@xylabs/aries 0.1.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 (421) hide show
  1. package/README.md +693 -0
  2. package/dist/actions/audit/auditPaths.mjs +22 -0
  3. package/dist/actions/audit/auditPaths.mjs.map +1 -0
  4. package/dist/actions/audit/index.mjs +739 -0
  5. package/dist/actions/audit/index.mjs.map +1 -0
  6. package/dist/actions/audit/installPlugin.mjs +298 -0
  7. package/dist/actions/audit/installPlugin.mjs.map +1 -0
  8. package/dist/actions/audit/listSessions.mjs +93 -0
  9. package/dist/actions/audit/listSessions.mjs.map +1 -0
  10. package/dist/actions/audit/openAuditDir.mjs +44 -0
  11. package/dist/actions/audit/openAuditDir.mjs.map +1 -0
  12. package/dist/actions/audit/searchAudit.mjs +77 -0
  13. package/dist/actions/audit/searchAudit.mjs.map +1 -0
  14. package/dist/actions/audit/showAiMeta.mjs +105 -0
  15. package/dist/actions/audit/showAiMeta.mjs.map +1 -0
  16. package/dist/actions/audit/showSession.mjs +105 -0
  17. package/dist/actions/audit/showSession.mjs.map +1 -0
  18. package/dist/actions/audit/statusAudit.mjs +98 -0
  19. package/dist/actions/audit/statusAudit.mjs.map +1 -0
  20. package/dist/actions/clamp/clampAudit.mjs +53 -0
  21. package/dist/actions/clamp/clampAudit.mjs.map +1 -0
  22. package/dist/actions/clamp/index.mjs +2258 -0
  23. package/dist/actions/clamp/index.mjs.map +1 -0
  24. package/dist/actions/clamp/ipcServer.mjs +55 -0
  25. package/dist/actions/clamp/ipcServer.mjs.map +1 -0
  26. package/dist/actions/clamp/policyManagement.mjs +144 -0
  27. package/dist/actions/clamp/policyManagement.mjs.map +1 -0
  28. package/dist/actions/clamp/promptUser.mjs +91 -0
  29. package/dist/actions/clamp/promptUser.mjs.map +1 -0
  30. package/dist/actions/clamp/runClamped.mjs +2107 -0
  31. package/dist/actions/clamp/runClamped.mjs.map +1 -0
  32. package/dist/actions/clamp/sandboxExec.mjs +1612 -0
  33. package/dist/actions/clamp/sandboxExec.mjs.map +1 -0
  34. package/dist/actions/clamp/shellEnvSetup.mjs +59 -0
  35. package/dist/actions/clamp/shellEnvSetup.mjs.map +1 -0
  36. package/dist/actions/clamp/shimGenerator.mjs +68 -0
  37. package/dist/actions/clamp/shimGenerator.mjs.map +1 -0
  38. package/dist/actions/clamp/terminalRenderer.mjs +145 -0
  39. package/dist/actions/clamp/terminalRenderer.mjs.map +1 -0
  40. package/dist/actions/datalake/audit/auditLog.mjs +191 -0
  41. package/dist/actions/datalake/audit/auditLog.mjs.map +1 -0
  42. package/dist/actions/datalake/createDatalake.mjs +127 -0
  43. package/dist/actions/datalake/createDatalake.mjs.map +1 -0
  44. package/dist/actions/datalake/describeDatalake.mjs +159 -0
  45. package/dist/actions/datalake/describeDatalake.mjs.map +1 -0
  46. package/dist/actions/datalake/destroyDatalake.mjs +34 -0
  47. package/dist/actions/datalake/destroyDatalake.mjs.map +1 -0
  48. package/dist/actions/datalake/dev/downDevServer.mjs +102 -0
  49. package/dist/actions/datalake/dev/downDevServer.mjs.map +1 -0
  50. package/dist/actions/datalake/dev/index.mjs +369 -0
  51. package/dist/actions/datalake/dev/index.mjs.map +1 -0
  52. package/dist/actions/datalake/dev/logsDevServer.mjs +44 -0
  53. package/dist/actions/datalake/dev/logsDevServer.mjs.map +1 -0
  54. package/dist/actions/datalake/dev/paths.mjs +25 -0
  55. package/dist/actions/datalake/dev/paths.mjs.map +1 -0
  56. package/dist/actions/datalake/dev/resetDevServer.mjs +118 -0
  57. package/dist/actions/datalake/dev/resetDevServer.mjs.map +1 -0
  58. package/dist/actions/datalake/dev/resolveServerBin.mjs +26 -0
  59. package/dist/actions/datalake/dev/resolveServerBin.mjs.map +1 -0
  60. package/dist/actions/datalake/dev/state.mjs +62 -0
  61. package/dist/actions/datalake/dev/state.mjs.map +1 -0
  62. package/dist/actions/datalake/dev/statusDevServer.mjs +101 -0
  63. package/dist/actions/datalake/dev/statusDevServer.mjs.map +1 -0
  64. package/dist/actions/datalake/dev/upDevServer.mjs +221 -0
  65. package/dist/actions/datalake/dev/upDevServer.mjs.map +1 -0
  66. package/dist/actions/datalake/dev/waitForHealth.mjs +22 -0
  67. package/dist/actions/datalake/dev/waitForHealth.mjs.map +1 -0
  68. package/dist/actions/datalake/formatters.mjs +90 -0
  69. package/dist/actions/datalake/formatters.mjs.map +1 -0
  70. package/dist/actions/datalake/grantAccess.mjs +116 -0
  71. package/dist/actions/datalake/grantAccess.mjs.map +1 -0
  72. package/dist/actions/datalake/index.mjs +361 -0
  73. package/dist/actions/datalake/index.mjs.map +1 -0
  74. package/dist/actions/datalake/listDatalakes.mjs +54 -0
  75. package/dist/actions/datalake/listDatalakes.mjs.map +1 -0
  76. package/dist/actions/datalake/login.mjs +20 -0
  77. package/dist/actions/datalake/login.mjs.map +1 -0
  78. package/dist/actions/datalake/logout.mjs +11 -0
  79. package/dist/actions/datalake/logout.mjs.map +1 -0
  80. package/dist/actions/datalake/mintToken.mjs +37 -0
  81. package/dist/actions/datalake/mintToken.mjs.map +1 -0
  82. package/dist/actions/datalake/parseSize.mjs +21 -0
  83. package/dist/actions/datalake/parseSize.mjs.map +1 -0
  84. package/dist/actions/datalake/payloads/fetchPayload.mjs +76 -0
  85. package/dist/actions/datalake/payloads/fetchPayload.mjs.map +1 -0
  86. package/dist/actions/datalake/payloads/index.mjs +271 -0
  87. package/dist/actions/datalake/payloads/index.mjs.map +1 -0
  88. package/dist/actions/datalake/payloads/mintAndConnect.mjs +46 -0
  89. package/dist/actions/datalake/payloads/mintAndConnect.mjs.map +1 -0
  90. package/dist/actions/datalake/payloads/parsePayloadsFile.mjs +71 -0
  91. package/dist/actions/datalake/payloads/parsePayloadsFile.mjs.map +1 -0
  92. package/dist/actions/datalake/payloads/pushPayloads.mjs +181 -0
  93. package/dist/actions/datalake/payloads/pushPayloads.mjs.map +1 -0
  94. package/dist/actions/datalake/payloads/tailPayloads.mjs +106 -0
  95. package/dist/actions/datalake/payloads/tailPayloads.mjs.map +1 -0
  96. package/dist/actions/datalake/resolveTarget.mjs +15 -0
  97. package/dist/actions/datalake/resolveTarget.mjs.map +1 -0
  98. package/dist/actions/datalake/revokeAccess.mjs +108 -0
  99. package/dist/actions/datalake/revokeAccess.mjs.map +1 -0
  100. package/dist/actions/datalake/useDatalake.mjs +22 -0
  101. package/dist/actions/datalake/useDatalake.mjs.map +1 -0
  102. package/dist/actions/detect/detectAiClients.mjs +405 -0
  103. package/dist/actions/detect/detectAiClients.mjs.map +1 -0
  104. package/dist/actions/detect/index.mjs +405 -0
  105. package/dist/actions/detect/index.mjs.map +1 -0
  106. package/dist/actions/hash/algorithms/blockhash.mjs +61 -0
  107. package/dist/actions/hash/algorithms/blockhash.mjs.map +1 -0
  108. package/dist/actions/hash/algorithms/chromaprint.mjs +205 -0
  109. package/dist/actions/hash/algorithms/chromaprint.mjs.map +1 -0
  110. package/dist/actions/hash/algorithms/dhash.mjs +75 -0
  111. package/dist/actions/hash/algorithms/dhash.mjs.map +1 -0
  112. package/dist/actions/hash/algorithms/index.mjs +818 -0
  113. package/dist/actions/hash/algorithms/index.mjs.map +1 -0
  114. package/dist/actions/hash/algorithms/nilsimsa.mjs +27 -0
  115. package/dist/actions/hash/algorithms/nilsimsa.mjs.map +1 -0
  116. package/dist/actions/hash/algorithms/pdq.mjs +83 -0
  117. package/dist/actions/hash/algorithms/pdq.mjs.map +1 -0
  118. package/dist/actions/hash/algorithms/phash.mjs +71 -0
  119. package/dist/actions/hash/algorithms/phash.mjs.map +1 -0
  120. package/dist/actions/hash/algorithms/sha256.mjs +24 -0
  121. package/dist/actions/hash/algorithms/sha256.mjs.map +1 -0
  122. package/dist/actions/hash/algorithms/ssdeep.mjs +203 -0
  123. package/dist/actions/hash/algorithms/ssdeep.mjs.map +1 -0
  124. package/dist/actions/hash/algorithms/tlsh.mjs +66 -0
  125. package/dist/actions/hash/algorithms/tlsh.mjs.map +1 -0
  126. package/dist/actions/hash/algorithms/types.mjs +1 -0
  127. package/dist/actions/hash/algorithms/types.mjs.map +1 -0
  128. package/dist/actions/hash/algorithms/videoFrames.mjs +404 -0
  129. package/dist/actions/hash/algorithms/videoFrames.mjs.map +1 -0
  130. package/dist/actions/hash/algorithms/xyo.mjs +30 -0
  131. package/dist/actions/hash/algorithms/xyo.mjs.map +1 -0
  132. package/dist/actions/hash/compareHashes.mjs +823 -0
  133. package/dist/actions/hash/compareHashes.mjs.map +1 -0
  134. package/dist/actions/hash/hashInput.mjs +868 -0
  135. package/dist/actions/hash/hashInput.mjs.map +1 -0
  136. package/dist/actions/hash/index.mjs +881 -0
  137. package/dist/actions/hash/index.mjs.map +1 -0
  138. package/dist/actions/hash/lib/hamming.mjs +44 -0
  139. package/dist/actions/hash/lib/hamming.mjs.map +1 -0
  140. package/dist/actions/hash/lib/levenshtein.mjs +36 -0
  141. package/dist/actions/hash/lib/levenshtein.mjs.map +1 -0
  142. package/dist/actions/hash/lib/runBinary.mjs +54 -0
  143. package/dist/actions/hash/lib/runBinary.mjs.map +1 -0
  144. package/dist/actions/hash/lib/which.mjs +36 -0
  145. package/dist/actions/hash/lib/which.mjs.map +1 -0
  146. package/dist/actions/hash/lib/withTempfile.mjs +19 -0
  147. package/dist/actions/hash/lib/withTempfile.mjs.map +1 -0
  148. package/dist/actions/index.mjs +4615 -0
  149. package/dist/actions/index.mjs.map +1 -0
  150. package/dist/actions/printVersion.mjs +12 -0
  151. package/dist/actions/printVersion.mjs.map +1 -0
  152. package/dist/actions/sync/index.mjs +51 -0
  153. package/dist/actions/sync/index.mjs.map +1 -0
  154. package/dist/actions/sync/syncAiConfig.mjs +51 -0
  155. package/dist/actions/sync/syncAiConfig.mjs.map +1 -0
  156. package/dist/actions/wallet/account/deriveAndAdd.mjs +394 -0
  157. package/dist/actions/wallet/account/deriveAndAdd.mjs.map +1 -0
  158. package/dist/actions/wallet/account/getActiveWallet.mjs +338 -0
  159. package/dist/actions/wallet/account/getActiveWallet.mjs.map +1 -0
  160. package/dist/actions/wallet/account/labelAccount.mjs +389 -0
  161. package/dist/actions/wallet/account/labelAccount.mjs.map +1 -0
  162. package/dist/actions/wallet/account/listAccounts.mjs +374 -0
  163. package/dist/actions/wallet/account/listAccounts.mjs.map +1 -0
  164. package/dist/actions/wallet/account/removeAccount.mjs +384 -0
  165. package/dist/actions/wallet/account/removeAccount.mjs.map +1 -0
  166. package/dist/actions/wallet/account/showAccount.mjs +368 -0
  167. package/dist/actions/wallet/account/showAccount.mjs.map +1 -0
  168. package/dist/actions/wallet/addressBook/storage.mjs +110 -0
  169. package/dist/actions/wallet/addressBook/storage.mjs.map +1 -0
  170. package/dist/actions/wallet/backup/exportBackup.mjs +93 -0
  171. package/dist/actions/wallet/backup/exportBackup.mjs.map +1 -0
  172. package/dist/actions/wallet/backup/importBackup.mjs +142 -0
  173. package/dist/actions/wallet/backup/importBackup.mjs.map +1 -0
  174. package/dist/actions/wallet/balance/getBalance.mjs +434 -0
  175. package/dist/actions/wallet/balance/getBalance.mjs.map +1 -0
  176. package/dist/actions/wallet/client/walletClient.mjs +64 -0
  177. package/dist/actions/wallet/client/walletClient.mjs.map +1 -0
  178. package/dist/actions/wallet/contact/contactActions.mjs +120 -0
  179. package/dist/actions/wallet/contact/contactActions.mjs.map +1 -0
  180. package/dist/actions/wallet/contact/storage.mjs +69 -0
  181. package/dist/actions/wallet/contact/storage.mjs.map +1 -0
  182. package/dist/actions/wallet/index.mjs +1439 -0
  183. package/dist/actions/wallet/index.mjs.map +1 -0
  184. package/dist/actions/wallet/network/networkActions.mjs +137 -0
  185. package/dist/actions/wallet/network/networkActions.mjs.map +1 -0
  186. package/dist/actions/wallet/network/storage.mjs +93 -0
  187. package/dist/actions/wallet/network/storage.mjs.map +1 -0
  188. package/dist/actions/wallet/password/changePassword.mjs +282 -0
  189. package/dist/actions/wallet/password/changePassword.mjs.map +1 -0
  190. package/dist/actions/wallet/password/getActiveKey.mjs +297 -0
  191. package/dist/actions/wallet/password/getActiveKey.mjs.map +1 -0
  192. package/dist/actions/wallet/password/initOrUnlock.mjs +337 -0
  193. package/dist/actions/wallet/password/initOrUnlock.mjs.map +1 -0
  194. package/dist/actions/wallet/password/passwordStorage.mjs +69 -0
  195. package/dist/actions/wallet/password/passwordStorage.mjs.map +1 -0
  196. package/dist/actions/wallet/password/setPassword.mjs +138 -0
  197. package/dist/actions/wallet/password/setPassword.mjs.map +1 -0
  198. package/dist/actions/wallet/password/validatePassword.mjs +123 -0
  199. package/dist/actions/wallet/password/validatePassword.mjs.map +1 -0
  200. package/dist/actions/wallet/passwordKey.mjs +87 -0
  201. package/dist/actions/wallet/passwordKey.mjs.map +1 -0
  202. package/dist/actions/wallet/paths.mjs +26 -0
  203. package/dist/actions/wallet/paths.mjs.map +1 -0
  204. package/dist/actions/wallet/prompt.mjs +93 -0
  205. package/dist/actions/wallet/prompt.mjs.map +1 -0
  206. package/dist/actions/wallet/seedPhrase/createPhrase.mjs +392 -0
  207. package/dist/actions/wallet/seedPhrase/createPhrase.mjs.map +1 -0
  208. package/dist/actions/wallet/seedPhrase/exportPhrase.mjs +334 -0
  209. package/dist/actions/wallet/seedPhrase/exportPhrase.mjs.map +1 -0
  210. package/dist/actions/wallet/seedPhrase/idGen.mjs +11 -0
  211. package/dist/actions/wallet/seedPhrase/idGen.mjs.map +1 -0
  212. package/dist/actions/wallet/seedPhrase/importPhrase.mjs +393 -0
  213. package/dist/actions/wallet/seedPhrase/importPhrase.mjs.map +1 -0
  214. package/dist/actions/wallet/seedPhrase/listPhrases.mjs +62 -0
  215. package/dist/actions/wallet/seedPhrase/listPhrases.mjs.map +1 -0
  216. package/dist/actions/wallet/seedPhrase/phraseStorage.mjs +89 -0
  217. package/dist/actions/wallet/seedPhrase/phraseStorage.mjs.map +1 -0
  218. package/dist/actions/wallet/seedPhrase/removePhrase.mjs +366 -0
  219. package/dist/actions/wallet/seedPhrase/removePhrase.mjs.map +1 -0
  220. package/dist/actions/wallet/seedPhrase/renamePhrase.mjs +78 -0
  221. package/dist/actions/wallet/seedPhrase/renamePhrase.mjs.map +1 -0
  222. package/dist/actions/wallet/seedPhrase/types.mjs +1 -0
  223. package/dist/actions/wallet/seedPhrase/types.mjs.map +1 -0
  224. package/dist/actions/wallet/seedPhrase/usePhrase.mjs +83 -0
  225. package/dist/actions/wallet/seedPhrase/usePhrase.mjs.map +1 -0
  226. package/dist/actions/wallet/session/machineId.mjs +145 -0
  227. package/dist/actions/wallet/session/machineId.mjs.map +1 -0
  228. package/dist/actions/wallet/session/sessionCache.mjs +221 -0
  229. package/dist/actions/wallet/session/sessionCache.mjs.map +1 -0
  230. package/dist/actions/wallet/session/unlock.mjs +307 -0
  231. package/dist/actions/wallet/session/unlock.mjs.map +1 -0
  232. package/dist/actions/wallet/sign/signPayload.mjs +637 -0
  233. package/dist/actions/wallet/sign/signPayload.mjs.map +1 -0
  234. package/dist/actions/wallet/storage.mjs +51 -0
  235. package/dist/actions/wallet/storage.mjs.map +1 -0
  236. package/dist/actions/wallet/transaction/broadcastTransaction.mjs +453 -0
  237. package/dist/actions/wallet/transaction/broadcastTransaction.mjs.map +1 -0
  238. package/dist/actions/wallet/transaction/sendTransaction.mjs +457 -0
  239. package/dist/actions/wallet/transaction/sendTransaction.mjs.map +1 -0
  240. package/dist/actions/wallet/transaction/signTransactionFile.mjs +378 -0
  241. package/dist/actions/wallet/transaction/signTransactionFile.mjs.map +1 -0
  242. package/dist/actions/xyo/index.mjs +138 -0
  243. package/dist/actions/xyo/index.mjs.map +1 -0
  244. package/dist/actions/xyo/transaction/index.mjs +138 -0
  245. package/dist/actions/xyo/transaction/index.mjs.map +1 -0
  246. package/dist/actions/xyo/transaction/validateTransactions.mjs +138 -0
  247. package/dist/actions/xyo/transaction/validateTransactions.mjs.map +1 -0
  248. package/dist/aries.mjs +8466 -0
  249. package/dist/aries.mjs.map +1 -0
  250. package/dist/bin/aries.mjs +8472 -0
  251. package/dist/bin/aries.mjs.map +1 -0
  252. package/dist/commands/aiCommand.mjs +492 -0
  253. package/dist/commands/aiCommand.mjs.map +1 -0
  254. package/dist/commands/auditAiCommand.mjs +119 -0
  255. package/dist/commands/auditAiCommand.mjs.map +1 -0
  256. package/dist/commands/auditCommand.mjs +857 -0
  257. package/dist/commands/auditCommand.mjs.map +1 -0
  258. package/dist/commands/auditInstallCommand.mjs +324 -0
  259. package/dist/commands/auditInstallCommand.mjs.map +1 -0
  260. package/dist/commands/auditListCommand.mjs +107 -0
  261. package/dist/commands/auditListCommand.mjs.map +1 -0
  262. package/dist/commands/auditOpenCommand.mjs +51 -0
  263. package/dist/commands/auditOpenCommand.mjs.map +1 -0
  264. package/dist/commands/auditSearchCommand.mjs +98 -0
  265. package/dist/commands/auditSearchCommand.mjs.map +1 -0
  266. package/dist/commands/auditShowCommand.mjs +123 -0
  267. package/dist/commands/auditShowCommand.mjs.map +1 -0
  268. package/dist/commands/auditStatusCommand.mjs +105 -0
  269. package/dist/commands/auditStatusCommand.mjs.map +1 -0
  270. package/dist/commands/clampCommand.mjs +2328 -0
  271. package/dist/commands/clampCommand.mjs.map +1 -0
  272. package/dist/commands/clampPolicyCommand.mjs +184 -0
  273. package/dist/commands/clampPolicyCommand.mjs.map +1 -0
  274. package/dist/commands/clampPolicyInitCommand.mjs +63 -0
  275. package/dist/commands/clampPolicyInitCommand.mjs.map +1 -0
  276. package/dist/commands/clampPolicyListCommand.mjs +56 -0
  277. package/dist/commands/clampPolicyListCommand.mjs.map +1 -0
  278. package/dist/commands/clampPolicyShowCommand.mjs +83 -0
  279. package/dist/commands/clampPolicyShowCommand.mjs.map +1 -0
  280. package/dist/commands/clampRunCommand.mjs +2137 -0
  281. package/dist/commands/clampRunCommand.mjs.map +1 -0
  282. package/dist/commands/datalakeAuditCommand.mjs +273 -0
  283. package/dist/commands/datalakeAuditCommand.mjs.map +1 -0
  284. package/dist/commands/datalakeCommand.mjs +1637 -0
  285. package/dist/commands/datalakeCommand.mjs.map +1 -0
  286. package/dist/commands/datalakeCreateCommand.mjs +189 -0
  287. package/dist/commands/datalakeCreateCommand.mjs.map +1 -0
  288. package/dist/commands/datalakeDescribeCommand.mjs +172 -0
  289. package/dist/commands/datalakeDescribeCommand.mjs.map +1 -0
  290. package/dist/commands/datalakeDestroyCommand.mjs +53 -0
  291. package/dist/commands/datalakeDestroyCommand.mjs.map +1 -0
  292. package/dist/commands/datalakeDevCommand.mjs +470 -0
  293. package/dist/commands/datalakeDevCommand.mjs.map +1 -0
  294. package/dist/commands/datalakeDevDownCommand.mjs +111 -0
  295. package/dist/commands/datalakeDevDownCommand.mjs.map +1 -0
  296. package/dist/commands/datalakeDevLogsCommand.mjs +65 -0
  297. package/dist/commands/datalakeDevLogsCommand.mjs.map +1 -0
  298. package/dist/commands/datalakeDevResetCommand.mjs +125 -0
  299. package/dist/commands/datalakeDevResetCommand.mjs.map +1 -0
  300. package/dist/commands/datalakeDevStatusCommand.mjs +110 -0
  301. package/dist/commands/datalakeDevStatusCommand.mjs.map +1 -0
  302. package/dist/commands/datalakeDevUpCommand.mjs +268 -0
  303. package/dist/commands/datalakeDevUpCommand.mjs.map +1 -0
  304. package/dist/commands/datalakeFetchCommand.mjs +106 -0
  305. package/dist/commands/datalakeFetchCommand.mjs.map +1 -0
  306. package/dist/commands/datalakeGrantCommand.mjs +147 -0
  307. package/dist/commands/datalakeGrantCommand.mjs.map +1 -0
  308. package/dist/commands/datalakeListCommand.mjs +61 -0
  309. package/dist/commands/datalakeListCommand.mjs.map +1 -0
  310. package/dist/commands/datalakeLoginCommand.mjs +39 -0
  311. package/dist/commands/datalakeLoginCommand.mjs.map +1 -0
  312. package/dist/commands/datalakeLogoutCommand.mjs +20 -0
  313. package/dist/commands/datalakeLogoutCommand.mjs.map +1 -0
  314. package/dist/commands/datalakePushCommand.mjs +214 -0
  315. package/dist/commands/datalakePushCommand.mjs.map +1 -0
  316. package/dist/commands/datalakeRevokeCommand.mjs +127 -0
  317. package/dist/commands/datalakeRevokeCommand.mjs.map +1 -0
  318. package/dist/commands/datalakeTailCommand.mjs +144 -0
  319. package/dist/commands/datalakeTailCommand.mjs.map +1 -0
  320. package/dist/commands/datalakeTokenCommand.mjs +61 -0
  321. package/dist/commands/datalakeTokenCommand.mjs.map +1 -0
  322. package/dist/commands/datalakeUseCommand.mjs +35 -0
  323. package/dist/commands/datalakeUseCommand.mjs.map +1 -0
  324. package/dist/commands/detectCommand.mjs +419 -0
  325. package/dist/commands/detectCommand.mjs.map +1 -0
  326. package/dist/commands/hashCommand.mjs +976 -0
  327. package/dist/commands/hashCommand.mjs.map +1 -0
  328. package/dist/commands/hashCompareCommand.mjs +865 -0
  329. package/dist/commands/hashCompareCommand.mjs.map +1 -0
  330. package/dist/commands/index.mjs +8461 -0
  331. package/dist/commands/index.mjs.map +1 -0
  332. package/dist/commands/syncCommand.mjs +66 -0
  333. package/dist/commands/syncCommand.mjs.map +1 -0
  334. package/dist/commands/versionCommand.mjs +24 -0
  335. package/dist/commands/versionCommand.mjs.map +1 -0
  336. package/dist/commands/walletAccountCommand.mjs +536 -0
  337. package/dist/commands/walletAccountCommand.mjs.map +1 -0
  338. package/dist/commands/walletAccountDeriveCommand.mjs +415 -0
  339. package/dist/commands/walletAccountDeriveCommand.mjs.map +1 -0
  340. package/dist/commands/walletAccountLabelCommand.mjs +405 -0
  341. package/dist/commands/walletAccountLabelCommand.mjs.map +1 -0
  342. package/dist/commands/walletAccountListCommand.mjs +381 -0
  343. package/dist/commands/walletAccountListCommand.mjs.map +1 -0
  344. package/dist/commands/walletAccountRemoveCommand.mjs +396 -0
  345. package/dist/commands/walletAccountRemoveCommand.mjs.map +1 -0
  346. package/dist/commands/walletAccountShowCommand.mjs +380 -0
  347. package/dist/commands/walletAccountShowCommand.mjs.map +1 -0
  348. package/dist/commands/walletBackupCommand.mjs +222 -0
  349. package/dist/commands/walletBackupCommand.mjs.map +1 -0
  350. package/dist/commands/walletBackupExportCommand.mjs +107 -0
  351. package/dist/commands/walletBackupExportCommand.mjs.map +1 -0
  352. package/dist/commands/walletBackupImportCommand.mjs +154 -0
  353. package/dist/commands/walletBackupImportCommand.mjs.map +1 -0
  354. package/dist/commands/walletBalanceCommand.mjs +448 -0
  355. package/dist/commands/walletBalanceCommand.mjs.map +1 -0
  356. package/dist/commands/walletCommand.mjs +1968 -0
  357. package/dist/commands/walletCommand.mjs.map +1 -0
  358. package/dist/commands/walletContactAddCommand.mjs +111 -0
  359. package/dist/commands/walletContactAddCommand.mjs.map +1 -0
  360. package/dist/commands/walletContactCommand.mjs +184 -0
  361. package/dist/commands/walletContactCommand.mjs.map +1 -0
  362. package/dist/commands/walletContactListCommand.mjs +66 -0
  363. package/dist/commands/walletContactListCommand.mjs.map +1 -0
  364. package/dist/commands/walletContactRemoveCommand.mjs +97 -0
  365. package/dist/commands/walletContactRemoveCommand.mjs.map +1 -0
  366. package/dist/commands/walletContactRenameCommand.mjs +114 -0
  367. package/dist/commands/walletContactRenameCommand.mjs.map +1 -0
  368. package/dist/commands/walletCreateCommand.mjs +407 -0
  369. package/dist/commands/walletCreateCommand.mjs.map +1 -0
  370. package/dist/commands/walletExportCommand.mjs +345 -0
  371. package/dist/commands/walletExportCommand.mjs.map +1 -0
  372. package/dist/commands/walletImportCommand.mjs +413 -0
  373. package/dist/commands/walletImportCommand.mjs.map +1 -0
  374. package/dist/commands/walletListCommand.mjs +69 -0
  375. package/dist/commands/walletListCommand.mjs.map +1 -0
  376. package/dist/commands/walletLockCommand.mjs +56 -0
  377. package/dist/commands/walletLockCommand.mjs.map +1 -0
  378. package/dist/commands/walletNetworkAddCommand.mjs +131 -0
  379. package/dist/commands/walletNetworkAddCommand.mjs.map +1 -0
  380. package/dist/commands/walletNetworkCommand.mjs +206 -0
  381. package/dist/commands/walletNetworkCommand.mjs.map +1 -0
  382. package/dist/commands/walletNetworkListCommand.mjs +104 -0
  383. package/dist/commands/walletNetworkListCommand.mjs.map +1 -0
  384. package/dist/commands/walletNetworkRemoveCommand.mjs +112 -0
  385. package/dist/commands/walletNetworkRemoveCommand.mjs.map +1 -0
  386. package/dist/commands/walletNetworkUseCommand.mjs +110 -0
  387. package/dist/commands/walletNetworkUseCommand.mjs.map +1 -0
  388. package/dist/commands/walletPasswordChangeCommand.mjs +291 -0
  389. package/dist/commands/walletPasswordChangeCommand.mjs.map +1 -0
  390. package/dist/commands/walletPasswordCommand.mjs +301 -0
  391. package/dist/commands/walletPasswordCommand.mjs.map +1 -0
  392. package/dist/commands/walletRemoveCommand.mjs +378 -0
  393. package/dist/commands/walletRemoveCommand.mjs.map +1 -0
  394. package/dist/commands/walletRenameCommand.mjs +94 -0
  395. package/dist/commands/walletRenameCommand.mjs.map +1 -0
  396. package/dist/commands/walletSignCommand.mjs +662 -0
  397. package/dist/commands/walletSignCommand.mjs.map +1 -0
  398. package/dist/commands/walletTxBroadcastCommand.mjs +473 -0
  399. package/dist/commands/walletTxBroadcastCommand.mjs.map +1 -0
  400. package/dist/commands/walletTxCommand.mjs +612 -0
  401. package/dist/commands/walletTxCommand.mjs.map +1 -0
  402. package/dist/commands/walletTxSendCommand.mjs +492 -0
  403. package/dist/commands/walletTxSendCommand.mjs.map +1 -0
  404. package/dist/commands/walletTxSignCommand.mjs +403 -0
  405. package/dist/commands/walletTxSignCommand.mjs.map +1 -0
  406. package/dist/commands/walletUnlockCommand.mjs +308 -0
  407. package/dist/commands/walletUnlockCommand.mjs.map +1 -0
  408. package/dist/commands/walletUseCommand.mjs +95 -0
  409. package/dist/commands/walletUseCommand.mjs.map +1 -0
  410. package/dist/commands/xyoCommand.mjs +188 -0
  411. package/dist/commands/xyoCommand.mjs.map +1 -0
  412. package/dist/commands/xyoTxCommand.mjs +178 -0
  413. package/dist/commands/xyoTxCommand.mjs.map +1 -0
  414. package/dist/commands/xyoTxValidateCommand.mjs +168 -0
  415. package/dist/commands/xyoTxValidateCommand.mjs.map +1 -0
  416. package/dist/index.d.ts +3 -0
  417. package/dist/index.mjs +8466 -0
  418. package/dist/index.mjs.map +1 -0
  419. package/dist/types/modules.d.mjs +1 -0
  420. package/dist/types/modules.d.mjs.map +1 -0
  421. package/package.json +197 -0
