@djangocfg/api 2.1.571 → 2.1.573

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/APIKey-EYCSY3JW.mjs +14 -0
  2. package/dist/APIKey-EYCSY3JW.mjs.map +1 -0
  3. package/dist/APIKey-I5QBXTLD.mjs +9 -0
  4. package/dist/APIKey-I5QBXTLD.mjs.map +1 -0
  5. package/dist/APIKeyRegenerate-3WIY3UIL.mjs +9 -0
  6. package/dist/APIKeyRegenerate-3WIY3UIL.mjs.map +1 -0
  7. package/dist/APIKeyRegenerate-AV5FCM32.mjs +13 -0
  8. package/dist/APIKeyRegenerate-AV5FCM32.mjs.map +1 -0
  9. package/dist/APIKeyReveal-JDXZMXKO.mjs +9 -0
  10. package/dist/APIKeyReveal-JDXZMXKO.mjs.map +1 -0
  11. package/dist/APIKeyReveal-ZY7ZD4WX.mjs +14 -0
  12. package/dist/APIKeyReveal-ZY7ZD4WX.mjs.map +1 -0
  13. package/dist/APIKeyTestResult-MQM2Q7XN.mjs +9 -0
  14. package/dist/APIKeyTestResult-MQM2Q7XN.mjs.map +1 -0
  15. package/dist/APIKeyTestResult-NPKQLHSQ.mjs +13 -0
  16. package/dist/APIKeyTestResult-NPKQLHSQ.mjs.map +1 -0
  17. package/dist/AccountDeleteResponse-NISN5UOR.mjs +9 -0
  18. package/dist/AccountDeleteResponse-NISN5UOR.mjs.map +1 -0
  19. package/dist/ConsentPolicy-67GXCYPA.mjs +9 -0
  20. package/dist/ConsentPolicy-67GXCYPA.mjs.map +1 -0
  21. package/dist/ConsentPolicy-A5WZFHO7.mjs +19 -0
  22. package/dist/ConsentPolicy-A5WZFHO7.mjs.map +1 -0
  23. package/dist/OAuthAuthorizeResponse-JQ5W7ZOZ.mjs +9 -0
  24. package/dist/OAuthAuthorizeResponse-JQ5W7ZOZ.mjs.map +1 -0
  25. package/dist/OAuthProvidersResponse-5DUH2AT7.mjs +9 -0
  26. package/dist/OAuthProvidersResponse-5DUH2AT7.mjs.map +1 -0
  27. package/dist/OAuthTokenResponse-4SJDK73L.mjs +9 -0
  28. package/dist/OAuthTokenResponse-4SJDK73L.mjs.map +1 -0
  29. package/dist/OTPRequestResponse-KKEOYXXS.mjs +9 -0
  30. package/dist/OTPRequestResponse-KKEOYXXS.mjs.map +1 -0
  31. package/dist/OTPVerifyResponse-XBXVMTO3.mjs +10 -0
  32. package/dist/OTPVerifyResponse-XBXVMTO3.mjs.map +1 -0
  33. package/dist/PasswordLoginResponse-3IRCBQIN.mjs +10 -0
  34. package/dist/PasswordLoginResponse-3IRCBQIN.mjs.map +1 -0
  35. package/dist/TokenRefresh-MKEUOQCX.mjs +9 -0
  36. package/dist/TokenRefresh-MKEUOQCX.mjs.map +1 -0
  37. package/dist/User-7OXQV7XG.mjs +9 -0
  38. package/dist/User-7OXQV7XG.mjs.map +1 -0
  39. package/dist/auth.cjs +485 -299
  40. package/dist/auth.cjs.map +1 -1
  41. package/dist/auth.mjs +132 -302
  42. package/dist/auth.mjs.map +1 -1
  43. package/dist/cfg_accounts_oauth_connections_response_200_AutoRef-J3IH5YMW.mjs +9 -0
  44. package/dist/cfg_accounts_oauth_connections_response_200_AutoRef-J3IH5YMW.mjs.map +1 -0
  45. package/dist/cfg_accounts_oauth_disconnect_response_200_AutoRef-6JT7B4EX.mjs +9 -0
  46. package/dist/cfg_accounts_oauth_disconnect_response_200_AutoRef-6JT7B4EX.mjs.map +1 -0
  47. package/dist/chunk-53YKWR6F.mjs +8 -0
  48. package/dist/chunk-53YKWR6F.mjs.map +1 -0
  49. package/dist/chunk-6MHVHTWT.mjs +30 -0
  50. package/dist/chunk-6MHVHTWT.mjs.map +1 -0
  51. package/dist/chunk-AQ2RQ4BQ.mjs +21 -0
  52. package/dist/chunk-AQ2RQ4BQ.mjs.map +1 -0
  53. package/dist/chunk-AXBITHBG.mjs +13 -0
  54. package/dist/chunk-AXBITHBG.mjs.map +1 -0
  55. package/dist/chunk-B22YGMM3.mjs +30 -0
  56. package/dist/chunk-B22YGMM3.mjs.map +1 -0
  57. package/dist/chunk-GCRGQTJ4.mjs +13 -0
  58. package/dist/chunk-GCRGQTJ4.mjs.map +1 -0
  59. package/dist/chunk-IPXJOS2Y.mjs +32 -0
  60. package/dist/chunk-IPXJOS2Y.mjs.map +1 -0
  61. package/dist/chunk-K5HZ55SP.mjs +21 -0
  62. package/dist/chunk-K5HZ55SP.mjs.map +1 -0
  63. package/dist/chunk-NTSWD2CP.mjs +20 -0
  64. package/dist/chunk-NTSWD2CP.mjs.map +1 -0
  65. package/dist/chunk-NZGOHTNF.mjs +14 -0
  66. package/dist/chunk-NZGOHTNF.mjs.map +1 -0
  67. package/dist/chunk-OGDF6IJV.mjs +13 -0
  68. package/dist/chunk-OGDF6IJV.mjs.map +1 -0
  69. package/dist/chunk-PDARU7RC.mjs +14 -0
  70. package/dist/chunk-PDARU7RC.mjs.map +1 -0
  71. package/dist/chunk-RQDZ2EMB.mjs +13 -0
  72. package/dist/chunk-RQDZ2EMB.mjs.map +1 -0
  73. package/dist/chunk-SUTMTPAG.mjs +12 -0
  74. package/dist/chunk-SUTMTPAG.mjs.map +1 -0
  75. package/dist/chunk-X5FEPK4J.mjs +13 -0
  76. package/dist/chunk-X5FEPK4J.mjs.map +1 -0
  77. package/dist/chunk-XSAHOB2U.mjs +19 -0
  78. package/dist/chunk-XSAHOB2U.mjs.map +1 -0
  79. package/dist/chunk-YMOOSBRI.mjs +12 -0
  80. package/dist/chunk-YMOOSBRI.mjs.map +1 -0
  81. package/dist/hooks.cjs +131 -76
  82. package/dist/hooks.cjs.map +1 -1
  83. package/dist/hooks.mjs +33 -78
  84. package/dist/hooks.mjs.map +1 -1
  85. package/package.json +2 -2
  86. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRegenerateCreate.ts +41 -37
  87. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts +41 -37
  88. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRevealCreate.ts +41 -37
  89. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyTestCreate.ts +41 -37
  90. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +41 -37
  91. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts +41 -37
  92. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +41 -37
  93. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +41 -37
  94. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +41 -37
  95. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpConsentPolicyRetrieve.ts +41 -37
  96. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +41 -37
  97. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +41 -37
  98. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts +41 -37
  99. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts +41 -37
  100. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +41 -37
  101. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts +41 -37
  102. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +41 -37
  103. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +41 -37
  104. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts +41 -37
  105. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenCreate.ts +41 -37
  106. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts +41 -37
  107. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +41 -37
  108. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +41 -37
  109. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +41 -37
  110. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDisableCreate.ts +41 -37
  111. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupConfirmCreate.ts +41 -37
  112. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupCreate.ts +41 -37
  113. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyBackupCreate.ts +41 -37
  114. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyCreate.ts +41 -37
