@voltro/plugin-rooms 0.0.0-stage → 0.87.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 +24329 -0
- package/LICENSE +61 -0
- package/README.md +9204 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +11322 -0
- package/dist/actor.js +1474 -0
- package/dist/apiBinding.js +678 -0
- package/dist/apiRegistryBinding.js +399 -0
- package/dist/apiReservations.js +433 -0
- package/dist/baselines.js +73 -0
- package/dist/bots.d.ts +1485 -0
- package/dist/bots.js +563 -0
- package/dist/catalog.js +80 -0
- package/dist/checkpointJson.js +24 -0
- package/dist/checkpointStore.js +386 -0
- package/dist/client.js +56 -0
- package/dist/clockSync.js +51 -0
- package/dist/collision.js +156 -0
- package/dist/commandDelivery.js +101 -0
- package/dist/commandRecord.js +11 -0
- package/dist/commandWithdrawal.js +183 -0
- package/dist/connection.js +497 -0
- package/dist/controlCarrier.js +375 -0
- package/dist/controlRegistry.js +79 -0
- package/dist/controlTarget.js +45 -0
- package/dist/controlTransport.js +574 -0
- package/dist/developmentBinding.js +113 -0
- package/dist/directory.js +323 -0
- package/dist/directoryProjection.js +117 -0
- package/dist/errors.d.ts +125 -0
- package/dist/errors.js +53 -0
- package/dist/fixed.d.ts +284 -0
- package/dist/fixed.js +10 -0
- package/dist/fixed32.js +134 -0
- package/dist/fixedCollision.js +60 -0
- package/dist/fixedCollision32.js +109 -0
- package/dist/fixedMath.js +56 -0
- package/dist/fixedRaw.js +11 -0
- package/dist/fixedSlabs.js +34 -0
- package/dist/fixedTrig.js +48 -0
- package/dist/fixedTrig32.js +38 -0
- package/dist/fixedVectors.js +113 -0
- package/dist/fixedVectors32.js +95 -0
- package/dist/fixedWide.js +50 -0
- package/dist/fixedWords.js +46 -0
- package/dist/gateway.js +57 -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 +82 -0
- package/dist/geometryActorInventory.js +108 -0
- package/dist/geometryAdminClient.js +87 -0
- package/dist/geometryAdminData.js +32 -0
- package/dist/geometryAdminFixtures.js +50 -0
- package/dist/geometryAdminPorts.js +5 -0
- package/dist/geometryAdminRpc.js +58 -0
- package/dist/geometryAdminRpcRoutes.js +49 -0
- package/dist/geometryAdminSchemas.js +39 -0
- package/dist/geometryAdministration.js +190 -0
- package/dist/geometryAdministrationPorts.js +5 -0
- package/dist/geometryApiBinding.js +165 -0
- package/dist/geometryAppStorage.js +58 -0
- package/dist/geometryArtifacts.js +198 -0
- package/dist/geometryAssetBundle.js +117 -0
- package/dist/geometryAssetClient.js +25 -0
- package/dist/geometryAssetData.js +106 -0
- package/dist/geometryAssetHttp.js +123 -0
- package/dist/geometryAssetPorts.js +5 -0
- package/dist/geometryAssetRpc.js +30 -0
- package/dist/geometryAssetRpcRoutes.js +40 -0
- package/dist/geometryAssetStorageGrant.js +103 -0
- package/dist/geometryBoxOverlap.js +110 -0
- package/dist/geometryCatalogueDigest.js +111 -0
- package/dist/geometryCellCoverage.js +85 -0
- package/dist/geometryCellLoader.js +28 -0
- package/dist/geometryChannel.js +134 -0
- package/dist/geometryChunkHttp.js +54 -0
- package/dist/geometryChunkLeases.js +22 -0
- package/dist/geometryClient.d.ts +1429 -0
- package/dist/geometryClient.js +149 -0
- package/dist/geometryClientChunks.js +330 -0
- package/dist/geometryClientDelta.js +25 -0
- package/dist/geometryClientHttp.js +37 -0
- package/dist/geometryClientInterest.js +109 -0
- package/dist/geometryClientStatic.js +34 -0
- package/dist/geometryCms.d.ts +763 -0
- package/dist/geometryCms.js +217 -0
- package/dist/geometryCommitCoordinator.js +241 -0
- package/dist/geometryCompactionFixture.js +84 -0
- package/dist/geometryCompactionStrategies.js +38 -0
- package/dist/geometryConnectionClient.js +23 -0
- package/dist/geometryDerivationFixtures.js +141 -0
- package/dist/geometryDerivationStrategies.js +27 -0
- package/dist/geometryDigest.js +13 -0
- package/dist/geometryEditChannel.js +70 -0
- package/dist/geometryEditIngress.js +263 -0
- package/dist/geometryEdits.js +366 -0
- package/dist/geometryEnvelope.js +41 -0
- package/dist/geometryGridRaycast.js +92 -0
- package/dist/geometryGridSweep.js +92 -0
- package/dist/geometryHeightfield.js +166 -0
- package/dist/geometryHeightfieldRaycast.js +74 -0
- package/dist/geometryHeightfieldSweep.js +85 -0
- package/dist/geometryHeightfieldVolume.js +45 -0
- package/dist/geometryHost.js +322 -0
- package/dist/geometryHostDirectory.js +207 -0
- package/dist/geometryHostMutations.js +137 -0
- package/dist/geometryHostStreams.js +124 -0
- package/dist/geometryHttpBody.js +76 -0
- package/dist/geometryHttpRoutes.js +112 -0
- package/dist/geometryImportGltf.js +300 -0
- package/dist/geometryImportLdtk.js +54 -0
- package/dist/geometryImportPng.js +144 -0
- package/dist/geometryImportPublication.js +67 -0
- package/dist/geometryImportTiled.js +39 -0
- package/dist/geometryImportTiles.js +136 -0
- package/dist/geometryImportVox.js +130 -0
- package/dist/geometryImportedSource.js +101 -0
- package/dist/geometryInspectEndpoint.js +248 -0
- package/dist/geometryInspection.js +92 -0
- package/dist/geometryInstall.js +121 -0
- package/dist/geometryJournalArchiveData.js +21 -0
- package/dist/geometryJournalArchiveIndex.js +330 -0
- package/dist/geometryJournalArchiveTable.js +21 -0
- package/dist/geometryJournalCompaction.js +100 -0
- package/dist/geometryJournalPatch.js +47 -0
- package/dist/geometryJournalRetention.js +112 -0
- package/dist/geometryJournalRetentionSchemas.js +36 -0
- package/dist/geometryJournalRetentionSweep.js +112 -0
- package/dist/geometryJournalRetentionWorkflow.js +28 -0
- package/dist/geometryJournalRetentionWorkflowData.js +31 -0
- package/dist/geometryJournalStorage.js +148 -0
- package/dist/geometryLoader.js +118 -0
- package/dist/geometryManifest.js +113 -0
- package/dist/geometryManifestChannel.js +93 -0
- package/dist/geometryManifestClient.js +122 -0
- package/dist/geometryManifestData.js +49 -0
- package/dist/geometryManifestPorts.js +5 -0
- package/dist/geometryManifestPublication.js +109 -0
- package/dist/geometryManifestSource.js +68 -0
- package/dist/geometryMigrationJournal.js +14 -0
- package/dist/geometryMigrationStrategies.js +7 -0
- package/dist/geometryMigrations.js +323 -0
- package/dist/geometryNativeMetadata.js +52 -0
- package/dist/geometryPatch.js +170 -0
- package/dist/geometryPersistence.js +449 -0
- package/dist/geometryPersistenceCapture.js +69 -0
- package/dist/geometryPersistenceData.js +140 -0
- package/dist/geometryPersistencePorts.js +5 -0
- package/dist/geometryPlayerAdmission.js +34 -0
- package/dist/geometryPlayerEditOwner.js +265 -0
- package/dist/geometryPlayerEdits.js +49 -0
- package/dist/geometryPrepared.js +188 -0
- package/dist/geometryPrivacyFence.js +24 -0
- package/dist/geometryProceduralPublication.js +91 -0
- package/dist/geometryProceduralWorker.js +164 -0
- package/dist/geometryPublication.js +110 -0
- package/dist/geometryRayAlgebra.js +116 -0
- package/dist/geometryReadClient.js +157 -0
- package/dist/geometryReadPorts.js +5 -0
- package/dist/geometryReadRpc.js +27 -0
- package/dist/geometryReadRpcRoutes.js +47 -0
- package/dist/geometryReliablePublication.js +82 -0
- package/dist/geometryReloadPorts.js +46 -0
- package/dist/geometryReloadSource.js +278 -0
- package/dist/geometryRenderCache.js +165 -0
- package/dist/geometryRenderLod.js +102 -0
- package/dist/geometryRollback.js +125 -0
- package/dist/geometryRollbackCoordinator.js +203 -0
- package/dist/geometryRollbackPorts.js +46 -0
- package/dist/geometryRollbackSource.js +209 -0
- package/dist/geometryRollbackStore.js +198 -0
- package/dist/geometrySchemas.js +27 -0
- package/dist/geometryServer.d.ts +2766 -0
- package/dist/geometryServer.js +62 -0
- package/dist/geometryShapeRaycast.js +111 -0
- package/dist/geometryShapeSegments.js +34 -0
- package/dist/geometryShapes.js +223 -0
- package/dist/geometrySnapshot.js +76 -0
- package/dist/geometrySnapshotChannel.js +160 -0
- package/dist/geometrySnapshotClient.js +159 -0
- package/dist/geometrySnapshotPreparation.js +76 -0
- package/dist/geometrySnapshotServer.js +191 -0
- package/dist/geometrySqlOwner.js +21 -0
- package/dist/geometryStorage.js +127 -0
- package/dist/geometryStorageGrant.js +69 -0
- package/dist/geometryStorageIdentity.js +9 -0
- package/dist/geometryTileArtifact.js +10 -0
- package/dist/geometryTileCodec.js +194 -0
- package/dist/geometryTileCollision.js +96 -0
- package/dist/geometryTileNavigation.js +128 -0
- package/dist/geometryTileView.js +35 -0
- package/dist/geometryVersionActivation.js +114 -0
- package/dist/geometryVersionClient.js +238 -0
- package/dist/geometryVersionCompare.js +40 -0
- package/dist/geometryVersionMigration.js +106 -0
- package/dist/geometryVoxel.js +253 -0
- package/dist/geometryWorldEntitySubject.js +32 -0
- package/dist/geometryWorldExtent.js +12 -0
- package/dist/geometryWorldMetadata.js +38 -0
- package/dist/geometryWorldStrategyFixtures.js +127 -0
- package/dist/geometryWorldView.js +307 -0
- package/dist/host.js +128 -0
- package/dist/hostBinding.js +277 -0
- package/dist/hostCellObservation.js +114 -0
- package/dist/hostClientCapacity.js +90 -0
- package/dist/hostCommandScope.js +64 -0
- package/dist/hostController.js +3094 -0
- package/dist/hostDeployment.js +65 -0
- package/dist/hostDrain.js +152 -0
- package/dist/hostDrainPorts.js +5 -0
- package/dist/hostDriver.js +179 -0
- package/dist/hostLane.js +288 -0
- package/dist/hostListener.js +79 -0
- package/dist/hostListenerBinding.js +19 -0
- package/dist/hostLoopObservation.js +90 -0
- package/dist/hostMetrics.js +56 -0
- package/dist/hostRegistryBinding.js +418 -0
- package/dist/hostSelection.js +16 -0
- package/dist/hostShutdown.js +47 -0
- package/dist/hostTurnObservation.js +53 -0
- package/dist/identities.js +4 -0
- package/dist/index.d.ts +8632 -0
- package/dist/index.js +232 -0
- package/dist/inputReceipts.js +63 -0
- package/dist/inputRedundancy.js +55 -0
- package/dist/inspect.js +238 -0
- package/dist/lockstep.d.ts +436 -0
- package/dist/lockstep.js +382 -0
- package/dist/lockstepAdmission.js +262 -0
- package/dist/lockstepAdmissionCodec.js +94 -0
- package/dist/lockstepAdmissionPorts.js +5 -0
- package/dist/lockstepClientSession.js +578 -0
- package/dist/lockstepDefinition.js +148 -0
- package/dist/lockstepHostLoop.js +243 -0
- package/dist/lockstepInitialAdmission.js +67 -0
- package/dist/lockstepInitialStrategyFixtures.js +45 -0
- package/dist/lockstepJournal.js +395 -0
- package/dist/lockstepJournalCodec.js +254 -0
- package/dist/lockstepJournalPorts.js +5 -0
- package/dist/lockstepJournalRebuild.js +208 -0
- package/dist/lockstepJournalRows.js +57 -0
- package/dist/lockstepMembers.js +131 -0
- package/dist/lockstepMessages.js +47 -0
- package/dist/lockstepOwnedRoom.js +764 -0
- package/dist/lockstepPolicies.js +84 -0
- package/dist/lockstepReact.js +47 -0
- package/dist/lockstepRecoveryTruth.js +121 -0
- package/dist/lockstepRosterConfig.js +32 -0
- package/dist/lockstepSeed.js +12 -0
- package/dist/lockstepSeedFixture.js +20 -0
- package/dist/lockstepServer.d.ts +3897 -0
- package/dist/lockstepServer.js +325 -0
- package/dist/lockstepServerConfig.js +101 -0
- package/dist/lockstepServerRoles.js +403 -0
- package/dist/lockstepServerStrategyFixtures.js +33 -0
- package/dist/lockstepStrategies.js +6 -0
- package/dist/lockstepStrategyFixtures.js +137 -0
- package/dist/lockstepTerminal.js +90 -0
- package/dist/lockstepTerminalPorts.js +5 -0
- package/dist/lockstepTransport.js +773 -0
- package/dist/lockstepTransportConfig.js +32 -0
- package/dist/lockstepWireRoster.js +34 -0
- package/dist/matchRoomProvider.js +32 -0
- package/dist/matchRooms.js +19 -0
- package/dist/membershipObserver.js +47 -0
- package/dist/moderation.js +98 -0
- package/dist/movementSpecials.js +104 -0
- package/dist/ownership.js +17 -0
- package/dist/ownershipWithdrawal.js +18 -0
- package/dist/pcg32.js +96 -0
- package/dist/ports.d.ts +1241 -0
- package/dist/ports.js +11 -0
- package/dist/quaternion.js +70 -0
- package/dist/react.d.ts +406 -0
- package/dist/react.js +109 -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 +243 -0
- package/dist/reaperSchemas.js +42 -0
- package/dist/reaperWorkflow.js +70 -0
- package/dist/recovery.js +189 -0
- package/dist/recoverySeats.js +26 -0
- package/dist/replay.d.ts +273 -0
- package/dist/replay.js +485 -0
- package/dist/replayPorts.js +5 -0
- package/dist/replayRecording.js +67 -0
- package/dist/replaySchema.js +157 -0
- package/dist/replayStorage.d.ts +149 -0
- package/dist/replayStorage.js +485 -0
- package/dist/reservationBatch.js +422 -0
- package/dist/reservationSchemas.js +17 -0
- package/dist/reservations.js +259 -0
- package/dist/reservePort.js +69 -0
- package/dist/resolvedOptions.js +4 -0
- package/dist/room.d.ts +1006 -0
- package/dist/room.js +284 -0
- package/dist/roomAccessSweep.js +95 -0
- package/dist/roomAppCommandControl.js +59 -0
- package/dist/roomAuthoringStrategy.js +17 -0
- package/dist/roomErasure.js +198 -0
- package/dist/roomPoolRuntimeDefaults.js +24 -0
- package/dist/roomPoolSelection.js +19 -0
- package/dist/roomPoolTopology.js +212 -0
- package/dist/rpc.d.ts +551 -0
- package/dist/rpc.js +112 -0
- package/dist/rpcClient.js +152 -0
- package/dist/rpcRoutes.js +28 -0
- package/dist/runtime.js +1123 -0
- package/dist/schemaHistory.js +98 -0
- package/dist/seatStore.js +151 -0
- package/dist/seatStrategyFixtures.js +52 -0
- package/dist/seatSubject.js +32 -0
- package/dist/seats.js +130 -0
- package/dist/serverSession.js +811 -0
- package/dist/serverSessionConfig.js +43 -0
- package/dist/sessionAdmission.js +53 -0
- package/dist/sidecarAdmission.js +103 -0
- package/dist/sidecarConfig.js +116 -0
- package/dist/sidecarConfigPublication.js +64 -0
- package/dist/sidecarHostListener.js +208 -0
- package/dist/sidecarIpc.js +205 -0
- package/dist/sidecarPeer.js +310 -0
- package/dist/sidecarProcessPort.js +28 -0
- package/dist/sidecarRuntime.js +168 -0
- package/dist/sidecarSelection.js +142 -0
- package/dist/sidecarWire.js +178 -0
- package/dist/sidecarWrites.js +163 -0
- package/dist/simulation.d.ts +391 -0
- package/dist/simulation.js +282 -0
- package/dist/simulationAuthoring.js +29 -0
- package/dist/simulationBytes.js +27 -0
- package/dist/simulationConformance.js +305 -0
- package/dist/simulationInputHistoryCapture.js +35 -0
- package/dist/simulationInputHistoryWire.js +193 -0
- package/dist/simulationOptionsWire.js +78 -0
- package/dist/simulationRecoveryWire.js +134 -0
- package/dist/simulationReplay.js +127 -0
- package/dist/simulationSnapshotWire.js +112 -0
- package/dist/simulationState.js +178 -0
- package/dist/snapshotBlob.js +126 -0
- package/dist/snapshotBlobCleanup.js +93 -0
- package/dist/snapshotBlobIndex.js +38 -0
- package/dist/snapshotBudget.js +80 -0
- package/dist/snapshotChain.js +185 -0
- package/dist/snapshotErasure.js +172 -0
- package/dist/snapshotInspection.js +105 -0
- package/dist/snapshotSegmentBlobs.js +58 -0
- package/dist/snapshotUploads.js +166 -0
- package/dist/socketTransport.js +253 -0
- package/dist/spatial.js +104 -0
- package/dist/spectatorPolicy.js +26 -0
- package/dist/spectatorProducer.js +89 -0
- package/dist/startFailureCause.js +4 -0
- package/dist/stateCodec.js +658 -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 +182 -0
- package/dist/streamFraming.js +122 -0
- package/dist/streamTransport.js +266 -0
- package/dist/subjectAdmission.js +50 -0
- package/dist/subjectPrivacy.js +281 -0
- package/dist/subjectPrivacyBinding.js +90 -0
- package/dist/systemManifest.js +182 -0
- package/dist/tables.js +159 -0
- package/dist/testHarness.js +89 -0
- package/dist/testing.d.ts +3684 -0
- package/dist/testing.js +221 -0
- package/dist/testingPorts.js +271 -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 +217 -0
- package/dist/transform3d.js +118 -0
- package/dist/transformCollection.js +24 -0
- package/dist/transformCollection3d.js +24 -0
- package/dist/transformCollectionCore.js +156 -0
- package/dist/transformFrames.js +121 -0
- package/dist/transformPrediction3d.js +127 -0
- package/dist/transformRules.js +123 -0
- package/dist/transformSchemas.js +20 -0
- package/dist/transport.js +32 -0
- package/dist/transportAuthoring.js +29 -0
- package/dist/transportCleanup.js +22 -0
- package/dist/transportConformance.js +124 -0
- package/dist/transportConnector.js +82 -0
- package/dist/transportEndpoints.js +38 -0
- package/dist/transportsServer.d.ts +5515 -0
- package/dist/transportsServer.js +6 -0
- package/dist/viewProjection.js +16 -0
- package/dist/web.d.ts +2286 -0
- package/dist/web.js +518 -0
- package/dist/webTransportClient.js +173 -0
- package/dist/wire.d.ts +992 -0
- package/dist/wire.js +492 -0
- package/dist/withdrawalPort.js +28 -0
- package/dist/world.d.ts +1894 -0
- package/dist/world.js +333 -0
- package/dist/worldActorReceipts.js +48 -0
- package/dist/worldActorTransferSnapshot.js +14 -0
- package/dist/worldAdmissionPending.js +8 -0
- package/dist/worldBoundaryCoordinator.js +148 -0
- package/dist/worldCatalog.js +81 -0
- package/dist/worldCellAllocation.js +203 -0
- package/dist/worldCellDestination.js +68 -0
- package/dist/worldCells.js +489 -0
- package/dist/worldChange.js +32 -0
- package/dist/worldClient.js +664 -0
- package/dist/worldClientControl.js +141 -0
- package/dist/worldClientPendingInput.js +16 -0
- package/dist/worldClientRpc.js +133 -0
- package/dist/worldClientRpcRoutes.js +43 -0
- package/dist/worldClientSchemas.js +28 -0
- package/dist/worldCommands.js +140 -0
- package/dist/worldData.js +42 -0
- package/dist/worldDefaultBinding.js +377 -0
- package/dist/worldDefaultGroupAdmission.js +82 -0
- package/dist/worldDefaultGroupAppServices.js +31 -0
- package/dist/worldDefaultGroupCompensation.js +109 -0
- package/dist/worldDefaultGroupContinuation.js +96 -0
- package/dist/worldDefaultGroupControl.js +72 -0
- package/dist/worldDefaultGroupMembers.js +85 -0
- package/dist/worldDefaultGroups.js +21 -0
- package/dist/worldDefaultPending.js +79 -0
- package/dist/worldDefaultService.js +245 -0
- package/dist/worldEntities.js +2980 -0
- package/dist/worldEntityCodec.js +21 -0
- package/dist/worldEntityHandoffView.js +154 -0
- package/dist/worldGeometry.js +170 -0
- package/dist/worldGhostAdmission.js +65 -0
- package/dist/worldGhostDestination.js +118 -0
- package/dist/worldGhostGateway.js +132 -0
- package/dist/worldGhostHandshake.js +108 -0
- package/dist/worldGhostHost.js +42 -0
- package/dist/worldGhostIngress.js +132 -0
- package/dist/worldGhostNeighborhood.js +70 -0
- package/dist/worldGhostNeighbors.js +86 -0
- package/dist/worldGhostOutbound.js +110 -0
- package/dist/worldGhostPublisher.js +216 -0
- package/dist/worldGhostReceiver.js +213 -0
- package/dist/worldGhostSender.js +146 -0
- package/dist/worldGhostSocket.js +78 -0
- package/dist/worldGhostWire.js +172 -0
- package/dist/worldGroupCommand.js +49 -0
- package/dist/worldGroupDeadline.js +115 -0
- package/dist/worldGroupPreparation.js +115 -0
- package/dist/worldGroupReadyControl.js +128 -0
- package/dist/worldGroupSupervisor.js +120 -0
- package/dist/worldHandoffMetrics.js +59 -0
- package/dist/worldHandoffView.js +100 -0
- package/dist/worldHostSource.js +69 -0
- package/dist/worldInspectEndpoint.js +250 -0
- package/dist/worldInspection.js +109 -0
- package/dist/worldInstanceAdmission.js +31 -0
- package/dist/worldInstanceAllocation.js +116 -0
- package/dist/worldInstanceDestination.js +64 -0
- package/dist/worldInstanceExpiry.js +282 -0
- package/dist/worldInstanceExpirySupervisor.js +88 -0
- package/dist/worldInstanceLifecycle.js +103 -0
- package/dist/worldInstanceState.js +52 -0
- package/dist/worldInstances.js +478 -0
- package/dist/worldJoin.js +56 -0
- package/dist/worldLayers.js +151 -0
- package/dist/worldLeases.js +78 -0
- package/dist/worldManifest.js +25 -0
- package/dist/worldMovement.js +63 -0
- package/dist/worldPersistence.js +134 -0
- package/dist/worldProjection.js +221 -0
- package/dist/worldReact.js +110 -0
- package/dist/worldRecoveryActor.js +35 -0
- package/dist/worldReturnAnchor.js +49 -0
- package/dist/worldRoomHooks.js +57 -0
- package/dist/worldRoomPool.js +27 -0
- package/dist/worldRoomSteps.js +133 -0
- package/dist/worldSeatBinding.js +36 -0
- package/dist/worldServer.d.ts +6936 -0
- package/dist/worldServer.js +48 -0
- package/dist/worldSourceSeatPending.js +9 -0
- package/dist/worldStrategyFixtures.js +164 -0
- package/dist/worldTesting.js +27 -0
- package/dist/worldTransitionDefaults.js +198 -0
- package/dist/worldTransitionExecutor.js +519 -0
- package/dist/worldTransitionGroup.js +113 -0
- package/dist/worldTransitionPhysicalSteps.js +40 -0
- package/dist/worldTransitionResolver.js +228 -0
- package/dist/worldTransitionSeatGroup.js +64 -0
- package/dist/worldTransitionSeats.js +260 -0
- package/dist/worldTransitionState.js +95 -0
- package/dist/worldTransitions.js +101 -0
- package/package.json +189 -4
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { simulationOwnData as t } from "./simulationAuthoring.js";
|
|
3
|
+
import { captureWorldCatalog as n } from "./world.js";
|
|
4
|
+
import { captureRoomPoolCatalog as r, roomPoolHostedNames as i } from "./roomPoolTopology.js";
|
|
5
|
+
import { captureRoomHostDrainPolicy as a } from "./hostDrain.js";
|
|
6
|
+
import { frameworkStartCause as o } from "./startFailureCause.js";
|
|
7
|
+
import { RoomHostLane as s, RoomHostLaneStartFailure as c } from "./hostLane.js";
|
|
8
|
+
import { assertRoomHostListenerDeployment as l } from "./hostListenerBinding.js";
|
|
9
|
+
import { captureRoomHostShutdownPolicy as u, superviseRoomHostDrain as d } from "./hostShutdown.js";
|
|
10
|
+
import { captureRoomHostDeployment as f } from "./hostDeployment.js";
|
|
11
|
+
import { validateWorldRooms as p } from "./worldCatalog.js";
|
|
12
|
+
import { performance as m } from "node:perf_hooks";
|
|
13
|
+
//#region src/hostBinding.ts
|
|
14
|
+
var h = (n) => {
|
|
15
|
+
let r = t(n, ["pool", "region"], []), i = {};
|
|
16
|
+
for (let t of ["pool", "region"]) {
|
|
17
|
+
if (!Object.hasOwn(r, t)) continue;
|
|
18
|
+
let n = r[t];
|
|
19
|
+
if (typeof n != "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,95}$/.test(n) || [
|
|
20
|
+
"__proto__",
|
|
21
|
+
"prototype",
|
|
22
|
+
"constructor"
|
|
23
|
+
].includes(n)) throw new e({ detail: "Room host selection requires bounded pool and region identifiers" });
|
|
24
|
+
i[t] = n;
|
|
25
|
+
}
|
|
26
|
+
return Object.freeze(i);
|
|
27
|
+
}, g = class extends Error {
|
|
28
|
+
retryCleanup;
|
|
29
|
+
name = "RoomsHostBindFailure";
|
|
30
|
+
constructor(e) {
|
|
31
|
+
super("Room host provider cleanup remains incomplete"), this.retryCleanup = e;
|
|
32
|
+
}
|
|
33
|
+
}, _ = class extends Error {
|
|
34
|
+
stage;
|
|
35
|
+
retryCleanup;
|
|
36
|
+
name = "RoomsHostStartFailure";
|
|
37
|
+
constructor(e, t, n) {
|
|
38
|
+
super(`Room host startup failed during ${e}; cleanup remains owned`, o(n) === void 0 ? void 0 : { cause: n }), this.stage = e, this.retryCleanup = t;
|
|
39
|
+
}
|
|
40
|
+
}, v = class extends Error {
|
|
41
|
+
retryCleanup;
|
|
42
|
+
name = "RoomsHostStopFailure";
|
|
43
|
+
constructor(e) {
|
|
44
|
+
super("Room host cleanup remains incomplete"), this.retryCleanup = e;
|
|
45
|
+
}
|
|
46
|
+
}, y = class {
|
|
47
|
+
pluginName;
|
|
48
|
+
binder;
|
|
49
|
+
phase = "idle";
|
|
50
|
+
abort = new AbortController();
|
|
51
|
+
acquisition = null;
|
|
52
|
+
closing = null;
|
|
53
|
+
lane = null;
|
|
54
|
+
laneClosing = null;
|
|
55
|
+
control = null;
|
|
56
|
+
partialLane = null;
|
|
57
|
+
partialControl = null;
|
|
58
|
+
release = null;
|
|
59
|
+
failed = !1;
|
|
60
|
+
plannedDrain = null;
|
|
61
|
+
shutdownPolicy = null;
|
|
62
|
+
shutdownDeadline = null;
|
|
63
|
+
stopping = null;
|
|
64
|
+
worldState;
|
|
65
|
+
constructor(t, n, r = {}) {
|
|
66
|
+
if (this.pluginName = t, this.binder = n, !t.trim() || typeof n != "function") throw new e({ detail: "Room host requires an explicit complete provider" });
|
|
67
|
+
let i = r.worldState ?? "none";
|
|
68
|
+
if (![
|
|
69
|
+
"none",
|
|
70
|
+
"entities",
|
|
71
|
+
"transitions"
|
|
72
|
+
].includes(i)) throw new e({ detail: "Room host World state must be none, entities or transitions" });
|
|
73
|
+
this.worldState = i;
|
|
74
|
+
}
|
|
75
|
+
get status() {
|
|
76
|
+
return this.phase;
|
|
77
|
+
}
|
|
78
|
+
get signal() {
|
|
79
|
+
return this.abort.signal;
|
|
80
|
+
}
|
|
81
|
+
get hasRuntimeFailure() {
|
|
82
|
+
return this.failed;
|
|
83
|
+
}
|
|
84
|
+
start(t, a, o = [], d = {}, m, v) {
|
|
85
|
+
if (this.phase !== "idle") return Promise.reject(new e({ detail: "Room host owner is single-use" }));
|
|
86
|
+
let y, b;
|
|
87
|
+
try {
|
|
88
|
+
if (y = h(d), b = m === void 0 ? void 0 : r(m, a.inventory().map((e) => e.descriptor.name)), b) {
|
|
89
|
+
let t = y.pool ?? b.default, n = b.pools[t];
|
|
90
|
+
if (!n || y.region !== void 0 && !n.regions.includes(y.region)) throw new e({ detail: "Room host selection is outside the app pool topology" });
|
|
91
|
+
y = Object.freeze({
|
|
92
|
+
...y,
|
|
93
|
+
pool: t
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
} catch (e) {
|
|
97
|
+
return Promise.reject(e);
|
|
98
|
+
}
|
|
99
|
+
let x, S;
|
|
100
|
+
try {
|
|
101
|
+
x = n(o), S = p(x, a);
|
|
102
|
+
} catch {
|
|
103
|
+
return Promise.reject(new e({ detail: "World catalogue does not match the admitted Room inventory" }));
|
|
104
|
+
}
|
|
105
|
+
let C = new Set(i(b, b === void 0 ? void 0 : y.pool, a.inventory().map((e) => e.descriptor.name))), w = Object.freeze(a.inventory().filter((e) => C.has(e.descriptor.name))), T = Object.freeze(x.filter((e) => S.some((t) => t.worldId === e.name && C.has(t.room))));
|
|
106
|
+
if (this.phase = "starting", v !== void 0 && typeof v != "function") return Promise.reject(new e({ detail: "Room host app dependencies must be a function" }));
|
|
107
|
+
let E = Object.freeze({
|
|
108
|
+
root: t,
|
|
109
|
+
pluginName: this.pluginName,
|
|
110
|
+
catalog: a,
|
|
111
|
+
hostedRooms: w,
|
|
112
|
+
hostedWorlds: T,
|
|
113
|
+
worlds: x,
|
|
114
|
+
worldRooms: S,
|
|
115
|
+
worldState: this.worldState,
|
|
116
|
+
selection: y,
|
|
117
|
+
pools: b,
|
|
118
|
+
signal: this.abort.signal,
|
|
119
|
+
...v === void 0 ? {} : { appDependencies: v }
|
|
120
|
+
}), D = Object.freeze({
|
|
121
|
+
VOLTRO_ROOMS_HOST_DEPLOYMENT: process.env.VOLTRO_ROOMS_HOST_DEPLOYMENT,
|
|
122
|
+
VOLTRO_ROOMS_HOST_METRICS_TOKEN: process.env.VOLTRO_ROOMS_HOST_METRICS_TOKEN,
|
|
123
|
+
VOLTRO_ROOMS_HOST_METRICS_TOKEN_PREVIOUS: process.env.VOLTRO_ROOMS_HOST_METRICS_TOKEN_PREVIOUS,
|
|
124
|
+
VOLTRO_ROOMS_HOST_POD_NAME: process.env.VOLTRO_ROOMS_HOST_POD_NAME
|
|
125
|
+
}), O = (async () => {
|
|
126
|
+
let t = "provider";
|
|
127
|
+
try {
|
|
128
|
+
let n = await this.binder(E);
|
|
129
|
+
if (typeof n?.release != "function") throw new e({ detail: "Room host provider must return its owned release operation" });
|
|
130
|
+
if (this.release = n.release.bind(n), this.shutdownPolicy = n.shutdown === void 0 ? null : u(n.shutdown), !n.store || !n.options || typeof n.openControl != "function") throw new e({ detail: "Room host provider must supply SQL, host configuration and control transport" });
|
|
131
|
+
if (b !== void 0 && n.options.host.pools !== b) throw new e({ detail: "Room host provider did not retain the app pool topology" });
|
|
132
|
+
if (y.pool !== void 0 && n.options.host.pool !== y.pool || y.region !== void 0 && n.options.host.region !== y.region) throw new e({ detail: "Room host provider did not honor the process pool and region selection" });
|
|
133
|
+
let r = f(D, n.options.host.pool, n.options.host.region);
|
|
134
|
+
if (r) {
|
|
135
|
+
if (r.shutdown && (!this.shutdownPolicy || this.shutdownPolicy.drainMs > r.shutdown.drainMs)) throw new e({ detail: "Room host shutdown policy exceeds or is missing from its deployment drain budget" });
|
|
136
|
+
if (l(n.options.listener, r), r.publicAddress !== void 0 && n.options.host.address !== r.publicAddress) throw new e({ detail: "Room host provider did not apply its deployment public address" });
|
|
137
|
+
}
|
|
138
|
+
let i = n.openControl.bind(n);
|
|
139
|
+
this.requireAcquiring(), t = "lane";
|
|
140
|
+
let o = n.options.driver.onFailure.bind(n.options.driver);
|
|
141
|
+
this.lane = await s.start(n.store, a, {
|
|
142
|
+
...n.options,
|
|
143
|
+
processRole: "rooms",
|
|
144
|
+
startSuspended: !0,
|
|
145
|
+
host: {
|
|
146
|
+
...n.options.host,
|
|
147
|
+
worlds: T
|
|
148
|
+
},
|
|
149
|
+
driver: {
|
|
150
|
+
...n.options.driver,
|
|
151
|
+
onFailure: (t) => {
|
|
152
|
+
this.failed = !0, this.abort.abort(), this.close().catch(() => void 0);
|
|
153
|
+
let n = o(t);
|
|
154
|
+
if (n !== void 0) throw n instanceof Promise && n.catch(() => void 0), new e({ detail: "Room host failure observer must return synchronous void" });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}), this.requireAcquiring(), t = "control";
|
|
158
|
+
let c = await i(this.lane, E);
|
|
159
|
+
if (typeof c?.close != "function") throw new e({ detail: "Room control provider must return its owned cleanup" });
|
|
160
|
+
if (this.control = {
|
|
161
|
+
fence: typeof c.fence == "function" ? c.fence.bind(c) : () => {
|
|
162
|
+
throw new e({ detail: "Room control provider has no admission fence" });
|
|
163
|
+
},
|
|
164
|
+
close: c.close.bind(c)
|
|
165
|
+
}, typeof c.fence != "function") throw new e({ detail: "Room control provider must return a synchronous fence" });
|
|
166
|
+
return this.requireAcquiring(), t = "activation", await this.lane.activate(), this.requireAcquiring(), this.phase = "running", this.lane;
|
|
167
|
+
} catch (e) {
|
|
168
|
+
this.phase = "closing", this.abort.abort(), e instanceof c && !this.lane && (this.partialLane = e.retryCleanup), e instanceof g && (t === "control" ? this.partialControl = e.retryCleanup : this.release = e.retryCleanup);
|
|
169
|
+
try {
|
|
170
|
+
await this.releaseResources();
|
|
171
|
+
} catch {}
|
|
172
|
+
throw new _(t, () => this.close(), e);
|
|
173
|
+
}
|
|
174
|
+
})();
|
|
175
|
+
return this.acquisition = O, O.then(() => {
|
|
176
|
+
this.acquisition = null;
|
|
177
|
+
}, () => {
|
|
178
|
+
this.acquisition = null;
|
|
179
|
+
}), O;
|
|
180
|
+
}
|
|
181
|
+
requireAcquiring() {
|
|
182
|
+
if (this.abort.signal.aborted || this.phase !== "starting") throw new e({ detail: "Room host acquisition was cancelled" });
|
|
183
|
+
}
|
|
184
|
+
fenceLane() {
|
|
185
|
+
if (this.laneClosing) return this.laneClosing;
|
|
186
|
+
if (!this.lane) return Promise.resolve();
|
|
187
|
+
try {
|
|
188
|
+
this.laneClosing = this.plannedDrain ? this.lane.drain(this.plannedDrain) : this.lane.close();
|
|
189
|
+
} catch (e) {
|
|
190
|
+
this.laneClosing = Promise.reject(e);
|
|
191
|
+
}
|
|
192
|
+
return this.laneClosing.catch(() => void 0), this.laneClosing;
|
|
193
|
+
}
|
|
194
|
+
async releaseResources() {
|
|
195
|
+
let t = [];
|
|
196
|
+
if (this.control) try {
|
|
197
|
+
this.control.fence();
|
|
198
|
+
} catch (e) {
|
|
199
|
+
t.push(e);
|
|
200
|
+
}
|
|
201
|
+
let n = this.lane, r = this.control, i = await Promise.allSettled([
|
|
202
|
+
n ? this.fenceLane().then(() => {
|
|
203
|
+
this.lane = null;
|
|
204
|
+
}).finally(() => {
|
|
205
|
+
this.laneClosing = null;
|
|
206
|
+
}) : Promise.resolve(),
|
|
207
|
+
r ? Promise.resolve().then(() => r.close()).then(() => {
|
|
208
|
+
this.control = null;
|
|
209
|
+
}) : Promise.resolve(),
|
|
210
|
+
this.partialLane ? Promise.resolve().then(() => this.partialLane()).then(() => {
|
|
211
|
+
this.partialLane = null;
|
|
212
|
+
}) : Promise.resolve(),
|
|
213
|
+
this.partialControl ? Promise.resolve().then(() => this.partialControl()).then(() => {
|
|
214
|
+
this.partialControl = null;
|
|
215
|
+
}) : Promise.resolve()
|
|
216
|
+
]);
|
|
217
|
+
for (let e of i) e.status === "rejected" && t.push(e.reason);
|
|
218
|
+
if (t.length > 0) throw new e({ detail: "Room host lane or control cleanup remains incomplete" });
|
|
219
|
+
this.release &&= (await this.release(), null), this.phase = "closed";
|
|
220
|
+
}
|
|
221
|
+
stop() {
|
|
222
|
+
if (this.phase === "closed") return Promise.resolve();
|
|
223
|
+
if (this.stopping) return this.stopping;
|
|
224
|
+
if (!this.shutdownPolicy || !this.plannedDrain && (this.phase !== "running" || this.failed)) return this.close();
|
|
225
|
+
let e = this.plannedDrain ?? this.shutdownPolicy;
|
|
226
|
+
this.shutdownDeadline ??= m.now() + this.shutdownPolicy.drainMs;
|
|
227
|
+
let t = Promise.withResolvers();
|
|
228
|
+
return this.stopping = t.promise, d(() => this.drain({
|
|
229
|
+
graceMs: e.graceMs,
|
|
230
|
+
maxCheckpointBytes: e.maxCheckpointBytes
|
|
231
|
+
}), this.shutdownDeadline, () => this.close()).then(t.resolve, t.reject), t.promise.then(() => {
|
|
232
|
+
this.stopping = null;
|
|
233
|
+
}, () => {
|
|
234
|
+
this.stopping = null;
|
|
235
|
+
}), t.promise;
|
|
236
|
+
}
|
|
237
|
+
drain(t) {
|
|
238
|
+
try {
|
|
239
|
+
let n = a(t);
|
|
240
|
+
if (this.plannedDrain) {
|
|
241
|
+
if (n.graceMs !== this.plannedDrain.graceMs || n.maxCheckpointBytes !== this.plannedDrain.maxCheckpointBytes) throw new e({ detail: "Room host owner drain retry cannot change its retained policy" });
|
|
242
|
+
} else {
|
|
243
|
+
if (this.phase !== "running" || !this.lane?.controller.host.membership || this.failed) throw new e({ detail: "Planned owner drain requires a running registered process" });
|
|
244
|
+
this.plannedDrain = n;
|
|
245
|
+
}
|
|
246
|
+
return this.close();
|
|
247
|
+
} catch (e) {
|
|
248
|
+
return Promise.reject(e);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
close() {
|
|
252
|
+
if (this.phase === "closed") return Promise.resolve();
|
|
253
|
+
if (this.closing) return this.closing;
|
|
254
|
+
this.phase = "closing", this.abort.abort();
|
|
255
|
+
try {
|
|
256
|
+
this.control?.fence();
|
|
257
|
+
} catch {}
|
|
258
|
+
this.lane && this.fenceLane().catch(() => void 0);
|
|
259
|
+
let e = (async () => {
|
|
260
|
+
try {
|
|
261
|
+
await this.acquisition;
|
|
262
|
+
} catch {}
|
|
263
|
+
try {
|
|
264
|
+
await this.releaseResources();
|
|
265
|
+
} catch {
|
|
266
|
+
throw new v(() => this.close());
|
|
267
|
+
}
|
|
268
|
+
})();
|
|
269
|
+
return this.closing = e, e.then(() => {
|
|
270
|
+
this.closing = null;
|
|
271
|
+
}, () => {
|
|
272
|
+
this.closing = null;
|
|
273
|
+
}), e;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
//#endregion
|
|
277
|
+
export { g as RoomsHostBindFailure, y as RoomsHostOwner, _ as RoomsHostStartFailure, v as RoomsHostStopFailure };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ROOMS_TABLE as e } from "./identities.js";
|
|
2
|
+
import { captureWorldCatalog as t } from "./world.js";
|
|
3
|
+
import { WORLD_CELLS_TABLE as n } from "./worldCells.js";
|
|
4
|
+
import { and as r, eq as i } from "@voltro/database";
|
|
5
|
+
import { performance as a } from "node:perf_hooks";
|
|
6
|
+
//#region src/hostCellObservation.ts
|
|
7
|
+
var o = class {
|
|
8
|
+
hostId;
|
|
9
|
+
capacity;
|
|
10
|
+
now;
|
|
11
|
+
worlds;
|
|
12
|
+
observed = null;
|
|
13
|
+
next = 0;
|
|
14
|
+
last = 0;
|
|
15
|
+
invalidClock = !1;
|
|
16
|
+
constructor(e, n, r, i = () => a.now()) {
|
|
17
|
+
this.hostId = n, this.capacity = r, this.now = i, this.worlds = e === void 0 ? void 0 : t(e);
|
|
18
|
+
}
|
|
19
|
+
time() {
|
|
20
|
+
try {
|
|
21
|
+
let e = this.now();
|
|
22
|
+
return (!Number.isFinite(e) || e < this.last) && (this.invalidClock = !0), this.invalidClock ? null : (this.last = e, e);
|
|
23
|
+
} catch {
|
|
24
|
+
return this.invalidClock = !0, null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
identity(e) {
|
|
28
|
+
return JSON.stringify(e.map((e) => [
|
|
29
|
+
e.roomId,
|
|
30
|
+
e.tenantId,
|
|
31
|
+
e.epoch,
|
|
32
|
+
e.name,
|
|
33
|
+
e.published
|
|
34
|
+
]).sort((e, t) => String(e[0]).localeCompare(String(t[0]))));
|
|
35
|
+
}
|
|
36
|
+
snapshot(e) {
|
|
37
|
+
let t = this.time(), n = this.observed;
|
|
38
|
+
return t !== null && n !== null && t - n.at < 5e3 && n.owners === this.identity(e) ? n.count : null;
|
|
39
|
+
}
|
|
40
|
+
async refresh(t, a) {
|
|
41
|
+
let o = this.time(), s = this.identity(a);
|
|
42
|
+
if (o === null || this.worlds === void 0) this.observed = null;
|
|
43
|
+
else if (!(o < this.next)) {
|
|
44
|
+
this.next = o + 1e3, this.observed = null;
|
|
45
|
+
try {
|
|
46
|
+
let c = this.worlds, l = new Map(a.map((e) => [e.roomId, e]));
|
|
47
|
+
if (l.size !== a.length || a.length > this.capacity) return;
|
|
48
|
+
let u = c.length === 0 ? 0 : await t.transactional(async (t) => {
|
|
49
|
+
let o = await t.query({
|
|
50
|
+
table: n,
|
|
51
|
+
predicate: i("hostId", this.hostId),
|
|
52
|
+
order: [{
|
|
53
|
+
column: "id",
|
|
54
|
+
direction: "asc"
|
|
55
|
+
}],
|
|
56
|
+
take: this.capacity + 1,
|
|
57
|
+
skip: void 0,
|
|
58
|
+
projection: [
|
|
59
|
+
"tenantId",
|
|
60
|
+
"worldId",
|
|
61
|
+
"zoneId",
|
|
62
|
+
"cellId",
|
|
63
|
+
"layer",
|
|
64
|
+
"roomId",
|
|
65
|
+
"hostId",
|
|
66
|
+
"epoch",
|
|
67
|
+
"state"
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
if (o.length > this.capacity) return null;
|
|
71
|
+
let s = await t.query({
|
|
72
|
+
table: e,
|
|
73
|
+
predicate: r(i("hostId", this.hostId), i("state", "live")),
|
|
74
|
+
order: [{
|
|
75
|
+
column: "id",
|
|
76
|
+
direction: "asc"
|
|
77
|
+
}],
|
|
78
|
+
take: this.capacity + 1,
|
|
79
|
+
skip: void 0,
|
|
80
|
+
projection: [
|
|
81
|
+
"id",
|
|
82
|
+
"tenantId",
|
|
83
|
+
"hostId",
|
|
84
|
+
"epoch",
|
|
85
|
+
"name",
|
|
86
|
+
"state"
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
if (s.length > this.capacity) return null;
|
|
90
|
+
let u = new Map(s.map((e) => [e.id, e]));
|
|
91
|
+
if (u.size !== s.length) return null;
|
|
92
|
+
let d = /* @__PURE__ */ new Set();
|
|
93
|
+
for (let e of o) {
|
|
94
|
+
let t = typeof e.roomId == "string" ? l.get(e.roomId) : void 0, n = c.find((t) => t.name === e.worldId);
|
|
95
|
+
if (!t?.published || !n || e.hostId !== this.hostId || e.state !== "live" || e.tenantId !== t.tenantId || e.epoch !== t.epoch || !n.zones.some((n) => n.id === e.zoneId && n.room === t.name) || typeof e.cellId != "string" || !e.cellId || !Number.isSafeInteger(e.layer) || Number(e.layer) < 1 || d.has(t.roomId)) return null;
|
|
96
|
+
d.add(t.roomId);
|
|
97
|
+
let r = u.get(t.roomId);
|
|
98
|
+
if (!r || r.tenantId !== t.tenantId || r.hostId !== this.hostId || r.epoch !== t.epoch || r.name !== t.name || r.state !== "live") return null;
|
|
99
|
+
}
|
|
100
|
+
return a.some((e) => c.some((t) => t.zones.some((t) => t.room === e.name)) && !d.has(e.roomId)) ? null : o.length;
|
|
101
|
+
});
|
|
102
|
+
u !== null && (this.observed = {
|
|
103
|
+
count: u,
|
|
104
|
+
at: o,
|
|
105
|
+
owners: s
|
|
106
|
+
});
|
|
107
|
+
} catch {
|
|
108
|
+
this.observed = null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { o as RoomHostCellObservation };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ProtocolError as e, RoomFull as t, RoomGone as n } from "./errors.js";
|
|
2
|
+
import { ROOMS_TABLE as r, ROOM_HOSTS_TABLE as i } from "./identities.js";
|
|
3
|
+
import { and as a, eq as o, or as s } from "@voltro/database";
|
|
4
|
+
//#region src/hostClientCapacity.ts
|
|
5
|
+
function c() {
|
|
6
|
+
throw new e({ detail: "Host client capacity authority is inconsistent or exceeds its scan budget" });
|
|
7
|
+
}
|
|
8
|
+
var l = (e) => typeof e == "number" && Number.isSafeInteger(e) && e >= 0 ? e : c(), u = async (e, t, s) => {
|
|
9
|
+
let l = [...new Set(t)].sort(), u = /* @__PURE__ */ new Map();
|
|
10
|
+
for (let t of l) {
|
|
11
|
+
let i = (await e.query({
|
|
12
|
+
table: r,
|
|
13
|
+
predicate: a(o("id", t), o("tenantId", s)),
|
|
14
|
+
order: [],
|
|
15
|
+
take: 1,
|
|
16
|
+
skip: void 0,
|
|
17
|
+
projection: ["hostId"]
|
|
18
|
+
}))[0];
|
|
19
|
+
if (!i) throw new n({ roomId: t });
|
|
20
|
+
let l = i.hostId;
|
|
21
|
+
if (l !== null && (typeof l != "string" || !l)) return c();
|
|
22
|
+
u.set(t, l);
|
|
23
|
+
}
|
|
24
|
+
for (let t of [...new Set([...u.values()].filter((e) => e !== null))].sort()) await e.query({
|
|
25
|
+
table: i,
|
|
26
|
+
predicate: o("id", t),
|
|
27
|
+
order: [],
|
|
28
|
+
take: 1,
|
|
29
|
+
skip: void 0,
|
|
30
|
+
projection: ["id"],
|
|
31
|
+
lock: "update"
|
|
32
|
+
});
|
|
33
|
+
let d = /* @__PURE__ */ new Map();
|
|
34
|
+
for (let t of l) {
|
|
35
|
+
let i = (await e.query({
|
|
36
|
+
table: r,
|
|
37
|
+
predicate: a(o("id", t), o("tenantId", s)),
|
|
38
|
+
order: [],
|
|
39
|
+
take: 1,
|
|
40
|
+
skip: void 0,
|
|
41
|
+
projection: void 0,
|
|
42
|
+
lock: "update"
|
|
43
|
+
}))[0];
|
|
44
|
+
if (!i || i.hostId !== u.get(t)) throw new n({ roomId: t });
|
|
45
|
+
d.set(t, i);
|
|
46
|
+
}
|
|
47
|
+
return d;
|
|
48
|
+
}, d = async (e, u, d, f) => {
|
|
49
|
+
if (l(d), !Number.isSafeInteger(f) || f < 1 || f >= 2 ** 53 - 1) return c();
|
|
50
|
+
let p = (await e.query({
|
|
51
|
+
table: i,
|
|
52
|
+
predicate: o("id", u),
|
|
53
|
+
order: [],
|
|
54
|
+
take: 1,
|
|
55
|
+
skip: void 0,
|
|
56
|
+
projection: [
|
|
57
|
+
"pool",
|
|
58
|
+
"clientCapacity",
|
|
59
|
+
"capacity"
|
|
60
|
+
],
|
|
61
|
+
lock: "update"
|
|
62
|
+
}))[0];
|
|
63
|
+
if (!p) throw new n({ roomId: "host" });
|
|
64
|
+
if (p.pool == null && p.clientCapacity == null) return;
|
|
65
|
+
if (typeof p.pool != "string" || !p.pool) return c();
|
|
66
|
+
let m = l(p.clientCapacity), h = l(p.capacity);
|
|
67
|
+
if (m < 1 || h < 1 || h > f) return c();
|
|
68
|
+
let g = await e.query({
|
|
69
|
+
table: r,
|
|
70
|
+
predicate: a(o("hostId", u), s(o("state", "live"), o("state", "creating"), o("state", "hibernating"))),
|
|
71
|
+
order: [{
|
|
72
|
+
column: "id",
|
|
73
|
+
direction: "asc"
|
|
74
|
+
}],
|
|
75
|
+
take: h + 1,
|
|
76
|
+
skip: void 0,
|
|
77
|
+
projection: ["clients"],
|
|
78
|
+
lock: "update"
|
|
79
|
+
});
|
|
80
|
+
if (g.length > h) return c();
|
|
81
|
+
let _ = m;
|
|
82
|
+
for (let e of g) {
|
|
83
|
+
let n = l(e.clients);
|
|
84
|
+
if (n > _) throw new t({ roomId: "host" });
|
|
85
|
+
_ -= n;
|
|
86
|
+
}
|
|
87
|
+
if (d > _) throw new t({ roomId: "host" });
|
|
88
|
+
};
|
|
89
|
+
//#endregion
|
|
90
|
+
export { d as assertHostClientCapacity, u as lockRoomReservationOwners };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { AsyncLocalStorage as t } from "node:async_hooks";
|
|
3
|
+
//#region src/hostCommandScope.ts
|
|
4
|
+
var n = new t(), r = (e) => {
|
|
5
|
+
for (let t = n.getStore(); t; t = t.parent) if (t.owner === e) return !0;
|
|
6
|
+
return !1;
|
|
7
|
+
}, i = () => n.getStore() !== void 0, a = (e, t) => {
|
|
8
|
+
let n = Promise.resolve().then(t);
|
|
9
|
+
return e.pending = n, n.then(() => {
|
|
10
|
+
e.pending === n && (e.pending = null);
|
|
11
|
+
}, (t) => {
|
|
12
|
+
e.failed = !0, e.failure = t, e.pending === n && (e.pending = null);
|
|
13
|
+
}), n;
|
|
14
|
+
}, o = (t, i, o) => {
|
|
15
|
+
let s = n.getStore();
|
|
16
|
+
if (!s) return o();
|
|
17
|
+
if (r(t) || !s.active || s.pending || i) return Promise.reject(new e({ detail: "Host command cannot wait on an occupied, ancestral or expired control lane" }));
|
|
18
|
+
let c;
|
|
19
|
+
try {
|
|
20
|
+
c = o();
|
|
21
|
+
} catch (e) {
|
|
22
|
+
c = Promise.reject(e);
|
|
23
|
+
}
|
|
24
|
+
return a(s, () => c);
|
|
25
|
+
}, s = (t, i) => {
|
|
26
|
+
let o = n.getStore();
|
|
27
|
+
if (o) return o.owner === t ? !o.active || o.pending ? Promise.reject(new e({ detail: "Host command operation scope is expired or already occupied" })) : a(o, () => o.dispatch ? o.dispatch(i) : i()) : r(t) ? Promise.reject(new e({ detail: "Host command cannot reenter an ancestral control lane" })) : void 0;
|
|
28
|
+
}, c = async (e, t, r, i) => {
|
|
29
|
+
let a = {
|
|
30
|
+
owner: e,
|
|
31
|
+
parent: r,
|
|
32
|
+
dispatch: i,
|
|
33
|
+
active: !0,
|
|
34
|
+
pending: null,
|
|
35
|
+
failure: void 0,
|
|
36
|
+
failed: !1
|
|
37
|
+
};
|
|
38
|
+
return n.run(a, async () => {
|
|
39
|
+
try {
|
|
40
|
+
let e = await t();
|
|
41
|
+
if (a.active = !1, a.pending && await a.pending, a.failed) throw a.failure;
|
|
42
|
+
return e;
|
|
43
|
+
} finally {
|
|
44
|
+
a.active = !1, a.pending && await a.pending;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}, l = async (t, i, a) => {
|
|
48
|
+
if (r(t)) throw new e({ detail: "Host command delivery cannot recursively deliver commands" });
|
|
49
|
+
return c(t, i, n.getStore(), a);
|
|
50
|
+
}, u = (t) => {
|
|
51
|
+
let r = !0, i = Promise.resolve();
|
|
52
|
+
return Object.freeze({
|
|
53
|
+
run: (a) => {
|
|
54
|
+
if (!r) return Promise.reject(new e({ detail: "Host command World operation window is closed" }));
|
|
55
|
+
let o = n.getStore(), s = i.then(() => c(t, a, o));
|
|
56
|
+
return i = s.then(() => void 0, () => void 0), s;
|
|
57
|
+
},
|
|
58
|
+
close: async () => {
|
|
59
|
+
r = !1, await i;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { r as hasRoomHostCommandScope, i as insideRoomHostCommandScope, u as makeRoomHostCommandWindow, o as queueRoomHostCommandOperation, s as runRoomHostCommandOperation, l as withRoomHostCommandScope };
|