@thunderid/react 1.0.7 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/api/updateMeCredentials.d.ts +33 -0
  2. package/dist/api/updateMeCredentials.d.ts.map +1 -0
  3. package/dist/api/updateMeCredentials.js +29 -0
  4. package/dist/api/updateMeCredentials.js.map +1 -0
  5. package/dist/cjs/api/updateMeCredentials.cjs +31 -0
  6. package/dist/cjs/api/updateMeCredentials.cjs.map +1 -0
  7. package/dist/cjs/components/presentation/ChangeCredential/BaseChangeCredential.cjs +187 -0
  8. package/dist/cjs/components/presentation/ChangeCredential/BaseChangeCredential.cjs.map +1 -0
  9. package/dist/cjs/components/presentation/ChangeCredential/BaseChangeCredential.styles.cjs +108 -0
  10. package/dist/cjs/components/presentation/ChangeCredential/BaseChangeCredential.styles.cjs.map +1 -0
  11. package/dist/cjs/components/presentation/ChangeCredential/ChangeCredential.cjs +123 -0
  12. package/dist/cjs/components/presentation/ChangeCredential/ChangeCredential.cjs.map +1 -0
  13. package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.cjs +1 -1
  14. package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.cjs +2 -2
  15. package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.cjs.map +1 -1
  16. package/dist/cjs/components/presentation/UserDropdown/UserDropdown.cjs +8 -4
  17. package/dist/cjs/components/presentation/UserDropdown/UserDropdown.cjs.map +1 -1
  18. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.styles.cjs +2 -0
  19. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.styles.cjs.map +1 -1
  20. package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs +2 -2
  21. package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs.map +1 -1
  22. package/dist/cjs/contexts/Theme/ThemeProvider.cjs +26 -4
  23. package/dist/cjs/contexts/Theme/ThemeProvider.cjs.map +1 -1
  24. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs +2 -0
  25. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs.map +1 -1
  26. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +7 -1
  27. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
  28. package/dist/cjs/hooks/agents/useCreateAgent.cjs +26 -0
  29. package/dist/cjs/hooks/agents/useCreateAgent.cjs.map +1 -0
  30. package/dist/cjs/hooks/agents/useDeleteAgent.cjs +26 -0
  31. package/dist/cjs/hooks/agents/useDeleteAgent.cjs.map +1 -0
  32. package/dist/cjs/hooks/agents/useGetAgent.cjs +30 -0
  33. package/dist/cjs/hooks/agents/useGetAgent.cjs.map +1 -0
  34. package/dist/cjs/hooks/agents/useGetAgents.cjs +31 -0
  35. package/dist/cjs/hooks/agents/useGetAgents.cjs.map +1 -0
  36. package/dist/cjs/hooks/agents/useUpdateAgent.cjs +27 -0
  37. package/dist/cjs/hooks/agents/useUpdateAgent.cjs.map +1 -0
  38. package/dist/cjs/hooks/applications/useCreateApplication.cjs +31 -0
  39. package/dist/cjs/hooks/applications/useCreateApplication.cjs.map +1 -0
  40. package/dist/cjs/hooks/applications/useDeleteApplication.cjs +26 -0
  41. package/dist/cjs/hooks/applications/useDeleteApplication.cjs.map +1 -0
  42. package/dist/cjs/hooks/applications/useGetApplication.cjs +35 -0
  43. package/dist/cjs/hooks/applications/useGetApplication.cjs.map +1 -0
  44. package/dist/cjs/hooks/applications/useGetApplications.cjs +36 -0
  45. package/dist/cjs/hooks/applications/useGetApplications.cjs.map +1 -0
  46. package/dist/cjs/hooks/applications/useUpdateApplication.cjs +27 -0
  47. package/dist/cjs/hooks/applications/useUpdateApplication.cjs.map +1 -0
  48. package/dist/cjs/hooks/useManagementEndpoint.cjs +25 -0
  49. package/dist/cjs/hooks/useManagementEndpoint.cjs.map +1 -0
  50. package/dist/cjs/hooks/useResourceMutation.cjs +72 -0
  51. package/dist/cjs/hooks/useResourceMutation.cjs.map +1 -0
  52. package/dist/cjs/hooks/useResourceQuery.cjs +86 -0
  53. package/dist/cjs/hooks/useResourceQuery.cjs.map +1 -0
  54. package/dist/cjs/hooks/users/useCreateUser.cjs +26 -0
  55. package/dist/cjs/hooks/users/useCreateUser.cjs.map +1 -0
  56. package/dist/cjs/hooks/users/useDeleteUser.cjs +26 -0
  57. package/dist/cjs/hooks/users/useDeleteUser.cjs.map +1 -0
  58. package/dist/cjs/hooks/users/useGetUser.cjs +30 -0
  59. package/dist/cjs/hooks/users/useGetUser.cjs.map +1 -0
  60. package/dist/cjs/hooks/users/useGetUsers.cjs +38 -0
  61. package/dist/cjs/hooks/users/useGetUsers.cjs.map +1 -0
  62. package/dist/cjs/hooks/users/useUpdateUser.cjs +27 -0
  63. package/dist/cjs/hooks/users/useUpdateUser.cjs.map +1 -0
  64. package/dist/cjs/index.cjs +144 -0
  65. package/dist/cjs/utils/createAuthenticatedFetcher.cjs +43 -0
  66. package/dist/cjs/utils/createAuthenticatedFetcher.cjs.map +1 -0
  67. package/dist/cjs/utils/createResourceInvalidator.cjs +38 -0
  68. package/dist/cjs/utils/createResourceInvalidator.cjs.map +1 -0
  69. package/dist/components/presentation/ChangeCredential/BaseChangeCredential.d.ts +100 -0
  70. package/dist/components/presentation/ChangeCredential/BaseChangeCredential.d.ts.map +1 -0
  71. package/dist/components/presentation/ChangeCredential/BaseChangeCredential.js +183 -0
  72. package/dist/components/presentation/ChangeCredential/BaseChangeCredential.js.map +1 -0
  73. package/dist/components/presentation/ChangeCredential/BaseChangeCredential.styles.d.ts +10 -0
  74. package/dist/components/presentation/ChangeCredential/BaseChangeCredential.styles.d.ts.map +1 -0
  75. package/dist/components/presentation/ChangeCredential/BaseChangeCredential.styles.js +108 -0
  76. package/dist/components/presentation/ChangeCredential/BaseChangeCredential.styles.js.map +1 -0
  77. package/dist/components/presentation/ChangeCredential/ChangeCredential.d.ts +55 -0
  78. package/dist/components/presentation/ChangeCredential/ChangeCredential.d.ts.map +1 -0
  79. package/dist/components/presentation/ChangeCredential/ChangeCredential.js +119 -0
  80. package/dist/components/presentation/ChangeCredential/ChangeCredential.js.map +1 -0
  81. package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.js +1 -1
  82. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +5 -0
  83. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts.map +1 -1
  84. package/dist/components/presentation/UserDropdown/BaseUserDropdown.js +2 -2
  85. package/dist/components/presentation/UserDropdown/BaseUserDropdown.js.map +1 -1
  86. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +12 -0
  87. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts.map +1 -1
  88. package/dist/components/presentation/UserDropdown/UserDropdown.js +8 -4
  89. package/dist/components/presentation/UserDropdown/UserDropdown.js.map +1 -1
  90. package/dist/components/presentation/UserProfile/BaseUserProfile.styles.d.ts.map +1 -1
  91. package/dist/components/presentation/UserProfile/BaseUserProfile.styles.js +2 -0
  92. package/dist/components/presentation/UserProfile/BaseUserProfile.styles.js.map +1 -1
  93. package/dist/components/primitives/PasswordField/PasswordField.d.ts +6 -0
  94. package/dist/components/primitives/PasswordField/PasswordField.d.ts.map +1 -1
  95. package/dist/components/primitives/PasswordField/PasswordField.js +2 -2
  96. package/dist/components/primitives/PasswordField/PasswordField.js.map +1 -1
  97. package/dist/contexts/Theme/ThemeProvider.d.ts +1 -1
  98. package/dist/contexts/Theme/ThemeProvider.d.ts.map +1 -1
  99. package/dist/contexts/Theme/ThemeProvider.js +27 -5
  100. package/dist/contexts/Theme/ThemeProvider.js.map +1 -1
  101. package/dist/contexts/ThunderID/ThunderIDContext.d.ts +12 -1
  102. package/dist/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
  103. package/dist/contexts/ThunderID/ThunderIDContext.js +2 -0
  104. package/dist/contexts/ThunderID/ThunderIDContext.js.map +1 -1
  105. package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  106. package/dist/contexts/ThunderID/ThunderIDProvider.js +7 -1
  107. package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
  108. package/dist/hooks/agents/useCreateAgent.d.ts +11 -0
  109. package/dist/hooks/agents/useCreateAgent.d.ts.map +1 -0
  110. package/dist/hooks/agents/useCreateAgent.js +24 -0
  111. package/dist/hooks/agents/useCreateAgent.js.map +1 -0
  112. package/dist/hooks/agents/useDeleteAgent.d.ts +10 -0
  113. package/dist/hooks/agents/useDeleteAgent.d.ts.map +1 -0
  114. package/dist/hooks/agents/useDeleteAgent.js +24 -0
  115. package/dist/hooks/agents/useDeleteAgent.js.map +1 -0
  116. package/dist/hooks/agents/useGetAgent.d.ts +12 -0
  117. package/dist/hooks/agents/useGetAgent.d.ts.map +1 -0
  118. package/dist/hooks/agents/useGetAgent.js +28 -0
  119. package/dist/hooks/agents/useGetAgent.js.map +1 -0
  120. package/dist/hooks/agents/useGetAgents.d.ts +19 -0
  121. package/dist/hooks/agents/useGetAgents.d.ts.map +1 -0
  122. package/dist/hooks/agents/useGetAgents.js +29 -0
  123. package/dist/hooks/agents/useGetAgents.js.map +1 -0
  124. package/dist/hooks/agents/useUpdateAgent.d.ts +18 -0
  125. package/dist/hooks/agents/useUpdateAgent.d.ts.map +1 -0
  126. package/dist/hooks/agents/useUpdateAgent.js +25 -0
  127. package/dist/hooks/agents/useUpdateAgent.js.map +1 -0
  128. package/dist/hooks/applications/useCreateApplication.d.ts +16 -0
  129. package/dist/hooks/applications/useCreateApplication.d.ts.map +1 -0
  130. package/dist/hooks/applications/useCreateApplication.js +29 -0
  131. package/dist/hooks/applications/useCreateApplication.js.map +1 -0
  132. package/dist/hooks/applications/useDeleteApplication.d.ts +10 -0
  133. package/dist/hooks/applications/useDeleteApplication.d.ts.map +1 -0
  134. package/dist/hooks/applications/useDeleteApplication.js +24 -0
  135. package/dist/hooks/applications/useDeleteApplication.js.map +1 -0
  136. package/dist/hooks/applications/useGetApplication.d.ts +17 -0
  137. package/dist/hooks/applications/useGetApplication.d.ts.map +1 -0
  138. package/dist/hooks/applications/useGetApplication.js +33 -0
  139. package/dist/hooks/applications/useGetApplication.js.map +1 -0
  140. package/dist/hooks/applications/useGetApplications.d.ts +24 -0
  141. package/dist/hooks/applications/useGetApplications.d.ts.map +1 -0
  142. package/dist/hooks/applications/useGetApplications.js +34 -0
  143. package/dist/hooks/applications/useGetApplications.js.map +1 -0
  144. package/dist/hooks/applications/useUpdateApplication.d.ts +18 -0
  145. package/dist/hooks/applications/useUpdateApplication.d.ts.map +1 -0
  146. package/dist/hooks/applications/useUpdateApplication.js +25 -0
  147. package/dist/hooks/applications/useUpdateApplication.js.map +1 -0
  148. package/dist/hooks/useManagementEndpoint.d.ts +22 -0
  149. package/dist/hooks/useManagementEndpoint.d.ts.map +1 -0
  150. package/dist/hooks/useManagementEndpoint.js +23 -0
  151. package/dist/hooks/useManagementEndpoint.js.map +1 -0
  152. package/dist/hooks/useResourceMutation.d.ts +51 -0
  153. package/dist/hooks/useResourceMutation.d.ts.map +1 -0
  154. package/dist/hooks/useResourceMutation.js +70 -0
  155. package/dist/hooks/useResourceMutation.js.map +1 -0
  156. package/dist/hooks/useResourceQuery.d.ts +45 -0
  157. package/dist/hooks/useResourceQuery.d.ts.map +1 -0
  158. package/dist/hooks/useResourceQuery.js +83 -0
  159. package/dist/hooks/useResourceQuery.js.map +1 -0
  160. package/dist/hooks/users/useCreateUser.d.ts +11 -0
  161. package/dist/hooks/users/useCreateUser.d.ts.map +1 -0
  162. package/dist/hooks/users/useCreateUser.js +24 -0
  163. package/dist/hooks/users/useCreateUser.js.map +1 -0
  164. package/dist/hooks/users/useDeleteUser.d.ts +10 -0
  165. package/dist/hooks/users/useDeleteUser.d.ts.map +1 -0
  166. package/dist/hooks/users/useDeleteUser.js +24 -0
  167. package/dist/hooks/users/useDeleteUser.js.map +1 -0
  168. package/dist/hooks/users/useGetUser.d.ts +12 -0
  169. package/dist/hooks/users/useGetUser.d.ts.map +1 -0
  170. package/dist/hooks/users/useGetUser.js +28 -0
  171. package/dist/hooks/users/useGetUser.js.map +1 -0
  172. package/dist/hooks/users/useGetUsers.d.ts +17 -0
  173. package/dist/hooks/users/useGetUsers.d.ts.map +1 -0
  174. package/dist/hooks/users/useGetUsers.js +36 -0
  175. package/dist/hooks/users/useGetUsers.js.map +1 -0
  176. package/dist/hooks/users/useUpdateUser.d.ts +18 -0
  177. package/dist/hooks/users/useUpdateUser.d.ts.map +1 -0
  178. package/dist/hooks/users/useUpdateUser.js +25 -0
  179. package/dist/hooks/users/useUpdateUser.js.map +1 -0
  180. package/dist/index.d.ts +29 -0
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +20 -2
  183. package/dist/models/config.d.ts +13 -1
  184. package/dist/models/config.d.ts.map +1 -1
  185. package/dist/utils/createAuthenticatedFetcher.d.ts +14 -0
  186. package/dist/utils/createAuthenticatedFetcher.d.ts.map +1 -0
  187. package/dist/utils/createAuthenticatedFetcher.js +41 -0
  188. package/dist/utils/createAuthenticatedFetcher.js.map +1 -0
  189. package/dist/utils/createResourceInvalidator.d.ts +29 -0
  190. package/dist/utils/createResourceInvalidator.d.ts.map +1 -0
  191. package/dist/utils/createResourceInvalidator.js +36 -0
  192. package/dist/utils/createResourceInvalidator.js.map +1 -0
  193. package/package.json +2 -2
