@studiocms/google 0.1.0-beta.29 → 0.1.0-beta.31

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.
@@ -30,11 +30,11 @@ declare const GoogleUser_base: Schema.Class<GoogleUser, {
30
30
  export declare class GoogleUser extends GoogleUser_base {
31
31
  }
32
32
  declare const GoogleOAuthAPI_base: Effect.Service.Class<GoogleOAuthAPI, "GoogleOAuthAPI", {
33
- 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>];
33
+ readonly dependencies: readonly [import("effect/Layer").Layer<import("studiocms/lib/auth/verify-email").VerifyEmail, Error | import("effect/ConfigError").ConfigError, never>, import("effect/Layer").Layer<Platform.HttpClient.HttpClient, never, never>];
34
34
  readonly effect: Effect.Effect<{
35
- initSession: (context: APIContext) => Effect.Effect<Response, import("@withstudiocms/auth-kit/errors").SessionError, never>;
36
- initCallback: (context: APIContext) => Effect.Effect<Response, import("@withstudiocms/auth-kit/errors").SessionError, never>;
37
- }, import("@withstudiocms/auth-kit/errors").SessionError | import("@withstudiocms/auth-kit/errors").UserError, import("studiocms/lib/auth/verify-email").VerifyEmail | Platform.HttpClient.HttpClient>;
35
+ initSession: (context: APIContext) => Effect.Effect<Response, import("effect/ConfigError").ConfigError | import("@withstudiocms/auth-kit/errors").SessionError, never>;
36
+ initCallback: (context: APIContext) => Effect.Effect<Response, import("effect/ConfigError").ConfigError | import("@withstudiocms/auth-kit/errors").SessionError, never>;
37
+ }, import("effect/ConfigError").ConfigError | import("studiocms/sdk/base").DBClientInitializationError | import("studiocms/sdk/base").SDKInitializationError | import("@withstudiocms/auth-kit/errors").SessionError | import("@withstudiocms/auth-kit/errors").UserError, import("studiocms/lib/auth/verify-email").VerifyEmail | Platform.HttpClient.HttpClient>;
38
38
  }>;
39
39
  /**
40
40
  * Provides Google OAuth authentication effects for the StudioCMS API.
@@ -15,9 +15,9 @@ class GoogleUser extends Schema.Class("GoogleUser")({
15
15
  }) {
16
16
  }
17
17
  const GOOGLE = {
18
- CLIENT_ID: getSecret("GOOGLE_CLIENT_ID") ?? "",
19
- CLIENT_SECRET: getSecret("GOOGLE_CLIENT_SECRET") ?? "",
20
- REDIRECT_URI: getSecret("GOOGLE_REDIRECT_URI") ?? ""
18
+ CLIENT_ID: getSecret("CMS_GOOGLE_CLIENT_ID") ?? "",
19
+ CLIENT_SECRET: getSecret("CMS_GOOGLE_CLIENT_SECRET") ?? "",
20
+ REDIRECT_URI: getSecret("CMS_GOOGLE_REDIRECT_URI") ?? ""
21
21
  };
22
22
  class GoogleOAuthAPI extends Effect.Service()("GoogleOAuthAPI", {
23
23
  dependencies: [VerifyEmail.Default, Platform.FetchHttpClient.layer],
@@ -78,10 +78,10 @@ class GoogleOAuthAPI extends Effect.Service()("GoogleOAuthAPI", {
78
78
  }
79
79
  const googleUser = yield* validateAuthCode(code, codeVerifier);
80
80
  const { sub: googleUserId, name: googleUsername } = googleUser;
81
- const existingOAuthAccount = yield* sdk.AUTH.oAuth.searchProvidersForId(
82
- GoogleOAuthAPI.ProviderID,
83
- googleUserId
84
- );
81
+ const existingOAuthAccount = yield* sdk.AUTH.oAuth.searchProvidersForId({
82
+ providerId: GoogleOAuthAPI.ProviderID,
83
+ userId: googleUserId
84
+ });
85
85
  if (existingOAuthAccount) {
86
86
  const user = yield* sdk.GET.users.byId(existingOAuthAccount.userId);
87
87
  if (!user) {
@@ -123,11 +123,11 @@ class GoogleOAuthAPI extends Effect.Service()("GoogleOAuthAPI", {
123
123
  email: googleUser.email,
124
124
  name: googleUser.name,
125
125
  avatar: googleUser.picture,
126
- createdAt: /* @__PURE__ */ new Date(),
126
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
127
127
  emailVerified: false,
128
128
  notifications: null,
129
129
  password: null,
130
- updatedAt: /* @__PURE__ */ new Date(),
130
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
131
131
  url: null
132
132
  },
133
133
  { provider: GoogleOAuthAPI.ProviderID, providerUserId: googleUserId }
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ function studiocmsGoogle() {
8
8
  name: "StudioCMS Google Plugin",
9
9
  studiocmsMinimumVersion: "0.1.0-beta.22",
10
10
  hooks: {
11
- "studiocms:config:setup": ({ setAuthService }) => {
11
+ "studiocms:auth": ({ setAuthService }) => {
12
12
  setAuthService({
13
13
  oAuthProvider: {
14
14
  name: "google",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiocms/google",
3
- "version": "0.1.0-beta.29",
3
+ "version": "0.1.0-beta.31",
4
4
  "description": "Add Google OAuth Support to your StudioCMS project with ease!",
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.19.0",
58
+ "effect": "^3.19.9",
59
59
  "vite": "^6.3.4",
60
- "studiocms": "0.1.0-beta.29"
60
+ "studiocms": "0.1.0-beta.31"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "buildkit build 'src/**/*.{ts,astro,css,json,png}'",