@@ -8,7 +8,7 @@ import useSWRMutation from "swr/mutation";
8
8
  import type { SWRMutationConfiguration } from "swr/mutation";
9
9
  import { CfgTotp } from "../../sdk.gen";
10
10
  import type { CfgTotpDisableCreateData, CfgTotpDisableCreateResponses } from "../../types.gen";
11
- import { cfg_totp_disable_response_200_AutoRefSchema } from "../schemas/cfg_totp_disable_response_200_AutoRef";
11
+
12
12
 
13
13
  type Args = Omit<CfgTotpDisableCreateData, "url">;
14
14
  type Result = CfgTotpDisableCreateResponses[keyof CfgTotpDisableCreateResponses];
@@ -21,43 +21,47 @@ export function useCfgTotpDisableCreate(
21
21
  async (_key, { arg }: { arg: Args }) => {
22
22
  const res = await CfgTotp.cfgTotpDisableCreate({ ...arg, throwOnError: true } as never);
23
23
  const data = res.data as Result;
24
- const parsed = cfg_totp_disable_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_totp_disable_create",
32
- method: "POST",
33
- path: "/cfg/totp/disable/",
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_totp_disable_create",
44
- method: "POST",
45
- path: "/cfg/totp/disable/",
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.
24
+ void import("../schemas/cfg_totp_disable_response_200_AutoRef")
25
+ .then(({ cfg_totp_disable_response_200_AutoRefSchema }) => {
26
+ const parsed = cfg_totp_disable_response_200_AutoRefSchema.safeParse(data);
27
+ if (parsed.success) return;
28
+ // Log first so the failure is always visible, even if the
29
+ // event handler swallows it.
30
+ console.warn(
31
+ "[zod] response did not match schema",
32
+ {
33
+ operation: "cfg_totp_disable_create",
34
+ method: "POST",
35
+ path: "/cfg/totp/disable/",
36
+ issues: parsed.error.issues,
37
+ data,
38
+ },
39
+ );
40
+ if (typeof window !== "undefined") {
41
+ try {
42
+ window.dispatchEvent(
43
+ new CustomEvent("zod-validation-error", {
44
+ detail: {
45
+ operation: "cfg_totp_disable_create",
46
+ method: "POST",
47
+ path: "/cfg/totp/disable/",
48
+ issues: parsed.error.issues,
49
+ data,
50
+ timestamp: new Date(),
51
+ },
52
+ bubbles: true,
53
+ cancelable: false,
54
+ }),
55
+ );
56
+ } catch {
57
+ // Event dispatch is best-effort.
58
+ }
56
59
  }
57
- }
58
- return data;
59
- }
60
- return parsed.data as unknown as Result;
60
+ })
61
+ .catch(() => {
62
+ // A schema chunk that fails to load is not the caller's problem.
63
+ });
64
+ return data;
61
65
  },
