Saltearse al contenido

effect/auth0

Esta página aún no está disponible en tu idioma.

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:94^

Provides Auth0 OAuth authentication effects for the StudioCMS API.

This service handles the OAuth flow with Auth0, including session initialization, authorization code validation, user account linking, and user creation.

  • Uses generator-based effects for async operations.
  • Integrates with session management, user library, and email verification.
  • Handles first-time setup and redirects based on authentication state.
const auth0Api = yield* Auth0OAuthAPI;
yield* auth0Api.initSession(context);
yield* auth0Api.initCallback(context);
  • Session.Default
  • SDKCore.Default
  • VerifyEmail.Default
  • User.Default

initSession Initializes the OAuth session by generating state and code verifier, setting cookies, and redirecting to the Auth0 authorization URL.

initCallback Handles the OAuth callback, validates the authorization code, manages user linking, creates new users if necessary, verifies email, and creates user sessions.

  • any

new Auth0OAuthAPI(): Auth0OAuthAPI

Auth0OAuthAPI

Effect.Service<Auth0OAuthAPI>()('Auth0OAuthAPI', {
dependencies: [Session.Default, VerifyEmail.Default, User.Default, FetchHttpClient.layer],
effect: genLogger('studiocms/routes/api/auth/auth0/effect')(function () {
const [
sdk,
fetchClient,
{ setOAuthSessionTokenCookie, createUserSession },
{ isEmailVerified, sendVerificationEmail },
{ getUserData, createOAuthUser },
] = yield Effect.all([SDKCore, HttpClient.HttpClient, Session, VerifyEmail, User]);
const { CLIENT_ID, CLIENT_SECRET, DOMAIN, REDIRECT_URI } = AUTH0;
const CLIENT_DOMAIN = cleanDomain(DOMAIN);
const auth0 = new Auth0(CLIENT_DOMAIN, CLIENT_ID, CLIENT_SECRET, REDIRECT_URI);
const validateAuthCode = (code: string, codeVerifier: string) =>
genLogger('studiocms/routes/api/auth/auth0/effect.validateAuthCode')(function () {
const tokens = yield Effect.tryPromise(() =>
auth0.validateAuthorizationCode(code, codeVerifier)
);
return yield fetchClient
.get(${CLIENT_DOMAIN}/userinfo, {
headers: { Authorization: Bearer ${tokens.accessToken()} },
})
.pipe(
Effect.flatMap(HttpClientResponse.schemaBodyJson(Auth0User)),
Effect.catchAll((error) =>
Effect.fail(
new ValidateAuthCodeError({
provider: Auth0OAuthAPI.ProviderID,
message: Failed to fetch user info: ${error.message},
})
)
)
);
});
return {
initSession: (context: APIContext) =>
genLogger('studiocms/routes/api/auth/auth0/effect.initSession')(function () {
const state = generateState();
const codeVerifier = generateCodeVerifier();
const scopes = ['openid', 'profile', 'email'];
const url = auth0.createAuthorizationURL(state, codeVerifier, scopes);
yield setOAuthSessionTokenCookie(context, Auth0OAuthAPI.ProviderCookieName, state);
yield setOAuthSessionTokenCookie(
context,
Auth0OAuthAPI.ProviderCodeVerifier,
codeVerifier
);
return context.redirect(url.toString());
}),
initCallback: (context: APIContext) =>
genLogger('studiocms/routes/api/auth/auth0/effect.initCallback')(function () {
const { cookies, redirect } = context;
const [code, state, storedState, codeVerifier] = yield Effect.all([
getUrlParam(context, 'code'),
getUrlParam(context, 'state'),
getCookie(context, Auth0OAuthAPI.ProviderCookieName),
getCookie(context, Auth0OAuthAPI.ProviderCodeVerifier),
]);
if (!code || !storedState || !codeVerifier || state !== storedState) {
return redirect(StudioCMSRoutes.authLinks.loginURL);
}
const auth0User = yield validateAuthCode(code, codeVerifier);
const { sub: auth0UserId, name: auth0Username } = auth0User;
const existingOAuthAccount = yield sdk.AUTH.oAuth.searchProvidersForId(
Auth0OAuthAPI.ProviderID,
auth0UserId
);
if (existingOAuthAccount) {
const user = yield sdk.GET.users.byId(existingOAuthAccount.userId);
if (!user) {
return new Response('User not found', { status: 404 });
}
const isEmailAccountVerified = yield isEmailVerified(user);
// If Mailer is enabled, is the user verified?
if (!isEmailAccountVerified) {
return new Response('Email not verified, please verify your account first.', {
status: 400,
});
}
yield createUserSession(user.id, context);
return redirect(StudioCMSRoutes.mainLinks.dashboardIndex);
}
const loggedInUser = yield getUserData(context);
const linkNewOAuth = !!cookies.get(User.LinkNewOAuthCookieName)?.value;
if (loggedInUser.user && linkNewOAuth) {
const existingUser = yield sdk.GET.users.byId(loggedInUser.user.id);
if (existingUser) {
yield sdk.AUTH.oAuth.create({
userId: existingUser.id,
provider: Auth0OAuthAPI.ProviderID,
providerUserId: auth0UserId,
});
const isEmailAccountVerified = yield isEmailVerified(existingUser);
// If Mailer is enabled, is the user verified?
if (!isEmailAccountVerified) {
return new Response('Email not verified, please verify your account first.', {
status: 400,
});
}
yield createUserSession(existingUser.id, context);
return redirect(StudioCMSRoutes.mainLinks.dashboardIndex);
}
}
const newUser = yield createOAuthUser(
{
// @ts-expect-error drizzle broke the id variable...
id: crypto.randomUUID(),
username: auth0Username,
name: auth0User.name,
email: auth0User.email,
avatar: auth0User.picture,
createdAt: new Date(),
},
{ provider: Auth0OAuthAPI.ProviderID, providerUserId: auth0UserId }
);
if ('error' in newUser) {
return new Response('Error creating user', { status: 500 });
}
// FIRST-TIME-SETUP
if (config.dbStartPage) {
return redirect('/done');
}
yield sendVerificationEmail(newUser.id, true);
const existingUser = yield sdk.GET.users.byId(newUser.id);
const isEmailAccountVerified = yield isEmailVerified(existingUser);
// If Mailer is enabled, is the user verified?
if (!isEmailAccountVerified) {
return new Response('Email not verified, please verify your account first.', {
status: 400,
});
}
yield createUserSession(newUser.id, context);
return redirect(StudioCMSRoutes.mainLinks.dashboardIndex);
}),
};
}),
}).constructor

