@voltro/plugin-rooms 0.0.0-stage → 0.88.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/CHANGELOG.md +24492 -0
- package/LICENSE +61 -0
- package/README.md +9204 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +12496 -0
- package/dist/actor.js +1473 -0
- package/dist/apiBinding.js +677 -0
- package/dist/apiRegistryBinding.js +398 -0
- package/dist/apiReservations.js +432 -0
- package/dist/baselines.js +72 -0
- package/dist/bots.d.ts +1485 -0
- package/dist/bots.js +562 -0
- package/dist/catalog.js +79 -0
- package/dist/checkpointJson.js +23 -0
- package/dist/checkpointStore.js +385 -0
- package/dist/client.js +55 -0
- package/dist/clockSync.js +50 -0
- package/dist/collision.js +155 -0
- package/dist/commandDelivery.js +100 -0
- package/dist/commandRecord.js +10 -0
- package/dist/commandWithdrawal.js +182 -0
- package/dist/connection.js +496 -0
- package/dist/controlCarrier.js +374 -0
- package/dist/controlRegistry.js +78 -0
- package/dist/controlTarget.js +44 -0
- package/dist/controlTransport.js +573 -0
- package/dist/developmentBinding.js +112 -0
- package/dist/directory.js +322 -0
- package/dist/directoryProjection.js +116 -0
- package/dist/errors.d.ts +125 -0
- package/dist/errors.js +52 -0
- package/dist/fixed.d.ts +284 -0
- package/dist/fixed.js +10 -0
- package/dist/fixed32.js +133 -0
- package/dist/fixedCollision.js +59 -0
- package/dist/fixedCollision32.js +108 -0
- package/dist/fixedMath.js +55 -0
- package/dist/fixedRaw.js +10 -0
- package/dist/fixedSlabs.js +33 -0
- package/dist/fixedTrig.js +47 -0
- package/dist/fixedTrig32.js +37 -0
- package/dist/fixedVectors.js +112 -0
- package/dist/fixedVectors32.js +94 -0
- package/dist/fixedWide.js +49 -0
- package/dist/fixedWords.js +45 -0
- package/dist/gateway.js +56 -0
- package/dist/geometry-retention-app/rooms.geometryJournalRetention.workflow.server.tsx +4 -0
- package/dist/geometry-retention-app/rooms.geometryJournalRetention.workflow.tsx +14 -0
- package/dist/geometry-worker/worker.d.mts +2 -0
- package/dist/geometry-worker/worker.mjs +50 -0
- package/dist/geometry.d.ts +2249 -0
- package/dist/geometry.js +40 -0
- package/dist/geometryActivation.js +81 -0
- package/dist/geometryActorInventory.js +107 -0
- package/dist/geometryAdminClient.js +86 -0
- package/dist/geometryAdminData.js +31 -0
- package/dist/geometryAdminFixtures.js +49 -0
- package/dist/geometryAdminPorts.js +4 -0
- package/dist/geometryAdminRpc.js +57 -0
- package/dist/geometryAdminRpcRoutes.js +48 -0
- package/dist/geometryAdminSchemas.js +38 -0
- package/dist/geometryAdministration.js +189 -0
- package/dist/geometryAdministrationPorts.js +4 -0
- package/dist/geometryApiBinding.js +164 -0
- package/dist/geometryAppStorage.js +57 -0
- package/dist/geometryArtifacts.js +197 -0
- package/dist/geometryAssetBundle.js +116 -0
- package/dist/geometryAssetClient.js +24 -0
- package/dist/geometryAssetData.js +105 -0
- package/dist/geometryAssetHttp.js +122 -0
- package/dist/geometryAssetPorts.js +4 -0
- package/dist/geometryAssetRpc.js +29 -0
- package/dist/geometryAssetRpcRoutes.js +39 -0
- package/dist/geometryAssetStorageGrant.js +102 -0
- package/dist/geometryBoxOverlap.js +109 -0
- package/dist/geometryCatalogueDigest.js +110 -0
- package/dist/geometryCellCoverage.js +84 -0
- package/dist/geometryCellLoader.js +27 -0
- package/dist/geometryChannel.js +133 -0
- package/dist/geometryChunkHttp.js +53 -0
- package/dist/geometryChunkLeases.js +21 -0
- package/dist/geometryClient.d.ts +1429 -0
- package/dist/geometryClient.js +148 -0
- package/dist/geometryClientChunks.js +329 -0
- package/dist/geometryClientDelta.js +24 -0
- package/dist/geometryClientHttp.js +36 -0
- package/dist/geometryClientInterest.js +108 -0
- package/dist/geometryClientStatic.js +33 -0
- package/dist/geometryCms.d.ts +763 -0
- package/dist/geometryCms.js +216 -0
- package/dist/geometryCommitCoordinator.js +240 -0
- package/dist/geometryCompactionFixture.js +83 -0
- package/dist/geometryCompactionStrategies.js +37 -0
- package/dist/geometryConnectionClient.js +22 -0
- package/dist/geometryDerivationFixtures.js +140 -0
- package/dist/geometryDerivationStrategies.js +26 -0
- package/dist/geometryDigest.js +12 -0
- package/dist/geometryEditChannel.js +69 -0
- package/dist/geometryEditIngress.js +262 -0
- package/dist/geometryEdits.js +365 -0
- package/dist/geometryEnvelope.js +40 -0
- package/dist/geometryGridRaycast.js +91 -0
- package/dist/geometryGridSweep.js +91 -0
- package/dist/geometryHeightfield.js +165 -0
- package/dist/geometryHeightfieldRaycast.js +73 -0
- package/dist/geometryHeightfieldSweep.js +84 -0
- package/dist/geometryHeightfieldVolume.js +44 -0
- package/dist/geometryHost.js +321 -0
- package/dist/geometryHostDirectory.js +206 -0
- package/dist/geometryHostMutations.js +136 -0
- package/dist/geometryHostStreams.js +123 -0
- package/dist/geometryHttpBody.js +75 -0
- package/dist/geometryHttpRoutes.js +111 -0
- package/dist/geometryImportGltf.js +299 -0
- package/dist/geometryImportLdtk.js +53 -0
- package/dist/geometryImportPng.js +143 -0
- package/dist/geometryImportPublication.js +66 -0
- package/dist/geometryImportTiled.js +38 -0
- package/dist/geometryImportTiles.js +135 -0
- package/dist/geometryImportVox.js +129 -0
- package/dist/geometryImportedSource.js +100 -0
- package/dist/geometryInspectEndpoint.js +247 -0
- package/dist/geometryInspection.js +91 -0
- package/dist/geometryInstall.js +120 -0
- package/dist/geometryJournalArchiveData.js +20 -0
- package/dist/geometryJournalArchiveIndex.js +329 -0
- package/dist/geometryJournalArchiveTable.js +20 -0
- package/dist/geometryJournalCompaction.js +99 -0
- package/dist/geometryJournalPatch.js +46 -0
- package/dist/geometryJournalRetention.js +111 -0
- package/dist/geometryJournalRetentionSchemas.js +35 -0
- package/dist/geometryJournalRetentionSweep.js +111 -0
- package/dist/geometryJournalRetentionWorkflow.js +27 -0
- package/dist/geometryJournalRetentionWorkflowData.js +30 -0
- package/dist/geometryJournalStorage.js +147 -0
- package/dist/geometryLoader.js +117 -0
- package/dist/geometryManifest.js +112 -0
- package/dist/geometryManifestChannel.js +92 -0
- package/dist/geometryManifestClient.js +121 -0
- package/dist/geometryManifestData.js +48 -0
- package/dist/geometryManifestPorts.js +4 -0
- package/dist/geometryManifestPublication.js +108 -0
- package/dist/geometryManifestSource.js +67 -0
- package/dist/geometryMigrationJournal.js +13 -0
- package/dist/geometryMigrationStrategies.js +6 -0
- package/dist/geometryMigrations.js +322 -0
- package/dist/geometryNativeMetadata.js +51 -0
- package/dist/geometryPatch.js +169 -0
- package/dist/geometryPersistence.js +448 -0
- package/dist/geometryPersistenceCapture.js +68 -0
- package/dist/geometryPersistenceData.js +139 -0
- package/dist/geometryPersistencePorts.js +4 -0
- package/dist/geometryPlayerAdmission.js +33 -0
- package/dist/geometryPlayerEditOwner.js +264 -0
- package/dist/geometryPlayerEdits.js +48 -0
- package/dist/geometryPrepared.js +187 -0
- package/dist/geometryPrivacyFence.js +23 -0
- package/dist/geometryProceduralPublication.js +90 -0
- package/dist/geometryProceduralWorker.js +163 -0
- package/dist/geometryPublication.js +109 -0
- package/dist/geometryRayAlgebra.js +115 -0
- package/dist/geometryReadClient.js +156 -0
- package/dist/geometryReadPorts.js +4 -0
- package/dist/geometryReadRpc.js +26 -0
- package/dist/geometryReadRpcRoutes.js +46 -0
- package/dist/geometryReliablePublication.js +81 -0
- package/dist/geometryReloadPorts.js +45 -0
- package/dist/geometryReloadSource.js +277 -0
- package/dist/geometryRenderCache.js +164 -0
- package/dist/geometryRenderLod.js +101 -0
- package/dist/geometryRollback.js +124 -0
- package/dist/geometryRollbackCoordinator.js +202 -0
- package/dist/geometryRollbackPorts.js +45 -0
- package/dist/geometryRollbackSource.js +208 -0
- package/dist/geometryRollbackStore.js +197 -0
- package/dist/geometrySchemas.js +26 -0
- package/dist/geometryServer.d.ts +2766 -0
- package/dist/geometryServer.js +62 -0
- package/dist/geometryShapeRaycast.js +110 -0
- package/dist/geometryShapeSegments.js +33 -0
- package/dist/geometryShapes.js +222 -0
- package/dist/geometrySnapshot.js +75 -0
- package/dist/geometrySnapshotChannel.js +159 -0
- package/dist/geometrySnapshotClient.js +158 -0
- package/dist/geometrySnapshotPreparation.js +75 -0
- package/dist/geometrySnapshotServer.js +190 -0
- package/dist/geometrySqlOwner.js +20 -0
- package/dist/geometryStorage.js +126 -0
- package/dist/geometryStorageGrant.js +68 -0
- package/dist/geometryStorageIdentity.js +8 -0
- package/dist/geometryTileArtifact.js +9 -0
- package/dist/geometryTileCodec.js +193 -0
- package/dist/geometryTileCollision.js +95 -0
- package/dist/geometryTileNavigation.js +127 -0
- package/dist/geometryTileView.js +34 -0
- package/dist/geometryVersionActivation.js +113 -0
- package/dist/geometryVersionClient.js +237 -0
- package/dist/geometryVersionCompare.js +39 -0
- package/dist/geometryVersionMigration.js +105 -0
- package/dist/geometryVoxel.js +252 -0
- package/dist/geometryWorldEntitySubject.js +31 -0
- package/dist/geometryWorldExtent.js +11 -0
- package/dist/geometryWorldMetadata.js +37 -0
- package/dist/geometryWorldStrategyFixtures.js +126 -0
- package/dist/geometryWorldView.js +306 -0
- package/dist/host.js +127 -0
- package/dist/hostBinding.js +276 -0
- package/dist/hostCellObservation.js +113 -0
- package/dist/hostClientCapacity.js +89 -0
- package/dist/hostCommandScope.js +63 -0
- package/dist/hostController.js +3093 -0
- package/dist/hostDeployment.js +64 -0
- package/dist/hostDrain.js +151 -0
- package/dist/hostDrainPorts.js +4 -0
- package/dist/hostDriver.js +178 -0
- package/dist/hostLane.js +287 -0
- package/dist/hostListener.js +78 -0
- package/dist/hostListenerBinding.js +18 -0
- package/dist/hostLoopObservation.js +89 -0
- package/dist/hostMetrics.js +55 -0
- package/dist/hostRegistryBinding.js +417 -0
- package/dist/hostSelection.js +15 -0
- package/dist/hostShutdown.js +46 -0
- package/dist/hostTurnObservation.js +52 -0
- package/dist/identities.js +3 -0
- package/dist/index.d.ts +8632 -0
- package/dist/index.js +231 -0
- package/dist/inputReceipts.js +62 -0
- package/dist/inputRedundancy.js +54 -0
- package/dist/inspect.js +237 -0
- package/dist/lockstep.d.ts +436 -0
- package/dist/lockstep.js +381 -0
- package/dist/lockstepAdmission.js +261 -0
- package/dist/lockstepAdmissionCodec.js +93 -0
- package/dist/lockstepAdmissionPorts.js +4 -0
- package/dist/lockstepClientSession.js +577 -0
- package/dist/lockstepDefinition.js +147 -0
- package/dist/lockstepHostLoop.js +242 -0
- package/dist/lockstepInitialAdmission.js +66 -0
- package/dist/lockstepInitialStrategyFixtures.js +44 -0
- package/dist/lockstepJournal.js +394 -0
- package/dist/lockstepJournalCodec.js +253 -0
- package/dist/lockstepJournalPorts.js +4 -0
- package/dist/lockstepJournalRebuild.js +207 -0
- package/dist/lockstepJournalRows.js +56 -0
- package/dist/lockstepMembers.js +130 -0
- package/dist/lockstepMessages.js +46 -0
- package/dist/lockstepOwnedRoom.js +763 -0
- package/dist/lockstepPolicies.js +83 -0
- package/dist/lockstepReact.js +46 -0
- package/dist/lockstepRecoveryTruth.js +120 -0
- package/dist/lockstepRosterConfig.js +31 -0
- package/dist/lockstepSeed.js +11 -0
- package/dist/lockstepSeedFixture.js +19 -0
- package/dist/lockstepServer.d.ts +3897 -0
- package/dist/lockstepServer.js +324 -0
- package/dist/lockstepServerConfig.js +100 -0
- package/dist/lockstepServerRoles.js +402 -0
- package/dist/lockstepServerStrategyFixtures.js +32 -0
- package/dist/lockstepStrategies.js +5 -0
- package/dist/lockstepStrategyFixtures.js +136 -0
- package/dist/lockstepTerminal.js +89 -0
- package/dist/lockstepTerminalPorts.js +4 -0
- package/dist/lockstepTransport.js +772 -0
- package/dist/lockstepTransportConfig.js +31 -0
- package/dist/lockstepWireRoster.js +33 -0
- package/dist/matchRoomProvider.js +31 -0
- package/dist/matchRooms.js +18 -0
- package/dist/membershipObserver.js +46 -0
- package/dist/moderation.js +97 -0
- package/dist/movementSpecials.js +103 -0
- package/dist/ownership.js +16 -0
- package/dist/ownershipWithdrawal.js +17 -0
- package/dist/pcg32.js +95 -0
- package/dist/ports.d.ts +1241 -0
- package/dist/ports.js +10 -0
- package/dist/quaternion.js +69 -0
- package/dist/react.d.ts +406 -0
- package/dist/react.js +108 -0
- package/dist/reaper-app/rooms.reaper.workflow.server.tsx +5 -0
- package/dist/reaper-app/rooms.reaper.workflow.tsx +13 -0
- package/dist/reaper.js +242 -0
- package/dist/reaperSchemas.js +41 -0
- package/dist/reaperWorkflow.js +69 -0
- package/dist/recovery.js +188 -0
- package/dist/recoverySeats.js +25 -0
- package/dist/replay.d.ts +273 -0
- package/dist/replay.js +484 -0
- package/dist/replayPorts.js +4 -0
- package/dist/replayRecording.js +66 -0
- package/dist/replaySchema.js +156 -0
- package/dist/replayStorage.d.ts +149 -0
- package/dist/replayStorage.js +484 -0
- package/dist/reservationBatch.js +421 -0
- package/dist/reservationSchemas.js +16 -0
- package/dist/reservations.js +258 -0
- package/dist/reservePort.js +68 -0
- package/dist/resolvedOptions.js +3 -0
- package/dist/room.d.ts +1006 -0
- package/dist/room.js +283 -0
- package/dist/roomAccessSweep.js +94 -0
- package/dist/roomAppCommandControl.js +58 -0
- package/dist/roomAuthoringStrategy.js +16 -0
- package/dist/roomErasure.js +197 -0
- package/dist/roomPoolRuntimeDefaults.js +23 -0
- package/dist/roomPoolSelection.js +18 -0
- package/dist/roomPoolTopology.js +211 -0
- package/dist/rpc.d.ts +551 -0
- package/dist/rpc.js +111 -0
- package/dist/rpcClient.js +151 -0
- package/dist/rpcRoutes.js +27 -0
- package/dist/runtime.js +1122 -0
- package/dist/schemaHistory.js +97 -0
- package/dist/seatStore.js +150 -0
- package/dist/seatStrategyFixtures.js +51 -0
- package/dist/seatSubject.js +31 -0
- package/dist/seats.js +129 -0
- package/dist/serverSession.js +810 -0
- package/dist/serverSessionConfig.js +42 -0
- package/dist/sessionAdmission.js +52 -0
- package/dist/sidecarAdmission.js +102 -0
- package/dist/sidecarConfig.js +115 -0
- package/dist/sidecarConfigPublication.js +63 -0
- package/dist/sidecarHostListener.js +207 -0
- package/dist/sidecarIpc.js +204 -0
- package/dist/sidecarPeer.js +309 -0
- package/dist/sidecarProcessPort.js +27 -0
- package/dist/sidecarRuntime.js +167 -0
- package/dist/sidecarSelection.js +141 -0
- package/dist/sidecarWire.js +177 -0
- package/dist/sidecarWrites.js +162 -0
- package/dist/simulation.d.ts +391 -0
- package/dist/simulation.js +281 -0
- package/dist/simulationAuthoring.js +28 -0
- package/dist/simulationBytes.js +26 -0
- package/dist/simulationConformance.js +304 -0
- package/dist/simulationInputHistoryCapture.js +34 -0
- package/dist/simulationInputHistoryWire.js +192 -0
- package/dist/simulationOptionsWire.js +77 -0
- package/dist/simulationRecoveryWire.js +133 -0
- package/dist/simulationReplay.js +126 -0
- package/dist/simulationSnapshotWire.js +111 -0
- package/dist/simulationState.js +177 -0
- package/dist/snapshotBlob.js +125 -0
- package/dist/snapshotBlobCleanup.js +92 -0
- package/dist/snapshotBlobIndex.js +37 -0
- package/dist/snapshotBudget.js +79 -0
- package/dist/snapshotChain.js +184 -0
- package/dist/snapshotErasure.js +171 -0
- package/dist/snapshotInspection.js +104 -0
- package/dist/snapshotSegmentBlobs.js +57 -0
- package/dist/snapshotUploads.js +165 -0
- package/dist/socketTransport.js +252 -0
- package/dist/spatial.js +103 -0
- package/dist/spectatorPolicy.js +25 -0
- package/dist/spectatorProducer.js +88 -0
- package/dist/startFailureCause.js +3 -0
- package/dist/stateCodec.js +657 -0
- package/dist/strategies.d.ts +210 -0
- package/dist/strategies.js +8 -0
- package/dist/strategiesServer.d.ts +286 -0
- package/dist/strategiesServer.js +11 -0
- package/dist/strategyFixtures.js +181 -0
- package/dist/streamFraming.js +121 -0
- package/dist/streamTransport.js +265 -0
- package/dist/subjectAdmission.js +49 -0
- package/dist/subjectPrivacy.js +280 -0
- package/dist/subjectPrivacyBinding.js +89 -0
- package/dist/systemManifest.js +181 -0
- package/dist/tables.js +158 -0
- package/dist/testHarness.js +88 -0
- package/dist/testing.d.ts +3684 -0
- package/dist/testing.js +220 -0
- package/dist/testingPorts.js +270 -0
- package/dist/testingServer.d.ts +4060 -0
- package/dist/testingServer.js +18 -0
- package/dist/transform.d.ts +692 -0
- package/dist/transform.js +216 -0
- package/dist/transform3d.js +117 -0
- package/dist/transformCollection.js +23 -0
- package/dist/transformCollection3d.js +23 -0
- package/dist/transformCollectionCore.js +155 -0
- package/dist/transformFrames.js +120 -0
- package/dist/transformPrediction3d.js +126 -0
- package/dist/transformRules.js +122 -0
- package/dist/transformSchemas.js +19 -0
- package/dist/transport.js +31 -0
- package/dist/transportAuthoring.js +28 -0
- package/dist/transportCleanup.js +21 -0
- package/dist/transportConformance.js +123 -0
- package/dist/transportConnector.js +81 -0
- package/dist/transportEndpoints.js +37 -0
- package/dist/transportsServer.d.ts +5515 -0
- package/dist/transportsServer.js +6 -0
- package/dist/viewProjection.js +15 -0
- package/dist/web.d.ts +2286 -0
- package/dist/web.js +517 -0
- package/dist/webTransportClient.js +172 -0
- package/dist/wire.d.ts +992 -0
- package/dist/wire.js +491 -0
- package/dist/withdrawalPort.js +27 -0
- package/dist/world.d.ts +1894 -0
- package/dist/world.js +332 -0
- package/dist/worldActorReceipts.js +47 -0
- package/dist/worldActorTransferSnapshot.js +13 -0
- package/dist/worldAdmissionPending.js +7 -0
- package/dist/worldBoundaryCoordinator.js +147 -0
- package/dist/worldCatalog.js +80 -0
- package/dist/worldCellAllocation.js +202 -0
- package/dist/worldCellDestination.js +67 -0
- package/dist/worldCells.js +488 -0
- package/dist/worldChange.js +31 -0
- package/dist/worldClient.js +663 -0
- package/dist/worldClientControl.js +140 -0
- package/dist/worldClientPendingInput.js +15 -0
- package/dist/worldClientRpc.js +132 -0
- package/dist/worldClientRpcRoutes.js +42 -0
- package/dist/worldClientSchemas.js +27 -0
- package/dist/worldCommands.js +139 -0
- package/dist/worldData.js +41 -0
- package/dist/worldDefaultBinding.js +376 -0
- package/dist/worldDefaultGroupAdmission.js +81 -0
- package/dist/worldDefaultGroupAppServices.js +30 -0
- package/dist/worldDefaultGroupCompensation.js +108 -0
- package/dist/worldDefaultGroupContinuation.js +95 -0
- package/dist/worldDefaultGroupControl.js +71 -0
- package/dist/worldDefaultGroupMembers.js +84 -0
- package/dist/worldDefaultGroups.js +20 -0
- package/dist/worldDefaultPending.js +78 -0
- package/dist/worldDefaultService.js +244 -0
- package/dist/worldEntities.js +2979 -0
- package/dist/worldEntityCodec.js +20 -0
- package/dist/worldEntityHandoffView.js +153 -0
- package/dist/worldGeometry.js +169 -0
- package/dist/worldGhostAdmission.js +64 -0
- package/dist/worldGhostDestination.js +117 -0
- package/dist/worldGhostGateway.js +131 -0
- package/dist/worldGhostHandshake.js +107 -0
- package/dist/worldGhostHost.js +41 -0
- package/dist/worldGhostIngress.js +131 -0
- package/dist/worldGhostNeighborhood.js +69 -0
- package/dist/worldGhostNeighbors.js +85 -0
- package/dist/worldGhostOutbound.js +109 -0
- package/dist/worldGhostPublisher.js +215 -0
- package/dist/worldGhostReceiver.js +212 -0
- package/dist/worldGhostSender.js +145 -0
- package/dist/worldGhostSocket.js +77 -0
- package/dist/worldGhostWire.js +171 -0
- package/dist/worldGroupCommand.js +48 -0
- package/dist/worldGroupDeadline.js +114 -0
- package/dist/worldGroupPreparation.js +114 -0
- package/dist/worldGroupReadyControl.js +127 -0
- package/dist/worldGroupSupervisor.js +119 -0
- package/dist/worldHandoffMetrics.js +58 -0
- package/dist/worldHandoffView.js +99 -0
- package/dist/worldHostSource.js +68 -0
- package/dist/worldInspectEndpoint.js +249 -0
- package/dist/worldInspection.js +108 -0
- package/dist/worldInstanceAdmission.js +30 -0
- package/dist/worldInstanceAllocation.js +115 -0
- package/dist/worldInstanceDestination.js +63 -0
- package/dist/worldInstanceExpiry.js +281 -0
- package/dist/worldInstanceExpirySupervisor.js +87 -0
- package/dist/worldInstanceLifecycle.js +102 -0
- package/dist/worldInstanceState.js +51 -0
- package/dist/worldInstances.js +477 -0
- package/dist/worldJoin.js +55 -0
- package/dist/worldLayers.js +150 -0
- package/dist/worldLeases.js +77 -0
- package/dist/worldManifest.js +24 -0
- package/dist/worldMovement.js +62 -0
- package/dist/worldPersistence.js +133 -0
- package/dist/worldProjection.js +220 -0
- package/dist/worldReact.js +109 -0
- package/dist/worldRecoveryActor.js +34 -0
- package/dist/worldReturnAnchor.js +48 -0
- package/dist/worldRoomHooks.js +56 -0
- package/dist/worldRoomPool.js +26 -0
- package/dist/worldRoomSteps.js +132 -0
- package/dist/worldSeatBinding.js +35 -0
- package/dist/worldServer.d.ts +6936 -0
- package/dist/worldServer.js +48 -0
- package/dist/worldSourceSeatPending.js +8 -0
- package/dist/worldStrategyFixtures.js +163 -0
- package/dist/worldTesting.js +26 -0
- package/dist/worldTransitionDefaults.js +197 -0
- package/dist/worldTransitionExecutor.js +518 -0
- package/dist/worldTransitionGroup.js +112 -0
- package/dist/worldTransitionPhysicalSteps.js +39 -0
- package/dist/worldTransitionResolver.js +227 -0
- package/dist/worldTransitionSeatGroup.js +63 -0
- package/dist/worldTransitionSeats.js +259 -0
- package/dist/worldTransitionState.js +94 -0
- package/dist/worldTransitions.js +100 -0
- package/package.json +189 -4
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { ROOM_SNAPSHOT_SEGMENTS_TABLE as t } from "./identities.js";
|
|
3
|
+
import { captureRoomSnapshotBlobReference as n } from "./snapshotBlob.js";
|
|
4
|
+
import { and as r, eq as i } from "@voltro/database";
|
|
5
|
+
// src/snapshotSegmentBlobs.ts
|
|
6
|
+
function a(t) {
|
|
7
|
+
throw new e({ detail: t });
|
|
8
|
+
}
|
|
9
|
+
var o = (e, t) => r(i("roomId", e), i("tenantId", t)), s = (e, t, r, i) => e.blob == null ? null : e.roomId !== t || e.tenantId !== r || !(e.bytes instanceof Uint8Array) || e.bytes.byteLength !== 0 ? a("Snapshot segment blob has mixed or foreign SQL payload identity") : n(e.blob, {
|
|
10
|
+
roomId: t,
|
|
11
|
+
tenantId: r,
|
|
12
|
+
epoch: e.epoch,
|
|
13
|
+
revision: e.revision
|
|
14
|
+
}, i), c = async (e, n, r, i, c) => {
|
|
15
|
+
if (c !== void 0 && (!Number.isSafeInteger(c) || c < 2)) return a("Invalid snapshot segment withdrawal boundary");
|
|
16
|
+
let l = await e.query({
|
|
17
|
+
table: t,
|
|
18
|
+
predicate: o(n, r),
|
|
19
|
+
order: [],
|
|
20
|
+
take: 146,
|
|
21
|
+
skip: void 0,
|
|
22
|
+
projection: [
|
|
23
|
+
"id",
|
|
24
|
+
"roomId",
|
|
25
|
+
"tenantId",
|
|
26
|
+
"epoch",
|
|
27
|
+
"revision",
|
|
28
|
+
"bytes",
|
|
29
|
+
"blob"
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
if (l.length > 145) return a("Snapshot segment claim inventory exceeds its bound");
|
|
33
|
+
let u = [];
|
|
34
|
+
for (let e of l) {
|
|
35
|
+
if (c !== void 0 && (e.roomId !== n || e.tenantId !== r || !Number.isSafeInteger(e.epoch) || Number(e.epoch) < 1 || Number(e.epoch) >= c || !Number.isSafeInteger(e.revision) || Number(e.revision) < 1)) return a("Snapshot segment still has an unfenced writer");
|
|
36
|
+
let t = s(e, n, r, i);
|
|
37
|
+
t && u.push(t);
|
|
38
|
+
}
|
|
39
|
+
return u;
|
|
40
|
+
}, l = async (e, n, c, l, u) => {
|
|
41
|
+
let d = await e.query({
|
|
42
|
+
table: t,
|
|
43
|
+
predicate: u ? r(o(n, c), u) : o(n, c),
|
|
44
|
+
order: [],
|
|
45
|
+
take: 146,
|
|
46
|
+
skip: void 0,
|
|
47
|
+
projection: void 0
|
|
48
|
+
});
|
|
49
|
+
if (d.length > 145) return a("Snapshot segment retirement exceeds its bound");
|
|
50
|
+
let f = [];
|
|
51
|
+
for (let a of d) {
|
|
52
|
+
let u = s(a, n, c, l);
|
|
53
|
+
u && f.push(u), await e.deleteMany(t, { where: r(o(n, c), i("id", a.id)) });
|
|
54
|
+
}
|
|
55
|
+
return f;
|
|
56
|
+
};
|
|
57
|
+
export { s as captureRoomSnapshotSegmentBlob, c as readRoomSnapshotSegmentBlobs, l as retireRoomSnapshotSegments };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { ROOMS_TABLE as t, ROOM_CHECKPOINTS_TABLE as n } from "./identities.js";
|
|
3
|
+
import { canonicalRoomJson as r } from "./checkpointJson.js";
|
|
4
|
+
import { captureRoomSnapshotBlobReference as i } from "./snapshotBlob.js";
|
|
5
|
+
import { captureRoomSnapshotBlobs as a, captureRoomSnapshotEffectRunner as o } from "./snapshotBlobIndex.js";
|
|
6
|
+
import { readRoomSnapshotSegmentBlobs as s } from "./snapshotSegmentBlobs.js";
|
|
7
|
+
import { readRoomSnapshotBlobJournal as c } from "./snapshotBlobCleanup.js";
|
|
8
|
+
import { and as l, eq as u } from "@voltro/database";
|
|
9
|
+
import { Effect as d } from "effect";
|
|
10
|
+
import { createHash as f } from "node:crypto";
|
|
11
|
+
// src/snapshotUploads.ts
|
|
12
|
+
function p(t) {
|
|
13
|
+
throw new e({ detail: t });
|
|
14
|
+
}
|
|
15
|
+
var m = (e) => f("sha256").update(e).digest("hex"), h = (e, t) => l(u("id", e), u("tenantId", t)), g = (e) => `rooms:snapshot:${m(e.claimId)}`, _ = (e, t) => r({
|
|
16
|
+
...e,
|
|
17
|
+
reference: null
|
|
18
|
+
}) === r({
|
|
19
|
+
...t,
|
|
20
|
+
reference: null
|
|
21
|
+
}), v = async (e, n, r) => (await e.query({
|
|
22
|
+
table: t,
|
|
23
|
+
predicate: h(n, r),
|
|
24
|
+
order: [],
|
|
25
|
+
take: 1,
|
|
26
|
+
skip: void 0,
|
|
27
|
+
projection: void 0,
|
|
28
|
+
lock: "update"
|
|
29
|
+
}))[0] || p("Snapshot upload journal lost its SQL room authority"), y = (e, t, n, r) => {
|
|
30
|
+
if (!e || typeof e != "object" || Array.isArray(e) || Object.keys(e).some((e) => ![
|
|
31
|
+
"roomId",
|
|
32
|
+
"tenantId",
|
|
33
|
+
"hostId",
|
|
34
|
+
"epoch",
|
|
35
|
+
"revision",
|
|
36
|
+
"requestId",
|
|
37
|
+
"fingerprint",
|
|
38
|
+
"claimId",
|
|
39
|
+
"size",
|
|
40
|
+
"checksum",
|
|
41
|
+
"reference"
|
|
42
|
+
].includes(e)) || e.roomId !== t || e.tenantId !== n || ![
|
|
43
|
+
t,
|
|
44
|
+
n,
|
|
45
|
+
e.hostId
|
|
46
|
+
].every((e) => typeof e == "string" && e.trim() && e.length <= 191) || ![
|
|
47
|
+
e.epoch,
|
|
48
|
+
e.revision,
|
|
49
|
+
e.size
|
|
50
|
+
].every((e) => Number.isSafeInteger(e) && e > 0) || e.size > r || e.requestId !== `${t}:${e.epoch}:checkpoint:${e.revision}` || e.requestId.length > 191 || typeof e.claimId != "string" || e.claimId.length > 191 || ![e.fingerprint, e.checksum].every((e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e)) || e.claimId !== e.requestId && e.claimId !== `${e.requestId}:segment` || e.reference === void 0) return p("Malformed scoped snapshot upload intent");
|
|
51
|
+
let a = e.reference === null ? null : i(e.reference, e, r);
|
|
52
|
+
return a && (a.claim !== g(e) || a.size !== e.size || a.checksum !== e.checksum) ? p("Snapshot upload receipt does not match its durable intent") : Object.freeze({
|
|
53
|
+
roomId: t,
|
|
54
|
+
tenantId: n,
|
|
55
|
+
hostId: e.hostId,
|
|
56
|
+
epoch: e.epoch,
|
|
57
|
+
revision: e.revision,
|
|
58
|
+
requestId: e.requestId,
|
|
59
|
+
fingerprint: e.fingerprint,
|
|
60
|
+
claimId: e.claimId,
|
|
61
|
+
size: e.size,
|
|
62
|
+
checksum: e.checksum,
|
|
63
|
+
reference: a
|
|
64
|
+
});
|
|
65
|
+
}, b = (e, t, n, r) => {
|
|
66
|
+
if (e.id !== t || e.tenantId !== n || !Number.isSafeInteger(e.epoch) || Number(e.epoch) < 1) return p("Snapshot upload journal has foreign SQL room identity");
|
|
67
|
+
let i = e.snapshotUploads;
|
|
68
|
+
if (i == null) return [];
|
|
69
|
+
if (!Array.isArray(i) || i.length > 16) return p("Snapshot upload journal exceeds its bounded inventory");
|
|
70
|
+
let a = /* @__PURE__ */ new Set(), o = [];
|
|
71
|
+
for (let s = 0; s < i.length; s++) {
|
|
72
|
+
if (!Object.hasOwn(i, s)) return p("Snapshot upload journal cannot be sparse");
|
|
73
|
+
let c = y(i[s], t, n, r);
|
|
74
|
+
if (c.epoch > Number(e.epoch) || a.has(c.requestId)) return p("Snapshot upload journal contains a future or duplicate owner request");
|
|
75
|
+
a.add(c.requestId), o.push(c);
|
|
76
|
+
}
|
|
77
|
+
return Object.freeze(o);
|
|
78
|
+
}, x = async (e, n, r, i) => {
|
|
79
|
+
let a = y(r, r.roomId, r.tenantId, i), o = b(n, a.roomId, a.tenantId, i), s = o.find((e) => e.requestId === a.requestId);
|
|
80
|
+
s ? _(s, a) || p("Snapshot upload request identity was reused") : (o.length >= 16 && p("Snapshot upload journal must drain before another preupload"), await e.updateMany(t, { snapshotUploads: [...o, a] }, { where: h(a.roomId, a.tenantId) }));
|
|
81
|
+
}, S = async (e, n, i, a) => e.transactional(async (e) => {
|
|
82
|
+
let o = y({
|
|
83
|
+
...n,
|
|
84
|
+
reference: i
|
|
85
|
+
}, n.roomId, n.tenantId, a), s = b(await v(e, n.roomId, n.tenantId), n.roomId, n.tenantId, a), c = s.find((e) => e.requestId === n.requestId);
|
|
86
|
+
if (!c || !_(c, o) || c.reference && r(c.reference) !== r(i)) return p("Snapshot upload receipt no longer owns its durable journal entry");
|
|
87
|
+
await e.updateMany(t, { snapshotUploads: s.map((e) => e.requestId === n.requestId ? o : e) }, { where: h(n.roomId, n.tenantId) });
|
|
88
|
+
}), C = async (e, n, r, i, a, o) => {
|
|
89
|
+
let s = b(await v(e, n, r), n, r, o), c = s.find((e) => e.requestId === i);
|
|
90
|
+
if (c) {
|
|
91
|
+
if (c.fingerprint !== a) return p("Snapshot upload journal completion has unrelated checkpoint identity");
|
|
92
|
+
await e.updateMany(t, { snapshotUploads: s.filter((e) => e.requestId !== i) }, { where: h(n, r) });
|
|
93
|
+
}
|
|
94
|
+
}, w = (r, f, m, _, x = 1048576) => {
|
|
95
|
+
let w = a(f);
|
|
96
|
+
return !w || ![m, _].every((e) => typeof e == "string" && e.trim() && e.length <= 191) || !Number.isSafeInteger(x) || x < 1 || x > 67108864 ? d.fail(new e({ detail: "Invalid scoped snapshot upload recovery budget" })) : d.flatMap(d.context(), (a) => d.uninterruptible(d.tryPromise({
|
|
97
|
+
try: async () => {
|
|
98
|
+
let e = o(a), d = await r.transactional(async (e) => {
|
|
99
|
+
let r = await v(e, m, _), a = b(r, m, _, x);
|
|
100
|
+
if (!a.length) return {
|
|
101
|
+
indexed: 0,
|
|
102
|
+
candidates: [],
|
|
103
|
+
pending: 0
|
|
104
|
+
};
|
|
105
|
+
let o = (await e.query({
|
|
106
|
+
table: n,
|
|
107
|
+
predicate: l(u("roomId", m), u("tenantId", _)),
|
|
108
|
+
order: [],
|
|
109
|
+
take: 1,
|
|
110
|
+
skip: void 0,
|
|
111
|
+
projection: void 0,
|
|
112
|
+
lock: "update"
|
|
113
|
+
}))[0], d = c(o, m, _, x), f = [
|
|
114
|
+
...d.blobHistory,
|
|
115
|
+
...d.retiredBlobs,
|
|
116
|
+
...await s(e, m, _, x)
|
|
117
|
+
];
|
|
118
|
+
o?.blob && f.push(i(o.blob, o.checkpoint, x));
|
|
119
|
+
let p = /* @__PURE__ */ new Set();
|
|
120
|
+
for (let e of a) {
|
|
121
|
+
let t = f.find((t) => t.claim === g(e) && t.epoch === e.epoch && t.revision === e.revision);
|
|
122
|
+
t && (y({
|
|
123
|
+
...e,
|
|
124
|
+
reference: t
|
|
125
|
+
}, m, _, x), p.add(e.requestId));
|
|
126
|
+
}
|
|
127
|
+
p.size && await e.updateMany(t, { snapshotUploads: a.filter((e) => !p.has(e.requestId)) }, { where: h(m, _) });
|
|
128
|
+
let S = a.filter((e) => !p.has(e.requestId)), C = S.filter((e) => Number(r.epoch) > e.epoch);
|
|
129
|
+
return {
|
|
130
|
+
indexed: p.size,
|
|
131
|
+
candidates: C,
|
|
132
|
+
pending: S.length - C.length
|
|
133
|
+
};
|
|
134
|
+
}), f = 0, T = d.pending;
|
|
135
|
+
for (let t of d.candidates) {
|
|
136
|
+
let n = t.reference;
|
|
137
|
+
if (!n) {
|
|
138
|
+
let i = await e(w.recover(t));
|
|
139
|
+
if (!i || typeof i != "object" || ![
|
|
140
|
+
"pending",
|
|
141
|
+
"ready",
|
|
142
|
+
"released"
|
|
143
|
+
].includes(i.state)) return p("Snapshot recovery port returned an invalid durable observation");
|
|
144
|
+
if (i.state === "pending") {
|
|
145
|
+
T++;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (n = y({
|
|
149
|
+
...t,
|
|
150
|
+
reference: i.reference
|
|
151
|
+
}, m, _, x).reference, !n) return p("Snapshot recovered upload has no exact claim");
|
|
152
|
+
await S(r, t, n, x);
|
|
153
|
+
}
|
|
154
|
+
await e(w.release(n, n)), await r.transactional((e) => C(e, m, _, t.requestId, t.fingerprint, x)), f++;
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
indexed: d.indexed,
|
|
158
|
+
released: f,
|
|
159
|
+
pending: T
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
catch: (t) => t instanceof e ? t : new e({ detail: "Snapshot upload recovery remains unconfirmed" })
|
|
163
|
+
})));
|
|
164
|
+
};
|
|
165
|
+
export { x as appendRoomSnapshotUploadIntent, y as captureRoomSnapshotUploadIntent, w as cleanupRoomSnapshotUploads, C as finishRoomSnapshotUploadIntent, b as readRoomSnapshotUploadJournal, S as recordRoomSnapshotUploadReference };
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t, RoomAuthoringError as n } from "./errors.js";
|
|
2
|
+
import { captureRoomTransportClock as r, captureRoomTransportDataMethod as i } from "./transportAuthoring.js";
|
|
3
|
+
import { RoomTransportCleanupFailure as a } from "./transportCleanup.js";
|
|
4
|
+
// src/socketTransport.ts
|
|
5
|
+
var o = (e) => {
|
|
6
|
+
let n = Reflect.get(globalThis, "WebSocket");
|
|
7
|
+
if (typeof n != "function") throw new t({ detail: "This platform requires a Room WebSocket factory" });
|
|
8
|
+
return Reflect.construct(n, [e]);
|
|
9
|
+
}, s = (e) => Number.isSafeInteger(e) ? e === 1e3 || e >= 3e3 && e <= 4999 ? e : e >= 1001 && e <= 1014 ? 4e3 + e - 1e3 : 4e3 : 4e3, ee = (e) => {
|
|
10
|
+
let t = "", n = 0, r = new TextEncoder();
|
|
11
|
+
for (let i of e) {
|
|
12
|
+
let e = r.encode(i).byteLength;
|
|
13
|
+
if (n + e > 123) break;
|
|
14
|
+
n += e, t += i;
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
}, c = (c, l, u = {}) => {
|
|
18
|
+
if (l.aborted) return Promise.reject(new t({ detail: "Room socket connection was cancelled" }));
|
|
19
|
+
let d = [
|
|
20
|
+
"factory",
|
|
21
|
+
"clock",
|
|
22
|
+
"connectTimeoutMs",
|
|
23
|
+
"drainPollMs",
|
|
24
|
+
"maxFrameBytes",
|
|
25
|
+
"maxPendingBytes",
|
|
26
|
+
"maxPendingFrames",
|
|
27
|
+
"highWaterBytes",
|
|
28
|
+
"maxListeners"
|
|
29
|
+
];
|
|
30
|
+
if (!u || Object.getPrototypeOf(u) !== Object.prototype || Reflect.ownKeys(u).some((e) => {
|
|
31
|
+
let t = Object.getOwnPropertyDescriptor(u, e);
|
|
32
|
+
return typeof e != "string" || !d.includes(e) || !t?.enumerable || !("value" in t);
|
|
33
|
+
}) || u.factory !== void 0 && typeof u.factory != "function") return Promise.reject(new n({
|
|
34
|
+
room: "socket",
|
|
35
|
+
detail: "Room socket options require exact own providers and budgets"
|
|
36
|
+
}));
|
|
37
|
+
let f = Object.freeze({
|
|
38
|
+
connectTimeoutMs: 5e3,
|
|
39
|
+
drainPollMs: 10,
|
|
40
|
+
maxFrameBytes: 65536,
|
|
41
|
+
maxPendingBytes: 1048576,
|
|
42
|
+
maxPendingFrames: 128,
|
|
43
|
+
highWaterBytes: 32768,
|
|
44
|
+
maxListeners: 128,
|
|
45
|
+
...u
|
|
46
|
+
});
|
|
47
|
+
for (let e of [
|
|
48
|
+
f.connectTimeoutMs,
|
|
49
|
+
f.drainPollMs,
|
|
50
|
+
f.maxFrameBytes,
|
|
51
|
+
f.maxPendingBytes,
|
|
52
|
+
f.maxPendingFrames,
|
|
53
|
+
f.highWaterBytes,
|
|
54
|
+
f.maxListeners
|
|
55
|
+
]) if (!Number.isSafeInteger(e) || e < 1) return Promise.reject(new n({
|
|
56
|
+
room: "socket",
|
|
57
|
+
detail: "Socket budgets must be positive safe integers"
|
|
58
|
+
}));
|
|
59
|
+
if (f.maxFrameBytes > f.maxPendingBytes || f.connectTimeoutMs > 2147483647 || f.drainPollMs > 2147483647) return Promise.reject(new n({
|
|
60
|
+
room: "socket",
|
|
61
|
+
detail: "Socket frame or timer budget exceeds its parent budget"
|
|
62
|
+
}));
|
|
63
|
+
let p, m;
|
|
64
|
+
try {
|
|
65
|
+
p = r(f.clock ?? { now: () => performance.now() });
|
|
66
|
+
let e = new URL(c);
|
|
67
|
+
if (!["ws:", "wss:"].includes(e.protocol) || e.username || e.password || e.search || e.hash) throw new t({ detail: "Rooms socket address must contain no credentials, query or fragment" });
|
|
68
|
+
m = (f.factory ?? o)(e.toString());
|
|
69
|
+
} catch (e) {
|
|
70
|
+
return Promise.reject(e instanceof t || e instanceof n ? e : new t({ detail: "Room socket native acquisition failed" }));
|
|
71
|
+
}
|
|
72
|
+
let h, g, _, v;
|
|
73
|
+
try {
|
|
74
|
+
h = i(m, "addEventListener", "Room socket needs an actual event observer"), g = i(m, "removeEventListener", "Room socket needs actual event withdrawal"), _ = i(m, "close", "Room socket needs an actual native close"), v = i(m, "send", "Room socket needs an actual binary writer");
|
|
75
|
+
} catch {
|
|
76
|
+
let e = !1, n = new a(async () => {
|
|
77
|
+
if (e ||= (i(m, "close", "Room socket parent release remains unavailable")(1e3, "Room socket provider admission failed"), !0), m.readyState !== 3) throw new t({ detail: "Room socket provider terminal evidence remains unavailable" });
|
|
78
|
+
});
|
|
79
|
+
return n.cleanupAsync().then(() => {
|
|
80
|
+
throw new t({ detail: "Room socket provider admission failed" });
|
|
81
|
+
}, () => {
|
|
82
|
+
throw n;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
let y = new AbortController(), b = /* @__PURE__ */ new Set(), x = [], S = /* @__PURE__ */ new Set(), C = 0, w = !1, T = !1, E = !1, D = !1, O = !1, k = !1, A = -1, j, M = !1, N, P, F, I, L = new Promise((e) => {
|
|
86
|
+
I = e;
|
|
87
|
+
}), R, z, B = new Promise((e, t) => {
|
|
88
|
+
R = e, z = t;
|
|
89
|
+
}), V = () => {
|
|
90
|
+
let e = p.now();
|
|
91
|
+
if (!Number.isFinite(e) || e < 0 || e < A) throw new t({ detail: "Socket receive clock must be monotonic" });
|
|
92
|
+
return A = e, e;
|
|
93
|
+
}, H = () => {
|
|
94
|
+
let e = m.bufferedAmount;
|
|
95
|
+
if (!Number.isSafeInteger(e) || e < 0) throw new t({ detail: "Platform socket returned an invalid buffer size" });
|
|
96
|
+
return e;
|
|
97
|
+
}, U = () => x.reduce((e, t) => e + (t.sent ? 0 : t.frame.byteLength), H()), W = (e) => {
|
|
98
|
+
if (!w) {
|
|
99
|
+
w = !0, N !== void 0 && clearTimeout(N), P !== void 0 && clearTimeout(P), N = void 0, P = void 0;
|
|
100
|
+
for (let t of x.splice(0)) t.reject(e);
|
|
101
|
+
C = 0, b.clear(), y.abort();
|
|
102
|
+
}
|
|
103
|
+
}, G = () => {
|
|
104
|
+
D || O || (_(F.code, F.reason), O = !0);
|
|
105
|
+
}, K = new a(async () => {
|
|
106
|
+
if (j !== void 0) throw j = void 0, new t({ detail: "Room socket native close remains incomplete" });
|
|
107
|
+
!D && m.readyState === 3 && (D = !0, I()), !D && !k && (S.add("close"), h("close", Z), k = !0), G(), await L;
|
|
108
|
+
let e = !1;
|
|
109
|
+
for (let [t, n] of $) if (S.has(t)) try {
|
|
110
|
+
g(t, n), S.delete(t), t === "close" && (k = !1);
|
|
111
|
+
} catch {
|
|
112
|
+
e = !0;
|
|
113
|
+
}
|
|
114
|
+
if (M) try {
|
|
115
|
+
l.removeEventListener("abort", Q), M = !1;
|
|
116
|
+
} catch {
|
|
117
|
+
e = !0;
|
|
118
|
+
}
|
|
119
|
+
if (e) throw new t({ detail: "Room socket listener cleanup remains incomplete" });
|
|
120
|
+
}), q = (e, n, r) => {
|
|
121
|
+
if (F ??= Object.freeze({
|
|
122
|
+
code: s(e),
|
|
123
|
+
reason: ee(n)
|
|
124
|
+
}), W(r), j === void 0) try {
|
|
125
|
+
G();
|
|
126
|
+
} catch {
|
|
127
|
+
j = new t({ detail: "Room socket native close failed" });
|
|
128
|
+
}
|
|
129
|
+
let i = K.cleanupAsync();
|
|
130
|
+
return i.then(() => {
|
|
131
|
+
z(r);
|
|
132
|
+
}, () => {
|
|
133
|
+
z(K);
|
|
134
|
+
}), i;
|
|
135
|
+
}, J = (e, t, n) => {
|
|
136
|
+
q(e, t, n).catch(() => {});
|
|
137
|
+
}, Y = () => {
|
|
138
|
+
if (N = void 0, !w && T) try {
|
|
139
|
+
if (m.readyState !== 1) {
|
|
140
|
+
J(1e3, "Room socket is no longer open", new t({ detail: "Room socket is no longer open" }));
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (H() > f.maxPendingBytes) throw new e({
|
|
144
|
+
budget: "socketPendingBytes",
|
|
145
|
+
limit: f.maxPendingBytes
|
|
146
|
+
});
|
|
147
|
+
for (; x.length;) {
|
|
148
|
+
let e = x[0];
|
|
149
|
+
if (e.sent) {
|
|
150
|
+
if (H() !== 0) break;
|
|
151
|
+
x.shift(), C -= e.frame.byteLength, e.resolve();
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
let t = H();
|
|
155
|
+
if (t > 0 && t + e.frame.byteLength > f.highWaterBytes) break;
|
|
156
|
+
v(e.frame), e.sent = !0;
|
|
157
|
+
}
|
|
158
|
+
x.length && (N = setTimeout(Y, f.drainPollMs));
|
|
159
|
+
} catch (t) {
|
|
160
|
+
J(t instanceof e ? 1009 : 1002, "Room socket write failed", t);
|
|
161
|
+
}
|
|
162
|
+
}, te = Object.freeze({
|
|
163
|
+
name: "ws",
|
|
164
|
+
signal: y.signal,
|
|
165
|
+
reliable: Object.freeze({
|
|
166
|
+
send: (n) => {
|
|
167
|
+
if (w || !T) return Promise.reject(new t({ detail: "Room socket is not open" }));
|
|
168
|
+
if (!(n instanceof Uint8Array)) return Promise.reject(new t({ detail: "Room socket requires binary bytes" }));
|
|
169
|
+
if (n.byteLength > f.maxFrameBytes) return Promise.reject(new e({
|
|
170
|
+
budget: "socketFrameBytes",
|
|
171
|
+
limit: f.maxFrameBytes
|
|
172
|
+
}));
|
|
173
|
+
if (x.length >= f.maxPendingFrames || C + n.byteLength > f.maxPendingBytes) {
|
|
174
|
+
let t = x.length >= f.maxPendingFrames ? new e({
|
|
175
|
+
budget: "socketPendingFrames",
|
|
176
|
+
limit: f.maxPendingFrames
|
|
177
|
+
}) : new e({
|
|
178
|
+
budget: "socketPendingBytes",
|
|
179
|
+
limit: f.maxPendingBytes
|
|
180
|
+
});
|
|
181
|
+
return J(1009, "Room socket queue exceeded its budget", t), Promise.reject(t);
|
|
182
|
+
}
|
|
183
|
+
let r = new Promise((e, t) => {
|
|
184
|
+
let r = Uint8Array.from(n);
|
|
185
|
+
x.push({
|
|
186
|
+
frame: r,
|
|
187
|
+
resolve: e,
|
|
188
|
+
reject: t,
|
|
189
|
+
sent: !1
|
|
190
|
+
}), C += r.byteLength;
|
|
191
|
+
});
|
|
192
|
+
return N === void 0 && Y(), r;
|
|
193
|
+
},
|
|
194
|
+
onFrame: (n) => {
|
|
195
|
+
if (w || typeof n != "function") throw new t({ detail: "Room socket cannot attach this listener after close" });
|
|
196
|
+
if (!b.has(n) && b.size >= f.maxListeners) throw new e({
|
|
197
|
+
budget: "roomTransportListeners",
|
|
198
|
+
limit: f.maxListeners
|
|
199
|
+
});
|
|
200
|
+
return b.add(n), () => {
|
|
201
|
+
b.delete(n);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
stats: () => ({
|
|
206
|
+
rttMs: null,
|
|
207
|
+
queuedBytes: w ? 0 : U(),
|
|
208
|
+
droppedDatagrams: 0
|
|
209
|
+
}),
|
|
210
|
+
close: (e, n) => J(e, n, new t({ detail: "Room socket was closed" })),
|
|
211
|
+
closeAsync: (e, n) => q(e, n, new t({ detail: "Room socket was closed" }))
|
|
212
|
+
}), X = () => {
|
|
213
|
+
w || T || !E || (T = !0, P !== void 0 && clearTimeout(P), P = void 0, R(te));
|
|
214
|
+
}, ne = (n) => {
|
|
215
|
+
if (!w && T) try {
|
|
216
|
+
let r = n.data, i = r instanceof ArrayBuffer ? new Uint8Array(r) : ArrayBuffer.isView(r) ? new Uint8Array(r.buffer, r.byteOffset, r.byteLength) : null;
|
|
217
|
+
if (!i) throw new t({ detail: "Rooms sockets require binary frames" });
|
|
218
|
+
if (i.byteLength > f.maxFrameBytes) throw new e({
|
|
219
|
+
budget: "socketFrameBytes",
|
|
220
|
+
limit: f.maxFrameBytes
|
|
221
|
+
});
|
|
222
|
+
let a = V();
|
|
223
|
+
for (let e of b) {
|
|
224
|
+
if (w) break;
|
|
225
|
+
e(Uint8Array.from(i), a);
|
|
226
|
+
}
|
|
227
|
+
} catch (t) {
|
|
228
|
+
J(t instanceof e ? 1009 : 1002, "Room socket frame refused", t);
|
|
229
|
+
}
|
|
230
|
+
}, Z = () => {
|
|
231
|
+
D = !0, I(), J(1e3, "Room socket disconnected", new t({ detail: "Room socket disconnected" }));
|
|
232
|
+
}, re = () => {
|
|
233
|
+
w || J(1002, "Room socket failed", new t({ detail: "Room socket failed" }));
|
|
234
|
+
}, Q = () => {
|
|
235
|
+
w || J(1e3, "Room socket cancelled", new t({ detail: "Room socket connection was cancelled" }));
|
|
236
|
+
}, $ = [
|
|
237
|
+
["open", X],
|
|
238
|
+
["message", ne],
|
|
239
|
+
["close", Z],
|
|
240
|
+
["error", re]
|
|
241
|
+
];
|
|
242
|
+
try {
|
|
243
|
+
if (S.add("close"), h("close", Z), k = !0, w) throw new t({ detail: "Room socket closed during observer admission" });
|
|
244
|
+
m.binaryType = "arraybuffer";
|
|
245
|
+
for (let [e, t] of $) e !== "close" && (S.add(e), h(e, t));
|
|
246
|
+
M = !0, l.addEventListener("abort", Q, { once: !0 }), E = !0, w || (P = setTimeout(() => J(1e3, "Room socket connection timed out", new t({ detail: "Room socket connection timed out" })), f.connectTimeoutMs)), l.aborted ? Q() : m.readyState === 1 ? X() : m.readyState === 3 ? Z() : m.readyState !== 0 && J(1e3, "Room socket admission failed", new t({ detail: "Room socket is already closing" }));
|
|
247
|
+
} catch {
|
|
248
|
+
J(1e3, "Room socket initialization failed", new t({ detail: "Room socket initialization failed" }));
|
|
249
|
+
}
|
|
250
|
+
return B;
|
|
251
|
+
};
|
|
252
|
+
export { o as defaultRoomWebSocketFactory, c as openRoomSocketTransport };
|
package/dist/spatial.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { BudgetExceeded as e, RoomAuthoringError as t } from "./errors.js";
|
|
2
|
+
// src/spatial.ts
|
|
3
|
+
function n(e) {
|
|
4
|
+
throw new t({
|
|
5
|
+
room: "spatial",
|
|
6
|
+
detail: e
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
var r = (e) => {
|
|
10
|
+
Number.isFinite(e.x) && Number.isFinite(e.y) || n("Spatial positions must be finite");
|
|
11
|
+
}, i = (e) => Number.isSafeInteger(e) && e > 0 ? e : n("Spatial budgets must be positive safe integers"), a = class {
|
|
12
|
+
entities = /* @__PURE__ */ new Map();
|
|
13
|
+
cells = /* @__PURE__ */ new Map();
|
|
14
|
+
options;
|
|
15
|
+
constructor(e) {
|
|
16
|
+
(!Number.isFinite(e.cell) || e.cell <= 0) && n("Spatial cell size must be positive and finite"), i(e.maxEntities), i(e.maxQueryCells), this.options = Object.freeze({ ...e });
|
|
17
|
+
}
|
|
18
|
+
coordinate(e) {
|
|
19
|
+
let t = Math.floor(e / this.options.cell);
|
|
20
|
+
return Number.isSafeInteger(t) ? t : n("Spatial cell coordinate exceeds its integer range");
|
|
21
|
+
}
|
|
22
|
+
key(e) {
|
|
23
|
+
return r(e), `${this.coordinate(e.x)}:${this.coordinate(e.y)}`;
|
|
24
|
+
}
|
|
25
|
+
set(t, i, a) {
|
|
26
|
+
t.trim() || n("Spatial entity id is required"), r(i);
|
|
27
|
+
let o = this.entities.get(t);
|
|
28
|
+
if (!o && this.entities.size >= this.options.maxEntities) throw new e({
|
|
29
|
+
budget: "spatialEntities",
|
|
30
|
+
limit: this.options.maxEntities
|
|
31
|
+
});
|
|
32
|
+
let s = this.key(i), c = structuredClone(a);
|
|
33
|
+
o && o.cell !== s && this.removeFromCell(t, o.cell);
|
|
34
|
+
let l = this.cells.get(s) ?? /* @__PURE__ */ new Set();
|
|
35
|
+
l.add(t), this.cells.set(s, l), this.entities.set(t, {
|
|
36
|
+
cell: s,
|
|
37
|
+
position: Object.freeze({ ...i }),
|
|
38
|
+
value: c
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
removeFromCell(e, t) {
|
|
42
|
+
let n = this.cells.get(t);
|
|
43
|
+
n?.delete(e), n?.size === 0 && this.cells.delete(t);
|
|
44
|
+
}
|
|
45
|
+
delete(e) {
|
|
46
|
+
let t = this.entities.get(e);
|
|
47
|
+
return t ? (this.removeFromCell(e, t.cell), this.entities.delete(e)) : !1;
|
|
48
|
+
}
|
|
49
|
+
get(e) {
|
|
50
|
+
let t = this.entities.get(e);
|
|
51
|
+
return t === void 0 ? void 0 : structuredClone(t.value);
|
|
52
|
+
}
|
|
53
|
+
nearby(t, a, o = this.options.maxEntities) {
|
|
54
|
+
r(t), i(o), (!Number.isFinite(a) || a < 0) && n("Spatial radius must be finite and nonnegative");
|
|
55
|
+
let s = this.coordinate(t.x - a), c = this.coordinate(t.x + a), l = this.coordinate(t.y - a), u = this.coordinate(t.y + a), d = (c - s + 1) * (u - l + 1);
|
|
56
|
+
if (!Number.isSafeInteger(d) || d > this.options.maxQueryCells) throw new e({
|
|
57
|
+
budget: "spatialQueryCells",
|
|
58
|
+
limit: this.options.maxQueryCells
|
|
59
|
+
});
|
|
60
|
+
let f = [];
|
|
61
|
+
for (let e = s; e <= c; e++) for (let n = l; n <= u; n++) for (let r of this.cells.get(`${e}:${n}`) ?? []) {
|
|
62
|
+
let e = this.entities.get(r);
|
|
63
|
+
if (!e) continue;
|
|
64
|
+
let n = Math.hypot(e.position.x - t.x, e.position.y - t.y);
|
|
65
|
+
n <= a && f.push({
|
|
66
|
+
id: r,
|
|
67
|
+
value: e.value,
|
|
68
|
+
distance: n
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return f.sort((e, t) => e.distance - t.distance || (e.id < t.id ? -1 : +(e.id > t.id))), f.slice(0, Math.min(o, this.options.maxEntities)).map((e) => ({
|
|
72
|
+
...e,
|
|
73
|
+
value: structuredClone(e.value)
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
size() {
|
|
77
|
+
return this.entities.size;
|
|
78
|
+
}
|
|
79
|
+
cellCount() {
|
|
80
|
+
return this.cells.size;
|
|
81
|
+
}
|
|
82
|
+
clear() {
|
|
83
|
+
this.entities.clear(), this.cells.clear();
|
|
84
|
+
}
|
|
85
|
+
}, o = (e) => new a(e), s = class {
|
|
86
|
+
grid;
|
|
87
|
+
radius;
|
|
88
|
+
hysteresis;
|
|
89
|
+
maxEntities;
|
|
90
|
+
visible = /* @__PURE__ */ new Set();
|
|
91
|
+
constructor(e, t, r, a) {
|
|
92
|
+
this.grid = e, this.radius = t, this.hysteresis = r, this.maxEntities = a, (!Number.isFinite(t) || t < 0 || !Number.isFinite(r) || r < 0) && n("Interest bounds must be finite and nonnegative"), i(a);
|
|
93
|
+
}
|
|
94
|
+
update(e) {
|
|
95
|
+
let t = this.grid.nearby(e, this.radius + this.hysteresis).filter((e) => e.distance <= this.radius || this.visible.has(e.id)).slice(0, this.maxEntities), n = new Set(t.map((e) => e.id)), r = [...n].filter((e) => !this.visible.has(e)), i = [...this.visible].filter((e) => !n.has(e)).sort();
|
|
96
|
+
return this.visible = n, {
|
|
97
|
+
entities: t,
|
|
98
|
+
entered: r,
|
|
99
|
+
left: i
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
export { a as SpatialGrid2D, s as SpatialInterest2D, o as spatialGrid };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
// src/spectatorPolicy.ts
|
|
3
|
+
var t = Object.freeze({
|
|
4
|
+
delayMs: 0,
|
|
5
|
+
retentionMs: 18e4,
|
|
6
|
+
maxFrames: 4096,
|
|
7
|
+
maxBytes: 16777216,
|
|
8
|
+
maxFrameBytes: 1048576,
|
|
9
|
+
checkpointEveryMs: 5e3,
|
|
10
|
+
maxDeliveryFrames: 256
|
|
11
|
+
});
|
|
12
|
+
function n() {
|
|
13
|
+
throw new e({ detail: "Invalid spectator history policy or allocation budget" });
|
|
14
|
+
}
|
|
15
|
+
var r = (e = {}) => {
|
|
16
|
+
e && typeof e == "object" && [Object.prototype, null].includes(Object.getPrototypeOf(e)) || n();
|
|
17
|
+
let r = { ...t };
|
|
18
|
+
for (let i of Reflect.ownKeys(e)) {
|
|
19
|
+
let a = Object.getOwnPropertyDescriptor(e, i);
|
|
20
|
+
typeof i == "string" && Object.hasOwn(t, i) && a && Object.hasOwn(a, "value") && a.enumerable && typeof a.value == "number" || n(), r[i] = a.value;
|
|
21
|
+
}
|
|
22
|
+
for (let [e, t] of Object.entries(r)) (!Number.isSafeInteger(t) || t < (e === "delayMs" ? 0 : 1)) && n();
|
|
23
|
+
return (r.retentionMs < r.delayMs || r.maxFrames > 1e6 || r.maxBytes > 536870912 || r.maxFrameBytes > r.maxBytes || r.maxDeliveryFrames > r.maxFrames) && n(), Object.freeze(r);
|
|
24
|
+
};
|
|
25
|
+
export { r as defaultRoomSpectatorPolicy };
|