@fuzdev/fuz_app 0.177.0 → 0.179.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.
Files changed (98) hide show
  1. package/dist/actions/CLAUDE.md +117 -12
  2. package/dist/actions/connection_registry.d.ts +18 -0
  3. package/dist/actions/connection_registry.d.ts.map +1 -1
  4. package/dist/actions/connection_registry.js +23 -0
  5. package/dist/actions/room_action_specs.d.ts +733 -0
  6. package/dist/actions/room_action_specs.d.ts.map +1 -0
  7. package/dist/actions/room_action_specs.js +506 -0
  8. package/dist/actions/room_actions.d.ts +276 -0
  9. package/dist/actions/room_actions.d.ts.map +1 -0
  10. package/dist/actions/room_actions.js +394 -0
  11. package/dist/actions/room_client.svelte.d.ts +399 -0
  12. package/dist/actions/room_client.svelte.d.ts.map +1 -0
  13. package/dist/actions/room_client.svelte.js +942 -0
  14. package/dist/actions/room_registry.d.ts +454 -0
  15. package/dist/actions/room_registry.d.ts.map +1 -0
  16. package/dist/actions/room_registry.js +927 -0
  17. package/dist/actions/ws_socket_session.d.ts +2 -2
  18. package/dist/actions/ws_socket_session.js +3 -3
  19. package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
  20. package/dist/auth/role_grant_queries.d.ts +17 -0
  21. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  22. package/dist/auth/role_grant_queries.js +30 -0
  23. package/dist/rtc/rtc_mesh.svelte.d.ts +102 -0
  24. package/dist/rtc/rtc_mesh.svelte.d.ts.map +1 -0
  25. package/dist/rtc/rtc_mesh.svelte.js +232 -0
  26. package/dist/rtc/rtc_peer.svelte.d.ts +180 -0
  27. package/dist/rtc/rtc_peer.svelte.d.ts.map +1 -0
  28. package/dist/rtc/rtc_peer.svelte.js +397 -0
  29. package/dist/rtc/rtc_signal.d.ts +74 -0
  30. package/dist/rtc/rtc_signal.d.ts.map +1 -0
  31. package/dist/rtc/rtc_signal.js +87 -0
  32. package/dist/server/app_server.d.ts +16 -27
  33. package/dist/server/app_server.d.ts.map +1 -1
  34. package/dist/server/app_server.js +7 -9
  35. package/dist/testing/CLAUDE.md +72 -18
  36. package/dist/testing/cross_backend/action_manifest.d.ts +34 -2
  37. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  38. package/dist/testing/cross_backend/action_manifest.js +33 -6
  39. package/dist/testing/cross_backend/capabilities.d.ts +23 -5
  40. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  41. package/dist/testing/cross_backend/capabilities.js +4 -1
  42. package/dist/testing/cross_backend/default_backend_configs.js +1 -1
  43. package/dist/testing/cross_backend/full_spine_mount.d.ts +31 -6
  44. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  45. package/dist/testing/cross_backend/full_spine_mount.js +45 -13
  46. package/dist/testing/cross_backend/rooms_ws.d.ts +20 -0
  47. package/dist/testing/cross_backend/rooms_ws.d.ts.map +1 -0
  48. package/dist/testing/cross_backend/rooms_ws.js +534 -0
  49. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
  50. package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +4 -1
  51. package/dist/testing/cross_backend/spine_suites.d.ts +5 -2
  52. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  53. package/dist/testing/cross_backend/spine_suites.js +24 -5
  54. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  55. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  56. package/dist/testing/cross_backend/spine_surface_constants.js +2 -1
  57. package/dist/testing/cross_backend/test_room_authorize.d.ts +47 -0
  58. package/dist/testing/cross_backend/test_room_authorize.d.ts.map +1 -0
  59. package/dist/testing/cross_backend/test_room_authorize.js +58 -0
  60. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  61. package/dist/testing/cross_backend/testing_backdoor.js +10 -4
  62. package/dist/testing/cross_backend/testing_reset_actions.d.ts +85 -1
  63. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  64. package/dist/testing/cross_backend/testing_reset_actions.js +57 -3
  65. package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
  66. package/dist/testing/cross_backend/testing_server_bun.js +6 -7
  67. package/dist/testing/cross_backend/testing_server_core.d.ts +23 -37
  68. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  69. package/dist/testing/cross_backend/testing_server_core.js +1 -8
  70. package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
  71. package/dist/testing/cross_backend/testing_server_node.js +35 -46
  72. package/dist/testing/cross_backend/transport_composition.js +2 -2
  73. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  74. package/dist/testing/cross_backend/ts_spine_backend_config.js +6 -3
  75. package/dist/testing/stubs.d.ts +1 -1
  76. package/dist/testing/stubs.js +1 -1
  77. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
  78. package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
  79. package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
  80. package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
  81. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  82. package/dist/ui/AdminRoleGrantHistory.svelte.d.ts.map +1 -1
  83. package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
  84. package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
  85. package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
  86. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  87. package/dist/ui/ConfirmButton.svelte.d.ts.map +1 -1
  88. package/dist/ui/Datatable.svelte.d.ts.map +1 -1
  89. package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
  90. package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
  91. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
  92. package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
  93. package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
  94. package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -1
  95. package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
  96. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  97. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  98. package/package.json +21 -26