static ProviderCodeVerifier: string = 'auth0_oauth_code_verifier';

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:270^

static ProviderCookieName: string = 'auth0_oauth_state';

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:269^

static ProviderID: string = 'auth0';

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:268^


Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:21^

Represents a user authenticated via Auth0.

  • { sub: string; } & { name: string; } & { email: string; } & { picture: string; } & { nickname: string; }

new Auth0User(props: {
email: string;
name: string;
nickname: string;
picture: string;
sub: string;
}, options?: MakeOptions): Auth0User

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4265

string = Schema.String

string = Schema.String

string = Schema.String

string = Schema.String

string = Schema.String

MakeOptions

Auth0User

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).constructor

readonly email: string = Schema.String;

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:24^

The email address of the user.

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).email

readonly name: string = Schema.String;

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:23^

The full name of the user.

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).name

readonly nickname: string = Schema.String;

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:26^

The user’s nickname.

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).nickname

readonly picture: string = Schema.String;

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:25^

The URL to the user’s profile picture.

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).picture

readonly sub: string = Schema.String;

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:22^

The unique identifier for the user (subject).

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).sub

readonly static [TypeId]: {
_A: Invariant<Auth0User>;
_I: Invariant<{
email: string;
name: string;
nickname: string;
picture: string;
sub: string;
}>;
_R: Covariant<never>;
};

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:160

