@aura-stack/auth 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/@types/index.d.ts +6 -2
  2. package/dist/@types/router.d.d.ts +6 -2
  3. package/dist/actions/callback/access-token.cjs +103 -59
  4. package/dist/actions/callback/access-token.d.ts +7 -3
  5. package/dist/actions/callback/access-token.js +3 -3
  6. package/dist/actions/callback/callback.cjs +200 -134
  7. package/dist/actions/callback/callback.d.ts +32 -3
  8. package/dist/actions/callback/callback.js +11 -12
  9. package/dist/actions/callback/userinfo.cjs +103 -70
  10. package/dist/actions/callback/userinfo.d.ts +6 -2
  11. package/dist/actions/callback/userinfo.js +7 -8
  12. package/dist/actions/csrfToken/csrfToken.cjs +7 -15
  13. package/dist/actions/csrfToken/csrfToken.d.ts +3 -1
  14. package/dist/actions/csrfToken/csrfToken.js +7 -8
  15. package/dist/actions/index.cjs +502 -295
  16. package/dist/actions/index.d.ts +5 -2
  17. package/dist/actions/index.js +23 -20
  18. package/dist/actions/session/session.cjs +76 -24
  19. package/dist/actions/session/session.d.ts +3 -1
  20. package/dist/actions/session/session.js +6 -4
  21. package/dist/actions/signIn/authorization-url.cjs +288 -0
  22. package/dist/actions/signIn/authorization-url.d.ts +31 -0
  23. package/dist/actions/signIn/authorization-url.js +16 -0
  24. package/dist/actions/signIn/authorization.cjs +91 -132
  25. package/dist/actions/signIn/authorization.d.ts +17 -16
  26. package/dist/actions/signIn/authorization.js +8 -7
  27. package/dist/actions/signIn/signIn.cjs +319 -191
  28. package/dist/actions/signIn/signIn.d.ts +32 -3
  29. package/dist/actions/signIn/signIn.js +10 -9
  30. package/dist/actions/signOut/signOut.cjs +211 -212
  31. package/dist/actions/signOut/signOut.d.ts +9 -1
  32. package/dist/actions/signOut/signOut.js +9 -10
  33. package/dist/api/createApi.cjs +750 -0
  34. package/dist/api/createApi.d.ts +12 -0
  35. package/dist/api/createApi.js +19 -0
  36. package/dist/api/getSession.cjs +141 -0
  37. package/dist/api/getSession.d.ts +16 -0
  38. package/dist/api/getSession.js +10 -0
  39. package/dist/api/signIn.cjs +549 -0
  40. package/dist/api/signIn.d.ts +26 -0
  41. package/dist/api/signIn.js +15 -0
  42. package/dist/api/signOut.cjs +279 -0
  43. package/dist/api/signOut.d.ts +16 -0
  44. package/dist/api/signOut.js +13 -0
  45. package/dist/assert.cjs +42 -9
  46. package/dist/assert.d.ts +8 -4
  47. package/dist/assert.js +5 -5
  48. package/dist/{chunk-KJBAQZX2.js → chunk-2A5B7GWR.js} +44 -11
  49. package/dist/chunk-2GQLSIJ2.js +40 -0
  50. package/dist/chunk-2IR674WX.js +44 -0
  51. package/dist/chunk-3J5TUH2I.js +50 -0
  52. package/dist/chunk-4RWSYUKX.js +98 -0
  53. package/dist/chunk-5X7JZMEF.js +0 -0
  54. package/dist/{chunk-TZB6MUXN.js → chunk-7BE46WWS.js} +21 -11
  55. package/dist/chunk-7YYXFKLR.js +35 -0
  56. package/dist/chunk-C3A37LQC.js +33 -0
  57. package/dist/chunk-CITNGXDA.js +31 -0
  58. package/dist/chunk-CWX724AG.js +78 -0
  59. package/dist/chunk-D2CSIUKP.js +74 -0
  60. package/dist/{chunk-ICAZ4OVS.js → chunk-FPCVZUVG.js} +2 -2
  61. package/dist/{chunk-XGLBNXL4.js → chunk-GNNBM2WJ.js} +17 -9
  62. package/dist/chunk-JOCGX3RP.js +59 -0
  63. package/dist/chunk-KBXWTD6E.js +94 -0
  64. package/dist/{chunk-XUP6KKNG.js → chunk-LATR3NIV.js} +48 -37
  65. package/dist/chunk-LAYPUDQF.js +39 -0
  66. package/dist/chunk-LX3TJ2TJ.js +294 -0
  67. package/dist/{chunk-6MXFPFR3.js → chunk-NHZBQNRR.js} +19 -19
  68. package/dist/{chunk-TM5IPSNF.js → chunk-PDP3PHB3.js} +33 -19
  69. package/dist/chunk-PHYNROD4.js +47 -0
  70. package/dist/chunk-QQEKY4XP.js +29 -0
  71. package/dist/{chunk-VNCNJKS2.js → chunk-U4RK4LKJ.js} +82 -1
  72. package/dist/{chunk-RRLIF4PQ.js → chunk-U5663F2U.js} +16 -1
  73. package/dist/chunk-UN7X6SU5.js +53 -0
  74. package/dist/chunk-UZQJJD6A.js +100 -0
  75. package/dist/{chunk-NUDITUKX.js → chunk-V6LLEAR4.js} +22 -15
  76. package/dist/{chunk-4MYWAOLG.js → chunk-WHNDRO3N.js} +20 -1
  77. package/dist/{chunk-5W4BRQYG.js → chunk-XY5R3EHH.js} +6 -3
  78. package/dist/client/client.cjs +135 -0
  79. package/dist/client/client.d.ts +85 -0
  80. package/dist/client/client.js +9 -0
  81. package/dist/client/index.cjs +135 -0
  82. package/dist/client/index.d.ts +14 -0
  83. package/dist/client/index.js +10 -0
  84. package/dist/context.cjs +1237 -0
  85. package/dist/context.d.ts +16 -0
  86. package/dist/context.js +28 -0
  87. package/dist/cookie.cjs +33 -2
  88. package/dist/cookie.d.ts +9 -5
  89. package/dist/cookie.js +3 -2
  90. package/dist/createAuth.cjs +2320 -0
  91. package/dist/createAuth.d.ts +12 -0
  92. package/dist/createAuth.js +48 -0
  93. package/dist/env.cjs +24 -2
  94. package/dist/env.d.ts +4 -1
  95. package/dist/env.js +9 -3
  96. package/dist/errors.cjs +17 -0
  97. package/dist/errors.d.ts +13 -3
  98. package/dist/errors.js +5 -1
  99. package/dist/{index-CSyIJmCM.d.ts → index-_aXtxb_s.d.ts} +383 -13
  100. package/dist/index.cjs +2135 -1547
  101. package/dist/index.d.ts +9 -30
  102. package/dist/index.js +46 -119
  103. package/dist/jose.cjs +52 -14
  104. package/dist/jose.d.ts +12 -25
  105. package/dist/jose.js +11 -3
  106. package/dist/logger.cjs +132 -0
  107. package/dist/logger.d.ts +6 -2
  108. package/dist/logger.js +10 -1
  109. package/dist/oauth/atlassian.cjs +57 -0
  110. package/dist/oauth/atlassian.d.ts +12 -0
  111. package/dist/oauth/atlassian.js +6 -0
  112. package/dist/oauth/bitbucket.d.ts +6 -2
  113. package/dist/oauth/discord.d.ts +6 -2
  114. package/dist/oauth/dropbox.cjs +53 -0
  115. package/dist/oauth/dropbox.d.ts +12 -0
  116. package/dist/oauth/dropbox.js +6 -0
  117. package/dist/oauth/figma.d.ts +6 -2
  118. package/dist/oauth/github.d.ts +6 -2
  119. package/dist/oauth/gitlab.d.ts +6 -2
  120. package/dist/oauth/index.cjs +278 -88
  121. package/dist/oauth/index.d.ts +6 -2
  122. package/dist/oauth/index.js +27 -11
  123. package/dist/oauth/mailchimp.d.ts +6 -2
  124. package/dist/oauth/notion.cjs +131 -0
  125. package/dist/oauth/notion.d.ts +12 -0
  126. package/dist/oauth/notion.js +9 -0
  127. package/dist/oauth/pinterest.d.ts +6 -2
  128. package/dist/oauth/spotify.d.ts +6 -2
  129. package/dist/oauth/strava.d.ts +6 -2
  130. package/dist/oauth/twitch.cjs +95 -0
  131. package/dist/oauth/twitch.d.ts +12 -0
  132. package/dist/oauth/twitch.js +7 -0
  133. package/dist/oauth/x.d.ts +6 -2
  134. package/dist/schemas.cjs +84 -51
  135. package/dist/schemas.d.ts +103 -23
  136. package/dist/schemas.js +1 -1
  137. package/dist/secure.cjs +36 -36
  138. package/dist/secure.d.ts +10 -4
  139. package/dist/secure.js +7 -6
  140. package/dist/utils.cjs +109 -3
  141. package/dist/utils.d.ts +15 -4
  142. package/dist/utils.js +11 -4
  143. package/package.json +9 -5
  144. package/dist/chunk-4EKY7655.js +0 -123
  145. package/dist/chunk-7QF22LHP.js +0 -67
  146. package/dist/chunk-ALG3GIV4.js +0 -95
  147. package/dist/chunk-FRJFWTOY.js +0 -70
  148. package/dist/chunk-PHFH2MGS.js +0 -36
  149. package/dist/chunk-QQVSRXGX.js +0 -149
