@burdenoff/microfe-workspaces 2026.510.50

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 (260) hide show
  1. package/README.md +88 -0
  2. package/dist/WorkspacesRoot.d.ts +35 -0
  3. package/dist/WorkspacesRoot.d.ts.map +1 -0
  4. package/dist/WorkspacesRoot.js +71 -0
  5. package/dist/WorkspacesRoot.js.map +1 -0
  6. package/dist/WorkspacesRoutes.d.ts +10 -0
  7. package/dist/WorkspacesRoutes.d.ts.map +1 -0
  8. package/dist/WorkspacesRoutes.js +111 -0
  9. package/dist/WorkspacesRoutes.js.map +1 -0
  10. package/dist/components/CreateProjectDialog.d.ts +6 -0
  11. package/dist/components/CreateProjectDialog.d.ts.map +1 -0
  12. package/dist/components/CreateProjectDialog.js +115 -0
  13. package/dist/components/CreateProjectDialog.js.map +1 -0
  14. package/dist/components/CreateWorkspaceDialog.d.ts +2 -0
  15. package/dist/components/CreateWorkspaceDialog.d.ts.map +1 -0
  16. package/dist/components/CreateWorkspaceDialog.js +172 -0
  17. package/dist/components/CreateWorkspaceDialog.js.map +1 -0
  18. package/dist/components/InviteMemberDialog.d.ts +7 -0
  19. package/dist/components/InviteMemberDialog.d.ts.map +1 -0
  20. package/dist/components/InviteMemberDialog.js +148 -0
  21. package/dist/components/InviteMemberDialog.js.map +1 -0
  22. package/dist/components/MemberListItem.d.ts +11 -0
  23. package/dist/components/MemberListItem.d.ts.map +1 -0
  24. package/dist/components/MemberListItem.js +118 -0
  25. package/dist/components/MemberListItem.js.map +1 -0
  26. package/dist/components/ProjectCard.d.ts +13 -0
  27. package/dist/components/ProjectCard.d.ts.map +1 -0
  28. package/dist/components/ProjectCard.js +150 -0
  29. package/dist/components/ProjectCard.js.map +1 -0
  30. package/dist/components/WorkspaceCard.d.ts +8 -0
  31. package/dist/components/WorkspaceCard.d.ts.map +1 -0
  32. package/dist/components/WorkspaceCard.js +79 -0
  33. package/dist/components/WorkspaceCard.js.map +1 -0
  34. package/dist/components/WorkspacesErrorBoundary.d.ts +27 -0
  35. package/dist/components/WorkspacesErrorBoundary.d.ts.map +1 -0
  36. package/dist/components/WorkspacesErrorBoundary.js +136 -0
  37. package/dist/components/WorkspacesErrorBoundary.js.map +1 -0
  38. package/dist/components/index.d.ts +8 -0
  39. package/dist/components/index.d.ts.map +1 -0
  40. package/dist/components/index.js +7 -0
  41. package/dist/constants/permissions.d.ts +33 -0
  42. package/dist/constants/permissions.d.ts.map +1 -0
  43. package/dist/constants/permissions.js +31 -0
  44. package/dist/constants/permissions.js.map +1 -0
  45. package/dist/generated/global-operations.d.ts +279 -0
  46. package/dist/generated/global-operations.d.ts.map +1 -0
  47. package/dist/generated/global-operations.js +103 -0
  48. package/dist/generated/global-operations.js.map +1 -0
  49. package/dist/generated/global-types.d.ts +20714 -0
  50. package/dist/generated/global-types.d.ts.map +1 -0
  51. package/dist/generated/wspace-operations.d.ts +2209 -0
  52. package/dist/generated/wspace-operations.d.ts.map +1 -0
  53. package/dist/generated/wspace-operations.js +576 -0
  54. package/dist/generated/wspace-operations.js.map +1 -0
  55. package/dist/generated/wspace-types.d.ts +54990 -0
  56. package/dist/generated/wspace-types.d.ts.map +1 -0
  57. package/dist/hooks/index.d.ts +8 -0
  58. package/dist/hooks/index.d.ts.map +1 -0
  59. package/dist/hooks/index.js +7 -0
  60. package/dist/hooks/useMemberMutations.d.ts +61 -0
  61. package/dist/hooks/useMemberMutations.d.ts.map +1 -0
  62. package/dist/hooks/useMemberMutations.js +263 -0
  63. package/dist/hooks/useMemberMutations.js.map +1 -0
  64. package/dist/hooks/useProjectMutations.d.ts +26 -0
  65. package/dist/hooks/useProjectMutations.d.ts.map +1 -0
  66. package/dist/hooks/useProjectMutations.js +127 -0
  67. package/dist/hooks/useProjectMutations.js.map +1 -0
  68. package/dist/hooks/useProjects.d.ts +16 -0
  69. package/dist/hooks/useProjects.d.ts.map +1 -0
  70. package/dist/hooks/useProjects.js +103 -0
  71. package/dist/hooks/useProjects.js.map +1 -0
  72. package/dist/hooks/useScopedNavigation.d.ts +4 -0
  73. package/dist/hooks/useScopedNavigation.d.ts.map +1 -0
  74. package/dist/hooks/useScopedNavigation.js +11 -0
  75. package/dist/hooks/useScopedNavigation.js.map +1 -0
  76. package/dist/hooks/useTenants.d.ts +13 -0
  77. package/dist/hooks/useTenants.d.ts.map +1 -0
  78. package/dist/hooks/useTenants.js +47 -0
  79. package/dist/hooks/useTenants.js.map +1 -0
  80. package/dist/hooks/useWorkspaceActivity.d.ts +12 -0
  81. package/dist/hooks/useWorkspaceActivity.d.ts.map +1 -0
  82. package/dist/hooks/useWorkspaceActivity.js +31 -0
  83. package/dist/hooks/useWorkspaceActivity.js.map +1 -0
  84. package/dist/hooks/useWorkspaceMembers.d.ts +24 -0
  85. package/dist/hooks/useWorkspaceMembers.d.ts.map +1 -0
  86. package/dist/hooks/useWorkspaceMembers.js +130 -0
  87. package/dist/hooks/useWorkspaceMembers.js.map +1 -0
  88. package/dist/hooks/useWorkspaceMutations.d.ts +36 -0
  89. package/dist/hooks/useWorkspaceMutations.d.ts.map +1 -0
  90. package/dist/hooks/useWorkspaceMutations.js +119 -0
  91. package/dist/hooks/useWorkspaceMutations.js.map +1 -0
  92. package/dist/hooks/useWorkspacePermissions.d.ts +29 -0
  93. package/dist/hooks/useWorkspacePermissions.d.ts.map +1 -0
  94. package/dist/hooks/useWorkspacePermissions.js +33 -0
  95. package/dist/hooks/useWorkspacePermissions.js.map +1 -0
  96. package/dist/hooks/useWorkspaceRoles.d.ts +8 -0
  97. package/dist/hooks/useWorkspaceRoles.d.ts.map +1 -0
  98. package/dist/hooks/useWorkspaceRoles.js +31 -0
  99. package/dist/hooks/useWorkspaceRoles.js.map +1 -0
  100. package/dist/hooks/useWorkspaces.d.ts +21 -0
  101. package/dist/hooks/useWorkspaces.d.ts.map +1 -0
  102. package/dist/hooks/useWorkspaces.js +75 -0
  103. package/dist/hooks/useWorkspaces.js.map +1 -0
  104. package/dist/hooks/useWorkspacesEventEmitter.d.ts +14 -0
  105. package/dist/hooks/useWorkspacesEventEmitter.d.ts.map +1 -0
  106. package/dist/hooks/useWorkspacesEventEmitter.js +14 -0
  107. package/dist/hooks/useWorkspacesEventEmitter.js.map +1 -0
  108. package/dist/index.d.ts +33 -0
  109. package/dist/index.d.ts.map +1 -0
  110. package/dist/index.js +24 -0
  111. package/dist/pages/ActivityListPage.d.ts +2 -0
  112. package/dist/pages/ActivityListPage.d.ts.map +1 -0
  113. package/dist/pages/ActivityListPage.js +119 -0
  114. package/dist/pages/ActivityListPage.js.map +1 -0
  115. package/dist/pages/CreateWorkspacePage.d.ts +2 -0
  116. package/dist/pages/CreateWorkspacePage.d.ts.map +1 -0
  117. package/dist/pages/CreateWorkspacePage.js +264 -0
  118. package/dist/pages/CreateWorkspacePage.js.map +1 -0
  119. package/dist/pages/InviteAcceptancePage.d.ts +6 -0
  120. package/dist/pages/InviteAcceptancePage.d.ts.map +1 -0
  121. package/dist/pages/InviteAcceptancePage.js +495 -0
  122. package/dist/pages/InviteAcceptancePage.js.map +1 -0
  123. package/dist/pages/MembersListPage.d.ts +2 -0
  124. package/dist/pages/MembersListPage.d.ts.map +1 -0
  125. package/dist/pages/MembersListPage.js +420 -0
  126. package/dist/pages/MembersListPage.js.map +1 -0
  127. package/dist/pages/ProjectDetailPage.d.ts +2 -0
  128. package/dist/pages/ProjectDetailPage.d.ts.map +1 -0
  129. package/dist/pages/ProjectDetailPage.js +361 -0
  130. package/dist/pages/ProjectDetailPage.js.map +1 -0
  131. package/dist/pages/ProjectsListPage.d.ts +2 -0
  132. package/dist/pages/ProjectsListPage.d.ts.map +1 -0
  133. package/dist/pages/ProjectsListPage.js +398 -0
  134. package/dist/pages/ProjectsListPage.js.map +1 -0
  135. package/dist/pages/WorkspaceDetailPage.d.ts +2 -0
  136. package/dist/pages/WorkspaceDetailPage.d.ts.map +1 -0
  137. package/dist/pages/WorkspaceDetailPage.js +230 -0
  138. package/dist/pages/WorkspaceDetailPage.js.map +1 -0
  139. package/dist/pages/WorkspaceSettingsPage.d.ts +2 -0
  140. package/dist/pages/WorkspaceSettingsPage.d.ts.map +1 -0
  141. package/dist/pages/WorkspaceSettingsPage.js +157 -0
  142. package/dist/pages/WorkspaceSettingsPage.js.map +1 -0
  143. package/dist/pages/WorkspacesListPage.d.ts +2 -0
  144. package/dist/pages/WorkspacesListPage.d.ts.map +1 -0
  145. package/dist/pages/WorkspacesListPage.js +186 -0
  146. package/dist/pages/WorkspacesListPage.js.map +1 -0
  147. package/dist/pages/dashboard/DashboardCustomizer.d.ts +12 -0
  148. package/dist/pages/dashboard/DashboardCustomizer.d.ts.map +1 -0
  149. package/dist/pages/dashboard/DashboardCustomizer.js +136 -0
  150. package/dist/pages/dashboard/DashboardCustomizer.js.map +1 -0
  151. package/dist/pages/dashboard/DashboardGrid.d.ts +8 -0
  152. package/dist/pages/dashboard/DashboardGrid.d.ts.map +1 -0
  153. package/dist/pages/dashboard/DashboardGrid.js +58 -0
  154. package/dist/pages/dashboard/DashboardGrid.js.map +1 -0
  155. package/dist/pages/dashboard/DashboardPage.d.ts +14 -0
  156. package/dist/pages/dashboard/DashboardPage.d.ts.map +1 -0
  157. package/dist/pages/dashboard/DashboardPage.js +136 -0
  158. package/dist/pages/dashboard/DashboardPage.js.map +1 -0
  159. package/dist/pages/dashboard/WidgetWrapper.d.ts +17 -0
  160. package/dist/pages/dashboard/WidgetWrapper.d.ts.map +1 -0
  161. package/dist/pages/dashboard/WidgetWrapper.js +72 -0
  162. package/dist/pages/dashboard/WidgetWrapper.js.map +1 -0
  163. package/dist/pages/dashboard/config.d.ts +9 -0
  164. package/dist/pages/dashboard/config.d.ts.map +1 -0
  165. package/dist/pages/dashboard/config.js +214 -0
  166. package/dist/pages/dashboard/config.js.map +1 -0
  167. package/dist/pages/dashboard/hooks/useDashboardData.d.ts +9 -0
  168. package/dist/pages/dashboard/hooks/useDashboardData.d.ts.map +1 -0
  169. package/dist/pages/dashboard/hooks/useDashboardData.js +118 -0
  170. package/dist/pages/dashboard/hooks/useDashboardData.js.map +1 -0
  171. package/dist/pages/dashboard/hooks/useDashboardPreferences.d.ts +4 -0
  172. package/dist/pages/dashboard/hooks/useDashboardPreferences.d.ts.map +1 -0
  173. package/dist/pages/dashboard/hooks/useDashboardPreferences.js +32 -0
  174. package/dist/pages/dashboard/hooks/useDashboardPreferences.js.map +1 -0
  175. package/dist/pages/dashboard/types.d.ts +145 -0
  176. package/dist/pages/dashboard/types.d.ts.map +1 -0
  177. package/dist/pages/dashboard/widgets/GroupsWidget.d.ts +4 -0
  178. package/dist/pages/dashboard/widgets/GroupsWidget.d.ts.map +1 -0
  179. package/dist/pages/dashboard/widgets/GroupsWidget.js +59 -0
  180. package/dist/pages/dashboard/widgets/GroupsWidget.js.map +1 -0
  181. package/dist/pages/dashboard/widgets/MembersWidget.d.ts +4 -0
  182. package/dist/pages/dashboard/widgets/MembersWidget.d.ts.map +1 -0
  183. package/dist/pages/dashboard/widgets/MembersWidget.js +65 -0
  184. package/dist/pages/dashboard/widgets/MembersWidget.js.map +1 -0
  185. package/dist/pages/dashboard/widgets/ProjectsWidget.d.ts +4 -0
  186. package/dist/pages/dashboard/widgets/ProjectsWidget.d.ts.map +1 -0
  187. package/dist/pages/dashboard/widgets/ProjectsWidget.js +91 -0
  188. package/dist/pages/dashboard/widgets/ProjectsWidget.js.map +1 -0
  189. package/dist/pages/dashboard/widgets/QuickActionsWidget.d.ts +4 -0
  190. package/dist/pages/dashboard/widgets/QuickActionsWidget.d.ts.map +1 -0
  191. package/dist/pages/dashboard/widgets/QuickActionsWidget.js +80 -0
  192. package/dist/pages/dashboard/widgets/QuickActionsWidget.js.map +1 -0
  193. package/dist/pages/dashboard/widgets/RecentActivityWidget.d.ts +4 -0
  194. package/dist/pages/dashboard/widgets/RecentActivityWidget.d.ts.map +1 -0
  195. package/dist/pages/dashboard/widgets/RecentActivityWidget.js +81 -0
  196. package/dist/pages/dashboard/widgets/RecentActivityWidget.js.map +1 -0
  197. package/dist/pages/dashboard/widgets/StorageWidget.d.ts +4 -0
  198. package/dist/pages/dashboard/widgets/StorageWidget.d.ts.map +1 -0
  199. package/dist/pages/dashboard/widgets/StorageWidget.js +69 -0
  200. package/dist/pages/dashboard/widgets/StorageWidget.js.map +1 -0
  201. package/dist/pages/dashboard/widgets/SystemHealthWidget.d.ts +4 -0
  202. package/dist/pages/dashboard/widgets/SystemHealthWidget.d.ts.map +1 -0
  203. package/dist/pages/dashboard/widgets/SystemHealthWidget.js +59 -0
  204. package/dist/pages/dashboard/widgets/SystemHealthWidget.js.map +1 -0
  205. package/dist/pages/dashboard/widgets/TagCloudWidget.d.ts +4 -0
  206. package/dist/pages/dashboard/widgets/TagCloudWidget.d.ts.map +1 -0
  207. package/dist/pages/dashboard/widgets/TagCloudWidget.js +61 -0
  208. package/dist/pages/dashboard/widgets/TagCloudWidget.js.map +1 -0
  209. package/dist/pages/dashboard/widgets/TipsWidget.d.ts +4 -0
  210. package/dist/pages/dashboard/widgets/TipsWidget.d.ts.map +1 -0
  211. package/dist/pages/dashboard/widgets/TipsWidget.js +67 -0
  212. package/dist/pages/dashboard/widgets/TipsWidget.js.map +1 -0
  213. package/dist/pages/dashboard/widgets/UpcomingEventsWidget.d.ts +4 -0
  214. package/dist/pages/dashboard/widgets/UpcomingEventsWidget.d.ts.map +1 -0
  215. package/dist/pages/dashboard/widgets/UpcomingEventsWidget.js +83 -0
  216. package/dist/pages/dashboard/widgets/UpcomingEventsWidget.js.map +1 -0
  217. package/dist/pages/dashboard/widgets/WelcomeWidget.d.ts +4 -0
  218. package/dist/pages/dashboard/widgets/WelcomeWidget.d.ts.map +1 -0
  219. package/dist/pages/dashboard/widgets/WelcomeWidget.js +71 -0
  220. package/dist/pages/dashboard/widgets/WelcomeWidget.js.map +1 -0
  221. package/dist/pages/dashboard/widgets/WorkflowStatsWidget.d.ts +4 -0
  222. package/dist/pages/dashboard/widgets/WorkflowStatsWidget.d.ts.map +1 -0
  223. package/dist/pages/dashboard/widgets/WorkflowStatsWidget.js +97 -0
  224. package/dist/pages/dashboard/widgets/WorkflowStatsWidget.js.map +1 -0
  225. package/dist/pages/dashboard/widgets/WorkspacesWidget.d.ts +4 -0
  226. package/dist/pages/dashboard/widgets/WorkspacesWidget.d.ts.map +1 -0
  227. package/dist/pages/dashboard/widgets/WorkspacesWidget.js +67 -0
  228. package/dist/pages/dashboard/widgets/WorkspacesWidget.js.map +1 -0
  229. package/dist/providers/WorkspacesProvider.d.ts +13 -0
  230. package/dist/providers/WorkspacesProvider.d.ts.map +1 -0
  231. package/dist/providers/WorkspacesProvider.js +24 -0
  232. package/dist/providers/WorkspacesProvider.js.map +1 -0
  233. package/dist/store/workspacesStore.d.ts +82 -0
  234. package/dist/store/workspacesStore.d.ts.map +1 -0
  235. package/dist/store/workspacesStore.js +92 -0
  236. package/dist/store/workspacesStore.js.map +1 -0
  237. package/dist/types/index.d.ts +280 -0
  238. package/dist/types/index.d.ts.map +1 -0
  239. package/dist/utils/formatters.d.ts +60 -0
  240. package/dist/utils/formatters.d.ts.map +1 -0
  241. package/dist/utils/formatters.js +61 -0
  242. package/dist/utils/formatters.js.map +1 -0
  243. package/dist/utils/index.d.ts +3 -0
  244. package/dist/utils/index.d.ts.map +1 -0
  245. package/dist/utils/nativeBridge.d.ts +3 -0
  246. package/dist/utils/nativeBridge.d.ts.map +1 -0
  247. package/dist/utils/nativeBridge.js +2 -0
  248. package/dist/utils/projectTags.d.ts +6 -0
  249. package/dist/utils/projectTags.d.ts.map +1 -0
  250. package/dist/utils/projectTags.js +49 -0
  251. package/dist/utils/projectTags.js.map +1 -0
  252. package/dist/utils/slug.d.ts +13 -0
  253. package/dist/utils/slug.d.ts.map +1 -0
  254. package/dist/utils/slug.js +8 -0
  255. package/dist/utils/slug.js.map +1 -0
  256. package/dist/utils/tokenHelpers.d.ts +114 -0
  257. package/dist/utils/tokenHelpers.d.ts.map +1 -0
  258. package/dist/utils/tokenHelpers.js +80 -0
  259. package/dist/utils/tokenHelpers.js.map +1 -0
  260. package/package.json +113 -0
