@studiocms/auth0 0.1.0-beta.30 → 0.1.0

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/verify-email").VerifyEmail, 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, import("studiocms/sdk/base").DBClientInitializationError | import("studiocms/sdk/base").SDKInitializationError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError | import("@withstudiocms/effect/smtp").SMTPError, never>, import("effect/Layer").Layer<Platform.HttpClient.HttpClient, never, never>];
50
50
  readonly effect: Effect.Effect<{
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>;
51
+ initSession: (context: APIContext) => Effect.Effect<Response, import("effect/ConfigError").ConfigError | import("@withstudiocms/auth-kit/errors").SessionError, never>;
52
+ initCallback: (context: APIContext) => Effect.Effect<Response, any, never>;
53
+ }, import("studiocms/sdk/base").DBClientInitializationError | import("studiocms/sdk/base").SDKInitializationError | import("effect/ConfigError").ConfigError | 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.
@@ -48,13 +48,11 @@ class Auth0OAuthAPI extends Effect.Service()("Auth0OAuthAPI", {
48
48
  headers: { Authorization: `Bearer ${tokens.accessToken()}` }
49
49
  }).pipe(
50
50
  Effect.flatMap(Platform.HttpClientResponse.schemaBodyJson(Auth0User)),
51
- Effect.catchAll(
52
- (error) => Effect.fail(
53
- new ValidateAuthCodeError({
54
- provider: Auth0OAuthAPI.ProviderID,
55
- message: `Failed to fetch user info: ${error.message}`
56
- })
57
- )
51
+ Effect.mapError(
52
+ (error) => new ValidateAuthCodeError({
53
+ provider: Auth0OAuthAPI.ProviderID,
54
+ message: `Failed to fetch user info: ${error.message}`
55
+ })
58
56
  )
59
57
  );
60
58
  });
@@ -85,10 +83,10 @@ class Auth0OAuthAPI extends Effect.Service()("Auth0OAuthAPI", {
85
83
  }
86
84
  const auth0User = yield* validateAuthCode(code, codeVerifier);
87
85
  const { sub: auth0UserId, name: auth0Username } = auth0User;
88
- const existingOAuthAccount = yield* sdk.AUTH.oAuth.searchProvidersForId(
89
- Auth0OAuthAPI.ProviderID,
90
- auth0UserId
91
- );
86
+ const existingOAuthAccount = yield* sdk.AUTH.oAuth.searchProvidersForId({
87
+ providerId: Auth0OAuthAPI.ProviderID,
88
+ userId: auth0UserId
89
+ });
92
90
  if (existingOAuthAccount) {
93
91
  const user = yield* sdk.GET.users.byId(existingOAuthAccount.userId);
94
92
  if (!user) {
@@ -130,11 +128,11 @@ class Auth0OAuthAPI extends Effect.Service()("Auth0OAuthAPI", {
130
128
  name: auth0User.name,
131
129
  email: auth0User.email,
132
130
  avatar: auth0User.picture,
133
- createdAt: /* @__PURE__ */ new Date(),
131
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
134
132
  emailVerified: false,
135
133
  notifications: null,
136
134
  password: null,
137
- updatedAt: /* @__PURE__ */ new Date(),
135
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
138
136
  url: null
139
137
  },
140
138
  { provider: Auth0OAuthAPI.ProviderID, providerUserId: auth0UserId }
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ function studiocmsAuth0() {
8
8
  name: "StudioCMS Auth0 Provider 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: "auth0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiocms/auth0",
3
- "version": "0.1.0-beta.30",
3
+ "version": "0.1.0",
4
4
  "description": "Add Auth0 OAuth Support into your StudioCMS project.",
5
5
  "author": {
6
6
  "name": "withstudiocms",
@@ -55,14 +55,16 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "astro": "^5.12.9",
58
- "effect": "^3.19.2",
58
+ "effect": "^3.19.14",
59
59
  "vite": "^6.3.4",
60
- "studiocms": "0.1.0-beta.30"
60
+ "studiocms": "0.1.0"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "buildkit build 'src/**/*.{ts,astro,css,json,png}'",
64
64
  "dev": "buildkit dev 'src/**/*.{ts,astro,css,json,png}'",
65
65
  "typecheck": "tspc -p tsconfig.tspc.json",
66
+ "effect-check": "pnpm effect-language-service diagnostics --project tsconfig.tspc.json",
67
+ "ci:effect-check": "pnpm effect-check --format github-actions",
66
68
  "test": "vitest"
67
69
  }
68
70
  }