@@ -0,0 +1,12 @@
1
+ import 'jose';
2
+ export { w as createAuth, ay as createAuthInstance } from './index-_aXtxb_s.js';
3
+ import '@aura-stack/jose';
4
+ import '@aura-stack/router';
5
+ import 'zod/v4/core';
6
+ import 'zod';
7
+ import './@types/utility.js';
8
+ import './schemas.js';
9
+ import 'zod/v4';
10
+ import '@aura-stack/jose/jose';
11
+ import '@aura-stack/jose/crypto';
12
+ import '@aura-stack/router/cookie';
@@ -0,0 +1,48 @@
1
+ import {
2
+ createAuth,
3
+ createAuthInstance
4
+ } from "./chunk-CWX724AG.js";
5
+ import "./chunk-ITQ7352M.js";
6
+ import "./chunk-NHZBQNRR.js";
7
+ import "./chunk-GNNBM2WJ.js";
8
+ import "./chunk-FPCVZUVG.js";
9
+ import "./chunk-UN7X6SU5.js";
10
+ import "./chunk-7YYXFKLR.js";
11
+ import "./chunk-3J5TUH2I.js";
12
+ import "./chunk-7BE46WWS.js";
13
+ import "./chunk-LAYPUDQF.js";
14
+ import "./chunk-CITNGXDA.js";
15
+ import "./chunk-JOCGX3RP.js";
16
+ import "./chunk-D2CSIUKP.js";
17
+ import "./chunk-LATR3NIV.js";
18
+ import "./chunk-KBXWTD6E.js";
19
+ import "./chunk-ZNCZVF6U.js";
20
+ import "./chunk-V6LLEAR4.js";
21
+ import "./chunk-2IR674WX.js";
22
+ import "./chunk-PDP3PHB3.js";
23
+ import "./chunk-LDU7A2JE.js";
24
+ import "./chunk-PHYNROD4.js";
25
+ import "./chunk-E6G5YCI6.js";
26
+ import "./chunk-IPKO6UQN.js";
27
+ import "./chunk-54CZPKR4.js";
28
+ import "./chunk-2GQLSIJ2.js";
29
+ import "./chunk-EEE7UM5T.js";
30
+ import "./chunk-C3A37LQC.js";
31
+ import "./chunk-4YHJ4IEQ.js";
32
+ import "./chunk-OVHNRULD.js";
33
+ import "./chunk-QQEKY4XP.js";
34
+ import "./chunk-KMMAZFSJ.js";
35
+ import "./chunk-FW4W3REU.js";
36
+ import "./chunk-5LZ7TOM3.js";
37
+ import "./chunk-U4RK4LKJ.js";
38
+ import "./chunk-2A5B7GWR.js";
39
+ import "./chunk-UZQJJD6A.js";
40
+ import "./chunk-LX3TJ2TJ.js";
41
+ import "./chunk-XY5R3EHH.js";
42
+ import "./chunk-WHNDRO3N.js";
43
+ import "./chunk-U5663F2U.js";
44
+ import "./chunk-EBAMFRB7.js";
45
+ export {
46
+ createAuth,
47
+ createAuthInstance
48
+ };
package/dist/env.cjs CHANGED
@@ -20,7 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/env.ts
21
21
  var env_exports = {};
