@shivaedev/effect-test-sql 0.7.5 → 0.8.0
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 +12 -0
- package/README.md +14 -14
- package/dist/server/database.d.ts +1 -1
- package/dist/server/database.js +1 -1
- package/dist/server/database.js.map +1 -1
- package/package.json +8 -8
- package/src/server/database.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0 - 2026-10-19
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Quality's `manifests/exports-shape` rule checks exports at the package root and in workspace members by default. Modules use one file-preserving TypeScript wildcard with matching source, types and runtime targets; root entries, exact non-code assets, package metadata and null blocks are allowed.
|
|
8
|
+
|
|
9
|
+
### Breaking
|
|
10
|
+
|
|
11
|
+
- Quality's Biome preset moves from `@shivaedev/quality/biome` to `@shivaedev/quality/biome/preset.json`. Change the `extends` entry in your Biome config to the new path; the old alias is removed. TypeScript preset paths are unchanged.
|
|
12
|
+
- `@shivaedev/effect-pg-boss`, `@shivaedev/effect-test-sql`, `@shivaedev/local-postgres` and `@shivaedev/test-story` expose server modules at their file paths. Add `/server/` after the package name in imports, for example `@shivaedev/test-story/server/storyKit.ts`. The shortened paths are removed; internal server modules remain blocked.
|
|
13
|
+
- Work Board moves `@shivaedev/work-board/client/client.ts` to `@shivaedev/work-board/browserClient.ts`; change browser-client imports to that file path. `@shivaedev/work-board/client/document/View.ts` is removed: consume document queries with your own renderer, or use the bundled Board browser UI. The client bundle stays private and the old export overrides are removed.
|
|
14
|
+
|
|
3
15
|
## 0.7.5 - 2026-10-19
|
|
4
16
|
|
|
5
17
|
### Changed
|
package/README.md
CHANGED
|
@@ -33,8 +33,8 @@ import { expect } from "vitest";
|
|
|
33
33
|
import { Config, Effect, Redacted } from "effect";
|
|
34
34
|
import { Migrator, SqlClient } from "effect/sql";
|
|
35
35
|
import { makeEffectIt } from "@shivaedev/effect-test/vitest.ts";
|
|
36
|
-
import { makePostgresTestLayer } from "@shivaedev/effect-test-sql/postgres.ts";
|
|
37
|
-
import { withTestTransaction } from "@shivaedev/effect-test-sql/withTestTransaction.ts";
|
|
36
|
+
import { makePostgresTestLayer } from "@shivaedev/effect-test-sql/server/postgres.ts";
|
|
37
|
+
import { withTestTransaction } from "@shivaedev/effect-test-sql/server/withTestTransaction.ts";
|
|
38
38
|
|
|
39
39
|
const layer = makePostgresTestLayer({
|
|
40
40
|
url: Redacted.make(Effect.runSync(Config.String("TEST_DATABASE_URL"))),
|
|
@@ -126,7 +126,7 @@ Use `withIsolatedDatabase` for after-commit effects, LISTEN/NOTIFY, advisory-loc
|
|
|
126
126
|
An isolated block can live inside the rollback tester above:
|
|
127
127
|
|
|
128
128
|
```ts
|
|
129
|
-
import { withIsolatedDatabase } from "@shivaedev/effect-test-sql/withIsolatedDatabase.ts";
|
|
129
|
+
import { withIsolatedDatabase } from "@shivaedev/effect-test-sql/server/withIsolatedDatabase.ts";
|
|
130
130
|
|
|
131
131
|
effectApp("commits in its own database", function* () {
|
|
132
132
|
yield* withIsolatedDatabase(Effect.gen(function* () {
|
|
@@ -162,8 +162,8 @@ A backfill needs rows in the old schema. Prepare an empty template with the appl
|
|
|
162
162
|
This example uses an application loader whose `001_create_contacts` migration creates `contacts(id, email)`, `002_backfill_emails` creates `emails(contact_id, address)` and copies the contact email addresses into it, and `003_drop_email` drops `contacts.email`:
|
|
163
163
|
|
|
164
164
|
```ts
|
|
165
|
-
import { migrationSteps } from "@shivaedev/effect-test-sql/migrationSteps.ts";
|
|
166
|
-
import { withIsolatedDatabase } from "@shivaedev/effect-test-sql/withIsolatedDatabase.ts";
|
|
165
|
+
import { migrationSteps } from "@shivaedev/effect-test-sql/server/migrationSteps.ts";
|
|
166
|
+
import { withIsolatedDatabase } from "@shivaedev/effect-test-sql/server/withIsolatedDatabase.ts";
|
|
167
167
|
import { appMigrations } from "./migrations.ts";
|
|
168
168
|
|
|
169
169
|
const migrationLayer = makePostgresTestLayer({
|
|
@@ -199,8 +199,8 @@ For test-story, use the same Layer and `around: withIsolatedDatabase`, acquire `
|
|
|
199
199
|
A fresh-database test cannot prove that older databases upgrade to the current model. Run `migrationUpgrade` in a disposable database with an empty migration ledger, outside a wrapping transaction. It resolves the application's loader once, commits migrations through the existing `upTo` id, then applies the remaining migrations through `migratePostgres`. It returns the target table's column names and PostgreSQL `format_type` strings, including type modifiers such as `numeric(10,2)`; dropped columns are excluded.
|
|
200
200
|
|
|
201
201
|
```ts
|
|
202
|
-
import { assertModelColumns } from "@shivaedev/effect-test-sql/assertModelColumns.ts";
|
|
203
|
-
import { migrationUpgrade } from "@shivaedev/effect-test-sql/migrationUpgrade.ts";
|
|
202
|
+
import { assertModelColumns } from "@shivaedev/effect-test-sql/server/assertModelColumns.ts";
|
|
203
|
+
import { migrationUpgrade } from "@shivaedev/effect-test-sql/server/migrationUpgrade.ts";
|
|
204
204
|
|
|
205
205
|
const columns = yield* migrationUpgrade({
|
|
206
206
|
migrations: appMigrations,
|
|
@@ -226,13 +226,13 @@ Import each name from the module that defines it. The package has no root entry.
|
|
|
226
226
|
|
|
227
227
|
| Module | Exports |
|
|
228
228
|
| --- | --- |
|
|
229
|
-
| `@shivaedev/effect-test-sql/postgres.ts` | `makePostgresTestLayer({ url, migrations, fixtures?, maxConnections?, prepare?, transformQueryNames?, transformResultNames? })`, `PostgresTestOptions`, `PostgresTestLoader` |
|
|
230
|
-
| `@shivaedev/effect-test-sql/withTestTransaction.ts` | `withTestTransaction(effect)` |
|
|
231
|
-
| `@shivaedev/effect-test-sql/withIsolatedDatabase.ts` | `withIsolatedDatabase(effect, { template? }?)` |
|
|
232
|
-
| `@shivaedev/effect-test-sql/database.ts` | `PostgresTestDatabase`, `PostgresTestDatabaseService`, `PostgresTestServices`, `PostgresTestTemplate` |
|
|
233
|
-
| `@shivaedev/effect-test-sql/migrationSteps.ts` | `migrationSteps(appMigrations)` returning `{ migrateTo(name), migrateToLatest }` |
|
|
234
|
-
| `@shivaedev/effect-test-sql/migrationUpgrade.ts` | `migrationUpgrade({ migrations, upTo, table })`, `MigrationUpgradeOptions`, `PostgresColumn` |
|
|
235
|
-
| `@shivaedev/effect-test-sql/assertModelColumns.ts` | `assertModelColumns(columns, model, types)`, `ModelColumnMismatch` |
|
|
229
|
+
| `@shivaedev/effect-test-sql/server/postgres.ts` | `makePostgresTestLayer({ url, migrations, fixtures?, maxConnections?, prepare?, transformQueryNames?, transformResultNames? })`, `PostgresTestOptions`, `PostgresTestLoader` |
|
|
230
|
+
| `@shivaedev/effect-test-sql/server/withTestTransaction.ts` | `withTestTransaction(effect)` |
|
|
231
|
+
| `@shivaedev/effect-test-sql/server/withIsolatedDatabase.ts` | `withIsolatedDatabase(effect, { template? }?)` |
|
|
232
|
+
| `@shivaedev/effect-test-sql/server/database.ts` | `PostgresTestDatabase`, `PostgresTestDatabaseService`, `PostgresTestServices`, `PostgresTestTemplate` |
|
|
233
|
+
| `@shivaedev/effect-test-sql/server/migrationSteps.ts` | `migrationSteps(appMigrations)` returning `{ migrateTo(name), migrateToLatest }` |
|
|
234
|
+
| `@shivaedev/effect-test-sql/server/migrationUpgrade.ts` | `migrationUpgrade({ migrations, upTo, table })`, `MigrationUpgradeOptions`, `PostgresColumn` |
|
|
235
|
+
| `@shivaedev/effect-test-sql/server/assertModelColumns.ts` | `assertModelColumns(columns, model, types)`, `ModelColumnMismatch` |
|
|
236
236
|
|
|
237
237
|
`url` is a redacted PostgreSQL URL for an existing administrative database. `PostgresTestDatabase` supplies the current database's redacted `url`, an `awaitCleanup: Effect<void>` drain, a scoped `isolated` Effect that acquires a migrated clone's service Context, and `clone(template)` for an explicit `"empty"` or `"migrated"` choice. With `prepare: false`, both choices are empty. Prefer `withIsolatedDatabase` to acquire and release that Context around a test. Wrappers retain the body's result, failures and unmet service requirements, with native `SqlError` added for acquisition or transaction failures. Cleanup failures surface as SQL defects when the Layer closes. Drops that fail with connection exhaustion (SQLSTATE `53300`) retry every 100 ms of live time for up to 300 retries, even while a test clock is paused; if capacity does not return, the SQL defect remains visible. Startup sweeps databases left by dead processes on the same host and databases from the older unowned naming format. Databases owned by live processes or another host are retained, so local parallel workers keep their databases. Use the same host to reclaim its abandoned databases.
|
|
238
238
|
|
|
@@ -11,7 +11,7 @@ export interface PostgresTestDatabaseService {
|
|
|
11
11
|
readonly isolated: Effect.Effect<Context.Context<PostgresTestServices | PostgresTestDatabase>, SqlError, Scope.Scope>;
|
|
12
12
|
readonly url: Redacted.Redacted<string>;
|
|
13
13
|
}
|
|
14
|
-
declare const PostgresTestDatabase_base: Context.ServiceClass<PostgresTestDatabase, "@shivaedev/effect-test-sql/PostgresTestDatabase", PostgresTestDatabaseService>;
|
|
14
|
+
declare const PostgresTestDatabase_base: Context.ServiceClass<PostgresTestDatabase, "@shivaedev/effect-test-sql/server/PostgresTestDatabase", PostgresTestDatabaseService>;
|
|
15
15
|
export declare class PostgresTestDatabase extends PostgresTestDatabase_base {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
package/dist/server/database.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
|
-
export class PostgresTestDatabase extends Context.Service()("@shivaedev/effect-test-sql/PostgresTestDatabase") {
|
|
2
|
+
export class PostgresTestDatabase extends Context.Service()("@shivaedev/effect-test-sql/server/PostgresTestDatabase") {
|
|
3
3
|
}
|
|
4
4
|
//# sourceMappingURL=database.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/server/database.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA0C,MAAM,QAAQ,CAAC;AAiBzE,MAAM,OAAO,oBAAqB,SAAQ,OAAO,CAAC,OAAO,EAAqD,CAC7G,
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/server/database.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA0C,MAAM,QAAQ,CAAC;AAiBzE,MAAM,OAAO,oBAAqB,SAAQ,OAAO,CAAC,OAAO,EAAqD,CAC7G,wDAAwD,CACxD;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/effect-test-sql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "PostgreSQL rollback and real-commit test isolation for Effect",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/effect-test-sql#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
26
|
"./*.ts": {
|
|
27
|
-
"source": "./src
|
|
28
|
-
"types": "./dist
|
|
29
|
-
"default": "./dist
|
|
27
|
+
"source": "./src/*.ts",
|
|
28
|
+
"types": "./dist/*.d.ts",
|
|
29
|
+
"default": "./dist/*.js"
|
|
30
30
|
},
|
|
31
|
-
"./
|
|
32
|
-
"./
|
|
31
|
+
"./package.json": "./package.json",
|
|
32
|
+
"./server/internal/*": null
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@effect/sql-pg": "4.0.4",
|
|
48
48
|
"@effect/vitest": "4.0.4",
|
|
49
49
|
"@shivaedev/effect-test": "0.7.1",
|
|
50
|
-
"@shivaedev/quality": "0.
|
|
51
|
-
"@shivaedev/test-story": "0.
|
|
50
|
+
"@shivaedev/quality": "0.30.0",
|
|
51
|
+
"@shivaedev/test-story": "0.17.0",
|
|
52
52
|
"@types/node": "24.19.2",
|
|
53
53
|
"effect": "4.0.4",
|
|
54
54
|
"pg-boss": "12.37.1",
|
package/src/server/database.ts
CHANGED
|
@@ -17,5 +17,5 @@ export interface PostgresTestDatabaseService {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export class PostgresTestDatabase extends Context.Service<PostgresTestDatabase, PostgresTestDatabaseService>()(
|
|
20
|
-
"@shivaedev/effect-test-sql/PostgresTestDatabase",
|
|
20
|
+
"@shivaedev/effect-test-sql/server/PostgresTestDatabase",
|
|
21
21
|
) {}
|