62
66
  config,
63
67
  );
@@ -8,7 +8,7 @@ import useSWRMutation from "swr/mutation";
8
8
  import type { SWRMutationConfiguration } from "swr/mutation";
9
9
  import { CfgTotpSetup } from "../../sdk.gen";
10
10
  import type { CfgTotpSetupConfirmCreateData, CfgTotpSetupConfirmCreateResponses } from "../../types.gen";
11
- import { ConfirmSetupResponseSchema } from "../schemas/ConfirmSetupResponse";
11
+
12
12
 
13
13
  type Args = Omit<CfgTotpSetupConfirmCreateData, "url">;
14
14
  type Result = CfgTotpSetupConfirmCreateResponses[keyof CfgTotpSetupConfirmCreateResponses];
@@ -21,43 +21,47 @@ export function useCfgTotpSetupConfirmCreate(
21
21
  async (_key, { arg }: { arg: Args }) => {
22
22
  const res = await CfgTotpSetup.cfgTotpSetupConfirmCreate({ ...arg, throwOnError: true } as never);
23
23
  const data = res.data as Result;
24
- const parsed = ConfirmSetupResponseSchema.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_totp_setup_confirm_create",
32
- method: "POST",
33
- path: "/cfg/totp/setup/confirm/",
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_totp_setup_confirm_create",
44
- method: "POST",
45
- path: "/cfg/totp/setup/confirm/",
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.
24
+ void import("../schemas/ConfirmSetupResponse")
25
+ .then(({ ConfirmSetupResponseSchema }) => {
26
+ const parsed = ConfirmSetupResponseSchema.safeParse(data);
27
+ if (parsed.success) return;
28
+ // Log first so the failure is always visible, even if the
29
+ // event handler swallows it.
30
+ console.warn(
31
+ "[zod] response did not match schema",
32
+ {
33
+ operation: "cfg_totp_setup_confirm_create",
34
+ method: "POST",
35
+ path: "/cfg/totp/setup/confirm/",
36
+ issues: parsed.error.issues,
37
+ data,
38
+ },
39
+ );
40
+ if (typeof window !== "undefined") {
41
+ try {
42
+ window.dispatchEvent(
43
+ new CustomEvent("zod-validation-error", {
44
+ detail: {
45
+ operation: "cfg_totp_setup_confirm_create",
46
+ method: "POST",
47
+ path: "/cfg/totp/setup/confirm/",
48
+ issues: parsed.error.issues,
49
+ data,
50
+ timestamp: new Date(),
51
+ },
52
+ bubbles: true,
53
+ cancelable: false,
54
+ }),
55
+ );
56
+ } catch {
57
+ // Event dispatch is best-effort.
58
+ }
56
59
  }
57
- }
58
- return data;
59
- }
60
- return parsed.data as unknown as Result;
60
+ })
61
+ .catch(() => {
62
+ // A schema chunk that fails to load is not the caller's problem.
63
+ });
64
+ return data;
61
65
  },
