@zincapp/znvault-cli 2.16.5 → 2.18.0

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 (348) hide show
  1. package/dist/commands/apikey/conditions.d.ts +6 -0
  2. package/dist/commands/apikey/conditions.d.ts.map +1 -0
  3. package/dist/commands/apikey/conditions.js +57 -0
  4. package/dist/commands/apikey/conditions.js.map +1 -0
  5. package/dist/commands/apikey/create.d.ts +6 -0
  6. package/dist/commands/apikey/create.d.ts.map +1 -0
  7. package/dist/commands/apikey/create.js +106 -0
  8. package/dist/commands/apikey/create.js.map +1 -0
  9. package/dist/commands/apikey/delete.d.ts +6 -0
  10. package/dist/commands/apikey/delete.d.ts.map +1 -0
  11. package/dist/commands/apikey/delete.js +29 -0
  12. package/dist/commands/apikey/delete.js.map +1 -0
  13. package/dist/commands/apikey/enable-disable.d.ts +6 -0
  14. package/dist/commands/apikey/enable-disable.d.ts.map +1 -0
  15. package/dist/commands/apikey/enable-disable.js +44 -0
  16. package/dist/commands/apikey/enable-disable.js.map +1 -0
  17. package/dist/commands/apikey/helpers.d.ts +23 -0
  18. package/dist/commands/apikey/helpers.d.ts.map +1 -0
  19. package/dist/commands/apikey/helpers.js +135 -0
  20. package/dist/commands/apikey/helpers.js.map +1 -0
  21. package/dist/commands/apikey/index.d.ts +10 -0
  22. package/dist/commands/apikey/index.d.ts.map +1 -0
  23. package/dist/commands/apikey/index.js +33 -0
  24. package/dist/commands/apikey/index.js.map +1 -0
  25. package/dist/commands/apikey/list.d.ts +6 -0
  26. package/dist/commands/apikey/list.d.ts.map +1 -0
  27. package/dist/commands/apikey/list.js +74 -0
  28. package/dist/commands/apikey/list.js.map +1 -0
  29. package/dist/commands/apikey/managed/bind.d.ts +6 -0
  30. package/dist/commands/apikey/managed/bind.d.ts.map +1 -0
  31. package/dist/commands/apikey/managed/bind.js +52 -0
  32. package/dist/commands/apikey/managed/bind.js.map +1 -0
  33. package/dist/commands/apikey/managed/conditions.d.ts +6 -0
  34. package/dist/commands/apikey/managed/conditions.d.ts.map +1 -0
  35. package/dist/commands/apikey/managed/conditions.js +62 -0
  36. package/dist/commands/apikey/managed/conditions.js.map +1 -0
  37. package/dist/commands/apikey/managed/config.d.ts +6 -0
  38. package/dist/commands/apikey/managed/config.d.ts.map +1 -0
  39. package/dist/commands/apikey/managed/config.js +52 -0
  40. package/dist/commands/apikey/managed/config.js.map +1 -0
  41. package/dist/commands/apikey/managed/create.d.ts +6 -0
  42. package/dist/commands/apikey/managed/create.d.ts.map +1 -0
  43. package/dist/commands/apikey/managed/create.js +82 -0
  44. package/dist/commands/apikey/managed/create.js.map +1 -0
  45. package/dist/commands/apikey/managed/delete.d.ts +6 -0
  46. package/dist/commands/apikey/managed/delete.d.ts.map +1 -0
  47. package/dist/commands/apikey/managed/delete.js +29 -0
  48. package/dist/commands/apikey/managed/delete.js.map +1 -0
  49. package/dist/commands/apikey/managed/get.d.ts +6 -0
  50. package/dist/commands/apikey/managed/get.d.ts.map +1 -0
  51. package/dist/commands/apikey/managed/get.js +31 -0
  52. package/dist/commands/apikey/managed/get.js.map +1 -0
  53. package/dist/commands/apikey/managed/helpers.d.ts +5 -0
  54. package/dist/commands/apikey/managed/helpers.d.ts.map +1 -0
  55. package/dist/commands/apikey/managed/helpers.js +70 -0
  56. package/dist/commands/apikey/managed/helpers.js.map +1 -0
  57. package/dist/commands/apikey/managed/index.d.ts +7 -0
  58. package/dist/commands/apikey/managed/index.d.ts.map +1 -0
  59. package/dist/commands/apikey/managed/index.js +27 -0
  60. package/dist/commands/apikey/managed/index.js.map +1 -0
  61. package/dist/commands/apikey/managed/list.d.ts +6 -0
  62. package/dist/commands/apikey/managed/list.d.ts.map +1 -0
  63. package/dist/commands/apikey/managed/list.js +58 -0
  64. package/dist/commands/apikey/managed/list.js.map +1 -0
  65. package/dist/commands/apikey/managed/permissions.d.ts +6 -0
  66. package/dist/commands/apikey/managed/permissions.d.ts.map +1 -0
  67. package/dist/commands/apikey/managed/permissions.js +73 -0
  68. package/dist/commands/apikey/managed/permissions.js.map +1 -0
  69. package/dist/commands/apikey/managed/rotate.d.ts +6 -0
  70. package/dist/commands/apikey/managed/rotate.d.ts.map +1 -0
  71. package/dist/commands/apikey/managed/rotate.js +29 -0
  72. package/dist/commands/apikey/managed/rotate.js.map +1 -0
  73. package/dist/commands/apikey/managed/types.d.ts +62 -0
  74. package/dist/commands/apikey/managed/types.d.ts.map +1 -0
  75. package/dist/commands/apikey/managed/types.js +3 -0
  76. package/dist/commands/apikey/managed/types.js.map +1 -0
  77. package/dist/commands/apikey/permissions.d.ts +6 -0
  78. package/dist/commands/apikey/permissions.d.ts.map +1 -0
  79. package/dist/commands/apikey/permissions.js +70 -0
  80. package/dist/commands/apikey/permissions.js.map +1 -0
  81. package/dist/commands/apikey/policies.d.ts +6 -0
  82. package/dist/commands/apikey/policies.d.ts.map +1 -0
  83. package/dist/commands/apikey/policies.js +82 -0
  84. package/dist/commands/apikey/policies.js.map +1 -0
  85. package/dist/commands/apikey/rotate.d.ts +6 -0
  86. package/dist/commands/apikey/rotate.d.ts.map +1 -0
  87. package/dist/commands/apikey/rotate.js +42 -0
  88. package/dist/commands/apikey/rotate.js.map +1 -0
  89. package/dist/commands/apikey/self.d.ts +6 -0
  90. package/dist/commands/apikey/self.d.ts.map +1 -0
  91. package/dist/commands/apikey/self.js +96 -0
  92. package/dist/commands/apikey/self.js.map +1 -0
  93. package/dist/commands/apikey/show.d.ts +6 -0
  94. package/dist/commands/apikey/show.d.ts.map +1 -0
  95. package/dist/commands/apikey/show.js +79 -0
  96. package/dist/commands/apikey/show.js.map +1 -0
  97. package/dist/commands/apikey/types.d.ts +83 -0
  98. package/dist/commands/apikey/types.d.ts.map +1 -0
  99. package/dist/commands/apikey/types.js +3 -0
  100. package/dist/commands/apikey/types.js.map +1 -0
  101. package/dist/commands/apikey.d.ts +8 -2
  102. package/dist/commands/apikey.d.ts.map +1 -1
  103. package/dist/commands/apikey.js +9 -1296
  104. package/dist/commands/apikey.js.map +1 -1
  105. package/dist/commands/audit.d.ts.map +1 -1
  106. package/dist/commands/audit.js +7 -1
  107. package/dist/commands/audit.js.map +1 -1
  108. package/dist/commands/auth.d.ts.map +1 -1
  109. package/dist/commands/auth.js +31 -10
  110. package/dist/commands/auth.js.map +1 -1
  111. package/dist/commands/cert.d.ts.map +1 -1
  112. package/dist/commands/cert.js +25 -1
  113. package/dist/commands/cert.js.map +1 -1
  114. package/dist/commands/cluster.d.ts.map +1 -1
  115. package/dist/commands/cluster.js +46 -17
  116. package/dist/commands/cluster.js.map +1 -1
  117. package/dist/commands/device.d.ts.map +1 -1
  118. package/dist/commands/device.js +8 -5
  119. package/dist/commands/device.js.map +1 -1
  120. package/dist/commands/dynamic-secrets.d.ts.map +1 -1
  121. package/dist/commands/dynamic-secrets.js +12 -0
  122. package/dist/commands/dynamic-secrets.js.map +1 -1
  123. package/dist/commands/emergency.d.ts.map +1 -1
  124. package/dist/commands/emergency.js +37 -1
  125. package/dist/commands/emergency.js.map +1 -1
  126. package/dist/commands/kms.d.ts.map +1 -1
  127. package/dist/commands/kms.js +19 -4
  128. package/dist/commands/kms.js.map +1 -1
  129. package/dist/commands/lockdown.d.ts.map +1 -1
  130. package/dist/commands/lockdown.js +10 -0
  131. package/dist/commands/lockdown.js.map +1 -1
  132. package/dist/commands/notification.d.ts.map +1 -1
  133. package/dist/commands/notification.js +51 -15
  134. package/dist/commands/notification.js.map +1 -1
  135. package/dist/commands/plugin.d.ts.map +1 -1
  136. package/dist/commands/plugin.js +97 -12
  137. package/dist/commands/plugin.js.map +1 -1
  138. package/dist/commands/policy.d.ts.map +1 -1
  139. package/dist/commands/policy.js +148 -35
  140. package/dist/commands/policy.js.map +1 -1
  141. package/dist/commands/role.d.ts.map +1 -1
  142. package/dist/commands/role.js +11 -1
  143. package/dist/commands/role.js.map +1 -1
  144. package/dist/commands/secret/copy.d.ts +6 -0
  145. package/dist/commands/secret/copy.d.ts.map +1 -0
  146. package/dist/commands/secret/copy.js +43 -0
  147. package/dist/commands/secret/copy.js.map +1 -0
  148. package/dist/commands/secret/create.d.ts +6 -0
  149. package/dist/commands/secret/create.d.ts.map +1 -0
  150. package/dist/commands/secret/create.js +297 -0
  151. package/dist/commands/secret/create.js.map +1 -0
  152. package/dist/commands/secret/decrypt.d.ts +6 -0
  153. package/dist/commands/secret/decrypt.d.ts.map +1 -0
  154. package/dist/commands/secret/decrypt.js +104 -0
  155. package/dist/commands/secret/decrypt.js.map +1 -0
  156. package/dist/commands/secret/delete.d.ts +6 -0
  157. package/dist/commands/secret/delete.d.ts.map +1 -0
  158. package/dist/commands/secret/delete.js +60 -0
  159. package/dist/commands/secret/delete.js.map +1 -0
  160. package/dist/commands/secret/get.d.ts +6 -0
  161. package/dist/commands/secret/get.d.ts.map +1 -0
  162. package/dist/commands/secret/get.js +60 -0
  163. package/dist/commands/secret/get.js.map +1 -0
  164. package/dist/commands/secret/helpers.d.ts +11 -0
  165. package/dist/commands/secret/helpers.d.ts.map +1 -0
  166. package/dist/commands/secret/helpers.js +59 -0
  167. package/dist/commands/secret/helpers.js.map +1 -0
  168. package/dist/commands/secret/history.d.ts +6 -0
  169. package/dist/commands/secret/history.d.ts.map +1 -0
  170. package/dist/commands/secret/history.js +52 -0
  171. package/dist/commands/secret/history.js.map +1 -0
  172. package/dist/commands/secret/index.d.ts +12 -0
  173. package/dist/commands/secret/index.d.ts.map +1 -0
  174. package/dist/commands/secret/index.js +49 -0
  175. package/dist/commands/secret/index.js.map +1 -0
  176. package/dist/commands/secret/list.d.ts +6 -0
  177. package/dist/commands/secret/list.d.ts.map +1 -0
  178. package/dist/commands/secret/list.js +72 -0
  179. package/dist/commands/secret/list.js.map +1 -0
  180. package/dist/commands/secret/pem-analysis.d.ts +32 -0
  181. package/dist/commands/secret/pem-analysis.d.ts.map +1 -0
  182. package/dist/commands/secret/pem-analysis.js +190 -0
  183. package/dist/commands/secret/pem-analysis.js.map +1 -0
  184. package/dist/commands/secret/resolve.d.ts +17 -0
  185. package/dist/commands/secret/resolve.d.ts.map +1 -0
  186. package/dist/commands/secret/resolve.js +36 -0
  187. package/dist/commands/secret/resolve.js.map +1 -0
  188. package/dist/commands/secret/rotate.d.ts +6 -0
  189. package/dist/commands/secret/rotate.d.ts.map +1 -0
  190. package/dist/commands/secret/rotate.js +72 -0
  191. package/dist/commands/secret/rotate.js.map +1 -0
  192. package/dist/commands/secret/types.d.ts +123 -0
  193. package/dist/commands/secret/types.d.ts.map +1 -0
  194. package/dist/commands/secret/types.js +3 -0
  195. package/dist/commands/secret/types.js.map +1 -0
  196. package/dist/commands/secret/update.d.ts +6 -0
  197. package/dist/commands/secret/update.d.ts.map +1 -0
  198. package/dist/commands/secret/update.js +124 -0
  199. package/dist/commands/secret/update.js.map +1 -0
  200. package/dist/commands/secret.d.ts +8 -2
  201. package/dist/commands/secret.d.ts.map +1 -1
  202. package/dist/commands/secret.js +6 -1131
  203. package/dist/commands/secret.js.map +1 -1
  204. package/dist/commands/self-update.d.ts.map +1 -1
  205. package/dist/commands/self-update.js +51 -5
  206. package/dist/commands/self-update.js.map +1 -1
  207. package/dist/commands/superadmin.d.ts.map +1 -1
  208. package/dist/commands/superadmin.js +23 -7
  209. package/dist/commands/superadmin.js.map +1 -1
  210. package/dist/commands/tenant.d.ts.map +1 -1
  211. package/dist/commands/tenant.js +4 -0
  212. package/dist/commands/tenant.js.map +1 -1
  213. package/dist/commands/update.d.ts.map +1 -1
  214. package/dist/commands/update.js +13 -0
  215. package/dist/commands/update.js.map +1 -1
  216. package/dist/commands/user.d.ts.map +1 -1
  217. package/dist/commands/user.js +35 -8
  218. package/dist/commands/user.js.map +1 -1
  219. package/dist/index.js +48 -4
  220. package/dist/index.js.map +1 -1
  221. package/dist/lib/client/apikeys.d.ts +34 -0
  222. package/dist/lib/client/apikeys.d.ts.map +1 -0
  223. package/dist/lib/client/apikeys.js +113 -0
  224. package/dist/lib/client/apikeys.js.map +1 -0
  225. package/dist/lib/client/audit.d.ts +21 -0
  226. package/dist/lib/client/audit.d.ts.map +1 -0
  227. package/dist/lib/client/audit.js +40 -0
  228. package/dist/lib/client/audit.js.map +1 -0
  229. package/dist/lib/client/health.d.ts +30 -0
  230. package/dist/lib/client/health.d.ts.map +1 -0
  231. package/dist/lib/client/health.js +55 -0
  232. package/dist/lib/client/health.js.map +1 -0
  233. package/dist/lib/client/http.d.ts +50 -0
  234. package/dist/lib/client/http.d.ts.map +1 -0
  235. package/dist/lib/client/http.js +333 -0
  236. package/dist/lib/client/http.js.map +1 -0
  237. package/dist/lib/client/index.d.ts +156 -0
  238. package/dist/lib/client/index.d.ts.map +1 -0
  239. package/dist/lib/client/index.js +172 -0
  240. package/dist/lib/client/index.js.map +1 -0
  241. package/dist/lib/client/lockdown.d.ts +23 -0
  242. package/dist/lib/client/lockdown.d.ts.map +1 -0
  243. package/dist/lib/client/lockdown.js +48 -0
  244. package/dist/lib/client/lockdown.js.map +1 -0
  245. package/dist/lib/client/managed-keys.d.ts +18 -0
  246. package/dist/lib/client/managed-keys.d.ts.map +1 -0
  247. package/dist/lib/client/managed-keys.js +190 -0
  248. package/dist/lib/client/managed-keys.js.map +1 -0
  249. package/dist/lib/client/policies.d.ts +35 -0
  250. package/dist/lib/client/policies.d.ts.map +1 -0
  251. package/dist/lib/client/policies.js +131 -0
  252. package/dist/lib/client/policies.js.map +1 -0
  253. package/dist/lib/client/tenants.d.ts +29 -0
  254. package/dist/lib/client/tenants.d.ts.map +1 -0
  255. package/dist/lib/client/tenants.js +56 -0
  256. package/dist/lib/client/tenants.js.map +1 -0
  257. package/dist/lib/client/types.d.ts +45 -0
  258. package/dist/lib/client/types.d.ts.map +1 -0
  259. package/dist/lib/client/types.js +3 -0
  260. package/dist/lib/client/types.js.map +1 -0
  261. package/dist/lib/client/users.d.ts +44 -0
  262. package/dist/lib/client/users.d.ts.map +1 -0
  263. package/dist/lib/client/users.js +116 -0
  264. package/dist/lib/client/users.js.map +1 -0
  265. package/dist/lib/client.d.ts +11 -246
  266. package/dist/lib/client.d.ts.map +1 -1
  267. package/dist/lib/client.js +10 -999
  268. package/dist/lib/client.js.map +1 -1
  269. package/dist/lib/command-error-handler.d.ts +99 -0
  270. package/dist/lib/command-error-handler.d.ts.map +1 -0
  271. package/dist/lib/command-error-handler.js +108 -0
  272. package/dist/lib/command-error-handler.js.map +1 -0
  273. package/dist/lib/config/apikey.d.ts +29 -0
  274. package/dist/lib/config/apikey.d.ts.map +1 -0
  275. package/dist/lib/config/apikey.js +58 -0
  276. package/dist/lib/config/apikey.js.map +1 -0
  277. package/dist/lib/config/cache.d.ts +47 -0
  278. package/dist/lib/config/cache.d.ts.map +1 -0
  279. package/dist/lib/config/cache.js +84 -0
  280. package/dist/lib/config/cache.js.map +1 -0
  281. package/dist/lib/config/credentials.d.ts +33 -0
  282. package/dist/lib/config/credentials.d.ts.map +1 -0
  283. package/dist/lib/config/credentials.js +70 -0
  284. package/dist/lib/config/credentials.js.map +1 -0
  285. package/dist/lib/config/getters.d.ts +28 -0
  286. package/dist/lib/config/getters.d.ts.map +1 -0
  287. package/dist/lib/config/getters.js +65 -0
  288. package/dist/lib/config/getters.js.map +1 -0
  289. package/dist/lib/config/index.d.ts +17 -0
  290. package/dist/lib/config/index.d.ts.map +1 -0
  291. package/dist/lib/config/index.js +21 -0
  292. package/dist/lib/config/index.js.map +1 -0
  293. package/dist/lib/config/migration.d.ts +10 -0
  294. package/dist/lib/config/migration.d.ts.map +1 -0
  295. package/dist/lib/config/migration.js +59 -0
  296. package/dist/lib/config/migration.js.map +1 -0
  297. package/dist/lib/config/plugins.d.ts +25 -0
  298. package/dist/lib/config/plugins.d.ts.map +1 -0
  299. package/dist/lib/config/plugins.js +58 -0
  300. package/dist/lib/config/plugins.js.map +1 -0
  301. package/dist/lib/config/profile.d.ts +42 -0
  302. package/dist/lib/config/profile.d.ts.map +1 -0
  303. package/dist/lib/config/profile.js +154 -0
  304. package/dist/lib/config/profile.js.map +1 -0
  305. package/dist/lib/config/store.d.ts +23 -0
  306. package/dist/lib/config/store.d.ts.map +1 -0
  307. package/dist/lib/config/store.js +41 -0
  308. package/dist/lib/config/store.js.map +1 -0
  309. package/dist/lib/config/types.d.ts +44 -0
  310. package/dist/lib/config/types.d.ts.map +1 -0
  311. package/dist/lib/config/types.js +8 -0
  312. package/dist/lib/config/types.js.map +1 -0
  313. package/dist/lib/config/validation.d.ts +38 -0
  314. package/dist/lib/config/validation.d.ts.map +1 -0
  315. package/dist/lib/config/validation.js +146 -0
  316. package/dist/lib/config/validation.js.map +1 -0
  317. package/dist/lib/config.d.ts +5 -158
  318. package/dist/lib/config.d.ts.map +1 -1
  319. package/dist/lib/config.js +26 -424
  320. package/dist/lib/config.js.map +1 -1
  321. package/dist/lib/constants.d.ts +65 -0
  322. package/dist/lib/constants.d.ts.map +1 -0
  323. package/dist/lib/constants.js +90 -0
  324. package/dist/lib/constants.js.map +1 -0
  325. package/dist/lib/db.d.ts +4 -0
  326. package/dist/lib/db.d.ts.map +1 -1
  327. package/dist/lib/db.js +77 -46
  328. package/dist/lib/db.js.map +1 -1
  329. package/dist/lib/format-helpers.d.ts +63 -0
  330. package/dist/lib/format-helpers.d.ts.map +1 -0
  331. package/dist/lib/format-helpers.js +219 -0
  332. package/dist/lib/format-helpers.js.map +1 -0
  333. package/dist/lib/validation-helpers.d.ts +132 -0
  334. package/dist/lib/validation-helpers.d.ts.map +1 -0
  335. package/dist/lib/validation-helpers.js +319 -0
  336. package/dist/lib/validation-helpers.js.map +1 -0
  337. package/dist/lib/visual.d.ts +22 -0
  338. package/dist/lib/visual.d.ts.map +1 -1
  339. package/dist/lib/visual.js +83 -0
  340. package/dist/lib/visual.js.map +1 -1
  341. package/dist/services/signature-verifier.d.ts.map +1 -1
  342. package/dist/services/signature-verifier.js +11 -4
  343. package/dist/services/signature-verifier.js.map +1 -1
  344. package/dist/services/update-installer.d.ts +7 -0
  345. package/dist/services/update-installer.d.ts.map +1 -1
  346. package/dist/services/update-installer.js +58 -19
  347. package/dist/services/update-installer.js.map +1 -1
  348. package/package.json +1 -1
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Config getters and setters
3
+ */
4
+ import type { CLIConfig, FullConfig } from '../../types/index.js';
5
+ /**
6
+ * Get configuration value with priority:
7
+ * 1. Environment variable
8
+ * 2. Current profile config
9
+ * 3. Default value
10
+ */
11
+ export declare function getConfig(): FullConfig;
12
+ /**
13
+ * Get a specific config value
14
+ */
15
+ export declare function getConfigValue<K extends keyof FullConfig>(key: K): FullConfig[K];
16
+ /**
17
+ * Set a config value in the current profile
18
+ */
19
+ export declare function setConfigValue<K extends keyof CLIConfig>(key: K, value: CLIConfig[K]): void;
20
+ /**
21
+ * Get the effective URL (from env or config)
22
+ */
23
+ export declare function getEffectiveUrl(): string;
24
+ /**
25
+ * Get all stored config (for display)
26
+ */
27
+ export declare function getAllConfig(): Record<string, unknown>;
28
+ //# sourceMappingURL=getters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getters.d.ts","sourceRoot":"","sources":["../../../src/lib/config/getters.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIlE;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,UAAU,CActC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAEhF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAW3F;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAatD"}
@@ -0,0 +1,65 @@
1
+ // Path: src/lib/config/getters.ts
2
+ import { getConfigPath } from './store.js';
3
+ import { getActiveProfileName, getCurrentProfile, saveProfile } from './profile.js';
4
+ /**
5
+ * Get configuration value with priority:
6
+ * 1. Environment variable
7
+ * 2. Current profile config
8
+ * 3. Default value
9
+ */
10
+ export function getConfig() {
11
+ const envUrl = process.env.ZNVAULT_URL;
12
+ const envInsecure = process.env.ZNVAULT_INSECURE;
13
+ const envTimeout = process.env.ZNVAULT_TIMEOUT;
14
+ const profile = getCurrentProfile();
15
+ return {
16
+ url: envUrl ?? profile.url,
17
+ insecure: envInsecure === 'true' || profile.insecure,
18
+ timeout: envTimeout ? parseInt(envTimeout, 10) : profile.timeout,
19
+ defaultTenant: profile.defaultTenant,
20
+ credentials: profile.credentials,
21
+ };
22
+ }
23
+ /**
24
+ * Get a specific config value
25
+ */
26
+ export function getConfigValue(key) {
27
+ return getConfig()[key];
28
+ }
29
+ /**
30
+ * Set a config value in the current profile
31
+ */
32
+ export function setConfigValue(key, value) {
33
+ const profileName = getActiveProfileName();
34
+ const profile = getCurrentProfile();
35
+ // Type-safe assignment using a properly typed intermediate object
36
+ const updatedProfile = {
37
+ ...profile,
38
+ [key]: value,
39
+ };
40
+ saveProfile(profileName, updatedProfile);
41
+ }
42
+ /**
43
+ * Get the effective URL (from env or config)
44
+ */
45
+ export function getEffectiveUrl() {
46
+ return process.env.ZNVAULT_URL ?? getCurrentProfile().url;
47
+ }
48
+ /**
49
+ * Get all stored config (for display)
50
+ */
51
+ export function getAllConfig() {
52
+ const profile = getCurrentProfile();
53
+ return {
54
+ activeProfile: getActiveProfileName(),
55
+ url: profile.url,
56
+ insecure: profile.insecure,
57
+ timeout: profile.timeout,
58
+ defaultTenant: profile.defaultTenant,
59
+ hasCredentials: !!profile.credentials,
60
+ hasApiKey: !!profile.apiKey,
61
+ apiKeyPrefix: profile.apiKey ? profile.apiKey.substring(0, 12) + '...' : undefined,
62
+ configPath: getConfigPath(),
63
+ };
64
+ }
65
+ //# sourceMappingURL=getters.js.map
@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AAc,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,iBAAiB,EAAE,CAAC,GAAG,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,OAAO;QACL,aAAa,EAAE,oBAAoB,EAAE;QACrC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW;QACrC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM;QAC3B,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS;QAClF,UAAU,EAAE,aAAa,EAAE;KAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Config module - main entry point
3
+ *
4
+ * Re-exports all config functionality for backward compatibility.
5
+ */
6
+ export type { Profile, ConfigStore, ProfileInfo, ApiKeyInfo } from './types.js';
7
+ export { CONFIG_DEFAULTS, DEFAULT_PROFILE } from './types.js';
8
+ export { store, setRuntimeProfile, resetConfig, getConfigPath } from './store.js';
9
+ export { ensureMigrated, resetMigrationState } from './migration.js';
10
+ export { invalidateProfileCache, invalidateAllProfileCaches, invalidateConfigCache, invalidateAllCaches, getCacheStats, } from './cache.js';
11
+ export { getActiveProfileName, getCurrentProfile, saveProfile, listProfiles, createProfile, deleteProfile, switchProfile, getProfile, renameProfile, } from './profile.js';
12
+ export { storeCredentials, clearCredentials, getCredentials, isTokenExpired, hasEnvCredentials, getEnvCredentials, } from './credentials.js';
13
+ export { hasApiKey, getApiKey, storeApiKey, getStoredApiKeyInfo, clearApiKey, getStoredApiKey, } from './apikey.js';
14
+ export { getPlugins, addPlugin, removePlugin, setPluginEnabled, clearPlugins, } from './plugins.js';
15
+ export { getConfig, getConfigValue, setConfigValue, getEffectiveUrl, getAllConfig, } from './getters.js';
16
+ export { validateEnvironment, assertValidEnvironment, getValidatedEnvCredentials, getValidatedApiKey, getValidatedUrl, type ValidationResult, } from './validation.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/config/index.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAGH,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG9D,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGlF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGrE,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,eAAe,GAChB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,21 @@
1
+ // Path: src/lib/config/index.ts
2
+ export { CONFIG_DEFAULTS, DEFAULT_PROFILE } from './types.js';
3
+ // Store
4
+ export { store, setRuntimeProfile, resetConfig, getConfigPath } from './store.js';
5
+ // Migration
6
+ export { ensureMigrated, resetMigrationState } from './migration.js';
7
+ // Cache
8
+ export { invalidateProfileCache, invalidateAllProfileCaches, invalidateConfigCache, invalidateAllCaches, getCacheStats, } from './cache.js';
9
+ // Profile management
10
+ export { getActiveProfileName, getCurrentProfile, saveProfile, listProfiles, createProfile, deleteProfile, switchProfile, getProfile, renameProfile, } from './profile.js';
11
+ // Credentials
12
+ export { storeCredentials, clearCredentials, getCredentials, isTokenExpired, hasEnvCredentials, getEnvCredentials, } from './credentials.js';
13
+ // API key
14
+ export { hasApiKey, getApiKey, storeApiKey, getStoredApiKeyInfo, clearApiKey, getStoredApiKey, } from './apikey.js';
15
+ // Plugins
16
+ export { getPlugins, addPlugin, removePlugin, setPluginEnabled, clearPlugins, } from './plugins.js';
17
+ // Config getters/setters
18
+ export { getConfig, getConfigValue, setConfigValue, getEffectiveUrl, getAllConfig, } from './getters.js';
19
+ // Validation
20
+ export { validateEnvironment, assertValidEnvironment, getValidatedEnvCredentials, getValidatedApiKey, getValidatedUrl, } from './validation.js';
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/config/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAUhC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAElF,YAAY;AACZ,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErE,QAAQ;AACR,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,qBAAqB;AACrB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,cAAc;AACd,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,UAAU;AACV,OAAO,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,UAAU;AACV,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,yBAAyB;AACzB,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,aAAa;AACb,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,GAEhB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Ensure migration has been run (lazy initialization)
3
+ * Wraps migrateIfNeeded with error handling to prevent module load failures
4
+ */
5
+ export declare function ensureMigrated(): void;
6
+ /**
7
+ * Reset migration state (for testing)
8
+ */
9
+ export declare function resetMigrationState(): void;
10
+ //# sourceMappingURL=migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/lib/config/migration.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAarC;AAgCD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
@@ -0,0 +1,59 @@
1
+ // Path: src/lib/config/migration.ts
2
+ /**
3
+ * Config migration from legacy format to profile-based format
4
+ */
5
+ import { store } from './store.js';
6
+ import { CONFIG_DEFAULTS, DEFAULT_PROFILE } from './types.js';
7
+ /**
8
+ * Flag to track if migration has been attempted
9
+ */
10
+ let migrationAttempted = false;
11
+ /**
12
+ * Ensure migration has been run (lazy initialization)
13
+ * Wraps migrateIfNeeded with error handling to prevent module load failures
14
+ */
15
+ export function ensureMigrated() {
16
+ if (migrationAttempted)
17
+ return;
18
+ migrationAttempted = true;
19
+ try {
20
+ migrateIfNeeded();
21
+ }
22
+ catch (error) {
23
+ // Log warning but don't fail module load
24
+ console.error('Warning: Config migration failed:', error instanceof Error ? error.message : String(error));
25
+ }
26
+ }
27
+ /**
28
+ * Migrate legacy config to profile-based config
29
+ */
30
+ function migrateIfNeeded() {
31
+ // Check if we have legacy config (url at root level but no profiles)
32
+ const legacyUrl = store.get('url');
33
+ const profiles = store.get('profiles');
34
+ if (legacyUrl && Object.keys(profiles).length === 0) {
35
+ // Migrate legacy config to default profile
36
+ const defaultProfile = {
37
+ url: legacyUrl,
38
+ insecure: store.get('insecure') ?? CONFIG_DEFAULTS.insecure,
39
+ timeout: store.get('timeout') ?? CONFIG_DEFAULTS.timeout,
40
+ defaultTenant: store.get('defaultTenant'),
41
+ credentials: store.get('credentials'),
42
+ };
43
+ store.set('profiles', { [DEFAULT_PROFILE]: defaultProfile });
44
+ store.set('activeProfile', DEFAULT_PROFILE);
45
+ // Clean up legacy keys
46
+ store.delete('url');
47
+ store.delete('insecure');
48
+ store.delete('timeout');
49
+ store.delete('defaultTenant');
50
+ store.delete('credentials');
51
+ }
52
+ }
53
+ /**
54
+ * Reset migration state (for testing)
55
+ */
56
+ export function resetMigrationState() {
57
+ migrationAttempted = false;
58
+ }
59
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.js","sourceRoot":"","sources":["../../../src/lib/config/migration.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAC;AAE5E;;GAEG;AACH,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,kBAAkB;QAAE,OAAO;IAC/B,kBAAkB,GAAG,IAAI,CAAC;IAE1B,IAAI,CAAC;QACH,eAAe,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,yCAAyC;QACzC,OAAO,CAAC,KAAK,CACX,mCAAmC,EACnC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,eAAe;IACtB,qEAAqE;IACrE,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEvC,IAAI,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,2CAA2C;QAC3C,MAAM,cAAc,GAAY;YAC9B,GAAG,EAAE,SAAS;YACd,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,eAAe,CAAC,QAAQ;YAC3D,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,OAAO;YACxD,aAAa,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC;YACzC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC;SACtC,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QAC7D,KAAK,CAAC,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QAE5C,uBAAuB;QACvB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpB,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxB,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAC9B,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,kBAAkB,GAAG,KAAK,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Plugin configuration management
3
+ */
4
+ import type { CLIPluginConfig } from '../../plugins/types.js';
5
+ /**
6
+ * Get all configured plugins
7
+ */
8
+ export declare function getPlugins(): CLIPluginConfig[];
9
+ /**
10
+ * Add a plugin configuration
11
+ */
12
+ export declare function addPlugin(config: CLIPluginConfig): void;
13
+ /**
14
+ * Remove a plugin by package name or path
15
+ */
16
+ export declare function removePlugin(packageOrPath: string): boolean;
17
+ /**
18
+ * Enable or disable a plugin
19
+ */
20
+ export declare function setPluginEnabled(packageOrPath: string, enabled: boolean): boolean;
21
+ /**
22
+ * Clear all plugins
23
+ */
24
+ export declare function clearPlugins(): void;
25
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/lib/config/plugins.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D;;GAEG;AACH,wBAAgB,UAAU,IAAI,eAAe,EAAE,CAE9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAcvD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAa3D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAYjF;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
@@ -0,0 +1,58 @@
1
+ // Path: src/lib/config/plugins.ts
2
+ import { store } from './store.js';
3
+ /**
4
+ * Get all configured plugins
5
+ */
6
+ export function getPlugins() {
7
+ return store.get('plugins') ?? [];
8
+ }
9
+ /**
10
+ * Add a plugin configuration
11
+ */
12
+ export function addPlugin(config) {
13
+ const plugins = getPlugins();
14
+ const source = config.package ?? config.path;
15
+ // Check for duplicate
16
+ const existing = plugins.findIndex(p => (p.package ?? p.path) === source);
17
+ if (existing >= 0) {
18
+ // Update existing
19
+ plugins[existing] = config;
20
+ }
21
+ else {
22
+ plugins.push(config);
23
+ }
24
+ store.set('plugins', plugins);
25
+ }
26
+ /**
27
+ * Remove a plugin by package name or path
28
+ */
29
+ export function removePlugin(packageOrPath) {
30
+ const plugins = getPlugins();
31
+ const initialLength = plugins.length;
32
+ const filtered = plugins.filter(p => p.package !== packageOrPath && p.path !== packageOrPath);
33
+ if (filtered.length < initialLength) {
34
+ store.set('plugins', filtered);
35
+ return true;
36
+ }
37
+ return false;
38
+ }
39
+ /**
40
+ * Enable or disable a plugin
41
+ */
42
+ export function setPluginEnabled(packageOrPath, enabled) {
43
+ const plugins = getPlugins();
44
+ const plugin = plugins.find(p => p.package === packageOrPath || p.path === packageOrPath);
45
+ if (plugin) {
46
+ plugin.enabled = enabled;
47
+ store.set('plugins', plugins);
48
+ return true;
49
+ }
50
+ return false;
51
+ }
52
+ /**
53
+ * Clear all plugins
54
+ */
55
+ export function clearPlugins() {
56
+ store.set('plugins', []);
57
+ }
58
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/lib/config/plugins.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAOlC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,MAAuB;IAC/C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC;IAE7C,sBAAsB;IACtB,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,CAAC;IAC1E,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAClB,kBAAkB;QAClB,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,aAAqB;IAChD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAErC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAClC,CAAC,CAAC,OAAO,KAAK,aAAa,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa,CACxD,CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,GAAG,aAAa,EAAE,CAAC;QACpC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,aAAqB,EAAE,OAAgB;IACtE,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAC9B,CAAC,CAAC,OAAO,KAAK,aAAa,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa,CACxD,CAAC;IAEF,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { type Profile, type ProfileInfo } from './types.js';
2
+ /**
3
+ * Get the current active profile name
4
+ */
5
+ export declare function getActiveProfileName(): string;
6
+ /**
7
+ * Get the current profile data (with caching)
8
+ */
9
+ export declare function getCurrentProfile(): Profile;
10
+ /**
11
+ * Save profile data (invalidates cache)
12
+ */
13
+ export declare function saveProfile(profileName: string, profile: Profile): void;
14
+ /**
15
+ * List all profiles
16
+ */
17
+ export declare function listProfiles(): ProfileInfo[];
18
+ /**
19
+ * Create a new profile
20
+ */
21
+ export declare function createProfile(name: string, options: {
22
+ url?: string;
23
+ insecure?: boolean;
24
+ copyFrom?: string;
25
+ }): void;
26
+ /**
27
+ * Delete a profile
28
+ */
29
+ export declare function deleteProfile(name: string): void;
30
+ /**
31
+ * Switch active profile
32
+ */
33
+ export declare function switchProfile(name: string): void;
34
+ /**
35
+ * Get a specific profile
36
+ */
37
+ export declare function getProfile(name: string): Profile | undefined;
38
+ /**
39
+ * Rename a profile
40
+ */
41
+ export declare function renameProfile(oldName: string, newName: string): void;
42
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../src/lib/config/profile.ts"],"names":[],"mappings":"AAQA,OAAO,EAAoC,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9F;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAG7C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAqB3C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAOvE;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,WAAW,EAAE,CAW5C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAiClH;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAmBhD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQhD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAG5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAwBpE"}
@@ -0,0 +1,154 @@
1
+ // Path: src/lib/config/profile.ts
2
+ /**
3
+ * Profile management operations
4
+ */
5
+ import { store, getRuntimeProfile } from './store.js';
6
+ import { ensureMigrated } from './migration.js';
7
+ import { CONFIG_DEFAULTS, DEFAULT_PROFILE } from './types.js';
8
+ import { getCachedProfile, cacheProfile, invalidateProfileCache } from './cache.js';
9
+ /**
10
+ * Get the current active profile name
11
+ */
12
+ export function getActiveProfileName() {
13
+ ensureMigrated();
14
+ return getRuntimeProfile() ?? process.env.ZNVAULT_PROFILE ?? store.get('activeProfile');
15
+ }
16
+ /**
17
+ * Get the current profile data (with caching)
18
+ */
19
+ export function getCurrentProfile() {
20
+ ensureMigrated();
21
+ const profileName = getActiveProfileName();
22
+ // Check cache first
23
+ const cached = getCachedProfile(profileName);
24
+ if (cached)
25
+ return cached;
26
+ // Load from store
27
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- needed for test mocks
28
+ const profiles = store.get('profiles') ?? {};
29
+ const profile = profiles[profileName] ?? {
30
+ url: CONFIG_DEFAULTS.url,
31
+ insecure: CONFIG_DEFAULTS.insecure,
32
+ timeout: CONFIG_DEFAULTS.timeout,
33
+ };
34
+ // Cache for subsequent reads
35
+ cacheProfile(profileName, profile);
36
+ return profile;
37
+ }
38
+ /**
39
+ * Save profile data (invalidates cache)
40
+ */
41
+ export function saveProfile(profileName, profile) {
42
+ const profiles = store.get('profiles');
43
+ profiles[profileName] = profile;
44
+ store.set('profiles', profiles);
45
+ // Invalidate cache for this profile
46
+ invalidateProfileCache(profileName);
47
+ }
48
+ /**
49
+ * List all profiles
50
+ */
51
+ export function listProfiles() {
52
+ const profiles = store.get('profiles');
53
+ const activeProfile = getActiveProfileName();
54
+ return Object.entries(profiles).map(([name, profile]) => ({
55
+ name,
56
+ url: profile.url,
57
+ active: name === activeProfile,
58
+ hasCredentials: !!profile.credentials,
59
+ hasApiKey: !!profile.apiKey,
60
+ }));
61
+ }
62
+ /**
63
+ * Create a new profile
64
+ */
65
+ export function createProfile(name, options) {
66
+ const profiles = store.get('profiles');
67
+ if (name in profiles) {
68
+ throw new Error(`Profile '${name}' already exists`);
69
+ }
70
+ let newProfile;
71
+ if (options.copyFrom) {
72
+ if (!(options.copyFrom in profiles)) {
73
+ throw new Error(`Source profile '${options.copyFrom}' not found`);
74
+ }
75
+ newProfile = { ...profiles[options.copyFrom] };
76
+ // Don't copy credentials
77
+ newProfile.credentials = undefined;
78
+ }
79
+ else {
80
+ newProfile = {
81
+ url: options.url ?? CONFIG_DEFAULTS.url,
82
+ insecure: options.insecure ?? CONFIG_DEFAULTS.insecure,
83
+ timeout: CONFIG_DEFAULTS.timeout,
84
+ };
85
+ }
86
+ if (options.url) {
87
+ newProfile.url = options.url;
88
+ }
89
+ if (options.insecure !== undefined) {
90
+ newProfile.insecure = options.insecure;
91
+ }
92
+ profiles[name] = newProfile;
93
+ store.set('profiles', profiles);
94
+ }
95
+ /**
96
+ * Delete a profile
97
+ */
98
+ export function deleteProfile(name) {
99
+ if (name === DEFAULT_PROFILE) {
100
+ throw new Error(`Cannot delete the '${DEFAULT_PROFILE}' profile`);
101
+ }
102
+ const profiles = store.get('profiles');
103
+ if (!(name in profiles)) {
104
+ throw new Error(`Profile '${name}' not found`);
105
+ }
106
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
107
+ delete profiles[name];
108
+ store.set('profiles', profiles);
109
+ // If we deleted the active profile, switch to default
110
+ if (store.get('activeProfile') === name) {
111
+ store.set('activeProfile', DEFAULT_PROFILE);
112
+ }
113
+ }
114
+ /**
115
+ * Switch active profile
116
+ */
117
+ export function switchProfile(name) {
118
+ const profiles = store.get('profiles');
119
+ if (!(name in profiles)) {
120
+ throw new Error(`Profile '${name}' not found`);
121
+ }
122
+ store.set('activeProfile', name);
123
+ }
124
+ /**
125
+ * Get a specific profile
126
+ */
127
+ export function getProfile(name) {
128
+ const profiles = store.get('profiles');
129
+ return profiles[name];
130
+ }
131
+ /**
132
+ * Rename a profile
133
+ */
134
+ export function renameProfile(oldName, newName) {
135
+ if (oldName === DEFAULT_PROFILE) {
136
+ throw new Error(`Cannot rename the '${DEFAULT_PROFILE}' profile`);
137
+ }
138
+ const profiles = store.get('profiles');
139
+ if (!(oldName in profiles)) {
140
+ throw new Error(`Profile '${oldName}' not found`);
141
+ }
142
+ if (newName in profiles) {
143
+ throw new Error(`Profile '${newName}' already exists`);
144
+ }
145
+ profiles[newName] = profiles[oldName];
146
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
147
+ delete profiles[oldName];
148
+ store.set('profiles', profiles);
149
+ // Update active profile if needed
150
+ if (store.get('activeProfile') === oldName) {
151
+ store.set('activeProfile', newName);
152
+ }
153
+ }
154
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../src/lib/config/profile.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAkC,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpF;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,cAAc,EAAE,CAAC;IACjB,OAAO,iBAAiB,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC1F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,cAAc,EAAE,CAAC;IACjB,MAAM,WA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,UAAU,aAAa,CAAC,OAAe,EAAE,OAAe;IAC5D,IAAI,OAAO,KAAK,eAAe,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,sBAAsB,eAAe,WAAW,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEvC,IAAI,CAAC,CAAC,OAAO,IAAI,QAAQ,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,aAAa,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,kBAAkB,CAAC,CAAC;IACzD,CAAC;IAED,QAAQ,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACtC,gEAAgE;IAChE,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzB,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAEhC,kCAAkC;IAClC,IAAI,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,OAAO,EAAE,CAAC;QAC3C,KAAK,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Config store initialization
3
+ */
4
+ import Conf from 'conf';
5
+ import type { ConfigStore } from './types.js';
6
+ export declare const store: Conf<ConfigStore>;
7
+ /**
8
+ * Set runtime profile override (from --profile flag)
9
+ */
10
+ export declare function setRuntimeProfile(profile: string | null): void;
11
+ /**
12
+ * Get runtime profile override
13
+ */
14
+ export declare function getRuntimeProfile(): string | null;
15
+ /**
16
+ * Reset all configuration
17
+ */
18
+ export declare function resetConfig(): void;
19
+ /**
20
+ * Get config file path (for display purposes)
21
+ */
22
+ export declare function getConfigPath(): string;
23
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/lib/config/store.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,eAAO,MAAM,KAAK,mBAOhB,CAAC;AAKH;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAE9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAEjD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
@@ -0,0 +1,41 @@
1
+ // Path: src/lib/config/store.ts
2
+ /**
3
+ * Config store initialization
4
+ */
5
+ import Conf from 'conf';
6
+ import { DEFAULT_PROFILE } from './types.js';
7
+ export const store = new Conf({
8
+ projectName: 'znvault',
9
+ defaults: {
10
+ activeProfile: DEFAULT_PROFILE,
11
+ profiles: {},
12
+ plugins: [],
13
+ },
14
+ });
15
+ // Runtime profile override (set via --profile flag)
16
+ let runtimeProfileOverride = null;
17
+ /**
18
+ * Set runtime profile override (from --profile flag)
19
+ */
20
+ export function setRuntimeProfile(profile) {
21
+ runtimeProfileOverride = profile;
22
+ }
23
+ /**
24
+ * Get runtime profile override
25
+ */
26
+ export function getRuntimeProfile() {
27
+ return runtimeProfileOverride;
28
+ }
29
+ /**
30
+ * Reset all configuration
31
+ */
32
+ export function resetConfig() {
33
+ store.clear();
34
+ }
35
+ /**
36
+ * Get config file path (for display purposes)
37
+ */
38
+ export function getConfigPath() {
39
+ return store.path;
40
+ }
41
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/lib/config/store.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC;;GAEG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,IAAI,CAAc;IACzC,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE;QACR,aAAa,EAAE,eAAe;QAC9B,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;KACZ;CACF,CAAC,CAAC;AAEH,oDAAoD;AACpD,IAAI,sBAAsB,GAAkB,IAAI,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAsB;IACtD,sBAAsB,GAAG,OAAO,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,sBAAsB,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Config module types
3
+ */
4
+ import type { StoredCredentials } from '../../types/index.js';
5
+ import type { CLIPluginConfig } from '../../plugins/types.js';
6
+ export declare const CONFIG_DEFAULTS: {
7
+ readonly url: "https://localhost:8443";
8
+ readonly insecure: false;
9
+ readonly timeout: 30000;
10
+ };
11
+ export declare const DEFAULT_PROFILE = "default";
12
+ export interface Profile {
13
+ url: string;
14
+ insecure: boolean;
15
+ timeout: number;
16
+ defaultTenant?: string;
17
+ credentials?: StoredCredentials;
18
+ apiKey?: string;
19
+ apiKeyId?: string;
20
+ apiKeyName?: string;
21
+ }
22
+ export interface ConfigStore {
23
+ activeProfile: string;
24
+ profiles: Record<string, Profile>;
25
+ plugins?: CLIPluginConfig[];
26
+ url?: string;
27
+ insecure?: boolean;
28
+ timeout?: number;
29
+ defaultTenant?: string;
30
+ credentials?: StoredCredentials;
31
+ }
32
+ export interface ProfileInfo {
33
+ name: string;
34
+ url: string;
35
+ active: boolean;
36
+ hasCredentials: boolean;
37
+ hasApiKey: boolean;
38
+ }
39
+ export interface ApiKeyInfo {
40
+ key: string;
41
+ id?: string;
42
+ name?: string;
43
+ }
44
+ //# sourceMappingURL=types.d.ts.map