@@ -0,0 +1,1637 @@
1
+ // src/actions/datalake/audit/auditLog.ts
2
+ import { spawn } from "child_process";
3
+ import {
4
+ createReadStream,
5
+ existsSync,
6
+ readdirSync,
7
+ statSync,
8
+ unlinkSync
9
+ } from "fs";
10
+ import path2 from "path";
11
+ import { createInterface } from "readline";
12
+ import { createDatalakeClient } from "@xylabs/aries-datalake-client";
13
+ import chalk from "chalk";
14
+
15
+ // src/actions/datalake/dev/paths.ts
16
+ import { homedir } from "os";
17
+ import path from "path";
18
+ function getAriesHome() {
19
+ return process.env.ARIES_HOME ?? path.join(homedir(), ".aries");
20
+ }
21
+ function getDevDir() {
22
+ return path.join(getAriesHome(), "dev");
23
+ }
24
+ function getDevStatePath() {
25
+ return path.join(getDevDir(), "state.json");
26
+ }
27
+ function getDevPidPath() {
28
+ return path.join(getDevDir(), "pid");
29
+ }
30
+ function getDevLogPath() {
31
+ return path.join(getDevDir(), "server.log");
32
+ }
33
+
34
+ // src/actions/datalake/audit/auditLog.ts
35
+ var AUDIT_FILE_PATTERN = /^audit-\d{4}-\d{2}-\d{2}\.log$/;
36
+ function defaultSingleFile() {
37
+ return path2.join(getDevDir(), "audit.log");
38
+ }
39
+ function defaultRotationDir() {
40
+ return path2.join(getDevDir(), "audit");
41
+ }
42
+ function listRotatedFiles(directory) {
43
+ if (!existsSync(directory)) return [];
44
+ return readdirSync(directory).filter((file) => AUDIT_FILE_PATTERN.test(file)).toSorted().map((file) => path2.join(directory, file));
45
+ }
46
+ function resolveSource(override) {
47
+ if (override) {
48
+ if (!existsSync(override)) return void 0;
49
+ const stat = statSync(override);
50
+ if (stat.isDirectory()) {
51
+ const files2 = listRotatedFiles(override);
52
+ if (files2.length === 0) return void 0;
53
+ return {
54
+ files: files2,
55
+ tailFile: files2.at(-1),
56
+ description: override
57
+ };
58
+ }
59
+ return {
60
+ files: [override],
61
+ tailFile: override,
62
+ description: override
63
+ };
64
+ }
65
+ const single = defaultSingleFile();
66
+ if (existsSync(single)) {
67
+ return {
68
+ files: [single],
69
+ tailFile: single,
70
+ description: single
71
+ };
72
+ }
73
+ const rotDir = defaultRotationDir();
74
+ const files = listRotatedFiles(rotDir);
75
+ if (files.length === 0) return void 0;
76
+ return {
77
+ files,
78
+ tailFile: files.at(-1),
79
+ description: rotDir
80
+ };
81
+ }
82
+ async function resolveDatalakeId(target) {
83
+ if (target.startsWith("dl_")) return target;
84
+ const client = createDatalakeClient();
85
+ const descriptor = await client.describe(target);
86
+ return descriptor.id;
87
+ }
88
+ async function buildFilters(options) {
89
+ return {
90
+ datalakeId: options.datalake ? await resolveDatalakeId(options.datalake) : void 0,
91
+ statusPrefix: options.status,
92
+ method: options.method?.toUpperCase(),
93
+ authenticated: options.authenticated === void 0 ? void 0 : options.authenticated === "true",
94
+ grepRegex: options.grep ? new RegExp(options.grep) : void 0
95
+ };
96
+ }
97
+ function matchesFilters(line, entry, filters) {
98
+ if (filters.datalakeId && entry.datalakeId !== filters.datalakeId) return false;
99
+ if (filters.statusPrefix && !String(entry.statusCode).startsWith(filters.statusPrefix)) return false;
100
+ if (filters.method && entry.method !== filters.method) return false;
101
+ if (filters.authenticated !== void 0 && entry.authenticated !== filters.authenticated) return false;
102
+ if (filters.grepRegex && !filters.grepRegex.test(line)) return false;
103
+ return true;
104
+ }
105
+ function formatEntry(entry) {
106
+ const when = entry.time.slice(11, 19);
107
+ const status = entry.statusCode >= 500 ? chalk.red(String(entry.statusCode)) : entry.statusCode >= 400 ? chalk.yellow(String(entry.statusCode)) : chalk.green(String(entry.statusCode));
108
+ const subject = entry.authenticated ? chalk.magenta(entry.subject) : chalk.gray(entry.subject);
109
+ const duration = chalk.gray(`${entry.durationMs}ms`);
110
+ return `${chalk.gray(when)} ${status} ${entry.method.padEnd(6)} ${entry.path} ${subject} ${duration}`;
111
+ }
112
+ function parseLine(line) {
113
+ try {
114
+ return JSON.parse(line);
115
+ } catch {
116
+ return void 0;
117
+ }
118
+ }
119
+ async function auditLog(options = {}) {
120
+ const source = resolveSource(options.file);
121
+ if (!source) {
122
+ const location = options.file ?? `${defaultSingleFile()} or ${defaultRotationDir()}`;
123
+ console.log(chalk.yellow(`no audit log at ${location}`));
124
+ console.log(chalk.gray("enable with `aries datalake dev up --audit` (or --audit --audit-rotate)"));
125
+ process.exitCode = 3;
126
+ return;
127
+ }
128
+ const filters = await buildFilters(options);
129
+ if (options.follow) {
130
+ await followLog(source.tailFile, filters, options.lines ?? 0);
131
+ return;
132
+ }
133
+ await dumpTail(source.files, filters, options.lines ?? 50);
134
+ }
135
+ async function dumpTail(files, filters, limit) {
136
+ const ring = [];
137
+ for (const filePath of files) {
138
+ const stream = createReadStream(filePath, { encoding: "utf8" });
139
+ const rl = createInterface({ input: stream, crlfDelay: Infinity });
140
+ for await (const line of rl) {
141
+ if (!line.trim()) continue;
142
+ const entry = parseLine(line);
143
+ if (!entry) continue;
144
+ if (!matchesFilters(line, entry, filters)) continue;
145
+ ring.push(formatEntry(entry));
146
+ if (ring.length > limit) ring.shift();
147
+ }
148
+ }
149
+ for (const row of ring) console.log(row);
150
+ }
151
+ async function followLog(filePath, filters, initialLines) {
152
+ if (initialLines > 0) {
153
+ await dumpTail([filePath], filters, initialLines);
154
+ }
155
+ const startOffset = statSync(filePath).size;
156
+ const child = spawn("tail", ["-f", "-c", "+0", filePath], { stdio: ["ignore", "pipe", "inherit"] });
157
+ child.stdout.setEncoding("utf8");
158
+ let buffer = "";
159
+ let bytesSeen = 0;
160
+ child.stdout.on("data", (chunk) => {
161
+ bytesSeen += Buffer.byteLength(chunk, "utf8");
162
+ buffer += chunk;
163
+ const lines = buffer.split("\n");
164
+ buffer = lines.pop() ?? "";
165
+ if (bytesSeen < startOffset) return;
166
+ for (const line of lines) {
167
+ if (!line.trim()) continue;
168
+ const entry = parseLine(line);
169
+ if (!entry) continue;
170
+ if (!matchesFilters(line, entry, filters)) continue;
171
+ console.log(formatEntry(entry));
172
+ }
173
+ });
174
+ await new Promise((resolve) => {
175
+ child.on("exit", (code) => {
176
+ process.exitCode = code ?? 0;
177
+ resolve();
178
+ });
179
+ });
180
+ }
181
+ function purgeAuditLog(options) {
182
+ const directory = options.directory ?? defaultRotationDir();
183
+ if (!existsSync(directory)) return [];
184
+ const cutoff = Date.now() - options.maxAgeDays * 864e5;
185
+ const removed = [];
186
+ for (const file of readdirSync(directory)) {
187
+ if (!AUDIT_FILE_PATTERN.test(file)) continue;
188
+ const fullPath = path2.join(directory, file);
189
+ const stat = statSync(fullPath);
190
+ if (stat.mtimeMs >= cutoff) continue;
191
+ if (!options.dryRun) unlinkSync(fullPath);
192
+ removed.push(fullPath);
193
+ }
194
+ return removed;
195
+ }
196
+
197
+ // src/commands/datalakeAuditCommand.ts
198
+ var viewCommand = {
199
+ command: ["view", "$0"],
200
+ describe: "Print audit log rows (default)",
201
+ builder: (yargs) => yargs.option("follow", {
202
+ alias: "f",
203
+ type: "boolean",
204
+ default: false,
205
+ describe: "Stream new rows as they arrive (tails the most recent file)"
206
+ }).option("lines", {
207
+ alias: "n",
208
+ type: "number",
209
+ default: 50,
210
+ describe: "Tail this many rows (0 = start fresh in --follow mode)"
211
+ }).option("datalake", {
212
+ alias: "d",
213
+ type: "string",
214
+ describe: "Filter by datalake name or id"
215
+ }).option("status", {
216
+ type: "string",
217
+ describe: "Status code prefix filter (e.g. 4 matches 4xx)"
218
+ }).option("method", {
219
+ type: "string",
220
+ describe: "HTTP method filter (GET, POST, etc.)"
221
+ }).option("authenticated", {
222
+ type: "string",
223
+ choices: ["true", "false"],
224
+ describe: "Show only authenticated or only anonymous requests"
225
+ }).option("grep", {
226
+ type: "string",
227
+ describe: "Regex pattern applied to the raw JSON line"
228
+ }).option("file", {
229
+ type: "string",
230
+ describe: "File or directory (auto-detects rotation layout)"
231
+ }),
232
+ handler: async (argv) => {
233
+ await auditLog({
234
+ follow: argv.follow,
235
+ lines: argv.lines,
236
+ datalake: argv.datalake,
237
+ status: argv.status,
238
+ method: argv.method,
239
+ authenticated: argv.authenticated,
240
+ grep: argv.grep,
241
+ file: argv.file
242
+ });
243
+ }
244
+ };
245
+ var purgeCommand = {
246
+ command: "purge",
247
+ describe: "Delete rotated audit files older than --max-age-days",
248
+ builder: (yargs) => yargs.option("max-age-days", {
249
+ type: "number",
250
+ demandOption: true,
251
+ describe: "Retention window; files older than this are deleted"
252
+ }).option("directory", {
253
+ type: "string",
254
+ describe: "Rotation directory (defaults to <ARIES_HOME>/dev/audit)"
255
+ }).option("dry-run", {
256
+ type: "boolean",
257
+ default: false,
258
+ describe: "Report what would be deleted without removing anything"
259
+ }),
260
+ handler: (argv) => {
261
+ const removed = purgeAuditLog({
262
+ maxAgeDays: argv["max-age-days"],
263
+ directory: argv.directory,
264
+ dryRun: argv["dry-run"]
265
+ });
266
+ const verb = argv["dry-run"] ? "would remove" : "removed";
267
+ console.log(`${verb} ${removed.length} file(s):`);
268
+ for (const file of removed) console.log(` ${file}`);
269
+ }
270
+ };
271
+ var datalakeAuditCommand = {
272
+ command: "audit",
273
+ describe: "Inspect or prune the data-plane audit log (dev server)",
274
+ builder: (yargs) => yargs.command(viewCommand).command(purgeCommand),
275
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
276
+ handler: () => {
277
+ }
278
+ };
279
+
280
+ // src/commands/datalakeCreateCommand.ts
281
+ import { DATALAKE_REGIONS, DATALAKE_TIERS } from "@xylabs/aries-datalake-core";
282
+
283
+ // src/actions/datalake/createDatalake.ts
284
+ import { createDatalakeClient as createDatalakeClient2 } from "@xylabs/aries-datalake-client";
285
+ import chalk3 from "chalk";
286
+
287
+ // src/actions/datalake/formatters.ts
288
+ import chalk2 from "chalk";
289
+ var STATUS_COLORS = {
290
+ pending: chalk2.gray,
291
+ provisioning: chalk2.yellow,
292
+ ready: chalk2.green,
293
+ resizing: chalk2.yellow,
294
+ deprovisioning: chalk2.yellow,
295
+ deleted: chalk2.gray,
296
+ error: chalk2.red
297
+ };
298
+ function formatBytes(bytes) {
299
+ if (bytes < 1024) return `${bytes} B`;
300
+ if (bytes < 1024 ** 2) return `${(bytes / 1024).toFixed(1)} KB`;
301
+ if (bytes < 1024 ** 3) return `${(bytes / 1024 ** 2).toFixed(1)} MB`;
302
+ if (bytes < 1024 ** 4) return `${(bytes / 1024 ** 3).toFixed(1)} GB`;
303
+ return `${(bytes / 1024 ** 4).toFixed(1)} TB`;
304
+ }
305
+ function formatStatus(status) {
306
+ const colorize = STATUS_COLORS[status] ?? chalk2.white;
307
+ return colorize(status);
308
+ }
309
+ function printDatalakeRow(datalake) {
310
+ const size = datalake.config.sizeBytes ? formatBytes(datalake.config.sizeBytes) : "\u2014";
311
+ const name = chalk2.white(datalake.name.padEnd(20));
312
+ const tier = chalk2.cyan(datalake.config.tier.padEnd(8));
313
+ const region = chalk2.gray((datalake.config.region ?? "\u2014").padEnd(12));
314
+ const status = formatStatus(datalake.status).padEnd(14);
315
+ console.log(` ${name} ${tier} ${region} ${size.padStart(8)} ${status}`);
316
+ }
317
+ function printRateLimits(limits) {
318
+ const parts = [];
319
+ if (limits.authenticatedPerMinute !== void 0) parts.push(`auth=${limits.authenticatedPerMinute}/min`);
320
+ if (limits.anonymousPerMinute !== void 0) parts.push(`anon=${limits.anonymousPerMinute}/min`);
321
+ if (limits.burstFactor !== void 0) parts.push(`burst=${limits.burstFactor}x`);
322
+ if (parts.length > 0) {
323
+ console.log(` ${chalk2.gray("limits:")} ${parts.join(" ")}`);
324
+ }
325
+ }
326
+ function printUsage(usage) {
327
+ console.log();
328
+ console.log(chalk2.cyan(" usage"));
329
+ console.log(` ${chalk2.gray("payloads:")} ${usage.payloadCount}`);
330
+ console.log(` ${chalk2.gray("stored:")} ${formatBytes(usage.bytesStored)} / ${formatBytes(usage.bytesStoredLimit)}`);
331
+ console.log(` ${chalk2.gray("reads 24h:")} ${usage.readsLast24h}`);
332
+ console.log(` ${chalk2.gray("writes 24h:")} ${usage.writesLast24h}`);
333
+ }
334
+ function printAcl(acl) {
335
+ if (acl.length === 0) return;
336
+ console.log();
337
+ console.log(chalk2.cyan(" access"));
338
+ for (const entry of acl) {
339
+ const principal = entry.principal === "public" ? chalk2.yellow("public") : entry.principal;
340
+ console.log(` ${principal.padEnd(24)} ${chalk2.magenta(entry.role)} ${chalk2.gray(entry.grantedAt)}`);
341
+ }
342
+ }
343
+ function printDatalakeDetail(datalake) {
344
+ console.log(chalk2.cyan(`
345
+ ${datalake.name}`));
346
+ console.log(` ${chalk2.gray("id:")} ${datalake.id}`);
347
+ console.log(` ${chalk2.gray("status:")} ${formatStatus(datalake.status)}`);
348
+ if (datalake.url) {
349
+ console.log(` ${chalk2.gray("url:")} ${datalake.url}`);
350
+ }
351
+ console.log(` ${chalk2.gray("owner:")} ${datalake.ownerId}`);
352
+ console.log(` ${chalk2.gray("tier:")} ${datalake.config.tier}`);
353
+ console.log(` ${chalk2.gray("region:")} ${datalake.config.region ?? "\u2014"}`);
354
+ console.log(` ${chalk2.gray("size:")} ${datalake.config.sizeBytes ? formatBytes(datalake.config.sizeBytes) : "\u2014"}`);
355
+ console.log(` ${chalk2.gray("iops:")} ${datalake.config.iops ?? "\u2014"}`);
356
+ console.log(` ${chalk2.gray("retention:")} ${datalake.config.retentionDays ?? "forever"}`);
357
+ if (datalake.config.verifyHashes) {
358
+ console.log(` ${chalk2.gray("verify:")} ${chalk2.green("hashes enforced")}`);
359
+ }
360
+ if (datalake.config.rateLimits) printRateLimits(datalake.config.rateLimits);
361
+ console.log(` ${chalk2.gray("created:")} ${datalake.createdAt}`);
362
+ console.log(` ${chalk2.gray("updated:")} ${datalake.updatedAt}`);
363
+ if (datalake.usage) printUsage(datalake.usage);
364
+ printAcl(datalake.acl);
365
+ if (datalake.errorMessage) {
366
+ console.log();
367
+ console.log(` ${chalk2.red("error:")} ${datalake.errorMessage}`);
368
+ }
369
+ }
370
+
371
+ // src/actions/datalake/parseSize.ts
372
+ var SIZE_UNITS = {
373
+ b: 1,
374
+ kb: 1024,
375
+ mb: 1024 ** 2,
376
+ gb: 1024 ** 3,
377
+ tb: 1024 ** 4
378
+ };
379
+ function parseSize(input) {
380
+ const match = /^(\d+(?:\.\d+)?)\s*([a-zA-Z]+)?$/.exec(input.trim());
381
+ if (!match) throw new Error(`Invalid size: ${input}`);
382
+ const value = Number(match[1]);
383
+ const unitRaw = (match[2] ?? "b").toLowerCase();
384
+ const unit = SIZE_UNITS[unitRaw];
385
+ if (unit === void 0) throw new Error(`Unknown size unit: ${match[2]}`);
386
+ return Math.round(value * unit);
387
+ }
388
+
389
+ // src/actions/datalake/createDatalake.ts
390
+ function buildRateLimits(options) {
391
+ if (options.rateAuthPerMinute === void 0 && options.rateAnonPerMinute === void 0 && options.rateBurstFactor === void 0) return void 0;
392
+ return {
393
+ authenticatedPerMinute: options.rateAuthPerMinute,
394
+ anonymousPerMinute: options.rateAnonPerMinute,
395
+ burstFactor: options.rateBurstFactor
396
+ };
397
+ }
398
+ async function createDatalake(options) {
399
+ const client = createDatalakeClient2();
400
+ const config = {
401
+ tier: options.tier,
402
+ sizeBytes: options.size === void 0 ? void 0 : parseSize(options.size),
403
+ iops: options.iops,
404
+ region: options.region,
405
+ retentionDays: options.retentionDays,
406
+ verifyHashes: options.verifyHashes,
407
+ rateLimits: buildRateLimits(options)
408
+ };
409
+ console.log(chalk3.gray(`provisioning ${options.name} (tier=${options.tier})...`));
410
+ const descriptor = await client.create({ name: options.name, config });
411
+ console.log(chalk3.green(`created ${descriptor.name} (${descriptor.id})`));
412
+ printDatalakeDetail(descriptor);
413
+ }
414
+
415
+ // src/actions/datalake/describeDatalake.ts
416
+ import { createDatalakeClient as createDatalakeClient4 } from "@xylabs/aries-datalake-client";
417
+ import chalk4 from "chalk";
418
+
419
+ // src/actions/datalake/payloads/mintAndConnect.ts
420
+ import { createDatalakeClient as createDatalakeClient3, RestPayloadsClient } from "@xylabs/aries-datalake-client";
421
+ import { XyoPayloadsClient } from "@xylabs/aries-datalake-xl1-adapter";
422
+
423
+ // src/actions/datalake/resolveTarget.ts
424
+ import { getDefaultDatalake } from "@xylabs/aries-datalake-client";
425
+ function resolveTarget(argValue) {
426
+ const target = argValue ?? getDefaultDatalake();
427
+ if (!target) {
428
+ throw new Error(
429
+ "No datalake specified and no default set. Pass <name> or run `aries datalake use <name>`."
430
+ );
431
+ }
432
+ return target;
433
+ }
434
+
435
+ // src/actions/datalake/payloads/mintAndConnect.ts
436
+ async function mintAndConnect(options) {
437
+ const controlClient = createDatalakeClient3();
438
+ const target = resolveTarget(options.idOrName);
439
+ const descriptor = await controlClient.describe(target);
440
+ if (!descriptor.url) {
441
+ throw new Error(`Datalake ${descriptor.name} has no URL yet (status=${descriptor.status})`);
442
+ }
443
+ const token = await controlClient.mintToken({
444
+ datalakeId: descriptor.id,
445
+ role: options.role,
446
+ ttlSeconds: options.ttlSeconds ?? 3600
447
+ });
448
+ const clientOptions = {
449
+ baseUrl: token.url,
450
+ datalakeId: descriptor.id,
451
+ authToken: token.token
452
+ };
453
+ return {
454
+ client: options.useXl1Sdk ? new XyoPayloadsClient(clientOptions) : new RestPayloadsClient(clientOptions),
455
+ datalakeName: descriptor.name,
456
+ datalakeId: descriptor.id,
457
+ url: token.url,
458
+ transport: options.useXl1Sdk ? "xl1-sdk" : "native"
459
+ };
460
+ }
461
+
462
+ // src/actions/datalake/describeDatalake.ts
463
+ async function describeDatalake(idOrName) {
464
+ const client = createDatalakeClient4();
465
+ const target = resolveTarget(idOrName);
466
+ const descriptor = await client.describe(target);
467
+ printDatalakeDetail(descriptor);
468
+ if (descriptor.status !== "ready") return;
469
+ try {
470
+ const connection = await mintAndConnect({ idOrName: target, role: "viewer" });
471
+ const usage = await connection.client.usage();
472
+ printLiveUsage(usage);
473
+ } catch (error) {
474
+ console.log();
475
+ console.log(chalk4.gray(
476
+ ` (live quota unavailable: ${error instanceof Error ? error.message : String(error)})`
477
+ ));
478
+ }
479
+ }
480
+ function printLiveUsage(usage) {
481
+ console.log();
482
+ console.log(chalk4.cyan(" live"));
483
+ console.log(` ${chalk4.gray("payloads:")} ${usage.payloadCount}`);
484
+ const limits = usage.rateLimits;
485
+ if (limits?.authenticated) {
486
+ const { remaining, limit } = limits.authenticated;
487
+ console.log(` ${chalk4.gray("auth quota:")} ${remaining}/${limit}`);
488
+ }
489
+ if (limits?.anonymous) {
490
+ const { remaining, limit } = limits.anonymous;
491
+ console.log(` ${chalk4.gray("anon quota:")} ${remaining}/${limit}`);
492
+ }
493
+ }
494
+
495
+ // src/actions/datalake/destroyDatalake.ts
496
+ import { createDatalakeClient as createDatalakeClient5 } from "@xylabs/aries-datalake-client";
497
+ import chalk5 from "chalk";
498
+ async function destroyDatalake(options) {
499
+ const client = createDatalakeClient5();
500
+ const target = resolveTarget(options.idOrName);
501
+ if (!options.force) {
502
+ console.log(chalk5.yellow(
503
+ `Refusing to destroy ${target} without --force. This operation permanently deletes the datalake and all its payloads.`
504
+ ));
505
+ process.exitCode = 1;
506
+ return;
507
+ }
508
+ await client.destroy(target);
509
+ console.log(chalk5.green(`destroyed ${target}`));
510
+ }
511
+
512
+ // src/actions/datalake/grantAccess.ts
513
+ import { createDatalakeClient as createDatalakeClient6 } from "@xylabs/aries-datalake-client";
514
+ import chalk6 from "chalk";
515
+ async function grantAccess(options) {
516
+ const client = createDatalakeClient6();
517
+ const target = resolveTarget(options.idOrName);
518
+ if (options.principal === "public" && options.role === "runner" && !options.confirmPublic) {
519
+ console.log(chalk6.yellow(
520
+ "Granting `public runner` makes anonymous writes possible. Re-run with --confirm-public to proceed."
521
+ ));
522
+ process.exitCode = 1;
523
+ return;
524
+ }
525
+ const descriptor = await client.describe(target);
526
+ const updated = await client.grant({
527
+ datalakeId: descriptor.id,
528
+ principal: options.principal,
529
+ role: options.role
530
+ });
531
+ console.log(chalk6.green(`granted ${options.role} to ${options.principal} on ${updated.name}`));
532
+ printDatalakeDetail(updated);
533
+ }
534
+
535
+ // src/actions/datalake/listDatalakes.ts
536
+ import { createDatalakeClient as createDatalakeClient7 } from "@xylabs/aries-datalake-client";
537
+ import chalk7 from "chalk";
538
+ async function listDatalakes() {
539
+ const client = createDatalakeClient7();
540
+ const datalakes = await client.list();
541
+ if (datalakes.length === 0) {
542
+ console.log(chalk7.yellow("No datalakes yet. Create one with `aries datalake create <name>`."));
543
+ return;
544
+ }
545
+ console.log(
546
+ chalk7.gray(" ") + chalk7.gray("name".padEnd(20)) + " " + chalk7.gray("tier".padEnd(8)) + " " + chalk7.gray("region".padEnd(12)) + " " + chalk7.gray(" size") + " " + chalk7.gray("status")
547
+ );
548
+ for (const datalake of datalakes) {
549
+ printDatalakeRow(datalake);
550
+ }
551
+ }
552
+
553
+ // src/actions/datalake/login.ts
554
+ import { saveCredentials } from "@xylabs/aries-datalake-client";
555
+ import chalk8 from "chalk";
556
+ async function login(options) {
557
+ const baseUrl = options.baseUrl ?? process.env.ARIES_DATALAKE_API;
558
+ const token = options.token ?? process.env.ARIES_DATALAKE_TOKEN;
559
+ if (!baseUrl || !token) {
560
+ console.log(chalk8.yellow(
561
+ "P0 login requires --base-url and --token (or ARIES_DATALAKE_API + ARIES_DATALAKE_TOKEN). OAuth device-flow lands in P1."
562
+ ));
563
+ process.exitCode = 1;
564
+ return;
565
+ }
566
+ saveCredentials({ baseUrl, authToken: token });
567
+ console.log(chalk8.green(`credentials saved for ${baseUrl}`));
568
+ }
569
+
570
+ // src/actions/datalake/logout.ts
571
+ import { clearCredentials } from "@xylabs/aries-datalake-client";
572
+ import chalk9 from "chalk";
573
+ async function logout() {
574
+ clearCredentials();
575
+ console.log(chalk9.green("signed out"));
576
+ }
577
+
578
+ // src/actions/datalake/mintToken.ts
579
+ import { createDatalakeClient as createDatalakeClient8 } from "@xylabs/aries-datalake-client";
580
+ import chalk10 from "chalk";
581
+ async function mintToken(options) {
582
+ const client = createDatalakeClient8();
583
+ const target = resolveTarget(options.idOrName);
584
+ const descriptor = await client.describe(target);
585
+ const token = await client.mintToken({
586
+ datalakeId: descriptor.id,
587
+ role: options.role,
588
+ ttlSeconds: options.ttlSeconds
589
+ });
590
+ console.log(chalk10.cyan("datalake token"));
591
+ console.log(` ${chalk10.gray("url:")} ${token.url}`);
592
+ console.log(` ${chalk10.gray("role:")} ${token.role}`);
593
+ console.log(` ${chalk10.gray("exp:")} ${token.expiresAt}`);
594
+ console.log();
595
+ console.log(token.token);
596
+ }
597
+
598
+ // src/actions/datalake/revokeAccess.ts
599
+ import { createDatalakeClient as createDatalakeClient9 } from "@xylabs/aries-datalake-client";
600
+ import chalk11 from "chalk";
601
+ async function revokeAccess(options) {
602
+ const client = createDatalakeClient9();
603
+ const target = resolveTarget(options.idOrName);
604
+ const descriptor = await client.describe(target);
605
+ const updated = await client.revoke({
606
+ datalakeId: descriptor.id,
607
+ principal: options.principal
608
+ });
609
+ console.log(chalk11.green(`revoked access for ${options.principal} on ${updated.name}`));
610
+ printDatalakeDetail(updated);
611
+ }
612
+
613
+ // src/actions/datalake/useDatalake.ts
614
+ import {
615
+ clearDefaultDatalake,
616
+ createDatalakeClient as createDatalakeClient10,
617
+ setDefaultDatalake
618
+ } from "@xylabs/aries-datalake-client";
619
+ import chalk12 from "chalk";
620
+ async function useDatalake(name) {
621
+ if (!name) {
622
+ clearDefaultDatalake();
623
+ console.log(chalk12.green("cleared default datalake"));
624
+ return;
625
+ }
626
+ const client = createDatalakeClient10();
627
+ const descriptor = await client.describe(name);
628
+ setDefaultDatalake(descriptor.name, descriptor.id);
629
+ console.log(chalk12.green(`default datalake set to ${descriptor.name} (${descriptor.id})`));
630
+ }
631
+
632
+ // src/commands/datalakeCreateCommand.ts
633
+ var datalakeCreateCommand = {
634
+ command: "create <name>",
635
+ describe: "Provision a new datalake",
636
+ builder: (yargs) => yargs.positional("name", {
637
+ type: "string",
638
+ describe: "Human-friendly name (unique per owner)",
639
+ demandOption: true
640
+ }).option("tier", {
641
+ alias: "t",
642
+ type: "string",
643
+ choices: DATALAKE_TIERS,
644
+ default: "small",
645
+ describe: "Service tier"
646
+ }).option("size", {
647
+ alias: "s",
648
+ type: "string",
649
+ describe: "Capacity (e.g. 10GB, 100GB, 1TB)"
650
+ }).option("iops", {
651
+ type: "number",
652
+ describe: "Provisioned IOPS target"
653
+ }).option("region", {
654
+ alias: "r",
655
+ type: "string",
656
+ choices: DATALAKE_REGIONS,
657
+ describe: "Deployment region"
658
+ }).option("retention-days", {
659
+ type: "number",
660
+ describe: "Retention in days (omit for tier default)"
661
+ }).option("verify-hashes", {
662
+ type: "boolean",
663
+ default: false,
664
+ describe: "Reject inserts whose $hash does not match the content digest"
665
+ }).option("rate-auth-per-minute", {
666
+ type: "number",
667
+ describe: "Override: authenticated requests per minute"
668
+ }).option("rate-anon-per-minute", {
669
+ type: "number",
670
+ describe: "Override: anonymous requests per minute"
671
+ }).option("rate-burst-factor", {
672
+ type: "number",
673
+ describe: "Override: rate-limit burst factor (1 = no burst)"
674
+ }),
675
+ handler: async (argv) => {
676
+ await createDatalake({
677
+ name: argv.name,
678
+ tier: argv.tier,
679
+ size: argv.size,
680
+ iops: argv.iops,
681
+ region: argv.region,
682
+ retentionDays: argv["retention-days"],
683
+ verifyHashes: argv["verify-hashes"],
684
+ rateAuthPerMinute: argv["rate-auth-per-minute"],
685
+ rateAnonPerMinute: argv["rate-anon-per-minute"],
686
+ rateBurstFactor: argv["rate-burst-factor"]
687
+ });
688
+ }
689
+ };
690
+
691
+ // src/commands/datalakeDescribeCommand.ts
692
+ var datalakeDescribeCommand = {
693
+ command: "describe [name]",
694
+ describe: "Show details for a datalake (falls back to the default)",
695
+ builder: (yargs) => yargs.positional("name", {
696
+ type: "string",
697
+ describe: "Datalake name or id"
698
+ }),
699
+ handler: async (argv) => {
700
+ await describeDatalake(argv.name);
701
+ }
702
+ };
703
+
704
+ // src/commands/datalakeDestroyCommand.ts
705
+ var datalakeDestroyCommand = {
706
+ command: "destroy [name]",
707
+ describe: "Permanently delete a datalake",
708
+ builder: (yargs) => yargs.positional("name", {
709
+ type: "string",
710
+ describe: "Datalake name or id"
711
+ }).option("force", {
712
+ alias: "f",
713
+ type: "boolean",
714
+ default: false,
715
+ describe: "Required confirmation flag"
716
+ }),
717
+ handler: async (argv) => {
718
+ await destroyDatalake({
719
+ idOrName: argv.name,
720
+ force: argv.force
721
+ });
722
+ }
723
+ };
724
+
725
+ // src/actions/datalake/dev/downDevServer.ts
726
+ import { clearCredentials as clearCredentials2, loadCredentials } from "@xylabs/aries-datalake-client";
727
+ import chalk13 from "chalk";
728
+
729
+ // src/actions/datalake/dev/state.ts
730
+ import {
731
+ existsSync as existsSync2,
732
+ mkdirSync,
733
+ readFileSync,
734
+ unlinkSync as unlinkSync2,
735
+ writeFileSync
736
+ } from "fs";
737
+ function readDevState() {
738
+ const filePath = getDevStatePath();
739
+ if (!existsSync2(filePath)) return void 0;
740
+ try {
741
+ return JSON.parse(readFileSync(filePath, "utf8"));
742
+ } catch {
743
+ return void 0;
744
+ }
745
+ }
746
+ function writeDevState(state) {
747
+ const dir = getDevDir();
748
+ if (!existsSync2(dir)) mkdirSync(dir, { recursive: true });
749
+ writeFileSync(getDevStatePath(), JSON.stringify(state, void 0, 2), "utf8");
750
+ writeFileSync(getDevPidPath(), String(state.pid), "utf8");
751
+ }
752
+ function clearDevState() {
753
+ for (const filePath of [getDevStatePath(), getDevPidPath()]) {
754
+ if (existsSync2(filePath)) unlinkSync2(filePath);
755
+ }
756
+ }
757
+ function isProcessAlive(pid) {
758
+ try {
759
+ process.kill(pid, 0);
760
+ return true;
761
+ } catch (error) {
762
+ const code = error.code;
763
+ return code === "EPERM";
764
+ }
765
+ }
766
+
767
+ // src/actions/datalake/dev/downDevServer.ts
768
+ var DEFAULT_GRACE_MS = 2e3;
769
+ var POLL_MS = 50;
770
+ async function downDevServer(options = {}) {
771
+ const state = readDevState();
772
+ if (!state) {
773
+ console.log(chalk13.yellow("dev server is not running"));
774
+ return;
775
+ }
776
+ const graceMs = options.gracePeriodMs ?? DEFAULT_GRACE_MS;
777
+ if (!isProcessAlive(state.pid)) {
778
+ cleanup(state.controlUrl);
779
+ console.log(chalk13.green(`dev server pid ${state.pid} was already stopped \u2014 cleaned up state`));
780
+ return;
781
+ }
782
+ try {
783
+ process.kill(state.pid, "SIGTERM");
784
+ } catch (error) {
785
+ const code = error.code;
786
+ if (code !== "ESRCH") throw error;
787
+ }
788
+ const deadline = Date.now() + graceMs;
789
+ while (Date.now() < deadline && isProcessAlive(state.pid)) {
790
+ await delay(POLL_MS);
791
+ }
792
+ if (isProcessAlive(state.pid)) {
793
+ try {
794
+ process.kill(state.pid, "SIGKILL");
795
+ } catch {
796
+ }
797
+ }
798
+ cleanup(state.controlUrl);
799
+ console.log(chalk13.green(`dev server pid ${state.pid} stopped`));
800
+ }
801
+ function cleanup(controlUrl) {
802
+ const credentials = loadCredentials();
803
+ if (credentials?.baseUrl === controlUrl) {
804
+ clearCredentials2();
805
+ }
806
+ clearDevState();
807
+ }
808
+ function delay(ms) {
809
+ return new Promise((resolve) => setTimeout(resolve, ms));
810
+ }
811
+
812
+ // src/actions/datalake/dev/logsDevServer.ts
813
+ import { spawn as spawn2 } from "child_process";
814
+ import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
815
+ import chalk14 from "chalk";
816
+ async function logsDevServer(options = {}) {
817
+ const logPath = getDevLogPath();
818
+ if (!existsSync3(logPath)) {
819
+ console.log(chalk14.yellow("no dev server log file yet"));
820
+ return;
821
+ }
822
+ if (options.follow) {
823
+ const child = spawn2("tail", ["-n", String(options.lines ?? 50), "-f", logPath], { stdio: "inherit" });
824
+ await new Promise((resolve) => {
825
+ child.on("exit", (code) => {
826
+ process.exitCode = code ?? 0;
827
+ resolve();
828
+ });
829
+ });
830
+ return;
831
+ }
832
+ const lines = readFileSync2(logPath, "utf8").split("\n");
833
+ const tail = lines.slice(-(options.lines ?? 50));
834
+ process.stdout.write(tail.join("\n"));
835
+ if (!tail.at(-1)?.endsWith("\n")) process.stdout.write("\n");
836
+ }
837
+
838
+ // src/actions/datalake/dev/resetDevServer.ts
839
+ import { existsSync as existsSync4, rmSync } from "fs";
840
+ import chalk15 from "chalk";
841
+ async function resetDevServer() {
842
+ await downDevServer();
843
+ const dir = getDevDir();
844
+ if (!existsSync4(dir)) {
845
+ console.log(chalk15.green("nothing to reset"));
846
+ return;
847
+ }
848
+ rmSync(dir, { recursive: true, force: true });
849
+ console.log(chalk15.green(`reset ${dir}`));
850
+ }
851
+
852
+ // src/actions/datalake/dev/statusDevServer.ts
853
+ import chalk16 from "chalk";
854
+ async function statusDevServer() {
855
+ const state = readDevState();
856
+ if (!state) {
857
+ console.log(chalk16.yellow("dev server not running"));
858
+ process.exitCode = 3;
859
+ return;
860
+ }
861
+ const alive = isProcessAlive(state.pid);
862
+ const healthy = alive ? await pingHealth(state.controlUrl) : false;
863
+ const uptime = formatUptime(state.startedAt);
864
+ console.log(chalk16.cyan("dev server status"));
865
+ console.log(` ${chalk16.gray("state:")} ${statusLabel(alive, healthy)}`);
866
+ console.log(` ${chalk16.gray("pid:")} ${state.pid}`);
867
+ console.log(` ${chalk16.gray("control:")} ${state.controlUrl}`);
868
+ console.log(` ${chalk16.gray("data:")} ${state.planeUrl}`);
869
+ console.log(` ${chalk16.gray("user:")} ${state.userId}`);
870
+ console.log(` ${chalk16.gray("started:")} ${state.startedAt}${uptime ? ` (${uptime})` : ""}`);
871
+ console.log(` ${chalk16.gray("log:")} ${getDevLogPath()}`);
872
+ if (alive && !healthy) {
873
+ process.exitCode = 2;
874
+ } else if (!alive) {
875
+ process.exitCode = 3;
876
+ }
877
+ }
878
+ function statusLabel(alive, healthy) {
879
+ if (alive && healthy) return chalk16.green("running + healthy");
880
+ if (alive) return chalk16.yellow("running but unresponsive");
881
+ return chalk16.red("stale state (process gone)");
882
+ }
883
+ async function pingHealth(controlUrl) {
884
+ try {
885
+ const controller = new AbortController();
886
+ const timeout = setTimeout(() => controller.abort(), 1e3);
887
+ const response = await fetch(`${controlUrl}/v1/health`, { signal: controller.signal });
888
+ clearTimeout(timeout);
889
+ return response.ok;
890
+ } catch {
891
+ return false;
892
+ }
893
+ }
894
+ function formatUptime(startedAt) {
895
+ const started = new Date(startedAt).getTime();
896
+ if (Number.isNaN(started)) return "";
897
+ const seconds = Math.max(0, Math.floor((Date.now() - started) / 1e3));
898
+ if (seconds < 60) return `${seconds}s`;
899
+ const minutes = Math.floor(seconds / 60);
900
+ if (minutes < 60) return `${minutes}m ${seconds % 60}s`;
901
+ const hours = Math.floor(minutes / 60);
902
+ return `${hours}h ${minutes % 60}m`;
903
+ }
904
+
905
+ // src/actions/datalake/dev/upDevServer.ts
906
+ import { spawn as spawn3 } from "child_process";
907
+ import { randomBytes } from "crypto";
908
+ import {
909
+ existsSync as existsSync6,
910
+ mkdirSync as mkdirSync2,
911
+ openSync
912
+ } from "fs";
913
+ import path4 from "path";
914
+ import { saveCredentials as saveCredentials2 } from "@xylabs/aries-datalake-client";
915
+ import chalk17 from "chalk";
916
+
917
+ // src/actions/datalake/dev/resolveServerBin.ts
918
+ import { existsSync as existsSync5 } from "fs";
919
+ import { createRequire } from "module";
920
+ import path3 from "path";
921
+ var require2 = createRequire(import.meta.url);
922
+ function resolveServerBin() {
923
+ let packageJsonPath;
924
+ try {
925
+ packageJsonPath = require2.resolve("@xylabs/aries-datalake-plane/package.json");
926
+ } catch {
927
+ throw new Error(
928
+ "@xylabs/aries-datalake-plane is not installed. Install it as a dev dependency to use `aries datalake dev` locally."
929
+ );
930
+ }
931
+ const binPath = path3.join(path3.dirname(packageJsonPath), "dist", "bin", "devServer.mjs");
932
+ if (!existsSync5(binPath)) {
933
+ throw new Error(
934
+ `Dev server binary not found at ${binPath}. Run \`pnpm xy compile\` to build it.`
935
+ );
936
+ }
937
+ return binPath;
938
+ }
939
+
940
+ // src/actions/datalake/dev/waitForHealth.ts
941
+ var POLL_INTERVAL_MS = 100;
942
+ async function waitForHealth(baseUrl, timeoutMs) {
943
+ const deadline = Date.now() + timeoutMs;
944
+ const url = `${baseUrl.replace(/\/$/, "")}/v1/health`;
945
+ while (Date.now() < deadline) {
946
+ try {
947
+ const response = await fetch(url);
948
+ if (response.ok) return true;
949
+ } catch {
950
+ }
951
+ await delay2(POLL_INTERVAL_MS);
952
+ }
953
+ return false;
954
+ }
955
+ function delay2(ms) {
956
+ return new Promise((resolve) => setTimeout(resolve, ms));
957
+ }
958
+
959
+ // src/actions/datalake/dev/upDevServer.ts
960
+ var DEFAULT_CONTROL_PORT = 8787;
961
+ var DEFAULT_PLANE_PORT = 8788;
962
+ var DEFAULT_TIMEOUT_SECONDS = 10;
963
+ function resolveOptions(options) {
964
+ const controlPort = options.controlPort ?? DEFAULT_CONTROL_PORT;
965
+ const planePort = options.planePort ?? DEFAULT_PLANE_PORT;
966
+ const rotate = options.auditRotate === true;
967
+ return {
968
+ controlPort,
969
+ planePort,
970
+ controlUrl: `http://127.0.0.1:${controlPort}`,
971
+ planeUrl: `http://127.0.0.1:${planePort}`,
972
+ userId: options.userId ?? "dev-user",
973
+ authToken: options.authToken ?? randomBytes(16).toString("hex"),
974
+ signingSecret: options.signingSecret ?? randomBytes(32).toString("hex"),
975
+ timeoutMs: (options.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1e3,
976
+ persistDir: options.persist ? path4.join(getDevDir(), "store") : void 0,
977
+ auditLogPath: options.audit && !rotate ? path4.join(getDevDir(), "audit.log") : void 0,
978
+ auditDir: options.audit && rotate ? path4.join(getDevDir(), "audit") : void 0,
979
+ auditKeepDays: rotate ? options.auditKeepDays : void 0
980
+ };
981
+ }
982
+ function spawnDaemon(binPath, resolved) {
983
+ const devDir = getDevDir();
984
+ if (!existsSync6(devDir)) mkdirSync2(devDir, { recursive: true });
985
+ const logFd = openSync(getDevLogPath(), "a");
986
+ const env = {
987
+ ...process.env,
988
+ CONTROL_PORT: String(resolved.controlPort),
989
+ PLANE_PORT: String(resolved.planePort),
990
+ HOST: "127.0.0.1",
991
+ DATALAKE_CONTROL_TOKENS: `${resolved.authToken}=${resolved.userId}`,
992
+ TOKEN_SIGNING_SECRET: resolved.signingSecret,
993
+ DATALAKE_ORIGIN_URL: resolved.planeUrl,
994
+ LOG_LEVEL: process.env.LOG_LEVEL ?? "info"
995
+ };
996
+ if (resolved.persistDir) env.DATALAKE_PERSIST_DIR = resolved.persistDir;
997
+ if (resolved.auditLogPath) env.DATALAKE_AUDIT_LOG = resolved.auditLogPath;
998
+ if (resolved.auditDir) env.DATALAKE_AUDIT_DIR = resolved.auditDir;
999
+ if (resolved.auditKeepDays !== void 0) env.DATALAKE_AUDIT_MAX_AGE_DAYS = String(resolved.auditKeepDays);
1000
+ const child = spawn3(process.execPath, [binPath], {
1001
+ detached: true,
1002
+ stdio: ["ignore", logFd, logFd],
1003
+ env
1004
+ });
1005
+ child.unref();
1006
+ return child;
1007
+ }
1008
+ function describeAudit(resolved) {
1009
+ if (resolved.auditDir) {
1010
+ return `rotating ${resolved.auditDir}${resolved.auditKeepDays ? ` (keep ${resolved.auditKeepDays}d)` : ""}`;
1011
+ }
1012
+ return resolved.auditLogPath ?? "disabled";
1013
+ }
1014
+ function printReadyBanner(state, resolved) {
1015
+ console.log(chalk17.green("dev server ready"));
1016
+ console.log(` ${chalk17.gray("control:")} ${state.controlUrl}`);
1017
+ console.log(` ${chalk17.gray("data:")} ${state.planeUrl}`);
1018
+ console.log(` ${chalk17.gray("user:")} ${state.userId}`);
1019
+ console.log(` ${chalk17.gray("log:")} ${getDevLogPath()}`);
1020
+ console.log(` ${chalk17.gray("store:")} ${resolved.persistDir ? `persisted (${resolved.persistDir})` : "in-memory"}`);
1021
+ console.log(` ${chalk17.gray("audit:")} ${describeAudit(resolved)}`);
1022
+ console.log(chalk17.gray("\nCLI is configured \u2014 try `aries datalake list`"));
1023
+ }
1024
+ async function upDevServer(options = {}) {
1025
+ const existing = readDevState();
1026
+ if (existing && isProcessAlive(existing.pid)) {
1027
+ console.log(chalk17.yellow(`dev server already running (pid ${existing.pid}) at ${existing.controlUrl}`));
1028
+ return existing;
1029
+ }
1030
+ if (existing) clearDevState();
1031
+ const resolved = resolveOptions(options);
1032
+ const child = spawnDaemon(resolveServerBin(), resolved);
1033
+ if (!child.pid) throw new Error("Failed to spawn dev server process");
1034
+ console.log(chalk17.gray(`starting dev server (pid ${child.pid})...`));
1035
+ const healthy = await waitForHealth(resolved.controlUrl, resolved.timeoutMs);
1036
+ if (!healthy) {
1037
+ try {
1038
+ process.kill(child.pid, "SIGTERM");
1039
+ } catch {
1040
+ }
1041
+ throw new Error(
1042
+ `Dev server did not become healthy within ${resolved.timeoutMs / 1e3}s. Check logs at ${getDevLogPath()}`
1043
+ );
1044
+ }
1045
+ const state = {
1046
+ pid: child.pid,
1047
+ controlUrl: resolved.controlUrl,
1048
+ planeUrl: resolved.planeUrl,
1049
+ controlPort: resolved.controlPort,
1050
+ planePort: resolved.planePort,
1051
+ userId: resolved.userId,
1052
+ authToken: resolved.authToken,
1053
+ signingSecret: resolved.signingSecret,
1054
+ startedAt: (/* @__PURE__ */ new Date()).toISOString()
1055
+ };
1056
+ writeDevState(state);
1057
+ saveCredentials2({
1058
+ baseUrl: resolved.controlUrl,
1059
+ authToken: resolved.authToken,
1060
+ userId: resolved.userId
1061
+ });
1062
+ printReadyBanner(state, resolved);
1063
+ return state;
1064
+ }
1065
+
1066
+ // src/commands/datalakeDevDownCommand.ts
1067
+ var datalakeDevDownCommand = {
1068
+ command: "down",
1069
+ describe: "Stop the local dev server (if running) and clear its credentials",
1070
+ handler: async () => {
1071
+ await downDevServer();
1072
+ }
1073
+ };
1074
+
1075
+ // src/commands/datalakeDevLogsCommand.ts
1076
+ var datalakeDevLogsCommand = {
1077
+ command: "logs",
1078
+ describe: "Print recent dev server log output",
1079
+ builder: (yargs) => yargs.option("follow", {
1080
+ alias: "f",
1081
+ type: "boolean",
1082
+ default: false,
1083
+ describe: "Stream new lines as they arrive"
1084
+ }).option("lines", {
1085
+ alias: "n",
1086
+ type: "number",
1087
+ default: 50,
1088
+ describe: "Number of tail lines to show"
1089
+ }),
1090
+ handler: async (argv) => {
1091
+ await logsDevServer({
1092
+ follow: argv.follow,
1093
+ lines: argv.lines
1094
+ });
1095
+ }
1096
+ };
1097
+
1098
+ // src/commands/datalakeDevResetCommand.ts
1099
+ var datalakeDevResetCommand = {
1100
+ command: "reset",
1101
+ describe: "Stop the dev server and wipe all its local state",
1102
+ handler: async () => {
1103
+ await resetDevServer();
1104
+ }
1105
+ };
1106
+
1107
+ // src/commands/datalakeDevStatusCommand.ts
1108
+ var datalakeDevStatusCommand = {
1109
+ command: "status",
1110
+ describe: "Report whether the local dev server is running and healthy",
1111
+ handler: async () => {
1112
+ await statusDevServer();
1113
+ }
1114
+ };
1115
+
1116
+ // src/commands/datalakeDevUpCommand.ts
1117
+ var datalakeDevUpCommand = {
1118
+ command: "up",
1119
+ describe: "Start the local control + data plane dev server and wire the CLI to it",
1120
+ builder: (yargs) => yargs.option("control-port", {
1121
+ type: "number",
1122
+ default: 8787,
1123
+ describe: "Control-plane port"
1124
+ }).option("plane-port", {
1125
+ type: "number",
1126
+ default: 8788,
1127
+ describe: "Data-plane port"
1128
+ }).option("timeout", {
1129
+ type: "number",
1130
+ default: 10,
1131
+ describe: "Seconds to wait for health"
1132
+ }).option("persist", {
1133
+ type: "boolean",
1134
+ default: false,
1135
+ describe: "Persist store state to disk so it survives restarts"
1136
+ }).option("audit", {
1137
+ type: "boolean",
1138
+ default: false,
1139
+ describe: "Write a JSONL audit log of every data-plane request"
1140
+ }).option("audit-rotate", {
1141
+ type: "boolean",
1142
+ default: false,
1143
+ describe: "Rotate the audit log daily (writes to <home>/dev/audit/)"
1144
+ }).option("audit-keep-days", {
1145
+ type: "number",
1146
+ describe: "Prune rotated audit files older than this many days"
1147
+ }),
1148
+ handler: async (argv) => {
1149
+ await upDevServer({
1150
+ controlPort: argv["control-port"],
1151
+ planePort: argv["plane-port"],
1152
+ timeoutSeconds: argv.timeout,
1153
+ persist: argv.persist,
1154
+ audit: argv.audit,
1155
+ auditRotate: argv["audit-rotate"],
1156
+ auditKeepDays: argv["audit-keep-days"]
1157
+ });
1158
+ }
1159
+ };
1160
+
1161
+ // src/commands/datalakeDevCommand.ts
1162
+ var datalakeDevCommand = {
1163
+ command: "dev",
1164
+ describe: "Run a local datalake control + data plane for development & testing",
1165
+ builder: (yargs) => yargs.command(datalakeDevUpCommand).command(datalakeDevDownCommand).command(datalakeDevStatusCommand).command(datalakeDevLogsCommand).command(datalakeDevResetCommand).demandCommand(1).strictCommands(),
1166
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1167
+ handler: () => {
1168
+ }
1169
+ };
1170
+
1171
+ // src/actions/datalake/payloads/fetchPayload.ts
1172
+ import { DatalakeApiError } from "@xylabs/aries-datalake-core";
1173
+ import chalk18 from "chalk";
1174
+ async function fetchPayload(options) {
1175
+ const connection = await mintAndConnect({
1176
+ idOrName: options.idOrName,
1177
+ role: "viewer",
1178
+ useXl1Sdk: options.xl1Sdk
1179
+ });
1180
+ try {
1181
+ const payload = await connection.client.get(options.hash);
1182
+ if (options.raw) {
1183
+ process.stdout.write(`${JSON.stringify(payload)}
1184
+ `);
1185
+ return;
1186
+ }
1187
+ console.log(chalk18.cyan(`${connection.datalakeName} / ${options.hash}`));
1188
+ console.log(JSON.stringify(payload, void 0, 2));
1189
+ } catch (error) {
1190
+ if (error instanceof DatalakeApiError && error.code === "not_found") {
1191
+ console.log(chalk18.yellow(`payload not found: ${options.hash}`));
1192
+ process.exitCode = 3;
1193
+ return;
1194
+ }
1195
+ throw error;
1196
+ }
1197
+ }
1198
+
1199
+ // src/actions/datalake/payloads/parsePayloadsFile.ts
1200
+ import { readFileSync as readFileSync3 } from "fs";
1201
+ import path5 from "path";
1202
+ function parsePayloadsFile(filePath) {
1203
+ const absolute = path5.resolve(filePath);
1204
+ const raw = readFileSync3(absolute, "utf8");
1205
+ const ext = path5.extname(absolute).toLowerCase();
1206
+ if (ext === ".jsonl" || ext === ".ndjson") {
1207
+ return parseJsonl(raw);
1208
+ }
1209
+ if (ext === ".json") {
1210
+ return parseJson(raw);
1211
+ }
1212
+ const trimmed = raw.trim();
1213
+ if (trimmed.startsWith("{") && trimmed.endsWith("}") && trimmed.includes("\n{")) {
1214
+ return parseJsonl(raw);
1215
+ }
1216
+ return parseJson(raw);
1217
+ }
1218
+ function parseJson(raw) {
1219
+ const parsed = JSON.parse(raw);
1220
+ const candidates = Array.isArray(parsed) ? parsed : isPayloadsEnvelope(parsed) ? parsed.payloads : void 0;
1221
+ if (!candidates) {
1222
+ throw new Error('Expected an array of payloads or { "payloads": [...] }');
1223
+ }
1224
+ const result = [];
1225
+ for (const [index, candidate] of candidates.entries()) {
1226
+ validatePayload(candidate, `index ${index}`);
1227
+ result.push(candidate);
1228
+ }
1229
+ return result;
1230
+ }
1231
+ function parseJsonl(raw) {
1232
+ const lines = raw.split("\n");
1233
+ const payloads = [];
1234
+ for (const [i, line_] of lines.entries()) {
1235
+ const line = line_?.trim();
1236
+ if (!line) continue;
1237
+ let parsed;
1238
+ try {
1239
+ parsed = JSON.parse(line);
1240
+ } catch (error) {
1241
+ const message = error instanceof Error ? error.message : String(error);
1242
+ throw new Error(`Line ${i + 1}: invalid JSON (${message})`, { cause: error });
1243
+ }
1244
+ validatePayload(parsed, `line ${i + 1}`);
1245
+ payloads.push(parsed);
1246
+ }
1247
+ return payloads;
1248
+ }
1249
+ function isPayloadsEnvelope(value) {
1250
+ if (typeof value !== "object" || value === null) return false;
1251
+ const record = value;
1252
+ return Array.isArray(record.payloads);
1253
+ }
1254
+ function validatePayload(value, where) {
1255
+ if (typeof value !== "object" || value === null) {
1256
+ throw new Error(`${where}: not an object`);
1257
+ }
1258
+ const record = value;
1259
+ if (typeof record.schema !== "string" || record.schema.length === 0) {
1260
+ throw new Error(`${where}: missing or invalid \`schema\``);
1261
+ }
1262
+ if (typeof record.$hash !== "string" || record.$hash.length === 0) {
1263
+ throw new Error(`${where}: missing or invalid \`$hash\``);
1264
+ }
1265
+ }
1266
+
1267
+ // src/actions/datalake/payloads/pushPayloads.ts
1268
+ import { xyoVerifyPayloadHash } from "@xylabs/aries-datalake-core";
1269
+ import chalk19 from "chalk";
1270
+ var DEFAULT_BATCH_SIZE = 500;
1271
+ function printRejectedList(label, hashes, cap, color) {
1272
+ console.log(color(label));
1273
+ for (const hash of hashes.slice(0, cap)) {
1274
+ console.log(` ${hash}`);
1275
+ }
1276
+ if (hashes.length > cap) {
1277
+ console.log(chalk19.gray(` ... and ${hashes.length - cap} more`));
1278
+ }
1279
+ }
1280
+ async function verifyLocally(payloads) {
1281
+ const mismatches = [];
1282
+ for (const payload of payloads) {
1283
+ if (!await xyoVerifyPayloadHash(payload)) mismatches.push(payload.$hash);
1284
+ }
1285
+ if (mismatches.length === 0) {
1286
+ console.log(chalk19.gray(`verified ${payloads.length} payload hashes locally (XL1-canonical)`));
1287
+ return true;
1288
+ }
1289
+ printRejectedList(
1290
+ `refusing to push: ${mismatches.length} payload(s) have mismatched $hash`,
1291
+ mismatches,
1292
+ 10,
1293
+ chalk19.red
1294
+ );
1295
+ process.exitCode = 1;
1296
+ return false;
1297
+ }
1298
+ async function pushPayloads(options) {
1299
+ const payloads = parsePayloadsFile(options.file);
1300
+ if (payloads.length === 0) {
1301
+ console.log(chalk19.yellow(`${options.file} contained 0 payloads \u2014 nothing to push`));
1302
+ return;
1303
+ }
1304
+ if (options.verify && !await verifyLocally(payloads)) return;
1305
+ const connection = await mintAndConnect({
1306
+ idOrName: options.idOrName,
1307
+ role: "runner",
1308
+ useXl1Sdk: options.xl1Sdk
1309
+ });
1310
+ console.log(chalk19.gray(
1311
+ `pushing ${payloads.length} payloads to ${connection.datalakeName} (${connection.datalakeId}) via ${connection.transport}...`
1312
+ ));
1313
+ const batchSize = options.batchSize ?? DEFAULT_BATCH_SIZE;
1314
+ let inserted = 0;
1315
+ let duplicates = 0;
1316
+ const rejected = [];
1317
+ for (let offset = 0; offset < payloads.length; offset += batchSize) {
1318
+ const batch = payloads.slice(offset, offset + batchSize);
1319
+ const result = await connection.client.insert(batch);
1320
+ inserted += result.inserted;
1321
+ duplicates += result.duplicates;
1322
+ rejected.push(...result.rejected);
1323
+ }
1324
+ console.log(chalk19.green(
1325
+ `push complete: inserted=${inserted} duplicates=${duplicates} rejected=${rejected.length}`
1326
+ ));
1327
+ if (rejected.length > 0) {
1328
+ printRejectedList("rejected hashes:", rejected, 20, chalk19.yellow);
1329
+ }
1330
+ }
1331
+
1332
+ // src/actions/datalake/payloads/tailPayloads.ts
1333
+ import chalk20 from "chalk";
1334
+ var DEFAULT_LIMIT = 50;
1335
+ var DEFAULT_POLL_MS = 1e3;
1336
+ async function tailPayloads(options) {
1337
+ const connection = await mintAndConnect({ idOrName: options.idOrName, role: "viewer" });
1338
+ const limit = options.limit ?? DEFAULT_LIMIT;
1339
+ let cursor = options.cursor;
1340
+ let totalSeen = 0;
1341
+ while (true) {
1342
+ const page = await connection.client.next({
1343
+ limit,
1344
+ cursor,
1345
+ schemas: options.schemas
1346
+ });
1347
+ for (const payload of page.payloads) {
1348
+ printPayload(payload);
1349
+ totalSeen += 1;
1350
+ }
1351
+ if (!options.follow) {
1352
+ if (totalSeen === 0) {
1353
+ console.log(chalk20.yellow(`${connection.datalakeName}: no payloads yet`));
1354
+ }
1355
+ return;
1356
+ }
1357
+ if (page.payloads.length < limit) {
1358
+ cursor = page.nextCursor ?? cursor;
1359
+ break;
1360
+ }
1361
+ cursor = page.nextCursor ?? cursor;
1362
+ }
1363
+ const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_MS;
1364
+ console.log(chalk20.gray(`following ${connection.datalakeName} (Ctrl+C to stop)`));
1365
+ let polls = 0;
1366
+ while (options.maxPolls === void 0 || polls < options.maxPolls) {
1367
+ await delay3(pollIntervalMs);
1368
+ polls += 1;
1369
+ const page = await connection.client.next({
1370
+ limit,
1371
+ cursor,
1372
+ schemas: options.schemas
1373
+ });
1374
+ for (const payload of page.payloads) {
1375
+ printPayload(payload);
1376
+ totalSeen += 1;
1377
+ }
1378
+ if (page.nextCursor) cursor = page.nextCursor;
1379
+ }
1380
+ }
1381
+ function printPayload(payload) {
1382
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
1383
+ console.log(`${chalk20.gray(timestamp)} ${chalk20.cyan(payload.$hash.slice(0, 12))} ${chalk20.magenta(payload.schema)}`);
1384
+ console.log(` ${JSON.stringify(payload)}`);
1385
+ }
1386
+ function delay3(ms) {
1387
+ return new Promise((resolve) => setTimeout(resolve, ms));
1388
+ }
1389
+
1390
+ // src/commands/datalakeFetchCommand.ts
1391
+ var datalakeFetchCommand = {
1392
+ command: "fetch <hash> [name]",
1393
+ describe: "Fetch a single payload by content hash",
1394
+ builder: (yargs) => yargs.positional("hash", {
1395
+ type: "string",
1396
+ describe: "Content hash of the payload to fetch",
1397
+ demandOption: true
1398
+ }).positional("name", {
1399
+ type: "string",
1400
+ describe: "Datalake name or id (defaults to current)"
1401
+ }).option("raw", {
1402
+ type: "boolean",
1403
+ default: false,
1404
+ describe: "Print only the raw JSON payload (no header)"
1405
+ }).option("xl1-sdk", {
1406
+ type: "boolean",
1407
+ default: false,
1408
+ describe: "Use the real @xyo-network/xl1-protocol-sdk RestDataLakeViewer"
1409
+ }),
1410
+ handler: async (argv) => {
1411
+ await fetchPayload({
1412
+ hash: argv.hash,
1413
+ idOrName: argv.name,
1414
+ raw: argv.raw,
1415
+ xl1Sdk: argv["xl1-sdk"]
1416
+ });
1417
+ }
1418
+ };
1419
+
1420
+ // src/commands/datalakeGrantCommand.ts
1421
+ var datalakeGrantCommand = {
1422
+ command: "grant <name> <principal>",
1423
+ describe: 'Grant a role on a datalake (principal=user-id or "public")',
1424
+ builder: (yargs) => yargs.positional("name", {
1425
+ type: "string",
1426
+ describe: "Datalake name or id",
1427
+ demandOption: true
1428
+ }).positional("principal", {
1429
+ type: "string",
1430
+ describe: 'User id, or the literal "public"',
1431
+ demandOption: true
1432
+ }).option("role", {
1433
+ alias: "r",
1434
+ type: "string",
1435
+ choices: ["viewer", "runner"],
1436
+ default: "viewer",
1437
+ describe: "Role to grant"
1438
+ }).option("confirm-public", {
1439
+ type: "boolean",
1440
+ default: false,
1441
+ describe: "Required to grant `public runner` (anonymous writes)"
1442
+ }),
1443
+ handler: async (argv) => {
1444
+ await grantAccess({
1445
+ idOrName: argv.name,
1446
+ principal: argv.principal,
1447
+ role: argv.role,
1448
+ confirmPublic: argv["confirm-public"]
1449
+ });
1450
+ }
1451
+ };
1452
+
1453
+ // src/commands/datalakeListCommand.ts
1454
+ var datalakeListCommand = {
1455
+ command: "list",
1456
+ describe: "List your datalakes",
1457
+ handler: async () => {
1458
+ await listDatalakes();
1459
+ }
1460
+ };
1461
+
1462
+ // src/commands/datalakeLoginCommand.ts
1463
+ var datalakeLoginCommand = {
1464
+ command: "login",
1465
+ describe: "Sign in to the datalake control plane",
1466
+ builder: (yargs) => yargs.option("base-url", {
1467
+ type: "string",
1468
+ describe: "Control-plane base URL (P0: required)"
1469
+ }).option("token", {
1470
+ type: "string",
1471
+ describe: "Pre-issued auth token (P0: required; OAuth lands in P1)"
1472
+ }),
1473
+ handler: async (argv) => {
1474
+ await login({
1475
+ baseUrl: argv["base-url"],
1476
+ token: argv.token
1477
+ });
1478
+ }
1479
+ };
1480
+
1481
+ // src/commands/datalakeLogoutCommand.ts
1482
+ var datalakeLogoutCommand = {
1483
+ command: "logout",
1484
+ describe: "Clear stored datalake credentials",
1485
+ handler: async () => {
1486
+ await logout();
1487
+ }
1488
+ };
1489
+
1490
+ // src/commands/datalakePushCommand.ts
1491
+ var datalakePushCommand = {
1492
+ command: "push <file> [name]",
1493
+ describe: "Insert payloads from a JSON or JSONL file into a datalake",
1494
+ builder: (yargs) => yargs.positional("file", {
1495
+ type: "string",
1496
+ describe: "Path to a .json (array) or .jsonl (one payload per line) file",
1497
+ demandOption: true
1498
+ }).positional("name", {
1499
+ type: "string",
1500
+ describe: "Target datalake name or id (defaults to current)"
1501
+ }).option("batch-size", {
1502
+ type: "number",
1503
+ default: 500,
1504
+ describe: "Max payloads per HTTP request"
1505
+ }).option("verify", {
1506
+ type: "boolean",
1507
+ default: false,
1508
+ describe: "Verify each payload's $hash against content locally before pushing"
1509
+ }).option("xl1-sdk", {
1510
+ type: "boolean",
1511
+ default: false,
1512
+ describe: "Use the real @xyo-network/xl1-protocol-sdk RestDataLakeRunner"
1513
+ }),
1514
+ handler: async (argv) => {
1515
+ await pushPayloads({
1516
+ file: argv.file,
1517
+ idOrName: argv.name,
1518
+ batchSize: argv["batch-size"],
1519
+ verify: argv.verify,
1520
+ xl1Sdk: argv["xl1-sdk"]
1521
+ });
1522
+ }
1523
+ };
1524
+
1525
+ // src/commands/datalakeRevokeCommand.ts
1526
+ var datalakeRevokeCommand = {
1527
+ command: "revoke <name> <principal>",
1528
+ describe: "Revoke a principal's access to a datalake",
1529
+ builder: (yargs) => yargs.positional("name", {
1530
+ type: "string",
1531
+ describe: "Datalake name or id",
1532
+ demandOption: true
1533
+ }).positional("principal", {
1534
+ type: "string",
1535
+ describe: 'User id, or the literal "public"',
1536
+ demandOption: true
1537
+ }),
1538
+ handler: async (argv) => {
1539
+ await revokeAccess({
1540
+ idOrName: argv.name,
1541
+ principal: argv.principal
1542
+ });
1543
+ }
1544
+ };
1545
+
1546
+ // src/commands/datalakeTailCommand.ts
1547
+ var datalakeTailCommand = {
1548
+ command: "tail [name]",
1549
+ describe: "Stream payloads from a datalake (Ctrl+C to stop with --follow)",
1550
+ builder: (yargs) => yargs.positional("name", {
1551
+ type: "string",
1552
+ describe: "Datalake name or id (defaults to current)"
1553
+ }).option("follow", {
1554
+ alias: "f",
1555
+ type: "boolean",
1556
+ default: false,
1557
+ describe: "Keep polling for new payloads after draining the backlog"
1558
+ }).option("limit", {
1559
+ alias: "n",
1560
+ type: "number",
1561
+ default: 50,
1562
+ describe: "Max payloads per page"
1563
+ }).option("cursor", {
1564
+ type: "string",
1565
+ describe: "Resume after this hash (exclusive)"
1566
+ }).option("schemas", {
1567
+ type: "string",
1568
+ describe: "Comma-separated list of schemas to include"
1569
+ }).option("poll-interval", {
1570
+ type: "number",
1571
+ default: 1e3,
1572
+ describe: "Poll interval in ms when following"
1573
+ }),
1574
+ handler: async (argv) => {
1575
+ await tailPayloads({
1576
+ idOrName: argv.name,
1577
+ follow: argv.follow,
1578
+ limit: argv.limit,
1579
+ cursor: argv.cursor,
1580
+ schemas: argv.schemas ? argv.schemas.split(",") : void 0,
1581
+ pollIntervalMs: argv["poll-interval"]
1582
+ });
1583
+ }
1584
+ };
1585
+
1586
+ // src/commands/datalakeTokenCommand.ts
1587
+ var datalakeTokenCommand = {
1588
+ command: "token [name]",
1589
+ describe: "Mint a scoped JWT for SDK use",
1590
+ builder: (yargs) => yargs.positional("name", {
1591
+ type: "string",
1592
+ describe: "Datalake name or id (defaults to current)"
1593
+ }).option("role", {
1594
+ alias: "r",
1595
+ type: "string",
1596
+ choices: ["viewer", "runner"],
1597
+ default: "viewer",
1598
+ describe: "Role encoded in the token"
1599
+ }).option("ttl", {
1600
+ type: "number",
1601
+ describe: "Lifetime in seconds (server-capped)"
1602
+ }),
1603
+ handler: async (argv) => {
1604
+ await mintToken({
1605
+ idOrName: argv.name,
1606
+ role: argv.role,
1607
+ ttlSeconds: argv.ttl
1608
+ });
1609
+ }
1610
+ };
1611
+
1612
+ // src/commands/datalakeUseCommand.ts
1613
+ var datalakeUseCommand = {
1614
+ command: "use [name]",
1615
+ describe: "Set the default datalake for subsequent commands (omit name to clear)",
1616
+ builder: (yargs) => yargs.positional("name", {
1617
+ type: "string",
1618
+ describe: "Datalake name or id"
1619
+ }),
1620
+ handler: async (argv) => {
1621
+ await useDatalake(argv.name);
1622
+ }
1623
+ };
1624
+
1625
+ // src/commands/datalakeCommand.ts
1626
+ var datalakeCommand = {
1627
+ command: "datalake",
1628
+ describe: "Provision and manage on-demand XL1 datalakes",
1629
+ builder: (yargs) => yargs.command(datalakeLoginCommand).command(datalakeLogoutCommand).command(datalakeCreateCommand).command(datalakeListCommand).command(datalakeDescribeCommand).command(datalakeDestroyCommand).command(datalakeGrantCommand).command(datalakeRevokeCommand).command(datalakeTokenCommand).command(datalakeUseCommand).command(datalakePushCommand).command(datalakeFetchCommand).command(datalakeTailCommand).command(datalakeAuditCommand).command(datalakeDevCommand).demandCommand(1).strictCommands(),
1630
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1631
+ handler: () => {
1632
+ }
1633
+ };
1634
+ export {
1635
+ datalakeCommand
1636
+ };
1637
+ //# sourceMappingURL=datalakeCommand.mjs.map