@@ -1,6 +1,10 @@
1
1
  import '../assert_dev_env.js';
2
+ import { ConnectionRegistry } from '../../actions/connection_registry.js';
2
3
  import { peer_ping_action } from '../../actions/peer_ping.js';
3
4
  import { protocol_actions } from '../../actions/protocol.js';
5
+ import { room_notification_actions } from '../../actions/room_action_specs.js';
6
+ import { create_room_actions, DEFAULT_ROOM_RATE_LIMIT, RoomRateLimiter } from '../../actions/room_actions.js';
7
+ import { RoomRegistry } from '../../actions/room_registry.js';
4
8
  import { create_standard_rpc_actions } from '../../auth/standard_rpc_actions.js';
5
9
  import { create_all_cell_actions } from '../../auth/all_cell_actions.js';
6
10
  import { create_actor_lookup_actions } from '../../auth/actor_lookup_actions.js';
@@ -8,7 +12,8 @@ import { create_actor_search_actions } from '../../auth/actor_search_actions.js'
8
12
  import { create_stub_app_deps } from '../stubs.js';
9
13
  import { CELL_DROP_TABLES } from '../../db/cell_ddl.js';
10
14
  import { FACT_DROP_TABLES } from '../../db/fact_ddl.js';
11
- import { create_testing_action_manifest_action, create_testing_actions, create_testing_shorten_credential_expiry_action } from './testing_reset_actions.js';
15
+ import { create_testing_action_manifest_action, create_testing_actions, create_testing_room_evict_action, create_testing_shorten_credential_expiry_action } from './testing_reset_actions.js';
16
+ import { test_room_authorize } from './test_room_authorize.js';
12
17
  import { create_testing_origin_check_action } from './testing_origin_check.js';
13
18
  import { test_cell_gated_create_authorize } from './test_cell_gated_create_authorize.js';
14
19
  import { test_cell_grant_steward_revoke_authorize } from './test_cell_grant_steward_revoke_authorize.js';
@@ -24,14 +29,26 @@ import { SPINE_RPC_PATH } from './spine_surface_constants.js';
24
29
  */
25
30
  const SPINE_DOMAIN_RESET_TABLES = [...CELL_DROP_TABLES, ...FACT_DROP_TABLES];
26
31
  /**
27
- * `_testing_reset`'s `reset_state` for the full spine mount — empties
28
- * `SPINE_DOMAIN_RESET_TABLES` on the reset's own transaction.
32
+ * `_testing_reset`'s `reset_state` for the full spine mount — drops every
33
+ * room, silently, so no seat or watch outlives its test, then empties
34
+ * `SPINE_DOMAIN_RESET_TABLES` on the reset's own transaction. The Rust stub's
35
+ * reset does the same, in the same order.
29
36
  */