readonly _A: Invariant<Auth0User>;
readonly _I: Invariant<{
email: string;
name: string;
nickname: string;
picture: string;
sub: string;
}>;
readonly _R: Covariant<never>;
Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).[TypeId]

readonly static ast: Transformation;

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4267

3.10.0

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).ast

readonly static Context: never;

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:63

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).Context

readonly static Encoded: {
email: string;
name: string;
nickname: string;
picture: string;
sub: string;
};

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:62

email: string;
name: string;
nickname: string;
picture: string;
sub: string;
Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).Encoded

readonly static fields: {
email: typeof String$;
name: typeof String$;
nickname: typeof String$;
picture: typeof String$;
sub: typeof String$;
};

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4270

readonly email: typeof String$ = Schema.String;
readonly name: typeof String$ = Schema.String;
readonly nickname: typeof String$ = Schema.String;
readonly picture: typeof String$ = Schema.String;
readonly sub: typeof String$ = Schema.String;
Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).fields

readonly static identifier: string;

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4273

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).identifier

readonly static Type: Auth0User;

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:61

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).Type

static annotations(annotations: Schema<Auth0User>): SchemaClass<Auth0User, {
email: string;
name: string;
nickname: string;
picture: string;
sub: string;
}, never>

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4269

Merges a set of new annotations with existing ones, potentially overwriting any duplicates.

Schema<Auth0User>

SchemaClass<Auth0User, { email: string; name: string; nickname: string; picture: string; sub: string; }, never>

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).annotations

static extend<Extended>(identifier: string): <NewFields>(fields: NewFields | HasFields<NewFields>, annotations?: ClassAnnotations<Extended, { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }>) => [Extended] extends [never] ? "Missing `Self` generic - use `class Self extends Base.extend<Self>()({ ... })`" : Class<Extended, {
email: typeof String$;
name: typeof String$;
nickname: typeof String$;
picture: typeof String$;
sub: typeof String$;
} & NewFields, {
email: string;
name: string;
nickname: string;
picture: string;
sub: string;
} & {} & { readonly [K in string | number | symbol as Key<NewFields, K>]: Encoded<NewFields[K]> } & { readonly [K in string | number | symbol as Key<NewFields, K>]?: Encoded<NewFields[K]> }, Context<NewFields[keyof NewFields]>, {
sub: string;
} & {
name: string;
} & {
email: string;
} & {
picture: string;
} & {
nickname: string;
} & Constructor<NewFields>, Auth0User, {}>

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4296

Extended = never

string

Function

NewFields extends Fields

NewFields | HasFields<NewFields>

ClassAnnotations<Extended, { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }>

[Extended] extends [never] ? "Missing `Self` generic - use `class Self extends Base.extend<Self>()({ ... })`" : Class<Extended, { email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$; } & NewFields, { email: string; name: string; nickname: string; picture: string; sub: string; } & {} & { readonly [K in string | number | symbol as Key<NewFields, K>]: Encoded<NewFields[K]> } & { readonly [K in string | number | symbol as Key<NewFields, K>]?: Encoded<NewFields[K]> }, Context<NewFields[keyof NewFields]>, { sub: string; } & { name: string; } & { email: string; } & { picture: string; } & { nickname: string; } & Constructor<NewFields>, Auth0User, {}>

import { Schema } from "effect"
class MyClass extends Schema.Class<MyClass>("MyClass")({
myField: Schema.String
}) {
myMethod() {
return this.myField + "my"
}
}
class NextClass extends MyClass.extend<NextClass>("NextClass")({
nextField: Schema.Number
}) {
nextMethod() {
return this.myMethod() + this.myField + this.nextField
}
}
Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).extend

static make<C>(this: C, ...args: ConstructorParameters<C>): InstanceType<C>

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4268

C extends (…args: any[]) => any

C

ConstructorParameters<C>

InstanceType<C>

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).make

static pipe<A>(this: A): A

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:10

A

A

A

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B>(this: A, ab: (_: A) => B): B

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:11

A

B = never

A

(_: A) => B

B

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C): C

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:12

A

B = never

