@cedarjs/pg 0.2.0-alpha.0 → 0.3.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 +300 -230
- package/dist/cli.cjs +99 -43
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +85 -29
- package/dist/cli.mjs.map +1 -1
- package/dist/dev-env.cjs +1 -1
- package/dist/dev-env.mjs +1 -1
- package/dist/index.cjs +9 -8
- package/dist/index.d.cts +80 -9
- package/dist/index.d.mts +80 -9
- package/dist/index.mjs +7 -7
- package/dist/jest-teardown.cjs +1 -1
- package/dist/jest-teardown.mjs +1 -1
- package/dist/jest-template.cjs +7 -2
- package/dist/jest-template.cjs.map +1 -1
- package/dist/jest-template.d.cts +7 -2
- package/dist/jest-template.d.mts +7 -2
- package/dist/jest-template.mjs +7 -2
- package/dist/jest-template.mjs.map +1 -1
- package/dist/jest.cjs +1 -1
- package/dist/jest.mjs +1 -1
- package/dist/{lease-BSBBpaR4.mjs → lease-DS1SX8U_.mjs} +23 -3
- package/dist/lease-DS1SX8U_.mjs.map +1 -0
- package/dist/{lease-Bq9wKwQa.cjs → lease-WlmOnNDi.cjs} +41 -3
- package/dist/lease-WlmOnNDi.cjs.map +1 -0
- package/dist/lifecycle-2BZgSVz2.mjs +1072 -0
- package/dist/lifecycle-2BZgSVz2.mjs.map +1 -0
- package/dist/{lifecycle-DEJ4GgWV.cjs → lifecycle-BCeM96tI.cjs} +517 -117
- package/dist/lifecycle-BCeM96tI.cjs.map +1 -0
- package/dist/{load-dev-env-7UjMHhw7.mjs → load-dev-env-BULkXyen.mjs} +2 -2
- package/dist/{load-dev-env-7UjMHhw7.mjs.map → load-dev-env-BULkXyen.mjs.map} +1 -1
- package/dist/{load-dev-env-cII6N4ZP.cjs → load-dev-env-Bl6Ddv1U.cjs} +2 -2
- package/dist/{load-dev-env-cII6N4ZP.cjs.map → load-dev-env-Bl6Ddv1U.cjs.map} +1 -1
- package/dist/{load-mode-env-B0qO9DZx.cjs → load-mode-env-CX9vd56X.cjs} +2 -2
- package/dist/{load-mode-env-B0qO9DZx.cjs.map → load-mode-env-CX9vd56X.cjs.map} +1 -1
- package/dist/{load-mode-env-C8gy4v9V.mjs → load-mode-env-Ce9ujisN.mjs} +2 -2
- package/dist/{load-mode-env-C8gy4v9V.mjs.map → load-mode-env-Ce9ujisN.mjs.map} +1 -1
- package/dist/{load-test-env-C34wpkIX.mjs → load-test-env-BqtA6V-d.mjs} +2 -2
- package/dist/{load-test-env-C34wpkIX.mjs.map → load-test-env-BqtA6V-d.mjs.map} +1 -1
- package/dist/{load-test-env-CkdUjTpV.cjs → load-test-env-Dcgh6YHV.cjs} +2 -2
- package/dist/{load-test-env-CkdUjTpV.cjs.map → load-test-env-Dcgh6YHV.cjs.map} +1 -1
- package/dist/{naming-C2nGVxPk.d.cts → naming-Df4fz_Fb.d.cts} +3 -2
- package/dist/{naming-C2nGVxPk.d.mts → naming-Df4fz_Fb.d.mts} +3 -2
- package/dist/status-B68SGSKx.mjs +26 -0
- package/dist/status-B68SGSKx.mjs.map +1 -0
- package/dist/status-Z_BYdxzI.cjs +31 -0
- package/dist/status-Z_BYdxzI.cjs.map +1 -0
- package/dist/studio-Bi6SU9jE.mjs +221 -0
- package/dist/studio-Bi6SU9jE.mjs.map +1 -0
- package/dist/studio-CdWIdnxr.cjs +280 -0
- package/dist/studio-CdWIdnxr.cjs.map +1 -0
- package/dist/{template-D0gJ_MS2.cjs → template-Cd77H7Cr.cjs} +21 -18
- package/dist/template-Cd77H7Cr.cjs.map +1 -0
- package/dist/{template-CGw3C1Ob.mjs → template-DlqHL8Go.mjs} +21 -18
- package/dist/template-DlqHL8Go.mjs.map +1 -0
- package/dist/template-mode-BqV3GjXI.d.cts +48 -0
- package/dist/template-mode-BqV3GjXI.d.mts +48 -0
- package/dist/template-mode-DK5cAlv9.mjs +81 -0
- package/dist/template-mode-DK5cAlv9.mjs.map +1 -0
- package/dist/template-mode-DMO5-z7O.cjs +92 -0
- package/dist/template-mode-DMO5-z7O.cjs.map +1 -0
- package/dist/test-env.cjs +1 -1
- package/dist/test-env.mjs +1 -1
- package/dist/vite-plus.cjs +113 -10
- package/dist/vite-plus.cjs.map +1 -1
- package/dist/vite-plus.d.cts +41 -2
- package/dist/vite-plus.d.mts +41 -2
- package/dist/vite-plus.mjs +110 -7
- package/dist/vite-plus.mjs.map +1 -1
- package/dist/vitest-template.cjs +6 -3
- package/dist/vitest-template.cjs.map +1 -1
- package/dist/vitest-template.d.cts +6 -3
- package/dist/vitest-template.d.mts +6 -3
- package/dist/vitest-template.mjs +6 -3
- package/dist/vitest-template.mjs.map +1 -1
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/package.json +11 -7
- package/scripts/autopg-version +1 -1
- package/scripts/ci-install-autopg.sh +7 -2
- package/scripts/postinstall.js +41 -13
- package/dist/constants-Ct8myrEn.cjs +0 -41
- package/dist/constants-Ct8myrEn.cjs.map +0 -1
- package/dist/constants-NLR0U4NR.mjs +0 -24
- package/dist/constants-NLR0U4NR.mjs.map +0 -1
- package/dist/lease-B3TuX92y.d.mts +0 -24
- package/dist/lease-BSBBpaR4.mjs.map +0 -1
- package/dist/lease-Bq9wKwQa.cjs.map +0 -1
- package/dist/lease-t4I9JahV.d.cts +0 -24
- package/dist/lifecycle-BOo6xBjD.mjs +0 -684
- package/dist/lifecycle-BOo6xBjD.mjs.map +0 -1
- package/dist/lifecycle-DEJ4GgWV.cjs.map +0 -1
- package/dist/nx.cjs +0 -44
- package/dist/nx.cjs.map +0 -1
- package/dist/nx.d.cts +0 -15
- package/dist/nx.d.mts +0 -15
- package/dist/nx.mjs +0 -36
- package/dist/nx.mjs.map +0 -1
- package/dist/tasks-Caud9yHr.cjs +0 -67
- package/dist/tasks-Caud9yHr.cjs.map +0 -1
- package/dist/tasks-CjaZRi_G.d.mts +0 -19
- package/dist/tasks-DdQoP9We.d.cts +0 -19
- package/dist/tasks-KherHLac.mjs +0 -38
- package/dist/tasks-KherHLac.mjs.map +0 -1
- package/dist/template-CGw3C1Ob.mjs.map +0 -1
- package/dist/template-D0gJ_MS2.cjs.map +0 -1
- package/dist/template-mode-BkEs9LnY.cjs +0 -91
- package/dist/template-mode-BkEs9LnY.cjs.map +0 -1
- package/dist/template-mode-CcxV_Iju.d.cts +0 -28
- package/dist/template-mode-CcxV_Iju.d.mts +0 -28
- package/dist/template-mode-IjlFOG4O.mjs +0 -80
- package/dist/template-mode-IjlFOG4O.mjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
import { a as WorktreeIdentity, i as buildRoleName, n as buildCloneDatabaseName, o as resolveRoot, r as buildDatabaseName, s as resolveWorktreeIdentity, t as DbMode } from "./naming-
|
|
2
|
-
|
|
1
|
+
import { a as WorktreeIdentity, i as buildRoleName, n as buildCloneDatabaseName, o as resolveRoot, r as buildDatabaseName, s as resolveWorktreeIdentity, t as DbMode } from "./naming-Df4fz_Fb.cjs";
|
|
2
|
+
//#region src/core/lease.d.ts
|
|
3
|
+
type Lease = {
|
|
4
|
+
schemaVersion: 1;
|
|
5
|
+
mode: DbMode;
|
|
6
|
+
root: string;
|
|
7
|
+
repoSlug: string;
|
|
8
|
+
worktreeSlug: string;
|
|
9
|
+
pathHash: string;
|
|
10
|
+
databaseName: string;
|
|
11
|
+
roleName: string;
|
|
12
|
+
port: number;
|
|
13
|
+
pid: number;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
};
|
|
16
|
+
/** Narrow-parse a lease; reject incomplete or wrong-version records. */
|
|
17
|
+
declare function parseLease(raw: unknown): Lease | null;
|
|
18
|
+
/** Absolute `.cedarpg/<mode>.env` path (resolves root when omitted). */
|
|
19
|
+
declare function envFilePath(root: string | undefined, mode: DbMode): string;
|
|
20
|
+
declare function readLease(root: string, mode: DbMode): Lease | null;
|
|
21
|
+
declare function isOrphanLease(lease: Lease): boolean;
|
|
22
|
+
//#endregion
|
|
3
23
|
//#region src/core/policy.d.ts
|
|
4
24
|
/**
|
|
5
25
|
* Shared acquire skip policy for test-runner adapters and Cedar CLI bridges.
|
|
@@ -58,6 +78,14 @@ type AcquireOptions = {
|
|
|
58
78
|
mode: DbMode;
|
|
59
79
|
/** Inject DATABASE_URL / TEST_DATABASE_URL into process.env (default true). */
|
|
60
80
|
setEnv?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Start from an empty database (default false): first DROP every database
|
|
83
|
+
* owned by this worktree's role for `mode` — the leased DB, TEMPLATE clones,
|
|
84
|
+
* crashed-run leftovers — then create it again. Scoped by the role (the
|
|
85
|
+
* lease's when it is for this database, else the derived name), so it works
|
|
86
|
+
* without a lease file and never touches other worktrees.
|
|
87
|
+
*/
|
|
88
|
+
fresh?: boolean;
|
|
61
89
|
};
|
|
62
90
|
type AcquireResult = {
|
|
63
91
|
databaseUrl: string;
|
|
@@ -128,7 +156,7 @@ declare function gc(): Promise<{
|
|
|
128
156
|
type MarkTemplateOptions = {
|
|
129
157
|
root?: string;
|
|
130
158
|
mode: DbMode;
|
|
131
|
-
/** Superuser URL from `acquire`; when omitted,
|
|
159
|
+
/** Superuser URL from `acquire`; when omitted, built from the lease port (never starts the host). */
|
|
132
160
|
adminUrl?: string;
|
|
133
161
|
};
|
|
134
162
|
/**
|
|
@@ -142,13 +170,19 @@ declare function markTemplate(options: MarkTemplateOptions): Promise<{
|
|
|
142
170
|
type CloneFromTemplateOptions = {
|
|
143
171
|
root?: string;
|
|
144
172
|
mode: DbMode;
|
|
145
|
-
/** Superuser URL from `acquire`; when omitted,
|
|
173
|
+
/** Superuser URL from `acquire`; when omitted, built from the lease port (never starts the host). */
|
|
146
174
|
adminUrl?: string;
|
|
147
175
|
/**
|
|
148
176
|
* Suffix for the clone datname (e.g. Jest worker id).
|
|
149
177
|
* Defaults to `<pid>_<base36 time>`.
|
|
150
178
|
*/
|
|
151
179
|
name?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Keep an existing `<template>_c_<name>` owned by the lease role instead of
|
|
182
|
+
* failing with `database already exists` (default false). Worker adapters pass
|
|
183
|
+
* true so every test file in one worker attaches to the same clone.
|
|
184
|
+
*/
|
|
185
|
+
reuse?: boolean;
|
|
152
186
|
/**
|
|
153
187
|
* Inject DATABASE_URL / TEST_DATABASE_URL for this clone (default false).
|
|
154
188
|
* Host `cloneFromTemplateIfNeeded` defaults true; worker adapters pass true explicitly.
|
|
@@ -172,7 +206,9 @@ type CloneResult = {
|
|
|
172
206
|
* Clone the leased TEMPLATE database via admin (`CREATE DATABASE … TEMPLATE`).
|
|
173
207
|
* Reuses the template role so `databaseUrl` passwords stay valid (scheme v2).
|
|
174
208
|
* Provider rejects when the leased DB is not marked TEMPLATE.
|
|
175
|
-
* Port comes from the lease; admin URL is passed through or
|
|
209
|
+
* Port comes from the lease; admin URL is passed through or built from the lease
|
|
210
|
+
* port. Fails when nothing listens there (setup should have acquired).
|
|
211
|
+
* An existing clone datname fails unless `reuse` is set and the lease role owns it.
|
|
176
212
|
*/
|
|
177
213
|
declare function cloneFromTemplate(options: CloneFromTemplateOptions): Promise<CloneResult>;
|
|
178
214
|
type CloneFromTemplateIfNeededOptions = CloneFromTemplateOptions & ResolveAcquireSkipInput;
|
|
@@ -247,25 +283,60 @@ type CreateAcquireTaskOptions = {
|
|
|
247
283
|
/** Run acquireIfNeeded, then optional afterAcquire (migrate / db:ready). */
|
|
248
284
|
declare function createAcquireTask(options: CreateAcquireTaskOptions): () => Promise<void>;
|
|
249
285
|
//#endregion
|
|
286
|
+
//#region src/core/status.d.ts
|
|
287
|
+
type ResolveDevStatusOptions = {
|
|
288
|
+
root?: string;
|
|
289
|
+
mode?: DbMode;
|
|
290
|
+
};
|
|
291
|
+
type DevStatus = {
|
|
292
|
+
ok: true;
|
|
293
|
+
mode: DbMode;
|
|
294
|
+
root: string;
|
|
295
|
+
lease: Lease;
|
|
296
|
+
databaseUrl: string;
|
|
297
|
+
envPath: string;
|
|
298
|
+
} | {
|
|
299
|
+
ok: false;
|
|
300
|
+
mode: DbMode;
|
|
301
|
+
root: string;
|
|
302
|
+
};
|
|
303
|
+
/** Read-only lease snapshot for CLI / Vite panel (no acquire, no host). */
|
|
304
|
+
declare function resolveDevStatus(options?: ResolveDevStatusOptions): DevStatus;
|
|
305
|
+
//#endregion
|
|
250
306
|
//#region src/providers/autopg.d.ts
|
|
251
307
|
type AutopgDiscovery = {
|
|
252
308
|
port: number;
|
|
253
309
|
adminUrl: string;
|
|
254
310
|
bin: string;
|
|
255
311
|
};
|
|
312
|
+
type HostStatusPaths = {
|
|
313
|
+
dataDir?: string;
|
|
314
|
+
socketDir?: string;
|
|
315
|
+
logsDir?: string;
|
|
316
|
+
};
|
|
256
317
|
declare const INSTALL_HINT: string;
|
|
257
318
|
/** Password scheme v2: sha256(PASSWORD_SALT_PREFIX + "\\0" + roleName) hex[:32]. Frozen for URL rebuild. */
|
|
258
319
|
declare const ROLE_PASSWORD_SCHEME: "v2";
|
|
259
320
|
declare function resolveAutopgBin(): string | null;
|
|
260
321
|
declare function requireAutopgBin(): string;
|
|
261
322
|
/**
|
|
262
|
-
* Parse `autopg status --json`
|
|
323
|
+
* Parse `autopg status --json` → the **registered** port (and data/socket/logs
|
|
324
|
+
* dirs when present). Throws only when the output is not autopg status JSON.
|
|
325
|
+
*
|
|
326
|
+
* Registration is not liveness: autopg reports a port for a stopped host too,
|
|
327
|
+
* and its `status` / `ready` describe the supervisor (autopg ≥ v3.2: `ready` needs
|
|
328
|
+
* pm2 `online`; pm2's raw state is `supervisorStatus`). Neither, nor `runtime.live`,
|
|
329
|
+
* is the attach gate — a bare postmaster (e.g. one cedar-pg revived) is
|
|
330
|
+
* query-ready while status stays `stopped` / `ready: false`.
|
|
331
|
+
* Liveness is a TCP accept on the port, proven by the caller (`acquire`).
|
|
263
332
|
*/
|
|
264
|
-
declare function parseHostStatus(json: string): {
|
|
333
|
+
declare function parseHostStatus(json: string): HostStatusPaths & {
|
|
265
334
|
port: number;
|
|
266
335
|
};
|
|
267
336
|
/**
|
|
268
|
-
* Discover
|
|
337
|
+
* Discover the registered autopg host (port + admin URL) via `autopg status --json`.
|
|
338
|
+
* Throws when autopg cannot be queried; does **not** prove a listener — probe TCP
|
|
339
|
+
* (or use `acquire`, which does) before connecting.
|
|
269
340
|
*/
|
|
270
341
|
declare function discoverHost(bin?: string): AutopgDiscovery;
|
|
271
342
|
/**
|
|
@@ -283,5 +354,5 @@ declare function buildDatabaseUrl(opts: {
|
|
|
283
354
|
password?: string;
|
|
284
355
|
}): string;
|
|
285
356
|
//#endregion
|
|
286
|
-
export { type AcquireIfNeededOptions, type AcquireIfNeededResult, type AcquireOptions, type AcquireResult, type AcquireSkip, type AcquireTaskContext, type AutopgDiscovery, CLI_NAME, type CloneFromTemplateIfNeededOptions, type CloneFromTemplateIfNeededResult, type CloneFromTemplateOptions, type CloneResult, type CreateAcquireTaskOptions, type DbMode, type DisposeOptions, type DisposeResult, INSTALL_HINT, type Lease, type LoadDevEnvOptions, type LoadTestEnvOptions, type MarkTemplateOptions, ROLE_PASSWORD_SCHEME, type ResolveAcquireSkipInput, STATE_DIRNAME, type WorktreeIdentity, acquire, acquireIfNeeded, applyDatabaseUrlEnv, buildCloneDatabaseName, buildDatabaseName, buildDatabaseUrl, buildRoleName, cloneFromTemplate, cloneFromTemplateIfNeeded, createAcquireTask, discoverHost, dispose, envFilePath, gc, isCedarPgManagedUrl, isExternalDatabaseEscapeHatch, isOrphanLease, loadDevEnv, loadTestEnv, markTemplate, parseHostStatus, parseLease, readLease, requireAutopgBin, resolveAcquireSkip, resolveAutopgBin, resolveRoot, resolveWorktreeIdentity, rolePasswordFor, urlFromLease };
|
|
357
|
+
export { type AcquireIfNeededOptions, type AcquireIfNeededResult, type AcquireOptions, type AcquireResult, type AcquireSkip, type AcquireTaskContext, type AutopgDiscovery, CLI_NAME, type CloneFromTemplateIfNeededOptions, type CloneFromTemplateIfNeededResult, type CloneFromTemplateOptions, type CloneResult, type CreateAcquireTaskOptions, type DbMode, type DevStatus, type DisposeOptions, type DisposeResult, INSTALL_HINT, type Lease, type LoadDevEnvOptions, type LoadTestEnvOptions, type MarkTemplateOptions, ROLE_PASSWORD_SCHEME, type ResolveAcquireSkipInput, type ResolveDevStatusOptions, STATE_DIRNAME, type WorktreeIdentity, acquire, acquireIfNeeded, applyDatabaseUrlEnv, buildCloneDatabaseName, buildDatabaseName, buildDatabaseUrl, buildRoleName, cloneFromTemplate, cloneFromTemplateIfNeeded, createAcquireTask, discoverHost, dispose, envFilePath, gc, isCedarPgManagedUrl, isExternalDatabaseEscapeHatch, isOrphanLease, loadDevEnv, loadTestEnv, markTemplate, parseHostStatus, parseLease, readLease, requireAutopgBin, resolveAcquireSkip, resolveAutopgBin, resolveDevStatus, resolveRoot, resolveWorktreeIdentity, rolePasswordFor, urlFromLease };
|
|
287
358
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
import { a as WorktreeIdentity, i as buildRoleName, n as buildCloneDatabaseName, o as resolveRoot, r as buildDatabaseName, s as resolveWorktreeIdentity, t as DbMode } from "./naming-
|
|
2
|
-
|
|
1
|
+
import { a as WorktreeIdentity, i as buildRoleName, n as buildCloneDatabaseName, o as resolveRoot, r as buildDatabaseName, s as resolveWorktreeIdentity, t as DbMode } from "./naming-Df4fz_Fb.mjs";
|
|
2
|
+
//#region src/core/lease.d.ts
|
|
3
|
+
type Lease = {
|
|
4
|
+
schemaVersion: 1;
|
|
5
|
+
mode: DbMode;
|
|
6
|
+
root: string;
|
|
7
|
+
repoSlug: string;
|
|
8
|
+
worktreeSlug: string;
|
|
9
|
+
pathHash: string;
|
|
10
|
+
databaseName: string;
|
|
11
|
+
roleName: string;
|
|
12
|
+
port: number;
|
|
13
|
+
pid: number;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
};
|
|
16
|
+
/** Narrow-parse a lease; reject incomplete or wrong-version records. */
|
|
17
|
+
declare function parseLease(raw: unknown): Lease | null;
|
|
18
|
+
/** Absolute `.cedarpg/<mode>.env` path (resolves root when omitted). */
|
|
19
|
+
declare function envFilePath(root: string | undefined, mode: DbMode): string;
|
|
20
|
+
declare function readLease(root: string, mode: DbMode): Lease | null;
|
|
21
|
+
declare function isOrphanLease(lease: Lease): boolean;
|
|
22
|
+
//#endregion
|
|
3
23
|
//#region src/core/policy.d.ts
|
|
4
24
|
/**
|
|
5
25
|
* Shared acquire skip policy for test-runner adapters and Cedar CLI bridges.
|
|
@@ -58,6 +78,14 @@ type AcquireOptions = {
|
|
|
58
78
|
mode: DbMode;
|
|
59
79
|
/** Inject DATABASE_URL / TEST_DATABASE_URL into process.env (default true). */
|
|
60
80
|
setEnv?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Start from an empty database (default false): first DROP every database
|
|
83
|
+
* owned by this worktree's role for `mode` — the leased DB, TEMPLATE clones,
|
|
84
|
+
* crashed-run leftovers — then create it again. Scoped by the role (the
|
|
85
|
+
* lease's when it is for this database, else the derived name), so it works
|
|
86
|
+
* without a lease file and never touches other worktrees.
|
|
87
|
+
*/
|
|
88
|
+
fresh?: boolean;
|
|
61
89
|
};
|
|
62
90
|
type AcquireResult = {
|
|
63
91
|
databaseUrl: string;
|
|
@@ -128,7 +156,7 @@ declare function gc(): Promise<{
|
|
|
128
156
|
type MarkTemplateOptions = {
|
|
129
157
|
root?: string;
|
|
130
158
|
mode: DbMode;
|
|
131
|
-
/** Superuser URL from `acquire`; when omitted,
|
|
159
|
+
/** Superuser URL from `acquire`; when omitted, built from the lease port (never starts the host). */
|
|
132
160
|
adminUrl?: string;
|
|
133
161
|
};
|
|
134
162
|
/**
|
|
@@ -142,13 +170,19 @@ declare function markTemplate(options: MarkTemplateOptions): Promise<{
|
|
|
142
170
|
type CloneFromTemplateOptions = {
|
|
143
171
|
root?: string;
|
|
144
172
|
mode: DbMode;
|
|
145
|
-
/** Superuser URL from `acquire`; when omitted,
|
|
173
|
+
/** Superuser URL from `acquire`; when omitted, built from the lease port (never starts the host). */
|
|
146
174
|
adminUrl?: string;
|
|
147
175
|
/**
|
|
148
176
|
* Suffix for the clone datname (e.g. Jest worker id).
|
|
149
177
|
* Defaults to `<pid>_<base36 time>`.
|
|
150
178
|
*/
|
|
151
179
|
name?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Keep an existing `<template>_c_<name>` owned by the lease role instead of
|
|
182
|
+
* failing with `database already exists` (default false). Worker adapters pass
|
|
183
|
+
* true so every test file in one worker attaches to the same clone.
|
|
184
|
+
*/
|
|
185
|
+
reuse?: boolean;
|
|
152
186
|
/**
|
|
153
187
|
* Inject DATABASE_URL / TEST_DATABASE_URL for this clone (default false).
|
|
154
188
|
* Host `cloneFromTemplateIfNeeded` defaults true; worker adapters pass true explicitly.
|
|
@@ -172,7 +206,9 @@ type CloneResult = {
|
|
|
172
206
|
* Clone the leased TEMPLATE database via admin (`CREATE DATABASE … TEMPLATE`).
|
|
173
207
|
* Reuses the template role so `databaseUrl` passwords stay valid (scheme v2).
|
|
174
208
|
* Provider rejects when the leased DB is not marked TEMPLATE.
|
|
175
|
-
* Port comes from the lease; admin URL is passed through or
|
|
209
|
+
* Port comes from the lease; admin URL is passed through or built from the lease
|
|
210
|
+
* port. Fails when nothing listens there (setup should have acquired).
|
|
211
|
+
* An existing clone datname fails unless `reuse` is set and the lease role owns it.
|
|
176
212
|
*/
|
|
177
213
|
declare function cloneFromTemplate(options: CloneFromTemplateOptions): Promise<CloneResult>;
|
|
178
214
|
type CloneFromTemplateIfNeededOptions = CloneFromTemplateOptions & ResolveAcquireSkipInput;
|
|
@@ -247,25 +283,60 @@ type CreateAcquireTaskOptions = {
|
|
|
247
283
|
/** Run acquireIfNeeded, then optional afterAcquire (migrate / db:ready). */
|
|
248
284
|
declare function createAcquireTask(options: CreateAcquireTaskOptions): () => Promise<void>;
|
|
249
285
|
//#endregion
|
|
286
|
+
//#region src/core/status.d.ts
|
|
287
|
+
type ResolveDevStatusOptions = {
|
|
288
|
+
root?: string;
|
|
289
|
+
mode?: DbMode;
|
|
290
|
+
};
|
|
291
|
+
type DevStatus = {
|
|
292
|
+
ok: true;
|
|
293
|
+
mode: DbMode;
|
|
294
|
+
root: string;
|
|
295
|
+
lease: Lease;
|
|
296
|
+
databaseUrl: string;
|
|
297
|
+
envPath: string;
|
|
298
|
+
} | {
|
|
299
|
+
ok: false;
|
|
300
|
+
mode: DbMode;
|
|
301
|
+
root: string;
|
|
302
|
+
};
|
|
303
|
+
/** Read-only lease snapshot for CLI / Vite panel (no acquire, no host). */
|
|
304
|
+
declare function resolveDevStatus(options?: ResolveDevStatusOptions): DevStatus;
|
|
305
|
+
//#endregion
|
|
250
306
|
//#region src/providers/autopg.d.ts
|
|
251
307
|
type AutopgDiscovery = {
|
|
252
308
|
port: number;
|
|
253
309
|
adminUrl: string;
|
|
254
310
|
bin: string;
|
|
255
311
|
};
|
|
312
|
+
type HostStatusPaths = {
|
|
313
|
+
dataDir?: string;
|
|
314
|
+
socketDir?: string;
|
|
315
|
+
logsDir?: string;
|
|
316
|
+
};
|
|
256
317
|
declare const INSTALL_HINT: string;
|
|
257
318
|
/** Password scheme v2: sha256(PASSWORD_SALT_PREFIX + "\\0" + roleName) hex[:32]. Frozen for URL rebuild. */
|
|
258
319
|
declare const ROLE_PASSWORD_SCHEME: "v2";
|
|
259
320
|
declare function resolveAutopgBin(): string | null;
|
|
260
321
|
declare function requireAutopgBin(): string;
|
|
261
322
|
/**
|
|
262
|
-
* Parse `autopg status --json`
|
|
323
|
+
* Parse `autopg status --json` → the **registered** port (and data/socket/logs
|
|
324
|
+
* dirs when present). Throws only when the output is not autopg status JSON.
|
|
325
|
+
*
|
|
326
|
+
* Registration is not liveness: autopg reports a port for a stopped host too,
|
|
327
|
+
* and its `status` / `ready` describe the supervisor (autopg ≥ v3.2: `ready` needs
|
|
328
|
+
* pm2 `online`; pm2's raw state is `supervisorStatus`). Neither, nor `runtime.live`,
|
|
329
|
+
* is the attach gate — a bare postmaster (e.g. one cedar-pg revived) is
|
|
330
|
+
* query-ready while status stays `stopped` / `ready: false`.
|
|
331
|
+
* Liveness is a TCP accept on the port, proven by the caller (`acquire`).
|
|
263
332
|
*/
|
|
264
|
-
declare function parseHostStatus(json: string): {
|
|
333
|
+
declare function parseHostStatus(json: string): HostStatusPaths & {
|
|
265
334
|
port: number;
|
|
266
335
|
};
|
|
267
336
|
/**
|
|
268
|
-
* Discover
|
|
337
|
+
* Discover the registered autopg host (port + admin URL) via `autopg status --json`.
|
|
338
|
+
* Throws when autopg cannot be queried; does **not** prove a listener — probe TCP
|
|
339
|
+
* (or use `acquire`, which does) before connecting.
|
|
269
340
|
*/
|
|
270
341
|
declare function discoverHost(bin?: string): AutopgDiscovery;
|
|
271
342
|
/**
|
|
@@ -283,5 +354,5 @@ declare function buildDatabaseUrl(opts: {
|
|
|
283
354
|
password?: string;
|
|
284
355
|
}): string;
|
|
285
356
|
//#endregion
|
|
286
|
-
export { type AcquireIfNeededOptions, type AcquireIfNeededResult, type AcquireOptions, type AcquireResult, type AcquireSkip, type AcquireTaskContext, type AutopgDiscovery, CLI_NAME, type CloneFromTemplateIfNeededOptions, type CloneFromTemplateIfNeededResult, type CloneFromTemplateOptions, type CloneResult, type CreateAcquireTaskOptions, type DbMode, type DisposeOptions, type DisposeResult, INSTALL_HINT, type Lease, type LoadDevEnvOptions, type LoadTestEnvOptions, type MarkTemplateOptions, ROLE_PASSWORD_SCHEME, type ResolveAcquireSkipInput, STATE_DIRNAME, type WorktreeIdentity, acquire, acquireIfNeeded, applyDatabaseUrlEnv, buildCloneDatabaseName, buildDatabaseName, buildDatabaseUrl, buildRoleName, cloneFromTemplate, cloneFromTemplateIfNeeded, createAcquireTask, discoverHost, dispose, envFilePath, gc, isCedarPgManagedUrl, isExternalDatabaseEscapeHatch, isOrphanLease, loadDevEnv, loadTestEnv, markTemplate, parseHostStatus, parseLease, readLease, requireAutopgBin, resolveAcquireSkip, resolveAutopgBin, resolveRoot, resolveWorktreeIdentity, rolePasswordFor, urlFromLease };
|
|
357
|
+
export { type AcquireIfNeededOptions, type AcquireIfNeededResult, type AcquireOptions, type AcquireResult, type AcquireSkip, type AcquireTaskContext, type AutopgDiscovery, CLI_NAME, type CloneFromTemplateIfNeededOptions, type CloneFromTemplateIfNeededResult, type CloneFromTemplateOptions, type CloneResult, type CreateAcquireTaskOptions, type DbMode, type DevStatus, type DisposeOptions, type DisposeResult, INSTALL_HINT, type Lease, type LoadDevEnvOptions, type LoadTestEnvOptions, type MarkTemplateOptions, ROLE_PASSWORD_SCHEME, type ResolveAcquireSkipInput, type ResolveDevStatusOptions, STATE_DIRNAME, type WorktreeIdentity, acquire, acquireIfNeeded, applyDatabaseUrlEnv, buildCloneDatabaseName, buildDatabaseName, buildDatabaseUrl, buildRoleName, cloneFromTemplate, cloneFromTemplateIfNeeded, createAcquireTask, discoverHost, dispose, envFilePath, gc, isCedarPgManagedUrl, isExternalDatabaseEscapeHatch, isOrphanLease, loadDevEnv, loadTestEnv, markTemplate, parseHostStatus, parseLease, readLease, requireAutopgBin, resolveAcquireSkip, resolveAutopgBin, resolveDevStatus, resolveRoot, resolveWorktreeIdentity, rolePasswordFor, urlFromLease };
|
|
287
358
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
1
|
+
import { c as parseLease, d as resolveRoot, f as resolveWorktreeIdentity, h as STATE_DIRNAME, i as isOrphanLease, l as readLease, p as CLI_NAME, t as envFilePath } from "./lease-DS1SX8U_.mjs";
|
|
2
|
+
import { C as resolveAcquireSkip, D as buildRoleName, E as buildDatabaseName, S as isExternalDatabaseEscapeHatch, T as buildCloneDatabaseName, _ as rolePasswordFor, a as gc, b as applyDatabaseUrlEnv, c as ROLE_PASSWORD_SCHEME, f as discoverHost, g as resolveAutopgBin, h as requireAutopgBin, i as dispose, m as parseHostStatus, n as acquireIfNeeded, o as urlFromLease, s as INSTALL_HINT, t as acquire, u as buildDatabaseUrl, x as isCedarPgManagedUrl } from "./lifecycle-2BZgSVz2.mjs";
|
|
3
|
+
import { n as cloneFromTemplateIfNeeded, r as markTemplate, t as cloneFromTemplate } from "./template-DlqHL8Go.mjs";
|
|
4
|
+
import { t as loadTestEnv } from "./load-test-env-BqtA6V-d.mjs";
|
|
5
|
+
import { t as loadDevEnv } from "./load-dev-env-BULkXyen.mjs";
|
|
6
|
+
import { t as resolveDevStatus } from "./status-B68SGSKx.mjs";
|
|
7
7
|
//#region src/adapters/acquire-task.ts
|
|
8
8
|
/** Run acquireIfNeeded, then optional afterAcquire (migrate / db:ready). */
|
|
9
9
|
function createAcquireTask(options) {
|
|
@@ -27,6 +27,6 @@ function createAcquireTask(options) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
|
-
export { CLI_NAME, INSTALL_HINT, ROLE_PASSWORD_SCHEME, STATE_DIRNAME, acquire, acquireIfNeeded, applyDatabaseUrlEnv, buildCloneDatabaseName, buildDatabaseName, buildDatabaseUrl, buildRoleName, cloneFromTemplate, cloneFromTemplateIfNeeded, createAcquireTask, discoverHost, dispose, envFilePath, gc, isCedarPgManagedUrl, isExternalDatabaseEscapeHatch, isOrphanLease, loadDevEnv, loadTestEnv, markTemplate, parseHostStatus, parseLease, readLease, requireAutopgBin, resolveAcquireSkip, resolveAutopgBin, resolveRoot, resolveWorktreeIdentity, rolePasswordFor, urlFromLease };
|
|
30
|
+
export { CLI_NAME, INSTALL_HINT, ROLE_PASSWORD_SCHEME, STATE_DIRNAME, acquire, acquireIfNeeded, applyDatabaseUrlEnv, buildCloneDatabaseName, buildDatabaseName, buildDatabaseUrl, buildRoleName, cloneFromTemplate, cloneFromTemplateIfNeeded, createAcquireTask, discoverHost, dispose, envFilePath, gc, isCedarPgManagedUrl, isExternalDatabaseEscapeHatch, isOrphanLease, loadDevEnv, loadTestEnv, markTemplate, parseHostStatus, parseLease, readLease, requireAutopgBin, resolveAcquireSkip, resolveAutopgBin, resolveDevStatus, resolveRoot, resolveWorktreeIdentity, rolePasswordFor, urlFromLease };
|
|
31
31
|
|
|
32
32
|
//# sourceMappingURL=index.mjs.map
|
package/dist/jest-teardown.cjs
CHANGED
package/dist/jest-teardown.mjs
CHANGED
package/dist/jest-template.cjs
CHANGED
|
@@ -2,10 +2,11 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_template_mode = require("./template-mode-
|
|
5
|
+
const require_template_mode = require("./template-mode-DMO5-z7O.cjs");
|
|
6
6
|
//#region src/adapters/jest-template.ts
|
|
7
7
|
/**
|
|
8
|
-
* Jest globalSetup (template mode).
|
|
8
|
+
* Jest globalSetup (template mode). Drops crashed-run leftovers under this
|
|
9
|
+
* worktree's test role, then acquire → migrate → markTemplate.
|
|
9
10
|
*
|
|
10
11
|
* ```js
|
|
11
12
|
* // jest.cedar-global.cjs
|
|
@@ -13,8 +14,12 @@ const require_template_mode = require("./template-mode-BkEs9LnY.cjs");
|
|
|
13
14
|
* module.exports = createGlobalSetup({ migrate: async ({ databaseUrl }) => {} });
|
|
14
15
|
*
|
|
15
16
|
* // jest.config.cjs
|
|
17
|
+
* // When .env has a real TEST_DATABASE_URL, set once here (inherits to workers):
|
|
18
|
+
* // process.env.CEDAR_PG_FORCE = "1";
|
|
16
19
|
* globalSetup: "<rootDir>/jest.cedar-global.cjs",
|
|
17
20
|
* globalTeardown: require.resolve("@cedarjs/pg/jest-teardown"),
|
|
21
|
+
* // Runs per test file; every file in a worker reuses that worker's clone,
|
|
22
|
+
* // truncated with RESTART IDENTITY first (`cloneWorkerDatabase({ reset: "none" })` opts out).
|
|
18
23
|
* setupFilesAfterEnv: ["<rootDir>/jest.cedar-worker.cjs"],
|
|
19
24
|
*
|
|
20
25
|
* // jest.cedar-worker.cjs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest-template.cjs","names":["setupTemplateMode"],"sources":["../src/adapters/jest-template.ts"],"sourcesContent":["import {\n cloneWorkerDatabase,\n setupTemplateMode,\n type SetupTemplateModeOptions,\n} from \"./template-mode.ts\";\n\nexport { cloneWorkerDatabase };\nexport type {\n SetupTemplateModeOptions,\n TemplateMigrateFn,\n TemplateMigrateContext,\n} from \"./template-mode.ts\";\n\n/**\n * Jest globalSetup (template mode).\n *\n * ```js\n * // jest.cedar-global.cjs\n * const { createGlobalSetup } = require(\"@cedarjs/pg/jest/template\");\n * module.exports = createGlobalSetup({ migrate: async ({ databaseUrl }) => {} });\n *\n * // jest.config.cjs\n * globalSetup: \"<rootDir>/jest.cedar-global.cjs\",\n * globalTeardown: require.resolve(\"@cedarjs/pg/jest-teardown\"),\n * setupFilesAfterEnv: [\"<rootDir>/jest.cedar-worker.cjs\"],\n *\n * // jest.cedar-worker.cjs\n * const { cloneWorkerDatabase } = require(\"@cedarjs/pg/jest/template\");\n * beforeAll(() => cloneWorkerDatabase());\n * ```\n *\n * Stock `@cedarjs/pg/jest` is one shared test DB only.\n */\nexport function createGlobalSetup(options: SetupTemplateModeOptions) {\n return async () => {\n await setupTemplateMode(options);\n };\n}\n\n/** String `require.resolve` without a migrate hook is unsupported — use `createGlobalSetup`. */\nexport default async function globalSetup(): Promise<void> {\n throw new Error(\n \"@cedarjs/pg/jest/template requires createGlobalSetup({ migrate }). \" +\n \"Point globalSetup at a local module that exports createGlobalSetup({ migrate }).\",\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"jest-template.cjs","names":["setupTemplateMode"],"sources":["../src/adapters/jest-template.ts"],"sourcesContent":["import {\n cloneWorkerDatabase,\n setupTemplateMode,\n type SetupTemplateModeOptions,\n} from \"./template-mode.ts\";\n\nexport { cloneWorkerDatabase };\nexport type {\n SetupTemplateModeOptions,\n TemplateMigrateFn,\n TemplateMigrateContext,\n} from \"./template-mode.ts\";\n\n/**\n * Jest globalSetup (template mode). Drops crashed-run leftovers under this\n * worktree's test role, then acquire → migrate → markTemplate.\n *\n * ```js\n * // jest.cedar-global.cjs\n * const { createGlobalSetup } = require(\"@cedarjs/pg/jest/template\");\n * module.exports = createGlobalSetup({ migrate: async ({ databaseUrl }) => {} });\n *\n * // jest.config.cjs\n * // When .env has a real TEST_DATABASE_URL, set once here (inherits to workers):\n * // process.env.CEDAR_PG_FORCE = \"1\";\n * globalSetup: \"<rootDir>/jest.cedar-global.cjs\",\n * globalTeardown: require.resolve(\"@cedarjs/pg/jest-teardown\"),\n * // Runs per test file; every file in a worker reuses that worker's clone,\n * // truncated with RESTART IDENTITY first (`cloneWorkerDatabase({ reset: \"none\" })` opts out).\n * setupFilesAfterEnv: [\"<rootDir>/jest.cedar-worker.cjs\"],\n *\n * // jest.cedar-worker.cjs\n * const { cloneWorkerDatabase } = require(\"@cedarjs/pg/jest/template\");\n * beforeAll(() => cloneWorkerDatabase());\n * ```\n *\n * Stock `@cedarjs/pg/jest` is one shared test DB only.\n */\nexport function createGlobalSetup(options: SetupTemplateModeOptions) {\n return async () => {\n await setupTemplateMode(options);\n };\n}\n\n/** String `require.resolve` without a migrate hook is unsupported — use `createGlobalSetup`. */\nexport default async function globalSetup(): Promise<void> {\n throw new Error(\n \"@cedarjs/pg/jest/template requires createGlobalSetup({ migrate }). \" +\n \"Point globalSetup at a local module that exports createGlobalSetup({ migrate }).\",\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,kBAAkB,SAAmC;CACnE,OAAO,YAAY;EACjB,MAAMA,sBAAAA,kBAAkB,OAAO;CACjC;AACF;;AAGA,eAA8B,cAA6B;CACzD,MAAM,IAAI,MACR,qJAEF;AACF"}
|
package/dist/jest-template.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { i as cloneWorkerDatabase, n as TemplateMigrateContext, r as TemplateMigrateFn, t as SetupTemplateModeOptions } from "./template-mode-
|
|
1
|
+
import { i as cloneWorkerDatabase, n as TemplateMigrateContext, r as TemplateMigrateFn, t as SetupTemplateModeOptions } from "./template-mode-BqV3GjXI.cjs";
|
|
2
2
|
//#region src/adapters/jest-template.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* Jest globalSetup (template mode).
|
|
4
|
+
* Jest globalSetup (template mode). Drops crashed-run leftovers under this
|
|
5
|
+
* worktree's test role, then acquire → migrate → markTemplate.
|
|
5
6
|
*
|
|
6
7
|
* ```js
|
|
7
8
|
* // jest.cedar-global.cjs
|
|
@@ -9,8 +10,12 @@ import { i as cloneWorkerDatabase, n as TemplateMigrateContext, r as TemplateMig
|
|
|
9
10
|
* module.exports = createGlobalSetup({ migrate: async ({ databaseUrl }) => {} });
|
|
10
11
|
*
|
|
11
12
|
* // jest.config.cjs
|
|
13
|
+
* // When .env has a real TEST_DATABASE_URL, set once here (inherits to workers):
|
|
14
|
+
* // process.env.CEDAR_PG_FORCE = "1";
|
|
12
15
|
* globalSetup: "<rootDir>/jest.cedar-global.cjs",
|
|
13
16
|
* globalTeardown: require.resolve("@cedarjs/pg/jest-teardown"),
|
|
17
|
+
* // Runs per test file; every file in a worker reuses that worker's clone,
|
|
18
|
+
* // truncated with RESTART IDENTITY first (`cloneWorkerDatabase({ reset: "none" })` opts out).
|
|
14
19
|
* setupFilesAfterEnv: ["<rootDir>/jest.cedar-worker.cjs"],
|
|
15
20
|
*
|
|
16
21
|
* // jest.cedar-worker.cjs
|
package/dist/jest-template.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { i as cloneWorkerDatabase, n as TemplateMigrateContext, r as TemplateMigrateFn, t as SetupTemplateModeOptions } from "./template-mode-
|
|
1
|
+
import { i as cloneWorkerDatabase, n as TemplateMigrateContext, r as TemplateMigrateFn, t as SetupTemplateModeOptions } from "./template-mode-BqV3GjXI.mjs";
|
|
2
2
|
//#region src/adapters/jest-template.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* Jest globalSetup (template mode).
|
|
4
|
+
* Jest globalSetup (template mode). Drops crashed-run leftovers under this
|
|
5
|
+
* worktree's test role, then acquire → migrate → markTemplate.
|
|
5
6
|
*
|
|
6
7
|
* ```js
|
|
7
8
|
* // jest.cedar-global.cjs
|
|
@@ -9,8 +10,12 @@ import { i as cloneWorkerDatabase, n as TemplateMigrateContext, r as TemplateMig
|
|
|
9
10
|
* module.exports = createGlobalSetup({ migrate: async ({ databaseUrl }) => {} });
|
|
10
11
|
*
|
|
11
12
|
* // jest.config.cjs
|
|
13
|
+
* // When .env has a real TEST_DATABASE_URL, set once here (inherits to workers):
|
|
14
|
+
* // process.env.CEDAR_PG_FORCE = "1";
|
|
12
15
|
* globalSetup: "<rootDir>/jest.cedar-global.cjs",
|
|
13
16
|
* globalTeardown: require.resolve("@cedarjs/pg/jest-teardown"),
|
|
17
|
+
* // Runs per test file; every file in a worker reuses that worker's clone,
|
|
18
|
+
* // truncated with RESTART IDENTITY first (`cloneWorkerDatabase({ reset: "none" })` opts out).
|
|
14
19
|
* setupFilesAfterEnv: ["<rootDir>/jest.cedar-worker.cjs"],
|
|
15
20
|
*
|
|
16
21
|
* // jest.cedar-worker.cjs
|
package/dist/jest-template.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { n as setupTemplateMode, t as cloneWorkerDatabase } from "./template-mode-
|
|
1
|
+
import { n as setupTemplateMode, t as cloneWorkerDatabase } from "./template-mode-DK5cAlv9.mjs";
|
|
2
2
|
//#region src/adapters/jest-template.ts
|
|
3
3
|
/**
|
|
4
|
-
* Jest globalSetup (template mode).
|
|
4
|
+
* Jest globalSetup (template mode). Drops crashed-run leftovers under this
|
|
5
|
+
* worktree's test role, then acquire → migrate → markTemplate.
|
|
5
6
|
*
|
|
6
7
|
* ```js
|
|
7
8
|
* // jest.cedar-global.cjs
|
|
@@ -9,8 +10,12 @@ import { n as setupTemplateMode, t as cloneWorkerDatabase } from "./template-mod
|
|
|
9
10
|
* module.exports = createGlobalSetup({ migrate: async ({ databaseUrl }) => {} });
|
|
10
11
|
*
|
|
11
12
|
* // jest.config.cjs
|
|
13
|
+
* // When .env has a real TEST_DATABASE_URL, set once here (inherits to workers):
|
|
14
|
+
* // process.env.CEDAR_PG_FORCE = "1";
|
|
12
15
|
* globalSetup: "<rootDir>/jest.cedar-global.cjs",
|
|
13
16
|
* globalTeardown: require.resolve("@cedarjs/pg/jest-teardown"),
|
|
17
|
+
* // Runs per test file; every file in a worker reuses that worker's clone,
|
|
18
|
+
* // truncated with RESTART IDENTITY first (`cloneWorkerDatabase({ reset: "none" })` opts out).
|
|
14
19
|
* setupFilesAfterEnv: ["<rootDir>/jest.cedar-worker.cjs"],
|
|
15
20
|
*
|
|
16
21
|
* // jest.cedar-worker.cjs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest-template.mjs","names":[],"sources":["../src/adapters/jest-template.ts"],"sourcesContent":["import {\n cloneWorkerDatabase,\n setupTemplateMode,\n type SetupTemplateModeOptions,\n} from \"./template-mode.ts\";\n\nexport { cloneWorkerDatabase };\nexport type {\n SetupTemplateModeOptions,\n TemplateMigrateFn,\n TemplateMigrateContext,\n} from \"./template-mode.ts\";\n\n/**\n * Jest globalSetup (template mode).\n *\n * ```js\n * // jest.cedar-global.cjs\n * const { createGlobalSetup } = require(\"@cedarjs/pg/jest/template\");\n * module.exports = createGlobalSetup({ migrate: async ({ databaseUrl }) => {} });\n *\n * // jest.config.cjs\n * globalSetup: \"<rootDir>/jest.cedar-global.cjs\",\n * globalTeardown: require.resolve(\"@cedarjs/pg/jest-teardown\"),\n * setupFilesAfterEnv: [\"<rootDir>/jest.cedar-worker.cjs\"],\n *\n * // jest.cedar-worker.cjs\n * const { cloneWorkerDatabase } = require(\"@cedarjs/pg/jest/template\");\n * beforeAll(() => cloneWorkerDatabase());\n * ```\n *\n * Stock `@cedarjs/pg/jest` is one shared test DB only.\n */\nexport function createGlobalSetup(options: SetupTemplateModeOptions) {\n return async () => {\n await setupTemplateMode(options);\n };\n}\n\n/** String `require.resolve` without a migrate hook is unsupported — use `createGlobalSetup`. */\nexport default async function globalSetup(): Promise<void> {\n throw new Error(\n \"@cedarjs/pg/jest/template requires createGlobalSetup({ migrate }). \" +\n \"Point globalSetup at a local module that exports createGlobalSetup({ migrate }).\",\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"jest-template.mjs","names":[],"sources":["../src/adapters/jest-template.ts"],"sourcesContent":["import {\n cloneWorkerDatabase,\n setupTemplateMode,\n type SetupTemplateModeOptions,\n} from \"./template-mode.ts\";\n\nexport { cloneWorkerDatabase };\nexport type {\n SetupTemplateModeOptions,\n TemplateMigrateFn,\n TemplateMigrateContext,\n} from \"./template-mode.ts\";\n\n/**\n * Jest globalSetup (template mode). Drops crashed-run leftovers under this\n * worktree's test role, then acquire → migrate → markTemplate.\n *\n * ```js\n * // jest.cedar-global.cjs\n * const { createGlobalSetup } = require(\"@cedarjs/pg/jest/template\");\n * module.exports = createGlobalSetup({ migrate: async ({ databaseUrl }) => {} });\n *\n * // jest.config.cjs\n * // When .env has a real TEST_DATABASE_URL, set once here (inherits to workers):\n * // process.env.CEDAR_PG_FORCE = \"1\";\n * globalSetup: \"<rootDir>/jest.cedar-global.cjs\",\n * globalTeardown: require.resolve(\"@cedarjs/pg/jest-teardown\"),\n * // Runs per test file; every file in a worker reuses that worker's clone,\n * // truncated with RESTART IDENTITY first (`cloneWorkerDatabase({ reset: \"none\" })` opts out).\n * setupFilesAfterEnv: [\"<rootDir>/jest.cedar-worker.cjs\"],\n *\n * // jest.cedar-worker.cjs\n * const { cloneWorkerDatabase } = require(\"@cedarjs/pg/jest/template\");\n * beforeAll(() => cloneWorkerDatabase());\n * ```\n *\n * Stock `@cedarjs/pg/jest` is one shared test DB only.\n */\nexport function createGlobalSetup(options: SetupTemplateModeOptions) {\n return async () => {\n await setupTemplateMode(options);\n };\n}\n\n/** String `require.resolve` without a migrate hook is unsupported — use `createGlobalSetup`. */\nexport default async function globalSetup(): Promise<void> {\n throw new Error(\n \"@cedarjs/pg/jest/template requires createGlobalSetup({ migrate }). \" +\n \"Point globalSetup at a local module that exports createGlobalSetup({ migrate }).\",\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,kBAAkB,SAAmC;CACnE,OAAO,YAAY;EACjB,MAAM,kBAAkB,OAAO;CACjC;AACF;;AAGA,eAA8B,cAA6B;CACzD,MAAM,IAAI,MACR,qJAEF;AACF"}
|
package/dist/jest.cjs
CHANGED
package/dist/jest.mjs
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
import { r as STATE_DIRNAME } from "./constants-NLR0U4NR.mjs";
|
|
2
1
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
2
|
import { homedir } from "node:os";
|
|
4
3
|
import { basename, dirname, join, resolve } from "node:path";
|
|
5
4
|
import { createHash } from "node:crypto";
|
|
6
5
|
import { execFileSync } from "node:child_process";
|
|
6
|
+
//#region src/core/constants.ts
|
|
7
|
+
/**
|
|
8
|
+
* Product identity vs frozen crypto.
|
|
9
|
+
*
|
|
10
|
+
* State dirs follow the CLI name (`.cedarpg`): product-owned, not nested under
|
|
11
|
+
* autopg's `~/.autopg/` (host owns that) and not a generic `.pg` (collision-prone).
|
|
12
|
+
* Password salt is an opaque crypto constant; bump ROLE_PASSWORD_SCHEME to change it.
|
|
13
|
+
*/
|
|
14
|
+
/** User-facing CLI binary (`package.json` bin) and log prefix */
|
|
15
|
+
const CLI_NAME = "cedarpg";
|
|
16
|
+
/**
|
|
17
|
+
* Worktree-local state dir and home-registry parent (`~/.cedarpg/registry`).
|
|
18
|
+
* Frozen for lease/gc discovery after first alpha consumers appear.
|
|
19
|
+
*/
|
|
20
|
+
const STATE_DIRNAME = ".cedarpg";
|
|
21
|
+
/**
|
|
22
|
+
* Password scheme v2 salt prefix: sha256(`${PASSWORD_SALT_PREFIX}\0` + roleName).
|
|
23
|
+
* Opaque; independent of STATE_DIRNAME / CLI_NAME. Bump ROLE_PASSWORD_SCHEME to change.
|
|
24
|
+
*/
|
|
25
|
+
const PASSWORD_SALT_PREFIX = "cedar-pg";
|
|
26
|
+
//#endregion
|
|
7
27
|
//#region src/core/worktree.ts
|
|
8
28
|
function git(args, cwd) {
|
|
9
29
|
try {
|
|
@@ -196,6 +216,6 @@ function isOrphanLease(lease) {
|
|
|
196
216
|
return !existsSync(lease.root);
|
|
197
217
|
}
|
|
198
218
|
//#endregion
|
|
199
|
-
export { leaseDir as a, parseLease as c, resolveRoot as d, resolveWorktreeIdentity as f, isOrphanLease as i, readLease as l, envPath as n, leasePath as o, forgetLease as r, listRegistryLeases as s, envFilePath as t, writeLease as u };
|
|
219
|
+
export { leaseDir as a, parseLease as c, resolveRoot as d, resolveWorktreeIdentity as f, STATE_DIRNAME as h, isOrphanLease as i, readLease as l, PASSWORD_SALT_PREFIX as m, envPath as n, leasePath as o, CLI_NAME as p, forgetLease as r, listRegistryLeases as s, envFilePath as t, writeLease as u };
|
|
200
220
|
|
|
201
|
-
//# sourceMappingURL=lease-
|
|
221
|
+
//# sourceMappingURL=lease-DS1SX8U_.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lease-DS1SX8U_.mjs","names":[],"sources":["../src/core/constants.ts","../src/core/worktree.ts","../src/core/lease.ts"],"sourcesContent":["/**\n * Product identity vs frozen crypto.\n *\n * State dirs follow the CLI name (`.cedarpg`): product-owned, not nested under\n * autopg's `~/.autopg/` (host owns that) and not a generic `.pg` (collision-prone).\n * Password salt is an opaque crypto constant; bump ROLE_PASSWORD_SCHEME to change it.\n */\n\n/** User-facing CLI binary (`package.json` bin) and log prefix */\nexport const CLI_NAME = \"cedarpg\";\n\n/**\n * Worktree-local state dir and home-registry parent (`~/.cedarpg/registry`).\n * Frozen for lease/gc discovery after first alpha consumers appear.\n */\nexport const STATE_DIRNAME = \".cedarpg\";\n\n/**\n * Password scheme v2 salt prefix: sha256(`${PASSWORD_SALT_PREFIX}\\0` + roleName).\n * Opaque; independent of STATE_DIRNAME / CLI_NAME. Bump ROLE_PASSWORD_SCHEME to change.\n */\nexport const PASSWORD_SALT_PREFIX = \"cedar-pg\";\n","import { createHash } from \"node:crypto\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { basename, dirname, resolve } from \"node:path\";\nimport { execFileSync } from \"node:child_process\";\n\nexport type WorktreeIdentity = {\n /** Absolute path to the worktree / project root. */\n root: string;\n /** Basename of the git common dir / main checkout (e.g. `cedar`). */\n repoSlug: string;\n /** Basename of this worktree directory (e.g. `feat-auth`). */\n worktreeSlug: string;\n /** First 8 hex chars of sha256(absolute root). */\n pathHash: string;\n};\n\nfunction git(args: string[], cwd: string): string | null {\n try {\n return execFileSync(\"git\", args, {\n cwd,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n } catch {\n return null;\n }\n}\n\nfunction sanitizeSlug(input: string): string {\n return input\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n}\n\n/**\n * Resolve the project / worktree root.\n * Explicit `root` wins (app project path). Otherwise prefer git toplevel, then cwd.\n */\nexport function resolveRoot(root?: string): string {\n if (root) return resolve(root);\n const start = resolve(process.cwd());\n const toplevel = git([\"rev-parse\", \"--show-toplevel\"], start);\n if (toplevel) return toplevel;\n return start;\n}\n\n/**\n * Identify repo + worktree for observable DB naming.\n */\nexport function resolveWorktreeIdentity(root?: string): WorktreeIdentity {\n const absRoot = resolveRoot(root);\n const pathHash = createHash(\"sha256\").update(absRoot).digest(\"hex\").slice(0, 8);\n\n const commonDir = git([\"rev-parse\", \"--git-common-dir\"], absRoot);\n let repoSlug = sanitizeSlug(basename(absRoot));\n if (commonDir) {\n // common-dir is often `<main>/.git` or an absolute path to the main .git\n const commonAbs = resolve(absRoot, commonDir);\n // If commonAbs ends with `.git`, parent is main worktree root\n const mainRoot = basename(commonAbs) === \".git\" ? dirname(commonAbs) : commonAbs;\n // For linked worktrees, common-dir may be `.../main/.git`\n const candidate = basename(mainRoot) === \".git\" ? dirname(mainRoot) : mainRoot;\n const fromGit = sanitizeSlug(basename(candidate));\n if (fromGit) repoSlug = fromGit;\n }\n\n // Prefer gitdir worktree name when present (`.git` file pointing at worktrees/<name>)\n let worktreeSlug = sanitizeSlug(basename(absRoot));\n const gitFile = resolve(absRoot, \".git\");\n if (existsSync(gitFile)) {\n try {\n const content = readFileSync(gitFile, \"utf8\").trim();\n const match = content.match(/gitdir:\\s*(.+)$/m);\n if (match?.[1]) {\n const gitdir = resolve(absRoot, match[1].trim());\n // .../.git/worktrees/<name>\n const parts = gitdir.split(/[/\\\\]/);\n const wtIdx = parts.lastIndexOf(\"worktrees\");\n if (wtIdx >= 0 && parts[wtIdx + 1]) {\n const fromWt = sanitizeSlug(parts[wtIdx + 1]!);\n if (fromWt) worktreeSlug = fromWt;\n }\n }\n } catch {\n // keep basename slug\n }\n }\n\n if (!repoSlug) repoSlug = \"repo\";\n if (!worktreeSlug) worktreeSlug = \"wt\";\n\n return { root: absRoot, repoSlug, worktreeSlug, pathHash };\n}\n","import {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n renameSync,\n unlinkSync,\n writeFileSync,\n} from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { STATE_DIRNAME } from \"./constants.ts\";\nimport type { DbMode } from \"./naming.ts\";\nimport { resolveRoot } from \"./worktree.ts\";\n\nexport type Lease = {\n schemaVersion: 1;\n mode: DbMode;\n root: string;\n repoSlug: string;\n worktreeSlug: string;\n pathHash: string;\n databaseName: string;\n roleName: string;\n port: number;\n pid: number;\n createdAt: string;\n};\n\nfunction isDbMode(value: unknown): value is DbMode {\n return value === \"dev\" || value === \"test\";\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === \"string\" && value.length > 0;\n}\n\n/** Narrow-parse a lease; reject incomplete or wrong-version records. */\nexport function parseLease(raw: unknown): Lease | null {\n if (!raw || typeof raw !== \"object\") return null;\n const o = raw as Record<string, unknown>;\n if (o.schemaVersion !== 1) return null;\n if (!isDbMode(o.mode)) return null;\n if (!isNonEmptyString(o.root)) return null;\n if (!isNonEmptyString(o.repoSlug)) return null;\n if (!isNonEmptyString(o.worktreeSlug)) return null;\n if (!isNonEmptyString(o.pathHash)) return null;\n if (!isNonEmptyString(o.databaseName)) return null;\n if (!isNonEmptyString(o.roleName)) return null;\n if (typeof o.port !== \"number\") return null;\n if (typeof o.pid !== \"number\") return null;\n if (!isNonEmptyString(o.createdAt)) return null;\n return {\n schemaVersion: 1,\n mode: o.mode,\n root: o.root,\n repoSlug: o.repoSlug,\n worktreeSlug: o.worktreeSlug,\n pathHash: o.pathHash,\n databaseName: o.databaseName,\n roleName: o.roleName,\n port: o.port,\n pid: o.pid,\n createdAt: o.createdAt,\n };\n}\n\nexport function leaseDir(root: string): string {\n return join(root, STATE_DIRNAME);\n}\n\nexport function leasePath(root: string, mode: DbMode): string {\n return join(leaseDir(root), `${mode}.json`);\n}\n\nexport function envPath(root: string, mode: DbMode): string {\n return join(leaseDir(root), `${mode}.env`);\n}\n\n/** Absolute `.cedarpg/<mode>.env` path (resolves root when omitted). */\nexport function envFilePath(root: string | undefined, mode: DbMode): string {\n return envPath(resolveRoot(root), mode);\n}\n\n/** Best-effort delete worktree lease JSON + mode env (missing is fine). */\nfunction unlinkWorktreeArtifacts(root: string, mode: DbMode): void {\n for (const file of [leasePath(root, mode), envPath(root, mode)]) {\n try {\n unlinkSync(file);\n } catch {\n // root or file may already be gone\n }\n }\n}\n\n/** Durable registry outside worktrees so GC can find orphans after a checkout is deleted. */\nexport function registryDir(): string {\n return process.env.CEDAR_PG_REGISTRY_DIR || join(homedir(), STATE_DIRNAME, \"registry\");\n}\n\nfunction registryPath(databaseName: string): string {\n return join(registryDir(), `${databaseName}.json`);\n}\n\nfunction writeJsonAtomic(file: string, value: unknown): void {\n mkdirSync(dirname(file), { recursive: true, mode: 0o700 });\n const tmp = `${file}.tmp.${process.pid}`;\n writeFileSync(tmp, `${JSON.stringify(value, null, 2)}\\n`, { mode: 0o600 });\n renameSync(tmp, file);\n}\n\nfunction registerLease(lease: Lease): void {\n writeJsonAtomic(registryPath(lease.databaseName), lease);\n}\n\nfunction unregisterLease(databaseName: string): void {\n try {\n unlinkSync(registryPath(databaseName));\n } catch {\n // missing is fine\n }\n}\n\nfunction peekDatabaseName(root: string, mode: DbMode): string | undefined {\n const file = leasePath(root, mode);\n if (!existsSync(file)) return undefined;\n try {\n const raw = JSON.parse(readFileSync(file, \"utf8\")) as { databaseName?: unknown };\n return typeof raw.databaseName === \"string\" && raw.databaseName ? raw.databaseName : undefined;\n } catch {\n return undefined;\n }\n}\n\nexport function readLease(root: string, mode: DbMode): Lease | null {\n const file = leasePath(root, mode);\n if (!existsSync(file)) return null;\n try {\n return parseLease(JSON.parse(readFileSync(file, \"utf8\")));\n } catch {\n return null;\n }\n}\n\n/**\n * Persist lease. Registry is written first (GC source of truth), then the worktree cache.\n */\nexport function writeLease(lease: Lease): void {\n registerLease(lease);\n const dir = leaseDir(lease.root);\n mkdirSync(dir, { recursive: true, mode: 0o700 });\n writeJsonAtomic(leasePath(lease.root, lease.mode), lease);\n}\n\n/**\n * Remove registry entry by databaseName and best-effort delete worktree lease + env.\n * Call only after a successful DROP (or when intentionally abandoning tracking).\n */\nexport function forgetLease(lease: Pick<Lease, \"root\" | \"mode\" | \"databaseName\">): void {\n unregisterLease(lease.databaseName);\n unlinkWorktreeArtifacts(lease.root, lease.mode);\n}\n\n/**\n * Clear worktree lease + env + registry. Unregisters by databaseName even when the local\n * file fails full parse (peeks databaseName from raw JSON).\n */\nexport function clearLease(root: string, mode: DbMode): void {\n const existing = readLease(root, mode);\n if (existing) {\n forgetLease(existing);\n return;\n }\n const databaseName = peekDatabaseName(root, mode);\n unlinkWorktreeArtifacts(root, mode);\n if (databaseName) {\n unregisterLease(databaseName);\n }\n}\n\n/** All registry entries (used by gc). */\nexport function listRegistryLeases(): Lease[] {\n const dir = registryDir();\n if (!existsSync(dir)) return [];\n const out: Lease[] = [];\n for (const name of readdirSync(dir)) {\n if (!name.endsWith(\".json\")) continue;\n try {\n const lease = parseLease(JSON.parse(readFileSync(join(dir, name), \"utf8\")));\n if (lease) out.push(lease);\n } catch {\n // skip corrupt\n }\n }\n return out;\n}\n\nexport function isOrphanLease(lease: Lease): boolean {\n return !existsSync(lease.root);\n}\n"],"mappings":"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"}
|