22
22
  __export(env_exports, {
23
- env: () => env
23
+ env: () => env,
24
+ getEnv: () => getEnv,
25
+ getEnvArray: () => getEnvArray,
26
+ getEnvBoolean: () => getEnvBoolean
24
27
  });
25
28
  module.exports = __toCommonJS(env_exports);
26
29
  var import_meta = {};
@@ -50,7 +53,26 @@ var env = new Proxy({}, {
50
53
  }
51
54
  }
52
55
  });
56
+ var getEnv = (key) => {
57
+ const keys = [`AURA_AUTH_${key.toUpperCase()}`, `AURA_${key.toUpperCase()}`, `AUTH_${key.toUpperCase()}`, key.toUpperCase()];
58
+ return env[keys.find((k) => env[k]) ?? ""];
59
+ };
60
+ var getEnvBoolean = (key) => {
61
+ const value = getEnv(key);
62
+ if (value === void 0) return false;
63
+ const normalized = value.trim().toLowerCase();
64
+ if (["1", "true", "yes", "on", "debug"].includes(normalized)) return true;
65
+ return false;
66
+ };
67
+ var getEnvArray = (key, defaultValue = []) => {
68
+ const value = getEnv(key);
69
+ if (!value) return defaultValue;
70
+ return value.split(/[,;\n]+/).map((v) => v.trim()).filter(Boolean);
71
+ };
53
72
  // Annotate the CommonJS export names for ESM import in node:
