@thunderid/react 1.0.8 → 1.2.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.
- package/dist/api/updateMeCredentials.d.ts +33 -0
- package/dist/api/updateMeCredentials.d.ts.map +1 -0
- package/dist/api/updateMeCredentials.js +29 -0
- package/dist/api/updateMeCredentials.js.map +1 -0
- package/dist/cjs/api/updateMeCredentials.cjs +31 -0
- package/dist/cjs/api/updateMeCredentials.cjs.map +1 -0
- package/dist/cjs/components/presentation/ChangeCredential/BaseChangeCredential.cjs +187 -0
- package/dist/cjs/components/presentation/ChangeCredential/BaseChangeCredential.cjs.map +1 -0
- package/dist/cjs/components/presentation/ChangeCredential/BaseChangeCredential.styles.cjs +108 -0
- package/dist/cjs/components/presentation/ChangeCredential/BaseChangeCredential.styles.cjs.map +1 -0
- package/dist/cjs/components/presentation/ChangeCredential/ChangeCredential.cjs +123 -0
- package/dist/cjs/components/presentation/ChangeCredential/ChangeCredential.cjs.map +1 -0
- package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.cjs +1 -1
- package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.cjs +2 -2
- package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.cjs.map +1 -1
- package/dist/cjs/components/presentation/UserDropdown/UserDropdown.cjs +8 -4
- package/dist/cjs/components/presentation/UserDropdown/UserDropdown.cjs.map +1 -1
- package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.styles.cjs +2 -0
- package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.styles.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +13 -0
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +69 -66
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
- package/dist/cjs/components/primitives/KeyValueList/KeyValueList.cjs +41 -0
- package/dist/cjs/components/primitives/KeyValueList/KeyValueList.cjs.map +1 -0
- package/dist/cjs/components/primitives/KeyValueList/KeyValueList.styles.cjs +46 -0
- package/dist/cjs/components/primitives/KeyValueList/KeyValueList.styles.cjs.map +1 -0
- package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs +2 -2
- package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs.map +1 -1
- package/dist/cjs/contexts/Theme/ThemeProvider.cjs +26 -4
- package/dist/cjs/contexts/Theme/ThemeProvider.cjs.map +1 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs +2 -0
- package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs.map +1 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +7 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
- package/dist/cjs/hooks/agents/useCreateAgent.cjs +26 -0
- package/dist/cjs/hooks/agents/useCreateAgent.cjs.map +1 -0
- package/dist/cjs/hooks/agents/useDeleteAgent.cjs +26 -0
- package/dist/cjs/hooks/agents/useDeleteAgent.cjs.map +1 -0
- package/dist/cjs/hooks/agents/useGetAgent.cjs +30 -0
- package/dist/cjs/hooks/agents/useGetAgent.cjs.map +1 -0
- package/dist/cjs/hooks/agents/useGetAgents.cjs +31 -0
- package/dist/cjs/hooks/agents/useGetAgents.cjs.map +1 -0
- package/dist/cjs/hooks/agents/useUpdateAgent.cjs +27 -0
- package/dist/cjs/hooks/agents/useUpdateAgent.cjs.map +1 -0
- package/dist/cjs/hooks/applications/useCreateApplication.cjs +31 -0
- package/dist/cjs/hooks/applications/useCreateApplication.cjs.map +1 -0
- package/dist/cjs/hooks/applications/useDeleteApplication.cjs +26 -0
- package/dist/cjs/hooks/applications/useDeleteApplication.cjs.map +1 -0
- package/dist/cjs/hooks/applications/useGetApplication.cjs +35 -0
- package/dist/cjs/hooks/applications/useGetApplication.cjs.map +1 -0
- package/dist/cjs/hooks/applications/useGetApplications.cjs +36 -0
- package/dist/cjs/hooks/applications/useGetApplications.cjs.map +1 -0
- package/dist/cjs/hooks/applications/useUpdateApplication.cjs +27 -0
- package/dist/cjs/hooks/applications/useUpdateApplication.cjs.map +1 -0
- package/dist/cjs/hooks/useManagementEndpoint.cjs +25 -0
- package/dist/cjs/hooks/useManagementEndpoint.cjs.map +1 -0
- package/dist/cjs/hooks/useResourceMutation.cjs +72 -0
- package/dist/cjs/hooks/useResourceMutation.cjs.map +1 -0
- package/dist/cjs/hooks/useResourceQuery.cjs +86 -0
- package/dist/cjs/hooks/useResourceQuery.cjs.map +1 -0
- package/dist/cjs/hooks/users/useCreateUser.cjs +26 -0
- package/dist/cjs/hooks/users/useCreateUser.cjs.map +1 -0
- package/dist/cjs/hooks/users/useDeleteUser.cjs +26 -0
- package/dist/cjs/hooks/users/useDeleteUser.cjs.map +1 -0
- package/dist/cjs/hooks/users/useGetUser.cjs +30 -0
- package/dist/cjs/hooks/users/useGetUser.cjs.map +1 -0
- package/dist/cjs/hooks/users/useGetUsers.cjs +38 -0
- package/dist/cjs/hooks/users/useGetUsers.cjs.map +1 -0
- package/dist/cjs/hooks/users/useUpdateUser.cjs +27 -0
- package/dist/cjs/hooks/users/useUpdateUser.cjs.map +1 -0
- package/dist/cjs/index.cjs +152 -0
- package/dist/cjs/utils/createAuthenticatedFetcher.cjs +43 -0
- package/dist/cjs/utils/createAuthenticatedFetcher.cjs.map +1 -0
- package/dist/cjs/utils/createResourceInvalidator.cjs +38 -0
- package/dist/cjs/utils/createResourceInvalidator.cjs.map +1 -0
- package/dist/components/actions/SignInButton/BaseSignInButton.js +2 -2
- package/dist/components/actions/SignInButton/BaseSignInButton.js.map +1 -1
- package/dist/components/actions/SignOutButton/BaseSignOutButton.js +2 -2
- package/dist/components/actions/SignOutButton/BaseSignOutButton.js.map +1 -1
- package/dist/components/actions/SignUpButton/BaseSignUpButton.js +2 -2
- package/dist/components/actions/SignUpButton/BaseSignUpButton.js.map +1 -1
- package/dist/components/adapters/FlowTimer.js +2 -2
- package/dist/components/adapters/FlowTimer.js.map +1 -1
- package/dist/components/presentation/ChangeCredential/BaseChangeCredential.d.ts +100 -0
- package/dist/components/presentation/ChangeCredential/BaseChangeCredential.d.ts.map +1 -0
- package/dist/components/presentation/ChangeCredential/BaseChangeCredential.js +183 -0
- package/dist/components/presentation/ChangeCredential/BaseChangeCredential.js.map +1 -0
- package/dist/components/presentation/ChangeCredential/BaseChangeCredential.styles.d.ts +10 -0
- package/dist/components/presentation/ChangeCredential/BaseChangeCredential.styles.d.ts.map +1 -0
- package/dist/components/presentation/ChangeCredential/BaseChangeCredential.styles.js +108 -0
- package/dist/components/presentation/ChangeCredential/BaseChangeCredential.styles.js.map +1 -0
- package/dist/components/presentation/ChangeCredential/ChangeCredential.d.ts +55 -0
- package/dist/components/presentation/ChangeCredential/ChangeCredential.d.ts.map +1 -0
- package/dist/components/presentation/ChangeCredential/ChangeCredential.js +119 -0
- package/dist/components/presentation/ChangeCredential/ChangeCredential.js.map +1 -0
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.js +3 -3
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.js.map +1 -1
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +5 -0
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts.map +1 -1
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.js +2 -2
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.js.map +1 -1
- package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +12 -0
- package/dist/components/presentation/UserDropdown/UserDropdown.d.ts.map +1 -1
- package/dist/components/presentation/UserDropdown/UserDropdown.js +11 -7
- package/dist/components/presentation/UserDropdown/UserDropdown.js.map +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.js +8 -8
- package/dist/components/presentation/UserProfile/BaseUserProfile.js.map +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.styles.d.ts.map +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.styles.js +2 -0
- package/dist/components/presentation/UserProfile/BaseUserProfile.styles.js.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.js +14 -1
- package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/SignIn.js +2 -2
- package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js +69 -66
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.js +2 -2
- package/dist/components/primitives/AffixedField/AffixedField.js.map +1 -1
- package/dist/components/primitives/KeyValueList/KeyValueList.d.ts +19 -0
- package/dist/components/primitives/KeyValueList/KeyValueList.d.ts.map +1 -0
- package/dist/components/primitives/KeyValueList/KeyValueList.js +38 -0
- package/dist/components/primitives/KeyValueList/KeyValueList.js.map +1 -0
- package/dist/components/primitives/KeyValueList/KeyValueList.styles.d.ts +4 -0
- package/dist/components/primitives/KeyValueList/KeyValueList.styles.d.ts.map +1 -0
- package/dist/components/primitives/KeyValueList/KeyValueList.styles.js +44 -0
- package/dist/components/primitives/KeyValueList/KeyValueList.styles.js.map +1 -0
- package/dist/components/primitives/PasswordField/PasswordField.d.ts +6 -0
- package/dist/components/primitives/PasswordField/PasswordField.d.ts.map +1 -1
- package/dist/components/primitives/PasswordField/PasswordField.js +2 -2
- package/dist/components/primitives/PasswordField/PasswordField.js.map +1 -1
- package/dist/contexts/Theme/ThemeProvider.d.ts +1 -1
- package/dist/contexts/Theme/ThemeProvider.d.ts.map +1 -1
- package/dist/contexts/Theme/ThemeProvider.js +27 -5
- package/dist/contexts/Theme/ThemeProvider.js.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDContext.d.ts +12 -1
- package/dist/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDContext.js +2 -0
- package/dist/contexts/ThunderID/ThunderIDContext.js.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.js +7 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
- package/dist/hooks/agents/useCreateAgent.d.ts +11 -0
- package/dist/hooks/agents/useCreateAgent.d.ts.map +1 -0
- package/dist/hooks/agents/useCreateAgent.js +24 -0
- package/dist/hooks/agents/useCreateAgent.js.map +1 -0
- package/dist/hooks/agents/useDeleteAgent.d.ts +10 -0
- package/dist/hooks/agents/useDeleteAgent.d.ts.map +1 -0
- package/dist/hooks/agents/useDeleteAgent.js +24 -0
- package/dist/hooks/agents/useDeleteAgent.js.map +1 -0
- package/dist/hooks/agents/useGetAgent.d.ts +12 -0
- package/dist/hooks/agents/useGetAgent.d.ts.map +1 -0
- package/dist/hooks/agents/useGetAgent.js +28 -0
- package/dist/hooks/agents/useGetAgent.js.map +1 -0
- package/dist/hooks/agents/useGetAgents.d.ts +19 -0
- package/dist/hooks/agents/useGetAgents.d.ts.map +1 -0
- package/dist/hooks/agents/useGetAgents.js +29 -0
- package/dist/hooks/agents/useGetAgents.js.map +1 -0
- package/dist/hooks/agents/useUpdateAgent.d.ts +18 -0
- package/dist/hooks/agents/useUpdateAgent.d.ts.map +1 -0
- package/dist/hooks/agents/useUpdateAgent.js +25 -0
- package/dist/hooks/agents/useUpdateAgent.js.map +1 -0
- package/dist/hooks/applications/useCreateApplication.d.ts +16 -0
- package/dist/hooks/applications/useCreateApplication.d.ts.map +1 -0
- package/dist/hooks/applications/useCreateApplication.js +29 -0
- package/dist/hooks/applications/useCreateApplication.js.map +1 -0
- package/dist/hooks/applications/useDeleteApplication.d.ts +10 -0
- package/dist/hooks/applications/useDeleteApplication.d.ts.map +1 -0
- package/dist/hooks/applications/useDeleteApplication.js +24 -0
- package/dist/hooks/applications/useDeleteApplication.js.map +1 -0
- package/dist/hooks/applications/useGetApplication.d.ts +17 -0
- package/dist/hooks/applications/useGetApplication.d.ts.map +1 -0
- package/dist/hooks/applications/useGetApplication.js +33 -0
- package/dist/hooks/applications/useGetApplication.js.map +1 -0
- package/dist/hooks/applications/useGetApplications.d.ts +24 -0
- package/dist/hooks/applications/useGetApplications.d.ts.map +1 -0
- package/dist/hooks/applications/useGetApplications.js +34 -0
- package/dist/hooks/applications/useGetApplications.js.map +1 -0
- package/dist/hooks/applications/useUpdateApplication.d.ts +18 -0
- package/dist/hooks/applications/useUpdateApplication.d.ts.map +1 -0
- package/dist/hooks/applications/useUpdateApplication.js +25 -0
- package/dist/hooks/applications/useUpdateApplication.js.map +1 -0
- package/dist/hooks/useManagementEndpoint.d.ts +22 -0
- package/dist/hooks/useManagementEndpoint.d.ts.map +1 -0
- package/dist/hooks/useManagementEndpoint.js +23 -0
- package/dist/hooks/useManagementEndpoint.js.map +1 -0
- package/dist/hooks/useResourceMutation.d.ts +51 -0
- package/dist/hooks/useResourceMutation.d.ts.map +1 -0
- package/dist/hooks/useResourceMutation.js +70 -0
- package/dist/hooks/useResourceMutation.js.map +1 -0
- package/dist/hooks/useResourceQuery.d.ts +45 -0
- package/dist/hooks/useResourceQuery.d.ts.map +1 -0
- package/dist/hooks/useResourceQuery.js +83 -0
- package/dist/hooks/useResourceQuery.js.map +1 -0
- package/dist/hooks/users/useCreateUser.d.ts +11 -0
- package/dist/hooks/users/useCreateUser.d.ts.map +1 -0
- package/dist/hooks/users/useCreateUser.js +24 -0
- package/dist/hooks/users/useCreateUser.js.map +1 -0
- package/dist/hooks/users/useDeleteUser.d.ts +10 -0
- package/dist/hooks/users/useDeleteUser.d.ts.map +1 -0
- package/dist/hooks/users/useDeleteUser.js +24 -0
- package/dist/hooks/users/useDeleteUser.js.map +1 -0
- package/dist/hooks/users/useGetUser.d.ts +12 -0
- package/dist/hooks/users/useGetUser.d.ts.map +1 -0
- package/dist/hooks/users/useGetUser.js +28 -0
- package/dist/hooks/users/useGetUser.js.map +1 -0
- package/dist/hooks/users/useGetUsers.d.ts +17 -0
- package/dist/hooks/users/useGetUsers.d.ts.map +1 -0
- package/dist/hooks/users/useGetUsers.js +36 -0
- package/dist/hooks/users/useGetUsers.js.map +1 -0
- package/dist/hooks/users/useUpdateUser.d.ts +18 -0
- package/dist/hooks/users/useUpdateUser.d.ts.map +1 -0
- package/dist/hooks/users/useUpdateUser.js +25 -0
- package/dist/hooks/users/useUpdateUser.js.map +1 -0
- package/dist/index.d.ts +32 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -2
- package/dist/models/config.d.ts +13 -1
- package/dist/models/config.d.ts.map +1 -1
- package/dist/utils/createAuthenticatedFetcher.d.ts +14 -0
- package/dist/utils/createAuthenticatedFetcher.d.ts.map +1 -0
- package/dist/utils/createAuthenticatedFetcher.js +41 -0
- package/dist/utils/createAuthenticatedFetcher.js.map +1 -0
- package/dist/utils/createResourceInvalidator.d.ts +29 -0
- package/dist/utils/createResourceInvalidator.d.ts.map +1 -0
- package/dist/utils/createResourceInvalidator.js +36 -0
- package/dist/utils/createResourceInvalidator.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteApplication.cjs","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation","ApplicationQueryKeys"],"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,sCAAsB,eAAe;AAE1E,QAAOC,qCACJ,eAAuB,uDAA8B;EAAC,GAAG;EAAU;EAAe;EAAQ,CAAC,QACtF,CAAC,CAACC,yCAAqB,aAAa,CAAC,EAC3C,QACD;;AAGH,mCAAe"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useManagementEndpoint = require('../useManagementEndpoint.cjs');
|
|
3
|
+
const require_useResourceQuery = require('../useResourceQuery.cjs');
|
|
4
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
5
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/applications/useGetApplication.ts
|
|
8
|
+
/**
|
|
9
|
+
* Fetches a single application. Does nothing until `applicationId` is set.
|
|
10
|
+
*
|
|
11
|
+
* @param applicationId - Identifier of the application.
|
|
12
|
+
* @param options - Query options, including a per-hook `fetcher`.
|
|
13
|
+
* @returns The query state.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const {data: application} = useGetApplication(applicationId);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
const useGetApplication = (applicationId, options) => {
|
|
21
|
+
const endpoint = require_useManagementEndpoint.default("applications");
|
|
22
|
+
return require_useResourceQuery.default([__thunderid_browser.ApplicationQueryKeys.APPLICATION, applicationId], (fetcher) => (0, __thunderid_browser.getApplication)({
|
|
23
|
+
...endpoint,
|
|
24
|
+
applicationId,
|
|
25
|
+
fetcher
|
|
26
|
+
}), {
|
|
27
|
+
...options,
|
|
28
|
+
enabled: Boolean(applicationId) && options?.enabled !== false
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var useGetApplication_default = useGetApplication;
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.default = useGetApplication_default;
|
|
35
|
+
//# sourceMappingURL=useGetApplication.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetApplication.cjs","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceQuery","ApplicationQueryKeys"],"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,sCAAsB,eAAe;AAE1E,QAAOC,iCACL,CAACC,yCAAqB,aAAa,cAAc,GAChD,oDAA2B;EAAC,GAAG;EAAyB;EAAgB;EAAQ,CAAC,EAClF;EAAC,GAAG;EAAS,SAAS,QAAQ,cAAc,IAAI,SAAS,YAAY;EAAM,CAC5E;;AAGH,gCAAe"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useManagementEndpoint = require('../useManagementEndpoint.cjs');
|
|
3
|
+
const require_useResourceQuery = require('../useResourceQuery.cjs');
|
|
4
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
5
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/applications/useGetApplications.ts
|
|
8
|
+
/**
|
|
9
|
+
* Fetches a page of applications.
|
|
10
|
+
*
|
|
11
|
+
* @param params - Pagination parameters.
|
|
12
|
+
* @param options - Query options, including a per-hook `fetcher`.
|
|
13
|
+
* @returns The query state.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const {data, isLoading, error} = useGetApplications({limit: 10});
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
const useGetApplications = ({ limit, offset } = {}, options) => {
|
|
21
|
+
const endpoint = require_useManagementEndpoint.default("applications");
|
|
22
|
+
return require_useResourceQuery.default([__thunderid_browser.ApplicationQueryKeys.APPLICATIONS, {
|
|
23
|
+
limit,
|
|
24
|
+
offset
|
|
25
|
+
}], (fetcher) => (0, __thunderid_browser.getApplications)({
|
|
26
|
+
...endpoint,
|
|
27
|
+
fetcher,
|
|
28
|
+
limit,
|
|
29
|
+
offset
|
|
30
|
+
}), options);
|
|
31
|
+
};
|
|
32
|
+
var useGetApplications_default = useGetApplications;
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.default = useGetApplications_default;
|
|
36
|
+
//# sourceMappingURL=useGetApplications.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetApplications.cjs","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceQuery","ApplicationQueryKeys"],"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,sCAAsB,eAAe;AAE1E,QAAOC,iCACL,CAACC,yCAAqB,cAAc;EAAC;EAAO;EAAO,CAAC,GACnD,qDAA4B;EAAC,GAAG;EAAU;EAAS;EAAO;EAAO,CAAC,EACnE,QACD;;AAGH,iCAAe"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useManagementEndpoint = require('../useManagementEndpoint.cjs');
|
|
3
|
+
const require_useResourceMutation = require('../useResourceMutation.cjs');
|
|
4
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
5
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/applications/useUpdateApplication.ts
|
|
8
|
+
/**
|
|
9
|
+
* Updates an application, then refetches it and any mounted application lists.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
|
|
12
|
+
* @returns The mutation state. Call `mutate({applicationId, data})` to update.
|
|
13
|
+
*/
|
|
14
|
+
const useUpdateApplication = (options) => {
|
|
15
|
+
const endpoint = require_useManagementEndpoint.default("applications");
|
|
16
|
+
return require_useResourceMutation.default(({ applicationId, data }, fetcher) => (0, __thunderid_browser.updateApplication)({
|
|
17
|
+
...endpoint,
|
|
18
|
+
applicationId,
|
|
19
|
+
fetcher,
|
|
20
|
+
payload: data
|
|
21
|
+
}), ({ applicationId }) => [[__thunderid_browser.ApplicationQueryKeys.APPLICATION, applicationId], [__thunderid_browser.ApplicationQueryKeys.APPLICATIONS]], options);
|
|
22
|
+
};
|
|
23
|
+
var useUpdateApplication_default = useUpdateApplication;
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.default = useUpdateApplication_default;
|
|
27
|
+
//# sourceMappingURL=useUpdateApplication.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateApplication.cjs","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation","ApplicationQueryKeys"],"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,sCAAsB,eAAe;AAE1E,QAAOC,qCACJ,EAAC,eAAe,QAAmC,uDAChC;EAAC,GAAG;EAAU;EAAe;EAAS,SAAS;EAAK,CAAC,GACxE,EAAC,oBAA+C,CAC/C,CAACC,yCAAqB,aAAa,cAAc,EACjD,CAACA,yCAAqB,aAAa,CACpC,EACD,QACD;;AAGH,mCAAe"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useThunderID = require('../contexts/ThunderID/useThunderID.cjs');
|
|
3
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
4
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
5
|
+
|
|
6
|
+
//#region src/hooks/useManagementEndpoint.ts
|
|
7
|
+
/**
|
|
8
|
+
* Resolves where a management resource collection lives, honoring the provider's `endpoints`
|
|
9
|
+
* override so the management API can run on a different host from the authorization server.
|
|
10
|
+
*
|
|
11
|
+
* @param key - The resource collection.
|
|
12
|
+
* @returns The base URL and optional collection URL override.
|
|
13
|
+
*/
|
|
14
|
+
const useManagementEndpoint = (key) => {
|
|
15
|
+
const { baseUrl, endpoints } = require_useThunderID.default();
|
|
16
|
+
return {
|
|
17
|
+
baseUrl,
|
|
18
|
+
url: (0, __thunderid_browser.resolveResourceEndpoint)(key, { endpoints })
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
var useManagementEndpoint_default = useManagementEndpoint;
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.default = useManagementEndpoint_default;
|
|
25
|
+
//# sourceMappingURL=useManagementEndpoint.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useManagementEndpoint.cjs","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,8BAAc;AAE3C,QAAO;EAAC;EAAS,sDAA6B,KAAK,EAAC,WAAU,CAAC;EAAC;;AAGlE,oCAAe"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_createResourceInvalidator = require('../utils/createResourceInvalidator.cjs');
|
|
3
|
+
const require_useThunderID = require('../contexts/ThunderID/useThunderID.cjs');
|
|
4
|
+
const require_useResourceQuery = require('./useResourceQuery.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
7
|
+
|
|
8
|
+
//#region src/hooks/useResourceMutation.ts
|
|
9
|
+
/**
|
|
10
|
+
* Runs a management mutation and invalidates the queries whose data it changed. Depends on no data
|
|
11
|
+
* fetching library.
|
|
12
|
+
*
|
|
13
|
+
* @param mutationFn - Performs the request with the resolved fetcher.
|
|
14
|
+
* @param getInvalidatedKeys - Returns the query key prefixes to invalidate after a success.
|
|
15
|
+
* @param options - Mutation options.
|
|
16
|
+
* @returns The mutation state.
|
|
17
|
+
*/
|
|
18
|
+
const useResourceMutation = (mutationFn, getInvalidatedKeys, { fetcher, onError, onSuccess } = {}) => {
|
|
19
|
+
const { invalidator = require_createResourceInvalidator.fallbackResourceInvalidator } = require_useThunderID.default();
|
|
20
|
+
const resolvedFetcher = require_useResourceQuery.useResolvedFetcher(fetcher);
|
|
21
|
+
const [data, setData] = (0, react.useState)(void 0);
|
|
22
|
+
const [error, setError] = (0, react.useState)(null);
|
|
23
|
+
const [isLoading, setIsLoading] = (0, react.useState)(false);
|
|
24
|
+
const callbacksRef = (0, react.useRef)({
|
|
25
|
+
getInvalidatedKeys,
|
|
26
|
+
mutationFn,
|
|
27
|
+
onError,
|
|
28
|
+
onSuccess
|
|
29
|
+
});
|
|
30
|
+
callbacksRef.current = {
|
|
31
|
+
getInvalidatedKeys,
|
|
32
|
+
mutationFn,
|
|
33
|
+
onError,
|
|
34
|
+
onSuccess
|
|
35
|
+
};
|
|
36
|
+
const mutateAsync = (0, react.useCallback)(async (variables) => {
|
|
37
|
+
setIsLoading(true);
|
|
38
|
+
setError(null);
|
|
39
|
+
try {
|
|
40
|
+
const result = await callbacksRef.current.mutationFn(variables, resolvedFetcher);
|
|
41
|
+
setData(result);
|
|
42
|
+
callbacksRef.current.getInvalidatedKeys(variables).forEach((key) => {
|
|
43
|
+
invalidator.invalidate(key);
|
|
44
|
+
});
|
|
45
|
+
callbacksRef.current.onSuccess?.(result, variables);
|
|
46
|
+
return result;
|
|
47
|
+
} catch (err) {
|
|
48
|
+
const mutationError = err instanceof Error ? err : new Error(String(err));
|
|
49
|
+
setError(mutationError);
|
|
50
|
+
callbacksRef.current.onError?.(mutationError, variables);
|
|
51
|
+
throw mutationError;
|
|
52
|
+
} finally {
|
|
53
|
+
setIsLoading(false);
|
|
54
|
+
}
|
|
55
|
+
}, [invalidator, resolvedFetcher]);
|
|
56
|
+
return {
|
|
57
|
+
data,
|
|
58
|
+
error,
|
|
59
|
+
isLoading,
|
|
60
|
+
mutate: (0, react.useCallback)((variables) => mutateAsync(variables).catch(() => void 0), [mutateAsync]),
|
|
61
|
+
mutateAsync,
|
|
62
|
+
reset: (0, react.useCallback)(() => {
|
|
63
|
+
setData(void 0);
|
|
64
|
+
setError(null);
|
|
65
|
+
}, [])
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
var useResourceMutation_default = useResourceMutation;
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.default = useResourceMutation_default;
|
|
72
|
+
//# sourceMappingURL=useResourceMutation.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResourceMutation.cjs","names":["fallbackResourceInvalidator","useThunderID","resolvedFetcher: ApiFetcher","useResolvedFetcher","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,cAAcA,kEAA+BC,8BAAc;CAClE,MAAMC,kBAA8BC,4CAAmB,QAAQ;CAC/D,MAAM,CAAC,MAAM,+BAAuC,OAAU;CAC9D,MAAM,CAAC,OAAO,gCAAmC,KAAK;CACtD,MAAM,CAAC,WAAW,oCAAkC,MAAM;CAE1D,MAAMC,iCAOK;EAAC;EAAoB;EAAY;EAAS;EAAU,CAAC;AAChE,cAAa,UAAU;EAAC;EAAoB;EAAY;EAAS;EAAU;CAE3E,MAAMC,qCACJ,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,gCAT7B,cAAsD,YAAY,UAAU,CAAC,YAAuB,OAAU,EAC/G,CAAC,YAAY,CACd;EAOuC;EAAa,oCALH;AAChD,WAAQ,OAAU;AAClB,YAAS,KAAK;KACb,EAAE,CAAC;EAEqD;;AAG7D,kCAAe"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_createResourceInvalidator = require('../utils/createResourceInvalidator.cjs');
|
|
3
|
+
const require_useThunderID = require('../contexts/ThunderID/useThunderID.cjs');
|
|
4
|
+
const require_createAuthenticatedFetcher = require('../utils/createAuthenticatedFetcher.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
7
|
+
|
|
8
|
+
//#region src/hooks/useResourceQuery.ts
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the fetcher a management hook should use: the hook's own, then the provider's, then the
|
|
11
|
+
* SDK's authenticated HTTP client.
|
|
12
|
+
*/
|
|
13
|
+
const useResolvedFetcher = (fetcher) => {
|
|
14
|
+
const { http, instanceId } = require_useThunderID.default();
|
|
15
|
+
const providerFetcher = http?.fetcher;
|
|
16
|
+
return (0, react.useMemo)(() => fetcher ?? providerFetcher ?? require_createAuthenticatedFetcher.default(instanceId), [
|
|
17
|
+
fetcher,
|
|
18
|
+
providerFetcher,
|
|
19
|
+
instanceId
|
|
20
|
+
]);
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Fetches a management resource and keeps it fresh. Depends on no data fetching library: the
|
|
24
|
+
* request runs through the resolved fetcher, and a matching mutation triggers a refetch.
|
|
25
|
+
*
|
|
26
|
+
* @param queryKey - Identifies the data. Changing it refetches; mutations invalidate by key prefix.
|
|
27
|
+
* @param queryFn - Performs the request with the resolved fetcher.
|
|
28
|
+
* @param options - Query options.
|
|
29
|
+
* @returns The query state.
|
|
30
|
+
*/
|
|
31
|
+
const useResourceQuery = (queryKey, queryFn, { enabled = true, fetcher } = {}) => {
|
|
32
|
+
const { invalidator = require_createResourceInvalidator.fallbackResourceInvalidator } = require_useThunderID.default();
|
|
33
|
+
const resolvedFetcher = useResolvedFetcher(fetcher);
|
|
34
|
+
const [data, setData] = (0, react.useState)(void 0);
|
|
35
|
+
const [error, setError] = (0, react.useState)(null);
|
|
36
|
+
const [isLoading, setIsLoading] = (0, react.useState)(enabled);
|
|
37
|
+
const serializedKey = JSON.stringify(queryKey);
|
|
38
|
+
const queryFnRef = (0, react.useRef)(queryFn);
|
|
39
|
+
queryFnRef.current = queryFn;
|
|
40
|
+
const latestRequestRef = (0, react.useRef)(0);
|
|
41
|
+
const refetch = (0, react.useCallback)(async () => {
|
|
42
|
+
latestRequestRef.current += 1;
|
|
43
|
+
const requestId = latestRequestRef.current;
|
|
44
|
+
setIsLoading(true);
|
|
45
|
+
try {
|
|
46
|
+
const result = await queryFnRef.current(resolvedFetcher);
|
|
47
|
+
if (requestId === latestRequestRef.current) {
|
|
48
|
+
setData(result);
|
|
49
|
+
setError(null);
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
} catch (err) {
|
|
53
|
+
if (requestId === latestRequestRef.current) setError(err instanceof Error ? err : new Error(String(err)));
|
|
54
|
+
return;
|
|
55
|
+
} finally {
|
|
56
|
+
if (requestId === latestRequestRef.current) setIsLoading(false);
|
|
57
|
+
}
|
|
58
|
+
}, [resolvedFetcher]);
|
|
59
|
+
(0, react.useEffect)(() => {
|
|
60
|
+
if (!enabled) {
|
|
61
|
+
setIsLoading(false);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
refetch();
|
|
65
|
+
return invalidator.subscribe(JSON.parse(serializedKey), () => {
|
|
66
|
+
refetch();
|
|
67
|
+
});
|
|
68
|
+
}, [
|
|
69
|
+
enabled,
|
|
70
|
+
invalidator,
|
|
71
|
+
refetch,
|
|
72
|
+
serializedKey
|
|
73
|
+
]);
|
|
74
|
+
return {
|
|
75
|
+
data,
|
|
76
|
+
error,
|
|
77
|
+
isLoading,
|
|
78
|
+
refetch
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
var useResourceQuery_default = useResourceQuery;
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
exports.default = useResourceQuery_default;
|
|
85
|
+
exports.useResolvedFetcher = useResolvedFetcher;
|
|
86
|
+
//# sourceMappingURL=useResourceQuery.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResourceQuery.cjs","names":["useThunderID","providerFetcher: ApiFetcher | undefined","createAuthenticatedFetcher","fallbackResourceInvalidator","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,8BAAc;CACzC,MAAMC,kBAA0C,MAAM;AAEtD,iCACQ,WAAW,mBAAmBC,2CAA2B,WAAW,EAC1E;EAAC;EAAS;EAAiB;EAAW,CACvC;;;;;;;;;;;AAYH,MAAM,oBACJ,UACA,SACA,EAAC,UAAU,MAAM,YAAiC,EAAE,KACzB;CAC3B,MAAM,EAAC,cAAcC,kEAA+BH,8BAAc;CAClE,MAAMI,kBAA8B,mBAAmB,QAAQ;CAC/D,MAAM,CAAC,MAAM,+BAAmC,OAAU;CAC1D,MAAM,CAAC,OAAO,gCAAmC,KAAK;CACtD,MAAM,CAAC,WAAW,oCAAkC,QAAQ;CAE5D,MAAMC,gBAAwB,KAAK,UAAU,SAAS;CACtD,MAAMC,+BAAoE,QAAQ;AAClF,YAAW,UAAU;CAErB,MAAMC,qCAA6C,EAAE;CAErD,MAAMC,iCAAoD,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,4BAAgB;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,26 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useManagementEndpoint = require('../useManagementEndpoint.cjs');
|
|
3
|
+
const require_useResourceMutation = require('../useResourceMutation.cjs');
|
|
4
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
5
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/users/useCreateUser.ts
|
|
8
|
+
/**
|
|
9
|
+
* Creates a user, then refetches any mounted user lists.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
|
|
12
|
+
* @returns The mutation state. Call `mutate(payload)` to create.
|
|
13
|
+
*/
|
|
14
|
+
const useCreateUser = (options) => {
|
|
15
|
+
const endpoint = require_useManagementEndpoint.default("users");
|
|
16
|
+
return require_useResourceMutation.default((payload, fetcher) => (0, __thunderid_browser.createUser)({
|
|
17
|
+
...endpoint,
|
|
18
|
+
fetcher,
|
|
19
|
+
payload
|
|
20
|
+
}), () => [[__thunderid_browser.UserQueryKeys.USERS]], options);
|
|
21
|
+
};
|
|
22
|
+
var useCreateUser_default = useCreateUser;
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.default = useCreateUser_default;
|
|
26
|
+
//# sourceMappingURL=useCreateUser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateUser.cjs","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation","UserQueryKeys"],"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,sCAAsB,QAAQ;AAEnE,QAAOC,qCACJ,SAAmC,gDAAuB;EAAC,GAAG;EAAU;EAAS;EAAQ,CAAC,QACrF,CAAC,CAACC,kCAAc,MAAM,CAAC,EAC7B,QACD;;AAGH,4BAAe"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useManagementEndpoint = require('../useManagementEndpoint.cjs');
|
|
3
|
+
const require_useResourceMutation = require('../useResourceMutation.cjs');
|
|
4
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
5
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/users/useDeleteUser.ts
|
|
8
|
+
/**
|
|
9
|
+
* Deletes a user, then refetches any mounted user lists.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
|
|
12
|
+
* @returns The mutation state. Call `mutate(userId)` to delete.
|
|
13
|
+
*/
|
|
14
|
+
const useDeleteUser = (options) => {
|
|
15
|
+
const endpoint = require_useManagementEndpoint.default("users");
|
|
16
|
+
return require_useResourceMutation.default((userId, fetcher) => (0, __thunderid_browser.deleteUser)({
|
|
17
|
+
...endpoint,
|
|
18
|
+
fetcher,
|
|
19
|
+
userId
|
|
20
|
+
}), () => [[__thunderid_browser.UserQueryKeys.USERS]], options);
|
|
21
|
+
};
|
|
22
|
+
var useDeleteUser_default = useDeleteUser;
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.default = useDeleteUser_default;
|
|
26
|
+
//# sourceMappingURL=useDeleteUser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteUser.cjs","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation","UserQueryKeys"],"sources":["../../../../src/hooks/users/useDeleteUser.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {UserQueryKeys, deleteUser} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationOptions, ResourceMutationResult} from '../useResourceMutation';\n\n/**\n * Deletes 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(userId)` to delete.\n */\nconst useDeleteUser = (options?: ResourceMutationOptions<void, string>): ResourceMutationResult<void, string> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('users');\n\n return useResourceMutation(\n (userId: string, fetcher) => deleteUser({...endpoint, fetcher, userId}),\n () => [[UserQueryKeys.USERS]],\n options,\n );\n};\n\nexport default useDeleteUser;\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,iBAAiB,YAA0F;CAC/G,MAAMA,WAA+BC,sCAAsB,QAAQ;AAEnE,QAAOC,qCACJ,QAAgB,gDAAuB;EAAC,GAAG;EAAU;EAAS;EAAO,CAAC,QACjE,CAAC,CAACC,kCAAc,MAAM,CAAC,EAC7B,QACD;;AAGH,4BAAe"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useManagementEndpoint = require('../useManagementEndpoint.cjs');
|
|
3
|
+
const require_useResourceQuery = require('../useResourceQuery.cjs');
|
|
4
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
5
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/users/useGetUser.ts
|
|
8
|
+
/**
|
|
9
|
+
* Fetches a single user. Does nothing until `userId` is set.
|
|
10
|
+
*
|
|
11
|
+
* @param userId - Identifier of the user.
|
|
12
|
+
* @param options - Query options, including a per-hook `fetcher`.
|
|
13
|
+
* @returns The query state.
|
|
14
|
+
*/
|
|
15
|
+
const useGetUser = (userId, options) => {
|
|
16
|
+
const endpoint = require_useManagementEndpoint.default("users");
|
|
17
|
+
return require_useResourceQuery.default([__thunderid_browser.UserQueryKeys.USER, userId], (fetcher) => (0, __thunderid_browser.getUser)({
|
|
18
|
+
...endpoint,
|
|
19
|
+
fetcher,
|
|
20
|
+
userId
|
|
21
|
+
}), {
|
|
22
|
+
...options,
|
|
23
|
+
enabled: Boolean(userId) && options?.enabled !== false
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var useGetUser_default = useGetUser;
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.default = useGetUser_default;
|
|
30
|
+
//# sourceMappingURL=useGetUser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetUser.cjs","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceQuery","UserQueryKeys"],"sources":["../../../../src/hooks/users/useGetUser.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ManagedUser, UserQueryKeys, getUser} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceQuery, {ResourceQueryOptions, ResourceQueryResult} from '../useResourceQuery';\n\n/**\n * Fetches a single user. Does nothing until `userId` is set.\n *\n * @param userId - Identifier of the user.\n * @param options - Query options, including a per-hook `fetcher`.\n * @returns The query state.\n */\nconst useGetUser = (userId: string | undefined, options?: ResourceQueryOptions): ResourceQueryResult<ManagedUser> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('users');\n\n return useResourceQuery([UserQueryKeys.USER, userId], (fetcher) => getUser({...endpoint, fetcher, userId: userId!}), {\n ...options,\n enabled: Boolean(userId) && options?.enabled !== false,\n });\n};\n\nexport default useGetUser;\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,cAAc,QAA4B,YAAqE;CACnH,MAAMA,WAA+BC,sCAAsB,QAAQ;AAEnE,QAAOC,iCAAiB,CAACC,kCAAc,MAAM,OAAO,GAAG,6CAAoB;EAAC,GAAG;EAAU;EAAiB;EAAQ,CAAC,EAAE;EACnH,GAAG;EACH,SAAS,QAAQ,OAAO,IAAI,SAAS,YAAY;EAClD,CAAC;;AAGJ,yBAAe"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useManagementEndpoint = require('../useManagementEndpoint.cjs');
|
|
3
|
+
const require_useResourceQuery = require('../useResourceQuery.cjs');
|
|
4
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
5
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/users/useGetUsers.ts
|
|
8
|
+
/**
|
|
9
|
+
* Fetches a page of users.
|
|
10
|
+
*
|
|
11
|
+
* @param params - Pagination and filter parameters.
|
|
12
|
+
* @param options - Query options, including a per-hook `fetcher`.
|
|
13
|
+
* @returns The query state.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const {data, isLoading} = useGetUsers({limit: 20, filter: 'username sw "a"'});
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
const useGetUsers = ({ filter, limit, offset } = {}, options) => {
|
|
21
|
+
const endpoint = require_useManagementEndpoint.default("users");
|
|
22
|
+
return require_useResourceQuery.default([__thunderid_browser.UserQueryKeys.USERS, {
|
|
23
|
+
filter,
|
|
24
|
+
limit,
|
|
25
|
+
offset
|
|
26
|
+
}], (fetcher) => (0, __thunderid_browser.getUsers)({
|
|
27
|
+
...endpoint,
|
|
28
|
+
fetcher,
|
|
29
|
+
filter,
|
|
30
|
+
limit,
|
|
31
|
+
offset
|
|
32
|
+
}), options);
|
|
33
|
+
};
|
|
34
|
+
var useGetUsers_default = useGetUsers;
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.default = useGetUsers_default;
|
|
38
|
+
//# sourceMappingURL=useGetUsers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetUsers.cjs","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceQuery","UserQueryKeys"],"sources":["../../../../src/hooks/users/useGetUsers.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ApiFilteringParams, ManagedUserListResponse, UserQueryKeys, getUsers} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceQuery, {ResourceQueryOptions, ResourceQueryResult} from '../useResourceQuery';\n\n/**\n * Fetches a page of users.\n *\n * @param params - Pagination and filter 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} = useGetUsers({limit: 20, filter: 'username sw \"a\"'});\n * ```\n */\nconst useGetUsers = (\n {filter, limit, offset}: ApiFilteringParams = {},\n options?: ResourceQueryOptions,\n): ResourceQueryResult<ManagedUserListResponse> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('users');\n\n return useResourceQuery(\n [UserQueryKeys.USERS, {filter, limit, offset}],\n (fetcher) => getUsers({...endpoint, fetcher, filter, limit, offset}),\n options,\n );\n};\n\nexport default useGetUsers;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,eACJ,EAAC,QAAQ,OAAO,WAA8B,EAAE,EAChD,YACiD;CACjD,MAAMA,WAA+BC,sCAAsB,QAAQ;AAEnE,QAAOC,iCACL,CAACC,kCAAc,OAAO;EAAC;EAAQ;EAAO;EAAO,CAAC,GAC7C,8CAAqB;EAAC,GAAG;EAAU;EAAS;EAAQ;EAAO;EAAO,CAAC,EACpE,QACD;;AAGH,0BAAe"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useManagementEndpoint = require('../useManagementEndpoint.cjs');
|
|
3
|
+
const require_useResourceMutation = require('../useResourceMutation.cjs');
|
|
4
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
5
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/users/useUpdateUser.ts
|
|
8
|
+
/**
|
|
9
|
+
* Updates a user, then refetches it and any mounted user lists.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
|
|
12
|
+
* @returns The mutation state. Call `mutate({userId, data})` to update.
|
|
13
|
+
*/
|
|
14
|
+
const useUpdateUser = (options) => {
|
|
15
|
+
const endpoint = require_useManagementEndpoint.default("users");
|
|
16
|
+
return require_useResourceMutation.default(({ userId, data }, fetcher) => (0, __thunderid_browser.updateUser)({
|
|
17
|
+
...endpoint,
|
|
18
|
+
fetcher,
|
|
19
|
+
payload: data,
|
|
20
|
+
userId
|
|
21
|
+
}), ({ userId }) => [[__thunderid_browser.UserQueryKeys.USER, userId], [__thunderid_browser.UserQueryKeys.USERS]], options);
|
|
22
|
+
};
|
|
23
|
+
var useUpdateUser_default = useUpdateUser;
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.default = useUpdateUser_default;
|
|
27
|
+
//# sourceMappingURL=useUpdateUser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateUser.cjs","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation","UserQueryKeys"],"sources":["../../../../src/hooks/users/useUpdateUser.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ManagedUser, UpdateManagedUserRequest, UserQueryKeys, updateUser} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationOptions, ResourceMutationResult} from '../useResourceMutation';\n\n/**\n * Variables accepted by {@link useUpdateUser}'s `mutate`.\n */\nexport interface UpdateUserVariables {\n data: UpdateManagedUserRequest;\n userId: string;\n}\n\n/**\n * Updates a user, then refetches it and 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({userId, data})` to update.\n */\nconst useUpdateUser = (\n options?: ResourceMutationOptions<ManagedUser, UpdateUserVariables>,\n): ResourceMutationResult<ManagedUser, UpdateUserVariables> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('users');\n\n return useResourceMutation(\n ({userId, data}: UpdateUserVariables, fetcher) => updateUser({...endpoint, fetcher, payload: data, userId}),\n ({userId}: UpdateUserVariables) => [[UserQueryKeys.USER, userId], [UserQueryKeys.USERS]],\n options,\n );\n};\n\nexport default useUpdateUser;\n"],"mappings":";;;;;;;;;;;;;AAqBA,MAAM,iBACJ,YAC6D;CAC7D,MAAMA,WAA+BC,sCAAsB,QAAQ;AAEnE,QAAOC,qCACJ,EAAC,QAAQ,QAA4B,gDAAuB;EAAC,GAAG;EAAU;EAAS,SAAS;EAAM;EAAO,CAAC,GAC1G,EAAC,aAAiC,CAAC,CAACC,kCAAc,MAAM,OAAO,EAAE,CAACA,kCAAc,MAAM,CAAC,EACxF,QACD;;AAGH,4BAAe"}
|