C = never

A

(_: A) => B

(_: B) => C

C

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D): D

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:13

A

B = never

C = never

D = never

A

(_: A) => B

(_: B) => C

(_: C) => D

D

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E): E

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:14

A

B = never

C = never

D = never

E = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

E

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F): F

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:15

A

B = never

C = never

D = never

E = never

F = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

F

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G): G

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:16

A

B = never

C = never

D = never

E = never

F = never

G = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

G

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H): H

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:17

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

H

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I): I

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:18

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

I

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J): J

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:19

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

J

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K): K

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:20

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

K

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L): L

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:21

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

L

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M): M

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:22

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

M

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M,
mn: (_: M) => N): N

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:23

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

N = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

(_: M) => N

N

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M,
mn: (_: M) => N,
no: (_: N) => O): O

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:24

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

N = never

O = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

(_: M) => N

(_: N) => O

O

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M,
mn: (_: M) => N,
no: (_: N) => O,
op: (_: O) => P): P

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:25

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

N = never

O = never

P = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

(_: M) => N

(_: N) => O

(_: O) => P

P

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M,
mn: (_: M) => N,
no: (_: N) => O,
op: (_: O) => P,
pq: (_: P) => Q): Q

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:26

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

N = never

O = never

P = never

Q = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

(_: M) => N

(_: N) => O

(_: O) => P

(_: P) => Q

Q

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M,
mn: (_: M) => N,
no: (_: N) => O,
op: (_: O) => P,
pq: (_: P) => Q,
qr: (_: Q) => R): R

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:27

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

N = never

O = never

P = never

Q = never

R = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

(_: M) => N

(_: N) => O

(_: O) => P

(_: P) => Q

(_: Q) => R

R

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M,
mn: (_: M) => N,
no: (_: N) => O,
op: (_: O) => P,
pq: (_: P) => Q,
qr: (_: Q) => R,
rs: (_: R) => S): S

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:28

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

N = never

O = never

P = never

Q = never

R = never

S = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

(_: M) => N

(_: N) => O

(_: O) => P

(_: P) => Q

(_: Q) => R

(_: R) => S

S

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M,
mn: (_: M) => N,
no: (_: N) => O,
op: (_: O) => P,
pq: (_: P) => Q,
qr: (_: Q) => R,
rs: (_: R) => S,
st: (_: S) => T): T

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:29

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

N = never

O = never

P = never

Q = never

R = never

S = never

T = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

(_: M) => N

(_: N) => O

(_: O) => P

(_: P) => Q

(_: Q) => R

(_: R) => S

(_: S) => T

T

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M,
mn: (_: M) => N,
no: (_: N) => O,
op: (_: O) => P,
pq: (_: P) => Q,
qr: (_: Q) => R,
rs: (_: R) => S,
st: (_: S) => T,
tu: (_: T) => U): U

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:30

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

N = never

O = never

P = never

Q = never

R = never

S = never

T = never

U = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

(_: M) => N

(_: N) => O

(_: O) => P

(_: P) => Q

(_: Q) => R

(_: R) => S

(_: S) => T

(_: T) => U

U

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe
static pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(
this: A,
ab: (_: A) => B,
bc: (_: B) => C,
cd: (_: C) => D,
de: (_: D) => E,
ef: (_: E) => F,
fg: (_: F) => G,
gh: (_: G) => H,
hi: (_: H) => I,
ij: (_: I) => J,
jk: (_: J) => K,
kl: (_: K) => L,
lm: (_: L) => M,
mn: (_: M) => N,
no: (_: N) => O,
op: (_: O) => P,
pq: (_: P) => Q,
qr: (_: Q) => R,
rs: (_: R) => S,
st: (_: S) => T,
tu: (_: T) => U): U

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:31

A

B = never

C = never

D = never

E = never

F = never

G = never

H = never

I = never

J = never

K = never

L = never

M = never

N = never

O = never

P = never

Q = never

R = never

S = never

T = never

U = never

A

(_: A) => B

(_: B) => C

(_: C) => D