@@ -0,0 +1,24 @@
1
+ import useManagementEndpoint_default from "../useManagementEndpoint.js";
2
+ import useResourceMutation_default from "../useResourceMutation.js";
3
+ import { ApplicationQueryKeys, deleteApplication } from "@thunderid/browser";
4
+
5
+ //#region src/hooks/applications/useDeleteApplication.ts
6
+ /**
7
+ * Deletes an application, then refetches any mounted application lists.
8
+ *
9
+ * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
10
+ * @returns The mutation state. Call `mutate(applicationId)` to delete.
11
+ */
12
+ const useDeleteApplication = (options) => {
13
+ const endpoint = useManagementEndpoint_default("applications");
14
+ return useResourceMutation_default((applicationId, fetcher) => deleteApplication({
15
+ ...endpoint,
16
+ applicationId,
17
+ fetcher
18
+ }), () => [[ApplicationQueryKeys.APPLICATIONS]], options);
19
+ };
20
+ var useDeleteApplication_default = useDeleteApplication;
21
+
22
+ //#endregion
23
+ export { useDeleteApplication_default as default };
24
+ //# sourceMappingURL=useDeleteApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeleteApplication.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation"],"sources":["../../../src/hooks/applications/useDeleteApplication.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ApplicationQueryKeys, deleteApplication} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationOptions, ResourceMutationResult} from '../useResourceMutation';\n\n/**\n * Deletes an application, then refetches any mounted application lists.\n *\n * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.\n * @returns The mutation state. Call `mutate(applicationId)` to delete.\n */\nconst useDeleteApplication = (\n options?: ResourceMutationOptions<void, string>,\n): ResourceMutationResult<void, string> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('applications');\n\n return useResourceMutation(\n (applicationId: string, fetcher) => deleteApplication({...endpoint, applicationId, fetcher}),\n () => [[ApplicationQueryKeys.APPLICATIONS]],\n options,\n );\n};\n\nexport default useDeleteApplication;\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,wBACJ,YACyC;CACzC,MAAMA,WAA+BC,8BAAsB,eAAe;AAE1E,QAAOC,6BACJ,eAAuB,YAAY,kBAAkB;EAAC,GAAG;EAAU;EAAe;EAAQ,CAAC,QACtF,CAAC,CAAC,qBAAqB,aAAa,CAAC,EAC3C,QACD;;AAGH,mCAAe"}
@@ -0,0 +1,17 @@
1
+ import { Application } from '@thunderid/browser';
2
+ import { ResourceQueryOptions, ResourceQueryResult } from '../useResourceQuery';
3
+ /**
4
+ * Fetches a single application. Does nothing until `applicationId` is set.
5
+ *
6
+ * @param applicationId - Identifier of the application.
7
+ * @param options - Query options, including a per-hook `fetcher`.
8
+ * @returns The query state.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const {data: application} = useGetApplication(applicationId);
13
+ * ```
14
+ */
15
+ declare const useGetApplication: (applicationId: string | undefined, options?: ResourceQueryOptions) => ResourceQueryResult<Application>;
16
+ export default useGetApplication;
17
+ //# sourceMappingURL=useGetApplication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetApplication.d.ts","sourceRoot":"","sources":["../../../src/hooks/applications/useGetApplication.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,WAAW,EAAuC,MAAM,oBAAoB,CAAC;AAErF,OAAyB,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAEhG;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,iBAAiB,GACrB,eAAe,MAAM,GAAG,SAAS,EACjC,UAAU,oBAAoB,KAC7B,mBAAmB,CAAC,WAAW,CAQjC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import useManagementEndpoint_default from "../useManagementEndpoint.js";
2
+ import useResourceQuery_default from "../useResourceQuery.js";
3
+ import { ApplicationQueryKeys, getApplication } from "@thunderid/browser";
4
+
5
+ //#region src/hooks/applications/useGetApplication.ts
6
+ /**
7
+ * Fetches a single application. Does nothing until `applicationId` is set.
8
+ *
9
+ * @param applicationId - Identifier of the application.
10
+ * @param options - Query options, including a per-hook `fetcher`.
11
+ * @returns The query state.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const {data: application} = useGetApplication(applicationId);
16
+ * ```
17
+ */
18
+ const useGetApplication = (applicationId, options) => {
19
+ const endpoint = useManagementEndpoint_default("applications");
20
+ return useResourceQuery_default([ApplicationQueryKeys.APPLICATION, applicationId], (fetcher) => getApplication({
21
+ ...endpoint,
22
+ applicationId,
23
+ fetcher
24
+ }), {
25
+ ...options,
26
+ enabled: Boolean(applicationId) && options?.enabled !== false
27
+ });
28
+ };
29
+ var useGetApplication_default = useGetApplication;
30
+
31
+ //#endregion
32
+ export { useGetApplication_default as default };
33
+ //# sourceMappingURL=useGetApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetApplication.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceQuery"],"sources":["../../../src/hooks/applications/useGetApplication.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Application, ApplicationQueryKeys, getApplication} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceQuery, {ResourceQueryOptions, ResourceQueryResult} from '../useResourceQuery';\n\n/**\n * Fetches a single application. Does nothing until `applicationId` is set.\n *\n * @param applicationId - Identifier of the application.\n * @param options - Query options, including a per-hook `fetcher`.\n * @returns The query state.\n *\n * @example\n * ```tsx\n * const {data: application} = useGetApplication(applicationId);\n * ```\n */\nconst useGetApplication = (\n applicationId: string | undefined,\n options?: ResourceQueryOptions,\n): ResourceQueryResult<Application> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('applications');\n\n return useResourceQuery(\n [ApplicationQueryKeys.APPLICATION, applicationId],\n (fetcher) => getApplication({...endpoint, applicationId: applicationId!, fetcher}),\n {...options, enabled: Boolean(applicationId) && options?.enabled !== false},\n );\n};\n\nexport default useGetApplication;\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAM,qBACJ,eACA,YACqC;CACrC,MAAMA,WAA+BC,8BAAsB,eAAe;AAE1E,QAAOC,yBACL,CAAC,qBAAqB,aAAa,cAAc,GAChD,YAAY,eAAe;EAAC,GAAG;EAAyB;EAAgB;EAAQ,CAAC,EAClF;EAAC,GAAG;EAAS,SAAS,QAAQ,cAAc,IAAI,SAAS,YAAY;EAAM,CAC5E;;AAGH,gCAAe"}
@@ -0,0 +1,24 @@
1
+ import { ApplicationListResponse } from '@thunderid/browser';
2
+ import { ResourceQueryOptions, ResourceQueryResult } from '../useResourceQuery';
3
+ /**
4
+ * Parameters for {@link useGetApplications}.
5
+ */
6
+ export interface UseGetApplicationsParams {
7
+ limit?: number;
8
+ offset?: number;
9
+ }
10
+ /**
11
+ * Fetches a page of applications.
12
+ *
13
+ * @param params - Pagination parameters.
14
+ * @param options - Query options, including a per-hook `fetcher`.
15
+ * @returns The query state.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * const {data, isLoading, error} = useGetApplications({limit: 10});
20
+ * ```
21
+ */
22
+ declare const useGetApplications: ({ limit, offset }?: UseGetApplicationsParams, options?: ResourceQueryOptions) => ResourceQueryResult<ApplicationListResponse>;
23
+ export default useGetApplications;
24
+ //# sourceMappingURL=useGetApplications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetApplications.d.ts","sourceRoot":"","sources":["../../../src/hooks/applications/useGetApplications.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,uBAAuB,EAAwC,MAAM,oBAAoB,CAAC;AAElG,OAAyB,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAEhG;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,kBAAkB,GACtB,oBAAiB,wBAA6B,EAC9C,UAAU,oBAAoB,KAC7B,mBAAmB,CAAC,uBAAuB,CAQ7C,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import useManagementEndpoint_default from "../useManagementEndpoint.js";
2
+ import useResourceQuery_default from "../useResourceQuery.js";
3
+ import { ApplicationQueryKeys, getApplications } from "@thunderid/browser";
4
+
5
+ //#region src/hooks/applications/useGetApplications.ts
6
+ /**
7
+ * Fetches a page of applications.
8
+ *
9
+ * @param params - Pagination parameters.
10
+ * @param options - Query options, including a per-hook `fetcher`.
11
+ * @returns The query state.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const {data, isLoading, error} = useGetApplications({limit: 10});
16
+ * ```
17
+ */
18
+ const useGetApplications = ({ limit, offset } = {}, options) => {
19
+ const endpoint = useManagementEndpoint_default("applications");
20
+ return useResourceQuery_default([ApplicationQueryKeys.APPLICATIONS, {
21
+ limit,
22
+ offset
23
+ }], (fetcher) => getApplications({
24
+ ...endpoint,
25
+ fetcher,
26
+ limit,
27
+ offset
28
+ }), options);
29
+ };
30
+ var useGetApplications_default = useGetApplications;
31
+
32
+ //#endregion
33
+ export { useGetApplications_default as default };
34
+ //# sourceMappingURL=useGetApplications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetApplications.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceQuery"],"sources":["../../../src/hooks/applications/useGetApplications.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ApplicationListResponse, ApplicationQueryKeys, getApplications} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceQuery, {ResourceQueryOptions, ResourceQueryResult} from '../useResourceQuery';\n\n/**\n * Parameters for {@link useGetApplications}.\n */\nexport interface UseGetApplicationsParams {\n limit?: number;\n offset?: number;\n}\n\n/**\n * Fetches a page of applications.\n *\n * @param params - Pagination parameters.\n * @param options - Query options, including a per-hook `fetcher`.\n * @returns The query state.\n *\n * @example\n * ```tsx\n * const {data, isLoading, error} = useGetApplications({limit: 10});\n * ```\n */\nconst useGetApplications = (\n {limit, offset}: UseGetApplicationsParams = {},\n options?: ResourceQueryOptions,\n): ResourceQueryResult<ApplicationListResponse> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('applications');\n\n return useResourceQuery(\n [ApplicationQueryKeys.APPLICATIONS, {limit, offset}],\n (fetcher) => getApplications({...endpoint, fetcher, limit, offset}),\n options,\n );\n};\n\nexport default useGetApplications;\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAM,sBACJ,EAAC,OAAO,WAAoC,EAAE,EAC9C,YACiD;CACjD,MAAMA,WAA+BC,8BAAsB,eAAe;AAE1E,QAAOC,yBACL,CAAC,qBAAqB,cAAc;EAAC;EAAO;EAAO,CAAC,GACnD,YAAY,gBAAgB;EAAC,GAAG;EAAU;EAAS;EAAO;EAAO,CAAC,EACnE,QACD;;AAGH,iCAAe"}
@@ -0,0 +1,18 @@
1
+ import { Application, UpdateApplicationRequest } from '@thunderid/browser';
2
+ import { ResourceMutationOptions, ResourceMutationResult } from '../useResourceMutation';
3
+ /**
4
+ * Variables accepted by {@link useUpdateApplication}'s `mutate`.
5
+ */
6
+ export interface UpdateApplicationVariables {
7
+ applicationId: string;
8
+ data: UpdateApplicationRequest;
9
+ }
10
+ /**
11
+ * Updates an application, then refetches it and any mounted application lists.
12
+ *
13
+ * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
14
+ * @returns The mutation state. Call `mutate({applicationId, data})` to update.
15
+ */
16
+ declare const useUpdateApplication: (options?: ResourceMutationOptions<Application, UpdateApplicationVariables>) => ResourceMutationResult<Application, UpdateApplicationVariables>;
17
+ export default useUpdateApplication;
18
+ //# sourceMappingURL=useUpdateApplication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdateApplication.d.ts","sourceRoot":"","sources":["../../../src/hooks/applications/useUpdateApplication.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,WAAW,EAAwB,wBAAwB,EAAoB,MAAM,oBAAoB,CAAC;AAElH,OAA4B,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAE5G;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,wBAAwB,CAAC;CAChC;AAED;;;;;GAKG;AACH,QAAA,MAAM,oBAAoB,GACxB,UAAU,uBAAuB,CAAC,WAAW,EAAE,0BAA0B,CAAC,KACzE,sBAAsB,CAAC,WAAW,EAAE,0BAA0B,CAYhE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import useManagementEndpoint_default from "../useManagementEndpoint.js";
2
+ import useResourceMutation_default from "../useResourceMutation.js";
3
+ import { ApplicationQueryKeys, updateApplication } from "@thunderid/browser";
4
+
5
+ //#region src/hooks/applications/useUpdateApplication.ts
6
+ /**
7
+ * Updates an application, then refetches it and any mounted application lists.
8
+ *
9
+ * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
10
+ * @returns The mutation state. Call `mutate({applicationId, data})` to update.
11
+ */
12
+ const useUpdateApplication = (options) => {
13
+ const endpoint = useManagementEndpoint_default("applications");
14
+ return useResourceMutation_default(({ applicationId, data }, fetcher) => updateApplication({
15
+ ...endpoint,
16
+ applicationId,
17
+ fetcher,
18
+ payload: data
19
+ }), ({ applicationId }) => [[ApplicationQueryKeys.APPLICATION, applicationId], [ApplicationQueryKeys.APPLICATIONS]], options);
20
+ };
21
+ var useUpdateApplication_default = useUpdateApplication;
22
+
23
+ //#endregion
24
+ export { useUpdateApplication_default as default };
25
+ //# sourceMappingURL=useUpdateApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdateApplication.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation"],"sources":["../../../src/hooks/applications/useUpdateApplication.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Application, ApplicationQueryKeys, UpdateApplicationRequest, updateApplication} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationOptions, ResourceMutationResult} from '../useResourceMutation';\n\n/**\n * Variables accepted by {@link useUpdateApplication}'s `mutate`.\n */\nexport interface UpdateApplicationVariables {\n applicationId: string;\n data: UpdateApplicationRequest;\n}\n\n/**\n * Updates an application, then refetches it and any mounted application lists.\n *\n * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.\n * @returns The mutation state. Call `mutate({applicationId, data})` to update.\n */\nconst useUpdateApplication = (\n options?: ResourceMutationOptions<Application, UpdateApplicationVariables>,\n): ResourceMutationResult<Application, UpdateApplicationVariables> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('applications');\n\n return useResourceMutation(\n ({applicationId, data}: UpdateApplicationVariables, fetcher) =>\n updateApplication({...endpoint, applicationId, fetcher, payload: data}),\n ({applicationId}: UpdateApplicationVariables) => [\n [ApplicationQueryKeys.APPLICATION, applicationId],\n [ApplicationQueryKeys.APPLICATIONS],\n ],\n options,\n );\n};\n\nexport default useUpdateApplication;\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,wBACJ,YACoE;CACpE,MAAMA,WAA+BC,8BAAsB,eAAe;AAE1E,QAAOC,6BACJ,EAAC,eAAe,QAAmC,YAClD,kBAAkB;EAAC,GAAG;EAAU;EAAe;EAAS,SAAS;EAAK,CAAC,GACxE,EAAC,oBAA+C,CAC/C,CAAC,qBAAqB,aAAa,cAAc,EACjD,CAAC,qBAAqB,aAAa,CACpC,EACD,QACD;;AAGH,mCAAe"}
@@ -0,0 +1,22 @@
1
+ import { ResourceEndpointKey } from '@thunderid/browser';
2
+ /**
3
+ * The URL inputs a management API function needs.
4
+ */
5
+ export interface ManagementEndpoint {
6
+ baseUrl: string | undefined;
7
+ /**
8
+ * The collection URL from `endpoints` when overridden, otherwise `undefined` so the API function
9
+ * falls back to `{baseUrl}/{collection}`.
10
+ */
11
+ url: string | undefined;
12
+ }
13
+ /**
14
+ * Resolves where a management resource collection lives, honoring the provider's `endpoints`
15
+ * override so the management API can run on a different host from the authorization server.
16
+ *
17
+ * @param key - The resource collection.
18
+ * @returns The base URL and optional collection URL override.
19
+ */
20
+ declare const useManagementEndpoint: (key: Extract<ResourceEndpointKey, "agents" | "applications" | "users">) => ManagementEndpoint;
21
+ export default useManagementEndpoint;
22
+ //# sourceMappingURL=useManagementEndpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useManagementEndpoint.d.ts","sourceRoot":"","sources":["../../src/hooks/useManagementEndpoint.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,mBAAmB,EAA0B,MAAM,oBAAoB,CAAC;AAGhF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;;OAGG;IACH,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,GACzB,KAAK,OAAO,CAAC,mBAAmB,EAAE,QAAQ,GAAG,cAAc,GAAG,OAAO,CAAC,KACrE,kBAIF,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import useThunderID_default from "../contexts/ThunderID/useThunderID.js";
2
+ import { resolveResourceEndpoint } from "@thunderid/browser";
3
+
4
+ //#region src/hooks/useManagementEndpoint.ts
5
+ /**
6
+ * Resolves where a management resource collection lives, honoring the provider's `endpoints`
7
+ * override so the management API can run on a different host from the authorization server.
8
+ *
9
+ * @param key - The resource collection.
10
+ * @returns The base URL and optional collection URL override.
11
+ */
12
+ const useManagementEndpoint = (key) => {
13
+ const { baseUrl, endpoints } = useThunderID_default();
14
+ return {
15
+ baseUrl,
16
+ url: resolveResourceEndpoint(key, { endpoints })
17
+ };
18
+ };
19
+ var useManagementEndpoint_default = useManagementEndpoint;
20
+
21
+ //#endregion
22
+ export { useManagementEndpoint_default as default };
23
+ //# sourceMappingURL=useManagementEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useManagementEndpoint.js","names":["useThunderID"],"sources":["../../src/hooks/useManagementEndpoint.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ResourceEndpointKey, resolveResourceEndpoint} from '@thunderid/browser';\nimport useThunderID from '../contexts/ThunderID/useThunderID';\n\n/**\n * The URL inputs a management API function needs.\n */\nexport interface ManagementEndpoint {\n baseUrl: string | undefined;\n /**\n * The collection URL from `endpoints` when overridden, otherwise `undefined` so the API function\n * falls back to `{baseUrl}/{collection}`.\n */\n url: string | undefined;\n}\n\n/**\n * Resolves where a management resource collection lives, honoring the provider's `endpoints`\n * override so the management API can run on a different host from the authorization server.\n *\n * @param key - The resource collection.\n * @returns The base URL and optional collection URL override.\n */\nconst useManagementEndpoint = (\n key: Extract<ResourceEndpointKey, 'agents' | 'applications' | 'users'>,\n): ManagementEndpoint => {\n const {baseUrl, endpoints} = useThunderID();\n\n return {baseUrl, url: resolveResourceEndpoint(key, {endpoints})};\n};\n\nexport default useManagementEndpoint;\n"],"mappings":";;;;;;;;;;;AAyBA,MAAM,yBACJ,QACuB;CACvB,MAAM,EAAC,SAAS,cAAaA,sBAAc;AAE3C,QAAO;EAAC;EAAS,KAAK,wBAAwB,KAAK,EAAC,WAAU,CAAC;EAAC;;AAGlE,oCAAe"}
@@ -0,0 +1,51 @@
1
+ import { ApiFetcher } from '@thunderid/browser';
2
+ import { ResourceQueryKey } from '../utils/createResourceInvalidator';
3
+ /**
4
+ * Options accepted by every management mutation hook.
5
+ */
6
+ export interface ResourceMutationOptions<TData, TVariables> {
7
+ /**
8
+ * Transport for this hook only. Takes precedence over `ThunderIDProvider`'s `http.fetcher`.
9
+ */
10
+ fetcher?: ApiFetcher;
11
+ /**
12
+ * Called when the mutation fails.
13
+ */
14
+ onError?: (error: Error, variables: TVariables) => void;
15
+ /**
16
+ * Called when the mutation succeeds, after the affected queries have been invalidated.
17
+ */
18
+ onSuccess?: (data: TData, variables: TVariables) => void;
19
+ }
20
+ /**
21
+ * State returned by a management mutation hook.
22
+ */
23
+ export interface ResourceMutationResult<TData, TVariables> {
24
+ data: TData | undefined;
25
+ error: Error | null;
26
+ isLoading: boolean;
27
+ /**
28
+ * Runs the mutation. Never rejects: read `error`, or use `onError`, to handle a failure.
29
+ */
30
+ mutate: (variables: TVariables) => Promise<TData | undefined>;
31
+ /**
32
+ * Runs the mutation and rejects if it fails.
33
+ */
34
+ mutateAsync: (variables: TVariables) => Promise<TData>;
35
+ /**
36
+ * Clears `data` and `error`.
37
+ */
38
+ reset: () => void;
39
+ }
40
+ /**
41
+ * Runs a management mutation and invalidates the queries whose data it changed. Depends on no data
42
+ * fetching library.
43
+ *
44
+ * @param mutationFn - Performs the request with the resolved fetcher.
45
+ * @param getInvalidatedKeys - Returns the query key prefixes to invalidate after a success.
46
+ * @param options - Mutation options.
47
+ * @returns The mutation state.
48
+ */
49
+ declare const useResourceMutation: <TData, TVariables>(mutationFn: (variables: TVariables, fetcher: ApiFetcher) => Promise<TData>, getInvalidatedKeys: (variables: TVariables) => ResourceQueryKey[], { fetcher, onError, onSuccess }?: ResourceMutationOptions<TData, TVariables>) => ResourceMutationResult<TData, TVariables>;
50
+ export default useResourceMutation;
51
+ //# sourceMappingURL=useResourceMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResourceMutation.d.ts","sourceRoot":"","sources":["../../src/hooks/useResourceMutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAI9C,OAAO,EAAC,gBAAgB,EAA8B,MAAM,oCAAoC,CAAC;AAEjG;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,KAAK,EAAE,UAAU;IACxD;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,KAAK,IAAI,CAAC;IACxD;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,KAAK,IAAI,CAAC;CAC1D;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,KAAK,EAAE,UAAU;IACvD,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC;IACxB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,EAAE,CAAC,SAAS,EAAE,UAAU,KAAK,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC9D;;OAEG;IACH,WAAW,EAAE,CAAC,SAAS,EAAE,UAAU,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IACvD;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,mBAAmB,GAAI,KAAK,EAAE,UAAU,EAC5C,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,KAAK,CAAC,EAC1E,oBAAoB,CAAC,SAAS,EAAE,UAAU,KAAK,gBAAgB,EAAE,EACjE,kCAA+B,uBAAuB,CAAC,KAAK,EAAE,UAAU,CAAM,KAC7E,sBAAsB,CAAC,KAAK,EAAE,UAAU,CAyD1C,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { fallbackResourceInvalidator } from "../utils/createResourceInvalidator.js";
2
+ import useThunderID_default from "../contexts/ThunderID/useThunderID.js";
3
+ import { useResolvedFetcher } from "./useResourceQuery.js";
4
+ import { useCallback, useRef, useState } from "react";
5
+
6
+ //#region src/hooks/useResourceMutation.ts
7
+ /**
8
+ * Runs a management mutation and invalidates the queries whose data it changed. Depends on no data
9
+ * fetching library.
10
+ *
11
+ * @param mutationFn - Performs the request with the resolved fetcher.
12
+ * @param getInvalidatedKeys - Returns the query key prefixes to invalidate after a success.
13
+ * @param options - Mutation options.
14
+ * @returns The mutation state.
15
+ */
16
+ const useResourceMutation = (mutationFn, getInvalidatedKeys, { fetcher, onError, onSuccess } = {}) => {
17
+ const { invalidator = fallbackResourceInvalidator } = useThunderID_default();
18
+ const resolvedFetcher = useResolvedFetcher(fetcher);
19
+ const [data, setData] = useState(void 0);
20
+ const [error, setError] = useState(null);
21
+ const [isLoading, setIsLoading] = useState(false);
22
+ const callbacksRef = useRef({
23
+ getInvalidatedKeys,
24
+ mutationFn,
25
+ onError,
26
+ onSuccess
27
+ });
28
+ callbacksRef.current = {
29
+ getInvalidatedKeys,
30
+ mutationFn,
31
+ onError,
32
+ onSuccess
33
+ };
34
+ const mutateAsync = useCallback(async (variables) => {
35
+ setIsLoading(true);
36
+ setError(null);
37
+ try {
38
+ const result = await callbacksRef.current.mutationFn(variables, resolvedFetcher);
39
+ setData(result);
40
+ callbacksRef.current.getInvalidatedKeys(variables).forEach((key) => {
41
+ invalidator.invalidate(key);
42
+ });
43
+ callbacksRef.current.onSuccess?.(result, variables);
44
+ return result;
45
+ } catch (err) {
46
+ const mutationError = err instanceof Error ? err : new Error(String(err));
47
+ setError(mutationError);
48
+ callbacksRef.current.onError?.(mutationError, variables);
49
+ throw mutationError;
50
+ } finally {
51
+ setIsLoading(false);
52
+ }
53
+ }, [invalidator, resolvedFetcher]);
54
+ return {
55
+ data,
56
+ error,
57
+ isLoading,
58
+ mutate: useCallback((variables) => mutateAsync(variables).catch(() => void 0), [mutateAsync]),
59
+ mutateAsync,
60
+ reset: useCallback(() => {
61
+ setData(void 0);
62
+ setError(null);
63
+ }, [])
64
+ };
65
+ };
66
+ var useResourceMutation_default = useResourceMutation;
67
+
68
+ //#endregion
69
+ export { useResourceMutation_default as default };
70
+ //# sourceMappingURL=useResourceMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResourceMutation.js","names":["useThunderID","resolvedFetcher: ApiFetcher","callbacksRef: {\n current: {\n getInvalidatedKeys: typeof getInvalidatedKeys;\n mutationFn: typeof mutationFn;\n onError?: ResourceMutationOptions<TData, TVariables>['onError'];\n onSuccess?: ResourceMutationOptions<TData, TVariables>['onSuccess'];\n };\n }","mutateAsync: (variables: TVariables) => Promise<TData>","result: TData","mutationError: Error"],"sources":["../../src/hooks/useResourceMutation.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ApiFetcher} from '@thunderid/browser';\nimport {useCallback, useRef, useState} from 'react';\nimport {useResolvedFetcher} from './useResourceQuery';\nimport useThunderID from '../contexts/ThunderID/useThunderID';\nimport {ResourceQueryKey, fallbackResourceInvalidator} from '../utils/createResourceInvalidator';\n\n/**\n * Options accepted by every management mutation hook.\n */\nexport interface ResourceMutationOptions<TData, TVariables> {\n /**\n * Transport for this hook only. Takes precedence over `ThunderIDProvider`'s `http.fetcher`.\n */\n fetcher?: ApiFetcher;\n /**\n * Called when the mutation fails.\n */\n onError?: (error: Error, variables: TVariables) => void;\n /**\n * Called when the mutation succeeds, after the affected queries have been invalidated.\n */\n onSuccess?: (data: TData, variables: TVariables) => void;\n}\n\n/**\n * State returned by a management mutation hook.\n */\nexport interface ResourceMutationResult<TData, TVariables> {\n data: TData | undefined;\n error: Error | null;\n isLoading: boolean;\n /**\n * Runs the mutation. Never rejects: read `error`, or use `onError`, to handle a failure.\n */\n mutate: (variables: TVariables) => Promise<TData | undefined>;\n /**\n * Runs the mutation and rejects if it fails.\n */\n mutateAsync: (variables: TVariables) => Promise<TData>;\n /**\n * Clears `data` and `error`.\n */\n reset: () => void;\n}\n\n/**\n * Runs a management mutation and invalidates the queries whose data it changed. Depends on no data\n * fetching library.\n *\n * @param mutationFn - Performs the request with the resolved fetcher.\n * @param getInvalidatedKeys - Returns the query key prefixes to invalidate after a success.\n * @param options - Mutation options.\n * @returns The mutation state.\n */\nconst useResourceMutation = <TData, TVariables>(\n mutationFn: (variables: TVariables, fetcher: ApiFetcher) => Promise<TData>,\n getInvalidatedKeys: (variables: TVariables) => ResourceQueryKey[],\n {fetcher, onError, onSuccess}: ResourceMutationOptions<TData, TVariables> = {},\n): ResourceMutationResult<TData, TVariables> => {\n const {invalidator = fallbackResourceInvalidator} = useThunderID();\n const resolvedFetcher: ApiFetcher = useResolvedFetcher(fetcher);\n const [data, setData] = useState<TData | undefined>(undefined);\n const [error, setError] = useState<Error | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n\n const callbacksRef: {\n current: {\n getInvalidatedKeys: typeof getInvalidatedKeys;\n mutationFn: typeof mutationFn;\n onError?: ResourceMutationOptions<TData, TVariables>['onError'];\n onSuccess?: ResourceMutationOptions<TData, TVariables>['onSuccess'];\n };\n } = useRef({getInvalidatedKeys, mutationFn, onError, onSuccess});\n callbacksRef.current = {getInvalidatedKeys, mutationFn, onError, onSuccess};\n\n const mutateAsync: (variables: TVariables) => Promise<TData> = useCallback(\n async (variables: TVariables): Promise<TData> => {\n setIsLoading(true);\n setError(null);\n\n try {\n const result: TData = await callbacksRef.current.mutationFn(variables, resolvedFetcher);\n\n setData(result);\n callbacksRef.current.getInvalidatedKeys(variables).forEach((key: ResourceQueryKey) => {\n invalidator.invalidate(key);\n });\n callbacksRef.current.onSuccess?.(result, variables);\n\n return result;\n } catch (err) {\n const mutationError: Error = err instanceof Error ? err : new Error(String(err));\n\n setError(mutationError);\n callbacksRef.current.onError?.(mutationError, variables);\n\n throw mutationError;\n } finally {\n setIsLoading(false);\n }\n },\n [invalidator, resolvedFetcher],\n );\n\n const mutate: (variables: TVariables) => Promise<TData | undefined> = useCallback(\n (variables: TVariables): Promise<TData | undefined> => mutateAsync(variables).catch((): undefined => undefined),\n [mutateAsync],\n );\n\n const reset: () => void = useCallback((): void => {\n setData(undefined);\n setError(null);\n }, []);\n\n return {data, error, isLoading, mutate, mutateAsync, reset};\n};\n\nexport default useResourceMutation;\n"],"mappings":";;;;;;;;;;;;;;;AAyDA,MAAM,uBACJ,YACA,oBACA,EAAC,SAAS,SAAS,cAAyD,EAAE,KAChC;CAC9C,MAAM,EAAC,cAAc,gCAA+BA,sBAAc;CAClE,MAAMC,kBAA8B,mBAAmB,QAAQ;CAC/D,MAAM,CAAC,MAAM,WAAW,SAA4B,OAAU;CAC9D,MAAM,CAAC,OAAO,YAAY,SAAuB,KAAK;CACtD,MAAM,CAAC,WAAW,gBAAgB,SAAkB,MAAM;CAE1D,MAAMC,eAOF,OAAO;EAAC;EAAoB;EAAY;EAAS;EAAU,CAAC;AAChE,cAAa,UAAU;EAAC;EAAoB;EAAY;EAAS;EAAU;CAE3E,MAAMC,cAAyD,YAC7D,OAAO,cAA0C;AAC/C,eAAa,KAAK;AAClB,WAAS,KAAK;AAEd,MAAI;GACF,MAAMC,SAAgB,MAAM,aAAa,QAAQ,WAAW,WAAW,gBAAgB;AAEvF,WAAQ,OAAO;AACf,gBAAa,QAAQ,mBAAmB,UAAU,CAAC,SAAS,QAA0B;AACpF,gBAAY,WAAW,IAAI;KAC3B;AACF,gBAAa,QAAQ,YAAY,QAAQ,UAAU;AAEnD,UAAO;WACA,KAAK;GACZ,MAAMC,gBAAuB,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC;AAEhF,YAAS,cAAc;AACvB,gBAAa,QAAQ,UAAU,eAAe,UAAU;AAExD,SAAM;YACE;AACR,gBAAa,MAAM;;IAGvB,CAAC,aAAa,gBAAgB,CAC/B;AAYD,QAAO;EAAC;EAAM;EAAO;EAAW,QAVsC,aACnE,cAAsD,YAAY,UAAU,CAAC,YAAuB,OAAU,EAC/G,CAAC,YAAY,CACd;EAOuC;EAAa,OAL3B,kBAAwB;AAChD,WAAQ,OAAU;AAClB,YAAS,KAAK;KACb,EAAE,CAAC;EAEqD;;AAG7D,kCAAe"}
@@ -0,0 +1,45 @@
1
+ import { ApiFetcher } from '@thunderid/browser';
2
+ import { ResourceQueryKey } from '../utils/createResourceInvalidator';
3
+ /**
4
+ * Options accepted by every management query hook.
5
+ */
6
+ export interface ResourceQueryOptions {
7
+ /**
8
+ * Set to `false` to skip fetching, for example until an identifier is known.
9
+ * @default true
10
+ */
11
+ enabled?: boolean;
12
+ /**
13
+ * Transport for this hook only. Takes precedence over `ThunderIDProvider`'s `http.fetcher`.
14
+ */
15
+ fetcher?: ApiFetcher;
16
+ }
17
+ /**
18
+ * State returned by a management query hook.
19
+ */
20
+ export interface ResourceQueryResult<T> {
21
+ data: T | undefined;
22
+ error: Error | null;
23
+ isLoading: boolean;
24
+ /**
25
+ * Fetches the resource again. Resolves with the new data, or `undefined` if the request failed.
26
+ */
27
+ refetch: () => Promise<T | undefined>;
28
+ }
29
+ /**
30
+ * Resolves the fetcher a management hook should use: the hook's own, then the provider's, then the
31
+ * SDK's authenticated HTTP client.
32
+ */
33
+ export declare const useResolvedFetcher: (fetcher?: ApiFetcher) => ApiFetcher;
34
+ /**
35
+ * Fetches a management resource and keeps it fresh. Depends on no data fetching library: the
36
+ * request runs through the resolved fetcher, and a matching mutation triggers a refetch.
37
+ *
38
+ * @param queryKey - Identifies the data. Changing it refetches; mutations invalidate by key prefix.
39
+ * @param queryFn - Performs the request with the resolved fetcher.
40
+ * @param options - Query options.
41
+ * @returns The query state.
42
+ */
43
+ declare const useResourceQuery: <T>(queryKey: ResourceQueryKey, queryFn: (fetcher: ApiFetcher) => Promise<T>, { enabled, fetcher }?: ResourceQueryOptions) => ResourceQueryResult<T>;
44
+ export default useResourceQuery;
45
+ //# sourceMappingURL=useResourceQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResourceQuery.d.ts","sourceRoot":"","sources":["../../src/hooks/useResourceQuery.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAI9C,OAAO,EAAC,gBAAgB,EAA8B,MAAM,oCAAoC,CAAC;AAEjG;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CACvC;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,UAAU,KAAG,UAQzD,CAAC;AAEF;;;;;;;;GAQG;AACH,QAAA,MAAM,gBAAgB,GAAI,CAAC,EACzB,UAAU,gBAAgB,EAC1B,SAAS,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,EAC5C,uBAA2B,oBAAyB,KACnD,mBAAmB,CAAC,CAAC,CAwDvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { fallbackResourceInvalidator } from "../utils/createResourceInvalidator.js";
2
+ import useThunderID_default from "../contexts/ThunderID/useThunderID.js";
3
+ import createAuthenticatedFetcher_default from "../utils/createAuthenticatedFetcher.js";
4
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
5
+
6
+ //#region src/hooks/useResourceQuery.ts
7
+ /**
8
+ * Resolves the fetcher a management hook should use: the hook's own, then the provider's, then the
9
+ * SDK's authenticated HTTP client.
10
+ */
11
+ const useResolvedFetcher = (fetcher) => {
12
+ const { http, instanceId } = useThunderID_default();
13
+ const providerFetcher = http?.fetcher;
14
+ return useMemo(() => fetcher ?? providerFetcher ?? createAuthenticatedFetcher_default(instanceId), [
15
+ fetcher,
16
+ providerFetcher,
17
+ instanceId
18
+ ]);
19
+ };
20
+ /**
21
+ * Fetches a management resource and keeps it fresh. Depends on no data fetching library: the
22
+ * request runs through the resolved fetcher, and a matching mutation triggers a refetch.
23
+ *
24
+ * @param queryKey - Identifies the data. Changing it refetches; mutations invalidate by key prefix.
25
+ * @param queryFn - Performs the request with the resolved fetcher.
26
+ * @param options - Query options.
27
+ * @returns The query state.
28
+ */
29
+ const useResourceQuery = (queryKey, queryFn, { enabled = true, fetcher } = {}) => {
30
+ const { invalidator = fallbackResourceInvalidator } = useThunderID_default();
31
+ const resolvedFetcher = useResolvedFetcher(fetcher);
32
+ const [data, setData] = useState(void 0);
33
+ const [error, setError] = useState(null);
34
+ const [isLoading, setIsLoading] = useState(enabled);
35
+ const serializedKey = JSON.stringify(queryKey);
36
+ const queryFnRef = useRef(queryFn);
37
+ queryFnRef.current = queryFn;
38
+ const latestRequestRef = useRef(0);
39
+ const refetch = useCallback(async () => {
40
+ latestRequestRef.current += 1;
41
+ const requestId = latestRequestRef.current;
42
+ setIsLoading(true);
43
+ try {
44
+ const result = await queryFnRef.current(resolvedFetcher);
45
+ if (requestId === latestRequestRef.current) {
46
+ setData(result);
47
+ setError(null);
48
+ }
49
+ return result;
50
+ } catch (err) {
51
+ if (requestId === latestRequestRef.current) setError(err instanceof Error ? err : new Error(String(err)));
52
+ return;
53
+ } finally {
54
+ if (requestId === latestRequestRef.current) setIsLoading(false);
55
+ }
56
+ }, [resolvedFetcher]);
57
+ useEffect(() => {
58
+ if (!enabled) {
59
+ setIsLoading(false);
60
+ return;
61
+ }
62
+ refetch();
63
+ return invalidator.subscribe(JSON.parse(serializedKey), () => {
64
+ refetch();
65
+ });
66
+ }, [
67
+ enabled,
68
+ invalidator,
69
+ refetch,
70
+ serializedKey
71
+ ]);
72
+ return {
73
+ data,
74
+ error,
75
+ isLoading,
76
+ refetch
77
+ };
78
+ };
79
+ var useResourceQuery_default = useResourceQuery;
80
+
81
+ //#endregion
82
+ export { useResourceQuery_default as default, useResolvedFetcher };
83
+ //# sourceMappingURL=useResourceQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResourceQuery.js","names":["useThunderID","providerFetcher: ApiFetcher | undefined","createAuthenticatedFetcher","resolvedFetcher: ApiFetcher","serializedKey: string","queryFnRef: {current: (fetcher: ApiFetcher) => Promise<T>}","latestRequestRef: {current: number}","refetch: () => Promise<T | undefined>","requestId: number","result: T"],"sources":["../../src/hooks/useResourceQuery.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ApiFetcher} from '@thunderid/browser';\nimport {useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport useThunderID from '../contexts/ThunderID/useThunderID';\nimport createAuthenticatedFetcher from '../utils/createAuthenticatedFetcher';\nimport {ResourceQueryKey, fallbackResourceInvalidator} from '../utils/createResourceInvalidator';\n\n/**\n * Options accepted by every management query hook.\n */\nexport interface ResourceQueryOptions {\n /**\n * Set to `false` to skip fetching, for example until an identifier is known.\n * @default true\n */\n enabled?: boolean;\n /**\n * Transport for this hook only. Takes precedence over `ThunderIDProvider`'s `http.fetcher`.\n */\n fetcher?: ApiFetcher;\n}\n\n/**\n * State returned by a management query hook.\n */\nexport interface ResourceQueryResult<T> {\n data: T | undefined;\n error: Error | null;\n isLoading: boolean;\n /**\n * Fetches the resource again. Resolves with the new data, or `undefined` if the request failed.\n */\n refetch: () => Promise<T | undefined>;\n}\n\n/**\n * Resolves the fetcher a management hook should use: the hook's own, then the provider's, then the\n * SDK's authenticated HTTP client.\n */\nexport const useResolvedFetcher = (fetcher?: ApiFetcher): ApiFetcher => {\n const {http, instanceId} = useThunderID();\n const providerFetcher: ApiFetcher | undefined = http?.fetcher;\n\n return useMemo(\n () => fetcher ?? providerFetcher ?? createAuthenticatedFetcher(instanceId),\n [fetcher, providerFetcher, instanceId],\n );\n};\n\n/**\n * Fetches a management resource and keeps it fresh. Depends on no data fetching library: the\n * request runs through the resolved fetcher, and a matching mutation triggers a refetch.\n *\n * @param queryKey - Identifies the data. Changing it refetches; mutations invalidate by key prefix.\n * @param queryFn - Performs the request with the resolved fetcher.\n * @param options - Query options.\n * @returns The query state.\n */\nconst useResourceQuery = <T>(\n queryKey: ResourceQueryKey,\n queryFn: (fetcher: ApiFetcher) => Promise<T>,\n {enabled = true, fetcher}: ResourceQueryOptions = {},\n): ResourceQueryResult<T> => {\n const {invalidator = fallbackResourceInvalidator} = useThunderID();\n const resolvedFetcher: ApiFetcher = useResolvedFetcher(fetcher);\n const [data, setData] = useState<T | undefined>(undefined);\n const [error, setError] = useState<Error | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(enabled);\n\n const serializedKey: string = JSON.stringify(queryKey);\n const queryFnRef: {current: (fetcher: ApiFetcher) => Promise<T>} = useRef(queryFn);\n queryFnRef.current = queryFn;\n // Only the latest request may write state, so a slow earlier response cannot overwrite a newer one.\n const latestRequestRef: {current: number} = useRef(0);\n\n const refetch: () => Promise<T | undefined> = useCallback(async (): Promise<T | undefined> => {\n latestRequestRef.current += 1;\n const requestId: number = latestRequestRef.current;\n\n setIsLoading(true);\n\n try {\n const result: T = await queryFnRef.current(resolvedFetcher);\n\n if (requestId === latestRequestRef.current) {\n setData(result);\n setError(null);\n }\n\n return result;\n } catch (err) {\n if (requestId === latestRequestRef.current) {\n setError(err instanceof Error ? err : new Error(String(err)));\n }\n\n return undefined;\n } finally {\n if (requestId === latestRequestRef.current) {\n setIsLoading(false);\n }\n }\n }, [resolvedFetcher]);\n\n useEffect(() => {\n if (!enabled) {\n setIsLoading(false);\n\n return undefined;\n }\n\n void refetch();\n\n return invalidator.subscribe(JSON.parse(serializedKey) as ResourceQueryKey, () => {\n void refetch();\n });\n }, [enabled, invalidator, refetch, serializedKey]);\n\n return {data, error, isLoading, refetch};\n};\n\nexport default useResourceQuery;\n"],"mappings":";;;;;;;;;;AAyCA,MAAa,sBAAsB,YAAqC;CACtE,MAAM,EAAC,MAAM,eAAcA,sBAAc;CACzC,MAAMC,kBAA0C,MAAM;AAEtD,QAAO,cACC,WAAW,mBAAmBC,mCAA2B,WAAW,EAC1E;EAAC;EAAS;EAAiB;EAAW,CACvC;;;;;;;;;;;AAYH,MAAM,oBACJ,UACA,SACA,EAAC,UAAU,MAAM,YAAiC,EAAE,KACzB;CAC3B,MAAM,EAAC,cAAc,gCAA+BF,sBAAc;CAClE,MAAMG,kBAA8B,mBAAmB,QAAQ;CAC/D,MAAM,CAAC,MAAM,WAAW,SAAwB,OAAU;CAC1D,MAAM,CAAC,OAAO,YAAY,SAAuB,KAAK;CACtD,MAAM,CAAC,WAAW,gBAAgB,SAAkB,QAAQ;CAE5D,MAAMC,gBAAwB,KAAK,UAAU,SAAS;CACtD,MAAMC,aAA6D,OAAO,QAAQ;AAClF,YAAW,UAAU;CAErB,MAAMC,mBAAsC,OAAO,EAAE;CAErD,MAAMC,UAAwC,YAAY,YAAoC;AAC5F,mBAAiB,WAAW;EAC5B,MAAMC,YAAoB,iBAAiB;AAE3C,eAAa,KAAK;AAElB,MAAI;GACF,MAAMC,SAAY,MAAM,WAAW,QAAQ,gBAAgB;AAE3D,OAAI,cAAc,iBAAiB,SAAS;AAC1C,YAAQ,OAAO;AACf,aAAS,KAAK;;AAGhB,UAAO;WACA,KAAK;AACZ,OAAI,cAAc,iBAAiB,QACjC,UAAS,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;AAG/D;YACQ;AACR,OAAI,cAAc,iBAAiB,QACjC,cAAa,MAAM;;IAGtB,CAAC,gBAAgB,CAAC;AAErB,iBAAgB;AACd,MAAI,CAAC,SAAS;AACZ,gBAAa,MAAM;AAEnB;;AAGF,EAAK,SAAS;AAEd,SAAO,YAAY,UAAU,KAAK,MAAM,cAAc,QAA4B;AAChF,GAAK,SAAS;IACd;IACD;EAAC;EAAS;EAAa;EAAS;EAAc,CAAC;AAElD,QAAO;EAAC;EAAM;EAAO;EAAW;EAAQ;;AAG1C,+BAAe"}
@@ -0,0 +1,11 @@
1
+ import { CreateManagedUserRequest, ManagedUser } from '@thunderid/browser';
2
+ import { ResourceMutationOptions, ResourceMutationResult } from '../useResourceMutation';
3
+ /**
4
+ * Creates a user, then refetches any mounted user lists.
5
+ *
6
+ * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
7
+ * @returns The mutation state. Call `mutate(payload)` to create.
8
+ */
9
+ declare const useCreateUser: (options?: ResourceMutationOptions<ManagedUser, CreateManagedUserRequest>) => ResourceMutationResult<ManagedUser, CreateManagedUserRequest>;
10
+ export default useCreateUser;
11
+ //# sourceMappingURL=useCreateUser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateUser.d.ts","sourceRoot":"","sources":["../../../src/hooks/users/useCreateUser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,wBAAwB,EAAE,WAAW,EAA4B,MAAM,oBAAoB,CAAC;AAEpG,OAA4B,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAE5G;;;;;GAKG;AACH,QAAA,MAAM,aAAa,GACjB,UAAU,uBAAuB,CAAC,WAAW,EAAE,wBAAwB,CAAC,KACvE,sBAAsB,CAAC,WAAW,EAAE,wBAAwB,CAQ9D,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,24 @@
1
+ import useManagementEndpoint_default from "../useManagementEndpoint.js";
2
+ import useResourceMutation_default from "../useResourceMutation.js";
3
+ import { UserQueryKeys, createUser } from "@thunderid/browser";
4
+
5
+ //#region src/hooks/users/useCreateUser.ts
6
+ /**
7
+ * Creates a user, then refetches any mounted user lists.
8
+ *
9
+ * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
10
+ * @returns The mutation state. Call `mutate(payload)` to create.
11
+ */
12
+ const useCreateUser = (options) => {
13
+ const endpoint = useManagementEndpoint_default("users");
14
+ return useResourceMutation_default((payload, fetcher) => createUser({
15
+ ...endpoint,
16
+ fetcher,
17
+ payload
18
+ }), () => [[UserQueryKeys.USERS]], options);
19
+ };
20
+ var useCreateUser_default = useCreateUser;
21
+
22
+ //#endregion
23
+ export { useCreateUser_default as default };
24
+ //# sourceMappingURL=useCreateUser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateUser.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation"],"sources":["../../../src/hooks/users/useCreateUser.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {CreateManagedUserRequest, ManagedUser, UserQueryKeys, createUser} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationOptions, ResourceMutationResult} from '../useResourceMutation';\n\n/**\n * Creates a user, then refetches any mounted user lists.\n *\n * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.\n * @returns The mutation state. Call `mutate(payload)` to create.\n */\nconst useCreateUser = (\n options?: ResourceMutationOptions<ManagedUser, CreateManagedUserRequest>,\n): ResourceMutationResult<ManagedUser, CreateManagedUserRequest> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('users');\n\n return useResourceMutation(\n (payload: CreateManagedUserRequest, fetcher) => createUser({...endpoint, fetcher, payload}),\n () => [[UserQueryKeys.USERS]],\n options,\n );\n};\n\nexport default useCreateUser;\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,iBACJ,YACkE;CAClE,MAAMA,WAA+BC,8BAAsB,QAAQ;AAEnE,QAAOC,6BACJ,SAAmC,YAAY,WAAW;EAAC,GAAG;EAAU;EAAS;EAAQ,CAAC,QACrF,CAAC,CAAC,cAAc,MAAM,CAAC,EAC7B,QACD;;AAGH,4BAAe"}
@@ -0,0 +1,10 @@
1
+ import { ResourceMutationOptions, ResourceMutationResult } from '../useResourceMutation';
2
+ /**
3
+ * Deletes a user, then refetches any mounted user lists.
4
+ *
5
+ * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
6
+ * @returns The mutation state. Call `mutate(userId)` to delete.
7
+ */
8
+ declare const useDeleteUser: (options?: ResourceMutationOptions<void, string>) => ResourceMutationResult<void, string>;
9
+ export default useDeleteUser;
10
+ //# sourceMappingURL=useDeleteUser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeleteUser.d.ts","sourceRoot":"","sources":["../../../src/hooks/users/useDeleteUser.ts"],"names":[],"mappings":"AAKA,OAA4B,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAE5G;;;;;GAKG;AACH,QAAA,MAAM,aAAa,GAAI,UAAU,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,KAAG,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAQ3G,CAAC;AAEF,eAAe,aAAa,CAAC"}