@fuzdev/fuz_app 0.100.0 → 0.101.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/dist/db/status.d.ts +42 -1
- package/dist/db/status.d.ts.map +1 -1
- package/dist/db/status.js +48 -5
- package/dist/dev/setup.d.ts +9 -1
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +11 -11
- package/dist/env/dotenv.d.ts +3 -0
- package/dist/env/dotenv.d.ts.map +1 -1
- package/dist/env/dotenv.js +12 -5
- package/dist/env/update_env_variable.d.ts +1 -0
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +10 -5
- package/dist/testing/CLAUDE.md +3 -2
- package/dist/testing/cross_backend/account_lifecycle.js +1 -1
- package/dist/testing/cross_backend/actor_lookup.js +1 -1
- package/dist/testing/cross_backend/actor_search.js +1 -1
- package/dist/testing/cross_backend/app_settings.js +1 -1
- package/dist/testing/cross_backend/body_size.js +1 -1
- package/dist/testing/cross_backend/body_size_smuggling.js +1 -1
- package/dist/testing/cross_backend/cell_crud.js +1 -1
- package/dist/testing/cross_backend/cell_grant_role.js +1 -1
- package/dist/testing/cross_backend/cell_relations.js +1 -1
- package/dist/testing/cross_backend/credential_header_robustness.js +1 -1
- package/dist/testing/cross_backend/default_spine_surface.d.ts +0 -30
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +6 -30
- package/dist/testing/cross_backend/fact_serving.js +1 -1
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +2 -1
- package/dist/testing/cross_backend/origin.js +1 -1
- package/dist/testing/cross_backend/role_grant_offer_enumeration.js +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +47 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -0
- package/dist/testing/cross_backend/spine_surface_constants.js +46 -0
- package/dist/testing/cross_backend/testing_backdoor.js +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +0 -11
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +4 -14
- package/package.json +1 -1
package/dist/db/status.d.ts
CHANGED
|
@@ -4,10 +4,41 @@
|
|
|
4
4
|
* Queries migration state and table info without a running server.
|
|
5
5
|
* Returns structured data that consumer scripts can print however they like.
|
|
6
6
|
*
|
|
7
|
+
* The migration check is **name-divergence aware**: it name-prefix-verifies the
|
|
8
|
+
* applied migrations against the code's list (mirroring `run_migrations`), so a
|
|
9
|
+
* divergent history (same count, different names) reports a `divergence` and
|
|
10
|
+
* renders `DIVERGED` rather than a false `up_to_date`.
|
|
11
|
+
*
|
|
7
12
|
* @module
|
|
8
13
|
*/
|
|
9
14
|
import type { Db } from './db.js';
|
|
10
15
|
import type { MigrationNamespace } from './migrate.js';
|
|
16
|
+
/**
|
|
17
|
+
* A divergence between the recorded migration tracker and the code's list.
|
|
18
|
+
*
|
|
19
|
+
* Either variant is a state the migration runner refuses to boot against — a
|
|
20
|
+
* re-bootstrap (drop + migrate) is needed. Structured (not a pre-formatted
|
|
21
|
+
* string) so programmatic consumers can branch on `kind`; `format_db_status`
|
|
22
|
+
* renders the operator-facing line. The discriminated-union twin of the Rust
|
|
23
|
+
* `fuz_db` `Divergence` enum.
|
|
24
|
+
*/
|
|
25
|
+
export type Divergence = {
|
|
26
|
+
/** An applied name doesn't match the code's name at `position`. */
|
|
27
|
+
kind: 'name_mismatch';
|
|
28
|
+
/** Sequence position of the first mismatch. */
|
|
29
|
+
position: number;
|
|
30
|
+
/** The name recorded in the tracker at `position`. */
|
|
31
|
+
applied: string;
|
|
32
|
+
/** The name the code declares at `position`. */
|
|
33
|
+
expected: string;
|
|
34
|
+
} | {
|
|
35
|
+
/** The tracker records more migrations than the code declares. */
|
|
36
|
+
kind: 'binary_older';
|
|
37
|
+
/** Count recorded in the tracker. */
|
|
38
|
+
applied: number;
|
|
39
|
+
/** Count the code declares. */
|
|
40
|
+
declared: number;
|
|
41
|
+
};
|
|
11
42
|
/**
|
|
12
43
|
* Migration status for a single namespace.
|
|
13
44
|
*/
|
|
@@ -17,8 +48,18 @@ export interface MigrationStatus {
|
|
|
17
48
|
applied_names: Array<string>;
|
|
18
49
|
/** Names of code migrations not yet applied (suffix of the code array). */
|
|
19
50
|
pending_names: Array<string>;
|
|
20
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Whether `applied_names` is the full code array with no name divergence
|
|
53
|
+
* (no pending work, no diverged history).
|
|
54
|
+
*/
|
|
21
55
|
up_to_date: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The first applied/code divergence, if any. Absent when the applied names
|
|
58
|
+
* are a clean prefix of the code's list (the only state the runner boots
|
|
59
|
+
* against). Present means a divergent bootstrap history — a re-bootstrap
|
|
60
|
+
* (drop + migrate) is needed.
|
|
61
|
+
*/
|
|
62
|
+
divergence?: Divergence;
|
|
22
63
|
}
|
|
23
64
|
/**
|
|
24
65
|
* Table info with row count.
|
package/dist/db/status.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/status.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GACnB;IACA,mEAAmE;IACnE,IAAI,EAAE,eAAe,CAAC;IACtB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IAC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AC"}
|
package/dist/db/status.js
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
* Queries migration state and table info without a running server.
|
|
5
5
|
* Returns structured data that consumer scripts can print however they like.
|
|
6
6
|
*
|
|
7
|
+
* The migration check is **name-divergence aware**: it name-prefix-verifies the
|
|
8
|
+
* applied migrations against the code's list (mirroring `run_migrations`), so a
|
|
9
|
+
* divergent history (same count, different names) reports a `divergence` and
|
|
10
|
+
* renders `DIVERGED` rather than a false `up_to_date`.
|
|
11
|
+
*
|
|
7
12
|
* @module
|
|
8
13
|
*/
|
|
9
14
|
import { to_error_message } from '@fuzdev/fuz_util/error.ts';
|
|
@@ -78,14 +83,37 @@ export const query_db_status = async (db, namespaces) => {
|
|
|
78
83
|
ORDER BY sequence ASC`, [namespace]);
|
|
79
84
|
const applied_names = rows.map((r) => r.name);
|
|
80
85
|
const code_names = ns_migrations.map((m) => m.name);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
const total = code_names.length;
|
|
87
|
+
const applied = applied_names.length;
|
|
88
|
+
// Name-prefix verify, mirroring the migration runner: the applied
|
|
89
|
+
// names must equal the first `applied` code names by position. A
|
|
90
|
+
// divergent history (a renamed/reordered migration, same count or not)
|
|
91
|
+
// is the exact state `run_migrations` refuses to boot against, so a
|
|
92
|
+
// count-only check would report a DB the runner rejects as up-to-date.
|
|
93
|
+
let divergence;
|
|
94
|
+
if (applied > total) {
|
|
95
|
+
divergence = { kind: 'binary_older', applied, declared: total };
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const position = applied_names.findIndex((name, i) => name !== code_names[i]);
|
|
99
|
+
if (position !== -1) {
|
|
100
|
+
divergence = {
|
|
101
|
+
kind: 'name_mismatch',
|
|
102
|
+
position,
|
|
103
|
+
applied: applied_names[position],
|
|
104
|
+
expected: code_names[position],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// pending = the suffix of code names past the applied count (clamped:
|
|
109
|
+
// a binary-older history has no pending tail)
|
|
110
|
+
const pending_names = code_names.slice(Math.min(applied, total));
|
|
84
111
|
migrations.push({
|
|
85
112
|
namespace,
|
|
86
113
|
applied_names,
|
|
87
114
|
pending_names,
|
|
88
|
-
up_to_date:
|
|
115
|
+
up_to_date: applied === total && pending_names.length === 0 && divergence === undefined,
|
|
116
|
+
...(divergence ? { divergence } : {}),
|
|
89
117
|
});
|
|
90
118
|
}
|
|
91
119
|
}
|
|
@@ -110,6 +138,18 @@ export const query_db_status = async (db, namespaces) => {
|
|
|
110
138
|
...(old_tracker_shape ? { old_tracker_shape: true } : {}),
|
|
111
139
|
};
|
|
112
140
|
};
|
|
141
|
+
/**
|
|
142
|
+
* Render a `Divergence` as the operator-facing detail line. Twin of the Rust
|
|
143
|
+
* `Divergence` `Display`.
|
|
144
|
+
*/
|
|
145
|
+
const format_divergence = (divergence) => {
|
|
146
|
+
switch (divergence.kind) {
|
|
147
|
+
case 'name_mismatch':
|
|
148
|
+
return `position ${divergence.position}: database has '${divergence.applied}', code has '${divergence.expected}'`;
|
|
149
|
+
case 'binary_older':
|
|
150
|
+
return `database has ${divergence.applied} applied but code declares ${divergence.declared} (binary older than database)`;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
113
153
|
/**
|
|
114
154
|
* Format a `DbStatus` as a human-readable string for CLI output.
|
|
115
155
|
*
|
|
@@ -141,7 +181,10 @@ export const format_db_status = (status) => {
|
|
|
141
181
|
lines.push(' Migrations:');
|
|
142
182
|
for (const m of status.migrations) {
|
|
143
183
|
const total = m.applied_names.length + m.pending_names.length;
|
|
144
|
-
if (m.
|
|
184
|
+
if (m.divergence) {
|
|
185
|
+
lines.push(` ${m.namespace}: DIVERGED (${m.applied_names.length}/${total}) — ${format_divergence(m.divergence)}`);
|
|
186
|
+
}
|
|
187
|
+
else if (m.up_to_date) {
|
|
145
188
|
lines.push(` ${m.namespace}: up to date (${m.applied_names.length}/${total})`);
|
|
146
189
|
}
|
|
147
190
|
else {
|
package/dist/dev/setup.d.ts
CHANGED
|
@@ -96,12 +96,20 @@ export declare const generate_random_key: (deps: CommandDeps) => Promise<string>
|
|
|
96
96
|
/**
|
|
97
97
|
* Read a single env var from a dotenv-style file.
|
|
98
98
|
*
|
|
99
|
+
* Delegates to `load_env_file` so the value is tokenized exactly like every
|
|
100
|
+
* other dotenv read — surrounding quotes, inline comments, and escapes are
|
|
101
|
+
* handled, and a leading `export ` is tolerated. Returns `undefined` when the
|
|
102
|
+
* file is absent or the variable is unset; a read error other than the file
|
|
103
|
+
* not existing (permission denied, I/O failure) propagates rather than being
|
|
104
|
+
* masked as "not found".
|
|
105
|
+
*
|
|
99
106
|
* @param deps - file read capability
|
|
100
107
|
* @param env_path - path to the .env file
|
|
101
108
|
* @param name - the variable name to read
|
|
102
109
|
* @returns the value, or `undefined` if the file or variable doesn't exist
|
|
110
|
+
* @throws Error if reading fails for any reason other than `ENOENT` / `NotFound`
|
|
103
111
|
*/
|
|
104
|
-
export declare const read_env_var: (deps: Pick<FsReadDeps, "
|
|
112
|
+
export declare const read_env_var: (deps: Pick<FsReadDeps, "read_text_file">, env_path: string, name: string) => Promise<string | undefined>;
|
|
105
113
|
/**
|
|
106
114
|
* Create an env file from its example template, auto-generating `SECRET_FUZ_COOKIE_KEYS`.
|
|
107
115
|
*
|
package/dist/dev/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/dev/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,aAAa,EACb,OAAO,EACP,UAAU,EACV,YAAY,EACZ,WAAW,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/dev/setup.ts"],"names":[],"mappings":"AAAA;;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CAAC,oBAAoB,CAwC9B,CAAC"}
|
package/dist/dev/setup.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
+
import { load_env_file } from '../env/dotenv.js';
|
|
11
12
|
import { query_account_by_username, query_actors_by_account, query_create_account_with_actor, } from '../auth/account_queries.js';
|
|
12
13
|
import { query_create_role_grant } from '../auth/role_grant_queries.js';
|
|
13
14
|
/** Default logger using bracket format. */
|
|
@@ -49,23 +50,22 @@ export const generate_random_key = async (deps) => {
|
|
|
49
50
|
/**
|
|
50
51
|
* Read a single env var from a dotenv-style file.
|
|
51
52
|
*
|
|
53
|
+
* Delegates to `load_env_file` so the value is tokenized exactly like every
|
|
54
|
+
* other dotenv read — surrounding quotes, inline comments, and escapes are
|
|
55
|
+
* handled, and a leading `export ` is tolerated. Returns `undefined` when the
|
|
56
|
+
* file is absent or the variable is unset; a read error other than the file
|
|
57
|
+
* not existing (permission denied, I/O failure) propagates rather than being
|
|
58
|
+
* masked as "not found".
|
|
59
|
+
*
|
|
52
60
|
* @param deps - file read capability
|
|
53
61
|
* @param env_path - path to the .env file
|
|
54
62
|
* @param name - the variable name to read
|
|
55
63
|
* @returns the value, or `undefined` if the file or variable doesn't exist
|
|
64
|
+
* @throws Error if reading fails for any reason other than `ENOENT` / `NotFound`
|
|
56
65
|
*/
|
|
57
66
|
export const read_env_var = async (deps, env_path, name) => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
return undefined;
|
|
61
|
-
try {
|
|
62
|
-
const content = await deps.read_text_file(env_path);
|
|
63
|
-
const match = new RegExp(`^${name}=(.+)$`, 'm').exec(content);
|
|
64
|
-
return match?.[1]?.trim();
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
67
|
+
const env = await load_env_file(deps, env_path);
|
|
68
|
+
return env?.[name];
|
|
69
69
|
};
|
|
70
70
|
// === Setup helpers ===
|
|
71
71
|
/**
|
package/dist/env/dotenv.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ import type { FsReadDeps } from '../runtime/deps.js';
|
|
|
20
20
|
* values keep `#` literal when no whitespace precedes it so URL fragments
|
|
21
21
|
* like `KEY=https://x.com#frag` round-trip unchanged.
|
|
22
22
|
*
|
|
23
|
+
* A leading `export ` on a line is ignored, so a shell-sourceable `.env`
|
|
24
|
+
* (`export KEY=value`) parses identically to a plain `KEY=value`.
|
|
25
|
+
*
|
|
23
26
|
* Trailing whitespace on unquoted values is lost (the raw value is trimmed);
|
|
24
27
|
* wrap the value in `"..."` or `'...'` to preserve surrounding spacing.
|
|
25
28
|
*
|
package/dist/env/dotenv.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotenv.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/dotenv.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"dotenv.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/dotenv.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAqCnE,CAAC;AAiEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GACzB,SAAS,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,EAC3C,MAAM,MAAM,KACV,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CASvC,CAAC"}
|
package/dist/env/dotenv.js
CHANGED
|
@@ -19,25 +19,32 @@
|
|
|
19
19
|
* values keep `#` literal when no whitespace precedes it so URL fragments
|
|
20
20
|
* like `KEY=https://x.com#frag` round-trip unchanged.
|
|
21
21
|
*
|
|
22
|
+
* A leading `export ` on a line is ignored, so a shell-sourceable `.env`
|
|
23
|
+
* (`export KEY=value`) parses identically to a plain `KEY=value`.
|
|
24
|
+
*
|
|
22
25
|
* Trailing whitespace on unquoted values is lost (the raw value is trimmed);
|
|
23
26
|
* wrap the value in `"..."` or `'...'` to preserve surrounding spacing.
|
|
24
27
|
*
|
|
25
28
|
* @param content - dotenv file content
|
|
26
29
|
* @returns parsed key-value pairs
|
|
27
30
|
*/
|
|
28
|
-
// Line tokenization (trim, skip empties/comments,
|
|
29
|
-
// mirrored in `update_env_variable.ts`'s
|
|
31
|
+
// Line tokenization (trim, skip empties/comments, strip a leading `export `,
|
|
32
|
+
// split on first `=`) is mirrored in `update_env_variable.ts`'s
|
|
33
|
+
// `find_last_key_line_index`.
|
|
30
34
|
export const parse_dotenv = (content) => {
|
|
31
35
|
const result = {};
|
|
32
36
|
for (const line of content.split('\n')) {
|
|
33
37
|
const trimmed = line.trim();
|
|
34
38
|
if (!trimmed || trimmed.startsWith('#'))
|
|
35
39
|
continue;
|
|
36
|
-
|
|
40
|
+
// tolerate a leading `export ` so shell-sourceable `.env` files parse
|
|
41
|
+
// the same as plain `KEY=value` ones
|
|
42
|
+
const assignment = trimmed.startsWith('export ') ? trimmed.slice(7) : trimmed;
|
|
43
|
+
const eq_index = assignment.indexOf('=');
|
|
37
44
|
if (eq_index === -1)
|
|
38
45
|
continue;
|
|
39
|
-
const key =
|
|
40
|
-
let value =
|
|
46
|
+
const key = assignment.slice(0, eq_index).trim();
|
|
47
|
+
let value = assignment.slice(eq_index + 1).trim();
|
|
41
48
|
if (value.startsWith('"')) {
|
|
42
49
|
const close = find_closing_double_quote(value);
|
|
43
50
|
if (close !== -1 && is_comment_or_empty_after(value, close)) {
|
|
@@ -22,6 +22,7 @@ export interface UpdateEnvVariableOptions {
|
|
|
22
22
|
* - **Duplicate keys**: updates the LAST occurrence (matches dotenv behavior)
|
|
23
23
|
* - **Inline comments**: preserved after the value (e.g., `KEY=value # comment`)
|
|
24
24
|
* - **Quote style**: preserved from original (quoted/unquoted)
|
|
25
|
+
* - **`export ` prefix**: preserved when updating an `export KEY=…` line
|
|
25
26
|
*
|
|
26
27
|
* @warning Not atomic; not safe for concurrent writers. Reads the file, mutates
|
|
27
28
|
* in memory, then writes it back — a crash or concurrent write can corrupt
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update_env_variable.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/update_env_variable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,oFAAoF;IACpF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChF;AAED
|
|
1
|
+
{"version":3,"file":"update_env_variable.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/update_env_variable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,oFAAoF;IACpF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,KAAK,MAAM,EACX,OAAO,MAAM,EACb,SAAS,wBAAwB,KAC/B,OAAO,CAAC,IAAI,CAsDd,CAAC"}
|
|
@@ -13,6 +13,7 @@ import { resolve } from 'node:path';
|
|
|
13
13
|
* - **Duplicate keys**: updates the LAST occurrence (matches dotenv behavior)
|
|
14
14
|
* - **Inline comments**: preserved after the value (e.g., `KEY=value # comment`)
|
|
15
15
|
* - **Quote style**: preserved from original (quoted/unquoted)
|
|
16
|
+
* - **`export ` prefix**: preserved when updating an `export KEY=…` line
|
|
16
17
|
*
|
|
17
18
|
* @warning Not atomic; not safe for concurrent writers. Reads the file, mutates
|
|
18
19
|
* in memory, then writes it back — a crash or concurrent write can corrupt
|
|
@@ -49,14 +50,17 @@ export const update_env_variable = async (key, value, options) => {
|
|
|
49
50
|
const last_match_idx = find_last_key_line_index(lines, key);
|
|
50
51
|
const updated_lines = lines.map((line, idx) => {
|
|
51
52
|
if (idx === last_match_idx) {
|
|
53
|
+
// preserve a leading `export ` (the rest of the line's leading
|
|
54
|
+
// whitespace is normalized away, same as for a plain assignment)
|
|
55
|
+
const export_prefix = line.trimStart().startsWith('export ') ? 'export ' : '';
|
|
52
56
|
const equals_pos = line.indexOf('=');
|
|
53
57
|
const value_part = line.substring(equals_pos + 1);
|
|
54
58
|
const inline_comment = extract_inline_comment(value_part);
|
|
55
59
|
const trimmed_value = value_part.trim();
|
|
56
60
|
const has_quotes = is_quoted_value(trimmed_value);
|
|
57
61
|
return has_quotes
|
|
58
|
-
? `${key}=${quote_value(value)}${inline_comment}`
|
|
59
|
-
: `${key}=${value}${inline_comment}`;
|
|
62
|
+
? `${export_prefix}${key}=${quote_value(value)}${inline_comment}`
|
|
63
|
+
: `${export_prefix}${key}=${value}${inline_comment}`;
|
|
60
64
|
}
|
|
61
65
|
return line;
|
|
62
66
|
});
|
|
@@ -71,7 +75,7 @@ export const update_env_variable = async (key, value, options) => {
|
|
|
71
75
|
await write_file(file_path, updated_content, 'utf-8');
|
|
72
76
|
};
|
|
73
77
|
// Keep this tokenization aligned with `parse_dotenv` in `env/dotenv.ts`:
|
|
74
|
-
// trim, skip empties/comments, split on the first `=`.
|
|
78
|
+
// trim, skip empties/comments, strip a leading `export `, split on the first `=`.
|
|
75
79
|
const find_last_key_line_index = (lines, key) => {
|
|
76
80
|
if (!key)
|
|
77
81
|
return -1;
|
|
@@ -80,10 +84,11 @@ const find_last_key_line_index = (lines, key) => {
|
|
|
80
84
|
const trimmed = line.trim();
|
|
81
85
|
if (!trimmed || trimmed.startsWith('#'))
|
|
82
86
|
return;
|
|
83
|
-
const
|
|
87
|
+
const assignment = trimmed.startsWith('export ') ? trimmed.slice(7) : trimmed;
|
|
88
|
+
const eq_index = assignment.indexOf('=');
|
|
84
89
|
if (eq_index === -1)
|
|
85
90
|
return;
|
|
86
|
-
if (
|
|
91
|
+
if (assignment.slice(0, eq_index).trim() === key)
|
|
87
92
|
last_match_idx = idx;
|
|
88
93
|
});
|
|
89
94
|
return last_match_idx;
|
package/dist/testing/CLAUDE.md
CHANGED
|
@@ -1347,8 +1347,9 @@ the same reasons the sibling `cross_backend/origin.ts` suite is imperative.
|
|
|
1347
1347
|
Both backends read the **same** committed
|
|
1348
1348
|
`testing/cross_backend/expected_schema.json` (column-presence is engine-portable,
|
|
1349
1349
|
so one fixture is the cross-impl contract): the TS spine via
|
|
1350
|
-
`create_spine_ready_route_spec
|
|
1351
|
-
|
|
1350
|
+
`create_spine_ready_route_spec`, which reads the `SPINE_EXPECTED_SCHEMA_URL`
|
|
1351
|
+
`import.meta.url` constant off `spine_surface_constants.ts`; the Rust
|
|
1352
|
+
`testing_spine_stub` via the absolute path `rust_spine_stub_backend_config`
|
|
1352
1353
|
passes through `FUZ_RUST_SPINE_STUB_EXPECTED_SCHEMA_PATH`. The fixture covers the full
|
|
1353
1354
|
spine bootstrap (auth + cell + cell_history + fact) and is regenerated +
|
|
1354
1355
|
drift-guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`
|
|
@@ -22,7 +22,7 @@ import { AccountDeleteOutput, AccountUndeleteOutput, AccountPurgeOutput, AdminAc
|
|
|
22
22
|
import { ERROR_ACCOUNT_NOT_FOUND, ERROR_AUTHENTICATION_REQUIRED } from '../../http/error_schemas.js';
|
|
23
23
|
import { test_if } from './capabilities.js';
|
|
24
24
|
import { cross_rpc_call, error_reason, expect_output } from './cell_cross_helpers.js';
|
|
25
|
-
import { SPINE_RPC_PATH } from './
|
|
25
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
26
26
|
export const describe_account_lifecycle_cross_tests = (options) => {
|
|
27
27
|
const { setup_test, capabilities } = options;
|
|
28
28
|
const rpc_path = options.rpc_path ?? SPINE_RPC_PATH;
|
|
@@ -32,7 +32,7 @@ import '../assert_dev_env.js';
|
|
|
32
32
|
*/
|
|
33
33
|
import { describe, test, assert } from 'vitest';
|
|
34
34
|
import { actor_lookup_action_spec } from '../../auth/actor_lookup_action_specs.js';
|
|
35
|
-
import { SPINE_RPC_PATH } from './
|
|
35
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
36
36
|
/** Keys that must never appear on an `actor_lookup` result row. */
|
|
37
37
|
const forbidden_row_keys = ['account_id', 'email', 'created_at', 'updated_at', 'role'];
|
|
38
38
|
/** Build the JSON-RPC envelope body for an `actor_lookup` call. */
|
|
@@ -35,7 +35,7 @@ import '../assert_dev_env.js';
|
|
|
35
35
|
*/
|
|
36
36
|
import { describe, test, assert } from 'vitest';
|
|
37
37
|
import { actor_search_action_spec, ERROR_ACTOR_SEARCH_SCOPE_REQUIRED, } from '../../auth/actor_search_action_specs.js';
|
|
38
|
-
import { SPINE_RPC_PATH } from './
|
|
38
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
39
39
|
/** Nil UUID — an unheld scope id (no actor holds a role_grant on it). */
|
|
40
40
|
const NIL_UUID = '00000000-0000-0000-0000-000000000000';
|
|
41
41
|
/** Build the JSON-RPC envelope body for an `actor_search` call. */
|
|
@@ -33,7 +33,7 @@ import '../assert_dev_env.js';
|
|
|
33
33
|
import { describe, test, assert } from 'vitest';
|
|
34
34
|
import { app_settings_update_action_spec } from '../../auth/admin_action_specs.js';
|
|
35
35
|
import { ERROR_NO_MATCHING_INVITE } from '../../http/error_schemas.js';
|
|
36
|
-
import { SPINE_RPC_PATH } from './
|
|
36
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
37
37
|
/** REST signup path on the spine surface (`/api/account` prefix + `/signup`). */
|
|
38
38
|
const SIGNUP_PATH = '/api/account/signup';
|
|
39
39
|
/** A password that satisfies the creation-strength schema (min 12). */
|
|
@@ -55,7 +55,7 @@ import '../assert_dev_env.js';
|
|
|
55
55
|
import { describe, test, assert } from 'vitest';
|
|
56
56
|
import { account_verify_action_spec } from '../../auth/account_action_specs.js';
|
|
57
57
|
import { ERROR_PAYLOAD_TOO_LARGE } from '../../http/error_schemas.js';
|
|
58
|
-
import { SPINE_RPC_PATH } from './
|
|
58
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
59
59
|
/**
|
|
60
60
|
* The shared 1 MiB default both impls ship (`DEFAULT_MAX_BODY_SIZE` in TS,
|
|
61
61
|
* `DEFAULT_BODY_LIMIT_BYTES` in `fuz_http`). Kept as a local cross-impl
|
|
@@ -50,7 +50,7 @@ import '../assert_dev_env.js';
|
|
|
50
50
|
*/
|
|
51
51
|
import { connect } from 'node:net';
|
|
52
52
|
import { describe, test, assert } from 'vitest';
|
|
53
|
-
import { SPINE_RPC_PATH } from './
|
|
53
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
54
54
|
/** The shared 1 MiB cap (see `body_size.ts` for why it's a local constant). */
|
|
55
55
|
const BODY_LIMIT_DEFAULT_BYTES = 1024 * 1024;
|
|
56
56
|
/**
|
|
@@ -43,7 +43,7 @@ import { describe, assert } from 'vitest';
|
|
|
43
43
|
import { CellCreateOutput, CellDeleteOutput, CellGetOutput, CellListOutput, CellUpdateOutput, } from '../../auth/cell_action_specs.js';
|
|
44
44
|
import { test_if } from './capabilities.js';
|
|
45
45
|
import { cross_rpc_call, error_reason, expect_output } from './cell_cross_helpers.js';
|
|
46
|
-
import { SPINE_RPC_PATH } from './
|
|
46
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
47
47
|
export const describe_cell_crud_cross_tests = (options) => {
|
|
48
48
|
const { setup_test, capabilities } = options;
|
|
49
49
|
const rpc_path = options.rpc_path ?? SPINE_RPC_PATH;
|
|
@@ -38,7 +38,7 @@ import { CellCreateOutput, CellGetOutput, CellUpdateOutput } from '../../auth/ce
|
|
|
38
38
|
import { CellGrantCreateOutput, ERROR_CELL_GRANT_UNKNOWN_ROLE, } from '../../auth/cell_grant_action_specs.js';
|
|
39
39
|
import { test_if } from './capabilities.js';
|
|
40
40
|
import { cross_rpc_call, error_reason, expect_output } from './cell_cross_helpers.js';
|
|
41
|
-
import { SPINE_CELL_EDITOR_ROLE, SPINE_RPC_PATH } from './
|
|
41
|
+
import { SPINE_CELL_EDITOR_ROLE, SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
42
42
|
/** App role the holder is seeded with; matches the spine's registered role. */
|
|
43
43
|
export const CELL_EDITOR_ROLE = SPINE_CELL_EDITOR_ROLE;
|
|
44
44
|
/** Username the fixture seeds (via `extra_accounts`) holding `CELL_EDITOR_ROLE`. */
|
|
@@ -61,7 +61,7 @@ import { CellItemDeleteOutput, CellItemInsertOutput, CellItemListOutput, CellIte
|
|
|
61
61
|
import { CellAuditListOutput } from '../../auth/cell_audit_action_specs.js';
|
|
62
62
|
import { test_if } from './capabilities.js';
|
|
63
63
|
import { cross_rpc_call, error_reason, expect_output } from './cell_cross_helpers.js';
|
|
64
|
-
import { SPINE_RPC_PATH } from './
|
|
64
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
65
65
|
/** Create a cell over the wire and return its id (the parity gate parses the output). */
|
|
66
66
|
const create_cell = async (t, rpc_path, h, params) => expect_output(await cross_rpc_call(t, rpc_path, 'cell_create', params, h), CellCreateOutput).cell
|
|
67
67
|
.id;
|
|
@@ -51,7 +51,7 @@ import '../assert_dev_env.js';
|
|
|
51
51
|
import { connect } from 'node:net';
|
|
52
52
|
import { describe, test, assert } from 'vitest';
|
|
53
53
|
import { DAEMON_TOKEN_HEADER } from '../../auth/daemon_token.js';
|
|
54
|
-
import { SPINE_RPC_PATH } from './
|
|
54
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
55
55
|
/** A well-formed UUID that never names a real row. */
|
|
56
56
|
const NIL_UUID = '00000000-0000-0000-0000-000000000000';
|
|
57
57
|
/** A value that is never a real credential — used for the conflicting / garbage copies. */
|
|
@@ -35,14 +35,6 @@ import type { AppServerContext } from '../../server/app_server_context.js';
|
|
|
35
35
|
* (`fuz_session`) so cookie-attribute assertions + jar extraction line up.
|
|
36
36
|
*/
|
|
37
37
|
export declare const spine_session_options: SessionOptions<string>;
|
|
38
|
-
/**
|
|
39
|
-
* App role the role-shaped-`cell_grant` cross suite exercises. Registered
|
|
40
|
-
* with no grant path (`grant_paths: []`) so it stays a valid registry member
|
|
41
|
-
* without entering the admin / self-service grant flows — holders are seeded
|
|
42
|
-
* directly via `extra_accounts`. Must match the `cell_editor` entry in the
|
|
43
|
-
* Rust `testing_spine_stub`'s `known_roles` (cross-language test contract).
|
|
44
|
-
*/
|
|
45
|
-
export declare const SPINE_CELL_EDITOR_ROLE = "cell_editor";
|
|
46
38
|
/**
|
|
47
39
|
* The spine's closed role registry: built-ins plus `SPINE_CELL_EDITOR_ROLE`.
|
|
48
40
|
* Threaded into the cell spec set's role-validity gate; the Rust stub mirrors
|
|
@@ -51,16 +43,6 @@ export declare const SPINE_CELL_EDITOR_ROLE = "cell_editor";
|
|
|
51
43
|
* picks up grant-path coverage.
|
|
52
44
|
*/
|
|
53
45
|
export declare const spine_roles: RoleSchemaResult;
|
|
54
|
-
/** RPC endpoint mount path — matches the binary's `/api/rpc`. */
|
|
55
|
-
export declare const SPINE_RPC_PATH = "/api/rpc";
|
|
56
|
-
/**
|
|
57
|
-
* Audit-log SSE stream path — `/api/admin` prefix + the
|
|
58
|
-
* `create_audit_log_route_specs` `/audit/stream` route. Matches the default
|
|
59
|
-
* `BackendConfig.sse_path` and the cross-process SSE suite's default. Only
|
|
60
|
-
* mounted by the TS spine binary (which wires `audit_log_sse`); the shared
|
|
61
|
-
* surface stub leaves `ctx.audit_sse` null so the snapshot stays SSE-free.
|
|
62
|
-
*/
|
|
63
|
-
export declare const SPINE_SSE_PATH = "/api/admin/audit/stream";
|
|
64
46
|
/** Options for {@link spine_rpc_endpoints}. */
|
|
65
47
|
export interface SpineRpcEndpointsOptions {
|
|
66
48
|
/**
|
|
@@ -109,18 +91,6 @@ export declare const spine_rpc_endpoints: (ctx: AppServerContext, options?: Spin
|
|
|
109
91
|
* the stream at `SPINE_SSE_PATH`.
|
|
110
92
|
*/
|
|
111
93
|
export declare const create_spine_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
|
|
112
|
-
/**
|
|
113
|
-
* Committed expected-schema fixture for the spine `/ready` deploy gate — the
|
|
114
|
-
* column map a fresh full spine bootstrap (auth + cell + cell_history + fact)
|
|
115
|
-
* produces. Resolved relative to this module so the spawned TS binary (which
|
|
116
|
-
* imports this source under its loader) reads it off disk via `node:fs`.
|
|
117
|
-
* Regenerated + guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`.
|
|
118
|
-
*
|
|
119
|
-
* The Rust `testing_spine_stub` reads the **same** committed file (its absolute
|
|
120
|
-
* path passed via env by `rust_spine_stub_backend_config`) — column-presence is
|
|
121
|
-
* engine-portable, so one fixture is the cross-impl contract.
|
|
122
|
-
*/
|
|
123
|
-
export declare const SPINE_EXPECTED_SCHEMA_URL: URL;
|
|
124
94
|
/**
|
|
125
95
|
* The spine's `/ready` route spec — the column-presence schema-drift deploy
|
|
126
96
|
* gate, reading {@link SPINE_EXPECTED_SCHEMA_URL}. Mounted **live** by the TS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default_spine_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_spine_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAIpD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAqB,KAAK,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAwB,KAAK,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAIxF,OAAO,EAAqB,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"default_spine_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_spine_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAIpD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAqB,KAAK,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAwB,KAAK,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAIxF,OAAO,EAAqB,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;AAczE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,MAAM,CAAwC,CAAC;AAElG;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,gBAExB,CAAC;AAEH,+CAA+C;AAC/C,MAAM,WAAW,wBAAwB;IACxC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAC/B,KAAK,gBAAgB,EACrB,UAAU,wBAAwB,KAChC,KAAK,CAAC,eAAe,CAQvB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GAAI,KAAK,gBAAgB,KAAG,KAAK,CAAC,SAAS,CA+B/E,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,6BAA6B,GAAI,MAAM,MAAM,KAAG,SAC6B,CAAC;AAE3F;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAAO,cAM1C,CAAC"}
|
|
@@ -8,19 +8,17 @@ import { create_standard_rpc_actions } from '../../auth/standard_rpc_actions.js'
|
|
|
8
8
|
import { create_ready_route_spec, load_expected_schema } from '../../http/common_routes.js';
|
|
9
9
|
import { prefix_route_specs } from '../../http/route_spec.js';
|
|
10
10
|
import { create_test_app_surface_spec } from '../stubs.js';
|
|
11
|
+
// Pure path / role / fixture-URL constants live on the hono-free
|
|
12
|
+
// `spine_surface_constants.ts` leaf so cross-process suite modules can import them
|
|
13
|
+
// without dragging this module's eager in-process route handlers
|
|
14
|
+
// (→ `session_middleware` → `hono/cookie`). Import only the constants this
|
|
15
|
+
// module uses internally; callers that need a bare constant reach for the leaf.
|
|
16
|
+
import { SPINE_CELL_EDITOR_ROLE, SPINE_EXPECTED_SCHEMA_URL, SPINE_RPC_PATH, } from './spine_surface_constants.js';
|
|
11
17
|
/**
|
|
12
18
|
* Session config — cookie name matches the binary's issued session cookie
|
|
13
19
|
* (`fuz_session`) so cookie-attribute assertions + jar extraction line up.
|
|
14
20
|
*/
|
|
15
21
|
export const spine_session_options = create_session_config('fuz_session');
|
|
16
|
-
/**
|
|
17
|
-
* App role the role-shaped-`cell_grant` cross suite exercises. Registered
|
|
18
|
-
* with no grant path (`grant_paths: []`) so it stays a valid registry member
|
|
19
|
-
* without entering the admin / self-service grant flows — holders are seeded
|
|
20
|
-
* directly via `extra_accounts`. Must match the `cell_editor` entry in the
|
|
21
|
-
* Rust `testing_spine_stub`'s `known_roles` (cross-language test contract).
|
|
22
|
-
*/
|
|
23
|
-
export const SPINE_CELL_EDITOR_ROLE = 'cell_editor';
|
|
24
22
|
/**
|
|
25
23
|
* The spine's closed role registry: built-ins plus `SPINE_CELL_EDITOR_ROLE`.
|
|
26
24
|
* Threaded into the cell spec set's role-validity gate; the Rust stub mirrors
|
|
@@ -31,16 +29,6 @@ export const SPINE_CELL_EDITOR_ROLE = 'cell_editor';
|
|
|
31
29
|
export const spine_roles = create_role_schema([
|
|
32
30
|
{ name: SPINE_CELL_EDITOR_ROLE, grant_paths: [] },
|
|
33
31
|
]);
|
|
34
|
-
/** RPC endpoint mount path — matches the binary's `/api/rpc`. */
|
|
35
|
-
export const SPINE_RPC_PATH = '/api/rpc';
|
|
36
|
-
/**
|
|
37
|
-
* Audit-log SSE stream path — `/api/admin` prefix + the
|
|
38
|
-
* `create_audit_log_route_specs` `/audit/stream` route. Matches the default
|
|
39
|
-
* `BackendConfig.sse_path` and the cross-process SSE suite's default. Only
|
|
40
|
-
* mounted by the TS spine binary (which wires `audit_log_sse`); the shared
|
|
41
|
-
* surface stub leaves `ctx.audit_sse` null so the snapshot stays SSE-free.
|
|
42
|
-
*/
|
|
43
|
-
export const SPINE_SSE_PATH = '/api/admin/audit/stream';
|
|
44
32
|
/**
|
|
45
33
|
* Factory-form RPC endpoints over the per-test `ctx.deps`. `create_app_server`
|
|
46
34
|
* (in the binary) owns live dispatch; the surface builder invokes the factory
|
|
@@ -105,18 +93,6 @@ export const create_spine_route_specs = (ctx) => [
|
|
|
105
93
|
? prefix_route_specs('/api/admin', create_audit_log_route_specs({ stream: ctx.audit_sse }))
|
|
106
94
|
: []),
|
|
107
95
|
];
|
|
108
|
-
/**
|
|
109
|
-
* Committed expected-schema fixture for the spine `/ready` deploy gate — the
|
|
110
|
-
* column map a fresh full spine bootstrap (auth + cell + cell_history + fact)
|
|
111
|
-
* produces. Resolved relative to this module so the spawned TS binary (which
|
|
112
|
-
* imports this source under its loader) reads it off disk via `node:fs`.
|
|
113
|
-
* Regenerated + guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`.
|
|
114
|
-
*
|
|
115
|
-
* The Rust `testing_spine_stub` reads the **same** committed file (its absolute
|
|
116
|
-
* path passed via env by `rust_spine_stub_backend_config`) — column-presence is
|
|
117
|
-
* engine-portable, so one fixture is the cross-impl contract.
|
|
118
|
-
*/
|
|
119
|
-
export const SPINE_EXPECTED_SCHEMA_URL = new URL('./expected_schema.json', import.meta.url);
|
|
120
96
|
/**
|
|
121
97
|
* The spine's `/ready` route spec — the column-presence schema-drift deploy
|
|
122
98
|
* gate, reading {@link SPINE_EXPECTED_SCHEMA_URL}. Mounted **live** by the TS
|
|
@@ -42,7 +42,7 @@ import { FactHashSchema } from '@fuzdev/fuz_util/fact_hash.ts';
|
|
|
42
42
|
import { CellCreateOutput } from '../../auth/cell_action_specs.js';
|
|
43
43
|
import { test_if } from './capabilities.js';
|
|
44
44
|
import { cross_rpc_call, expect_output } from './cell_cross_helpers.js';
|
|
45
|
-
import { SPINE_RPC_PATH } from './
|
|
45
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
46
46
|
/** A blake3 hash that is a valid form but references no seeded fact. */
|
|
47
47
|
const UNRELATED_HASH = `blake3:${'0'.repeat(64)}`;
|
|
48
48
|
/** Nil UUID — a valid `Uuid` param that resolves to no cell. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full_spine_mount.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/full_spine_mount.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,8CAA8C,CAAC;AAKrF,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"full_spine_mount.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/full_spine_mount.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,8CAA8C,CAAC;AAKrF,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;AAQzE,2FAA2F;AAC3F,MAAM,WAAW,qBAAqB;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzD;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,OAAO,EACb,SAAS,qBAAqB,KAC5B,KAAK,CAAC,SAAS,CA0BjB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACpC,KAAK,gBAAgB,EACrB,SAAS,qBAAqB,KAC5B,KAAK,CAAC,eAAe,CAEvB,CAAC"}
|
|
@@ -5,7 +5,8 @@ import { create_all_cell_actions } from '../../auth/all_cell_actions.js';
|
|
|
5
5
|
import { create_actor_lookup_actions } from '../../auth/actor_lookup_actions.js';
|
|
6
6
|
import { create_actor_search_actions } from '../../auth/actor_search_actions.js';
|
|
7
7
|
import { create_testing_action_manifest_action, create_testing_actions, } from './testing_reset_actions.js';
|
|
8
|
-
import {
|
|
8
|
+
import { spine_roles, spine_session_options } from './default_spine_surface.js';
|
|
9
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
9
10
|
/**
|
|
10
11
|
* Build the complete live RPC action list the spine test binary mounts on
|
|
11
12
|
* its single endpoint: the declared `create_standard_rpc_actions` bundle plus
|
|
@@ -29,7 +29,7 @@ import '../assert_dev_env.js';
|
|
|
29
29
|
import { describe, test, assert } from 'vitest';
|
|
30
30
|
import { account_verify_action_spec } from '../../auth/account_action_specs.js';
|
|
31
31
|
import { ERROR_FORBIDDEN_ORIGIN } from '../../http/error_schemas.js';
|
|
32
|
-
import { SPINE_RPC_PATH } from './
|
|
32
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
33
33
|
/** Build the JSON-RPC envelope body for a nullary `account_verify` call. */
|
|
34
34
|
const verify_envelope = (id) => JSON.stringify({ jsonrpc: '2.0', method: account_verify_action_spec.method, id });
|
|
35
35
|
export const describe_origin_cross_tests = (options) => {
|
|
@@ -46,7 +46,7 @@ import { describe, test, assert } from 'vitest';
|
|
|
46
46
|
import { rpc_call } from '../rpc_helpers.js';
|
|
47
47
|
import { ROLE_ADMIN } from '../../auth/role_schema.js';
|
|
48
48
|
import { ERROR_ROLE_GRANT_OFFER_ACTOR_MISMATCH, ERROR_ROLE_GRANT_OFFER_NOT_FOUND, } from '../../auth/role_grant_offer_action_specs.js';
|
|
49
|
-
import { SPINE_RPC_PATH } from './
|
|
49
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
50
50
|
/** A well-formed UUID that never names a real offer — exercises the not-found arm. */
|
|
51
51
|
const NIL_UUID = '00000000-0000-0000-0000-000000000000';
|
|
52
52
|
/**
|
|
@@ -35,7 +35,7 @@ import '../assert_dev_env.js';
|
|
|
35
35
|
*/
|
|
36
36
|
import { fileURLToPath } from 'node:url';
|
|
37
37
|
import { build_test_backend_paths } from './build_test_backend_paths.js';
|
|
38
|
-
import { SPINE_EXPECTED_SCHEMA_URL } from './
|
|
38
|
+
import { SPINE_EXPECTED_SCHEMA_URL } from './spine_surface_constants.js';
|
|
39
39
|
import { LOGIN_RATE_LIMIT_ENABLED_ENV, make_default_rust_backend_config, rust_default_capabilities, } from './default_backend_configs.js';
|
|
40
40
|
/** Env var naming the prebuilt `testing_spine_stub` binary. Required when `binary_path` is omitted. */
|
|
41
41
|
export const RUST_SPINE_STUB_BIN_ENV = 'FUZ_TESTING_RUST_SPINE_STUB_BIN';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pure spine-surface path + role constants — the hono-free leaf split out of
|
|
4
|
+
* `default_spine_surface.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Cross-process suite modules (which drive a separately-spawned backend binary
|
|
7
|
+
* over HTTP) need only the wire path / role / fixture-URL, not the in-process
|
|
8
|
+
* route handlers. Importing them from `default_spine_surface.ts` used to drag
|
|
9
|
+
* its eager `account_routes.ts` / `signup_routes.ts` imports — and through them
|
|
10
|
+
* `session_middleware` → `hono/cookie` — onto a backend-spawning consumer with
|
|
11
|
+
* no `hono` peer installed (a Rust-only spine consumer). Keeping these constants
|
|
12
|
+
* on this handler-free leaf lets such a consumer import the path without the
|
|
13
|
+
* peer. `default_spine_surface.ts` re-exports them for in-process callers.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
/** RPC endpoint mount path — matches the binary's `/api/rpc`. */
|
|
18
|
+
export declare const SPINE_RPC_PATH = "/api/rpc";
|
|
19
|
+
/**
|
|
20
|
+
* Audit-log SSE stream path — `/api/admin` prefix + the
|
|
21
|
+
* `create_audit_log_route_specs` `/audit/stream` route. Matches the default
|
|
22
|
+
* `BackendConfig.sse_path` and the cross-process SSE suite's default. Only
|
|
23
|
+
* mounted by the TS spine binary (which wires `audit_log_sse`); the shared
|
|
24
|
+
* surface stub leaves `ctx.audit_sse` null so the snapshot stays SSE-free.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SPINE_SSE_PATH = "/api/admin/audit/stream";
|
|
27
|
+
/**
|
|
28
|
+
* App role the role-shaped-`cell_grant` cross suite exercises. Registered
|
|
29
|
+
* with no grant path (`grant_paths: []`) so it stays a valid registry member
|
|
30
|
+
* without entering the admin / self-service grant flows — holders are seeded
|
|
31
|
+
* directly via `extra_accounts`. Must match the `cell_editor` entry in the
|
|
32
|
+
* Rust `testing_spine_stub`'s `known_roles` (cross-language test contract).
|
|
33
|
+
*/
|
|
34
|
+
export declare const SPINE_CELL_EDITOR_ROLE = "cell_editor";
|
|
35
|
+
/**
|
|
36
|
+
* Committed expected-schema fixture for the spine `/ready` deploy gate — the
|
|
37
|
+
* column map a fresh full spine bootstrap (auth + cell + cell_history + fact)
|
|
38
|
+
* produces. Resolved relative to this module so the spawned TS binary (which
|
|
39
|
+
* imports this source under its loader) reads it off disk via `node:fs`.
|
|
40
|
+
* Regenerated + guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`.
|
|
41
|
+
*
|
|
42
|
+
* The Rust `testing_spine_stub` reads the **same** committed file (its absolute
|
|
43
|
+
* path passed via env by `rust_spine_stub_backend_config`) — column-presence is
|
|
44
|
+
* engine-portable, so one fixture is the cross-impl contract.
|
|
45
|
+
*/
|
|
46
|
+
export declare const SPINE_EXPECTED_SCHEMA_URL: URL;
|
|
47
|
+
//# sourceMappingURL=spine_surface_constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spine_surface_constants.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/spine_surface_constants.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;GAcG;AAEH,iEAAiE;AACjE,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,4BAA4B,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,EAAE,GAAwD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pure spine-surface path + role constants — the hono-free leaf split out of
|
|
4
|
+
* `default_spine_surface.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Cross-process suite modules (which drive a separately-spawned backend binary
|
|
7
|
+
* over HTTP) need only the wire path / role / fixture-URL, not the in-process
|
|
8
|
+
* route handlers. Importing them from `default_spine_surface.ts` used to drag
|
|
9
|
+
* its eager `account_routes.ts` / `signup_routes.ts` imports — and through them
|
|
10
|
+
* `session_middleware` → `hono/cookie` — onto a backend-spawning consumer with
|
|
11
|
+
* no `hono` peer installed (a Rust-only spine consumer). Keeping these constants
|
|
12
|
+
* on this handler-free leaf lets such a consumer import the path without the
|
|
13
|
+
* peer. `default_spine_surface.ts` re-exports them for in-process callers.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
/** RPC endpoint mount path — matches the binary's `/api/rpc`. */
|
|
18
|
+
export const SPINE_RPC_PATH = '/api/rpc';
|
|
19
|
+
/**
|
|
20
|
+
* Audit-log SSE stream path — `/api/admin` prefix + the
|
|
21
|
+
* `create_audit_log_route_specs` `/audit/stream` route. Matches the default
|
|
22
|
+
* `BackendConfig.sse_path` and the cross-process SSE suite's default. Only
|
|
23
|
+
* mounted by the TS spine binary (which wires `audit_log_sse`); the shared
|
|
24
|
+
* surface stub leaves `ctx.audit_sse` null so the snapshot stays SSE-free.
|
|
25
|
+
*/
|
|
26
|
+
export const SPINE_SSE_PATH = '/api/admin/audit/stream';
|
|
27
|
+
/**
|
|
28
|
+
* App role the role-shaped-`cell_grant` cross suite exercises. Registered
|
|
29
|
+
* with no grant path (`grant_paths: []`) so it stays a valid registry member
|
|
30
|
+
* without entering the admin / self-service grant flows — holders are seeded
|
|
31
|
+
* directly via `extra_accounts`. Must match the `cell_editor` entry in the
|
|
32
|
+
* Rust `testing_spine_stub`'s `known_roles` (cross-language test contract).
|
|
33
|
+
*/
|
|
34
|
+
export const SPINE_CELL_EDITOR_ROLE = 'cell_editor';
|
|
35
|
+
/**
|
|
36
|
+
* Committed expected-schema fixture for the spine `/ready` deploy gate — the
|
|
37
|
+
* column map a fresh full spine bootstrap (auth + cell + cell_history + fact)
|
|
38
|
+
* produces. Resolved relative to this module so the spawned TS binary (which
|
|
39
|
+
* imports this source under its loader) reads it off disk via `node:fs`.
|
|
40
|
+
* Regenerated + guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`.
|
|
41
|
+
*
|
|
42
|
+
* The Rust `testing_spine_stub` reads the **same** committed file (its absolute
|
|
43
|
+
* path passed via env by `rust_spine_stub_backend_config`) — column-presence is
|
|
44
|
+
* engine-portable, so one fixture is the cross-impl contract.
|
|
45
|
+
*/
|
|
46
|
+
export const SPINE_EXPECTED_SCHEMA_URL = new URL('./expected_schema.json', import.meta.url);
|
|
@@ -53,7 +53,7 @@ import '../assert_dev_env.js';
|
|
|
53
53
|
import { describe, test, assert } from 'vitest';
|
|
54
54
|
import { ERROR_CREDENTIAL_TYPE_REQUIRED } from '../../http/error_schemas.js';
|
|
55
55
|
import { rpc_call } from '../rpc_helpers.js';
|
|
56
|
-
import { SPINE_RPC_PATH } from './
|
|
56
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
57
57
|
/** A well-formed UUID that never names a real row. */
|
|
58
58
|
const NIL_UUID = '00000000-0000-0000-0000-000000000000';
|
|
59
59
|
/**
|
|
@@ -19,17 +19,6 @@ import '../assert_dev_env.js';
|
|
|
19
19
|
import type { BackendConfig } from './backend_config.js';
|
|
20
20
|
/** Env var naming the backend root dir; `{dir}/run/daemon_token` must match `bootstrap.daemon_token_path`. */
|
|
21
21
|
export declare const TS_SPINE_DIR_ENV = "FUZ_TESTING_TS_SPINE_DIR";
|
|
22
|
-
/**
|
|
23
|
-
* Audit-log SSE stream path the TS spine binary serves (it wires
|
|
24
|
-
* `audit_log_sse`). Matches `SPINE_SSE_PATH` in `testing/cross_backend/default_spine_surface.ts`
|
|
25
|
-
* and the cross-process SSE suite's default. Scoped to the TS configs
|
|
26
|
-
* (which advertise `capabilities.sse: true`) — the shared
|
|
27
|
-
* `ts_default_capabilities` stays `sse: false` because not every consumer
|
|
28
|
-
* wires `audit_log_sse`, so the default stays honest for backends that don't
|
|
29
|
-
* serve the stream. (The Rust `testing_spine_stub` does serve it and opts in
|
|
30
|
-
* via `rust_spine_stub_backend_config`.)
|
|
31
|
-
*/
|
|
32
|
-
export declare const TS_SPINE_SSE_PATH = "/api/admin/audit/stream";
|
|
33
22
|
/** Default port for the Node TS spine binary — slots beside the Rust `spine_stub` (1177). */
|
|
34
23
|
export declare const TS_SPINE_NODE_DEFAULT_PORT = 1178;
|
|
35
24
|
/** Default port for the Deno TS spine binary. */
|
|
@@ -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,EAAC,aAAa,EAAC,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,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AASvD,8GAA8G;AAC9G,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AA+B3D,6FAA6F;AAC7F,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,iDAAiD;AACjD,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,gDAAgD;AAChD,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,wDAAwD,CAAC;AAEzF,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,wDAAwD,CAAC;AAEzF,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,uDAAuD,CAAC;AAEvF,MAAM,WAAW,2BAA2B;IAC3C,mFAAmF;IACnF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAC3C;AAWD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACxC,UAAS,2BAAgC,KACvC,aAmBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GACvC,UAAS,2BAAgC,KACvC,aAmBF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GACxC,UAAS,2BAAgC,KACvC,aAgCF,CAAC"}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import { build_test_backend_paths } from './build_test_backend_paths.js';
|
|
3
3
|
import { LOGIN_RATE_LIMIT_ENABLED_ENV, make_default_ts_backend_config, ts_default_capabilities, } from './default_backend_configs.js';
|
|
4
|
+
import { SPINE_SSE_PATH } from './spine_surface_constants.js';
|
|
4
5
|
/** Env var naming the backend root dir; `{dir}/run/daemon_token` must match `bootstrap.daemon_token_path`. */
|
|
5
6
|
export const TS_SPINE_DIR_ENV = 'FUZ_TESTING_TS_SPINE_DIR';
|
|
6
|
-
/**
|
|
7
|
-
* Audit-log SSE stream path the TS spine binary serves (it wires
|
|
8
|
-
* `audit_log_sse`). Matches `SPINE_SSE_PATH` in `testing/cross_backend/default_spine_surface.ts`
|
|
9
|
-
* and the cross-process SSE suite's default. Scoped to the TS configs
|
|
10
|
-
* (which advertise `capabilities.sse: true`) — the shared
|
|
11
|
-
* `ts_default_capabilities` stays `sse: false` because not every consumer
|
|
12
|
-
* wires `audit_log_sse`, so the default stays honest for backends that don't
|
|
13
|
-
* serve the stream. (The Rust `testing_spine_stub` does serve it and opts in
|
|
14
|
-
* via `rust_spine_stub_backend_config`.)
|
|
15
|
-
*/
|
|
16
|
-
export const TS_SPINE_SSE_PATH = '/api/admin/audit/stream';
|
|
17
7
|
/**
|
|
18
8
|
* Capabilities for the TS spine binary — `ts_default_capabilities` plus `sse`
|
|
19
9
|
* (the binary wires `audit_log_sse`), `ready` (the binary live-mounts the
|
|
@@ -81,7 +71,7 @@ export const ts_spine_node_backend_config = (options = {}) => {
|
|
|
81
71
|
},
|
|
82
72
|
capabilities: ts_spine_capabilities,
|
|
83
73
|
}),
|
|
84
|
-
sse_path:
|
|
74
|
+
sse_path: SPINE_SSE_PATH,
|
|
85
75
|
};
|
|
86
76
|
};
|
|
87
77
|
/**
|
|
@@ -107,7 +97,7 @@ export const ts_spine_bun_backend_config = (options = {}) => {
|
|
|
107
97
|
},
|
|
108
98
|
capabilities: ts_spine_bun_capabilities,
|
|
109
99
|
}),
|
|
110
|
-
sse_path:
|
|
100
|
+
sse_path: SPINE_SSE_PATH,
|
|
111
101
|
};
|
|
112
102
|
};
|
|
113
103
|
/**
|
|
@@ -151,6 +141,6 @@ export const ts_spine_deno_backend_config = (options = {}) => {
|
|
|
151
141
|
},
|
|
152
142
|
capabilities: ts_spine_capabilities,
|
|
153
143
|
}),
|
|
154
|
-
sse_path:
|
|
144
|
+
sse_path: SPINE_SSE_PATH,
|
|
155
145
|
};
|
|
156
146
|
};
|