@harperfast/harper 5.0.30 → 5.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1140) hide show
  1. package/README.md +11 -10
  2. package/agent/agent.ts +203 -0
  3. package/agent/loop.ts +205 -0
  4. package/agent/operations.ts +148 -0
  5. package/agent/session.ts +187 -0
  6. package/agent/tools/fsTools.ts +276 -0
  7. package/agent/tools/httpFetchTool.ts +112 -0
  8. package/agent/tools/scheduleTool.ts +68 -0
  9. package/agent/toolset.ts +43 -0
  10. package/agent/types.ts +85 -0
  11. package/bin/{BinObjects.js → BinObjects.ts} +4 -5
  12. package/bin/cliCredentials.ts +133 -0
  13. package/bin/cliOperations.ts +339 -0
  14. package/bin/copyDb.ts +10 -10
  15. package/bin/deployRenderer.ts +196 -0
  16. package/bin/{harper.js → harper.ts} +43 -19
  17. package/bin/{install.js → install.ts} +3 -3
  18. package/bin/lite.ts +2 -0
  19. package/bin/login.ts +134 -0
  20. package/bin/logout.ts +11 -0
  21. package/bin/mcp/client.ts +407 -0
  22. package/bin/mcp/doctor.ts +189 -0
  23. package/bin/mcp/index.ts +80 -0
  24. package/bin/mcp/options.ts +122 -0
  25. package/bin/mcp/printConfig.ts +89 -0
  26. package/bin/multipartBuilder.ts +74 -0
  27. package/bin/{restart.js → restart.ts} +27 -28
  28. package/bin/{run.js → run.ts} +41 -30
  29. package/bin/sseConsumer.ts +126 -0
  30. package/bin/{status.js → status.ts} +10 -10
  31. package/bin/{stop.js → stop.ts} +5 -5
  32. package/bin/upgrade.js +17 -24
  33. package/components/Application.ts +144 -18
  34. package/components/ApplicationScope.ts +2 -2
  35. package/components/ComponentV1.ts +2 -2
  36. package/components/EntryHandler.ts +159 -9
  37. package/components/OptionsWatcher.ts +75 -11
  38. package/components/Scope.ts +132 -18
  39. package/components/anthropic/index.ts +547 -0
  40. package/components/bedrock/index.ts +823 -0
  41. package/components/componentLoader.ts +64 -32
  42. package/components/deployLifecycle.ts +161 -0
  43. package/components/deploymentOperations.ts +173 -0
  44. package/components/deploymentRecorder.ts +427 -0
  45. package/components/deriveURLPath.ts +4 -4
  46. package/components/mcp/adapters/fastify.ts +87 -0
  47. package/components/mcp/adapters/harperHttp.ts +103 -0
  48. package/components/mcp/audit.ts +75 -0
  49. package/components/mcp/index.ts +134 -0
  50. package/components/mcp/jsonrpc.ts +134 -0
  51. package/components/mcp/lifecycle.ts +105 -0
  52. package/components/mcp/listChanged.ts +270 -0
  53. package/components/mcp/rateLimit.ts +217 -0
  54. package/components/mcp/resources.ts +607 -0
  55. package/components/mcp/session.ts +151 -0
  56. package/components/mcp/sessionRegistry.ts +140 -0
  57. package/components/mcp/toolRegistry.ts +294 -0
  58. package/components/mcp/tools/application.ts +761 -0
  59. package/components/mcp/tools/operations.ts +311 -0
  60. package/components/mcp/tools/schemas/derive.ts +356 -0
  61. package/components/mcp/tools/schemas/operationDescriptions.ts +241 -0
  62. package/components/mcp/tools/schemas/operations.ts +301 -0
  63. package/components/mcp/transport.ts +517 -0
  64. package/components/ollama/index.ts +316 -0
  65. package/components/openai/index.ts +563 -0
  66. package/components/operations.js +217 -60
  67. package/components/operationsValidation.js +12 -4
  68. package/components/packageComponent.ts +97 -29
  69. package/components/requestRestart.ts +17 -2
  70. package/components/status/crossThread.ts +14 -5
  71. package/components/status/errors.ts +1 -1
  72. package/config/RootConfigWatcher.ts +56 -2
  73. package/config/configUtils.js +29 -8
  74. package/config/harperConfigEnvVars.ts +1 -1
  75. package/config-root.schema.json +78 -4
  76. package/dataLayer/{CreateAttributeObject.js → CreateAttributeObject.ts} +4 -3
  77. package/dataLayer/{CreateTableObject.js → CreateTableObject.ts} +2 -1
  78. package/dataLayer/{DataLayerObjects.js → DataLayerObjects.ts} +17 -9
  79. package/dataLayer/{DeleteBeforeObject.js → DeleteBeforeObject.ts} +2 -1
  80. package/dataLayer/{DeleteObject.js → DeleteObject.ts} +3 -2
  81. package/dataLayer/{DropAttributeObject.js → DropAttributeObject.ts} +2 -1
  82. package/dataLayer/{GetBackupObject.js → GetBackupObject.ts} +3 -2
  83. package/dataLayer/{InsertObject.js → InsertObject.ts} +3 -2
  84. package/dataLayer/{ReadAuditLogObject.js → ReadAuditLogObject.ts} +3 -2
  85. package/dataLayer/{SQLSearch.js → SQLSearch.ts} +97 -43
  86. package/dataLayer/{SearchByConditionsObject.js → SearchByConditionsObject.ts} +5 -6
  87. package/dataLayer/{SearchByHashObject.js → SearchByHashObject.ts} +2 -1
  88. package/dataLayer/{SearchObject.js → SearchObject.ts} +2 -1
  89. package/dataLayer/{SqlSearchObject.js → SqlSearchObject.ts} +2 -1
  90. package/dataLayer/{UpdateObject.js → UpdateObject.ts} +3 -2
  91. package/dataLayer/{UpsertObject.js → UpsertObject.ts} +3 -2
  92. package/dataLayer/{bulkLoad.js → bulkLoad.ts} +40 -49
  93. package/dataLayer/{delete.js → delete.ts} +21 -26
  94. package/dataLayer/{export.js → export.ts} +22 -26
  95. package/dataLayer/{getBackup.js → getBackup.ts} +7 -9
  96. package/dataLayer/harperBridge/BridgeMethods.ts +102 -0
  97. package/dataLayer/harperBridge/ResourceBridge.ts +27 -26
  98. package/dataLayer/harperBridge/TableSizeObject.ts +1 -0
  99. package/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +4 -4
  100. package/dataLayer/harperBridge/{harperBridge.js → harperBridge.ts} +3 -3
  101. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +8 -6
  102. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +4 -4
  103. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +1 -1
  104. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +6 -4
  105. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +5 -4
  106. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +4 -4
  107. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +6 -5
  108. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +5 -4
  109. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +5 -5
  110. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +1 -1
  111. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +3 -3
  112. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +1 -1
  113. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +3 -2
  114. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +5 -5
  115. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +10 -8
  116. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +1 -1
  117. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +4 -3
  118. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +3 -3
  119. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +6 -5
  120. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +2 -1
  121. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +3 -2
  122. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +2 -2
  123. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +5 -4
  124. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +6 -3
  125. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.ts +1 -1
  126. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +4 -4
  127. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +5 -5
  128. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +4 -4
  129. package/dataLayer/{hdbInfoController.js → hdbInfoController.ts} +20 -26
  130. package/dataLayer/{insert.js → insert.ts} +24 -24
  131. package/dataLayer/{readAuditLog.js → readAuditLog.ts} +8 -10
  132. package/dataLayer/{schema.js → schema.ts} +32 -44
  133. package/dataLayer/{schemaDescribe.js → schemaDescribe.ts} +23 -26
  134. package/dataLayer/{search.js → search.ts} +9 -15
  135. package/dataLayer/{transaction.js → transaction.ts} +2 -5
  136. package/dataLayer/{update.js → update.ts} +19 -22
  137. package/dist/agent/agent.d.ts +35 -0
  138. package/dist/agent/agent.js +175 -0
  139. package/dist/agent/agent.js.map +1 -0
  140. package/dist/agent/loop.d.ts +34 -0
  141. package/dist/agent/loop.js +176 -0
  142. package/dist/agent/loop.js.map +1 -0
  143. package/dist/agent/operations.d.ts +17 -0
  144. package/dist/agent/operations.js +137 -0
  145. package/dist/agent/operations.js.map +1 -0
  146. package/dist/agent/session.d.ts +36 -0
  147. package/dist/agent/session.js +182 -0
  148. package/dist/agent/session.js.map +1 -0
  149. package/dist/agent/tools/fsTools.d.ts +19 -0
  150. package/dist/agent/tools/fsTools.js +286 -0
  151. package/dist/agent/tools/fsTools.js.map +1 -0
  152. package/dist/agent/tools/httpFetchTool.d.ts +9 -0
  153. package/dist/agent/tools/httpFetchTool.js +116 -0
  154. package/dist/agent/tools/httpFetchTool.js.map +1 -0
  155. package/dist/agent/tools/scheduleTool.d.ts +22 -0
  156. package/dist/agent/tools/scheduleTool.js +54 -0
  157. package/dist/agent/tools/scheduleTool.js.map +1 -0
  158. package/dist/agent/toolset.d.ts +24 -0
  159. package/dist/agent/toolset.js +33 -0
  160. package/dist/agent/toolset.js.map +1 -0
  161. package/dist/agent/types.d.ts +75 -0
  162. package/dist/agent/types.js +10 -0
  163. package/dist/agent/types.js.map +1 -0
  164. package/dist/bin/BinObjects.d.ts +2 -2
  165. package/dist/bin/BinObjects.js +6 -3
  166. package/dist/bin/BinObjects.js.map +1 -1
  167. package/dist/bin/cliCredentials.d.ts +27 -0
  168. package/dist/bin/cliCredentials.js +130 -0
  169. package/dist/bin/cliCredentials.js.map +1 -0
  170. package/dist/bin/cliOperations.d.ts +7 -7
  171. package/dist/bin/cliOperations.js +251 -37
  172. package/dist/bin/cliOperations.js.map +1 -1
  173. package/dist/bin/copyDb.js +16 -16
  174. package/dist/bin/copyDb.js.map +1 -1
  175. package/dist/bin/deployRenderer.d.ts +47 -0
  176. package/dist/bin/deployRenderer.js +185 -0
  177. package/dist/bin/deployRenderer.js.map +1 -0
  178. package/dist/bin/harper.d.ts +2 -1
  179. package/dist/bin/harper.js +87 -26
  180. package/dist/bin/harper.js.map +1 -1
  181. package/dist/bin/install.d.ts +1 -1
  182. package/dist/bin/install.js +41 -4
  183. package/dist/bin/install.js.map +1 -1
  184. package/dist/bin/lite.js +3 -4
  185. package/dist/bin/lite.js.map +1 -1
  186. package/dist/bin/login.d.ts +4 -0
  187. package/dist/bin/login.js +123 -0
  188. package/dist/bin/login.js.map +1 -0
  189. package/dist/bin/logout.d.ts +4 -0
  190. package/dist/bin/logout.js +16 -0
  191. package/dist/bin/logout.js.map +1 -0
  192. package/dist/bin/mcp/client.d.ts +34 -0
  193. package/dist/bin/mcp/client.js +395 -0
  194. package/dist/bin/mcp/client.js.map +1 -0
  195. package/dist/bin/mcp/doctor.d.ts +11 -0
  196. package/dist/bin/mcp/doctor.js +193 -0
  197. package/dist/bin/mcp/doctor.js.map +1 -0
  198. package/dist/bin/mcp/index.d.ts +10 -0
  199. package/dist/bin/mcp/index.js +81 -0
  200. package/dist/bin/mcp/index.js.map +1 -0
  201. package/dist/bin/mcp/options.d.ts +33 -0
  202. package/dist/bin/mcp/options.js +113 -0
  203. package/dist/bin/mcp/options.js.map +1 -0
  204. package/dist/bin/mcp/printConfig.d.ts +14 -0
  205. package/dist/bin/mcp/printConfig.js +85 -0
  206. package/dist/bin/mcp/printConfig.js.map +1 -0
  207. package/dist/bin/multipartBuilder.d.ts +26 -0
  208. package/dist/bin/multipartBuilder.js +55 -0
  209. package/dist/bin/multipartBuilder.js.map +1 -0
  210. package/dist/bin/restart.d.ts +3 -2
  211. package/dist/bin/restart.js +82 -45
  212. package/dist/bin/restart.js.map +1 -1
  213. package/dist/bin/run.d.ts +13 -9
  214. package/dist/bin/run.js +111 -65
  215. package/dist/bin/run.js.map +1 -1
  216. package/dist/bin/sseConsumer.d.ts +24 -0
  217. package/dist/bin/sseConsumer.js +127 -0
  218. package/dist/bin/sseConsumer.js.map +1 -0
  219. package/dist/bin/status.d.ts +1 -1
  220. package/dist/bin/status.js +48 -11
  221. package/dist/bin/status.js.map +1 -1
  222. package/dist/bin/stop.d.ts +1 -1
  223. package/dist/bin/stop.js +43 -6
  224. package/dist/bin/stop.js.map +1 -1
  225. package/dist/bin/upgrade.js +14 -22
  226. package/dist/bin/upgrade.js.map +1 -1
  227. package/dist/components/Application.d.ts +29 -17
  228. package/dist/components/Application.js +134 -28
  229. package/dist/components/Application.js.map +1 -1
  230. package/dist/components/ApplicationScope.js +2 -2
  231. package/dist/components/ComponentV1.d.ts +1 -1
  232. package/dist/components/ComponentV1.js +5 -5
  233. package/dist/components/ComponentV1.js.map +1 -1
  234. package/dist/components/EntryHandler.d.ts +26 -3
  235. package/dist/components/EntryHandler.js +153 -13
  236. package/dist/components/EntryHandler.js.map +1 -1
  237. package/dist/components/OptionsWatcher.d.ts +7 -2
  238. package/dist/components/OptionsWatcher.js +72 -10
  239. package/dist/components/OptionsWatcher.js.map +1 -1
  240. package/dist/components/Scope.d.ts +11 -6
  241. package/dist/components/Scope.js +112 -12
  242. package/dist/components/Scope.js.map +1 -1
  243. package/dist/components/anthropic/index.d.ts +40 -0
  244. package/dist/components/anthropic/index.js +428 -0
  245. package/dist/components/anthropic/index.js.map +1 -0
  246. package/dist/components/bedrock/index.d.ts +79 -0
  247. package/dist/components/bedrock/index.js +734 -0
  248. package/dist/components/bedrock/index.js.map +1 -0
  249. package/dist/components/componentLoader.d.ts +29 -0
  250. package/dist/components/componentLoader.js +65 -38
  251. package/dist/components/componentLoader.js.map +1 -1
  252. package/dist/components/deployLifecycle.d.ts +39 -0
  253. package/dist/components/deployLifecycle.js +156 -0
  254. package/dist/components/deployLifecycle.js.map +1 -0
  255. package/dist/components/deploymentOperations.d.ts +19 -0
  256. package/dist/components/deploymentOperations.js +185 -0
  257. package/dist/components/deploymentOperations.js.map +1 -0
  258. package/dist/components/deploymentRecorder.d.ts +97 -0
  259. package/dist/components/deploymentRecorder.js +425 -0
  260. package/dist/components/deploymentRecorder.js.map +1 -0
  261. package/dist/components/deriveURLPath.d.ts +2 -2
  262. package/dist/components/deriveURLPath.js +2 -2
  263. package/dist/components/deriveURLPath.js.map +1 -1
  264. package/dist/components/mcp/adapters/fastify.d.ts +35 -0
  265. package/dist/components/mcp/adapters/fastify.js +66 -0
  266. package/dist/components/mcp/adapters/fastify.js.map +1 -0
  267. package/dist/components/mcp/adapters/harperHttp.d.ts +38 -0
  268. package/dist/components/mcp/adapters/harperHttp.js +78 -0
  269. package/dist/components/mcp/adapters/harperHttp.js.map +1 -0
  270. package/dist/components/mcp/audit.d.ts +27 -0
  271. package/dist/components/mcp/audit.js +73 -0
  272. package/dist/components/mcp/audit.js.map +1 -0
  273. package/dist/components/mcp/index.d.ts +47 -0
  274. package/dist/components/mcp/index.js +109 -0
  275. package/dist/components/mcp/index.js.map +1 -0
  276. package/dist/components/mcp/jsonrpc.d.ts +71 -0
  277. package/dist/components/mcp/jsonrpc.js +93 -0
  278. package/dist/components/mcp/jsonrpc.js.map +1 -0
  279. package/dist/components/mcp/lifecycle.d.ts +69 -0
  280. package/dist/components/mcp/lifecycle.js +79 -0
  281. package/dist/components/mcp/lifecycle.js.map +1 -0
  282. package/dist/components/mcp/listChanged.d.ts +24 -0
  283. package/dist/components/mcp/listChanged.js +257 -0
  284. package/dist/components/mcp/listChanged.js.map +1 -0
  285. package/dist/components/mcp/rateLimit.d.ts +25 -0
  286. package/dist/components/mcp/rateLimit.js +226 -0
  287. package/dist/components/mcp/rateLimit.js.map +1 -0
  288. package/dist/components/mcp/resources.d.ts +90 -0
  289. package/dist/components/mcp/resources.js +526 -0
  290. package/dist/components/mcp/resources.js.map +1 -0
  291. package/dist/components/mcp/session.d.ts +36 -0
  292. package/dist/components/mcp/session.js +170 -0
  293. package/dist/components/mcp/session.js.map +1 -0
  294. package/dist/components/mcp/sessionRegistry.d.ts +63 -0
  295. package/dist/components/mcp/sessionRegistry.js +124 -0
  296. package/dist/components/mcp/sessionRegistry.js.map +1 -0
  297. package/dist/components/mcp/toolRegistry.d.ts +151 -0
  298. package/dist/components/mcp/toolRegistry.js +177 -0
  299. package/dist/components/mcp/toolRegistry.js.map +1 -0
  300. package/dist/components/mcp/tools/application.d.ts +72 -0
  301. package/dist/components/mcp/tools/application.js +660 -0
  302. package/dist/components/mcp/tools/application.js.map +1 -0
  303. package/dist/components/mcp/tools/operations.d.ts +23 -0
  304. package/dist/components/mcp/tools/operations.js +331 -0
  305. package/dist/components/mcp/tools/operations.js.map +1 -0
  306. package/dist/components/mcp/tools/schemas/derive.d.ts +50 -0
  307. package/dist/components/mcp/tools/schemas/derive.js +291 -0
  308. package/dist/components/mcp/tools/schemas/derive.js.map +1 -0
  309. package/dist/components/mcp/tools/schemas/operationDescriptions.d.ts +32 -0
  310. package/dist/components/mcp/tools/schemas/operationDescriptions.js +179 -0
  311. package/dist/components/mcp/tools/schemas/operationDescriptions.js.map +1 -0
  312. package/dist/components/mcp/tools/schemas/operations.d.ts +27 -0
  313. package/dist/components/mcp/tools/schemas/operations.js +299 -0
  314. package/dist/components/mcp/tools/schemas/operations.js.map +1 -0
  315. package/dist/components/mcp/transport.d.ts +38 -0
  316. package/dist/components/mcp/transport.js +467 -0
  317. package/dist/components/mcp/transport.js.map +1 -0
  318. package/dist/components/ollama/index.d.ts +46 -0
  319. package/dist/components/ollama/index.js +239 -0
  320. package/dist/components/ollama/index.js.map +1 -0
  321. package/dist/components/openai/index.d.ts +51 -0
  322. package/dist/components/openai/index.js +475 -0
  323. package/dist/components/openai/index.js.map +1 -0
  324. package/dist/components/operations.d.ts +6 -6
  325. package/dist/components/operations.js +205 -52
  326. package/dist/components/operations.js.map +1 -1
  327. package/dist/components/operationsValidation.d.ts +2 -2
  328. package/dist/components/operationsValidation.js +13 -4
  329. package/dist/components/operationsValidation.js.map +1 -1
  330. package/dist/components/packageComponent.d.ts +28 -6
  331. package/dist/components/packageComponent.js +87 -26
  332. package/dist/components/packageComponent.js.map +1 -1
  333. package/dist/components/requestRestart.d.ts +1 -0
  334. package/dist/components/requestRestart.js +12 -1
  335. package/dist/components/requestRestart.js.map +1 -1
  336. package/dist/components/status/crossThread.d.ts +5 -1
  337. package/dist/components/status/crossThread.js +12 -5
  338. package/dist/components/status/crossThread.js.map +1 -1
  339. package/dist/components/status/errors.js +7 -7
  340. package/dist/config/RootConfigWatcher.d.ts +3 -0
  341. package/dist/config/RootConfigWatcher.js +52 -1
  342. package/dist/config/RootConfigWatcher.js.map +1 -1
  343. package/dist/config/configUtils.js +31 -8
  344. package/dist/config/configUtils.js.map +1 -1
  345. package/dist/config/harperConfigEnvVars.js +1 -1
  346. package/dist/config/harperConfigEnvVars.js.map +1 -1
  347. package/dist/dataLayer/CreateAttributeObject.d.ts +3 -7
  348. package/dist/dataLayer/CreateAttributeObject.js +4 -3
  349. package/dist/dataLayer/CreateAttributeObject.js.map +1 -1
  350. package/dist/dataLayer/CreateTableObject.d.ts +2 -4
  351. package/dist/dataLayer/CreateTableObject.js +2 -1
  352. package/dist/dataLayer/CreateTableObject.js.map +1 -1
  353. package/dist/dataLayer/DataLayerObjects.d.ts +17 -16
  354. package/dist/dataLayer/DataLayerObjects.js +19 -5
  355. package/dist/dataLayer/DataLayerObjects.js.map +1 -1
  356. package/dist/dataLayer/DeleteBeforeObject.d.ts +3 -5
  357. package/dist/dataLayer/DeleteBeforeObject.js +2 -1
  358. package/dist/dataLayer/DeleteBeforeObject.js.map +1 -1
  359. package/dist/dataLayer/DeleteObject.d.ts +3 -7
  360. package/dist/dataLayer/DeleteObject.js +4 -3
  361. package/dist/dataLayer/DeleteObject.js.map +1 -1
  362. package/dist/dataLayer/DropAttributeObject.d.ts +2 -4
  363. package/dist/dataLayer/DropAttributeObject.js +2 -1
  364. package/dist/dataLayer/DropAttributeObject.js.map +1 -1
  365. package/dist/dataLayer/GetBackupObject.d.ts +3 -5
  366. package/dist/dataLayer/GetBackupObject.js +4 -3
  367. package/dist/dataLayer/GetBackupObject.js.map +1 -1
  368. package/dist/dataLayer/InsertObject.d.ts +3 -8
  369. package/dist/dataLayer/InsertObject.js +4 -3
  370. package/dist/dataLayer/InsertObject.js.map +1 -1
  371. package/dist/dataLayer/ReadAuditLogObject.d.ts +3 -7
  372. package/dist/dataLayer/ReadAuditLogObject.js +4 -3
  373. package/dist/dataLayer/ReadAuditLogObject.js.map +1 -1
  374. package/dist/dataLayer/SQLSearch.d.ts +68 -38
  375. package/dist/dataLayer/SQLSearch.js +140 -78
  376. package/dist/dataLayer/SQLSearch.js.map +1 -1
  377. package/dist/dataLayer/SearchByConditionsObject.d.ts +10 -58
  378. package/dist/dataLayer/SearchByConditionsObject.js +5 -7
  379. package/dist/dataLayer/SearchByConditionsObject.js.map +1 -1
  380. package/dist/dataLayer/SearchByHashObject.d.ts +3 -6
  381. package/dist/dataLayer/SearchByHashObject.js +2 -1
  382. package/dist/dataLayer/SearchByHashObject.js.map +1 -1
  383. package/dist/dataLayer/SearchObject.d.ts +3 -12
  384. package/dist/dataLayer/SearchObject.js +2 -1
  385. package/dist/dataLayer/SearchObject.js.map +1 -1
  386. package/dist/dataLayer/SqlSearchObject.d.ts +2 -4
  387. package/dist/dataLayer/SqlSearchObject.js +2 -1
  388. package/dist/dataLayer/SqlSearchObject.js.map +1 -1
  389. package/dist/dataLayer/UpdateObject.d.ts +3 -7
  390. package/dist/dataLayer/UpdateObject.js +4 -3
  391. package/dist/dataLayer/UpdateObject.js.map +1 -1
  392. package/dist/dataLayer/UpsertObject.d.ts +3 -7
  393. package/dist/dataLayer/UpsertObject.js +4 -3
  394. package/dist/dataLayer/UpsertObject.js.map +1 -1
  395. package/dist/dataLayer/bulkLoad.d.ts +4 -4
  396. package/dist/dataLayer/bulkLoad.js +122 -88
  397. package/dist/dataLayer/bulkLoad.js.map +1 -1
  398. package/dist/dataLayer/delete.d.ts +10 -11
  399. package/dist/dataLayer/delete.js +74 -39
  400. package/dist/dataLayer/delete.js.map +1 -1
  401. package/dist/dataLayer/export.d.ts +8 -8
  402. package/dist/dataLayer/export.js +90 -55
  403. package/dist/dataLayer/export.js.map +1 -1
  404. package/dist/dataLayer/getBackup.d.ts +4 -3
  405. package/dist/dataLayer/getBackup.js +43 -11
  406. package/dist/dataLayer/getBackup.js.map +1 -1
  407. package/dist/dataLayer/harperBridge/BridgeMethods.d.ts +39 -21
  408. package/dist/dataLayer/harperBridge/BridgeMethods.js +41 -20
  409. package/dist/dataLayer/harperBridge/BridgeMethods.js.map +1 -1
  410. package/dist/dataLayer/harperBridge/ResourceBridge.d.ts +2 -2
  411. package/dist/dataLayer/harperBridge/ResourceBridge.js +26 -25
  412. package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -1
  413. package/dist/dataLayer/harperBridge/TableSizeObject.d.ts +1 -0
  414. package/dist/dataLayer/harperBridge/TableSizeObject.js.map +1 -1
  415. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.d.ts +4 -4
  416. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +4 -4
  417. package/dist/dataLayer/harperBridge/harperBridge.d.ts +2 -3
  418. package/dist/dataLayer/harperBridge/harperBridge.js +38 -4
  419. package/dist/dataLayer/harperBridge/harperBridge.js.map +1 -1
  420. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.d.ts +1 -2
  421. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +7 -6
  422. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js.map +1 -1
  423. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.d.ts +1 -2
  424. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +4 -4
  425. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js.map +1 -1
  426. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +1 -1
  427. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js.map +1 -1
  428. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +5 -4
  429. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js.map +1 -1
  430. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.d.ts +1 -2
  431. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +4 -4
  432. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js.map +1 -1
  433. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +4 -4
  434. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.d.ts +1 -2
  435. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +5 -5
  436. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js.map +1 -1
  437. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +4 -4
  438. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js.map +1 -1
  439. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +5 -5
  440. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js.map +1 -1
  441. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +1 -1
  442. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +3 -3
  443. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +1 -1
  444. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +2 -2
  445. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js.map +1 -1
  446. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +5 -5
  447. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.d.ts +1 -2
  448. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +8 -8
  449. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js.map +1 -1
  450. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.d.ts +1 -1
  451. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +1 -1
  452. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.d.ts +1 -2
  453. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +3 -3
  454. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js.map +1 -1
  455. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +3 -3
  456. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.d.ts +1 -2
  457. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +5 -5
  458. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js.map +1 -1
  459. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.d.ts +1 -2
  460. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +1 -1
  461. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js.map +1 -1
  462. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +2 -2
  463. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js.map +1 -1
  464. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +2 -2
  465. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +4 -4
  466. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js.map +1 -1
  467. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.d.ts +1 -2
  468. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +5 -3
  469. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js.map +1 -1
  470. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js +2 -2
  471. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.d.ts +1 -2
  472. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +4 -4
  473. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js.map +1 -1
  474. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +5 -5
  475. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +4 -4
  476. package/dist/dataLayer/hdbInfoController.d.ts +4 -8
  477. package/dist/dataLayer/hdbInfoController.js +66 -31
  478. package/dist/dataLayer/hdbInfoController.js.map +1 -1
  479. package/dist/dataLayer/insert.d.ts +14 -26
  480. package/dist/dataLayer/insert.js +63 -28
  481. package/dist/dataLayer/insert.js.map +1 -1
  482. package/dist/dataLayer/readAuditLog.d.ts +1 -3
  483. package/dist/dataLayer/readAuditLog.js +45 -13
  484. package/dist/dataLayer/readAuditLog.js.map +1 -1
  485. package/dist/dataLayer/schema.d.ts +10 -10
  486. package/dist/dataLayer/schema.js +124 -89
  487. package/dist/dataLayer/schema.js.map +1 -1
  488. package/dist/dataLayer/schemaDescribe.d.ts +4 -4
  489. package/dist/dataLayer/schemaDescribe.js +78 -41
  490. package/dist/dataLayer/schemaDescribe.js.map +1 -1
  491. package/dist/dataLayer/search.d.ts +4 -4
  492. package/dist/dataLayer/search.js +12 -13
  493. package/dist/dataLayer/search.js.map +1 -1
  494. package/dist/dataLayer/transaction.d.ts +1 -1
  495. package/dist/dataLayer/transaction.js +3 -4
  496. package/dist/dataLayer/transaction.js.map +1 -1
  497. package/dist/dataLayer/update.d.ts +2 -8
  498. package/dist/dataLayer/update.js +53 -18
  499. package/dist/dataLayer/update.js.map +1 -1
  500. package/dist/globals.d.ts +1 -1
  501. package/dist/globals.js +1 -0
  502. package/dist/globals.js.map +1 -1
  503. package/dist/index.d.ts +4 -0
  504. package/dist/index.js +4 -1
  505. package/dist/index.js.map +1 -1
  506. package/dist/json/systemSchema.json +65 -0
  507. package/dist/launchServiceScripts/launchHarperDB.d.ts +1 -0
  508. package/dist/launchServiceScripts/launchHarperDB.js +3 -0
  509. package/dist/launchServiceScripts/launchHarperDB.js.map +1 -0
  510. package/dist/launchServiceScripts/utility/checkNodeVersion.js +3 -0
  511. package/dist/launchServiceScripts/utility/checkNodeVersion.js.map +1 -1
  512. package/dist/resources/DatabaseTransaction.d.ts +14 -6
  513. package/dist/resources/DatabaseTransaction.js +39 -15
  514. package/dist/resources/DatabaseTransaction.js.map +1 -1
  515. package/dist/resources/ErrorResource.d.ts +1 -1
  516. package/dist/resources/ErrorResource.js +3 -1
  517. package/dist/resources/ErrorResource.js.map +1 -1
  518. package/dist/resources/LMDBTransaction.d.ts +10 -13
  519. package/dist/resources/LMDBTransaction.js +18 -7
  520. package/dist/resources/LMDBTransaction.js.map +1 -1
  521. package/dist/resources/RecordEncoder.d.ts +10 -12
  522. package/dist/resources/RecordEncoder.js +38 -38
  523. package/dist/resources/RecordEncoder.js.map +1 -1
  524. package/dist/resources/RequestTarget.d.ts +1 -0
  525. package/dist/resources/RequestTarget.js.map +1 -1
  526. package/dist/resources/Resource.d.ts +25 -5
  527. package/dist/resources/Resource.js +43 -10
  528. package/dist/resources/Resource.js.map +1 -1
  529. package/dist/resources/ResourceInterface.d.ts +24 -5
  530. package/dist/resources/ResourceInterface.js +20 -0
  531. package/dist/resources/ResourceInterface.js.map +1 -1
  532. package/dist/resources/Resources.d.ts +3 -4
  533. package/dist/resources/Resources.js +7 -6
  534. package/dist/resources/Resources.js.map +1 -1
  535. package/dist/resources/RocksIndexStore.js +3 -0
  536. package/dist/resources/RocksIndexStore.js.map +1 -1
  537. package/dist/resources/RocksTransactionLogStore.d.ts +1 -1
  538. package/dist/resources/RocksTransactionLogStore.js +10 -3
  539. package/dist/resources/RocksTransactionLogStore.js.map +1 -1
  540. package/dist/resources/Table.d.ts +76 -329
  541. package/dist/resources/Table.js +306 -116
  542. package/dist/resources/Table.js.map +1 -1
  543. package/dist/resources/analytics/metadata.d.ts +1 -0
  544. package/dist/resources/analytics/metadata.js +1 -0
  545. package/dist/resources/analytics/metadata.js.map +1 -1
  546. package/dist/resources/analytics/read.d.ts +8 -1
  547. package/dist/resources/analytics/read.js +69 -8
  548. package/dist/resources/analytics/read.js.map +1 -1
  549. package/dist/resources/analytics/write.d.ts +28 -0
  550. package/dist/resources/analytics/write.js +232 -20
  551. package/dist/resources/analytics/write.js.map +1 -1
  552. package/dist/resources/auditStore.d.ts +18 -13
  553. package/dist/resources/auditStore.js +16 -8
  554. package/dist/resources/auditStore.js.map +1 -1
  555. package/dist/resources/blob.d.ts +16 -27
  556. package/dist/resources/blob.js +8 -8
  557. package/dist/resources/blob.js.map +1 -1
  558. package/dist/resources/dataLoader.d.ts +1 -1
  559. package/dist/resources/dataLoader.js +13 -13
  560. package/dist/resources/databases.d.ts +17 -0
  561. package/dist/resources/databases.js +175 -59
  562. package/dist/resources/databases.js.map +1 -1
  563. package/dist/resources/graphql.d.ts +1 -7
  564. package/dist/resources/graphql.js +267 -173
  565. package/dist/resources/graphql.js.map +1 -1
  566. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +17 -1
  567. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +327 -59
  568. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
  569. package/dist/resources/indexes/vector.d.ts +1 -0
  570. package/dist/resources/indexes/vector.js +14 -0
  571. package/dist/resources/indexes/vector.js.map +1 -1
  572. package/dist/resources/jsonSchemaTypes.d.ts +60 -0
  573. package/dist/resources/jsonSchemaTypes.js +78 -0
  574. package/dist/resources/jsonSchemaTypes.js.map +1 -0
  575. package/dist/resources/loadEnv.d.ts +2 -5
  576. package/dist/resources/loadEnv.js +21 -18
  577. package/dist/resources/loadEnv.js.map +1 -1
  578. package/dist/resources/login.d.ts +2 -3
  579. package/dist/resources/login.js +5 -4
  580. package/dist/resources/login.js.map +1 -1
  581. package/dist/resources/models/Models.d.ts +45 -0
  582. package/dist/resources/models/Models.js +265 -0
  583. package/dist/resources/models/Models.js.map +1 -0
  584. package/dist/resources/models/TestBackend.d.ts +15 -0
  585. package/dist/resources/models/TestBackend.js +71 -0
  586. package/dist/resources/models/TestBackend.js.map +1 -0
  587. package/dist/resources/models/agentLoop.d.ts +125 -0
  588. package/dist/resources/models/agentLoop.js +746 -0
  589. package/dist/resources/models/agentLoop.js.map +1 -0
  590. package/dist/resources/models/analyticsTable.d.ts +65 -0
  591. package/dist/resources/models/analyticsTable.js +166 -0
  592. package/dist/resources/models/analyticsTable.js.map +1 -0
  593. package/dist/resources/models/backendHelpers.d.ts +57 -0
  594. package/dist/resources/models/backendHelpers.js +109 -0
  595. package/dist/resources/models/backendHelpers.js.map +1 -0
  596. package/dist/resources/models/backendRegistry.d.ts +36 -0
  597. package/dist/resources/models/backendRegistry.js +54 -0
  598. package/dist/resources/models/backendRegistry.js.map +1 -0
  599. package/dist/resources/models/bootstrap.d.ts +24 -0
  600. package/dist/resources/models/bootstrap.js +112 -0
  601. package/dist/resources/models/bootstrap.js.map +1 -0
  602. package/dist/resources/models/embedHook.d.ts +33 -0
  603. package/dist/resources/models/embedHook.js +127 -0
  604. package/dist/resources/models/embedHook.js.map +1 -0
  605. package/dist/resources/models/types.d.ts +301 -0
  606. package/dist/resources/models/types.js +11 -0
  607. package/dist/resources/models/types.js.map +1 -0
  608. package/dist/resources/openApi.js +74 -34
  609. package/dist/resources/openApi.js.map +1 -1
  610. package/dist/resources/replayLogs.js +7 -1
  611. package/dist/resources/replayLogs.js.map +1 -1
  612. package/dist/resources/replayLogsGuards.d.ts +9 -0
  613. package/dist/resources/replayLogsGuards.js +47 -0
  614. package/dist/resources/replayLogsGuards.js.map +1 -1
  615. package/dist/resources/roles.d.ts +1 -7
  616. package/dist/resources/roles.js +67 -71
  617. package/dist/resources/roles.js.map +1 -1
  618. package/dist/resources/search.d.ts +18 -1
  619. package/dist/resources/search.js +349 -140
  620. package/dist/resources/search.js.map +1 -1
  621. package/dist/resources/tracked.d.ts +1 -1
  622. package/dist/resources/tracked.js +23 -15
  623. package/dist/resources/tracked.js.map +1 -1
  624. package/dist/resources/transaction.d.ts +1 -1
  625. package/dist/resources/transaction.js +1 -1
  626. package/dist/resources/transaction.js.map +1 -1
  627. package/dist/resources/transactionBroadcast.d.ts +1 -1
  628. package/dist/resources/transactionBroadcast.js.map +1 -1
  629. package/dist/security/auth.d.ts +1 -5
  630. package/dist/security/auth.js +34 -25
  631. package/dist/security/auth.js.map +1 -1
  632. package/dist/security/certificateVerification/crlVerification.js +7 -1
  633. package/dist/security/certificateVerification/crlVerification.js.map +1 -1
  634. package/dist/security/cryptoHash.d.ts +2 -2
  635. package/dist/security/cryptoHash.js +37 -5
  636. package/dist/security/cryptoHash.js.map +1 -1
  637. package/dist/security/data_objects/PermissionAttributeResponseObject.d.ts +3 -4
  638. package/dist/security/data_objects/PermissionAttributeResponseObject.js +4 -1
  639. package/dist/security/data_objects/PermissionAttributeResponseObject.js.map +1 -1
  640. package/dist/security/data_objects/PermissionResponseObject.d.ts +9 -9
  641. package/dist/security/data_objects/PermissionResponseObject.js +15 -8
  642. package/dist/security/data_objects/PermissionResponseObject.js.map +1 -1
  643. package/dist/security/data_objects/PermissionTableResponseObject.d.ts +5 -6
  644. package/dist/security/data_objects/PermissionTableResponseObject.js +6 -1
  645. package/dist/security/data_objects/PermissionTableResponseObject.js.map +1 -1
  646. package/dist/security/fastifyAuth.d.ts +2 -2
  647. package/dist/security/fastifyAuth.js +131 -22
  648. package/dist/security/fastifyAuth.js.map +1 -1
  649. package/dist/security/impersonation.js +15 -15
  650. package/dist/security/jsLoader.js +18 -5
  651. package/dist/security/jsLoader.js.map +1 -1
  652. package/dist/security/keys.d.ts +45 -48
  653. package/dist/security/keys.js +160 -114
  654. package/dist/security/keys.js.map +1 -1
  655. package/dist/security/permissionsTranslator.js +2 -2
  656. package/dist/security/role.d.ts +5 -5
  657. package/dist/security/role.js +70 -35
  658. package/dist/security/role.js.map +1 -1
  659. package/dist/security/tokenAuthentication.d.ts +13 -0
  660. package/dist/security/tokenAuthentication.js +57 -27
  661. package/dist/security/tokenAuthentication.js.map +1 -1
  662. package/dist/security/user.js +74 -38
  663. package/dist/security/user.js.map +1 -1
  664. package/dist/server/DurableSubscriptionsSession.d.ts +4 -2
  665. package/dist/server/DurableSubscriptionsSession.js +71 -55
  666. package/dist/server/DurableSubscriptionsSession.js.map +1 -1
  667. package/dist/server/REST.d.ts +1 -8
  668. package/dist/server/REST.js +17 -16
  669. package/dist/server/REST.js.map +1 -1
  670. package/dist/server/Server.d.ts +23 -4
  671. package/dist/server/Server.js +1 -1
  672. package/dist/server/Server.js.map +1 -1
  673. package/dist/server/fastifyRoutes/helpers/getCORSOptions.js +1 -1
  674. package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +1 -1
  675. package/dist/server/fastifyRoutes/helpers/getServerOptions.js +1 -1
  676. package/dist/server/fastifyRoutes.d.ts +1 -4
  677. package/dist/server/fastifyRoutes.js +34 -30
  678. package/dist/server/fastifyRoutes.js.map +1 -1
  679. package/dist/server/graphqlQuerying.d.ts +1 -1
  680. package/dist/server/graphqlQuerying.js +8 -7
  681. package/dist/server/graphqlQuerying.js.map +1 -1
  682. package/dist/server/http.d.ts +9 -4
  683. package/dist/server/http.js +523 -47
  684. package/dist/server/http.js.map +1 -1
  685. package/dist/server/itc/serverHandlers.js +66 -15
  686. package/dist/server/itc/serverHandlers.js.map +1 -1
  687. package/dist/server/jobs/JobObject.d.ts +3 -3
  688. package/dist/server/jobs/JobObject.js +53 -7
  689. package/dist/server/jobs/JobObject.js.map +1 -1
  690. package/dist/server/jobs/jobProcess.js +64 -24
  691. package/dist/server/jobs/jobProcess.js.map +1 -1
  692. package/dist/server/jobs/jobRunner.d.ts +7 -6
  693. package/dist/server/jobs/jobRunner.js +68 -30
  694. package/dist/server/jobs/jobRunner.js.map +1 -1
  695. package/dist/server/jobs/jobs.d.ts +18 -7
  696. package/dist/server/jobs/jobs.js +93 -61
  697. package/dist/server/jobs/jobs.js.map +1 -1
  698. package/dist/server/loadRootComponents.js +1 -1
  699. package/dist/server/middlewareChain.d.ts +80 -0
  700. package/dist/server/middlewareChain.js +252 -0
  701. package/dist/server/middlewareChain.js.map +1 -0
  702. package/dist/server/mqtt.d.ts +1 -8
  703. package/dist/server/mqtt.js +22 -17
  704. package/dist/server/mqtt.js.map +1 -1
  705. package/dist/server/nodeName.js +46 -13
  706. package/dist/server/nodeName.js.map +1 -1
  707. package/dist/server/operationsServer.d.ts +2 -2
  708. package/dist/server/operationsServer.js +106 -33
  709. package/dist/server/operationsServer.js.map +1 -1
  710. package/dist/server/serverHelpers/Headers.d.ts +4 -4
  711. package/dist/server/serverHelpers/Headers.js +2 -0
  712. package/dist/server/serverHelpers/Headers.js.map +1 -1
  713. package/dist/server/serverHelpers/JSONStream.d.ts +7 -1
  714. package/dist/server/serverHelpers/JSONStream.js +12 -3
  715. package/dist/server/serverHelpers/JSONStream.js.map +1 -1
  716. package/dist/server/serverHelpers/Request.d.ts +106 -8
  717. package/dist/server/serverHelpers/Request.js +370 -9
  718. package/dist/server/serverHelpers/Request.js.map +1 -1
  719. package/dist/server/serverHelpers/contentTypes.d.ts +1 -1
  720. package/dist/server/serverHelpers/contentTypes.js +36 -7
  721. package/dist/server/serverHelpers/contentTypes.js.map +1 -1
  722. package/dist/server/serverHelpers/multipartParser.d.ts +21 -0
  723. package/dist/server/serverHelpers/multipartParser.js +142 -0
  724. package/dist/server/serverHelpers/multipartParser.js.map +1 -0
  725. package/dist/server/serverHelpers/progressEmitter.d.ts +25 -0
  726. package/dist/server/serverHelpers/progressEmitter.js +103 -0
  727. package/dist/server/serverHelpers/progressEmitter.js.map +1 -0
  728. package/dist/server/serverHelpers/serverHandlers.d.ts +1 -1
  729. package/dist/server/serverHelpers/serverHandlers.js +38 -7
  730. package/dist/server/serverHelpers/serverHandlers.js.map +1 -1
  731. package/dist/server/serverHelpers/serverUtilities.d.ts +4 -2
  732. package/dist/server/serverHelpers/serverUtilities.js +97 -93
  733. package/dist/server/serverHelpers/serverUtilities.js.map +1 -1
  734. package/dist/server/static.js +8 -5
  735. package/dist/server/static.js.map +1 -1
  736. package/dist/server/status/index.js +3 -3
  737. package/dist/server/storageReclamation.d.ts +10 -0
  738. package/dist/server/storageReclamation.js +68 -9
  739. package/dist/server/storageReclamation.js.map +1 -1
  740. package/dist/server/threads/itc.js +7 -4
  741. package/dist/server/threads/itc.js.map +1 -1
  742. package/dist/server/threads/manageThreads.d.ts +1 -1
  743. package/dist/server/threads/manageThreads.js +110 -26
  744. package/dist/server/threads/manageThreads.js.map +1 -1
  745. package/dist/server/threads/socketRouter.d.ts +0 -1
  746. package/dist/server/threads/socketRouter.js +8 -271
  747. package/dist/server/threads/socketRouter.js.map +1 -1
  748. package/dist/server/threads/threadServer.d.ts +1 -0
  749. package/dist/server/threads/threadServer.js +360 -118
  750. package/dist/server/threads/threadServer.js.map +1 -1
  751. package/dist/server/threads/workerProcessGuard.d.ts +42 -0
  752. package/dist/server/threads/workerProcessGuard.js +114 -0
  753. package/dist/server/threads/workerProcessGuard.js.map +1 -0
  754. package/dist/server/throttle.js +17 -0
  755. package/dist/server/throttle.js.map +1 -1
  756. package/dist/sqlTranslator/SelectValidator.d.ts +21 -24
  757. package/dist/sqlTranslator/SelectValidator.js +86 -47
  758. package/dist/sqlTranslator/SelectValidator.js.map +1 -1
  759. package/dist/sqlTranslator/alasqlFunctionImporter.d.ts +6 -2
  760. package/dist/sqlTranslator/alasqlFunctionImporter.js +40 -3
  761. package/dist/sqlTranslator/alasqlFunctionImporter.js.map +1 -1
  762. package/dist/sqlTranslator/deleteTranslator.d.ts +4 -7
  763. package/dist/sqlTranslator/deleteTranslator.js +48 -14
  764. package/dist/sqlTranslator/deleteTranslator.js.map +1 -1
  765. package/dist/sqlTranslator/index.d.ts +10 -9
  766. package/dist/sqlTranslator/index.js +69 -30
  767. package/dist/sqlTranslator/index.js.map +1 -1
  768. package/dist/sqlTranslator/sql_statement_bucket.d.ts +10 -10
  769. package/dist/sqlTranslator/sql_statement_bucket.js +55 -13
  770. package/dist/sqlTranslator/sql_statement_bucket.js.map +1 -1
  771. package/dist/upgrade/UpgradeObjects.d.ts +2 -3
  772. package/dist/upgrade/UpgradeObjects.js +37 -4
  773. package/dist/upgrade/UpgradeObjects.js.map +1 -1
  774. package/dist/upgrade/directives/5-1-0.d.ts +6 -0
  775. package/dist/upgrade/directives/5-1-0.js +114 -0
  776. package/dist/upgrade/directives/5-1-0.js.map +1 -0
  777. package/dist/upgrade/directives/directivesController.d.ts +10 -10
  778. package/dist/upgrade/directives/directivesController.js +52 -11
  779. package/dist/upgrade/directives/directivesController.js.map +1 -1
  780. package/dist/upgrade/directivesManager.d.ts +1 -1
  781. package/dist/upgrade/directivesManager.js +53 -18
  782. package/dist/upgrade/directivesManager.js.map +1 -1
  783. package/dist/upgrade/upgradePrompt.d.ts +2 -8
  784. package/dist/upgrade/upgradePrompt.js +55 -60
  785. package/dist/upgrade/upgradePrompt.js.map +1 -1
  786. package/dist/upgrade/upgradeUtilities.d.ts +1 -1
  787. package/dist/upgrade/upgradeUtilities.js +37 -5
  788. package/dist/upgrade/upgradeUtilities.js.map +1 -1
  789. package/dist/utility/OperationFunctionCaller.d.ts +1 -1
  790. package/dist/utility/OperationFunctionCaller.js +45 -10
  791. package/dist/utility/OperationFunctionCaller.js.map +1 -1
  792. package/dist/utility/assignCmdEnvVariables.d.ts +1 -2
  793. package/dist/utility/assignCmdEnvVariables.js +8 -4
  794. package/dist/utility/assignCmdEnvVariables.js.map +1 -1
  795. package/dist/utility/common_utils.d.ts +80 -77
  796. package/dist/utility/common_utils.js +140 -79
  797. package/dist/utility/common_utils.js.map +1 -1
  798. package/dist/utility/environment/environmentManager.d.ts +12 -11
  799. package/dist/utility/environment/environmentManager.js +75 -29
  800. package/dist/utility/environment/environmentManager.js.map +1 -1
  801. package/dist/utility/environment/systemInformation.d.ts +4 -0
  802. package/dist/utility/environment/systemInformation.js +27 -16
  803. package/dist/utility/environment/systemInformation.js.map +1 -1
  804. package/dist/utility/errors/commonErrors.d.ts +192 -168
  805. package/dist/utility/errors/commonErrors.js +49 -18
  806. package/dist/utility/errors/commonErrors.js.map +1 -1
  807. package/dist/utility/errors/hdbError.d.ts +37 -51
  808. package/dist/utility/errors/hdbError.js +65 -26
  809. package/dist/utility/errors/hdbError.js.map +1 -1
  810. package/dist/utility/expandEnvVar.d.ts +61 -0
  811. package/dist/utility/expandEnvVar.js +113 -0
  812. package/dist/utility/expandEnvVar.js.map +1 -0
  813. package/dist/utility/functions/geo.js +2 -2
  814. package/dist/utility/functions/sql/alaSQLExtension.js +1 -1
  815. package/dist/utility/globalSchema.d.ts +13 -4
  816. package/dist/utility/globalSchema.js +14 -11
  817. package/dist/utility/globalSchema.js.map +1 -1
  818. package/dist/utility/hdbTerms.d.ts +54 -1
  819. package/dist/utility/hdbTerms.js +54 -1
  820. package/dist/utility/hdbTerms.js.map +1 -1
  821. package/dist/utility/install/checkJWTTokensExist.js +1 -1
  822. package/dist/utility/install/installer.d.ts +9 -12
  823. package/dist/utility/install/installer.js +117 -54
  824. package/dist/utility/install/installer.js.map +1 -1
  825. package/dist/utility/installation.js +3 -3
  826. package/dist/utility/lmdb/DBIDefinition.d.ts +4 -4
  827. package/dist/utility/lmdb/DBIDefinition.js +5 -1
  828. package/dist/utility/lmdb/DBIDefinition.js.map +1 -1
  829. package/dist/utility/lmdb/DeleteRecordsResponseObject.d.ts +3 -6
  830. package/dist/utility/lmdb/DeleteRecordsResponseObject.js +2 -1
  831. package/dist/utility/lmdb/DeleteRecordsResponseObject.js.map +1 -1
  832. package/dist/utility/lmdb/InsertRecordsResponseObject.d.ts +3 -5
  833. package/dist/utility/lmdb/InsertRecordsResponseObject.js +2 -1
  834. package/dist/utility/lmdb/InsertRecordsResponseObject.js.map +1 -1
  835. package/dist/utility/lmdb/OpenDBIObject.d.ts +12 -15
  836. package/dist/utility/lmdb/OpenDBIObject.js +68 -6
  837. package/dist/utility/lmdb/OpenDBIObject.js.map +1 -1
  838. package/dist/utility/lmdb/OpenEnvironmentObject.d.ts +5 -8
  839. package/dist/utility/lmdb/OpenEnvironmentObject.js +52 -4
  840. package/dist/utility/lmdb/OpenEnvironmentObject.js.map +1 -1
  841. package/dist/utility/lmdb/UpdateRecordsResponseObject.d.ts +3 -6
  842. package/dist/utility/lmdb/UpdateRecordsResponseObject.js +2 -1
  843. package/dist/utility/lmdb/UpdateRecordsResponseObject.js.map +1 -1
  844. package/dist/utility/lmdb/UpsertRecordsResponseObject.d.ts +3 -5
  845. package/dist/utility/lmdb/UpsertRecordsResponseObject.js +2 -1
  846. package/dist/utility/lmdb/UpsertRecordsResponseObject.js.map +1 -1
  847. package/dist/utility/lmdb/cleanLMDBMap.d.ts +1 -1
  848. package/dist/utility/lmdb/cleanLMDBMap.js +44 -7
  849. package/dist/utility/lmdb/cleanLMDBMap.js.map +1 -1
  850. package/dist/utility/lmdb/commonUtility.d.ts +8 -9
  851. package/dist/utility/lmdb/commonUtility.js +46 -17
  852. package/dist/utility/lmdb/commonUtility.js.map +1 -1
  853. package/dist/utility/lmdb/deleteUtility.d.ts +2 -3
  854. package/dist/utility/lmdb/deleteUtility.js +51 -16
  855. package/dist/utility/lmdb/deleteUtility.js.map +1 -1
  856. package/dist/utility/lmdb/environmentUtility.d.ts +69 -36
  857. package/dist/utility/lmdb/environmentUtility.js +91 -51
  858. package/dist/utility/lmdb/environmentUtility.js.map +1 -1
  859. package/dist/utility/lmdb/searchCursorFunctions.d.ts +19 -19
  860. package/dist/utility/lmdb/searchCursorFunctions.js +46 -14
  861. package/dist/utility/lmdb/searchCursorFunctions.js.map +1 -1
  862. package/dist/utility/lmdb/searchUtility.d.ts +142 -73
  863. package/dist/utility/lmdb/searchUtility.js +91 -55
  864. package/dist/utility/lmdb/searchUtility.js.map +1 -1
  865. package/dist/utility/lmdb/terms.d.ts +34 -34
  866. package/dist/utility/lmdb/terms.js +12 -22
  867. package/dist/utility/lmdb/terms.js.map +1 -1
  868. package/dist/utility/lmdb/writeUtility.d.ts +3 -6
  869. package/dist/utility/lmdb/writeUtility.js +61 -28
  870. package/dist/utility/lmdb/writeUtility.js.map +1 -1
  871. package/dist/utility/logging/harper_logger.d.ts +87 -103
  872. package/dist/utility/logging/harper_logger.js +177 -82
  873. package/dist/utility/logging/harper_logger.js.map +1 -1
  874. package/dist/utility/logging/logRotator.d.ts +2 -10
  875. package/dist/utility/logging/logRotator.js +67 -32
  876. package/dist/utility/logging/logRotator.js.map +1 -1
  877. package/dist/utility/logging/logger.js +4 -4
  878. package/dist/utility/logging/readLog.d.ts +1 -1
  879. package/dist/utility/logging/readLog.js +54 -17
  880. package/dist/utility/logging/readLog.js.map +1 -1
  881. package/dist/utility/logging/transactionLog.d.ts +2 -2
  882. package/dist/utility/logging/transactionLog.js +51 -16
  883. package/dist/utility/logging/transactionLog.js.map +1 -1
  884. package/dist/utility/mount_hdb.d.ts +1 -2
  885. package/dist/utility/mount_hdb.js +54 -17
  886. package/dist/utility/mount_hdb.js.map +1 -1
  887. package/dist/utility/npmUtilities.d.ts +1 -1
  888. package/dist/utility/npmUtilities.js +54 -19
  889. package/dist/utility/npmUtilities.js.map +1 -1
  890. package/dist/utility/operation_authorization.d.ts +36 -9
  891. package/dist/utility/operation_authorization.js +135 -86
  892. package/dist/utility/operation_authorization.js.map +1 -1
  893. package/dist/utility/packageUtils.d.ts +0 -2
  894. package/dist/utility/packageUtils.js +7 -17
  895. package/dist/utility/packageUtils.js.map +1 -1
  896. package/dist/utility/password.js +2 -2
  897. package/dist/utility/processManagement/processManagement.js +2 -2
  898. package/dist/utility/processManagement/servicesConfig.js +1 -1
  899. package/dist/utility/signalling.d.ts +2 -2
  900. package/dist/utility/signalling.js +51 -16
  901. package/dist/utility/signalling.js.map +1 -1
  902. package/dist/utility/watcherFallback.d.ts +36 -0
  903. package/dist/utility/watcherFallback.js +73 -0
  904. package/dist/utility/watcherFallback.js.map +1 -0
  905. package/dist/validation/analyticsValidator.d.ts +1 -0
  906. package/dist/validation/analyticsValidator.js +80 -0
  907. package/dist/validation/analyticsValidator.js.map +1 -0
  908. package/dist/validation/bulkDeleteValidator.d.ts +1 -2
  909. package/dist/validation/bulkDeleteValidator.js +49 -11
  910. package/dist/validation/bulkDeleteValidator.js.map +1 -1
  911. package/dist/validation/check_permissions.d.ts +1 -2
  912. package/dist/validation/check_permissions.js +38 -3
  913. package/dist/validation/check_permissions.js.map +1 -1
  914. package/dist/validation/common_validators.d.ts +20 -20
  915. package/dist/validation/common_validators.js +62 -31
  916. package/dist/validation/common_validators.js.map +1 -1
  917. package/dist/validation/configValidator.d.ts +4 -4
  918. package/dist/validation/configValidator.js +189 -54
  919. package/dist/validation/configValidator.js.map +1 -1
  920. package/dist/validation/deleteValidator.d.ts +1 -2
  921. package/dist/validation/deleteValidator.js +49 -11
  922. package/dist/validation/deleteValidator.js.map +1 -1
  923. package/dist/validation/fileLoadValidator.d.ts +4 -4
  924. package/dist/validation/fileLoadValidator.js +67 -32
  925. package/dist/validation/fileLoadValidator.js.map +1 -1
  926. package/dist/validation/insertValidator.d.ts +1 -2
  927. package/dist/validation/insertValidator.js +48 -10
  928. package/dist/validation/insertValidator.js.map +1 -1
  929. package/dist/validation/installValidator.d.ts +2 -2
  930. package/dist/validation/installValidator.js +47 -10
  931. package/dist/validation/installValidator.js.map +1 -1
  932. package/dist/validation/readLogValidator.d.ts +1 -2
  933. package/dist/validation/readLogValidator.js +60 -22
  934. package/dist/validation/readLogValidator.js.map +1 -1
  935. package/dist/validation/role_validation.d.ts +3 -3
  936. package/dist/validation/role_validation.js +55 -19
  937. package/dist/validation/role_validation.js.map +1 -1
  938. package/dist/validation/schemaMetadataValidator.d.ts +3 -4
  939. package/dist/validation/schemaMetadataValidator.js +11 -12
  940. package/dist/validation/schemaMetadataValidator.js.map +1 -1
  941. package/dist/validation/searchValidator.d.ts +1 -2
  942. package/dist/validation/searchValidator.js +82 -43
  943. package/dist/validation/searchValidator.js.map +1 -1
  944. package/dist/validation/statusValidator.d.ts +1 -1
  945. package/dist/validation/transactionLogValidator.d.ts +3 -3
  946. package/dist/validation/transactionLogValidator.js +52 -17
  947. package/dist/validation/transactionLogValidator.js.map +1 -1
  948. package/dist/validation/user_validation.d.ts +3 -3
  949. package/dist/validation/user_validation.js +38 -6
  950. package/dist/validation/user_validation.js.map +1 -1
  951. package/dist/validation/validationWrapper.d.ts +3 -3
  952. package/dist/validation/validationWrapper.js +4 -5
  953. package/dist/validation/validationWrapper.js.map +1 -1
  954. package/index.ts +5 -0
  955. package/json/systemSchema.json +65 -0
  956. package/launchServiceScripts/utility/checkNodeVersion.js +2 -0
  957. package/package.json +38 -24
  958. package/resources/DESIGN.md +98 -0
  959. package/resources/DatabaseTransaction.ts +58 -30
  960. package/resources/ErrorResource.ts +2 -1
  961. package/resources/LMDBTransaction.ts +38 -29
  962. package/resources/RecordEncoder.ts +41 -39
  963. package/resources/RequestTarget.ts +2 -0
  964. package/resources/Resource.ts +96 -56
  965. package/resources/ResourceInterface.ts +44 -21
  966. package/resources/Resources.ts +8 -8
  967. package/resources/RocksIndexStore.ts +3 -0
  968. package/resources/RocksTransactionLogStore.ts +13 -4
  969. package/resources/Table.ts +440 -223
  970. package/resources/analytics/metadata.ts +1 -0
  971. package/resources/analytics/read.ts +99 -10
  972. package/resources/analytics/write.ts +240 -17
  973. package/resources/auditStore.ts +30 -19
  974. package/resources/blob.ts +53 -53
  975. package/resources/dataLoader.ts +4 -4
  976. package/resources/databases.ts +208 -74
  977. package/resources/graphql.ts +267 -165
  978. package/resources/indexes/HierarchicalNavigableSmallWorld.ts +310 -65
  979. package/resources/indexes/vector.ts +17 -0
  980. package/resources/jsonSchemaTypes.ts +102 -0
  981. package/resources/loadEnv.ts +21 -17
  982. package/resources/login.ts +5 -3
  983. package/resources/models/Models.ts +304 -0
  984. package/resources/models/TestBackend.ts +83 -0
  985. package/resources/models/agentLoop.ts +895 -0
  986. package/resources/models/analyticsTable.ts +199 -0
  987. package/resources/models/backendHelpers.ts +116 -0
  988. package/resources/models/backendRegistry.ts +66 -0
  989. package/resources/models/bootstrap.ts +135 -0
  990. package/resources/models/embedHook.ts +138 -0
  991. package/resources/models/types.ts +296 -0
  992. package/resources/openApi.ts +65 -31
  993. package/resources/replayLogs.ts +20 -9
  994. package/resources/replayLogsGuards.ts +45 -0
  995. package/resources/roles.ts +62 -67
  996. package/resources/search.ts +355 -135
  997. package/resources/tracked.ts +18 -9
  998. package/resources/transaction.ts +8 -8
  999. package/resources/transactionBroadcast.ts +3 -3
  1000. package/schema.graphql +7 -0
  1001. package/security/auth.ts +35 -26
  1002. package/security/certificateVerification/crlVerification.ts +11 -4
  1003. package/security/{cryptoHash.js → cryptoHash.ts} +3 -8
  1004. package/security/data_objects/{PermissionAttributeResponseObject.js → PermissionAttributeResponseObject.ts} +4 -4
  1005. package/security/data_objects/{PermissionResponseObject.js → PermissionResponseObject.ts} +12 -11
  1006. package/security/data_objects/{PermissionTableResponseObject.js → PermissionTableResponseObject.ts} +6 -4
  1007. package/security/{fastifyAuth.js → fastifyAuth.ts} +93 -20
  1008. package/security/impersonation.ts +3 -3
  1009. package/security/jsLoader.ts +22 -8
  1010. package/security/{keys.js → keys.ts} +113 -121
  1011. package/security/permissionsTranslator.js +2 -2
  1012. package/security/{role.js → role.ts} +26 -33
  1013. package/security/tokenAuthentication.ts +34 -7
  1014. package/security/user.ts +26 -22
  1015. package/server/DESIGN.md +139 -0
  1016. package/server/DurableSubscriptionsSession.ts +67 -50
  1017. package/server/REST.ts +120 -107
  1018. package/server/Server.ts +31 -12
  1019. package/server/fastifyRoutes/helpers/getCORSOptions.js +1 -1
  1020. package/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +1 -1
  1021. package/server/fastifyRoutes/helpers/getServerOptions.js +1 -1
  1022. package/server/fastifyRoutes.ts +37 -33
  1023. package/server/graphqlQuerying.ts +6 -5
  1024. package/server/http.ts +517 -26
  1025. package/server/itc/serverHandlers.js +75 -14
  1026. package/server/jobs/{JobObject.js → JobObject.ts} +13 -6
  1027. package/server/jobs/{jobProcess.js → jobProcess.ts} +20 -16
  1028. package/server/jobs/{jobRunner.js → jobRunner.ts} +20 -21
  1029. package/server/jobs/{jobs.js → jobs.ts} +41 -44
  1030. package/server/loadRootComponents.js +1 -1
  1031. package/server/middlewareChain.ts +270 -0
  1032. package/server/mqtt.ts +35 -26
  1033. package/server/nodeName.ts +3 -1
  1034. package/server/operationsServer.ts +85 -10
  1035. package/server/serverHelpers/Headers.ts +10 -8
  1036. package/server/serverHelpers/JSONStream.ts +15 -5
  1037. package/server/serverHelpers/Request.ts +370 -13
  1038. package/server/serverHelpers/contentTypes.ts +42 -11
  1039. package/server/serverHelpers/multipartParser.ts +152 -0
  1040. package/server/serverHelpers/progressEmitter.ts +110 -0
  1041. package/server/serverHelpers/serverHandlers.js +43 -7
  1042. package/server/serverHelpers/serverUtilities.ts +40 -30
  1043. package/server/static.ts +9 -6
  1044. package/server/status/index.ts +2 -2
  1045. package/server/storageReclamation.ts +39 -2
  1046. package/server/threads/itc.js +7 -4
  1047. package/server/threads/manageThreads.js +100 -26
  1048. package/server/threads/socketRouter.ts +12 -275
  1049. package/server/threads/threadServer.js +345 -105
  1050. package/server/threads/workerProcessGuard.ts +93 -0
  1051. package/server/throttle.ts +18 -0
  1052. package/sqlTranslator/{SelectValidator.js → SelectValidator.ts} +41 -49
  1053. package/sqlTranslator/{alasqlFunctionImporter.js → alasqlFunctionImporter.ts} +5 -5
  1054. package/sqlTranslator/{deleteTranslator.js → deleteTranslator.ts} +13 -18
  1055. package/sqlTranslator/{index.js → index.ts} +30 -33
  1056. package/sqlTranslator/{sql_statement_bucket.js → sql_statement_bucket.ts} +49 -20
  1057. package/static/README.md +10 -9
  1058. package/static/defaultConfig.yaml +0 -1
  1059. package/studio/web/assets/{index-CybLScHg.js → index-Dqr9oVhe.js} +5 -5
  1060. package/studio/web/assets/index-Dqr9oVhe.js.map +1 -0
  1061. package/studio/web/assets/{index.lazy-DKx5-iXF.js → index.lazy-CpKcKb7M.js} +2 -2
  1062. package/studio/web/assets/{index.lazy-DKx5-iXF.js.map → index.lazy-CpKcKb7M.js.map} +1 -1
  1063. package/studio/web/assets/{profile-BOjes0Wl.js → profile-C1cujdsg.js} +2 -2
  1064. package/studio/web/assets/{profile-BOjes0Wl.js.map → profile-C1cujdsg.js.map} +1 -1
  1065. package/studio/web/assets/{status-EWKUIrjT.js → status-CTiIIQlY.js} +2 -2
  1066. package/studio/web/assets/{status-EWKUIrjT.js.map → status-CTiIIQlY.js.map} +1 -1
  1067. package/studio/web/index.html +1 -1
  1068. package/upgrade/{UpgradeObjects.js → UpgradeObjects.ts} +3 -6
  1069. package/upgrade/directives/5-1-0.ts +89 -0
  1070. package/upgrade/directives/{directivesController.js → directivesController.ts} +16 -16
  1071. package/upgrade/{directivesManager.js → directivesManager.ts} +7 -11
  1072. package/upgrade/{upgradePrompt.js → upgradePrompt.ts} +6 -54
  1073. package/upgrade/{upgradeUtilities.js → upgradeUtilities.ts} +3 -7
  1074. package/utility/{OperationFunctionCaller.js → OperationFunctionCaller.ts} +7 -7
  1075. package/utility/{assignCmdEnvVariables.js → assignCmdEnvVariables.ts} +6 -8
  1076. package/utility/{common_utils.js → common_utils.ts} +113 -139
  1077. package/utility/environment/{environmentManager.js → environmentManager.ts} +34 -33
  1078. package/utility/environment/systemInformation.ts +18 -4
  1079. package/utility/errors/{commonErrors.js → commonErrors.ts} +9 -9
  1080. package/utility/errors/{hdbError.js → hdbError.ts} +39 -45
  1081. package/utility/expandEnvVar.ts +110 -0
  1082. package/utility/functions/geo.js +2 -2
  1083. package/utility/functions/sql/alaSQLExtension.js +1 -1
  1084. package/utility/globalSchema.ts +30 -0
  1085. package/utility/hdbTerms.ts +54 -1
  1086. package/utility/install/checkJWTTokensExist.js +1 -1
  1087. package/utility/install/{installer.js → installer.ts} +66 -42
  1088. package/utility/installation.ts +2 -2
  1089. package/utility/lmdb/{DBIDefinition.js → DBIDefinition.ts} +4 -1
  1090. package/utility/lmdb/{DeleteRecordsResponseObject.js → DeleteRecordsResponseObject.ts} +2 -1
  1091. package/utility/lmdb/{InsertRecordsResponseObject.js → InsertRecordsResponseObject.ts} +2 -1
  1092. package/utility/lmdb/OpenDBIObject.ts +57 -0
  1093. package/utility/lmdb/{OpenEnvironmentObject.js → OpenEnvironmentObject.ts} +19 -6
  1094. package/utility/lmdb/{UpdateRecordsResponseObject.js → UpdateRecordsResponseObject.ts} +2 -1
  1095. package/utility/lmdb/{UpsertRecordsResponseObject.js → UpsertRecordsResponseObject.ts} +2 -1
  1096. package/utility/lmdb/{cleanLMDBMap.js → cleanLMDBMap.ts} +5 -5
  1097. package/utility/lmdb/{commonUtility.js → commonUtility.ts} +13 -21
  1098. package/utility/lmdb/{deleteUtility.js → deleteUtility.ts} +8 -12
  1099. package/utility/lmdb/{environmentUtility.js → environmentUtility.ts} +43 -52
  1100. package/utility/lmdb/{searchCursorFunctions.js → searchCursorFunctions.ts} +12 -26
  1101. package/utility/lmdb/{searchUtility.js → searchUtility.ts} +75 -64
  1102. package/utility/lmdb/{terms.js → terms.ts} +10 -23
  1103. package/utility/lmdb/{writeUtility.js → writeUtility.ts} +37 -22
  1104. package/utility/logging/{harper_logger.js → harper_logger.ts} +137 -90
  1105. package/utility/logging/{logRotator.js → logRotator.ts} +15 -18
  1106. package/utility/logging/logger.ts +1 -1
  1107. package/utility/logging/{readLog.js → readLog.ts} +19 -19
  1108. package/utility/logging/{transactionLog.js → transactionLog.ts} +10 -14
  1109. package/utility/{mount_hdb.js → mount_hdb.ts} +15 -16
  1110. package/utility/{npmUtilities.js → npmUtilities.ts} +14 -17
  1111. package/utility/{operation_authorization.js → operation_authorization.ts} +173 -124
  1112. package/utility/packageUtils.js +7 -16
  1113. package/utility/password.ts +1 -1
  1114. package/utility/processManagement/processManagement.js +2 -2
  1115. package/utility/processManagement/servicesConfig.js +1 -1
  1116. package/utility/{signalling.js → signalling.ts} +6 -11
  1117. package/utility/watcherFallback.ts +74 -0
  1118. package/validation/analyticsValidator.ts +44 -0
  1119. package/validation/{bulkDeleteValidator.js → bulkDeleteValidator.ts} +5 -5
  1120. package/validation/{check_permissions.js → check_permissions.ts} +3 -3
  1121. package/validation/{common_validators.js → common_validators.ts} +12 -24
  1122. package/validation/{configValidator.js → configValidator.ts} +114 -18
  1123. package/validation/{deleteValidator.js → deleteValidator.ts} +5 -5
  1124. package/validation/{fileLoadValidator.js → fileLoadValidator.ts} +12 -19
  1125. package/validation/{insertValidator.js → insertValidator.ts} +5 -5
  1126. package/validation/{installValidator.js → installValidator.ts} +8 -8
  1127. package/validation/{readLogValidator.js → readLogValidator.ts} +10 -10
  1128. package/validation/{role_validation.js → role_validation.ts} +26 -32
  1129. package/validation/{schemaMetadataValidator.js → schemaMetadataValidator.ts} +5 -11
  1130. package/validation/{searchValidator.js → searchValidator.ts} +12 -11
  1131. package/validation/statusValidator.ts +1 -1
  1132. package/validation/{transactionLogValidator.js → transactionLogValidator.ts} +4 -9
  1133. package/validation/{user_validation.js → user_validation.ts} +4 -10
  1134. package/validation/{validationWrapper.js → validationWrapper.ts} +3 -9
  1135. package/bin/cliOperations.js +0 -159
  1136. package/bin/lite.js +0 -5
  1137. package/dataLayer/harperBridge/BridgeMethods.js +0 -85
  1138. package/studio/web/assets/index-CybLScHg.js.map +0 -1
  1139. package/utility/globalSchema.js +0 -35
  1140. package/utility/lmdb/OpenDBIObject.js +0 -31
