@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,10 @@
|
|
|
1
|
+
import { ResourceMutationOptions, ResourceMutationResult } from '../useResourceMutation';
|
|
2
|
+
/**
|
|
3
|
+
* Deletes an agent, then refetches any mounted agent lists.
|
|
4
|
+
*
|
|
5
|
+
* @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
|
|
6
|
+
* @returns The mutation state. Call `mutate(agentId)` to delete.
|
|
7
|
+
*/
|
|
8
|
+
declare const useDeleteAgent: (options?: ResourceMutationOptions<void, string>) => ResourceMutationResult<void, string>;
|
|
9
|
+
export default useDeleteAgent;
|
|
10
|
+
//# sourceMappingURL=useDeleteAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteAgent.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/useDeleteAgent.ts"],"names":[],"mappings":"AAKA,OAA4B,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAE5G;;;;;GAKG;AACH,QAAA,MAAM,cAAc,GAAI,UAAU,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,KAAG,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAQ5G,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import useManagementEndpoint_default from "../useManagementEndpoint.js";
|
|
2
|
+
import useResourceMutation_default from "../useResourceMutation.js";
|
|
3
|
+
import { AgentQueryKeys, deleteAgent } from "@thunderid/browser";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/agents/useDeleteAgent.ts
|
|
6
|
+
/**
|
|
7
|
+
* Deletes an agent, then refetches any mounted agent lists.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
|
|
10
|
+
* @returns The mutation state. Call `mutate(agentId)` to delete.
|
|
11
|
+
*/
|
|
12
|
+
const useDeleteAgent = (options) => {
|
|
13
|
+
const endpoint = useManagementEndpoint_default("agents");
|
|
14
|
+
return useResourceMutation_default((agentId, fetcher) => deleteAgent({
|
|
15
|
+
...endpoint,
|
|
16
|
+
agentId,
|
|
17
|
+
fetcher
|
|
18
|
+
}), () => [[AgentQueryKeys.AGENTS]], options);
|
|
19
|
+
};
|
|
20
|
+
var useDeleteAgent_default = useDeleteAgent;
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { useDeleteAgent_default as default };
|
|
24
|
+
//# sourceMappingURL=useDeleteAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteAgent.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation"],"sources":["../../../src/hooks/agents/useDeleteAgent.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {AgentQueryKeys, deleteAgent} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationOptions, ResourceMutationResult} from '../useResourceMutation';\n\n/**\n * Deletes an agent, then refetches any mounted agent lists.\n *\n * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.\n * @returns The mutation state. Call `mutate(agentId)` to delete.\n */\nconst useDeleteAgent = (options?: ResourceMutationOptions<void, string>): ResourceMutationResult<void, string> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('agents');\n\n return useResourceMutation(\n (agentId: string, fetcher) => deleteAgent({...endpoint, agentId, fetcher}),\n () => [[AgentQueryKeys.AGENTS]],\n options,\n );\n};\n\nexport default useDeleteAgent;\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,kBAAkB,YAA0F;CAChH,MAAMA,WAA+BC,8BAAsB,SAAS;AAEpE,QAAOC,6BACJ,SAAiB,YAAY,YAAY;EAAC,GAAG;EAAU;EAAS;EAAQ,CAAC,QACpE,CAAC,CAAC,eAAe,OAAO,CAAC,EAC/B,QACD;;AAGH,6BAAe"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Agent } from '@thunderid/browser';
|
|
2
|
+
import { ResourceQueryOptions, ResourceQueryResult } from '../useResourceQuery';
|
|
3
|
+
/**
|
|
4
|
+
* Fetches a single agent. Does nothing until `agentId` is set.
|
|
5
|
+
*
|
|
6
|
+
* @param agentId - Identifier of the agent.
|
|
7
|
+
* @param options - Query options, including a per-hook `fetcher`.
|
|
8
|
+
* @returns The query state.
|
|
9
|
+
*/
|
|
10
|
+
declare const useGetAgent: (agentId: string | undefined, options?: ResourceQueryOptions) => ResourceQueryResult<Agent>;
|
|
11
|
+
export default useGetAgent;
|
|
12
|
+
//# sourceMappingURL=useGetAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetAgent.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/useGetAgent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAA2B,MAAM,oBAAoB,CAAC;AAEnE,OAAyB,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAEhG;;;;;;GAMG;AACH,QAAA,MAAM,WAAW,GAAI,SAAS,MAAM,GAAG,SAAS,EAAE,UAAU,oBAAoB,KAAG,mBAAmB,CAAC,KAAK,CAQ3G,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import useManagementEndpoint_default from "../useManagementEndpoint.js";
|
|
2
|
+
import useResourceQuery_default from "../useResourceQuery.js";
|
|
3
|
+
import { AgentQueryKeys, getAgent } from "@thunderid/browser";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/agents/useGetAgent.ts
|
|
6
|
+
/**
|
|
7
|
+
* Fetches a single agent. Does nothing until `agentId` is set.
|
|
8
|
+
*
|
|
9
|
+
* @param agentId - Identifier of the agent.
|
|
10
|
+
* @param options - Query options, including a per-hook `fetcher`.
|
|
11
|
+
* @returns The query state.
|
|
12
|
+
*/
|
|
13
|
+
const useGetAgent = (agentId, options) => {
|
|
14
|
+
const endpoint = useManagementEndpoint_default("agents");
|
|
15
|
+
return useResourceQuery_default([AgentQueryKeys.AGENT, agentId], (fetcher) => getAgent({
|
|
16
|
+
...endpoint,
|
|
17
|
+
agentId,
|
|
18
|
+
fetcher
|
|
19
|
+
}), {
|
|
20
|
+
...options,
|
|
21
|
+
enabled: Boolean(agentId) && options?.enabled !== false
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var useGetAgent_default = useGetAgent;
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useGetAgent_default as default };
|
|
28
|
+
//# sourceMappingURL=useGetAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetAgent.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceQuery"],"sources":["../../../src/hooks/agents/useGetAgent.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Agent, AgentQueryKeys, getAgent} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceQuery, {ResourceQueryOptions, ResourceQueryResult} from '../useResourceQuery';\n\n/**\n * Fetches a single agent. Does nothing until `agentId` is set.\n *\n * @param agentId - Identifier of the agent.\n * @param options - Query options, including a per-hook `fetcher`.\n * @returns The query state.\n */\nconst useGetAgent = (agentId: string | undefined, options?: ResourceQueryOptions): ResourceQueryResult<Agent> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('agents');\n\n return useResourceQuery(\n [AgentQueryKeys.AGENT, agentId],\n (fetcher) => getAgent({...endpoint, agentId: agentId!, fetcher}),\n {...options, enabled: Boolean(agentId) && options?.enabled !== false},\n );\n};\n\nexport default useGetAgent;\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,eAAe,SAA6B,YAA+D;CAC/G,MAAMA,WAA+BC,8BAAsB,SAAS;AAEpE,QAAOC,yBACL,CAAC,eAAe,OAAO,QAAQ,GAC9B,YAAY,SAAS;EAAC,GAAG;EAAmB;EAAU;EAAQ,CAAC,EAChE;EAAC,GAAG;EAAS,SAAS,QAAQ,QAAQ,IAAI,SAAS,YAAY;EAAM,CACtE;;AAGH,0BAAe"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AgentListResponse } from '@thunderid/browser';
|
|
2
|
+
import { ResourceQueryOptions, ResourceQueryResult } from '../useResourceQuery';
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for {@link useGetAgents}.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseGetAgentsParams {
|
|
7
|
+
limit?: number;
|
|
8
|
+
offset?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Fetches a page of agents.
|
|
12
|
+
*
|
|
13
|
+
* @param params - Pagination parameters.
|
|
14
|
+
* @param options - Query options, including a per-hook `fetcher`.
|
|
15
|
+
* @returns The query state.
|
|
16
|
+
*/
|
|
17
|
+
declare const useGetAgents: ({ limit, offset }?: UseGetAgentsParams, options?: ResourceQueryOptions) => ResourceQueryResult<AgentListResponse>;
|
|
18
|
+
export default useGetAgents;
|
|
19
|
+
//# sourceMappingURL=useGetAgents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetAgents.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/useGetAgents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAA4B,MAAM,oBAAoB,CAAC;AAEhF,OAAyB,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAEhG;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,YAAY,GAChB,oBAAiB,kBAAuB,EACxC,UAAU,oBAAoB,KAC7B,mBAAmB,CAAC,iBAAiB,CAQvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import useManagementEndpoint_default from "../useManagementEndpoint.js";
|
|
2
|
+
import useResourceQuery_default from "../useResourceQuery.js";
|
|
3
|
+
import { AgentQueryKeys, getAgents } from "@thunderid/browser";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/agents/useGetAgents.ts
|
|
6
|
+
/**
|
|
7
|
+
* Fetches a page of agents.
|
|
8
|
+
*
|
|
9
|
+
* @param params - Pagination parameters.
|
|
10
|
+
* @param options - Query options, including a per-hook `fetcher`.
|
|
11
|
+
* @returns The query state.
|
|
12
|
+
*/
|
|
13
|
+
const useGetAgents = ({ limit, offset } = {}, options) => {
|
|
14
|
+
const endpoint = useManagementEndpoint_default("agents");
|
|
15
|
+
return useResourceQuery_default([AgentQueryKeys.AGENTS, {
|
|
16
|
+
limit,
|
|
17
|
+
offset
|
|
18
|
+
}], (fetcher) => getAgents({
|
|
19
|
+
...endpoint,
|
|
20
|
+
fetcher,
|
|
21
|
+
limit,
|
|
22
|
+
offset
|
|
23
|
+
}), options);
|
|
24
|
+
};
|
|
25
|
+
var useGetAgents_default = useGetAgents;
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { useGetAgents_default as default };
|
|
29
|
+
//# sourceMappingURL=useGetAgents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetAgents.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceQuery"],"sources":["../../../src/hooks/agents/useGetAgents.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {AgentListResponse, AgentQueryKeys, getAgents} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceQuery, {ResourceQueryOptions, ResourceQueryResult} from '../useResourceQuery';\n\n/**\n * Parameters for {@link useGetAgents}.\n */\nexport interface UseGetAgentsParams {\n limit?: number;\n offset?: number;\n}\n\n/**\n * Fetches a page of agents.\n *\n * @param params - Pagination parameters.\n * @param options - Query options, including a per-hook `fetcher`.\n * @returns The query state.\n */\nconst useGetAgents = (\n {limit, offset}: UseGetAgentsParams = {},\n options?: ResourceQueryOptions,\n): ResourceQueryResult<AgentListResponse> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('agents');\n\n return useResourceQuery(\n [AgentQueryKeys.AGENTS, {limit, offset}],\n (fetcher) => getAgents({...endpoint, fetcher, limit, offset}),\n options,\n );\n};\n\nexport default useGetAgents;\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAM,gBACJ,EAAC,OAAO,WAA8B,EAAE,EACxC,YAC2C;CAC3C,MAAMA,WAA+BC,8BAAsB,SAAS;AAEpE,QAAOC,yBACL,CAAC,eAAe,QAAQ;EAAC;EAAO;EAAO,CAAC,GACvC,YAAY,UAAU;EAAC,GAAG;EAAU;EAAS;EAAO;EAAO,CAAC,EAC7D,QACD;;AAGH,2BAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Agent, UpdateAgentRequest } from '@thunderid/browser';
|
|
2
|
+
import { ResourceMutationOptions, ResourceMutationResult } from '../useResourceMutation';
|
|
3
|
+
/**
|
|
4
|
+
* Variables accepted by {@link useUpdateAgent}'s `mutate`.
|
|
5
|
+
*/
|
|
6
|
+
export interface UpdateAgentVariables {
|
|
7
|
+
agentId: string;
|
|
8
|
+
data: UpdateAgentRequest;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Updates an agent, then refetches it and any mounted agent lists.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
|
|
14
|
+
* @returns The mutation state. Call `mutate({agentId, data})` to update.
|
|
15
|
+
*/
|
|
16
|
+
declare const useUpdateAgent: (options?: ResourceMutationOptions<Agent, UpdateAgentVariables>) => ResourceMutationResult<Agent, UpdateAgentVariables>;
|
|
17
|
+
export default useUpdateAgent;
|
|
18
|
+
//# sourceMappingURL=useUpdateAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateAgent.d.ts","sourceRoot":"","sources":["../../../src/hooks/agents/useUpdateAgent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAkB,kBAAkB,EAAc,MAAM,oBAAoB,CAAC;AAE1F,OAA4B,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAE5G;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED;;;;;GAKG;AACH,QAAA,MAAM,cAAc,GAClB,UAAU,uBAAuB,CAAC,KAAK,EAAE,oBAAoB,CAAC,KAC7D,sBAAsB,CAAC,KAAK,EAAE,oBAAoB,CAQpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import useManagementEndpoint_default from "../useManagementEndpoint.js";
|
|
2
|
+
import useResourceMutation_default from "../useResourceMutation.js";
|
|
3
|
+
import { AgentQueryKeys, updateAgent } from "@thunderid/browser";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/agents/useUpdateAgent.ts
|
|
6
|
+
/**
|
|
7
|
+
* Updates an agent, then refetches it and any mounted agent lists.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
|
|
10
|
+
* @returns The mutation state. Call `mutate({agentId, data})` to update.
|
|
11
|
+
*/
|
|
12
|
+
const useUpdateAgent = (options) => {
|
|
13
|
+
const endpoint = useManagementEndpoint_default("agents");
|
|
14
|
+
return useResourceMutation_default(({ agentId, data }, fetcher) => updateAgent({
|
|
15
|
+
...endpoint,
|
|
16
|
+
agentId,
|
|
17
|
+
fetcher,
|
|
18
|
+
payload: data
|
|
19
|
+
}), ({ agentId }) => [[AgentQueryKeys.AGENT, agentId], [AgentQueryKeys.AGENTS]], options);
|
|
20
|
+
};
|
|
21
|
+
var useUpdateAgent_default = useUpdateAgent;
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { useUpdateAgent_default as default };
|
|
25
|
+
//# sourceMappingURL=useUpdateAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateAgent.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation"],"sources":["../../../src/hooks/agents/useUpdateAgent.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Agent, AgentQueryKeys, UpdateAgentRequest, updateAgent} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationOptions, ResourceMutationResult} from '../useResourceMutation';\n\n/**\n * Variables accepted by {@link useUpdateAgent}'s `mutate`.\n */\nexport interface UpdateAgentVariables {\n agentId: string;\n data: UpdateAgentRequest;\n}\n\n/**\n * Updates an agent, then refetches it and any mounted agent lists.\n *\n * @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.\n * @returns The mutation state. Call `mutate({agentId, data})` to update.\n */\nconst useUpdateAgent = (\n options?: ResourceMutationOptions<Agent, UpdateAgentVariables>,\n): ResourceMutationResult<Agent, UpdateAgentVariables> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('agents');\n\n return useResourceMutation(\n ({agentId, data}: UpdateAgentVariables, fetcher) => updateAgent({...endpoint, agentId, fetcher, payload: data}),\n ({agentId}: UpdateAgentVariables) => [[AgentQueryKeys.AGENT, agentId], [AgentQueryKeys.AGENTS]],\n options,\n );\n};\n\nexport default useUpdateAgent;\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,kBACJ,YACwD;CACxD,MAAMA,WAA+BC,8BAAsB,SAAS;AAEpE,QAAOC,6BACJ,EAAC,SAAS,QAA6B,YAAY,YAAY;EAAC,GAAG;EAAU;EAAS;EAAS,SAAS;EAAK,CAAC,GAC9G,EAAC,cAAmC,CAAC,CAAC,eAAe,OAAO,QAAQ,EAAE,CAAC,eAAe,OAAO,CAAC,EAC/F,QACD;;AAGH,6BAAe"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Application, CreateApplicationRequest } from '@thunderid/browser';
|
|
2
|
+
import { ResourceMutationOptions, ResourceMutationResult } from '../useResourceMutation';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an application, then refetches any mounted application 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
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const {mutate, isLoading, error} = useCreateApplication({onSuccess: app => navigate(app.id)});
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare const useCreateApplication: (options?: ResourceMutationOptions<Application, CreateApplicationRequest>) => ResourceMutationResult<Application, CreateApplicationRequest>;
|
|
15
|
+
export default useCreateApplication;
|
|
16
|
+
//# sourceMappingURL=useCreateApplication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateApplication.d.ts","sourceRoot":"","sources":["../../../src/hooks/applications/useCreateApplication.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,WAAW,EAAwB,wBAAwB,EAAoB,MAAM,oBAAoB,CAAC;AAElH,OAA4B,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAE5G;;;;;;;;;;GAUG;AACH,QAAA,MAAM,oBAAoB,GACxB,UAAU,uBAAuB,CAAC,WAAW,EAAE,wBAAwB,CAAC,KACvE,sBAAsB,CAAC,WAAW,EAAE,wBAAwB,CAQ9D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import useManagementEndpoint_default from "../useManagementEndpoint.js";
|
|
2
|
+
import useResourceMutation_default from "../useResourceMutation.js";
|
|
3
|
+
import { ApplicationQueryKeys, createApplication } from "@thunderid/browser";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/applications/useCreateApplication.ts
|
|
6
|
+
/**
|
|
7
|
+
* Creates 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(payload)` to create.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const {mutate, isLoading, error} = useCreateApplication({onSuccess: app => navigate(app.id)});
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
const useCreateApplication = (options) => {
|
|
18
|
+
const endpoint = useManagementEndpoint_default("applications");
|
|
19
|
+
return useResourceMutation_default((payload, fetcher) => createApplication({
|
|
20
|
+
...endpoint,
|
|
21
|
+
fetcher,
|
|
22
|
+
payload
|
|
23
|
+
}), () => [[ApplicationQueryKeys.APPLICATIONS]], options);
|
|
24
|
+
};
|
|
25
|
+
var useCreateApplication_default = useCreateApplication;
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { useCreateApplication_default as default };
|
|
29
|
+
//# sourceMappingURL=useCreateApplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateApplication.js","names":["endpoint: ManagementEndpoint","useManagementEndpoint","useResourceMutation"],"sources":["../../../src/hooks/applications/useCreateApplication.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Application, ApplicationQueryKeys, CreateApplicationRequest, createApplication} from '@thunderid/browser';\nimport useManagementEndpoint, {ManagementEndpoint} from '../useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationOptions, ResourceMutationResult} from '../useResourceMutation';\n\n/**\n * Creates 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(payload)` to create.\n *\n * @example\n * ```tsx\n * const {mutate, isLoading, error} = useCreateApplication({onSuccess: app => navigate(app.id)});\n * ```\n */\nconst useCreateApplication = (\n options?: ResourceMutationOptions<Application, CreateApplicationRequest>,\n): ResourceMutationResult<Application, CreateApplicationRequest> => {\n const endpoint: ManagementEndpoint = useManagementEndpoint('applications');\n\n return useResourceMutation(\n (payload: CreateApplicationRequest, fetcher) => createApplication({...endpoint, fetcher, payload}),\n () => [[ApplicationQueryKeys.APPLICATIONS]],\n options,\n );\n};\n\nexport default useCreateApplication;\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAM,wBACJ,YACkE;CAClE,MAAMA,WAA+BC,8BAAsB,eAAe;AAE1E,QAAOC,6BACJ,SAAmC,YAAY,kBAAkB;EAAC,GAAG;EAAU;EAAS;EAAQ,CAAC,QAC5F,CAAC,CAAC,qBAAqB,aAAa,CAAC,EAC3C,QACD;;AAGH,mCAAe"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ResourceMutationOptions, ResourceMutationResult } from '../useResourceMutation';
|
|
2
|
+
/**
|
|
3
|
+
* Deletes an application, then refetches any mounted application lists.
|
|
4
|
+
*
|
|
5
|
+
* @param options - Mutation options, including `onSuccess`, `onError`, and a per-hook `fetcher`.
|
|
6
|
+
* @returns The mutation state. Call `mutate(applicationId)` to delete.
|
|
7
|
+
*/
|
|
8
|
+
declare const useDeleteApplication: (options?: ResourceMutationOptions<void, string>) => ResourceMutationResult<void, string>;
|
|
9
|
+
export default useDeleteApplication;
|
|
10
|
+
//# sourceMappingURL=useDeleteApplication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteApplication.d.ts","sourceRoot":"","sources":["../../../src/hooks/applications/useDeleteApplication.ts"],"names":[],"mappings":"AAKA,OAA4B,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAE5G;;;;;GAKG;AACH,QAAA,MAAM,oBAAoB,GACxB,UAAU,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,KAC9C,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAQrC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -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
|