@@ -0,0 +1,8 @@
1
+ export * from './useWorkspaces';
2
+ export * from './useWorkspaceMutations';
3
+ export * from './useProjects';
4
+ export * from './useProjectMutations';
5
+ export * from './useWorkspaceMembers';
6
+ export * from './useMemberMutations';
7
+ export * from './useTenants';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ import "./useWorkspaces.js";
2
+ import "./useWorkspaceMembers.js";
3
+ import "./useMemberMutations.js";
4
+ import "./useWorkspaceMutations.js";
5
+ import "./useProjects.js";
6
+ import "./useProjectMutations.js";
7
+ import "./useTenants.js";
@@ -0,0 +1,61 @@
1
+ import { WorkspaceMember, WorkspaceInvitation, AddWorkspaceMemberInput, CreateInvitationInput, UpdateInvitationInput } from '../types';
2
+
3
+ /**
4
+ * Hook to add a member to a workspace
5
+ * Requires x-workspace-id header for workspace context
6
+ */
7
+ export declare const useAddWorkspaceMember: () => import('@tanstack/react-query').UseMutationResult<WorkspaceMember, Error, AddWorkspaceMemberInput, unknown>;
8
+ /**
9
+ * Hook to remove a member from a workspace by member ID
10
+ */
11
+ export declare const useRemoveWorkspaceMember: (workspaceIdOverride?: string) => import('@tanstack/react-query').UseMutationResult<boolean, Error, string, unknown>;
12
+ /**
13
+ * Hook to remove a user from a workspace
14
+ * Requires x-workspace-id header for workspace context
15
+ */
16
+ export declare const useRemoveUserFromWorkspace: (workspaceIdOverride?: string) => import('@tanstack/react-query').UseMutationResult<boolean, Error, string, unknown>;
17
+ /**
18
+ * NOTE: The updateWorkspaceMemberRoles mutation has been removed from the backend.
19
+ * Role management is now handled via invitations - when creating an invitation,
20
+ * you can specify roleIds that will be assigned when the invitation is accepted.
21
+ *
22
+ * Use CreateInvitationInput.roleIds to assign roles to new members.
23
+ */
24
+ /**
25
+ * Hook to create a workspace invitation
26
+ * Uses x-workspace-id header as fallback when input.workspaceId is not provided
27
+ */
28
+ export declare const useCreateInvitation: (workspaceIdOverride?: string) => import('@tanstack/react-query').UseMutationResult<WorkspaceInvitation, Error, CreateInvitationInput, unknown>;
29
+ /**
30
+ * Hook to update an invitation
31
+ */
32
+ export declare const useUpdateInvitation: () => import('@tanstack/react-query').UseMutationResult<WorkspaceInvitation, Error, {
33
+ id: string;
34
+ input: UpdateInvitationInput;
35
+ }, unknown>;
36
+ /**
37
+ * Hook to accept an invitation
38
+ */
39
+ export declare const useAcceptInvitation: () => import('@tanstack/react-query').UseMutationResult<WorkspaceInvitation, Error, string, unknown>;
40
+ /**
41
+ * Hook to reject an invitation
42
+ */
43
+ export declare const useRejectInvitation: () => import('@tanstack/react-query').UseMutationResult<WorkspaceInvitation, Error, string, unknown>;
44
+ /**
45
+ * Hook to cancel an invitation
46
+ */
47
+ export declare const useCancelInvitation: () => import('@tanstack/react-query').UseMutationResult<WorkspaceInvitation, Error, string, unknown>;
48
+ /**
49
+ * Hook to resend an invitation
50
+ */
51
+ export declare const useResendInvitation: (workspaceIdOverride?: string) => import('@tanstack/react-query').UseMutationResult<WorkspaceInvitation, Error, string, unknown>;
52
+ /**
53
+ * Hook to delete an invitation
54
+ */
55
+ export declare const useDeleteInvitation: () => import('@tanstack/react-query').UseMutationResult<boolean, Error, string, unknown>;
56
+ /**
57
+ * Hook to bulk create invitations
58
+ * Uses x-workspace-id header as fallback when inputs[].workspaceId is not provided
59
+ */
60
+ export declare const useBulkCreateInvitations: () => import('@tanstack/react-query').UseMutationResult<WorkspaceInvitation[], Error, CreateInvitationInput[], unknown>;
61
+ //# sourceMappingURL=useMemberMutations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMemberMutations.d.ts","sourceRoot":"","sources":["../../src/hooks/useMemberMutations.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAGlB;;;GAGG;AACH,eAAO,MAAM,qBAAqB,mHAiCjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,sBAAsB,MAAM,uFA6BpE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GAAI,sBAAsB,MAAM,uFA6BtE,CAAC;AAEF;;;;;;GAMG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,sBAAsB,MAAM,kHAmC/D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB;QAUtB,MAAM;WACH,qBAAqB;WA0BjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,sGAiC/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,sGA+B/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,sGA+B/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,sBAAsB,MAAM,mGAgC/D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,0FA2B/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,yHAyBpC,CAAC"}
@@ -0,0 +1,263 @@
1
+ import { useWorkspacesContext as e } from "../providers/WorkspacesProvider.js";
2
+ import { AcceptInvitationDocument as t, AddWorkspaceMemberDocument as n, BulkCreateInvitationsDocument as r, CancelInvitationDocument as i, CreateInvitationDocument as a, DeleteInvitationDocument as o, RejectInvitationDocument as s, RemoveUserFromWorkspaceDocument as c, RemoveWorkspaceMemberDocument as l, ResendInvitationDocument as u, UpdateInvitationDocument as d } from "../generated/wspace-operations.js";
3
+ import { useWorkspacesEventEmitter as f } from "./useWorkspacesEventEmitter.js";
4
+ import { useMutation as p, useQueryClient as m } from "@tanstack/react-query";
5
+ import { print as h } from "graphql";
6
+ import { graphqlFetch as g } from "@burdenoff/fe-libs/shared/graphql";
7
+ //#region src/hooks/useMemberMutations.ts
8
+ var _ = () => {
9
+ let { authToken: t, workspaceId: r } = e(), i = m(), { emit: a } = f();
10
+ return p({
11
+ mutationFn: async (e) => {
12
+ let i = await g({
13
+ gateway: "workspace",
14
+ authToken: t || void 0,
15
+ query: h(n),
16
+ variables: { input: e },
17
+ workspaceId: r || void 0,
18
+ workspaceToken: !0
19
+ });
20
+ if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
21
+ return i.data.addWorkspaceMember;
22
+ },
23
+ onSuccess: (e) => {
24
+ i.invalidateQueries({ queryKey: ["workspaceMembers", e.workspaceId] }), i.invalidateQueries({ queryKey: ["userWorkspaces"] }), a("workspace-member.added", {
25
+ memberId: e.id,
26
+ workspaceId: e.workspaceId,
27
+ userId: e.userId,
28
+ source: "microfe-workspaces"
29
+ });
30
+ }
31
+ });
32
+ }, v = (t) => {
33
+ let { authToken: n, workspaceId: r } = e(), i = m(), { emit: a } = f(), o = t || r;
34
+ return p({
35
+ mutationFn: async (e) => {
36
+ let t = await g({
37
+ gateway: "workspace",
38
+ authToken: n || void 0,
39
+ query: h(l),
40
+ variables: { id: e },
41
+ workspaceId: o || void 0,
42
+ workspaceToken: !0
43
+ });
44
+ if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
45
+ return t.data.removeWorkspaceMember;
46
+ },
47
+ onSuccess: (e, t) => {
48
+ i.invalidateQueries({ queryKey: ["workspaceMembers"] }), i.invalidateQueries({ queryKey: ["userWorkspaces"] }), a("workspace-member.removed", {
49
+ memberId: t,
50
+ source: "microfe-workspaces"
51
+ });
52
+ }
53
+ });
54
+ }, y = (t) => {
55
+ let { authToken: n, workspaceId: r } = e(), i = m(), { emit: a } = f(), o = t || r;
56
+ return p({
57
+ mutationFn: async (e) => {
58
+ let t = await g({
59
+ gateway: "workspace",
60
+ authToken: n || void 0,
61
+ query: h(c),
62
+ variables: { userId: e },
63
+ workspaceId: o || void 0,
64
+ workspaceToken: !0
65
+ });
66
+ if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
67
+ return t.data.removeUserFromWorkspace;
68
+ },
69
+ onSuccess: (e, t) => {
70
+ i.invalidateQueries({ queryKey: ["workspaceMembers"] }), i.invalidateQueries({ queryKey: ["userWorkspaces", t] }), a("workspace-member.removed", {
71
+ userId: t,
72
+ source: "microfe-workspaces"
73
+ });
74
+ }
75
+ });
76
+ }, b = (t) => {
77
+ let { authToken: n, workspaceId: r } = e(), i = m(), { emit: o } = f(), s = t || r;
78
+ return p({
79
+ mutationFn: async (e) => {
80
+ let t = await g({
81
+ gateway: "workspace",
82
+ authToken: n || void 0,
83
+ query: h(a),
84
+ variables: { input: e },
85
+ workspaceId: e.workspaceId || s || void 0,
86
+ workspaceToken: !0
87
+ });
88
+ if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
89
+ return t.data.createInvitation;
90
+ },
91
+ onSuccess: (e) => {
92
+ e.workspaceId && i.invalidateQueries({ queryKey: ["workspaceInvitations", e.workspaceId] }), o("workspace-invitation.created", {
93
+ invitationId: e.id,
94
+ workspaceId: e.workspaceId,
95
+ email: e.email,
96
+ source: "microfe-workspaces"
97
+ });
98
+ }
99
+ });
100
+ }, x = () => {
101
+ let { authToken: t, workspaceId: n } = e(), r = m(), { emit: i } = f();
102
+ return p({
103
+ mutationFn: async ({ id: e, input: r }) => {
104
+ let i = await g({
105
+ gateway: "workspace",
106
+ authToken: t || void 0,
107
+ query: h(d),
108
+ variables: {
109
+ id: e,
110
+ input: r
111
+ },
112
+ workspaceId: n || void 0,
113
+ workspaceToken: !0
114
+ });
115
+ if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
116
+ return i.data.updateInvitation;
117
+ },
118
+ onSuccess: (e) => {
119
+ r.invalidateQueries({ queryKey: ["workspaceInvitations"] }), i("workspace-invitation.created", {
120
+ invitationId: e.id,
121
+ workspaceId: e.workspaceId,
122
+ source: "microfe-workspaces"
123
+ });
124
+ }
125
+ });
126
+ }, S = () => {
127
+ let { authToken: n, workspaceId: r } = e(), i = m(), { emit: a } = f();
128
+ return p({
129
+ mutationFn: async (e) => {
130
+ let i = await g({
131
+ gateway: "workspace",
132
+ authToken: n || void 0,
133
+ query: h(t),
134
+ variables: { id: e },
135
+ workspaceId: r || void 0,
136
+ workspaceToken: !0
137
+ });
138
+ if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
139
+ return i.data.acceptInvitation;
140
+ },
141
+ onSuccess: (e) => {
142
+ i.invalidateQueries({ queryKey: ["workspaceInvitations"] }), i.invalidateQueries({ queryKey: ["workspaceMembers"] }), i.invalidateQueries({ queryKey: ["userWorkspaces"] }), a("workspace-invitation.accepted", {
143
+ invitationId: e.id,
144
+ workspaceId: e.workspaceId,
145
+ source: "microfe-workspaces"
146
+ });
147
+ }
148
+ });
149
+ }, C = () => {
150
+ let { authToken: t, workspaceId: n } = e(), r = m(), { emit: i } = f();
151
+ return p({
152
+ mutationFn: async (e) => {
153
+ let r = await g({
154
+ gateway: "workspace",
155
+ authToken: t || void 0,
156
+ query: h(s),
157
+ variables: { id: e },
158
+ workspaceId: n || void 0,
159
+ workspaceToken: !0
160
+ });
161
+ if (r.errors?.length) throw Error(r.errors[0]?.message || "GraphQL error");
162
+ return r.data.rejectInvitation;
163
+ },
164
+ onSuccess: (e) => {
165
+ r.invalidateQueries({ queryKey: ["workspaceInvitations"] }), i("workspace-invitation.rejected", {
166
+ invitationId: e.id,
167
+ workspaceId: e.workspaceId,
168
+ source: "microfe-workspaces"
169
+ });
170
+ }
171
+ });
172
+ }, w = () => {
173
+ let { authToken: t, workspaceId: n } = e(), r = m(), { emit: a } = f();
174
+ return p({
175
+ mutationFn: async (e) => {
176
+ let r = await g({
177
+ gateway: "workspace",
178
+ authToken: t || void 0,
179
+ query: h(i),
180
+ variables: { id: e },
181
+ workspaceId: n || void 0,
182
+ workspaceToken: !0
183
+ });
184
+ if (r.errors?.length) throw Error(r.errors[0]?.message || "GraphQL error");
185
+ return r.data.cancelInvitation;
186
+ },
187
+ onSuccess: (e) => {
188
+ r.invalidateQueries({ queryKey: ["workspaceInvitations"] }), a("workspace-invitation.cancelled", {
189
+ invitationId: e.id,
190
+ workspaceId: e.workspaceId,
191
+ source: "microfe-workspaces"
192
+ });
193
+ }
194
+ });
195
+ }, T = (t) => {
196
+ let { authToken: n, workspaceId: r } = e(), i = m(), { emit: a } = f(), o = t || r;
197
+ return p({
198
+ mutationFn: async (e) => {
199
+ let t = await g({
200
+ gateway: "workspace",
201
+ authToken: n || void 0,
202
+ query: h(u),
203
+ variables: { id: e },
204
+ workspaceId: o || void 0,
205
+ workspaceToken: !0
206
+ });
207
+ if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
208
+ return t.data.resendInvitation;
209
+ },
210
+ onSuccess: (e) => {
211
+ i.invalidateQueries({ queryKey: ["workspaceInvitations"] }), a("workspace-invitation.resent", {
212
+ invitationId: e.id,
213
+ workspaceId: e.workspaceId,
214
+ source: "microfe-workspaces"
215
+ });
216
+ }
217
+ });
218
+ }, E = () => {
219
+ let { authToken: t, workspaceId: n } = e(), r = m(), { emit: i } = f();
220
+ return p({
221
+ mutationFn: async (e) => {
222
+ let r = await g({
223
+ gateway: "workspace",
224
+ authToken: t || void 0,
225
+ query: h(o),
226
+ variables: { id: e },
227
+ workspaceId: n || void 0,
228
+ workspaceToken: !0
229
+ });
230
+ if (r.errors?.length) throw Error(r.errors[0]?.message || "GraphQL error");
231
+ return r.data.deleteInvitation;
232
+ },
233
+ onSuccess: (e, t) => {
234
+ r.invalidateQueries({ queryKey: ["workspaceInvitations"] }), i("workspace-invitation.deleted", {
235
+ invitationId: t,
236
+ source: "microfe-workspaces"
237
+ });
238
+ }
239
+ });
240
+ }, D = () => {
241
+ let { authToken: t, workspaceId: n } = e(), i = m();
242
+ return p({
243
+ mutationFn: async (e) => {
244
+ let i = await g({
245
+ gateway: "workspace",
246
+ authToken: t || void 0,
247
+ query: h(r),
248
+ variables: { inputs: e },
249
+ workspaceId: e[0]?.workspaceId || n || void 0,
250
+ workspaceToken: !0
251
+ });
252
+ if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
253
+ return i.data.bulkCreateInvitations;
254
+ },
255
+ onSuccess: () => {
256
+ i.invalidateQueries({ queryKey: ["workspaceInvitations"] });
257
+ }
258
+ });
259
+ };
260
+ //#endregion
261
+ export { S as useAcceptInvitation, _ as useAddWorkspaceMember, D as useBulkCreateInvitations, w as useCancelInvitation, b as useCreateInvitation, E as useDeleteInvitation, C as useRejectInvitation, y as useRemoveUserFromWorkspace, v as useRemoveWorkspaceMember, T as useResendInvitation, x as useUpdateInvitation };
262
+
263
+ //# sourceMappingURL=useMemberMutations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMemberMutations.js","names":[],"sources":["../../src/hooks/useMemberMutations.ts"],"sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { print } from 'graphql';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\nimport { useWorkspacesContext } from '../providers/WorkspacesProvider';\nimport {\n AddWorkspaceMemberDocument,\n RemoveWorkspaceMemberDocument,\n RemoveUserFromWorkspaceDocument,\n CreateInvitationDocument,\n UpdateInvitationDocument,\n AcceptInvitationDocument,\n RejectInvitationDocument,\n CancelInvitationDocument,\n ResendInvitationDocument,\n DeleteInvitationDocument,\n BulkCreateInvitationsDocument,\n} from '../generated/wspace-operations';\nimport type {\n WorkspaceMember,\n WorkspaceInvitation,\n AddWorkspaceMemberInput,\n CreateInvitationInput,\n UpdateInvitationInput,\n} from '../types';\nimport { useWorkspacesEventEmitter } from './useWorkspacesEventEmitter';\n\n/**\n * Hook to add a member to a workspace\n * Requires x-workspace-id header for workspace context\n */\nexport const useAddWorkspaceMember = () => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n\n return useMutation({\n mutationFn: async (input: AddWorkspaceMemberInput): Promise<WorkspaceMember> => {\n const result = await graphqlFetch<{ addWorkspaceMember: WorkspaceMember }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(AddWorkspaceMemberDocument),\n variables: { input },\n workspaceId: workspaceId || undefined,\n workspaceToken: true, // Auto-read from profile context for x-workspace-id header\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.addWorkspaceMember;\n },\n onSuccess: (data) => {\n queryClient.invalidateQueries({ queryKey: ['workspaceMembers', data.workspaceId] });\n queryClient.invalidateQueries({ queryKey: ['userWorkspaces'] });\n emit('workspace-member.added', {\n memberId: data.id,\n workspaceId: data.workspaceId,\n userId: data.userId,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n\n/**\n * Hook to remove a member from a workspace by member ID\n */\nexport const useRemoveWorkspaceMember = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useMutation({\n mutationFn: async (id: string): Promise<boolean> => {\n const result = await graphqlFetch<{ removeWorkspaceMember: boolean }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(RemoveWorkspaceMemberDocument),\n variables: { id },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true, // Required by gateway RBAC for wspace-scoped operations\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.removeWorkspaceMember;\n },\n onSuccess: (_, id) => {\n queryClient.invalidateQueries({ queryKey: ['workspaceMembers'] });\n queryClient.invalidateQueries({ queryKey: ['userWorkspaces'] });\n emit('workspace-member.removed', { memberId: id, source: 'microfe-workspaces' });\n },\n });\n};\n\n/**\n * Hook to remove a user from a workspace\n * Requires x-workspace-id header for workspace context\n */\nexport const useRemoveUserFromWorkspace = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useMutation({\n mutationFn: async (userId: string): Promise<boolean> => {\n const result = await graphqlFetch<{ removeUserFromWorkspace: boolean }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(RemoveUserFromWorkspaceDocument),\n variables: { userId },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true, // Auto-read from profile context for x-workspace-id header\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.removeUserFromWorkspace;\n },\n onSuccess: (_, userId) => {\n queryClient.invalidateQueries({ queryKey: ['workspaceMembers'] });\n queryClient.invalidateQueries({ queryKey: ['userWorkspaces', userId] });\n emit('workspace-member.removed', { userId, source: 'microfe-workspaces' });\n },\n });\n};\n\n/**\n * NOTE: The updateWorkspaceMemberRoles mutation has been removed from the backend.\n * Role management is now handled via invitations - when creating an invitation,\n * you can specify roleIds that will be assigned when the invitation is accepted.\n *\n * Use CreateInvitationInput.roleIds to assign roles to new members.\n */\n\n/**\n * Hook to create a workspace invitation\n * Uses x-workspace-id header as fallback when input.workspaceId is not provided\n */\nexport const useCreateInvitation = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useMutation({\n mutationFn: async (input: CreateInvitationInput): Promise<WorkspaceInvitation> => {\n const result = await graphqlFetch<{ createInvitation: WorkspaceInvitation }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(CreateInvitationDocument),\n variables: { input },\n workspaceId: input.workspaceId || effectiveWorkspaceId || undefined,\n workspaceToken: true, // Auto-read from profile context for x-workspace-id header fallback\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.createInvitation;\n },\n onSuccess: (data) => {\n if (data.workspaceId) {\n queryClient.invalidateQueries({ queryKey: ['workspaceInvitations', data.workspaceId] });\n }\n emit('workspace-invitation.created', {\n invitationId: data.id,\n workspaceId: data.workspaceId,\n email: data.email,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n\n/**\n * Hook to update an invitation\n */\nexport const useUpdateInvitation = () => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n\n return useMutation({\n mutationFn: async ({\n id,\n input,\n }: {\n id: string;\n input: UpdateInvitationInput;\n }): Promise<WorkspaceInvitation> => {\n const result = await graphqlFetch<{ updateInvitation: WorkspaceInvitation }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(UpdateInvitationDocument),\n variables: { id, input },\n workspaceId: workspaceId || undefined,\n workspaceToken: true, // Required by gateway RBAC for wspace-scoped operations\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.updateInvitation;\n },\n onSuccess: (data) => {\n queryClient.invalidateQueries({ queryKey: ['workspaceInvitations'] });\n emit('workspace-invitation.created', {\n invitationId: data.id,\n workspaceId: data.workspaceId,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n\n/**\n * Hook to accept an invitation\n */\nexport const useAcceptInvitation = () => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n\n return useMutation({\n mutationFn: async (id: string): Promise<WorkspaceInvitation> => {\n const result = await graphqlFetch<{ acceptInvitation: WorkspaceInvitation }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(AcceptInvitationDocument),\n variables: { id },\n workspaceId: workspaceId || undefined,\n workspaceToken: true, // Required by gateway RBAC for wspace-scoped operations\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.acceptInvitation;\n },\n onSuccess: (data) => {\n queryClient.invalidateQueries({ queryKey: ['workspaceInvitations'] });\n queryClient.invalidateQueries({ queryKey: ['workspaceMembers'] });\n queryClient.invalidateQueries({ queryKey: ['userWorkspaces'] });\n emit('workspace-invitation.accepted', {\n invitationId: data.id,\n workspaceId: data.workspaceId,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n\n/**\n * Hook to reject an invitation\n */\nexport const useRejectInvitation = () => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n\n return useMutation({\n mutationFn: async (id: string): Promise<WorkspaceInvitation> => {\n const result = await graphqlFetch<{ rejectInvitation: WorkspaceInvitation }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(RejectInvitationDocument),\n variables: { id },\n workspaceId: workspaceId || undefined,\n workspaceToken: true, // Required by gateway RBAC for wspace-scoped operations\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.rejectInvitation;\n },\n onSuccess: (data) => {\n queryClient.invalidateQueries({ queryKey: ['workspaceInvitations'] });\n emit('workspace-invitation.rejected', {\n invitationId: data.id,\n workspaceId: data.workspaceId,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n\n/**\n * Hook to cancel an invitation\n */\nexport const useCancelInvitation = () => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n\n return useMutation({\n mutationFn: async (id: string): Promise<WorkspaceInvitation> => {\n const result = await graphqlFetch<{ cancelInvitation: WorkspaceInvitation }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(CancelInvitationDocument),\n variables: { id },\n workspaceId: workspaceId || undefined,\n workspaceToken: true, // Required by gateway RBAC for wspace-scoped operations\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.cancelInvitation;\n },\n onSuccess: (data) => {\n queryClient.invalidateQueries({ queryKey: ['workspaceInvitations'] });\n emit('workspace-invitation.cancelled', {\n invitationId: data.id,\n workspaceId: data.workspaceId,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n\n/**\n * Hook to resend an invitation\n */\nexport const useResendInvitation = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useMutation({\n mutationFn: async (id: string): Promise<WorkspaceInvitation> => {\n const result = await graphqlFetch<{ resendInvitation: WorkspaceInvitation }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(ResendInvitationDocument),\n variables: { id },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true, // Required by gateway RBAC for wspace-scoped operations\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.resendInvitation;\n },\n onSuccess: (data) => {\n queryClient.invalidateQueries({ queryKey: ['workspaceInvitations'] });\n emit('workspace-invitation.resent', {\n invitationId: data.id,\n workspaceId: data.workspaceId,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n\n/**\n * Hook to delete an invitation\n */\nexport const useDeleteInvitation = () => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n\n return useMutation({\n mutationFn: async (id: string): Promise<boolean> => {\n const result = await graphqlFetch<{ deleteInvitation: boolean }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(DeleteInvitationDocument),\n variables: { id },\n workspaceId: workspaceId || undefined,\n workspaceToken: true, // Required by gateway RBAC for wspace-scoped operations\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.deleteInvitation;\n },\n onSuccess: (_, id) => {\n queryClient.invalidateQueries({ queryKey: ['workspaceInvitations'] });\n emit('workspace-invitation.deleted', { invitationId: id, source: 'microfe-workspaces' });\n },\n });\n};\n\n/**\n * Hook to bulk create invitations\n * Uses x-workspace-id header as fallback when inputs[].workspaceId is not provided\n */\nexport const useBulkCreateInvitations = () => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: async (inputs: CreateInvitationInput[]): Promise<WorkspaceInvitation[]> => {\n const result = await graphqlFetch<{ bulkCreateInvitations: WorkspaceInvitation[] }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: print(BulkCreateInvitationsDocument),\n variables: { inputs },\n workspaceId: inputs[0]?.workspaceId || workspaceId || undefined,\n workspaceToken: true, // Auto-read from profile context for x-workspace-id header fallback\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.bulkCreateInvitations;\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workspaceInvitations'] });\n },\n });\n};\n"],"mappings":";;;;;;;AA8BA,IAAa,UAA8B;CACzC,IAAM,EAAE,cAAW,mBAAgB,GAAsB,EACnD,IAAc,GAAgB,EAC9B,EAAE,YAAS,GAA2B;AAE5C,QAAO,EAAY;EACjB,YAAY,OAAO,MAA6D;GAC9E,IAAM,IAAS,MAAM,EAAsD;IACzE,SAAS;IACT,WAAW,KAAa,KAAA;IACxB,OAAO,EAAM,EAA2B;IACxC,WAAW,EAAE,UAAO;IACpB,aAAa,KAAe,KAAA;IAC5B,gBAAgB;IACjB,CAAC;AAEF,OAAI,EAAO,QAAQ,OACjB,OAAU,MAAM,EAAO,OAAO,IAAI,WAAW,gBAAgB;AAG/D,UAAO,EAAO,KAAM;;EAEtB,YAAY,MAAS;AAGnB,GAFA,EAAY,kBAAkB,EAAE,UAAU,CAAC,oBAAoB,EAAK,YAAY,EA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Ae,KAAe,KAAA;IACtD,gBAAgB;IACjB,CAAC;AAEF,OAAI,EAAO,QAAQ,OACjB,OAAU,MAAM,EAAO,OAAO,IAAI,WAAW,gBAAgB;AAG/D,UAAO,EAAO,KAAM;;EAEtB,iBAAiB;AACf,KAAY,kBAAkB,EAAE,UAAU,CAAC,uBAAuB,EAAE,CAAC;;EAExE,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { CreateProjectInput, UpdateProjectInput, Project } from '../types';
2
+
3
+ /**
4
+ * Hook to create a new project
5
+ */
6
+ export declare const useCreateProject: (workspaceIdOverride?: string) => import('@tanstack/react-query').UseMutationResult<Project, Error, CreateProjectInput, unknown>;
7
+ /**
8
+ * Hook to update an existing project
9
+ */
10
+ export declare const useUpdateProject: (workspaceIdOverride?: string) => import('@tanstack/react-query').UseMutationResult<Project, Error, {
11
+ id: string;
12
+ input: UpdateProjectInput;
13
+ }, unknown>;
14
+ /**
15
+ * Hook to delete a project
16
+ */
17
+ export declare const useDeleteProject: (workspaceIdOverride?: string) => import('@tanstack/react-query').UseMutationResult<boolean, Error, string, unknown>;
18
+ /**
19
+ * Hook to archive a project
20
+ */
21
+ export declare const useArchiveProject: (workspaceIdOverride?: string) => import('@tanstack/react-query').UseMutationResult<Project, Error, string, unknown>;
22
+ /**
23
+ * Hook to unarchive a project
24
+ */
25
+ export declare const useUnarchiveProject: (workspaceIdOverride?: string) => import('@tanstack/react-query').UseMutationResult<Project, Error, string, unknown>;
26
+ //# sourceMappingURL=useProjectMutations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProjectMutations.d.ts","sourceRoot":"","sources":["../../src/hooks/useProjectMutations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AA2DhF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,sBAAsB,MAAM,mGAoC5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,sBAAsB,MAAM;QAWnD,MAAM;WACH,kBAAkB;WA4B9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,sBAAsB,MAAM,uFA8B5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,sBAAsB,MAAM,uFAkC7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,sBAAsB,MAAM,uFAkC/D,CAAC"}
@@ -0,0 +1,127 @@
1
+ import { useWorkspacesContext as e } from "../providers/WorkspacesProvider.js";
2
+ import { useWorkspacesEventEmitter as t } from "./useWorkspacesEventEmitter.js";
3
+ import { useMutation as n, useQueryClient as r } from "@tanstack/react-query";
4
+ import { graphqlFetch as i } from "@burdenoff/fe-libs/shared/graphql";
5
+ //#region src/hooks/useProjectMutations.ts
6
+ var a = "\n mutation CreateProject($input: CreateProjectInput!) {\n createProject(input: $input) {\n id\n name\n key\n workspaceId\n creatorId\n status\n tags\n createdAt\n }\n }\n", o = "\n mutation UpdateProject($id: ID!, $input: UpdateProjectInput!) {\n updateProject(id: $id, input: $input) {\n id\n name\n key\n status\n config\n tags\n archived\n updatedAt\n }\n }\n", s = "\n mutation DeleteProject($id: ID!) {\n deleteProject(id: $id)\n }\n", c = "\n mutation ArchiveProject($id: ID!) {\n archiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", l = "\n mutation UnarchiveProject($id: ID!) {\n unarchiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", u = (o) => {
7
+ let { authToken: s, onProjectCreate: c, workspaceId: l } = e(), u = r(), { emit: d } = t(), f = o || l;
8
+ return n({
9
+ mutationFn: async (e) => {
10
+ let t = await i({
11
+ gateway: "workspace",
12
+ authToken: s || void 0,
13
+ query: a,
14
+ variables: { input: e },
15
+ workspaceId: f || void 0,
16
+ workspaceToken: !0
17
+ });
18
+ if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
19
+ return t.data.createProject;
20
+ },
21
+ onSuccess: (e) => {
22
+ u.invalidateQueries({ queryKey: ["projects"] }), u.invalidateQueries({ queryKey: ["myProjects"] }), d("project.created", {
23
+ projectId: e.id,
24
+ workspaceId: e.workspaceId,
25
+ source: "microfe-workspaces"
26
+ }), c && c(e);
27
+ }
28
+ });
29
+ }, d = (a) => {
30
+ let { authToken: s, workspaceId: c } = e(), l = r(), { emit: u } = t(), d = a || c;
31
+ return n({
32
+ mutationFn: async ({ id: e, input: t }) => {
33
+ let n = await i({
34
+ gateway: "workspace",
35
+ authToken: s || void 0,
36
+ query: o,
37
+ variables: {
38
+ id: e,
39
+ input: t
40
+ },
41
+ workspaceId: d || void 0,
42
+ workspaceToken: !0
43
+ });
44
+ if (n.errors?.length) throw Error(n.errors[0]?.message || "GraphQL error");
45
+ return n.data.updateProject;
46
+ },
47
+ onSuccess: (e) => {
48
+ l.invalidateQueries({ queryKey: ["projects"] }), l.invalidateQueries({ queryKey: ["project", e.id] }), l.invalidateQueries({ queryKey: ["myProjects"] }), u("project.updated", {
49
+ projectId: e.id,
50
+ workspaceId: e.workspaceId,
51
+ source: "microfe-workspaces"
52
+ });
53
+ }
54
+ });
55
+ }, f = (a) => {
56
+ let { authToken: o, workspaceId: c } = e(), l = r(), { emit: u } = t(), d = a || c;
57
+ return n({
58
+ mutationFn: async (e) => {
59
+ let t = await i({
60
+ gateway: "workspace",
61
+ authToken: o || void 0,
62
+ query: s,
63
+ variables: { id: e },
64
+ workspaceId: d || void 0,
65
+ workspaceToken: !0
66
+ });
67
+ if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
68
+ return t.data.deleteProject;
69
+ },
70
+ onSuccess: (e, t) => {
71
+ l.invalidateQueries({ queryKey: ["projects"] }), l.invalidateQueries({ queryKey: ["project", t] }), l.invalidateQueries({ queryKey: ["myProjects"] }), u("project.deleted", {
72
+ projectId: t,
73
+ source: "microfe-workspaces"
74
+ });
75
+ }
76
+ });
77
+ }, p = (a) => {
78
+ let { authToken: o, workspaceId: s } = e(), l = r(), { emit: u } = t(), d = a || s;
79
+ return n({
80
+ mutationFn: async (e) => {
81
+ let t = await i({
82
+ gateway: "workspace",
83
+ authToken: o || void 0,
84
+ query: c,
85
+ variables: { id: e },
86
+ workspaceId: d || void 0,
87
+ workspaceToken: !0
88
+ });
89
+ if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
90
+ return t.data.archiveProject;
91
+ },
92
+ onSuccess: (e) => {
93
+ l.invalidateQueries({ queryKey: ["projects"] }), l.invalidateQueries({ queryKey: ["project", e.id] }), l.invalidateQueries({ queryKey: ["myProjects"] }), u("project.archived", {
94
+ projectId: e.id,
95
+ workspaceId: e.workspaceId,
96
+ source: "microfe-workspaces"
97
+ });
98
+ }
99
+ });
100
+ }, m = (a) => {
101
+ let { authToken: o, workspaceId: s } = e(), c = r(), { emit: u } = t(), d = a || s;
102
+ return n({
103
+ mutationFn: async (e) => {
104
+ let t = await i({
105
+ gateway: "workspace",
106
+ authToken: o || void 0,
107
+ query: l,
108
+ variables: { id: e },
109
+ workspaceId: d || void 0,
110
+ workspaceToken: !0
111
+ });
112
+ if (t.errors?.length) throw Error(t.errors[0]?.message || "GraphQL error");
113
+ return t.data.unarchiveProject;
114
+ },
115
+ onSuccess: (e) => {
116
+ c.invalidateQueries({ queryKey: ["projects"] }), c.invalidateQueries({ queryKey: ["project", e.id] }), c.invalidateQueries({ queryKey: ["myProjects"] }), u("project.unarchived", {
117
+ projectId: e.id,
118
+ workspaceId: e.workspaceId,
119
+ source: "microfe-workspaces"
120
+ });
121
+ }
122
+ });
123
+ };
124
+ //#endregion
125
+ export { p as useArchiveProject, u as useCreateProject, f as useDeleteProject, m as useUnarchiveProject, d as useUpdateProject };
126
+
127
+ //# sourceMappingURL=useProjectMutations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProjectMutations.js","names":[],"sources":["../../src/hooks/useProjectMutations.ts"],"sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\nimport { useWorkspacesContext } from '../providers/WorkspacesProvider';\nimport type { CreateProjectInput, UpdateProjectInput, Project } from '../types';\nimport { useWorkspacesEventEmitter } from './useWorkspacesEventEmitter';\n\nconst CREATE_PROJECT_MUTATION = `\n mutation CreateProject($input: CreateProjectInput!) {\n createProject(input: $input) {\n id\n name\n key\n workspaceId\n creatorId\n status\n tags\n createdAt\n }\n }\n`;\n\nconst UPDATE_PROJECT_MUTATION = `\n mutation UpdateProject($id: ID!, $input: UpdateProjectInput!) {\n updateProject(id: $id, input: $input) {\n id\n name\n key\n status\n config\n tags\n archived\n updatedAt\n }\n }\n`;\n\nconst DELETE_PROJECT_MUTATION = `\n mutation DeleteProject($id: ID!) {\n deleteProject(id: $id)\n }\n`;\n\nconst ARCHIVE_PROJECT_MUTATION = `\n mutation ArchiveProject($id: ID!) {\n archiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n`;\n\nconst UNARCHIVE_PROJECT_MUTATION = `\n mutation UnarchiveProject($id: ID!) {\n unarchiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n`;\n\n/**\n * Hook to create a new project\n */\nexport const useCreateProject = (workspaceIdOverride?: string) => {\n const { authToken, onProjectCreate, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useMutation({\n mutationFn: async (input: CreateProjectInput): Promise<Project> => {\n const result = await graphqlFetch<{ createProject: Project }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: CREATE_PROJECT_MUTATION,\n variables: { input },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true, // Auto-read from profile context for x-workspace-id header (required by gateway RBAC)\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.createProject;\n },\n onSuccess: (project) => {\n queryClient.invalidateQueries({ queryKey: ['projects'] });\n queryClient.invalidateQueries({ queryKey: ['myProjects'] });\n emit('project.created', {\n projectId: project.id,\n workspaceId: project.workspaceId,\n source: 'microfe-workspaces',\n });\n if (onProjectCreate) {\n onProjectCreate(project);\n }\n },\n });\n};\n\n/**\n * Hook to update an existing project\n */\nexport const useUpdateProject = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useMutation({\n mutationFn: async ({\n id,\n input,\n }: {\n id: string;\n input: UpdateProjectInput;\n }): Promise<Project> => {\n const result = await graphqlFetch<{ updateProject: Project }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: UPDATE_PROJECT_MUTATION,\n variables: { id, input },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true, // Auto-read from profile context for x-workspace-id header (required by gateway RBAC)\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.updateProject;\n },\n onSuccess: (project) => {\n queryClient.invalidateQueries({ queryKey: ['projects'] });\n queryClient.invalidateQueries({ queryKey: ['project', project.id] });\n queryClient.invalidateQueries({ queryKey: ['myProjects'] });\n emit('project.updated', {\n projectId: project.id,\n workspaceId: project.workspaceId,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n\n/**\n * Hook to delete a project\n */\nexport const useDeleteProject = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useMutation({\n mutationFn: async (id: string): Promise<boolean> => {\n const result = await graphqlFetch<{ deleteProject: boolean }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: DELETE_PROJECT_MUTATION,\n variables: { id },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true, // Auto-read from profile context for x-workspace-id header (required by gateway RBAC)\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.deleteProject;\n },\n onSuccess: (_, id) => {\n queryClient.invalidateQueries({ queryKey: ['projects'] });\n queryClient.invalidateQueries({ queryKey: ['project', id] });\n queryClient.invalidateQueries({ queryKey: ['myProjects'] });\n emit('project.deleted', { projectId: id, source: 'microfe-workspaces' });\n },\n });\n};\n\n/**\n * Hook to archive a project\n */\nexport const useArchiveProject = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useMutation({\n mutationFn: async (id: string): Promise<Project> => {\n const result = await graphqlFetch<{ archiveProject: Project }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: ARCHIVE_PROJECT_MUTATION,\n variables: { id },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true, // Auto-read from profile context for x-workspace-id header (required by gateway RBAC)\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.archiveProject;\n },\n onSuccess: (project) => {\n queryClient.invalidateQueries({ queryKey: ['projects'] });\n queryClient.invalidateQueries({ queryKey: ['project', project.id] });\n queryClient.invalidateQueries({ queryKey: ['myProjects'] });\n emit('project.archived', {\n projectId: project.id,\n workspaceId: project.workspaceId,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n\n/**\n * Hook to unarchive a project\n */\nexport const useUnarchiveProject = (workspaceIdOverride?: string) => {\n const { authToken, workspaceId } = useWorkspacesContext();\n const queryClient = useQueryClient();\n const { emit } = useWorkspacesEventEmitter();\n const effectiveWorkspaceId = workspaceIdOverride || workspaceId;\n\n return useMutation({\n mutationFn: async (id: string): Promise<Project> => {\n const result = await graphqlFetch<{ unarchiveProject: Project }>({\n gateway: 'workspace',\n authToken: authToken || undefined,\n query: UNARCHIVE_PROJECT_MUTATION,\n variables: { id },\n workspaceId: effectiveWorkspaceId || undefined,\n workspaceToken: true, // Auto-read from profile context for x-workspace-id header (required by gateway RBAC)\n });\n\n if (result.errors?.length) {\n throw new Error(result.errors[0]?.message || 'GraphQL error');\n }\n\n return result.data!.unarchiveProject;\n },\n onSuccess: (project) => {\n queryClient.invalidateQueries({ queryKey: ['projects'] });\n queryClient.invalidateQueries({ queryKey: ['project', project.id] });\n queryClient.invalidateQueries({ queryKey: ['myProjects'] });\n emit('project.unarchived', {\n projectId: project.id,\n workspaceId: project.workspaceId,\n source: 'microfe-workspaces',\n });\n },\n });\n};\n"],"mappings":";;;;;AAMA,IAAM,IAA0B,+NAe1B,IAA0B,4OAe1B,IAA0B,6EAM1B,IAA2B,mIAU3B,IAA6B,uIAatB,KAAoB,MAAiC;CAChE,IAAM,EAAE,cAAW,oBAAiB,mBAAgB,GAAsB,EACpE,IAAc,GAAgB,EAC9B,EAAE,YAAS,GAA2B,EACtC,IAAuB,KAAuB;AAEpD,QAAO,EAAY;EACjB,YAAY,OAAO,MAAgD;GACjE,IAAM,IAAS,MAAM,EAAyC;IAC5D,SAAS;IACT,WAAW,KAAa,KAAA;IACxB,OAAO;IACP,WAAW,EAAE,UAAO;IACpB,aAAa,KAAwB,KAAA;IACrC,gBAAgB;IACjB,CAAC;AAEF,OAAI,EAAO,QAAQ,OACjB,OAAU,MAAM,EAAO,OAAO,IAAI,WAAW,gBAAgB;AAG/D,UAAO,EAAO,KAAM;;EAEtB,YAAY,MAAY;AAQtB,GAPA,EAAY,kBAAkB,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,EACzD,EAAY,kBAAkB,EAAE,UAAU,CAAC,aAAa,EAAE,CAAC,EAC3D,EAAK,mBAAmB;IACtB,WAAW,EAAQ;IACnB,aAAa,EAAQ;IACrB,QAAQ;IACT,CAAC,EACE,KACF,EAAgB,EAAQ;;EAG7B,CAAC;GAMS,KAAoB,MAAiC;CAChE,IAAM,EA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BAAgB;IACjB,CAAC;AAEF,OAAI,EAAO,QAAQ,OACjB,OAAU,MAAM,EAAO,OAAO,IAAI,WAAW,gBAAgB;AAG/D,UAAO,EAAO,KAAM;;EAEtB,YAAY,MAAY;AAItB,GAHA,EAAY,kBAAkB,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,EACzD,EAAY,kBAAkB,EAAE,UAAU,CAAC,WAAW,EAAQ,GAAG,EAAE,CAAC,EACpE,EAAY,kBAAkB,EAAE,UAAU,CAAC,aAAa,EAAE,CAAC,EAC3D,EAAK,sBAAsB;IACzB,WAAW,EAAQ;IACnB,aAAa,EAAQ;IACrB,QAAQ;IACT,CAAC;;EAEL,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ProjectFilters, ProjectList, Project, PaginationInput } from '../types';
2
+
3
+ /**
4
+ * Hook to fetch all projects with filtering and pagination
5
+ */
6
+ export declare const useProjects: (filters?: ProjectFilters, pagination?: PaginationInput, workspaceIdOverride?: string) => import('@tanstack/react-query').UseQueryResult<ProjectList, Error>;
7
+ /**
8
+ * Hook to fetch a single project by ID
9
+ */
10
+ export declare const useProject: (id: string, workspaceIdOverride?: string) => import('@tanstack/react-query').UseQueryResult<Project, Error>;
11
+ /**
12
+ * Hook to fetch current user's projects
13
+ */
14
+ export declare const useMyProjects: (pagination?: PaginationInput) => import('@tanstack/react-query').UseQueryResult<ProjectList, Error>;
15
+ export declare const useProjectMembersCount: (projectId: string, workspaceIdOverride?: string) => import('@tanstack/react-query').UseQueryResult<number, Error>;
16
+ //# sourceMappingURL=useProjects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProjects.d.ts","sourceRoot":"","sources":["../../src/hooks/useProjects.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAwEtF;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,cAAc,EACxB,aAAa,eAAe,EAC5B,sBAAsB,MAAM,uEAgC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,IAAI,MAAM,EAAE,sBAAsB,MAAM,mEAyBlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,aAAa,eAAe,uEAuBzD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,EAAE,sBAAsB,MAAM,kEA2BrF,CAAC"}