62
66
  config,
63
67
  );
@@ -8,7 +8,7 @@ import useSWRMutation from "swr/mutation";
8
8
  import type { SWRMutationConfiguration } from "swr/mutation";
9
9
  import { CfgTotpSetup } from "../../sdk.gen";
10
10
  import type { CfgTotpSetupCreateData, CfgTotpSetupCreateResponses } from "../../types.gen";
11
- import { SetupResponseSchema } from "../schemas/SetupResponse";
11
+
12
12
 
13
13
  type Args = Omit<CfgTotpSetupCreateData, "url">;
14
14
  type Result = CfgTotpSetupCreateResponses[keyof CfgTotpSetupCreateResponses];
@@ -21,43 +21,47 @@ export function useCfgTotpSetupCreate(
21
21
  async (_key, { arg }: { arg: Args }) => {
22
22
  const res = await CfgTotpSetup.cfgTotpSetupCreate({ ...arg, throwOnError: true } as never);
23
23
  const data = res.data as Result;
24
- const parsed = SetupResponseSchema.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_totp_setup_create",
32
- method: "POST",
33
- path: "/cfg/totp/setup/",
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_totp_setup_create",
44
- method: "POST",
45
- path: "/cfg/totp/setup/",
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.
24
+ void import("../schemas/SetupResponse")
25
+ .then(({ SetupResponseSchema }) => {
26
+ const parsed = SetupResponseSchema.safeParse(data);
27
+ if (parsed.success) return;
28
+ // Log first so the failure is always visible, even if the
29
+ // event handler swallows it.
30
+ console.warn(
31
+ "[zod] response did not match schema",
32
+ {
33
+ operation: "cfg_totp_setup_create",
34
+ method: "POST",
35
+ path: "/cfg/totp/setup/",
36
+ issues: parsed.error.issues,
37
+ data,
38
+ },
39
+ );
40
+ if (typeof window !== "undefined") {
41
+ try {
42
+ window.dispatchEvent(
43
+ new CustomEvent("zod-validation-error", {
44
+ detail: {
45
+ operation: "cfg_totp_setup_create",
46
+ method: "POST",
47
+ path: "/cfg/totp/setup/",
48
+ issues: parsed.error.issues,
49
+ data,
50
+ timestamp: new Date(),
51
+ },
52
+ bubbles: true,
53
+ cancelable: false,
54
+ }),
55
+ );
56
+ } catch {
57
+ // Event dispatch is best-effort.
58
+ }
56
59
  }
57
- }
58
- return data;
59
- }
60
- return parsed.data as unknown as Result;
60
+ })
61
+ .catch(() => {
62
+ // A schema chunk that fails to load is not the caller's problem.
63
+ });
64
+ return data;
61
65
  },
62
66
  config,
63
67
  );
@@ -8,7 +8,7 @@ import useSWRMutation from "swr/mutation";
8
8
  import type { SWRMutationConfiguration } from "swr/mutation";
9
9
  import { CfgTotpVerify } from "../../sdk.gen";
10
10
  import type { CfgTotpVerifyBackupCreateData, CfgTotpVerifyBackupCreateResponses } from "../../types.gen";
11
- import { VerifyResponseSchema } from "../schemas/VerifyResponse";
11
+
12
12
 
13
13
  type Args = Omit<CfgTotpVerifyBackupCreateData, "url">;
14
14
  type Result = CfgTotpVerifyBackupCreateResponses[keyof CfgTotpVerifyBackupCreateResponses];
