Compare commits

..

6 Commits

Author SHA1 Message Date
205b95ad7e Update dependency node to v24
Some checks failed
Lint / lint (push) Failing after 11s
Test build / test-build (pull_request) Failing after 12s
2025-10-29 14:34:08 +01:00
b9b9f37859 Update dependency @effect/language-service to ^0.49.0 (#20)
Some checks failed
Lint / lint (push) Failing after 11s
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [@effect/language-service](https://github.com/Effect-TS/language-service) | [`^0.48.0` -> `^0.49.0`](https://renovatebot.com/diffs/npm/@effect%2flanguage-service/0.48.0/0.49.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@effect%2flanguage-service/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@effect%2flanguage-service/0.48.0/0.49.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>Effect-TS/language-service (@&#8203;effect/language-service)</summary>

### [`v0.49.0`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0490)

[Compare Source](https://github.com/Effect-TS/language-service/compare/v0.48.0...v0.49.0)

##### Minor Changes

- [#&#8203;445](https://github.com/Effect-TS/language-service/pull/445) [`fe0e390`](fe0e390f02) Thanks [@&#8203;mattiamanzati](https://github.com/mattiamanzati)! - Use the Graph module for outline line graph and layer magic

##### Patch Changes

- [#&#8203;449](https://github.com/Effect-TS/language-service/pull/449) [`ff11b7d`](ff11b7da9b) Thanks [@&#8203;mattiamanzati](https://github.com/mattiamanzati)! - Update effect package version to [`97ff1dc`](https://github.com/Effect-TS/language-service/commit/97ff1dc). This version improves handling of special characters in layer graph mermaid diagrams by properly escaping HTML entities (parentheses, braces, quotes) to ensure correct rendering.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNjUuMiIsInVwZGF0ZWRJblZlciI6IjQxLjE2NS4yIiwidGFyZ2V0QnJhbmNoIjoibmV4dCIsImxhYmVscyI6W119-->

Reviewed-on: #20
Co-authored-by: Renovate Bot <renovate-bot@valverde.cloud>
Co-committed-by: Renovate Bot <renovate-bot@valverde.cloud>
2025-10-29 14:33:36 +01:00
Julien Valverdé
363c7d24f4 Fix forkEffectScoped
Some checks failed
Lint / lint (push) Failing after 11s
2025-10-29 14:32:45 +01:00
Julien Valverdé
d57654d872 Fix
All checks were successful
Lint / lint (push) Successful in 12s
2025-10-28 21:35:54 +01:00
Julien Valverdé
0b7d9383ec Fix
All checks were successful
Lint / lint (push) Successful in 13s
2025-10-28 21:16:11 +01:00
Julien Valverdé
c380fe9d08 Result work
All checks were successful
Lint / lint (push) Successful in 13s
2025-10-28 21:03:31 +01:00
3 changed files with 91 additions and 22 deletions

View File

@@ -5,7 +5,7 @@
"name": "@effect-fc/monorepo",
"devDependencies": {
"@biomejs/biome": "^2.2.5",
"@effect/language-service": "^0.48.0",
"@effect/language-service": "^0.49.0",
"@types/bun": "^1.2.23",
"npm-check-updates": "^19.0.0",
"npm-sort": "^0.0.4",
@@ -130,7 +130,7 @@
"@effect-fc/example": ["@effect-fc/example@workspace:packages/example"],
"@effect/language-service": ["@effect/language-service@0.48.0", "", { "bin": { "effect-language-service": "cli.js" } }, "sha512-u7DTPoGFFeDGSdomjY5C2nCGNWSisxpYSqHp3dlSG8kCZh5cay+166bveHRYvuJSJS5yomdkPTJwjwrqMmT7Og=="],
"@effect/language-service": ["@effect/language-service@0.49.0", "", { "bin": { "effect-language-service": "cli.js" } }, "sha512-m4HGX4XO+ZHN0LZPH+rCQw8iutiFpuPKRuoZCuiyisLoXDpiKHQsIIEUrccDFo4i17nNbrgFdUyqxBJr/eSdnw=="],
"@effect/platform": ["@effect/platform@0.92.1", "", { "dependencies": { "find-my-way-ts": "^0.1.6", "msgpackr": "^1.11.4", "multipasta": "^0.2.7" }, "peerDependencies": { "effect": "^3.18.1" } }, "sha512-XXWCBVwyhaKZISN7aM1fv/3fWDGyxr84ObywnUrL8aHvJLoIeskWFAP/fqw3c5MFCrJ3ZV97RWLbv6JiBQugdg=="],

View File

@@ -16,7 +16,7 @@
},
"devDependencies": {
"@biomejs/biome": "^2.2.5",
"@effect/language-service": "^0.48.0",
"@effect/language-service": "^0.49.0",
"@types/bun": "^1.2.23",
"npm-check-updates": "^19.0.0",
"npm-sort": "^0.0.4",

View File

@@ -1,4 +1,4 @@
import { Cause, Effect, Equal, Exit, Hash, Match, Option, Pipeable, Predicate, pipe, Queue, type Scope } from "effect"
import { Cause, Context, Data, Effect, Equal, Exit, Hash, Layer, Match, Option, Pipeable, Predicate, pipe, Queue, Ref, type Scope } from "effect"
export const ResultTypeId: unique symbol = Symbol.for("@effect-fc/Result/Result")
@@ -95,14 +95,9 @@ const ResultPrototype = Object.freeze({
} as const satisfies Result.Prototype)
export interface ProgressService<P = never> {
readonly update: (progress: P) => Effect.Effect<void>
}
export const isResult = (u: unknown): u is Result<unknown, unknown, unknown> => Predicate.hasProperty(u, ResultTypeId)
export const isInitial = (u: unknown): u is Initial => isResult(u) && u._tag === "Initial"
export const isRunning = (u: unknown): u is Running => isResult(u) && u._tag === "Running"
export const isRunning = (u: unknown): u is Running<unknown> => isResult(u) && u._tag === "Running"
export const isSuccess = (u: unknown): u is Success<unknown> => isResult(u) && u._tag === "Success"
export const isFailure = (u: unknown): u is Failure<unknown, unknown> => isResult(u) && u._tag === "Failure"
export const isRefreshing = (u: unknown): u is Refreshing<unknown> => isResult(u) && Predicate.hasProperty(u, "refreshing") && u.refreshing
@@ -110,6 +105,7 @@ export const isRefreshing = (u: unknown): u is Refreshing<unknown> => isResult(u
export const initial = (): Initial => Object.setPrototypeOf({ _tag: "Initial" }, ResultPrototype)
export const running = <P = never>(progress?: P): Running<P> => Object.setPrototypeOf({ _tag: "Running", progress }, ResultPrototype)
export const succeed = <A>(value: A): Success<A> => Object.setPrototypeOf({ _tag: "Success", value }, ResultPrototype)
export const fail = <E, A = never>(
cause: Cause.Cause<E>,
previousSuccess?: Success<A>,
@@ -126,7 +122,6 @@ export const refreshing = <R extends Success<any> | Failure<any, any>, P = never
Object.getPrototypeOf(result),
)
export const fromExit = <A, E>(
exit: Exit.Exit<A, E>
): Success<A> | Failure<A, E> => exit._tag === "Success"
@@ -146,15 +141,89 @@ export const toExit = <A, E, P>(
}
}
export const forkEffectScoped = <A, E, R>(
effect: Effect.Effect<A, E, R>
): Effect.Effect<Queue.Dequeue<Result<A, E>>, never, Scope.Scope | R> => Queue.unbounded<Result<A, E>>().pipe(
Effect.tap(Queue.offer(initial())),
Effect.tap(queue => Effect.forkScoped(Effect.addFinalizer(() => Queue.shutdown(queue)).pipe(
Effect.andThen(Queue.offer(queue, running())),
Effect.andThen(effect),
Effect.exit,
Effect.andThen(exit => Queue.offer(queue, fromExit(exit))),
Effect.scoped,
))),
export interface Progress<P = never> {
readonly update: <E, R>(
f: (previous: P) => Effect.Effect<P, E, R>
) => Effect.Effect<void, PreviousResultNotRunningOrRefreshing | E, R>
}
export class PreviousResultNotRunningOrRefreshing extends Data.TaggedError("@effect-fc/Result/PreviousResultNotRunningOrRefreshing")<{
readonly previous: Result<unknown, unknown, unknown>
}> {}
export const Progress = <P = never>(): Context.Tag<Progress<P>, Progress<P>> => Context.GenericTag("@effect-fc/Result/Progress")
export const makeProgressLayer = <A, E, P = never>(
queue: Queue.Enqueue<Result<A, E, P>>,
ref: Ref.Ref<Result<A, E, P>>,
): Layer.Layer<Progress<P>> => Layer.sync(Progress<P>(), () => ({
update: <E, R>(f: (previous: P) => Effect.Effect<P, E, R>) => Effect.Do.pipe(
Effect.bind("previous", () => Effect.andThen(
ref,
previous => isRunning(previous) || isRefreshing(previous)
? Effect.succeed(previous)
: Effect.fail(new PreviousResultNotRunningOrRefreshing({ previous })),
)),
Effect.bind("progress", ({ previous }) => f(previous.progress)),
Effect.let("next", ({ previous, progress }) => Object.setPrototypeOf(
Object.assign({}, previous, { progress }),
Object.getPrototypeOf(previous),
)),
Effect.tap(({ next }) => Ref.set(ref, next)),
Effect.tap(({ next }) => Queue.offer(queue, next)),
Effect.asVoid,
),
}))
export namespace forkEffectScoped {
export type ContextInput<R, P> = (R extends Progress<infer X>
? [X] extends [P]
? R
: never
: R
)
export interface Options<P = never> {
readonly initialProgress?: P
}
}
export const forkEffectScoped = <A, E, R, P = never>(
effect: Effect.Effect<A, E, forkEffectScoped.ContextInput<R, NoInfer<P>>>,
options?: forkEffectScoped.Options<P>,
): Effect.Effect<
Queue.Dequeue<Result<A, E, P>>,
never,
Scope.Scope | Exclude<R, Progress<any>>
> => Effect.Do.pipe(
Effect.bind("queue", () => Queue.unbounded<Result<A, E, P>>()),
Effect.bind("ref", () => Ref.make<Result<A, E, P>>(initial())),
Effect.tap(({ queue, ref }) => Effect.andThen(ref, v => Queue.offer(queue, v))),
Effect.tap(({ queue, ref }) => Effect.forkScoped(
Effect.addFinalizer(() => Queue.shutdown(queue)).pipe(
Effect.andThen(Effect.succeed(running(options?.initialProgress)).pipe(
Effect.tap(v => Ref.set(ref, v)),
Effect.tap(v => Queue.offer(queue, v)),
)),
Effect.andThen(effect),
Effect.exit,
Effect.andThen(exit => Effect.succeed(fromExit(exit)).pipe(
Effect.tap(v => Ref.set(ref, v)),
Effect.tap(v => Queue.offer(queue, v)),
)),
Effect.scoped,
Effect.provide(makeProgressLayer(queue, ref)),
)
)),
Effect.map(({ queue }) => queue),
)
const t = forkEffectScoped(
Effect.gen(function*() {
yield* Progress()
}),
{ initialProgress: "juif" }
)