harper 5.1.20 → 5.2.0-alpha.5

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 (395) hide show
  1. package/agent/operations.ts +13 -16
  2. package/components/Application.ts +188 -7
  3. package/components/ApplicationScope.ts +3 -0
  4. package/components/Scope.ts +12 -0
  5. package/components/anthropic/index.ts +9 -2
  6. package/components/bedrock/index.ts +25 -2
  7. package/components/componentLoader.ts +56 -7
  8. package/components/componentSecrets.ts +451 -0
  9. package/components/deploymentRecorder.ts +7 -1
  10. package/components/mcp/adapters/fastify.ts +3 -0
  11. package/components/mcp/adapters/harperHttp.ts +3 -0
  12. package/components/mcp/audit.ts +21 -6
  13. package/components/mcp/customResourceRegistry.ts +17 -38
  14. package/components/mcp/listChanged.ts +37 -20
  15. package/components/mcp/quota.ts +145 -0
  16. package/components/mcp/rateLimit.ts +152 -14
  17. package/components/mcp/resources.ts +2 -4
  18. package/components/mcp/toolRegistry.ts +73 -4
  19. package/components/mcp/tools/application.ts +77 -8
  20. package/components/mcp/tools/operations.ts +106 -36
  21. package/components/mcp/tools/schemas/operationDescriptions.ts +4 -4
  22. package/components/mcp/tools/schemas/operations.ts +5 -0
  23. package/components/mcp/transport.ts +55 -4
  24. package/components/ollama/index.ts +6 -2
  25. package/components/openai/index.ts +9 -2
  26. package/components/operations.js +204 -10
  27. package/components/operationsValidation.js +173 -0
  28. package/components/secretOperations.ts +498 -0
  29. package/config/configUtils.ts +25 -1
  30. package/config-app.schema.json +81 -0
  31. package/config-root.schema.json +8 -1
  32. package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +4 -3
  33. package/dataLayer/readAuditLog.ts +14 -0
  34. package/dataLayer/schemaDescribe.ts +1 -0
  35. package/dist/agent/operations.d.ts +7 -4
  36. package/dist/agent/operations.js +13 -15
  37. package/dist/agent/operations.js.map +1 -1
  38. package/dist/components/Application.d.ts +25 -2
  39. package/dist/components/Application.js +166 -7
  40. package/dist/components/Application.js.map +1 -1
  41. package/dist/components/ApplicationScope.d.ts +2 -0
  42. package/dist/components/ApplicationScope.js +3 -0
  43. package/dist/components/ApplicationScope.js.map +1 -1
  44. package/dist/components/Scope.d.ts +8 -0
  45. package/dist/components/Scope.js +11 -0
  46. package/dist/components/Scope.js.map +1 -1
  47. package/dist/components/anthropic/index.d.ts +4 -1
  48. package/dist/components/anthropic/index.js +4 -2
  49. package/dist/components/anthropic/index.js.map +1 -1
  50. package/dist/components/bedrock/index.d.ts +4 -1
  51. package/dist/components/bedrock/index.js +22 -2
  52. package/dist/components/bedrock/index.js.map +1 -1
  53. package/dist/components/componentLoader.d.ts +2 -0
  54. package/dist/components/componentLoader.js +52 -10
  55. package/dist/components/componentLoader.js.map +1 -1
  56. package/dist/components/componentSecrets.d.ts +63 -0
  57. package/dist/components/componentSecrets.js +405 -0
  58. package/dist/components/componentSecrets.js.map +1 -0
  59. package/dist/components/deploymentRecorder.d.ts +3 -0
  60. package/dist/components/deploymentRecorder.js +4 -3
  61. package/dist/components/deploymentRecorder.js.map +1 -1
  62. package/dist/components/mcp/adapters/fastify.d.ts +2 -0
  63. package/dist/components/mcp/adapters/fastify.js +1 -0
  64. package/dist/components/mcp/adapters/fastify.js.map +1 -1
  65. package/dist/components/mcp/adapters/harperHttp.d.ts +2 -0
  66. package/dist/components/mcp/adapters/harperHttp.js +1 -0
  67. package/dist/components/mcp/adapters/harperHttp.js.map +1 -1
  68. package/dist/components/mcp/audit.d.ts +2 -2
  69. package/dist/components/mcp/audit.js +20 -5
  70. package/dist/components/mcp/audit.js.map +1 -1
  71. package/dist/components/mcp/customResourceRegistry.d.ts +5 -12
  72. package/dist/components/mcp/customResourceRegistry.js +15 -30
  73. package/dist/components/mcp/customResourceRegistry.js.map +1 -1
  74. package/dist/components/mcp/listChanged.d.ts +7 -2
  75. package/dist/components/mcp/listChanged.js +28 -0
  76. package/dist/components/mcp/listChanged.js.map +1 -1
  77. package/dist/components/mcp/quota.d.ts +31 -0
  78. package/dist/components/mcp/quota.js +155 -0
  79. package/dist/components/mcp/quota.js.map +1 -0
  80. package/dist/components/mcp/rateLimit.d.ts +19 -3
  81. package/dist/components/mcp/rateLimit.js +129 -13
  82. package/dist/components/mcp/rateLimit.js.map +1 -1
  83. package/dist/components/mcp/resources.js.map +1 -1
  84. package/dist/components/mcp/toolRegistry.d.ts +39 -1
  85. package/dist/components/mcp/toolRegistry.js +60 -5
  86. package/dist/components/mcp/toolRegistry.js.map +1 -1
  87. package/dist/components/mcp/tools/application.d.ts +8 -1
  88. package/dist/components/mcp/tools/application.js +65 -5
  89. package/dist/components/mcp/tools/application.js.map +1 -1
  90. package/dist/components/mcp/tools/operations.d.ts +15 -3
  91. package/dist/components/mcp/tools/operations.js +99 -38
  92. package/dist/components/mcp/tools/operations.js.map +1 -1
  93. package/dist/components/mcp/tools/schemas/operationDescriptions.js +4 -4
  94. package/dist/components/mcp/tools/schemas/operationDescriptions.js.map +1 -1
  95. package/dist/components/mcp/tools/schemas/operations.js +4 -0
  96. package/dist/components/mcp/tools/schemas/operations.js.map +1 -1
  97. package/dist/components/mcp/transport.d.ts +6 -0
  98. package/dist/components/mcp/transport.js +47 -3
  99. package/dist/components/mcp/transport.js.map +1 -1
  100. package/dist/components/ollama/index.d.ts +4 -1
  101. package/dist/components/ollama/index.js +4 -2
  102. package/dist/components/ollama/index.js.map +1 -1
  103. package/dist/components/openai/index.d.ts +4 -1
  104. package/dist/components/openai/index.js +4 -2
  105. package/dist/components/openai/index.js.map +1 -1
  106. package/dist/components/operations.d.ts +39 -0
  107. package/dist/components/operations.js +194 -2
  108. package/dist/components/operations.js.map +1 -1
  109. package/dist/components/operationsValidation.d.ts +38 -0
  110. package/dist/components/operationsValidation.js +155 -0
  111. package/dist/components/operationsValidation.js.map +1 -1
  112. package/dist/components/secretOperations.d.ts +113 -0
  113. package/dist/components/secretOperations.js +475 -0
  114. package/dist/components/secretOperations.js.map +1 -0
  115. package/dist/config/configUtils.d.ts +4 -1
  116. package/dist/config/configUtils.js +18 -1
  117. package/dist/config/configUtils.js.map +1 -1
  118. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +4 -3
  119. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js.map +1 -1
  120. package/dist/dataLayer/readAuditLog.js +11 -0
  121. package/dist/dataLayer/readAuditLog.js.map +1 -1
  122. package/dist/dataLayer/schemaDescribe.js +2 -0
  123. package/dist/dataLayer/schemaDescribe.js.map +1 -1
  124. package/dist/globals.d.ts +1 -1
  125. package/dist/globals.js +1 -0
  126. package/dist/globals.js.map +1 -1
  127. package/dist/index.d.ts +3 -0
  128. package/dist/index.js +1 -0
  129. package/dist/index.js.map +1 -1
  130. package/dist/json/systemSchema.json +38 -0
  131. package/dist/resources/DatabaseTransaction.d.ts +31 -3
  132. package/dist/resources/DatabaseTransaction.js +190 -29
  133. package/dist/resources/DatabaseTransaction.js.map +1 -1
  134. package/dist/resources/LMDBTransaction.d.ts +1 -1
  135. package/dist/resources/LMDBTransaction.js +43 -5
  136. package/dist/resources/LMDBTransaction.js.map +1 -1
  137. package/dist/resources/PrimaryRocksDatabase.d.ts +51 -0
  138. package/dist/resources/PrimaryRocksDatabase.js +194 -0
  139. package/dist/resources/PrimaryRocksDatabase.js.map +1 -0
  140. package/dist/resources/RecordEncoder.d.ts +1 -0
  141. package/dist/resources/RecordEncoder.js +81 -75
  142. package/dist/resources/RecordEncoder.js.map +1 -1
  143. package/dist/resources/RequestTarget.d.ts +19 -0
  144. package/dist/resources/RequestTarget.js.map +1 -1
  145. package/dist/resources/Resource.d.ts +0 -1
  146. package/dist/resources/Resource.js +103 -16
  147. package/dist/resources/Resource.js.map +1 -1
  148. package/dist/resources/ResourceInterface.d.ts +6 -2
  149. package/dist/resources/ResourceInterface.js.map +1 -1
  150. package/dist/resources/Resources.js.map +1 -1
  151. package/dist/resources/Table.d.ts +6 -4
  152. package/dist/resources/Table.js +247 -24
  153. package/dist/resources/Table.js.map +1 -1
  154. package/dist/resources/analytics/read.js +25 -28
  155. package/dist/resources/analytics/read.js.map +1 -1
  156. package/dist/resources/blob.js +165 -22
  157. package/dist/resources/blob.js.map +1 -1
  158. package/dist/resources/crdt.d.ts +2 -0
  159. package/dist/resources/crdt.js +45 -36
  160. package/dist/resources/crdt.js.map +1 -1
  161. package/dist/resources/databases.d.ts +1 -0
  162. package/dist/resources/databases.js +134 -7
  163. package/dist/resources/databases.js.map +1 -1
  164. package/dist/resources/graphql.js +8 -0
  165. package/dist/resources/graphql.js.map +1 -1
  166. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +35 -5
  167. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +239 -14
  168. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
  169. package/dist/resources/jsResource.js +6 -0
  170. package/dist/resources/jsResource.js.map +1 -1
  171. package/dist/resources/loadEnv.js +30 -3
  172. package/dist/resources/loadEnv.js.map +1 -1
  173. package/dist/resources/login.js +2 -2
  174. package/dist/resources/login.js.map +1 -1
  175. package/dist/resources/models/Models.js +14 -3
  176. package/dist/resources/models/Models.js.map +1 -1
  177. package/dist/resources/models/embedHook.js +10 -2
  178. package/dist/resources/models/embedHook.js.map +1 -1
  179. package/dist/resources/models/openaiStream.d.ts +56 -0
  180. package/dist/resources/models/openaiStream.js +94 -0
  181. package/dist/resources/models/openaiStream.js.map +1 -0
  182. package/dist/resources/replayLogs.js +4 -3
  183. package/dist/resources/replayLogs.js.map +1 -1
  184. package/dist/resources/search.d.ts +1 -1
  185. package/dist/resources/search.js +104 -11
  186. package/dist/resources/search.js.map +1 -1
  187. package/dist/resources/secretDecryptor.d.ts +54 -0
  188. package/dist/resources/secretDecryptor.js +131 -0
  189. package/dist/resources/secretDecryptor.js.map +1 -0
  190. package/dist/resources/tracked.js +15 -5
  191. package/dist/resources/tracked.js.map +1 -1
  192. package/dist/security/auth.js +71 -8
  193. package/dist/security/auth.js.map +1 -1
  194. package/dist/security/jsLoader.js +11 -0
  195. package/dist/security/jsLoader.js.map +1 -1
  196. package/dist/security/tokenAuthentication.d.ts +9 -1
  197. package/dist/security/tokenAuthentication.js +31 -1
  198. package/dist/security/tokenAuthentication.js.map +1 -1
  199. package/dist/server/DurableSubscriptionsSession.d.ts +1 -1
  200. package/dist/server/DurableSubscriptionsSession.js +8 -4
  201. package/dist/server/DurableSubscriptionsSession.js.map +1 -1
  202. package/dist/server/REST.js +28 -9
  203. package/dist/server/REST.js.map +1 -1
  204. package/dist/server/fastifyRoutes.js +11 -1
  205. package/dist/server/fastifyRoutes.js.map +1 -1
  206. package/dist/server/graphqlQuerying.js +4 -3
  207. package/dist/server/graphqlQuerying.js.map +1 -1
  208. package/dist/server/http.d.ts +40 -2
  209. package/dist/server/http.js +560 -77
  210. package/dist/server/http.js.map +1 -1
  211. package/dist/server/itc/serverHandlers.js +64 -0
  212. package/dist/server/itc/serverHandlers.js.map +1 -1
  213. package/dist/server/liveSubscriptionAuth.d.ts +12 -0
  214. package/dist/server/liveSubscriptionAuth.js +140 -0
  215. package/dist/server/liveSubscriptionAuth.js.map +1 -0
  216. package/dist/server/loadRootComponents.js +2 -1
  217. package/dist/server/loadRootComponents.js.map +1 -1
  218. package/dist/server/middlewareChain.d.ts +44 -1
  219. package/dist/server/middlewareChain.js +86 -10
  220. package/dist/server/middlewareChain.js.map +1 -1
  221. package/dist/server/mqtt.js +2 -1
  222. package/dist/server/mqtt.js.map +1 -1
  223. package/dist/server/operationsServer.js +1 -1
  224. package/dist/server/operationsServer.js.map +1 -1
  225. package/dist/server/serverHelpers/Headers.d.ts +9 -0
  226. package/dist/server/serverHelpers/Headers.js +22 -0
  227. package/dist/server/serverHelpers/Headers.js.map +1 -1
  228. package/dist/server/serverHelpers/JSONStream.js +3 -3
  229. package/dist/server/serverHelpers/JSONStream.js.map +1 -1
  230. package/dist/server/serverHelpers/Request.d.ts +52 -1
  231. package/dist/server/serverHelpers/Request.js +122 -1
  232. package/dist/server/serverHelpers/Request.js.map +1 -1
  233. package/dist/server/serverHelpers/contentTypes.js +3 -8
  234. package/dist/server/serverHelpers/contentTypes.js.map +1 -1
  235. package/dist/server/serverHelpers/progressEmitter.d.ts +19 -0
  236. package/dist/server/serverHelpers/progressEmitter.js +52 -4
  237. package/dist/server/serverHelpers/progressEmitter.js.map +1 -1
  238. package/dist/server/serverHelpers/registeredOperations.d.ts +40 -0
  239. package/dist/server/serverHelpers/registeredOperations.js +286 -0
  240. package/dist/server/serverHelpers/registeredOperations.js.map +1 -0
  241. package/dist/server/serverHelpers/serverHandlers.js +11 -5
  242. package/dist/server/serverHelpers/serverHandlers.js.map +1 -1
  243. package/dist/server/serverHelpers/serverUtilities.d.ts +1 -0
  244. package/dist/server/serverHelpers/serverUtilities.js +67 -5
  245. package/dist/server/serverHelpers/serverUtilities.js.map +1 -1
  246. package/dist/server/serverHelpers/uwsServer.d.ts +80 -0
  247. package/dist/server/serverHelpers/uwsServer.js +433 -0
  248. package/dist/server/serverHelpers/uwsServer.js.map +1 -0
  249. package/dist/server/static.d.ts +0 -15
  250. package/dist/server/static.js +161 -2
  251. package/dist/server/static.js.map +1 -1
  252. package/dist/server/status/index.d.ts +4 -1
  253. package/dist/server/status/index.js +64 -4
  254. package/dist/server/status/index.js.map +1 -1
  255. package/dist/server/threads/manageThreads.d.ts +10 -0
  256. package/dist/server/threads/manageThreads.js +107 -4
  257. package/dist/server/threads/manageThreads.js.map +1 -1
  258. package/dist/server/threads/socketRouter.js +5 -1
  259. package/dist/server/threads/socketRouter.js.map +1 -1
  260. package/dist/server/threads/threadServer.js +92 -14
  261. package/dist/server/threads/threadServer.js.map +1 -1
  262. package/dist/upgrade/directives/5-2-0.d.ts +7 -0
  263. package/dist/upgrade/directives/5-2-0.js +108 -0
  264. package/dist/upgrade/directives/5-2-0.js.map +1 -0
  265. package/dist/upgrade/directives/directivesController.js +2 -1
  266. package/dist/upgrade/directives/directivesController.js.map +1 -1
  267. package/dist/utility/common_utils.js +5 -0
  268. package/dist/utility/common_utils.js.map +1 -1
  269. package/dist/utility/envFile.d.ts +41 -0
  270. package/dist/utility/envFile.js +221 -0
  271. package/dist/utility/envFile.js.map +1 -0
  272. package/dist/utility/globalSchema.d.ts +9 -0
  273. package/dist/utility/hdbTerms.d.ts +25 -0
  274. package/dist/utility/hdbTerms.js +31 -0
  275. package/dist/utility/hdbTerms.js.map +1 -1
  276. package/dist/utility/logging/harper_logger.d.ts +21 -0
  277. package/dist/utility/logging/harper_logger.js +160 -8
  278. package/dist/utility/logging/harper_logger.js.map +1 -1
  279. package/dist/utility/logging/logRotator.js +29 -17
  280. package/dist/utility/logging/logRotator.js.map +1 -1
  281. package/dist/utility/logging/readLog.d.ts +1 -1
  282. package/dist/utility/logging/readLog.js +305 -2
  283. package/dist/utility/logging/readLog.js.map +1 -1
  284. package/dist/utility/operationPermissions.d.ts +18 -0
  285. package/dist/utility/operationPermissions.js +35 -1
  286. package/dist/utility/operationPermissions.js.map +1 -1
  287. package/dist/utility/operation_authorization.d.ts +17 -0
  288. package/dist/utility/operation_authorization.js +38 -0
  289. package/dist/utility/operation_authorization.js.map +1 -1
  290. package/dist/utility/secretEnvelope.d.ts +30 -0
  291. package/dist/utility/secretEnvelope.js +94 -0
  292. package/dist/utility/secretEnvelope.js.map +1 -0
  293. package/dist/utility/signalling.d.ts +7 -0
  294. package/dist/utility/signalling.js +16 -0
  295. package/dist/utility/signalling.js.map +1 -1
  296. package/dist/validation/configValidator.js +70 -24
  297. package/dist/validation/configValidator.js.map +1 -1
  298. package/index.ts +4 -0
  299. package/json/systemSchema.json +38 -0
  300. package/npm-shrinkwrap.json +15066 -9347
  301. package/package.json +13 -8
  302. package/resources/DESIGN.md +15 -12
  303. package/resources/DatabaseTransaction.ts +206 -37
  304. package/resources/LMDBTransaction.ts +43 -9
  305. package/resources/PrimaryRocksDatabase.ts +201 -0
  306. package/resources/RecordEncoder.ts +81 -69
  307. package/resources/RequestTarget.ts +21 -0
  308. package/resources/Resource.ts +109 -25
  309. package/resources/ResourceInterface.ts +6 -2
  310. package/resources/Resources.ts +1 -3
  311. package/resources/Table.ts +238 -29
  312. package/resources/analytics/read.ts +25 -30
  313. package/resources/blob.ts +159 -23
  314. package/resources/crdt.ts +37 -31
  315. package/resources/databases.ts +143 -6
  316. package/resources/graphql.ts +8 -0
  317. package/resources/indexes/HierarchicalNavigableSmallWorld.ts +251 -17
  318. package/resources/jsResource.ts +6 -0
  319. package/resources/loadEnv.ts +34 -3
  320. package/resources/login.ts +2 -2
  321. package/resources/models/Models.ts +19 -3
  322. package/resources/models/embedHook.ts +13 -2
  323. package/resources/models/openaiStream.ts +133 -0
  324. package/resources/replayLogs.ts +4 -3
  325. package/resources/search.ts +113 -11
  326. package/resources/secretDecryptor.ts +159 -0
  327. package/resources/tracked.ts +24 -17
  328. package/security/auth.ts +70 -10
  329. package/security/jsLoader.ts +12 -0
  330. package/security/tokenAuthentication.ts +42 -1
  331. package/server/DESIGN.md +10 -0
  332. package/server/DurableSubscriptionsSession.ts +8 -4
  333. package/server/REST.ts +26 -9
  334. package/server/fastifyRoutes.ts +10 -1
  335. package/server/graphqlQuerying.ts +4 -3
  336. package/server/http.ts +563 -77
  337. package/server/itc/serverHandlers.js +70 -0
  338. package/server/liveSubscriptionAuth.ts +152 -0
  339. package/server/loadRootComponents.js +2 -1
  340. package/server/middlewareChain.ts +107 -17
  341. package/server/mqtt.ts +2 -1
  342. package/server/operationsServer.ts +2 -2
  343. package/server/serverHelpers/Headers.ts +24 -0
  344. package/server/serverHelpers/JSONStream.ts +3 -3
  345. package/server/serverHelpers/Request.ts +127 -0
  346. package/server/serverHelpers/contentTypes.ts +3 -8
  347. package/server/serverHelpers/progressEmitter.ts +55 -5
  348. package/server/serverHelpers/registeredOperations.ts +259 -0
  349. package/server/serverHelpers/serverHandlers.js +11 -5
  350. package/server/serverHelpers/serverUtilities.ts +88 -5
  351. package/server/serverHelpers/uwsServer.ts +488 -0
  352. package/server/static.ts +180 -2
  353. package/server/status/index.ts +72 -4
  354. package/server/threads/manageThreads.js +102 -4
  355. package/server/threads/socketRouter.ts +5 -1
  356. package/server/threads/threadServer.js +93 -10
  357. package/studio/web/assets/{Chat-SdD1EZca.js → Chat-Cv_2paZE.js} +2 -2
  358. package/studio/web/assets/{Chat-SdD1EZca.js.map → Chat-Cv_2paZE.js.map} +1 -1
  359. package/studio/web/assets/{FloatingChat-GMq6tHK9.js → FloatingChat-CPyPIcVR.js} +4 -4
  360. package/studio/web/assets/{FloatingChat-GMq6tHK9.js.map → FloatingChat-CPyPIcVR.js.map} +1 -1
  361. package/studio/web/assets/{applications-B5hhv7uA.js → applications-C0jT2vdZ.js} +2 -2
  362. package/studio/web/assets/{applications-B5hhv7uA.js.map → applications-C0jT2vdZ.js.map} +1 -1
  363. package/studio/web/assets/{index-VFcpNWgq.js → index-D_GKOkhn.js} +6 -6
  364. package/studio/web/assets/index-D_GKOkhn.js.map +1 -0
  365. package/studio/web/assets/{index.lazy-DgcJojIA.js → index.lazy-CAmCIA65.js} +4 -4
  366. package/studio/web/assets/{index.lazy-DgcJojIA.js.map → index.lazy-CAmCIA65.js.map} +1 -1
  367. package/studio/web/assets/{profile-BqN-8vzm.js → profile-CaF-4aZe.js} +2 -2
  368. package/studio/web/assets/{profile-BqN-8vzm.js.map → profile-CaF-4aZe.js.map} +1 -1
  369. package/studio/web/assets/{setComponentFile-CHFvFq9u.js → setComponentFile-DLW1DHCt.js} +2 -2
  370. package/studio/web/assets/{setComponentFile-CHFvFq9u.js.map → setComponentFile-DLW1DHCt.js.map} +1 -1
  371. package/studio/web/assets/{setup-CQ3vWJSr.js → setup-TGCErIhq.js} +2 -2
  372. package/studio/web/assets/{setup-CQ3vWJSr.js.map → setup-TGCErIhq.js.map} +1 -1
  373. package/studio/web/assets/{status-BsW5fjuh.js → status-DG0Maoao.js} +2 -2
  374. package/studio/web/assets/{status-BsW5fjuh.js.map → status-DG0Maoao.js.map} +1 -1
  375. package/studio/web/assets/{swagger-ui-react-DITdeB9-.js → swagger-ui-react-8T4SgQ1m.js} +2 -2
  376. package/studio/web/assets/{swagger-ui-react-DITdeB9-.js.map → swagger-ui-react-8T4SgQ1m.js.map} +1 -1
  377. package/studio/web/assets/{tsMode-Dyph-OUs.js → tsMode-DJ6Sl24Q.js} +2 -2
  378. package/studio/web/assets/{tsMode-Dyph-OUs.js.map → tsMode-DJ6Sl24Q.js.map} +1 -1
  379. package/studio/web/assets/{useEntityRestURL-D0QTUqex.js → useEntityRestURL-JO2mfWTQ.js} +2 -2
  380. package/studio/web/assets/{useEntityRestURL-D0QTUqex.js.map → useEntityRestURL-JO2mfWTQ.js.map} +1 -1
  381. package/studio/web/index.html +1 -1
  382. package/upgrade/directives/5-2-0.ts +82 -0
  383. package/upgrade/directives/directivesController.ts +2 -1
  384. package/utility/common_utils.ts +5 -0
  385. package/utility/envFile.ts +218 -0
  386. package/utility/hdbTerms.ts +31 -0
  387. package/utility/logging/harper_logger.ts +156 -8
  388. package/utility/logging/logRotator.ts +24 -14
  389. package/utility/logging/readLog.ts +323 -2
  390. package/utility/operationPermissions.ts +35 -1
  391. package/utility/operation_authorization.ts +74 -1
  392. package/utility/secretEnvelope.ts +113 -0
  393. package/utility/signalling.ts +15 -0
  394. package/validation/configValidator.ts +78 -25
  395. package/studio/web/assets/index-VFcpNWgq.js.map +0 -1
