Add Effect v4 support, Fast Refresh tooling, and revamped docs #56
@@ -10,14 +10,14 @@ import * as View from "./View.js"
|
||||
export const SubmittableFormTypeId: unique symbol = Symbol.for("@effect-fc/Form/SubmittableForm")
|
||||
export type SubmittableFormTypeId = typeof SubmittableFormTypeId
|
||||
|
||||
export interface SubmittableForm<in out A, in out I = A, in out R = never, in out MA = void, out ME = never, in out MR = never>
|
||||
export interface SubmittableForm<in out A, in out I = A, in out RD = never, in out RE = never, in out MA = void, out ME = never, in out MR = never>
|
||||
extends Form.Form<readonly [], A, I, never, never> {
|
||||
readonly [SubmittableFormTypeId]: SubmittableFormTypeId
|
||||
|
||||
readonly schema: Schema.ConstraintCodec<A, I, R, unknown>
|
||||
readonly context: Context.Context<Scope.Scope | R>
|
||||
readonly schema: Schema.ConstraintCodec<A, I, RD, RE>
|
||||
readonly context: Context.Context<Scope.Scope | RD | RE>
|
||||
readonly mutation: Mutation.Mutation<
|
||||
readonly [value: A, form: SubmittableForm<A, I, R, unknown, unknown, unknown>],
|
||||
readonly [value: A, form: SubmittableForm<A, I, RD, RE, unknown, unknown, unknown>],
|
||||
MA, ME, MR
|
||||
>
|
||||
readonly validationFiber: View.View<Option.Option<Fiber.Fiber<A, Schema.SchemaError>>, never, never>
|
||||
@@ -26,8 +26,8 @@ extends Form.Form<readonly [], A, I, never, never> {
|
||||
readonly submit: Effect.Effect<Option.Option<AsyncResult.Success<MA, ME> | AsyncResult.Failure<MA, ME>>, Cause.NoSuchElementError>
|
||||
}
|
||||
|
||||
export class SubmittableFormImpl<in out A, in out I = A, in out R = never, in out MA = void, in out ME = never, in out MR = never>
|
||||
extends Pipeable.Class implements SubmittableForm<A, I, R, MA, ME, MR> {
|
||||
export class SubmittableFormImpl<in out A, in out I = A, in out RD = never, in out RE = never, in out MA = void, out ME = never, in out MR = never>
|
||||
extends Pipeable.Class implements SubmittableForm<A, I, RD, RE, MA, ME, MR> {
|
||||
readonly [Form.FormTypeId]: Form.FormTypeId = Form.FormTypeId
|
||||
readonly [SubmittableFormTypeId]: SubmittableFormTypeId = SubmittableFormTypeId
|
||||
|
||||
@@ -39,10 +39,10 @@ extends Pipeable.Class implements SubmittableForm<A, I, R, MA, ME, MR> {
|
||||
readonly isCommitting: View.View<boolean, never, never>
|
||||
|
||||
constructor(
|
||||
readonly schema: Schema.ConstraintCodec<A, I, R, unknown>,
|
||||
readonly context: Context.Context<Scope.Scope | R>,
|
||||
readonly schema: Schema.ConstraintCodec<A, I, RD, RE>,
|
||||
readonly context: Context.Context<Scope.Scope | RD | RE>,
|
||||
readonly mutation: Mutation.Mutation<
|
||||
readonly [value: A, form: SubmittableForm<A, I, R, unknown, unknown, unknown>],
|
||||
readonly [value: A, form: SubmittableForm<A, I, RD, RE, unknown, unknown, unknown>],
|
||||
MA, ME, MR
|
||||
>,
|
||||
readonly value: Lens.Lens<Option.Option<A>, never, never, never, never>,
|
||||
@@ -165,26 +165,26 @@ export const isSubmittableForm = (u: unknown): u is SubmittableForm<unknown, unk
|
||||
|
||||
|
||||
export declare namespace make {
|
||||
export interface Options<in out A, in out I = A, in out R = never, in out MA = void, in out ME = never, in out MR = never>
|
||||
export interface Options<in out A, in out I = A, in out RD = never, in out RE = never, in out MA = void, out ME = never, in out MR = never>
|
||||
extends Mutation.make.Options<
|
||||
readonly [value: NoInfer<A>, form: SubmittableForm<NoInfer<A>, NoInfer<I>, NoInfer<R>, unknown, unknown, unknown>],
|
||||
readonly [value: NoInfer<A>, form: SubmittableForm<NoInfer<A>, NoInfer<I>, NoInfer<RD>, NoInfer<RE>, unknown, unknown, unknown>],
|
||||
MA, ME, MR
|
||||
> {
|
||||
readonly schema: Schema.ConstraintCodec<A, I, R, unknown>
|
||||
readonly schema: Schema.ConstraintCodec<A, I, RD, RE>
|
||||
readonly initialEncodedValue: NoInfer<I>
|
||||
}
|
||||
}
|
||||
|
||||
export const make = Effect.fnUntraced(function* <A, I = A, R = never, MA = void, ME = never, MR = never>(
|
||||
options: make.Options<A, I, R, MA, ME, MR>
|
||||
export const make = Effect.fnUntraced(function* <A, I = A, RD = never, RE = never, MA = void, ME = never, MR = never>(
|
||||
options: make.Options<A, I, RD, RE, MA, ME, MR>
|
||||
): Effect.fn.Return<
|
||||
SubmittableForm<A, I, R, MA, ME, MR>,
|
||||
SubmittableForm<A, I, RD, RE, MA, ME, MR>,
|
||||
never,
|
||||
Scope.Scope | R | MR
|
||||
Scope.Scope | RD | RE | MR
|
||||
> {
|
||||
return new SubmittableFormImpl(
|
||||
options.schema,
|
||||
yield* Effect.context<Scope.Scope | R | MR>(),
|
||||
yield* Effect.context<Scope.Scope | RD | RE | MR>(),
|
||||
yield* Mutation.make(options),
|
||||
|
||||
Lens.fromSubscriptionRef(yield* SubscriptionRef.make(Option.none<A>())),
|
||||
@@ -197,16 +197,16 @@ export const make = Effect.fnUntraced(function* <A, I = A, R = never, MA = void,
|
||||
})
|
||||
|
||||
export declare namespace service {
|
||||
export interface Options<in out A, in out I = A, in out R = never, in out MA = void, in out ME = never, in out MR = never>
|
||||
extends make.Options<A, I, R, MA, ME, MR> {}
|
||||
export interface Options<in out A, in out I = A, in out RD = never, in out RE = never, in out MA = void, out ME = never, in out MR = never>
|
||||
extends make.Options<A, I, RD, RE, MA, ME, MR> {}
|
||||
}
|
||||
|
||||
export const service = <A, I = A, R = never, MA = void, ME = never, MR = never, MP = never>(
|
||||
options: service.Options<A, I, R, MA, ME, MR>
|
||||
export const service = <A, I = A, RD = never, RE = never, MA = void, ME = never, MR = never>(
|
||||
options: service.Options<A, I, RD, RE, MA, ME, MR>
|
||||
): Effect.Effect<
|
||||
SubmittableForm<A, I, R, MA, ME, MR>,
|
||||
SubmittableForm<A, I, RD, RE, MA, ME, MR>,
|
||||
never,
|
||||
Scope.Scope | R | MR
|
||||
Scope.Scope | RD | RE | MR
|
||||
> => Effect.tap(
|
||||
make(options),
|
||||
form => Effect.forkScoped(form.run),
|
||||
|
||||
@@ -1,204 +1,206 @@
|
||||
import {
|
||||
Array,
|
||||
type Context,
|
||||
Effect,
|
||||
Equal,
|
||||
Fiber,
|
||||
Option,
|
||||
Pipeable,
|
||||
Predicate,
|
||||
Schema,
|
||||
SchemaIssue,
|
||||
SchemaParser,
|
||||
type Scope,
|
||||
Semaphore,
|
||||
Stream,
|
||||
SubscriptionRef,
|
||||
} from "effect"
|
||||
import type { StandardSchemaV1 } from "@standard-schema/spec"
|
||||
import { Array, type Context, Effect, Equal, Fiber, Option, Pipeable, Predicate, Schema, SchemaIssue, type Scope, Semaphore, Stream, SubscriptionRef } from "effect"
|
||||
import * as Form from "./Form.js"
|
||||
import * as Lens from "./Lens.js"
|
||||
import * as View from "./View.js"
|
||||
|
||||
|
||||
type FormSchema<A, I, R> = Schema.Top & {
|
||||
readonly Type: A
|
||||
readonly Encoded: I
|
||||
readonly DecodingServices: R
|
||||
readonly EncodingServices: R
|
||||
}
|
||||
|
||||
export const SynchronizedFormTypeId: unique symbol = Symbol.for("@effect-fc/Form/SynchronizedForm")
|
||||
export type SynchronizedFormTypeId = typeof SynchronizedFormTypeId
|
||||
|
||||
export interface SynchronizedForm<
|
||||
in out A,
|
||||
in out I = A,
|
||||
in out R = never,
|
||||
in out TER = never,
|
||||
in out TEW = never,
|
||||
in out TRR = never,
|
||||
in out TRW = never,
|
||||
> extends Form.Form<readonly [], A, I, TER, TER | TEW> {
|
||||
export interface SynchronizedForm<in out A, in out I = A, in out RD = never, in out RE = never, in out TER = never, in out TEW = never, in out TRR = never, in out TRW = never>
|
||||
extends Form.Form<readonly [], A, I, TER, TER | TEW> {
|
||||
readonly [SynchronizedFormTypeId]: SynchronizedFormTypeId
|
||||
readonly schema: FormSchema<A, I, R>
|
||||
readonly context: Context.Context<Scope.Scope | R | TRR | TRW>
|
||||
|
||||
readonly schema: Schema.ConstraintCodec<A, I, RD, RE>
|
||||
readonly context: Context.Context<Scope.Scope | RD | RE | TRR | TRW>
|
||||
readonly target: Lens.Lens<A, TER, TEW, TRR, TRW>
|
||||
readonly validationFiber: View.View<Option.Option<Fiber.Fiber<A, SchemaIssue.Issue>>, never, never>
|
||||
readonly validationFiber: View.View<Option.Option<Fiber.Fiber<A, Schema.SchemaError>>, never, never>
|
||||
|
||||
readonly run: Effect.Effect<void, TER>
|
||||
}
|
||||
|
||||
export class SynchronizedFormImpl<
|
||||
in out A,
|
||||
in out I = A,
|
||||
in out R = never,
|
||||
in out TER = never,
|
||||
in out TEW = never,
|
||||
in out TRR = never,
|
||||
in out TRW = never,
|
||||
> extends Pipeable.Class implements SynchronizedForm<A, I, R, TER, TEW, TRR, TRW> {
|
||||
export class SynchronizedFormImpl<in out A, in out I = A, in out RD = never, in out RE = never, in out TER = never, in out TEW = never, in out TRR = never, in out TRW = never>
|
||||
extends Pipeable.Class implements SynchronizedForm<A, I, RD, RE, TER, TEW, TRR, TRW> {
|
||||
readonly [Form.FormTypeId]: Form.FormTypeId = Form.FormTypeId
|
||||
readonly [SynchronizedFormTypeId]: SynchronizedFormTypeId = SynchronizedFormTypeId
|
||||
|
||||
readonly path = [] as const
|
||||
readonly value: View.View<Option.Option<A>, TER, never>
|
||||
|
||||
readonly value: View.View<Option.Option<A>, never, never>
|
||||
readonly encodedValue: Lens.Lens<I, TER, TER | TEW, never, never>
|
||||
readonly isValidating: View.View<boolean, never, never>
|
||||
readonly canCommit: View.View<boolean, never, never>
|
||||
|
||||
constructor(
|
||||
readonly schema: FormSchema<A, I, R>,
|
||||
readonly context: Context.Context<Scope.Scope | R | TRR | TRW>,
|
||||
readonly schema: Schema.ConstraintCodec<A, I, RD, RE>,
|
||||
readonly context: Context.Context<Scope.Scope | RD | RE | TRR | TRW>,
|
||||
readonly target: Lens.Lens<A, TER, TEW, TRR, TRW>,
|
||||
|
||||
readonly internalEncodedValue: Lens.Lens<I, never, never, never, never>,
|
||||
readonly issues: Lens.Lens<readonly Form.FormIssue[], never, never, never, never>,
|
||||
readonly validationFiber: Lens.Lens<Option.Option<Fiber.Fiber<A, SchemaIssue.Issue>>, never, never, never, never>,
|
||||
readonly isCommitting: Lens.Lens<boolean, never, never, never, never>,
|
||||
readonly issues: Lens.Lens<readonly StandardSchemaV1.Issue[], never, never, never, never>,
|
||||
readonly validationFiber: Lens.Lens<Option.Option<Fiber.Fiber<A, Schema.SchemaError>>, never, never, never, never>,
|
||||
readonly isCommitting: Lens.Lens<boolean, never, never>,
|
||||
|
||||
readonly runSemaphore: Semaphore.Semaphore,
|
||||
) {
|
||||
super()
|
||||
this.value = View.make({
|
||||
get: Effect.provide(Effect.map(target.get, Option.some), context),
|
||||
changes: Stream.provideContext(
|
||||
target.changes.pipe(
|
||||
Stream.map(Option.some),
|
||||
Stream.catchCause(() => Stream.make(Option.none<A>())),
|
||||
|
||||
this.value = Effect.succeed(this).pipe(
|
||||
Effect.map(self => View.make({
|
||||
get: Effect.provide(Effect.option(self.target.get), self.context),
|
||||
get changes() {
|
||||
return Stream.provideContext(
|
||||
self.target.changes.pipe(
|
||||
Stream.map(Option.some),
|
||||
Stream.catch(() => Stream.make(Option.none())),
|
||||
),
|
||||
self.context,
|
||||
)
|
||||
},
|
||||
})),
|
||||
View.unwrap,
|
||||
)
|
||||
this.encodedValue = Effect.all([
|
||||
Effect.succeed(this),
|
||||
Effect.succeed(Lens.asLensImpl(this.internalEncodedValue)),
|
||||
]).pipe(
|
||||
Effect.map(([self, parent]) => Lens.make({
|
||||
get: parent.get,
|
||||
get changes() { return parent.changes },
|
||||
commit: a => Effect.andThen(
|
||||
Effect.flatMap(
|
||||
parent.resolve,
|
||||
resolved => resolved.commit(Effect.succeed(a)),
|
||||
),
|
||||
self.synchronizeEncodedValue(a),
|
||||
),
|
||||
context,
|
||||
),
|
||||
})
|
||||
this.encodedValue = Lens.make({
|
||||
get: Lens.get(internalEncodedValue),
|
||||
changes: internalEncodedValue.changes,
|
||||
commit: encoded => Effect.andThen(
|
||||
Lens.set(internalEncodedValue, encoded),
|
||||
this.synchronizeEncodedValue(encoded),
|
||||
),
|
||||
lock: Lens.asLensImpl(internalEncodedValue).lock,
|
||||
}) as unknown as Lens.Lens<I, TER, TER | TEW, never, never>
|
||||
this.isValidating = View.map(validationFiber, Option.isSome)
|
||||
const commitState = View.zipLatestAll(issues as any, validationFiber as any, isCommitting as any) as unknown as View.View<readonly [
|
||||
readonly Form.FormIssue[],
|
||||
Option.Option<Fiber.Fiber<A, SchemaIssue.Issue>>,
|
||||
boolean,
|
||||
]>
|
||||
this.canCommit = View.map(
|
||||
commitState,
|
||||
([currentIssues, fiber, committing]) => currentIssues.length === 0 && Option.isNone(fiber) && !committing,
|
||||
lock: parent.lock,
|
||||
})),
|
||||
Lens.unwrap,
|
||||
)
|
||||
this.isValidating = Effect.succeed(this).pipe(
|
||||
Effect.map(self => View.map(self.validationFiber, Option.isSome)),
|
||||
View.unwrap,
|
||||
)
|
||||
this.canCommit = Effect.succeed(this).pipe(
|
||||
Effect.map(self => View.map(
|
||||
View.zipLatestAll(self.issues, self.validationFiber, self.isCommitting),
|
||||
([issues, validationFiber, isCommitting]) => (
|
||||
Array.isReadonlyArrayEmpty(issues) &&
|
||||
Option.isNone(validationFiber) &&
|
||||
!isCommitting
|
||||
),
|
||||
)),
|
||||
View.unwrap,
|
||||
)
|
||||
}
|
||||
|
||||
synchronizeEncodedValue(encodedValue: I): Effect.Effect<void, TER | TEW> {
|
||||
const self = this
|
||||
return Effect.gen(function*() {
|
||||
const current = yield* Lens.get(self.validationFiber)
|
||||
if (Option.isSome(current)) yield* Fiber.interrupt(current.value)
|
||||
const fiber = yield* Effect.forkScoped(
|
||||
synchronizeEncodedValue(encodedValue: I): Effect.Effect<void, TER | TEW, never> {
|
||||
return Lens.get(this.validationFiber).pipe(
|
||||
Effect.andThen(Option.match({
|
||||
onSome: Fiber.interrupt,
|
||||
onNone: () => Effect.void,
|
||||
})),
|
||||
Effect.andThen(Effect.forkScoped(
|
||||
Effect.ensuring(
|
||||
SchemaParser.decodeEffect(self.schema)(encodedValue),
|
||||
Lens.set(self.validationFiber, Option.none()),
|
||||
Schema.decodeEffect(this.schema, { errors: "all" })(encodedValue),
|
||||
Lens.set(this.validationFiber, Option.none()),
|
||||
)
|
||||
)),
|
||||
Effect.tap(fiber => Lens.set(this.validationFiber, Option.some(fiber))),
|
||||
Effect.flatMap(Fiber.join),
|
||||
|
||||
Effect.flatMap(value => Effect.ensuring(
|
||||
Lens.set(this.isCommitting, true).pipe(
|
||||
Effect.andThen(Lens.set(this.issues, Array.empty())),
|
||||
Effect.andThen(Lens.set(this.target, value)),
|
||||
),
|
||||
)
|
||||
yield* Lens.set(self.validationFiber, Option.some(fiber))
|
||||
yield* Fiber.join(fiber).pipe(
|
||||
Effect.flatMap(value => Effect.ensuring(
|
||||
Effect.andThen(
|
||||
Lens.set(self.isCommitting, true),
|
||||
Effect.andThen(Lens.set(self.issues, Array.empty()), Lens.set(self.target, value)),
|
||||
),
|
||||
Lens.set(self.isCommitting, false),
|
||||
)),
|
||||
Effect.catchIf(SchemaIssue.isIssue, issue => Lens.set(self.issues, formatIssue(issue))),
|
||||
)
|
||||
}).pipe(Effect.provide(this.context)) as Effect.Effect<void, TER | TEW>
|
||||
Lens.set(this.isCommitting, false),
|
||||
)),
|
||||
Effect.catchIf(
|
||||
Schema.isSchemaError,
|
||||
error => Lens.set(this.issues, SchemaIssue.makeFormatterStandardSchemaV1()(error.issue).issues),
|
||||
),
|
||||
|
||||
Effect.provide(this.context),
|
||||
)
|
||||
}
|
||||
|
||||
get run(): Effect.Effect<void, TER> {
|
||||
get run(): Effect.Effect<void, TER, never> {
|
||||
return this.runSemaphore.withPermits(1)(Effect.provide(
|
||||
Stream.runForEach(Stream.drop(this.target.changes, 1), targetValue => Effect.ignore(
|
||||
Effect.flatMap(SchemaParser.encodeEffect(this.schema)(targetValue), encodedValue => Effect.flatMap(
|
||||
Lens.get(this.internalEncodedValue),
|
||||
current => Equal.equals(encodedValue, current)
|
||||
? Effect.succeed(undefined)
|
||||
: Effect.andThen(
|
||||
Stream.runForEach(
|
||||
Stream.drop(Lens.changes(this.target), 1),
|
||||
targetValue => Schema.encodeEffect(this.schema, { errors: "all" })(targetValue).pipe(
|
||||
Effect.flatMap(encodedValue => Effect.when(
|
||||
Effect.andThen(
|
||||
Lens.set(this.issues, Array.empty()),
|
||||
Lens.set(this.internalEncodedValue, encodedValue),
|
||||
),
|
||||
)),
|
||||
)),
|
||||
Effect.map(
|
||||
Lens.get(this.internalEncodedValue),
|
||||
currentEncodedValue => !Equal.equals(encodedValue, currentEncodedValue),
|
||||
),
|
||||
)),
|
||||
Effect.ignore,
|
||||
),
|
||||
),
|
||||
this.context,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
const formatIssue = (issue: SchemaIssue.Issue): readonly Form.FormIssue[] => {
|
||||
const formatted = SchemaIssue.makeFormatterStandardSchemaV1()(issue)
|
||||
return formatted.issues.map(item => ({
|
||||
path: (item.path ?? []) as readonly PropertyKey[],
|
||||
message: item.message,
|
||||
}))
|
||||
}
|
||||
|
||||
export const isSynchronizedForm = (u: unknown): u is SynchronizedForm<unknown, unknown, unknown, unknown, unknown, unknown, unknown> => Predicate.hasProperty(u, SynchronizedFormTypeId)
|
||||
|
||||
|
||||
export declare namespace make {
|
||||
export interface Options<in out A, in out I = A, in out R = never, in out TER = never, in out TEW = never, in out TRR = never, in out TRW = never> {
|
||||
readonly schema: FormSchema<A, I, R>
|
||||
export interface Options<in out A, in out I = A, in out RD = never, in out RE = never, in out TER = never, in out TEW = never, in out TRR = never, in out TRW = never> {
|
||||
readonly schema: Schema.ConstraintCodec<A, I, RD, RE>
|
||||
readonly target: Lens.Lens<A, TER, TEW, TRR, TRW>
|
||||
readonly initialEncodedValue?: NoInfer<I>
|
||||
}
|
||||
}
|
||||
|
||||
export const make = Effect.fnUntraced(function* <A, I = A, R = never, TER = never, TEW = never, TRR = never, TRW = never>(
|
||||
options: make.Options<A, I, R, TER, TEW, TRR, TRW>,
|
||||
export const make = Effect.fnUntraced(function* <A, I = A, RD = never, RE = never, TER = never, TEW = never, TRR = never, TRW = never>(
|
||||
options: make.Options<A, I, RD, RE, TER, TEW, TRR, TRW>
|
||||
): Effect.fn.Return<
|
||||
SynchronizedForm<A, I, R, TER, TEW, TRR, TRW>,
|
||||
SchemaIssue.Issue | TER,
|
||||
Scope.Scope | R | TRR | TRW
|
||||
SynchronizedForm<A, I, RD, RE, TER, TEW, TRR, TRW>,
|
||||
Schema.SchemaError | TER,
|
||||
Scope.Scope | RD | RE | TRR | TRW
|
||||
> {
|
||||
const initialEncodedValue = options.initialEncodedValue !== undefined
|
||||
? options.initialEncodedValue
|
||||
: yield* Effect.flatMap(Lens.get(options.target), SchemaParser.encodeEffect(options.schema))
|
||||
: yield* Effect.flatMap(
|
||||
Lens.get(options.target),
|
||||
Schema.encodeEffect(options.schema),
|
||||
)
|
||||
|
||||
return new SynchronizedFormImpl(
|
||||
options.schema,
|
||||
yield* Effect.context<Scope.Scope | R | TRR | TRW>(),
|
||||
yield* Effect.context<Scope.Scope | RD | RE | TRR | TRW>(),
|
||||
options.target,
|
||||
|
||||
Lens.fromSubscriptionRef(yield* SubscriptionRef.make(initialEncodedValue)),
|
||||
Lens.fromSubscriptionRef(yield* SubscriptionRef.make<readonly Form.FormIssue[]>(Array.empty())),
|
||||
Lens.fromSubscriptionRef(yield* SubscriptionRef.make(Option.none<Fiber.Fiber<A, SchemaIssue.Issue>>())),
|
||||
Lens.fromSubscriptionRef(yield* SubscriptionRef.make<readonly StandardSchemaV1.Issue[]>(Array.empty())),
|
||||
Lens.fromSubscriptionRef(yield* SubscriptionRef.make(Option.none<Fiber.Fiber<A, Schema.SchemaError>>())),
|
||||
Lens.fromSubscriptionRef(yield* SubscriptionRef.make(false)),
|
||||
|
||||
yield* Semaphore.make(1),
|
||||
)
|
||||
})
|
||||
|
||||
export declare namespace service {
|
||||
export interface Options<in out A, in out I = A, in out R = never, in out TER = never, in out TEW = never, in out TRR = never, in out TRW = never>
|
||||
extends make.Options<A, I, R, TER, TEW, TRR, TRW> {}
|
||||
export interface Options<in out A, in out I = A, in out RD = never, in out RE = never, in out TER = never, in out TEW = never, in out TRR = never, in out TRW = never>
|
||||
extends make.Options<A, I, RD, RE, TER, TEW, TRR, TRW> {}
|
||||
}
|
||||
|
||||
export const service = <A, I = A, R = never, TER = never, TEW = never, TRR = never, TRW = never>(
|
||||
options: service.Options<A, I, R, TER, TEW, TRR, TRW>,
|
||||
export const service = <A, I = A, RD = never, RE = never, TER = never, TEW = never, TRR = never, TRW = never>(
|
||||
options: service.Options<A, I, RD, RE, TER, TEW, TRR, TRW>
|
||||
): Effect.Effect<
|
||||
SynchronizedForm<A, I, R, TER, TEW, TRR, TRW>,
|
||||
SchemaIssue.Issue | TER,
|
||||
Scope.Scope | R | TRR | TRW
|
||||
> => Effect.tap(make(options), form => Effect.asVoid(Effect.forkScoped(form.run)))
|
||||
SynchronizedForm<A, I, RD, RE, TER, TEW, TRR, TRW>,
|
||||
Schema.SchemaError | TER,
|
||||
Scope.Scope | RD | RE | TRR | TRW
|
||||
> => Effect.tap(
|
||||
make(options),
|
||||
form => Effect.forkScoped(form.run),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user