@harperfast/harper 5.0.25 → 5.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1121) 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 +168 -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 +6 -6
  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 +125 -15
  39. package/components/anthropic/index.ts +547 -0
  40. package/components/bedrock/index.ts +823 -0
  41. package/components/componentLoader.ts +63 -32
  42. package/components/deployLifecycle.ts +161 -0
  43. package/components/deploymentOperations.ts +173 -0
  44. package/components/deploymentRecorder.ts +402 -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 +593 -0
  55. package/components/mcp/session.ts +151 -0
  56. package/components/mcp/sessionRegistry.ts +140 -0
  57. package/components/mcp/toolRegistry.ts +292 -0
  58. package/components/mcp/tools/application.ts +603 -0
  59. package/components/mcp/tools/operations.ts +283 -0
  60. package/components/mcp/tools/schemas/derive.ts +256 -0
  61. package/components/mcp/tools/schemas/operations.ts +245 -0
  62. package/components/mcp/transport.ts +517 -0
  63. package/components/ollama/index.ts +316 -0
  64. package/components/openai/index.ts +563 -0
  65. package/components/operations.js +211 -60
  66. package/components/operationsValidation.js +3 -3
  67. package/components/packageComponent.ts +97 -29
  68. package/components/requestRestart.ts +17 -2
  69. package/components/status/crossThread.ts +14 -5
  70. package/components/status/errors.ts +1 -1
  71. package/config/RootConfigWatcher.ts +56 -2
  72. package/config/configUtils.js +29 -8
  73. package/config/harperConfigEnvVars.ts +1 -1
  74. package/config-root.schema.json +74 -0
  75. package/dataLayer/{CreateAttributeObject.js → CreateAttributeObject.ts} +4 -3
  76. package/dataLayer/{CreateTableObject.js → CreateTableObject.ts} +2 -1
  77. package/dataLayer/{DataLayerObjects.js → DataLayerObjects.ts} +17 -9
  78. package/dataLayer/{DeleteBeforeObject.js → DeleteBeforeObject.ts} +2 -1
  79. package/dataLayer/{DeleteObject.js → DeleteObject.ts} +3 -2
  80. package/dataLayer/{DropAttributeObject.js → DropAttributeObject.ts} +2 -1
  81. package/dataLayer/{GetBackupObject.js → GetBackupObject.ts} +3 -2
  82. package/dataLayer/{InsertObject.js → InsertObject.ts} +3 -2
  83. package/dataLayer/{ReadAuditLogObject.js → ReadAuditLogObject.ts} +3 -2
  84. package/dataLayer/{SQLSearch.js → SQLSearch.ts} +97 -43
  85. package/dataLayer/{SearchByConditionsObject.js → SearchByConditionsObject.ts} +5 -6
  86. package/dataLayer/{SearchByHashObject.js → SearchByHashObject.ts} +2 -1
  87. package/dataLayer/{SearchObject.js → SearchObject.ts} +2 -1
  88. package/dataLayer/{SqlSearchObject.js → SqlSearchObject.ts} +2 -1
  89. package/dataLayer/{UpdateObject.js → UpdateObject.ts} +3 -2
  90. package/dataLayer/{UpsertObject.js → UpsertObject.ts} +3 -2
  91. package/dataLayer/{bulkLoad.js → bulkLoad.ts} +40 -49
  92. package/dataLayer/{delete.js → delete.ts} +21 -26
  93. package/dataLayer/{export.js → export.ts} +22 -26
  94. package/dataLayer/{getBackup.js → getBackup.ts} +7 -9
  95. package/dataLayer/harperBridge/BridgeMethods.ts +102 -0
  96. package/dataLayer/harperBridge/ResourceBridge.ts +27 -26
  97. package/dataLayer/harperBridge/TableSizeObject.ts +1 -0
  98. package/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +4 -4
  99. package/dataLayer/harperBridge/{harperBridge.js → harperBridge.ts} +3 -3
  100. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +8 -6
  101. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +4 -4
  102. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +1 -1
  103. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +6 -4
  104. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +5 -4
  105. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +4 -4
  106. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +6 -5
  107. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +5 -4
  108. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +5 -5
  109. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +1 -1
  110. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +3 -3
  111. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +1 -1
  112. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +3 -2
  113. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +5 -5
  114. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +10 -8
  115. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +1 -1
  116. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +4 -3
  117. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +3 -3
  118. package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +6 -5
  119. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +2 -1
  120. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +3 -2
  121. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +2 -2
  122. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +5 -4
  123. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +6 -3
  124. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.ts +1 -1
  125. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +4 -4
  126. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +5 -5
  127. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +4 -4
  128. package/dataLayer/{hdbInfoController.js → hdbInfoController.ts} +20 -26
  129. package/dataLayer/{insert.js → insert.ts} +24 -24
  130. package/dataLayer/{readAuditLog.js → readAuditLog.ts} +8 -10
  131. package/dataLayer/{schema.js → schema.ts} +32 -44
  132. package/dataLayer/{schemaDescribe.js → schemaDescribe.ts} +23 -26
  133. package/dataLayer/{search.js → search.ts} +9 -15
  134. package/dataLayer/{transaction.js → transaction.ts} +2 -5
  135. package/dataLayer/{update.js → update.ts} +19 -22
  136. package/dist/agent/agent.d.ts +35 -0
  137. package/dist/agent/agent.js +175 -0
  138. package/dist/agent/agent.js.map +1 -0
  139. package/dist/agent/loop.d.ts +34 -0
  140. package/dist/agent/loop.js +176 -0
  141. package/dist/agent/loop.js.map +1 -0
  142. package/dist/agent/operations.d.ts +17 -0
  143. package/dist/agent/operations.js +137 -0
  144. package/dist/agent/operations.js.map +1 -0
  145. package/dist/agent/session.d.ts +36 -0
  146. package/dist/agent/session.js +182 -0
  147. package/dist/agent/session.js.map +1 -0
  148. package/dist/agent/tools/fsTools.d.ts +19 -0
  149. package/dist/agent/tools/fsTools.js +286 -0
  150. package/dist/agent/tools/fsTools.js.map +1 -0
  151. package/dist/agent/tools/httpFetchTool.d.ts +9 -0
  152. package/dist/agent/tools/httpFetchTool.js +116 -0
  153. package/dist/agent/tools/httpFetchTool.js.map +1 -0
  154. package/dist/agent/tools/scheduleTool.d.ts +22 -0
  155. package/dist/agent/tools/scheduleTool.js +54 -0
  156. package/dist/agent/tools/scheduleTool.js.map +1 -0
  157. package/dist/agent/toolset.d.ts +24 -0
  158. package/dist/agent/toolset.js +33 -0
  159. package/dist/agent/toolset.js.map +1 -0
  160. package/dist/agent/types.d.ts +75 -0
  161. package/dist/agent/types.js +10 -0
  162. package/dist/agent/types.js.map +1 -0
  163. package/dist/bin/BinObjects.d.ts +2 -2
  164. package/dist/bin/BinObjects.js +6 -3
  165. package/dist/bin/BinObjects.js.map +1 -1
  166. package/dist/bin/cliCredentials.d.ts +27 -0
  167. package/dist/bin/cliCredentials.js +130 -0
  168. package/dist/bin/cliCredentials.js.map +1 -0
  169. package/dist/bin/cliOperations.d.ts +7 -7
  170. package/dist/bin/cliOperations.js +251 -37
  171. package/dist/bin/cliOperations.js.map +1 -1
  172. package/dist/bin/copyDb.js +16 -16
  173. package/dist/bin/copyDb.js.map +1 -1
  174. package/dist/bin/deployRenderer.d.ts +47 -0
  175. package/dist/bin/deployRenderer.js +185 -0
  176. package/dist/bin/deployRenderer.js.map +1 -0
  177. package/dist/bin/harper.d.ts +2 -1
  178. package/dist/bin/harper.js +87 -26
  179. package/dist/bin/harper.js.map +1 -1
  180. package/dist/bin/install.d.ts +1 -1
  181. package/dist/bin/install.js +41 -4
  182. package/dist/bin/install.js.map +1 -1
  183. package/dist/bin/lite.js +3 -4
  184. package/dist/bin/lite.js.map +1 -1
  185. package/dist/bin/login.d.ts +4 -0
  186. package/dist/bin/login.js +158 -0
  187. package/dist/bin/login.js.map +1 -0
  188. package/dist/bin/logout.d.ts +4 -0
  189. package/dist/bin/logout.js +16 -0
  190. package/dist/bin/logout.js.map +1 -0
  191. package/dist/bin/mcp/client.d.ts +34 -0
  192. package/dist/bin/mcp/client.js +395 -0
  193. package/dist/bin/mcp/client.js.map +1 -0
  194. package/dist/bin/mcp/doctor.d.ts +11 -0
  195. package/dist/bin/mcp/doctor.js +193 -0
  196. package/dist/bin/mcp/doctor.js.map +1 -0
  197. package/dist/bin/mcp/index.d.ts +10 -0
  198. package/dist/bin/mcp/index.js +81 -0
  199. package/dist/bin/mcp/index.js.map +1 -0
  200. package/dist/bin/mcp/options.d.ts +33 -0
  201. package/dist/bin/mcp/options.js +113 -0
  202. package/dist/bin/mcp/options.js.map +1 -0
  203. package/dist/bin/mcp/printConfig.d.ts +14 -0
  204. package/dist/bin/mcp/printConfig.js +85 -0
  205. package/dist/bin/mcp/printConfig.js.map +1 -0
  206. package/dist/bin/multipartBuilder.d.ts +26 -0
  207. package/dist/bin/multipartBuilder.js +55 -0
  208. package/dist/bin/multipartBuilder.js.map +1 -0
  209. package/dist/bin/restart.d.ts +3 -2
  210. package/dist/bin/restart.js +82 -45
  211. package/dist/bin/restart.js.map +1 -1
  212. package/dist/bin/run.d.ts +13 -9
  213. package/dist/bin/run.js +111 -65
  214. package/dist/bin/run.js.map +1 -1
  215. package/dist/bin/sseConsumer.d.ts +24 -0
  216. package/dist/bin/sseConsumer.js +127 -0
  217. package/dist/bin/sseConsumer.js.map +1 -0
  218. package/dist/bin/status.d.ts +1 -1
  219. package/dist/bin/status.js +48 -11
  220. package/dist/bin/status.js.map +1 -1
  221. package/dist/bin/stop.d.ts +1 -1
  222. package/dist/bin/stop.js +43 -6
  223. package/dist/bin/stop.js.map +1 -1
  224. package/dist/bin/upgrade.js +6 -6
  225. package/dist/components/Application.d.ts +29 -17
  226. package/dist/components/Application.js +134 -28
  227. package/dist/components/Application.js.map +1 -1
  228. package/dist/components/ApplicationScope.js +2 -2
  229. package/dist/components/ComponentV1.d.ts +1 -1
  230. package/dist/components/ComponentV1.js +5 -5
  231. package/dist/components/ComponentV1.js.map +1 -1
  232. package/dist/components/EntryHandler.d.ts +26 -3
  233. package/dist/components/EntryHandler.js +153 -13
  234. package/dist/components/EntryHandler.js.map +1 -1
  235. package/dist/components/OptionsWatcher.d.ts +7 -2
  236. package/dist/components/OptionsWatcher.js +72 -10
  237. package/dist/components/OptionsWatcher.js.map +1 -1
  238. package/dist/components/Scope.d.ts +11 -6
  239. package/dist/components/Scope.js +105 -9
  240. package/dist/components/Scope.js.map +1 -1
  241. package/dist/components/anthropic/index.d.ts +40 -0
  242. package/dist/components/anthropic/index.js +428 -0
  243. package/dist/components/anthropic/index.js.map +1 -0
  244. package/dist/components/bedrock/index.d.ts +79 -0
  245. package/dist/components/bedrock/index.js +734 -0
  246. package/dist/components/bedrock/index.js.map +1 -0
  247. package/dist/components/componentLoader.d.ts +29 -0
  248. package/dist/components/componentLoader.js +63 -38
  249. package/dist/components/componentLoader.js.map +1 -1
  250. package/dist/components/deployLifecycle.d.ts +39 -0
  251. package/dist/components/deployLifecycle.js +156 -0
  252. package/dist/components/deployLifecycle.js.map +1 -0
  253. package/dist/components/deploymentOperations.d.ts +19 -0
  254. package/dist/components/deploymentOperations.js +185 -0
  255. package/dist/components/deploymentOperations.js.map +1 -0
  256. package/dist/components/deploymentRecorder.d.ts +81 -0
  257. package/dist/components/deploymentRecorder.js +401 -0
  258. package/dist/components/deploymentRecorder.js.map +1 -0
  259. package/dist/components/deriveURLPath.d.ts +2 -2
  260. package/dist/components/deriveURLPath.js +2 -2
  261. package/dist/components/deriveURLPath.js.map +1 -1
  262. package/dist/components/mcp/adapters/fastify.d.ts +35 -0
  263. package/dist/components/mcp/adapters/fastify.js +66 -0
  264. package/dist/components/mcp/adapters/fastify.js.map +1 -0
  265. package/dist/components/mcp/adapters/harperHttp.d.ts +38 -0
  266. package/dist/components/mcp/adapters/harperHttp.js +78 -0
  267. package/dist/components/mcp/adapters/harperHttp.js.map +1 -0
  268. package/dist/components/mcp/audit.d.ts +27 -0
  269. package/dist/components/mcp/audit.js +73 -0
  270. package/dist/components/mcp/audit.js.map +1 -0
  271. package/dist/components/mcp/index.d.ts +47 -0
  272. package/dist/components/mcp/index.js +109 -0
  273. package/dist/components/mcp/index.js.map +1 -0
  274. package/dist/components/mcp/jsonrpc.d.ts +71 -0
  275. package/dist/components/mcp/jsonrpc.js +93 -0
  276. package/dist/components/mcp/jsonrpc.js.map +1 -0
  277. package/dist/components/mcp/lifecycle.d.ts +69 -0
  278. package/dist/components/mcp/lifecycle.js +79 -0
  279. package/dist/components/mcp/lifecycle.js.map +1 -0
  280. package/dist/components/mcp/listChanged.d.ts +24 -0
  281. package/dist/components/mcp/listChanged.js +257 -0
  282. package/dist/components/mcp/listChanged.js.map +1 -0
  283. package/dist/components/mcp/rateLimit.d.ts +25 -0
  284. package/dist/components/mcp/rateLimit.js +226 -0
  285. package/dist/components/mcp/rateLimit.js.map +1 -0
  286. package/dist/components/mcp/resources.d.ts +90 -0
  287. package/dist/components/mcp/resources.js +515 -0
  288. package/dist/components/mcp/resources.js.map +1 -0
  289. package/dist/components/mcp/session.d.ts +36 -0
  290. package/dist/components/mcp/session.js +170 -0
  291. package/dist/components/mcp/session.js.map +1 -0
  292. package/dist/components/mcp/sessionRegistry.d.ts +63 -0
  293. package/dist/components/mcp/sessionRegistry.js +124 -0
  294. package/dist/components/mcp/sessionRegistry.js.map +1 -0
  295. package/dist/components/mcp/toolRegistry.d.ts +150 -0
  296. package/dist/components/mcp/toolRegistry.js +176 -0
  297. package/dist/components/mcp/toolRegistry.js.map +1 -0
  298. package/dist/components/mcp/tools/application.d.ts +58 -0
  299. package/dist/components/mcp/tools/application.js +549 -0
  300. package/dist/components/mcp/tools/application.js.map +1 -0
  301. package/dist/components/mcp/tools/operations.d.ts +23 -0
  302. package/dist/components/mcp/tools/operations.js +303 -0
  303. package/dist/components/mcp/tools/operations.js.map +1 -0
  304. package/dist/components/mcp/tools/schemas/derive.d.ts +36 -0
  305. package/dist/components/mcp/tools/schemas/derive.js +216 -0
  306. package/dist/components/mcp/tools/schemas/derive.js.map +1 -0
  307. package/dist/components/mcp/tools/schemas/operations.d.ts +27 -0
  308. package/dist/components/mcp/tools/schemas/operations.js +243 -0
  309. package/dist/components/mcp/tools/schemas/operations.js.map +1 -0
  310. package/dist/components/mcp/transport.d.ts +38 -0
  311. package/dist/components/mcp/transport.js +467 -0
  312. package/dist/components/mcp/transport.js.map +1 -0
  313. package/dist/components/ollama/index.d.ts +46 -0
  314. package/dist/components/ollama/index.js +239 -0
  315. package/dist/components/ollama/index.js.map +1 -0
  316. package/dist/components/openai/index.d.ts +51 -0
  317. package/dist/components/openai/index.js +475 -0
  318. package/dist/components/openai/index.js.map +1 -0
  319. package/dist/components/operations.d.ts +6 -6
  320. package/dist/components/operations.js +198 -52
  321. package/dist/components/operations.js.map +1 -1
  322. package/dist/components/operationsValidation.d.ts +2 -2
  323. package/dist/components/operationsValidation.js +3 -3
  324. package/dist/components/packageComponent.d.ts +28 -6
  325. package/dist/components/packageComponent.js +87 -26
  326. package/dist/components/packageComponent.js.map +1 -1
  327. package/dist/components/requestRestart.d.ts +1 -0
  328. package/dist/components/requestRestart.js +12 -1
  329. package/dist/components/requestRestart.js.map +1 -1
  330. package/dist/components/status/crossThread.d.ts +5 -1
  331. package/dist/components/status/crossThread.js +12 -5
  332. package/dist/components/status/crossThread.js.map +1 -1
  333. package/dist/components/status/errors.js +7 -7
  334. package/dist/config/RootConfigWatcher.d.ts +3 -0
  335. package/dist/config/RootConfigWatcher.js +52 -1
  336. package/dist/config/RootConfigWatcher.js.map +1 -1
  337. package/dist/config/configUtils.js +31 -8
  338. package/dist/config/configUtils.js.map +1 -1
  339. package/dist/config/harperConfigEnvVars.js +1 -1
  340. package/dist/config/harperConfigEnvVars.js.map +1 -1
  341. package/dist/dataLayer/CreateAttributeObject.d.ts +3 -7
  342. package/dist/dataLayer/CreateAttributeObject.js +4 -3
  343. package/dist/dataLayer/CreateAttributeObject.js.map +1 -1
  344. package/dist/dataLayer/CreateTableObject.d.ts +2 -4
  345. package/dist/dataLayer/CreateTableObject.js +2 -1
  346. package/dist/dataLayer/CreateTableObject.js.map +1 -1
  347. package/dist/dataLayer/DataLayerObjects.d.ts +17 -16
  348. package/dist/dataLayer/DataLayerObjects.js +19 -5
  349. package/dist/dataLayer/DataLayerObjects.js.map +1 -1
  350. package/dist/dataLayer/DeleteBeforeObject.d.ts +3 -5
  351. package/dist/dataLayer/DeleteBeforeObject.js +2 -1
  352. package/dist/dataLayer/DeleteBeforeObject.js.map +1 -1
  353. package/dist/dataLayer/DeleteObject.d.ts +3 -7
  354. package/dist/dataLayer/DeleteObject.js +4 -3
  355. package/dist/dataLayer/DeleteObject.js.map +1 -1
  356. package/dist/dataLayer/DropAttributeObject.d.ts +2 -4
  357. package/dist/dataLayer/DropAttributeObject.js +2 -1
  358. package/dist/dataLayer/DropAttributeObject.js.map +1 -1
  359. package/dist/dataLayer/GetBackupObject.d.ts +3 -5
  360. package/dist/dataLayer/GetBackupObject.js +4 -3
  361. package/dist/dataLayer/GetBackupObject.js.map +1 -1
  362. package/dist/dataLayer/InsertObject.d.ts +3 -8
  363. package/dist/dataLayer/InsertObject.js +4 -3
  364. package/dist/dataLayer/InsertObject.js.map +1 -1
  365. package/dist/dataLayer/ReadAuditLogObject.d.ts +3 -7
  366. package/dist/dataLayer/ReadAuditLogObject.js +4 -3
  367. package/dist/dataLayer/ReadAuditLogObject.js.map +1 -1
  368. package/dist/dataLayer/SQLSearch.d.ts +68 -38
  369. package/dist/dataLayer/SQLSearch.js +140 -78
  370. package/dist/dataLayer/SQLSearch.js.map +1 -1
  371. package/dist/dataLayer/SearchByConditionsObject.d.ts +10 -58
  372. package/dist/dataLayer/SearchByConditionsObject.js +5 -7
  373. package/dist/dataLayer/SearchByConditionsObject.js.map +1 -1
  374. package/dist/dataLayer/SearchByHashObject.d.ts +3 -6
  375. package/dist/dataLayer/SearchByHashObject.js +2 -1
  376. package/dist/dataLayer/SearchByHashObject.js.map +1 -1
  377. package/dist/dataLayer/SearchObject.d.ts +3 -12
  378. package/dist/dataLayer/SearchObject.js +2 -1
  379. package/dist/dataLayer/SearchObject.js.map +1 -1
  380. package/dist/dataLayer/SqlSearchObject.d.ts +2 -4
  381. package/dist/dataLayer/SqlSearchObject.js +2 -1
  382. package/dist/dataLayer/SqlSearchObject.js.map +1 -1
  383. package/dist/dataLayer/UpdateObject.d.ts +3 -7
  384. package/dist/dataLayer/UpdateObject.js +4 -3
  385. package/dist/dataLayer/UpdateObject.js.map +1 -1
  386. package/dist/dataLayer/UpsertObject.d.ts +3 -7
  387. package/dist/dataLayer/UpsertObject.js +4 -3
  388. package/dist/dataLayer/UpsertObject.js.map +1 -1
  389. package/dist/dataLayer/bulkLoad.d.ts +4 -4
  390. package/dist/dataLayer/bulkLoad.js +122 -88
  391. package/dist/dataLayer/bulkLoad.js.map +1 -1
  392. package/dist/dataLayer/delete.d.ts +10 -11
  393. package/dist/dataLayer/delete.js +74 -39
  394. package/dist/dataLayer/delete.js.map +1 -1
  395. package/dist/dataLayer/export.d.ts +8 -8
  396. package/dist/dataLayer/export.js +90 -55
  397. package/dist/dataLayer/export.js.map +1 -1
  398. package/dist/dataLayer/getBackup.d.ts +4 -3
  399. package/dist/dataLayer/getBackup.js +43 -11
  400. package/dist/dataLayer/getBackup.js.map +1 -1
  401. package/dist/dataLayer/harperBridge/BridgeMethods.d.ts +39 -21
  402. package/dist/dataLayer/harperBridge/BridgeMethods.js +41 -20
  403. package/dist/dataLayer/harperBridge/BridgeMethods.js.map +1 -1
  404. package/dist/dataLayer/harperBridge/ResourceBridge.d.ts +2 -2
  405. package/dist/dataLayer/harperBridge/ResourceBridge.js +26 -25
  406. package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -1
  407. package/dist/dataLayer/harperBridge/TableSizeObject.d.ts +1 -0
  408. package/dist/dataLayer/harperBridge/TableSizeObject.js.map +1 -1
  409. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.d.ts +4 -4
  410. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +4 -4
  411. package/dist/dataLayer/harperBridge/harperBridge.d.ts +2 -3
  412. package/dist/dataLayer/harperBridge/harperBridge.js +38 -4
  413. package/dist/dataLayer/harperBridge/harperBridge.js.map +1 -1
  414. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.d.ts +1 -2
  415. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +7 -6
  416. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js.map +1 -1
  417. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.d.ts +1 -2
  418. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +4 -4
  419. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js.map +1 -1
  420. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +1 -1
  421. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js.map +1 -1
  422. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +5 -4
  423. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js.map +1 -1
  424. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.d.ts +1 -2
  425. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +4 -4
  426. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js.map +1 -1
  427. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +4 -4
  428. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.d.ts +1 -2
  429. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +5 -5
  430. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js.map +1 -1
  431. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +4 -4
  432. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js.map +1 -1
  433. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +5 -5
  434. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js.map +1 -1
  435. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +1 -1
  436. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +3 -3
  437. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +1 -1
  438. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +2 -2
  439. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js.map +1 -1
  440. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +5 -5
  441. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.d.ts +1 -2
  442. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +8 -8
  443. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js.map +1 -1
  444. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.d.ts +1 -1
  445. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +1 -1
  446. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.d.ts +1 -2
  447. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +3 -3
  448. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js.map +1 -1
  449. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +3 -3
  450. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.d.ts +1 -2
  451. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +5 -5
  452. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js.map +1 -1
  453. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.d.ts +1 -2
  454. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +1 -1
  455. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js.map +1 -1
  456. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +2 -2
  457. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js.map +1 -1
  458. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +2 -2
  459. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +4 -4
  460. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js.map +1 -1
  461. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.d.ts +1 -2
  462. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +5 -3
  463. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js.map +1 -1
  464. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js +2 -2
  465. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.d.ts +1 -2
  466. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +4 -4
  467. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js.map +1 -1
  468. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +5 -5
  469. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +4 -4
  470. package/dist/dataLayer/hdbInfoController.d.ts +4 -8
  471. package/dist/dataLayer/hdbInfoController.js +66 -31
  472. package/dist/dataLayer/hdbInfoController.js.map +1 -1
  473. package/dist/dataLayer/insert.d.ts +14 -26
  474. package/dist/dataLayer/insert.js +63 -28
  475. package/dist/dataLayer/insert.js.map +1 -1
  476. package/dist/dataLayer/readAuditLog.d.ts +1 -3
  477. package/dist/dataLayer/readAuditLog.js +45 -13
  478. package/dist/dataLayer/readAuditLog.js.map +1 -1
  479. package/dist/dataLayer/schema.d.ts +10 -10
  480. package/dist/dataLayer/schema.js +124 -89
  481. package/dist/dataLayer/schema.js.map +1 -1
  482. package/dist/dataLayer/schemaDescribe.d.ts +4 -4
  483. package/dist/dataLayer/schemaDescribe.js +78 -41
  484. package/dist/dataLayer/schemaDescribe.js.map +1 -1
  485. package/dist/dataLayer/search.d.ts +4 -4
  486. package/dist/dataLayer/search.js +12 -13
  487. package/dist/dataLayer/search.js.map +1 -1
  488. package/dist/dataLayer/transaction.d.ts +1 -1
  489. package/dist/dataLayer/transaction.js +3 -4
  490. package/dist/dataLayer/transaction.js.map +1 -1
  491. package/dist/dataLayer/update.d.ts +2 -8
  492. package/dist/dataLayer/update.js +53 -18
  493. package/dist/dataLayer/update.js.map +1 -1
  494. package/dist/globals.d.ts +1 -1
  495. package/dist/globals.js +1 -0
  496. package/dist/globals.js.map +1 -1
  497. package/dist/index.d.ts +4 -0
  498. package/dist/index.js +4 -1
  499. package/dist/index.js.map +1 -1
  500. package/dist/json/systemSchema.json +65 -0
  501. package/dist/launchServiceScripts/launchHarperDB.d.ts +1 -0
  502. package/dist/launchServiceScripts/launchHarperDB.js +3 -0
  503. package/dist/launchServiceScripts/launchHarperDB.js.map +1 -0
  504. package/dist/launchServiceScripts/utility/checkNodeVersion.js +3 -0
  505. package/dist/launchServiceScripts/utility/checkNodeVersion.js.map +1 -1
  506. package/dist/resources/DatabaseTransaction.d.ts +14 -6
  507. package/dist/resources/DatabaseTransaction.js +39 -15
  508. package/dist/resources/DatabaseTransaction.js.map +1 -1
  509. package/dist/resources/ErrorResource.d.ts +1 -1
  510. package/dist/resources/ErrorResource.js +3 -1
  511. package/dist/resources/ErrorResource.js.map +1 -1
  512. package/dist/resources/LMDBTransaction.d.ts +10 -13
  513. package/dist/resources/LMDBTransaction.js +18 -7
  514. package/dist/resources/LMDBTransaction.js.map +1 -1
  515. package/dist/resources/RecordEncoder.d.ts +7 -1
  516. package/dist/resources/RecordEncoder.js +5 -2
  517. package/dist/resources/RecordEncoder.js.map +1 -1
  518. package/dist/resources/RequestTarget.d.ts +1 -0
  519. package/dist/resources/RequestTarget.js.map +1 -1
  520. package/dist/resources/Resource.d.ts +9 -5
  521. package/dist/resources/Resource.js +37 -10
  522. package/dist/resources/Resource.js.map +1 -1
  523. package/dist/resources/ResourceInterface.d.ts +24 -5
  524. package/dist/resources/ResourceInterface.js +20 -0
  525. package/dist/resources/ResourceInterface.js.map +1 -1
  526. package/dist/resources/Resources.d.ts +3 -4
  527. package/dist/resources/Resources.js +7 -6
  528. package/dist/resources/Resources.js.map +1 -1
  529. package/dist/resources/RocksIndexStore.js +3 -0
  530. package/dist/resources/RocksIndexStore.js.map +1 -1
  531. package/dist/resources/RocksTransactionLogStore.d.ts +1 -1
  532. package/dist/resources/RocksTransactionLogStore.js +46 -27
  533. package/dist/resources/RocksTransactionLogStore.js.map +1 -1
  534. package/dist/resources/Table.d.ts +59 -329
  535. package/dist/resources/Table.js +267 -107
  536. package/dist/resources/Table.js.map +1 -1
  537. package/dist/resources/analytics/metadata.d.ts +1 -0
  538. package/dist/resources/analytics/metadata.js +1 -0
  539. package/dist/resources/analytics/metadata.js.map +1 -1
  540. package/dist/resources/analytics/read.d.ts +5 -0
  541. package/dist/resources/analytics/read.js +16 -5
  542. package/dist/resources/analytics/read.js.map +1 -1
  543. package/dist/resources/analytics/write.d.ts +28 -0
  544. package/dist/resources/analytics/write.js +232 -20
  545. package/dist/resources/analytics/write.js.map +1 -1
  546. package/dist/resources/auditStore.d.ts +18 -13
  547. package/dist/resources/auditStore.js +13 -8
  548. package/dist/resources/auditStore.js.map +1 -1
  549. package/dist/resources/blob.d.ts +16 -27
  550. package/dist/resources/blob.js +8 -8
  551. package/dist/resources/blob.js.map +1 -1
  552. package/dist/resources/dataLoader.d.ts +1 -1
  553. package/dist/resources/dataLoader.js +13 -13
  554. package/dist/resources/databases.d.ts +13 -0
  555. package/dist/resources/databases.js +160 -52
  556. package/dist/resources/databases.js.map +1 -1
  557. package/dist/resources/graphql.d.ts +1 -7
  558. package/dist/resources/graphql.js +224 -174
  559. package/dist/resources/graphql.js.map +1 -1
  560. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +16 -1
  561. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +308 -59
  562. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
  563. package/dist/resources/indexes/vector.d.ts +1 -0
  564. package/dist/resources/indexes/vector.js +14 -0
  565. package/dist/resources/indexes/vector.js.map +1 -1
  566. package/dist/resources/loadEnv.d.ts +2 -5
  567. package/dist/resources/loadEnv.js +21 -18
  568. package/dist/resources/loadEnv.js.map +1 -1
  569. package/dist/resources/login.d.ts +2 -3
  570. package/dist/resources/login.js +5 -4
  571. package/dist/resources/login.js.map +1 -1
  572. package/dist/resources/models/Models.d.ts +45 -0
  573. package/dist/resources/models/Models.js +265 -0
  574. package/dist/resources/models/Models.js.map +1 -0
  575. package/dist/resources/models/TestBackend.d.ts +15 -0
  576. package/dist/resources/models/TestBackend.js +71 -0
  577. package/dist/resources/models/TestBackend.js.map +1 -0
  578. package/dist/resources/models/agentLoop.d.ts +125 -0
  579. package/dist/resources/models/agentLoop.js +746 -0
  580. package/dist/resources/models/agentLoop.js.map +1 -0
  581. package/dist/resources/models/analyticsTable.d.ts +65 -0
  582. package/dist/resources/models/analyticsTable.js +166 -0
  583. package/dist/resources/models/analyticsTable.js.map +1 -0
  584. package/dist/resources/models/backendHelpers.d.ts +57 -0
  585. package/dist/resources/models/backendHelpers.js +109 -0
  586. package/dist/resources/models/backendHelpers.js.map +1 -0
  587. package/dist/resources/models/backendRegistry.d.ts +36 -0
  588. package/dist/resources/models/backendRegistry.js +54 -0
  589. package/dist/resources/models/backendRegistry.js.map +1 -0
  590. package/dist/resources/models/bootstrap.d.ts +24 -0
  591. package/dist/resources/models/bootstrap.js +112 -0
  592. package/dist/resources/models/bootstrap.js.map +1 -0
  593. package/dist/resources/models/embedHook.d.ts +33 -0
  594. package/dist/resources/models/embedHook.js +127 -0
  595. package/dist/resources/models/embedHook.js.map +1 -0
  596. package/dist/resources/models/types.d.ts +301 -0
  597. package/dist/resources/models/types.js +11 -0
  598. package/dist/resources/models/types.js.map +1 -0
  599. package/dist/resources/replayLogs.js +7 -1
  600. package/dist/resources/replayLogs.js.map +1 -1
  601. package/dist/resources/roles.d.ts +1 -7
  602. package/dist/resources/roles.js +67 -71
  603. package/dist/resources/roles.js.map +1 -1
  604. package/dist/resources/search.d.ts +18 -1
  605. package/dist/resources/search.js +349 -140
  606. package/dist/resources/search.js.map +1 -1
  607. package/dist/resources/tracked.d.ts +1 -1
  608. package/dist/resources/tracked.js +14 -14
  609. package/dist/resources/tracked.js.map +1 -1
  610. package/dist/resources/transaction.d.ts +1 -1
  611. package/dist/resources/transaction.js +1 -1
  612. package/dist/resources/transaction.js.map +1 -1
  613. package/dist/resources/transactionBroadcast.d.ts +1 -1
  614. package/dist/resources/transactionBroadcast.js.map +1 -1
  615. package/dist/security/auth.d.ts +1 -5
  616. package/dist/security/auth.js +34 -25
  617. package/dist/security/auth.js.map +1 -1
  618. package/dist/security/certificateVerification/crlVerification.js +7 -1
  619. package/dist/security/certificateVerification/crlVerification.js.map +1 -1
  620. package/dist/security/cryptoHash.d.ts +2 -2
  621. package/dist/security/cryptoHash.js +37 -5
  622. package/dist/security/cryptoHash.js.map +1 -1
  623. package/dist/security/data_objects/PermissionAttributeResponseObject.d.ts +3 -4
  624. package/dist/security/data_objects/PermissionAttributeResponseObject.js +4 -1
  625. package/dist/security/data_objects/PermissionAttributeResponseObject.js.map +1 -1
  626. package/dist/security/data_objects/PermissionResponseObject.d.ts +9 -9
  627. package/dist/security/data_objects/PermissionResponseObject.js +15 -8
  628. package/dist/security/data_objects/PermissionResponseObject.js.map +1 -1
  629. package/dist/security/data_objects/PermissionTableResponseObject.d.ts +5 -6
  630. package/dist/security/data_objects/PermissionTableResponseObject.js +6 -1
  631. package/dist/security/data_objects/PermissionTableResponseObject.js.map +1 -1
  632. package/dist/security/fastifyAuth.d.ts +2 -2
  633. package/dist/security/fastifyAuth.js +131 -22
  634. package/dist/security/fastifyAuth.js.map +1 -1
  635. package/dist/security/impersonation.js +15 -15
  636. package/dist/security/jsLoader.js +18 -5
  637. package/dist/security/jsLoader.js.map +1 -1
  638. package/dist/security/keys.d.ts +45 -48
  639. package/dist/security/keys.js +160 -114
  640. package/dist/security/keys.js.map +1 -1
  641. package/dist/security/permissionsTranslator.js +2 -2
  642. package/dist/security/role.d.ts +5 -5
  643. package/dist/security/role.js +70 -35
  644. package/dist/security/role.js.map +1 -1
  645. package/dist/security/tokenAuthentication.d.ts +13 -0
  646. package/dist/security/tokenAuthentication.js +57 -27
  647. package/dist/security/tokenAuthentication.js.map +1 -1
  648. package/dist/security/user.js +74 -38
  649. package/dist/security/user.js.map +1 -1
  650. package/dist/server/DurableSubscriptionsSession.d.ts +4 -2
  651. package/dist/server/DurableSubscriptionsSession.js +71 -55
  652. package/dist/server/DurableSubscriptionsSession.js.map +1 -1
  653. package/dist/server/REST.d.ts +1 -8
  654. package/dist/server/REST.js +17 -16
  655. package/dist/server/REST.js.map +1 -1
  656. package/dist/server/Server.d.ts +23 -4
  657. package/dist/server/Server.js +1 -1
  658. package/dist/server/Server.js.map +1 -1
  659. package/dist/server/fastifyRoutes/helpers/getCORSOptions.js +1 -1
  660. package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +1 -1
  661. package/dist/server/fastifyRoutes/helpers/getServerOptions.js +1 -1
  662. package/dist/server/fastifyRoutes.d.ts +1 -4
  663. package/dist/server/fastifyRoutes.js +34 -30
  664. package/dist/server/fastifyRoutes.js.map +1 -1
  665. package/dist/server/graphqlQuerying.d.ts +1 -1
  666. package/dist/server/graphqlQuerying.js +8 -7
  667. package/dist/server/graphqlQuerying.js.map +1 -1
  668. package/dist/server/http.d.ts +9 -4
  669. package/dist/server/http.js +523 -47
  670. package/dist/server/http.js.map +1 -1
  671. package/dist/server/itc/serverHandlers.js +66 -15
  672. package/dist/server/itc/serverHandlers.js.map +1 -1
  673. package/dist/server/jobs/JobObject.d.ts +3 -3
  674. package/dist/server/jobs/JobObject.js +53 -7
  675. package/dist/server/jobs/JobObject.js.map +1 -1
  676. package/dist/server/jobs/jobProcess.js +64 -24
  677. package/dist/server/jobs/jobProcess.js.map +1 -1
  678. package/dist/server/jobs/jobRunner.d.ts +7 -6
  679. package/dist/server/jobs/jobRunner.js +68 -30
  680. package/dist/server/jobs/jobRunner.js.map +1 -1
  681. package/dist/server/jobs/jobs.d.ts +18 -7
  682. package/dist/server/jobs/jobs.js +93 -61
  683. package/dist/server/jobs/jobs.js.map +1 -1
  684. package/dist/server/loadRootComponents.js +1 -1
  685. package/dist/server/middlewareChain.d.ts +80 -0
  686. package/dist/server/middlewareChain.js +252 -0
  687. package/dist/server/middlewareChain.js.map +1 -0
  688. package/dist/server/mqtt.d.ts +1 -8
  689. package/dist/server/mqtt.js +22 -17
  690. package/dist/server/mqtt.js.map +1 -1
  691. package/dist/server/nodeName.js +44 -13
  692. package/dist/server/nodeName.js.map +1 -1
  693. package/dist/server/operationsServer.d.ts +2 -2
  694. package/dist/server/operationsServer.js +106 -33
  695. package/dist/server/operationsServer.js.map +1 -1
  696. package/dist/server/serverHelpers/Headers.d.ts +4 -4
  697. package/dist/server/serverHelpers/Headers.js +2 -0
  698. package/dist/server/serverHelpers/Headers.js.map +1 -1
  699. package/dist/server/serverHelpers/JSONStream.d.ts +7 -1
  700. package/dist/server/serverHelpers/JSONStream.js +12 -3
  701. package/dist/server/serverHelpers/JSONStream.js.map +1 -1
  702. package/dist/server/serverHelpers/Request.d.ts +106 -8
  703. package/dist/server/serverHelpers/Request.js +370 -9
  704. package/dist/server/serverHelpers/Request.js.map +1 -1
  705. package/dist/server/serverHelpers/contentTypes.d.ts +1 -1
  706. package/dist/server/serverHelpers/contentTypes.js +36 -7
  707. package/dist/server/serverHelpers/contentTypes.js.map +1 -1
  708. package/dist/server/serverHelpers/multipartParser.d.ts +21 -0
  709. package/dist/server/serverHelpers/multipartParser.js +142 -0
  710. package/dist/server/serverHelpers/multipartParser.js.map +1 -0
  711. package/dist/server/serverHelpers/progressEmitter.d.ts +25 -0
  712. package/dist/server/serverHelpers/progressEmitter.js +103 -0
  713. package/dist/server/serverHelpers/progressEmitter.js.map +1 -0
  714. package/dist/server/serverHelpers/serverHandlers.d.ts +1 -1
  715. package/dist/server/serverHelpers/serverHandlers.js +38 -7
  716. package/dist/server/serverHelpers/serverHandlers.js.map +1 -1
  717. package/dist/server/serverHelpers/serverUtilities.d.ts +4 -2
  718. package/dist/server/serverHelpers/serverUtilities.js +97 -93
  719. package/dist/server/serverHelpers/serverUtilities.js.map +1 -1
  720. package/dist/server/static.js +8 -5
  721. package/dist/server/static.js.map +1 -1
  722. package/dist/server/status/index.js +3 -3
  723. package/dist/server/storageReclamation.d.ts +10 -0
  724. package/dist/server/storageReclamation.js +68 -9
  725. package/dist/server/storageReclamation.js.map +1 -1
  726. package/dist/server/threads/itc.js +7 -4
  727. package/dist/server/threads/itc.js.map +1 -1
  728. package/dist/server/threads/manageThreads.d.ts +1 -1
  729. package/dist/server/threads/manageThreads.js +110 -26
  730. package/dist/server/threads/manageThreads.js.map +1 -1
  731. package/dist/server/threads/socketRouter.d.ts +0 -1
  732. package/dist/server/threads/socketRouter.js +8 -271
  733. package/dist/server/threads/socketRouter.js.map +1 -1
  734. package/dist/server/threads/threadServer.d.ts +1 -0
  735. package/dist/server/threads/threadServer.js +360 -118
  736. package/dist/server/threads/threadServer.js.map +1 -1
  737. package/dist/server/threads/workerProcessGuard.d.ts +42 -0
  738. package/dist/server/threads/workerProcessGuard.js +114 -0
  739. package/dist/server/threads/workerProcessGuard.js.map +1 -0
  740. package/dist/server/throttle.js +17 -0
  741. package/dist/server/throttle.js.map +1 -1
  742. package/dist/sqlTranslator/SelectValidator.d.ts +21 -24
  743. package/dist/sqlTranslator/SelectValidator.js +86 -47
  744. package/dist/sqlTranslator/SelectValidator.js.map +1 -1
  745. package/dist/sqlTranslator/alasqlFunctionImporter.d.ts +6 -2
  746. package/dist/sqlTranslator/alasqlFunctionImporter.js +40 -3
  747. package/dist/sqlTranslator/alasqlFunctionImporter.js.map +1 -1
  748. package/dist/sqlTranslator/deleteTranslator.d.ts +4 -7
  749. package/dist/sqlTranslator/deleteTranslator.js +48 -14
  750. package/dist/sqlTranslator/deleteTranslator.js.map +1 -1
  751. package/dist/sqlTranslator/index.d.ts +10 -9
  752. package/dist/sqlTranslator/index.js +69 -30
  753. package/dist/sqlTranslator/index.js.map +1 -1
  754. package/dist/sqlTranslator/sql_statement_bucket.d.ts +10 -10
  755. package/dist/sqlTranslator/sql_statement_bucket.js +55 -13
  756. package/dist/sqlTranslator/sql_statement_bucket.js.map +1 -1
  757. package/dist/upgrade/UpgradeObjects.d.ts +2 -3
  758. package/dist/upgrade/UpgradeObjects.js +37 -4
  759. package/dist/upgrade/UpgradeObjects.js.map +1 -1
  760. package/dist/upgrade/directives/5-2-0.d.ts +6 -0
  761. package/dist/upgrade/directives/5-2-0.js +77 -0
  762. package/dist/upgrade/directives/5-2-0.js.map +1 -0
  763. package/dist/upgrade/directives/directivesController.d.ts +10 -10
  764. package/dist/upgrade/directives/directivesController.js +52 -11
  765. package/dist/upgrade/directives/directivesController.js.map +1 -1
  766. package/dist/upgrade/directivesManager.d.ts +1 -1
  767. package/dist/upgrade/directivesManager.js +53 -18
  768. package/dist/upgrade/directivesManager.js.map +1 -1
  769. package/dist/upgrade/upgradePrompt.d.ts +3 -3
  770. package/dist/upgrade/upgradePrompt.js +65 -30
  771. package/dist/upgrade/upgradePrompt.js.map +1 -1
  772. package/dist/upgrade/upgradeUtilities.d.ts +1 -1
  773. package/dist/upgrade/upgradeUtilities.js +37 -5
  774. package/dist/upgrade/upgradeUtilities.js.map +1 -1
  775. package/dist/utility/OperationFunctionCaller.d.ts +1 -1
  776. package/dist/utility/OperationFunctionCaller.js +45 -10
  777. package/dist/utility/OperationFunctionCaller.js.map +1 -1
  778. package/dist/utility/assignCmdEnvVariables.d.ts +1 -2
  779. package/dist/utility/assignCmdEnvVariables.js +8 -4
  780. package/dist/utility/assignCmdEnvVariables.js.map +1 -1
  781. package/dist/utility/common_utils.d.ts +80 -77
  782. package/dist/utility/common_utils.js +140 -79
  783. package/dist/utility/common_utils.js.map +1 -1
  784. package/dist/utility/environment/environmentManager.d.ts +12 -11
  785. package/dist/utility/environment/environmentManager.js +75 -29
  786. package/dist/utility/environment/environmentManager.js.map +1 -1
  787. package/dist/utility/environment/systemInformation.d.ts +4 -0
  788. package/dist/utility/environment/systemInformation.js +27 -16
  789. package/dist/utility/environment/systemInformation.js.map +1 -1
  790. package/dist/utility/errors/commonErrors.d.ts +192 -168
  791. package/dist/utility/errors/commonErrors.js +49 -18
  792. package/dist/utility/errors/commonErrors.js.map +1 -1
  793. package/dist/utility/errors/hdbError.d.ts +37 -51
  794. package/dist/utility/errors/hdbError.js +65 -26
  795. package/dist/utility/errors/hdbError.js.map +1 -1
  796. package/dist/utility/expandEnvVar.d.ts +61 -0
  797. package/dist/utility/expandEnvVar.js +113 -0
  798. package/dist/utility/expandEnvVar.js.map +1 -0
  799. package/dist/utility/functions/geo.js +2 -2
  800. package/dist/utility/functions/sql/alaSQLExtension.js +1 -1
  801. package/dist/utility/globalSchema.d.ts +13 -4
  802. package/dist/utility/globalSchema.js +14 -11
  803. package/dist/utility/globalSchema.js.map +1 -1
  804. package/dist/utility/hdbTerms.d.ts +56 -0
  805. package/dist/utility/hdbTerms.js +56 -0
  806. package/dist/utility/hdbTerms.js.map +1 -1
  807. package/dist/utility/install/checkJWTTokensExist.js +1 -1
  808. package/dist/utility/install/installer.d.ts +9 -12
  809. package/dist/utility/install/installer.js +87 -51
  810. package/dist/utility/install/installer.js.map +1 -1
  811. package/dist/utility/installation.js +3 -3
  812. package/dist/utility/lmdb/DBIDefinition.d.ts +4 -4
  813. package/dist/utility/lmdb/DBIDefinition.js +5 -1
  814. package/dist/utility/lmdb/DBIDefinition.js.map +1 -1
  815. package/dist/utility/lmdb/DeleteRecordsResponseObject.d.ts +3 -6
  816. package/dist/utility/lmdb/DeleteRecordsResponseObject.js +2 -1
  817. package/dist/utility/lmdb/DeleteRecordsResponseObject.js.map +1 -1
  818. package/dist/utility/lmdb/InsertRecordsResponseObject.d.ts +3 -5
  819. package/dist/utility/lmdb/InsertRecordsResponseObject.js +2 -1
  820. package/dist/utility/lmdb/InsertRecordsResponseObject.js.map +1 -1
  821. package/dist/utility/lmdb/OpenDBIObject.d.ts +11 -15
  822. package/dist/utility/lmdb/OpenDBIObject.js +54 -6
  823. package/dist/utility/lmdb/OpenDBIObject.js.map +1 -1
  824. package/dist/utility/lmdb/OpenEnvironmentObject.d.ts +5 -8
  825. package/dist/utility/lmdb/OpenEnvironmentObject.js +52 -4
  826. package/dist/utility/lmdb/OpenEnvironmentObject.js.map +1 -1
  827. package/dist/utility/lmdb/UpdateRecordsResponseObject.d.ts +3 -6
  828. package/dist/utility/lmdb/UpdateRecordsResponseObject.js +2 -1
  829. package/dist/utility/lmdb/UpdateRecordsResponseObject.js.map +1 -1
  830. package/dist/utility/lmdb/UpsertRecordsResponseObject.d.ts +3 -5
  831. package/dist/utility/lmdb/UpsertRecordsResponseObject.js +2 -1
  832. package/dist/utility/lmdb/UpsertRecordsResponseObject.js.map +1 -1
  833. package/dist/utility/lmdb/cleanLMDBMap.d.ts +1 -1
  834. package/dist/utility/lmdb/cleanLMDBMap.js +44 -7
  835. package/dist/utility/lmdb/cleanLMDBMap.js.map +1 -1
  836. package/dist/utility/lmdb/commonUtility.d.ts +8 -9
  837. package/dist/utility/lmdb/commonUtility.js +46 -17
  838. package/dist/utility/lmdb/commonUtility.js.map +1 -1
  839. package/dist/utility/lmdb/deleteUtility.d.ts +2 -3
  840. package/dist/utility/lmdb/deleteUtility.js +51 -16
  841. package/dist/utility/lmdb/deleteUtility.js.map +1 -1
  842. package/dist/utility/lmdb/environmentUtility.d.ts +69 -36
  843. package/dist/utility/lmdb/environmentUtility.js +91 -51
  844. package/dist/utility/lmdb/environmentUtility.js.map +1 -1
  845. package/dist/utility/lmdb/searchCursorFunctions.d.ts +19 -19
  846. package/dist/utility/lmdb/searchCursorFunctions.js +46 -14
  847. package/dist/utility/lmdb/searchCursorFunctions.js.map +1 -1
  848. package/dist/utility/lmdb/searchUtility.d.ts +142 -73
  849. package/dist/utility/lmdb/searchUtility.js +91 -55
  850. package/dist/utility/lmdb/searchUtility.js.map +1 -1
  851. package/dist/utility/lmdb/terms.d.ts +34 -34
  852. package/dist/utility/lmdb/terms.js +12 -22
  853. package/dist/utility/lmdb/terms.js.map +1 -1
  854. package/dist/utility/lmdb/writeUtility.d.ts +3 -6
  855. package/dist/utility/lmdb/writeUtility.js +61 -28
  856. package/dist/utility/lmdb/writeUtility.js.map +1 -1
  857. package/dist/utility/logging/harper_logger.d.ts +87 -103
  858. package/dist/utility/logging/harper_logger.js +176 -81
  859. package/dist/utility/logging/harper_logger.js.map +1 -1
  860. package/dist/utility/logging/logRotator.d.ts +2 -10
  861. package/dist/utility/logging/logRotator.js +65 -28
  862. package/dist/utility/logging/logRotator.js.map +1 -1
  863. package/dist/utility/logging/logger.js +4 -4
  864. package/dist/utility/logging/readLog.d.ts +1 -1
  865. package/dist/utility/logging/readLog.js +54 -17
  866. package/dist/utility/logging/readLog.js.map +1 -1
  867. package/dist/utility/logging/transactionLog.d.ts +2 -2
  868. package/dist/utility/logging/transactionLog.js +51 -16
  869. package/dist/utility/logging/transactionLog.js.map +1 -1
  870. package/dist/utility/mount_hdb.d.ts +1 -2
  871. package/dist/utility/mount_hdb.js +54 -17
  872. package/dist/utility/mount_hdb.js.map +1 -1
  873. package/dist/utility/npmUtilities.d.ts +1 -1
  874. package/dist/utility/npmUtilities.js +54 -19
  875. package/dist/utility/npmUtilities.js.map +1 -1
  876. package/dist/utility/operation_authorization.d.ts +36 -9
  877. package/dist/utility/operation_authorization.js +135 -86
  878. package/dist/utility/operation_authorization.js.map +1 -1
  879. package/dist/utility/packageUtils.d.ts +0 -2
  880. package/dist/utility/packageUtils.js +7 -17
  881. package/dist/utility/packageUtils.js.map +1 -1
  882. package/dist/utility/password.js +2 -2
  883. package/dist/utility/processManagement/processManagement.js +2 -2
  884. package/dist/utility/processManagement/servicesConfig.js +1 -1
  885. package/dist/utility/signalling.d.ts +2 -2
  886. package/dist/utility/signalling.js +51 -16
  887. package/dist/utility/signalling.js.map +1 -1
  888. package/dist/utility/watcherFallback.d.ts +36 -0
  889. package/dist/utility/watcherFallback.js +73 -0
  890. package/dist/utility/watcherFallback.js.map +1 -0
  891. package/dist/validation/analyticsValidator.d.ts +1 -0
  892. package/dist/validation/analyticsValidator.js +79 -0
  893. package/dist/validation/analyticsValidator.js.map +1 -0
  894. package/dist/validation/bulkDeleteValidator.d.ts +1 -2
  895. package/dist/validation/bulkDeleteValidator.js +49 -11
  896. package/dist/validation/bulkDeleteValidator.js.map +1 -1
  897. package/dist/validation/check_permissions.d.ts +1 -2
  898. package/dist/validation/check_permissions.js +38 -3
  899. package/dist/validation/check_permissions.js.map +1 -1
  900. package/dist/validation/common_validators.d.ts +20 -20
  901. package/dist/validation/common_validators.js +62 -31
  902. package/dist/validation/common_validators.js.map +1 -1
  903. package/dist/validation/configValidator.d.ts +4 -4
  904. package/dist/validation/configValidator.js +189 -54
  905. package/dist/validation/configValidator.js.map +1 -1
  906. package/dist/validation/deleteValidator.d.ts +1 -2
  907. package/dist/validation/deleteValidator.js +49 -11
  908. package/dist/validation/deleteValidator.js.map +1 -1
  909. package/dist/validation/fileLoadValidator.d.ts +4 -4
  910. package/dist/validation/fileLoadValidator.js +67 -32
  911. package/dist/validation/fileLoadValidator.js.map +1 -1
  912. package/dist/validation/insertValidator.d.ts +1 -2
  913. package/dist/validation/insertValidator.js +48 -10
  914. package/dist/validation/insertValidator.js.map +1 -1
  915. package/dist/validation/installValidator.d.ts +2 -2
  916. package/dist/validation/installValidator.js +47 -10
  917. package/dist/validation/installValidator.js.map +1 -1
  918. package/dist/validation/readLogValidator.d.ts +1 -2
  919. package/dist/validation/readLogValidator.js +60 -22
  920. package/dist/validation/readLogValidator.js.map +1 -1
  921. package/dist/validation/role_validation.d.ts +3 -3
  922. package/dist/validation/role_validation.js +55 -19
  923. package/dist/validation/role_validation.js.map +1 -1
  924. package/dist/validation/schemaMetadataValidator.d.ts +3 -4
  925. package/dist/validation/schemaMetadataValidator.js +11 -12
  926. package/dist/validation/schemaMetadataValidator.js.map +1 -1
  927. package/dist/validation/searchValidator.d.ts +1 -2
  928. package/dist/validation/searchValidator.js +82 -43
  929. package/dist/validation/searchValidator.js.map +1 -1
  930. package/dist/validation/statusValidator.d.ts +1 -1
  931. package/dist/validation/transactionLogValidator.d.ts +3 -3
  932. package/dist/validation/transactionLogValidator.js +52 -17
  933. package/dist/validation/transactionLogValidator.js.map +1 -1
  934. package/dist/validation/user_validation.d.ts +3 -3
  935. package/dist/validation/user_validation.js +38 -6
  936. package/dist/validation/user_validation.js.map +1 -1
  937. package/dist/validation/validationWrapper.d.ts +3 -3
  938. package/dist/validation/validationWrapper.js +4 -5
  939. package/dist/validation/validationWrapper.js.map +1 -1
  940. package/index.ts +5 -0
  941. package/json/systemSchema.json +65 -0
  942. package/launchServiceScripts/utility/checkNodeVersion.js +2 -0
  943. package/package.json +37 -22
  944. package/resources/DESIGN.md +98 -0
  945. package/resources/DatabaseTransaction.ts +58 -30
  946. package/resources/ErrorResource.ts +2 -1
  947. package/resources/LMDBTransaction.ts +38 -29
  948. package/resources/RecordEncoder.ts +12 -4
  949. package/resources/RequestTarget.ts +2 -0
  950. package/resources/Resource.ts +89 -56
  951. package/resources/ResourceInterface.ts +44 -21
  952. package/resources/Resources.ts +8 -8
  953. package/resources/RocksIndexStore.ts +3 -0
  954. package/resources/RocksTransactionLogStore.ts +47 -28
  955. package/resources/Table.ts +386 -214
  956. package/resources/analytics/metadata.ts +1 -0
  957. package/resources/analytics/read.ts +24 -6
  958. package/resources/analytics/write.ts +240 -17
  959. package/resources/auditStore.ts +28 -19
  960. package/resources/blob.ts +53 -53
  961. package/resources/dataLoader.ts +4 -4
  962. package/resources/databases.ts +190 -71
  963. package/resources/graphql.ts +227 -164
  964. package/resources/indexes/HierarchicalNavigableSmallWorld.ts +294 -65
  965. package/resources/indexes/vector.ts +17 -0
  966. package/resources/loadEnv.ts +21 -17
  967. package/resources/login.ts +5 -3
  968. package/resources/models/Models.ts +304 -0
  969. package/resources/models/TestBackend.ts +83 -0
  970. package/resources/models/agentLoop.ts +895 -0
  971. package/resources/models/analyticsTable.ts +199 -0
  972. package/resources/models/backendHelpers.ts +116 -0
  973. package/resources/models/backendRegistry.ts +66 -0
  974. package/resources/models/bootstrap.ts +135 -0
  975. package/resources/models/embedHook.ts +138 -0
  976. package/resources/models/types.ts +296 -0
  977. package/resources/replayLogs.ts +15 -7
  978. package/resources/roles.ts +62 -67
  979. package/resources/search.ts +355 -135
  980. package/resources/tracked.ts +8 -8
  981. package/resources/transaction.ts +8 -8
  982. package/resources/transactionBroadcast.ts +3 -3
  983. package/security/auth.ts +35 -26
  984. package/security/certificateVerification/crlVerification.ts +11 -4
  985. package/security/{cryptoHash.js → cryptoHash.ts} +3 -8
  986. package/security/data_objects/{PermissionAttributeResponseObject.js → PermissionAttributeResponseObject.ts} +4 -4
  987. package/security/data_objects/{PermissionResponseObject.js → PermissionResponseObject.ts} +12 -11
  988. package/security/data_objects/{PermissionTableResponseObject.js → PermissionTableResponseObject.ts} +6 -4
  989. package/security/{fastifyAuth.js → fastifyAuth.ts} +93 -20
  990. package/security/impersonation.ts +3 -3
  991. package/security/jsLoader.ts +22 -8
  992. package/security/{keys.js → keys.ts} +113 -121
  993. package/security/permissionsTranslator.js +2 -2
  994. package/security/{role.js → role.ts} +26 -33
  995. package/security/tokenAuthentication.ts +34 -7
  996. package/security/user.ts +26 -22
  997. package/server/DESIGN.md +139 -0
  998. package/server/DurableSubscriptionsSession.ts +67 -50
  999. package/server/REST.ts +120 -107
  1000. package/server/Server.ts +31 -12
  1001. package/server/fastifyRoutes/helpers/getCORSOptions.js +1 -1
  1002. package/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +1 -1
  1003. package/server/fastifyRoutes/helpers/getServerOptions.js +1 -1
  1004. package/server/fastifyRoutes.ts +37 -33
  1005. package/server/graphqlQuerying.ts +6 -5
  1006. package/server/http.ts +517 -26
  1007. package/server/itc/serverHandlers.js +75 -14
  1008. package/server/jobs/{JobObject.js → JobObject.ts} +13 -6
  1009. package/server/jobs/{jobProcess.js → jobProcess.ts} +20 -16
  1010. package/server/jobs/{jobRunner.js → jobRunner.ts} +20 -21
  1011. package/server/jobs/{jobs.js → jobs.ts} +41 -44
  1012. package/server/loadRootComponents.js +1 -1
  1013. package/server/middlewareChain.ts +270 -0
  1014. package/server/mqtt.ts +35 -26
  1015. package/server/nodeName.ts +2 -1
  1016. package/server/operationsServer.ts +85 -10
  1017. package/server/serverHelpers/Headers.ts +10 -8
  1018. package/server/serverHelpers/JSONStream.ts +15 -5
  1019. package/server/serverHelpers/Request.ts +370 -13
  1020. package/server/serverHelpers/contentTypes.ts +42 -11
  1021. package/server/serverHelpers/multipartParser.ts +152 -0
  1022. package/server/serverHelpers/progressEmitter.ts +110 -0
  1023. package/server/serverHelpers/serverHandlers.js +43 -7
  1024. package/server/serverHelpers/serverUtilities.ts +40 -30
  1025. package/server/static.ts +9 -6
  1026. package/server/status/index.ts +2 -2
  1027. package/server/storageReclamation.ts +39 -2
  1028. package/server/threads/itc.js +7 -4
  1029. package/server/threads/manageThreads.js +100 -26
  1030. package/server/threads/socketRouter.ts +12 -275
  1031. package/server/threads/threadServer.js +345 -105
  1032. package/server/threads/workerProcessGuard.ts +93 -0
  1033. package/server/throttle.ts +18 -0
  1034. package/sqlTranslator/{SelectValidator.js → SelectValidator.ts} +41 -49
  1035. package/sqlTranslator/{alasqlFunctionImporter.js → alasqlFunctionImporter.ts} +5 -5
  1036. package/sqlTranslator/{deleteTranslator.js → deleteTranslator.ts} +13 -18
  1037. package/sqlTranslator/{index.js → index.ts} +30 -33
  1038. package/sqlTranslator/{sql_statement_bucket.js → sql_statement_bucket.ts} +49 -20
  1039. package/static/README.md +10 -9
  1040. package/studio/web/assets/{index-CmtPP0YO.js → index-COfIkCT-.js} +5 -5
  1041. package/studio/web/assets/index-COfIkCT-.js.map +1 -0
  1042. package/studio/web/assets/{index.lazy-C8jvGtlu.js → index.lazy-CIvl7Fj9.js} +2 -2
  1043. package/studio/web/assets/{index.lazy-C8jvGtlu.js.map → index.lazy-CIvl7Fj9.js.map} +1 -1
  1044. package/studio/web/assets/{profile-O0DYlJUv.js → profile-B2ZVB--r.js} +2 -2
  1045. package/studio/web/assets/{profile-O0DYlJUv.js.map → profile-B2ZVB--r.js.map} +1 -1
  1046. package/studio/web/assets/{status-BIlJkJby.js → status-Db6WBmhf.js} +2 -2
  1047. package/studio/web/assets/{status-BIlJkJby.js.map → status-Db6WBmhf.js.map} +1 -1
  1048. package/studio/web/index.html +1 -1
  1049. package/upgrade/{UpgradeObjects.js → UpgradeObjects.ts} +3 -6
  1050. package/upgrade/directives/5-2-0.ts +49 -0
  1051. package/upgrade/directives/{directivesController.js → directivesController.ts} +16 -16
  1052. package/upgrade/{directivesManager.js → directivesManager.ts} +7 -11
  1053. package/upgrade/{upgradePrompt.js → upgradePrompt.ts} +8 -14
  1054. package/upgrade/{upgradeUtilities.js → upgradeUtilities.ts} +3 -7
  1055. package/utility/{OperationFunctionCaller.js → OperationFunctionCaller.ts} +7 -7
  1056. package/utility/{assignCmdEnvVariables.js → assignCmdEnvVariables.ts} +6 -8
  1057. package/utility/{common_utils.js → common_utils.ts} +113 -139
  1058. package/utility/environment/{environmentManager.js → environmentManager.ts} +34 -33
  1059. package/utility/environment/systemInformation.ts +18 -4
  1060. package/utility/errors/{commonErrors.js → commonErrors.ts} +9 -9
  1061. package/utility/errors/{hdbError.js → hdbError.ts} +39 -45
  1062. package/utility/expandEnvVar.ts +110 -0
  1063. package/utility/functions/geo.js +2 -2
  1064. package/utility/functions/sql/alaSQLExtension.js +1 -1
  1065. package/utility/globalSchema.ts +30 -0
  1066. package/utility/hdbTerms.ts +56 -0
  1067. package/utility/install/checkJWTTokensExist.js +1 -1
  1068. package/utility/install/{installer.js → installer.ts} +38 -39
  1069. package/utility/installation.ts +2 -2
  1070. package/utility/lmdb/{DBIDefinition.js → DBIDefinition.ts} +4 -1
  1071. package/utility/lmdb/{DeleteRecordsResponseObject.js → DeleteRecordsResponseObject.ts} +2 -1
  1072. package/utility/lmdb/{InsertRecordsResponseObject.js → InsertRecordsResponseObject.ts} +2 -1
  1073. package/utility/lmdb/OpenDBIObject.ts +43 -0
  1074. package/utility/lmdb/{OpenEnvironmentObject.js → OpenEnvironmentObject.ts} +19 -6
  1075. package/utility/lmdb/{UpdateRecordsResponseObject.js → UpdateRecordsResponseObject.ts} +2 -1
  1076. package/utility/lmdb/{UpsertRecordsResponseObject.js → UpsertRecordsResponseObject.ts} +2 -1
  1077. package/utility/lmdb/{cleanLMDBMap.js → cleanLMDBMap.ts} +5 -5
  1078. package/utility/lmdb/{commonUtility.js → commonUtility.ts} +13 -21
  1079. package/utility/lmdb/{deleteUtility.js → deleteUtility.ts} +8 -12
  1080. package/utility/lmdb/{environmentUtility.js → environmentUtility.ts} +43 -52
  1081. package/utility/lmdb/{searchCursorFunctions.js → searchCursorFunctions.ts} +12 -26
  1082. package/utility/lmdb/{searchUtility.js → searchUtility.ts} +75 -64
  1083. package/utility/lmdb/{terms.js → terms.ts} +10 -23
  1084. package/utility/lmdb/{writeUtility.js → writeUtility.ts} +37 -22
  1085. package/utility/logging/{harper_logger.js → harper_logger.ts} +136 -89
  1086. package/utility/logging/{logRotator.js → logRotator.ts} +13 -13
  1087. package/utility/logging/logger.ts +1 -1
  1088. package/utility/logging/{readLog.js → readLog.ts} +19 -19
  1089. package/utility/logging/{transactionLog.js → transactionLog.ts} +10 -14
  1090. package/utility/{mount_hdb.js → mount_hdb.ts} +15 -16
  1091. package/utility/{npmUtilities.js → npmUtilities.ts} +14 -17
  1092. package/utility/{operation_authorization.js → operation_authorization.ts} +173 -124
  1093. package/utility/packageUtils.js +7 -16
  1094. package/utility/password.ts +1 -1
  1095. package/utility/processManagement/processManagement.js +2 -2
  1096. package/utility/processManagement/servicesConfig.js +1 -1
  1097. package/utility/{signalling.js → signalling.ts} +6 -11
  1098. package/utility/watcherFallback.ts +74 -0
  1099. package/validation/analyticsValidator.ts +43 -0
  1100. package/validation/{bulkDeleteValidator.js → bulkDeleteValidator.ts} +5 -5
  1101. package/validation/{check_permissions.js → check_permissions.ts} +3 -3
  1102. package/validation/{common_validators.js → common_validators.ts} +12 -24
  1103. package/validation/{configValidator.js → configValidator.ts} +114 -18
  1104. package/validation/{deleteValidator.js → deleteValidator.ts} +5 -5
  1105. package/validation/{fileLoadValidator.js → fileLoadValidator.ts} +12 -19
  1106. package/validation/{insertValidator.js → insertValidator.ts} +5 -5
  1107. package/validation/{installValidator.js → installValidator.ts} +8 -8
  1108. package/validation/{readLogValidator.js → readLogValidator.ts} +10 -10
  1109. package/validation/{role_validation.js → role_validation.ts} +26 -32
  1110. package/validation/{schemaMetadataValidator.js → schemaMetadataValidator.ts} +5 -11
  1111. package/validation/{searchValidator.js → searchValidator.ts} +12 -11
  1112. package/validation/statusValidator.ts +1 -1
  1113. package/validation/{transactionLogValidator.js → transactionLogValidator.ts} +4 -9
  1114. package/validation/{user_validation.js → user_validation.ts} +4 -10
  1115. package/validation/{validationWrapper.js → validationWrapper.ts} +3 -9
  1116. package/bin/cliOperations.js +0 -159
  1117. package/bin/lite.js +0 -5
  1118. package/dataLayer/harperBridge/BridgeMethods.js +0 -85
  1119. package/studio/web/assets/index-CmtPP0YO.js.map +0 -1
  1120. package/utility/globalSchema.js +0 -35
  1121. package/utility/lmdb/OpenDBIObject.js +0 -31
