effect/google
Esta página aún no está disponible en tu idioma.
Classes
Section titled “Classes”GoogleOAuthAPI
Section titled “GoogleOAuthAPI”Defined in: studiocms/packages/@studiocms/google/src/effect/google.ts:68^
Provides Google OAuth authentication effects for the StudioCMS API.
Remarks
Section titled “Remarks”This service handles the OAuth flow for Google authentication, including session initialization, authorization code validation, user account linking, and user creation. It integrates with session management, user data libraries, and email verification.
Example
Section titled “Example”const googleOAuth = new GoogleOAuthAPI();yield* googleOAuth.initSession(context);yield* googleOAuth.initCallback(context);
Method
Section titled “Method”initSession Initializes the OAuth session by generating a state and code verifier, setting cookies, and redirecting the user to Google’s authorization URL.
The API context containing request and response information.
Method
Section titled “Method”initCallback Handles the OAuth callback from Google. Validates the authorization code and state, fetches user information, links or creates user accounts, verifies email, and creates a user session.
The API context containing request and response information.
Dependencies
Section titled “Dependencies”- Session.Default: Session management utilities.
- SDKCore.Default: Core SDK for user and OAuth provider operations.
- VerifyEmail.Default: Email verification utilities.
- User.Default: User data management utilities.
Extends
Section titled “Extends”any
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GoogleOAuthAPI(): GoogleOAuthAPI
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Effect.Service<GoogleOAuthAPI>()('GoogleOAuthAPI', { dependencies: [Session.Default, VerifyEmail.Default, User.Default, FetchHttpClient.layer], effect: genLogger('studiocms/routes/api/auth/google/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, REDIRECT_URI } = GOOGLE;
const google = new Google(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI);
const validateAuthCode = (code: string, codeVerifier: string) => genLogger('studiocms/routes/api/auth/google/effect.validateAuthCode')(function () { const tokens = yield Effect.tryPromise(() => google.validateAuthorizationCode(code, codeVerifier) );
return yield fetchClient .get('https://openidconnect.googleapis.com/v1/userinfo', { headers: { Authorization: Bearer ${tokens.accessToken}, }, }) .pipe( Effect.flatMap(HttpClientResponse.schemaBodyJson(GoogleUser)), Effect.catchAll((error) => Effect.fail( new ValidateAuthCodeError({ provider: GoogleOAuthAPI.ProviderID, message: Failed to fetch user info: ${error.message}, }) ) ) ); });
return { initSession: (context: APIContext) => genLogger('studiocms/routes/api/auth/google/effect.initSession')(function () { const state = generateState(); const codeVerifier = generateCodeVerifier(); const scopes = ['profile', 'email'];
const url = google.createAuthorizationURL(state, codeVerifier, scopes);
yield setOAuthSessionTokenCookie(context, GoogleOAuthAPI.ProviderCookieName, state);
yield setOAuthSessionTokenCookie( context, GoogleOAuthAPI.ProviderCodeVerifier, codeVerifier );
return context.redirect(url.toString()); }), initCallback: (context: APIContext) => genLogger('studiocms/routes/api/auth/google/effect.initCallback')(function () { const { cookies, redirect } = context;
const [code, state, storedState, codeVerifier] = yield Effect.all([ getUrlParam(context, 'code'), getUrlParam(context, 'state'), getCookie(context, GoogleOAuthAPI.ProviderCookieName), getCookie(context, GoogleOAuthAPI.ProviderCodeVerifier), ]);
if (!code || !storedState || !codeVerifier || state !== storedState) { return redirect(StudioCMSRoutes.authLinks.loginURL); }
const googleUser = yield validateAuthCode(code, codeVerifier);
const { sub: googleUserId, name: googleUsername } = googleUser;
const existingOAuthAccount = yield sdk.AUTH.oAuth.searchProvidersForId( GoogleOAuthAPI.ProviderID, googleUserId );
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: GoogleOAuthAPI.ProviderID, providerUserId: googleUserId, });
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: googleUsername, email: googleUser.email, name: googleUser.name, avatar: googleUser.picture, createdAt: new Date(), }, { provider: GoogleOAuthAPI.ProviderID, providerUserId: googleUserId } );
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
Properties
Section titled “Properties”ProviderCodeVerifier
Section titled “ProviderCodeVerifier”static ProviderCodeVerifier: string = 'google_oauth_code_verifier';
Defined in: studiocms/packages/@studiocms/google/src/effect/google.ts:244^
ProviderCookieName
Section titled “ProviderCookieName”static ProviderCookieName: string = 'google_oauth_state';
Defined in: studiocms/packages/@studiocms/google/src/effect/google.ts:243^
ProviderID
Section titled “ProviderID”static ProviderID: string = 'google';
Defined in: studiocms/packages/@studiocms/google/src/effect/google.ts:242^
GoogleUser
Section titled “GoogleUser”Defined in: studiocms/packages/@studiocms/google/src/effect/google.ts:20^
Represents a user authenticated via Google OAuth.
Extends
Section titled “Extends”- {
sub
:string
; } & {picture
:string
; } & {name
:string
; } & {email
:string
; }
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GoogleUser(props: { email: string; name: string; picture: string; sub: string; }, options?: MakeOptions): GoogleUser
Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4265
Parameters
Section titled “Parameters”string
= Schema.String
string
= Schema.String
picture
Section titled “picture”string
= Schema.String
string
= Schema.String
options?
Section titled “options?”MakeOptions
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).constructor
Properties
Section titled “Properties”readonly email: string = Schema.String;
Defined in: studiocms/packages/@studiocms/google/src/effect/google.ts:24^
The user’s email address.
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).email
readonly name: string = Schema.String;
Defined in: studiocms/packages/@studiocms/google/src/effect/google.ts:23^
The full name of the user.
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).name
picture
Section titled “picture”readonly picture: string = Schema.String;
Defined in: studiocms/packages/@studiocms/google/src/effect/google.ts:22^
The URL of the user’s profile picture.
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).picture
readonly sub: string = Schema.String;
Defined in: studiocms/packages/@studiocms/google/src/effect/google.ts:21^
The unique identifier for the user (subject).
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).sub
[TypeId]
Section titled “[TypeId]”readonly static [TypeId]: { _A: Invariant<GoogleUser>; _I: Invariant<{ email: string; name: 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<GoogleUser>;
readonly _I: Invariant<{ email: string; name: string; picture: string; sub: string;}>;
readonly _R: Covariant<never>;
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: 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
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).ast
Context
Section titled “Context”readonly static Context: never;
Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:63
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).Context
Encoded
Section titled “Encoded”readonly static Encoded: { email: string; name: 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;
picture
Section titled “picture”picture: string;
sub: string;
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).Encoded
fields
Section titled “fields”readonly static fields: { email: typeof String$; name: 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;
picture
Section titled “picture”readonly picture: typeof String$ = Schema.String;
readonly sub: typeof String$ = Schema.String;
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).fields
identifier
Section titled “identifier”readonly static identifier: string;
Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4273
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).identifier
readonly static Type: GoogleUser;
Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:61
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).Type
Methods
Section titled “Methods”annotations()
Section titled “annotations()”static annotations(annotations: Schema<GoogleUser>): SchemaClass<GoogleUser, { email: string; name: 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.
Parameters
Section titled “Parameters”annotations
Section titled “annotations”Schema
<GoogleUser
>
Returns
Section titled “Returns”SchemaClass
<GoogleUser
, {
email
: string
;
name
: string
;
picture
: string
;
sub
: string
;
}, never
>
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).annotations
extend()
Section titled “extend()”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$; 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$; picture: typeof String$; sub: typeof String$; } & NewFields, { email: string; name: 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; } & { picture: string; } & { name: string; } & { email: string;} & Constructor<NewFields>, GoogleUser, {}>
Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4296
Type Parameters
Section titled “Type Parameters”Extended
Section titled “Extended”Extended
= never
Parameters
Section titled “Parameters”identifier
Section titled “identifier”string
Returns
Section titled “Returns”Function
Type Parameters
Section titled “Type Parameters”NewFields
Section titled “NewFields”NewFields
extends Fields
Parameters
Section titled “Parameters”fields
Section titled “fields”NewFields
| HasFields
<NewFields
>
annotations?
Section titled “annotations?”ClassAnnotations
<Extended
, { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }>
Returns
Section titled “Returns”[Extended
] extends [never
] ? "Missing `Self` generic - use `class Self extends Base.extend<Self>()({ ... })`"
: Class
<Extended
, {
email
: typeof String$
;
name
: typeof String$
;
picture
: typeof String$
;
sub
: typeof String$
;
} & NewFields
, {
email
: string
;
name
: 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
;
} & {
picture
: string
;
} & {
name
: string
;
} & {
email
: string
;
} & Constructor
<NewFields
>, GoogleUser
, {}>
Example
Section titled “Example”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 }}
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).extend
make()
Section titled “make()”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
Type Parameters
Section titled “Type Parameters”C
extends (…args
: any
[]) => any
Parameters
Section titled “Parameters”C
…ConstructorParameters
<C
>
Returns
Section titled “Returns”InstanceType
<C
>
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).make
pipe()
Section titled “pipe()”Call Signature
Section titled “Call Signature”static pipe<A>(this: A): A
Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Pipeable.d.ts:10
Type Parameters
Section titled “Type Parameters”A
Parameters
Section titled “Parameters”A
Returns
Section titled “Returns”A
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
Returns
Section titled “Returns”B
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
Returns
Section titled “Returns”C
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
D
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
(_
: C
) => D
Returns
Section titled “Returns”D
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
D
= never
E
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
(_
: C
) => D
(_
: D
) => E
Returns
Section titled “Returns”E
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
D
= never
E
= never
F
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
(_
: C
) => D
(_
: D
) => E
(_
: E
) => F
Returns
Section titled “Returns”F
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
D
= never
E
= never
F
= never
G
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
(_
: C
) => D
(_
: D
) => E
(_
: E
) => F
(_
: F
) => G
Returns
Section titled “Returns”G
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
D
= never
E
= never
F
= never
G
= never
H
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
(_
: C
) => D
(_
: D
) => E
(_
: E
) => F
(_
: F
) => G
(_
: G
) => H
Returns
Section titled “Returns”H
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
D
= never
E
= never
F
= never
G
= never
H
= never
I
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
(_
: C
) => D
(_
: D
) => E
(_
: E
) => F
(_
: F
) => G
(_
: G
) => H
(_
: H
) => I
Returns
Section titled “Returns”I
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
D
= never
E
= never
F
= never
G
= never
H
= never
I
= never
J
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
(_
: C
) => D
(_
: D
) => E
(_
: E
) => F
(_
: F
) => G
(_
: G
) => H
(_
: H
) => I
(_
: I
) => J
Returns
Section titled “Returns”J
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
D
= never
E
= never
F
= never
G
= never
H
= never
I
= never
J
= never
K
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
(_
: C
) => D
(_
: D
) => E
(_
: E
) => F
(_
: F
) => G
(_
: G
) => H
(_
: H
) => I
(_
: I
) => J
(_
: J
) => K
Returns
Section titled “Returns”K
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”A
B
= never
C
= never
D
= never
E
= never
F
= never
G
= never
H
= never
I
= never
J
= never
K
= never
L
= never
Parameters
Section titled “Parameters”A
(_
: A
) => B
(_
: B
) => C
(_
: C
) => D
(_
: D
) => E
(_
: E
) => F
(_
: F
) => G
(_
: G
) => H
(_
: H
) => I
(_
: I
) => J
(_
: J
) => K
(_
: K
) => L
Returns
Section titled “Returns”L
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”M
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”N
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”O
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”P
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”Q
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”R
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”S
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”T
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”U
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
Call Signature
Section titled “Call Signature”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
Type Parameters
Section titled “Type Parameters”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
Parameters
Section titled “Parameters”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
Returns
Section titled “Returns”U
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).pipe
transformOrFail()
Section titled “transformOrFail()”static transformOrFail<Transformed>(identifier: string): <NewFields, R2, R3>(fields: NewFields, options: { decode: (input: { email: string; name: string; picture: string; sub: string; }, options: ParseOptions, ast: Transformation) => Effect<{ [K in string | number | symbol]: Type<{ email: typeof String$; name: 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$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }, options: ParseOptions, ast: Transformation) => Effect<{ sub: string; } & { picture: string; } & { name: string; } & { email: string; }, ParseIssue, R3>; }, annotations?: ClassAnnotations<Transformed, { [K in string | number | symbol]: Type<{ email: typeof String$; name: 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$; picture: typeof String$; sub: typeof String$; } & NewFields, Encoded<{ email: typeof String$; name: typeof String$; picture: typeof String$; sub: typeof String$; }>, R2 | R3 | Context<NewFields[keyof NewFields]>, { sub: string; } & { picture: string; } & { name: string; } & { email: string;} & Constructor<NewFields>, GoogleUser, {}>
Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4326
Type Parameters
Section titled “Type Parameters”Transformed
Section titled “Transformed”Transformed
= never
Parameters
Section titled “Parameters”identifier
Section titled “identifier”string
Returns
Section titled “Returns”Function
Type Parameters
Section titled “Type Parameters”NewFields
Section titled “NewFields”NewFields
extends Fields
R2
R3
Parameters
Section titled “Parameters”fields
Section titled “fields”NewFields
options
Section titled “options”decode
Section titled “decode”(input
: {
email
: string
;
name
: string
;
picture
: string
;
sub
: string
;
}, options
: ParseOptions
, ast
: Transformation
) => Effect
<{ [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }, ParseIssue
, R2
>
encode
Section titled “encode”(input
: { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }, options
: ParseOptions
, ast
: Transformation
) => Effect
<{
sub
: string
;
} & {
picture
: string
;
} & {
name
: string
;
} & {
email
: string
;
}, ParseIssue
, R3
>
annotations?
Section titled “annotations?”ClassAnnotations
<Transformed
, { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }>
Returns
Section titled “Returns”[Transformed
] extends [never
] ? "Missing `Self` generic - use `class Self extends Base.transformOrFail<Self>()({ ... })`"
: Class
<Transformed
, {
email
: typeof String$
;
name
: typeof String$
;
picture
: typeof String$
;
sub
: typeof String$
;
} & NewFields
, Encoded
<{
email
: typeof String$
;
name
: typeof String$
;
picture
: typeof String$
;
sub
: typeof String$
;
}>, R2
| R3
| Context
<NewFields
[keyof NewFields
]>, {
sub
: string
;
} & {
picture
: string
;
} & {
name
: string
;
} & {
email
: string
;
} & Constructor
<NewFields
>, GoogleUser
, {}>
Example
Section titled “Example”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 }}
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).transformOrFail
transformOrFailFrom()
Section titled “transformOrFailFrom()”static transformOrFailFrom<Transformed>(identifier: string): <NewFields, R2, R3>(fields: NewFields, options: { decode: (input: { email: string; name: string; picture: string; sub: string; }, options: ParseOptions, ast: Transformation) => Effect<{ [K in string | number | symbol]: ({ email: string; name: 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; 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$; picture: typeof String$; sub: typeof String$; }>, ParseIssue, R3>; }, annotations?: ClassAnnotations<Transformed, { [K in string | number | symbol]: Type<{ email: typeof String$; name: 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$; picture: typeof String$; sub: typeof String$; } & NewFields, Encoded<{ email: typeof String$; name: typeof String$; picture: typeof String$; sub: typeof String$; }>, R2 | R3 | Context<NewFields[keyof NewFields]>, { sub: string; } & { picture: string; } & { name: string; } & { email: string;} & Constructor<NewFields>, GoogleUser, {}>
Defined in: node_modules/.pnpm/effect@3.17.3/node_modules/effect/dist/dts/Schema.d.ts:4359
Type Parameters
Section titled “Type Parameters”Transformed
Section titled “Transformed”Transformed
= never
Parameters
Section titled “Parameters”identifier
Section titled “identifier”string
Returns
Section titled “Returns”Function
Type Parameters
Section titled “Type Parameters”NewFields
Section titled “NewFields”NewFields
extends Fields
R2
R3
Parameters
Section titled “Parameters”fields
Section titled “fields”NewFields
options
Section titled “options”decode
Section titled “decode”(input
: {
email
: string
;
name
: string
;
picture
: string
;
sub
: string
;
}, options
: ParseOptions
, ast
: Transformation
) => Effect
<{ [K in string | number | symbol]: ({ email: string; name: 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
Section titled “encode”(input
: { [K in string | number | symbol]: ({ email: string; name: 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$
;
picture
: typeof String$
;
sub
: typeof String$
;
}>, ParseIssue
, R3
>
annotations?
Section titled “annotations?”ClassAnnotations
<Transformed
, { [K in string | number | symbol]: Type<{ email: typeof String$; name: typeof String$; picture: typeof String$; sub: typeof String$ } & NewFields>[K] }>
Returns
Section titled “Returns”[Transformed
] extends [never
] ? "Missing `Self` generic - use `class Self extends Base.transformOrFailFrom<Self>()({ ... })`"
: Class
<Transformed
, {
email
: typeof String$
;
name
: typeof String$
;
picture
: typeof String$
;
sub
: typeof String$
;
} & NewFields
, Encoded
<{
email
: typeof String$
;
name
: typeof String$
;
picture
: typeof String$
;
sub
: typeof String$
;
}>, R2
| R3
| Context
<NewFields
[keyof NewFields
]>, {
sub
: string
;
} & {
picture
: string
;
} & {
name
: string
;
} & {
email
: string
;
} & Constructor
<NewFields
>, GoogleUser
, {}>
Example
Section titled “Example”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 }}
Inherited from
Section titled “Inherited from”Schema.Class<GoogleUser>('GoogleUser')({ sub: Schema.String, picture: Schema.String, name: Schema.String, email: Schema.String,}).transformOrFailFrom