@antelopejs/dms 0.24.4-next.1079.g1281247 → 0.25.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 +41 -0
- package/README.md +2 -2
- package/dist/e2e/index.d.mts +3 -1
- package/dist/e2e/processes.d.mts +0 -50
- package/dist/e2e/run-copy.d.mts +3 -1
- package/dist/e2e/stack.d.mts +0 -8
- package/dist/e2e/waits.d.mts +69 -0
- package/e2e/backend.mjs +1 -1
- package/e2e/dashboard.mjs +1 -1
- package/e2e/index.mjs +4 -2
- package/e2e/mongo.mjs +2 -6
- package/e2e/processes.mjs +1 -101
- package/e2e/run-copy.mjs +8 -4
- package/e2e/stack.mjs +2 -18
- package/e2e/waits.mjs +138 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.25.1
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.25.0...v0.25.1)
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- **e2e:** Retry a failed journey once in the merge queue, reported as flaky ([#1302](https://github.com/AntelopeJS/dms/pull/1302))
|
|
10
|
+
- **e2e:** Make the backend and dashboard waits refuse a port another process holds ([#1301](https://github.com/AntelopeJS/dms/pull/1301))
|
|
11
|
+
- **dms:** Lay out a run copy of a playground with no node_modules of its own ([#1303](https://github.com/AntelopeJS/dms/pull/1303))
|
|
12
|
+
|
|
13
|
+
### ❤️ Contributors
|
|
14
|
+
|
|
15
|
+
- Antony Rizzitelli
|
|
16
|
+
|
|
17
|
+
## v0.25.0
|
|
18
|
+
|
|
19
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.24.3...v0.25.0)
|
|
20
|
+
|
|
21
|
+
### 🔥 Performance
|
|
22
|
+
|
|
23
|
+
- **dms:** Run two e2e workers per shard, each on a run of its own ([#1286](https://github.com/AntelopeJS/dms/pull/1286))
|
|
24
|
+
|
|
25
|
+
### 🩹 Fixes
|
|
26
|
+
|
|
27
|
+
- **dms:** Keep the e2e kit's mongod off the run's reserved ports ([#1285](https://github.com/AntelopeJS/dms/pull/1285))
|
|
28
|
+
- **ci:** Run every job on Blacksmith, gate the hand-written jobs and sync tooling-configs 0.10.12 ([#1289](https://github.com/AntelopeJS/dms/pull/1289))
|
|
29
|
+
|
|
30
|
+
### 🏡 Chore
|
|
31
|
+
|
|
32
|
+
- **deps:** Update dependency @types/chai to v5 ([#1294](https://github.com/AntelopeJS/dms/pull/1294))
|
|
33
|
+
- **deps:** Update dependency @types/jsdom to v30 ([#1295](https://github.com/AntelopeJS/dms/pull/1295))
|
|
34
|
+
- **deps:** Update dependency @unhead/vue to v3 ([#1296](https://github.com/AntelopeJS/dms/pull/1296))
|
|
35
|
+
|
|
36
|
+
#### ⚠️ Breaking Changes
|
|
37
|
+
|
|
38
|
+
- **dms:** Run two e2e workers per shard, each on a run of its own ([#1286](https://github.com/AntelopeJS/dms/pull/1286))
|
|
39
|
+
|
|
40
|
+
### ❤️ Contributors
|
|
41
|
+
|
|
42
|
+
- Antony Rizzitelli
|
|
43
|
+
|
|
3
44
|
## v0.24.3
|
|
4
45
|
|
|
5
46
|
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.24.2...v0.24.3)
|
package/README.md
CHANGED
|
@@ -87,9 +87,9 @@ export class SalesPage extends PageController("sales", {
|
|
|
87
87
|
| `@antelopejs/interface-database` | `>=0.4.3 <0.5.0` | `0.4.3` |
|
|
88
88
|
| `@antelopejs/interface-database-catalog` | `>=0.1.1 <0.2.0` | `0.1.1` |
|
|
89
89
|
| `@antelopejs/interface-database-decorators` | `>=0.5.4 <0.6.0` | `0.5.4` |
|
|
90
|
-
| `@antelopejs/interface-dms` | `^0.17.
|
|
90
|
+
| `@antelopejs/interface-dms` | `^0.17.3` | `0.17.3` |
|
|
91
91
|
| `@antelopejs/interface-dms-automation` | `>=0.7.0 <0.8.0` | `0.7.2` |
|
|
92
|
-
| `@antelopejs/interface-dms-builder` | `^0.6.
|
|
92
|
+
| `@antelopejs/interface-dms-builder` | `^0.6.4` | `0.6.4` |
|
|
93
93
|
| `@antelopejs/interface-email` | `>=0.2.1 <0.3.0` | `0.2.1` |
|
|
94
94
|
| `@antelopejs/interface-file-storage` | `>=0.1.4 <0.2.0` | `0.1.9` |
|
|
95
95
|
| `@antelopejs/interface-redis` | `>=0.0.9 <0.1.0` | `0.0.11` |
|
package/dist/e2e/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Playwright config of a suite: two workers, each against a run of its
|
|
3
3
|
* own that the global setup starts (one worker when `DMS_E2E_RUN` names
|
|
4
|
-
* the run to drive),
|
|
4
|
+
* the run to drive), one retry in a GitHub merge-queue run (`merge_group`),
|
|
5
|
+
* which reports a pass on retry as flaky, and none elsewhere, a test timeout
|
|
6
|
+
* above the kit's own waits,
|
|
5
7
|
* and the CI reporters. It is plain
|
|
6
8
|
* Playwright config, so `defineConfig(e2eConfig(), overrides)` adjusts it.
|
|
7
9
|
* The suite's journeys come from `e2e/journeys.config.ts` and
|
package/dist/e2e/processes.d.mts
CHANGED
|
@@ -66,56 +66,6 @@ export function runToEnd(spec: {
|
|
|
66
66
|
env: NodeJS.ProcessEnv;
|
|
67
67
|
logs: string;
|
|
68
68
|
}): Promise<void>;
|
|
69
|
-
/**
|
|
70
|
-
* The status of one GET, or `null` when nothing answered.
|
|
71
|
-
*
|
|
72
|
-
* @param {string} url The URL
|
|
73
|
-
* @returns {Promise<number | null>} The HTTP status
|
|
74
|
-
*/
|
|
75
|
-
export function probe(url: string): Promise<number | null>;
|
|
76
|
-
/**
|
|
77
|
-
* Polls `url` until it answers 200, the process exits or the timeout passes.
|
|
78
|
-
*
|
|
79
|
-
* @param {string} url The readiness URL
|
|
80
|
-
* @param {{ pid: number, log: string }} record The process that must serve it
|
|
81
|
-
* @param {number} timeoutMs How long to wait
|
|
82
|
-
* @returns {Promise<void>} Resolves once ready
|
|
83
|
-
* @throws When the process exits first or the timeout passes, naming its log
|
|
84
|
-
*/
|
|
85
|
-
export function waitForOk(url: string, record: {
|
|
86
|
-
pid: number;
|
|
87
|
-
log: string;
|
|
88
|
-
}, timeoutMs: number): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* Polls a loopback port until it accepts a connection, the process exits or
|
|
91
|
-
* the timeout passes.
|
|
92
|
-
*
|
|
93
|
-
* @param {number} port The port
|
|
94
|
-
* @param {{ name: string, pid: number, log: string }} record The process that must listen
|
|
95
|
-
* @param {number} timeoutMs How long to wait
|
|
96
|
-
* @returns {Promise<void>} Resolves once it listens
|
|
97
|
-
* @throws When the process exits first or the timeout passes, naming its log
|
|
98
|
-
*/
|
|
99
|
-
export function waitForPort(port: number, record: {
|
|
100
|
-
name: string;
|
|
101
|
-
pid: number;
|
|
102
|
-
log: string;
|
|
103
|
-
}, timeoutMs: number): Promise<void>;
|
|
104
|
-
/**
|
|
105
|
-
* Polls until the process itself listens on the port, so a port another
|
|
106
|
-
* program took after it was picked is not mistaken for ours.
|
|
107
|
-
*
|
|
108
|
-
* @param {number} port The port
|
|
109
|
-
* @param {{ name: string, pid: number, log: string }} record The process that must listen
|
|
110
|
-
* @param {number} timeoutMs How long to wait
|
|
111
|
-
* @returns {Promise<void>} Resolves once the process listens
|
|
112
|
-
* @throws When it exits first (the port was taken) or the timeout passes
|
|
113
|
-
*/
|
|
114
|
-
export function waitForOwnPort(port: number, record: {
|
|
115
|
-
name: string;
|
|
116
|
-
pid: number;
|
|
117
|
-
log: string;
|
|
118
|
-
}, timeoutMs: number): Promise<void>;
|
|
119
69
|
/**
|
|
120
70
|
* Every live descendant of `pids`, read from /proc. Empty where /proc is
|
|
121
71
|
* missing. A child that left the process group is found here too.
|
package/dist/e2e/run-copy.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A `node_modules` that is `modules` with `@antelopejs/dms-frontend` replaced
|
|
3
3
|
* by the renderer checkout and no `.cache`, every other entry linked to the
|
|
4
|
-
* original.
|
|
4
|
+
* original. Without `modules`, it holds only the renderer.
|
|
5
5
|
*
|
|
6
6
|
* @param {string} modules The playground's installed modules
|
|
7
7
|
* @param {string} shadow The run's `node_modules`
|
|
@@ -17,6 +17,8 @@ export function linkRenderer(modules: string, shadow: string, renderer: string):
|
|
|
17
17
|
* the playground's but `.cache`, where a backend writes its MCP credential
|
|
18
18
|
* and its packed modules, so that folder belongs to the run too; and
|
|
19
19
|
* `@antelopejs/dms-frontend` is the `renderer` checkout when there is one.
|
|
20
|
+
* A playground with no `node_modules` of its own gets none, unless it has a
|
|
21
|
+
* `renderer`, and resolves its modules from the linked levels above it.
|
|
20
22
|
*
|
|
21
23
|
* @param {string} playground The playground folder
|
|
22
24
|
* @param {string} checkout The checkout root, or the module folder outside one
|
package/dist/e2e/stack.d.mts
CHANGED
|
@@ -78,14 +78,6 @@ export function launchBackend(state: RunState, database: string, build?: {
|
|
|
78
78
|
* @returns {import("./run-state.mjs").BackendRecord[]} The backends
|
|
79
79
|
*/
|
|
80
80
|
export function liveBackends(state: RunState): import("./run-state.mjs").BackendRecord[];
|
|
81
|
-
/**
|
|
82
|
-
* Waits until a backend answers `/api/onboarding/informations` on its own port.
|
|
83
|
-
*
|
|
84
|
-
* @param {import("./run-state.mjs").ServerRecord} backend The backend
|
|
85
|
-
* @returns {Promise<void>} Resolves once it answers 200
|
|
86
|
-
* @throws When it exits first or the timeout passes, naming its log
|
|
87
|
-
*/
|
|
88
|
-
export function waitForBackend(backend: import("./run-state.mjs").ServerRecord): Promise<void>;
|
|
89
81
|
/**
|
|
90
82
|
* Starts the run's backend on `state.database`, from the run's build or
|
|
91
83
|
* `build`, and points the API at it once it answers.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The status of one GET, or `null` when nothing answered.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} url The URL
|
|
5
|
+
* @returns {Promise<number | null>} The HTTP status
|
|
6
|
+
*/
|
|
7
|
+
export function probe(url: string): Promise<number | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Polls `url` until it answers 200, the process exits or the timeout passes.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} url The readiness URL
|
|
12
|
+
* @param {{ pid: number, log: string }} record The process that must serve it
|
|
13
|
+
* @param {number} timeoutMs How long to wait
|
|
14
|
+
* @returns {Promise<void>} Resolves once ready
|
|
15
|
+
* @throws When the process exits first or the timeout passes, naming its log
|
|
16
|
+
*/
|
|
17
|
+
export function waitForOk(url: string, record: {
|
|
18
|
+
pid: number;
|
|
19
|
+
log: string;
|
|
20
|
+
}, timeoutMs: number): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Polls a loopback port until it accepts a connection, the process exits or
|
|
23
|
+
* the timeout passes.
|
|
24
|
+
*
|
|
25
|
+
* @param {number} port The port
|
|
26
|
+
* @param {{ name: string, pid: number, log: string }} record The process that must listen
|
|
27
|
+
* @param {number} timeoutMs How long to wait
|
|
28
|
+
* @returns {Promise<void>} Resolves once it listens
|
|
29
|
+
* @throws When the process exits first or the timeout passes, naming its log
|
|
30
|
+
*/
|
|
31
|
+
export function waitForPort(port: number, record: {
|
|
32
|
+
name: string;
|
|
33
|
+
pid: number;
|
|
34
|
+
log: string;
|
|
35
|
+
}, timeoutMs: number): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Polls until the process or one it started listens on the port, so a port
|
|
38
|
+
* another program took after it was picked is not mistaken for ours.
|
|
39
|
+
*
|
|
40
|
+
* @param {number} port The port
|
|
41
|
+
* @param {{ name: string, pid: number, log: string }} record The process that must listen
|
|
42
|
+
* @param {number} timeoutMs How long to wait
|
|
43
|
+
* @returns {Promise<void>} Resolves once the process listens
|
|
44
|
+
* @throws When it exits first (the port was taken) or the timeout passes
|
|
45
|
+
*/
|
|
46
|
+
export function waitForOwnPort(port: number, record: {
|
|
47
|
+
name: string;
|
|
48
|
+
pid: number;
|
|
49
|
+
log: string;
|
|
50
|
+
}, timeoutMs: number): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Waits until a backend listens on its own port and answers
|
|
53
|
+
* `/api/onboarding/informations` there.
|
|
54
|
+
*
|
|
55
|
+
* @param {import("./run-state.mjs").ServerRecord} backend The backend
|
|
56
|
+
* @returns {Promise<void>} Resolves once it answers 200
|
|
57
|
+
* @throws When it exits first, another process holds its port or the timeout passes, naming its log
|
|
58
|
+
*/
|
|
59
|
+
export function waitForBackend(backend: import("./run-state.mjs").ServerRecord): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Waits until the run's dashboard listens on the run's web port and answers
|
|
62
|
+
* `/dms-preview` there.
|
|
63
|
+
*
|
|
64
|
+
* @param {Pick<import("./run-state.mjs").RunState, "webPort" | "webUrl">} state The run
|
|
65
|
+
* @param {import("./run-state.mjs").ProcessRecord} frontend The dashboard's process
|
|
66
|
+
* @returns {Promise<void>} Resolves once it answers 200
|
|
67
|
+
* @throws When it exits first, another process holds its port or the timeout passes, naming its log
|
|
68
|
+
*/
|
|
69
|
+
export function waitForDashboard(state: Pick<import("./run-state.mjs").RunState, "webPort" | "webUrl">, frontend: import("./run-state.mjs").ProcessRecord): Promise<void>;
|
package/e2e/backend.mjs
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
record,
|
|
12
12
|
runBackendMode,
|
|
13
13
|
startBackend,
|
|
14
|
-
waitForBackend,
|
|
15
14
|
} from "./stack.mjs";
|
|
15
|
+
import { waitForBackend } from "./waits.mjs";
|
|
16
16
|
import { recordTiming, stopwatch, timed } from "./timing.mjs";
|
|
17
17
|
|
|
18
18
|
/** @typedef {import("./run-state.mjs").RunState} RunState */
|
package/e2e/dashboard.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { join } from "node:path";
|
|
|
5
5
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
6
6
|
import { arrayOf, decode, isBoolean, isRecord, objectOf } from "./json.mjs";
|
|
7
7
|
import { frontendPackage } from "./launch.mjs";
|
|
8
|
-
import { probe, waitForOk } from "./
|
|
8
|
+
import { probe, waitForOk } from "./waits.mjs";
|
|
9
9
|
|
|
10
10
|
const MODULE_SET = "./dist/module-set.js";
|
|
11
11
|
const MANIFEST_PATH = "/dms/frontend?renderer=vue&rendererVersion=3";
|
package/e2e/index.mjs
CHANGED
|
@@ -22,7 +22,9 @@ const WORKERS = 2;
|
|
|
22
22
|
/**
|
|
23
23
|
* The Playwright config of a suite: two workers, each against a run of its
|
|
24
24
|
* own that the global setup starts (one worker when `DMS_E2E_RUN` names
|
|
25
|
-
* the run to drive),
|
|
25
|
+
* the run to drive), one retry in a GitHub merge-queue run (`merge_group`),
|
|
26
|
+
* which reports a pass on retry as flaky, and none elsewhere, a test timeout
|
|
27
|
+
* above the kit's own waits,
|
|
26
28
|
* and the CI reporters. It is plain
|
|
27
29
|
* Playwright config, so `defineConfig(e2eConfig(), overrides)` adjusts it.
|
|
28
30
|
* The suite's journeys come from `e2e/journeys.config.ts` and
|
|
@@ -45,7 +47,7 @@ export function e2eConfig(options = {}) {
|
|
|
45
47
|
outputDir: `test-results${suffix}`,
|
|
46
48
|
fullyParallel: true,
|
|
47
49
|
workers: process.env.DMS_E2E_RUN ? 1 : WORKERS,
|
|
48
|
-
retries: 0,
|
|
50
|
+
retries: process.env.GITHUB_EVENT_NAME === "merge_group" ? 1 : 0,
|
|
49
51
|
forbidOnly: CI,
|
|
50
52
|
timeout: 15 * MINUTE,
|
|
51
53
|
globalSetup: fileURLToPath(new URL("global-setup.mjs", import.meta.url)),
|
package/e2e/mongo.mjs
CHANGED
|
@@ -14,12 +14,8 @@ import {
|
|
|
14
14
|
objectOf,
|
|
15
15
|
recordOf,
|
|
16
16
|
} from "./json.mjs";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
startDetached,
|
|
20
|
-
stopRecorded,
|
|
21
|
-
waitForOwnPort,
|
|
22
|
-
} from "./processes.mjs";
|
|
17
|
+
import { restartablePort, startDetached, stopRecorded } from "./processes.mjs";
|
|
18
|
+
import { waitForOwnPort } from "./waits.mjs";
|
|
23
19
|
|
|
24
20
|
/** A file name Node runs as a script. */
|
|
25
21
|
const JAVASCRIPT_FILE = /\.[cm]?js$/u;
|
package/e2e/processes.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
readFileSync,
|
|
9
9
|
readlinkSync,
|
|
10
10
|
} from "node:fs";
|
|
11
|
-
import {
|
|
11
|
+
import { createServer } from "node:net";
|
|
12
12
|
import { platform } from "node:os";
|
|
13
13
|
import { join } from "node:path";
|
|
14
14
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
assertOwnProc,
|
|
17
17
|
assertSignalable,
|
|
18
18
|
hasProc,
|
|
19
|
-
isAlive,
|
|
20
19
|
isSameProcess,
|
|
21
20
|
isSignalable,
|
|
22
21
|
startedAs,
|
|
@@ -24,11 +23,9 @@ import {
|
|
|
24
23
|
statOf,
|
|
25
24
|
} from "./identity.mjs";
|
|
26
25
|
|
|
27
|
-
const POLL_MS = 500;
|
|
28
26
|
const READY_POLL_MS = 100;
|
|
29
27
|
const KILL_POLL_MS = 10;
|
|
30
28
|
const STOP_GRACE_MS = 10_000;
|
|
31
|
-
const PROBE_TIMEOUT_MS = 3_000;
|
|
32
29
|
const LISTEN_STATE = "0A";
|
|
33
30
|
const HEX = 16;
|
|
34
31
|
const EPHEMERAL_RANGE_FILE = "/proc/sys/net/ipv4/ip_local_port_range";
|
|
@@ -243,103 +240,6 @@ export function runToEnd(spec) {
|
|
|
243
240
|
});
|
|
244
241
|
}
|
|
245
242
|
|
|
246
|
-
/**
|
|
247
|
-
* The status of one GET, or `null` when nothing answered.
|
|
248
|
-
*
|
|
249
|
-
* @param {string} url The URL
|
|
250
|
-
* @returns {Promise<number | null>} The HTTP status
|
|
251
|
-
*/
|
|
252
|
-
export async function probe(url) {
|
|
253
|
-
try {
|
|
254
|
-
const response = await fetch(url, {
|
|
255
|
-
signal: AbortSignal.timeout(PROBE_TIMEOUT_MS),
|
|
256
|
-
});
|
|
257
|
-
await response.body?.cancel();
|
|
258
|
-
return response.status;
|
|
259
|
-
} catch {
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Polls `url` until it answers 200, the process exits or the timeout passes.
|
|
266
|
-
*
|
|
267
|
-
* @param {string} url The readiness URL
|
|
268
|
-
* @param {{ pid: number, log: string }} record The process that must serve it
|
|
269
|
-
* @param {number} timeoutMs How long to wait
|
|
270
|
-
* @returns {Promise<void>} Resolves once ready
|
|
271
|
-
* @throws When the process exits first or the timeout passes, naming its log
|
|
272
|
-
*/
|
|
273
|
-
export async function waitForOk(url, record, timeoutMs) {
|
|
274
|
-
const deadline = Date.now() + timeoutMs;
|
|
275
|
-
while (Date.now() < deadline) {
|
|
276
|
-
if (!isAlive(record.pid)) {
|
|
277
|
-
throw new Error(`${url}: the process exited first; see ${record.log}`);
|
|
278
|
-
}
|
|
279
|
-
if ((await probe(url)) === 200) return;
|
|
280
|
-
await sleep(READY_POLL_MS);
|
|
281
|
-
}
|
|
282
|
-
throw new Error(
|
|
283
|
-
`${url} did not answer 200 in ${timeoutMs} ms; see ${record.log}`,
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/** @param {number} port */
|
|
288
|
-
function accepts(port) {
|
|
289
|
-
return new Promise((resolve) => {
|
|
290
|
-
const socket = createConnection({ host: "127.0.0.1", port });
|
|
291
|
-
socket.once("connect", () => {
|
|
292
|
-
socket.end();
|
|
293
|
-
resolve(true);
|
|
294
|
-
});
|
|
295
|
-
socket.once("error", () => resolve(false));
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Polls a loopback port until it accepts a connection, the process exits or
|
|
301
|
-
* the timeout passes.
|
|
302
|
-
*
|
|
303
|
-
* @param {number} port The port
|
|
304
|
-
* @param {{ name: string, pid: number, log: string }} record The process that must listen
|
|
305
|
-
* @param {number} timeoutMs How long to wait
|
|
306
|
-
* @returns {Promise<void>} Resolves once it listens
|
|
307
|
-
* @throws When the process exits first or the timeout passes, naming its log
|
|
308
|
-
*/
|
|
309
|
-
export async function waitForPort(port, record, timeoutMs) {
|
|
310
|
-
const deadline = Date.now() + timeoutMs;
|
|
311
|
-
while (Date.now() < deadline) {
|
|
312
|
-
if (await accepts(port)) return;
|
|
313
|
-
if (!isAlive(record.pid)) break;
|
|
314
|
-
await sleep(POLL_MS);
|
|
315
|
-
}
|
|
316
|
-
throw new Error(
|
|
317
|
-
`${record.name} did not listen on ${port}; see ${record.log}`,
|
|
318
|
-
);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Polls until the process itself listens on the port, so a port another
|
|
323
|
-
* program took after it was picked is not mistaken for ours.
|
|
324
|
-
*
|
|
325
|
-
* @param {number} port The port
|
|
326
|
-
* @param {{ name: string, pid: number, log: string }} record The process that must listen
|
|
327
|
-
* @param {number} timeoutMs How long to wait
|
|
328
|
-
* @returns {Promise<void>} Resolves once the process listens
|
|
329
|
-
* @throws When it exits first (the port was taken) or the timeout passes
|
|
330
|
-
*/
|
|
331
|
-
export async function waitForOwnPort(port, record, timeoutMs) {
|
|
332
|
-
if (listenersOf(port) === null) return waitForPort(port, record, timeoutMs);
|
|
333
|
-
const deadline = Date.now() + timeoutMs;
|
|
334
|
-
while (Date.now() < deadline && isAlive(record.pid)) {
|
|
335
|
-
if (listenersOf(port).includes(record.pid)) return;
|
|
336
|
-
await sleep(POLL_MS);
|
|
337
|
-
}
|
|
338
|
-
throw new Error(
|
|
339
|
-
`${record.name} does not listen on ${port}; see ${record.log}`,
|
|
340
|
-
);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
243
|
function procEntries() {
|
|
344
244
|
try {
|
|
345
245
|
return readdirSync("/proc").filter((entry) => /^\d+$/.test(entry));
|
package/e2e/run-copy.mjs
CHANGED
|
@@ -34,7 +34,7 @@ function shadowLevel(real, shadow, ...keep) {
|
|
|
34
34
|
/**
|
|
35
35
|
* A `node_modules` that is `modules` with `@antelopejs/dms-frontend` replaced
|
|
36
36
|
* by the renderer checkout and no `.cache`, every other entry linked to the
|
|
37
|
-
* original.
|
|
37
|
+
* original. Without `modules`, it holds only the renderer.
|
|
38
38
|
*
|
|
39
39
|
* @param {string} modules The playground's installed modules
|
|
40
40
|
* @param {string} shadow The run's `node_modules`
|
|
@@ -42,11 +42,11 @@ function shadowLevel(real, shadow, ...keep) {
|
|
|
42
42
|
*/
|
|
43
43
|
export function linkRenderer(modules, shadow, renderer) {
|
|
44
44
|
const scope = "@antelopejs";
|
|
45
|
-
shadowLevel(modules, shadow, scope, MODULES_CACHE);
|
|
45
|
+
if (existsSync(modules)) shadowLevel(modules, shadow, scope, MODULES_CACHE);
|
|
46
46
|
const scoped = join(modules, scope);
|
|
47
47
|
const shadowScope = join(shadow, scope);
|
|
48
48
|
if (existsSync(scoped)) shadowLevel(scoped, shadowScope, "dms-frontend");
|
|
49
|
-
else mkdirSync(shadowScope);
|
|
49
|
+
else mkdirSync(shadowScope, { recursive: true });
|
|
50
50
|
symlinkSync(renderer, join(shadowScope, "dms-frontend"));
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -59,6 +59,8 @@ export function linkRenderer(modules, shadow, renderer) {
|
|
|
59
59
|
* the playground's but `.cache`, where a backend writes its MCP credential
|
|
60
60
|
* and its packed modules, so that folder belongs to the run too; and
|
|
61
61
|
* `@antelopejs/dms-frontend` is the `renderer` checkout when there is one.
|
|
62
|
+
* A playground with no `node_modules` of its own gets none, unless it has a
|
|
63
|
+
* `renderer`, and resolves its modules from the linked levels above it.
|
|
62
64
|
*
|
|
63
65
|
* @param {string} playground The playground folder
|
|
64
66
|
* @param {string} checkout The checkout root, or the module folder outside one
|
|
@@ -81,6 +83,8 @@ export function layOutCopy(playground, checkout, root, renderer) {
|
|
|
81
83
|
});
|
|
82
84
|
const modules = join(playground, "node_modules");
|
|
83
85
|
if (renderer) linkRenderer(modules, join(shadow, "node_modules"), renderer);
|
|
84
|
-
else
|
|
86
|
+
else if (existsSync(modules)) {
|
|
87
|
+
shadowLevel(modules, join(shadow, "node_modules"), MODULES_CACHE);
|
|
88
|
+
}
|
|
85
89
|
return shadow;
|
|
86
90
|
}
|
package/e2e/stack.mjs
CHANGED
|
@@ -21,9 +21,8 @@ import {
|
|
|
21
21
|
runToEnd,
|
|
22
22
|
startDetached,
|
|
23
23
|
stopRecorded,
|
|
24
|
-
waitForOk,
|
|
25
|
-
waitForOwnPort,
|
|
26
24
|
} from "./processes.mjs";
|
|
25
|
+
import { waitForBackend, waitForDashboard, waitForOwnPort } from "./waits.mjs";
|
|
27
26
|
import {
|
|
28
27
|
backendsFolder,
|
|
29
28
|
createRunFolders,
|
|
@@ -333,21 +332,6 @@ export function liveBackends(state) {
|
|
|
333
332
|
});
|
|
334
333
|
}
|
|
335
334
|
|
|
336
|
-
/**
|
|
337
|
-
* Waits until a backend answers `/api/onboarding/informations` on its own port.
|
|
338
|
-
*
|
|
339
|
-
* @param {import("./run-state.mjs").ServerRecord} backend The backend
|
|
340
|
-
* @returns {Promise<void>} Resolves once it answers 200
|
|
341
|
-
* @throws When it exits first or the timeout passes, naming its log
|
|
342
|
-
*/
|
|
343
|
-
export function waitForBackend(backend) {
|
|
344
|
-
return waitForOk(
|
|
345
|
-
`http://127.0.0.1:${backend.port}/api/onboarding/informations`,
|
|
346
|
-
backend,
|
|
347
|
-
READY_TIMEOUT_MS,
|
|
348
|
-
);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
335
|
/**
|
|
352
336
|
* Starts the run's backend on `state.database`, from the run's build or
|
|
353
337
|
* `build`, and points the API at it once it answers.
|
|
@@ -496,7 +480,7 @@ async function buildAndStart(state, useCache) {
|
|
|
496
480
|
await timed(state, "frontend-start", async () => {
|
|
497
481
|
const frontend = startDetached(frontendSpec(state));
|
|
498
482
|
record(state, { ...frontend, port: state.webPort });
|
|
499
|
-
await
|
|
483
|
+
await waitForDashboard(state, frontend);
|
|
500
484
|
assertFrontendBound(frontend);
|
|
501
485
|
});
|
|
502
486
|
await recordDashboardModules(state);
|
package/e2e/waits.mjs
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { createConnection } from "node:net";
|
|
2
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
3
|
+
import { isAlive } from "./identity.mjs";
|
|
4
|
+
import { descendantsOf, listenersOf } from "./processes.mjs";
|
|
5
|
+
|
|
6
|
+
const POLL_MS = 500;
|
|
7
|
+
const READY_POLL_MS = 100;
|
|
8
|
+
const PROBE_TIMEOUT_MS = 3_000;
|
|
9
|
+
const READY_TIMEOUT_MS = 180_000;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The status of one GET, or `null` when nothing answered.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} url The URL
|
|
15
|
+
* @returns {Promise<number | null>} The HTTP status
|
|
16
|
+
*/
|
|
17
|
+
export async function probe(url) {
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetch(url, {
|
|
20
|
+
signal: AbortSignal.timeout(PROBE_TIMEOUT_MS),
|
|
21
|
+
});
|
|
22
|
+
await response.body?.cancel();
|
|
23
|
+
return response.status;
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Polls `url` until it answers 200, the process exits or the timeout passes.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} url The readiness URL
|
|
33
|
+
* @param {{ pid: number, log: string }} record The process that must serve it
|
|
34
|
+
* @param {number} timeoutMs How long to wait
|
|
35
|
+
* @returns {Promise<void>} Resolves once ready
|
|
36
|
+
* @throws When the process exits first or the timeout passes, naming its log
|
|
37
|
+
*/
|
|
38
|
+
export async function waitForOk(url, record, timeoutMs) {
|
|
39
|
+
const deadline = Date.now() + timeoutMs;
|
|
40
|
+
while (Date.now() < deadline) {
|
|
41
|
+
if (!isAlive(record.pid)) {
|
|
42
|
+
throw new Error(`${url}: the process exited first; see ${record.log}`);
|
|
43
|
+
}
|
|
44
|
+
if ((await probe(url)) === 200) return;
|
|
45
|
+
await sleep(READY_POLL_MS);
|
|
46
|
+
}
|
|
47
|
+
throw new Error(
|
|
48
|
+
`${url} did not answer 200 in ${timeoutMs} ms; see ${record.log}`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @param {number} port */
|
|
53
|
+
function accepts(port) {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
const socket = createConnection({ host: "127.0.0.1", port });
|
|
56
|
+
socket.once("connect", () => {
|
|
57
|
+
socket.end();
|
|
58
|
+
resolve(true);
|
|
59
|
+
});
|
|
60
|
+
socket.once("error", () => resolve(false));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Polls a loopback port until it accepts a connection, the process exits or
|
|
66
|
+
* the timeout passes.
|
|
67
|
+
*
|
|
68
|
+
* @param {number} port The port
|
|
69
|
+
* @param {{ name: string, pid: number, log: string }} record The process that must listen
|
|
70
|
+
* @param {number} timeoutMs How long to wait
|
|
71
|
+
* @returns {Promise<void>} Resolves once it listens
|
|
72
|
+
* @throws When the process exits first or the timeout passes, naming its log
|
|
73
|
+
*/
|
|
74
|
+
export async function waitForPort(port, record, timeoutMs) {
|
|
75
|
+
const deadline = Date.now() + timeoutMs;
|
|
76
|
+
while (Date.now() < deadline) {
|
|
77
|
+
if (await accepts(port)) return;
|
|
78
|
+
if (!isAlive(record.pid)) break;
|
|
79
|
+
await sleep(POLL_MS);
|
|
80
|
+
}
|
|
81
|
+
throw new Error(
|
|
82
|
+
`${record.name} did not listen on ${port}; see ${record.log}`,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Polls until the process or one it started listens on the port, so a port
|
|
88
|
+
* another program took after it was picked is not mistaken for ours.
|
|
89
|
+
*
|
|
90
|
+
* @param {number} port The port
|
|
91
|
+
* @param {{ name: string, pid: number, log: string }} record The process that must listen
|
|
92
|
+
* @param {number} timeoutMs How long to wait
|
|
93
|
+
* @returns {Promise<void>} Resolves once the process listens
|
|
94
|
+
* @throws When it exits first (the port was taken) or the timeout passes
|
|
95
|
+
*/
|
|
96
|
+
export async function waitForOwnPort(port, record, timeoutMs) {
|
|
97
|
+
if (listenersOf(port) === null) return waitForPort(port, record, timeoutMs);
|
|
98
|
+
const deadline = Date.now() + timeoutMs;
|
|
99
|
+
while (Date.now() < deadline && isAlive(record.pid)) {
|
|
100
|
+
const own = new Set([record.pid, ...descendantsOf([record.pid])]);
|
|
101
|
+
if (listenersOf(port)?.some((pid) => own.has(pid))) return;
|
|
102
|
+
await sleep(READY_POLL_MS);
|
|
103
|
+
}
|
|
104
|
+
throw new Error(
|
|
105
|
+
`${record.name} does not listen on ${port}; see ${record.log}`,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Waits until a backend listens on its own port and answers
|
|
111
|
+
* `/api/onboarding/informations` there.
|
|
112
|
+
*
|
|
113
|
+
* @param {import("./run-state.mjs").ServerRecord} backend The backend
|
|
114
|
+
* @returns {Promise<void>} Resolves once it answers 200
|
|
115
|
+
* @throws When it exits first, another process holds its port or the timeout passes, naming its log
|
|
116
|
+
*/
|
|
117
|
+
export async function waitForBackend(backend) {
|
|
118
|
+
await waitForOwnPort(backend.port, backend, READY_TIMEOUT_MS);
|
|
119
|
+
await waitForOk(
|
|
120
|
+
`http://127.0.0.1:${backend.port}/api/onboarding/informations`,
|
|
121
|
+
backend,
|
|
122
|
+
READY_TIMEOUT_MS,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Waits until the run's dashboard listens on the run's web port and answers
|
|
128
|
+
* `/dms-preview` there.
|
|
129
|
+
*
|
|
130
|
+
* @param {Pick<import("./run-state.mjs").RunState, "webPort" | "webUrl">} state The run
|
|
131
|
+
* @param {import("./run-state.mjs").ProcessRecord} frontend The dashboard's process
|
|
132
|
+
* @returns {Promise<void>} Resolves once it answers 200
|
|
133
|
+
* @throws When it exits first, another process holds its port or the timeout passes, naming its log
|
|
134
|
+
*/
|
|
135
|
+
export async function waitForDashboard(state, frontend) {
|
|
136
|
+
await waitForOwnPort(state.webPort, frontend, READY_TIMEOUT_MS);
|
|
137
|
+
await waitForOk(`${state.webUrl}/dms-preview`, frontend, READY_TIMEOUT_MS);
|
|
138
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"description": "AntelopeJS DMS. Plug in your PostgreSQL, MySQL, MariaDB, MongoDB or RethinkDB database and your coding agent builds a back office and analytics dashboard as typed TypeScript. Real-time updates on the data the DMS manages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -88,8 +88,6 @@
|
|
|
88
88
|
"@antelopejs/interface-data-api": ">=0.8.2 <0.9.0",
|
|
89
89
|
"@antelopejs/interface-database": ">=0.4.3 <0.5.0",
|
|
90
90
|
"@antelopejs/interface-database-decorators": ">=0.5.4 <0.6.0",
|
|
91
|
-
"@antelopejs/interface-dms": "^0.17.2",
|
|
92
|
-
"@antelopejs/interface-dms-builder": "0.6.4-next.1079.g1281247",
|
|
93
91
|
"@antelopejs/interface-email": ">=0.2.1 <0.3.0",
|
|
94
92
|
"@antelopejs/interface-file-storage": ">=0.1.4 <0.2.0",
|
|
95
93
|
"@csstools/css-tokenizer": "^4.0.3",
|
|
@@ -111,7 +109,9 @@
|
|
|
111
109
|
"striptags": "^3.2.0",
|
|
112
110
|
"ts-morph": "^28.0.0",
|
|
113
111
|
"ua-parser-js": "^2.0.9",
|
|
114
|
-
"zod": "^4.5.0"
|
|
112
|
+
"zod": "^4.5.0",
|
|
113
|
+
"@antelopejs/interface-dms": "^0.17.3",
|
|
114
|
+
"@antelopejs/interface-dms-builder": "^0.6.4"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@antelopejs/api": "~1.7.9",
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
"optional": true
|
|
212
212
|
}
|
|
213
213
|
},
|
|
214
|
-
"gitHead": "
|
|
214
|
+
"gitHead": "995c8f94cd4a82bbe533267ff8c0df690ffcfef0",
|
|
215
215
|
"scripts": {
|
|
216
216
|
"build": "pnpm --filter @antelopejs/interface-dms --filter @antelopejs/interface-dms-builder build && rimraf dist && antelopejs-tsc && tsc-alias && tsc -p e2e/tsconfig.types.json",
|
|
217
217
|
"dev": "ajs project run --inspect -w -p playground",
|