54
73
  0 && (module.exports = {
55
- env
74
+ env,
75
+ getEnv,
76
+ getEnvArray,
77
+ getEnvBoolean
56
78
  });
package/dist/env.d.ts CHANGED
@@ -3,5 +3,8 @@
3
3
  * Checks multiple sources to ensure compatibility with Node, Bun, Deno, Vite, and Edge platforms.
4
4
  */
5
5
  declare const env: Record<string, string | undefined>;
6
+ declare const getEnv: (key: string) => string | undefined;
7
+ declare const getEnvBoolean: (key: string) => boolean;
8
+ declare const getEnvArray: (key: string, defaultValue?: string[]) => string[];
6
9
 
7
- export { env };
10
+ export { env, getEnv, getEnvArray, getEnvBoolean };
package/dist/env.js CHANGED
@@ -1,6 +1,12 @@
1
1
  import {
2
- env
3
- } from "./chunk-4MYWAOLG.js";
2
+ env,
3
+ getEnv,
4
+ getEnvArray,
5
+ getEnvBoolean
6
+ } from "./chunk-WHNDRO3N.js";
4
7
  export {
5
- env
8
+ env,
9
+ getEnv,
10
+ getEnvArray,
11
+ getEnvBoolean
6
12
  };
package/dist/errors.cjs CHANGED
@@ -20,9 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/errors.ts
21
21
  var errors_exports = {};
