@specific.dev/spectest 0.26.0 → 0.27.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/dist/aws-sigv4.d.ts +42 -0
- package/dist/aws-sigv4.js +166 -0
- package/dist/browser.d.ts +314 -0
- package/dist/browser.js +1320 -0
- package/dist/components/email.d.ts +135 -0
- package/dist/components/email.js +271 -0
- package/dist/components/expo.d.ts +69 -0
- package/dist/components/expo.js +125 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +18 -0
- package/dist/components/k3s.d.ts +143 -0
- package/dist/components/k3s.js +1067 -0
- package/dist/components/postgres.d.ts +93 -0
- package/dist/components/postgres.js +58 -0
- package/dist/components/replayFake.d.ts +169 -0
- package/dist/components/replayFake.js +738 -0
- package/dist/components/s3.d.ts +99 -0
- package/dist/components/s3.js +81 -0
- package/dist/components/supabase.d.ts +197 -0
- package/dist/components/supabase.js +1003 -0
- package/dist/daemon.d.ts +1 -0
- package/dist/daemon.js +4223 -0
- package/dist/ids.d.ts +2 -0
- package/{src/ids.ts → dist/ids.js} +46 -50
- package/dist/index.d.ts +1183 -0
- package/dist/index.js +769 -0
- package/dist/ingress.d.ts +114 -0
- package/dist/ingress.js +210 -0
- package/dist/inspect.d.ts +228 -0
- package/dist/inspect.js +429 -0
- package/dist/locator.d.ts +260 -0
- package/dist/locator.js +293 -0
- package/dist/mobile.d.ts +71 -0
- package/dist/mobile.js +65 -0
- package/dist/record-secrets.d.ts +9 -0
- package/{src/record-secrets.ts → dist/record-secrets.js} +13 -15
- package/dist/recorder.d.ts +516 -0
- package/dist/recorder.js +219 -0
- package/dist/redis.d.ts +54 -0
- package/dist/redis.js +126 -0
- package/dist/replay-bundle.d.ts +38 -0
- package/{src/replay-bundle.ts → dist/replay-bundle.js} +29 -47
- package/dist/resolver.d.ts +1 -0
- package/dist/resolver.js +309 -0
- package/dist/s3.d.ts +89 -0
- package/dist/s3.js +198 -0
- package/dist/sql.d.ts +74 -0
- package/dist/sql.js +151 -0
- package/dist/terminal.d.ts +161 -0
- package/dist/terminal.js +538 -0
- package/package.json +24 -9
- package/src/browser.ts +0 -1819
- package/src/components/email.ts +0 -398
- package/src/components/expo.ts +0 -167
- package/src/components/index.ts +0 -63
- package/src/components/k3s.ts +0 -1312
- package/src/components/postgres.ts +0 -105
- package/src/components/replayFake.ts +0 -848
- package/src/components/s3.ts +0 -132
- package/src/components/supabase.ts +0 -1299
- package/src/daemon.ts +0 -4969
- package/src/index.ts +0 -2350
- package/src/ingress.ts +0 -288
- package/src/inspect.ts +0 -673
- package/src/locator.ts +0 -594
- package/src/mobile.ts +0 -133
- package/src/recorder.ts +0 -817
- package/src/redis.ts +0 -202
- package/src/resolver.ts +0 -351
- package/src/s3.ts +0 -333
- package/src/sql.ts +0 -243
- package/src/terminal.ts +0 -740
- package/src/vendor/rrweb-plugin-console-record.umd.js +0 -521
- package/src/vendor/rrweb-record.min.js +0 -5061
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { ServiceDefinition } from "../index.js";
|
|
2
|
-
import { SQL, type SqlClient } from "../sql.js";
|
|
3
|
-
|
|
4
|
-
export interface PostgresOptions {
|
|
5
|
-
/** Image tag for the official `postgres` image. Default `"18-alpine"`.
|
|
6
|
-
* Ignored when {@link image} is set. */
|
|
7
|
-
version?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Full image reference, overriding the default `postgres:<version>`. For a
|
|
10
|
-
* Bun-SQL-/wire-compatible image (timescaledb, postgis, pgvector, …) you
|
|
11
|
-
* still get the instrumented client on `ctx.svc.<name>.client`.
|
|
12
|
-
*/
|
|
13
|
-
image?: string;
|
|
14
|
-
/** Database created on first boot. */
|
|
15
|
-
database: string;
|
|
16
|
-
/** Superuser name created on first boot. */
|
|
17
|
-
user: string;
|
|
18
|
-
/** Superuser password. */
|
|
19
|
-
password: string;
|
|
20
|
-
/**
|
|
21
|
-
* Whether postgres data persists across container restarts via a bind
|
|
22
|
-
* mount under `.spectest/volumes/<name>/`. Default `true`.
|
|
23
|
-
* Snapshots/forks always preserve state regardless of this flag — the
|
|
24
|
-
* volume just means a plain `docker rm`/`docker run` cycle keeps data.
|
|
25
|
-
*/
|
|
26
|
-
persistent?: boolean;
|
|
27
|
-
/** TCP port the container listens on. Default `5432`. */
|
|
28
|
-
port?: number;
|
|
29
|
-
/**
|
|
30
|
-
* CMD args appended after the image entrypoint (keeps the entrypoint, unlike
|
|
31
|
-
* `command`). For extension tuning, e.g.
|
|
32
|
-
* `["postgres", "-c", "timescaledb.max_background_workers=0"]`.
|
|
33
|
-
*/
|
|
34
|
-
args?: string[];
|
|
35
|
-
/** Extra environment variables forwarded to the container. */
|
|
36
|
-
env?: Record<string, string>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Helpers a `postgres(...)` service exposes on `ctx.svc.<name>`. */
|
|
40
|
-
export interface PostgresHelpers {
|
|
41
|
-
/** An instrumented Bun SQL client — each query lands on the test event log
|
|
42
|
-
* alongside http/exec/assertion events, and its rows come back
|
|
43
|
-
* inspect-wrapped so `expect(...)` on them links to the query. See
|
|
44
|
-
* {@link SQL}. */
|
|
45
|
-
client: SqlClient;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* A ready-to-use Postgres service. Drop into `environment.services`:
|
|
50
|
-
*
|
|
51
|
-
* ```ts
|
|
52
|
-
* services: {
|
|
53
|
-
* db: postgres({ database: "todos", user: "todos", password: "todos" }),
|
|
54
|
-
* ...
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* Peer services reach it at `<key>:<port>` (e.g. `db:5432` for the
|
|
59
|
-
* example above). Tests get a wired-up Bun SQL client at
|
|
60
|
-
* `ctx.svc.<key>.client` — `await ctx.svc.db.client\`SELECT 1\`` — with
|
|
61
|
-
* every query recorded on the test event log.
|
|
62
|
-
*
|
|
63
|
-
* Point it at a wire-compatible image with `image`/`args`:
|
|
64
|
-
*
|
|
65
|
-
* ```ts
|
|
66
|
-
* db: postgres({
|
|
67
|
-
* image: "timescale/timescaledb:latest-pg17",
|
|
68
|
-
* args: ["postgres", "-c", "timescaledb.max_background_workers=0"],
|
|
69
|
-
* database: "app", user: "app", password: "app",
|
|
70
|
-
* }),
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
export function postgres(opts: PostgresOptions) {
|
|
74
|
-
const version = opts.version ?? "18-alpine";
|
|
75
|
-
const reference = opts.image ?? `postgres:${version}`;
|
|
76
|
-
const port = opts.port ?? 5432;
|
|
77
|
-
const persistent = opts.persistent ?? true;
|
|
78
|
-
// `satisfies` (instead of a return-type annotation) preserves the
|
|
79
|
-
// literal type — in particular, the `helpers` factory's return shape.
|
|
80
|
-
// The mapped type in `ServiceHandlesFor<S>` reads that to type
|
|
81
|
-
// `ctx.svc.<name>` as `{ client: SqlClient }`.
|
|
82
|
-
return {
|
|
83
|
-
image: { type: "registry", reference },
|
|
84
|
-
...(opts.args ? { args: opts.args } : {}),
|
|
85
|
-
env: {
|
|
86
|
-
POSTGRES_DB: opts.database,
|
|
87
|
-
POSTGRES_USER: opts.user,
|
|
88
|
-
POSTGRES_PASSWORD: opts.password,
|
|
89
|
-
// PGDATA lives in a subdir so postgres can initialise inside a bind
|
|
90
|
-
// mount that may not be empty on first boot.
|
|
91
|
-
PGDATA: "/var/lib/postgresql/data/pgdata",
|
|
92
|
-
...(opts.env ?? {}),
|
|
93
|
-
},
|
|
94
|
-
volumes: persistent ? [{ target: "/var/lib/postgresql/data" }] : [],
|
|
95
|
-
ports: [port],
|
|
96
|
-
readyCheck: { type: "tcp" as const, port, timeoutSecs: 60 },
|
|
97
|
-
helpers: ({ name }: { name: string }): PostgresHelpers => {
|
|
98
|
-
const url =
|
|
99
|
-
`postgres://${encodeURIComponent(opts.user)}` +
|
|
100
|
-
`:${encodeURIComponent(opts.password)}` +
|
|
101
|
-
`@${name}:${port}/${encodeURIComponent(opts.database)}`;
|
|
102
|
-
return { client: new SQL(url, { label: name }) };
|
|
103
|
-
},
|
|
104
|
-
} satisfies ServiceDefinition<PostgresHelpers>;
|
|
105
|
-
}
|