(_: D) => E

(_: E) => F

(_: F) => G

(_: G) => H

(_: H) => I

(_: I) => J

(_: J) => K

(_: K) => L

(_: L) => M

(_: M) => N

(_: N) => O

(_: O) => P

(_: P) => Q

(_: Q) => R

(_: R) => S

(_: S) => T

(_: T) => U

U

Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).pipe

static transformOrFail<Transformed>(identifier: string): <NewFields, R2, R3>(fields: NewFields, options: {
decode: (input: {
email: string;
name: string;
nickname: string;
picture: string;
sub: string;
}, options: ParseOptions, ast: Transformation) => Effect<{ [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }, ParseIssue, R2>;
encode: (input: { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }, options: ParseOptions, ast: Transformation) => Effect<{
sub: string;
} & {
name: string;
} & {
email: string;
} & {
picture: string;
} & {
nickname: string;
}, ParseIssue, R3>;
}, annotations?: ClassAnnotations<Transformed, { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }>) => [Transformed] extends [never] ? "Missing `Self` generic - use `class Self extends Base.transformOrFail<Self>()({ ... })`" : Class<Transformed, {
email: typeof String$;
name: typeof String$;
nickname: typeof String$;
picture: typeof String$;
sub: typeof String$;
} & NewFields, Encoded<{
email: typeof String$;
name: typeof String$;
nickname: typeof String$;
picture: typeof String$;
sub: typeof String$;
}>, R2 | R3 | Context<NewFields[keyof NewFields]>, {
sub: string;
} & {
name: string;
} & {
email: string;
} & {
picture: string;
} & {
nickname: string;
} & Constructor<NewFields>, Auth0User, {}>

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4326

Transformed = never

string

Function

NewFields extends Fields

R2

R3

NewFields

(input: { email: string; name: string; nickname: string; picture: string; sub: string; }, options: ParseOptions, ast: Transformation) => Effect<{ [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }, ParseIssue, R2>

(input: { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }, options: ParseOptions, ast: Transformation) => Effect<{ sub: string; } & { name: string; } & { email: string; } & { picture: string; } & { nickname: string; }, ParseIssue, R3>

ClassAnnotations<Transformed, { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }>

[Transformed] extends [never] ? "Missing `Self` generic - use `class Self extends Base.transformOrFail<Self>()({ ... })`" : Class<Transformed, { email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$; } & NewFields, Encoded<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$; }>, R2 | R3 | Context<NewFields[keyof NewFields]>, { sub: string; } & { name: string; } & { email: string; } & { picture: string; } & { nickname: string; } & Constructor<NewFields>, Auth0User, {}>

import { Effect, Schema } from "effect"
class MyClass extends Schema.Class<MyClass>("MyClass")({
myField: Schema.String
}) {
myMethod() {
return this.myField + "my"
}
}
class NextClass extends MyClass.transformOrFail<NextClass>("NextClass")({
nextField: Schema.Number
}, {
decode: (i) =>
Effect.succeed({
myField: i.myField,
nextField: i.myField.length
}),
encode: (a) => Effect.succeed({ myField: a.myField })
}) {
nextMethod() {
return this.myMethod() + this.myField + this.nextField
}
}
Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).transformOrFail

