@zeroxsolutions/db 8.0.0 → 9.0.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/README.md +5 -2
- package/dist/testing/disposable-postgres.d.ts +0 -6
- package/dist/testing/disposable-postgres.d.ts.map +1 -1
- package/dist/testing/disposable-postgres.js +0 -6
- package/dist/testing/postgres-image.d.ts +8 -0
- package/dist/testing/postgres-image.d.ts.map +1 -0
- package/dist/testing/postgres-image.js +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ declares `"."`, but no `src/index.ts` exists for the build to emit it from, so
|
|
|
38
38
|
| `@zeroxsolutions/db/postgres` | PostgreSQL entity, repository, view repository, unit of work, outbox, and types |
|
|
39
39
|
| `@zeroxsolutions/db/d1` | Cloudflare D1 (SQLite) entity, repository, unit of work, outbox, and types |
|
|
40
40
|
| `@zeroxsolutions/db/utils` | Filter and order builders, `TableQuery` and the relational-read builder, the field-whitelist guard, the filter-value schema + operator enum, omit masks, pagination constants |
|
|
41
|
-
| `@zeroxsolutions/db/testing` | A throwaway Postgres container carrying your schema, the
|
|
41
|
+
| `@zeroxsolutions/db/testing` | A throwaway Postgres container carrying your schema, on the engine you name, plus the container timeout and a fake uuid v7 |
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
@@ -476,10 +476,13 @@ afterAll(async () => {
|
|
|
476
476
|
A suite that cannot use the client - a worker e2e reaching its database through a Hyperdrive
|
|
477
477
|
binding - takes `database.connectionString` and hands that to its test pool instead.
|
|
478
478
|
|
|
479
|
+
This package names no engine for you, and exports no constant standing in as that argument. Which
|
|
480
|
+
major you run is your deployment's own fact, so `image` takes no default: a forgotten argument is a
|
|
481
|
+
typecheck failure rather than a suite that quietly passed on a major you do not deploy.
|
|
482
|
+
|
|
479
483
|
| Export | What it is |
|
|
480
484
|
| ------ | ---------- |
|
|
481
485
|
| `startDisposablePostgres(schema, image)` | Starts the container, creates `schema` in it, and returns a Drizzle client typed against it, the `connectionString` it dialled, and the `stop()` that tears it down |
|
|
482
|
-
| `POSTGRES_IMAGE` | `postgres:18-alpine`, the engine this package's own specs run on. Yours is your own to name: `image` takes no default, so a forgotten argument is a typecheck failure rather than a suite that quietly ran a major you do not deploy |
|
|
483
486
|
| `CONTAINER_TIMEOUT_MS` | 180s, for the hook that starts a container: an image pull on a cold machine outruns vitest's 5s default |
|
|
484
487
|
| `fakeUuidV7` | Random bits in a v7 layout: it passes a v7 check, and is not time-ordered like a minted id |
|
|
485
488
|
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { type PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
2
|
-
/**
|
|
3
|
-
* The Postgres engine this package's own container-starting specs run against.
|
|
4
|
-
* A consumer names its own instead: which engine a context runs is that context's fact, and its major
|
|
5
|
-
* tracks what that context deploys, not what this package happens to test on.
|
|
6
|
-
*/
|
|
7
|
-
export declare const POSTGRES_IMAGE = "postgres:18-alpine";
|
|
8
2
|
/** Pulling the image on a cold machine costs far more than vitest's 5s default timeout. */
|
|
9
3
|
export declare const CONTAINER_TIMEOUT_MS = 180000;
|
|
10
4
|
/** A throwaway Postgres carrying one schema, and the handle that tears its container down. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disposable-postgres.d.ts","sourceRoot":"","sources":["../../src/testing/disposable-postgres.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG3E
|
|
1
|
+
{"version":3,"file":"disposable-postgres.d.ts","sourceRoot":"","sources":["../../src/testing/disposable-postgres.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG3E,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB,SAAU,CAAC;AAE5C,8FAA8F;AAC9F,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzE,EAAE,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAChC;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnF,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAiBtC"}
|
|
@@ -2,12 +2,6 @@ import { PostgreSqlContainer } from '@testcontainers/postgresql';
|
|
|
2
2
|
import { generateDrizzleJson, generateMigration } from 'drizzle-kit/api';
|
|
3
3
|
import { drizzle } from 'drizzle-orm/postgres-js';
|
|
4
4
|
import postgres from 'postgres';
|
|
5
|
-
/**
|
|
6
|
-
* The Postgres engine this package's own container-starting specs run against.
|
|
7
|
-
* A consumer names its own instead: which engine a context runs is that context's fact, and its major
|
|
8
|
-
* tracks what that context deploys, not what this package happens to test on.
|
|
9
|
-
*/
|
|
10
|
-
export const POSTGRES_IMAGE = 'postgres:18-alpine';
|
|
11
5
|
/** Pulling the image on a cold machine costs far more than vitest's 5s default timeout. */
|
|
12
6
|
export const CONTAINER_TIMEOUT_MS = 180_000;
|
|
13
7
|
/**
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Postgres engine this package's own specs run on, named once for all of them.
|
|
3
|
+
* Deliberately outside `index.ts`, so no consumer can import it: which engine a context runs is that
|
|
4
|
+
* context's own fact, and a constant a consumer could pass would carry this package's answer under
|
|
5
|
+
* that consumer's name, exactly as a default parameter would.
|
|
6
|
+
*/
|
|
7
|
+
export declare const POSTGRES_IMAGE = "postgres:18-alpine";
|
|
8
|
+
//# sourceMappingURL=postgres-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-image.d.ts","sourceRoot":"","sources":["../../src/testing/postgres-image.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Postgres engine this package's own specs run on, named once for all of them.
|
|
3
|
+
* Deliberately outside `index.ts`, so no consumer can import it: which engine a context runs is that
|
|
4
|
+
* context's own fact, and a constant a consumer could pass would carry this package's answer under
|
|
5
|
+
* that consumer's name, exactly as a default parameter would.
|
|
6
|
+
*/
|
|
7
|
+
export const POSTGRES_IMAGE = 'postgres:18-alpine';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeroxsolutions/db",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Generic Drizzle toolkit - the id column and audit timestamps a table takes, a base repository, the unit-of-work and transactional outbox impls, and the filter/sort/pagination query helpers, for PostgreSQL (postgres-js) and Cloudflare D1; ships no domain schema. Shared across ZeroXSolutions services.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|