diff --git a/.changeset/calm-machines-organize.md b/.changeset/calm-machines-organize.md new file mode 100644 index 0000000..b0a8601 --- /dev/null +++ b/.changeset/calm-machines-organize.md @@ -0,0 +1,5 @@ +--- +"@typeonce/effect-machine": patch +--- + +Organize public, internal, testing, and unstable modules into Effect-shaped directories without changing package entrypoints. Add a TypeScript-resolved architecture check that enforces dependency direction, test boundaries, acyclic runtime imports, and internal naming conventions. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0313df2..87a21b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,3 +3,55 @@ This project generally does not accept unsolicited pull requests. Open an issue first describing the problem or use case and, for API changes, the public API you want to add or change. Wait for the proposal to be discussed and accepted before starting an implementation or opening a pull request. Pull requests without prior agreement may be closed. + +## Repository architecture + +The source tree follows Effect's public-module/internal-implementation split: + +```text +src/ +├── Machine.ts +├── index.ts +├── testing/ +├── unstable/ +└── internal/ + ├── machine/ + └── testing/machine/ +``` + +Public entrypoints and public modules use Effect-style names. Private files sit +under the domain they implement and use responsibility names such as +`planner.ts`, `process.ts`, and `runtime.ts`; they do not repeat `machine` in +every filename. Runtime tests mirror the same domains. Tests below +`test/internal/` are the only white-box suites allowed to import `src/internal`. + +The core dependency direction is: + +```text +public entrypoint -> public module -> process -> planner + | | + v v + runtime model + | | + └-> errors <-┘ +``` + +Internal machine modules may refer back to the public `Machine` types through +type-only imports. The runtime is intentionally unaware of the model, planner, +and process layers. Testing implementations are isolated under +`src/internal/testing` and may only be consumed by the public testing module or +other testing internals. + +`pnpm check:architecture` builds a TypeScript dependency graph using the +project's NodeNext resolver. It distinguishes type-only and runtime edges, +understands imports, re-exports, and dynamic imports, and enforces: + +- public entrypoints do not leak internals; +- internal back-edges and layer dependencies keep their intended direction; +- production code does not depend on testing internals; +- black-box tests do not depend on implementation internals; +- production runtime imports are acyclic; +- private directories have no barrels or legacy `machine*` filenames. + +The checker has executable fixture tests and runs as part of `pnpm check`. Add +new rules only with a failing fixture that demonstrates the boundary. diff --git a/examples/platformer/src/machine.test.ts b/examples/platformer/src/machine.test.ts index e16cb79..74c198e 100644 --- a/examples/platformer/src/machine.test.ts +++ b/examples/platformer/src/machine.test.ts @@ -1,7 +1,7 @@ import { Machine } from "@typeonce/effect-machine" import { Effect } from "effect" import { describe, expect, it } from "vitest" -import { makeTextRenderer } from "../../../test/visualization/text.ts" +import { makeTextRenderer } from "../../../test/machine/visualization/text.ts" import { CharacterMachine, type CharacterSnapshot, Event } from "./machine.ts" const renderMachine = makeTextRenderer(Machine) diff --git a/package.json b/package.json index c5d510a..38e1cdc 100644 --- a/package.json +++ b/package.json @@ -27,16 +27,16 @@ "import": "./dist/index.js" }, "./reactivity": { - "types": "./dist/reactivity.d.ts", - "import": "./dist/reactivity.js" + "types": "./dist/unstable/reactivity/index.d.ts", + "import": "./dist/unstable/reactivity/index.js" }, "./cluster": { - "types": "./dist/cluster.d.ts", - "import": "./dist/cluster.js" + "types": "./dist/unstable/cluster/index.d.ts", + "import": "./dist/unstable/cluster/index.js" }, "./testing": { - "types": "./dist/testing.d.ts", - "import": "./dist/testing.js" + "types": "./dist/testing/index.d.ts", + "import": "./dist/testing/index.js" }, "./package.json": "./package.json" }, @@ -48,6 +48,7 @@ "build": "tsc -p tsconfig.build.json", "test": "vitest run", "test:types": "tstyche", + "check:architecture": "node --test scripts/check-architecture.test.mjs && node scripts/check-architecture.mjs", "typecheck": "tsc -p tsconfig.json --noEmit", "perf:types": "pnpm build && node scripts/type-performance.mjs", "perf:runtime": "pnpm build && node --expose-gc scripts/runtime-performance.mjs", @@ -55,7 +56,7 @@ "format:check": "dprint check", "test:consumer": "node scripts/test-consumer.mjs", "pack:check": "node scripts/pack-check.mjs", - "check": "pnpm format:check && pnpm typecheck && pnpm build && pnpm test && pnpm test:types && pnpm test:consumer && pnpm pack:check", + "check": "pnpm format:check && pnpm check:architecture && pnpm typecheck && pnpm build && pnpm test && pnpm test:types && pnpm test:consumer && pnpm pack:check", "changeset": "changeset", "version-packages": "changeset version", "release": "pnpm build && changeset publish" diff --git a/scripts/check-architecture.mjs b/scripts/check-architecture.mjs new file mode 100644 index 0000000..8a471d3 --- /dev/null +++ b/scripts/check-architecture.mjs @@ -0,0 +1,339 @@ +import { basename, dirname, relative, resolve, sep } from "node:path" +import { fileURLToPath } from "node:url" +import ts from "typescript" + +const ruleDescriptions = { + ARCH001: "Public entrypoints may only expose public modules", + ARCH003: "Core internals may only refer back to Machine through type-only imports", + ARCH004: "The planner may not depend on process or runtime execution", + ARCH006: "The runtime may not depend on machine semantics or process orchestration", + ARCH007: "Production modules may not depend on testing internals", + ARCH008: "Black-box tests may not depend on implementation internals", + ARCH009: "Production runtime imports must be acyclic", + ARCH011: "Internal directories may not use barrel modules", + ARCH012: "Internal filenames must describe their responsibility without a machine prefix" +} + +const normalizePath = (path) => path.split(sep).join("/") + +const projectPath = (rootDirectory, path) => normalizePath(relative(rootDirectory, path)) + +const isProjectSource = (path) => + path.startsWith("src/") || path.startsWith("test/") || path.startsWith("typetest/") + +const isTypeOnlyImport = (node) => { + const clause = node.importClause + if (clause === undefined) return false + if (clause.isTypeOnly) return true + if (clause.name !== undefined) return false + if (clause.namedBindings === undefined) return false + if (ts.isNamespaceImport(clause.namedBindings)) return false + return clause.namedBindings.elements.length > 0 && clause.namedBindings.elements.every((element) => element.isTypeOnly) +} + +const isTypeOnlyExport = (node) => { + if (node.isTypeOnly) return true + if (node.exportClause === undefined || !ts.isNamedExports(node.exportClause)) return false + return node.exportClause.elements.length > 0 && node.exportClause.elements.every((element) => element.isTypeOnly) +} + +const lineAndColumn = (sourceFile, node) => { + const location = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)) + return { line: location.line + 1, column: location.character + 1 } +} + +const diagnostic = (rule, sourceFile, node, path, message) => ({ + rule, + path, + ...lineAndColumn(sourceFile, node), + message +}) + +const compareDiagnostics = (left, right) => + left.path.localeCompare(right.path) || + left.line - right.line || + left.column - right.column || + left.rule.localeCompare(right.rule) || + left.message.localeCompare(right.message) + +const resolveProjectModule = (specifier, sourceFile, compilerOptions, rootDirectory) => { + const resolvedModule = ts.resolveModuleName(specifier, sourceFile.fileName, compilerOptions, ts.sys).resolvedModule + if (resolvedModule === undefined) return undefined + const path = projectPath(rootDirectory, resolvedModule.resolvedFileName) + return isProjectSource(path) ? path : undefined +} + +const collectEdges = (program, rootDirectory) => { + const edges = [] + const compilerOptions = program.getCompilerOptions() + + for (const sourceFile of program.getSourceFiles()) { + const source = projectPath(rootDirectory, sourceFile.fileName) + if (!isProjectSource(source)) continue + + const addEdge = (moduleSpecifier, typeOnly, node) => { + const target = resolveProjectModule(moduleSpecifier.text, sourceFile, compilerOptions, rootDirectory) + if (target !== undefined) { + edges.push({ source, target, typeOnly, sourceFile, node }) + } + } + + const visit = (node) => { + if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) { + addEdge(node.moduleSpecifier, isTypeOnlyImport(node), node) + } else if (ts.isExportDeclaration(node) && node.moduleSpecifier !== undefined && ts.isStringLiteral(node.moduleSpecifier)) { + addEdge(node.moduleSpecifier, isTypeOnlyExport(node), node) + } else if ( + ts.isCallExpression(node) && + node.expression.kind === ts.SyntaxKind.ImportKeyword && + node.arguments.length === 1 && + ts.isStringLiteral(node.arguments[0]) + ) { + addEdge(node.arguments[0], false, node) + } + ts.forEachChild(node, visit) + } + visit(sourceFile) + } + + return edges +} + +const stronglyConnectedComponents = (nodes, adjacency) => { + let nextIndex = 0 + const indices = new Map() + const lowLinks = new Map() + const stack = [] + const onStack = new Set() + const components = [] + + const connect = (node) => { + const index = nextIndex++ + indices.set(node, index) + lowLinks.set(node, index) + stack.push(node) + onStack.add(node) + + for (const target of adjacency.get(node) ?? []) { + if (!indices.has(target)) { + connect(target) + lowLinks.set(node, Math.min(lowLinks.get(node), lowLinks.get(target))) + } else if (onStack.has(target)) { + lowLinks.set(node, Math.min(lowLinks.get(node), indices.get(target))) + } + } + + if (lowLinks.get(node) !== indices.get(node)) return + const component = [] + while (stack.length > 0) { + const current = stack.pop() + onStack.delete(current) + component.push(current) + if (current === node) break + } + components.push(component) + } + + for (const node of nodes) { + if (!indices.has(node)) connect(node) + } + return components +} + +const collectCycleDiagnostics = (program, rootDirectory, runtimeEdges) => { + const sourceFiles = new Map() + for (const sourceFile of program.getSourceFiles()) { + const path = projectPath(rootDirectory, sourceFile.fileName) + if (path.startsWith("src/")) sourceFiles.set(path, sourceFile) + } + const nodes = new Set(sourceFiles.keys()) + const adjacency = new Map() + for (const edge of runtimeEdges) { + if (!edge.source.startsWith("src/") || !edge.target.startsWith("src/")) continue + const targets = adjacency.get(edge.source) ?? new Set() + targets.add(edge.target) + adjacency.set(edge.source, targets) + } + + const diagnostics = [] + for (const component of stronglyConnectedComponents(nodes, adjacency)) { + const selfCycle = component.length === 1 && adjacency.get(component[0])?.has(component[0]) === true + if (component.length < 2 && !selfCycle) continue + const paths = [...component].sort() + const source = paths[0] + const sourceFile = sourceFiles.get(source) + diagnostics.push({ + rule: "ARCH009", + path: source, + line: 1, + column: 1, + message: `Runtime import cycle: ${paths.join(" -> ")}`, + sourceFile + }) + } + return diagnostics +} + +const readProject = (rootDirectory, tsconfigPath) => { + const configPath = resolve(rootDirectory, tsconfigPath) + const configFile = ts.readConfigFile(configPath, ts.sys.readFile) + if (configFile.error !== undefined) { + throw new Error(ts.flattenDiagnosticMessageText(configFile.error.messageText, "\n")) + } + const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname(configPath), undefined, configPath) + if (parsed.errors.length > 0) { + throw new Error(parsed.errors.map((error) => ts.flattenDiagnosticMessageText(error.messageText, "\n")).join("\n")) + } + const architectureFiles = ts.sys.readDirectory( + rootDirectory, + [".ts"], + ["**/dist/**", "**/node_modules/**", "**/references/**"], + ["src/**/*.ts", "test/**/*.ts", "typetest/**/*.ts"] + ) + return ts.createProgram({ + rootNames: [...new Set([...parsed.fileNames, ...architectureFiles])], + options: parsed.options + }) +} + +export const checkArchitecture = ({ + rootDirectory = process.cwd(), + tsconfigPath = "tsconfig.json" +} = {}) => { + const root = resolve(rootDirectory) + const program = readProject(root, tsconfigPath) + const edges = collectEdges(program, root) + const runtimeEdges = edges.filter((edge) => !edge.typeOnly) + const diagnostics = [] + const entrypoints = new Set([ + "src/index.ts", + "src/testing/index.ts", + "src/unstable/cluster/index.ts", + "src/unstable/reactivity/index.ts" + ]) + + for (const edge of edges) { + if (entrypoints.has(edge.source) && edge.target.includes("/internal/")) { + diagnostics.push(diagnostic( + "ARCH001", + edge.sourceFile, + edge.node, + edge.source, + `Public entrypoint imports internal module ${edge.target}` + )) + } + if ( + edge.source.startsWith("src/internal/machine/") && + edge.target === "src/Machine.ts" && + !edge.typeOnly + ) { + diagnostics.push(diagnostic( + "ARCH003", + edge.sourceFile, + edge.node, + edge.source, + "Core internal back-reference to Machine must be type-only" + )) + } + if ( + edge.source === "src/internal/machine/planner.ts" && + !edge.typeOnly && + (edge.target === "src/internal/machine/process.ts" || edge.target === "src/internal/machine/runtime.ts") + ) { + diagnostics.push(diagnostic( + "ARCH004", + edge.sourceFile, + edge.node, + edge.source, + `Planner has a runtime dependency on ${edge.target}` + )) + } + if ( + edge.source === "src/internal/machine/runtime.ts" && + [ + "src/internal/machine/model.ts", + "src/internal/machine/planner.ts", + "src/internal/machine/process.ts" + ].includes(edge.target) + ) { + diagnostics.push(diagnostic( + "ARCH006", + edge.sourceFile, + edge.node, + edge.source, + `Runtime depends on higher-level module ${edge.target}` + )) + } + if ( + edge.source.startsWith("src/") && + !edge.source.startsWith("src/testing/") && + !edge.source.startsWith("src/internal/testing/") && + edge.target.startsWith("src/internal/testing/") + ) { + diagnostics.push(diagnostic( + "ARCH007", + edge.sourceFile, + edge.node, + edge.source, + `Production module imports testing internal ${edge.target}` + )) + } + if ( + (edge.source.startsWith("test/") || edge.source.startsWith("typetest/")) && + !edge.source.startsWith("test/internal/") && + edge.target.startsWith("src/internal/") + ) { + diagnostics.push(diagnostic( + "ARCH008", + edge.sourceFile, + edge.node, + edge.source, + `Black-box test imports implementation internal ${edge.target}` + )) + } + } + + for (const sourceFile of program.getSourceFiles()) { + const path = projectPath(root, sourceFile.fileName) + if (!path.startsWith("src/internal/")) continue + if (basename(path) === "index.ts") { + diagnostics.push({ + rule: "ARCH011", + path, + line: 1, + column: 1, + message: "Internal barrel modules hide dependency direction" + }) + } + if (/^machine[A-Z]/.test(basename(path))) { + diagnostics.push({ + rule: "ARCH012", + path, + line: 1, + column: 1, + message: "Internal filename repeats the machine domain prefix" + }) + } + } + + diagnostics.push(...collectCycleDiagnostics(program, root, runtimeEdges)) + return diagnostics.sort(compareDiagnostics) +} + +export const formatArchitectureDiagnostics = (diagnostics) => + diagnostics.map((item) => + `${item.rule} ${item.path}:${item.line}:${item.column} ${item.message}\n` + + ` ${ruleDescriptions[item.rule]}` + ).join("\n") + +const isMain = process.argv[1] !== undefined && resolve(process.argv[1]) === fileURLToPath(import.meta.url) + +if (isMain) { + const diagnostics = checkArchitecture() + if (diagnostics.length > 0) { + console.error(formatArchitectureDiagnostics(diagnostics)) + process.exitCode = 1 + } else { + console.log("Architecture checks passed") + } +} diff --git a/scripts/check-architecture.test.mjs b/scripts/check-architecture.test.mjs new file mode 100644 index 0000000..7704ba4 --- /dev/null +++ b/scripts/check-architecture.test.mjs @@ -0,0 +1,96 @@ +import { strict as assert } from "node:assert" +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs" +import { tmpdir } from "node:os" +import { dirname, join } from "node:path" +import { afterEach, test } from "node:test" +import { checkArchitecture } from "./check-architecture.mjs" + +const temporaryProjects = [] + +afterEach(() => { + while (temporaryProjects.length > 0) { + rmSync(temporaryProjects.pop(), { recursive: true, force: true }) + } +}) + +const makeProject = (files) => { + const root = mkdtempSync(join(tmpdir(), "effect-machine-architecture-")) + temporaryProjects.push(root) + const projectFiles = { + "package.json": JSON.stringify({ type: "module" }), + "tsconfig.json": JSON.stringify({ + compilerOptions: { + target: "ES2022", + module: "NodeNext", + moduleResolution: "NodeNext", + strict: true, + noEmit: true + }, + include: ["src/**/*.ts", "test/**/*.ts", "typetest/**/*.ts"] + }), + ...files + } + for (const [path, contents] of Object.entries(projectFiles)) { + const destination = join(root, path) + mkdirSync(dirname(destination), { recursive: true }) + writeFileSync(destination, contents) + } + return root +} + +const rules = (root) => checkArchitecture({ rootDirectory: root }).map((diagnostic) => diagnostic.rule) + +test("accepts Effect-shaped modules and ignores type-only back-edges", () => { + const root = makeProject({ + "src/index.ts": 'export * as Machine from "./Machine.js"', + "src/Machine.ts": 'import * as Model from "./internal/machine/model.js"\nexport interface Machine {}\nexport const model = Model.value', + "src/internal/machine/model.ts": 'import type { Machine } from "../../Machine.js"\nexport const value = 1', + "test/machine/Machine.test.ts": 'import { Machine } from "../../src/index.js"\nvoid Machine', + "test/internal/machine/model.test.ts": 'import { value } from "../../../src/internal/machine/model.js"\nvoid value' + }) + assert.deepEqual(rules(root), []) +}) + +test("rejects entrypoint leaks, black-box internal imports, barrels, and legacy filenames", () => { + const root = makeProject({ + "src/index.ts": 'export { value } from "./internal/machine/model.js"', + "src/internal/machine/model.ts": "export const value = 1", + "src/internal/machine/index.ts": "export {}", + "src/internal/machine/machinePlanner.ts": "export {}", + "test/machine/model.test.ts": 'import { value } from "../../src/internal/machine/model.js"\nvoid value' + }) + assert.deepEqual(rules(root), ["ARCH001", "ARCH011", "ARCH012", "ARCH008"]) +}) + +test("rejects value back-edges and execution-layer inversions", () => { + const root = makeProject({ + "src/Machine.ts": "export const Machine = 1", + "src/internal/machine/planner.ts": 'import { Machine } from "../../Machine.js"\nimport { run } from "./runtime.js"\nexport const plan = Machine + run', + "src/internal/machine/runtime.ts": 'import type { plan } from "./planner.js"\nexport const run: typeof plan = 1', + "src/internal/testing/machine/arbitrary.ts": "export const arbitrary = 1", + "src/consumer.ts": 'import { arbitrary } from "./internal/testing/machine/arbitrary.js"\nvoid arbitrary' + }) + assert.deepEqual(rules(root), ["ARCH007", "ARCH003", "ARCH004", "ARCH006"]) +}) + +test("detects runtime cycles while permitting type-only cycles", () => { + const cyclic = makeProject({ + "src/a.ts": 'import { b } from "./b.js"\nexport const a = b', + "src/b.ts": 'import { a } from "./a.js"\nexport const b = a' + }) + assert.deepEqual(rules(cyclic), ["ARCH009"]) + + const typeOnly = makeProject({ + "src/a.ts": 'import type { B } from "./b.js"\nexport interface A { readonly b: B }', + "src/b.ts": 'import type { A } from "./a.js"\nexport interface B { readonly a: A }' + }) + assert.deepEqual(rules(typeOnly), []) +}) + +test("includes re-exports and dynamic imports in the runtime graph", () => { + const root = makeProject({ + "src/a.ts": 'export { b } from "./b.js"', + "src/b.ts": 'export const b = import("./a.js")' + }) + assert.deepEqual(rules(root), ["ARCH009"]) +}) diff --git a/scripts/pack-check.mjs b/scripts/pack-check.mjs index a5ca012..12187fc 100644 --- a/scripts/pack-check.mjs +++ b/scripts/pack-check.mjs @@ -21,12 +21,12 @@ try { const required = [ "package/dist/index.js", "package/dist/index.d.ts", - "package/dist/reactivity.js", - "package/dist/reactivity.d.ts", - "package/dist/cluster.js", - "package/dist/cluster.d.ts", - "package/dist/testing.js", - "package/dist/testing.d.ts", + "package/dist/unstable/reactivity/index.js", + "package/dist/unstable/reactivity/index.d.ts", + "package/dist/unstable/cluster/index.js", + "package/dist/unstable/cluster/index.d.ts", + "package/dist/testing/index.js", + "package/dist/testing/index.d.ts", "package/package.json", "package/README.md", "package/docs/agent-guide.md", @@ -36,6 +36,17 @@ try { for (const file of required) { if (!files.includes(file)) throw new Error(`tarball is missing ${file}`) } + const legacyBuildFiles = [ + "package/dist/reactivity.js", + "package/dist/reactivity.d.ts", + "package/dist/cluster.js", + "package/dist/cluster.d.ts", + "package/dist/testing.js", + "package/dist/testing.d.ts" + ].filter((file) => files.includes(file)) + if (legacyBuildFiles.length > 0) { + throw new Error(`tarball contains legacy entrypoint artifacts:\n${legacyBuildFiles.join("\n")}`) + } const forbidden = files.filter((file) => /^package\/(?:src|test|typetest|scripts|\.github|\.changeset)\//.test(file)) if (forbidden.length > 0) throw new Error(`tarball contains repository files:\n${forbidden.join("\n")}`) console.log(`pack verification passed (${files.length} files)`) diff --git a/src/Machine.ts b/src/Machine.ts index 02a8f26..61e64e9 100644 --- a/src/Machine.ts +++ b/src/Machine.ts @@ -15,7 +15,7 @@ import type * as Schema from "effect/Schema" import type * as Scope from "effect/Scope" import type * as Stream from "effect/Stream" import type * as Types from "effect/Types" -import * as Activities from "./internal/machineActivities.js" +import * as Activities from "./internal/machine/activities.js" import type { ChildAlreadyExistsError, InfiniteTransitionError, @@ -24,14 +24,14 @@ import type { ProcessLocalError, StartupError, StoppedError -} from "./internal/machineErrors.js" -import { ProcessLocalError as ProcessLocalErrorValue } from "./internal/machineErrors.js" -import * as Model from "./internal/machineModel.js" -import * as internalPlanner from "./internal/machinePlanner.js" -import * as internalProcess from "./internal/machineProcess.js" -import type { EnsureExecutable } from "./internal/machineReadiness.js" -import * as internalRuntime from "./internal/machineRuntime.js" -import * as StateDefinition from "./internal/machineStateDefinition.js" +} from "./internal/machine/errors.js" +import { ProcessLocalError as ProcessLocalErrorValue } from "./internal/machine/errors.js" +import * as Model from "./internal/machine/model.js" +import * as internalPlanner from "./internal/machine/planner.js" +import * as internalProcess from "./internal/machine/process.js" +import type { EnsureExecutable } from "./internal/machine/readiness.js" +import * as internalRuntime from "./internal/machine/runtime.js" +import * as StateDefinition from "./internal/machine/stateDefinition.js" /** * String literal type used as the runtime type identifier for `Machine` @@ -283,7 +283,7 @@ export { * @since 4.0.0 */ StoppedError -} from "./internal/machineErrors.js" +} from "./internal/machine/errors.js" const RuntimeRequirementTypeId = "~effect/Machine/RuntimeRequirement" const ActionRequirementTypeId = "~effect/Machine/ActionRequirement" diff --git a/src/internal/machineActivities.ts b/src/internal/machine/activities.ts similarity index 100% rename from src/internal/machineActivities.ts rename to src/internal/machine/activities.ts diff --git a/src/internal/machineErrors.ts b/src/internal/machine/errors.ts similarity index 100% rename from src/internal/machineErrors.ts rename to src/internal/machine/errors.ts diff --git a/src/internal/machineModel.ts b/src/internal/machine/model.ts similarity index 99% rename from src/internal/machineModel.ts rename to src/internal/machine/model.ts index 02a9474..7c957e5 100644 --- a/src/internal/machineModel.ts +++ b/src/internal/machine/model.ts @@ -10,8 +10,8 @@ import * as Option from "effect/Option" import { hasProperty } from "effect/Predicate" import * as Result from "effect/Result" import * as Schema from "effect/Schema" -import type { Machine } from "../Machine.js" -import { MachineSchemaDecodeError, MachineSchemaEncodeError } from "./machineErrors.js" +import type { Machine } from "../../Machine.js" +import { MachineSchemaDecodeError, MachineSchemaEncodeError } from "./errors.js" export const TargetTypeId = "~effect/Machine/Target" export const TargetSnapshotTypeId: unique symbol = Symbol("effect/Machine/TargetSnapshot") diff --git a/src/internal/machinePlanner.ts b/src/internal/machine/planner.ts similarity index 99% rename from src/internal/machinePlanner.ts rename to src/internal/machine/planner.ts index ac67136..56ee656 100644 --- a/src/internal/machinePlanner.ts +++ b/src/internal/machine/planner.ts @@ -8,8 +8,8 @@ import * as Cause from "effect/Cause" import * as Effect from "effect/Effect" import * as Option from "effect/Option" import type * as Schema from "effect/Schema" -import type { Command, Enqueue, InitialEvent as MachineInitialEvent, Machine, Runtime } from "../Machine.js" -import { InfiniteTransitionError, MachineSchemaDecodeError, StartupError } from "./machineErrors.js" +import type { Command, Enqueue, InitialEvent as MachineInitialEvent, Machine, Runtime } from "../../Machine.js" +import { InfiniteTransitionError, MachineSchemaDecodeError, StartupError } from "./errors.js" import { type ActiveConfiguration, captureHistory, @@ -55,8 +55,8 @@ import { snapshotFromConfigurationAtPath, TargetSnapshotTypeId, validateInitialConfiguration -} from "./machineModel.js" -import type { ProcessScope } from "./machineRuntime.js" +} from "./model.js" +import type { ProcessScope } from "./runtime.js" export type RuntimeCommand = Command diff --git a/src/internal/machineProcess.ts b/src/internal/machine/process.ts similarity index 99% rename from src/internal/machineProcess.ts rename to src/internal/machine/process.ts index bfce1c4..05c9b41 100644 --- a/src/internal/machineProcess.ts +++ b/src/internal/machine/process.ts @@ -10,17 +10,12 @@ import * as Exit from "effect/Exit" import * as Option from "effect/Option" import * as Queue from "effect/Queue" import type * as Schema from "effect/Schema" -import type { ActionError, ExecutionServices, Machine, Runtime } from "../Machine.js" -import { - ChildAlreadyExistsError, - InfiniteTransitionError, - MachineSchemaDecodeError, - StartupError -} from "./machineErrors.js" -import type { StoppedError } from "./machineErrors.js" -import * as Model from "./machineModel.js" -import * as internalPlanner from "./machinePlanner.js" -import * as internalRuntime from "./machineRuntime.js" +import type { ActionError, ExecutionServices, Machine, Runtime } from "../../Machine.js" +import { ChildAlreadyExistsError, InfiniteTransitionError, MachineSchemaDecodeError, StartupError } from "./errors.js" +import type { StoppedError } from "./errors.js" +import * as Model from "./model.js" +import * as internalPlanner from "./planner.js" +import * as internalRuntime from "./runtime.js" type IsAny = 0 extends (1 & A) ? true : false diff --git a/src/internal/machineReadiness.ts b/src/internal/machine/readiness.ts similarity index 89% rename from src/internal/machineReadiness.ts rename to src/internal/machine/readiness.ts index 0d9b2ac..16549b2 100644 --- a/src/internal/machineReadiness.ts +++ b/src/internal/machine/readiness.ts @@ -1,4 +1,4 @@ -import type * as Machine from "../Machine.js" +import type * as Machine from "../../Machine.js" /** Canonical proof required before a machine can be planned or executed. */ export type EnsureExecutable< diff --git a/src/internal/machineRuntime.ts b/src/internal/machine/runtime.ts similarity index 99% rename from src/internal/machineRuntime.ts rename to src/internal/machine/runtime.ts index 55d7afd..618c5fd 100644 --- a/src/internal/machineRuntime.ts +++ b/src/internal/machine/runtime.ts @@ -19,7 +19,7 @@ import * as Scope from "effect/Scope" import * as Stream from "effect/Stream" import * as SynchronizedRef from "effect/SynchronizedRef" import type * as Take from "effect/Take" -import { ChildAlreadyExistsError, StoppedError } from "./machineErrors.js" +import { ChildAlreadyExistsError, StoppedError } from "./errors.js" type ChildDescriptor = { readonly id: string diff --git a/src/internal/machineStateDefinition.ts b/src/internal/machine/stateDefinition.ts similarity index 100% rename from src/internal/machineStateDefinition.ts rename to src/internal/machine/stateDefinition.ts diff --git a/src/internal/machineTestArbitrary.ts b/src/internal/testing/machine/arbitrary.ts similarity index 100% rename from src/internal/machineTestArbitrary.ts rename to src/internal/testing/machine/arbitrary.ts diff --git a/src/internal/machineTestFiniteModel.ts b/src/internal/testing/machine/finiteModel.ts similarity index 99% rename from src/internal/machineTestFiniteModel.ts rename to src/internal/testing/machine/finiteModel.ts index cf00622..01227ae 100644 --- a/src/internal/machineTestFiniteModel.ts +++ b/src/internal/testing/machine/finiteModel.ts @@ -11,7 +11,7 @@ import * as Schema from "effect/Schema" import { FastCheck } from "effect/testing" -import * as Machine from "../Machine.js" +import * as Machine from "../../../Machine.js" /** * An atomic state in a finite generated model. diff --git a/src/internal/machineTestReferenceModel.ts b/src/internal/testing/machine/referenceModel.ts similarity index 99% rename from src/internal/machineTestReferenceModel.ts rename to src/internal/testing/machine/referenceModel.ts index 69b0dbf..b140f5a 100644 --- a/src/internal/machineTestReferenceModel.ts +++ b/src/internal/testing/machine/referenceModel.ts @@ -19,7 +19,7 @@ import type { FiniteState, FiniteTransition, FiniteTransitionTrigger -} from "./machineTestFiniteModel.js" +} from "./finiteModel.js" /** * The deterministic value assigned to one active finite-model state. diff --git a/src/internal/machineTestRuntime.ts b/src/internal/testing/machine/runtime.ts similarity index 99% rename from src/internal/machineTestRuntime.ts rename to src/internal/testing/machine/runtime.ts index 2b9389f..cb02e62 100644 --- a/src/internal/machineTestRuntime.ts +++ b/src/internal/testing/machine/runtime.ts @@ -14,8 +14,8 @@ import * as Queue from "effect/Queue" import * as Schema from "effect/Schema" import * as Stream from "effect/Stream" import { FastCheck, TestClock } from "effect/testing" -import * as Machine from "../Machine.js" -import { type SchemaArbitraryReport, toArbitraryWithReport } from "./machineTestArbitrary.js" +import * as Machine from "../../../Machine.js" +import { type SchemaArbitraryReport, toArbitraryWithReport } from "./arbitrary.js" type AnyMachine = Machine.Machine.Any diff --git a/src/MachineTest.ts b/src/testing/MachineTest.ts similarity index 99% rename from src/MachineTest.ts rename to src/testing/MachineTest.ts index 8e52706..1ed4664 100644 --- a/src/MachineTest.ts +++ b/src/testing/MachineTest.ts @@ -10,11 +10,11 @@ import * as Graph from "effect/Graph" import * as Schema from "effect/Schema" import * as SchemaAST from "effect/SchemaAST" import { FastCheck } from "effect/testing" -import type { EnsureExecutable } from "./internal/machineReadiness.js" -import { type SchemaArbitraryReport, toArbitraryWithReport } from "./internal/machineTestArbitrary.js" -import type { FiniteModel } from "./internal/machineTestFiniteModel.js" -import * as ReferenceModel from "./internal/machineTestReferenceModel.js" -import * as Machine from "./Machine.js" +import type { EnsureExecutable } from "../internal/machine/readiness.js" +import { type SchemaArbitraryReport, toArbitraryWithReport } from "../internal/testing/machine/arbitrary.js" +import type { FiniteModel } from "../internal/testing/machine/finiteModel.js" +import * as ReferenceModel from "../internal/testing/machine/referenceModel.js" +import * as Machine from "../Machine.js" export { advanceCommand, @@ -39,13 +39,13 @@ export { type RuntimeTranscript, sendCommand, stopCommand -} from "./internal/machineTestRuntime.js" +} from "../internal/testing/machine/runtime.js" export type { SchemaArbitraryOpaqueFilterWarning, SchemaArbitraryReport, SchemaArbitraryWarning -} from "./internal/machineTestArbitrary.js" +} from "../internal/testing/machine/arbitrary.js" export { compileModel, @@ -67,7 +67,7 @@ export { type FiniteState, type FiniteTransition, type FiniteTransitionTrigger -} from "./internal/machineTestFiniteModel.js" +} from "../internal/testing/machine/finiteModel.js" export { ModelVerificationError, @@ -83,7 +83,7 @@ export { type ReferenceStep, type ReferenceTrace, type ReferenceTransition -} from "./internal/machineTestReferenceModel.js" +} from "../internal/testing/machine/referenceModel.js" /** * Purely interprets a finite hierarchical model without compiling a diff --git a/src/testing.ts b/src/testing/index.ts similarity index 100% rename from src/testing.ts rename to src/testing/index.ts diff --git a/src/ClusterMachine.ts b/src/unstable/cluster/ClusterMachine.ts similarity index 99% rename from src/ClusterMachine.ts rename to src/unstable/cluster/ClusterMachine.ts index 0c21ea8..fd3d1f1 100644 --- a/src/ClusterMachine.ts +++ b/src/unstable/cluster/ClusterMachine.ts @@ -19,8 +19,8 @@ import { Snowflake } from "effect/unstable/cluster" import { Rpc } from "effect/unstable/rpc" -import type { EnsureExecutable } from "./internal/machineReadiness.js" -import * as Machine from "./Machine.js" +import type { EnsureExecutable } from "../../internal/machine/readiness.js" +import * as Machine from "../../Machine.js" type EntityAddress = EntityAddress.EntityAddress type PersistenceError = ClusterError.PersistenceError diff --git a/src/cluster.ts b/src/unstable/cluster/index.ts similarity index 100% rename from src/cluster.ts rename to src/unstable/cluster/index.ts diff --git a/src/AtomMachine.ts b/src/unstable/reactivity/AtomMachine.ts similarity index 99% rename from src/AtomMachine.ts rename to src/unstable/reactivity/AtomMachine.ts index f6acd94..5fe3ad7 100644 --- a/src/AtomMachine.ts +++ b/src/unstable/reactivity/AtomMachine.ts @@ -12,9 +12,9 @@ import type * as Schema from "effect/Schema" import type * as Scope from "effect/Scope" import * as Stream from "effect/Stream" import { AsyncResult, Atom, type AtomRegistry } from "effect/unstable/reactivity" -import * as Model from "./internal/machineModel.js" -import type { EnsureExecutable } from "./internal/machineReadiness.js" -import * as Machine from "./Machine.js" +import * as Model from "../../internal/machine/model.js" +import type { EnsureExecutable } from "../../internal/machine/readiness.js" +import * as Machine from "../../Machine.js" /** * Error returned when a machine command is issued before startup completes. diff --git a/src/reactivity.ts b/src/unstable/reactivity/index.ts similarity index 100% rename from src/reactivity.ts rename to src/unstable/reactivity/index.ts diff --git a/test/MachineActivities.test.ts b/test/internal/machine/activities.test.ts similarity index 98% rename from test/MachineActivities.test.ts rename to test/internal/machine/activities.test.ts index 697bfd6..583f9e6 100644 --- a/test/MachineActivities.test.ts +++ b/test/internal/machine/activities.test.ts @@ -1,13 +1,13 @@ import { assert, describe, it } from "@effect/vitest" import { Duration, Effect, Schema } from "effect" import { FastCheck } from "effect/testing" -import { Machine } from "../src/index.js" +import { Machine } from "../../../src/index.js" import { activityDefinitions, ActivityMetadataTypeId, type StaticActivityMetadata -} from "../src/internal/machineActivities.js" -import { makeTextRenderer } from "./visualization/text.js" +} from "../../../src/internal/machine/activities.js" +import { makeTextRenderer } from "../../machine/visualization/text.js" class Loading extends Schema.TaggedClass("Loading")("Loading", {}) {} class Dynamic extends Schema.TaggedClass("Dynamic")("Dynamic", {}) {} diff --git a/test/MachineProcessLifecycle.test.ts b/test/internal/machine/processLifecycle.test.ts similarity index 99% rename from test/MachineProcessLifecycle.test.ts rename to test/internal/machine/processLifecycle.test.ts index 8762bdf..811f0a2 100644 --- a/test/MachineProcessLifecycle.test.ts +++ b/test/internal/machine/processLifecycle.test.ts @@ -1,7 +1,7 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Deferred, Effect, Exit, Fiber, Option, Ref, Stream } from "effect" -import { Machine } from "../src/index.js" -import * as MachineRuntime from "../src/internal/machineRuntime.js" +import { Machine } from "../../../src/index.js" +import * as MachineRuntime from "../../../src/internal/machine/runtime.js" describe("machine process lifecycle", () => { it.effect("reuses a settled active startup without running an empty compiled drain", () => diff --git a/test/MachineProtocol.test.ts b/test/internal/machine/protocol.test.ts similarity index 92% rename from test/MachineProtocol.test.ts rename to test/internal/machine/protocol.test.ts index 4c06fd4..0aa945f 100644 --- a/test/MachineProtocol.test.ts +++ b/test/internal/machine/protocol.test.ts @@ -1,7 +1,7 @@ import { assert, describe, it } from "@effect/vitest" import { Effect, Schema } from "effect" -import { Machine } from "../src/index.js" -import { decodeEvent } from "../src/internal/machineModel.js" +import { Machine } from "../../../src/index.js" +import { decodeEvent } from "../../../src/internal/machine/model.js" class ProtocolIdle extends Schema.TaggedClass("ProtocolIdle")("ProtocolIdle", {}) {} diff --git a/test/MachineStrategyDifferential.test.ts b/test/internal/machine/strategyDifferential.test.ts similarity index 96% rename from test/MachineStrategyDifferential.test.ts rename to test/internal/machine/strategyDifferential.test.ts index 3bfc4a2..63225b5 100644 --- a/test/MachineStrategyDifferential.test.ts +++ b/test/internal/machine/strategyDifferential.test.ts @@ -1,12 +1,12 @@ import { assert, describe, it } from "@effect/vitest" import { Effect, Fiber, Schema, Stream } from "effect" import { FastCheck } from "effect/testing" -import { Machine } from "../src/index.js" -import * as Planner from "../src/internal/machinePlanner.js" -import { MachineTest } from "../src/testing.js" -import type { DifferentialStep } from "./support/machineRuntimeDifferential.js" -import { verifyManagedExecution } from "./support/machineRuntimeDifferential.js" -import { openWithRuntimeStrategy, verifyPlannerStrategies } from "./support/machineStrategyDifferential.js" +import { Machine } from "../../../src/index.js" +import * as Planner from "../../../src/internal/machine/planner.js" +import { MachineTest } from "../../../src/testing/index.js" +import type { DifferentialStep } from "../../machine/support/runtimeDifferential.js" +import { verifyManagedExecution } from "../../machine/support/runtimeDifferential.js" +import { openWithRuntimeStrategy, verifyPlannerStrategies } from "./support/strategyDifferential.js" class Count extends Schema.TaggedClass("StrategyCount")("Count", { value: Schema.Number diff --git a/test/support/machineStrategyDifferential.ts b/test/internal/machine/support/strategyDifferential.ts similarity index 94% rename from test/support/machineStrategyDifferential.ts rename to test/internal/machine/support/strategyDifferential.ts index af837eb..3166af2 100644 --- a/test/support/machineStrategyDifferential.ts +++ b/test/internal/machine/support/strategyDifferential.ts @@ -1,9 +1,9 @@ import { assert } from "@effect/vitest" import { Effect } from "effect" -import { Machine } from "../../src/index.js" -import * as Model from "../../src/internal/machineModel.js" -import * as Planner from "../../src/internal/machinePlanner.js" -import * as Process from "../../src/internal/machineProcess.js" +import { Machine } from "../../../../src/index.js" +import * as Model from "../../../../src/internal/machine/model.js" +import * as Planner from "../../../../src/internal/machine/planner.js" +import * as Process from "../../../../src/internal/machine/process.js" const eventTag = (event: unknown): PropertyKey | undefined => typeof event === "object" && event !== null && "_tag" in event diff --git a/test/MachineActivityLifecycleModel.test.ts b/test/machine/ActivityLifecycleModel.test.ts similarity index 99% rename from test/MachineActivityLifecycleModel.test.ts rename to test/machine/ActivityLifecycleModel.test.ts index 15da768..2fc5510 100644 --- a/test/MachineActivityLifecycleModel.test.ts +++ b/test/machine/ActivityLifecycleModel.test.ts @@ -1,7 +1,7 @@ import { assert, describe, it } from "@effect/vitest" import { Deferred, Effect, Exit, Fiber, Schema, Stream } from "effect" import { TestClock } from "effect/testing" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" import { ActivityFailure, countRecords, diff --git a/test/MachineAnnotations.test.ts b/test/machine/Annotations.test.ts similarity index 98% rename from test/MachineAnnotations.test.ts rename to test/machine/Annotations.test.ts index aa7d90f..a96afd2 100644 --- a/test/MachineAnnotations.test.ts +++ b/test/machine/Annotations.test.ts @@ -1,6 +1,6 @@ import { assert, describe, it } from "@effect/vitest" import { Schema } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Workflow extends Schema.TaggedClass("Workflow")("Workflow", {}) {} class Idle extends Schema.TaggedClass("Idle")("Idle", {}) {} diff --git a/test/MachineAnnotationsVisualization.test.ts b/test/machine/AnnotationsVisualization.test.ts similarity index 97% rename from test/MachineAnnotationsVisualization.test.ts rename to test/machine/AnnotationsVisualization.test.ts index 3d85e3d..86959a6 100644 --- a/test/MachineAnnotationsVisualization.test.ts +++ b/test/machine/AnnotationsVisualization.test.ts @@ -1,6 +1,6 @@ import { assert, describe, it } from "@effect/vitest" import { Schema } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" import { makeTextRenderer } from "./visualization/text.js" class Workflow extends Schema.TaggedClass("Workflow")("Workflow", {}) {} diff --git a/test/MachineChoice.test.ts b/test/machine/Choice.test.ts similarity index 99% rename from test/MachineChoice.test.ts rename to test/machine/Choice.test.ts index 10d276d..960570f 100644 --- a/test/MachineChoice.test.ts +++ b/test/machine/Choice.test.ts @@ -1,7 +1,7 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Context, Data, Effect, Schema } from "effect" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" class Flow extends Schema.TaggedClass("Flow")("Flow", { score: Schema.Number }) {} class Approved extends Schema.TaggedClass("Approved")("Approved", {}) {} diff --git a/test/MachineDeepHandlers.test.ts b/test/machine/DeepHandlers.test.ts similarity index 99% rename from test/MachineDeepHandlers.test.ts rename to test/machine/DeepHandlers.test.ts index 7a5d50f..79e4237 100644 --- a/test/MachineDeepHandlers.test.ts +++ b/test/machine/DeepHandlers.test.ts @@ -1,6 +1,6 @@ import { assert, it } from "@effect/vitest" import { Effect, Fiber, Option, Schema, Stream } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class NodeState extends Schema.TaggedClass("DeepNode")("DeepNode", { level: Schema.Number }) {} class DeepIdle extends Schema.TaggedClass("DeepIdle")("DeepIdle", { value: Schema.String }) {} diff --git a/test/MachineHistory.test.ts b/test/machine/History.test.ts similarity index 99% rename from test/MachineHistory.test.ts rename to test/machine/History.test.ts index 7ddd4bc..592254e 100644 --- a/test/MachineHistory.test.ts +++ b/test/machine/History.test.ts @@ -1,6 +1,6 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Context, Data, Effect, Fiber, Schema, Stream } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Checkout extends Schema.TaggedClass("Checkout")("Checkout", { orderId: Schema.String diff --git a/test/MachineInspection.test.ts b/test/machine/Inspection.test.ts similarity index 99% rename from test/MachineInspection.test.ts rename to test/machine/Inspection.test.ts index 858f758..6fc8c97 100644 --- a/test/MachineInspection.test.ts +++ b/test/machine/Inspection.test.ts @@ -1,6 +1,6 @@ import { assert, describe, it } from "@effect/vitest" import { Effect, Schema } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Root extends Schema.TaggedClass("InspectionRoot")("InspectionRoot", {}) {} class Flow extends Schema.TaggedClass("InspectionFlow")("InspectionFlow", {}) {} diff --git a/test/Machine.test.ts b/test/machine/Machine.test.ts similarity index 99% rename from test/Machine.test.ts rename to test/machine/Machine.test.ts index 0b5fbc4..0b7ec16 100644 --- a/test/Machine.test.ts +++ b/test/machine/Machine.test.ts @@ -1,7 +1,7 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Context, Data, Deferred, Effect, Fiber, Option, Ref, Schema, Stream } from "effect" import { TestClock } from "effect/testing" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class DeferredLog extends Context.Service Effect.Effect diff --git a/test/PublicPrototype.test.ts b/test/machine/PublicPrototype.test.ts similarity index 95% rename from test/PublicPrototype.test.ts rename to test/machine/PublicPrototype.test.ts index c8b9cad..439a284 100644 --- a/test/PublicPrototype.test.ts +++ b/test/machine/PublicPrototype.test.ts @@ -1,6 +1,6 @@ import { assert, it } from "@effect/vitest" import { Schema } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Idle extends Schema.TaggedClass("Idle")("Idle", {}) {} class Start extends Schema.TaggedClass("Start")("Start", {}) {} diff --git a/test/MachineResume.test.ts b/test/machine/Resume.test.ts similarity index 99% rename from test/MachineResume.test.ts rename to test/machine/Resume.test.ts index e981b23..98370bf 100644 --- a/test/MachineResume.test.ts +++ b/test/machine/Resume.test.ts @@ -1,7 +1,7 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Deferred, Effect, Fiber, Option, Ref, Schema, Stream } from "effect" import { TestClock } from "effect/testing" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" const waitFor = ( ref: Machine.MachineRef, diff --git a/test/MachineRuntimeDifferential.test.ts b/test/machine/RuntimeDifferential.test.ts similarity index 99% rename from test/MachineRuntimeDifferential.test.ts rename to test/machine/RuntimeDifferential.test.ts index 6872114..7a1dd3b 100644 --- a/test/MachineRuntimeDifferential.test.ts +++ b/test/machine/RuntimeDifferential.test.ts @@ -1,10 +1,10 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Data, Effect, Fiber, Ref, Schema, Stream } from "effect" import { FastCheck } from "effect/testing" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" -import type { DifferentialStep } from "./support/machineRuntimeDifferential.js" -import { traceBoundary, traceSteps, verifyManagedExecution } from "./support/machineRuntimeDifferential.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" +import type { DifferentialStep } from "./support/runtimeDifferential.js" +import { traceBoundary, traceSteps, verifyManagedExecution } from "./support/runtimeDifferential.js" const event = (_tag: string): { readonly _tag: string } => ({ _tag }) diff --git a/test/MachineScheduling.test.ts b/test/machine/Scheduling.test.ts similarity index 97% rename from test/MachineScheduling.test.ts rename to test/machine/Scheduling.test.ts index a9d3382..737a629 100644 --- a/test/MachineScheduling.test.ts +++ b/test/machine/Scheduling.test.ts @@ -1,6 +1,6 @@ import { assert, describe, it } from "@effect/vitest" import { Effect, Schema } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class SchedulingActive extends Schema.TaggedClass("SchedulingActive")( "SchedulingActive", diff --git a/test/MachineSnapshotCodecAdversarial.test.ts b/test/machine/SnapshotCodecAdversarial.test.ts similarity index 99% rename from test/MachineSnapshotCodecAdversarial.test.ts rename to test/machine/SnapshotCodecAdversarial.test.ts index 5500d0f..772e851 100644 --- a/test/MachineSnapshotCodecAdversarial.test.ts +++ b/test/machine/SnapshotCodecAdversarial.test.ts @@ -1,7 +1,7 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Effect, Exit, Option, Schema } from "effect" import { FastCheck } from "effect/testing" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Root extends Schema.TaggedClass("CodecRoot")("CodecRoot", { id: Schema.NonEmptyString diff --git a/test/MachineSnapshotContext.test.ts b/test/machine/SnapshotContext.test.ts similarity index 99% rename from test/MachineSnapshotContext.test.ts rename to test/machine/SnapshotContext.test.ts index 841fe8d..075b5cf 100644 --- a/test/MachineSnapshotContext.test.ts +++ b/test/machine/SnapshotContext.test.ts @@ -1,6 +1,6 @@ import { assert, describe, it } from "@effect/vitest" import { Effect, Option, Schema } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class System extends Schema.TaggedClass("System")("System", {}) {} class Playback extends Schema.TaggedClass("Playback")("Playback", {}) {} diff --git a/test/MachineStateDefinition.test.ts b/test/machine/StateDefinition.test.ts similarity index 99% rename from test/MachineStateDefinition.test.ts rename to test/machine/StateDefinition.test.ts index 837f90d..a29af55 100644 --- a/test/MachineStateDefinition.test.ts +++ b/test/machine/StateDefinition.test.ts @@ -1,6 +1,6 @@ import { assert, describe, it } from "@effect/vitest" import { Schema } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Root extends Schema.TaggedClass("Root")("Root", {}) {} class Idle extends Schema.TaggedClass("Idle")("Idle", {}) {} diff --git a/test/MachineTotality.test.ts b/test/machine/Totality.test.ts similarity index 99% rename from test/MachineTotality.test.ts rename to test/machine/Totality.test.ts index c8ee64e..66fdf27 100644 --- a/test/MachineTotality.test.ts +++ b/test/machine/Totality.test.ts @@ -2,8 +2,8 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Effect, Exit, Fiber, Schema, Stream } from "effect" import { FastCheck } from "effect/testing" import { isDeepStrictEqual } from "node:util" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" const generatedModels = MachineTest.finiteModels({ maxRoots: 3, diff --git a/test/MachineVisualization.test.ts b/test/machine/Visualization.test.ts similarity index 99% rename from test/MachineVisualization.test.ts rename to test/machine/Visualization.test.ts index 02d137a..f496c7b 100644 --- a/test/MachineVisualization.test.ts +++ b/test/machine/Visualization.test.ts @@ -1,6 +1,6 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Effect, Schema } from "effect" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" import { makeTextRenderer } from "./visualization/text.js" class Application extends Schema.TaggedClass("Application")("Application", {}) {} diff --git a/test/support/activityLifecycleModel.ts b/test/machine/support/activityLifecycleModel.ts similarity index 99% rename from test/support/activityLifecycleModel.ts rename to test/machine/support/activityLifecycleModel.ts index 9296d8b..4eabcc0 100644 --- a/test/support/activityLifecycleModel.ts +++ b/test/machine/support/activityLifecycleModel.ts @@ -1,6 +1,6 @@ import { Cause, Data, Deferred, Effect, Exit, Queue, Ref } from "effect" import { FastCheck } from "effect/testing" -import { Machine } from "../../src/index.js" +import { Machine } from "../../../src/index.js" export type ActivityOutcome = "succeeded" | "cancelled" | "failed" diff --git a/test/support/machineRuntimeDifferential.ts b/test/machine/support/runtimeDifferential.ts similarity index 97% rename from test/support/machineRuntimeDifferential.ts rename to test/machine/support/runtimeDifferential.ts index a94509a..ceb10f5 100644 --- a/test/support/machineRuntimeDifferential.ts +++ b/test/machine/support/runtimeDifferential.ts @@ -1,8 +1,8 @@ import { assert } from "@effect/vitest" import { Effect, Fiber, Stream } from "effect" import { isDeepStrictEqual } from "node:util" -import { Machine } from "../../src/index.js" -import { MachineTest } from "../../src/testing.js" +import { Machine } from "../../../src/index.js" +import { MachineTest } from "../../../src/testing/index.js" export type DifferentialStep = { readonly event: { readonly _tag: string } diff --git a/test/visualization/text.ts b/test/machine/visualization/text.ts similarity index 100% rename from test/visualization/text.ts rename to test/machine/visualization/text.ts diff --git a/test/MachineTestCoverage.test.ts b/test/testing/Coverage.test.ts similarity index 99% rename from test/MachineTestCoverage.test.ts rename to test/testing/Coverage.test.ts index f10d4d8..e0c46a0 100644 --- a/test/MachineTestCoverage.test.ts +++ b/test/testing/Coverage.test.ts @@ -3,8 +3,8 @@ import * as Effect from "effect/Effect" import * as Graph from "effect/Graph" import * as Option from "effect/Option" import * as Schema from "effect/Schema" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" class Count extends Schema.TaggedClass("Count")("Count", { value: Schema.Int diff --git a/test/MachineTestFiniteModel.test.ts b/test/testing/FiniteModel.test.ts similarity index 99% rename from test/MachineTestFiniteModel.test.ts rename to test/testing/FiniteModel.test.ts index 0e13170..cca8af5 100644 --- a/test/MachineTestFiniteModel.test.ts +++ b/test/testing/FiniteModel.test.ts @@ -1,8 +1,8 @@ import { assert, describe, it } from "@effect/vitest" import { Effect } from "effect" import { FastCheck } from "effect/testing" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" type FlatState = { readonly node: MachineTest.FiniteState diff --git a/test/MachineTest.test.ts b/test/testing/MachineTest.test.ts similarity index 98% rename from test/MachineTest.test.ts rename to test/testing/MachineTest.test.ts index a7bb6ee..0806722 100644 --- a/test/MachineTest.test.ts +++ b/test/testing/MachineTest.test.ts @@ -1,8 +1,8 @@ import { assert, describe, it } from "@effect/vitest" import { Data, Effect, Schema } from "effect" import { FastCheck } from "effect/testing" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" class TestInput extends Schema.Class("TestInput")({ userId: Schema.String diff --git a/test/MachineTestReferenceModel.test.ts b/test/testing/ReferenceModel.test.ts similarity index 99% rename from test/MachineTestReferenceModel.test.ts rename to test/testing/ReferenceModel.test.ts index 1f24df7..bfc41b9 100644 --- a/test/MachineTestReferenceModel.test.ts +++ b/test/testing/ReferenceModel.test.ts @@ -2,8 +2,8 @@ import { assert, describe, it } from "@effect/vitest" import * as Effect from "effect/Effect" import * as Schema from "effect/Schema" import { FastCheck } from "effect/testing" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" const event = (_tag: string): { readonly _tag: string } => ({ _tag }) diff --git a/test/MachineTestRuntime.test.ts b/test/testing/Runtime.test.ts similarity index 99% rename from test/MachineTestRuntime.test.ts rename to test/testing/Runtime.test.ts index 3eba1d3..bff51c2 100644 --- a/test/MachineTestRuntime.test.ts +++ b/test/testing/Runtime.test.ts @@ -1,8 +1,8 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Clock, Effect, Exit, Option, Ref, Schema, Stream } from "effect" import { FastCheck } from "effect/testing" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" class Counter extends Schema.TaggedClass("Counter")("Counter", { count: Schema.Int diff --git a/test/MachineTestVerification.test.ts b/test/testing/Verification.test.ts similarity index 99% rename from test/MachineTestVerification.test.ts rename to test/testing/Verification.test.ts index 93f2cad..8533465 100644 --- a/test/MachineTestVerification.test.ts +++ b/test/testing/Verification.test.ts @@ -1,7 +1,7 @@ import { assert, describe, it } from "@effect/vitest" import { Effect, Schema } from "effect" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" class Off extends Schema.TaggedClass("Off")("Off", {}) {} class App extends Schema.TaggedClass("App")("App", {}) {} diff --git a/test/ClusterMachine.test.ts b/test/unstable/cluster/ClusterMachine.test.ts similarity index 99% rename from test/ClusterMachine.test.ts rename to test/unstable/cluster/ClusterMachine.test.ts index ee5a4b9..2b8a02a 100644 --- a/test/ClusterMachine.test.ts +++ b/test/unstable/cluster/ClusterMachine.test.ts @@ -11,8 +11,8 @@ import { ShardingConfig, Snowflake } from "effect/unstable/cluster" -import { ClusterMachine } from "../src/cluster.js" -import { Machine } from "../src/index.js" +import { Machine } from "../../../src/index.js" +import { ClusterMachine } from "../../../src/unstable/cluster/index.js" class Count extends Schema.TaggedClass("Count")("Count", { value: Schema.NumberFromString diff --git a/test/AtomMachine.test.ts b/test/unstable/reactivity/AtomMachine.test.ts similarity index 99% rename from test/AtomMachine.test.ts rename to test/unstable/reactivity/AtomMachine.test.ts index 84b77a0..56a953a 100644 --- a/test/AtomMachine.test.ts +++ b/test/unstable/reactivity/AtomMachine.test.ts @@ -1,8 +1,8 @@ import { assert, describe, it } from "@effect/vitest" import { Cause, Context, Data, Deferred, Effect, Fiber, Layer, Option, Ref, Schema, Stream } from "effect" import { AsyncResult, Atom, AtomRegistry } from "effect/unstable/reactivity" -import { Machine } from "../src/index.js" -import { AtomMachine } from "../src/reactivity.js" +import { Machine } from "../../../src/index.js" +import { AtomMachine } from "../../../src/unstable/reactivity/index.js" class Count extends Schema.TaggedClass("Count")("Count", { value: Schema.Number diff --git a/typetest/MachineActivities.tst.ts b/typetest/machine/Activities.tst.ts similarity index 97% rename from typetest/MachineActivities.tst.ts rename to typetest/machine/Activities.tst.ts index 8c46676..15532a1 100644 --- a/typetest/MachineActivities.tst.ts +++ b/typetest/machine/Activities.tst.ts @@ -1,6 +1,6 @@ import { Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Loading extends Schema.TaggedClass("Loading")("Loading", {}) {} class Dynamic extends Schema.TaggedClass("Dynamic")("Dynamic", {}) {} diff --git a/typetest/MachineAnnotations.tst.ts b/typetest/machine/Annotations.tst.ts similarity index 98% rename from typetest/MachineAnnotations.tst.ts rename to typetest/machine/Annotations.tst.ts index 6daf157..9674fb2 100644 --- a/typetest/MachineAnnotations.tst.ts +++ b/typetest/machine/Annotations.tst.ts @@ -1,6 +1,6 @@ import { Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Workflow extends Schema.TaggedClass("Workflow")("Workflow", {}) {} class Idle extends Schema.TaggedClass("Idle")("Idle", {}) {} diff --git a/typetest/MachineChoice.tst.ts b/typetest/machine/Choice.tst.ts similarity index 99% rename from typetest/MachineChoice.tst.ts rename to typetest/machine/Choice.tst.ts index eedecc3..452eae9 100644 --- a/typetest/MachineChoice.tst.ts +++ b/typetest/machine/Choice.tst.ts @@ -1,6 +1,6 @@ import { Context, Data, Effect, Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Flow extends Schema.TaggedClass("Flow")("Flow", { score: Schema.Number }) {} class Approved extends Schema.TaggedClass("Approved")("Approved", {}) {} diff --git a/typetest/MachineDeepHandlers.tst.ts b/typetest/machine/DeepHandlers.tst.ts similarity index 99% rename from typetest/MachineDeepHandlers.tst.ts rename to typetest/machine/DeepHandlers.tst.ts index 3fc90f2..7bc8ef7 100644 --- a/typetest/MachineDeepHandlers.tst.ts +++ b/typetest/machine/DeepHandlers.tst.ts @@ -1,6 +1,6 @@ import { Context, Data, Effect, Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Root extends Schema.TaggedClass("Root")("Root", {}) {} class Branch extends Schema.TaggedClass("Branch")("Branch", {}) {} diff --git a/typetest/MachineEventByTag.tst.ts b/typetest/machine/EventByTag.tst.ts similarity index 97% rename from typetest/MachineEventByTag.tst.ts rename to typetest/machine/EventByTag.tst.ts index 13c26b8..02df7a0 100644 --- a/typetest/MachineEventByTag.tst.ts +++ b/typetest/machine/EventByTag.tst.ts @@ -1,6 +1,6 @@ import { Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" describe("Machine.EventByTag", () => { class Idle extends Schema.TaggedClass("EventByTagIdle")("EventByTagIdle", {}) {} diff --git a/typetest/MachineHistory.tst.ts b/typetest/machine/History.tst.ts similarity index 99% rename from typetest/MachineHistory.tst.ts rename to typetest/machine/History.tst.ts index 91325bb..bd9c668 100644 --- a/typetest/MachineHistory.tst.ts +++ b/typetest/machine/History.tst.ts @@ -1,6 +1,6 @@ import { Context, Effect, Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Checkout extends Schema.TaggedClass("Checkout")("Checkout", { orderId: Schema.String diff --git a/typetest/MachineInspection.tst.ts b/typetest/machine/Inspection.tst.ts similarity index 99% rename from typetest/MachineInspection.tst.ts rename to typetest/machine/Inspection.tst.ts index 9526133..5373cc9 100644 --- a/typetest/MachineInspection.tst.ts +++ b/typetest/machine/Inspection.tst.ts @@ -1,6 +1,6 @@ import { Effect, Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" describe("Machine inspection", () => { class Root extends Schema.TaggedClass("Root")("Root", {}) {} diff --git a/typetest/Machine.tst.ts b/typetest/machine/Machine.tst.ts similarity index 99% rename from typetest/Machine.tst.ts rename to typetest/machine/Machine.tst.ts index 5088067..5daa251 100644 --- a/typetest/Machine.tst.ts +++ b/typetest/machine/Machine.tst.ts @@ -1,6 +1,6 @@ import { Context, Effect, Option, Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" describe("Machine", () => { class Up extends Schema.TaggedClass("Up")("Up", { diff --git a/typetest/MachineReadiness.tst.ts b/typetest/machine/Readiness.tst.ts similarity index 97% rename from typetest/MachineReadiness.tst.ts rename to typetest/machine/Readiness.tst.ts index e964022..b5ed2e8 100644 --- a/typetest/MachineReadiness.tst.ts +++ b/typetest/machine/Readiness.tst.ts @@ -1,9 +1,9 @@ import { Effect, Schema } from "effect" import { describe, expect, it } from "tstyche" -import { ClusterMachine } from "../src/cluster.js" -import { Machine } from "../src/index.js" -import { AtomMachine } from "../src/reactivity.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" +import { ClusterMachine } from "../../src/unstable/cluster/index.js" +import { AtomMachine } from "../../src/unstable/reactivity/index.js" class Ready extends Schema.TaggedClass("Ready")("Ready", {}) {} class Flow extends Schema.TaggedClass("Flow")("Flow", {}) {} diff --git a/typetest/MachineResume.tst.ts b/typetest/machine/Resume.tst.ts similarity index 95% rename from typetest/MachineResume.tst.ts rename to typetest/machine/Resume.tst.ts index c847370..36cd535 100644 --- a/typetest/MachineResume.tst.ts +++ b/typetest/machine/Resume.tst.ts @@ -1,8 +1,8 @@ import { Effect, Schema } from "effect" import { Atom } from "effect/unstable/reactivity" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" -import { AtomMachine } from "../src/reactivity.js" +import { Machine } from "../../src/index.js" +import { AtomMachine } from "../../src/unstable/reactivity/index.js" class Idle extends Schema.TaggedClass("Idle")("Idle", { value: Schema.Number }) {} class Tick extends Schema.TaggedClass("Tick")("Tick", {}) {} diff --git a/typetest/MachineSnapshotContext.tst.ts b/typetest/machine/SnapshotContext.tst.ts similarity index 98% rename from typetest/MachineSnapshotContext.tst.ts rename to typetest/machine/SnapshotContext.tst.ts index 344f013..1822bf5 100644 --- a/typetest/MachineSnapshotContext.tst.ts +++ b/typetest/machine/SnapshotContext.tst.ts @@ -1,6 +1,6 @@ import { Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Root extends Schema.TaggedClass("Root")("Root", {}) {} class Left extends Schema.TaggedClass("Left")("Left", {}) {} diff --git a/typetest/MachineStateDefinition.tst.ts b/typetest/machine/StateDefinition.tst.ts similarity index 99% rename from typetest/MachineStateDefinition.tst.ts rename to typetest/machine/StateDefinition.tst.ts index c205373..2b0fd34 100644 --- a/typetest/MachineStateDefinition.tst.ts +++ b/typetest/machine/StateDefinition.tst.ts @@ -1,6 +1,6 @@ import { Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" +import { Machine } from "../../src/index.js" class Root extends Schema.TaggedClass("Root")("Root", {}) {} class Idle extends Schema.TaggedClass("Idle")("Idle", {}) {} diff --git a/typetest/MachineTestCoverage.tst.ts b/typetest/testing/Coverage.tst.ts similarity index 95% rename from typetest/MachineTestCoverage.tst.ts rename to typetest/testing/Coverage.tst.ts index ff90e01..aa4c83c 100644 --- a/typetest/MachineTestCoverage.tst.ts +++ b/typetest/testing/Coverage.tst.ts @@ -2,8 +2,8 @@ import * as Effect from "effect/Effect" import * as Graph from "effect/Graph" import * as Schema from "effect/Schema" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" describe("MachineTest coverage and observed graph", () => { class Idle extends Schema.TaggedClass("Idle")("Idle", {}) {} diff --git a/typetest/MachineTestFiniteModel.tst.ts b/typetest/testing/FiniteModel.tst.ts similarity index 98% rename from typetest/MachineTestFiniteModel.tst.ts rename to typetest/testing/FiniteModel.tst.ts index b7b3739..63c7dbb 100644 --- a/typetest/MachineTestFiniteModel.tst.ts +++ b/typetest/testing/FiniteModel.tst.ts @@ -1,7 +1,7 @@ import { FastCheck } from "effect/testing" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" describe("MachineTest finite models", () => { it("uses one discriminated trigger representation", () => { diff --git a/typetest/MachineTest.tst.ts b/typetest/testing/MachineTest.tst.ts similarity index 98% rename from typetest/MachineTest.tst.ts rename to typetest/testing/MachineTest.tst.ts index 4e23beb..8d3010d 100644 --- a/typetest/MachineTest.tst.ts +++ b/typetest/testing/MachineTest.tst.ts @@ -1,8 +1,8 @@ import { Cause, Context, Data, Effect, Schema } from "effect" import { FastCheck } from "effect/testing" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" describe("MachineTest", () => { class Input extends Schema.Class("Input")({ id: Schema.String }) {} diff --git a/typetest/MachineTestReferenceModel.tst.ts b/typetest/testing/ReferenceModel.tst.ts similarity index 97% rename from typetest/MachineTestReferenceModel.tst.ts rename to typetest/testing/ReferenceModel.tst.ts index 0ac9929..9ff70bb 100644 --- a/typetest/MachineTestReferenceModel.tst.ts +++ b/typetest/testing/ReferenceModel.tst.ts @@ -1,6 +1,6 @@ import { Effect } from "effect" import { describe, expect, it } from "tstyche" -import { MachineTest } from "../src/testing.js" +import { MachineTest } from "../../src/testing/index.js" describe("MachineTest finite-model reference interpreter", () => { const model: MachineTest.FiniteModel = { diff --git a/typetest/MachineTestVerification.tst.ts b/typetest/testing/Verification.tst.ts similarity index 93% rename from typetest/MachineTestVerification.tst.ts rename to typetest/testing/Verification.tst.ts index cf4d70f..4800001 100644 --- a/typetest/MachineTestVerification.tst.ts +++ b/typetest/testing/Verification.tst.ts @@ -1,7 +1,7 @@ import { Effect, Schema } from "effect" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" -import { MachineTest } from "../src/testing.js" +import { Machine } from "../../src/index.js" +import { MachineTest } from "../../src/testing/index.js" describe("MachineTest.verify", () => { class Idle extends Schema.TaggedClass("Idle")("Idle", {}) {} diff --git a/typetest/ClusterMachine.tst.ts b/typetest/unstable/cluster/ClusterMachine.tst.ts similarity index 97% rename from typetest/ClusterMachine.tst.ts rename to typetest/unstable/cluster/ClusterMachine.tst.ts index 46c4887..e0172fa 100644 --- a/typetest/ClusterMachine.tst.ts +++ b/typetest/unstable/cluster/ClusterMachine.tst.ts @@ -2,8 +2,8 @@ import { Context, Effect, type Layer, Option, Schema, SchemaGetter } from "effec import { type MessageStorage, type Sharding } from "effect/unstable/cluster" import type { Rpc, RpcGroup } from "effect/unstable/rpc" import { describe, expect, it } from "tstyche" -import { ClusterMachine } from "../src/cluster.js" -import { Machine } from "../src/index.js" +import { Machine } from "../../../src/index.js" +import { ClusterMachine } from "../../../src/unstable/cluster/index.js" describe("ClusterMachine", () => { class Count extends Schema.TaggedClass("Count")("Count", { diff --git a/typetest/AtomMachine.tst.ts b/typetest/unstable/reactivity/AtomMachine.tst.ts similarity index 98% rename from typetest/AtomMachine.tst.ts rename to typetest/unstable/reactivity/AtomMachine.tst.ts index 151de72..677f90a 100644 --- a/typetest/AtomMachine.tst.ts +++ b/typetest/unstable/reactivity/AtomMachine.tst.ts @@ -1,8 +1,8 @@ import { Context, Effect, Layer, type Option, Schema } from "effect" import { AsyncResult, Atom } from "effect/unstable/reactivity" import { describe, expect, it } from "tstyche" -import { Machine } from "../src/index.js" -import { AtomMachine } from "../src/reactivity.js" +import { Machine } from "../../../src/index.js" +import { AtomMachine } from "../../../src/unstable/reactivity/index.js" class Idle extends Schema.TaggedClass("Idle")("Idle", {}) {}