@avytheone/efmesh 0.1.0-beta.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +171 -92
- package/README.md +83 -9
- package/README.ru.md +80 -5
- package/SPEC.md +542 -459
- package/package.json +4 -1
- package/src/bin.ts +39 -2
- package/src/cli.ts +505 -85
- package/src/config.ts +15 -15
- package/src/core/audit.ts +15 -11
- package/src/core/errors.ts +37 -7
- package/src/core/graph.ts +6 -6
- package/src/core/interval.ts +18 -18
- package/src/core/model.ts +76 -75
- package/src/core/sql.ts +21 -21
- package/src/discovery.ts +16 -8
- package/src/efmesh.ts +28 -15
- package/src/engine/adapter.ts +29 -12
- package/src/engine/duckdb.ts +7 -7
- package/src/engine/postgres.ts +17 -17
- package/src/error-text.ts +35 -0
- package/src/index.ts +44 -13
- package/src/init.ts +100 -28
- package/src/plan/audit-run.ts +21 -13
- package/src/plan/categorize.ts +10 -7
- package/src/plan/contract.ts +23 -19
- package/src/plan/diff.ts +228 -4
- package/src/plan/executor.ts +223 -121
- package/src/plan/explain.ts +114 -0
- package/src/plan/fingerprint.ts +84 -31
- package/src/plan/graph-html.ts +7 -7
- package/src/plan/janitor.ts +30 -25
- package/src/plan/lineage.ts +20 -16
- package/src/plan/lock.ts +27 -10
- package/src/plan/metrics.ts +4 -4
- package/src/plan/naming.ts +23 -23
- package/src/plan/planner.ts +238 -52
- package/src/plan/run.ts +72 -26
- package/src/plan/schedule.ts +217 -0
- package/src/plan/status.ts +96 -0
- package/src/state/postgres.ts +68 -19
- package/src/state/sqlite.ts +74 -27
- package/src/state/store.ts +88 -45
- package/src/testing/index.ts +27 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avytheone/efmesh",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "sqlmesh-like data transformation framework on TypeScript, Bun and Effect",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alexey Yakimanskiy",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
],
|
|
31
31
|
"type": "module",
|
|
32
32
|
"module": "src/index.ts",
|
|
33
|
+
"engines": {
|
|
34
|
+
"bun": ">=1.3.11"
|
|
35
|
+
},
|
|
33
36
|
"bin": {
|
|
34
37
|
"efmesh": "src/bin.ts"
|
|
35
38
|
},
|
package/src/bin.ts
CHANGED
|
@@ -1,12 +1,49 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { BunRuntime, BunServices } from "@effect/platform-bun"
|
|
3
|
-
import { Effect } from "effect"
|
|
3
|
+
import { Cause, Effect, Logger } from "effect"
|
|
4
4
|
import { Command } from "effect/unstable/cli"
|
|
5
|
-
import { rootCommand } from "./cli.ts"
|
|
5
|
+
import { renderFailure, rootCommand, wantsTrace } from "./cli.ts"
|
|
6
6
|
import { version } from "../package.json"
|
|
7
7
|
|
|
8
|
+
// Logging (#14) goes to STDERR so `--json` stdout stays byte-clean — a contract
|
|
9
|
+
// for CI and agents. A human at a stderr TTY gets colored pretty output; a pipe,
|
|
10
|
+
// log file or the systemd journal gets plain one-line logfmt with no ANSI, which
|
|
11
|
+
// the fields (model=, env=, interval=) make machine-readable. The minimum level
|
|
12
|
+
// is Info by default (lifecycle visible during apply/run); the CLI's built-in
|
|
13
|
+
// `--log-level` flag lowers it to debug (SQL, lock internals) or raises it. An
|
|
14
|
+
// embedder wanting different sinks/levels provides its own Logger layer instead.
|
|
15
|
+
const loggerLayer = Logger.layer([
|
|
16
|
+
process.stderr.isTTY === true
|
|
17
|
+
? Logger.consolePretty({ stderr: true })
|
|
18
|
+
: Logger.withConsoleError(Logger.formatLogFmt),
|
|
19
|
+
])
|
|
20
|
+
|
|
21
|
+
// One central failure screen (#13): catch every cause here and render it
|
|
22
|
+
// ourselves (cause first, one screen, fiber trace only under --log-level
|
|
23
|
+
// debug) instead of letting runMain dump a pretty cause over an empty message.
|
|
24
|
+
// Interrupts (Ctrl+C) are not failures — leave them to the default teardown.
|
|
25
|
+
// The exit code stays a frozen contract: a rendered failure is 1, unless a
|
|
26
|
+
// command already claimed 2 ("awaiting a human") before failing.
|
|
27
|
+
const debug = wantsTrace(process.argv)
|
|
28
|
+
|
|
29
|
+
// Interrupt with nothing failed/died — Ctrl+C during a clean wait: not a
|
|
30
|
+
// failure to render, hand it back to the default teardown.
|
|
31
|
+
const isInterruptOnly = (cause: Cause.Cause<unknown>): boolean =>
|
|
32
|
+
!Cause.hasFails(cause) && Cause.interruptors(cause).size > 0
|
|
33
|
+
|
|
8
34
|
rootCommand.pipe(
|
|
9
35
|
Command.run({ version }),
|
|
36
|
+
Effect.catchCause((cause) =>
|
|
37
|
+
isInterruptOnly(cause)
|
|
38
|
+
? Effect.failCause(cause)
|
|
39
|
+
: Effect.sync(() => {
|
|
40
|
+
process.stderr.write(`${renderFailure(cause, { debug })}\n`)
|
|
41
|
+
if (process.exitCode === undefined || process.exitCode === 0) {
|
|
42
|
+
process.exitCode = 1
|
|
43
|
+
}
|
|
44
|
+
}),
|
|
45
|
+
),
|
|
46
|
+
Effect.provide(loggerLayer),
|
|
10
47
|
Effect.provide(BunServices.layer),
|
|
11
48
|
BunRuntime.runMain,
|
|
12
49
|
)
|