@@ -0,0 +1,475 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.setSecret = setSecret;
40
+ exports.grantSecret = grantSecret;
41
+ exports.revokeSecret = revokeSecret;
42
+ exports.listSecrets = listSecrets;
43
+ exports.deleteSecret = deleteSecret;
44
+ exports.getSecretsPublicKey = getSecretsPublicKey;
45
+ exports.deriveRegistrySecretName = deriveRegistrySecretName;
46
+ exports.ingestRegistryAuth = ingestRegistryAuth;
47
+ exports.resolveRegistryAuth = resolveRegistryAuth;
48
+ // Operations against system.hdb_secret — the envelope-encrypted secrets store (#715).
49
+ //
50
+ // Only ciphertext is ever stored: a plaintext `value` submitted to set_secret is encrypted
51
+ // immediately with the cluster public key (custody must be registered) and the plaintext is
52
+ // discarded; processLocalTransaction strips `value`/`envelope` from the operations log before
53
+ // dispatch. Rows reach peers via normal system-table replication — these operations deliberately
54
+ // do NOT call replicateOperation (op replication on top of table replication would double-apply).
55
+ //
56
+ // All operations are super_user only, enforced in-handler in addition to the requiredPermissions
57
+ // registration: an `operations` allowlist on a role can otherwise delegate SU-only ops (see the
58
+ // gate-2 bypass in utility/operation_authorization.ts), and secret custody must not be delegable.
59
+ const node_fs_1 = require("node:fs");
60
+ const node_path_1 = require("node:path");
61
+ const databases_ts_1 = require("../resources/databases.js");
62
+ const configUtils = __importStar(require("../config/configUtils.js"));
63
+ const terms = __importStar(require("../utility/hdbTerms.js"));
64
+ const hdbError_ts_1 = require("../utility/errors/hdbError.js");
65
+ const harper_logger_ts_1 = __importDefault(require("../utility/logging/harper_logger.js"));
66
+ const validator = __importStar(require("./operationsValidation.js"));
67
+ const secretDecryptor_ts_1 = require("../resources/secretDecryptor.js");
68
+ const secretEnvelope_ts_1 = require("../utility/secretEnvelope.js");
69
+ const envFile_ts_1 = require("../utility/envFile.js");
70
+ const { HTTP_STATUS_CODES } = hdbError_ts_1.hdbErrors;
71
+ const SECRET_TABLE = terms.SYSTEM_TABLE_NAMES.SECRET_TABLE_NAME;
72
+ function requireSuperUser(req) {
73
+ if (!req?.hdb_user?.role?.permission?.super_user) {
74
+ throw new hdbError_ts_1.ClientError(`Operation '${req?.operation}' is restricted to super_user roles`, HTTP_STATUS_CODES.FORBIDDEN);
75
+ }
76
+ }
77
+ function validate(validation) {
78
+ if (validation) {
79
+ throw (0, hdbError_ts_1.handleHDBError)(validation, validation.message, HTTP_STATUS_CODES.BAD_REQUEST);
80
+ }
81
+ }
82
+ function secretTable() {
83
+ const table = databases_ts_1.databases.system?.[SECRET_TABLE];
84
+ if (!table) {
85
+ throw new hdbError_ts_1.ClientError(`The secrets store is not initialized on this node (system.${SECRET_TABLE} missing). ` +
86
+ `Run upgrade or restart the server to provision the table.`);
87
+ }
88
+ return table;
89
+ }
90
+ // Grants are a set: duplicates would let one revoke leave a residual grant behind, so every write
91
+ // path normalizes through this (including rows that arrived dirty via replication).
92
+ function dedupeGrants(grants) {
93
+ return Array.isArray(grants) ? [...new Set(grants)] : [];
94
+ }
95
+ // Rebuild a plain record from a stored row's known attributes (never spread rows — RecordObject
96
+ // prototype fields don't survive a spread reliably; see DESIGN.md).
97
+ function toRecord(row) {
98
+ return {
99
+ name: row.name,
100
+ envelope: row.envelope,
101
+ kid: row.kid ?? null,
102
+ grants: dedupeGrants(row.grants),
103
+ processEnv: !!row.processEnv,
104
+ metadata: row.metadata ?? {},
105
+ unverified: !!row.unverified,
106
+ updated_by: row.updated_by ?? null,
107
+ };
108
+ }
109
+ // True when a directory with the component's name exists under the components root. Advisory
110
+ // only (audit breadcrumb) — must never block or throw.
111
+ function componentIsKnown(component) {
112
+ try {
113
+ return (0, node_fs_1.existsSync)((0, node_path_1.join)(configUtils.getConfigPath(terms.CONFIG_PARAMS.COMPONENTSROOT), component));
114
+ }
115
+ catch {
116
+ return false;
117
+ }
118
+ }
119
+ // Serialize read-modify-write mutations per secret name. The operations API dispatches these
120
+ // handlers on the MAIN thread only, so an in-process promise chain is sufficient to make the
121
+ // get→mutate→put of set_secret/grant_secret/revoke_secret/delete_secret atomic against local
122
+ // concurrency (without it, overlapping grant/revoke calls can silently drop each other's
123
+ // mutation). Cross-node concurrency remains last-write-wins on the whole row — the known
124
+ // system-table replication semantic.
125
+ const nameLocks = new Map();
126
+ async function withSecretLock(name, fn) {
127
+ const prior = nameLocks.get(name) ?? Promise.resolve();
128
+ const run = prior.then(fn);
129
+ // The stored tail never rejects, so a failed mutation doesn't poison the chain.
130
+ const tail = run.then(() => undefined, () => undefined);
131
+ nameLocks.set(name, tail);
132
+ try {
133
+ return await run;
134
+ }
135
+ finally {
136
+ if (nameLocks.get(name) === tail)
137
+ nameLocks.delete(name);
138
+ }
139
+ }
140
+ // Structured audit event for every mutation — operation, secret name, and user, never values.
141
+ function notifyMutation(operation, name, req, detail) {
142
+ harper_logger_ts_1.default.notify(`secret mutation: op=${operation} name=${name} user=${req?.hdb_user?.username ?? 'unknown'}${detail ? ` ${detail}` : ''}`);
143
+ }
144
+ /**
145
+ * Upsert a secret. Exactly one of `value` (plaintext, encrypted immediately — requires custody)
146
+ * or `envelope` (`enc:v1:...` ciphertext, encrypted client-side against get_secrets_public_key).
147
+ * `kid` is derived from the envelope server-side; a client-supplied kid field is never trusted.
148
+ * Never returns or logs plaintext.
149
+ *
150
+ * The delivery tier is explicit and mutually exclusive (a process-env secret is already global, so
151
+ * scoping it is meaningless):
152
+ * - `processEnv: true` — materialized into the real `process.env` at component load, inherited by
153
+ * child processes (`.env` semantics). No isolation promise.
154
+ * - `grants: [...]` — scoped: never in `process.env`, exposed only to the listed components via the
155
+ * `secrets` accessor.
156
+ * Both default to the stored row so a value rotation preserves the tier without re-specifying it.
157
+ */
158
+ async function setSecret(req) {
159
+ requireSuperUser(req);
160
+ validate(validator.setSecretValidator(req));
161
+ const table = secretTable();
162
+ const { name } = req;
163
+ const custody = (0, secretDecryptor_ts_1.getSecretCustody)();
164
+ let envelope;
165
+ let kid;
166
+ let unverified = false;
167
+ if (req.value !== undefined) {
168
+ if (!custody) {
169
+ throw new hdbError_ts_1.ClientError('secrets custody is not initialized on this node');
170
+ }
171
+ const { publicKey, fingerprint } = custody.getPublicKey();
172
+ envelope = envFile_ts_1.ENV_ENCRYPTED_PREFIX + (0, secretEnvelope_ts_1.encryptEnvelope)(req.value, publicKey, fingerprint);
173
+ kid = fingerprint;
174
+ delete req.value; // plaintext is now sealed; drop the reference
175
+ }
176
+ else {
177
+ // Deliberately NEVER decrypted server-side: a decrypt-verify would put the plaintext in
178
+ // this thread's heap, defeating client-side encryption. Ingest checks are structural
179
+ // (marker, base64url JSON, k/iv/ct/tag base64 fields) plus a kid-vs-custody fingerprint
180
+ // match; a tampered-but-well-formed envelope is only caught at consumption time.
181
+ envelope = req.envelope;
182
+ if (!envelope.startsWith(envFile_ts_1.ENV_ENCRYPTED_PREFIX)) {
183
+ throw new hdbError_ts_1.ClientError(`'envelope' must start with '${envFile_ts_1.ENV_ENCRYPTED_PREFIX}'`);
184
+ }
185
+ let fields;
186
+ try {
187
+ fields = (0, secretEnvelope_ts_1.parseEnvelopeFields)(envelope.slice(envFile_ts_1.ENV_ENCRYPTED_PREFIX.length));
188
+ }
189
+ catch (error) {
190
+ throw new hdbError_ts_1.ClientError(`Invalid secret envelope: ${error.message}`);
191
+ }
192
+ kid = fields.kid ?? null;
193
+ if (custody) {
194
+ const { fingerprint } = custody.getPublicKey();
195
+ if (kid !== null && kid !== fingerprint) {
196
+ throw new hdbError_ts_1.ClientError(`Secret envelope kid '${kid}' does not match this cluster's secrets key ` +
197
+ `(expected '${fingerprint}'; fetch it via get_secrets_public_key)`);
198
+ }
199
+ if (kid === null) {
200
+ // No sealed kid to check against custody — accept, but surface it in list_secrets.
201
+ unverified = true;
202
+ harper_logger_ts_1.default.warn(`set_secret '${name}': envelope carries no kid; accepted without key-identity verification`);
203
+ }
204
+ }
205
+ else {
206
+ // No custody on this node: accept, but mark the row so a bad envelope is visible in
207
+ // list_secrets instead of silently failing later.
208
+ unverified = true;
209
+ harper_logger_ts_1.default.warn(`set_secret '${name}': envelope accepted without verification (no secrets custody registered on this node)`);
210
+ }
211
+ }
212
+ return withSecretLock(name, async () => {
213
+ const existing = await table.get(name);
214
+ const processEnv = req.processEnv ?? existing?.processEnv ?? false;
215
+ const grants = dedupeGrants(req.grants ?? existing?.grants);
216
+ if (processEnv && grants.length > 0) {
217
+ throw new hdbError_ts_1.ClientError(`Secret '${name}' cannot be both processEnv and grant-scoped — a processEnv secret is global. ` +
218
+ `Set processEnv:false to scope it with grants, or omit grants.`);
219
+ }
220
+ await table.put({
221
+ name,
222
+ envelope,
223
+ kid,
224
+ grants: processEnv ? [] : grants,
225
+ processEnv,
226
+ metadata: req.metadata ?? existing?.metadata ?? {},
227
+ unverified,
228
+ updated_by: req.hdb_user?.username ?? null,
229
+ });
230
+ notifyMutation(terms.OPERATIONS_ENUM.SET_SECRET, name, req, unverified ? 'unverified=true' : undefined);
231
+ return { name, kid, created: existing == null };
232
+ });
233
+ }
234
+ async function mutateGrants(req, grant) {
235
+ requireSuperUser(req);
236
+ validate(validator.grantSecretValidator(req));
237
+ const table = secretTable();
238
+ return withSecretLock(req.name, async () => {
239
+ const row = await table.get(req.name);
240
+ if (!row) {
241
+ throw new hdbError_ts_1.ClientError(`No secret found with name '${req.name}'`, HTTP_STATUS_CODES.NOT_FOUND);
242
+ }
243
+ const record = toRecord(row); // record.grants comes back deduped
244
+ // A processEnv secret is global; granting/revoking a component scope is contradictory. Revoke
245
+ // is a no-op on an already-empty grants list, so only the grant path needs to reject loudly.
246
+ if (grant && record.processEnv) {
247
+ throw new hdbError_ts_1.ClientError(`Secret '${req.name}' is a processEnv (global) secret and cannot be scoped to a component. ` +
248
+ `Re-run set_secret with processEnv:false to convert it to a scoped secret first.`);
249
+ }
250
+ const present = record.grants.includes(req.component);
251
+ const storedLength = Array.isArray(row.grants) ? row.grants.length : 0;
252
+ // No-op short-circuit: nothing to write, nothing to audit, no updated_by/__updatedtime__
253
+ // bump. A stored row with duplicate grants (dirty state) is NOT a no-op — falling through
254
+ // persists the normalized set.
255
+ if ((grant ? present : !present) && record.grants.length === storedLength) {
256
+ return { name: req.name, grants: record.grants, changed: false };
257
+ }
258
+ if (grant && !present)
259
+ record.grants.push(req.component);
260
+ // Remove every occurrence — with the dedupe this is belt-and-braces against dirty rows.
261
+ if (!grant)
262
+ record.grants = record.grants.filter((component) => component !== req.component);
263
+ record.updated_by = req.hdb_user?.username ?? null;
264
+ await table.put(record);
265
+ // Granting to a not-yet-deployed component is legal (grants may precede the deploy), but an
266
+ // unknown name is worth a breadcrumb in the audit event — it is usually a typo.
267
+ let detail = `component=${req.component}`;
268
+ if (grant && !componentIsKnown(req.component))
269
+ detail += ' component_known=false';
270
+ notifyMutation(grant ? terms.OPERATIONS_ENUM.GRANT_SECRET : terms.OPERATIONS_ENUM.REVOKE_SECRET, req.name, req, detail);
271
+ return { name: req.name, grants: record.grants, changed: true };
272
+ });
273
+ }
274
+ /** Add a component to a secret's grants list (idempotent). */
275
+ function grantSecret(req) {
276
+ return mutateGrants(req, true);
277
+ }
278
+ /** Remove a component from a secret's grants list (idempotent). */
279
+ function revokeSecret(req) {
280
+ return mutateGrants(req, false);
281
+ }
282
+ /**
283
+ * List secret metadata: never envelopes, never values. Includes the node's current custody
284
+ * fingerprint (null when custody is absent) and a per-row kid_matches_custody flag so stale rows
285
+ * on a cloned/rekeyed node are immediately visible.
286
+ */
287
+ async function listSecrets(req) {
288
+ requireSuperUser(req);
289
+ const table = secretTable();
290
+ const custody = (0, secretDecryptor_ts_1.getSecretCustody)();
291
+ const custodyFingerprint = custody ? custody.getPublicKey().fingerprint : null;
292
+ const secrets = [];
293
+ for await (const row of table.search([])) {
294
+ secrets.push({
295
+ name: row.name,
296
+ kid: row.kid ?? null,
297
+ grants: Array.isArray(row.grants) ? [...row.grants] : [],
298
+ processEnv: !!row.processEnv,
299
+ metadata: row.metadata ?? {},
300
+ unverified: !!row.unverified,
301
+ updated_by: row.updated_by ?? null,
302
+ __createdtime__: row.__createdtime__,
303
+ __updatedtime__: row.__updatedtime__,
304
+ kid_matches_custody: custodyFingerprint !== null && row.kid === custodyFingerprint,
305
+ });
306
+ }
307
+ secrets.sort((a, b) => String(a.name).localeCompare(String(b.name)));
308
+ return { secrets, custody_fingerprint: custodyFingerprint };
309
+ }
310
+ /** Delete a secret row. Not cryptographic erasure — audit/txn logs and backups retain envelopes. */
311
+ async function deleteSecret(req) {
312
+ requireSuperUser(req);
313
+ validate(validator.deleteSecretValidator(req));
314
+ const table = secretTable();
315
+ return withSecretLock(req.name, async () => {
316
+ const row = await table.get(req.name);
317
+ if (!row) {
318
+ throw new hdbError_ts_1.ClientError(`No secret found with name '${req.name}'`, HTTP_STATUS_CODES.NOT_FOUND);
319
+ }
320
+ await table.delete(req.name);
321
+ notifyMutation(terms.OPERATIONS_ENUM.DELETE_SECRET, req.name, req);
322
+ return { message: `Successfully deleted secret '${req.name}'` };
323
+ });
324
+ }
325
+ /** The cluster secrets public key, for client-side envelope encryption. */
326
+ function getSecretsPublicKey(req) {
327
+ requireSuperUser(req);
328
+ const custody = (0, secretDecryptor_ts_1.getSecretCustody)();
329
+ if (!custody) {
330
+ throw new hdbError_ts_1.ClientError('secrets custody is not initialized on this node');
331
+ }
332
+ const { publicKey, fingerprint } = custody.getPublicKey();
333
+ return { public_key: publicKey, fingerprint };
334
+ }
335
+ /**
336
+ * Deterministic name for the auto-minted secret backing a literal registry token: keyed by the
337
+ * deploying component and the registry, so re-supplying (or rotating) the token on a later deploy
338
+ * overwrites the same row rather than accumulating one per deploy. Sanitized to the set_secret name
339
+ * grammar (`\w.-`), since a registry can carry a scheme, port, or path.
340
+ */
341
+ function deriveRegistrySecretName(component, registry) {
342
+ const registryKey = registry
343
+ .trim()
344
+ .replace(/^https?:\/\//i, '')
345
+ .replace(/^\/\//, '')
346
+ .replace(/\/+$/, '')
347
+ .toLowerCase()
348
+ .replace(/[^\w.-]+/g, '_');
349
+ const componentKey = String(component).replace(/[^\w.-]+/g, '_');
350
+ return `deploy.${componentKey}.${registryKey}`;
351
+ }
352
+ /**
353
+ * Ingest deploy_component `registryAuth` into the secrets store so a provided registry token lives
354
+ * as ciphertext in the replicated, audited `hdb_secret` store (reference, not embed) rather than
355
+ * travelling in the operation body. Returns the entries in reference form (`{ registry, secret }`).
356
+ *
357
+ * - A literal `{ registry, token }` entry is encrypted (via `set_secret`, custody required) under a
358
+ * derived name granted to `component`, and returned as a reference. Overwrites an existing
359
+ * derived row so token rotation is idempotent.
360
+ * - An already-reference `{ registry, secret }` entry passes through unchanged (peers re-running a
361
+ * replicated deploy already carry references — they never re-ingest).
362
+ * - With no custody on this node (OSS core, or key not held here), literal tokens CANNOT be sealed;
363
+ * they pass through untouched so the caller can fall back to the transient, this-node-only path.
364
+ * The reference-form result therefore contains only entries the caller may persist and replicate.
365
+ *
366
+ * Runs on the deploying main thread where custody is registered.
367
+ */
368
+ async function ingestRegistryAuth(req, registryAuth, component) {
369
+ if (!Array.isArray(registryAuth) || registryAuth.length === 0)
370
+ return registryAuth ?? [];
371
+ const custody = (0, secretDecryptor_ts_1.getSecretCustody)();
372
+ const out = [];
373
+ for (const entry of registryAuth) {
374
+ // Already a reference (or nothing to seal without custody): leave as-is.
375
+ if (entry.secret !== undefined || !custody) {
376
+ out.push(entry);
377
+ continue;
378
+ }
379
+ const name = deriveRegistrySecretName(component, entry.registry);
380
+ // Reuse set_secret's seal-and-store path (encrypt with custody, grant to the component, audit
381
+ // the mutation). The deploy request is already super_user, which set_secret requires.
382
+ await setSecret({
383
+ operation: terms.OPERATIONS_ENUM.SET_SECRET,
384
+ hdb_user: req?.hdb_user,
385
+ name,
386
+ value: entry.token,
387
+ grants: [component],
388
+ processEnv: false,
389
+ });
390
+ out.push(entry.scope === undefined
391
+ ? { registry: entry.registry, secret: name }
392
+ : { registry: entry.registry, secret: name, scope: entry.scope });
393
+ }
394
+ return out;
395
+ }
396
+ /** Wait (bounded) for a secret row to appear — covers the replicated-deploy race where a peer runs
397
+ * the deploy before the origin's hdb_secret row has replicated in. */
398
+ async function waitForSecretRow(table, name, waitMs) {
399
+ const deadline = Date.now() + waitMs;
400
+ let row = await table.get(name);
401
+ while (!row && Date.now() < deadline) {
402
+ await new Promise((resolve) => setTimeout(resolve, Math.min(200, Math.max(1, waitMs))));
403
+ row = await table.get(name);
404
+ }
405
+ return row;
406
+ }
407
+ /**
408
+ * Resolve deploy_component `registryAuth` entries that reference a stored secret
409
+ * (`{ registry, secret }`) into concrete token entries (`{ registry, token }`) by decrypting the
410
+ * named hdb_secret row on this thread. Entries that already carry a literal `token` pass through
411
+ * unchanged, so this is a no-op for the token-only fallback form.
412
+ *
413
+ * This is intentionally NOT a `get_secret` operation — the store never returns plaintext across the
414
+ * API boundary. The resolved token is handed back to the install path in-memory, fed to the
415
+ * transient .npmrc, and never written back to the request body, replicated, or logged.
416
+ *
417
+ * Authority mirrors the accessor model (#1550): the referenced secret must be usable by the
418
+ * component being deployed — either a `processEnv` (global) secret or a scoped secret granted to
419
+ * `component`. Without that, the deploy path would let a super_user pull an arbitrary scoped secret
420
+ * into an .npmrc, sidestepping the grant that is the store's authority. A missing row, missing
421
+ * grant, absent custody, or decrypt failure throws a ClientError naming the precise reason.
422
+ *
423
+ * `options.waitMs` gives a bounded grace period for a referenced row to replicate in (used on the
424
+ * peer side of a replicated deploy, where the deploy op can arrive just ahead of the hdb_secret
425
+ * row); it defaults to 0 (the origin wrote the row before it resolves, so no wait is needed).
426
+ *
427
+ * Runs on the main thread, where the operations API dispatches deploys and the Pro secrets
428
+ * component registers custody — the same place set_secret decrypts. On a node without custody
429
+ * (OSS core, or a custody key not held here) a referenced secret cannot be resolved and the deploy
430
+ * fails loudly rather than silently installing without auth.
431
+ */
432
+ async function resolveRegistryAuth(registryAuth, component, options = {}) {
433
+ if (!Array.isArray(registryAuth) || registryAuth.length === 0)
434
+ return registryAuth;
435
+ // Token-only requests must not require custody or a provisioned store — keep the fast path pure.
436
+ if (!registryAuth.some((entry) => entry && entry.secret !== undefined))
437
+ return registryAuth;
438
+ const waitMs = options.waitMs ?? 0;
439
+ const table = secretTable();
440
+ const resolved = [];
441
+ for (const entry of registryAuth) {
442
+ if (!entry)
443
+ continue; // parity with the fast-path guard above; validated entries are never null
444
+ if (entry.secret === undefined) {
445
+ resolved.push({ registry: entry.registry, token: entry.token, scope: entry.scope });
446
+ continue;
447
+ }
448
+ const name = entry.secret;
449
+ const row = waitMs > 0 ? await waitForSecretRow(table, name, waitMs) : await table.get(name);
450
+ if (!row) {
451
+ throw new hdbError_ts_1.ClientError(`registryAuth references secret '${name}', which does not exist`, HTTP_STATUS_CODES.NOT_FOUND);
452
+ }
453
+ const grants = Array.isArray(row.grants) ? row.grants : [];
454
+ if (!row.processEnv && !grants.includes(component)) {
455
+ throw new hdbError_ts_1.ClientError(`registryAuth secret '${name}' is not granted to component '${component}' ` +
456
+ `(grant it with grant_secret, or set it processEnv:true)`, HTTP_STATUS_CODES.FORBIDDEN);
457
+ }
458
+ const custody = (0, secretDecryptor_ts_1.getSecretCustody)();
459
+ if (!custody) {
460
+ // Server-state condition, not a client-fixable request: the same body would resolve once
461
+ // custody comes up, so report it retryable (503) rather than the ClientError default 400.
462
+ throw new hdbError_ts_1.ClientError(`secrets custody is not initialized on this node; cannot resolve registryAuth secret '${name}'`, HTTP_STATUS_CODES.SERVICE_UNAVAILABLE);
463
+ }
464
+ let token;
465
+ try {
466
+ token = custody.decrypt(row.envelope);
467
+ }
468
+ catch (error) {
469
+ throw new hdbError_ts_1.ClientError(`Failed to decrypt registryAuth secret '${name}': ${error.message}`, HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR);
470
+ }
471
+ resolved.push({ registry: entry.registry, token, scope: entry.scope });
472
+ }
473
+ return resolved;
474
+ }
475
+ //# sourceMappingURL=secretOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secretOperations.js","sourceRoot":"","sources":["../../components/secretOperations.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIb,8BAiFC;AAiDD,kCAEC;AAGD,oCAEC;AAOD,kCAuBC;AAGD,oCAcC;AAGD,kDAQC;AAsBD,4DAUC;AAkBD,gDA4BC;AAuCD,kDAuDC;AA/eD,sFAAsF;AACtF,EAAE;AACF,2FAA2F;AAC3F,4FAA4F;AAC5F,8FAA8F;AAC9F,iGAAiG;AACjG,kGAAkG;AAClG,EAAE;AACF,iGAAiG;AACjG,gGAAgG;AAChG,kGAAkG;AAElG,qCAAqC;AACrC,yCAAiC;AACjC,4DAAsD;AACtD,sEAAwD;AACxD,8DAAgD;AAChD,+DAAuF;AACvF,2FAAyD;AACzD,qEAAuD;AACvD,wEAAmE;AACnE,oEAAoF;AACpF,sDAA6D;AAE7D,MAAM,EAAE,iBAAiB,EAAE,GAAG,uBAAS,CAAC;AACxC,MAAM,YAAY,GAAG,KAAK,CAAC,kBAAkB,CAAC,iBAAiB,CAAC;AAEhE,SAAS,gBAAgB,CAAC,GAAQ;IACjC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QAClD,MAAM,IAAI,yBAAW,CACpB,cAAc,GAAG,EAAE,SAAS,qCAAqC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,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,yBAAW,CACpB,0CAA0C,IAAI,MAAO,KAAe,CAAC,OAAO,EAAE,EAC9E,iBAAiB,CAAC,qBAAqB,CACvC,CAAC;QACH,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
@@ -64,7 +64,10 @@ export declare function getConfiguration(): any;
64
64
  * @param setConfigJson
65
65
 
66
66
  */
67
- export declare function setConfiguration(setConfigJson: any): Promise<string>;
67
+ export declare function setConfiguration(setConfigJson: any): Promise<{
68
+ message: string;
69
+ replicated?: unknown[];
70
+ } | "Configuration successfully set. You must restart Harper for new config settings to take effect.">;
68
71
  export declare function readConfigFile(): any;
69
72
  /**
70
73
  * This function reads config settings from old settings file(before 4.0.0), aligns old keys to new keys, gets old
@@ -768,9 +768,26 @@ function getConfiguration() {
768
768
  */
769
769
  async function setConfiguration(setConfigJson) {
770
770
  // eslint-disable-next-line no-unused-vars
771
- const { operation, hdb_user, hdbAuthHeader, ...configFields } = setConfigJson;
771
+ const { operation, hdb_user, hdbAuthHeader, replicated, ...configFields } = setConfigJson;
772
+ // Operation-control field, not a config param: enforce boolean (matching other
773
+ // `replicated` surfaces, e.g. analyticsValidator) before any local write so a
774
+ // malformed value like the string "false" — which is truthy — can't apply config
775
+ // locally or trigger an unintended fan-out.
776
+ if (replicated !== undefined && typeof replicated !== 'boolean') {
777
+ throw (0, hdbError_ts_1.handleHDBError)(new Error(), `'replicated' must be a boolean`, commonErrors_ts_1.HTTP_STATUS_CODES.BAD_REQUEST, undefined, undefined, true);
778
+ }
772
779
  try {
773
780
  updateConfigValue(undefined, undefined, configFields, true);
781
+ if (replicated) {
782
+ // Opt-in fan-out to all cluster nodes (#660). replicateOperation forwards the
783
+ // body with `replicated: false`, so peers apply locally without re-replicating;
784
+ // per-node outcomes are returned on `response.replicated`. `replicated` must
785
+ // stay out of configFields on both origin and peers, or it would be written to
786
+ // the config file as a config param.
787
+ const response = await Server_ts_1.server.replication.replicateOperation(setConfigJson);
788
+ response.message = CONFIGURE_SUCCESS_RESPONSE;
789
+ return response;
790
+ }
774
791
  return CONFIGURE_SUCCESS_RESPONSE;
775
792
  }
776
793
  catch (err) {