22
22
  __export(errors_exports, {
23
+ AuthClientError: () => AuthClientError,
23
24
  AuthInternalError: () => AuthInternalError,
24
25
  AuthSecurityError: () => AuthSecurityError,
25
26
  OAuthProtocolError: () => OAuthProtocolError,
27
+ isAuthClientError: () => isAuthClientError,
26
28
  isAuthInternalError: () => isAuthInternalError,
27
29
  isAuthSecurityError: () => isAuthSecurityError,
28
30
  isNativeError: () => isNativeError,
@@ -61,6 +63,16 @@ var AuthSecurityError = class extends Error {
61
63
  Error.captureStackTrace(this, new.target);
62
64
  }
63
65
  };
66
+ var AuthClientError = class extends Error {
67
+ type = "AUTH_CLIENT_ERROR";
68
+ code;
69
+ constructor(code, message, options) {
70
+ super(message, options);
71
+ this.code = code;
72
+ this.name = new.target.name;
73
+ Error.captureStackTrace(this, new.target);
74
+ }
75
+ };
64
76
  var isNativeError = (error) => {
65
77
  return error instanceof Error;
66
78
  };
@@ -73,11 +85,16 @@ var isAuthInternalError = (error) => {
73
85
  var isAuthSecurityError = (error) => {
74
86
  return error instanceof AuthSecurityError;
75
87
  };
88
+ var isAuthClientError = (error) => {
89
+ return error instanceof AuthClientError;
90
+ };
76
91
  // Annotate the CommonJS export names for ESM import in node:
77
92
  0 && (module.exports = {
93
+ AuthClientError,
78
94
  AuthInternalError,
79
95
  AuthSecurityError,
80
96
  OAuthProtocolError,
97
+ isAuthClientError,
81
98
  isAuthInternalError,
82
99
  isAuthSecurityError,
83
100
  isNativeError,
package/dist/errors.d.ts CHANGED
@@ -1,11 +1,15 @@
1
- import { E as ErrorType, b as AuthInternalErrorCode, c as AuthSecurityErrorCode } from './index-CSyIJmCM.js';
1
+ import { d as AuthInternalErrorCode, e as AuthSecurityErrorCode, E as ErrorType } from './index-_aXtxb_s.js';
2
2
  import { LiteralUnion } from './@types/utility.js';
3
3
  import 'zod';
4
4
  import './schemas.js';
5
- import './jose.js';
5
+ import 'zod/v4';
6
6
  import '@aura-stack/jose';
7
7
  import '@aura-stack/jose/jose';
8
+ import '@aura-stack/jose/crypto';
8
9
  import '@aura-stack/router/cookie';
10
+ import 'jose';
11
+ import '@aura-stack/router';
12
+ import 'zod/v4/core';
9
13
 
10
14
  /**
11
15
  * The object returned by the class to users its:
@@ -42,9 +46,15 @@ declare class AuthSecurityError extends Error {
42
46
  readonly code: string;
43
47
  constructor(code: LiteralUnion<AuthSecurityErrorCode>, message?: string, options?: ErrorOptions);
44
48
  }
49
+ declare class AuthClientError extends Error {
50
+ readonly type = "AUTH_CLIENT_ERROR";
51
+ readonly code: string;
52
+ constructor(code: string, message?: string, options?: ErrorOptions);
53
+ }
45
54
  declare const isNativeError: (error: unknown) => error is Error;
46
55
  declare const isOAuthProtocolError: (error: unknown) => error is OAuthProtocolError;
47
56
  declare const isAuthInternalError: (error: unknown) => error is AuthInternalError;
48
57
  declare const isAuthSecurityError: (error: unknown) => error is AuthSecurityError;
58
+ declare const isAuthClientError: (error: unknown) => error is AuthClientError;
49
59
 
50
- export { AuthInternalError, AuthSecurityError, OAuthProtocolError, isAuthInternalError, isAuthSecurityError, isNativeError, isOAuthProtocolError };
60
+ export { AuthClientError, AuthInternalError, AuthSecurityError, OAuthProtocolError, isAuthClientError, isAuthInternalError, isAuthSecurityError, isNativeError, isOAuthProtocolError };
package/dist/errors.js CHANGED
@@ -1,16 +1,20 @@
1
1
  import {
2
+ AuthClientError,
2
3
  AuthInternalError,
3
4
  AuthSecurityError,
4
5
  OAuthProtocolError,
6
+ isAuthClientError,
5
7
  isAuthInternalError,
6
8
  isAuthSecurityError,
7
9
  isNativeError,
8
10
  isOAuthProtocolError
9
- } from "./chunk-RRLIF4PQ.js";
11
+ } from "./chunk-U5663F2U.js";
10
12
  export {
13
+ AuthClientError,
11
14
  AuthInternalError,
12
15
  AuthSecurityError,
13
16
  OAuthProtocolError,
17
+ isAuthClientError,
14
18
  isAuthInternalError,
15
19
  isAuthSecurityError,
16
20
  isNativeError,