@@ -21,43 +21,47 @@ export function useCfgTotpVerifyBackupCreate(
21
21
  async (_key, { arg }: { arg: Args }) => {
22
22
  const res = await CfgTotpVerify.cfgTotpVerifyBackupCreate({ ...arg, throwOnError: true } as never);
23
23
  const data = res.data as Result;
24
- const parsed = VerifyResponseSchema.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_totp_verify_backup_create",
32
- method: "POST",
33
- path: "/cfg/totp/verify/backup/",
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_totp_verify_backup_create",
44
- method: "POST",
45
- path: "/cfg/totp/verify/backup/",
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.
24
+ void import("../schemas/VerifyResponse")
25
+ .then(({ VerifyResponseSchema }) => {
26
+ const parsed = VerifyResponseSchema.safeParse(data);
27
+ if (parsed.success) return;
28
+ // Log first so the failure is always visible, even if the
29
+ // event handler swallows it.
30
+ console.warn(
31
+ "[zod] response did not match schema",
32
+ {
33
+ operation: "cfg_totp_verify_backup_create",
34
+ method: "POST",
35
+ path: "/cfg/totp/verify/backup/",
36
+ issues: parsed.error.issues,
37
+ data,
38
+ },
39
+ );
40
+ if (typeof window !== "undefined") {
41
+ try {
42
+ window.dispatchEvent(
43
+ new CustomEvent("zod-validation-error", {
44
+ detail: {
45
+ operation: "cfg_totp_verify_backup_create",
46
+ method: "POST",
47
+ path: "/cfg/totp/verify/backup/",
48
+ issues: parsed.error.issues,
49
+ data,
50
+ timestamp: new Date(),
51
+ },
52
+ bubbles: true,
53
+ cancelable: false,
54
+ }),
55
+ );
56
+ } catch {
57
+ // Event dispatch is best-effort.
58
+ }
56
59
  }
57
- }
58
- return data;
59
- }
60
- return parsed.data as unknown as Result;
60
+ })
61
+ .catch(() => {
62
+ // A schema chunk that fails to load is not the caller's problem.
63
+ });
64
+ return data;
61
65
  },
62
66
  config,
63
67
  );
@@ -8,7 +8,7 @@ import useSWRMutation from "swr/mutation";
8
8
  import type { SWRMutationConfiguration } from "swr/mutation";
9
9
  import { CfgTotpVerify } from "../../sdk.gen";
10
10
  import type { CfgTotpVerifyCreateData, CfgTotpVerifyCreateResponses } from "../../types.gen";
11
- import { VerifyResponseSchema } from "../schemas/VerifyResponse";
11
+
12
12
 
13
13
  type Args = Omit<CfgTotpVerifyCreateData, "url">;
14
14
  type Result = CfgTotpVerifyCreateResponses[keyof CfgTotpVerifyCreateResponses];
@@ -21,43 +21,47 @@ export function useCfgTotpVerifyCreate(
21
21
  async (_key, { arg }: { arg: Args }) => {
22
22
  const res = await CfgTotpVerify.cfgTotpVerifyCreate({ ...arg, throwOnError: true } as never);
23
23
  const data = res.data as Result;
24
- const parsed = VerifyResponseSchema.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_totp_verify_create",
32
- method: "POST",
33
- path: "/cfg/totp/verify/",
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_totp_verify_create",
44
- method: "POST",
45
- path: "/cfg/totp/verify/",
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.
24
+ void import("../schemas/VerifyResponse")
25
+ .then(({ VerifyResponseSchema }) => {
26
+ const parsed = VerifyResponseSchema.safeParse(data);
27
+ if (parsed.success) return;
28
+ // Log first so the failure is always visible, even if the
29
+ // event handler swallows it.
30
+ console.warn(
31
+ "[zod] response did not match schema",
32
+ {
33
+ operation: "cfg_totp_verify_create",
34
+ method: "POST",
35
+ path: "/cfg/totp/verify/",
36
+ issues: parsed.error.issues,
37
+ data,
38
+ },
39
+ );
40
+ if (typeof window !== "undefined") {
41
+ try {
42
+ window.dispatchEvent(
43
+ new CustomEvent("zod-validation-error", {
44
+ detail: {
45
+ operation: "cfg_totp_verify_create",
46
+ method: "POST",
47
+ path: "/cfg/totp/verify/",
48
+ issues: parsed.error.issues,
49
+ data,
50
+ timestamp: new Date(),
51
+ },
52
+ bubbles: true,
53
+ cancelable: false,
54
+ }),
55
+ );
56
+ } catch {
57
+ // Event dispatch is best-effort.
58
+ }
56
59
  }
57
- }
58
- return data;
59
- }
60
- return parsed.data as unknown as Result;
60
+ })
61
+ .catch(() => {
62
+ // A schema chunk that fails to load is not the caller's problem.
63
+ });
64
+ return data;
61
65
  },
62
66
  config,
63
67
  );