@djangocfg/api 2.1.355 → 2.1.357
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/README.md +53 -632
- package/dist/auth-server.cjs +717 -200
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +717 -200
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +843 -783
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +58 -37
- package/dist/auth.d.ts +58 -37
- package/dist/auth.mjs +846 -784
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +1427 -0
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +1686 -0
- package/dist/clients.d.ts +1686 -0
- package/dist/clients.mjs +1427 -0
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +1277 -1924
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +18 -1206
- package/dist/hooks.d.ts +18 -1206
- package/dist/hooks.mjs +1253 -1900
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +545 -1232
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1389 -1455
- package/dist/index.d.ts +1389 -1455
- package/dist/index.mjs +545 -1232
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
- package/src/_api/generated/_cfg_accounts/api.ts +11 -3
- package/src/_api/generated/_cfg_accounts/hooks/index.ts +3 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRegenerateCreate.ts +64 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts +65 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyTestCreate.ts +64 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/index.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/APIKey.ts +13 -0
- package/src/_api/generated/_cfg_accounts/schemas/APIKeyRegenerate.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/APIKeyRequest.ts +13 -0
- package/src/_api/generated/{_cfg_totp/schemas/DeviceListStatusEnum.ts → _cfg_accounts/schemas/APIKeyTestRequest.ts} +4 -2
- package/src/_api/generated/_cfg_accounts/schemas/APIKeyTestResult.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/AccountDeleteResponse.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/CentrifugoToken.ts +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/CfgUserUpdateRequest.ts +3 -2
- package/src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts +6 -6
- package/src/_api/generated/_cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/{ProviderEnum.ts → OAuthProviderEnum.ts} +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts +5 -5
- package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts +3 -3
- package/src/_api/generated/_cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts +3 -2
- package/src/_api/generated/_cfg_accounts/schemas/User.ts +12 -10
- package/src/_api/generated/_cfg_accounts/schemas/cfg_accounts_oauth_connections_response_200_AutoRef.ts +10 -0
- package/src/_api/generated/_cfg_accounts/schemas/cfg_accounts_oauth_disconnect_response_200_AutoRef.ts +11 -0
- package/src/_api/generated/_cfg_accounts/schemas/index.ts +8 -1
- package/src/_api/generated/_cfg_centrifugo/api.ts +3 -3
- package/src/_api/generated/_cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_centrifugo/index.ts +1 -1
- package/src/_api/generated/_cfg_centrifugo/schemas/ConnectionTokenResponse.ts +2 -2
- package/src/_api/generated/_cfg_totp/api.ts +9 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesDestroy.ts +7 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDisableCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupConfirmCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyBackupCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/index.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/ConfirmSetupRequest.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/ConfirmSetupResponse.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/DeviceList.ts +5 -5
- package/src/_api/generated/_cfg_totp/schemas/DeviceStatusEnum.ts +9 -0
- package/src/_api/generated/_cfg_totp/schemas/SetupResponse.ts +2 -2
- package/src/_api/generated/_cfg_totp/schemas/TotpVerifyUser.ts +11 -9
- package/src/_api/generated/_cfg_totp/schemas/VerifyBackupRequest.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/VerifyRequest.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/VerifyResponse.ts +2 -2
- package/src/_api/generated/_cfg_totp/schemas/cfg_totp_disable_response_200_AutoRef.ts +9 -0
- package/src/_api/generated/_cfg_totp/schemas/index.ts +2 -1
- package/src/_api/generated/index.ts +3 -1
- package/src/_api/generated/sdk.gen.ts +80 -813
- package/src/_api/generated/types.gen.ts +320 -159
- package/src/auth/context/AccountsContext.tsx +18 -6
- package/src/auth/context/AuthContext.tsx +11 -3
- package/src/auth/hooks/useDeleteAccount.ts +2 -2
- package/src/auth/hooks/useGithubAuth.ts +3 -3
- package/src/auth/hooks/useTokenRefresh.ts +2 -2
- package/src/auth/hooks/useTwoFactor.ts +3 -3
- package/src/auth/hooks/useTwoFactorSetup.ts +3 -3
- package/src/auth/hooks/useTwoFactorStatus.ts +3 -3
- package/src/auth/middlewares/tokenRefresh.ts +2 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useApiKey.ts +73 -0
- package/src/index.ts +12 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/api",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.357",
|
|
4
4
|
"description": "Auto-generated TypeScript API client with React hooks, SWR integration, and Zod validation for Django REST Framework backends",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"django",
|
|
@@ -54,6 +54,11 @@
|
|
|
54
54
|
"types": "./dist/clients.d.ts",
|
|
55
55
|
"import": "./dist/clients.mjs",
|
|
56
56
|
"require": "./dist/clients.cjs"
|
|
57
|
+
},
|
|
58
|
+
"./hooks": {
|
|
59
|
+
"types": "./dist/hooks.d.ts",
|
|
60
|
+
"import": "./dist/hooks.mjs",
|
|
61
|
+
"require": "./dist/hooks.cjs"
|
|
57
62
|
}
|
|
58
63
|
},
|
|
59
64
|
"files": [
|
|
@@ -79,7 +84,7 @@
|
|
|
79
84
|
"devDependencies": {
|
|
80
85
|
"@types/node": "^24.7.2",
|
|
81
86
|
"@types/react": "^19.1.0",
|
|
82
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
87
|
+
"@djangocfg/typescript-config": "^2.1.357",
|
|
83
88
|
"next": "^16.2.2",
|
|
84
89
|
"react": "^19.1.0",
|
|
85
90
|
"tsup": "^8.5.0",
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
import { auth } from '../helpers/auth';
|
|
7
7
|
import { APILogger, type LoggerConfig } from '../helpers/logger';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
import { CfgAccountsApiKey } from '../sdk.gen';
|
|
10
|
+
import { CfgAccountsOauth } from '../sdk.gen';
|
|
11
|
+
import { CfgAccounts } from '../sdk.gen';
|
|
12
|
+
import { CfgAccountsProfile } from '../sdk.gen';
|
|
13
|
+
import { CfgAccountsAuth } from '../sdk.gen';
|
|
10
14
|
|
|
11
15
|
|
|
12
16
|
|
|
@@ -34,7 +38,11 @@ export interface APIOptions {
|
|
|
34
38
|
export class API {
|
|
35
39
|
readonly logger: APILogger;
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
readonly cfgAccountsApiKey = CfgAccountsApiKey;
|
|
42
|
+
readonly cfgAccountsOauth = CfgAccountsOauth;
|
|
43
|
+
readonly cfgAccounts = CfgAccounts;
|
|
44
|
+
readonly cfgAccountsProfile = CfgAccountsProfile;
|
|
45
|
+
readonly cfgAccountsAuth = CfgAccountsAuth;
|
|
38
46
|
|
|
39
47
|
constructor(_baseUrl?: string, opts: APIOptions = {}) {
|
|
40
48
|
this.logger = new APILogger(opts.logger);
|
|
@@ -75,5 +83,5 @@ export class API {
|
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
export {
|
|
86
|
+
export { CfgAccountsApiKey, CfgAccountsOauth, CfgAccounts, CfgAccountsProfile, CfgAccountsAuth };
|
|
79
87
|
export { auth };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// AUTO-GENERATED — barrel for all hooks.
|
|
2
2
|
// DO NOT EDIT.
|
|
3
3
|
|
|
4
|
+
export { useCfgAccountsApiKeyRegenerateCreate } from "./useCfgAccountsApiKeyRegenerateCreate";
|
|
5
|
+
export { useCfgAccountsApiKeyRetrieve } from "./useCfgAccountsApiKeyRetrieve";
|
|
6
|
+
export { useCfgAccountsApiKeyTestCreate } from "./useCfgAccountsApiKeyTestCreate";
|
|
4
7
|
export { useCfgAccountsOauthConnectionsList } from "./useCfgAccountsOauthConnectionsList";
|
|
5
8
|
export { useCfgAccountsOauthDisconnectCreate } from "./useCfgAccountsOauthDisconnectCreate";
|
|
6
9
|
export { useCfgAccountsOauthGithubAuthorizeCreate } from "./useCfgAccountsOauthGithubAuthorizeCreate";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by openapi_processor / ts.hooks
|
|
4
|
+
// Regenerate API key
|
|
5
|
+
// DO NOT EDIT — re-run `make gen`.
|
|
6
|
+
|
|
7
|
+
import useSWRMutation from "swr/mutation";
|
|
8
|
+
import type { SWRMutationConfiguration } from "swr/mutation";
|
|
9
|
+
import { CfgAccountsApiKey } from "../../sdk.gen";
|
|
10
|
+
import type { CfgAccountsApiKeyRegenerateCreateData, CfgAccountsApiKeyRegenerateCreateResponses } from "../../types.gen";
|
|
11
|
+
import { APIKeyRegenerateSchema } from "../schemas/APIKeyRegenerate";
|
|
12
|
+
|
|
13
|
+
type Args = Omit<CfgAccountsApiKeyRegenerateCreateData, "url">;
|
|
14
|
+
type Result = CfgAccountsApiKeyRegenerateCreateResponses[keyof CfgAccountsApiKeyRegenerateCreateResponses];
|
|
15
|
+
|
|
16
|
+
export function useCfgAccountsApiKeyRegenerateCreate(
|
|
17
|
+
config?: SWRMutationConfiguration<Result, Error, readonly ["cfg_accounts_api_key_regenerate_create"], Args>,
|
|
18
|
+
) {
|
|
19
|
+
return useSWRMutation<Result, Error, readonly ["cfg_accounts_api_key_regenerate_create"], Args>(
|
|
20
|
+
["cfg_accounts_api_key_regenerate_create"] as const,
|
|
21
|
+
async (_key, { arg }: { arg: Args }) => {
|
|
22
|
+
const res = await CfgAccountsApiKey.cfgAccountsApiKeyRegenerateCreate({ ...arg, throwOnError: true } as never);
|
|
23
|
+
const data = res.data as Result;
|
|
24
|
+
const parsed = APIKeyRegenerateSchema.safeParse(data);
|
|
25
|
+
if (!parsed.success) {
|
|
26
|
+
// Log first so the failure is always visible, even if the
|
|
27
|
+
// event handler swallows it.
|
|
28
|
+
console.warn(
|
|
29
|
+
"[zod] response did not match schema",
|
|
30
|
+
{
|
|
31
|
+
operation: "cfg_accounts_api_key_regenerate_create",
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/cfg/accounts/api-key/regenerate/",
|
|
34
|
+
issues: parsed.error.issues,
|
|
35
|
+
data,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
if (typeof window !== "undefined") {
|
|
39
|
+
try {
|
|
40
|
+
window.dispatchEvent(
|
|
41
|
+
new CustomEvent("zod-validation-error", {
|
|
42
|
+
detail: {
|
|
43
|
+
operation: "cfg_accounts_api_key_regenerate_create",
|
|
44
|
+
method: "POST",
|
|
45
|
+
path: "/cfg/accounts/api-key/regenerate/",
|
|
46
|
+
issues: parsed.error.issues,
|
|
47
|
+
data,
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
},
|
|
50
|
+
bubbles: true,
|
|
51
|
+
cancelable: false,
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
} catch {
|
|
55
|
+
// Event dispatch is best-effort.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
return parsed.data as Result;
|
|
61
|
+
},
|
|
62
|
+
config,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by openapi_processor / ts.hooks
|
|
4
|
+
// Get API key details
|
|
5
|
+
// DO NOT EDIT — re-run `make gen`.
|
|
6
|
+
|
|
7
|
+
import useSWR from "swr";
|
|
8
|
+
import type { SWRConfiguration } from "swr";
|
|
9
|
+
import { CfgAccountsApiKey } from "../../sdk.gen";
|
|
10
|
+
import type { CfgAccountsApiKeyRetrieveData, CfgAccountsApiKeyRetrieveResponses } from "../../types.gen";
|
|
11
|
+
import { APIKeySchema } from "../schemas/APIKey";
|
|
12
|
+
|
|
13
|
+
type Result = CfgAccountsApiKeyRetrieveResponses[keyof CfgAccountsApiKeyRetrieveResponses];
|
|
14
|
+
|
|
15
|
+
export function useCfgAccountsApiKeyRetrieve(
|
|
16
|
+
args?: Omit<CfgAccountsApiKeyRetrieveData, "url" | "body">,
|
|
17
|
+
config?: SWRConfiguration<Result>,
|
|
18
|
+
) {
|
|
19
|
+
const key = ["cfg_accounts_api_key_retrieve", args ?? {}] as const;
|
|
20
|
+
return useSWR<Result>(
|
|
21
|
+
key,
|
|
22
|
+
async () => {
|
|
23
|
+
const res = await CfgAccountsApiKey.cfgAccountsApiKeyRetrieve({ ...(args ?? {}), throwOnError: true } as never);
|
|
24
|
+
const data = res.data as Result;
|
|
25
|
+
const parsed = APIKeySchema.safeParse(data);
|
|
26
|
+
if (!parsed.success) {
|
|
27
|
+
// Log first so the failure is always visible, even if the
|
|
28
|
+
// event handler swallows it.
|
|
29
|
+
console.warn(
|
|
30
|
+
"[zod] response did not match schema",
|
|
31
|
+
{
|
|
32
|
+
operation: "cfg_accounts_api_key_retrieve",
|
|
33
|
+
method: "GET",
|
|
34
|
+
path: "/cfg/accounts/api-key/",
|
|
35
|
+
issues: parsed.error.issues,
|
|
36
|
+
data,
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
if (typeof window !== "undefined") {
|
|
40
|
+
try {
|
|
41
|
+
window.dispatchEvent(
|
|
42
|
+
new CustomEvent("zod-validation-error", {
|
|
43
|
+
detail: {
|
|
44
|
+
operation: "cfg_accounts_api_key_retrieve",
|
|
45
|
+
method: "GET",
|
|
46
|
+
path: "/cfg/accounts/api-key/",
|
|
47
|
+
issues: parsed.error.issues,
|
|
48
|
+
data,
|
|
49
|
+
timestamp: new Date(),
|
|
50
|
+
},
|
|
51
|
+
bubbles: true,
|
|
52
|
+
cancelable: false,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
} catch {
|
|
56
|
+
// Event dispatch is best-effort.
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
return parsed.data as Result;
|
|
62
|
+
},
|
|
63
|
+
config,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by openapi_processor / ts.hooks
|
|
4
|
+
// Test API key
|
|
5
|
+
// DO NOT EDIT — re-run `make gen`.
|
|
6
|
+
|
|
7
|
+
import useSWRMutation from "swr/mutation";
|
|
8
|
+
import type { SWRMutationConfiguration } from "swr/mutation";
|
|
9
|
+
import { CfgAccountsApiKey } from "../../sdk.gen";
|
|
10
|
+
import type { CfgAccountsApiKeyTestCreateData, CfgAccountsApiKeyTestCreateResponses } from "../../types.gen";
|
|
11
|
+
import { APIKeyTestResultSchema } from "../schemas/APIKeyTestResult";
|
|
12
|
+
|
|
13
|
+
type Args = Omit<CfgAccountsApiKeyTestCreateData, "url">;
|
|
14
|
+
type Result = CfgAccountsApiKeyTestCreateResponses[keyof CfgAccountsApiKeyTestCreateResponses];
|
|
15
|
+
|
|
16
|
+
export function useCfgAccountsApiKeyTestCreate(
|
|
17
|
+
config?: SWRMutationConfiguration<Result, Error, readonly ["cfg_accounts_api_key_test_create"], Args>,
|
|
18
|
+
) {
|
|
19
|
+
return useSWRMutation<Result, Error, readonly ["cfg_accounts_api_key_test_create"], Args>(
|
|
20
|
+
["cfg_accounts_api_key_test_create"] as const,
|
|
21
|
+
async (_key, { arg }: { arg: Args }) => {
|
|
22
|
+
const res = await CfgAccountsApiKey.cfgAccountsApiKeyTestCreate({ ...arg, throwOnError: true } as never);
|
|
23
|
+
const data = res.data as Result;
|
|
24
|
+
const parsed = APIKeyTestResultSchema.safeParse(data);
|
|
25
|
+
if (!parsed.success) {
|
|
26
|
+
// Log first so the failure is always visible, even if the
|
|
27
|
+
// event handler swallows it.
|
|
28
|
+
console.warn(
|
|
29
|
+
"[zod] response did not match schema",
|
|
30
|
+
{
|
|
31
|
+
operation: "cfg_accounts_api_key_test_create",
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/cfg/accounts/api-key/test/",
|
|
34
|
+
issues: parsed.error.issues,
|
|
35
|
+
data,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
if (typeof window !== "undefined") {
|
|
39
|
+
try {
|
|
40
|
+
window.dispatchEvent(
|
|
41
|
+
new CustomEvent("zod-validation-error", {
|
|
42
|
+
detail: {
|
|
43
|
+
operation: "cfg_accounts_api_key_test_create",
|
|
44
|
+
method: "POST",
|
|
45
|
+
path: "/cfg/accounts/api-key/test/",
|
|
46
|
+
issues: parsed.error.issues,
|
|
47
|
+
data,
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
},
|
|
50
|
+
bubbles: true,
|
|
51
|
+
cancelable: false,
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
} catch {
|
|
55
|
+
// Event dispatch is best-effort.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
return parsed.data as Result;
|
|
61
|
+
},
|
|
62
|
+
config,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
// AUTO-GENERATED by openapi_processor / ts.hooks
|
|
2
4
|
// List OAuth connections
|
|
3
5
|
// DO NOT EDIT — re-run `make gen`.
|
|
4
6
|
|
|
5
7
|
import useSWR from "swr";
|
|
6
8
|
import type { SWRConfiguration } from "swr";
|
|
7
|
-
import {
|
|
9
|
+
import { CfgAccountsOauth } from "../../sdk.gen";
|
|
8
10
|
import type { CfgAccountsOauthConnectionsListData, CfgAccountsOauthConnectionsListResponses } from "../../types.gen";
|
|
11
|
+
import { cfg_accounts_oauth_connections_response_200_AutoRefSchema } from "../schemas/cfg_accounts_oauth_connections_response_200_AutoRef";
|
|
9
12
|
|
|
10
13
|
type Result = CfgAccountsOauthConnectionsListResponses[keyof CfgAccountsOauthConnectionsListResponses];
|
|
11
14
|
|
|
@@ -17,8 +20,45 @@ export function useCfgAccountsOauthConnectionsList(
|
|
|
17
20
|
return useSWR<Result>(
|
|
18
21
|
key,
|
|
19
22
|
async () => {
|
|
20
|
-
const res = await
|
|
21
|
-
|
|
23
|
+
const res = await CfgAccountsOauth.cfgAccountsOauthConnectionsList({ ...(args ?? {}), throwOnError: true } as never);
|
|
24
|
+
const data = res.data as Result;
|
|
25
|
+
const parsed = cfg_accounts_oauth_connections_response_200_AutoRefSchema.safeParse(data);
|
|
26
|
+
if (!parsed.success) {
|
|
27
|
+
// Log first so the failure is always visible, even if the
|
|
28
|
+
// event handler swallows it.
|
|
29
|
+
console.warn(
|
|
30
|
+
"[zod] response did not match schema",
|
|
31
|
+
{
|
|
32
|
+
operation: "cfg_accounts_oauth_connections_list",
|
|
33
|
+
method: "GET",
|
|
34
|
+
path: "/cfg/accounts/oauth/connections/",
|
|
35
|
+
issues: parsed.error.issues,
|
|
36
|
+
data,
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
if (typeof window !== "undefined") {
|
|
40
|
+
try {
|
|
41
|
+
window.dispatchEvent(
|
|
42
|
+
new CustomEvent("zod-validation-error", {
|
|
43
|
+
detail: {
|
|
44
|
+
operation: "cfg_accounts_oauth_connections_list",
|
|
45
|
+
method: "GET",
|
|
46
|
+
path: "/cfg/accounts/oauth/connections/",
|
|
47
|
+
issues: parsed.error.issues,
|
|
48
|
+
data,
|
|
49
|
+
timestamp: new Date(),
|
|
50
|
+
},
|
|
51
|
+
bubbles: true,
|
|
52
|
+
cancelable: false,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
} catch {
|
|
56
|
+
// Event dispatch is best-effort.
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
return parsed.data as Result;
|
|
22
62
|
},
|
|
23
63
|
config,
|
|
24
64
|
);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
// AUTO-GENERATED by openapi_processor / ts.hooks
|
|
2
4
|
// Disconnect OAuth provider
|
|
3
5
|
// DO NOT EDIT — re-run `make gen`.
|
|
4
6
|
|
|
5
7
|
import useSWRMutation from "swr/mutation";
|
|
6
8
|
import type { SWRMutationConfiguration } from "swr/mutation";
|
|
7
|
-
import {
|
|
9
|
+
import { CfgAccountsOauth } from "../../sdk.gen";
|
|
8
10
|
import type { CfgAccountsOauthDisconnectCreateData, CfgAccountsOauthDisconnectCreateResponses } from "../../types.gen";
|
|
11
|
+
import { cfg_accounts_oauth_disconnect_response_200_AutoRefSchema } from "../schemas/cfg_accounts_oauth_disconnect_response_200_AutoRef";
|
|
9
12
|
|
|
10
13
|
type Args = Omit<CfgAccountsOauthDisconnectCreateData, "url">;
|
|
11
14
|
type Result = CfgAccountsOauthDisconnectCreateResponses[keyof CfgAccountsOauthDisconnectCreateResponses];
|
|
@@ -16,8 +19,45 @@ export function useCfgAccountsOauthDisconnectCreate(
|
|
|
16
19
|
return useSWRMutation<Result, Error, readonly ["cfg_accounts_oauth_disconnect_create"], Args>(
|
|
17
20
|
["cfg_accounts_oauth_disconnect_create"] as const,
|
|
18
21
|
async (_key, { arg }: { arg: Args }) => {
|
|
19
|
-
const res = await
|
|
20
|
-
|
|
22
|
+
const res = await CfgAccountsOauth.cfgAccountsOauthDisconnectCreate({ ...arg, throwOnError: true } as never);
|
|
23
|
+
const data = res.data as Result;
|
|
24
|
+
const parsed = cfg_accounts_oauth_disconnect_response_200_AutoRefSchema.safeParse(data);
|
|
25
|
+
if (!parsed.success) {
|
|
26
|
+
// Log first so the failure is always visible, even if the
|
|
27
|
+
// event handler swallows it.
|
|
28
|
+
console.warn(
|
|
29
|
+
"[zod] response did not match schema",
|
|
30
|
+
{
|
|
31
|
+
operation: "cfg_accounts_oauth_disconnect_create",
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/cfg/accounts/oauth/disconnect/",
|
|
34
|
+
issues: parsed.error.issues,
|
|
35
|
+
data,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
if (typeof window !== "undefined") {
|
|
39
|
+
try {
|
|
40
|
+
window.dispatchEvent(
|
|
41
|
+
new CustomEvent("zod-validation-error", {
|
|
42
|
+
detail: {
|
|
43
|
+
operation: "cfg_accounts_oauth_disconnect_create",
|
|
44
|
+
method: "POST",
|
|
45
|
+
path: "/cfg/accounts/oauth/disconnect/",
|
|
46
|
+
issues: parsed.error.issues,
|
|
47
|
+
data,
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
},
|
|
50
|
+
bubbles: true,
|
|
51
|
+
cancelable: false,
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
} catch {
|
|
55
|
+
// Event dispatch is best-effort.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
return parsed.data as Result;
|
|
21
61
|
},
|
|
22
62
|
config,
|
|
23
63
|
);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
// AUTO-GENERATED by openapi_processor / ts.hooks
|
|
2
4
|
// Start GitHub OAuth
|
|
3
5
|
// DO NOT EDIT — re-run `make gen`.
|
|
4
6
|
|
|
5
7
|
import useSWRMutation from "swr/mutation";
|
|
6
8
|
import type { SWRMutationConfiguration } from "swr/mutation";
|
|
7
|
-
import {
|
|
9
|
+
import { CfgAccountsOauth } from "../../sdk.gen";
|
|
8
10
|
import type { CfgAccountsOauthGithubAuthorizeCreateData, CfgAccountsOauthGithubAuthorizeCreateResponses } from "../../types.gen";
|
|
11
|
+
import { OAuthAuthorizeResponseSchema } from "../schemas/OAuthAuthorizeResponse";
|
|
9
12
|
|
|
10
13
|
type Args = Omit<CfgAccountsOauthGithubAuthorizeCreateData, "url">;
|
|
11
14
|
type Result = CfgAccountsOauthGithubAuthorizeCreateResponses[keyof CfgAccountsOauthGithubAuthorizeCreateResponses];
|
|
@@ -16,8 +19,45 @@ export function useCfgAccountsOauthGithubAuthorizeCreate(
|
|
|
16
19
|
return useSWRMutation<Result, Error, readonly ["cfg_accounts_oauth_github_authorize_create"], Args>(
|
|
17
20
|
["cfg_accounts_oauth_github_authorize_create"] as const,
|
|
18
21
|
async (_key, { arg }: { arg: Args }) => {
|
|
19
|
-
const res = await
|
|
20
|
-
|
|
22
|
+
const res = await CfgAccountsOauth.cfgAccountsOauthGithubAuthorizeCreate({ ...arg, throwOnError: true } as never);
|
|
23
|
+
const data = res.data as Result;
|
|
24
|
+
const parsed = OAuthAuthorizeResponseSchema.safeParse(data);
|
|
25
|
+
if (!parsed.success) {
|
|
26
|
+
// Log first so the failure is always visible, even if the
|
|
27
|
+
// event handler swallows it.
|
|
28
|
+
console.warn(
|
|
29
|
+
"[zod] response did not match schema",
|
|
30
|
+
{
|
|
31
|
+
operation: "cfg_accounts_oauth_github_authorize_create",
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/cfg/accounts/oauth/github/authorize/",
|
|
34
|
+
issues: parsed.error.issues,
|
|
35
|
+
data,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
if (typeof window !== "undefined") {
|
|
39
|
+
try {
|
|
40
|
+
window.dispatchEvent(
|
|
41
|
+
new CustomEvent("zod-validation-error", {
|
|
42
|
+
detail: {
|
|
43
|
+
operation: "cfg_accounts_oauth_github_authorize_create",
|
|
44
|
+
method: "POST",
|
|
45
|
+
path: "/cfg/accounts/oauth/github/authorize/",
|
|
46
|
+
issues: parsed.error.issues,
|
|
47
|
+
data,
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
},
|
|
50
|
+
bubbles: true,
|
|
51
|
+
cancelable: false,
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
} catch {
|
|
55
|
+
// Event dispatch is best-effort.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
return parsed.data as Result;
|
|
21
61
|
},
|
|
22
62
|
config,
|
|
23
63
|
);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
// AUTO-GENERATED by openapi_processor / ts.hooks
|
|
2
4
|
// Complete GitHub OAuth
|
|
3
5
|
// DO NOT EDIT — re-run `make gen`.
|
|
4
6
|
|
|
5
7
|
import useSWRMutation from "swr/mutation";
|
|
6
8
|
import type { SWRMutationConfiguration } from "swr/mutation";
|
|
7
|
-
import {
|
|
9
|
+
import { CfgAccountsOauth } from "../../sdk.gen";
|
|
8
10
|
import type { CfgAccountsOauthGithubCallbackCreateData, CfgAccountsOauthGithubCallbackCreateResponses } from "../../types.gen";
|
|
11
|
+
import { OAuthTokenResponseSchema } from "../schemas/OAuthTokenResponse";
|
|
9
12
|
|
|
10
13
|
type Args = Omit<CfgAccountsOauthGithubCallbackCreateData, "url">;
|
|
11
14
|
type Result = CfgAccountsOauthGithubCallbackCreateResponses[keyof CfgAccountsOauthGithubCallbackCreateResponses];
|
|
@@ -16,8 +19,45 @@ export function useCfgAccountsOauthGithubCallbackCreate(
|
|
|
16
19
|
return useSWRMutation<Result, Error, readonly ["cfg_accounts_oauth_github_callback_create"], Args>(
|
|
17
20
|
["cfg_accounts_oauth_github_callback_create"] as const,
|
|
18
21
|
async (_key, { arg }: { arg: Args }) => {
|
|
19
|
-
const res = await
|
|
20
|
-
|
|
22
|
+
const res = await CfgAccountsOauth.cfgAccountsOauthGithubCallbackCreate({ ...arg, throwOnError: true } as never);
|
|
23
|
+
const data = res.data as Result;
|
|
24
|
+
const parsed = OAuthTokenResponseSchema.safeParse(data);
|
|
25
|
+
if (!parsed.success) {
|
|
26
|
+
// Log first so the failure is always visible, even if the
|
|
27
|
+
// event handler swallows it.
|
|
28
|
+
console.warn(
|
|
29
|
+
"[zod] response did not match schema",
|
|
30
|
+
{
|
|
31
|
+
operation: "cfg_accounts_oauth_github_callback_create",
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/cfg/accounts/oauth/github/callback/",
|
|
34
|
+
issues: parsed.error.issues,
|
|
35
|
+
data,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
if (typeof window !== "undefined") {
|
|
39
|
+
try {
|
|
40
|
+
window.dispatchEvent(
|
|
41
|
+
new CustomEvent("zod-validation-error", {
|
|
42
|
+
detail: {
|
|
43
|
+
operation: "cfg_accounts_oauth_github_callback_create",
|
|
44
|
+
method: "POST",
|
|
45
|
+
path: "/cfg/accounts/oauth/github/callback/",
|
|
46
|
+
issues: parsed.error.issues,
|
|
47
|
+
data,
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
},
|
|
50
|
+
bubbles: true,
|
|
51
|
+
cancelable: false,
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
} catch {
|
|
55
|
+
// Event dispatch is best-effort.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
return parsed.data as Result;
|
|
21
61
|
},
|
|
22
62
|
config,
|
|
23
63
|
);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
// AUTO-GENERATED by openapi_processor / ts.hooks
|
|
2
4
|
// List OAuth providers
|
|
3
5
|
// DO NOT EDIT — re-run `make gen`.
|
|
4
6
|
|
|
5
7
|
import useSWR from "swr";
|
|
6
8
|
import type { SWRConfiguration } from "swr";
|
|
7
|
-
import {
|
|
9
|
+
import { CfgAccountsOauth } from "../../sdk.gen";
|
|
8
10
|
import type { CfgAccountsOauthProvidersRetrieveData, CfgAccountsOauthProvidersRetrieveResponses } from "../../types.gen";
|
|
11
|
+
import { OAuthProvidersResponseSchema } from "../schemas/OAuthProvidersResponse";
|
|
9
12
|
|
|
10
13
|
type Result = CfgAccountsOauthProvidersRetrieveResponses[keyof CfgAccountsOauthProvidersRetrieveResponses];
|
|
11
14
|
|
|
@@ -17,8 +20,45 @@ export function useCfgAccountsOauthProvidersRetrieve(
|
|
|
17
20
|
return useSWR<Result>(
|
|
18
21
|
key,
|
|
19
22
|
async () => {
|
|
20
|
-
const res = await
|
|
21
|
-
|
|
23
|
+
const res = await CfgAccountsOauth.cfgAccountsOauthProvidersRetrieve({ ...(args ?? {}), throwOnError: true } as never);
|
|
24
|
+
const data = res.data as Result;
|
|
25
|
+
const parsed = OAuthProvidersResponseSchema.safeParse(data);
|
|
26
|
+
if (!parsed.success) {
|
|
27
|
+
// Log first so the failure is always visible, even if the
|
|
28
|
+
// event handler swallows it.
|
|
29
|
+
console.warn(
|
|
30
|
+
"[zod] response did not match schema",
|
|
31
|
+
{
|
|
32
|
+
operation: "cfg_accounts_oauth_providers_retrieve",
|
|
33
|
+
method: "GET",
|
|
34
|
+
path: "/cfg/accounts/oauth/providers/",
|
|
35
|
+
issues: parsed.error.issues,
|
|
36
|
+
data,
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
if (typeof window !== "undefined") {
|
|
40
|
+
try {
|
|
41
|
+
window.dispatchEvent(
|
|
42
|
+
new CustomEvent("zod-validation-error", {
|
|
43
|
+
detail: {
|
|
44
|
+
operation: "cfg_accounts_oauth_providers_retrieve",
|
|
45
|
+
method: "GET",
|
|
46
|
+
path: "/cfg/accounts/oauth/providers/",
|
|
47
|
+
issues: parsed.error.issues,
|
|
48
|
+
data,
|
|
49
|
+
timestamp: new Date(),
|
|
50
|
+
},
|
|
51
|
+
bubbles: true,
|
|
52
|
+
cancelable: false,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
} catch {
|
|
56
|
+
// Event dispatch is best-effort.
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
return parsed.data as Result;
|
|
22
62
|
},
|
|
23
63
|
config,
|
|
24
64
|
);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
// AUTO-GENERATED by openapi_processor / ts.hooks
|
|
2
4
|
// POST /cfg/accounts/otp/request/
|
|
3
5
|
// DO NOT EDIT — re-run `make gen`.
|
|
4
6
|
|
|
5
7
|
import useSWRMutation from "swr/mutation";
|
|
6
8
|
import type { SWRMutationConfiguration } from "swr/mutation";
|
|
7
|
-
import {
|
|
9
|
+
import { CfgAccounts } from "../../sdk.gen";
|
|
8
10
|
import type { CfgAccountsOtpRequestCreateData, CfgAccountsOtpRequestCreateResponses } from "../../types.gen";
|
|
11
|
+
import { OTPRequestResponseSchema } from "../schemas/OTPRequestResponse";
|
|
9
12
|
|
|
10
13
|
type Args = Omit<CfgAccountsOtpRequestCreateData, "url">;
|
|
11
14
|
type Result = CfgAccountsOtpRequestCreateResponses[keyof CfgAccountsOtpRequestCreateResponses];
|
|
@@ -16,8 +19,45 @@ export function useCfgAccountsOtpRequestCreate(
|
|
|
16
19
|
return useSWRMutation<Result, Error, readonly ["cfg_accounts_otp_request_create"], Args>(
|
|
17
20
|
["cfg_accounts_otp_request_create"] as const,
|
|
18
21
|
async (_key, { arg }: { arg: Args }) => {
|
|
19
|
-
const res = await
|
|
20
|
-
|
|
22
|
+
const res = await CfgAccounts.cfgAccountsOtpRequestCreate({ ...arg, throwOnError: true } as never);
|
|
23
|
+
const data = res.data as Result;
|
|
24
|
+
const parsed = OTPRequestResponseSchema.safeParse(data);
|
|
25
|
+
if (!parsed.success) {
|
|
26
|
+
// Log first so the failure is always visible, even if the
|
|
27
|
+
// event handler swallows it.
|
|
28
|
+
console.warn(
|
|
29
|
+
"[zod] response did not match schema",
|
|
30
|
+
{
|
|
31
|
+
operation: "cfg_accounts_otp_request_create",
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/cfg/accounts/otp/request/",
|
|
34
|
+
issues: parsed.error.issues,
|
|
35
|
+
data,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
if (typeof window !== "undefined") {
|
|
39
|
+
try {
|
|
40
|
+
window.dispatchEvent(
|
|
41
|
+
new CustomEvent("zod-validation-error", {
|
|
42
|
+
detail: {
|
|
43
|
+
operation: "cfg_accounts_otp_request_create",
|
|
44
|
+
method: "POST",
|
|
45
|
+
path: "/cfg/accounts/otp/request/",
|
|
46
|
+
issues: parsed.error.issues,
|
|
47
|
+
data,
|
|
48
|
+
timestamp: new Date(),
|
|
49
|
+
},
|
|
50
|
+
bubbles: true,
|
|
51
|
+
cancelable: false,
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
} catch {
|
|
55
|
+
// Event dispatch is best-effort.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
return parsed.data as Result;
|
|
21
61
|
},
|
|
22
62
|
config,
|
|
23
63
|
);
|