@fuzdev/fuz_app 0.181.0 → 0.183.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 +2 -0
- package/dist/actions/CLAUDE.md +28 -10
- package/dist/actions/action_rpc.d.ts +11 -1
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +3 -2
- package/dist/actions/action_types.d.ts +16 -1
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +1 -1
- package/dist/actions/notification_sender.d.ts +83 -0
- package/dist/actions/notification_sender.d.ts.map +1 -0
- package/dist/actions/notification_sender.js +85 -0
- package/dist/actions/perform_action.d.ts +9 -0
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +22 -13
- package/dist/actions/register_action_ws.d.ts +14 -0
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +3 -2
- package/dist/actions/ws_socket_session.d.ts +3 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +2 -1
- package/dist/auth/CLAUDE.md +113 -70
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +13 -3
- package/dist/auth/account_queries.d.ts +158 -16
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +189 -18
- package/dist/auth/account_routes.d.ts +6 -4
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +98 -92
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +93 -45
- package/dist/auth/api_token_queries.d.ts +13 -5
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +24 -9
- package/dist/auth/audit_emitter.d.ts +75 -84
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +83 -71
- package/dist/auth/audit_log_schema.d.ts +10 -5
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +22 -6
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +3 -2
- package/dist/auth/bootstrap_account.d.ts +31 -13
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +34 -15
- package/dist/auth/bootstrap_routes.d.ts +1 -1
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +7 -14
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +12 -1
- package/dist/auth/deps.d.ts +18 -5
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/deps.js +3 -2
- package/dist/auth/request_context.d.ts +73 -73
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +78 -96
- package/dist/auth/resolved_auth.d.ts +16 -11
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +6 -6
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +2 -1
- package/dist/auth/role_grant_offer_actions.d.ts +32 -12
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +91 -116
- package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +75 -22
- package/dist/auth/role_grant_offer_queries.d.ts +155 -18
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +262 -73
- package/dist/auth/role_grant_offer_schema.js +1 -1
- package/dist/auth/role_grant_queries.d.ts +43 -52
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +50 -74
- package/dist/auth/role_grant_sql.d.ts +21 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -1
- package/dist/auth/role_grant_sql.js +21 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +17 -21
- package/dist/auth/session_queries.d.ts +40 -16
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +68 -29
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +90 -38
- package/dist/auth/standard_rpc_actions.d.ts +6 -19
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/standard_rpc_actions.js +5 -6
- package/dist/auth/token_scope.d.ts +1 -1
- package/dist/auth/token_scope.js +1 -1
- package/dist/db/sql_columns.d.ts +1 -1
- package/dist/db/sql_columns.js +1 -1
- package/dist/http/CLAUDE.md +22 -16
- package/dist/http/auth_shape.d.ts +1 -1
- package/dist/http/db_routes.d.ts +7 -22
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +72 -72
- package/dist/http/error_schemas.d.ts +9 -21
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +14 -24
- package/dist/http/pending_effects.d.ts +42 -4
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +34 -4
- package/dist/http/route_spec.d.ts +2 -2
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +3 -1
- package/dist/server/app_server.d.ts +69 -18
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +74 -10
- package/dist/server/serve_fact_route.d.ts +3 -3
- package/dist/server/serve_fact_route.js +12 -12
- package/dist/testing/CLAUDE.md +259 -790
- package/dist/testing/adversarial_404.d.ts +6 -1
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +38 -17
- package/dist/testing/app_server.d.ts +20 -140
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +48 -125
- package/dist/testing/audit_drift_guard.d.ts +11 -6
- package/dist/testing/audit_drift_guard.d.ts.map +1 -1
- package/dist/testing/audit_drift_guard.js +15 -8
- package/dist/testing/auth_apps.js +1 -1
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +43 -0
- package/dist/testing/cross_backend/audit_cross_helpers.d.ts +12 -9
- package/dist/testing/cross_backend/audit_cross_helpers.d.ts.map +1 -1
- package/dist/testing/cross_backend/audit_cross_helpers.js +13 -14
- package/dist/testing/cross_backend/capabilities.d.ts +9 -6
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +11 -7
- package/dist/testing/cross_backend/capability_mounts.d.ts +103 -0
- package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -0
- package/dist/testing/cross_backend/capability_mounts.js +423 -0
- package/dist/testing/cross_backend/cell_moderate.js +2 -2
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +12 -11
- package/dist/testing/cross_backend/conformance_principal.d.ts +54 -0
- package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -0
- package/dist/testing/cross_backend/conformance_principal.js +283 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +2 -50
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +2 -270
- package/dist/testing/cross_backend/credential_deadline.d.ts.map +1 -1
- package/dist/testing/cross_backend/credential_deadline.js +2 -0
- package/dist/testing/cross_backend/credential_wire.d.ts +1 -1
- package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -1
- package/dist/testing/cross_backend/db_state_diff.d.ts +72 -0
- package/dist/testing/cross_backend/db_state_diff.d.ts.map +1 -0
- package/dist/testing/cross_backend/db_state_diff.js +444 -0
- package/dist/testing/cross_backend/declared_skips.d.ts +68 -0
- package/dist/testing/cross_backend/declared_skips.d.ts.map +1 -0
- package/dist/testing/cross_backend/declared_skips.js +132 -0
- package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +2 -6
- package/dist/testing/cross_backend/differential.d.ts +11 -2
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +35 -11
- package/dist/testing/cross_backend/differential_normalize.d.ts +12 -0
- package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential_normalize.js +16 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -10
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +4 -4
- package/dist/testing/cross_backend/in_process_setup.d.ts +22 -12
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +151 -134
- package/dist/testing/cross_backend/login_security.d.ts +12 -0
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +21 -4
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +0 -2
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -1
- package/dist/testing/cross_backend/request_target_conformance_wire.js +3 -1
- package/dist/testing/cross_backend/revocation_drivers.d.ts +18 -5
- package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
- package/dist/testing/cross_backend/revocation_drivers.js +18 -10
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts +1 -1
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +33 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +183 -30
- package/dist/testing/cross_backend/role_grant_participation.js +4 -4
- package/dist/testing/cross_backend/rpc_adversarial.js +1 -1
- package/dist/testing/cross_backend/session_cap.d.ts +2 -2
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +48 -16
- package/dist/testing/cross_backend/setup.d.ts +31 -1
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +32 -1
- package/dist/testing/cross_backend/spine_suites.d.ts +123 -12
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +454 -57
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +9 -1
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +123 -27
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -2
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +59 -27
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +66 -42
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +7 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts +5 -0
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +54 -8
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -0
- package/dist/testing/db.d.ts +0 -32
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +0 -86
- package/dist/testing/db_entities.d.ts +14 -0
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +17 -0
- package/dist/testing/db_invariant_queries.d.ts +259 -0
- package/dist/testing/db_invariant_queries.d.ts.map +1 -0
- package/dist/testing/db_invariant_queries.js +400 -0
- package/dist/testing/db_invariants.d.ts +106 -0
- package/dist/testing/db_invariants.d.ts.map +1 -0
- package/dist/testing/db_invariants.gen.sql.d.ts +11 -0
- package/dist/testing/db_invariants.gen.sql.d.ts.map +1 -0
- package/dist/testing/db_invariants.gen.sql.js +13 -0
- package/dist/testing/db_invariants.js +141 -0
- package/dist/testing/db_invariants.sql +152 -0
- package/dist/testing/describe_db.d.ts +36 -0
- package/dist/testing/describe_db.d.ts.map +1 -0
- package/dist/testing/describe_db.js +71 -0
- package/dist/testing/integration.d.ts +6 -9
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +9 -13
- package/dist/testing/integration_helpers.d.ts +1 -1
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/middleware.d.ts +1 -1
- package/dist/testing/middleware.js +5 -5
- package/dist/testing/rate_limiting.d.ts +1 -1
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -2
- package/dist/testing/resolved_auth.d.ts +3 -1
- package/dist/testing/resolved_auth.d.ts.map +1 -1
- package/dist/testing/resolved_auth.js +4 -4
- package/dist/testing/role_grant_helpers.d.ts +1 -1
- package/dist/testing/role_grant_helpers.d.ts.map +1 -1
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +3 -0
- package/dist/testing/rpc_attack_surface.d.ts +8 -6
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +69 -6
- package/dist/testing/rpc_round_trip.d.ts +1 -1
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +3 -0
- package/dist/testing/sse_round_trip.d.ts +1 -1
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +13 -4
- package/dist/testing/stubs.d.ts +4 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +15 -7
- package/dist/testing/test_app.d.ts +166 -0
- package/dist/testing/test_app.d.ts.map +1 -0
- package/dist/testing/test_app.js +124 -0
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +8 -4
- package/package.json +1 -1
|
@@ -2,27 +2,32 @@ import './assert_dev_env.js';
|
|
|
2
2
|
import { assert, beforeEach, afterEach } from 'vitest';
|
|
3
3
|
import { format_issue, nullable, object, parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
4
4
|
import { get_audit_metadata_validation_failures, get_audit_unknown_event_type_failures, reset_audit_metadata_validation_failures, reset_audit_unknown_event_type_failures } from '../auth/audit_log_queries.js';
|
|
5
|
-
import { get_audit_write_failures, reset_audit_write_failures } from '../auth/audit_emitter.js';
|
|
5
|
+
import { get_audit_success_outside_transaction, get_audit_write_failures, reset_audit_success_outside_transaction, reset_audit_write_failures } from '../auth/audit_emitter.js';
|
|
6
6
|
import { audit_metadata_schemas } from '../auth/audit_log_schema.js';
|
|
7
7
|
/**
|
|
8
8
|
* Register per-test `beforeEach` + `afterEach` hooks that catch any audit
|
|
9
9
|
* emission with a metadata shape that fails its `audit_metadata_schemas`
|
|
10
|
-
* entry, an `event_type` not present in the active `AuditLogConfig`,
|
|
11
|
-
* row the emitter failed to write
|
|
10
|
+
* entry, an `event_type` not present in the active `AuditLogConfig`, a
|
|
11
|
+
* row the emitter failed to write, or a success row written outside a
|
|
12
|
+
* transaction (`emit` with none open, or `emit_pool`).
|
|
12
13
|
*
|
|
13
14
|
* The production validation in `query_audit_log` is fail-open — it bumps
|
|
14
15
|
* process-wide counters and proceeds, so a regression that emits an
|
|
15
16
|
* undeclared metadata field or a typo'd event-type lands a row that
|
|
16
17
|
* passes downstream queries but breaks forensics. The emitter's pool write
|
|
17
18
|
* is fail-open too: a refused `INSERT` is logged and counted, the request
|
|
18
|
-
* succeeds, and the row is gone.
|
|
19
|
-
*
|
|
19
|
+
* succeeds, and the row is gone. A success row belongs in the transaction of
|
|
20
|
+
* the change it reports; `emit` refuses one with no transaction open by
|
|
21
|
+
* throwing, which a caller can swallow, and `emit_pool` writes one on the
|
|
22
|
+
* pool. Tests that exercise audit emits should fail loudly when any of these
|
|
23
|
+
* happens.
|
|
20
24
|
*
|
|
21
25
|
* Call at the top of every `describe` / `describe_db` block that fires
|
|
22
26
|
* audit writes through `deps.audit.emit`. Resets counters before each
|
|
23
27
|
* test and asserts zero on completion. A test that makes a write fail on
|
|
24
28
|
* purpose calls `reset_audit_write_failures` (`auth/audit_emitter.ts`) once
|
|
25
|
-
* it has asserted the count
|
|
29
|
+
* it has asserted the count, and one that writes a success row outside a
|
|
30
|
+
* transaction on purpose calls `reset_audit_success_outside_transaction`.
|
|
26
31
|
*
|
|
27
32
|
* Pair with `await_pending_effects: true` (the default for
|
|
28
33
|
* `create_test_app`) so fire-and-forget audit writes have completed by
|
|
@@ -33,6 +38,7 @@ export const install_audit_drift_guard = () => {
|
|
|
33
38
|
reset_audit_metadata_validation_failures();
|
|
34
39
|
reset_audit_unknown_event_type_failures();
|
|
35
40
|
reset_audit_write_failures();
|
|
41
|
+
reset_audit_success_outside_transaction();
|
|
36
42
|
});
|
|
37
43
|
afterEach(assert_no_audit_drift);
|
|
38
44
|
};
|
|
@@ -47,6 +53,7 @@ export const assert_no_audit_drift = () => {
|
|
|
47
53
|
assert.strictEqual(get_audit_metadata_validation_failures(), 0, 'audit metadata failed schema validation — see audit_log_schema.audit_metadata_schemas');
|
|
48
54
|
assert.strictEqual(get_audit_unknown_event_type_failures(), 0, 'audit emitted an unknown event_type — see AUDIT_EVENT_TYPES');
|
|
49
55
|
assert.strictEqual(get_audit_write_failures(), 0, 'an audit row failed to write and was lost — the emitter logged the database error');
|
|
56
|
+
assert.strictEqual(get_audit_success_outside_transaction(), 0, 'a success audit row was emitted outside a transaction — write it in the transaction of the change it reports');
|
|
50
57
|
};
|
|
51
58
|
/**
|
|
52
59
|
* Build a no-op `AuditEmitter` that records every `emit`, `emit_pool`, and
|
|
@@ -65,7 +72,7 @@ export const assert_no_audit_drift = () => {
|
|
|
65
72
|
* `listener_count` reports, and returns a remover with the production
|
|
66
73
|
* semantics (per registration, idempotent) — registered listeners never fire,
|
|
67
74
|
* since this emitter captures `emit` shapes, not fan-out. `drain_inflight` resolves at once
|
|
68
|
-
* and `
|
|
75
|
+
* and `inflight_count` answers 0: a recorded call writes nothing, so nothing is
|
|
69
76
|
* ever in flight.
|
|
70
77
|
*
|
|
71
78
|
* `emit` AND `emit_pool` both append to `calls`, so a test reads either
|
|
@@ -122,7 +129,7 @@ export const create_recording_audit_emitter = (calls_ref) => {
|
|
|
122
129
|
},
|
|
123
130
|
listener_count: () => listeners.length,
|
|
124
131
|
drain_inflight: () => Promise.resolve(),
|
|
125
|
-
|
|
132
|
+
inflight_count: () => 0
|
|
126
133
|
};
|
|
127
134
|
return { emitter, calls };
|
|
128
135
|
};
|
|
@@ -45,7 +45,7 @@ export const create_test_app_from_specs = (route_specs, auth_ctx, credential_typ
|
|
|
45
45
|
if (auth_ctx) {
|
|
46
46
|
c.set(RESOLVED_AUTH_KEY, create_test_resolved_auth({
|
|
47
47
|
credential_type: credential_type ?? CREDENTIAL_TYPE_SESSION,
|
|
48
|
-
|
|
48
|
+
account: auth_ctx.account
|
|
49
49
|
}));
|
|
50
50
|
c.set(REQUEST_CONTEXT_KEY, auth_ctx);
|
|
51
51
|
c.set(TEST_CONTEXT_PRESET_KEY, TEST_CONTEXT_PRESET);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/account_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"account_lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/account_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAgF9B,OAAO,KAAK,EAAE,uCAAuC,EAAe,MAAM,YAAY,CAAC;AAQvF;;;;;GAKG;AACH,MAAM,WAAW,gCAAiC,SAAQ,uCAAuC;IAChG,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,6DAA6D;IAC7D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAQD,eAAO,MAAM,sCAAsC,GAClD,SAAS,gCAAgC,KACvC,IAg7BF,CAAC"}
|
|
@@ -21,6 +21,11 @@ import '../assert_dev_env.js';
|
|
|
21
21
|
* an `outcome: 'failure'` row; `admin_account_list` with `include_deleted`
|
|
22
22
|
* lists tombstoned rows with `deleted_at` set.
|
|
23
23
|
*
|
|
24
|
+
* A purge ends the pending offers made to the account before its cascade
|
|
25
|
+
* deletes them, as a delete does — one `role_grant_offer_supersede` row each,
|
|
26
|
+
* `account_deleted` with the account as cause — and the grantor's history no
|
|
27
|
+
* longer lists them: the audit row is what remains.
|
|
28
|
+
*
|
|
24
29
|
* Two credential end states, each proven live before it is killed: a session
|
|
25
30
|
* and an API token minted before a soft delete stay dead after the undelete
|
|
26
31
|
* (the delete removed their rows, and the undelete clears only the
|
|
@@ -169,6 +174,44 @@ export const describe_account_lifecycle_cross_tests = (options) => {
|
|
|
169
174
|
assert.ok(row, 'account_purge writes a success row targeting the victim');
|
|
170
175
|
assert.strictEqual(row.metadata?.username, victim.account.username, 'account_purge snapshots the username');
|
|
171
176
|
});
|
|
177
|
+
test_if(capabilities.account_lifecycle, 'a purge supersedes the offers made to the account, audited, before its cascade deletes them', async () => {
|
|
178
|
+
const fixture = await setup_test();
|
|
179
|
+
const victim = await fixture.create_account({ username: 'lifecycle_purge_offered' });
|
|
180
|
+
const grantor = await fixture.create_account({
|
|
181
|
+
username: 'lifecycle_purge_offerer',
|
|
182
|
+
roles: [ROLE_ADMIN]
|
|
183
|
+
});
|
|
184
|
+
const offer = async (headers, params) => {
|
|
185
|
+
const res = await rpc(fixture, 'role_grant_offer_create', { to_account_id: victim.account.id, role: ROLE_ADMIN, ...params }, headers);
|
|
186
|
+
if (!res.ok)
|
|
187
|
+
assert.fail(`role_grant_offer_create: ${JSON.stringify(res)}`);
|
|
188
|
+
return res.result.offer.id;
|
|
189
|
+
};
|
|
190
|
+
const by_account = await offer(fixture.create_session_headers(), {});
|
|
191
|
+
const by_actor = await offer(grantor.create_session_headers(), {
|
|
192
|
+
to_actor_id: victim.actor.id
|
|
193
|
+
});
|
|
194
|
+
expect_output(await cross_rpc_call(fixture.fresh_transport({ origin: null }), rpc_path, 'account_purge', { account_id: victim.account.id, confirm: true }, fixture.create_daemon_token_headers()), AccountPurgeOutput);
|
|
195
|
+
const supersedes = await list_audit_events(fixture, { event_type: 'role_grant_offer_supersede' }, rpc_path);
|
|
196
|
+
for (const [offer_id, grantor_headers, label] of [
|
|
197
|
+
[by_account, fixture.create_session_headers(), 'the account-addressed offer'],
|
|
198
|
+
[by_actor, grantor.create_session_headers(), 'the actor-addressed offer']
|
|
199
|
+
]) {
|
|
200
|
+
const rows = supersedes.filter((e) => e.metadata?.offer_id === offer_id);
|
|
201
|
+
assert.strictEqual(rows.length, 1, `one role_grant_offer_supersede row for ${label}`);
|
|
202
|
+
assert.strictEqual(rows[0].target_account_id, victim.account.id, label);
|
|
203
|
+
assert_audit_metadata_fields(fixture, rows[0].metadata, {
|
|
204
|
+
offer_id,
|
|
205
|
+
role: ROLE_ADMIN,
|
|
206
|
+
scope_id: null,
|
|
207
|
+
reason: 'account_deleted',
|
|
208
|
+
cause_id: victim.account.id
|
|
209
|
+
});
|
|
210
|
+
// the cascade deleted the row: the audit row is all that remains
|
|
211
|
+
const { offers } = expect_output(await rpc(fixture, 'role_grant_offer_history', {}, grantor_headers), RoleGrantOfferHistoryOutput);
|
|
212
|
+
assert.notInclude(offers.map((o) => o.id), offer_id, `the grantor's history no longer lists ${label}`);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
172
215
|
test_if(capabilities.account_lifecycle, 'keeper guard: delete + purge refuse the keeper account', async () => {
|
|
173
216
|
const fixture = await setup_test();
|
|
174
217
|
const t = fixture.fresh_transport();
|
|
@@ -13,16 +13,19 @@ export interface AuditReadFixture {
|
|
|
13
13
|
readonly reject_unknown_audit_metadata_keys?: boolean;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Await the backend's in-flight
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Await the backend's in-flight detached writes (audit rows; on the Rust
|
|
17
|
+
* spine also the token touch and the bootstrap write) via
|
|
18
|
+
* `_testing_drain_effects`, so a following `audit_log_list` sees every row
|
|
19
|
+
* emitted before the call. The backend must mount the action — every spine
|
|
20
|
+
* test binary does; in-process suites mount
|
|
21
|
+
* `create_testing_drain_effects_action`.
|
|
20
22
|
*
|
|
21
|
-
* Refuses
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* Refuses any answer but exactly `{ok: true}` — what both spines answer once
|
|
24
|
+
* their drains have awaited the backend's in-flight detached writes. A backend
|
|
25
|
+
* answering anything else (an unknown key included) is not the drain this
|
|
26
|
+
* contract names, and its audit reads could race the writes — an absent row
|
|
27
|
+
* then reading as a pass. Every audit read runs through here, so each one
|
|
28
|
+
* checks the barrier is live.
|
|
26
29
|
*
|
|
27
30
|
* @param fixture - the per-test fixture, whose daemon token authorizes the drain
|
|
28
31
|
* @param rpc_path - the RPC endpoint the drain action is mounted on
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_cross_helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/audit_cross_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,s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AAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5F,QAAQ,CAAC,2BAA2B,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjG,8FAA8F;IAC9F,QAAQ,CAAC,kCAAkC,CAAC,EAAE,OAAO,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,SAAS,gBAAgB,EACzB,WAAU,MAAuB,KAC/B,OAAO,CAAC,IAAI,CAcd,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,IAAI,CAAC,gBAAgB,EAAE,oCAAoC,CAAC,EACrE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACxC,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAQ,aAAa,CAAC,MAAM,CAAM,KAChC,IASF,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,GAC7B,SAAS,gBAAgB,EACzB,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,WAAU,MAAuB,KAC/B,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAe/C,CAAC"}
|
|
@@ -21,16 +21,19 @@ import { assert_audit_event_metadata } from '../audit_drift_guard.js';
|
|
|
21
21
|
import { cross_rpc_call, expect_output } from './cross_rpc.js';
|
|
22
22
|
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
23
23
|
/**
|
|
24
|
-
* Await the backend's in-flight
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* Await the backend's in-flight detached writes (audit rows; on the Rust
|
|
25
|
+
* spine also the token touch and the bootstrap write) via
|
|
26
|
+
* `_testing_drain_effects`, so a following `audit_log_list` sees every row
|
|
27
|
+
* emitted before the call. The backend must mount the action — every spine
|
|
28
|
+
* test binary does; in-process suites mount
|
|
29
|
+
* `create_testing_drain_effects_action`.
|
|
28
30
|
*
|
|
29
|
-
* Refuses
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* Refuses any answer but exactly `{ok: true}` — what both spines answer once
|
|
32
|
+
* their drains have awaited the backend's in-flight detached writes. A backend
|
|
33
|
+
* answering anything else (an unknown key included) is not the drain this
|
|
34
|
+
* contract names, and its audit reads could race the writes — an absent row
|
|
35
|
+
* then reading as a pass. Every audit read runs through here, so each one
|
|
36
|
+
* checks the barrier is live.
|
|
34
37
|
*
|
|
35
38
|
* @param fixture - the per-test fixture, whose daemon token authorizes the drain
|
|
36
39
|
* @param rpc_path - the RPC endpoint the drain action is mounted on
|
|
@@ -38,11 +41,7 @@ import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
|
38
41
|
export const cross_drain_effects = async (fixture, rpc_path = SPINE_RPC_PATH) => {
|
|
39
42
|
const drained = await cross_rpc_call(fixture.fresh_transport({ origin: null }), rpc_path, '_testing_drain_effects', undefined, fixture.create_daemon_token_headers());
|
|
40
43
|
assert.ok(drained.ok, `_testing_drain_effects failed: ${JSON.stringify(drained.error)}`);
|
|
41
|
-
|
|
42
|
-
? drained.result.tracked
|
|
43
|
-
: undefined;
|
|
44
|
-
assert.strictEqual(tracked, true, "_testing_drain_effects must answer tracked: true — the backend's audit emitter does not " +
|
|
45
|
-
`track in-flight writes, so the drain waits on nothing (got ${JSON.stringify(drained.result)})`);
|
|
44
|
+
assert.deepStrictEqual(drained.result, { ok: true }, `_testing_drain_effects must answer exactly {ok: true} (got ${JSON.stringify(drained.result)})`);
|
|
46
45
|
};
|
|
47
46
|
/**
|
|
48
47
|
* Assert an audit row's `metadata` carries `expected` — each field compared
|
|
@@ -294,7 +294,9 @@ export interface BackendCapabilities {
|
|
|
294
294
|
* (`_testing_origin_check`), `ws_outbound_overflow`
|
|
295
295
|
* (`_testing_flood_notifications`) — and requires `_testing_put_fact` of a
|
|
296
296
|
* backend declaring `fact_serving` and `_testing_room_evict` of one
|
|
297
|
-
* declaring `rooms`.
|
|
297
|
+
* declaring `rooms`. `default_cross_process_setup` requires
|
|
298
|
+
* `_testing_db_invariants`, its per-test invariant check, unless the setup
|
|
299
|
+
* turns the check off (`exclude_db_invariants: {all: reason}`).
|
|
298
300
|
*
|
|
299
301
|
* fuz_app's spine presets declare every one; the in-process transport none
|
|
300
302
|
* (the backdoor suites are cross-process only).
|
|
@@ -344,12 +346,13 @@ export type FamilyDefaultCapabilities = Omit<BackendCapabilities, MountFlag | 't
|
|
|
344
346
|
export declare const in_process_capabilities: BackendCapabilities;
|
|
345
347
|
/**
|
|
346
348
|
* Conditional `test()` wrapper — registers a vitest case only when
|
|
347
|
-
* `cond` is true; otherwise registers it as
|
|
348
|
-
* surfaces the gated coverage in the
|
|
349
|
+
* `cond` is true; otherwise registers it as a gated skip
|
|
350
|
+
* (`test_skip_gated`), so the run still surfaces the gated coverage in the
|
|
351
|
+
* report and `check_declared_skips` can hold the skip to a declaration.
|
|
349
352
|
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
+
* `test.skipIf(!cond)` with the argument order flipped to match the more
|
|
354
|
+
* readable `test_if(capabilities.ws, ...)` call pattern, and the skip tagged
|
|
355
|
+
* at registration.
|
|
353
356
|
*/
|
|
354
357
|
export declare const test_if: (cond: boolean, name: string, fn: () => void | Promise<void>) => void;
|
|
355
358
|
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/capabilities.ts"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a `MountFlag`) is never inherited, nor is the `testing_backdoors` list: the
|
|
32
32
|
* family defaults are `FamilyDefaultCapabilities`, which omits them, so every
|
|
33
|
-
* backend config states each one
|
|
33
|
+
* backend config states each one, and `describe_capability_mounts_cross_tests`
|
|
34
|
+
* holds each a request can observe to what the backend mounts, `false` as
|
|
35
|
+
* much as `true`. The family defaults carry only what the family guarantees — the
|
|
34
36
|
* declared spine surface's mounts, fallback and host gate (`account_lifecycle`,
|
|
35
37
|
* `account_status`, `spine_fallback`, `host_gate`) and the runtime behavior of its
|
|
36
38
|
* reference runtime (`ws_handshake_pipelining`,
|
|
@@ -46,6 +48,7 @@ import '../assert_dev_env.js';
|
|
|
46
48
|
* @module
|
|
47
49
|
*/
|
|
48
50
|
import { test } from 'vitest';
|
|
51
|
+
import { test_skip_gated } from './declared_skips.js';
|
|
49
52
|
/**
|
|
50
53
|
* The upgrade refusals a runtime makes before the app runs, which
|
|
51
54
|
* `BackendCapabilities.ws_upgrade_runtime_refusals` declares: `empty_host`, an
|
|
@@ -108,18 +111,19 @@ export const in_process_capabilities = Object.freeze({
|
|
|
108
111
|
});
|
|
109
112
|
/**
|
|
110
113
|
* Conditional `test()` wrapper — registers a vitest case only when
|
|
111
|
-
* `cond` is true; otherwise registers it as
|
|
112
|
-
* surfaces the gated coverage in the
|
|
114
|
+
* `cond` is true; otherwise registers it as a gated skip
|
|
115
|
+
* (`test_skip_gated`), so the run still surfaces the gated coverage in the
|
|
116
|
+
* report and `check_declared_skips` can hold the skip to a declaration.
|
|
113
117
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
118
|
+
* `test.skipIf(!cond)` with the argument order flipped to match the more
|
|
119
|
+
* readable `test_if(capabilities.ws, ...)` call pattern, and the skip tagged
|
|
120
|
+
* at registration.
|
|
117
121
|
*/
|
|
118
122
|
export const test_if = (cond, name, fn) => {
|
|
119
123
|
if (cond) {
|
|
120
124
|
test(name, fn);
|
|
121
125
|
}
|
|
122
126
|
else {
|
|
123
|
-
|
|
127
|
+
test_skip_gated(name, fn);
|
|
124
128
|
}
|
|
125
129
|
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import type { BackendCapabilities } from './capabilities.js';
|
|
3
|
+
import type { RpcPathCapabilityGatedCrossSuiteOptions, SetupTest } from './setup.js';
|
|
4
|
+
/** The capability flags a request can observe, each probed in both directions. */
|
|
5
|
+
export type ProbedCapability = keyof Pick<BackendCapabilities, 'ws' | 'sse' | 'cell_crud' | 'cell_relations' | 'fact_serving' | 'fact_serving_admin_hash' | 'ready' | 'account_status' | 'ws_account_actions' | 'ws_role_gated'>;
|
|
6
|
+
/** The capabilities no probe checks — every `BackendCapabilities` key but the probed ones. */
|
|
7
|
+
export type UnprobedCapability = Exclude<keyof BackendCapabilities, ProbedCapability>;
|
|
8
|
+
/**
|
|
9
|
+
* Why each unprobed capability has no probe, shown in the run as a skipped
|
|
10
|
+
* test. Keyed by `UnprobedCapability`, so a new flag fails to compile until it
|
|
11
|
+
* is either probed or listed here.
|
|
12
|
+
*/
|
|
13
|
+
export declare const UNPROBED_CAPABILITIES: Readonly<Record<UnprobedCapability, string>>;
|
|
14
|
+
/** Options for the capability mount suite. */
|
|
15
|
+
export interface CapabilityMountsCrossTestOptions extends RpcPathCapabilityGatedCrossSuiteOptions {
|
|
16
|
+
/** Base URL the backend is reachable at (e.g. `http://localhost:1178`), for the upgrade probes. */
|
|
17
|
+
readonly base_url: string;
|
|
18
|
+
/** WebSocket endpoint path. Default `SPINE_WS_PATH`. */
|
|
19
|
+
readonly ws_path?: string;
|
|
20
|
+
/** Audit-log SSE stream path. Default `SPINE_SSE_PATH`. */
|
|
21
|
+
readonly sse_path?: string;
|
|
22
|
+
/** Role-gated WebSocket endpoint path. Default `SPINE_ROLE_GATED_WS_PATH`. */
|
|
23
|
+
readonly gated_ws_path?: string;
|
|
24
|
+
/** Readiness route path. Default `/ready`. */
|
|
25
|
+
readonly ready_path?: string;
|
|
26
|
+
/**
|
|
27
|
+
* A note per flag, added to that probe's failure — where its path came from
|
|
28
|
+
* and how to move it. `describe_spine_cross_suites` sets one for a flag
|
|
29
|
+
* whose path it reads from a sibling suite the call excludes.
|
|
30
|
+
*/
|
|
31
|
+
readonly path_notes?: Readonly<Partial<Record<ProbedCapability, string>>>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The suite's options with every path resolved — where the probes send. Each
|
|
35
|
+
* of these is a declaration as much as a flag is: a probe sent to the wrong
|
|
36
|
+
* path finds nothing mounted there.
|
|
37
|
+
*
|
|
38
|
+
* @internal Used by the suite's own tests and `describe_spine_cross_suites` — not stable API.
|
|
39
|
+
*/
|
|
40
|
+
export interface CapabilityMountsTarget {
|
|
41
|
+
readonly base_url: string;
|
|
42
|
+
readonly rpc_path: string;
|
|
43
|
+
readonly ws_path: string;
|
|
44
|
+
readonly sse_path: string;
|
|
45
|
+
readonly gated_ws_path: string;
|
|
46
|
+
readonly ready_path: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the suite's paths, each option's default filled.
|
|
50
|
+
*
|
|
51
|
+
* @param options - the suite's options
|
|
52
|
+
* @returns where every probe sends
|
|
53
|
+
* @internal Used by the suite's own tests and `describe_spine_cross_suites`, which derives the
|
|
54
|
+
* suite's options resolved — not stable API.
|
|
55
|
+
*/
|
|
56
|
+
export declare const resolve_capability_mounts_target: (options: Omit<CapabilityMountsCrossTestOptions, "setup_test" | "capabilities">) => CapabilityMountsTarget;
|
|
57
|
+
/**
|
|
58
|
+
* The name the unmounted controls send to: a path segment, RPC method and WS
|
|
59
|
+
* method no backend mounts.
|
|
60
|
+
*/
|
|
61
|
+
export declare const CAPABILITY_MOUNTS_ABSENT = "capability_mounts_absent";
|
|
62
|
+
/** Every probed capability, in the order the suite runs them. */
|
|
63
|
+
export declare const PROBED_CAPABILITIES: ReadonlyArray<ProbedCapability>;
|
|
64
|
+
/**
|
|
65
|
+
* One test the suite registers: its describe group, name, and whether it runs.
|
|
66
|
+
*
|
|
67
|
+
* @internal Used by the suite's own tests — not stable API.
|
|
68
|
+
*/
|
|
69
|
+
export interface CapabilityMountRow {
|
|
70
|
+
readonly group: 'capability mounts' | 'capability mount controls' | 'capability mounts not probed';
|
|
71
|
+
readonly name: string;
|
|
72
|
+
/**
|
|
73
|
+
* `run` sends and checks; `fail` fails at once (a contradictory
|
|
74
|
+
* declaration); `skip` is shown skipped (a flag no request observes);
|
|
75
|
+
* `gated_skip` is a skip the backend's declarations cause, registered
|
|
76
|
+
* through `test_skip_gated` so `check_declared_skips` holds it.
|
|
77
|
+
*/
|
|
78
|
+
readonly mode: 'run' | 'fail' | 'skip' | 'gated_skip';
|
|
79
|
+
/** The check a `run` row makes, or the failure a `fail` row reports. */
|
|
80
|
+
readonly body: (setup_test: SetupTest) => Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Plan the suite's tests from a backend's capabilities and paths — what
|
|
84
|
+
* `describe_capability_mounts_cross_tests` registers, as data, so the
|
|
85
|
+
* classification is checkable without a backend.
|
|
86
|
+
*
|
|
87
|
+
* @param capabilities - the backend's declarations
|
|
88
|
+
* @param target - where the probes send
|
|
89
|
+
* @param path_notes - a note per flag added to its probe's failure
|
|
90
|
+
* @returns every row, in registration order
|
|
91
|
+
* @internal Used by the suite's own tests — not stable API.
|
|
92
|
+
*/
|
|
93
|
+
export declare const plan_capability_mount_rows: (capabilities: BackendCapabilities, target: CapabilityMountsTarget, path_notes?: Readonly<Partial<Record<ProbedCapability, string>>>) => Array<CapabilityMountRow>;
|
|
94
|
+
/**
|
|
95
|
+
* Register the capability mount suite: one probe per `ProbedCapability`, each
|
|
96
|
+
* asserting the backend's answer matches its declaration, the same probe again
|
|
97
|
+
* as an unmounted control, and one skipped test per `UNPROBED_CAPABILITIES`
|
|
98
|
+
* entry naming why.
|
|
99
|
+
*
|
|
100
|
+
* @param options - the fixture, the backend's capabilities, and its paths
|
|
101
|
+
*/
|
|
102
|
+
export declare const describe_capability_mounts_cross_tests: (options: CapabilityMountsCrossTestOptions) => void;
|
|
103
|
+
//# sourceMappingURL=capability_mounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability_mounts.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/capability_mounts.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAyF9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,KAAK,EAAE,uCAAuC,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAUlG,kFAAkF;AAClF,MAAM,MAAM,gBAAgB,GAAG,MAAM,IAAI,CACxC,mBAAmB,EACjB,IAAI,GACJ,KAAK,GACL,WAAW,GACX,gBAAgB,GAChB,cAAc,GACd,yBAAyB,GACzB,OAAO,GACP,gBAAgB,GAChB,oBAAoB,GACpB,eAAe,CACjB,CAAC;AAEF,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAEtF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAqB7E,CAAC;AAEH,8CAA8C;AAC9C,MAAM,WAAW,gCAAiC,SAAQ,uCAAuC;IAChG,mGAAmG;IACnG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CA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