@studiocms/google 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.
- package/dist/effect/google.d.ts +4 -4
- package/dist/effect/google.js +9 -8
- package/package.json +3 -3
package/dist/effect/google.d.ts
CHANGED
|
@@ -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/
|
|
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>];
|
|
34
34
|
readonly effect: Effect.Effect<{
|
|
35
|
-
initSession: (context: APIContext) => Effect.Effect<Response, import("
|
|
36
|
-
initCallback: (context: APIContext) => Effect.Effect<Response,
|
|
37
|
-
},
|
|
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>;
|
|
38
38
|
}>;
|
|
39
39
|
/**
|
|
40
40
|
* Provides Google OAuth authentication effects for the StudioCMS API.
|
package/dist/effect/google.js
CHANGED
|
@@ -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 { Google, generateCodeVerifier, generateState } from "arctic";
|
|
7
|
+
import { LinkNewOAuthCookieName } from "studiocms/consts";
|
|
7
8
|
import { Effect, genLogger, Platform, Schema } from "studiocms/effect";
|
|
8
9
|
import { getCookie, getUrlParam, ValidateAuthCodeError } from "studiocms/oAuthUtils";
|
|
9
10
|
class GoogleUser extends Schema.Class("GoogleUser")({
|
|
@@ -19,12 +20,7 @@ const GOOGLE = {
|
|
|
19
20
|
REDIRECT_URI: getSecret("GOOGLE_REDIRECT_URI") ?? ""
|
|
20
21
|
};
|
|
21
22
|
class GoogleOAuthAPI extends Effect.Service()("GoogleOAuthAPI", {
|
|
22
|
-
dependencies: [
|
|
23
|
-
Session.Default,
|
|
24
|
-
VerifyEmail.Default,
|
|
25
|
-
User.Default,
|
|
26
|
-
Platform.FetchHttpClient.layer
|
|
27
|
-
],
|
|
23
|
+
dependencies: [VerifyEmail.Default, Platform.FetchHttpClient.layer],
|
|
28
24
|
effect: genLogger("studiocms/routes/api/auth/google/effect")(function* () {
|
|
29
25
|
const [
|
|
30
26
|
sdk,
|
|
@@ -101,7 +97,7 @@ class GoogleOAuthAPI extends Effect.Service()("GoogleOAuthAPI", {
|
|
|
101
97
|
return redirect(StudioCMSRoutes.mainLinks.dashboardIndex);
|
|
102
98
|
}
|
|
103
99
|
const loggedInUser = yield* getUserData(context);
|
|
104
|
-
const linkNewOAuth = !!cookies.get(
|
|
100
|
+
const linkNewOAuth = !!cookies.get(LinkNewOAuthCookieName)?.value;
|
|
105
101
|
if (loggedInUser.user && linkNewOAuth) {
|
|
106
102
|
const existingUser2 = yield* sdk.GET.users.byId(loggedInUser.user.id);
|
|
107
103
|
if (existingUser2) {
|
|
@@ -127,7 +123,12 @@ class GoogleOAuthAPI extends Effect.Service()("GoogleOAuthAPI", {
|
|
|
127
123
|
email: googleUser.email,
|
|
128
124
|
name: googleUser.name,
|
|
129
125
|
avatar: googleUser.picture,
|
|
130
|
-
createdAt: /* @__PURE__ */ new Date()
|
|
126
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
127
|
+
emailVerified: false,
|
|
128
|
+
notifications: null,
|
|
129
|
+
password: null,
|
|
130
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
131
|
+
url: null
|
|
131
132
|
},
|
|
132
133
|
{ provider: GoogleOAuthAPI.ProviderID, providerUserId: googleUserId }
|
|
133
134
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiocms/google",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.26",
|
|
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.17.
|
|
58
|
+
"effect": "^3.17.13",
|
|
59
59
|
"vite": "^6.3.4",
|
|
60
|
-
"studiocms": "0.1.0-beta.
|
|
60
|
+
"studiocms": "0.1.0-beta.26"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "buildkit build 'src/**/*.{ts,astro,css,json,png}'",
|