@studiocms/github 0.1.0-beta.30 → 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.
- package/dist/effect/github.d.ts +4 -4
- package/dist/effect/github.js +9 -9
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/effect/github.d.ts
CHANGED
|
@@ -45,11 +45,11 @@ declare const GitHubUser_base: Schema.Class<GitHubUser, {
|
|
|
45
45
|
export declare class GitHubUser extends GitHubUser_base {
|
|
46
46
|
}
|
|
47
47
|
declare const GitHubOAuthAPI_base: Effect.Service.Class<GitHubOAuthAPI, "GitHubOAuthAPI", {
|
|
48
|
-
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>];
|
|
48
|
+
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>];
|
|
49
49
|
readonly effect: Effect.Effect<{
|
|
50
|
-
initSession: (context: APIContext) => Effect.Effect<Response, import("@withstudiocms/auth-kit/errors").SessionError, never>;
|
|
51
|
-
initCallback: (context: APIContext) => Effect.Effect<Response, import("@withstudiocms/auth-kit/errors").SessionError, never>;
|
|
52
|
-
}, import("@withstudiocms/auth-kit/errors").SessionError | import("@withstudiocms/auth-kit/errors").UserError, import("studiocms/lib/auth/verify-email").VerifyEmail | Platform.HttpClient.HttpClient>;
|
|
50
|
+
initSession: (context: APIContext) => Effect.Effect<Response, import("effect/ConfigError").ConfigError | import("@withstudiocms/auth-kit/errors").SessionError, never>;
|
|
51
|
+
initCallback: (context: APIContext) => Effect.Effect<Response, import("effect/ConfigError").ConfigError | import("@withstudiocms/auth-kit/errors").SessionError, never>;
|
|
52
|
+
}, 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>;
|
|
53
53
|
}>;
|
|
54
54
|
/**
|
|
55
55
|
* Provides GitHub OAuth authentication effects for the StudioCMS API.
|
package/dist/effect/github.js
CHANGED
|
@@ -18,9 +18,9 @@ class GitHubUser extends Schema.Class("GitHubUser")({
|
|
|
18
18
|
}) {
|
|
19
19
|
}
|
|
20
20
|
const GITHUB = {
|
|
21
|
-
CLIENT_ID: getSecret("
|
|
22
|
-
CLIENT_SECRET: getSecret("
|
|
23
|
-
REDIRECT_URI: getSecret("
|
|
21
|
+
CLIENT_ID: getSecret("CMS_GITHUB_CLIENT_ID") ?? "",
|
|
22
|
+
CLIENT_SECRET: getSecret("CMS_GITHUB_CLIENT_SECRET") ?? "",
|
|
23
|
+
REDIRECT_URI: getSecret("CMS_GITHUB_REDIRECT_URI") ?? null
|
|
24
24
|
};
|
|
25
25
|
class GitHubOAuthAPI extends Effect.Service()("GitHubOAuthAPI", {
|
|
26
26
|
dependencies: [VerifyEmail.Default, Platform.FetchHttpClient.layer],
|
|
@@ -72,10 +72,10 @@ class GitHubOAuthAPI extends Effect.Service()("GitHubOAuthAPI", {
|
|
|
72
72
|
}
|
|
73
73
|
const githubUser = yield* validateAuthCode(code);
|
|
74
74
|
const { id: githubUserId, login: githubUsername } = githubUser;
|
|
75
|
-
const existingOAuthAccount = yield* sdk.AUTH.oAuth.searchProvidersForId(
|
|
76
|
-
GitHubOAuthAPI.ProviderID,
|
|
77
|
-
`${githubUserId}`
|
|
78
|
-
);
|
|
75
|
+
const existingOAuthAccount = yield* sdk.AUTH.oAuth.searchProvidersForId({
|
|
76
|
+
providerId: GitHubOAuthAPI.ProviderID,
|
|
77
|
+
userId: `${githubUserId}`
|
|
78
|
+
});
|
|
79
79
|
if (existingOAuthAccount) {
|
|
80
80
|
const user = yield* sdk.GET.users.byId(existingOAuthAccount.userId);
|
|
81
81
|
if (!user) {
|
|
@@ -117,12 +117,12 @@ class GitHubOAuthAPI extends Effect.Service()("GitHubOAuthAPI", {
|
|
|
117
117
|
email: githubUser.email || null,
|
|
118
118
|
name: githubUser.name || githubUsername,
|
|
119
119
|
avatar: githubUser.avatar_url,
|
|
120
|
-
createdAt: /* @__PURE__ */ new Date(),
|
|
120
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
121
121
|
url: githubUser.blog || null,
|
|
122
122
|
emailVerified: false,
|
|
123
123
|
notifications: null,
|
|
124
124
|
password: null,
|
|
125
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
125
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
126
126
|
},
|
|
127
127
|
{ provider: GitHubOAuthAPI.ProviderID, providerUserId: `${githubUserId}` }
|
|
128
128
|
);
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function studiocmsGithub() {
|
|
|
8
8
|
name: "StudioCMS GitHub Plugin",
|
|
9
9
|
studiocmsMinimumVersion: "0.1.0-beta.22",
|
|
10
10
|
hooks: {
|
|
11
|
-
"studiocms:
|
|
11
|
+
"studiocms:auth": ({ setAuthService }) => {
|
|
12
12
|
setAuthService({
|
|
13
13
|
oAuthProvider: {
|
|
14
14
|
name: "github",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiocms/github",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.31",
|
|
4
4
|
"description": "Add GitHub OAuth Support to 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.19.
|
|
58
|
+
"effect": "^3.19.9",
|
|
59
59
|
"vite": "^6.3.4",
|
|
60
|
-
"studiocms": "0.1.0-beta.
|
|
60
|
+
"studiocms": "0.1.0-beta.31"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "buildkit build 'src/**/*.{ts,astro,css,json,png}'",
|