@studiocms/auth0 0.1.0-beta.25 → 0.1.0-beta.26

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.
@@ -46,11 +46,11 @@ export declare class Auth0User extends Auth0User_base {
46
46
  */
47
47
  export declare const cleanDomain: (domain: string) => string;
48
48
  declare const Auth0OAuthAPI_base: Effect.Service.Class<Auth0OAuthAPI, "Auth0OAuthAPI", {
49
- readonly dependencies: readonly [import("effect/Layer").Layer<import("studiocms/lib/auth/session").Session, never, never>, import("effect/Layer").Layer<import("studiocms/lib/auth/verify-email").VerifyEmail, Error, never>, import("effect/Layer").Layer<import("studiocms/lib/auth/user").User, Error, never>, import("effect/Layer").Layer<Platform.HttpClient.HttpClient, never, never>];
49
+ readonly dependencies: readonly [import("effect/Layer").Layer<import("studiocms/lib/auth/verify-email").VerifyEmail, Error, never>, import("effect/Layer").Layer<Platform.HttpClient.HttpClient, never, never>];
50
50
  readonly effect: Effect.Effect<{
51
- initSession: (context: APIContext) => Effect.Effect<Response, import("studiocms/lib/auth/session").SessionError, never>;
52
- initCallback: (context: APIContext) => Effect.Effect<Response, Error | import("studiocms/sdk/effect/db").LibSQLDatabaseError | import("studiocms/sdk/errors").SDKCoreError, never>;
53
- }, never, import("studiocms/lib/auth/session").Session | import("studiocms/lib/auth/verify-email").VerifyEmail | import("studiocms/lib/auth/user").User | Platform.HttpClient.HttpClient>;
51
+ initSession: (context: APIContext) => Effect.Effect<Response, import("@withstudiocms/auth-kit/errors").SessionError, never>;
52
+ initCallback: (context: APIContext) => Effect.Effect<Response, import("@withstudiocms/auth-kit/errors").SessionError, never>;
53
+ }, import("@withstudiocms/auth-kit/errors").SessionError | import("@withstudiocms/auth-kit/errors").UserError, import("studiocms/lib/auth/verify-email").VerifyEmail | Platform.HttpClient.HttpClient>;
54
54
  }>;
55
55
  /**
56
56
  * Provides Auth0 OAuth authentication effects for the StudioCMS API.
@@ -4,6 +4,7 @@ import config from "studiocms:config";
4
4
  import { StudioCMSRoutes } from "studiocms:lib";
5
5
  import { SDKCore } from "studiocms:sdk";
6
6
  import { Auth0, generateCodeVerifier, generateState } from "arctic";
7
+ import { LinkNewOAuthCookieName } from "studiocms/consts";
7
8
  import { Effect, genLogger, Platform, pipe, Schema } from "studiocms/effect";
8
9
  import { getCookie, getUrlParam, ValidateAuthCodeError } from "studiocms/oAuthUtils";
9
10
  class Auth0User extends Schema.Class("Auth0User")({
@@ -27,12 +28,7 @@ const AUTH0 = {
27
28
  REDIRECT_URI: getSecret("CMS_AUTH0_REDIRECT_URI") || ""
28
29
  };
29
30
  class Auth0OAuthAPI extends Effect.Service()("Auth0OAuthAPI", {
30
- dependencies: [
31
- Session.Default,
32
- VerifyEmail.Default,
33
- User.Default,
34
- Platform.FetchHttpClient.layer
35
- ],
31
+ dependencies: [VerifyEmail.Default, Platform.FetchHttpClient.layer],
36
32
  effect: genLogger("studiocms/routes/api/auth/auth0/effect")(function* () {
37
33
  const [
38
34
  sdk,
@@ -108,7 +104,7 @@ class Auth0OAuthAPI extends Effect.Service()("Auth0OAuthAPI", {
108
104
  return redirect(StudioCMSRoutes.mainLinks.dashboardIndex);
109
105
  }
110
106
  const loggedInUser = yield* getUserData(context);
111
- const linkNewOAuth = !!cookies.get(User.LinkNewOAuthCookieName)?.value;
107
+ const linkNewOAuth = !!cookies.get(LinkNewOAuthCookieName)?.value;
112
108
  if (loggedInUser.user && linkNewOAuth) {
113
109
  const existingUser2 = yield* sdk.GET.users.byId(loggedInUser.user.id);
114
110
  if (existingUser2) {
@@ -134,7 +130,12 @@ class Auth0OAuthAPI extends Effect.Service()("Auth0OAuthAPI", {
134
130
  name: auth0User.name,
135
131
  email: auth0User.email,
136
132
  avatar: auth0User.picture,
137
- createdAt: /* @__PURE__ */ new Date()
133
+ createdAt: /* @__PURE__ */ new Date(),
134
+ emailVerified: false,
135
+ notifications: null,
136
+ password: null,
137
+ updatedAt: /* @__PURE__ */ new Date(),
138
+ url: null
138
139
  },
139
140
  { provider: Auth0OAuthAPI.ProviderID, providerUserId: auth0UserId }
140
141
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiocms/auth0",
3
- "version": "0.1.0-beta.25",
3
+ "version": "0.1.0-beta.26",
4
4
  "description": "Add Auth0 OAuth Support into your StudioCMS project.",
5
5
  "author": {
6
6
  "name": "withstudiocms",
@@ -55,9 +55,9 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "astro": "^5.12.9",
58
- "effect": "^3.17.9",
58
+ "effect": "^3.17.13",
59
59
  "vite": "^6.3.4",
60
- "studiocms": "0.1.0-beta.25"
60
+ "studiocms": "0.1.0-beta.26"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "buildkit build 'src/**/*.{ts,astro,css,json,png}'",