@@ -0,0 +1,185 @@
1
+ 'use strict';
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.handleListDeployments = handleListDeployments;
37
+ exports.handleGetDeployment = handleGetDeployment;
38
+ // Read-side operations against system.hdb_deployment.
39
+ // Write-side lives in deploymentRecorder.ts; this module only reads.
40
+ const databases_ts_1 = require("../resources/databases.js");
41
+ const terms = __importStar(require("../utility/hdbTerms.js"));
42
+ const hdbError_ts_1 = require("../utility/errors/hdbError.js");
43
+ const deploymentRecorder_ts_1 = require("./deploymentRecorder.js");
44
+ const DEPLOYMENT_TABLE = terms.SYSTEM_TABLE_NAMES.DEPLOYMENT_TABLE_NAME;
45
+ const TERMINAL_STATUSES = new Set(['success', 'failed', 'rolled_back']);
46
+ function deploymentTable() {
47
+ const table = databases_ts_1.databases.system?.[DEPLOYMENT_TABLE];
48
+ if (!table) {
49
+ throw new hdbError_ts_1.ClientError(`Deployment tracking is not initialized on this node (system.${DEPLOYMENT_TABLE} missing). ` +
50
+ `Run upgrade or restart the server to provision the table.`);
51
+ }
52
+ return table;
53
+ }
54
+ // Strip the blob attribute from a row; the bytes never travel over the operations API.
55
+ // A separate get_deployment_payload operation streams the raw bytes when callers need them.
56
+ function stripBlob(row) {
57
+ if (!row || typeof row !== 'object')
58
+ return row;
59
+ const { payload_blob, ...rest } = row;
60
+ rest.payload_blob_present = payload_blob != null;
61
+ return rest;
62
+ }
63
+ async function handleListDeployments(req = {}) {
64
+ const table = deploymentTable();
65
+ const conditions = [];
66
+ if (req.project)
67
+ conditions.push({ attribute: 'project', value: req.project });
68
+ if (req.status)
69
+ conditions.push({ attribute: 'status', value: req.status });
70
+ if (req.since != null)
71
+ conditions.push({ attribute: 'started_at', value: req.since, comparator: 'greater_than_equal' });
72
+ if (req.until != null)
73
+ conditions.push({ attribute: 'started_at', value: req.until, comparator: 'less_than_equal' });
74
+ const collected = [];
75
+ for await (const row of table.search(conditions)) {
76
+ collected.push(stripBlob(row));
77
+ }
78
+ // Newest first by started_at; ties broken by deployment_id for stability.
79
+ collected.sort((a, b) => (b.started_at ?? 0) - (a.started_at ?? 0) || String(a.deployment_id).localeCompare(b.deployment_id));
80
+ const total = collected.length;
81
+ const offset = Math.max(0, req.offset ?? 0);
82
+ const limit = req.limit != null ? Math.max(0, req.limit) : collected.length;
83
+ return { deployments: collected.slice(offset, offset + limit), total };
84
+ }
85
+ async function handleGetDeployment(req) {
86
+ if (!req || !req.deployment_id) {
87
+ throw new hdbError_ts_1.ClientError(`'deployment_id' is required`);
88
+ }
89
+ const table = deploymentTable();
90
+ const row = await table.get(req.deployment_id);
91
+ if (!row) {
92
+ throw new hdbError_ts_1.ClientError(`No deployment found with id '${req.deployment_id}'`);
93
+ }
94
+ // SSE content-negotiated branch — when serverHandlers.js detects
95
+ // `Accept: text/event-stream` it attaches a ProgressEmitter as req.progress and wraps
96
+ // our return as the operation's final SSE event. We replay event_log on connect, then
97
+ // tail the deployment's live emitter (if it's still running on this node) until it
98
+ // reaches a terminal status. The final return value becomes the SSE `done` event.
99
+ if (req.progress && typeof req.progress.emit === 'function') {
100
+ const sse = req.progress;
101
+ const liveEmitter = (0, deploymentRecorder_ts_1.getActiveEmitter)(req.deployment_id);
102
+ // Subscribe FIRST, before reading the row, so any event the recorder emits between
103
+ // "now" and the moment we finish reading the historical log still lands. Buffer
104
+ // those live events; dedupe by recording the timestamp of the last replayed entry
105
+ // and skipping any live event whose timestamp is <= that. Forward everything else.
106
+ let lastReplayedTs = 0;
107
+ let resolveLive = null;
108
+ let liveDone = false;
109
+ const liveBuffer = [];
110
+ const forwardLive = (e) => {
111
+ sse.emit(e.event, e.data);
112
+ // A terminal signal — either explicit success/error event from the lifecycle, or
113
+ // the recorder's `_recorder_finished` sentinel emitted before it unsubscribes.
114
+ const isTerminalEvent = e.event === '_recorder_finished' ||
115
+ e.event === 'error' ||
116
+ (e.event === 'phase' &&
117
+ e.data &&
118
+ typeof e.data === 'object' &&
119
+ e.data.phase === 'success');
120
+ if (isTerminalEvent && !liveDone) {
121
+ liveDone = true;
122
+ resolveLive?.();
123
+ }
124
+ };
125
+ const unsubscribe = liveEmitter
126
+ ? liveEmitter.subscribe((event) => {
127
+ const t = Date.now();
128
+ if (resolveLive) {
129
+ // Replay phase finished; we own the live forward path now.
130
+ if (t > lastReplayedTs)
131
+ forwardLive(event);
132
+ }
133
+ else {
134
+ // Still replaying; stash for dedup-and-forward once replay completes.
135
+ liveBuffer.push({ t, event });
136
+ }
137
+ })
138
+ : null;
139
+ try {
140
+ for (const entry of row.event_log ?? []) {
141
+ sse.emit(entry.event, entry.data);
142
+ if (typeof entry.t === 'number')
143
+ lastReplayedTs = Math.max(lastReplayedTs, entry.t);
144
+ }
145
+ if (liveEmitter && !TERMINAL_STATUSES.has(row.status)) {
146
+ await new Promise((resolve) => {
147
+ resolveLive = resolve;
148
+ // Flush anything that arrived during replay, filtering to events the replay missed.
149
+ for (const buffered of liveBuffer) {
150
+ if (buffered.t > lastReplayedTs)
151
+ forwardLive(buffered.event);
152
+ }
153
+ if (liveDone)
154
+ resolve();
155
+ // Safety net — if the in-memory emitter is dropped (recorder finished or
156
+ // the process recycled) before signaling, poll the row's status as a
157
+ // fallback so the client never hangs indefinitely.
158
+ const pollTimer = setInterval(async () => {
159
+ if (liveDone) {
160
+ clearInterval(pollTimer);
161
+ return;
162
+ }
163
+ const live = (0, deploymentRecorder_ts_1.getActiveEmitter)(req.deployment_id);
164
+ if (!live || live !== liveEmitter) {
165
+ clearInterval(pollTimer);
166
+ const latest = await table.get(req.deployment_id);
167
+ if (latest && TERMINAL_STATUSES.has(latest.status) && !liveDone) {
168
+ liveDone = true;
169
+ resolve();
170
+ }
171
+ }
172
+ }, 500);
173
+ });
174
+ }
175
+ // Re-read the row so the final SSE payload reflects the post-deploy state.
176
+ const finalRow = await table.get(req.deployment_id);
177
+ return stripBlob(finalRow ?? row);
178
+ }
179
+ finally {
180
+ unsubscribe?.();
181
+ }
182
+ }
183
+ return stripBlob(row);
184
+ }
185
+ //# sourceMappingURL=deploymentOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploymentOperations.js","sourceRoot":"","sources":["../../components/deploymentOperations.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,81 @@
1
+ import type { Readable } from 'node:stream';
2
+ import { ProgressEmitter } from '../server/serverHelpers/progressEmitter.ts';
3
+ export declare function getActiveEmitter(deploymentId: string): ProgressEmitter | undefined;
4
+ type DeploymentStatus = 'pending' | 'extracting' | 'installing' | 'loading' | 'replicating' | 'restarting' | 'success' | 'failed' | 'rolled_back';
5
+ interface CreateOptions {
6
+ project?: string;
7
+ package_identifier?: string;
8
+ user?: string;
9
+ restart_mode?: 'immediate' | 'rolling' | null;
10
+ rollback_of?: string | null;
11
+ emitter?: ProgressEmitter;
12
+ }
13
+ export declare class DeploymentRecorder {
14
+ readonly deploymentId: string;
15
+ private readonly record;
16
+ private hash;
17
+ private byteCount;
18
+ private finished;
19
+ private unsubscribe;
20
+ private pendingPut;
21
+ private dirty;
22
+ private constructor();
23
+ static create(options: CreateOptions): Promise<DeploymentRecorder>;
24
+ /**
25
+ * Subscribe to a ProgressEmitter. Each event is appended (bounded) to event_log; phase
26
+ * events also update the row's `status` and `phase` fields. Writes coalesce: a put is
27
+ * always pending after the first event in a burst, so chatty install output collapses
28
+ * to one row update per ~100ms instead of one per line.
29
+ */
30
+ private subscribeTo;
31
+ private appendEvent;
32
+ private scheduleFlush;
33
+ /**
34
+ * Drain a payload source (Buffer or Readable) into the row's payload_blob attribute,
35
+ * computing sha256 and byte count alongside. After this resolves the row has been
36
+ * committed once with the final hash and size, and `this.row.payload_blob.stream()`
37
+ * yields a fresh Readable that callers can pass to extraction.
38
+ *
39
+ * Buffers the payload in memory (subject to PAYLOAD_BUFFER_CAP_BYTES) so the
40
+ * hash/size are known synchronously before we commit and so the blob's `saveBlob`
41
+ * lifecycle doesn't race with our digest() call. A streaming variant is a planned
42
+ * follow-up that uses the unused `hash`/`byteCount` instance fields below.
43
+ */
44
+ ingestPayload(source: Readable | Buffer | string): Promise<void>;
45
+ transitionPhase(phase: string, status?: DeploymentStatus): Promise<void>;
46
+ /**
47
+ * Upsert a single peer outcome by node name. Called per-peer as each replication
48
+ * target settles, so the row reflects in-flight progress rather than only the
49
+ * final aggregate. Routes through `scheduleFlush()` so the write coalesces with
50
+ * the emitter-driven puts and the latest in-memory state always wins.
51
+ *
52
+ * Tolerates unknown shapes — anything we can't interpret becomes a plain
53
+ * stringified entry so the audit trail at least records that a peer was contacted.
54
+ */
55
+ recordPeer(result: unknown): void;
56
+ /**
57
+ * Bulk-record a final aggregate of peer outcomes. Equivalent to calling recordPeer()
58
+ * for each entry. Useful for replication layers that surface results all-at-once
59
+ * via Promise.allSettled rather than via a per-peer callback.
60
+ */
61
+ recordPeers(results: unknown): void;
62
+ finish(status: 'success' | 'failed' | 'rolled_back', error?: unknown): Promise<void>;
63
+ get row(): Record<string, any>;
64
+ private put;
65
+ }
66
+ /**
67
+ * Peer-side helper — wait for the hdb_deployment row to arrive via table replication,
68
+ * then return it. The row is committed on origin before `replicateOperation` is
69
+ * called, so peers normally find it immediately; this polling loop is for the rare
70
+ * case where the operation arrives faster than the table-replication channel.
71
+ *
72
+ * The payload_blob's chunks may still be in flight after the row arrives — that's
73
+ * fine, the Blob's `stream()` / `bytes()` API blocks on incomplete writes
74
+ * (resources/blob.ts).
75
+ */
76
+ export declare function awaitDeploymentRow(deploymentId: string, options?: {
77
+ timeoutMs?: number;
78
+ pollIntervalMs?: number;
79
+ initialPollIntervalMs?: number;
80
+ }): Promise<Record<string, any>>;
81
+ export {};
@@ -0,0 +1,401 @@
1
+ 'use strict';
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.DeploymentRecorder = void 0;
37
+ exports.getActiveEmitter = getActiveEmitter;
38
+ exports.awaitDeploymentRow = awaitDeploymentRow;
39
+ // DeploymentRecorder — lifecycle owner for one row in system.hdb_deployment.
40
+ //
41
+ // Creates the pending row at deploy start, persists the upload payload into the row's
42
+ // payload_blob (with sha256 + size), and writes the terminal status at the end.
43
+ // Subscribes to a ProgressEmitter so phase transitions and install lines land in
44
+ // event_log as they happen — making the deploy observable by Studio polling
45
+ // get_deployment without an attached CLI. The persisted payload_blob will also serve
46
+ // as the rollback source when that operation lands.
47
+ const node_crypto_1 = require("node:crypto");
48
+ const node_crypto_2 = require("node:crypto");
49
+ const databases_ts_1 = require("../resources/databases.js");
50
+ const blob_ts_1 = require("../resources/blob.js");
51
+ const terms = __importStar(require("../utility/hdbTerms.js"));
52
+ const hdbError_ts_1 = require("../utility/errors/hdbError.js");
53
+ const node_os_1 = require("node:os");
54
+ // Bound the event_log so a pathologically chatty install can't grow a row without limit.
55
+ // 200 entries comfortably covers a real deploy with headroom (phase events plus install
56
+ // line summaries). When we exceed the cap, drop the middle rather than the front — the
57
+ // lifecycle spine (prepare → load → replicate → success) is the most valuable context
58
+ // for debugging, and naive front-truncation loses it under a chatty `npm install`.
59
+ const EVENT_LOG_MAX = 200;
60
+ const EVENT_LOG_HEAD_KEEP = 20;
61
+ // In-memory registry of live emitters, keyed by deployment_id. Populated for the lifetime
62
+ // of an in-progress deploy on the origin node; get_deployment SSE looks here to tail live
63
+ // events after replaying event_log. Per-node, not replicated — peers don't see another
64
+ // node's in-progress emitters. Cross-node tailing is a later concern.
65
+ const activeEmitters = new Map();
66
+ function getActiveEmitter(deploymentId) {
67
+ return activeEmitters.get(deploymentId);
68
+ }
69
+ // Interim cap: ingestPayload currently buffers the entire payload in memory before
70
+ // computing the hash and persisting. This cap prevents an OOM on accidentally-huge
71
+ // uploads. A follow-up will swap this for a true streaming-hash + blob-source pattern
72
+ // that lifts the limit back to whatever the replication path supports.
73
+ const PAYLOAD_BUFFER_CAP_BYTES = 200 * 1024 * 1024;
74
+ class DeploymentRecorder {
75
+ deploymentId;
76
+ record;
77
+ hash = null;
78
+ byteCount = 0;
79
+ finished = false;
80
+ unsubscribe = null;
81
+ pendingPut = null;
82
+ dirty = false;
83
+ constructor(deploymentId, initial) {
84
+ this.deploymentId = deploymentId;
85
+ this.record = initial;
86
+ }
87
+ static async create(options) {
88
+ const deploymentId = (0, node_crypto_1.randomUUID)();
89
+ const startedAt = Date.now();
90
+ const record = {
91
+ deployment_id: deploymentId,
92
+ project: options.project ?? null,
93
+ package_identifier: options.package_identifier ?? null,
94
+ payload_hash: null,
95
+ payload_size: null,
96
+ payload_blob: null,
97
+ status: 'pending',
98
+ phase: 'pending',
99
+ event_log: [],
100
+ peer_results: [],
101
+ origin_node: (0, node_os_1.hostname)(),
102
+ restart_mode: options.restart_mode ?? null,
103
+ started_at: startedAt,
104
+ completed_at: null,
105
+ user: options.user ?? null,
106
+ rollback_of: options.rollback_of ?? null,
107
+ error: null,
108
+ };
109
+ const recorder = new DeploymentRecorder(deploymentId, record);
110
+ await recorder.put();
111
+ if (options.emitter) {
112
+ recorder.subscribeTo(options.emitter);
113
+ activeEmitters.set(deploymentId, options.emitter);
114
+ }
115
+ return recorder;
116
+ }
117
+ /**
118
+ * Subscribe to a ProgressEmitter. Each event is appended (bounded) to event_log; phase
119
+ * events also update the row's `status` and `phase` fields. Writes coalesce: a put is
120
+ * always pending after the first event in a burst, so chatty install output collapses
121
+ * to one row update per ~100ms instead of one per line.
122
+ */
123
+ subscribeTo(emitter) {
124
+ this.unsubscribe = emitter.subscribe((event) => {
125
+ this.appendEvent(event.event, event.data);
126
+ });
127
+ }
128
+ appendEvent(event, data) {
129
+ if (this.finished)
130
+ return;
131
+ const log = this.record.event_log;
132
+ log.push({ t: Date.now(), event, data });
133
+ // Keep the head (lifecycle spine) and tail (most-recent activity); drop the middle.
134
+ if (log.length > EVENT_LOG_MAX) {
135
+ const tailKeep = EVENT_LOG_MAX - EVENT_LOG_HEAD_KEEP - 1; // -1 for the truncation marker
136
+ const removedCount = log.length - EVENT_LOG_HEAD_KEEP - tailKeep;
137
+ log.splice(EVENT_LOG_HEAD_KEEP, log.length - EVENT_LOG_HEAD_KEEP - tailKeep, {
138
+ t: Date.now(),
139
+ event: 'truncated',
140
+ data: { dropped_events: removedCount },
141
+ });
142
+ }
143
+ // Phase events drive the canonical status/phase fields used by list_deployments.
144
+ if (event === 'phase' && data && typeof data === 'object') {
145
+ const p = data;
146
+ if (p.phase)
147
+ this.record.phase = p.phase;
148
+ if (p.status === 'start') {
149
+ const mapped = startStatusFor(p.phase);
150
+ if (mapped)
151
+ this.record.status = mapped;
152
+ }
153
+ }
154
+ this.scheduleFlush();
155
+ }
156
+ // Coalesce writes: at most one in-flight put at a time. While a put is running, mark
157
+ // the record dirty; the chained continuation issues a follow-up put once the prior one
158
+ // settles. This keeps event_log writes O(1) puts per burst rather than O(N) per event.
159
+ scheduleFlush() {
160
+ if (this.pendingPut) {
161
+ this.dirty = true;
162
+ return;
163
+ }
164
+ this.pendingPut = this.put().finally(() => {
165
+ this.pendingPut = null;
166
+ if (this.dirty) {
167
+ this.dirty = false;
168
+ this.scheduleFlush();
169
+ }
170
+ });
171
+ }
172
+ /**
173
+ * Drain a payload source (Buffer or Readable) into the row's payload_blob attribute,
174
+ * computing sha256 and byte count alongside. After this resolves the row has been
175
+ * committed once with the final hash and size, and `this.row.payload_blob.stream()`
176
+ * yields a fresh Readable that callers can pass to extraction.
177
+ *
178
+ * Buffers the payload in memory (subject to PAYLOAD_BUFFER_CAP_BYTES) so the
179
+ * hash/size are known synchronously before we commit and so the blob's `saveBlob`
180
+ * lifecycle doesn't race with our digest() call. A streaming variant is a planned
181
+ * follow-up that uses the unused `hash`/`byteCount` instance fields below.
182
+ */
183
+ async ingestPayload(source) {
184
+ const hash = (0, node_crypto_2.createHash)('sha256');
185
+ let byteCount = 0;
186
+ let buffer;
187
+ if (Buffer.isBuffer(source)) {
188
+ buffer = source;
189
+ }
190
+ else if (typeof source === 'string') {
191
+ // Legacy CBOR/JSON path: payload arrives as a base64-encoded string.
192
+ buffer = Buffer.from(source, 'base64');
193
+ }
194
+ else {
195
+ const chunks = [];
196
+ let collected = 0;
197
+ for await (const chunk of source) {
198
+ const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
199
+ collected += buf.length;
200
+ if (collected > PAYLOAD_BUFFER_CAP_BYTES) {
201
+ source.destroy?.();
202
+ throw new hdbError_ts_1.ClientError(`Deploy payload exceeds the ${PAYLOAD_BUFFER_CAP_BYTES} byte buffer cap. ` +
203
+ `Use a package identifier (npm:/file:/git:) for larger components.`);
204
+ }
205
+ chunks.push(buf);
206
+ }
207
+ buffer = Buffer.concat(chunks);
208
+ }
209
+ if (buffer.length > PAYLOAD_BUFFER_CAP_BYTES) {
210
+ throw new hdbError_ts_1.ClientError(`Deploy payload (${buffer.length} bytes) exceeds the ${PAYLOAD_BUFFER_CAP_BYTES} byte buffer cap. ` +
211
+ `Use a package identifier (npm:/file:/git:) for larger components.`);
212
+ }
213
+ hash.update(buffer);
214
+ byteCount = buffer.length;
215
+ this.record.payload_blob = (0, blob_ts_1.createBlob)(buffer, { type: 'application/gzip' });
216
+ this.record.payload_hash = hash.digest('hex');
217
+ this.record.payload_size = byteCount;
218
+ // Touch the unused private fields so the type system stays happy when a streaming
219
+ // variant lands that uses them.
220
+ this.hash = hash;
221
+ this.byteCount = byteCount;
222
+ await this.put();
223
+ }
224
+ async transitionPhase(phase, status) {
225
+ this.record.phase = phase;
226
+ if (status)
227
+ this.record.status = status;
228
+ await this.put();
229
+ }
230
+ /**
231
+ * Upsert a single peer outcome by node name. Called per-peer as each replication
232
+ * target settles, so the row reflects in-flight progress rather than only the
233
+ * final aggregate. Routes through `scheduleFlush()` so the write coalesces with
234
+ * the emitter-driven puts and the latest in-memory state always wins.
235
+ *
236
+ * Tolerates unknown shapes — anything we can't interpret becomes a plain
237
+ * stringified entry so the audit trail at least records that a peer was contacted.
238
+ */
239
+ recordPeer(result) {
240
+ if (this.finished)
241
+ return;
242
+ const normalized = normalizePeerResult(result);
243
+ // Defensive: rows freshly created via create() always have peer_results=[], but if
244
+ // a replicated row was loaded back where the attribute is absent or null we want
245
+ // to initialize lazily rather than throw on `.findIndex`.
246
+ if (!Array.isArray(this.record.peer_results))
247
+ this.record.peer_results = [];
248
+ const list = this.record.peer_results;
249
+ // Upsert by node name when present; otherwise append (we can't dedupe without an id).
250
+ const nodeName = normalized.node;
251
+ const idx = nodeName ? list.findIndex((entry) => entry.node === nodeName) : -1;
252
+ if (idx >= 0) {
253
+ list[idx] = normalized;
254
+ }
255
+ else {
256
+ list.push(normalized);
257
+ }
258
+ this.scheduleFlush();
259
+ }
260
+ /**
261
+ * Bulk-record a final aggregate of peer outcomes. Equivalent to calling recordPeer()
262
+ * for each entry. Useful for replication layers that surface results all-at-once
263
+ * via Promise.allSettled rather than via a per-peer callback.
264
+ */
265
+ recordPeers(results) {
266
+ if (this.finished)
267
+ return;
268
+ if (!Array.isArray(results))
269
+ return;
270
+ for (const result of results)
271
+ this.recordPeer(result);
272
+ }
273
+ async finish(status, error) {
274
+ if (this.finished)
275
+ return;
276
+ // Send a terminal sentinel through the emitter (if any) BEFORE we unsubscribe and
277
+ // remove it from the registry, so any SSE tail subscribers can resolve their wait
278
+ // even on a code path that doesn't emit an explicit `error` event.
279
+ const emitter = activeEmitters.get(this.deploymentId);
280
+ emitter?.emit('_recorder_finished', { status });
281
+ this.finished = true;
282
+ this.unsubscribe?.();
283
+ this.unsubscribe = null;
284
+ activeEmitters.delete(this.deploymentId);
285
+ // Drain the ENTIRE coalesced-flush chain before mutating + persisting the terminal
286
+ // state. Just awaiting `this.pendingPut` once isn't enough: its `.finally` may
287
+ // re-schedule another put (when `dirty` was set during the in-flight put), and
288
+ // that re-scheduled put captures a pre-mutation snapshot of the record. Without
289
+ // this loop, the re-scheduled put can complete AFTER our terminal put and
290
+ // overwrite status=success with stale state.
291
+ while (this.pendingPut) {
292
+ try {
293
+ await this.pendingPut;
294
+ }
295
+ catch {
296
+ /* the next put surfaces the error */
297
+ }
298
+ }
299
+ this.record.status = status;
300
+ this.record.completed_at = Date.now();
301
+ if (error) {
302
+ const e = error;
303
+ this.record.error = {
304
+ message: e?.message ?? String(error),
305
+ code: e?.code,
306
+ phase: this.record.phase,
307
+ };
308
+ }
309
+ await this.put();
310
+ }
311
+ get row() {
312
+ return this.record;
313
+ }
314
+ async put() {
315
+ const table = databases_ts_1.databases.system?.[terms.SYSTEM_TABLE_NAMES.DEPLOYMENT_TABLE_NAME];
316
+ if (!table) {
317
+ // Table missing means the upgrade directive hasn't run yet (or the table got dropped).
318
+ // We tolerate this — tracking is observability; the deploy itself must still succeed.
319
+ return;
320
+ }
321
+ await table.put(this.record);
322
+ }
323
+ }
324
+ exports.DeploymentRecorder = DeploymentRecorder;
325
+ /**
326
+ * Peer-side helper — wait for the hdb_deployment row to arrive via table replication,
327
+ * then return it. The row is committed on origin before `replicateOperation` is
328
+ * called, so peers normally find it immediately; this polling loop is for the rare
329
+ * case where the operation arrives faster than the table-replication channel.
330
+ *
331
+ * The payload_blob's chunks may still be in flight after the row arrives — that's
332
+ * fine, the Blob's `stream()` / `bytes()` API blocks on incomplete writes
333
+ * (resources/blob.ts).
334
+ */
335
+ async function awaitDeploymentRow(deploymentId, options = {}) {
336
+ const timeoutMs = options.timeoutMs ?? 30_000;
337
+ const maxIntervalMs = options.pollIntervalMs ?? 100;
338
+ // Start fast (5ms) so the common case — replication has already caught up — sees no
339
+ // human-noticeable latency, then back off exponentially up to maxIntervalMs for the
340
+ // rare case where the row is genuinely still replicating.
341
+ let intervalMs = options.initialPollIntervalMs ?? 5;
342
+ const table = databases_ts_1.databases.system?.[terms.SYSTEM_TABLE_NAMES.DEPLOYMENT_TABLE_NAME];
343
+ if (!table) {
344
+ throw new Error(`Deployment tracking is not initialized on this node (system.${terms.SYSTEM_TABLE_NAMES.DEPLOYMENT_TABLE_NAME} missing).`);
345
+ }
346
+ const deadline = Date.now() + timeoutMs;
347
+ let lastError;
348
+ while (Date.now() < deadline) {
349
+ try {
350
+ const row = await table.get(deploymentId);
351
+ if (row && row.payload_blob != null)
352
+ return row;
353
+ }
354
+ catch (err) {
355
+ lastError = err;
356
+ }
357
+ await new Promise((resolve) => setTimeout(resolve, intervalMs));
358
+ intervalMs = Math.min(intervalMs * 2, maxIntervalMs);
359
+ }
360
+ throw new Error(`Timed out after ${timeoutMs}ms waiting for hdb_deployment row '${deploymentId}' to replicate` +
361
+ (lastError ? ` (last error: ${lastError.message ?? lastError})` : ''));
362
+ }
363
+ function normalizePeerResult(raw) {
364
+ if (!raw || typeof raw !== 'object') {
365
+ // Replication layer returned a primitive — preserve as a stringified marker so the
366
+ // audit row at least records that something came back from a peer.
367
+ return { node: null, status: 'unknown', raw: String(raw) };
368
+ }
369
+ const r = raw;
370
+ const err = r.error;
371
+ const hasError = err != null && (typeof err === 'string' ? err.length > 0 : typeof err === 'object' || typeof err === 'number');
372
+ return {
373
+ node: r.node ?? r.name ?? r.hostname ?? null,
374
+ status: hasError ? 'failed' : (r.status ?? 'success'),
375
+ error: hasError
376
+ ? {
377
+ message: typeof err === 'object' ? (err.message ?? String(err)) : String(err),
378
+ code: typeof err === 'object' ? err.code : undefined,
379
+ }
380
+ : null,
381
+ started_at: r.started_at ?? null,
382
+ completed_at: r.completed_at ?? null,
383
+ };
384
+ }
385
+ function startStatusFor(phase) {
386
+ switch (phase) {
387
+ case 'extract':
388
+ return 'extracting';
389
+ case 'install':
390
+ return 'installing';
391
+ case 'load':
392
+ return 'loading';
393
+ case 'replicate':
394
+ return 'replicating';
395
+ case 'restart':
396
+ return 'restarting';
397
+ default:
398
+ return null;
399
+ }
400
+ }
401
+ //# sourceMappingURL=deploymentRecorder.js.map