@cedarjs/auth-supabase-web 9.0.0-canary.1784 → 9.0.0-canary.3124

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.
@@ -75,25 +75,27 @@ export declare function createAuth(supabaseClient: SupabaseClient, customProvide
75
75
  };
76
76
  } & {
77
77
  authMethod: "sso";
78
- }), AuthResponse | OAuthResponse | SSOResponse, unknown, void, {
78
+ }), AuthResponse | OAuthResponse | SSOResponse, unknown, void, ({
79
79
  email: string;
80
80
  password: string;
81
+ } & {
81
82
  options?: {
82
83
  emailRedirectTo?: string;
83
84
  data?: object;
84
85
  captchaToken?: string;
85
86
  channel?: "sms" | "whatsapp";
86
- } | undefined;
87
- } | {
87
+ };
88
+ }) | ({
88
89
  phone: string;
89
90
  password: string;
91
+ } & {
90
92
  options?: {
91
93
  emailRedirectTo?: string;
92
94
  data?: object;
93
95
  captchaToken?: string;
94
96
  channel?: "sms" | "whatsapp";
95
- } | undefined;
96
- }, AuthResponse, unknown, unknown, unknown, unknown, SupabaseClient<any, "public", "public", any, any>> | undefined>;
97
+ };
98
+ }), AuthResponse, unknown, unknown, unknown, unknown, SupabaseClient<any, "public", "public", any, any>> | undefined>;
97
99
  AuthProvider: ({ children }: import("@cedarjs/auth").AuthProviderProps) => import("react").JSX.Element;
98
100
  useAuth: () => import("@cedarjs/auth").AuthContextInterface<import("@supabase/supabase-js").UserMetadata, SignInWithOAuthOptions | SignInWithIdTokenOptions | ({
99
101
  email: string;
@@ -151,24 +153,26 @@ export declare function createAuth(supabaseClient: SupabaseClient, customProvide
151
153
  };
152
154
  } & {
153
155
  authMethod: "sso";
154
- }), AuthResponse | OAuthResponse | SSOResponse, unknown, void, {
156
+ }), AuthResponse | OAuthResponse | SSOResponse, unknown, void, ({
155
157
  email: string;
156
158
  password: string;
159
+ } & {
157
160
  options?: {
158
161
  emailRedirectTo?: string;
159
162
  data?: object;
160
163
  captchaToken?: string;
161
164
  channel?: "sms" | "whatsapp";
162
- } | undefined;
163
- } | {
165
+ };
166
+ }) | ({
164
167
  phone: string;
165
168
  password: string;
169
+ } & {
166
170
  options?: {
167
171
  emailRedirectTo?: string;
168
172
  data?: object;
169
173
  captchaToken?: string;
170
174
  channel?: "sms" | "whatsapp";
171
- } | undefined;
172
- }, AuthResponse, unknown, unknown, unknown, unknown, SupabaseClient<any, "public", "public", any, any>>;
175
+ };
176
+ }), AuthResponse, unknown, unknown, unknown, unknown, SupabaseClient<any, "public", "public", any, any>>;
173
177
  };
