@quenty/studio-bridge 0.21.1 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +109 -17
- package/build-scripts/transform-add-session-attribute.lua +1 -0
- package/deploy.nevermore.json +10 -0
- package/dist/src/bridge/bridge-connection.d.ts +26 -2
- package/dist/src/bridge/bridge-connection.d.ts.map +1 -1
- package/dist/src/bridge/bridge-connection.js +159 -14
- package/dist/src/bridge/bridge-connection.js.map +1 -1
- package/dist/src/bridge/bridge-connection.test.js +81 -0
- package/dist/src/bridge/bridge-connection.test.js.map +1 -1
- package/dist/src/bridge/bridge-session.d.ts +35 -2
- package/dist/src/bridge/bridge-session.d.ts.map +1 -1
- package/dist/src/bridge/bridge-session.js +185 -28
- package/dist/src/bridge/bridge-session.js.map +1 -1
- package/dist/src/bridge/bridge-session.test.js +6 -4
- package/dist/src/bridge/bridge-session.test.js.map +1 -1
- package/dist/src/bridge/index.d.ts +1 -1
- package/dist/src/bridge/index.d.ts.map +1 -1
- package/dist/src/bridge/index.js.map +1 -1
- package/dist/src/bridge/internal/bridge-client.d.ts +4 -0
- package/dist/src/bridge/internal/bridge-client.d.ts.map +1 -1
- package/dist/src/bridge/internal/bridge-client.js +20 -7
- package/dist/src/bridge/internal/bridge-client.js.map +1 -1
- package/dist/src/bridge/internal/bridge-client.test.js +18 -0
- package/dist/src/bridge/internal/bridge-client.test.js.map +1 -1
- package/dist/src/bridge/internal/bridge-host.d.ts +13 -1
- package/dist/src/bridge/internal/bridge-host.d.ts.map +1 -1
- package/dist/src/bridge/internal/bridge-host.js +35 -0
- package/dist/src/bridge/internal/bridge-host.js.map +1 -1
- package/dist/src/bridge/internal/bridge-host.test.js +31 -0
- package/dist/src/bridge/internal/bridge-host.test.js.map +1 -1
- package/dist/src/bridge/internal/hand-off.d.ts.map +1 -1
- package/dist/src/bridge/internal/hand-off.js +4 -1
- package/dist/src/bridge/internal/hand-off.js.map +1 -1
- package/dist/src/bridge/internal/host-protocol.d.ts +8 -0
- package/dist/src/bridge/internal/host-protocol.d.ts.map +1 -1
- package/dist/src/bridge/internal/host-protocol.js +120 -13
- package/dist/src/bridge/internal/host-protocol.js.map +1 -1
- package/dist/src/bridge/internal/host-protocol.test.js +13 -0
- package/dist/src/bridge/internal/host-protocol.test.js.map +1 -1
- package/dist/src/bridge/internal/instance-state.d.ts +9 -0
- package/dist/src/bridge/internal/instance-state.d.ts.map +1 -0
- package/dist/src/bridge/internal/instance-state.js +28 -0
- package/dist/src/bridge/internal/instance-state.js.map +1 -0
- package/dist/src/bridge/internal/transport-client.d.ts.map +1 -1
- package/dist/src/bridge/internal/transport-client.js +2 -1
- package/dist/src/bridge/internal/transport-client.js.map +1 -1
- package/dist/src/bridge/internal/transport-server.d.ts.map +1 -1
- package/dist/src/bridge/internal/transport-server.js +5 -1
- package/dist/src/bridge/internal/transport-server.js.map +1 -1
- package/dist/src/bridge/types.d.ts +43 -4
- package/dist/src/bridge/types.d.ts.map +1 -1
- package/dist/src/bridge/types.js.map +1 -1
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.js +24 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.js.map +1 -1
- package/dist/src/cli/adapters/cli-command-adapter.d.ts +6 -0
- package/dist/src/cli/adapters/cli-command-adapter.d.ts.map +1 -1
- package/dist/src/cli/adapters/cli-command-adapter.js +107 -11
- package/dist/src/cli/adapters/cli-command-adapter.js.map +1 -1
- package/dist/src/cli/adapters/group-builder.d.ts +3 -0
- package/dist/src/cli/adapters/group-builder.d.ts.map +1 -1
- package/dist/src/cli/adapters/group-builder.js +34 -15
- package/dist/src/cli/adapters/group-builder.js.map +1 -1
- package/dist/src/cli/adapters/group-builder.test.js +26 -2
- package/dist/src/cli/adapters/group-builder.test.js.map +1 -1
- package/dist/src/cli/adapters/help-formatter.d.ts.map +1 -1
- package/dist/src/cli/adapters/help-formatter.js +4 -3
- package/dist/src/cli/adapters/help-formatter.js.map +1 -1
- package/dist/src/cli/adapters/help-formatter.test.js +1 -1
- package/dist/src/cli/adapters/help-formatter.test.js.map +1 -1
- package/dist/src/cli/adapters/playtest-edit-guard.test.d.ts +2 -0
- package/dist/src/cli/adapters/playtest-edit-guard.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/playtest-edit-guard.test.js +28 -0
- package/dist/src/cli/adapters/playtest-edit-guard.test.js.map +1 -0
- package/dist/src/cli/args/global-args.d.ts +1 -1
- package/dist/src/cli/args/global-args.d.ts.map +1 -1
- package/dist/src/cli/cli-output-context.d.ts +14 -0
- package/dist/src/cli/cli-output-context.d.ts.map +1 -0
- package/dist/src/cli/cli-output-context.js +39 -0
- package/dist/src/cli/cli-output-context.js.map +1 -0
- package/dist/src/cli/cli-output-context.test.d.ts +2 -0
- package/dist/src/cli/cli-output-context.test.d.ts.map +1 -0
- package/dist/src/cli/cli-output-context.test.js +38 -0
- package/dist/src/cli/cli-output-context.test.js.map +1 -0
- package/dist/src/cli/cli.js +40 -17
- package/dist/src/cli/cli.js.map +1 -1
- package/dist/src/cli/managed-studio-run.d.ts +21 -0
- package/dist/src/cli/managed-studio-run.d.ts.map +1 -0
- package/dist/src/cli/managed-studio-run.js +75 -0
- package/dist/src/cli/managed-studio-run.js.map +1 -0
- package/dist/src/cli/managed-studio-run.test.d.ts +2 -0
- package/dist/src/cli/managed-studio-run.test.d.ts.map +1 -0
- package/dist/src/cli/managed-studio-run.test.js +52 -0
- package/dist/src/cli/managed-studio-run.test.js.map +1 -0
- package/dist/src/cli/resolve-session.js +1 -1
- package/dist/src/cli/resolve-session.js.map +1 -1
- package/dist/src/cli/resolve-session.test.js +1 -1
- package/dist/src/cli/resolve-session.test.js.map +1 -1
- package/dist/src/cli/script-executor.d.ts +13 -1
- package/dist/src/cli/script-executor.d.ts.map +1 -1
- package/dist/src/cli/script-executor.js +77 -47
- package/dist/src/cli/script-executor.js.map +1 -1
- package/dist/src/commands/console/exec/exec.d.ts +17 -0
- package/dist/src/commands/console/exec/exec.d.ts.map +1 -1
- package/dist/src/commands/console/exec/exec.js +39 -7
- package/dist/src/commands/console/exec/exec.js.map +1 -1
- package/dist/src/commands/console/exec/exec.test.js +62 -3
- package/dist/src/commands/console/exec/exec.test.js.map +1 -1
- package/dist/src/commands/console/logs/logs.d.ts +30 -2
- package/dist/src/commands/console/logs/logs.d.ts.map +1 -1
- package/dist/src/commands/console/logs/logs.js +82 -7
- package/dist/src/commands/console/logs/logs.js.map +1 -1
- package/dist/src/commands/console/logs/logs.test.js +63 -4
- package/dist/src/commands/console/logs/logs.test.js.map +1 -1
- package/dist/src/commands/explorer/export/export.d.ts +19 -0
- package/dist/src/commands/explorer/export/export.d.ts.map +1 -0
- package/dist/src/commands/explorer/export/export.js +37 -0
- package/dist/src/commands/explorer/export/export.js.map +1 -0
- package/dist/src/commands/explorer/export/export.test.d.ts +2 -0
- package/dist/src/commands/explorer/export/export.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/export/export.test.js +25 -0
- package/dist/src/commands/explorer/export/export.test.js.map +1 -0
- package/dist/src/commands/explorer/find/find.d.ts +28 -0
- package/dist/src/commands/explorer/find/find.d.ts.map +1 -0
- package/dist/src/commands/explorer/find/find.js +75 -0
- package/dist/src/commands/explorer/find/find.js.map +1 -0
- package/dist/src/commands/explorer/find/find.test.d.ts +2 -0
- package/dist/src/commands/explorer/find/find.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/find/find.test.js +44 -0
- package/dist/src/commands/explorer/find/find.test.js.map +1 -0
- package/dist/src/commands/explorer/grep/grep.d.ts +24 -0
- package/dist/src/commands/explorer/grep/grep.d.ts.map +1 -0
- package/dist/src/commands/explorer/grep/grep.js +63 -0
- package/dist/src/commands/explorer/grep/grep.js.map +1 -0
- package/dist/src/commands/explorer/grep/grep.test.d.ts +2 -0
- package/dist/src/commands/explorer/grep/grep.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/grep/grep.test.js +42 -0
- package/dist/src/commands/explorer/grep/grep.test.js.map +1 -0
- package/dist/src/commands/explorer/import/import.d.ts +21 -0
- package/dist/src/commands/explorer/import/import.d.ts.map +1 -0
- package/dist/src/commands/explorer/import/import.js +37 -0
- package/dist/src/commands/explorer/import/import.js.map +1 -0
- package/dist/src/commands/explorer/import/import.test.d.ts +2 -0
- package/dist/src/commands/explorer/import/import.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/import/import.test.js +45 -0
- package/dist/src/commands/explorer/import/import.test.js.map +1 -0
- package/dist/src/commands/formatters.test.js +7 -1
- package/dist/src/commands/formatters.test.js.map +1 -1
- package/dist/src/commands/framework/action-loader.d.ts +5 -1
- package/dist/src/commands/framework/action-loader.d.ts.map +1 -1
- package/dist/src/commands/framework/action-loader.js +9 -2
- package/dist/src/commands/framework/action-loader.js.map +1 -1
- package/dist/src/commands/framework/action-loader.test.js +23 -0
- package/dist/src/commands/framework/action-loader.test.js.map +1 -1
- package/dist/src/commands/framework/arg-builder.d.ts +15 -2
- package/dist/src/commands/framework/arg-builder.d.ts.map +1 -1
- package/dist/src/commands/framework/arg-builder.js +22 -2
- package/dist/src/commands/framework/arg-builder.js.map +1 -1
- package/dist/src/commands/framework/define-command.d.ts +19 -3
- package/dist/src/commands/framework/define-command.d.ts.map +1 -1
- package/dist/src/commands/framework/define-command.js.map +1 -1
- package/dist/src/commands/framework/index.d.ts +1 -1
- package/dist/src/commands/framework/index.d.ts.map +1 -1
- package/dist/src/commands/framework/index.js.map +1 -1
- package/dist/src/commands/index.d.ts +11 -0
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +11 -0
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/linux/inject-credentials/inject-credentials.d.ts.map +1 -1
- package/dist/src/commands/linux/inject-credentials/inject-credentials.js +1 -3
- package/dist/src/commands/linux/inject-credentials/inject-credentials.js.map +1 -1
- package/dist/src/commands/linux/setup/setup.d.ts.map +1 -1
- package/dist/src/commands/linux/setup/setup.js +1 -3
- package/dist/src/commands/linux/setup/setup.js.map +1 -1
- package/dist/src/commands/linux/status/status.d.ts +9 -1
- package/dist/src/commands/linux/status/status.d.ts.map +1 -1
- package/dist/src/commands/linux/status/status.js +66 -86
- package/dist/src/commands/linux/status/status.js.map +1 -1
- package/dist/src/commands/playtest/player/add/add.d.ts +17 -0
- package/dist/src/commands/playtest/player/add/add.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/add/add.js +45 -0
- package/dist/src/commands/playtest/player/add/add.js.map +1 -0
- package/dist/src/commands/playtest/player/list/list.d.ts +13 -0
- package/dist/src/commands/playtest/player/list/list.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/list/list.js +33 -0
- package/dist/src/commands/playtest/player/list/list.js.map +1 -0
- package/dist/src/commands/playtest/player/playtest-players.d.ts +36 -0
- package/dist/src/commands/playtest/player/playtest-players.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/playtest-players.js +187 -0
- package/dist/src/commands/playtest/player/playtest-players.js.map +1 -0
- package/dist/src/commands/playtest/player/playtest-players.test.d.ts +2 -0
- package/dist/src/commands/playtest/player/playtest-players.test.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/playtest-players.test.js +89 -0
- package/dist/src/commands/playtest/player/playtest-players.test.js.map +1 -0
- package/dist/src/commands/playtest/player/remove/remove.d.ts +17 -0
- package/dist/src/commands/playtest/player/remove/remove.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/remove/remove.js +42 -0
- package/dist/src/commands/playtest/player/remove/remove.js.map +1 -0
- package/dist/src/commands/playtest/playtest-sessions.d.ts +49 -0
- package/dist/src/commands/playtest/playtest-sessions.d.ts.map +1 -0
- package/dist/src/commands/playtest/playtest-sessions.js +283 -0
- package/dist/src/commands/playtest/playtest-sessions.js.map +1 -0
- package/dist/src/commands/playtest/playtest-sessions.test.d.ts +2 -0
- package/dist/src/commands/playtest/playtest-sessions.test.d.ts.map +1 -0
- package/dist/src/commands/playtest/playtest-sessions.test.js +87 -0
- package/dist/src/commands/playtest/playtest-sessions.test.js.map +1 -0
- package/dist/src/commands/playtest/restart/restart.d.ts +23 -0
- package/dist/src/commands/playtest/restart/restart.d.ts.map +1 -0
- package/dist/src/commands/playtest/restart/restart.js +105 -0
- package/dist/src/commands/playtest/restart/restart.js.map +1 -0
- package/dist/src/commands/playtest/run/run.d.ts +47 -0
- package/dist/src/commands/playtest/run/run.d.ts.map +1 -0
- package/dist/src/commands/playtest/run/run.js +137 -0
- package/dist/src/commands/playtest/run/run.js.map +1 -0
- package/dist/src/commands/playtest/start/start.d.ts +42 -0
- package/dist/src/commands/playtest/start/start.d.ts.map +1 -0
- package/dist/src/commands/playtest/start/start.js +70 -0
- package/dist/src/commands/playtest/start/start.js.map +1 -0
- package/dist/src/commands/playtest/stop/stop.d.ts +15 -0
- package/dist/src/commands/playtest/stop/stop.d.ts.map +1 -0
- package/dist/src/commands/playtest/stop/stop.js +24 -0
- package/dist/src/commands/playtest/stop/stop.js.map +1 -0
- package/dist/src/commands/process/close/close.d.ts +19 -10
- package/dist/src/commands/process/close/close.d.ts.map +1 -1
- package/dist/src/commands/process/close/close.js +118 -15
- package/dist/src/commands/process/close/close.js.map +1 -1
- package/dist/src/commands/process/close/close.test.d.ts +2 -0
- package/dist/src/commands/process/close/close.test.d.ts.map +1 -0
- package/dist/src/commands/process/close/close.test.js +190 -0
- package/dist/src/commands/process/close/close.test.js.map +1 -0
- package/dist/src/commands/process/info/info.d.ts +45 -5
- package/dist/src/commands/process/info/info.d.ts.map +1 -1
- package/dist/src/commands/process/info/info.js +117 -13
- package/dist/src/commands/process/info/info.js.map +1 -1
- package/dist/src/commands/process/info/info.test.js +140 -38
- package/dist/src/commands/process/info/info.test.js.map +1 -1
- package/dist/src/commands/process/launch/launch.d.ts +11 -1
- package/dist/src/commands/process/launch/launch.d.ts.map +1 -1
- package/dist/src/commands/process/launch/launch.js +37 -7
- package/dist/src/commands/process/launch/launch.js.map +1 -1
- package/dist/src/commands/process/launch/launch.test.js +99 -20
- package/dist/src/commands/process/launch/launch.test.js.map +1 -1
- package/dist/src/commands/process/list/list.d.ts +2 -1
- package/dist/src/commands/process/list/list.d.ts.map +1 -1
- package/dist/src/commands/process/list/list.js +9 -6
- package/dist/src/commands/process/list/list.js.map +1 -1
- package/dist/src/commands/process/list/list.test.js +1 -0
- package/dist/src/commands/process/list/list.test.js.map +1 -1
- package/dist/src/commands/process/run/run.d.ts +9 -0
- package/dist/src/commands/process/run/run.d.ts.map +1 -1
- package/dist/src/commands/process/run/run.js +15 -5
- package/dist/src/commands/process/run/run.js.map +1 -1
- package/dist/src/commands/serve/serve.d.ts +2 -0
- package/dist/src/commands/serve/serve.d.ts.map +1 -1
- package/dist/src/commands/serve/serve.js +17 -4
- package/dist/src/commands/serve/serve.js.map +1 -1
- package/dist/src/commands/serve/serve.test.js +9 -2
- package/dist/src/commands/serve/serve.test.js.map +1 -1
- package/dist/src/commands/viewport/screenshot/screenshot.d.ts.map +1 -1
- package/dist/src/commands/viewport/screenshot/screenshot.js +4 -1
- package/dist/src/commands/viewport/screenshot/screenshot.js.map +1 -1
- package/dist/src/commands/viewport/screenshot/screenshot.test.js +5 -9
- package/dist/src/commands/viewport/screenshot/screenshot.test.js.map +1 -1
- package/dist/src/deploy/deploy-places.d.ts +39 -0
- package/dist/src/deploy/deploy-places.d.ts.map +1 -0
- package/dist/src/deploy/deploy-places.js +162 -0
- package/dist/src/deploy/deploy-places.js.map +1 -0
- package/dist/src/deploy/deploy-places.test.d.ts +2 -0
- package/dist/src/deploy/deploy-places.test.d.ts.map +1 -0
- package/dist/src/deploy/deploy-places.test.js +96 -0
- package/dist/src/deploy/deploy-places.test.js.map +1 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/plugin/persistent-plugin-installer.d.ts.map +1 -1
- package/dist/src/plugin/persistent-plugin-installer.js +2 -1
- package/dist/src/plugin/persistent-plugin-installer.js.map +1 -1
- package/dist/src/plugin/persistent-plugin-installer.test.js +3 -0
- package/dist/src/plugin/persistent-plugin-installer.test.js.map +1 -1
- package/dist/src/plugin/plugin-build-version.d.ts +7 -0
- package/dist/src/plugin/plugin-build-version.d.ts.map +1 -0
- package/dist/src/plugin/plugin-build-version.js +42 -0
- package/dist/src/plugin/plugin-build-version.js.map +1 -0
- package/dist/src/plugin/plugin-build-version.test.d.ts +2 -0
- package/dist/src/plugin/plugin-build-version.test.d.ts.map +1 -0
- package/dist/src/plugin/plugin-build-version.test.js +41 -0
- package/dist/src/plugin/plugin-build-version.test.js.map +1 -0
- package/dist/src/plugin/plugin-injector.d.ts.map +1 -1
- package/dist/src/plugin/plugin-injector.js +7 -1
- package/dist/src/plugin/plugin-injector.js.map +1 -1
- package/dist/src/process/studio-process-closer.d.ts +35 -0
- package/dist/src/process/studio-process-closer.d.ts.map +1 -0
- package/dist/src/process/studio-process-closer.js +129 -0
- package/dist/src/process/studio-process-closer.js.map +1 -0
- package/dist/src/process/studio-process-closer.test.d.ts +2 -0
- package/dist/src/process/studio-process-closer.test.d.ts.map +1 -0
- package/dist/src/process/studio-process-closer.test.js +80 -0
- package/dist/src/process/studio-process-closer.test.js.map +1 -0
- package/dist/src/process/studio-settings.d.ts +14 -0
- package/dist/src/process/studio-settings.d.ts.map +1 -0
- package/dist/src/process/studio-settings.js +50 -0
- package/dist/src/process/studio-settings.js.map +1 -0
- package/dist/src/process/studio-settings.test.d.ts +2 -0
- package/dist/src/process/studio-settings.test.d.ts.map +1 -0
- package/dist/src/process/studio-settings.test.js +16 -0
- package/dist/src/process/studio-settings.test.js.map +1 -0
- package/dist/src/process/studio-window-state.d.ts +13 -0
- package/dist/src/process/studio-window-state.d.ts.map +1 -0
- package/dist/src/process/studio-window-state.js +48 -0
- package/dist/src/process/studio-window-state.js.map +1 -0
- package/dist/src/server/studio-bridge-server.d.ts +3 -1
- package/dist/src/server/studio-bridge-server.d.ts.map +1 -1
- package/dist/src/server/studio-bridge-server.js +12 -4
- package/dist/src/server/studio-bridge-server.js.map +1 -1
- package/dist/src/server/web-socket-protocol.d.ts +173 -6
- package/dist/src/server/web-socket-protocol.d.ts.map +1 -1
- package/dist/src/server/web-socket-protocol.js +244 -1
- package/dist/src/server/web-socket-protocol.js.map +1 -1
- package/dist/src/server/web-socket-protocol.test.js +48 -0
- package/dist/src/server/web-socket-protocol.test.js.map +1 -1
- package/dist/src/test/e2e/persistent-session.test.js +121 -0
- package/dist/src/test/e2e/persistent-session.test.js.map +1 -1
- package/dist/src/test/e2e/split-server.test.d.ts +3 -5
- package/dist/src/test/e2e/split-server.test.d.ts.map +1 -1
- package/dist/src/test/e2e/split-server.test.js +3 -5
- package/dist/src/test/e2e/split-server.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docker/Dockerfile +3 -0
- package/package.json +8 -6
- package/src/bridge/bridge-connection.test.ts +126 -0
- package/src/bridge/bridge-connection.ts +217 -22
- package/src/bridge/bridge-session.test.ts +6 -4
- package/src/bridge/bridge-session.ts +273 -28
- package/src/bridge/index.ts +3 -0
- package/src/bridge/internal/bridge-client.test.ts +23 -0
- package/src/bridge/internal/bridge-client.ts +25 -7
- package/src/bridge/internal/bridge-host.test.ts +38 -0
- package/src/bridge/internal/bridge-host.ts +47 -0
- package/src/bridge/internal/hand-off.ts +4 -1
- package/src/bridge/internal/host-protocol.test.ts +15 -0
- package/src/bridge/internal/host-protocol.ts +148 -37
- package/src/bridge/internal/instance-state.ts +34 -0
- package/src/bridge/internal/transport-client.ts +2 -1
- package/src/bridge/internal/transport-server.ts +5 -1
- package/src/bridge/types.ts +47 -2
- package/src/cli/adapters/cli-command-adapter-handler.test.ts +28 -0
- package/src/cli/adapters/cli-command-adapter.ts +150 -18
- package/src/cli/adapters/group-builder.test.ts +34 -2
- package/src/cli/adapters/group-builder.ts +52 -20
- package/src/cli/adapters/help-formatter.test.ts +1 -1
- package/src/cli/adapters/help-formatter.ts +4 -3
- package/src/cli/adapters/playtest-edit-guard.test.ts +54 -0
- package/src/cli/args/global-args.ts +1 -1
- package/src/cli/cli-output-context.test.ts +55 -0
- package/src/cli/cli-output-context.ts +50 -0
- package/src/cli/cli.ts +49 -17
- package/src/cli/managed-studio-run.test.ts +71 -0
- package/src/cli/managed-studio-run.ts +135 -0
- package/src/cli/resolve-session.test.ts +1 -1
- package/src/cli/resolve-session.ts +1 -1
- package/src/cli/script-executor.ts +99 -51
- package/src/commands/console/exec/exec.test.ts +96 -3
- package/src/commands/console/exec/exec.ts +59 -6
- package/src/commands/console/exec/execute.lua +356 -240
- package/src/commands/console/exec/execute.spec.lua +286 -0
- package/src/commands/console/logs/logs.test.ts +76 -4
- package/src/commands/console/logs/logs.ts +132 -17
- package/src/commands/console/logs/query-logs.lua +85 -52
- package/src/commands/console/logs/query-logs.spec.lua +132 -0
- package/src/commands/explorer/export/export-instances.lua +108 -0
- package/src/commands/explorer/export/export-instances.spec.lua +87 -0
- package/src/commands/explorer/export/export.test.ts +27 -0
- package/src/commands/explorer/export/export.ts +60 -0
- package/src/commands/explorer/find/find-instances.lua +174 -0
- package/src/commands/explorer/find/find-instances.spec.lua +122 -0
- package/src/commands/explorer/find/find.test.ts +53 -0
- package/src/commands/explorer/find/find.ts +113 -0
- package/src/commands/explorer/grep/grep-scripts.lua +214 -0
- package/src/commands/explorer/grep/grep-scripts.spec.lua +130 -0
- package/src/commands/explorer/grep/grep.test.ts +45 -0
- package/src/commands/explorer/grep/grep.ts +93 -0
- package/src/commands/explorer/import/import-instances.lua +106 -0
- package/src/commands/explorer/import/import-instances.spec.lua +84 -0
- package/src/commands/explorer/import/import.test.ts +60 -0
- package/src/commands/explorer/import/import.ts +66 -0
- package/src/commands/explorer/query/query-data-model.lua +124 -152
- package/src/commands/explorer/query/query-data-model.spec.lua +150 -0
- package/src/commands/formatters.test.ts +7 -1
- package/src/commands/framework/action-loader.test.ts +28 -0
- package/src/commands/framework/action-loader.ts +10 -2
- package/src/commands/framework/arg-builder.ts +26 -3
- package/src/commands/framework/define-command.ts +32 -3
- package/src/commands/framework/index.ts +1 -0
- package/src/commands/index.ts +50 -0
- package/src/commands/linux/inject-credentials/inject-credentials.ts +1 -3
- package/src/commands/linux/setup/setup.ts +1 -3
- package/src/commands/linux/status/status.ts +105 -98
- package/src/commands/playtest/player/add/add.ts +85 -0
- package/src/commands/playtest/player/list/list.ts +57 -0
- package/src/commands/playtest/player/playtest-players.test.ts +146 -0
- package/src/commands/playtest/player/playtest-players.ts +270 -0
- package/src/commands/playtest/player/remove/remove.ts +78 -0
- package/src/commands/playtest/playtest-sessions.test.ts +143 -0
- package/src/commands/playtest/playtest-sessions.ts +417 -0
- package/src/commands/playtest/restart/restart.ts +199 -0
- package/src/commands/playtest/run/playtest-runner.luau +264 -0
- package/src/commands/playtest/run/playtest-runner.spec.lua +71 -0
- package/src/commands/playtest/run/run-playtest-script.lua +139 -0
- package/src/commands/playtest/run/run-playtest-script.spec.lua +43 -0
- package/src/commands/playtest/run/run.ts +239 -0
- package/src/commands/playtest/start/start-playtest.lua +108 -0
- package/src/commands/playtest/start/start.ts +138 -0
- package/src/commands/playtest/stop/end-playtest.lua +47 -0
- package/src/commands/playtest/stop/stop.ts +51 -0
- package/src/commands/process/close/close.test.ts +250 -0
- package/src/commands/process/close/close.ts +183 -17
- package/src/commands/process/info/info.test.ts +198 -44
- package/src/commands/process/info/info.ts +204 -15
- package/src/commands/process/info/query-state.lua +42 -29
- package/src/commands/process/info/query-state.spec.lua +39 -0
- package/src/commands/process/launch/launch.test.ts +138 -21
- package/src/commands/process/launch/launch.ts +69 -9
- package/src/commands/process/list/list.test.ts +1 -0
- package/src/commands/process/list/list.ts +14 -6
- package/src/commands/process/run/run.ts +26 -5
- package/src/commands/serve/serve.test.ts +17 -2
- package/src/commands/serve/serve.ts +25 -6
- package/src/commands/viewport/screenshot/capture-screenshot.lua +175 -182
- package/src/commands/viewport/screenshot/capture-screenshot.spec.lua +129 -0
- package/src/commands/viewport/screenshot/screenshot.test.ts +7 -10
- package/src/commands/viewport/screenshot/screenshot.ts +6 -1
- package/src/deploy/deploy-places.test.ts +127 -0
- package/src/deploy/deploy-places.ts +229 -0
- package/src/index.ts +11 -0
- package/src/plugin/persistent-plugin-installer.test.ts +4 -0
- package/src/plugin/persistent-plugin-installer.ts +2 -1
- package/src/plugin/plugin-build-version.test.ts +55 -0
- package/src/plugin/plugin-build-version.ts +53 -0
- package/src/plugin/plugin-injector.ts +7 -1
- package/src/process/studio-process-closer.test.ts +107 -0
- package/src/process/studio-process-closer.ts +187 -0
- package/src/process/studio-settings.test.ts +18 -0
- package/src/process/studio-settings.ts +61 -0
- package/src/process/studio-window-state.ts +65 -0
- package/src/server/studio-bridge-server.ts +15 -4
- package/src/server/web-socket-protocol.test.ts +55 -0
- package/src/server/web-socket-protocol.ts +468 -8
- package/src/test/e2e/persistent-session.test.ts +137 -0
- package/src/test/e2e/split-server.test.ts +3 -5
- package/templates/studio-bridge-plugin/default.project.json +3 -0
- package/templates/studio-bridge-plugin/src/Shared/ActionRouter.lua +208 -159
- package/templates/studio-bridge-plugin/src/Shared/ActionRouter.spec.lua +418 -0
- package/templates/studio-bridge-plugin/src/Shared/BuiltInActions.lua +94 -0
- package/templates/studio-bridge-plugin/src/Shared/BuiltInActions.spec.lua +166 -0
- package/templates/studio-bridge-plugin/src/Shared/DiscoveryStateMachine.lua +118 -137
- package/templates/studio-bridge-plugin/src/Shared/DiscoveryStateMachine.spec.lua +228 -0
- package/templates/studio-bridge-plugin/src/Shared/MessageBuffer.lua +80 -109
- package/templates/studio-bridge-plugin/src/Shared/MessageBuffer.spec.lua +116 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeConnection.lua +233 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeConnection.spec.lua +239 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeLogUtils.lua +53 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeLogUtils.spec.lua +27 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.lua +164 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.spec.lua +159 -0
- package/templates/studio-bridge-plugin/src/StudioBridgePlugin.server.lua +266 -368
- package/templates/studio-bridge-plugin/src/Vendor/png.lua +8 -2
- package/test/default.project.json +41 -0
- package/test/jest.config.lua +3 -0
- package/test/scripts/Server/ServerMain.server.lua +10 -0
- package/tsconfig.json +1 -0
- package/templates/studio-bridge-plugin/src/Shared/Protocol.lua +0 -132
- package/templates/studio-bridge-plugin-test/test/actions.test.lua +0 -580
- package/templates/studio-bridge-plugin-test/test/discovery.test.lua +0 -622
- package/templates/studio-bridge-plugin-test/test/execute-handler.test.lua +0 -517
- package/templates/studio-bridge-plugin-test/test/hash-lifecycle.test.lua +0 -814
- package/templates/studio-bridge-plugin-test/test/integration.test.lua +0 -1020
- package/templates/studio-bridge-plugin-test/test/new-actions.test.lua +0 -339
- package/templates/studio-bridge-plugin-test/test/plugin-entry.test.lua +0 -493
- package/templates/studio-bridge-plugin-test/test/protocol.test.lua +0 -506
- package/templates/studio-bridge-plugin-test/test/roblox-mocks.lua +0 -108
- package/templates/studio-bridge-plugin-test/test/test-runner.lua +0 -112
|
@@ -1,506 +0,0 @@
|
|
|
1
|
-
--[[
|
|
2
|
-
Tests for Protocol.encode / Protocol.decode.
|
|
3
|
-
|
|
4
|
-
Covers round-trip for every message type, error cases, and optional field handling.
|
|
5
|
-
]]
|
|
6
|
-
|
|
7
|
-
local Protocol = require("../../studio-bridge-plugin/src/Shared/Protocol")
|
|
8
|
-
|
|
9
|
-
-- ---------------------------------------------------------------------------
|
|
10
|
-
-- Test helpers
|
|
11
|
-
-- ---------------------------------------------------------------------------
|
|
12
|
-
|
|
13
|
-
local function assertEqual(actual: any, expected: any, label: string?)
|
|
14
|
-
if actual ~= expected then
|
|
15
|
-
error(
|
|
16
|
-
string.format(
|
|
17
|
-
"%sexpected %s, got %s",
|
|
18
|
-
if label then label .. ": " else "",
|
|
19
|
-
tostring(expected),
|
|
20
|
-
tostring(actual)
|
|
21
|
-
)
|
|
22
|
-
)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
local function assertNil(value: any, label: string?)
|
|
27
|
-
if value ~= nil then
|
|
28
|
-
error(string.format("%sexpected nil, got %s", if label then label .. ": " else "", tostring(value)))
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
local function assertNotNil(value: any, label: string?)
|
|
33
|
-
if value == nil then
|
|
34
|
-
error(string.format("%sexpected non-nil value", if label then label .. ": " else ""))
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
local function assertContains(str: string, substring: string, label: string?)
|
|
39
|
-
if not string.find(str, substring, 1, true) then
|
|
40
|
-
error(
|
|
41
|
-
string.format(
|
|
42
|
-
"%sexpected string to contain '%s', got '%s'",
|
|
43
|
-
if label then label .. ": " else "",
|
|
44
|
-
substring,
|
|
45
|
-
str
|
|
46
|
-
)
|
|
47
|
-
)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
-- ---------------------------------------------------------------------------
|
|
52
|
-
-- Round-trip helper
|
|
53
|
-
-- ---------------------------------------------------------------------------
|
|
54
|
-
|
|
55
|
-
local function roundTrip(message: { [string]: any }): { [string]: any }
|
|
56
|
-
local encoded = Protocol.encode(message :: any)
|
|
57
|
-
local decoded, err = Protocol.decode(encoded)
|
|
58
|
-
if decoded == nil then
|
|
59
|
-
error("round-trip decode failed: " .. tostring(err))
|
|
60
|
-
end
|
|
61
|
-
return decoded :: any
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
-- ---------------------------------------------------------------------------
|
|
65
|
-
-- Tests
|
|
66
|
-
-- ---------------------------------------------------------------------------
|
|
67
|
-
|
|
68
|
-
local tests = {}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
-- 3. Round-trip: scriptComplete
|
|
72
|
-
table.insert(tests, {
|
|
73
|
-
name = "round-trip scriptComplete",
|
|
74
|
-
fn = function()
|
|
75
|
-
local msg = {
|
|
76
|
-
type = "scriptComplete",
|
|
77
|
-
sessionId = "sess-003",
|
|
78
|
-
payload = { success = true },
|
|
79
|
-
}
|
|
80
|
-
local result = roundTrip(msg)
|
|
81
|
-
assertEqual(result.type, "scriptComplete")
|
|
82
|
-
assertEqual(result.payload.success, true)
|
|
83
|
-
end,
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
-- 4. Round-trip: register
|
|
87
|
-
table.insert(tests, {
|
|
88
|
-
name = "round-trip register",
|
|
89
|
-
fn = function()
|
|
90
|
-
local msg = {
|
|
91
|
-
type = "register",
|
|
92
|
-
sessionId = "sess-004",
|
|
93
|
-
payload = {
|
|
94
|
-
pluginVersion = "1.0.0",
|
|
95
|
-
instanceId = "inst-xyz",
|
|
96
|
-
context = "edit",
|
|
97
|
-
placeName = "TestPlace",
|
|
98
|
-
placeId = 123,
|
|
99
|
-
gameId = 456,
|
|
100
|
-
state = "Edit",
|
|
101
|
-
capabilities = { "execute", "queryState" },
|
|
102
|
-
},
|
|
103
|
-
}
|
|
104
|
-
local result = roundTrip(msg)
|
|
105
|
-
assertEqual(result.type, "register")
|
|
106
|
-
assertEqual(result.payload.pluginVersion, "1.0.0")
|
|
107
|
-
assertEqual(result.payload.instanceId, "inst-xyz")
|
|
108
|
-
end,
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
-- 6. Round-trip: execute
|
|
112
|
-
table.insert(tests, {
|
|
113
|
-
name = "round-trip execute",
|
|
114
|
-
fn = function()
|
|
115
|
-
local msg = {
|
|
116
|
-
type = "execute",
|
|
117
|
-
sessionId = "sess-006",
|
|
118
|
-
requestId = "req-001",
|
|
119
|
-
payload = { script = "print('hi')" },
|
|
120
|
-
}
|
|
121
|
-
local result = roundTrip(msg)
|
|
122
|
-
assertEqual(result.type, "execute")
|
|
123
|
-
assertEqual(result.requestId, "req-001")
|
|
124
|
-
assertEqual(result.payload.script, "print('hi')")
|
|
125
|
-
end,
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
-- 7. Round-trip: shutdown
|
|
129
|
-
table.insert(tests, {
|
|
130
|
-
name = "round-trip shutdown",
|
|
131
|
-
fn = function()
|
|
132
|
-
local msg = {
|
|
133
|
-
type = "shutdown",
|
|
134
|
-
sessionId = "sess-007",
|
|
135
|
-
payload = {},
|
|
136
|
-
}
|
|
137
|
-
local result = roundTrip(msg)
|
|
138
|
-
assertEqual(result.type, "shutdown")
|
|
139
|
-
assertEqual(result.sessionId, "sess-007")
|
|
140
|
-
end,
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
-- 8. Round-trip: queryState / stateResult
|
|
144
|
-
table.insert(tests, {
|
|
145
|
-
name = "round-trip queryState and stateResult",
|
|
146
|
-
fn = function()
|
|
147
|
-
local query = {
|
|
148
|
-
type = "queryState",
|
|
149
|
-
sessionId = "sess-008",
|
|
150
|
-
requestId = "req-qs",
|
|
151
|
-
payload = {},
|
|
152
|
-
}
|
|
153
|
-
local qResult = roundTrip(query)
|
|
154
|
-
assertEqual(qResult.type, "queryState")
|
|
155
|
-
assertEqual(qResult.requestId, "req-qs")
|
|
156
|
-
|
|
157
|
-
local response = {
|
|
158
|
-
type = "stateResult",
|
|
159
|
-
sessionId = "sess-008",
|
|
160
|
-
requestId = "req-qs",
|
|
161
|
-
payload = {
|
|
162
|
-
state = "Edit",
|
|
163
|
-
placeId = 123,
|
|
164
|
-
placeName = "TestPlace",
|
|
165
|
-
gameId = 456,
|
|
166
|
-
},
|
|
167
|
-
}
|
|
168
|
-
local sResult = roundTrip(response)
|
|
169
|
-
assertEqual(sResult.type, "stateResult")
|
|
170
|
-
assertEqual(sResult.payload.state, "Edit")
|
|
171
|
-
assertEqual(sResult.payload.placeId, 123)
|
|
172
|
-
end,
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
-- 9. Round-trip: captureScreenshot / screenshotResult
|
|
176
|
-
table.insert(tests, {
|
|
177
|
-
name = "round-trip captureScreenshot and screenshotResult",
|
|
178
|
-
fn = function()
|
|
179
|
-
local capture = {
|
|
180
|
-
type = "captureScreenshot",
|
|
181
|
-
sessionId = "sess-009",
|
|
182
|
-
requestId = "req-cs",
|
|
183
|
-
payload = { format = "png" },
|
|
184
|
-
}
|
|
185
|
-
local cResult = roundTrip(capture)
|
|
186
|
-
assertEqual(cResult.type, "captureScreenshot")
|
|
187
|
-
|
|
188
|
-
local response = {
|
|
189
|
-
type = "screenshotResult",
|
|
190
|
-
sessionId = "sess-009",
|
|
191
|
-
requestId = "req-cs",
|
|
192
|
-
payload = {
|
|
193
|
-
data = "iVBORw0KGgo=",
|
|
194
|
-
format = "png",
|
|
195
|
-
width = 1920,
|
|
196
|
-
height = 1080,
|
|
197
|
-
},
|
|
198
|
-
}
|
|
199
|
-
local sResult = roundTrip(response)
|
|
200
|
-
assertEqual(sResult.type, "screenshotResult")
|
|
201
|
-
assertEqual(sResult.payload.width, 1920)
|
|
202
|
-
end,
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
-- 10. Round-trip: queryDataModel / dataModelResult
|
|
206
|
-
table.insert(tests, {
|
|
207
|
-
name = "round-trip queryDataModel and dataModelResult",
|
|
208
|
-
fn = function()
|
|
209
|
-
local query = {
|
|
210
|
-
type = "queryDataModel",
|
|
211
|
-
sessionId = "sess-010",
|
|
212
|
-
requestId = "req-dm",
|
|
213
|
-
payload = { path = "game.Workspace", depth = 1 },
|
|
214
|
-
}
|
|
215
|
-
local qResult = roundTrip(query)
|
|
216
|
-
assertEqual(qResult.type, "queryDataModel")
|
|
217
|
-
assertEqual(qResult.payload.path, "game.Workspace")
|
|
218
|
-
|
|
219
|
-
local response = {
|
|
220
|
-
type = "dataModelResult",
|
|
221
|
-
sessionId = "sess-010",
|
|
222
|
-
requestId = "req-dm",
|
|
223
|
-
payload = {
|
|
224
|
-
instance = {
|
|
225
|
-
name = "Workspace",
|
|
226
|
-
className = "Workspace",
|
|
227
|
-
path = "game.Workspace",
|
|
228
|
-
properties = {},
|
|
229
|
-
attributes = {},
|
|
230
|
-
childCount = 3,
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
}
|
|
234
|
-
local dResult = roundTrip(response)
|
|
235
|
-
assertEqual(dResult.type, "dataModelResult")
|
|
236
|
-
assertEqual(dResult.payload.instance.name, "Workspace")
|
|
237
|
-
assertEqual(dResult.payload.instance.childCount, 3)
|
|
238
|
-
end,
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
-- 11. Round-trip: queryLogs / logsResult
|
|
242
|
-
table.insert(tests, {
|
|
243
|
-
name = "round-trip queryLogs and logsResult",
|
|
244
|
-
fn = function()
|
|
245
|
-
local query = {
|
|
246
|
-
type = "queryLogs",
|
|
247
|
-
sessionId = "sess-011",
|
|
248
|
-
requestId = "req-ql",
|
|
249
|
-
payload = { count = 50, direction = "tail" },
|
|
250
|
-
}
|
|
251
|
-
local qResult = roundTrip(query)
|
|
252
|
-
assertEqual(qResult.type, "queryLogs")
|
|
253
|
-
assertEqual(qResult.payload.count, 50)
|
|
254
|
-
|
|
255
|
-
local response = {
|
|
256
|
-
type = "logsResult",
|
|
257
|
-
sessionId = "sess-011",
|
|
258
|
-
requestId = "req-ql",
|
|
259
|
-
payload = {
|
|
260
|
-
entries = {
|
|
261
|
-
{ level = "Print", body = "hello", timestamp = 1000 },
|
|
262
|
-
},
|
|
263
|
-
total = 1,
|
|
264
|
-
bufferCapacity = 1000,
|
|
265
|
-
},
|
|
266
|
-
}
|
|
267
|
-
local lResult = roundTrip(response)
|
|
268
|
-
assertEqual(lResult.type, "logsResult")
|
|
269
|
-
assertEqual(lResult.payload.total, 1)
|
|
270
|
-
assertEqual(lResult.payload.entries[1].body, "hello")
|
|
271
|
-
end,
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
-- 12. Round-trip: subscribe / subscribeResult / unsubscribe / unsubscribeResult
|
|
275
|
-
table.insert(tests, {
|
|
276
|
-
name = "round-trip subscribe and unsubscribe flows",
|
|
277
|
-
fn = function()
|
|
278
|
-
local sub = {
|
|
279
|
-
type = "subscribe",
|
|
280
|
-
sessionId = "sess-012",
|
|
281
|
-
requestId = "req-sub",
|
|
282
|
-
payload = { events = { "stateChange", "logPush" } },
|
|
283
|
-
}
|
|
284
|
-
local subResult = roundTrip(sub)
|
|
285
|
-
assertEqual(subResult.type, "subscribe")
|
|
286
|
-
assertEqual(#subResult.payload.events, 2)
|
|
287
|
-
|
|
288
|
-
local subConfirm = {
|
|
289
|
-
type = "subscribeResult",
|
|
290
|
-
sessionId = "sess-012",
|
|
291
|
-
requestId = "req-sub",
|
|
292
|
-
payload = { events = { "stateChange", "logPush" } },
|
|
293
|
-
}
|
|
294
|
-
local scResult = roundTrip(subConfirm)
|
|
295
|
-
assertEqual(scResult.type, "subscribeResult")
|
|
296
|
-
|
|
297
|
-
local unsub = {
|
|
298
|
-
type = "unsubscribe",
|
|
299
|
-
sessionId = "sess-012",
|
|
300
|
-
requestId = "req-unsub",
|
|
301
|
-
payload = { events = { "stateChange" } },
|
|
302
|
-
}
|
|
303
|
-
local unsubResult = roundTrip(unsub)
|
|
304
|
-
assertEqual(unsubResult.type, "unsubscribe")
|
|
305
|
-
|
|
306
|
-
local unsubConfirm = {
|
|
307
|
-
type = "unsubscribeResult",
|
|
308
|
-
sessionId = "sess-012",
|
|
309
|
-
requestId = "req-unsub",
|
|
310
|
-
payload = { events = { "stateChange" } },
|
|
311
|
-
}
|
|
312
|
-
local ucResult = roundTrip(unsubConfirm)
|
|
313
|
-
assertEqual(ucResult.type, "unsubscribeResult")
|
|
314
|
-
end,
|
|
315
|
-
})
|
|
316
|
-
|
|
317
|
-
-- 13. Round-trip: stateChange (push message, no requestId)
|
|
318
|
-
table.insert(tests, {
|
|
319
|
-
name = "round-trip stateChange push",
|
|
320
|
-
fn = function()
|
|
321
|
-
local msg = {
|
|
322
|
-
type = "stateChange",
|
|
323
|
-
sessionId = "sess-013",
|
|
324
|
-
payload = {
|
|
325
|
-
previousState = "Edit",
|
|
326
|
-
newState = "Play",
|
|
327
|
-
timestamp = 47230,
|
|
328
|
-
},
|
|
329
|
-
}
|
|
330
|
-
local result = roundTrip(msg)
|
|
331
|
-
assertEqual(result.type, "stateChange")
|
|
332
|
-
assertEqual(result.payload.previousState, "Edit")
|
|
333
|
-
assertEqual(result.payload.newState, "Play")
|
|
334
|
-
assertNil(result.requestId)
|
|
335
|
-
end,
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
-- 14. Round-trip: heartbeat
|
|
339
|
-
table.insert(tests, {
|
|
340
|
-
name = "round-trip heartbeat",
|
|
341
|
-
fn = function()
|
|
342
|
-
local msg = {
|
|
343
|
-
type = "heartbeat",
|
|
344
|
-
sessionId = "sess-014",
|
|
345
|
-
payload = {
|
|
346
|
-
uptimeMs = 45000,
|
|
347
|
-
state = "Edit",
|
|
348
|
-
pendingRequests = 0,
|
|
349
|
-
},
|
|
350
|
-
}
|
|
351
|
-
local result = roundTrip(msg)
|
|
352
|
-
assertEqual(result.type, "heartbeat")
|
|
353
|
-
assertEqual(result.payload.uptimeMs, 45000)
|
|
354
|
-
assertEqual(result.payload.pendingRequests, 0)
|
|
355
|
-
assertNil(result.requestId)
|
|
356
|
-
end,
|
|
357
|
-
})
|
|
358
|
-
|
|
359
|
-
-- 15. Round-trip: error (bidirectional)
|
|
360
|
-
table.insert(tests, {
|
|
361
|
-
name = "round-trip error message",
|
|
362
|
-
fn = function()
|
|
363
|
-
local msg = {
|
|
364
|
-
type = "error",
|
|
365
|
-
sessionId = "sess-015",
|
|
366
|
-
requestId = "req-err",
|
|
367
|
-
payload = {
|
|
368
|
-
code = "INSTANCE_NOT_FOUND",
|
|
369
|
-
message = "No instance found at path: game.Workspace.NonExistent",
|
|
370
|
-
details = { resolvedTo = "game.Workspace", failedSegment = "NonExistent" },
|
|
371
|
-
},
|
|
372
|
-
}
|
|
373
|
-
local result = roundTrip(msg)
|
|
374
|
-
assertEqual(result.type, "error")
|
|
375
|
-
assertEqual(result.requestId, "req-err")
|
|
376
|
-
assertEqual(result.payload.code, "INSTANCE_NOT_FOUND")
|
|
377
|
-
assertEqual(result.payload.details.failedSegment, "NonExistent")
|
|
378
|
-
end,
|
|
379
|
-
})
|
|
380
|
-
|
|
381
|
-
-- 16. Error case: invalid JSON
|
|
382
|
-
table.insert(tests, {
|
|
383
|
-
name = "decode rejects invalid JSON",
|
|
384
|
-
fn = function()
|
|
385
|
-
local result, err = Protocol.decode("not valid json {{{")
|
|
386
|
-
assertNil(result, "result")
|
|
387
|
-
assertNotNil(err, "error")
|
|
388
|
-
assertContains(err :: string, "invalid JSON")
|
|
389
|
-
end,
|
|
390
|
-
})
|
|
391
|
-
|
|
392
|
-
-- 17. Error case: unknown message type
|
|
393
|
-
table.insert(tests, {
|
|
394
|
-
name = "decode rejects unknown message type",
|
|
395
|
-
fn = function()
|
|
396
|
-
local json = '{"type":"unknownType","sessionId":"x","payload":{}}'
|
|
397
|
-
local result, err = Protocol.decode(json)
|
|
398
|
-
assertNil(result, "result")
|
|
399
|
-
assertNotNil(err, "error")
|
|
400
|
-
assertContains(err :: string, "unknown message type")
|
|
401
|
-
assertContains(err :: string, "unknownType")
|
|
402
|
-
end,
|
|
403
|
-
})
|
|
404
|
-
|
|
405
|
-
-- 18. Error case: missing sessionId
|
|
406
|
-
table.insert(tests, {
|
|
407
|
-
name = "decode rejects missing sessionId",
|
|
408
|
-
fn = function()
|
|
409
|
-
local json = '{"type":"register","payload":{}}'
|
|
410
|
-
local result, err = Protocol.decode(json)
|
|
411
|
-
assertNil(result, "result")
|
|
412
|
-
assertNotNil(err, "error")
|
|
413
|
-
assertContains(err :: string, "sessionId")
|
|
414
|
-
end,
|
|
415
|
-
})
|
|
416
|
-
|
|
417
|
-
-- 19. Error case: missing payload
|
|
418
|
-
table.insert(tests, {
|
|
419
|
-
name = "decode rejects missing payload",
|
|
420
|
-
fn = function()
|
|
421
|
-
local json = '{"type":"register","sessionId":"x"}'
|
|
422
|
-
local result, err = Protocol.decode(json)
|
|
423
|
-
assertNil(result, "result")
|
|
424
|
-
assertNotNil(err, "error")
|
|
425
|
-
assertContains(err :: string, "payload")
|
|
426
|
-
end,
|
|
427
|
-
})
|
|
428
|
-
|
|
429
|
-
-- 20. Error case: missing type
|
|
430
|
-
table.insert(tests, {
|
|
431
|
-
name = "decode rejects missing type",
|
|
432
|
-
fn = function()
|
|
433
|
-
local json = '{"sessionId":"x","payload":{}}'
|
|
434
|
-
local result, err = Protocol.decode(json)
|
|
435
|
-
assertNil(result, "result")
|
|
436
|
-
assertNotNil(err, "error")
|
|
437
|
-
assertContains(err :: string, "type")
|
|
438
|
-
end,
|
|
439
|
-
})
|
|
440
|
-
|
|
441
|
-
-- 21. requestId preserved when present, absent when nil
|
|
442
|
-
table.insert(tests, {
|
|
443
|
-
name = "requestId preserved when present, absent when nil",
|
|
444
|
-
fn = function()
|
|
445
|
-
-- With requestId
|
|
446
|
-
local withId = {
|
|
447
|
-
type = "execute",
|
|
448
|
-
sessionId = "sess-rid",
|
|
449
|
-
requestId = "req-123",
|
|
450
|
-
payload = { script = "x" },
|
|
451
|
-
}
|
|
452
|
-
local result1 = roundTrip(withId)
|
|
453
|
-
assertEqual(result1.requestId, "req-123")
|
|
454
|
-
|
|
455
|
-
-- Without requestId
|
|
456
|
-
local withoutId = {
|
|
457
|
-
type = "execute",
|
|
458
|
-
sessionId = "sess-rid",
|
|
459
|
-
payload = { script = "x" },
|
|
460
|
-
}
|
|
461
|
-
local result2 = roundTrip(withoutId)
|
|
462
|
-
assertNil(result2.requestId)
|
|
463
|
-
end,
|
|
464
|
-
})
|
|
465
|
-
|
|
466
|
-
-- 23. Encode omits nil optional fields from JSON output
|
|
467
|
-
table.insert(tests, {
|
|
468
|
-
name = "encode omits nil requestId",
|
|
469
|
-
fn = function()
|
|
470
|
-
local msg = {
|
|
471
|
-
type = "register",
|
|
472
|
-
sessionId = "sess-omit",
|
|
473
|
-
payload = { sessionId = "sess-omit" },
|
|
474
|
-
}
|
|
475
|
-
local json = Protocol.encode(msg :: any)
|
|
476
|
-
-- The JSON string should not contain requestId
|
|
477
|
-
if string.find(json, "requestId", 1, true) then
|
|
478
|
-
error("JSON should not contain requestId when nil")
|
|
479
|
-
end
|
|
480
|
-
end,
|
|
481
|
-
})
|
|
482
|
-
|
|
483
|
-
-- 24. Decode handles non-object JSON (e.g., array, string, number)
|
|
484
|
-
table.insert(tests, {
|
|
485
|
-
name = "decode rejects non-object JSON values",
|
|
486
|
-
fn = function()
|
|
487
|
-
-- JSON array
|
|
488
|
-
local r1, e1 = Protocol.decode("[1,2,3]")
|
|
489
|
-
-- serde.decode("[1,2,3]") returns a table, but it won't have type/sessionId/payload
|
|
490
|
-
-- so it should fail on the "type" check
|
|
491
|
-
assertNil(r1, "array result")
|
|
492
|
-
assertNotNil(e1, "array error")
|
|
493
|
-
|
|
494
|
-
-- JSON string
|
|
495
|
-
local r2, e2 = Protocol.decode('"hello"')
|
|
496
|
-
assertNil(r2, "string result")
|
|
497
|
-
assertNotNil(e2, "string error")
|
|
498
|
-
|
|
499
|
-
-- JSON number
|
|
500
|
-
local r3, e3 = Protocol.decode("42")
|
|
501
|
-
assertNil(r3, "number result")
|
|
502
|
-
assertNotNil(e3, "number error")
|
|
503
|
-
end,
|
|
504
|
-
})
|
|
505
|
-
|
|
506
|
-
return tests
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
--[[
|
|
2
|
-
Minimal Roblox service stubs for running plugin tests under Lune.
|
|
3
|
-
|
|
4
|
-
Provides mock implementations of HttpService, RunService, LogService,
|
|
5
|
-
and a simple Signal class. These are not full Roblox API replicas --
|
|
6
|
-
only the subset needed by the studio-bridge plugin modules.
|
|
7
|
-
]]
|
|
8
|
-
|
|
9
|
-
local serde = require("@lune/serde")
|
|
10
|
-
|
|
11
|
-
-- ---------------------------------------------------------------------------
|
|
12
|
-
-- Signal mock
|
|
13
|
-
-- ---------------------------------------------------------------------------
|
|
14
|
-
|
|
15
|
-
local Signal = {}
|
|
16
|
-
Signal.__index = Signal
|
|
17
|
-
|
|
18
|
-
function Signal.new()
|
|
19
|
-
return setmetatable({
|
|
20
|
-
_callbacks = {},
|
|
21
|
-
}, Signal)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
function Signal:Connect(callback: (...any) -> ())
|
|
25
|
-
local connection = {
|
|
26
|
-
_signal = self,
|
|
27
|
-
_callback = callback,
|
|
28
|
-
Connected = true,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function connection:Disconnect()
|
|
32
|
-
self.Connected = false
|
|
33
|
-
for i, cb in self._signal._callbacks do
|
|
34
|
-
if cb == self._callback then
|
|
35
|
-
table.remove(self._signal._callbacks, i)
|
|
36
|
-
break
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
table.insert(self._callbacks, callback)
|
|
42
|
-
return connection
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
function Signal:Fire(...)
|
|
46
|
-
-- Copy the list so disconnects during iteration are safe
|
|
47
|
-
local snapshot = table.clone(self._callbacks)
|
|
48
|
-
for _, callback in snapshot do
|
|
49
|
-
callback(...)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
-- ---------------------------------------------------------------------------
|
|
54
|
-
-- HttpService mock
|
|
55
|
-
-- ---------------------------------------------------------------------------
|
|
56
|
-
|
|
57
|
-
local HttpService = {}
|
|
58
|
-
|
|
59
|
-
function HttpService:JSONEncode(value: any): string
|
|
60
|
-
return serde.encode("json", value)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
function HttpService:JSONDecode(json: string): any
|
|
64
|
-
return serde.decode("json", json)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
-- ---------------------------------------------------------------------------
|
|
68
|
-
-- RunService mock
|
|
69
|
-
-- ---------------------------------------------------------------------------
|
|
70
|
-
|
|
71
|
-
local RunService = {
|
|
72
|
-
Heartbeat = Signal.new(),
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function RunService:IsStudio(): boolean
|
|
76
|
-
return true
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
function RunService:IsRunning(): boolean
|
|
80
|
-
return false
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
function RunService:IsClient(): boolean
|
|
84
|
-
return false
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
function RunService:IsServer(): boolean
|
|
88
|
-
return false
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
-- ---------------------------------------------------------------------------
|
|
92
|
-
-- LogService mock
|
|
93
|
-
-- ---------------------------------------------------------------------------
|
|
94
|
-
|
|
95
|
-
local LogService = {
|
|
96
|
-
MessageOut = Signal.new(),
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
-- ---------------------------------------------------------------------------
|
|
100
|
-
-- Module export
|
|
101
|
-
-- ---------------------------------------------------------------------------
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
Signal = Signal,
|
|
105
|
-
HttpService = HttpService,
|
|
106
|
-
RunService = RunService,
|
|
107
|
-
LogService = LogService,
|
|
108
|
-
}
|