static transformOrFailFrom<Transformed>(identifier: string): <NewFields, R2, R3>(fields: NewFields, options: {
decode: (input: {
email: string;
name: string;
nickname: string;
picture: string;
sub: string;
}, options: ParseOptions, ast: Transformation) => Effect<{ [K in string | number | symbol]: ({ email: string; name: string; nickname: string; picture: string; sub: string } & {} & { readonly [K in string | number | symbol as Key<NewFields, K>]: Encoded<NewFields[K]> } & { readonly [K in string | number | symbol as Key<NewFields, K>]?: Encoded<(...)[(...)]> })[K] }, ParseIssue, R2>;
encode: (input: { [K in string | number | symbol]: ({ email: string; name: string; nickname: string; picture: string; sub: string } & {} & { readonly [K in string | number | symbol as Key<NewFields, K>]: Encoded<NewFields[K]> } & { readonly [K in string | number | symbol as Key<NewFields, K>]?: Encoded<NewFields[K]> })[K] }, options: ParseOptions, ast: Transformation) => Effect<Encoded<{
email: typeof String$;
name: typeof String$;
nickname: typeof String$;
picture: typeof String$;
sub: typeof String$;
}>, ParseIssue, R3>;
}, annotations?: ClassAnnotations<Transformed, { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }>) => [Transformed] extends [never] ? "Missing `Self` generic - use `class Self extends Base.transformOrFailFrom<Self>()({ ... })`" : Class<Transformed, {
email: typeof String$;
name: typeof String$;
nickname: typeof String$;
picture: typeof String$;
sub: typeof String$;
} & NewFields, Encoded<{
email: typeof String$;
name: typeof String$;
nickname: typeof String$;
picture: typeof String$;
sub: typeof String$;
}>, R2 | R3 | Context<NewFields[keyof NewFields]>, {
sub: string;
} & {
name: string;
} & {
email: string;
} & {
picture: string;
} & {
nickname: string;
} & Constructor<NewFields>, Auth0User, {}>

Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4359

Transformed = never

string

Function

NewFields extends Fields

R2

R3

NewFields

(input: { email: string; name: string; nickname: string; picture: string; sub: string; }, options: ParseOptions, ast: Transformation) => Effect<{ [K in string | number | symbol]: ({ email: string; name: string; nickname: string; picture: string; sub: string } & {} & { readonly [K in string | number | symbol as Key<NewFields, K>]: Encoded<NewFields[K]> } & { readonly [K in string | number | symbol as Key<NewFields, K>]?: Encoded<(…)[(…)]> })[K] }, ParseIssue, R2>

(input: { [K in string | number | symbol]: ({ email: string; name: string; nickname: string; picture: string; sub: string } & {} & { readonly [K in string | number | symbol as Key<NewFields, K>]: Encoded<NewFields[K]> } & { readonly [K in string | number | symbol as Key<NewFields, K>]?: Encoded<NewFields[K]> })[K] }, options: ParseOptions, ast: Transformation) => Effect<Encoded<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$; }>, ParseIssue, R3>

ClassAnnotations<Transformed, { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }>

[Transformed] extends [never] ? "Missing `Self` generic - use `class Self extends Base.transformOrFailFrom<Self>()({ ... })`" : Class<Transformed, { email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$; } & NewFields, Encoded<{ email: typeof String$; name: typeof String$; nickname: typeof String$; picture: typeof String$; sub: typeof String$; }>, R2 | R3 | Context<NewFields[keyof NewFields]>, { sub: string; } & { name: string; } & { email: string; } & { picture: string; } & { nickname: string; } & Constructor<NewFields>, Auth0User, {}>

import { Effect, Schema } from "effect"
class MyClass extends Schema.Class<MyClass>("MyClass")({
myField: Schema.String
}) {
myMethod() {
return this.myField + "my"
}
}
class NextClass extends MyClass.transformOrFailFrom<NextClass>("NextClass")({
nextField: Schema.Number
}, {
decode: (i) =>
Effect.succeed({
myField: i.myField,
nextField: i.myField.length
}),
encode: (a) => Effect.succeed({ myField: a.myField })
}) {
nextMethod() {
return this.myMethod() + this.myField + this.nextField
}
}
Schema.Class<Auth0User>('Auth0User')({
sub: Schema.String,
name: Schema.String,
email: Schema.String,
picture: Schema.String,
nickname: Schema.String,
}).transformOrFailFrom

function cleanDomain(domain: string): string

Defined in: studiocms/packages/@studiocms/auth0/src/effect/auth0.ts:39^

Returns the normalized domain string for Auth0 authentication.

This function performs the following transformations:

  • Removes any leading slash from the domain.
  • Strips out the “http://” or “https://” protocol from the domain.
  • Prepends “https://” to the resulting domain.

string

string

The normalized domain string with “https://” prepended.