174
178
  //# sourceMappingURL=supabase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../src/supabase.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACX,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,iCAAiC,EACjC,aAAa,EAId,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,eAAe,CAAA;AAMrE,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG;IAChE,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,4BAA4B,GAAG;IACpE,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,6BAA6B,GAAG;IACtE,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,6BAA6B,GACvC,iCAAiC,GAAG;IAClC,UAAU,EAAE,KAAK,CAAA;CAClB,CAAA;AAEH,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,UAAU,EAAE,KAAK,CAAA;CAClB,CAAA;AAmBD,wBAAgB,UAAU,CACxB,cAAc,EAAE,cAAc,EAC9B,mBAAmB,CAAC,EAAE;IACpB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3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H,CAAC;+BAAwP,CAAC;;;oBAtRlynB,KAAK;;;;sBAsR8/nB,CAAC;wBAA0H,CAAC;+BAAwP,CAAC;;;oBAtRx3oB,KAAK;;;;;;2BAsR4vV,CAAC;gBAAsB,CAAC;wBAA8B,CAAC;mBAAyB,CAAC;;;;;;;2BAAjF,CAAC;gBAAsB,CAAC;wBAA8B,CAAC;mBAAyB,CAAC;;;;;;;;;wBAAwQ,CAAC;;;oBA/R3lW,UAAU;;;;;;wBA+RglW,CAAC;;;oBA/R3lW,UAAU;;;;2BA+RizW,CAAC;4BAA4H,CAAC;gBAAoS,CAAC;wBAA0H,CAAC;;;oBA1Rv1X,KAAK;;;;4BA0RkiY,CAAC;gBAAoS,CAAC;wBAA0H,CAAC;mBAAwF,CAAC;;;oBA1RjiZ,KAAK;;;;sBA0Rs6mB,CAAC;wBAA0H,CAAC;+BAAwP,CAAC;;;oBAtRlynB,KAAK;;;;sBAsR8/nB,CAAC;wBAA0H,CAAC;+BAAwP,CAAC;;;oBAtRx3oB,KAAK;;;;;;2BAsR4vV,CAAC;gBAAsB,CAAC;wBAA8B,CAAC;mBAAyB,CAAC;;;;;;;2BAAjF,CAAC;gBAAsB,CAAC;wBAA8B,CAAC;mBAAyB,CAAC;;;EAlP/1V"}
