@fuzdev/fuz_app 0.174.0 → 0.176.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 +3 -2
- package/dist/actions/CLAUDE.md +10 -8
- package/dist/actions/action_codegen.js +3 -3
- package/dist/actions/ws_outbound_writer.d.ts +8 -8
- package/dist/actions/ws_outbound_writer.d.ts.map +1 -1
- package/dist/actions/ws_outbound_writer.js +8 -11
- package/dist/auth/keyring.d.ts +1 -1
- package/dist/auth/keyring.js +1 -1
- package/dist/db/CLAUDE.md +9 -0
- package/dist/db/fact_disk_storage.d.ts +3 -2
- package/dist/db/fact_disk_storage.d.ts.map +1 -1
- package/dist/db/fact_disk_storage.js +2 -1
- package/dist/db/postgres_url.d.ts +95 -0
- package/dist/db/postgres_url.d.ts.map +1 -0
- package/dist/db/postgres_url.js +167 -0
- package/dist/dev/setup.d.ts +101 -33
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +174 -71
- package/dist/env/dotenv.d.ts +1 -1
- package/dist/env/dotenv.d.ts.map +1 -1
- package/dist/env/dotenv.js +2 -3
- package/dist/http/CLAUDE.md +1 -1
- package/dist/http/body_limit.d.ts +10 -16
- package/dist/http/body_limit.d.ts.map +1 -1
- package/dist/http/body_limit.js +10 -16
- package/dist/runtime/deps.d.ts +81 -45
- package/dist/runtime/deps.d.ts.map +1 -1
- package/dist/runtime/deps.js +7 -2
- package/dist/runtime/mock.d.ts +63 -16
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +75 -35
- package/dist/runtime/node.d.ts +3 -2
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +20 -72
- package/dist/runtime/process_id.d.ts +24 -0
- package/dist/runtime/process_id.d.ts.map +1 -0
- package/dist/runtime/process_id.js +27 -0
- package/dist/runtime/secure_file.d.ts +8 -30
- package/dist/runtime/secure_file.d.ts.map +1 -1
- package/dist/runtime/secure_file.js +23 -51
- package/dist/server/app_server.d.ts +2 -2
- package/dist/server/static.d.ts +1 -1
- package/dist/testing/CLAUDE.md +28 -27
- package/dist/testing/cross_backend/backend_config.d.ts +7 -7
- package/dist/testing/cross_backend/backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/bench/bench_report.d.ts +2 -2
- package/dist/testing/cross_backend/bench/bench_report.js +2 -2
- package/dist/testing/cross_backend/body_size_smuggling.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size_smuggling.js +1 -4
- package/dist/testing/cross_backend/bootstrap_backend.d.ts +1 -1
- package/dist/testing/cross_backend/capabilities.d.ts +2 -2
- package/dist/testing/cross_backend/create_cross_backend_global_setup.d.ts +2 -2
- package/dist/testing/cross_backend/create_cross_backend_global_setup.js +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +2 -2
- package/dist/testing/cross_backend/default_backend_configs.d.ts +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +4 -4
- package/dist/testing/cross_backend/differential.d.ts +2 -2
- package/dist/testing/cross_backend/differential.js +6 -6
- package/dist/testing/cross_backend/fact_serving.js +1 -1
- package/dist/testing/cross_backend/make_cross_backend_project.d.ts +2 -2
- package/dist/testing/cross_backend/make_cross_backend_project.js +1 -1
- package/dist/testing/cross_backend/origin_conformance.json +1 -1
- package/dist/testing/cross_backend/postgres_database.d.ts +7 -21
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +24 -35
- package/dist/testing/cross_backend/testing_reset_actions.js +1 -1
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +10 -12
- package/dist/testing/cross_backend/testing_server_core.d.ts +13 -17
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +7 -17
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +0 -51
- package/dist/testing/cross_backend/ws_outbound_overflow.js +2 -2
- package/dist/testing/daemon_info.d.ts +11 -6
- package/dist/testing/daemon_info.d.ts.map +1 -1
- package/dist/testing/daemon_info.js +11 -8
- package/dist/testing/middleware_gate_probes.js +2 -2
- package/package.json +11 -16
- package/dist/runtime/deno.d.ts +0 -21
- package/dist/runtime/deno.d.ts.map +0 -1
- package/dist/runtime/deno.js +0 -191
- package/dist/testing/cross_backend/testing_server_deno.d.ts +0 -5
- package/dist/testing/cross_backend/testing_server_deno.d.ts.map +0 -1
- package/dist/testing/cross_backend/testing_server_deno.js +0 -38
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
/**
|
|
3
3
|
* Cross-process `BackendConfig` presets for fuz_app's domain-free **TS**
|
|
4
|
-
* spine test binary (`src/test/cross_backend/testing_spine_server_{node,
|
|
4
|
+
* spine test binary (`src/test/cross_backend/testing_spine_server_{node,bun}.ts`).
|
|
5
5
|
*
|
|
6
6
|
* The TS analog of `rust_spine_stub_backend_config` (which spawns the Rust spine):
|
|
7
7
|
* these spawn fuz_app's own TS impl over real HTTP with no domain layer, so
|
|
8
|
-
* the `cross_backend_ts_node` / `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* the `cross_backend_ts_node` / `cross_backend_ts_bun` self-test projects
|
|
9
|
+
* verify fuz_app's wire path in its own repo on both JS runtimes. All run
|
|
10
|
+
* against in-memory pglet (`memory://`) — no external Postgres, unlike the
|
|
11
|
+
* Rust path.
|
|
12
12
|
*
|
|
13
13
|
* The binary writes its daemon token to `{FUZ_TESTING_TS_SPINE_DIR}/run/daemon_token`;
|
|
14
14
|
* anchoring the dir to `paths.root` makes that equal `paths.daemon_token_path`,
|
|
@@ -19,18 +19,14 @@ import '../assert_dev_env.js';
|
|
|
19
19
|
import type { BackendConfig } from './backend_config.js';
|
|
20
20
|
/** Default port for the Node TS spine binary — slots beside the Rust `spine_stub` (1177). */
|
|
21
21
|
export declare const TS_SPINE_NODE_DEFAULT_PORT = 1178;
|
|
22
|
-
/** Default port for the Deno TS spine binary. */
|
|
23
|
-
export declare const TS_SPINE_DENO_DEFAULT_PORT = 1179;
|
|
24
22
|
/** Default port for the Bun TS spine binary. */
|
|
25
23
|
export declare const TS_SPINE_BUN_DEFAULT_PORT = 1180;
|
|
26
24
|
/** Entry module spawned for the Node TS spine binary. */
|
|
27
25
|
export declare const TS_SPINE_NODE_ENTRY = "src/test/cross_backend/testing_spine_server_node.ts";
|
|
28
|
-
/** Entry module spawned for the Deno TS spine binary. */
|
|
29
|
-
export declare const TS_SPINE_DENO_ENTRY = "src/test/cross_backend/testing_spine_server_deno.ts";
|
|
30
26
|
/** Entry module spawned for the Bun TS spine binary. */
|
|
31
27
|
export declare const TS_SPINE_BUN_ENTRY = "src/test/cross_backend/testing_spine_server_bun.ts";
|
|
32
28
|
export interface TsSpineBackendConfigOptions {
|
|
33
|
-
/** Listening port. Defaults per runtime (`1178` Node, `
|
|
29
|
+
/** Listening port. Defaults per runtime (`1178` Node, `1180` Bun). */
|
|
34
30
|
readonly port?: number;
|
|
35
31
|
/** Database URL. Default `'memory://'` (in-memory pglet). */
|
|
36
32
|
readonly database_url?: string;
|
|
@@ -38,7 +34,7 @@ export interface TsSpineBackendConfigOptions {
|
|
|
38
34
|
* Backend name — labels the spawn in errors and logs, and names its
|
|
39
35
|
* directory under `os.tmpdir()` (`default_test_backend_paths`, namespaced
|
|
40
36
|
* by the running repo). Defaults per runtime (`ts_spine_node`,
|
|
41
|
-
* `
|
|
37
|
+
* `ts_spine_bun`). Give each
|
|
42
38
|
* backend spawned alongside another of its runtime its own name, so their
|
|
43
39
|
* bootstrap and daemon-token files don't collide.
|
|
44
40
|
*/
|
|
@@ -106,10 +102,4 @@ export declare const ts_spine_node_backend_config: (options?: TsSpineBackendConf
|
|
|
106
102
|
* peer dep.
|
|
107
103
|
*/
|
|
108
104
|
export declare const ts_spine_bun_backend_config: (options?: TsSpineBackendConfigOptions) => BackendConfig;
|
|
109
|
-
/**
|
|
110
|
-
* `BackendConfig` for the Deno TS spine binary. The `--allow-*` set mirrors
|
|
111
|
-
* the cross-process needs (net + read/write for the daemon-token file + env
|
|
112
|
-
* + sys); `--unstable-detect-cjs` matches the ecosystem's Deno test entries.
|
|
113
|
-
*/
|
|
114
|
-
export declare const ts_spine_deno_backend_config: (options?: TsSpineBackendConfigOptions) => BackendConfig;
|
|
115
105
|
//# sourceMappingURL=ts_spine_backend_config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts_spine_backend_config.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/ts_spine_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ts_spine_backend_config.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/ts_spine_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAuEzD,6FAA6F;AAC7F,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,gDAAgD;AAChD,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,wDAAwD,CAAC;AAEzF,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,uDAAuD,CAAC;AAEvF,MAAM,WAAW,2BAA2B;IAC3C,sEAAsE;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;OASG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACjD;;;;;OAKG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAC/C;AAWD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACxC,UAAS,2BAAgC,KACvC,aAyBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GACvC,UAAS,2BAAgC,KACvC,aAyBF,CAAC"}
|
|
@@ -37,15 +37,6 @@ const ts_spine_capabilities = Object.freeze({
|
|
|
37
37
|
ws_role_gated: true,
|
|
38
38
|
testing_backdoors: TESTING_BACKDOOR_METHODS
|
|
39
39
|
});
|
|
40
|
-
/**
|
|
41
|
-
* Capabilities for the **Deno** spine binary — `ts_spine_capabilities` with
|
|
42
|
-
* `ws_refusal_body: true` (`Deno.upgradeWebSocket` leaves a refused upgrade's
|
|
43
|
-
* response to Hono, body included).
|
|
44
|
-
*/
|
|
45
|
-
const ts_spine_deno_capabilities = Object.freeze({
|
|
46
|
-
...ts_spine_capabilities,
|
|
47
|
-
ws_refusal_body: true
|
|
48
|
-
});
|
|
49
40
|
/**
|
|
50
41
|
* Capabilities for the **Bun** spine binary — `ts_spine_capabilities` with
|
|
51
42
|
* `ws_handshake_pipelining: false` and `ws_refusal_body: true` (`Bun.serve`
|
|
@@ -66,14 +57,10 @@ const ts_spine_bun_capabilities = Object.freeze({
|
|
|
66
57
|
});
|
|
67
58
|
/** Default port for the Node TS spine binary — slots beside the Rust `spine_stub` (1177). */
|
|
68
59
|
export const TS_SPINE_NODE_DEFAULT_PORT = 1178;
|
|
69
|
-
/** Default port for the Deno TS spine binary. */
|
|
70
|
-
export const TS_SPINE_DENO_DEFAULT_PORT = 1179;
|
|
71
60
|
/** Default port for the Bun TS spine binary. */
|
|
72
61
|
export const TS_SPINE_BUN_DEFAULT_PORT = 1180;
|
|
73
62
|
/** Entry module spawned for the Node TS spine binary. */
|
|
74
63
|
export const TS_SPINE_NODE_ENTRY = 'src/test/cross_backend/testing_spine_server_node.ts';
|
|
75
|
-
/** Entry module spawned for the Deno TS spine binary. */
|
|
76
|
-
export const TS_SPINE_DENO_ENTRY = 'src/test/cross_backend/testing_spine_server_deno.ts';
|
|
77
64
|
/** Entry module spawned for the Bun TS spine binary. */
|
|
78
65
|
export const TS_SPINE_BUN_ENTRY = 'src/test/cross_backend/testing_spine_server_bun.ts';
|
|
79
66
|
/**
|
|
@@ -134,41 +121,3 @@ export const ts_spine_bun_backend_config = (options = {}) => {
|
|
|
134
121
|
sse_path: SPINE_SSE_PATH
|
|
135
122
|
};
|
|
136
123
|
};
|
|
137
|
-
/**
|
|
138
|
-
* `BackendConfig` for the Deno TS spine binary. The `--allow-*` set mirrors
|
|
139
|
-
* the cross-process needs (net + read/write for the daemon-token file + env
|
|
140
|
-
* + sys); `--unstable-detect-cjs` matches the ecosystem's Deno test entries.
|
|
141
|
-
*/
|
|
142
|
-
export const ts_spine_deno_backend_config = (options = {}) => {
|
|
143
|
-
const { port = TS_SPINE_DENO_DEFAULT_PORT, database_url, enable_login_rate_limit, name = 'ts_spine_deno' } = options;
|
|
144
|
-
const paths = default_test_backend_paths(name);
|
|
145
|
-
return {
|
|
146
|
-
...make_default_ts_backend_config({
|
|
147
|
-
name,
|
|
148
|
-
port,
|
|
149
|
-
start_command: [
|
|
150
|
-
'deno',
|
|
151
|
-
'run',
|
|
152
|
-
'--allow-net',
|
|
153
|
-
'--allow-read',
|
|
154
|
-
'--allow-env',
|
|
155
|
-
'--allow-write',
|
|
156
|
-
'--allow-sys',
|
|
157
|
-
'--allow-ffi',
|
|
158
|
-
'--allow-run',
|
|
159
|
-
'--unstable-detect-cjs',
|
|
160
|
-
TS_SPINE_DENO_ENTRY
|
|
161
|
-
],
|
|
162
|
-
database_url,
|
|
163
|
-
paths,
|
|
164
|
-
daemon_token_dir_env: TS_SPINE_DIR_ENV,
|
|
165
|
-
extra_env: {
|
|
166
|
-
...login_rate_limit_env(enable_login_rate_limit),
|
|
167
|
-
...action_rate_limit_env(options),
|
|
168
|
-
...timing_env(options)
|
|
169
|
-
},
|
|
170
|
-
capabilities: ts_spine_deno_capabilities
|
|
171
|
-
}),
|
|
172
|
-
sse_path: SPINE_SSE_PATH
|
|
173
|
-
};
|
|
174
|
-
};
|
|
@@ -22,8 +22,8 @@ import '../assert_dev_env.js';
|
|
|
22
22
|
* - **large, within the budget** — a burst of a few mebibytes, most of the
|
|
23
23
|
* default budget, arrives the same way: every frame whole, in order, the
|
|
24
24
|
* response last. Megabyte frames can outrun a socket's buffer, and where
|
|
25
|
-
* they do
|
|
26
|
-
*
|
|
25
|
+
* they do, the frames behind the first wait on the backend's write pump
|
|
26
|
+
* (Node and Bun write the burst through, as observed).
|
|
27
27
|
* - **overflow** — a burst far past the budget closes the socket with the code
|
|
28
28
|
* and the exact reason; the response of the flooding request never arrives;
|
|
29
29
|
* any flood frames that did arrive form a contiguous prefix of the burst.
|
|
@@ -6,7 +6,7 @@ import './assert_dev_env.js';
|
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
8
|
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
9
|
-
import type {
|
|
9
|
+
import type { EnvDeps, FsReadDeps, FsWriteDeps, LogDeps, ProcessProbeDeps } from '../runtime/deps.js';
|
|
10
10
|
/**
|
|
11
11
|
* Get an app's home directory path (`~/.{name}`).
|
|
12
12
|
*
|
|
@@ -76,11 +76,16 @@ export declare const write_daemon_info: (runtime: Pick<EnvDeps, "env_get"> & Pic
|
|
|
76
76
|
*/
|
|
77
77
|
export declare const read_daemon_info: (runtime: Pick<EnvDeps, "env_get"> & Pick<FsReadDeps, "stat" | "read_text_file"> & LogDeps, name: string) => Promise<DaemonInfo | null>;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Whether the daemon a `daemon.json` names is still running: its `pid` is a
|
|
80
|
+
* process this process may signal (`probe_process`).
|
|
80
81
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
82
|
+
* A process another user owns (`'not_permitted'`) is not the daemon — its pid
|
|
83
|
+
* was reused — so it reads as not running, as does a `pid` that names no
|
|
84
|
+
* single process (0, a negative number, a non-integer, out of `pid_t` range).
|
|
85
|
+
*
|
|
86
|
+
* @param runtime - runtime with the process probe
|
|
87
|
+
* @param pid - the process ID `daemon.json` recorded
|
|
88
|
+
* @returns `true` if the process is running and this process may signal it
|
|
84
89
|
*/
|
|
85
|
-
export declare const is_daemon_running: (runtime:
|
|
90
|
+
export declare const is_daemon_running: (runtime: ProcessProbeDeps, pid: number) => boolean;
|
|
86
91
|
//# sourceMappingURL=daemon_info.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon_info.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/daemon_info.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;GAKG;AAEH,OAAO,EAQN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"daemon_info.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/daemon_info.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;GAKG;AAEH,OAAO,EAQN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,MAAM,oBAAoB,CAAC;AAI5B;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,IAGtF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;IACtB,sBAAsB;;IAEtB,yBAAyB;;IAEzB,uCAAuC;;IAEvC;;;;;OAKG;;IAEH,0CAA0C;;EAEzC,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAChC,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EACjC,MAAM,MAAM,KACV,MAAM,GAAG,IAGX,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC7B,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,QAAQ,CAAC,EAC7F,MAAM,MAAM,EACZ,MAAM,UAAU,KACd,OAAO,CAAC,IAAI,CAWd,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC5B,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG,OAAO,EACzF,MAAM,MAAM,KACV,OAAO,CAAC,UAAU,GAAG,IAAI,CAwB3B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,gBAAgB,EAAE,KAAK,MAAM,KAAG,OACZ,CAAC"}
|
|
@@ -7,6 +7,7 @@ import './assert_dev_env.js';
|
|
|
7
7
|
*/
|
|
8
8
|
import { format_issue, iso_datetime, number, object, parse, pipe, string } from '@fuzdev/fuz_schema/schema.ts';
|
|
9
9
|
import { write_file_atomic } from '../runtime/fs.js';
|
|
10
|
+
import { is_process_id } from '../runtime/process_id.js';
|
|
10
11
|
/**
|
|
11
12
|
* Get an app's home directory path (`~/.{name}`).
|
|
12
13
|
*
|
|
@@ -101,13 +102,15 @@ export const read_daemon_info = async (runtime, name) => {
|
|
|
101
102
|
}
|
|
102
103
|
};
|
|
103
104
|
/**
|
|
104
|
-
*
|
|
105
|
+
* Whether the daemon a `daemon.json` names is still running: its `pid` is a
|
|
106
|
+
* process this process may signal (`probe_process`).
|
|
105
107
|
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
108
|
+
* A process another user owns (`'not_permitted'`) is not the daemon — its pid
|
|
109
|
+
* was reused — so it reads as not running, as does a `pid` that names no
|
|
110
|
+
* single process (0, a negative number, a non-integer, out of `pid_t` range).
|
|
111
|
+
*
|
|
112
|
+
* @param runtime - runtime with the process probe
|
|
113
|
+
* @param pid - the process ID `daemon.json` recorded
|
|
114
|
+
* @returns `true` if the process is running and this process may signal it
|
|
109
115
|
*/
|
|
110
|
-
export const is_daemon_running =
|
|
111
|
-
const result = await runtime.run_command('kill', ['-0', String(pid)]);
|
|
112
|
-
return result.success;
|
|
113
|
-
};
|
|
116
|
+
export const is_daemon_running = (runtime, pid) => is_process_id(pid) && runtime.probe_process(pid) === 'running';
|
|
@@ -20,8 +20,8 @@ import './assert_dev_env.js';
|
|
|
20
20
|
* HTTP parser (Node's, hyper) refuses such a length with a bodiless 400 of its
|
|
21
21
|
* own before the application sees it, and `fetch` can't send one. In-process
|
|
22
22
|
* the length reaches the body limit unparsed, and the 400 is the limit's own —
|
|
23
|
-
* the answer a
|
|
24
|
-
* `Content-Length`, which
|
|
23
|
+
* the answer a Bun server gives when a request repeats an equal
|
|
24
|
+
* `Content-Length`, which Bun hands over joined into one value.
|
|
25
25
|
*
|
|
26
26
|
* `describe_standard_integration_tests` runs one per declared gate of each
|
|
27
27
|
* route it counts and records each answer in its error coverage.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuzdev/fuz_app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.176.0",
|
|
4
4
|
"description": "fullstack app library",
|
|
5
5
|
"glyph": "🗝",
|
|
6
6
|
"logo": "logo.svg",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"check": "gro check",
|
|
16
16
|
"test": "gro test",
|
|
17
17
|
"test:cross": "node --conditions=development src/test/cross_backend/run_cross.ts",
|
|
18
|
-
"test:cross:ts": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_ts_node --project
|
|
18
|
+
"test:cross:ts": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_ts_node --project cross_backend_ts_bun",
|
|
19
19
|
"test:cross:rust-spine-stub": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_rust_spine_stub",
|
|
20
20
|
"test:cross:parity": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_parity",
|
|
21
21
|
"test:cross:security": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_security",
|
|
@@ -36,13 +36,12 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@electric-sql/pglite": ">=0.4",
|
|
38
38
|
"@fuzdev/blake3-wasm": ">=0.2.0",
|
|
39
|
-
"@fuzdev/fuz_css": ">=0.
|
|
39
|
+
"@fuzdev/fuz_css": ">=0.81.0",
|
|
40
40
|
"@fuzdev/fuz_schema": "^0.5.6",
|
|
41
|
-
"@fuzdev/fuz_ui": ">=0.
|
|
42
|
-
"@fuzdev/fuz_util": ">=0.
|
|
41
|
+
"@fuzdev/fuz_ui": ">=0.227.0",
|
|
42
|
+
"@fuzdev/fuz_util": ">=0.81.0",
|
|
43
43
|
"@fuzdev/pglet-wasm": ">=0.1.2",
|
|
44
44
|
"@hono/bun": ">=1",
|
|
45
|
-
"@hono/deno": ">=1",
|
|
46
45
|
"@hono/node-server": ">=1",
|
|
47
46
|
"@hono/node-ws": ">=1",
|
|
48
47
|
"@node-rs/argon2": ">=2",
|
|
@@ -69,9 +68,6 @@
|
|
|
69
68
|
"@hono/bun": {
|
|
70
69
|
"optional": true
|
|
71
70
|
},
|
|
72
|
-
"@hono/deno": {
|
|
73
|
-
"optional": true
|
|
74
|
-
},
|
|
75
71
|
"@hono/node-server": {
|
|
76
72
|
"optional": true
|
|
77
73
|
},
|
|
@@ -97,16 +93,15 @@
|
|
|
97
93
|
"devDependencies": {
|
|
98
94
|
"@electric-sql/pglite": "^0.5.8",
|
|
99
95
|
"@fuzdev/blake3-wasm": "^0.2.0",
|
|
100
|
-
"@fuzdev/fuz_code": "^0.
|
|
101
|
-
"@fuzdev/fuz_css": "^0.
|
|
96
|
+
"@fuzdev/fuz_code": "^0.59.0",
|
|
97
|
+
"@fuzdev/fuz_css": "^0.81.0",
|
|
102
98
|
"@fuzdev/fuz_schema": "^0.5.6",
|
|
103
|
-
"@fuzdev/fuz_ui": "^0.
|
|
104
|
-
"@fuzdev/fuz_util": "^0.
|
|
105
|
-
"@fuzdev/gro": "^0.
|
|
106
|
-
"@fuzdev/mdz": "^0.
|
|
99
|
+
"@fuzdev/fuz_ui": "^0.227.0",
|
|
100
|
+
"@fuzdev/fuz_util": "^0.82.0",
|
|
101
|
+
"@fuzdev/gro": "^0.230.0",
|
|
102
|
+
"@fuzdev/mdz": "^0.9.0",
|
|
107
103
|
"@fuzdev/pglet-wasm": "^0.1.2",
|
|
108
104
|
"@hono/bun": "^1.0.1",
|
|
109
|
-
"@hono/deno": "^1.0.3",
|
|
110
105
|
"@hono/node-server": "^1.19.14",
|
|
111
106
|
"@hono/node-ws": "^1.3.1",
|
|
112
107
|
"@node-rs/argon2": "^2.0.2",
|
package/dist/runtime/deno.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deno implementation of `RuntimeDeps`.
|
|
3
|
-
*
|
|
4
|
-
* Provides `create_deno_runtime(args)` — a factory returning a `RuntimeDeps`
|
|
5
|
-
* backed by Deno APIs. Only imported by Deno entry points (compiled binaries
|
|
6
|
-
* for tx, zzz, etc.).
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
import type { RuntimeDeps } from './deps.js';
|
|
11
|
-
/**
|
|
12
|
-
* Create a runtime backed by Deno APIs.
|
|
13
|
-
*
|
|
14
|
-
* Returns an object satisfying all `*Deps` interfaces from `runtime/deps.ts`.
|
|
15
|
-
* Pass to shared functions that accept `EnvDeps`, `FsReadDeps`, etc.
|
|
16
|
-
*
|
|
17
|
-
* @param args - CLI arguments (typically `Deno.args`)
|
|
18
|
-
* @returns runtime implementation using Deno APIs
|
|
19
|
-
*/
|
|
20
|
-
export declare const create_deno_runtime: (args: ReadonlyArray<string>) => RuntimeDeps;
|
|
21
|
-
//# sourceMappingURL=deno.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deno.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/runtime/deno.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,WAAW,EAA6B,MAAM,WAAW,CAAC;AAyExE;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,aAAa,CAAC,MAAM,CAAC,KAAG,WA0KhE,CAAC"}
|
package/dist/runtime/deno.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deno implementation of `RuntimeDeps`.
|
|
3
|
-
*
|
|
4
|
-
* Provides `create_deno_runtime(args)` — a factory returning a `RuntimeDeps`
|
|
5
|
-
* backed by Deno APIs. Only imported by Deno entry points (compiled binaries
|
|
6
|
-
* for tx, zzz, etc.).
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
import { to_error_message } from '@fuzdev/fuz_util/error.ts';
|
|
11
|
-
import { assert_secure_mode, assert_secure_regular_file, assert_secure_size, read_secure_bounded } from './secure_file.js';
|
|
12
|
-
/**
|
|
13
|
-
* Create a runtime backed by Deno APIs.
|
|
14
|
-
*
|
|
15
|
-
* Returns an object satisfying all `*Deps` interfaces from `runtime/deps.ts`.
|
|
16
|
-
* Pass to shared functions that accept `EnvDeps`, `FsReadDeps`, etc.
|
|
17
|
-
*
|
|
18
|
-
* @param args - CLI arguments (typically `Deno.args`)
|
|
19
|
-
* @returns runtime implementation using Deno APIs
|
|
20
|
-
*/
|
|
21
|
-
export const create_deno_runtime = (args) => ({
|
|
22
|
-
// === Environment ===
|
|
23
|
-
env_get: (name) => Deno.env.get(name),
|
|
24
|
-
env_set: (name, value) => Deno.env.set(name, value),
|
|
25
|
-
env_all: () => Deno.env.toObject(),
|
|
26
|
-
// === Process ===
|
|
27
|
-
args,
|
|
28
|
-
cwd: () => Deno.cwd(),
|
|
29
|
-
exit: (code) => Deno.exit(code),
|
|
30
|
-
// === Local File System ===
|
|
31
|
-
stat: async (path) => {
|
|
32
|
-
try {
|
|
33
|
-
const s = await Deno.stat(path);
|
|
34
|
-
return {
|
|
35
|
-
is_file: s.isFile,
|
|
36
|
-
is_directory: s.isDirectory,
|
|
37
|
-
size: s.size,
|
|
38
|
-
mtime_ms: s.mtime?.getTime()
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
mkdir: (path, options) => Deno.mkdir(path, options),
|
|
46
|
-
read_text_file: (path) => Deno.readTextFile(path),
|
|
47
|
-
read_file: (path) => Deno.readFile(path),
|
|
48
|
-
read_secure_file: async (path) => {
|
|
49
|
-
// Deno exposes no O_NOFOLLOW or O_NONBLOCK, so the symlink and
|
|
50
|
-
// regular-file checks are a pre-open lstat (a TOCTOU window the Node
|
|
51
|
-
// impl doesn't have — a FIFO swapped in after it would block the open;
|
|
52
|
-
// the checks below still run on the open descriptor, so a post-open swap
|
|
53
|
-
// can't defeat them). The checks themselves are the shared
|
|
54
|
-
// `runtime/secure_file.ts` helpers, same as `load_secure_file_node`.
|
|
55
|
-
const l = await Deno.lstat(path);
|
|
56
|
-
if (l.isSymlink)
|
|
57
|
-
throw new Error(`secure file is a symlink: ${path}`);
|
|
58
|
-
assert_secure_regular_file(path, l.isFile);
|
|
59
|
-
const file = await Deno.open(path, { read: true });
|
|
60
|
-
try {
|
|
61
|
-
const s = await file.stat();
|
|
62
|
-
assert_secure_regular_file(path, s.isFile);
|
|
63
|
-
// `mode` is null where POSIX modes don't apply (Windows).
|
|
64
|
-
if (s.mode !== null)
|
|
65
|
-
assert_secure_mode(path, s.mode);
|
|
66
|
-
assert_secure_size(path, s.size);
|
|
67
|
-
return await read_secure_bounded(path, (target) => file.read(target));
|
|
68
|
-
}
|
|
69
|
-
finally {
|
|
70
|
-
file.close();
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
read_file_stream: async (path) => (await Deno.open(path, { read: true })).readable,
|
|
74
|
-
write_file_stream: async (path, data) => {
|
|
75
|
-
const file = await Deno.open(path, { write: true, create: true, truncate: true });
|
|
76
|
-
// `pipeTo` closes the writable (and so the underlying file) on completion
|
|
77
|
-
// and aborts it on error — no manual `close()` needed.
|
|
78
|
-
await data.pipeTo(file.writable);
|
|
79
|
-
},
|
|
80
|
-
read_text_from_offset: async (path, offset) => {
|
|
81
|
-
const s = await Deno.stat(path);
|
|
82
|
-
const file_size = s.size;
|
|
83
|
-
const bytes_to_read = Math.max(0, file_size - offset);
|
|
84
|
-
if (bytes_to_read === 0)
|
|
85
|
-
return { content: '', bytes_read: 0, file_size };
|
|
86
|
-
const handle = await Deno.open(path, { read: true });
|
|
87
|
-
try {
|
|
88
|
-
await handle.seek(offset, Deno.SeekMode.Start);
|
|
89
|
-
const buffer = new Uint8Array(bytes_to_read);
|
|
90
|
-
const bytes_read = (await handle.read(buffer)) ?? 0;
|
|
91
|
-
return {
|
|
92
|
-
content: new TextDecoder().decode(buffer.subarray(0, bytes_read)),
|
|
93
|
-
bytes_read,
|
|
94
|
-
file_size
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
finally {
|
|
98
|
-
handle.close();
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
readdir: async (path) => {
|
|
102
|
-
const names = [];
|
|
103
|
-
for await (const entry of Deno.readDir(path))
|
|
104
|
-
names.push(entry.name);
|
|
105
|
-
return names;
|
|
106
|
-
},
|
|
107
|
-
write_text_file: (path, content, options) => Deno.writeTextFile(path, content, {
|
|
108
|
-
mode: options?.mode,
|
|
109
|
-
createNew: options?.exclusive
|
|
110
|
-
}),
|
|
111
|
-
write_file: (path, data) => Deno.writeFile(path, data),
|
|
112
|
-
rename: (old_path, new_path) => Deno.rename(old_path, new_path),
|
|
113
|
-
fsync: async (path) => {
|
|
114
|
-
const file = await Deno.open(path, { read: true });
|
|
115
|
-
try {
|
|
116
|
-
await file.sync();
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
file.close();
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
remove: (path, options) => Deno.remove(path, options),
|
|
123
|
-
// === HTTP ===
|
|
124
|
-
fetch: globalThis.fetch,
|
|
125
|
-
// === Local Commands ===
|
|
126
|
-
run_command: async (cmd, args, options) => {
|
|
127
|
-
try {
|
|
128
|
-
const controller = options?.timeout_ms !== undefined ? new AbortController() : null;
|
|
129
|
-
const signal = controller && options?.signal
|
|
130
|
-
? AbortSignal.any([controller.signal, options.signal])
|
|
131
|
-
: (controller?.signal ?? options?.signal);
|
|
132
|
-
const timer = controller && options?.timeout_ms !== undefined
|
|
133
|
-
? setTimeout(() => controller.abort(), options.timeout_ms)
|
|
134
|
-
: null;
|
|
135
|
-
let timed_out = false;
|
|
136
|
-
if (controller) {
|
|
137
|
-
controller.signal.addEventListener('abort', () => {
|
|
138
|
-
if (options?.signal?.aborted)
|
|
139
|
-
return;
|
|
140
|
-
timed_out = true;
|
|
141
|
-
}, { once: true });
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
const proc = new Deno.Command(cmd, {
|
|
145
|
-
args,
|
|
146
|
-
cwd: options?.cwd,
|
|
147
|
-
signal,
|
|
148
|
-
stdout: 'piped',
|
|
149
|
-
stderr: 'piped'
|
|
150
|
-
});
|
|
151
|
-
const result = await proc.output();
|
|
152
|
-
const base = {
|
|
153
|
-
success: result.code === 0 && !timed_out,
|
|
154
|
-
code: result.code,
|
|
155
|
-
stdout: new TextDecoder().decode(result.stdout),
|
|
156
|
-
stderr: new TextDecoder().decode(result.stderr)
|
|
157
|
-
};
|
|
158
|
-
if (options?.timeout_ms !== undefined)
|
|
159
|
-
base.timed_out = timed_out;
|
|
160
|
-
return base;
|
|
161
|
-
}
|
|
162
|
-
finally {
|
|
163
|
-
if (timer !== null)
|
|
164
|
-
clearTimeout(timer);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
catch (error) {
|
|
168
|
-
const message = to_error_message(error);
|
|
169
|
-
return {
|
|
170
|
-
success: false,
|
|
171
|
-
code: 1,
|
|
172
|
-
stdout: '',
|
|
173
|
-
stderr: `Failed to execute command: ${message}`
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
run_command_inherit: async (cmd, args) => {
|
|
178
|
-
const proc = new Deno.Command(cmd, {
|
|
179
|
-
args,
|
|
180
|
-
stdout: 'inherit',
|
|
181
|
-
stderr: 'inherit'
|
|
182
|
-
});
|
|
183
|
-
const result = await proc.output();
|
|
184
|
-
return result.code;
|
|
185
|
-
},
|
|
186
|
-
// === Terminal I/O ===
|
|
187
|
-
stdout_write: (data) => Deno.stdout.write(data),
|
|
188
|
-
stdin_read: (buffer) => Deno.stdin.read(buffer),
|
|
189
|
-
// === Logging ===
|
|
190
|
-
warn: (...args) => console.warn(...args)
|
|
191
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import '../assert_dev_env.js';
|
|
2
|
-
import type { TestingServerAdapter } from './testing_server_core.js';
|
|
3
|
-
/** Build the Deno `TestingServerAdapter`. */
|
|
4
|
-
export declare const create_deno_testing_adapter: () => TestingServerAdapter;
|
|
5
|
-
//# sourceMappingURL=testing_server_deno.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testing_server_deno.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_server_deno.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAsB9B,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAelF,6CAA6C;AAC7C,eAAO,MAAM,2BAA2B,QAAO,oBAkB7C,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import '../assert_dev_env.js';
|
|
2
|
-
/**
|
|
3
|
-
* Deno runtime adapter for spawnable cross-process test server binaries.
|
|
4
|
-
*
|
|
5
|
-
* Binds `Deno.serve` and `@hono/deno`'s module-level `upgradeWebSocket` (the
|
|
6
|
-
* optional `@hono/deno` peer dep). The shared
|
|
7
|
-
* `testing/cross_backend/testing_server_core.ts` owns the rest. Counterpart to
|
|
8
|
-
* `testing/cross_backend/testing_server_node.ts` — together they isolate the JS-runtime axis (Deno
|
|
9
|
-
* vs Node V8) on identical TS surfaces, and the Rust spine binary covers the
|
|
10
|
-
* cross-language axis.
|
|
11
|
-
*
|
|
12
|
-
* `Deno` globals are declared locally (mirroring `runtime/deno.ts`) so this
|
|
13
|
-
* module typechecks under fuz_app's Node-based config without a `deno.json`
|
|
14
|
-
* or `@types/deno`. It is only ever *run* under Deno.
|
|
15
|
-
*
|
|
16
|
-
* @module
|
|
17
|
-
*/
|
|
18
|
-
import { upgradeWebSocket } from '@hono/deno';
|
|
19
|
-
import { create_deno_runtime } from '../../runtime/deno.js';
|
|
20
|
-
/** Build the Deno `TestingServerAdapter`. */
|
|
21
|
-
export const create_deno_testing_adapter = () => ({
|
|
22
|
-
runtime_label: 'Deno',
|
|
23
|
-
runtime: create_deno_runtime([]),
|
|
24
|
-
get_connection_ip: (c) => c.env?.remoteAddr?.hostname,
|
|
25
|
-
// Deno's WS upgrade is module-level and stateless — no post-serve attach.
|
|
26
|
-
prepare_websocket: () => ({ create_upgrade_websocket: () => upgradeWebSocket }),
|
|
27
|
-
serve: ({ fetch, port, hostname }) => {
|
|
28
|
-
const server = Deno.serve({ port, hostname }, fetch);
|
|
29
|
-
const handle = { shutdown: () => server.shutdown(), native: server };
|
|
30
|
-
return handle;
|
|
31
|
-
},
|
|
32
|
-
pid: Deno.pid,
|
|
33
|
-
register_shutdown_signals: (handler) => {
|
|
34
|
-
Deno.addSignalListener('SIGINT', () => void handler());
|
|
35
|
-
Deno.addSignalListener('SIGTERM', () => void handler());
|
|
36
|
-
},
|
|
37
|
-
exit: (code) => Deno.exit(code)
|
|
38
|
-
});
|