@burdenoff/microfe-security 2026.1105.2 → 2026.1109.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 (238) hide show
  1. package/dist/dev/Dashboard.d.ts +4 -0
  2. package/dist/dev/SecurityApp.d.ts +10 -0
  3. package/dist/dev/main.d.ts +0 -0
  4. package/dist/dev/useDarkMode.d.ts +7 -0
  5. package/dist/generated/global-operations.d.ts +1 -0
  6. package/dist/generated/global-types.d.ts +27686 -0
  7. package/dist/generated/wspace-operations.d.ts +1948 -0
  8. package/dist/generated/wspace-operations.js +102 -103
  9. package/dist/generated/wspace-operations.js.map +1 -1
  10. package/dist/generated/wspace-types.d.ts +147604 -0
  11. package/dist/generated/wspace-types.js +1 -2
  12. package/dist/generated/wspace-types.js.map +1 -1
  13. package/dist/index.d.ts +5 -0
  14. package/dist/node_modules/clsx/dist/clsx.js +8 -7
  15. package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
  16. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +229 -167
  17. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
  18. package/dist/security/SecurityAdminRoot.d.ts +17 -0
  19. package/dist/security/SecurityAdminRoot.js +10 -8
  20. package/dist/security/SecurityAdminRoot.js.map +1 -1
  21. package/dist/security/SecurityRoot.d.ts +16 -0
  22. package/dist/security/SecurityRoot.js +10 -8
  23. package/dist/security/SecurityRoot.js.map +1 -1
  24. package/dist/security/SecurityRootBase.d.ts +17 -0
  25. package/dist/security/SecurityRootBase.js +9 -10
  26. package/dist/security/SecurityRootBase.js.map +1 -1
  27. package/dist/security/SecurityUserRoot.d.ts +16 -0
  28. package/dist/security/SecurityUserRoot.js +10 -8
  29. package/dist/security/SecurityUserRoot.js.map +1 -1
  30. package/dist/security/components/ActivityTimeline.d.ts +10 -0
  31. package/dist/security/components/ActivityTimeline.js +14 -15
  32. package/dist/security/components/ActivityTimeline.js.map +1 -1
  33. package/dist/security/components/BulkActionBar.d.ts +7 -0
  34. package/dist/security/components/BulkActionBar.js +18 -19
  35. package/dist/security/components/BulkActionBar.js.map +1 -1
  36. package/dist/security/components/ConfirmDialog.d.ts +17 -0
  37. package/dist/security/components/ConfirmDialog.js +5 -6
  38. package/dist/security/components/ConfirmDialog.js.map +1 -1
  39. package/dist/security/components/CopyButton.d.ts +18 -0
  40. package/dist/security/components/CopyButton.js +30 -29
  41. package/dist/security/components/CopyButton.js.map +1 -1
  42. package/dist/security/components/ExportDialog.d.ts +5 -0
  43. package/dist/security/components/ExportDialog.js +22 -22
  44. package/dist/security/components/ExportDialog.js.map +1 -1
  45. package/dist/security/components/ExternalSecretProviders.d.ts +16 -0
  46. package/dist/security/components/ExternalSecretProviders.js +72 -73
  47. package/dist/security/components/ExternalSecretProviders.js.map +1 -1
  48. package/dist/security/components/ImportWizard.d.ts +5 -0
  49. package/dist/security/components/ImportWizard.js +28 -29
  50. package/dist/security/components/ImportWizard.js.map +1 -1
  51. package/dist/security/components/PageLayout.d.ts +32 -0
  52. package/dist/security/components/PageLayout.js +1 -2
  53. package/dist/security/components/PageLayout.js.map +1 -1
  54. package/dist/security/components/PasswordGenerator.d.ts +15 -0
  55. package/dist/security/components/PasswordGenerator.js +14 -15
  56. package/dist/security/components/PasswordGenerator.js.map +1 -1
  57. package/dist/security/components/RotationStatusBadge.d.ts +11 -0
  58. package/dist/security/components/RotationStatusBadge.js +5 -6
  59. package/dist/security/components/RotationStatusBadge.js.map +1 -1
  60. package/dist/security/components/SecretFormFields.d.ts +21 -0
  61. package/dist/security/components/SecretFormFields.js +40 -41
  62. package/dist/security/components/SecretFormFields.js.map +1 -1
  63. package/dist/security/components/SecretRow.d.ts +11 -0
  64. package/dist/security/components/SecretRow.js +14 -15
  65. package/dist/security/components/SecretRow.js.map +1 -1
  66. package/dist/security/components/SecretShareDialog.d.ts +19 -0
  67. package/dist/security/components/SecretShareDialog.js +106 -107
  68. package/dist/security/components/SecretShareDialog.js.map +1 -1
  69. package/dist/security/components/SecretTypeBadge.d.ts +11 -0
  70. package/dist/security/components/SecretTypeBadge.js +7 -8
  71. package/dist/security/components/SecretTypeBadge.js.map +1 -1
  72. package/dist/security/components/SecretTypeIcon.d.ts +12 -0
  73. package/dist/security/components/SecretTypeIcon.js +6 -7
  74. package/dist/security/components/SecretTypeIcon.js.map +1 -1
  75. package/dist/security/components/SecretValueDisplay.d.ts +24 -0
  76. package/dist/security/components/SecretValueDisplay.js +9 -10
  77. package/dist/security/components/SecretValueDisplay.js.map +1 -1
  78. package/dist/security/components/SecurityPermissionGuard.d.ts +14 -0
  79. package/dist/security/components/SecurityPermissionGuard.js +1 -2
  80. package/dist/security/components/SecurityPermissionGuard.js.map +1 -1
  81. package/dist/security/components/SecurityScoreCard.d.ts +12 -0
  82. package/dist/security/components/SecurityScoreCard.js +14 -15
  83. package/dist/security/components/SecurityScoreCard.js.map +1 -1
  84. package/dist/security/components/VaultCard.d.ts +11 -0
  85. package/dist/security/components/VaultCard.js +8 -9
  86. package/dist/security/components/VaultCard.js.map +1 -1
  87. package/dist/security/components/VaultFormFields.d.ts +15 -0
  88. package/dist/security/components/VaultFormFields.js +8 -9
  89. package/dist/security/components/VaultFormFields.js.map +1 -1
  90. package/dist/security/components/VaultShareDialog.d.ts +14 -0
  91. package/dist/security/components/VaultShareDialog.js +12 -13
  92. package/dist/security/components/VaultShareDialog.js.map +1 -1
  93. package/dist/security/components/ui.d.ts +53 -0
  94. package/dist/security/components/ui.js +1 -2
  95. package/dist/security/components/ui.js.map +1 -1
  96. package/dist/security/config/navigation.d.ts +12 -0
  97. package/dist/security/config/navigation.js +1 -2
  98. package/dist/security/config/navigation.js.map +1 -1
  99. package/dist/security/constants/externalSecretProviders.d.ts +41 -0
  100. package/dist/security/constants/externalSecretProviders.js +1 -2
  101. package/dist/security/constants/externalSecretProviders.js.map +1 -1
  102. package/dist/security/constants/featureFlags.d.ts +39 -0
  103. package/dist/security/constants/featureFlags.js +1 -2
  104. package/dist/security/constants/featureFlags.js.map +1 -1
  105. package/dist/security/constants/permissions.d.ts +9 -0
  106. package/dist/security/constants/permissions.js +1 -2
  107. package/dist/security/constants/permissions.js.map +1 -1
  108. package/dist/security/constants/providers.d.ts +11 -0
  109. package/dist/security/constants/providers.js +1 -2
  110. package/dist/security/constants/providers.js.map +1 -1
  111. package/dist/security/constants/secretTypes.d.ts +16 -0
  112. package/dist/security/constants/secretTypes.js +1 -2
  113. package/dist/security/constants/secretTypes.js.map +1 -1
  114. package/dist/security/hooks/useAuditLog.d.ts +16 -0
  115. package/dist/security/hooks/useAuditLog.js +1 -2
  116. package/dist/security/hooks/useAuditLog.js.map +1 -1
  117. package/dist/security/hooks/useBulkSecretOperations.d.ts +6 -0
  118. package/dist/security/hooks/useBulkSecretOperations.js +1 -2
  119. package/dist/security/hooks/useBulkSecretOperations.js.map +1 -1
  120. package/dist/security/hooks/useImportExport.d.ts +53 -0
  121. package/dist/security/hooks/useImportExport.js +3 -4
  122. package/dist/security/hooks/useImportExport.js.map +1 -1
  123. package/dist/security/hooks/useProviderQueries.d.ts +9 -0
  124. package/dist/security/hooks/useProviderQueries.js +1 -2
  125. package/dist/security/hooks/useProviderQueries.js.map +1 -1
  126. package/dist/security/hooks/useSecretQueries.d.ts +7 -0
  127. package/dist/security/hooks/useSecretQueries.js +1 -2
  128. package/dist/security/hooks/useSecretQueries.js.map +1 -1
  129. package/dist/security/hooks/useSecretValue.d.ts +11 -0
  130. package/dist/security/hooks/useSecretValue.js +1 -2
  131. package/dist/security/hooks/useSecretValue.js.map +1 -1
  132. package/dist/security/hooks/useSecurityCacheInvalidation.d.ts +1 -0
  133. package/dist/security/hooks/useSecurityCacheInvalidation.js +1 -2
  134. package/dist/security/hooks/useSecurityCacheInvalidation.js.map +1 -1
  135. package/dist/security/hooks/useSecurityDashboard.d.ts +20 -0
  136. package/dist/security/hooks/useSecurityDashboard.js +1 -2
  137. package/dist/security/hooks/useSecurityDashboard.js.map +1 -1
  138. package/dist/security/hooks/useSecurityEventEmitter.d.ts +13 -0
  139. package/dist/security/hooks/useSecurityEventEmitter.js +1 -2
  140. package/dist/security/hooks/useSecurityEventEmitter.js.map +1 -1
  141. package/dist/security/hooks/useSecuritySubscriptions.d.ts +5 -0
  142. package/dist/security/hooks/useSecuritySubscriptions.js +1 -2
  143. package/dist/security/hooks/useSecuritySubscriptions.js.map +1 -1
  144. package/dist/security/hooks/useShareQueries.d.ts +13 -0
  145. package/dist/security/hooks/useShareQueries.js +1 -2
  146. package/dist/security/hooks/useShareQueries.js.map +1 -1
  147. package/dist/security/hooks/useTr.d.ts +16 -0
  148. package/dist/security/hooks/useTr.js +1 -2
  149. package/dist/security/hooks/useTr.js.map +1 -1
  150. package/dist/security/hooks/useVaultQueries.d.ts +12 -0
  151. package/dist/security/hooks/useVaultQueries.js +1 -2
  152. package/dist/security/hooks/useVaultQueries.js.map +1 -1
  153. package/dist/security/index.d.ts +32 -0
  154. package/dist/security/index.js +8 -7
  155. package/dist/security/pages/AccessReviewPage.d.ts +1 -0
  156. package/dist/security/pages/AccessReviewPage.js +31 -29
  157. package/dist/security/pages/AccessReviewPage.js.map +1 -1
  158. package/dist/security/pages/AuditLogPage.d.ts +1 -0
  159. package/dist/security/pages/AuditLogPage.js +16 -17
  160. package/dist/security/pages/AuditLogPage.js.map +1 -1
  161. package/dist/security/pages/ImportExportPage.d.ts +1 -0
  162. package/dist/security/pages/ImportExportPage.js +10 -11
  163. package/dist/security/pages/ImportExportPage.js.map +1 -1
  164. package/dist/security/pages/ProviderDetailPage.d.ts +1 -0
  165. package/dist/security/pages/ProviderDetailPage.js +82 -87
  166. package/dist/security/pages/ProviderDetailPage.js.map +1 -1
  167. package/dist/security/pages/ProvidersPage.d.ts +1 -0
  168. package/dist/security/pages/ProvidersPage.js +20 -21
  169. package/dist/security/pages/ProvidersPage.js.map +1 -1
  170. package/dist/security/pages/SecretCreatePage.d.ts +1 -0
  171. package/dist/security/pages/SecretCreatePage.js +45 -50
  172. package/dist/security/pages/SecretCreatePage.js.map +1 -1
  173. package/dist/security/pages/SecretDetailPage.d.ts +1 -0
  174. package/dist/security/pages/SecretDetailPage.js +52 -57
  175. package/dist/security/pages/SecretDetailPage.js.map +1 -1
  176. package/dist/security/pages/SecurityDashboardPage.d.ts +1 -0
  177. package/dist/security/pages/SecurityDashboardPage.js +13 -14
  178. package/dist/security/pages/SecurityDashboardPage.js.map +1 -1
  179. package/dist/security/pages/SharedWithMePage.d.ts +1 -0
  180. package/dist/security/pages/SharedWithMePage.js +32 -33
  181. package/dist/security/pages/SharedWithMePage.js.map +1 -1
  182. package/dist/security/pages/VaultCreatePage.d.ts +1 -0
  183. package/dist/security/pages/VaultCreatePage.js +36 -38
  184. package/dist/security/pages/VaultCreatePage.js.map +1 -1
  185. package/dist/security/pages/VaultDetailPage.d.ts +1 -0
  186. package/dist/security/pages/VaultDetailPage.js +81 -86
  187. package/dist/security/pages/VaultDetailPage.js.map +1 -1
  188. package/dist/security/pages/VaultLandingPage.d.ts +9 -0
  189. package/dist/security/pages/VaultLandingPage.js +4 -5
  190. package/dist/security/pages/VaultLandingPage.js.map +1 -1
  191. package/dist/security/pages/VaultSettingsPage.d.ts +1 -0
  192. package/dist/security/pages/VaultSettingsPage.js +37 -42
  193. package/dist/security/pages/VaultSettingsPage.js.map +1 -1
  194. package/dist/security/pages/VaultShareViewer.d.ts +18 -0
  195. package/dist/security/pages/VaultShareViewer.js +17 -18
  196. package/dist/security/pages/VaultShareViewer.js.map +1 -1
  197. package/dist/security/pages/VaultsDashboardPage.d.ts +1 -0
  198. package/dist/security/pages/VaultsDashboardPage.js +147 -148
  199. package/dist/security/pages/VaultsDashboardPage.js.map +1 -1
  200. package/dist/security/providers/SecurityProvider.d.ts +11 -0
  201. package/dist/security/providers/SecurityProvider.js +26 -29
  202. package/dist/security/providers/SecurityProvider.js.map +1 -1
  203. package/dist/security/routes/SecurityAdminRoutes.d.ts +6 -0
  204. package/dist/security/routes/SecurityAdminRoutes.js +1 -2
  205. package/dist/security/routes/SecurityAdminRoutes.js.map +1 -1
  206. package/dist/security/routes/SecurityRoutes.d.ts +18 -0
  207. package/dist/security/routes/SecurityRoutes.js +1 -2
  208. package/dist/security/routes/SecurityRoutes.js.map +1 -1
  209. package/dist/security/routes/SecurityUserRoutes.d.ts +10 -0
  210. package/dist/security/routes/SecurityUserRoutes.js +10 -11
  211. package/dist/security/routes/SecurityUserRoutes.js.map +1 -1
  212. package/dist/security/routes/routeUtils.d.ts +26 -0
  213. package/dist/security/routes/routeUtils.js +1 -2
  214. package/dist/security/routes/routeUtils.js.map +1 -1
  215. package/dist/security/store/securityStore.d.ts +33 -0
  216. package/dist/security/store/securityStore.js +1 -2
  217. package/dist/security/store/securityStore.js.map +1 -1
  218. package/dist/security/translations/en.d.ts +842 -0
  219. package/dist/security/translations/en.js +1 -2
  220. package/dist/security/translations/en.js.map +1 -1
  221. package/dist/security/translations/index.d.ts +1 -0
  222. package/dist/security/types/index.d.ts +282 -0
  223. package/dist/security/utils/clipboard.d.ts +11 -0
  224. package/dist/security/utils/clipboard.js +1 -2
  225. package/dist/security/utils/clipboard.js.map +1 -1
  226. package/dist/security/utils/cn.d.ts +5 -0
  227. package/dist/security/utils/cn.js +2 -3
  228. package/dist/security/utils/cn.js.map +1 -1
  229. package/dist/security/utils/fileParser.d.ts +17 -0
  230. package/dist/security/utils/fileParser.js +2 -11
  231. package/dist/security/utils/fileParser.js.map +1 -1
  232. package/dist/security/utils/i18n.d.ts +11 -0
  233. package/dist/security/utils/passwordGenerator.d.ts +21 -0
  234. package/dist/security/utils/passwordGenerator.js +1 -2
  235. package/dist/security/utils/passwordGenerator.js.map +1 -1
  236. package/dist/utils/nativeBridge.d.ts +2 -0
  237. package/dist/utils/nativeBridge.js +1 -2
  238. package/package.json +62 -46
