From 8fdc7036a2c1d9beaa030971925cdd20c71fe810 Mon Sep 17 00:00:00 2001 From: Maxwell Brown Date: Wed, 17 Dec 2025 15:46:25 -0500 Subject: [PATCH] Un-nest the `/stm` modules (#845) --- bundle/stm.ts | 2 +- packages/effect/src/Effect.ts | 17 +-- packages/effect/src/Schema.ts | 7 +- packages/effect/src/{stm => }/TxChunk.ts | 86 ++++------- packages/effect/src/{stm => }/TxHashMap.ts | 143 +++++++----------- packages/effect/src/{stm => }/TxHashSet.ts | 93 +++++------- packages/effect/src/{stm => }/TxQueue.ts | 129 ++++++---------- packages/effect/src/{stm => }/TxRef.ts | 26 ++-- packages/effect/src/{stm => }/TxSemaphore.ts | 56 +++---- packages/effect/src/index.ts | 53 +++++++ packages/effect/src/stm/index.ts | 56 ------- packages/effect/src/stm/index.ts.tpl | 3 - .../test/{primitives => }/BigDecimal.test.ts | 0 .../test/{primitives => }/BigInt.test.ts | 2 +- .../test/{primitives => }/Boolean.test.ts | 2 +- .../effect/test/{config => }/Config.test.ts | 0 .../test/{config => }/ConfigProvider.test.ts | 0 packages/effect/test/Effect.test.ts | 20 ++- .../test/{primitives => }/Number.test.ts | 2 +- .../test/{batching => }/Request.test.ts | 0 .../test/{primitives => }/String.test.ts | 2 +- packages/effect/test/TxChunk.test.ts | 3 +- packages/effect/test/TxHashMap.test.ts | 4 +- packages/effect/test/TxHashSet.test.ts | 4 +- packages/effect/test/TxQueue.test.ts | 5 +- packages/effect/test/TxSemaphore.test.ts | 5 +- packages/effect/test/http/Multipart.test.ts | 39 ----- .../{ => unstable}/http/HttpEffect.test.ts | 0 .../test/unstable/http/Multipart.test.ts | 35 ++++- .../persistence/PersistedCache.test.ts | 0 .../persistence/PersistedCacheTest.ts | 0 .../persistence/PersistedQueue.test.ts | 0 .../persistence/PersistedQueueTest.ts | 0 .../persistence/RateLimiter.test.ts | 0 packages/platform-node/test/NodeRedis.test.ts | 12 +- packages/sql/mysql2/test/Persistence.test.ts | 8 +- packages/sql/pg/test/Persistence.test.ts | 12 +- 37 files changed, 331 insertions(+), 495 deletions(-) rename packages/effect/src/{stm => }/TxChunk.ts (90%) rename packages/effect/src/{stm => }/TxHashMap.ts (94%) rename packages/effect/src/{stm => }/TxHashSet.ts (91%) rename packages/effect/src/{stm => }/TxQueue.ts (93%) rename packages/effect/src/{stm => }/TxRef.ts (90%) rename packages/effect/src/{stm => }/TxSemaphore.ts (91%) delete mode 100644 packages/effect/src/stm/index.ts delete mode 100644 packages/effect/src/stm/index.ts.tpl rename packages/effect/test/{primitives => }/BigDecimal.test.ts (100%) rename packages/effect/test/{primitives => }/BigInt.test.ts (94%) rename packages/effect/test/{primitives => }/Boolean.test.ts (96%) rename packages/effect/test/{config => }/Config.test.ts (100%) rename packages/effect/test/{config => }/ConfigProvider.test.ts (100%) rename packages/effect/test/{primitives => }/Number.test.ts (95%) rename packages/effect/test/{batching => }/Request.test.ts (100%) rename packages/effect/test/{primitives => }/String.test.ts (88%) delete mode 100644 packages/effect/test/http/Multipart.test.ts rename packages/effect/test/{ => unstable}/http/HttpEffect.test.ts (100%) rename packages/effect/test/{ => unstable}/persistence/PersistedCache.test.ts (100%) rename packages/effect/test/{ => unstable}/persistence/PersistedCacheTest.ts (100%) rename packages/effect/test/{ => unstable}/persistence/PersistedQueue.test.ts (100%) rename packages/effect/test/{ => unstable}/persistence/PersistedQueueTest.ts (100%) rename packages/effect/test/{ => unstable}/persistence/RateLimiter.test.ts (100%) diff --git a/bundle/stm.ts b/bundle/stm.ts index 98517100e8..4fe886643a 100644 --- a/bundle/stm.ts +++ b/bundle/stm.ts @@ -1,5 +1,5 @@ import * as Effect from "#dist/effect/Effect" -import * as TxRef from "#dist/effect/stm/TxRef" +import * as TxRef from "#dist/effect/TxRef" const program = Effect.gen(function*() { const ref = yield* TxRef.make(0) diff --git a/packages/effect/src/Effect.ts b/packages/effect/src/Effect.ts index 5902686caf..cad39ea43a 100644 --- a/packages/effect/src/Effect.ts +++ b/packages/effect/src/Effect.ts @@ -97,7 +97,6 @@ import type { Schedule } from "./Schedule.ts" import type { Scheduler } from "./Scheduler.ts" import type { Scope } from "./Scope.ts" import * as ServiceMap from "./ServiceMap.ts" -import type { TxRef } from "./stm/TxRef.ts" import type { AnySpan, ParentSpan, @@ -108,6 +107,7 @@ import type { TraceOptions, Tracer } from "./Tracer.ts" +import type { TxRef } from "./TxRef.ts" import type { Concurrency, Covariant, ExcludeTag, ExtractTag, NoInfer, NotFunction, Tags, unassigned } from "./Types.ts" import type * as Unify from "./Unify.ts" import { internalCall, SingleShotGen } from "./Utils.ts" @@ -10826,8 +10826,7 @@ export class Transaction extends ServiceMap.Service< * * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.gen(function*() { * const ref1 = yield* TxRef.make(0) @@ -10858,8 +10857,7 @@ export const atomic = ( * * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.atomicWith((txState) => * Effect.gen(function*() { @@ -10918,8 +10916,7 @@ export const atomicWith = ( * * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.gen(function*() { * const ref1 = yield* TxRef.make(0) @@ -10961,8 +10958,7 @@ export const transaction = ( * * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.transactionWith((txState) => * Effect.gen(function*() { @@ -11086,8 +11082,7 @@ function clearTransaction(state: Transaction["Service"]) { * @example * * ```ts - * import { Effect } from "effect" - * import * as TxRef from "effect/stm/TxRef" + * import { Effect, TxRef } from "effect" * * const program = Effect.gen(function*() { * // create a transactional reference diff --git a/packages/effect/src/Schema.ts b/packages/effect/src/Schema.ts index c01c39b6f9..577b942a44 100644 --- a/packages/effect/src/Schema.ts +++ b/packages/effect/src/Schema.ts @@ -1672,8 +1672,7 @@ interface fieldsAssign extends Lambda { * **Example** (Adding fields to a union of structs) * * ```ts - * import { Tuple } from "effect" - * import { Schema } from "effect" + * import { Schema, Tuple } from "effect" * * // Add a new field to all members of a union of structs * const schema = Schema.Union([ @@ -2845,7 +2844,7 @@ export interface compose extends decodeTo(initial: Chunk.Chunk): Effect.Effect> => * @category Constructors * @example * ```ts - * import { Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * // Create an empty TxChunk @@ -156,8 +153,7 @@ export const empty = (): Effect.Effect> => * @category Constructors * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * // Create TxChunk from array @@ -191,8 +187,7 @@ export const fromIterable = (iterable: Iterable): Effect.Effect * * @example * ```ts - * import { Chunk } from "effect" - * import { TxChunk, TxRef } from "effect/stm" + * import { Chunk, TxChunk, TxRef } from "effect" * * // Create a TxChunk from an existing TxRef (advanced usage) * const ref = TxRef.makeUnsafe(Chunk.fromIterable([1, 2, 3])) @@ -219,8 +214,7 @@ export const makeUnsafe = (ref: TxRef.TxRef>): TxChunk => { * @category Combinators * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3]) @@ -262,8 +256,7 @@ export const modify: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3]) @@ -294,8 +287,7 @@ export const update: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3]) @@ -323,8 +315,7 @@ export const get = (self: TxChunk): Effect.Effect> => TxRef * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3]) @@ -354,8 +345,7 @@ export const set: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3]) @@ -387,8 +377,7 @@ export const append: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([2, 3, 4]) @@ -417,8 +406,7 @@ export const prepend: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3, 4, 5]) @@ -445,8 +433,7 @@ export const size = (self: TxChunk): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const emptyChunk = yield* TxChunk.empty() @@ -472,8 +459,7 @@ export const isEmpty = (self: TxChunk): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const emptyChunk = yield* TxChunk.empty() @@ -502,8 +488,7 @@ export const isNonEmpty = (self: TxChunk): Effect.Effect => * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3, 4, 5]) @@ -532,8 +517,7 @@ export const take: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3, 4, 5]) @@ -562,8 +546,7 @@ export const drop: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3, 4, 5, 6, 7]) @@ -597,8 +580,7 @@ export const slice: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3, 4]) @@ -631,8 +613,7 @@ export const map: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3, 4, 5, 6]) @@ -668,8 +649,7 @@ export const filter: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([1, 2, 3]) @@ -704,8 +684,7 @@ export const appendAll: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk = yield* TxChunk.fromIterable([4, 5, 6]) @@ -742,8 +721,7 @@ export const prependAll: { * @category Combinators * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxChunk } from "effect/stm" + * import { Chunk, Effect, TxChunk } from "effect" * * const program = Effect.gen(function*() { * const txChunk1 = yield* TxChunk.fromIterable([1, 2, 3]) diff --git a/packages/effect/src/stm/TxHashMap.ts b/packages/effect/src/TxHashMap.ts similarity index 94% rename from packages/effect/src/stm/TxHashMap.ts rename to packages/effect/src/TxHashMap.ts index 40f2f3198a..646cd56993 100644 --- a/packages/effect/src/stm/TxHashMap.ts +++ b/packages/effect/src/TxHashMap.ts @@ -2,16 +2,16 @@ * @since 2.0.0 */ -import * as Effect from "../Effect.ts" -import { format } from "../Formatter.ts" -import { dual } from "../Function.ts" -import * as HashMap from "../HashMap.ts" -import type { Inspectable } from "../Inspectable.ts" -import { NodeInspectSymbol, toJson } from "../Inspectable.ts" -import * as Option from "../Option.ts" -import type { Pipeable } from "../Pipeable.ts" -import { pipeArguments } from "../Pipeable.ts" -import * as TxRef from "../stm/TxRef.ts" +import * as Effect from "./Effect.ts" +import { format } from "./Formatter.ts" +import { dual } from "./Function.ts" +import * as HashMap from "./HashMap.ts" +import type { Inspectable } from "./Inspectable.ts" +import { NodeInspectSymbol, toJson } from "./Inspectable.ts" +import * as Option from "./Option.ts" +import type { Pipeable } from "./Pipeable.ts" +import { pipeArguments } from "./Pipeable.ts" +import * as TxRef from "./TxRef.ts" const TypeId = "~effect/transactions/TxHashMap" @@ -41,8 +41,7 @@ const TxHashMapProto = { * * @example * ```ts - * import { Effect, Option } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, Option, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a transactional hash map @@ -83,8 +82,7 @@ export interface TxHashMap extends Inspectable, Pipeable { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a transactional inventory map @@ -119,8 +117,7 @@ export declare namespace TxHashMap { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a user map to extract key type from @@ -148,8 +145,7 @@ export declare namespace TxHashMap { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a product catalog TxHashMap @@ -181,8 +177,7 @@ export declare namespace TxHashMap { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a configuration TxHashMap @@ -218,8 +213,7 @@ export declare namespace TxHashMap { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create an empty transactional hash map @@ -253,8 +247,7 @@ export const empty = (): Effect.Effect> => * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a user directory @@ -292,8 +285,7 @@ export const make = (...entries: Array): Effect.Effect(entries: Iterable): Effect.E * * @example * ```ts - * import { Effect, Option } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, Option, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const userMap = yield* TxHashMap.make( @@ -381,8 +372,7 @@ export const get: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const inventory = yield* TxHashMap.make( @@ -422,8 +412,7 @@ export const set: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const permissions = yield* TxHashMap.make( @@ -468,8 +457,7 @@ export const has: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const cache = yield* TxHashMap.make( @@ -524,8 +512,7 @@ export const remove: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const sessionMap = yield* TxHashMap.make( @@ -560,8 +547,7 @@ export const clear = (self: TxHashMap): Effect.Effect => TxRef * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const metrics = yield* TxHashMap.make( @@ -599,8 +585,7 @@ export const size = (self: TxHashMap): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Start with empty map @@ -634,8 +619,7 @@ export const isEmpty = (self: TxHashMap): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const inventory = yield* TxHashMap.make(["laptop", 5]) @@ -664,8 +648,7 @@ export const isNonEmpty = (self: TxHashMap): Effect.Effect * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const counters = yield* TxHashMap.make( @@ -729,8 +712,7 @@ export const modify: { * * @example * ```ts - * import { Effect, Option } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, Option, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const storage = yield* TxHashMap.make([ @@ -790,8 +772,7 @@ export const modifyAt: { * * @example * ```ts - * import { Effect, Option } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, Option, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const userRoles = yield* TxHashMap.make( @@ -827,8 +808,7 @@ export const keys = (self: TxHashMap): Effect.Effect> => * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const scores = yield* TxHashMap.make( @@ -865,8 +845,7 @@ export const values = (self: TxHashMap): Effect.Effect> => * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const config = yield* TxHashMap.make( @@ -903,8 +882,7 @@ export const entries = (self: TxHashMap): Effect.Effect(self: TxHashMap): Effect.Effect(value: unknown): value is TxHashMap => { * * @example * ```ts - * import { Effect, Hash } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, Hash, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a cache with user sessions @@ -1201,8 +1174,7 @@ export const getHash: { * * @example * ```ts - * import { Effect, Hash } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, Hash, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create an access control map @@ -1258,8 +1230,7 @@ export const hasHash: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a user profile map @@ -1319,8 +1290,7 @@ export const map: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a product inventory @@ -1388,8 +1358,7 @@ export const filter: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a sales data map @@ -1455,8 +1424,7 @@ export const reduce: { * * @example * ```ts - * import { Effect, Option } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, Option, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a mixed data map @@ -1524,8 +1492,7 @@ export const filterMap: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a user status map @@ -1575,8 +1542,7 @@ export const hasBy: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a task priority map @@ -1626,8 +1592,7 @@ export const findFirst: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a product inventory @@ -1676,8 +1641,7 @@ export const some: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a user permissions map @@ -1727,8 +1691,7 @@ export const every: { * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Console, Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a log processing map @@ -1785,8 +1748,7 @@ export const forEach: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a department-employee map @@ -1867,8 +1829,7 @@ export const flatMap: { * * @example * ```ts - * import { Effect, Option } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, Option, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * // Create a map with optional user data @@ -1920,8 +1881,7 @@ export const compact = (self: TxHashMap>): Effect.Effe * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashMap } from "effect/stm" + * import { Effect, TxHashMap } from "effect" * * const program = Effect.gen(function*() { * const settings = yield* TxHashMap.make( @@ -1957,8 +1917,7 @@ export const toEntries = (self: TxHashMap): Effect.Effect extends Inspectable, Pipeable { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * // Create a transactional color set @@ -120,7 +118,7 @@ export declare namespace TxHashSet { /** * @example * ```ts - * import { TxHashSet } from "effect/stm" + * import { TxHashSet } from "effect" * * const fruits = TxHashSet.make("apple", "banana", "cherry") * @@ -149,8 +147,7 @@ const makeTxHashSet = (ref: TxRef.TxRef>): TxHashSet => * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const txSet = yield* TxHashSet.empty() @@ -179,8 +176,7 @@ export const empty = (): Effect.Effect> => * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const fruits = yield* TxHashSet.make("apple", "banana", "cherry") @@ -211,8 +207,7 @@ export const make = >( * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const fromArray = yield* TxHashSet.fromIterable(["a", "b", "c", "b", "a"]) @@ -242,9 +237,8 @@ export const fromIterable = (values: Iterable): Effect.Effect * * @example * ```ts - * import { Effect } from "effect" + * import { Effect, TxHashSet } from "effect" * import * as HashSet from "effect/HashSet" - * import { TxHashSet } from "effect/stm" * * const program = Effect.gen(function*() { * const hashSet = HashSet.make("x", "y", "z") @@ -274,9 +268,8 @@ export const fromHashSet = (hashSet: HashSet.HashSet): Effect.Effect => typeof u === * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const txSet = yield* TxHashSet.make("a", "b") @@ -338,8 +330,7 @@ export const add: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const txSet = yield* TxHashSet.make("a", "b", "c") @@ -381,8 +372,7 @@ export const remove: { * * @example * ```ts - * import { Effect, Equal, Hash } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, Equal, Hash, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const txSet = yield* TxHashSet.make("apple", "banana", "cherry") @@ -428,8 +418,7 @@ export const has: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const empty = yield* TxHashSet.empty() @@ -457,8 +446,7 @@ export const size = (self: TxHashSet): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const empty = yield* TxHashSet.empty() @@ -486,8 +474,7 @@ export const isEmpty = (self: TxHashSet): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const txSet = yield* TxHashSet.make("a", "b", "c") @@ -509,8 +496,7 @@ export const clear = (self: TxHashSet): Effect.Effect => TxRef.set(s * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const set1 = yield* TxHashSet.make("a", "b") @@ -547,8 +533,7 @@ export const union: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const set1 = yield* TxHashSet.make("a", "b", "c") @@ -585,8 +570,7 @@ export const intersection: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const set1 = yield* TxHashSet.make("a", "b", "c") @@ -623,8 +607,7 @@ export const difference: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const small = yield* TxHashSet.make("a", "b") @@ -661,8 +644,7 @@ export const isSubset: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const numbers = yield* TxHashSet.make(1, 2, 3, 4, 5) @@ -695,8 +677,7 @@ export const some: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const numbers = yield* TxHashSet.make(2, 4, 6, 8) @@ -729,8 +710,7 @@ export const every: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const numbers = yield* TxHashSet.make(1, 2, 3) @@ -771,8 +751,7 @@ export const map: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const numbers = yield* TxHashSet.make(1, 2, 3, 4, 5, 6) @@ -815,8 +794,7 @@ export const filter: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxHashSet } from "effect/stm" + * import { Effect, TxHashSet } from "effect" * * const program = Effect.gen(function*() { * const numbers = yield* TxHashSet.make(1, 2, 3, 4, 5) @@ -850,9 +828,8 @@ export const reduce: { * * @example * ```ts - * import { Effect } from "effect" + * import { Effect, TxHashSet } from "effect" * import * as HashSet from "effect/HashSet" - * import { TxHashSet } from "effect/stm" * * const program = Effect.gen(function*() { * const txSet = yield* TxHashSet.make("x", "y", "z") diff --git a/packages/effect/src/stm/TxQueue.ts b/packages/effect/src/TxQueue.ts similarity index 93% rename from packages/effect/src/stm/TxQueue.ts rename to packages/effect/src/TxQueue.ts index 4fd8c4d293..faafe35179 100644 --- a/packages/effect/src/stm/TxQueue.ts +++ b/packages/effect/src/TxQueue.ts @@ -9,17 +9,17 @@ * * @since 4.0.0 */ -import * as Cause from "../Cause.ts" -import * as Chunk from "../Chunk.ts" -import * as Effect from "../Effect.ts" -import { dual } from "../Function.ts" -import type { Inspectable } from "../Inspectable.ts" -import { NodeInspectSymbol, toJson } from "../Inspectable.ts" -import * as Option from "../Option.ts" -import { hasProperty } from "../Predicate.ts" -import * as TxChunk from "../stm/TxChunk.ts" -import * as TxRef from "../stm/TxRef.ts" -import type * as Types from "../Types.ts" +import * as Cause from "./Cause.ts" +import * as Chunk from "./Chunk.ts" +import * as Effect from "./Effect.ts" +import { dual } from "./Function.ts" +import type { Inspectable } from "./Inspectable.ts" +import { NodeInspectSymbol, toJson } from "./Inspectable.ts" +import * as Option from "./Option.ts" +import { hasProperty } from "./Predicate.ts" +import * as TxChunk from "./TxChunk.ts" +import * as TxRef from "./TxRef.ts" +import type * as Types from "./Types.ts" /** * Represents the state of a transactional queue with sophisticated lifecycle management. @@ -31,7 +31,7 @@ import type * as Types from "../Types.ts" * * @example * ```ts - * import type { TxQueue } from "effect/stm" + * import type { TxQueue } from "effect" * * // State progression example * declare const state: TxQueue.State @@ -70,7 +70,7 @@ const TypeId = "~effect/transactions/TxQueue" * * @example * ```ts - * import type { TxQueue } from "effect/stm" + * import type { TxQueue } from "effect" * * // Use variance types for type-level operations * declare const variance: TxQueue.TxEnqueue.Variance @@ -85,7 +85,7 @@ export declare namespace TxEnqueue { * * @example * ```ts - * import type { TxQueue } from "effect/stm" + * import type { TxQueue } from "effect" * * // Demonstrates contravariant type behavior for both A and E * declare const variance: TxQueue.TxEnqueue.Variance @@ -105,7 +105,7 @@ export declare namespace TxEnqueue { * * @example * ```ts - * import type { TxQueue } from "effect/stm" + * import type { TxQueue } from "effect" * * // Use variance types for type-level operations * declare const variance: TxQueue.TxDequeue.Variance @@ -120,7 +120,7 @@ export declare namespace TxDequeue { * * @example * ```ts - * import type { TxQueue } from "effect/stm" + * import type { TxQueue } from "effect" * * // Demonstrates covariant type behavior for both A and E * declare const variance: TxQueue.TxDequeue.Variance @@ -140,7 +140,7 @@ export declare namespace TxDequeue { * * @example * ```ts - * import type { TxQueue } from "effect/stm" + * import type { TxQueue } from "effect" * * // Use variance types for type-level operations * declare const variance: TxQueue.TxQueue.Variance @@ -155,7 +155,7 @@ export declare namespace TxQueue { * * @example * ```ts - * import type { TxQueue } from "effect/stm" + * import type { TxQueue } from "effect" * * // Demonstrates invariant type behavior for both A and E * declare const variance: TxQueue.TxQueue.Variance @@ -192,8 +192,7 @@ export interface TxQueueState extends Inspectable { * @example * ```ts * import type { Cause } from "effect" - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * // Queue without error channel @@ -228,8 +227,7 @@ export interface TxEnqueue extends TxQueueState { * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * // Queue without error channel @@ -260,8 +258,7 @@ export interface TxDequeue extends TxQueueState { * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * // Create a bounded transactional queue (E defaults to never) @@ -293,7 +290,7 @@ export interface TxQueue extends TxEnqueue, Tx * * @example * ```ts - * import { TxQueue } from "effect/stm" + * import { TxQueue } from "effect" * * declare const someValue: unknown * @@ -313,7 +310,7 @@ export const isTxEnqueue = (u: unknown): u is TxEnqueu * * @example * ```ts - * import { TxQueue } from "effect/stm" + * import { TxQueue } from "effect" * * declare const someValue: unknown * @@ -333,7 +330,7 @@ export const isTxDequeue = (u: unknown): u is TxDequeu * * @example * ```ts - * import { TxQueue } from "effect/stm" + * import { TxQueue } from "effect" * * declare const someValue: unknown * @@ -383,8 +380,7 @@ const TxQueueProto = { * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * // Create a bounded queue (E defaults to never) @@ -426,8 +422,7 @@ export const bounded = (capacity: number): Effect.Effect(): Effect.Effect> * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * // Create a dropping queue with capacity 2 @@ -510,8 +504,7 @@ export const dropping = (capacity: number): Effect.Effect< * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * // Create a sliding queue with capacity 2 @@ -557,8 +550,7 @@ export const sliding = (capacity: number): Effect.Effect(10) @@ -621,8 +613,7 @@ export const offer: { * * @example * ```ts - * import { Chunk, Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Chunk, Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -666,8 +657,7 @@ export const offerAll: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -725,8 +715,7 @@ export const take = (self: TxDequeue): Effect.Effect => * * @example * ```ts - * import { Effect, Option } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, Option, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -774,8 +763,7 @@ export const poll = (self: TxDequeue): Effect.Effect(10) @@ -848,8 +836,7 @@ export const takeAll = (self: TxDequeue): Effect.Effect(5) @@ -935,8 +922,7 @@ export const takeN: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1022,8 +1008,7 @@ export const takeBetween: { * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1075,8 +1060,7 @@ export const peek = (self: TxDequeue): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1097,8 +1081,7 @@ export const size = (self: TxQueueState): Effect.Effect => TxChunk.size( * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1122,8 +1105,7 @@ export const isEmpty = (self: TxQueueState): Effect.Effect => TxChunk.i * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(2) @@ -1157,8 +1139,7 @@ export const isFull = (self: TxQueueState): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1184,8 +1165,7 @@ export const interrupt = (self: TxEnqueue): Effect.Effect = * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1227,8 +1207,7 @@ export const fail: { * * @example * ```ts - * import { Cause, Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Cause, Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1278,8 +1257,7 @@ export const failCause: { * * @example * ```ts - * import { Cause, Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Cause, Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1313,8 +1291,7 @@ export const end = (self: TxEnqueue): Eff * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1346,8 +1323,7 @@ export const clear = (self: TxEnqueue): Effect.Effect => TxChu * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1382,8 +1358,7 @@ export const shutdown = (self: TxEnqueue): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1411,8 +1386,7 @@ export const isOpen = (self: TxQueueState): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1441,8 +1415,7 @@ export const isClosing = (self: TxQueueState): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1470,8 +1443,7 @@ export const isDone = (self: TxQueueState): Effect.Effect => * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) @@ -1495,8 +1467,7 @@ export const isShutdown = (self: TxQueueState): Effect.Effect => isDone * * @example * ```ts - * import { Effect } from "effect" - * import { TxQueue } from "effect/stm" + * import { Effect, TxQueue } from "effect" * * const program = Effect.gen(function*() { * const queue = yield* TxQueue.bounded(10) diff --git a/packages/effect/src/stm/TxRef.ts b/packages/effect/src/TxRef.ts similarity index 90% rename from packages/effect/src/stm/TxRef.ts rename to packages/effect/src/TxRef.ts index a1823c39a9..345c184d54 100644 --- a/packages/effect/src/stm/TxRef.ts +++ b/packages/effect/src/TxRef.ts @@ -8,9 +8,9 @@ * * @since 4.0.0 */ -import * as Effect from "../Effect.ts" -import { dual } from "../Function.ts" -import type { NoInfer } from "../Types.ts" +import * as Effect from "./Effect.ts" +import { dual } from "./Function.ts" +import type { NoInfer } from "./Types.ts" const TypeId = "~effect/transactions/TxRef" @@ -26,8 +26,7 @@ const TypeId = "~effect/transactions/TxRef" * @category Models * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.gen(function*() { * // Create a transactional reference @@ -59,8 +58,7 @@ export interface TxRef { * @category Constructors * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.gen(function*() { * // Create a transactional reference with initial value @@ -87,7 +85,7 @@ export const make = (initial: A) => Effect.sync(() => makeUnsafe(initial)) * @category Constructors * @example * ```ts - * import { TxRef } from "effect/stm" + * import { TxRef } from "effect" * * // Create a TxRef synchronously (unsafe - use make instead in Effect contexts) * const counter = TxRef.makeUnsafe(0) @@ -112,8 +110,7 @@ export const makeUnsafe = (initial: A): TxRef => ({ * @category Combinators * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.gen(function*() { * const counter = yield* TxRef.make(0) @@ -154,8 +151,7 @@ export const modify: { * @category Combinators * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.gen(function*() { * const counter = yield* TxRef.make(10) @@ -184,8 +180,7 @@ export const update: { * @category Combinators * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.gen(function*() { * const counter = yield* TxRef.make(42) @@ -208,8 +203,7 @@ export const get = (self: TxRef): Effect.Effect => modify(self, (curren * @category Combinators * @example * ```ts - * import { Effect } from "effect" - * import { TxRef } from "effect/stm" + * import { Effect, TxRef } from "effect" * * const program = Effect.gen(function*() { * const counter = yield* TxRef.make(0) diff --git a/packages/effect/src/stm/TxSemaphore.ts b/packages/effect/src/TxSemaphore.ts similarity index 91% rename from packages/effect/src/stm/TxSemaphore.ts rename to packages/effect/src/TxSemaphore.ts index 15a4ad61b3..890c802af8 100644 --- a/packages/effect/src/stm/TxSemaphore.ts +++ b/packages/effect/src/TxSemaphore.ts @@ -2,13 +2,13 @@ * @since 4.0.0 */ -import * as Effect from "../Effect.ts" -import type { Inspectable } from "../Inspectable.ts" -import { NodeInspectSymbol, toJson } from "../Inspectable.ts" -import type { Pipeable } from "../Pipeable.ts" -import { pipeArguments } from "../Pipeable.ts" -import type * as Scope from "../Scope.ts" -import * as TxRef from "../stm/TxRef.ts" +import * as Effect from "./Effect.ts" +import type { Inspectable } from "./Inspectable.ts" +import { NodeInspectSymbol, toJson } from "./Inspectable.ts" +import type { Pipeable } from "./Pipeable.ts" +import { pipeArguments } from "./Pipeable.ts" +import type * as Scope from "./Scope.ts" +import * as TxRef from "./TxRef.ts" const TypeId = "~effect/transactions/TxSemaphore" @@ -20,8 +20,7 @@ const TypeId = "~effect/transactions/TxSemaphore" * * @example * ```ts - * import { Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Effect, TxSemaphore } from "effect" * * // Create a semaphore with 3 permits for managing concurrent database connections * const program = Effect.gen(function*() { @@ -76,8 +75,7 @@ const makeTxSemaphore = (permitsRef: TxRef.TxRef, capacity: number): TxS * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * // Create a semaphore for managing concurrent access to a resource pool * const program = Effect.gen(function*() { @@ -117,8 +115,7 @@ export const make = (permits: number): Effect.Effect => * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(5) @@ -150,8 +147,7 @@ export const available = (self: TxSemaphore): Effect.Effect => TxRef.get * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(10) @@ -180,8 +176,7 @@ export const capacity = (self: TxSemaphore): Effect.Effect => Effect.suc * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(2) @@ -222,8 +217,7 @@ export const acquire = (self: TxSemaphore): Effect.Effect => * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(5) @@ -265,8 +259,7 @@ export const acquireN = (self: TxSemaphore, n: number): Effect.Effect => { * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(1) @@ -301,8 +294,7 @@ export const tryAcquire = (self: TxSemaphore): Effect.Effect => * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(3) @@ -341,8 +333,7 @@ export const tryAcquireN = (self: TxSemaphore, n: number): Effect.Effect => * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(5) @@ -418,8 +408,7 @@ export const releaseN = (self: TxSemaphore, n: number): Effect.Effect => { * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(2) @@ -467,8 +456,7 @@ export const withPermit = ( * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(5) @@ -518,8 +506,7 @@ export const withPermits = ( * * @example * ```ts - * import { Console, Effect } from "effect" - * import { TxSemaphore } from "effect/stm" + * import { Console, Effect, TxSemaphore } from "effect" * * const program = Effect.gen(function*() { * const semaphore = yield* TxSemaphore.make(3) @@ -559,8 +546,7 @@ export const withPermitScoped = (self: TxSemaphore): Effect.Effect>` internally to ensure all operations + * are performed atomically within transactions. + * + * Accessed values are tracked by the transaction in order to detect conflicts and to track changes. + * A transaction will retry whenever a conflict is detected or whenever the transaction explicitly + * calls `Effect.retryTransaction` and any of the accessed TxChunk values change. + * + * @since 4.0.0 + */ +export * as TxChunk from "./TxChunk.ts" + +/** + * @since 2.0.0 + */ +export * as TxHashMap from "./TxHashMap.ts" + +/** + * @since 2.0.0 + */ +export * as TxHashSet from "./TxHashSet.ts" + +/** + * TxQueue is a transactional queue data structure that provides Software Transactional Memory (STM) + * semantics for queue operations. It uses TxRef for transactional state management and supports + * multiple queue strategies: bounded, unbounded, dropping, and sliding. + * + * Accessed values are tracked by the transaction in order to detect conflicts and to track changes. + * A transaction will retry whenever a conflict is detected or whenever the transaction explicitly + * calls `Effect.retryTransaction` and any of the accessed TxQueue values change. + * + * @since 4.0.0 + */ +export * as TxQueue from "./TxQueue.ts" + +/** + * TxRef is a transactional value, it can be read and modified within the body of a transaction. + * + * Accessed values are tracked by the transaction in order to detect conflicts and in order to + * track changes, a transaction will retry whenever a conflict is detected or whenever the + * transaction explicitely calls to `Effect.retryTransaction` and any of the accessed TxRef values + * change. + * + * @since 4.0.0 + */ +export * as TxRef from "./TxRef.ts" + +/** + * @since 4.0.0 + */ +export * as TxSemaphore from "./TxSemaphore.ts" + /** * A collection of types that are commonly used types. * diff --git a/packages/effect/src/stm/index.ts b/packages/effect/src/stm/index.ts deleted file mode 100644 index f2b9c221c6..0000000000 --- a/packages/effect/src/stm/index.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @since 4.0.0 - */ - -/** - * TxChunk is a transactional chunk data structure that provides Software Transactional Memory (STM) - * semantics for chunk operations. It uses a `TxRef>` internally to ensure all operations - * are performed atomically within transactions. - * - * Accessed values are tracked by the transaction in order to detect conflicts and to track changes. - * A transaction will retry whenever a conflict is detected or whenever the transaction explicitly - * calls `Effect.retryTransaction` and any of the accessed TxChunk values change. - * - * @since 4.0.0 - */ -export * as TxChunk from "./TxChunk.ts" - -/** - * @since 2.0.0 - */ -export * as TxHashMap from "./TxHashMap.ts" - -/** - * @since 2.0.0 - */ -export * as TxHashSet from "./TxHashSet.ts" - -/** - * TxQueue is a transactional queue data structure that provides Software Transactional Memory (STM) - * semantics for queue operations. It uses TxRef for transactional state management and supports - * multiple queue strategies: bounded, unbounded, dropping, and sliding. - * - * Accessed values are tracked by the transaction in order to detect conflicts and to track changes. - * A transaction will retry whenever a conflict is detected or whenever the transaction explicitly - * calls `Effect.retryTransaction` and any of the accessed TxQueue values change. - * - * @since 4.0.0 - */ -export * as TxQueue from "./TxQueue.ts" - -/** - * TxRef is a transactional value, it can be read and modified within the body of a transaction. - * - * Accessed values are tracked by the transaction in order to detect conflicts and in order to - * track changes, a transaction will retry whenever a conflict is detected or whenever the - * transaction explicitely calls to `Effect.retryTransaction` and any of the accessed TxRef values - * change. - * - * @since 4.0.0 - */ -export * as TxRef from "./TxRef.ts" - -/** - * @since 4.0.0 - */ -export * as TxSemaphore from "./TxSemaphore.ts" diff --git a/packages/effect/src/stm/index.ts.tpl b/packages/effect/src/stm/index.ts.tpl deleted file mode 100644 index c2aac82f76..0000000000 --- a/packages/effect/src/stm/index.ts.tpl +++ /dev/null @@ -1,3 +0,0 @@ -/** - * @since 4.0.0 - */ diff --git a/packages/effect/test/primitives/BigDecimal.test.ts b/packages/effect/test/BigDecimal.test.ts similarity index 100% rename from packages/effect/test/primitives/BigDecimal.test.ts rename to packages/effect/test/BigDecimal.test.ts diff --git a/packages/effect/test/primitives/BigInt.test.ts b/packages/effect/test/BigInt.test.ts similarity index 94% rename from packages/effect/test/primitives/BigInt.test.ts rename to packages/effect/test/BigInt.test.ts index d1666088d4..8853312b69 100644 --- a/packages/effect/test/primitives/BigInt.test.ts +++ b/packages/effect/test/BigInt.test.ts @@ -1,6 +1,6 @@ import * as BigInt from "effect/BigInt" import { describe, it } from "vitest" -import { strictEqual } from "../utils/assert.ts" +import { strictEqual } from "./utils/assert.ts" describe("BigInt", () => { it("ReducerSum", () => { diff --git a/packages/effect/test/primitives/Boolean.test.ts b/packages/effect/test/Boolean.test.ts similarity index 96% rename from packages/effect/test/primitives/Boolean.test.ts rename to packages/effect/test/Boolean.test.ts index 98a91efdfe..2e0faf8a22 100644 --- a/packages/effect/test/primitives/Boolean.test.ts +++ b/packages/effect/test/Boolean.test.ts @@ -1,6 +1,6 @@ import * as Boolean from "effect/Boolean" import { describe, it } from "vitest" -import { strictEqual } from "../utils/assert.ts" +import { strictEqual } from "./utils/assert.ts" describe("Boolean", () => { it("ReducerAnd", () => { diff --git a/packages/effect/test/config/Config.test.ts b/packages/effect/test/Config.test.ts similarity index 100% rename from packages/effect/test/config/Config.test.ts rename to packages/effect/test/Config.test.ts diff --git a/packages/effect/test/config/ConfigProvider.test.ts b/packages/effect/test/ConfigProvider.test.ts similarity index 100% rename from packages/effect/test/config/ConfigProvider.test.ts rename to packages/effect/test/ConfigProvider.test.ts diff --git a/packages/effect/test/Effect.test.ts b/packages/effect/test/Effect.test.ts index 5ff7e4ea3b..da606b1b2c 100644 --- a/packages/effect/test/Effect.test.ts +++ b/packages/effect/test/Effect.test.ts @@ -1,10 +1,20 @@ import { assert, describe, it } from "@effect/vitest" -import { Data, Duration, Fiber, Filter, Option, Result, Schedule, Scope, ServiceMap } from "effect" -import * as Cause from "effect/Cause" -import * as Effect from "effect/Effect" -import * as Exit from "effect/Exit" +import { + Cause, + Data, + Duration, + Effect, + Exit, + Fiber, + Filter, + Option, + Result, + Schedule, + Scope, + ServiceMap, + TxRef +} from "effect" import { constFalse, constTrue, pipe } from "effect/Function" -import { TxRef } from "effect/stm" import { TestClock } from "effect/testing" class ATag extends ServiceMap.Service()("ATag") {} diff --git a/packages/effect/test/primitives/Number.test.ts b/packages/effect/test/Number.test.ts similarity index 95% rename from packages/effect/test/primitives/Number.test.ts rename to packages/effect/test/Number.test.ts index 928cd7db0f..db3c022c25 100644 --- a/packages/effect/test/primitives/Number.test.ts +++ b/packages/effect/test/Number.test.ts @@ -1,6 +1,6 @@ import { Number } from "effect" import { describe, it } from "vitest" -import { strictEqual } from "../utils/assert.ts" +import { strictEqual } from "./utils/assert.ts" describe("Number", () => { it("ReducerSum", () => { diff --git a/packages/effect/test/batching/Request.test.ts b/packages/effect/test/Request.test.ts similarity index 100% rename from packages/effect/test/batching/Request.test.ts rename to packages/effect/test/Request.test.ts diff --git a/packages/effect/test/primitives/String.test.ts b/packages/effect/test/String.test.ts similarity index 88% rename from packages/effect/test/primitives/String.test.ts rename to packages/effect/test/String.test.ts index c8635cf0a3..ef10a30e73 100644 --- a/packages/effect/test/primitives/String.test.ts +++ b/packages/effect/test/String.test.ts @@ -1,6 +1,6 @@ import * as String from "effect/String" import { describe, it } from "vitest" -import { strictEqual } from "../utils/assert.ts" +import { strictEqual } from "./utils/assert.ts" describe("String", () => { it("ReducerConcat", () => { diff --git a/packages/effect/test/TxChunk.test.ts b/packages/effect/test/TxChunk.test.ts index 38fa382537..ecebd1dad2 100644 --- a/packages/effect/test/TxChunk.test.ts +++ b/packages/effect/test/TxChunk.test.ts @@ -1,5 +1,4 @@ -import { Chunk, Effect } from "effect" -import { TxChunk } from "effect/stm" +import { Chunk, Effect, TxChunk } from "effect" import { describe, expect, it } from "vitest" describe("TxChunk", () => { diff --git a/packages/effect/test/TxHashMap.test.ts b/packages/effect/test/TxHashMap.test.ts index 2e97ad53b5..bb91084825 100644 --- a/packages/effect/test/TxHashMap.test.ts +++ b/packages/effect/test/TxHashMap.test.ts @@ -1,7 +1,5 @@ import { assert, describe, it } from "@effect/vitest" -import { Hash, HashMap, Option } from "effect" -import * as Effect from "effect/Effect" -import { TxHashMap } from "effect/stm" +import { Effect, Hash, HashMap, Option, TxHashMap } from "effect" describe("TxHashMap", () => { describe("constructors", () => { diff --git a/packages/effect/test/TxHashSet.test.ts b/packages/effect/test/TxHashSet.test.ts index f84ca95708..0ec97c7643 100644 --- a/packages/effect/test/TxHashSet.test.ts +++ b/packages/effect/test/TxHashSet.test.ts @@ -1,7 +1,5 @@ import { assert, describe, it } from "@effect/vitest" -import { Equal, Hash, HashSet } from "effect" -import * as Effect from "effect/Effect" -import { TxHashSet } from "effect/stm" +import { Effect, Equal, Hash, HashSet, TxHashSet } from "effect" class TestValue implements Equal.Equal { constructor(readonly value: string) {} diff --git a/packages/effect/test/TxQueue.test.ts b/packages/effect/test/TxQueue.test.ts index 28094ec43e..51a87c74b9 100644 --- a/packages/effect/test/TxQueue.test.ts +++ b/packages/effect/test/TxQueue.test.ts @@ -1,8 +1,5 @@ import { assert, describe, it } from "@effect/vitest" -import { Chunk, Fiber, Option } from "effect" -import * as Cause from "effect/Cause" -import * as Effect from "effect/Effect" -import { TxQueue } from "effect/stm" +import { Cause, Chunk, Effect, Fiber, Option, TxQueue } from "effect" describe("TxQueue", () => { describe("interfaces", () => { diff --git a/packages/effect/test/TxSemaphore.test.ts b/packages/effect/test/TxSemaphore.test.ts index b6f16aa793..b431e8288a 100644 --- a/packages/effect/test/TxSemaphore.test.ts +++ b/packages/effect/test/TxSemaphore.test.ts @@ -1,8 +1,5 @@ import { assert, describe, it } from "@effect/vitest" -import { Fiber } from "effect" -import * as Effect from "effect/Effect" -import * as Exit from "effect/Exit" -import * as TxSemaphore from "effect/stm/TxSemaphore" +import { Effect, Exit, Fiber, TxSemaphore } from "effect" describe("TxSemaphore", () => { describe("constructors", () => { diff --git a/packages/effect/test/http/Multipart.test.ts b/packages/effect/test/http/Multipart.test.ts deleted file mode 100644 index f8c2d8bc7f..0000000000 --- a/packages/effect/test/http/Multipart.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { describe, it } from "@effect/vitest" -import { deepStrictEqual } from "@effect/vitest/utils" -import { Effect, identity, Stream, Unify } from "effect" -import * as Multipart from "effect/unstable/http/Multipart" - -describe("Multipart", () => { - it.effect("it parses", () => - Effect.gen(function*() { - const data = new globalThis.FormData() - data.append("foo", "bar") - data.append("test", "ing") - data.append("file", new globalThis.File(["A".repeat(1024 * 1024)], "foo.txt", { type: "text/plain" })) - const response = new Response(data) - - const parts = yield* Stream.fromReadableStream({ - evaluate: () => response.body!, - onError: identity - }).pipe( - Stream.pipeThroughChannel(Multipart.makeChannel(Object.fromEntries(response.headers))), - Stream.mapEffect((part) => { - return Unify.unify( - part._tag === "File" ? - Effect.zip( - Effect.succeed(part.name), - Stream.mkString(Stream.decodeText(part.content)) - ) : - Effect.succeed([part.key, part.value] as const) - ) - }), - Stream.runCollect - ) - - deepStrictEqual(parts, [ - ["foo", "bar"], - ["test", "ing"], - ["foo.txt", "A".repeat(1024 * 1024)] - ]) - })) -}) diff --git a/packages/effect/test/http/HttpEffect.test.ts b/packages/effect/test/unstable/http/HttpEffect.test.ts similarity index 100% rename from packages/effect/test/http/HttpEffect.test.ts rename to packages/effect/test/unstable/http/HttpEffect.test.ts diff --git a/packages/effect/test/unstable/http/Multipart.test.ts b/packages/effect/test/unstable/http/Multipart.test.ts index 66b42ddff4..d9200d78b7 100644 --- a/packages/effect/test/unstable/http/Multipart.test.ts +++ b/packages/effect/test/unstable/http/Multipart.test.ts @@ -1,9 +1,42 @@ import { describe, it } from "@effect/vitest" -import { Schema } from "effect" +import { Effect, identity, Schema, Stream, Unify } from "effect" import { Multipart } from "effect/unstable/http" import { deepStrictEqual } from "node:assert" describe("Multipart", () => { + it.effect("it parses", () => + Effect.gen(function*() { + const data = new globalThis.FormData() + data.append("foo", "bar") + data.append("test", "ing") + data.append("file", new globalThis.File(["A".repeat(1024 * 1024)], "foo.txt", { type: "text/plain" })) + const response = new Response(data) + + const parts = yield* Stream.fromReadableStream({ + evaluate: () => response.body!, + onError: identity + }).pipe( + Stream.pipeThroughChannel(Multipart.makeChannel(Object.fromEntries(response.headers))), + Stream.mapEffect((part) => { + return Unify.unify( + part._tag === "File" ? + Effect.zip( + Effect.succeed(part.name), + Stream.mkString(Stream.decodeText(part.content)) + ) : + Effect.succeed([part.key, part.value] as const) + ) + }), + Stream.runCollect + ) + + deepStrictEqual(parts, [ + ["foo", "bar"], + ["test", "ing"], + ["foo.txt", "A".repeat(1024 * 1024)] + ]) + })) + describe("FileSchema", () => { it("jsonSchema", () => { const document = Schema.toJsonSchema(Multipart.FileSchema, { target: "draft-07" }) diff --git a/packages/effect/test/persistence/PersistedCache.test.ts b/packages/effect/test/unstable/persistence/PersistedCache.test.ts similarity index 100% rename from packages/effect/test/persistence/PersistedCache.test.ts rename to packages/effect/test/unstable/persistence/PersistedCache.test.ts diff --git a/packages/effect/test/persistence/PersistedCacheTest.ts b/packages/effect/test/unstable/persistence/PersistedCacheTest.ts similarity index 100% rename from packages/effect/test/persistence/PersistedCacheTest.ts rename to packages/effect/test/unstable/persistence/PersistedCacheTest.ts diff --git a/packages/effect/test/persistence/PersistedQueue.test.ts b/packages/effect/test/unstable/persistence/PersistedQueue.test.ts similarity index 100% rename from packages/effect/test/persistence/PersistedQueue.test.ts rename to packages/effect/test/unstable/persistence/PersistedQueue.test.ts diff --git a/packages/effect/test/persistence/PersistedQueueTest.ts b/packages/effect/test/unstable/persistence/PersistedQueueTest.ts similarity index 100% rename from packages/effect/test/persistence/PersistedQueueTest.ts rename to packages/effect/test/unstable/persistence/PersistedQueueTest.ts diff --git a/packages/effect/test/persistence/RateLimiter.test.ts b/packages/effect/test/unstable/persistence/RateLimiter.test.ts similarity index 100% rename from packages/effect/test/persistence/RateLimiter.test.ts rename to packages/effect/test/unstable/persistence/RateLimiter.test.ts diff --git a/packages/platform-node/test/NodeRedis.test.ts b/packages/platform-node/test/NodeRedis.test.ts index e0d60acd18..d00cf05885 100644 --- a/packages/platform-node/test/NodeRedis.test.ts +++ b/packages/platform-node/test/NodeRedis.test.ts @@ -1,8 +1,8 @@ import { NodeRedis } from "@effect/platform-node" import { RedisContainer } from "@testcontainers/redis" import { Effect, Layer } from "effect" -import * as PersistedCacheTest from "effect-test/persistence/PersistedCacheTest" -import * as PersistedQueueTest from "effect-test/persistence/PersistedQueueTest" +import * as PersistedCacheTest from "effect-test/unstable/persistence/PersistedCacheTest" +import * as PersistedQueueTest from "effect-test/unstable/persistence/PersistedQueueTest" import { PersistedQueue, Persistence } from "effect/unstable/persistence" const RedisLayer = Layer.unwrap( @@ -22,14 +22,10 @@ const RedisLayer = Layer.unwrap( PersistedCacheTest.suite( "NodeRedis", - Persistence.layerRedis.pipe( - Layer.provide(RedisLayer) - ) + Persistence.layerRedis.pipe(Layer.provide(RedisLayer)) ) PersistedQueueTest.suite( "NodeRedis", - PersistedQueue.layerStoreRedis().pipe( - Layer.provide(RedisLayer) - ) + PersistedQueue.layerStoreRedis().pipe(Layer.provide(RedisLayer)) ) diff --git a/packages/sql/mysql2/test/Persistence.test.ts b/packages/sql/mysql2/test/Persistence.test.ts index 9158d228b8..8e37eb6610 100644 --- a/packages/sql/mysql2/test/Persistence.test.ts +++ b/packages/sql/mysql2/test/Persistence.test.ts @@ -1,14 +1,12 @@ import { Layer } from "effect" -import * as PersistedCacheTest from "effect-test/persistence/PersistedCacheTest" -import * as PersistedQueueTest from "effect-test/persistence/PersistedQueueTest" +import * as PersistedCacheTest from "effect-test/unstable/persistence/PersistedCacheTest" +import * as PersistedQueueTest from "effect-test/unstable/persistence/PersistedQueueTest" import { PersistedQueue, Persistence } from "effect/unstable/persistence" import { MysqlContainer } from "./utils.ts" PersistedCacheTest.suite( "sql-mysql2", - Persistence.layerSql.pipe( - Layer.provide(MysqlContainer.layerClient) - ) + Persistence.layerSql.pipe(Layer.provide(MysqlContainer.layerClient)) ) PersistedQueueTest.suite( diff --git a/packages/sql/pg/test/Persistence.test.ts b/packages/sql/pg/test/Persistence.test.ts index 8b7d094b6c..9478460490 100644 --- a/packages/sql/pg/test/Persistence.test.ts +++ b/packages/sql/pg/test/Persistence.test.ts @@ -1,19 +1,15 @@ import { Layer } from "effect" -import * as PersistedCacheTest from "effect-test/persistence/PersistedCacheTest" -import * as PersistedQueueTest from "effect-test/persistence/PersistedQueueTest" +import * as PersistedCacheTest from "effect-test/unstable/persistence/PersistedCacheTest" +import * as PersistedQueueTest from "effect-test/unstable/persistence/PersistedQueueTest" import { PersistedQueue, Persistence } from "effect/unstable/persistence" import { PgContainer } from "./utils.ts" PersistedCacheTest.suite( "sql-pg", - Persistence.layerSql.pipe( - Layer.provide(PgContainer.layerClient) - ) + Persistence.layerSql.pipe(Layer.provide(PgContainer.layerClient)) ) PersistedQueueTest.suite( "sql-pg", - PersistedQueue.layerStoreSql().pipe( - Layer.provide(PgContainer.layerClient) - ) + PersistedQueue.layerStoreSql().pipe(Layer.provide(PgContainer.layerClient)) )