package/dist/supabase.js CHANGED
@@ -50,18 +50,65 @@ function createAuthImplementation({
50
50
  login: async (credentials) => {
51
51
  let result;
52
52
  switch (credentials.authMethod) {
53
+ /**
54
+ * Log in an existing user with an email and password or phone and password.
55
+ *
56
+ * Be aware that you may get back an error message that will not distinguish
57
+ * between the cases where the account does not exist or that the
58
+ * email/phone and password combination is wrong or that the account can only
59
+ * be accessed via social login.
60
+ */
53
61
  case "password":
54
62
  result = await supabaseClient.auth.signInWithPassword(credentials);
55
63
  break;
64
+ /**
65
+ * Log in an existing user via a third-party provider.
66
+ */
56
67
  case "oauth":
57
68
  result = await supabaseClient.auth.signInWithOAuth(credentials);
58
69
  break;
70
+ /**
71
+ * Log in a user using magiclink or a one-time password (OTP).
72
+ *
73
+ * If the `{{ .ConfirmationURL }}` variable is specified in the email template, a magiclink will be sent.
74
+ * If the `{{ .Token }}` variable is specified in the email template, an OTP will be sent.
75
+ * If you're using phone sign-ins, only an OTP will be sent. You won't be able to send a magiclink for phone sign-ins.
76
+ *
77
+ * Be aware that you may get back an error message that will not distinguish
78
+ * between the cases where the account does not exist or, that the account
79
+ * can only be accessed via social login.
80
+ */
59
81
  case "otp":
60
82
  result = await supabaseClient.auth.signInWithOtp(credentials);
61
83
  break;
84
+ /**
85
+ * Attempts a single-sign on using an enterprise Identity Provider. A
86
+ * successful SSO attempt will redirect the current page to the identity
87
+ * provider authorization page. The redirect URL is implementation and SSO
88
+ * protocol specific.
89
+ *
90
+ * You can use it by providing a SSO domain. Typically you can extract this
91
+ * domain by asking users for their email address. If this domain is
92
+ * registered on the Auth instance the redirect will use that organization's
93
+ * currently active SSO Identity Provider for the login.
94
+ *
95
+ * If you have built an organization-specific login page, you can use the
96
+ * organization's SSO Identity Provider UUID directly instead.
97
+ *
98
+ * This API is experimental and availability is conditional on correct
99
+ * settings on the Auth service.
100
+ *
101
+ * @experimental
102
+ */
62
103
  case "sso":
63
104
  result = await supabaseClient.auth.signInWithSSO(credentials);
64
105
  break;
106
+ /**
107
+ * Allows signing in with an ID token issued by certain supported providers.
108
+ * The ID token is verified for validity and a new session is established.
109
+ *
110
+ * @experimental
111
+ */
65
112
  case "id_token":
66
113
  result = await supabaseClient.auth.signInWithIdToken(credentials);
67
114
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/auth-supabase-web",
3
- "version": "9.0.0-canary.1784+baa47810a",
3
+ "version": "9.0.0-canary.3124",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -10,64 +10,56 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
- "import": {
13
+ "default": {
14
14
  "types": "./dist/index.d.ts",
15
15
  "default": "./dist/index.js"
16
- },
17
- "default": {
18
- "types": "./dist/cjs/index.d.ts",
19
- "default": "./dist/cjs/index.js"
20
16
  }
21
17
  },
22
18
  "./dist/supabase": {
23
- "import": {
19
+ "default": {
24
20
  "types": "./dist/supabase.d.ts",
25
21
  "default": "./dist/supabase.js"
26
- },
27
- "default": {
28
- "types": "./dist/cjs/supabase.d.ts",
29
- "default": "./dist/cjs/supabase.js"
30
22
  }
31
23
  }
32
24
  },
33
- "main": "./dist/cjs/index.js",
34
- "module": "./dist/index.js",
25
+ "main": "./dist/index.js",
35
26
  "types": "./dist/index.d.ts",
36
27
  "files": [
37
28
  "dist"
38
29
  ],
39
30
  "scripts": {
40
- "build": "tsx ./build.ts",
31
+ "build": "node ./build.ts",
41
32
  "build:pack": "yarn pack -o cedarjs-auth-supabase-web.tgz",
42
33
  "build:types": "tsc --build --verbose ./tsconfig.build.json",
43
- "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json",
44
34
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
45
- "check:attw": "yarn rw-fwtools-attw",
35
+ "check:attw": "yarn cedar-fwtools-attw",
46
36
  "check:package": "concurrently npm:check:attw yarn:publint",
47
37
  "prepublishOnly": "NODE_ENV=production yarn build",
48
38
  "test": "vitest run",
49
39
  "test:watch": "vitest watch"
50
40
  },
51
41
  "dependencies": {
52
- "@cedarjs/auth": "9.0.0-canary.1784"
42
+ "@cedarjs/auth": "9.0.0-canary.3124"
53
43
  },
54
44
  "devDependencies": {
55
- "@cedarjs/framework-tools": "9.0.0-canary.1784",
56
- "@supabase/ssr": "0.8.0",
57
- "@supabase/supabase-js": "2.95.3",
58
- "@types/react": "^18.2.55",
59
- "concurrently": "9.2.1",
60
- "publint": "0.3.17",
61
- "react": "19.2.3",
62
- "tsx": "4.21.0",
45
+ "@cedarjs/framework-tools": "9.0.0-canary.3124",
46
+ "@supabase/ssr": "0.12.5",
47
+ "@supabase/supabase-js": "2.115.0",
48
+ "@types/react": "^19.2.0",
49
+ "concurrently": "9.2.4",
50
+ "publint": "0.3.24",
51
+ "react": "19.2.8",
63
52
  "typescript": "5.9.3",
64
- "vitest": "3.2.4"
53
+ "vitest": "4.1.11"
65
54
  },
66
55
  "peerDependencies": {
67
- "@supabase/supabase-js": "2.95.3"
56
+ "@supabase/supabase-js": "2.115.0"
57
+ },
58
+ "engines": {
59
+ "node": ">=24"
68
60
  },
69
61
  "publishConfig": {
70
62
  "access": "public"
71
63
  },
72
- "gitHead": "baa47810a7defb73de27fdf513b815d679509b5e"
64
+ "gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
73
65
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Cedar
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,2 +0,0 @@
1
- export { createAuth } from './supabase.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA"}
package/dist/cjs/index.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var src_exports = {};
20
- __export(src_exports, {
21
- createAuth: () => import_supabase.createAuth
22
- });
23
- module.exports = __toCommonJS(src_exports);
24
- var import_supabase = require("./supabase.js");
25
- // Annotate the CommonJS export names for ESM import in node:
26
- 0 && (module.exports = {
27
- createAuth
28
- });
@@ -1 +0,0 @@
1
- {"type":"commonjs"}
@@ -1,174 +0,0 @@
1
- import type { SupabaseClient, AuthResponse, OAuthResponse, SSOResponse, SignInWithOAuthCredentials, SignInWithIdTokenCredentials, SignInWithPasswordCredentials, SignInWithPasswordlessCredentials, SignInWithSSO } from '@supabase/supabase-js';
2
- import type { CurrentUser } from '@cedarjs/auth';
3
- export type SignInWithOAuthOptions = SignInWithOAuthCredentials & {
4
- authMethod: 'oauth';
5
- };
6
- export type SignInWithIdTokenOptions = SignInWithIdTokenCredentials & {
7
- authMethod: 'id_token';
8
- };
9
- export type SignInWithPasswordOptions = SignInWithPasswordCredentials & {
10
- authMethod: 'password';
11
- };
12
- export type SignInWithPasswordlessOptions = SignInWithPasswordlessCredentials & {
13
- authMethod: 'otp';
14
- };
15
- export type SignInWithSSOOptions = SignInWithSSO & {
16
- authMethod: 'sso';
17
- };
18
- export declare function createAuth(supabaseClient: SupabaseClient, customProviderHooks?: {
19
- useCurrentUser?: () => Promise<CurrentUser>;
20
- useHasRole?: (currentUser: CurrentUser | null) => (rolesToCheck: string | string[]) => boolean;
21
- }): {
22
- AuthContext: import("react").Context<import("@cedarjs/auth").AuthContextInterface<import("@supabase/supabase-js").UserMetadata, SignInWithOAuthOptions | SignInWithIdTokenOptions | ({
23
- email: string;
24
- password: string;
25
- } & {
26
- options?: {
27
- captchaToken?: string;
28
- };
29
- } & {
30
- authMethod: "password";
31
- }) | ({
32
- phone: string;
33
- password: string;
34
- } & {
35
- options?: {
36
- captchaToken?: string;
37
- };
38
- } & {
39
- authMethod: "password";
40
- }) | ({
41
- email: string;
42
- options?: {
43
- emailRedirectTo?: string;
44
- shouldCreateUser?: boolean;
45
- data?: object;
46
- captchaToken?: string;
47
- };
48
- } & {
49
- authMethod: "otp";
50
- }) | ({
51
- phone: string;
52
- options?: {
53
- shouldCreateUser?: boolean;
54
- data?: object;
55
- captchaToken?: string;
56
- channel?: "sms" | "whatsapp";
57
- };
58
- } & {
59
- authMethod: "otp";
60
- }) | ({
61
- providerId: string;
62
- options?: {
63
- redirectTo?: string;
64
- captchaToken?: string;
65
- skipBrowserRedirect?: boolean;
66
- };
67
- } & {
68
- authMethod: "sso";
69
- }) | ({
70
- domain: string;
71
- options?: {
72
- redirectTo?: string;
73
- captchaToken?: string;
74
- skipBrowserRedirect?: boolean;
75
- };
76
- } & {
77
- authMethod: "sso";
78
- }), AuthResponse | OAuthResponse | SSOResponse, unknown, void, {
79
- email: string;
80
- password: string;
81
- options?: {
82
- emailRedirectTo?: string;
83
- data?: object;
84
- captchaToken?: string;
85
- channel?: "sms" | "whatsapp";
86
- } | undefined;
87
- } | {
88
- phone: string;
89
- password: string;
90
- options?: {
91
- emailRedirectTo?: string;
92
- data?: object;
93
- captchaToken?: string;
94
- channel?: "sms" | "whatsapp";
95
- } | undefined;
96
- }, AuthResponse, unknown, unknown, unknown, unknown, SupabaseClient<any, "public", "public", any, any>> | undefined>;
97
- AuthProvider: ({ children }: import("@cedarjs/auth").AuthProviderProps) => import("react").JSX.Element;
98
- useAuth: () => import("@cedarjs/auth").AuthContextInterface<import("@supabase/supabase-js").UserMetadata, SignInWithOAuthOptions | SignInWithIdTokenOptions | ({
99
- email: string;
100
- password: string;
101
- } & {
102
- options?: {
103
- captchaToken?: string;
104
- };
105
- } & {
106
- authMethod: "password";
107
- }) | ({
108
- phone: string;
109
- password: string;
110
- } & {
111
- options?: {
112
- captchaToken?: string;
113
- };
114
- } & {
115
- authMethod: "password";
116
- }) | ({
117
- email: string;
118
- options?: {
119
- emailRedirectTo?: string;
120
- shouldCreateUser?: boolean;
121
- data?: object;
122
- captchaToken?: string;
123
- };
124
- } & {
125
- authMethod: "otp";
126
- }) | ({
127
- phone: string;
128
- options?: {
129
- shouldCreateUser?: boolean;
130
- data?: object;
131
- captchaToken?: string;
132
- channel?: "sms" | "whatsapp";
133
- };
134
- } & {
135
- authMethod: "otp";
136
- }) | ({
137
- providerId: string;
138
- options?: {
139
- redirectTo?: string;
140
- captchaToken?: string;
141
- skipBrowserRedirect?: boolean;
142
- };
143
- } & {
144
- authMethod: "sso";
145
- }) | ({
146
- domain: string;
147
- options?: {
148
- redirectTo?: string;
149
- captchaToken?: string;
150
- skipBrowserRedirect?: boolean;
151
- };
152
- } & {
153
- authMethod: "sso";
154
- }), AuthResponse | OAuthResponse | SSOResponse, unknown, void, {
155
- email: string;
156
- password: string;
157
- options?: {
158
- emailRedirectTo?: string;
159
- data?: object;
160
- captchaToken?: string;
161
- channel?: "sms" | "whatsapp";
162
- } | undefined;
163
- } | {
164
- phone: string;
165
- password: string;
166
- options?: {
167
- emailRedirectTo?: string;
168
- data?: object;
169
- captchaToken?: string;
170
- channel?: "sms" | "whatsapp";
171
- } | undefined;
172
- }, AuthResponse, unknown, unknown, unknown, unknown, SupabaseClient<any, "public", "public", any, any>>;
173
- };
174
- //# sourceMappingURL=supabase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/supabase.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACX,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,iCAAiC,EACjC,aAAa,EAId,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,eAAe,CAAA;AAMrE,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG;IAChE,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,4BAA4B,GAAG;IACpE,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,6BAA6B,GAAG;IACtE,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,6BAA6B,GACvC,iCAAiC,GAAG;IAClC,UAAU,EAAE,KAAK,CAAA;CAClB,CAAA;AAEH,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,UAAU,EAAE,KAAK,CAAA;CAClB,CAAA;AAmBD,wBAAgB,UAAU,CACxB,cAAc,EAAE,cAAc,EAC9B,mBAAmB,CAAC,EAAE;IACpB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3C,UAAU,CAAC,EAAE,CACX,WAAW,EAAE,WAAW,GAAG,IAAI,KAC5B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAA;CAClD;;;;;;wBA8PynQ,CAAC;;;oBAlS/mQ,UAAU;;;;;;wBAkSomQ,CAAC;;;oBAlS/mQ,UAAU;;;;2BAkSq0Q,CAAC;4BAA4H,CAAC;gBAAoS,CAAC;wBAA0H,CAAC;;;oBA7R32R,KAAK;;;;4BA6RsjS,CAAC;gBAAoS,CAAC;wBAA0H,CAAC;mBAAwF,CAAC;;;oBA7RrjT,KAAK;;;;sBA6RyzgB,CAAC;wBAA0H,CAAC;+BAAwP,CAAC;;;oBAzRrrhB,KAAK;;;;sBAyRi5hB,CAAC;wBAA0H,CAAC;+BAAwP,CAAC;;;oBAzR3wiB,KAAK;;;;;2BAyR+wP,CAAC;gBAAsB,CAAC;wBAA8B,CAAC;mBAAyB,CAAC;;;;;;2BAAjF,CAAC;gBAAsB,CAAC;wBAA8B,CAAC;mBAAyB,CAAC;;;;;;;;;wBAAyQ,CAAC;;;oBAlS/mQ,UAAU;;;;;;wBAkSomQ,CAAC;;;oBAlS/mQ,UAAU;;;;2BAkSq0Q,CAAC;4BAA4H,CAAC;gBAAoS,CAAC;wBAA0H,CAAC;;;oBA7R32R,KAAK;;;;4BA6RsjS,CAAC;gBAAoS,CAAC;wBAA0H,CAAC;mBAAwF,CAAC;;;oBA7RrjT,KAAK;;;;sBA6RyzgB,CAAC;wBAA0H,CAAC;+BAAwP,CAAC;;;oBAzRrrhB,KAAK;;;;sBAyRi5hB,CAAC;wBAA0H,CAAC;+BAAwP,CAAC;;;oBAzR3wiB,KAAK;;;;;2BAyR+wP,CAAC;gBAAsB,CAAC;wBAA8B,CAAC;mBAAyB,CAAC;;;;;;2BAAjF,CAAC;gBAAsB,CAAC;wBAA8B,CAAC;mBAAyB,CAAC;;;EArPl3P"}
@@ -1,202 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var supabase_exports = {};
20
- __export(supabase_exports, {
21
- createAuth: () => createAuth
22
- });
23
- module.exports = __toCommonJS(supabase_exports);
24
- var import_ssr = require("@supabase/ssr");
25
- var import_ssr2 = require("@supabase/ssr");
26
- var import_supabase_js = require("@supabase/supabase-js");
27
- var import_auth = require("@cedarjs/auth");
28
- function createMiddlewareAuth(supabaseClient, customProviderHooks) {
29
- const authImplementation = createAuthImplementation({
30
- supabaseClient,
31
- middleware: true
32
- });
33
- return (0, import_auth.createAuthentication)(authImplementation, {
34
- ...customProviderHooks,
35
- useCurrentUser: customProviderHooks?.useCurrentUser ?? (() => (0, import_auth.getCurrentUserFromMiddleware)("/middleware/supabase"))
36
- });
37
- }
38
- function createAuth(supabaseClient, customProviderHooks) {
39
- if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
40
- return createMiddlewareAuth(supabaseClient, customProviderHooks);
41
- }
42
- const authImplementation = createAuthImplementation({ supabaseClient });
43
- return (0, import_auth.createAuthentication)(authImplementation, customProviderHooks);
44
- }
45
- const setAuthProviderCookie = () => {
46
- const authProviderCookieString = (0, import_ssr2.serialize)(
47
- "auth-provider",
48
- "supabase",
49
- import_ssr.DEFAULT_COOKIE_OPTIONS
50
- );
51
- document.cookie = authProviderCookieString;
52
- };
53
- const expireAuthProviderCookie = () => {
54
- const authProviderCookieString = (0, import_ssr2.serialize)("auth-provider", "supabase", {
55
- ...import_ssr.DEFAULT_COOKIE_OPTIONS,
56
- maxAge: -1
57
- });
58
- document.cookie = authProviderCookieString;
59
- };
60
- function createAuthImplementation({
61
- supabaseClient,
62
- middleware = false
63
- }) {
64
- return {
65
- type: "supabase",
66
- client: supabaseClient,
67
- /*
68
- * All Supabase Sign In Authentication Methods
69
- */
70
- login: async (credentials) => {
71
- let result;
72
- switch (credentials.authMethod) {
73
- case "password":
74
- result = await supabaseClient.auth.signInWithPassword(credentials);
75
- break;
76
- case "oauth":
77
- result = await supabaseClient.auth.signInWithOAuth(credentials);
78
- break;
79
- case "otp":
80
- result = await supabaseClient.auth.signInWithOtp(credentials);
81
- break;
82
- case "sso":
83
- result = await supabaseClient.auth.signInWithSSO(credentials);
84
- break;
85
- case "id_token":
86
- result = await supabaseClient.auth.signInWithIdToken(credentials);
87
- break;
88
- default:
89
- return {
90
- data: { user: null, session: null },
91
- error: new import_supabase_js.AuthError("Unsupported authentication method")
92
- };
93
- }
94
- if (middleware) {
95
- setAuthProviderCookie();
96
- }
97
- return result;
98
- },
99
- /**
100
- * Inside a browser context, `signOut()` will remove the logged in user from the browser session
101
- * and log them out - removing all items from localStorage and then trigger a `"SIGNED_OUT"` event.
102
- *
103
- * For server-side management, you can revoke all refresh tokens for a user by passing a user's JWT through to `auth.api.signOut(JWT: string)`.
104
- * There is no way to revoke a user's access token jwt until it expires. It is recommended to set a shorter expiry on the jwt for this reason.
105
- */
106
- logout: async () => {
107
- const { error } = await supabaseClient.auth.signOut();
108
- if (error) {
109
- console.error(error);
110
- }
111
- if (middleware) {
112
- expireAuthProviderCookie();
113
- }
114
- return;
115
- },
116
- /**
117
- * Creates a new user.
118
- *
119
- * Be aware that if a user account exists in the system you may get back an
120
- * error message that attempts to hide this information from the user.
121
- *
122
- * @returns A logged-in session if the server has "autoconfirm" ON
123
- * @returns A user if the server has "autoconfirm" OFF
124
- */
125
- signup: async (credentials) => {
126
- const result = await supabaseClient.auth.signUp(credentials);
127
- if (result.data?.session) {
128
- setAuthProviderCookie();
129
- }
130
- return result;
131
- },
132
- getToken: async () => {
133
- const { data, error } = await supabaseClient.auth.getSession();
134
- if (error) {
135
- console.error(error);
136
- return null;
137
- }
138
- return data?.session?.access_token ?? null;
139
- },
140
- /**
141
- * Gets the current user metadata if there is an existing session.
142
- */
143
- getUserMetadata: async () => {
144
- const { data, error } = await supabaseClient.auth.getSession();
145
- if (error) {
146
- console.error(error);
147
- return null;
148
- }
149
- return data?.session?.user?.user_metadata ?? null;
150
- },
151
- /**
152
- * Restore CedarJS authentication state when an OAuth or magiclink callback
153
- * redirects back to site with access token by restoring the Supabase auth
154
- * session.
155
- *
156
- * Initializes the Supabase client session either from the url or from
157
- * storage. This method is automatically called when instantiating the
158
- * client, but should also be called manually when checking for an error
159
- * from an auth redirect (oauth, magiclink, password recovery, etc).
160
- */
161
- restoreAuthState: async () => {
162
- try {
163
- const { data } = await supabaseClient.auth.refreshSession();
164
- if (middleware) {
165
- if (data.session) {
166
- setAuthProviderCookie();
167
- } else {
168
- expireAuthProviderCookie();
169
- }
170
- }
171
- const currentUrl = new URL(window.location.href);
172
- const authParams = [
173
- "access_token",
174
- "refresh_token",
175
- "token_type",
176
- "expires_in",
177
- "expires_at"
178
- ];
179
- let hasAuthParams = false;
180
- authParams.forEach((param) => {
181
- if (currentUrl.searchParams.has(param)) {
182
- currentUrl.searchParams.delete(param);
183
- hasAuthParams = true;
184
- }
185
- });
186
- if (hasAuthParams) {
187
- const cleanUrl = currentUrl.pathname + (currentUrl.search || "");
188
- window.history.replaceState({}, document.title, cleanUrl);
189
- }
190
- } catch (error) {
191
- console.error(error);
192
- }
193
- return;
194
- },
195
- // This is important, so we can skip fetching getCurrentUser
196
- useMiddlewareAuth: middleware
197
- };
198
- }
199
- // Annotate the CommonJS export names for ESM import in node:
200
- 0 && (module.exports = {
201
- createAuth
202
- });