@@ -0,0 +1,16 @@
1
+ import { SecretType } from '../types';
2
+ export interface SecretTypeInfo {
3
+ value: SecretType;
4
+ label: string;
5
+ description: string;
6
+ icon: string;
7
+ color: string;
8
+ /** Translation key under the `security.secretTypes` namespace (without the `security.` prefix). */
9
+ translationKey: string;
10
+ }
11
+ /**
12
+ * Secret types matching the GraphQL SecretType enum.
13
+ * Values MUST be uppercase to match the backend enum exactly.
14
+ */
15
+ export declare const SECRET_TYPES: SecretTypeInfo[];
16
+ export declare function getSecretTypeInfo(type: SecretType): SecretTypeInfo;
@@ -1,4 +1,4 @@
1
- //#region src/security/constants/secretTypes.ts
1
+ // src/security/constants/secretTypes.ts
2
2
  var e = [
3
3
  {
4
4
  value: "CREDENTIAL",
@@ -68,7 +68,6 @@ var e = [
68
68
  function t(t) {
69
69
  return e.find((e) => e.value === t) ?? e[e.length - 1];
70
70
  }
71
- //#endregion
72
71
  export { e as SECRET_TYPES, t as getSecretTypeInfo };
73
72
 
74
73
  //# sourceMappingURL=secretTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"secretTypes.js","names":[],"sources":["../../../src/security/constants/secretTypes.ts"],"sourcesContent":["import type { SecretType } from '../types';\n\nexport interface SecretTypeInfo {\n value: SecretType;\n label: string;\n description: string;\n icon: string;\n color: string;\n /** Translation key under the `security.secretTypes` namespace (without the `security.` prefix). */\n translationKey: string;\n}\n\n/**\n * Secret types matching the GraphQL SecretType enum.\n * Values MUST be uppercase to match the backend enum exactly.\n */\nexport const SECRET_TYPES: SecretTypeInfo[] = [\n {\n value: 'CREDENTIAL',\n label: 'Password / Credential',\n description: 'User or service account passwords and credentials',\n icon: 'KeyRound',\n color: 'text-accent-blue',\n translationKey: 'secretTypes.credential',\n },\n {\n value: 'API_KEY',\n label: 'API Key',\n description: 'API keys for external services',\n icon: 'Key',\n color: 'text-accent-purple',\n translationKey: 'secretTypes.apiKey',\n },\n {\n value: 'TOKEN',\n label: 'Token',\n description: 'Authentication or access tokens',\n icon: 'Ticket',\n color: 'text-status-success-text',\n translationKey: 'secretTypes.token',\n },\n {\n value: 'CERTIFICATE',\n label: 'Certificate',\n description: 'TLS/SSL certificates',\n icon: 'Award',\n color: 'text-status-warning-text',\n translationKey: 'secretTypes.certificate',\n },\n {\n value: 'PRIVATE_KEY',\n label: 'Private Key',\n description: 'SSH keys, encryption keys, signing keys',\n icon: 'Lock',\n color: 'text-status-error-text',\n translationKey: 'secretTypes.privateKey',\n },\n {\n value: 'FILE',\n label: 'File',\n description: 'Confidential file content (base64 encoded)',\n icon: 'FileCode',\n color: 'text-accent-orange',\n translationKey: 'secretTypes.file',\n },\n {\n value: 'TEXT',\n label: 'Text / Note',\n description: 'Free-form confidential text',\n icon: 'FileText',\n color: 'text-accent-teal',\n translationKey: 'secretTypes.text',\n },\n {\n value: 'STRUCTURED_DATA',\n label: 'Structured Data',\n description: 'JSON configuration, connection strings, env vars',\n icon: 'Settings',\n color: 'text-slate-500',\n translationKey: 'secretTypes.structuredData',\n },\n];\n\nexport function getSecretTypeInfo(type: SecretType): SecretTypeInfo {\n return SECRET_TYPES.find((t) => t.value === type) ?? SECRET_TYPES[SECRET_TYPES.length - 1];\n}\n"],"mappings":";AAgBA,IAAa,IAAiC;CAC5C;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;EACjB;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;EACjB;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;EACjB;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;EACjB;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;EACjB;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;EACjB;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;EACjB;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;EACjB;CACF;AAED,SAAgB,EAAkB,GAAkC;AAClE,QAAO,EAAa,MAAM,MAAM,EAAE,UAAU,EAAK,IAAI,EAAa,EAAa,SAAS"}
1
+ {"version":3,"file":"secretTypes.js","names":["SECRET_TYPES","getSecretTypeInfo","t","type"],"sources":["../../../src/security/constants/secretTypes.ts"],"sourcesContent":["import type { SecretType } from '../types';\n\nexport interface SecretTypeInfo {\n value: SecretType;\n label: string;\n description: string;\n icon: string;\n color: string;\n /** Translation key under the `security.secretTypes` namespace (without the `security.` prefix). */\n translationKey: string;\n}\n\n/**\n * Secret types matching the GraphQL SecretType enum.\n * Values MUST be uppercase to match the backend enum exactly.\n */\nexport const SECRET_TYPES: SecretTypeInfo[] = [\n {\n value: 'CREDENTIAL',\n label: 'Password / Credential',\n description: 'User or service account passwords and credentials',\n icon: 'KeyRound',\n color: 'text-accent-blue',\n translationKey: 'secretTypes.credential',\n },\n {\n value: 'API_KEY',\n label: 'API Key',\n description: 'API keys for external services',\n icon: 'Key',\n color: 'text-accent-purple',\n translationKey: 'secretTypes.apiKey',\n },\n {\n value: 'TOKEN',\n label: 'Token',\n description: 'Authentication or access tokens',\n icon: 'Ticket',\n color: 'text-status-success-text',\n translationKey: 'secretTypes.token',\n },\n {\n value: 'CERTIFICATE',\n label: 'Certificate',\n description: 'TLS/SSL certificates',\n icon: 'Award',\n color: 'text-status-warning-text',\n translationKey: 'secretTypes.certificate',\n },\n {\n value: 'PRIVATE_KEY',\n label: 'Private Key',\n description: 'SSH keys, encryption keys, signing keys',\n icon: 'Lock',\n color: 'text-status-error-text',\n translationKey: 'secretTypes.privateKey',\n },\n {\n value: 'FILE',\n label: 'File',\n description: 'Confidential file content (base64 encoded)',\n icon: 'FileCode',\n color: 'text-accent-orange',\n translationKey: 'secretTypes.file',\n },\n {\n value: 'TEXT',\n label: 'Text / Note',\n description: 'Free-form confidential text',\n icon: 'FileText',\n color: 'text-accent-teal',\n translationKey: 'secretTypes.text',\n },\n {\n value: 'STRUCTURED_DATA',\n label: 'Structured Data',\n description: 'JSON configuration, connection strings, env vars',\n icon: 'Settings',\n color: 'text-slate-500',\n translationKey: 'secretTypes.structuredData',\n },\n];\n\nexport function getSecretTypeInfo(type: SecretType): SecretTypeInfo {\n return SECRET_TYPES.find((t) => t.value === type) ?? SECRET_TYPES[SECRET_TYPES.length - 1];\n}\n"],"mappings":";AAgBA,IAAaA,IAAiC;CAC5C;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;CAClB;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;CAClB;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;CAClB;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;CAClB;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;CAClB;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;CAClB;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;CAClB;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO;EACP,gBAAgB;CAClB;AACF;AAEA,SAAgBC,EAAkB,GAAkC;CAClE,OAAOD,EAAa,MAAM,MAAME,EAAE,UAAUC,CAAI,KAAKH,EAAaA,EAAa,SAAS;AAC1F"}
@@ -0,0 +1,16 @@
1
+ import { VaultAuditLogFilterInput, SecurityPaginationInput } from '../../generated/wspace-types';
2
+ /**
3
+ * Two call shapes:
4
+ * - `useVaultAuditLogs(vaultId, …)` — per-vault audit trail (used in the
5
+ * vault-detail Audit Log tab). Filter is scoped to that vault entity.
6
+ * - `useVaultAuditLogs(undefined, …)` — workspace-wide audit feed (used in
7
+ * the page-level `/security/audit` view and the security dashboard).
8
+ *
9
+ * The previous implementation forced `entityType: 'vault'` + `entityId: vaultId`
10
+ * unconditionally AND set `skip: !vaultId`, so the two undefined-vaultId callers
11
+ * never fired a query at all — `/security/audit` rendered with no spinner, no
12
+ * error, and no rows because Apollo `useQuery` returns `{ data: undefined,
13
+ * loading: false, error: undefined }` when `skip` is true. Only scope the
14
+ * filter when a vaultId is actually supplied.
15
+ */
16
+ export declare function useVaultAuditLogs(vaultId: string | undefined, filter?: VaultAuditLogFilterInput, pagination?: SecurityPaginationInput): import('@apollo/client/react').useQuery.Result<Types.GetVaultAuditLogsQuery, Types.GetVaultAuditLogsQueryVariables, "empty" | "complete" | "streaming", Types.GetVaultAuditLogsQueryVariables, undefined>;
@@ -1,5 +1,5 @@
1
1
  import { useGetVaultAuditLogsQuery as e } from "../../generated/wspace-operations.js";
2
- //#region src/security/hooks/useAuditLog.ts
2
+ // src/security/hooks/useAuditLog.ts
3
3
  function t(t, n, r) {
4
4
  return e({
5
5
  variables: {
@@ -13,7 +13,6 @@ function t(t, n, r) {
13
13
  fetchPolicy: "network-only"
14
14
  });
15
15
  }
16
- //#endregion
17
16
  export { t as useVaultAuditLogs };
18
17
 
19
18
  //# sourceMappingURL=useAuditLog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAuditLog.js","names":[],"sources":["../../../src/security/hooks/useAuditLog.ts"],"sourcesContent":["import { useGetVaultAuditLogsQuery } from '../../generated/wspace-operations';\nimport type {\n VaultAuditLogFilterInput,\n SecurityPaginationInput,\n} from '../../generated/wspace-types';\n\n/**\n * Two call shapes:\n * - `useVaultAuditLogs(vaultId, …)` — per-vault audit trail (used in the\n * vault-detail Audit Log tab). Filter is scoped to that vault entity.\n * - `useVaultAuditLogs(undefined, …)` — workspace-wide audit feed (used in\n * the page-level `/security/audit` view and the security dashboard).\n *\n * The previous implementation forced `entityType: 'vault'` + `entityId: vaultId`\n * unconditionally AND set `skip: !vaultId`, so the two undefined-vaultId callers\n * never fired a query at all — `/security/audit` rendered with no spinner, no\n * error, and no rows because Apollo `useQuery` returns `{ data: undefined,\n * loading: false, error: undefined }` when `skip` is true. Only scope the\n * filter when a vaultId is actually supplied.\n */\nexport function useVaultAuditLogs(\n vaultId: string | undefined,\n filter?: VaultAuditLogFilterInput,\n pagination?: SecurityPaginationInput\n) {\n return useGetVaultAuditLogsQuery({\n variables: {\n filter: vaultId\n ? {\n ...filter,\n entityType: 'vault',\n entityId: vaultId,\n }\n : filter,\n pagination,\n },\n // No skip — both shapes (per-vault and workspace-wide) need to fire.\n fetchPolicy: 'network-only',\n });\n}\n"],"mappings":";;AAoBA,SAAgB,EACd,GACA,GACA,GACA;AACA,QAAO,EAA0B;EAC/B,WAAW;GACT,QAAQ,IACJ;IACE,GAAG;IACH,YAAY;IACZ,UAAU;IACX,GACD;GACJ;GACD;EAED,aAAa;EACd,CAAC"}
1
+ {"version":3,"file":"useAuditLog.js","names":["useVaultAuditLogs","useGetVaultAuditLogsQuery","vaultId","filter"],"sources":["../../../src/security/hooks/useAuditLog.ts"],"sourcesContent":["import { useGetVaultAuditLogsQuery } from '../../generated/wspace-operations';\nimport type {\n VaultAuditLogFilterInput,\n SecurityPaginationInput,\n} from '../../generated/wspace-types';\n\n/**\n * Two call shapes:\n * - `useVaultAuditLogs(vaultId, …)` — per-vault audit trail (used in the\n * vault-detail Audit Log tab). Filter is scoped to that vault entity.\n * - `useVaultAuditLogs(undefined, …)` — workspace-wide audit feed (used in\n * the page-level `/security/audit` view and the security dashboard).\n *\n * The previous implementation forced `entityType: 'vault'` + `entityId: vaultId`\n * unconditionally AND set `skip: !vaultId`, so the two undefined-vaultId callers\n * never fired a query at all — `/security/audit` rendered with no spinner, no\n * error, and no rows because Apollo `useQuery` returns `{ data: undefined,\n * loading: false, error: undefined }` when `skip` is true. Only scope the\n * filter when a vaultId is actually supplied.\n */\nexport function useVaultAuditLogs(\n vaultId: string | undefined,\n filter?: VaultAuditLogFilterInput,\n pagination?: SecurityPaginationInput\n) {\n return useGetVaultAuditLogsQuery({\n variables: {\n filter: vaultId\n ? {\n ...filter,\n entityType: 'vault',\n entityId: vaultId,\n }\n : filter,\n pagination,\n },\n // No skip — both shapes (per-vault and workspace-wide) need to fire.\n fetchPolicy: 'network-only',\n });\n}\n"],"mappings":";;AAoBA,SAAgBA,EACd,GACA,GACA,GACA;CACA,OAAOC,EAA0B;EAC/B,WAAW;GACT,QAAQC,IACJ;IACE,GAAGC;IACH,YAAY;IACZ,UAAUD;GACZ,IACAC;GACJ;EACF;EAEA,aAAa;CACf,CAAC;AACH"}
@@ -0,0 +1,6 @@
1
+ export declare function useBulkSecretOperations(): {
2
+ bulkDeleteSecrets: (ids: string[]) => Promise<import('@apollo/client').ApolloClient.MutateResult<Types.BulkDeleteSecretsMutation, undefined>>;
3
+ bulkMoveSecrets: (ids: string[], targetVaultId: string) => Promise<import('@apollo/client').ApolloClient.MutateResult<Types.BulkMoveSecretsMutation, undefined>>;
4
+ bulkLabelSecrets: (ids: string[], label: string, color?: string) => Promise<import('@apollo/client').ApolloClient.MutateResult<Types.BulkLabelSecretsMutation, undefined>>;
5
+ loading: boolean;
6
+ };
@@ -1,5 +1,5 @@
1
1
  import { useBulkDeleteSecretsMutation as e, useBulkLabelSecretsMutation as t, useBulkMoveSecretsMutation as n } from "../../generated/wspace-operations.js";
2
- //#region src/security/hooks/useBulkSecretOperations.ts
2
+ // src/security/hooks/useBulkSecretOperations.ts
3
3
  function r() {
4
4
  let [r, { loading: i }] = e({ refetchQueries: ["GetSecrets"] }), [a, { loading: o }] = n({ refetchQueries: ["GetSecrets"] }), [s, { loading: c }] = t({ refetchQueries: ["GetSecrets"] });
5
5
  return {
@@ -16,7 +16,6 @@ function r() {
16
16
  loading: i || o || c
17
17
  };
18
18
  }
19
- //#endregion
20
19
  export { r as useBulkSecretOperations };
21
20
 
22
21
  //# sourceMappingURL=useBulkSecretOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBulkSecretOperations.js","names":[],"sources":["../../../src/security/hooks/useBulkSecretOperations.ts"],"sourcesContent":["import {\n useBulkDeleteSecretsMutation,\n useBulkMoveSecretsMutation,\n useBulkLabelSecretsMutation,\n} from '../../generated/wspace-operations';\n\nexport function useBulkSecretOperations() {\n const [bulkDeleteMutation, { loading: deleteLoading }] = useBulkDeleteSecretsMutation({\n refetchQueries: ['GetSecrets'],\n });\n\n const [bulkMoveMutation, { loading: moveLoading }] = useBulkMoveSecretsMutation({\n refetchQueries: ['GetSecrets'],\n });\n\n const [bulkLabelMutation, { loading: labelLoading }] = useBulkLabelSecretsMutation({\n refetchQueries: ['GetSecrets'],\n });\n\n const bulkDeleteSecrets = async (ids: string[]) => {\n return bulkDeleteMutation({ variables: { ids } });\n };\n\n const bulkMoveSecrets = async (ids: string[], targetVaultId: string) => {\n return bulkMoveMutation({ variables: { ids, targetVaultId } });\n };\n\n const bulkLabelSecrets = async (ids: string[], label: string, color?: string) => {\n return bulkLabelMutation({ variables: { ids, label, color } });\n };\n\n return {\n bulkDeleteSecrets,\n bulkMoveSecrets,\n bulkLabelSecrets,\n loading: deleteLoading || moveLoading || labelLoading,\n };\n}\n"],"mappings":";;AAMA,SAAgB,IAA0B;CACxC,IAAM,CAAC,GAAoB,EAAE,SAAS,OAAmB,EAA6B,EACpF,gBAAgB,CAAC,aAAa,EAC/B,CAAC,EAEI,CAAC,GAAkB,EAAE,SAAS,OAAiB,EAA2B,EAC9E,gBAAgB,CAAC,aAAa,EAC/B,CAAC,EAEI,CAAC,GAAmB,EAAE,SAAS,OAAkB,EAA4B,EACjF,gBAAgB,CAAC,aAAa,EAC/B,CAAC;AAcF,QAAO;EACL,mBAbwB,OAAO,MACxB,EAAmB,EAAE,WAAW,EAAE,QAAK,EAAE,CAAC;EAajD,iBAVsB,OAAO,GAAe,MACrC,EAAiB,EAAE,WAAW;GAAE;GAAK;GAAe,EAAE,CAAC;EAU9D,kBAPuB,OAAO,GAAe,GAAe,MACrD,EAAkB,EAAE,WAAW;GAAE;GAAK;GAAO;GAAO,EAAE,CAAC;EAO9D,SAAS,KAAiB,KAAe;EAC1C"}
1
+ {"version":3,"file":"useBulkSecretOperations.js","names":["useBulkSecretOperations","bulkDeleteMutation","deleteLoading","useBulkDeleteSecretsMutation","bulkMoveMutation","moveLoading","useBulkMoveSecretsMutation","bulkLabelMutation","labelLoading","useBulkLabelSecretsMutation"],"sources":["../../../src/security/hooks/useBulkSecretOperations.ts"],"sourcesContent":["import {\n useBulkDeleteSecretsMutation,\n useBulkMoveSecretsMutation,\n useBulkLabelSecretsMutation,\n} from '../../generated/wspace-operations';\n\nexport function useBulkSecretOperations() {\n const [bulkDeleteMutation, { loading: deleteLoading }] = useBulkDeleteSecretsMutation({\n refetchQueries: ['GetSecrets'],\n });\n\n const [bulkMoveMutation, { loading: moveLoading }] = useBulkMoveSecretsMutation({\n refetchQueries: ['GetSecrets'],\n });\n\n const [bulkLabelMutation, { loading: labelLoading }] = useBulkLabelSecretsMutation({\n refetchQueries: ['GetSecrets'],\n });\n\n const bulkDeleteSecrets = async (ids: string[]) => {\n return bulkDeleteMutation({ variables: { ids } });\n };\n\n const bulkMoveSecrets = async (ids: string[], targetVaultId: string) => {\n return bulkMoveMutation({ variables: { ids, targetVaultId } });\n };\n\n const bulkLabelSecrets = async (ids: string[], label: string, color?: string) => {\n return bulkLabelMutation({ variables: { ids, label, color } });\n };\n\n return {\n bulkDeleteSecrets,\n bulkMoveSecrets,\n bulkLabelSecrets,\n loading: deleteLoading || moveLoading || labelLoading,\n };\n}\n"],"mappings":";;AAMA,SAAgBA,IAA0B;CACxC,IAAM,CAACC,GAAoB,EAAE,SAASC,OAAmBC,EAA6B,EACpF,gBAAgB,CAAC,YAAY,EAC/B,CAAC,GAEK,CAACC,GAAkB,EAAE,SAASC,OAAiBC,EAA2B,EAC9E,gBAAgB,CAAC,YAAY,EAC/B,CAAC,GAEK,CAACC,GAAmB,EAAE,SAASC,OAAkBC,EAA4B,EACjF,gBAAgB,CAAC,YAAY,EAC/B,CAAC;CAcD,OAAO;EACL,0BAb+B,MACxBR,EAAmB,EAAE,WAAW,EAAE,OAAI,EAAE,CAAC;EAahD,wBAV6B,GAAe,MACrCG,EAAiB,EAAE,WAAW;GAAE;GAAK;EAAc,EAAE,CAAC;EAU7D,yBAP8B,GAAe,GAAe,MACrDG,EAAkB,EAAE,WAAW;GAAE;GAAK;GAAO;EAAM,EAAE,CAAC;EAO7D,SAASL,KAAiBG,KAAeG;CAC3C;AACF"}
@@ -0,0 +1,53 @@
1
+ import { ParsedSecret } from '../utils/fileParser';
2
+ /**
3
+ * Wizard state machine for plain/backup imports.
4
+ *
5
+ * `status` is the single source of truth for what the wizard should
6
+ * render. Five terminal states are distinguished so consumers can light
7
+ * up the right affordance without inspecting `results`:
8
+ *
9
+ * - `completed` — at least one row was created, with no row-level
10
+ * errors. Green success banner.
11
+ * - `partial` — at least one row was created AND at least one row
12
+ * errored. Yellow / amber "imported some but not all" banner.
13
+ * `error` carries a one-line summary; per-row detail is in
14
+ * `results.errors`.
15
+ * - `skipped` — zero imported, all rows were duplicates and skipped
16
+ * (no row-level errors). Neutral "nothing to import" banner.
17
+ * `error` carries a count message.
18
+ * - `error` — zero imported AND every row errored, OR the
19
+ * mutation itself threw. Red failure banner. `error` carries a
20
+ * one-line summary including the first row error message.
21
+ */
22
+ export interface ImportState {
23
+ file: File | null;
24
+ fileName: string | null;
25
+ parsedSecrets: ParsedSecret[];
26
+ encodedBackup: string | null;
27
+ sourceType: 'plain' | 'backup' | null;
28
+ error: string | null;
29
+ status: 'idle' | 'parsing' | 'ready' | 'importing' | 'completed' | 'partial' | 'skipped' | 'error';
30
+ results?: {
31
+ imported: number;
32
+ skipped: number;
33
+ errors: string[];
34
+ };
35
+ }
36
+ export interface BackupExportResult {
37
+ fileId: string;
38
+ fileName: string;
39
+ downloadUrl: string;
40
+ count: number;
41
+ format: string;
42
+ passwordDelivered: boolean;
43
+ deliveryStatus: string;
44
+ }
45
+ export declare function useImportExport(): {
46
+ importState: ImportState;
47
+ importing: boolean;
48
+ exporting: boolean;
49
+ handleFileSelect: (file: File) => Promise<void>;
50
+ executeImport: (vaultId: string, backupPassword?: string) => Promise<void>;
51
+ resetImport: () => void;
52
+ createBackup: (vaultId: string, selectedSecretIds?: string[]) => Promise<BackupExportResult>;
53
+ };
@@ -4,13 +4,13 @@ import { parseImportFile as r } from "../utils/fileParser.js";
4
4
  import { useCallback as i, useState as a } from "react";
5
5
  import { gql as o } from "@apollo/client";
6
6
  import { useMutation as s } from "@apollo/client/react";
7
- //#region src/security/hooks/useImportExport.ts
7
+ // src/security/hooks/useImportExport.ts
8
8
  var c = 140;
9
9
  function l(e) {
10
10
  let t = e.trim();
11
11
  if (t.length <= c) return t;
12
12
  let n = [...t];
13
- return n.length <= c ? t : `${n.slice(0, c - 1).join("")}…`;
13
+ return n.length <= c ? t : `${n.slice(0, 139).join("")}…`;
14
14
  }
15
15
  var u = [e], d = new Map(Object.values(n).map((e) => [e.toUpperCase(), e]));
16
16
  function f(e) {
@@ -142,7 +142,7 @@ function _() {
142
142
  h = "partial";
143
143
  let t = e.parsedSecrets.length;
144
144
  g = `Imported ${a.imported} of ${t} secrets — ${a.errors.length} failed${m ? `, ${a.skipped} skipped` : ""}. First error: ${s}`;
145
- } else !c && m ? (h = "skipped", g = `Nothing imported: ${a.skipped} duplicate secret${a.skipped === 1 ? "" : "s"} skipped`) : !c && !u && !m && (h = "skipped", g = "Nothing was imported — the server returned an empty result.");
145
+ } else !c && m ? (h = "skipped", g = `Nothing imported: ${a.skipped} duplicate secret${a.skipped === 1 ? "" : "s"} skipped`) : c || u || m || (h = "skipped", g = "Nothing was imported — the server returned an empty result.");
146
146
  let _ = !c && !u && !m;
147
147
  n((e) => ({
148
148
  ...e,
@@ -195,7 +195,6 @@ function _() {
195
195
  createBackup: C
196
196
  };
197
197
  }
198
- //#endregion
199
198
  export { _ as useImportExport };
200
199
 
201
200
  //# sourceMappingURL=useImportExport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useImportExport.js","names":[],"sources":["../../../src/security/hooks/useImportExport.ts"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation } from '@apollo/client/react';\nimport {\n GetSecretsDocument,\n useBulkCreateSecretsMutation,\n} from '../../generated/wspace-operations';\nimport { SecretType } from '../../generated/wspace-types';\nimport { parseImportFile, type ParsedSecret } from '../utils/fileParser';\n\n/** Maximum length for the truncated server error string we display in the wizard banner. */\nconst MAX_BANNER_ERROR_LENGTH = 140;\n\n/**\n * Truncate raw server error strings before they are interpolated into\n * the wizard's banner. The gateway is supposed to normalise its errors\n * but a raw Prisma message (\"Unique constraint failed on field `key`\")\n * would otherwise leak schema details into the UI. The full text is\n * still available on `results.errors` for the per-row error list.\n *\n * Iterates over Unicode code points via the spread iterator (not the\n * UTF-16 code units that `String.prototype.slice` uses) so a truncation\n * boundary cannot land in the middle of a surrogate pair and produce a\n * mangled emoji or Asian-script character.\n */\nfunction summarizeError(raw: string): string {\n const trimmed = raw.trim();\n if (trimmed.length <= MAX_BANNER_ERROR_LENGTH) return trimmed;\n const codepoints = [...trimmed];\n if (codepoints.length <= MAX_BANNER_ERROR_LENGTH) return trimmed;\n return `${codepoints.slice(0, MAX_BANNER_ERROR_LENGTH - 1).join('')}…`;\n}\n\nconst REFETCH_VAULT_SECRETS = [GetSecretsDocument];\n\n/**\n * Lookup table from \"uppercased enum value\" to the canonical SecretType\n * enum entry, derived directly from codegen output. Using a Map keyed by\n * the uppercased value makes this robust regardless of whether the\n * codegen emits values in SCREAMING_SNAKE_CASE (current) or in some\n * other casing in the future. A future enum addition will surface here\n * as a type error rather than as a runtime \"invalid enum value\" rejection\n * from the gateway.\n *\n * Anything we cannot map falls back to TEXT, matching\n * `fileParser.normalizeSecret`'s default for blank columns. Unknown\n * inputs also emit a `console.warn` in non-production builds so a\n * typo in a CSV `type` column (e.g. \"CERTIFCATE\") doesn't silently\n * import the row as TEXT.\n */\nconst SECRET_TYPE_BY_UPPER: ReadonlyMap<string, SecretType> = new Map(\n Object.values(SecretType).map((value) => [value.toUpperCase(), value])\n);\n\nfunction coerceSecretType(input: string | undefined): SecretType {\n if (!input) return SecretType.Text;\n const normalized = input.trim().toUpperCase();\n return SECRET_TYPE_BY_UPPER.get(normalized) ?? SecretType.Text;\n}\n\n/**\n * Walk the parsed-secrets list and emit a single `console.warn`\n * summarising every unrecognised `type` value before the bulk\n * mutation runs, instead of `coerceSecretType` itself logging once\n * per row. This:\n * - de-duplicates noisy retry warnings if the user re-runs\n * `executeImport` against the same parsed file (e.g. after a\n * transient network error)\n * - prevents a typo'd row from silently importing as TEXT without\n * any signal in the browser console\n *\n * Uses one log line containing the full set of bad type values so a\n * 100-row CSV with 50 different typos doesn't spam the console with\n * 50 separate warnings.\n */\nfunction logUnknownSecretTypesOnce(secrets: ReadonlyArray<{ type?: string }>): void {\n const unknown = new Set<string>();\n for (const s of secrets) {\n const raw = s.type?.trim();\n if (!raw) continue;\n if (!SECRET_TYPE_BY_UPPER.has(raw.toUpperCase())) {\n unknown.add(raw);\n }\n }\n if (unknown.size === 0) return;\n // eslint-disable-next-line no-console\n console.warn(\n `[useImportExport] Unrecognized secret types — falling back to TEXT: ` +\n `${[...unknown].join(', ')}. Valid values: ${[...SECRET_TYPE_BY_UPPER.keys()].join(', ')}`\n );\n}\n\nconst CREATE_VAULT_BACKUP_MUTATION = gql`\n mutation CreateVaultBackup($input: CreateVaultBackupInput!) {\n createVaultBackup(input: $input) {\n fileId\n fileName\n downloadUrl\n count\n format\n passwordDelivered\n deliveryStatus\n }\n }\n`;\n\nconst RESTORE_VAULT_BACKUP_MUTATION = gql`\n mutation RestoreVaultBackup($input: RestoreVaultBackupInput!) {\n restoreVaultBackup(input: $input) {\n imported\n skipped\n errors\n }\n }\n`;\n\n/**\n * Wizard state machine for plain/backup imports.\n *\n * `status` is the single source of truth for what the wizard should\n * render. Five terminal states are distinguished so consumers can light\n * up the right affordance without inspecting `results`:\n *\n * - `completed` — at least one row was created, with no row-level\n * errors. Green success banner.\n * - `partial` — at least one row was created AND at least one row\n * errored. Yellow / amber \"imported some but not all\" banner.\n * `error` carries a one-line summary; per-row detail is in\n * `results.errors`.\n * - `skipped` — zero imported, all rows were duplicates and skipped\n * (no row-level errors). Neutral \"nothing to import\" banner.\n * `error` carries a count message.\n * - `error` — zero imported AND every row errored, OR the\n * mutation itself threw. Red failure banner. `error` carries a\n * one-line summary including the first row error message.\n */\nexport interface ImportState {\n file: File | null;\n fileName: string | null;\n parsedSecrets: ParsedSecret[];\n encodedBackup: string | null;\n sourceType: 'plain' | 'backup' | null;\n error: string | null;\n status:\n | 'idle'\n | 'parsing'\n | 'ready'\n | 'importing'\n | 'completed'\n | 'partial'\n | 'skipped'\n | 'error';\n results?: {\n imported: number;\n skipped: number;\n errors: string[];\n };\n}\n\nexport interface BackupExportResult {\n fileId: string;\n fileName: string;\n downloadUrl: string;\n count: number;\n format: string;\n passwordDelivered: boolean;\n deliveryStatus: string;\n}\n\nfunction triggerDownload(url: string, fileName: string): void {\n const link = document.createElement('a');\n link.href = url;\n link.download = fileName;\n link.rel = 'noopener';\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n}\n\nexport function useImportExport() {\n const [importState, setImportState] = useState<ImportState>({\n file: null,\n fileName: null,\n parsedSecrets: [],\n encodedBackup: null,\n sourceType: null,\n error: null,\n status: 'idle',\n });\n\n const [bulkCreateMutation, { loading: bulkImporting }] = useBulkCreateSecretsMutation({\n // Refetch the vault's secret list so the detail page shows the freshly\n // imported rows. We deliberately do NOT pass `awaitRefetchQueries: true`\n // here so the success banner appears as soon as the mutation resolves;\n // the cache update happens in the background. The old per-row\n // `useCreateSecret` helper had the same property — it issued a refetch\n // per call but did not block the mutation promise on it.\n refetchQueries: REFETCH_VAULT_SECRETS,\n });\n const [restoreBackupMutation, { loading: restoringBackup }] = useMutation<{\n restoreVaultBackup: { imported: number; skipped: number; errors: string[] };\n }>(RESTORE_VAULT_BACKUP_MUTATION, {\n // Same parity as the bulk-import path: refetch GetSecrets so the\n // vault detail page picks up the restored rows. Background refetch —\n // see the bulkCreateMutation comment for why we don't await it.\n refetchQueries: REFETCH_VAULT_SECRETS,\n });\n const [createBackupMutation, { loading: creatingBackup }] = useMutation<{\n createVaultBackup: BackupExportResult;\n }>(CREATE_VAULT_BACKUP_MUTATION);\n\n const handleFileSelect = useCallback(async (file: File) => {\n setImportState((previous) => ({\n ...previous,\n status: 'parsing',\n file,\n fileName: file.name,\n error: null,\n results: undefined,\n }));\n\n try {\n const parsed = await parseImportFile(file);\n if (parsed.kind === 'backup') {\n setImportState((previous) => ({\n ...previous,\n status: 'ready',\n sourceType: 'backup',\n encodedBackup: parsed.encodedBackup,\n parsedSecrets: [],\n }));\n return;\n }\n\n setImportState((previous) => ({\n ...previous,\n status: 'ready',\n sourceType: 'plain',\n parsedSecrets: parsed.secrets,\n encodedBackup: null,\n }));\n } catch (error) {\n setImportState((previous) => ({\n ...previous,\n status: 'error',\n sourceType: null,\n encodedBackup: null,\n parsedSecrets: [],\n error: error instanceof Error ? error.message : 'Failed to parse file',\n }));\n }\n }, []);\n\n const executeImport = useCallback(\n async (vaultId: string, backupPassword?: string) => {\n if (!vaultId) return;\n\n setImportState((previous) => ({ ...previous, status: 'importing', error: null }));\n\n try {\n if (importState.sourceType === 'backup') {\n if (!importState.encodedBackup) {\n throw new Error('No backup payload is available for restore');\n }\n if (!backupPassword?.trim()) {\n throw new Error('Backup password is required to restore the archive');\n }\n\n const { data } = await restoreBackupMutation({\n variables: {\n input: {\n vaultId,\n data: importState.encodedBackup,\n password: backupPassword,\n overwriteExisting: false,\n },\n },\n });\n\n const result = data?.restoreVaultBackup;\n if (!result) {\n throw new Error('Restore completed without a response');\n }\n\n setImportState((previous) => ({\n ...previous,\n status: 'completed',\n results: result,\n }));\n return;\n }\n\n if (!importState.parsedSecrets.length) {\n throw new Error('No secrets available for import');\n }\n\n // Surface any unrecognized `type` columns once, before the\n // mutation runs, so a typo doesn't silently import the row as\n // TEXT without any signal in the browser console.\n logUnknownSecretTypesOnce(importState.parsedSecrets);\n\n // Plain CSV/JSON upload: hand off to the bulkCreateSecrets mutation\n // so the server batches encryption + version rows in one round-trip\n // and reports per-secret errors. The previous per-secret loop here\n // multiplied gateway calls by N and lost partial-failure detail.\n //\n // overwriteExisting is intentionally not set — the server defaults\n // to false (skip duplicates), and the `skipped` count in the\n // result drives the wizard's `'skipped'` / `'partial'` states.\n // If a future \"overwrite duplicates\" toggle is added to the UI,\n // forward it through here.\n const { data } = await bulkCreateMutation({\n variables: {\n input: {\n vaultId,\n secrets: importState.parsedSecrets.map((s) => ({\n name: s.name,\n key: s.key,\n value: s.value,\n type: coerceSecretType(s.type),\n description: s.description,\n })),\n },\n },\n });\n\n const bulkResult = data?.bulkCreateSecrets;\n if (!bulkResult) {\n throw new Error('Bulk import completed without a response');\n }\n\n const firstError = bulkResult.errors[0] ? summarizeError(bulkResult.errors[0]) : '';\n\n // Resolve the four terminal `status` values from the server's\n // (imported, skipped, errors) tuple. Each branch is mutually\n // exclusive and the resolved status, paired with the `error`\n // string, is the unambiguous signal the wizard renders against.\n const hasImports = bulkResult.imported > 0;\n const hasErrors = bulkResult.errors.length > 0;\n const hasSkips = bulkResult.skipped > 0;\n\n let nextStatus: ImportState['status'] = 'completed';\n let nextError: string | null = null;\n\n if (!hasImports && hasErrors) {\n nextStatus = 'error';\n nextError = `Import failed: ${bulkResult.errors.length} secret${\n bulkResult.errors.length === 1 ? '' : 's'\n } could not be created — ${firstError}`;\n } else if (hasImports && hasErrors) {\n nextStatus = 'partial';\n // Use the row count the user actually uploaded as the denominator\n // — server-side math (imported + errors + skipped) would\n // disagree with the wizard's preview if the gateway dedupes or\n // truncates rows.\n const totalRows = importState.parsedSecrets.length;\n nextError = `Imported ${bulkResult.imported} of ${totalRows} secrets — ${\n bulkResult.errors.length\n } failed${hasSkips ? `, ${bulkResult.skipped} skipped` : ''}. First error: ${firstError}`;\n } else if (!hasImports && hasSkips) {\n nextStatus = 'skipped';\n nextError = `Nothing imported: ${bulkResult.skipped} duplicate secret${\n bulkResult.skipped === 1 ? '' : 's'\n } skipped`;\n } else if (!hasImports && !hasErrors && !hasSkips) {\n // Defensive: server returned an empty result tuple. Should not\n // happen because we guard `parsedSecrets.length > 0` above, but\n // protect the wizard from showing a green \"Import complete\"\n // banner with a \"0 imported\" badge if the gateway ever filters\n // every row out before processing.\n nextStatus = 'skipped';\n nextError = 'Nothing was imported — the server returned an empty result.';\n }\n\n // For the empty-result defensive branch we deliberately omit\n // `results` so the wizard's terminal-state card renders the\n // error message alone, instead of an extra \"0 imported\" badge\n // row that would contradict the message.\n const isEmptyResult = !hasImports && !hasErrors && !hasSkips;\n\n setImportState((previous) => ({\n ...previous,\n status: nextStatus,\n results: isEmptyResult ? undefined : bulkResult,\n error: nextError,\n }));\n } catch (error) {\n setImportState((previous) => ({\n ...previous,\n status: 'error',\n error: error instanceof Error ? error.message : 'Import failed',\n }));\n }\n },\n [\n bulkCreateMutation,\n importState.encodedBackup,\n importState.parsedSecrets,\n importState.sourceType,\n restoreBackupMutation,\n ]\n );\n\n const resetImport = useCallback(() => {\n setImportState({\n file: null,\n fileName: null,\n parsedSecrets: [],\n encodedBackup: null,\n sourceType: null,\n error: null,\n status: 'idle',\n results: undefined,\n });\n }, []);\n\n // INTENTIONALLY NOT IMPLEMENTED: a plain `exportSecrets` query path.\n //\n // The wspace-security-svc schema exposes\n // `exportSecrets(vaultId, passphrase, secretIds)` as a GraphQL query,\n // but a *query* is the wrong transport for a flow that takes a\n // user-supplied passphrase: any persisted-query / GET link config\n // would put the cleartext passphrase on the URL and into HTTP access\n // logs. The dormant `exportSecrets.graphql` operation that used to\n // live in `src/operations/wspace/queries/` was deleted in BOFF-2225\n // for that reason — it had zero callers in `src/` outside the\n // generated codegen output.\n //\n // The export flow now goes exclusively through `createBackup` /\n // `CREATE_VAULT_BACKUP_MUTATION` (a POST mutation) which produces\n // an encrypted backup archive, uploads it via files-svc, and emails\n // the password via channel-svc. If a \"download as encrypted JSON\"\n // UI is needed in the future it should be added as a new mutation,\n // not by re-introducing the query.\n\n const createBackup = useCallback(\n async (vaultId: string, selectedSecretIds?: string[]): Promise<BackupExportResult> => {\n const { data, error } = await createBackupMutation({\n variables: {\n input: {\n vaultId,\n secretIds:\n selectedSecretIds && selectedSecretIds.length > 0 ? selectedSecretIds : undefined,\n },\n },\n });\n\n if (error) {\n throw error;\n }\n\n const result = data?.createVaultBackup;\n if (!result) {\n throw new Error('Backup completed without a response');\n }\n\n triggerDownload(result.downloadUrl, result.fileName);\n return result;\n },\n [createBackupMutation]\n );\n\n return {\n importState,\n importing: bulkImporting || restoringBackup,\n exporting: creatingBackup,\n handleFileSelect,\n executeImport,\n resetImport,\n createBackup,\n };\n}\n"],"mappings":";;;;;;;AAWA,IAAM,IAA0B;AAchC,SAAS,EAAe,GAAqB;CAC3C,IAAM,IAAU,EAAI,MAAM;AAC1B,KAAI,EAAQ,UAAU,EAAyB,QAAO;CACtD,IAAM,IAAa,CAAC,GAAG,EAAQ;AAE/B,QADI,EAAW,UAAU,IAAgC,IAClD,GAAG,EAAW,MAAM,GAAG,IAA0B,EAAE,CAAC,KAAK,GAAG,CAAC;;AAGtE,IAAM,IAAwB,CAAC,EAAmB,EAiB5C,IAAwD,IAAI,IAChE,OAAO,OAAO,EAAW,CAAC,KAAK,MAAU,CAAC,EAAM,aAAa,EAAE,EAAM,CAAC,CACvE;AAED,SAAS,EAAiB,GAAuC;AAC/D,KAAI,CAAC,EAAO,QAAO,EAAW;CAC9B,IAAM,IAAa,EAAM,MAAM,CAAC,aAAa;AAC7C,QAAO,EAAqB,IAAI,EAAW,IAAI,EAAW;;AAkB5D,SAAS,EAA0B,GAAiD;CAClF,IAAM,oBAAU,IAAI,KAAa;AACjC,MAAK,IAAM,KAAK,GAAS;EACvB,IAAM,IAAM,EAAE,MAAM,MAAM;AACrB,QACA,EAAqB,IAAI,EAAI,aAAa,CAAC,IAC9C,EAAQ,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AM,sCAAsC;AAIxD,SADA,EAAgB,EAAO,aAAa,EAAO,SAAS,EAC7C;IAET,CAAC,EAAqB,CACvB;AAED,QAAO;EACL;EACA,WAAW,KAAiB;EAC5B,WAAW;EACX;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"useImportExport.js","names":["MAX_BANNER_ERROR_LENGTH","summarizeError","trimmed","raw","codepoints","REFETCH_VAULT_SECRETS","GetSecretsDocument","SECRET_TYPE_BY_UPPER","SecretType","value","coerceSecretType","input","normalized","logUnknownSecretTypesOnce","unknown","s","secrets","CREATE_VAULT_BACKUP_MUTATION","RESTORE_VAULT_BACKUP_MUTATION","triggerDownload","link","url","fileName","useImportExport","importState","setImportState","useState","bulkCreateMutation","bulkImporting","useBulkCreateSecretsMutation","restoreBackupMutation","restoringBackup","useMutation","createBackupMutation","creatingBackup","handleFileSelect","useCallback","previous","file","parsed","parseImportFile","error","executeImport","vaultId","backupPassword","result","data","bulkResult","firstError","hasImports","hasErrors","hasSkips","nextStatus","nextError","totalRows","isEmptyResult","resetImport","createBackup","selectedSecretIds"],"sources":["../../../src/security/hooks/useImportExport.ts"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation } from '@apollo/client/react';\nimport {\n GetSecretsDocument,\n useBulkCreateSecretsMutation,\n} from '../../generated/wspace-operations';\nimport { SecretType } from '../../generated/wspace-types';\nimport { parseImportFile, type ParsedSecret } from '../utils/fileParser';\n\n/** Maximum length for the truncated server error string we display in the wizard banner. */\nconst MAX_BANNER_ERROR_LENGTH = 140;\n\n/**\n * Truncate raw server error strings before they are interpolated into\n * the wizard's banner. The gateway is supposed to normalise its errors\n * but a raw Prisma message (\"Unique constraint failed on field `key`\")\n * would otherwise leak schema details into the UI. The full text is\n * still available on `results.errors` for the per-row error list.\n *\n * Iterates over Unicode code points via the spread iterator (not the\n * UTF-16 code units that `String.prototype.slice` uses) so a truncation\n * boundary cannot land in the middle of a surrogate pair and produce a\n * mangled emoji or Asian-script character.\n */\nfunction summarizeError(raw: string): string {\n const trimmed = raw.trim();\n if (trimmed.length <= MAX_BANNER_ERROR_LENGTH) return trimmed;\n const codepoints = [...trimmed];\n if (codepoints.length <= MAX_BANNER_ERROR_LENGTH) return trimmed;\n return `${codepoints.slice(0, MAX_BANNER_ERROR_LENGTH - 1).join('')}…`;\n}\n\nconst REFETCH_VAULT_SECRETS = [GetSecretsDocument];\n\n/**\n * Lookup table from \"uppercased enum value\" to the canonical SecretType\n * enum entry, derived directly from codegen output. Using a Map keyed by\n * the uppercased value makes this robust regardless of whether the\n * codegen emits values in SCREAMING_SNAKE_CASE (current) or in some\n * other casing in the future. A future enum addition will surface here\n * as a type error rather than as a runtime \"invalid enum value\" rejection\n * from the gateway.\n *\n * Anything we cannot map falls back to TEXT, matching\n * `fileParser.normalizeSecret`'s default for blank columns. Unknown\n * inputs also emit a `console.warn` in non-production builds so a\n * typo in a CSV `type` column (e.g. \"CERTIFCATE\") doesn't silently\n * import the row as TEXT.\n */\nconst SECRET_TYPE_BY_UPPER: ReadonlyMap<string, SecretType> = new Map(\n Object.values(SecretType).map((value) => [value.toUpperCase(), value])\n);\n\nfunction coerceSecretType(input: string | undefined): SecretType {\n if (!input) return SecretType.Text;\n const normalized = input.trim().toUpperCase();\n return SECRET_TYPE_BY_UPPER.get(normalized) ?? SecretType.Text;\n}\n\n/**\n * Walk the parsed-secrets list and emit a single `console.warn`\n * summarising every unrecognised `type` value before the bulk\n * mutation runs, instead of `coerceSecretType` itself logging once\n * per row. This:\n * - de-duplicates noisy retry warnings if the user re-runs\n * `executeImport` against the same parsed file (e.g. after a\n * transient network error)\n * - prevents a typo'd row from silently importing as TEXT without\n * any signal in the browser console\n *\n * Uses one log line containing the full set of bad type values so a\n * 100-row CSV with 50 different typos doesn't spam the console with\n * 50 separate warnings.\n */\nfunction logUnknownSecretTypesOnce(secrets: ReadonlyArray<{ type?: string }>): void {\n const unknown = new Set<string>();\n for (const s of secrets) {\n const raw = s.type?.trim();\n if (!raw) continue;\n if (!SECRET_TYPE_BY_UPPER.has(raw.toUpperCase())) {\n unknown.add(raw);\n }\n }\n if (unknown.size === 0) return;\n console.warn(\n `[useImportExport] Unrecognized secret types — falling back to TEXT: ` +\n `${[...unknown].join(', ')}. Valid values: ${[...SECRET_TYPE_BY_UPPER.keys()].join(', ')}`\n );\n}\n\nconst CREATE_VAULT_BACKUP_MUTATION = gql`\n mutation CreateVaultBackup($input: CreateVaultBackupInput!) {\n createVaultBackup(input: $input) {\n fileId\n fileName\n downloadUrl\n count\n format\n passwordDelivered\n deliveryStatus\n }\n }\n`;\n\nconst RESTORE_VAULT_BACKUP_MUTATION = gql`\n mutation RestoreVaultBackup($input: RestoreVaultBackupInput!) {\n restoreVaultBackup(input: $input) {\n imported\n skipped\n errors\n }\n }\n`;\n\n/**\n * Wizard state machine for plain/backup imports.\n *\n * `status` is the single source of truth for what the wizard should\n * render. Five terminal states are distinguished so consumers can light\n * up the right affordance without inspecting `results`:\n *\n * - `completed` — at least one row was created, with no row-level\n * errors. Green success banner.\n * - `partial` — at least one row was created AND at least one row\n * errored. Yellow / amber \"imported some but not all\" banner.\n * `error` carries a one-line summary; per-row detail is in\n * `results.errors`.\n * - `skipped` — zero imported, all rows were duplicates and skipped\n * (no row-level errors). Neutral \"nothing to import\" banner.\n * `error` carries a count message.\n * - `error` — zero imported AND every row errored, OR the\n * mutation itself threw. Red failure banner. `error` carries a\n * one-line summary including the first row error message.\n */\nexport interface ImportState {\n file: File | null;\n fileName: string | null;\n parsedSecrets: ParsedSecret[];\n encodedBackup: string | null;\n sourceType: 'plain' | 'backup' | null;\n error: string | null;\n status:\n 'idle' | 'parsing' | 'ready' | 'importing' | 'completed' | 'partial' | 'skipped' | 'error';\n results?: {\n imported: number;\n skipped: number;\n errors: string[];\n };\n}\n\nexport interface BackupExportResult {\n fileId: string;\n fileName: string;\n downloadUrl: string;\n count: number;\n format: string;\n passwordDelivered: boolean;\n deliveryStatus: string;\n}\n\nfunction triggerDownload(url: string, fileName: string): void {\n const link = document.createElement('a');\n link.href = url;\n link.download = fileName;\n link.rel = 'noopener';\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n}\n\nexport function useImportExport() {\n const [importState, setImportState] = useState<ImportState>({\n file: null,\n fileName: null,\n parsedSecrets: [],\n encodedBackup: null,\n sourceType: null,\n error: null,\n status: 'idle',\n });\n\n const [bulkCreateMutation, { loading: bulkImporting }] = useBulkCreateSecretsMutation({\n // Refetch the vault's secret list so the detail page shows the freshly\n // imported rows. We deliberately do NOT pass `awaitRefetchQueries: true`\n // here so the success banner appears as soon as the mutation resolves;\n // the cache update happens in the background. The old per-row\n // `useCreateSecret` helper had the same property — it issued a refetch\n // per call but did not block the mutation promise on it.\n refetchQueries: REFETCH_VAULT_SECRETS,\n });\n const [restoreBackupMutation, { loading: restoringBackup }] = useMutation<{\n restoreVaultBackup: { imported: number; skipped: number; errors: string[] };\n }>(RESTORE_VAULT_BACKUP_MUTATION, {\n // Same parity as the bulk-import path: refetch GetSecrets so the\n // vault detail page picks up the restored rows. Background refetch —\n // see the bulkCreateMutation comment for why we don't await it.\n refetchQueries: REFETCH_VAULT_SECRETS,\n });\n const [createBackupMutation, { loading: creatingBackup }] = useMutation<{\n createVaultBackup: BackupExportResult;\n }>(CREATE_VAULT_BACKUP_MUTATION);\n\n const handleFileSelect = useCallback(async (file: File) => {\n setImportState((previous) => ({\n ...previous,\n status: 'parsing',\n file,\n fileName: file.name,\n error: null,\n results: undefined,\n }));\n\n try {\n const parsed = await parseImportFile(file);\n if (parsed.kind === 'backup') {\n setImportState((previous) => ({\n ...previous,\n status: 'ready',\n sourceType: 'backup',\n encodedBackup: parsed.encodedBackup,\n parsedSecrets: [],\n }));\n return;\n }\n\n setImportState((previous) => ({\n ...previous,\n status: 'ready',\n sourceType: 'plain',\n parsedSecrets: parsed.secrets,\n encodedBackup: null,\n }));\n } catch (error) {\n setImportState((previous) => ({\n ...previous,\n status: 'error',\n sourceType: null,\n encodedBackup: null,\n parsedSecrets: [],\n error: error instanceof Error ? error.message : 'Failed to parse file',\n }));\n }\n }, []);\n\n const executeImport = useCallback(\n async (vaultId: string, backupPassword?: string) => {\n if (!vaultId) return;\n\n setImportState((previous) => ({ ...previous, status: 'importing', error: null }));\n\n try {\n if (importState.sourceType === 'backup') {\n if (!importState.encodedBackup) {\n throw new Error('No backup payload is available for restore');\n }\n if (!backupPassword?.trim()) {\n throw new Error('Backup password is required to restore the archive');\n }\n\n const { data } = await restoreBackupMutation({\n variables: {\n input: {\n vaultId,\n data: importState.encodedBackup,\n password: backupPassword,\n overwriteExisting: false,\n },\n },\n });\n\n const result = data?.restoreVaultBackup;\n if (!result) {\n throw new Error('Restore completed without a response');\n }\n\n setImportState((previous) => ({\n ...previous,\n status: 'completed',\n results: result,\n }));\n return;\n }\n\n if (!importState.parsedSecrets.length) {\n throw new Error('No secrets available for import');\n }\n\n // Surface any unrecognized `type` columns once, before the\n // mutation runs, so a typo doesn't silently import the row as\n // TEXT without any signal in the browser console.\n logUnknownSecretTypesOnce(importState.parsedSecrets);\n\n // Plain CSV/JSON upload: hand off to the bulkCreateSecrets mutation\n // so the server batches encryption + version rows in one round-trip\n // and reports per-secret errors. The previous per-secret loop here\n // multiplied gateway calls by N and lost partial-failure detail.\n //\n // overwriteExisting is intentionally not set — the server defaults\n // to false (skip duplicates), and the `skipped` count in the\n // result drives the wizard's `'skipped'` / `'partial'` states.\n // If a future \"overwrite duplicates\" toggle is added to the UI,\n // forward it through here.\n const { data } = await bulkCreateMutation({\n variables: {\n input: {\n vaultId,\n secrets: importState.parsedSecrets.map((s) => ({\n name: s.name,\n key: s.key,\n value: s.value,\n type: coerceSecretType(s.type),\n description: s.description,\n })),\n },\n },\n });\n\n const bulkResult = data?.bulkCreateSecrets;\n if (!bulkResult) {\n throw new Error('Bulk import completed without a response');\n }\n\n const firstError = bulkResult.errors[0] ? summarizeError(bulkResult.errors[0]) : '';\n\n // Resolve the four terminal `status` values from the server's\n // (imported, skipped, errors) tuple. Each branch is mutually\n // exclusive and the resolved status, paired with the `error`\n // string, is the unambiguous signal the wizard renders against.\n const hasImports = bulkResult.imported > 0;\n const hasErrors = bulkResult.errors.length > 0;\n const hasSkips = bulkResult.skipped > 0;\n\n let nextStatus: ImportState['status'] = 'completed';\n let nextError: string | null = null;\n\n if (!hasImports && hasErrors) {\n nextStatus = 'error';\n nextError = `Import failed: ${bulkResult.errors.length} secret${\n bulkResult.errors.length === 1 ? '' : 's'\n } could not be created — ${firstError}`;\n } else if (hasImports && hasErrors) {\n nextStatus = 'partial';\n // Use the row count the user actually uploaded as the denominator\n // — server-side math (imported + errors + skipped) would\n // disagree with the wizard's preview if the gateway dedupes or\n // truncates rows.\n const totalRows = importState.parsedSecrets.length;\n nextError = `Imported ${bulkResult.imported} of ${totalRows} secrets — ${\n bulkResult.errors.length\n } failed${hasSkips ? `, ${bulkResult.skipped} skipped` : ''}. First error: ${firstError}`;\n } else if (!hasImports && hasSkips) {\n nextStatus = 'skipped';\n nextError = `Nothing imported: ${bulkResult.skipped} duplicate secret${\n bulkResult.skipped === 1 ? '' : 's'\n } skipped`;\n } else if (!hasImports && !hasErrors && !hasSkips) {\n // Defensive: server returned an empty result tuple. Should not\n // happen because we guard `parsedSecrets.length > 0` above, but\n // protect the wizard from showing a green \"Import complete\"\n // banner with a \"0 imported\" badge if the gateway ever filters\n // every row out before processing.\n nextStatus = 'skipped';\n nextError = 'Nothing was imported — the server returned an empty result.';\n }\n\n // For the empty-result defensive branch we deliberately omit\n // `results` so the wizard's terminal-state card renders the\n // error message alone, instead of an extra \"0 imported\" badge\n // row that would contradict the message.\n const isEmptyResult = !hasImports && !hasErrors && !hasSkips;\n\n setImportState((previous) => ({\n ...previous,\n status: nextStatus,\n results: isEmptyResult ? undefined : bulkResult,\n error: nextError,\n }));\n } catch (error) {\n setImportState((previous) => ({\n ...previous,\n status: 'error',\n error: error instanceof Error ? error.message : 'Import failed',\n }));\n }\n },\n [\n bulkCreateMutation,\n importState.encodedBackup,\n importState.parsedSecrets,\n importState.sourceType,\n restoreBackupMutation,\n ]\n );\n\n const resetImport = useCallback(() => {\n setImportState({\n file: null,\n fileName: null,\n parsedSecrets: [],\n encodedBackup: null,\n sourceType: null,\n error: null,\n status: 'idle',\n results: undefined,\n });\n }, []);\n\n // INTENTIONALLY NOT IMPLEMENTED: a plain `exportSecrets` query path.\n //\n // The wspace-security-svc schema exposes\n // `exportSecrets(vaultId, passphrase, secretIds)` as a GraphQL query,\n // but a *query* is the wrong transport for a flow that takes a\n // user-supplied passphrase: any persisted-query / GET link config\n // would put the cleartext passphrase on the URL and into HTTP access\n // logs. The dormant `exportSecrets.graphql` operation that used to\n // live in `src/operations/wspace/queries/` was deleted in BOFF-2225\n // for that reason — it had zero callers in `src/` outside the\n // generated codegen output.\n //\n // The export flow now goes exclusively through `createBackup` /\n // `CREATE_VAULT_BACKUP_MUTATION` (a POST mutation) which produces\n // an encrypted backup archive, uploads it via files-svc, and emails\n // the password via channel-svc. If a \"download as encrypted JSON\"\n // UI is needed in the future it should be added as a new mutation,\n // not by re-introducing the query.\n\n const createBackup = useCallback(\n async (vaultId: string, selectedSecretIds?: string[]): Promise<BackupExportResult> => {\n const { data, error } = await createBackupMutation({\n variables: {\n input: {\n vaultId,\n secretIds:\n selectedSecretIds && selectedSecretIds.length > 0 ? selectedSecretIds : undefined,\n },\n },\n });\n\n if (error) {\n throw error;\n }\n\n const result = data?.createVaultBackup;\n if (!result) {\n throw new Error('Backup completed without a response');\n }\n\n triggerDownload(result.downloadUrl, result.fileName);\n return result;\n },\n [createBackupMutation]\n );\n\n return {\n importState,\n importing: bulkImporting || restoringBackup,\n exporting: creatingBackup,\n handleFileSelect,\n executeImport,\n resetImport,\n createBackup,\n };\n}\n"],"mappings":";;;;;;;AAWA,IAAMA,IAA0B;AAchC,SAASC,EAAe,GAAqB;CAC3C,IAAMC,IAAUC,EAAI,KAAK;CACzB,IAAID,EAAQ,UAAUF,GAAyB,OAAOE;CACtD,IAAME,I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BJ,EAAW,QAAQ,mBAClDA,EAAW,YAAY,IAAI,KAAK,IACjC,aACSE,KAAeC,KAAcC,MAMvC,IAAa,WACb,IAAY;IAOd,IAAMI,IAAgB,CAACN,KAAc,CAACC,KAAa,CAACC;IAEpD,GAAgB,OAAc;KAC5B,GAAGd;KACH,QAAQe;KACR,SAASG,IAAgB,KAAA,IAAYR;KACrC,OAAOM;IACT,EAAE;GACJ,SAASZ,GAAO;IACd,GAAgB,OAAc;KAC5B,GAAGJ;KACH,QAAQ;KACR,OAAOI,aAAiB,QAAQA,EAAM,UAAU;IAClD,EAAE;GACJ;EAvIgF;CAwIlF,GACA;EACEd;EACAH,EAAY;EACZA,EAAY;EACZA,EAAY;EACZM;CACF,CACF,GAEM0B,IAAcpB,QAAkB;EACpC,EAAe;GACb,MAAM;GACN,UAAU;GACV,eAAe,CAAC;GAChB,eAAe;GACf,YAAY;GACZ,OAAO;GACP,QAAQ;GACR,SAAS,KAAA;EACX,CAAC;CACH,GAAG,CAAC,CAAC,GAqBCqB,IAAerB,EACnB,OAAO,GAAiB,MAA8D;EACpF,IAAM,EAAE,SAAM,aAAU,MAAMH,EAAqB,EACjD,WAAW,EACT,OAAO;GACL;GACA,WACEyB,KAAqBA,EAAkB,SAAS,IAAIA,IAAoB,KAAA;EAC5E,EACF,EACF,CAAC;EAED,IAAIjB,GACF,MAAMA;EAGR,IAAMI,IAASC,GAAM;EACrB,IAAI,CAACD,GACH,MAAU,MAAM,qCAAqC;EAIvD,OADA1B,EAAgB0B,EAAO,aAAaA,EAAO,QAAQ,GAC5CA;CACT,GACA,CAACZ,CAAoB,CACvB;CAEA,OAAO;EACL;EACA,WAAWL,KAAiBG;EAC5B,WAAWG;EACX;EACA;EACA;EACA;CACF;AACF"}
@@ -0,0 +1,9 @@
1
+ import { VaultSyncLogFilterInput, SecurityPaginationInput } from '../../generated/wspace-types';
2
+ export declare function useVaultIntegrations(vaultId: string | undefined): import('@apollo/client/react').useQuery.Result<Types.GetVaultIntegrationsQuery, Types.GetVaultIntegrationsQueryVariables, "empty" | "complete" | "streaming", Types.GetVaultIntegrationsQueryVariables, undefined>;
3
+ export declare function useDeleteIntegration(): import('@apollo/client/react').useMutation.ResultTuple<Types.DeleteVaultIntegrationMutation, any, import('@apollo/client').ApolloCache, undefined>;
4
+ /** BOFF-9741: external secret providers. */
5
+ export declare function useCreateExternalSecretProvider(): import('@apollo/client/react').useMutation.ResultTuple<Types.CreateExternalSecretProviderMutation, any, import('@apollo/client').ApolloCache, undefined>;
6
+ export declare function useUpdateExternalSecretProvider(): import('@apollo/client/react').useMutation.ResultTuple<Types.UpdateExternalSecretProviderMutation, any, import('@apollo/client').ApolloCache, undefined>;
7
+ export declare function useTestExternalSecretProvider(): import('@apollo/client/react').useMutation.ResultTuple<Types.TestExternalSecretProviderMutation, any, import('@apollo/client').ApolloCache, undefined>;
8
+ export declare function useTriggerSync(): import('@apollo/client/react').useMutation.ResultTuple<Types.TriggerVaultSyncMutation, any, import('@apollo/client').ApolloCache, undefined>;
9
+ export declare function useVaultSyncLogs(integrationId: string | undefined, filter?: VaultSyncLogFilterInput, pagination?: SecurityPaginationInput): import('@apollo/client/react').useQuery.Result<Types.GetVaultSyncLogsQuery, Types.GetVaultSyncLogsQueryVariables, "empty" | "complete" | "streaming", Types.GetVaultSyncLogsQueryVariables, undefined>;
@@ -1,5 +1,5 @@
1
1
  import { useCreateExternalSecretProviderMutation as e, useDeleteVaultIntegrationMutation as t, useGetVaultIntegrationsQuery as n, useGetVaultSyncLogsQuery as r, useTestExternalSecretProviderMutation as i, useTriggerVaultSyncMutation as a, useUpdateExternalSecretProviderMutation as o } from "../../generated/wspace-operations.js";
2
- //#region src/security/hooks/useProviderQueries.ts
2
+ // src/security/hooks/useProviderQueries.ts
3
3
  function s(e) {
4
4
  return n({
5
5
  variables: { vaultId: e ?? "" },
@@ -33,7 +33,6 @@ function p(e, t, n) {
33
33
  fetchPolicy: "network-only"
34
34
  });
35
35
  }
36
- //#endregion
37
36
  export { l as useCreateExternalSecretProvider, c as useDeleteIntegration, d as useTestExternalSecretProvider, f as useTriggerSync, u as useUpdateExternalSecretProvider, s as useVaultIntegrations, p as useVaultSyncLogs };
38
37
 
39
38
  //# sourceMappingURL=useProviderQueries.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProviderQueries.js","names":[],"sources":["../../../src/security/hooks/useProviderQueries.ts"],"sourcesContent":["import {\n useCreateExternalSecretProviderMutation,\n useTestExternalSecretProviderMutation,\n useUpdateExternalSecretProviderMutation,\n useGetVaultIntegrationsQuery,\n useDeleteVaultIntegrationMutation,\n useTriggerVaultSyncMutation,\n useGetVaultSyncLogsQuery,\n} from '../../generated/wspace-operations';\nimport type {\n VaultSyncLogFilterInput,\n SecurityPaginationInput,\n} from '../../generated/wspace-types';\n\nexport function useVaultIntegrations(vaultId: string | undefined) {\n return useGetVaultIntegrationsQuery({\n variables: { vaultId: vaultId ?? '' },\n skip: !vaultId,\n fetchPolicy: 'network-only',\n });\n}\n\nexport function useDeleteIntegration() {\n return useDeleteVaultIntegrationMutation({\n refetchQueries: ['GetVaultIntegrations'],\n });\n}\n\n/** BOFF-9741: external secret providers. */\nexport function useCreateExternalSecretProvider() {\n return useCreateExternalSecretProviderMutation({ refetchQueries: ['GetVaultIntegrations'] });\n}\n\nexport function useUpdateExternalSecretProvider() {\n return useUpdateExternalSecretProviderMutation({ refetchQueries: ['GetVaultIntegrations'] });\n}\n\nexport function useTestExternalSecretProvider() {\n return useTestExternalSecretProviderMutation({ refetchQueries: ['GetVaultIntegrations'] });\n}\n\nexport function useTriggerSync() {\n return useTriggerVaultSyncMutation({\n refetchQueries: ['GetVaultSyncLogs'],\n });\n}\n\nexport function useVaultSyncLogs(\n integrationId: string | undefined,\n filter?: VaultSyncLogFilterInput,\n pagination?: SecurityPaginationInput\n) {\n return useGetVaultSyncLogsQuery({\n variables: {\n integrationId: integrationId ?? '',\n filter,\n pagination,\n },\n skip: !integrationId,\n fetchPolicy: 'network-only',\n });\n}\n"],"mappings":";;AAcA,SAAgB,EAAqB,GAA6B;AAChE,QAAO,EAA6B;EAClC,WAAW,EAAE,SAAS,KAAW,IAAI;EACrC,MAAM,CAAC;EACP,aAAa;EACd,CAAC;;AAGJ,SAAgB,IAAuB;AACrC,QAAO,EAAkC,EACvC,gBAAgB,CAAC,uBAAuB,EACzC,CAAC;;AAIJ,SAAgB,IAAkC;AAChD,QAAO,EAAwC,EAAE,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;;AAG9F,SAAgB,IAAkC;AAChD,QAAO,EAAwC,EAAE,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;;AAG9F,SAAgB,IAAgC;AAC9C,QAAO,EAAsC,EAAE,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;;AAG5F,SAAgB,IAAiB;AAC/B,QAAO,EAA4B,EACjC,gBAAgB,CAAC,mBAAmB,EACrC,CAAC;;AAGJ,SAAgB,EACd,GACA,GACA,GACA;AACA,QAAO,EAAyB;EAC9B,WAAW;GACT,eAAe,KAAiB;GAChC;GACA;GACD;EACD,MAAM,CAAC;EACP,aAAa;EACd,CAAC"}
1
+ {"version":3,"file":"useProviderQueries.js","names":["useVaultIntegrations","useGetVaultIntegrationsQuery","vaultId","useDeleteIntegration","useDeleteVaultIntegrationMutation","useCreateExternalSecretProvider","useCreateExternalSecretProviderMutation","useUpdateExternalSecretProvider","useUpdateExternalSecretProviderMutation","useTestExternalSecretProvider","useTestExternalSecretProviderMutation","useTriggerSync","useTriggerVaultSyncMutation","useVaultSyncLogs","useGetVaultSyncLogsQuery","integrationId"],"sources":["../../../src/security/hooks/useProviderQueries.ts"],"sourcesContent":["import {\n useCreateExternalSecretProviderMutation,\n useTestExternalSecretProviderMutation,\n useUpdateExternalSecretProviderMutation,\n useGetVaultIntegrationsQuery,\n useDeleteVaultIntegrationMutation,\n useTriggerVaultSyncMutation,\n useGetVaultSyncLogsQuery,\n} from '../../generated/wspace-operations';\nimport type {\n VaultSyncLogFilterInput,\n SecurityPaginationInput,\n} from '../../generated/wspace-types';\n\nexport function useVaultIntegrations(vaultId: string | undefined) {\n return useGetVaultIntegrationsQuery({\n variables: { vaultId: vaultId ?? '' },\n skip: !vaultId,\n fetchPolicy: 'network-only',\n });\n}\n\nexport function useDeleteIntegration() {\n return useDeleteVaultIntegrationMutation({\n refetchQueries: ['GetVaultIntegrations'],\n });\n}\n\n/** BOFF-9741: external secret providers. */\nexport function useCreateExternalSecretProvider() {\n return useCreateExternalSecretProviderMutation({ refetchQueries: ['GetVaultIntegrations'] });\n}\n\nexport function useUpdateExternalSecretProvider() {\n return useUpdateExternalSecretProviderMutation({ refetchQueries: ['GetVaultIntegrations'] });\n}\n\nexport function useTestExternalSecretProvider() {\n return useTestExternalSecretProviderMutation({ refetchQueries: ['GetVaultIntegrations'] });\n}\n\nexport function useTriggerSync() {\n return useTriggerVaultSyncMutation({\n refetchQueries: ['GetVaultSyncLogs'],\n });\n}\n\nexport function useVaultSyncLogs(\n integrationId: string | undefined,\n filter?: VaultSyncLogFilterInput,\n pagination?: SecurityPaginationInput\n) {\n return useGetVaultSyncLogsQuery({\n variables: {\n integrationId: integrationId ?? '',\n filter,\n pagination,\n },\n skip: !integrationId,\n fetchPolicy: 'network-only',\n });\n}\n"],"mappings":";;AAcA,SAAgBA,EAAqB,GAA6B;CAChE,OAAOC,EAA6B;EAClC,WAAW,EAAE,SAASC,KAAW,GAAG;EACpC,MAAM,CAACA;EACP,aAAa;CACf,CAAC;AACH;AAEA,SAAgBC,IAAuB;CACrC,OAAOC,EAAkC,EACvC,gBAAgB,CAAC,sBAAsB,EACzC,CAAC;AACH;AAGA,SAAgBC,IAAkC;CAChD,OAAOC,EAAwC,EAAE,gBAAgB,CAAC,sBAAsB,EAAE,CAAC;AAC7F;AAEA,SAAgBC,IAAkC;CAChD,OAAOC,EAAwC,EAAE,gBAAgB,CAAC,sBAAsB,EAAE,CAAC;AAC7F;AAEA,SAAgBC,IAAgC;CAC9C,OAAOC,EAAsC,EAAE,gBAAgB,CAAC,sBAAsB,EAAE,CAAC;AAC3F;AAEA,SAAgBC,IAAiB;CAC/B,OAAOC,EAA4B,EACjC,gBAAgB,CAAC,kBAAkB,EACrC,CAAC;AACH;AAEA,SAAgBC,EACd,GACA,GACA,GACA;CACA,OAAOC,EAAyB;EAC9B,WAAW;GACT,eAAeC,KAAiB;GAChC;GACA;EACF;EACA,MAAM,CAACA;EACP,aAAa;CACf,CAAC;AACH"}
@@ -0,0 +1,7 @@
1
+ import { SecretFilterInput, SecurityPaginationInput } from '../../generated/wspace-types';
2
+ export declare function useGetSecrets(vaultId: string | undefined, filter?: SecretFilterInput, pagination?: SecurityPaginationInput): import('@apollo/client/react').useQuery.Result<Types.GetSecretsQuery, Types.GetSecretsQueryVariables, "empty" | "complete" | "streaming", Types.GetSecretsQueryVariables, undefined>;
3
+ export declare function useGetSecret(id: string | null): import('@apollo/client/react').useQuery.Result<Types.GetSecretQuery, Types.GetSecretQueryVariables, "empty" | "complete" | "streaming", Types.GetSecretQueryVariables, undefined>;
4
+ export declare function useCreateSecret(): import('@apollo/client/react').useMutation.ResultTuple<Types.CreateSecretMutation, any, import('@apollo/client').ApolloCache, undefined>;
5
+ export declare function useDeleteSecret(): import('@apollo/client/react').useMutation.ResultTuple<Types.DeleteSecretMutation, any, import('@apollo/client').ApolloCache, undefined>;
6
+ export declare function useRotateSecret(): import('@apollo/client/react').useMutation.ResultTuple<Types.RotateSecretMutation, any, import('@apollo/client').ApolloCache, undefined>;
7
+ export declare function useRollbackSecret(): import('@apollo/client/react').useMutation.ResultTuple<Types.RollbackSecretMutation, any, import('@apollo/client').ApolloCache, undefined>;
@@ -1,5 +1,5 @@
1
1
  import { useCreateSecretMutation as e, useDeleteSecretMutation as t, useGetSecretQuery as n, useGetSecretsQuery as r, useRollbackSecretMutation as i, useRotateSecretMutation as a } from "../../generated/wspace-operations.js";
2
- //#region src/security/hooks/useSecretQueries.ts
2
+ // src/security/hooks/useSecretQueries.ts
3
3
  function o(e, t, n) {
4
4
  return r({
5
5
  variables: {
@@ -30,7 +30,6 @@ function u() {
30
30
  function d() {
31
31
  return i();
32
32
  }
33
- //#endregion
34
33
  export { c as useCreateSecret, l as useDeleteSecret, s as useGetSecret, o as useGetSecrets, d as useRollbackSecret, u as useRotateSecret };
35
34
 
36
35
  //# sourceMappingURL=useSecretQueries.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSecretQueries.js","names":[],"sources":["../../../src/security/hooks/useSecretQueries.ts"],"sourcesContent":["import {\n useGetSecretsQuery,\n useGetSecretQuery,\n useCreateSecretMutation,\n useDeleteSecretMutation,\n useRotateSecretMutation,\n useRollbackSecretMutation,\n} from '../../generated/wspace-operations';\nimport type { SecretFilterInput, SecurityPaginationInput } from '../../generated/wspace-types';\n\nexport function useGetSecrets(\n vaultId: string | undefined,\n filter?: SecretFilterInput,\n pagination?: SecurityPaginationInput\n) {\n return useGetSecretsQuery({\n variables: { vaultId: vaultId ?? '', filter, pagination },\n skip: !vaultId,\n fetchPolicy: 'network-only',\n });\n}\n\nexport function useGetSecret(id: string | null) {\n return useGetSecretQuery({\n variables: { id: id ?? '' },\n skip: !id,\n fetchPolicy: 'network-only',\n });\n}\n\nexport function useCreateSecret() {\n return useCreateSecretMutation({\n refetchQueries: ['GetSecrets'],\n });\n}\n\nexport function useDeleteSecret() {\n return useDeleteSecretMutation({\n refetchQueries: ['GetSecrets'],\n });\n}\n\nexport function useRotateSecret() {\n return useRotateSecretMutation();\n}\n\nexport function useRollbackSecret() {\n return useRollbackSecretMutation();\n}\n"],"mappings":";;AAUA,SAAgB,EACd,GACA,GACA,GACA;AACA,QAAO,EAAmB;EACxB,WAAW;GAAE,SAAS,KAAW;GAAI;GAAQ;GAAY;EACzD,MAAM,CAAC;EACP,aAAa;EACd,CAAC;;AAGJ,SAAgB,EAAa,GAAmB;AAC9C,QAAO,EAAkB;EACvB,WAAW,EAAE,IAAI,KAAM,IAAI;EAC3B,MAAM,CAAC;EACP,aAAa;EACd,CAAC;;AAGJ,SAAgB,IAAkB;AAChC,QAAO,EAAwB,EAC7B,gBAAgB,CAAC,aAAa,EAC/B,CAAC;;AAGJ,SAAgB,IAAkB;AAChC,QAAO,EAAwB,EAC7B,gBAAgB,CAAC,aAAa,EAC/B,CAAC;;AAGJ,SAAgB,IAAkB;AAChC,QAAO,GAAyB;;AAGlC,SAAgB,IAAoB;AAClC,QAAO,GAA2B"}
1
+ {"version":3,"file":"useSecretQueries.js","names":["useGetSecrets","useGetSecretsQuery","vaultId","useGetSecret","useGetSecretQuery","id","useCreateSecret","useCreateSecretMutation","useDeleteSecret","useDeleteSecretMutation","useRotateSecret","useRotateSecretMutation","useRollbackSecret","useRollbackSecretMutation"],"sources":["../../../src/security/hooks/useSecretQueries.ts"],"sourcesContent":["import {\n useGetSecretsQuery,\n useGetSecretQuery,\n useCreateSecretMutation,\n useDeleteSecretMutation,\n useRotateSecretMutation,\n useRollbackSecretMutation,\n} from '../../generated/wspace-operations';\nimport type { SecretFilterInput, SecurityPaginationInput } from '../../generated/wspace-types';\n\nexport function useGetSecrets(\n vaultId: string | undefined,\n filter?: SecretFilterInput,\n pagination?: SecurityPaginationInput\n) {\n return useGetSecretsQuery({\n variables: { vaultId: vaultId ?? '', filter, pagination },\n skip: !vaultId,\n fetchPolicy: 'network-only',\n });\n}\n\nexport function useGetSecret(id: string | null) {\n return useGetSecretQuery({\n variables: { id: id ?? '' },\n skip: !id,\n fetchPolicy: 'network-only',\n });\n}\n\nexport function useCreateSecret() {\n return useCreateSecretMutation({\n refetchQueries: ['GetSecrets'],\n });\n}\n\nexport function useDeleteSecret() {\n return useDeleteSecretMutation({\n refetchQueries: ['GetSecrets'],\n });\n}\n\nexport function useRotateSecret() {\n return useRotateSecretMutation();\n}\n\nexport function useRollbackSecret() {\n return useRollbackSecretMutation();\n}\n"],"mappings":";;AAUA,SAAgBA,EACd,GACA,GACA,GACA;CACA,OAAOC,EAAmB;EACxB,WAAW;GAAE,SAASC,KAAW;GAAI;GAAQ;EAAW;EACxD,MAAM,CAACA;EACP,aAAa;CACf,CAAC;AACH;AAEA,SAAgBC,EAAa,GAAmB;CAC9C,OAAOC,EAAkB;EACvB,WAAW,EAAE,IAAIC,KAAM,GAAG;EAC1B,MAAM,CAACA;EACP,aAAa;CACf,CAAC;AACH;AAEA,SAAgBC,IAAkB;CAChC,OAAOC,EAAwB,EAC7B,gBAAgB,CAAC,YAAY,EAC/B,CAAC;AACH;AAEA,SAAgBC,IAAkB;CAChC,OAAOC,EAAwB,EAC7B,gBAAgB,CAAC,YAAY,EAC/B,CAAC;AACH;AAEA,SAAgBC,IAAkB;CAChC,OAAOC,EAAwB;AACjC;AAEA,SAAgBC,IAAoB;CAClC,OAAOC,EAA0B;AACnC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Hook that fetches a decrypted secret value, stores in local state,
3
+ * and auto-clears after a configurable timeout.
4
+ */
5
+ export declare function useSecretValue(secretId: string): {
6
+ value: string | null;
7
+ reveal: () => Promise<void>;
8
+ hide: () => void;
9
+ loading: boolean;
10
+ isRevealed: boolean;
11
+ };
@@ -1,7 +1,7 @@
1
1
  import { useDecryptSecretLazyQuery as e } from "../../generated/wspace-operations.js";
2
2
  import { useSecurityStore as t } from "../store/securityStore.js";
3
3
  import { useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
4
- //#region src/security/hooks/useSecretValue.ts
4
+ // src/security/hooks/useSecretValue.ts
5
5
  function o(o) {
6
6
  let [s, c] = a(null), l = i(void 0), u = t((e) => e.clipboardAutoClearMs), [d, { loading: f }] = e({ fetchPolicy: "no-cache" }), p = n(() => {
7
7
  l.current &&= (clearTimeout(l.current), void 0);
@@ -24,7 +24,6 @@ function o(o) {
24
24
  isRevealed: s !== null
25
25
  };
26
26
  }
27
- //#endregion
28
27
  export { o as useSecretValue };
29
28
 
30
29
  //# sourceMappingURL=useSecretValue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSecretValue.js","names":[],"sources":["../../../src/security/hooks/useSecretValue.ts"],"sourcesContent":["import { useState, useCallback, useEffect, useRef } from 'react';\nimport { useDecryptSecretLazyQuery } from '../../generated/wspace-operations';\nimport { useSecurityStore } from '../store/securityStore.js';\n\n/**\n * Hook that fetches a decrypted secret value, stores in local state,\n * and auto-clears after a configurable timeout.\n */\nexport function useSecretValue(secretId: string) {\n const [value, setValue] = useState<string | null>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n const clipboardAutoClearMs = useSecurityStore((s) => s.clipboardAutoClearMs);\n const [decrypt, { loading }] = useDecryptSecretLazyQuery({ fetchPolicy: 'no-cache' });\n\n const clearTimer = useCallback(() => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n }\n }, []);\n\n const reveal = useCallback(async () => {\n const result = await decrypt({ variables: { id: secretId } });\n const data = result.data;\n if (data?.decryptSecret?.value) {\n setValue(data.decryptSecret.value);\n clearTimer();\n timerRef.current = setTimeout(() => setValue(null), clipboardAutoClearMs);\n }\n }, [secretId, decrypt, clipboardAutoClearMs, clearTimer]);\n\n const hide = useCallback(() => {\n setValue(null);\n clearTimer();\n }, [clearTimer]);\n\n useEffect(() => clearTimer, [clearTimer]);\n\n return { value, reveal, hide, loading, isRevealed: value !== null };\n}\n"],"mappings":";;;;AAQA,SAAgB,EAAe,GAAkB;CAC/C,IAAM,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,IAAW,EAAsC,KAAA,EAAU,EAC3D,IAAuB,GAAkB,MAAM,EAAE,qBAAqB,EACtE,CAAC,GAAS,EAAE,gBAAa,EAA0B,EAAE,aAAa,YAAY,CAAC,EAE/E,IAAa,QAAkB;AACnC,EAEE,EAAS,aADT,aAAa,EAAS,QAAQ,EACX,KAAA;IAEpB,EAAE,CAAC,EAEA,IAAS,EAAY,YAAY;EAErC,IAAM,KADS,MAAM,EAAQ,EAAE,WAAW,EAAE,IAAI,GAAU,EAAE,CAAC,EACzC;AACpB,EAAI,GAAM,eAAe,UACvB,EAAS,EAAK,cAAc,MAAM,EAClC,GAAY,EACZ,EAAS,UAAU,iBAAiB,EAAS,KAAK,EAAE,EAAqB;IAE1E;EAAC;EAAU;EAAS;EAAsB;EAAW,CAAC,EAEnD,IAAO,QAAkB;AAE7B,EADA,EAAS,KAAK,EACd,GAAY;IACX,CAAC,EAAW,CAAC;AAIhB,QAFA,QAAgB,GAAY,CAAC,EAAW,CAAC,EAElC;EAAE;EAAO;EAAQ;EAAM;EAAS,YAAY,MAAU;EAAM"}
1
+ {"version":3,"file":"useSecretValue.js","names":["useSecretValue","value","setValue","useState","timerRef","useRef","clipboardAutoClearMs","useSecurityStore","s","decrypt","useDecryptSecretLazyQuery","clearTimer","useCallback","reveal","data","secretId","hide","useEffect"],"sources":["../../../src/security/hooks/useSecretValue.ts"],"sourcesContent":["import { useState, useCallback, useEffect, useRef } from 'react';\nimport { useDecryptSecretLazyQuery } from '../../generated/wspace-operations';\nimport { useSecurityStore } from '../store/securityStore.js';\n\n/**\n * Hook that fetches a decrypted secret value, stores in local state,\n * and auto-clears after a configurable timeout.\n */\nexport function useSecretValue(secretId: string) {\n const [value, setValue] = useState<string | null>(null);\n const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n const clipboardAutoClearMs = useSecurityStore((s) => s.clipboardAutoClearMs);\n const [decrypt, { loading }] = useDecryptSecretLazyQuery({ fetchPolicy: 'no-cache' });\n\n const clearTimer = useCallback(() => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n }\n }, []);\n\n const reveal = useCallback(async () => {\n const result = await decrypt({ variables: { id: secretId } });\n const data = result.data;\n if (data?.decryptSecret?.value) {\n setValue(data.decryptSecret.value);\n clearTimer();\n timerRef.current = setTimeout(() => setValue(null), clipboardAutoClearMs);\n }\n }, [secretId, decrypt, clipboardAutoClearMs, clearTimer]);\n\n const hide = useCallback(() => {\n setValue(null);\n clearTimer();\n }, [clearTimer]);\n\n useEffect(() => clearTimer, [clearTimer]);\n\n return { value, reveal, hide, loading, isRevealed: value !== null };\n}\n"],"mappings":";;;;AAQA,SAAgBA,EAAe,GAAkB;CAC/C,IAAM,CAACC,GAAOC,KAAYC,EAAwB,IAAI,GAChDC,IAAWC,EAAsC,KAAA,CAAS,GAC1DC,IAAuBC,GAAkB,MAAMC,EAAE,oBAAoB,GACrE,CAACC,GAAS,EAAE,gBAAaC,EAA0B,EAAE,aAAa,WAAW,CAAC,GAE9EC,IAAaC,QAAkB;EACnC,AAEER,EAAS,aADT,aAAaA,EAAS,OAAO,GACV,KAAA;CAEvB,GAAG,CAAC,CAAC,GAECS,IAASD,EAAY,YAAY;EAErC,IAAME,KAAO,MADQL,EAAQ,EAAE,WAAW,EAAE,IAAIM,EAAS,EAAE,CAAC,EAAA,CACxC;EACpB,AAAID,GAAM,eAAe,UACvBZ,EAASY,EAAK,cAAc,KAAK,GACjCH,EAAW,GACX,EAAS,UAAU,iBAAiBT,EAAS,IAAI,GAAGI,CAAoB;CAE5E,GAAG;EAACS;EAAUN;EAASH;EAAsBK;CAAU,CAAC,GAElDK,IAAOJ,QAAkB;EAE7B,AADAV,EAAS,IAAI,GACbS,EAAW;CACb,GAAG,CAACA,CAAU,CAAC;CAIf,OAFAM,QAAgBN,GAAY,CAACA,CAAU,CAAC,GAEjC;EAAE;EAAO;EAAQ;EAAM;EAAS,YAAYV,MAAU;CAAK;AACpE"}
@@ -0,0 +1 @@
1
+ export declare function useSecurityCacheInvalidation(): void;
@@ -1,7 +1,7 @@
1
1
  import { useEffect as e } from "react";
2
2
  import { useApolloClient as t } from "@apollo/client/react";
3
3
  import { useEventBus as n } from "@burdenoff/fe-libs/shared/events";
4
- //#region src/security/hooks/useSecurityCacheInvalidation.ts
4
+ // src/security/hooks/useSecurityCacheInvalidation.ts
5
5
  var r = [
6
6
  "GetVaults",
7
7
  "GetVault",
@@ -46,7 +46,6 @@ function i() {
46
46
  };
47
47
  }, [a, i]);
48
48
  }
49
- //#endregion
50
49
  export { i as useSecurityCacheInvalidation };
51
50
 
52
51
  //# sourceMappingURL=useSecurityCacheInvalidation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSecurityCacheInvalidation.js","names":[],"sources":["../../../src/security/hooks/useSecurityCacheInvalidation.ts"],"sourcesContent":["/**\n * Listens to security-domain events on the host event bus and invalidates\n * the Apollo cache for the affected queries.\n *\n * The MFE never invokes Apollo cache APIs from feature code directly — it\n * subscribes to the bus and reacts. This is the subscribe-side counterpart\n * to `useSecurityEventEmitter`. Per spec 47, all cross-MFE coordination flows\n * through the bus; this hook is wired once at the root so every page in\n * the MFE benefits without each page needing its own subscription.\n */\nimport { useEffect } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useEventBus } from '@burdenoff/fe-libs/shared/events';\nimport type { SecurityDomainEvent } from './useSecurityEventEmitter';\n\ninterface BusEvent<T = unknown> {\n name: string;\n payload: T;\n}\n\ntype DynamicBus = {\n on: (name: string, handler: (event: BusEvent) => void) => () => void;\n};\n\nconst QUERIES_TO_REFETCH = [\n 'GetVaults',\n 'GetVault',\n 'GetVaultWithSecrets',\n 'GetSecrets',\n 'GetSecret',\n 'GetSecretVersionsPaginated',\n 'GetAuditLogs',\n];\n\nexport function useSecurityCacheInvalidation(): void {\n const client = useApolloClient();\n const bus = useEventBus() as unknown as DynamicBus;\n\n useEffect(() => {\n const events: SecurityDomainEvent[] = [\n 'vault.created',\n 'vault.updated',\n 'vault.deleted',\n 'vault.locked',\n 'vault.unlocked',\n 'vault.accessed',\n 'secret.created',\n 'secret.updated',\n 'secret.deleted',\n 'secret.accessed',\n 'secret.rotated',\n 'secret.rollback',\n 'member.added',\n 'member.removed',\n 'member.role_changed',\n ];\n\n const offHandlers = events.map((name) =>\n bus.on(name, () => {\n QUERIES_TO_REFETCH.forEach((q) => {\n try {\n void client.refetchQueries({ include: [q] });\n } catch {\n // Refetch failures are non-fatal; cached data stays usable.\n }\n });\n })\n );\n\n return () => {\n offHandlers.forEach((off) => {\n try {\n off();\n } catch {\n /* noop */\n }\n });\n };\n }, [bus, client]);\n}\n"],"mappings":";;;;AAwBA,IAAM,IAAqB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,IAAqC;CACnD,IAAM,IAAS,GAAiB,EAC1B,IAAM,GAAa;AAEzB,SAAgB;EAmBd,IAAM,IAlBgC;GACpC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAE0B,KAAK,MAC9B,EAAI,GAAG,SAAY;AACjB,KAAmB,SAAS,MAAM;AAChC,QAAI;AACG,OAAO,eAAe,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC;YACtC;KAGR;IACF,CACH;AAED,eAAa;AACX,KAAY,SAAS,MAAQ;AAC3B,QAAI;AACF,QAAK;YACC;KAGR;;IAEH,CAAC,GAAK,EAAO,CAAC"}
1
+ {"version":3,"file":"useSecurityCacheInvalidation.js","names":["QUERIES_TO_REFETCH","useSecurityCacheInvalidation","client","useApolloClient","bus","useEventBus","offHandlers","name","q"],"sources":["../../../src/security/hooks/useSecurityCacheInvalidation.ts"],"sourcesContent":["/**\n * Listens to security-domain events on the host event bus and invalidates\n * the Apollo cache for the affected queries.\n *\n * The MFE never invokes Apollo cache APIs from feature code directly — it\n * subscribes to the bus and reacts. This is the subscribe-side counterpart\n * to `useSecurityEventEmitter`. Per spec 47, all cross-MFE coordination flows\n * through the bus; this hook is wired once at the root so every page in\n * the MFE benefits without each page needing its own subscription.\n */\nimport { useEffect } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useEventBus } from '@burdenoff/fe-libs/shared/events';\nimport type { SecurityDomainEvent } from './useSecurityEventEmitter';\n\ninterface BusEvent<T = unknown> {\n name: string;\n payload: T;\n}\n\ntype DynamicBus = {\n on: (name: string, handler: (event: BusEvent) => void) => () => void;\n};\n\nconst QUERIES_TO_REFETCH = [\n 'GetVaults',\n 'GetVault',\n 'GetVaultWithSecrets',\n 'GetSecrets',\n 'GetSecret',\n 'GetSecretVersionsPaginated',\n 'GetAuditLogs',\n];\n\nexport function useSecurityCacheInvalidation(): void {\n const client = useApolloClient();\n const bus = useEventBus() as unknown as DynamicBus;\n\n useEffect(() => {\n const events: SecurityDomainEvent[] = [\n 'vault.created',\n 'vault.updated',\n 'vault.deleted',\n 'vault.locked',\n 'vault.unlocked',\n 'vault.accessed',\n 'secret.created',\n 'secret.updated',\n 'secret.deleted',\n 'secret.accessed',\n 'secret.rotated',\n 'secret.rollback',\n 'member.added',\n 'member.removed',\n 'member.role_changed',\n ];\n\n const offHandlers = events.map((name) =>\n bus.on(name, () => {\n QUERIES_TO_REFETCH.forEach((q) => {\n try {\n void client.refetchQueries({ include: [q] });\n } catch {\n // Refetch failures are non-fatal; cached data stays usable.\n }\n });\n })\n );\n\n return () => {\n offHandlers.forEach((off) => {\n try {\n off();\n } catch {\n /* noop */\n }\n });\n };\n }, [bus, client]);\n}\n"],"mappings":";;;;AAwBA,IAAMA,IAAqB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgBC,IAAqC;CACnD,IAAMC,IAASC,EAAgB,GACzBC,IAAMC,EAAY;CAExB,QAAgB;EAmBd,IAAMC,IAAc;GAjBlB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAGkB,CAAA,CAAO,KAAK,MAC9BF,EAAI,GAAGG,SAAY;GACjB,EAAmB,SAAS,MAAM;IAChC,IAAI;KACF,EAAY,eAAe,EAAE,SAAS,CAACC,CAAC,EAAE,CAAC;IAC7C,QAAQ,CAER;GACF,CAAC;EACH,CAAC,CACH;EAEA,aAAa;GACX,EAAY,SAAS,MAAQ;IAC3B,IAAI;KACF,EAAI;IACN,QAAQ,CAER;GACF,CAAC;EACH;CACF,GAAG,CAACJ,GAAKF,CAAM,CAAC;AAClB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Aggregating hook that fetches vaults and recent audit logs
3
+ * to produce a security health dashboard view.
4
+ *
5
+ * Dashboard metrics are derived from vault-level data (secretCount,
6
+ * memberCount) so we do not need to query getSecrets (which requires
7
+ * a vaultId).
8
+ */
9
+ export declare function useSecurityDashboard(): {
10
+ dashboard: {
11
+ totalVaults: any;
12
+ totalSecrets: any;
13
+ totalMembers: any;
14
+ healthScore: number;
15
+ lockedVaults: any;
16
+ recentActivity: any;
17
+ };
18
+ loading: boolean;
19
+ error: import('@apollo/client').ErrorLike | null;
20
+ };
@@ -1,7 +1,7 @@
1
1
  import { useGetVaults as e } from "./useVaultQueries.js";
2
2
  import { useVaultAuditLogs as t } from "./useAuditLog.js";
3
3
  import { useMemo as n } from "react";
4
- //#region src/security/hooks/useSecurityDashboard.ts
4
+ // src/security/hooks/useSecurityDashboard.ts
5
5
  function r() {
6
6
  let { data: r, loading: i, error: a } = e(void 0, { limit: 100 }), { data: o, loading: s, error: c } = t(void 0, void 0, { limit: 20 }), l = r?.getVaults?.items, u = o?.getVaultAuditLogs?.items, d = r?.getVaults?.total ?? 0;
7
7
  return {
@@ -28,7 +28,6 @@ function r() {
28
28
  error: a || c || null
29
29
  };
30
30
  }
31
- //#endregion
32
31
  export { r as useSecurityDashboard };
33
32
 
34
33
  //# sourceMappingURL=useSecurityDashboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSecurityDashboard.js","names":[],"sources":["../../../src/security/hooks/useSecurityDashboard.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useGetVaults } from './useVaultQueries';\nimport { useVaultAuditLogs } from './useAuditLog';\n\n/**\n * Aggregating hook that fetches vaults and recent audit logs\n * to produce a security health dashboard view.\n *\n * Dashboard metrics are derived from vault-level data (secretCount,\n * memberCount) so we do not need to query getSecrets (which requires\n * a vaultId).\n */\nexport function useSecurityDashboard() {\n const {\n data: vaultsData,\n loading: vaultsLoading,\n error: vaultsError,\n } = useGetVaults(undefined, { limit: 100 });\n\n const {\n data: auditData,\n loading: auditLoading,\n error: auditError,\n } = useVaultAuditLogs(undefined, undefined, { limit: 20 });\n\n const vaultsItems = vaultsData?.getVaults?.items;\n const auditItems = auditData?.getVaultAuditLogs?.items;\n const totalVaults = vaultsData?.getVaults?.total ?? 0;\n\n const dashboard = useMemo(() => {\n const vaults = vaultsItems ?? [];\n const auditLogs = auditItems ?? [];\n\n const totalSecrets = vaults.reduce(\n (sum: number, v: Record<string, unknown>) => sum + ((v.secretCount as number) ?? 0),\n 0\n );\n\n const totalMembers = vaults.reduce(\n (sum: number, v: Record<string, unknown>) => sum + ((v.memberCount as number) ?? 0),\n 0\n );\n\n const lockedVaults = vaults.filter((v: Record<string, unknown>) => v.status === 'locked');\n\n let healthScore = 100;\n if (totalVaults > 0) {\n const emptyVaults = vaults.filter(\n (v: Record<string, unknown>) => ((v.secretCount as number) ?? 0) === 0\n );\n healthScore -= Math.min(20, (emptyVaults.length / totalVaults) * 40);\n healthScore -= Math.min(15, (lockedVaults.length / totalVaults) * 30);\n }\n healthScore = Math.max(0, Math.round(healthScore));\n\n return {\n totalVaults,\n totalSecrets,\n totalMembers,\n healthScore,\n lockedVaults,\n recentActivity: auditLogs,\n };\n }, [vaultsItems, auditItems, totalVaults]);\n\n return {\n dashboard,\n loading: vaultsLoading || auditLoading,\n error: vaultsError || auditError || null,\n };\n}\n"],"mappings":";;;;AAYA,SAAgB,IAAuB;CACrC,IAAM,EACJ,MAAM,GACN,SAAS,GACT,OAAO,MACL,EAAa,KAAA,GAAW,EAAE,OAAO,KAAK,CAAC,EAErC,EACJ,MAAM,GACN,SAAS,GACT,OAAO,MACL,EAAkB,KAAA,GAAW,KAAA,GAAW,EAAE,OAAO,IAAI,CAAC,EAEpD,IAAc,GAAY,WAAW,OACrC,IAAa,GAAW,mBAAmB,OAC3C,IAAc,GAAY,WAAW,SAAS;AAsCpD,QAAO;EACL,WArCgB,QAAc;GAC9B,IAAM,IAAS,KAAe,EAAE,EAC1B,IAAY,KAAc,EAAE,EAE5B,IAAe,EAAO,QACzB,GAAa,MAA+B,KAAQ,EAAE,eAA0B,IACjF,EACD,EAEK,IAAe,EAAO,QACzB,GAAa,MAA+B,KAAQ,EAAE,eAA0B,IACjF,EACD,EAEK,IAAe,EAAO,QAAQ,MAA+B,EAAE,WAAW,SAAS,EAErF,IAAc;AAClB,OAAI,IAAc,GAAG;IACnB,IAAM,IAAc,EAAO,QACxB,OAAiC,EAAE,eAA0B,OAAO,EACtE;AAED,IADA,KAAe,KAAK,IAAI,IAAK,EAAY,SAAS,IAAe,GAAG,EACpE,KAAe,KAAK,IAAI,IAAK,EAAa,SAAS,IAAe,GAAG;;AAIvE,UAFA,IAAc,KAAK,IAAI,GAAG,KAAK,MAAM,EAAY,CAAC,EAE3C;IACL;IACA;IACA;IACA;IACA;IACA,gBAAgB;IACjB;KACA;GAAC;GAAa;GAAY;GAAY,CAAC;EAIxC,SAAS,KAAiB;EAC1B,OAAO,KAAe,KAAc;EACrC"}
1
+ {"version":3,"file":"useSecurityDashboard.js","names":["useSecurityDashboard","vaultsData","vaultsLoading","vaultsError","useGetVaults","auditData","auditLoading","auditError","useVaultAuditLogs","vaultsItems","auditItems","totalVaults","useMemo","vaults","auditLogs","totalSecrets","sum","v","totalMembers","lockedVaults","healthScore","emptyVaults"],"sources":["../../../src/security/hooks/useSecurityDashboard.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useGetVaults } from './useVaultQueries';\nimport { useVaultAuditLogs } from './useAuditLog';\n\n/**\n * Aggregating hook that fetches vaults and recent audit logs\n * to produce a security health dashboard view.\n *\n * Dashboard metrics are derived from vault-level data (secretCount,\n * memberCount) so we do not need to query getSecrets (which requires\n * a vaultId).\n */\nexport function useSecurityDashboard() {\n const {\n data: vaultsData,\n loading: vaultsLoading,\n error: vaultsError,\n } = useGetVaults(undefined, { limit: 100 });\n\n const {\n data: auditData,\n loading: auditLoading,\n error: auditError,\n } = useVaultAuditLogs(undefined, undefined, { limit: 20 });\n\n const vaultsItems = vaultsData?.getVaults?.items;\n const auditItems = auditData?.getVaultAuditLogs?.items;\n const totalVaults = vaultsData?.getVaults?.total ?? 0;\n\n const dashboard = useMemo(() => {\n const vaults = vaultsItems ?? [];\n const auditLogs = auditItems ?? [];\n\n const totalSecrets = vaults.reduce(\n (sum: number, v: Record<string, unknown>) => sum + ((v.secretCount as number) ?? 0),\n 0\n );\n\n const totalMembers = vaults.reduce(\n (sum: number, v: Record<string, unknown>) => sum + ((v.memberCount as number) ?? 0),\n 0\n );\n\n const lockedVaults = vaults.filter((v: Record<string, unknown>) => v.status === 'locked');\n\n let healthScore = 100;\n if (totalVaults > 0) {\n const emptyVaults = vaults.filter(\n (v: Record<string, unknown>) => ((v.secretCount as number) ?? 0) === 0\n );\n healthScore -= Math.min(20, (emptyVaults.length / totalVaults) * 40);\n healthScore -= Math.min(15, (lockedVaults.length / totalVaults) * 30);\n }\n healthScore = Math.max(0, Math.round(healthScore));\n\n return {\n totalVaults,\n totalSecrets,\n totalMembers,\n healthScore,\n lockedVaults,\n recentActivity: auditLogs,\n };\n }, [vaultsItems, auditItems, totalVaults]);\n\n return {\n dashboard,\n loading: vaultsLoading || auditLoading,\n error: vaultsError || auditError || null,\n };\n}\n"],"mappings":";;;;AAYA,SAAgBA,IAAuB;CACrC,IAAM,EACJ,MAAMC,GACN,SAASC,GACT,OAAOC,MACLC,EAAa,KAAA,GAAW,EAAE,OAAO,IAAI,CAAC,GAEpC,EACJ,MAAMC,GACN,SAASC,GACT,OAAOC,MACLC,EAAkB,KAAA,GAAW,KAAA,GAAW,EAAE,OAAO,GAAG,CAAC,GAEnDC,IAAcR,GAAY,WAAW,OACrCS,IAAaL,GAAW,mBAAmB,OAC3CM,IAAcV,GAAY,WAAW,SAAS;CAsCpD,OAAO;EACL,WArCgBW,QAAc;GAC9B,IAAMC,IAASJ,KAAe,CAAC,GACzBK,IAAYJ,KAAc,CAAC,GAE3BK,IAAeF,EAAO,QACzB,GAAa,MAA+BG,KAAQC,EAAE,eAA0B,IACjF,CACF,GAEMC,IAAeL,EAAO,QACzB,GAAa,MAA+BG,KAAQC,EAAE,eAA0B,IACjF,CACF,GAEME,IAAeN,EAAO,QAAQ,MAA+BI,EAAE,WAAW,QAAQ,GAEpFG,IAAc;GAClB,IAAIT,IAAc,GAAG;IACnB,IAAMU,IAAcR,EAAO,QACxB,OAAiCI,EAAE,eAA0B,OAAO,CACvE;IAEA,AADA,KAAe,KAAK,IAAI,IAAKI,EAAY,SAASV,IAAe,EAAE,GACnE,KAAe,KAAK,IAAI,IAAKQ,EAAa,SAASR,IAAe,EAAE;GACtE;GAGA,OAFA,IAAc,KAAK,IAAI,GAAG,KAAK,MAAMS,CAAW,CAAC,GAE1C;IACL;IACA;IACA;IACA;IACA;IACA,gBAAgBN;GAClB;EACF,GAAG;GAACL;GAAaC;GAAYC;EAAW,CAGtC;EACA,SAAST,KAAiBI;EAC1B,OAAOH,KAAeI,KAAc;CACtC;AACF"}
@@ -0,0 +1,13 @@
1
+ export type SecurityDomainEvent = 'vault.created' | 'vault.updated' | 'vault.deleted' | 'vault.locked' | 'vault.unlocked' | 'vault.accessed' | 'secret.created' | 'secret.updated' | 'secret.deleted' | 'secret.accessed' | 'secret.rotated' | 'secret.rollback' | 'member.added' | 'member.removed' | 'member.role_changed';
2
+ export interface SecurityEventPayload {
3
+ vaultId?: string;
4
+ secretId?: string;
5
+ memberId?: string;
6
+ workspaceId?: string;
7
+ role?: string;
8
+ count?: number;
9
+ source?: string;
10
+ }
11
+ export declare function useSecurityEventEmitter(): {
12
+ emit: (event: SecurityDomainEvent, payload?: SecurityEventPayload) => void;
13
+ };