30
- const reset_spine_domain_state = async (db) => {
37
+ const create_reset_spine_domain_state = (room_registry) => async (db) => {
38
+ room_registry.clear();
31
39
  for (const table of SPINE_DOMAIN_RESET_TABLES) {
32
40
  await db.query(`DELETE FROM ${table}`);
33
41
  }
34
42
  };
43
+ /**
44
+ * The spine binary's room registry over `connections`: exclusive — one seat
45
+ * per actor, the newest admitted winning, with the rejoin guard — at the
46
+ * default bounds. Twin of the Rust stub's `stub_room_registry`.
47
+ *
48
+ * @param connections - the connection registry the binary's WS endpoints share
49
+ * @returns the registry its room verbs and `_testing_room_evict` run on
50
+ */
51
+ export const create_spine_room_registry = (connections) => new RoomRegistry(connections, { exclusive: true });
35
52
  /**
36
53
  * Build the complete live RPC action list the spine test binary mounts on
37
54
  * its single endpoint: the declared `create_standard_rpc_actions` bundle plus
@@ -43,16 +60,27 @@ const reset_spine_domain_state = async (db) => {
43
60
  * runtime-varying inputs are the daemon-token state + notification sender.
44
61
  *
45
62
  * @param deps - the backend `AppDeps` (stub deps suffice for method enumeration)
46
- * @param options - daemon-token state + optional WS notification sender
63
+ * @param options - daemon-token state + optional WS notification sender and room registry
47
64
  * @returns every `RpcAction` the binary exposes, in mount order
48
65
  */
49
- export const build_full_spine_rpc_actions = (deps, options) => {
66
+ export const build_full_spine_rpc_actions = (deps, options) => build_full_spine_actions(deps, options).rpc_actions;
67
+ const build_full_spine_actions = (deps, options) => {
68
+ const room_registry = options.room_registry ?? create_spine_room_registry(new ConnectionRegistry({ log: null }));
69
+ // The room verbs, WS-only, over the test authorizer (twin of the Rust stub's
70
+ // `TestRoomAuthorize`) — the limiter on at the defaults, which no cross case
71
+ // nears unless it means to (it is per connection, so a fresh socket starts
72
+ // with a full budget), as on the stub.
73
+ const room_actions = create_room_actions({
74
+ registry: room_registry,
75
+ authorize: test_room_authorize,
76
+ limiter: new RoomRateLimiter(DEFAULT_ROOM_RATE_LIMIT)
77
+ });
50
78
  const actions = [
51
79
  ...create_standard_rpc_actions({ ...deps, notification_sender: options.notification_sender ?? null }, { roles: spine_roles }),
52
80
  ...create_testing_actions(deps, {
53
81
  session_options: spine_session_options,
54
82
  daemon_token_state: options.daemon_token_state,
55
- reset_state: reset_spine_domain_state
83
+ reset_state: create_reset_spine_domain_state(room_registry)
56
84
  }),
57
85
  // Mount the directory-model `cell_gated_create` test policy (twin of the
58
86
  // Rust stub's `TestCellGatedCreateAuthorize`) so the cross-backend
@@ -77,6 +105,8 @@ export const build_full_spine_rpc_actions = (deps, options) => {
77
105
  // the credential-deadline suite's shorten-only seam — kept out of
78
106
  // `create_testing_actions` for the same reason
79
107
  create_testing_shorten_credential_expiry_action(),
108
+ // the rooms suite's eviction seam, over the registry the room verbs run on
109
+ create_testing_room_evict_action(room_registry),
80
110
  // `peer/ping` is mounted on the HTTP RPC endpoint too (not just WS) so an
81
111
  // HTTP invocation reaches the handler and refuses with `peer_no_transport`
82
112
  // rather than `method_not_found`. It's a protocol action, so it's filtered
@@ -87,9 +117,9 @@ export const build_full_spine_rpc_actions = (deps, options) => {
87
117
  // Append the `_testing_action_manifest` backdoor last — it closes over the
88
118
  // complete `actions` list (plus its own spec) to dump the live method set
89
119
  // for the cross-impl manifest-parity gate, so it must come after every
90
- // method it enumerates.
91
- actions.push(create_testing_action_manifest_action(actions));
92
- return actions;
120
+ // method it enumerates. The room verbs join it as `transport: 'ws'`.
121
+ actions.push(create_testing_action_manifest_action(actions, room_actions));
122
+ return { rpc_actions: actions, room_actions };
93
123
  };
94
124
  /**
95
125
  * Build the full live mount for both of the spine binary's endpoints: the
@@ -104,17 +134,19 @@ export const build_full_spine_rpc_actions = (deps, options) => {
104
134
  * (never dispatched) on Rust.
105
135
  *
106
136
  * @param deps - the backend `AppDeps`
107
- * @param options - daemon-token state + optional WS notification sender
137
+ * @param options - daemon-token state + optional WS notification sender and room registry
108
138
  * @returns the RPC and WS action lists, built once and sharing handler instances
109
139
  */
110
140
  export const build_full_spine_mount = (deps, options) => {
111
- const rpc_actions = build_full_spine_rpc_actions(deps, options);
141
+ const { rpc_actions, room_actions } = build_full_spine_actions(deps, options);
112
142
  const protocol_methods = new Set(protocol_actions.map((action) => action.spec.method));
113
143
  return {
114
144
  rpc_actions,
115
145
  ws_actions: [
116
146
  ...protocol_actions,
117
- ...rpc_actions.filter((action) => !protocol_methods.has(action.spec.method))
147
+ ...rpc_actions.filter((action) => !protocol_methods.has(action.spec.method)),
148
+ ...room_actions,
149
+ ...room_notification_actions
118
150
  ]
119
151
  };
120
152
  };
@@ -0,0 +1,20 @@
1
+ import '../assert_dev_env.js';
2
+ import { type BackendCapabilities } from './capabilities.js';
3
+ import type { SetupTest } from './setup.js';
4
+ import { type WsEndpointTarget } from './ws_endpoint.js';
5
+ /** Configuration for `describe_rooms_ws_cross_tests`. */
6
+ export interface RoomsWsCrossTestOptions extends WsEndpointTarget {
7
+ /** Per-test fixture producer (`default_cross_process_setup(handle)`). */
8
+ readonly setup_test: SetupTest;
9
+ /** Backend capability flags; every case gates on `ws` and `rooms`. */
10
+ readonly capabilities: BackendCapabilities;
11
+ /** JSON-RPC endpoint path. Default `SPINE_RPC_PATH`. */
12
+ readonly rpc_path?: string;
13
+ }
14
+ /**
15
+ * Register the rooms suite (module doc).
16
+ *
17
+ * @param options - the backend, its capabilities, and the fixture producer
18
+ */
19
+ export declare const describe_rooms_ws_cross_tests: (options: RoomsWsCrossTestOptions) => void;
20
+ //# sourceMappingURL=rooms_ws.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rooms_ws.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rooms_ws.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAgE9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAmB,KAAK,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAKjG,yDAAyD;AACzD,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAChE,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAgBD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GAAI,SAAS,uBAAuB,KAAG,IA4qBhF,CAAC"}