@@ -1,5 +1,5 @@
1
- import { ClientError, ServerError, Violation } from '../utility/errors/hdbError.js';
2
- import { OVERFLOW_MARKER, MAX_SEARCH_KEY_LENGTH, SEARCH_TYPES } from '../utility/lmdb/terms.js';
1
+ import { ClientError, ServerError, Violation } from '../utility/errors/hdbError.ts';
2
+ import { OVERFLOW_MARKER, MAX_SEARCH_KEY_LENGTH, SEARCH_TYPES } from '../utility/lmdb/terms.ts';
3
3
  import { compareKeys, MAXIMUM_KEY } from 'ordered-binary';
4
4
  import { SKIP } from '@harperfast/extended-iterable';
5
5
  import { INVALIDATED, EVICTED } from './Table.ts';
@@ -14,6 +14,16 @@ const OPEN_RANGE_ESTIMATE = 0.3;
14
14
  const BETWEEN_ESTIMATE = 0.1;
15
15
  const STARTS_WITH_ESTIMATE = 0.05;
16
16
 
17
+ // Synthetic Table-like object used to recurse through plain JSON nested-path
18
+ // segments. It has no attributes, indices, or property resolvers, so the
19
+ // recursive filterByType call dispatches purely on the comparator.
20
+ const NESTED_PATH_TABLE = Object.freeze({
21
+ attributes: [],
22
+ indices: {},
23
+ primaryKey: null,
24
+ propertyResolvers: null,
25
+ });
26
+
17
27
  const SYMBOL_OPERATORS = {
18
28
  // these are coercing operators
19
29
  '<': 'lt',
@@ -127,20 +137,21 @@ export function searchByIndex(
127
137
  reverse: boolean,
128
138
  Table: any,
129
139
  allowFullScan?: boolean,
130
- filtered?: boolean,
140
+ filtered?: any,
131
141
  context?: any
132
142
  ): AsyncIterable<Id | { key: Id; value: any }> {
133
143
  let attribute_name = searchCondition[0] ?? searchCondition.attribute;
134
144
  let value = searchCondition[1] ?? searchCondition.value;
135
145
  const comparator = searchCondition.comparator;
136
- if (value === undefined && comparator !== 'sort') {
146
+ if (value === undefined && (comparator as any) !== 'sort') {
137
147
  throw new ClientError(`Search condition for ${attribute_name} must have a value`);
138
148
  }
149
+ let needFullScan;
139
150
  if (Array.isArray(attribute_name)) {
140
151
  const firstAttributeName = attribute_name[0];
141
152
  // get the potential relationship attribute
142
153
  const attribute = findAttribute(Table.attributes, firstAttributeName);
143
- if (attribute.relationship) {
154
+ if (attribute?.relationship) {
144
155
  // it is a join/relational query
145
156
  if (attribute_name.length < 2)
146
157
  throw new ClientError(
@@ -154,6 +165,7 @@ export function searchByIndex(
154
165
  attribute: attribute_name.length > 2 ? attribute_name.slice(1) : attribute_name[1],
155
166
  value,
156
167
  comparator,
168
+ negated: searchCondition.negated,
157
169
  },
158
170
  transaction,
159
171
  reverse,
@@ -186,14 +198,17 @@ export function searchByIndex(
186
198
  results = joinFrom(results, attribute, relatedTable.primaryStore, joined, searchEntry);
187
199
  } else {
188
200
  // many-to-one relationship, need to flatten the ids that point back to potentially many instances of this
189
- results = results.flatMap(searchEntry);
201
+ results = (results as any).flatMap(searchEntry);
190
202
  }
191
203
  }
192
204
  return results;
193
205
  } else if (attribute_name.length === 1) {
194
206
  attribute_name = attribute_name[0];
195
207
  } else {
196
- throw new ClientError('Unable to query by attribute ' + JSON.stringify(attribute_name));
208
+ // Non-relationship nested path (plain JSON path). Phase 1: filter-only
209
+ // we don't have an index for the nested path, so fall through to a full
210
+ // scan with `filterByType` walking the path on each record.
211
+ needFullScan = true;
197
212
  }
198
213
  }
199
214
  const isPrimaryKey = attribute_name === Table.primaryKey || attribute_name == null;
@@ -201,72 +216,86 @@ export function searchByIndex(
201
216
  let start;
202
217
  let end, inclusiveEnd, exclusiveStart;
203
218
  if (value instanceof Date) value = value.getTime();
204
- let needFullScan;
205
- switch (ALTERNATE_COMPARATOR_NAMES[comparator] || comparator) {
206
- case 'lt':
207
- start = true;
208
- end = value;
209
- break;
210
- case 'le':
211
- start = true;
212
- end = value;
213
- inclusiveEnd = true;
214
- break;
215
- case 'gt':
216
- start = value;
217
- exclusiveStart = true;
218
- break;
219
- case 'ge':
220
- start = value;
221
- break;
222
- case 'prefix': // this is form finding multi-part keys that start with the provided prefix
223
- // this search needs to be of the form:
224
- // start: [prefix, null], end: [prefix, MAXIMUM_KEY]
225
- if (!Array.isArray(value)) value = [value, null];
226
- else if (value[value.length - 1] != null) value = value.concat(null);
227
- start = value;
228
- end = value.slice(0);
229
- end[end.length - 1] = MAXIMUM_KEY;
230
- break;
231
- case 'starts_with':
232
- start = value.toString();
233
- end = value + String.fromCharCode(0xffff);
234
- break;
235
- case 'between':
236
- case 'gele':
237
- case 'gelt':
238
- case 'gtlt':
239
- case 'gtle':
240
- start = value[0];
241
- if (start instanceof Date) start = start.getTime();
242
- end = value[1];
243
- if (end instanceof Date) end = end.getTime();
244
- inclusiveEnd = comparator === 'gele' || comparator === 'gtle' || comparator === 'between';
245
- exclusiveStart = comparator === 'gtlt' || comparator === 'gtle';
246
- break;
247
- case 'equals':
248
- case undefined:
249
- start = value;
250
- end = value;
251
- inclusiveEnd = true;
252
- break;
253
- case 'ne':
254
- if (value === null) {
255
- // since null is the lowest value in an index, we can treat anything higher as a non-null
219
+ if (searchCondition.negated) {
220
+ // Negated conditions are filter-only in Phase 1: scan the whole index/table
221
+ // and exclude matching rows in the filter. Without overriding the range,
222
+ // the bounded index iteration would only visit *included* rows.
223
+ start = true;
224
+ needFullScan = true;
225
+ } else
226
+ switch (ALTERNATE_COMPARATOR_NAMES[comparator] || comparator) {
227
+ case 'lt':
228
+ start = true;
229
+ end = value;
230
+ break;
231
+ case 'le':
232
+ start = true;
233
+ end = value;
234
+ inclusiveEnd = true;
235
+ break;
236
+ case 'gt':
256
237
  start = value;
257
238
  exclusiveStart = true;
258
239
  break;
259
- }
260
- case 'sort': // this is a special case for when we want to get all records for sorting
261
- case 'contains':
262
- case 'ends_with':
263
- // we have to revert to full table scan here
264
- start = true;
265
- needFullScan = true;
266
- break;
267
- default:
268
- throw new ClientError(`Unknown query comparator "${comparator}"`);
269
- }
240
+ case 'ge':
241
+ start = value;
242
+ break;
243
+ case 'prefix': // this is form finding multi-part keys that start with the provided prefix
244
+ // this search needs to be of the form:
245
+ // start: [prefix, null], end: [prefix, MAXIMUM_KEY]
246
+ if (!Array.isArray(value)) value = [value, null];
247
+ else if (value[value.length - 1] != null) value = value.concat(null);
248
+ start = value;
249
+ end = value.slice(0);
250
+ end[end.length - 1] = MAXIMUM_KEY;
251
+ break;
252
+ case 'starts_with':
253
+ start = value.toString();
254
+ end = value + String.fromCharCode(0xffff);
255
+ break;
256
+ case 'between':
257
+ case 'gele':
258
+ case 'gelt':
259
+ case 'gtlt':
260
+ case 'gtle':
261
+ start = value[0];
262
+ if (start instanceof Date) start = start.getTime();
263
+ end = value[1];
264
+ if (end instanceof Date) end = end.getTime();
265
+ inclusiveEnd =
266
+ (comparator as any) === 'gele' || (comparator as any) === 'gtle' || (comparator as any) === 'between';
267
+ exclusiveStart = (comparator as any) === 'gtlt' || (comparator as any) === 'gtle';
268
+ break;
269
+ case 'equals':
270
+ case undefined:
271
+ start = value;
272
+ end = value;
273
+ inclusiveEnd = true;
274
+ break;
275
+ case 'in':
276
+ // Phase 1: route through filter — index-merge optimization is a Phase 2 follow-up.
277
+ // `value` is expected to be an array (empty array matches no rows).
278
+ if (!Array.isArray(value)) throw new ClientError(`"in" comparator requires an array value`);
279
+ start = true;
280
+ needFullScan = true;
281
+ break;
282
+ case 'ne':
283
+ if (value === null) {
284
+ // since null is the lowest value in an index, we can treat anything higher as a non-null
285
+ start = value;
286
+ exclusiveStart = true;
287
+ break;
288
+ }
289
+ case 'sort': // this is a special case for when we want to get all records for sorting
290
+ case 'contains':
291
+ case 'ends_with':
292
+ // we have to revert to full table scan here
293
+ start = true;
294
+ needFullScan = true;
295
+ break;
296
+ default:
297
+ throw new ClientError(`Unknown query comparator "${comparator}"`);
298
+ }
270
299
  let filter;
271
300
  if (typeof start === 'string' && start.length > MAX_SEARCH_KEY_LENGTH) {
272
301
  // if the key is too long, we need to truncate it and filter the results
@@ -288,7 +317,11 @@ export function searchByIndex(
288
317
  exclusiveStart = !inclusiveEnd;
289
318
  inclusiveEnd = newEnd;
290
319
  }
291
- if (!index || index.isIndexing || needFullScan || (value === null && !index.indexNulls)) {
320
+ // For negated conditions we need to consider records whose attribute value is
321
+ // missing from the index (e.g. nulls when the index doesn't index nulls), so
322
+ // we bypass the secondary index and iterate over the primary store.
323
+ const skipIndex = searchCondition.negated && index && !isPrimaryKey;
324
+ if (!index || index.isIndexing || needFullScan || (value === null && !index.indexNulls) || skipIndex) {
292
325
  // no indexed searching available, need a full scan
293
326
  if (allowFullScan === false && !index)
294
327
  throw new ClientError(`"${attribute_name}" is not indexed, can not search for this attribute`, 404);
@@ -352,9 +385,9 @@ export function searchByIndex(
352
385
  );
353
386
  results.hasEntries = true;
354
387
  return results;
355
- } else if (index) {
388
+ } else if (index && !skipIndex) {
356
389
  if (index.customIndex) {
357
- return index.customIndex.search(searchCondition, context).map((entry) => {
390
+ const loaded = index.customIndex.search(searchCondition, context).map((entry) => {
358
391
  // if the custom index returns an entry with metadata, merge it with the loaded entry
359
392
  if (typeof entry === 'object' && entry) {
360
393
  const { key, ...otherProps } = entry;
@@ -369,6 +402,26 @@ export function searchByIndex(
369
402
  }
370
403
  return entry;
371
404
  });
405
+ // Rerank: a quantized index navigates on approximate distances, so for a nearest-neighbor
406
+ // (sort) query, recompute the exact distance from each loaded record's full-precision vector
407
+ // and re-sort — restoring exact ordering and $distance. (lt/le threshold queries still use the
408
+ // index's approximate distance for now; exact threshold filtering needs over-fetch — follow-up.)
409
+ if (
410
+ index.customIndex.int8 &&
411
+ index.customIndex.exactDistance &&
412
+ (comparator as any) === 'sort' &&
413
+ (searchCondition as any).target &&
414
+ typeof attribute_name === 'string'
415
+ ) {
416
+ const rescored = (loaded as any[]).filter((e) => e !== SKIP && e && e.value);
417
+ for (const e of rescored)
418
+ e.distance = index.customIndex.exactDistance(searchCondition, e.value[attribute_name]);
419
+ // comparison-based (not subtraction) so Infinity sentinels for missing vectors
420
+ // sort last without producing NaN (Infinity - Infinity).
421
+ rescored.sort((a, b) => (a.distance === b.distance ? 0 : a.distance < b.distance ? -1 : 1));
422
+ return rescored as any;
423
+ }
424
+ return loaded;
372
425
  }
373
426
  return index.getRange(rangeOptions).map(
374
427
  filter
@@ -451,7 +504,7 @@ function joinTo(rightIterable, attribute, store, isManyToMany, joined: Map<any,
451
504
  return new rightIterable.constructor({
452
505
  [Symbol.iterator]() {
453
506
  let joinedIterator;
454
- joined.hasMappings = true;
507
+ (joined as any).hasMappings = true;
455
508
  return {
456
509
  next() {
457
510
  if (!joinedIterator) {
@@ -467,7 +520,7 @@ function joinTo(rightIterable, attribute, store, isManyToMany, joined: Map<any,
467
520
  const record = entry.value ?? store.getSync(entry.key ?? entry);
468
521
  const leftKey = record?.[rightProperty];
469
522
  if (leftKey == null) continue;
470
- if (joined.filters?.some((filter) => !filter(record))) continue;
523
+ if ((joined as any).filters?.some((filter) => !filter(record))) continue;
471
524
  if (isManyToMany) {
472
525
  for (let i = 0; i < leftKey.length; i++) {
473
526
  addEntry(leftKey[i], entry);
@@ -535,17 +588,17 @@ function joinFrom(rightIterable, attribute, store, joined: Map<any, any[]>, sear
535
588
  const ids = new Set();
536
589
  // Define the fromRecord function so that we can use it to filter the related records
537
590
  // that are in the select(), to only those that are in this set of ids
538
- joined.fromRecord = (record) => {
591
+ (joined as any).fromRecord = (record) => {
539
592
  // TODO: Sort based on order ids
540
593
  return record[attribute.relationship.from]?.filter?.((id) => ids.has(id));
541
594
  };
542
595
  //let i = 0;
543
596
  // get all the ids of the related records
544
597
  for (const id of rightIterable) {
545
- if (joined.filters) {
598
+ if ((joined as any).filters) {
546
599
  // if additional filters are defined, we need to check them
547
600
  const record = store.getSync(id);
548
- if (joined.filters.some((filter) => !filter(record))) continue;
601
+ if ((joined as any).filters.some((filter) => !filter(record))) continue;
549
602
  }
550
603
  ids.add(id);
551
604
  // TODO: Re-enable this when async iteration is used, and do so with manually iterating so that we don't need to do an await on every iteration
@@ -601,6 +654,7 @@ const ALTERNATE_COMPARATOR_NAMES = {
601
654
  'ew': 'ends_with',
602
655
  'endsWith': 'ends_with',
603
656
  'ct': 'contains',
657
+ 'includes': 'in',
604
658
  '>': 'gt',
605
659
  '>=': 'ge',
606
660
  '<': 'lt',
@@ -608,6 +662,55 @@ const ALTERNATE_COMPARATOR_NAMES = {
608
662
  '...': 'between',
609
663
  };
610
664
 
665
+ // Comparators whose value is a list (array) of values. Used to recognize the
666
+ // REST `(v1,v2,...)` value syntax during parsing.
667
+ const LIST_VALUE_COMPARATORS = new Set(['in', 'between']);
668
+
669
+ // Base comparators that accept the `not_` prefix to produce a negated form.
670
+ // `not_equal` is an existing alias for `ne` and keeps its existing semantics.
671
+ const NEGATABLE_BASE_COMPARATORS = new Set(['in', 'between', 'starts_with', 'ends_with', 'contains', 'equals']);
672
+
673
+ /**
674
+ * Resolve a comparator name to a (possibly stripped) base comparator and a
675
+ * `negated` flag. Existing aliases are preserved as-is — the execution layer
676
+ * resolves them via `ALTERNATE_COMPARATOR_NAMES`. Only the `not_` prefix is
677
+ * stripped here, and only when the base is a recognized negatable comparator
678
+ * and the full name is not itself an existing alias (so `not_equal` keeps its
679
+ * historical mapping to `ne`).
680
+ */
681
+ export function resolveComparator(comparator: string | undefined): {
682
+ comparator: string | undefined;
683
+ negated: boolean;
684
+ } {
685
+ if (comparator == null) return { comparator, negated: false };
686
+ // Preserve existing aliases (e.g., `not_equal` -> `ne`) — let execution-time
687
+ // alias resolution handle them so we don't change comparator strings stored
688
+ // on the condition object.
689
+ if (ALTERNATE_COMPARATOR_NAMES[comparator]) return { comparator, negated: false };
690
+ if (typeof comparator === 'string' && comparator.startsWith('not_')) {
691
+ const base = comparator.slice(4);
692
+ const baseResolved = ALTERNATE_COMPARATOR_NAMES[base] || base;
693
+ if (NEGATABLE_BASE_COMPARATORS.has(baseResolved)) {
694
+ return { comparator: base, negated: true };
695
+ }
696
+ }
697
+ return { comparator, negated: false };
698
+ }
699
+
700
+ /**
701
+ * Walk a nested-property path on a record. Returns the value at the path,
702
+ * or undefined if any intermediate property is missing.
703
+ */
704
+ export function getNestedValue(record: any, path: string | string[]): any {
705
+ if (typeof path === 'string') return record?.[path];
706
+ let current = record;
707
+ for (let i = 0; i < path.length; i++) {
708
+ if (current == null) return undefined;
709
+ current = current[path[i]];
710
+ }
711
+ return current;
712
+ }
713
+
611
714
  /**
612
715
  * Create a filter based on the search condition that can be used to test each supplied record.
613
716
  * @param {SearchObject} searchCondition
@@ -615,6 +718,7 @@ const ALTERNATE_COMPARATOR_NAMES = {
615
718
  */
616
719
  export function filterByType(searchCondition, Table, context, filtered, isPrimaryKey?, estimatedIncomingCount?) {
617
720
  const comparator = searchCondition.comparator;
721
+ const negated = searchCondition.negated;
618
722
  let attribute = searchCondition[0] ?? searchCondition.attribute;
619
723
  let value = searchCondition[1] ?? searchCondition.value;
620
724
  if (Array.isArray(attribute)) {
@@ -622,9 +726,29 @@ export function filterByType(searchCondition, Table, context, filtered, isPrimar
622
726
  if (attribute.length === 1) attribute = attribute[0];
623
727
  else if (attribute.length > 1) {
624
728
  const firstAttributeName = attribute[0];
625
- // get the relationship attribute
626
- const firstAttribute = findAttribute(Table.attributes, firstAttributeName);
627
- const relatedTable = firstAttribute.definition?.tableClass || firstAttribute.elements.definition?.tableClass;
729
+ // get the relationship attribute (may be undefined for plain JSON paths)
730
+ const firstAttribute = findAttribute(Table?.attributes, firstAttributeName);
731
+ const relatedTable = firstAttribute?.definition?.tableClass || firstAttribute?.elements?.definition?.tableClass;
732
+ if (!relatedTable) {
733
+ // Plain JSON nested path — walk the path on each record. Array
734
+ // intermediates use `some` semantics (match if any element matches).
735
+ const restAttribute = attribute.length > 2 ? attribute.slice(1) : attribute[1];
736
+ const leafFilter = filterByType(
737
+ { attribute: restAttribute, value, comparator, negated },
738
+ NESTED_PATH_TABLE,
739
+ context,
740
+ null,
741
+ false,
742
+ estimatedIncomingCount
743
+ );
744
+ if (!leafFilter) return;
745
+ return function nestedRecordFilter(record, entry) {
746
+ const subObject = record?.[firstAttributeName];
747
+ if (subObject == null) return leafFilter(undefined, entry);
748
+ if (Array.isArray(subObject)) return subObject.some((item) => leafFilter(item, entry));
749
+ return leafFilter(subObject, entry);
750
+ };
751
+ }
628
752
  // TODO: If this is a relationship, we can potentially make this more efficient by using the index
629
753
  // and retrieving the set of matching ids first
630
754
  const filterMap = filtered?.[firstAttributeName];
@@ -633,6 +757,7 @@ export function filterByType(searchCondition, Table, context, filtered, isPrimar
633
757
  attribute: attribute.length > 2 ? attribute.slice(1) : attribute[1],
634
758
  value,
635
759
  comparator,
760
+ negated,
636
761
  },
637
762
  relatedTable,
638
763
  context,
@@ -647,7 +772,7 @@ export function filterByType(searchCondition, Table, context, filtered, isPrimar
647
772
  return;
648
773
  }
649
774
  const resolver = Table.propertyResolvers?.[firstAttributeName];
650
- if (resolver.to) nextFilter.to = resolver.to;
775
+ if (resolver?.to) nextFilter.to = resolver.to;
651
776
  let subIdFilter;
652
777
  const getSubObject = (record, entry) => {
653
778
  let subObject, subEntry;
@@ -690,7 +815,7 @@ export function filterByType(searchCondition, Table, context, filtered, isPrimar
690
815
  subIdFilter = attributeComparator(resolver.from ?? Table.primaryKey, nextFilter.idFilter, false, true);
691
816
  }
692
817
  const matches = subIdFilter(record);
693
- if (subIdFilter.idFilter) recordFilter.idFilter = subIdFilter.idFilter;
818
+ if ((subIdFilter as any).idFilter) (recordFilter as any).idFilter = (subIdFilter as any).idFilter;
694
819
  return matches;
695
820
  }
696
821
  }
@@ -703,7 +828,7 @@ export function filterByType(searchCondition, Table, context, filtered, isPrimar
703
828
  filtered[firstAttributeName] = {
704
829
  fromRecord(record) {
705
830
  // this is called when selecting the fields to include in results
706
- const value = getSubObject(record).subObject;
831
+ const value = getSubObject(record, undefined).subObject;
707
832
  if (Array.isArray(value)) return value.filter(nextFilter).map((value) => value[relatedTable.primaryKey]);
708
833
  return value;
709
834
  },
@@ -716,24 +841,29 @@ export function filterByType(searchCondition, Table, context, filtered, isPrimar
716
841
  }
717
842
  if (value instanceof Date) value = value.getTime();
718
843
 
844
+ let baseFilter;
719
845
  switch (ALTERNATE_COMPARATOR_NAMES[comparator] || comparator) {
720
846
  case SEARCH_TYPES.EQUALS:
721
847
  case undefined:
722
- return attributeComparator(attribute, (recordValue) => recordValue === value, true);
848
+ baseFilter = attributeComparator(attribute, (recordValue) => recordValue === value, true);
849
+ break;
723
850
  case 'contains':
724
- return attributeComparator(attribute, (recordValue) => recordValue?.toString().includes(value));
851
+ baseFilter = attributeComparator(attribute, (recordValue) => recordValue?.toString().includes(value));
852
+ break;
725
853
  case 'ends_with':
726
- return attributeComparator(attribute, (recordValue) => recordValue?.toString().endsWith(value));
854
+ baseFilter = attributeComparator(attribute, (recordValue) => recordValue?.toString().endsWith(value));
855
+ break;
727
856
  case 'starts_with':
728
- return attributeComparator(
857
+ baseFilter = attributeComparator(
729
858
  attribute,
730
859
  (recordValue) => typeof recordValue === 'string' && recordValue.startsWith(value),
731
860
  true
732
861
  );
862
+ break;
733
863
  case 'prefix':
734
864
  if (!Array.isArray(value)) value = [value];
735
865
  else if (value[value.length - 1] == null) value = value.slice(0, -1);
736
- return attributeComparator(
866
+ baseFilter = attributeComparator(
737
867
  attribute,
738
868
  (recordValue) => {
739
869
  if (!Array.isArray(recordValue)) return false;
@@ -744,31 +874,68 @@ export function filterByType(searchCondition, Table, context, filtered, isPrimar
744
874
  },
745
875
  true
746
876
  );
877
+ break;
747
878
  case 'between':
879
+ case 'gele':
880
+ case 'gtlt':
881
+ case 'gtle':
882
+ case 'gelt': {
748
883
  if (value[0] instanceof Date) value[0] = value[0].getTime();
749
884
  if (value[1] instanceof Date) value[1] = value[1].getTime();
750
- return attributeComparator(
885
+ const resolvedComparator = ALTERNATE_COMPARATOR_NAMES[comparator] || comparator;
886
+ const startInclusive =
887
+ resolvedComparator === 'between' || resolvedComparator === 'gele' || resolvedComparator === 'gelt';
888
+ const endInclusive =
889
+ resolvedComparator === 'between' || resolvedComparator === 'gele' || resolvedComparator === 'gtle';
890
+ baseFilter = attributeComparator(
751
891
  attribute,
752
892
  (recordValue) => {
753
- return compareKeys(recordValue, value[0]) >= 0 && compareKeys(recordValue, value[1]) <= 0;
893
+ const cmpStart = compareKeys(recordValue, value[0]);
894
+ const cmpEnd = compareKeys(recordValue, value[1]);
895
+ return (startInclusive ? cmpStart >= 0 : cmpStart > 0) && (endInclusive ? cmpEnd <= 0 : cmpEnd < 0);
754
896
  },
755
897
  true
756
898
  );
899
+ break;
900
+ }
901
+ case 'in': {
902
+ if (!Array.isArray(value)) throw new ClientError(`"in" comparator requires an array value`);
903
+ // Cache the Set on the condition so multi-row evaluation reuses it.
904
+ let valueSet: Set<any> = (searchCondition as any).cachedSet;
905
+ if (!valueSet) {
906
+ valueSet = new Set(value.map((v) => (v instanceof Date ? v.getTime() : v)));
907
+ (searchCondition as any).cachedSet = valueSet;
908
+ }
909
+ baseFilter = attributeComparator(attribute, (recordValue) => valueSet.has(recordValue), true);
910
+ break;
911
+ }
757
912
  case 'gt':
758
- return attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) > 0);
913
+ baseFilter = attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) > 0);
914
+ break;
759
915
  case 'ge':
760
- return attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) >= 0);
916
+ baseFilter = attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) >= 0);
917
+ break;
761
918
  case 'lt':
762
- return attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) < 0);
919
+ baseFilter = attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) < 0);
920
+ break;
763
921
  case 'le':
764
- return attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) <= 0);
922
+ baseFilter = attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) <= 0);
923
+ break;
765
924
  case 'ne':
766
- return attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) !== 0, false, true);
925
+ baseFilter = attributeComparator(attribute, (recordValue) => compareKeys(recordValue, value) !== 0, false, true);
926
+ break;
767
927
  case 'sort':
768
928
  return () => true;
769
929
  default:
770
930
  throw new ClientError(`Unknown query comparator "${comparator}"`);
771
931
  }
932
+ if (negated && baseFilter) {
933
+ // Wrap with negation. Internal index-optimization state on `baseFilter`
934
+ // (idFilter, to, etc.) is intentionally not propagated through the
935
+ // negation wrapper — negated conditions are filter-only in Phase 1.
936
+ return (record, entry) => !baseFilter(record, entry);
937
+ }
938
+ return baseFilter;
772
939
  /** Create a comparison function that can take the record and check the attribute's value with the filter function */
773
940
  function attributeComparator(
774
941
  attribute: string,
@@ -792,7 +959,9 @@ export function filterByType(searchCondition, Table, context, filtered, isPrimar
792
959
  let misses = 0;
793
960
  let filteredSoFar = 3; // what we use to calculate miss rate; we give some buffer so we don't jump to indexed retrieval too quickly
794
961
  function recordFilter(record: any) {
795
- const value = record[attribute];
962
+ // `record` may be null/undefined when called via a nested-path filter
963
+ // where an intermediate property is missing.
964
+ const value = record == null ? undefined : record[attribute];
796
965
  let matches: boolean;
797
966
  if (typeof value !== 'object' || !value || allowObjectMatching) matches = filter(value);
798
967
  else if (Array.isArray(value)) matches = value.some(filter);
@@ -811,17 +980,19 @@ export function filterByType(searchCondition, Table, context, filtered, isPrimar
811
980
  // if we have missed too many times, we need to switch to indexed retrieval
812
981
  const searchResults = searchByIndex(searchCondition, Table._readTxnForContext(context), false, Table);
813
982
  let matchingIds: Iterable<Id>;
814
- if (recordFilter.to) {
983
+ if ((recordFilter as any).to) {
815
984
  // the values could be an array of keys, so we flatten the mapping
816
- matchingIds = searchResults.flatMap((id) => Table.primaryStore.getSync(id)[recordFilter.to]);
985
+ matchingIds = (searchResults as any).flatMap(
986
+ (id) => Table.primaryStore.getSync(id)[(recordFilter as any).to]
987
+ );
817
988
  } else {
818
- matchingIds = searchResults.map(flattenKey);
989
+ matchingIds = (searchResults as any).map(flattenKey);
819
990
  }
820
991
  // now generate a hash set that we can efficiently check primary keys against
821
992
  // TODO: Do this asynchronously
822
993
  const idSet = new Set(matchingIds);
823
994
  recordFilter.idFilter = (id) => idSet.has(flattenKey(id));
824
- recordFilter.idFilter.idSet = idSet;
995
+ (recordFilter.idFilter as any).idSet = idSet;
825
996
  }
826
997
  }
827
998
  return matches;
@@ -867,20 +1038,25 @@ export function estimateCondition(table) {
867
1038
  if (attribute_name == null || attribute_name === table.primaryKey) condition.estimated_count = 1;
868
1039
  else if (Array.isArray(attribute_name) && attribute_name.length > 1) {
869
1040
  const attribute = findAttribute(table.attributes, attribute_name[0]);
870
- const relatedTable = attribute.definition?.tableClass || attribute.elements.definition?.tableClass;
871
- const estimate = estimateCondition(relatedTable)({
872
- value: condition.value,
873
- attribute: attribute_name.length > 2 ? attribute_name.slice(1) : attribute_name[1],
874
- comparator: 'equals',
875
- });
876
- const fromIndex = table.indices[attribute.relationship.from];
877
- // the estimated count is sum of the estimate of the related table and the estimate of the index
878
- condition.estimated_count =
879
- estimate +
880
- (fromIndex
881
- ? (estimate * estimatedEntryCount(table.indices[attribute.relationship.from])) /
882
- (estimatedEntryCount(relatedTable.primaryStore) || 1)
883
- : estimate);
1041
+ const relatedTable = attribute?.definition?.tableClass || attribute?.elements?.definition?.tableClass;
1042
+ if (!relatedTable) {
1043
+ // Plain JSON nested path — no index, can't estimate cheaply.
1044
+ condition.estimated_count = Infinity;
1045
+ } else {
1046
+ const estimate = estimateCondition(relatedTable)({
1047
+ value: condition.value,
1048
+ attribute: attribute_name.length > 2 ? attribute_name.slice(1) : attribute_name[1],
1049
+ comparator: 'equals',
1050
+ });
1051
+ const fromIndex = table.indices[attribute.relationship?.from];
1052
+ // the estimated count is sum of the estimate of the related table and the estimate of the index
1053
+ condition.estimated_count =
1054
+ estimate +
1055
+ (fromIndex
1056
+ ? (estimate * estimatedEntryCount(table.indices[attribute.relationship.from])) /
1057
+ (estimatedEntryCount(relatedTable.primaryStore) || 1)
1058
+ : estimate);
1059
+ }
884
1060
  } else {
885
1061
  // we only attempt to estimate count on equals operator because that's really all that LMDB supports (some other key-value stores like libmdbx could be considered if we need to do estimated counts of ranges at some point)
886
1062
  const index = table.indices[attribute_name];
@@ -893,6 +1069,19 @@ export function estimateCondition(table) {
893
1069
  condition.estimated_count =
894
1070
  estimatedEntryCount(table.primaryStore) - (index ? index.getValuesCount(null) : 0);
895
1071
  } else condition.estimated_count = Infinity;
1072
+ } else if (searchType === 'in') {
1073
+ const attribute_name = condition[0] ?? condition.attribute;
1074
+ const index = table.indices[attribute_name];
1075
+ if (Array.isArray(condition.value) && index) {
1076
+ // Sum of per-value matches (over-counts duplicates but is a fine ceiling)
1077
+ let estimate = 0;
1078
+ for (const item of condition.value) {
1079
+ estimate += index.getValuesCount(item);
1080
+ }
1081
+ condition.estimated_count = estimate;
1082
+ } else if (Array.isArray(condition.value)) {
1083
+ condition.estimated_count = Infinity;
1084
+ } else condition.estimated_count = Infinity;
896
1085
  // for range queries (betweens, startsWith, greater, etc.), just arbitrarily guess
897
1086
  } else if (searchType === 'starts_with' || searchType === 'prefix')
898
1087
  condition.estimated_count = STARTS_WITH_ESTIMATE * estimatedEntryCount(table.primaryStore) + 1;
@@ -925,6 +1114,7 @@ class SyntaxViolation extends Violation {}
925
1114
  const NEEDS_PARSER = /[()[\]|!<>.]|(=\w*=)/;
926
1115
  const QUERY_PARSER = /([^?&|=<>!([{}\]),]*)([([{}\])|,&]|[=<>!]*)/g;
927
1116
  const VALUE_PARSER = /([^&|=[\]{}]+)([[\]{}]|[&|=]*)/g;
1117
+ const FIQL_OPERATOR_NAME = /^[a-zA-Z_][a-zA-Z_0-9]*$/;
928
1118
  let lastIndex;
929
1119
  let currentQuery;
930
1120
  let queryString;
@@ -943,15 +1133,15 @@ export function parseQuery(queryToParse: string, query: RequestTarget) {
943
1133
  currentQuery = query ?? new Query();
944
1134
  parseBlock(currentQuery, '');
945
1135
  if (lastIndex !== queryString.length) recordError(`Unable to parse query, unexpected end of query`);
946
- if (currentQuery.parseErrorMessage) {
947
- currentQuery.parseError = new SyntaxViolation(query.parseErrorMessage);
948
- if (!query) throw currentQuery.parseError;
1136
+ if ((currentQuery as any).parseErrorMessage) {
1137
+ (currentQuery as any).parseError = new SyntaxViolation((query as any).parseErrorMessage);
1138
+ if (!query) throw (currentQuery as any).parseError;
949
1139
  }
950
1140
  return currentQuery;
951
1141
  } catch (error) {
952
1142
  error.statusCode = 400;
953
1143
  error.message = `Unable to parse query, ${error.message} at position ${lastIndex} in '${queryString}'`;
954
- if (currentQuery.parseErrorMessage) error.message += ', ' + currentQuery.parseErrorMessage;
1144
+ if ((currentQuery as any).parseErrorMessage) error.message += ', ' + (currentQuery as any).parseErrorMessage;
955
1145
  if (query) {
956
1146
  query.parseError = error;
957
1147
  } else {
@@ -972,7 +1162,7 @@ function parseBlock(query, expectedEnd) {
972
1162
  let parser = QUERY_PARSER;
973
1163
  let match;
974
1164
  let attribute, comparator, expectingDelimiter, expectingValue;
975
- let valueDecoder = decodeURIComponent;
1165
+ let valueDecoder: any = decodeURIComponent;
976
1166
  let lastBinaryOperator;
977
1167
  while ((match = parser.exec(queryString))) {
978
1168
  lastIndex = parser.lastIndex;
@@ -986,8 +1176,10 @@ function parseBlock(query, expectedEnd) {
986
1176
  switch (operator) {
987
1177
  case '=':
988
1178
  if (attribute != undefined) {
989
- // a FIQL operator like =gt= (and don't allow just any string)
990
- if (value.length <= 2) comparator = value;
1179
+ // FIQL operator like =gt= or =starts_with= accept any identifier
1180
+ // (letters, digits, underscores). Unknown comparator names are
1181
+ // caught at execution time with a clearer error.
1182
+ if (FIQL_OPERATOR_NAME.test(value)) comparator = value;
991
1183
  else recordError(`invalid FIQL operator ${value}`);
992
1184
  valueDecoder = typedDecoding; // use typed/auto-cast decoding for FIQL operators
993
1185
  } else {
@@ -1029,12 +1221,7 @@ function parseBlock(query, expectedEnd) {
1029
1221
  }
1030
1222
  } else {
1031
1223
  if (!query.conditions) recordError('conditions/comparisons are not allowed in a property list');
1032
- const condition = {
1033
- comparator,
1034
- attribute: attribute || null,
1035
- value: valueDecoder(value),
1036
- };
1037
- if (comparator === 'eq') wildcardDecoding(condition, value);
1224
+ const condition = buildCondition(attribute, comparator, value, valueDecoder);
1038
1225
  if (attribute === '') {
1039
1226
  // this is a nested condition
1040
1227
  const lastCondition = query.conditions[query.conditions.length - 1];
@@ -1091,7 +1278,7 @@ function parseBlock(query, expectedEnd) {
1091
1278
  }
1092
1279
  break;
1093
1280
  case 'select':
1094
- if (Array.isArray(args[0]) && args.length === 1 && !args[0].name) {
1281
+ if (Array.isArray(args[0]) && args.length === 1 && !(args[0] as any).name) {
1095
1282
  query.select = args[0];
1096
1283
  query.select.asArray = true;
1097
1284
  } else if (args.length === 1) query.select = args[0];
@@ -1159,12 +1346,7 @@ function parseBlock(query, expectedEnd) {
1159
1346
  if (query.conditions) {
1160
1347
  // finish condition
1161
1348
  if (attribute) {
1162
- const condition = {
1163
- comparator: comparator || 'equals',
1164
- attribute,
1165
- value: valueDecoder(value),
1166
- };
1167
- if (comparator === 'eq') wildcardDecoding(condition, value);
1349
+ const condition = buildCondition(attribute, comparator || 'equals', value, valueDecoder);
1168
1350
  assignOperator(query, lastBinaryOperator);
1169
1351
  query.conditions.push(condition);
1170
1352
  } else if (value) {
@@ -1233,6 +1415,44 @@ function wildcardDecoding(condition, value) {
1233
1415
  }
1234
1416
  }
1235
1417
 
1418
+ /**
1419
+ * Build a condition from a parsed attribute, raw comparator name, raw value
1420
+ * string, and the value decoder for the operator. Centralizes:
1421
+ * - alias resolution and `not_` prefix handling (for `negated`)
1422
+ * - `(v1,v2,...)` list-value syntax for list-taking comparators
1423
+ * - wildcard detection on `eq` (typed-equality)
1424
+ */
1425
+ function buildCondition(
1426
+ attribute: any,
1427
+ rawComparator: string | undefined,
1428
+ rawValue: string,
1429
+ valueDecoder: (s: string) => any
1430
+ ) {
1431
+ const { comparator: resolvedComparator, negated } = resolveComparator(rawComparator);
1432
+ let value: any;
1433
+ if (
1434
+ LIST_VALUE_COMPARATORS.has(resolvedComparator as string) &&
1435
+ rawValue.length >= 2 &&
1436
+ rawValue.charCodeAt(0) === 0x28 /* ( */ &&
1437
+ rawValue.charCodeAt(rawValue.length - 1) === 0x29 /* ) */
1438
+ ) {
1439
+ // `(v1,v2,...)` list-value syntax. Each element is decoded individually.
1440
+ const inner = rawValue.slice(1, -1);
1441
+ value = inner.length === 0 ? [] : inner.split(',').map(valueDecoder);
1442
+ } else {
1443
+ value = valueDecoder(rawValue);
1444
+ }
1445
+ const condition: any = {
1446
+ comparator: resolvedComparator,
1447
+ attribute: attribute || null,
1448
+ value,
1449
+ };
1450
+ if (negated) condition.negated = true;
1451
+ // preserve existing wildcard behavior on coercive equality
1452
+ if (rawComparator === 'eq') wildcardDecoding(condition, rawValue);
1453
+ return condition;
1454
+ }
1455
+
1236
1456
  function toSortObject(sort) {
1237
1457
  const sortObject = toSortEntry(sort[0]);
1238
1458
  if (sort.length > 1) {