@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,181 @@
|
|
|
1
|
+
import { defaultRoomSpectatorPolicy as e } from "./spectatorPolicy.js";
|
|
2
|
+
import { defaultRoomBudgets as t, defaultRoomReconnectPolicy as n, defaultRoomSnapshotPolicy as r, defaultRoomView as i, defineRoom as a } from "./room.js";
|
|
3
|
+
import { captureRoomSnapshotBudget as o, defaultRoomSnapshotBudget as s } from "./snapshotBudget.js";
|
|
4
|
+
import { leastLoadedRoomHostInRegion as c, resolveRoomHostSelection as l } from "./hostSelection.js";
|
|
5
|
+
import { Effect as u, Schema as d } from "effect";
|
|
6
|
+
// src/strategyFixtures.ts
|
|
7
|
+
var f = {
|
|
8
|
+
name: "strategy-fixture",
|
|
9
|
+
state: d.Struct({ n: d.Int }),
|
|
10
|
+
input: d.Struct({}),
|
|
11
|
+
options: d.Struct({}),
|
|
12
|
+
onTick: () => void 0
|
|
13
|
+
}, p = { burst: 31 }, m = { graceMs: 1234 }, h = {
|
|
14
|
+
kind: "slot",
|
|
15
|
+
defaultImplementation: t,
|
|
16
|
+
defaultProbe: {
|
|
17
|
+
run: () => u.sync(() => a({
|
|
18
|
+
...f,
|
|
19
|
+
budgets: p
|
|
20
|
+
}).budgets.burst),
|
|
21
|
+
expected: 31
|
|
22
|
+
},
|
|
23
|
+
overrideProbe: {
|
|
24
|
+
run: () => u.sync(() => a({
|
|
25
|
+
...f,
|
|
26
|
+
budgets: p,
|
|
27
|
+
strategies: { budgets: (e) => ({
|
|
28
|
+
...t(e),
|
|
29
|
+
burst: 7
|
|
30
|
+
}) }
|
|
31
|
+
}).budgets.burst),
|
|
32
|
+
expected: 7
|
|
33
|
+
}
|
|
34
|
+
}, g = {
|
|
35
|
+
kind: "slot",
|
|
36
|
+
defaultImplementation: n,
|
|
37
|
+
defaultProbe: {
|
|
38
|
+
run: () => u.sync(() => a({
|
|
39
|
+
...f,
|
|
40
|
+
reconnect: m
|
|
41
|
+
}).reconnect.graceMs),
|
|
42
|
+
expected: 1234
|
|
43
|
+
},
|
|
44
|
+
overrideProbe: {
|
|
45
|
+
run: () => u.sync(() => a({
|
|
46
|
+
...f,
|
|
47
|
+
reconnect: m,
|
|
48
|
+
strategies: { reconnectPolicy: (e) => ({ graceMs: n(e).graceMs * 2 }) }
|
|
49
|
+
}).reconnect.graceMs),
|
|
50
|
+
expected: 2468
|
|
51
|
+
}
|
|
52
|
+
}, _ = {
|
|
53
|
+
kind: "slot",
|
|
54
|
+
defaultImplementation: r,
|
|
55
|
+
defaultProbe: {
|
|
56
|
+
run: () => u.sync(() => a({
|
|
57
|
+
...f,
|
|
58
|
+
snapshot: {
|
|
59
|
+
everyMs: 1234,
|
|
60
|
+
maxInlineBytes: 8192
|
|
61
|
+
}
|
|
62
|
+
}).snapshot.maxInlineBytes),
|
|
63
|
+
expected: 8192
|
|
64
|
+
},
|
|
65
|
+
overrideProbe: {
|
|
66
|
+
run: () => u.sync(() => a({
|
|
67
|
+
...f,
|
|
68
|
+
snapshot: {
|
|
69
|
+
everyMs: 1234,
|
|
70
|
+
maxInlineBytes: 8192
|
|
71
|
+
},
|
|
72
|
+
strategies: { snapshotPolicy: (e) => ({
|
|
73
|
+
...r(e),
|
|
74
|
+
maxInlineBytes: 4096
|
|
75
|
+
}) }
|
|
76
|
+
}).snapshot.maxInlineBytes),
|
|
77
|
+
expected: 4096
|
|
78
|
+
}
|
|
79
|
+
}, v = {
|
|
80
|
+
kind: "slot",
|
|
81
|
+
defaultImplementation: s,
|
|
82
|
+
defaultProbe: {
|
|
83
|
+
run: () => u.sync(() => {
|
|
84
|
+
let e = o(s, {
|
|
85
|
+
budgetBytesPerSec: 10,
|
|
86
|
+
burstBytes: 10
|
|
87
|
+
});
|
|
88
|
+
return e.forced(20, 0), e.metrics().debtBytes;
|
|
89
|
+
}),
|
|
90
|
+
expected: 10
|
|
91
|
+
},
|
|
92
|
+
overrideProbe: {
|
|
93
|
+
run: () => u.sync(() => {
|
|
94
|
+
let e = o((e) => s({
|
|
95
|
+
...e,
|
|
96
|
+
burstBytes: 20
|
|
97
|
+
}), {
|
|
98
|
+
budgetBytesPerSec: 10,
|
|
99
|
+
burstBytes: 10
|
|
100
|
+
});
|
|
101
|
+
return e.forced(20, 0), e.metrics().debtBytes;
|
|
102
|
+
}),
|
|
103
|
+
expected: 0
|
|
104
|
+
}
|
|
105
|
+
}, y = () => ({
|
|
106
|
+
state: { n: 7 },
|
|
107
|
+
tick: 1,
|
|
108
|
+
role: "player",
|
|
109
|
+
client: {
|
|
110
|
+
sessionId: "fixture-session",
|
|
111
|
+
subjectId: "fixture-subject",
|
|
112
|
+
tenantId: "fixture-tenant"
|
|
113
|
+
}
|
|
114
|
+
}), b = {
|
|
115
|
+
kind: "slot",
|
|
116
|
+
defaultImplementation: i,
|
|
117
|
+
defaultProbe: {
|
|
118
|
+
run: () => u.sync(() => a(f).view(y()).n),
|
|
119
|
+
expected: 7
|
|
120
|
+
},
|
|
121
|
+
overrideProbe: {
|
|
122
|
+
run: () => u.sync(() => a({
|
|
123
|
+
...f,
|
|
124
|
+
view: () => ({ n: 0 })
|
|
125
|
+
}).view(y()).n),
|
|
126
|
+
expected: 0
|
|
127
|
+
}
|
|
128
|
+
}, x = () => [{
|
|
129
|
+
id: "first",
|
|
130
|
+
address: "wss://first.invalid/rooms",
|
|
131
|
+
region: "fixture-region",
|
|
132
|
+
capacity: 2,
|
|
133
|
+
rooms: 1,
|
|
134
|
+
clients: 1,
|
|
135
|
+
cpu: .25,
|
|
136
|
+
lastHeartbeatAt: 1,
|
|
137
|
+
ready: !0
|
|
138
|
+
}, {
|
|
139
|
+
id: "second",
|
|
140
|
+
address: "wss://second.invalid/rooms",
|
|
141
|
+
region: "fixture-region",
|
|
142
|
+
capacity: 2,
|
|
143
|
+
rooms: 0,
|
|
144
|
+
clients: 0,
|
|
145
|
+
cpu: .5,
|
|
146
|
+
lastHeartbeatAt: 1,
|
|
147
|
+
ready: !0
|
|
148
|
+
}], S = {
|
|
149
|
+
kind: "slot",
|
|
150
|
+
defaultImplementation: c,
|
|
151
|
+
defaultProbe: {
|
|
152
|
+
run: () => u.sync(() => l(x(), "fixture-region")?.id),
|
|
153
|
+
expected: "second"
|
|
154
|
+
},
|
|
155
|
+
overrideProbe: {
|
|
156
|
+
run: () => u.sync(() => l(x(), "fixture-region", (e) => e[0] ?? null)?.id),
|
|
157
|
+
expected: "first"
|
|
158
|
+
}
|
|
159
|
+
}, C = {
|
|
160
|
+
kind: "slot",
|
|
161
|
+
defaultImplementation: e,
|
|
162
|
+
defaultProbe: {
|
|
163
|
+
run: () => u.sync(() => a({
|
|
164
|
+
...f,
|
|
165
|
+
spectator: { delayMs: 100 }
|
|
166
|
+
}).spectator?.delayMs),
|
|
167
|
+
expected: 100
|
|
168
|
+
},
|
|
169
|
+
overrideProbe: {
|
|
170
|
+
run: () => u.sync(() => a({
|
|
171
|
+
...f,
|
|
172
|
+
spectator: { delayMs: 100 },
|
|
173
|
+
strategies: { spectatorPolicy: (t) => ({
|
|
174
|
+
...e(t),
|
|
175
|
+
delayMs: 200
|
|
176
|
+
}) }
|
|
177
|
+
}).spectator?.delayMs),
|
|
178
|
+
expected: 200
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
export { h as roomBudgetsSlotFixture, g as roomReconnectSlotFixture, S as roomSelectHostSlotFixture, v as roomSnapshotBudgetSlotFixture, _ as roomSnapshotSlotFixture, C as roomSpectatorSlotFixture, b as roomViewSlotFixture };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t, RoomAuthoringError as n } from "./errors.js";
|
|
2
|
+
// src/streamFraming.ts
|
|
3
|
+
var r = (e, t) => {
|
|
4
|
+
if (typeof e != "number" || !Number.isSafeInteger(e) || e < 1 || e > t) throw new n({
|
|
5
|
+
room: "stream-framing",
|
|
6
|
+
detail: "Stream framing requires explicit positive bounded budgets"
|
|
7
|
+
});
|
|
8
|
+
return e;
|
|
9
|
+
}, i = (e) => {
|
|
10
|
+
if (!(e instanceof Uint8Array)) throw new t({ detail: "Room stream chunks must contain binary bytes" });
|
|
11
|
+
return e;
|
|
12
|
+
}, a = (n, a) => {
|
|
13
|
+
let o = i(n), s = r(a, 16777216);
|
|
14
|
+
if (!o.byteLength) throw new t({ detail: "Room stream cannot encode an empty frame" });
|
|
15
|
+
if (o.byteLength > s) throw new e({
|
|
16
|
+
budget: "roomStreamFrameBytes",
|
|
17
|
+
limit: s
|
|
18
|
+
});
|
|
19
|
+
let c = new Uint8Array(o.byteLength + 4);
|
|
20
|
+
return new DataView(c.buffer).setUint32(0, o.byteLength, !1), c.set(o, 4), c;
|
|
21
|
+
}, o = class {
|
|
22
|
+
options;
|
|
23
|
+
header = /* @__PURE__ */ new Uint8Array(4);
|
|
24
|
+
headerBytes = 0;
|
|
25
|
+
payload = null;
|
|
26
|
+
payloadBytes = 0;
|
|
27
|
+
ended = !1;
|
|
28
|
+
constructor(e) {
|
|
29
|
+
if (!e || Object.getPrototypeOf(e) !== Object.prototype || Reflect.ownKeys(e).length !== 3 || [
|
|
30
|
+
"maxFrameBytes",
|
|
31
|
+
"maxChunkBytes",
|
|
32
|
+
"maxFramesPerChunk"
|
|
33
|
+
].some((t) => {
|
|
34
|
+
let n = Object.getOwnPropertyDescriptor(e, t);
|
|
35
|
+
return !n?.enumerable || !("value" in n);
|
|
36
|
+
})) throw new n({
|
|
37
|
+
room: "stream-framing",
|
|
38
|
+
detail: "Stream framing configuration requires own bounded data"
|
|
39
|
+
});
|
|
40
|
+
this.options = Object.freeze({
|
|
41
|
+
maxFrameBytes: r(e.maxFrameBytes, 16777216),
|
|
42
|
+
maxChunkBytes: r(e.maxChunkBytes, 33554432),
|
|
43
|
+
maxFramesPerChunk: r(e.maxFramesPerChunk, 65536)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
get bufferedBytes() {
|
|
47
|
+
return this.headerBytes + this.payloadBytes;
|
|
48
|
+
}
|
|
49
|
+
push(n) {
|
|
50
|
+
if (this.ended) throw new t({ detail: "Room stream framing is closed or failed" });
|
|
51
|
+
try {
|
|
52
|
+
let r = i(n);
|
|
53
|
+
if (r.byteLength > this.options.maxChunkBytes) throw new e({
|
|
54
|
+
budget: "roomStreamChunkBytes",
|
|
55
|
+
limit: this.options.maxChunkBytes
|
|
56
|
+
});
|
|
57
|
+
let a = [], o = 0;
|
|
58
|
+
for (; o < r.byteLength;) {
|
|
59
|
+
if (this.payload === null) {
|
|
60
|
+
let n = Math.min(4 - this.headerBytes, r.byteLength - o);
|
|
61
|
+
if (this.header.set(r.subarray(o, o + n), this.headerBytes), this.headerBytes += n, o += n, this.headerBytes < 4) break;
|
|
62
|
+
let i = new DataView(this.header.buffer).getUint32(0, !1);
|
|
63
|
+
if (!i) throw new t({ detail: "Room stream declared an empty frame" });
|
|
64
|
+
if (i > this.options.maxFrameBytes) throw new e({
|
|
65
|
+
budget: "roomStreamFrameBytes",
|
|
66
|
+
limit: this.options.maxFrameBytes
|
|
67
|
+
});
|
|
68
|
+
if (a.length >= this.options.maxFramesPerChunk) throw new e({
|
|
69
|
+
budget: "roomStreamFramesPerChunk",
|
|
70
|
+
limit: this.options.maxFramesPerChunk
|
|
71
|
+
});
|
|
72
|
+
this.payload = new Uint8Array(i), this.payloadBytes = 0;
|
|
73
|
+
}
|
|
74
|
+
let n = Math.min(this.payload.byteLength - this.payloadBytes, r.byteLength - o);
|
|
75
|
+
this.payload.set(r.subarray(o, o + n), this.payloadBytes), this.payloadBytes += n, o += n, this.payloadBytes === this.payload.byteLength && (a.push(this.payload), this.payload = null, this.payloadBytes = 0, this.headerBytes = 0);
|
|
76
|
+
}
|
|
77
|
+
return Object.freeze(a);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
throw this.ended = !0, this.payload = null, this.payloadBytes = 0, this.headerBytes = 0, e;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
finish() {
|
|
83
|
+
if (this.ended) throw new t({ detail: "Room stream framing is already closed or failed" });
|
|
84
|
+
this.ended = !0;
|
|
85
|
+
let e = this.headerBytes !== 0 || this.payload !== null;
|
|
86
|
+
if (this.payload = null, this.headerBytes = 0, this.payloadBytes = 0, e) throw new t({ detail: "Room stream ended inside a frame" });
|
|
87
|
+
}
|
|
88
|
+
}, s = class {
|
|
89
|
+
maxDatagramBytes;
|
|
90
|
+
pending = null;
|
|
91
|
+
dropped = 0;
|
|
92
|
+
ended = !1;
|
|
93
|
+
constructor(e) {
|
|
94
|
+
this.maxDatagramBytes = r(e, 65535);
|
|
95
|
+
}
|
|
96
|
+
get droppedDatagrams() {
|
|
97
|
+
return this.dropped;
|
|
98
|
+
}
|
|
99
|
+
get bufferedBytes() {
|
|
100
|
+
return this.pending?.byteLength ?? 0;
|
|
101
|
+
}
|
|
102
|
+
offer(n) {
|
|
103
|
+
if (this.ended) throw new t({ detail: "Room datagram mailbox is closed" });
|
|
104
|
+
let r = i(n);
|
|
105
|
+
if (!r.byteLength) throw new t({ detail: "Room datagram cannot contain an empty frame" });
|
|
106
|
+
if (r.byteLength > this.maxDatagramBytes) throw new e({
|
|
107
|
+
budget: "maxDatagramBytes",
|
|
108
|
+
limit: this.maxDatagramBytes
|
|
109
|
+
});
|
|
110
|
+
this.pending && this.dropped++, this.pending = r.slice();
|
|
111
|
+
}
|
|
112
|
+
take() {
|
|
113
|
+
if (this.ended) throw new t({ detail: "Room datagram mailbox is closed" });
|
|
114
|
+
let e = this.pending;
|
|
115
|
+
return this.pending = null, e;
|
|
116
|
+
}
|
|
117
|
+
close() {
|
|
118
|
+
this.pending && this.dropped++, this.pending = null, this.ended = !0;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
export { s as RoomLatestDatagram, o as RoomStreamFrameDecoder, a as encodeRoomStreamFrame };
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t, RoomAuthoringError as n } from "./errors.js";
|
|
2
|
+
import { captureRoomTransportClock as r } from "./transportAuthoring.js";
|
|
3
|
+
import { RoomTransportCleanupFailure as i } from "./transportCleanup.js";
|
|
4
|
+
import { RoomLatestDatagram as a, RoomStreamFrameDecoder as o, encodeRoomStreamFrame as s } from "./streamFraming.js";
|
|
5
|
+
// src/streamTransport.ts
|
|
6
|
+
var c = (e) => new t({ detail: e }), l = async (t) => {
|
|
7
|
+
let l = [
|
|
8
|
+
"reliable",
|
|
9
|
+
"datagrams",
|
|
10
|
+
"maxFrameBytes",
|
|
11
|
+
"maxChunkBytes",
|
|
12
|
+
"maxFramesPerChunk",
|
|
13
|
+
"maxQueuedBytes",
|
|
14
|
+
"maxListeners",
|
|
15
|
+
"clock",
|
|
16
|
+
"signal",
|
|
17
|
+
"release"
|
|
18
|
+
];
|
|
19
|
+
if (!t || Object.getPrototypeOf(t) !== Object.prototype || Reflect.ownKeys(t).some((e) => {
|
|
20
|
+
let n = Object.getOwnPropertyDescriptor(t, e);
|
|
21
|
+
return typeof e != "string" || !l.includes(e) || !n?.enumerable || !("value" in n);
|
|
22
|
+
}) || !Number.isSafeInteger(t.maxQueuedBytes) || t.maxQueuedBytes < 1 || t.maxQueuedBytes > 33554432 || !Number.isSafeInteger(t.maxListeners) || t.maxListeners < 1 || t.maxListeners > 1024 || typeof t.release != "function" || !(t.signal instanceof AbortSignal)) throw new n({
|
|
23
|
+
room: "stream-transport",
|
|
24
|
+
detail: "Stream transport requires complete actual providers and bounded budgets"
|
|
25
|
+
});
|
|
26
|
+
let u = (e) => {
|
|
27
|
+
if (!e || Object.getPrototypeOf(e) !== Object.prototype || Reflect.ownKeys(e).some((t) => {
|
|
28
|
+
let n = Object.getOwnPropertyDescriptor(e, t);
|
|
29
|
+
return typeof t != "string" || ![
|
|
30
|
+
"readable",
|
|
31
|
+
"writable",
|
|
32
|
+
"maxDatagramBytes"
|
|
33
|
+
].includes(t) || !n?.enumerable || !("value" in n);
|
|
34
|
+
}) || !(e.readable instanceof ReadableStream) || !(e.writable instanceof WritableStream)) throw new n({
|
|
35
|
+
room: "stream-transport",
|
|
36
|
+
detail: "Room duplex requires actual transferred readable and writable streams"
|
|
37
|
+
});
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
readable: e.readable,
|
|
40
|
+
writable: e.writable
|
|
41
|
+
});
|
|
42
|
+
}, d = r(t.clock);
|
|
43
|
+
if (t.signal.aborted) throw c("Room stream admission was cancelled before resource transfer");
|
|
44
|
+
let f = u(t.reliable), p = t.datagrams === void 0 ? void 0 : u(t.datagrams), m = new o({
|
|
45
|
+
maxFrameBytes: t.maxFrameBytes,
|
|
46
|
+
maxChunkBytes: t.maxChunkBytes,
|
|
47
|
+
maxFramesPerChunk: t.maxFramesPerChunk
|
|
48
|
+
}), h = t.maxFrameBytes, g = t.maxQueuedBytes, _ = t.maxListeners, v = d.now, y = t.release.bind(t), b = t.signal, x = t.datagrams === void 0 ? void 0 : new a(t.datagrams.maxDatagramBytes), S = [], C, w, T, E;
|
|
49
|
+
try {
|
|
50
|
+
C = f.readable.getReader(), S.push(C), w = f.writable.getWriter(), S.push(w), p && (T = p.readable.getReader(), S.push(T), E = p.writable.getWriter(), S.push(E));
|
|
51
|
+
} catch {
|
|
52
|
+
let e = /* @__PURE__ */ new Set(), t = !1, n = new i(async () => {
|
|
53
|
+
let n = !1;
|
|
54
|
+
for (let t of S) if (!e.has(t)) try {
|
|
55
|
+
t.releaseLock(), e.add(t);
|
|
56
|
+
} catch {
|
|
57
|
+
n = !0;
|
|
58
|
+
}
|
|
59
|
+
if (!t) try {
|
|
60
|
+
await y(1011, "Room stream acquisition failed"), t = !0;
|
|
61
|
+
} catch {
|
|
62
|
+
n = !0;
|
|
63
|
+
}
|
|
64
|
+
if (n) throw c("Room stream acquisition cleanup remains incomplete");
|
|
65
|
+
});
|
|
66
|
+
try {
|
|
67
|
+
await n.cleanupAsync();
|
|
68
|
+
} catch {
|
|
69
|
+
throw n;
|
|
70
|
+
}
|
|
71
|
+
throw c("Room stream acquisition failed");
|
|
72
|
+
}
|
|
73
|
+
let D = new AbortController(), O = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Set(), A = [], j = 0, M, N, P, F, I = !1, L, R = !1, z = -1, B = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Set(), H, U = async (e, t) => {
|
|
74
|
+
let n = [], r = async (e, t) => {
|
|
75
|
+
if (!B.has(e)) try {
|
|
76
|
+
await t(), B.add(e);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
n.push(e);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
await Promise.all([
|
|
82
|
+
r(C, () => C.cancel()),
|
|
83
|
+
r(w, () => w.abort()),
|
|
84
|
+
...T ? [r(T, () => T.cancel())] : [],
|
|
85
|
+
...E ? [r(E, () => E.abort())] : [],
|
|
86
|
+
(async () => {
|
|
87
|
+
if (!R) try {
|
|
88
|
+
await y(e, t), R = !0;
|
|
89
|
+
} catch (e) {
|
|
90
|
+
n.push(e);
|
|
91
|
+
}
|
|
92
|
+
})()
|
|
93
|
+
]);
|
|
94
|
+
let i = await Promise.allSettled([
|
|
95
|
+
M,
|
|
96
|
+
N,
|
|
97
|
+
P,
|
|
98
|
+
F
|
|
99
|
+
].filter((e) => e !== void 0));
|
|
100
|
+
for (let e of i) e.status === "rejected" && n.push(e.reason);
|
|
101
|
+
for (let e of S) if (B.has(e) && !V.has(e)) try {
|
|
102
|
+
e.releaseLock(), V.add(e);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
n.push(e);
|
|
105
|
+
}
|
|
106
|
+
if (n.length) throw c("Room stream transport cleanup remains incomplete");
|
|
107
|
+
}, W = (e, t) => {
|
|
108
|
+
if (!Number.isSafeInteger(e) || e < 0 || e > 4294967295 || typeof t != "string" || !t.isWellFormed() || new TextEncoder().encode(t).byteLength > 1024) return Promise.reject(c("Invalid Room stream close information"));
|
|
109
|
+
if (L) return L;
|
|
110
|
+
if (!I) {
|
|
111
|
+
H = Object.freeze({
|
|
112
|
+
code: e,
|
|
113
|
+
reason: t
|
|
114
|
+
}), I = !0, b.removeEventListener("abort", K), D.abort(c("Room stream transport closed")), O.clear(), k.clear(), x?.close();
|
|
115
|
+
for (let e of A.splice(0)) j -= e.bytes.byteLength, e.reject(c("Room stream write was withdrawn before submission"));
|
|
116
|
+
}
|
|
117
|
+
let n = U(H.code, H.reason);
|
|
118
|
+
return L = n, n.catch(() => {
|
|
119
|
+
L === n && (L = void 0);
|
|
120
|
+
}), n;
|
|
121
|
+
}, G = (e, t) => {
|
|
122
|
+
W(e, t).catch(() => {});
|
|
123
|
+
}, K = () => {
|
|
124
|
+
G(1e3, "Room stream parent admission was cancelled");
|
|
125
|
+
}, q = () => {
|
|
126
|
+
G(1002, "Room stream operation failed");
|
|
127
|
+
}, J = (e, t) => {
|
|
128
|
+
let n = v();
|
|
129
|
+
if (!Number.isFinite(n) || n < 0 || n < z) throw c("Room stream requires a monotonic observation clock");
|
|
130
|
+
z = n;
|
|
131
|
+
for (let r of e) {
|
|
132
|
+
if (I) return;
|
|
133
|
+
r(t.slice(), n);
|
|
134
|
+
}
|
|
135
|
+
}, Y = async () => {
|
|
136
|
+
try {
|
|
137
|
+
for (; !I;) {
|
|
138
|
+
let e = await C.read();
|
|
139
|
+
if (I) return;
|
|
140
|
+
if (e.done) {
|
|
141
|
+
m.finish(), G(1e3, "Room reliable stream ended");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
for (let t of m.push(e.value)) J(O, t);
|
|
145
|
+
}
|
|
146
|
+
} catch {
|
|
147
|
+
I || q();
|
|
148
|
+
}
|
|
149
|
+
}, X = async () => {
|
|
150
|
+
try {
|
|
151
|
+
for (; !I;) {
|
|
152
|
+
let e = await T.read();
|
|
153
|
+
if (I) return;
|
|
154
|
+
if (e.done) {
|
|
155
|
+
G(1e3, "Room datagram stream ended");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (!(e.value instanceof Uint8Array) || !e.value.byteLength || e.value.byteLength > x.maxDatagramBytes) throw c("Room datagram exceeded its admitted binary budget");
|
|
159
|
+
J(k, e.value);
|
|
160
|
+
}
|
|
161
|
+
} catch {
|
|
162
|
+
I || q();
|
|
163
|
+
}
|
|
164
|
+
}, Z = () => {
|
|
165
|
+
if (P || I) return;
|
|
166
|
+
let e = (async () => {
|
|
167
|
+
for (; !I && A.length;) {
|
|
168
|
+
let e = A.shift();
|
|
169
|
+
try {
|
|
170
|
+
await w.write(e.bytes), I ? e.reject(c("Room native stream write outcome was withdrawn")) : e.resolve();
|
|
171
|
+
} catch {
|
|
172
|
+
e.reject(c("Room native stream write remains incomplete")), I || q();
|
|
173
|
+
} finally {
|
|
174
|
+
j -= e.bytes.byteLength;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
})();
|
|
178
|
+
P = e;
|
|
179
|
+
let t = () => {
|
|
180
|
+
P === e && (P = void 0), !I && A.length && Z();
|
|
181
|
+
};
|
|
182
|
+
e.then(t, () => {
|
|
183
|
+
q(), t();
|
|
184
|
+
});
|
|
185
|
+
}, Q = () => {
|
|
186
|
+
if (F || I) return;
|
|
187
|
+
let e = (async () => {
|
|
188
|
+
try {
|
|
189
|
+
for (; !I && x.bufferedBytes;) {
|
|
190
|
+
if (await E.ready, I) return;
|
|
191
|
+
let e = x.take();
|
|
192
|
+
e && await E.write(e);
|
|
193
|
+
}
|
|
194
|
+
} catch {
|
|
195
|
+
I || q();
|
|
196
|
+
}
|
|
197
|
+
})();
|
|
198
|
+
F = e;
|
|
199
|
+
let t = () => {
|
|
200
|
+
F === e && (F = void 0), !I && x.bufferedBytes && Q();
|
|
201
|
+
};
|
|
202
|
+
e.then(t, () => {
|
|
203
|
+
q(), t();
|
|
204
|
+
});
|
|
205
|
+
}, $ = (t, n, r) => {
|
|
206
|
+
if (typeof n != "function" || I) throw c("Room stream cannot attach a listener after close");
|
|
207
|
+
if (!t.has(n) && t.size >= _) throw new e({
|
|
208
|
+
budget: "roomTransportListeners",
|
|
209
|
+
limit: _
|
|
210
|
+
});
|
|
211
|
+
return t.add(n), r ? N ??= X() : M ??= Y(), () => {
|
|
212
|
+
t.delete(n);
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
if (b.addEventListener("abort", K, { once: !0 }), b.aborted) {
|
|
216
|
+
let e = new i(() => W(1e3, "Room stream parent admission was cancelled"));
|
|
217
|
+
try {
|
|
218
|
+
await e.cleanupAsync();
|
|
219
|
+
} catch {
|
|
220
|
+
throw e;
|
|
221
|
+
}
|
|
222
|
+
throw c("Room stream admission was cancelled");
|
|
223
|
+
}
|
|
224
|
+
return Object.freeze({
|
|
225
|
+
name: "wt",
|
|
226
|
+
signal: D.signal,
|
|
227
|
+
reliable: Object.freeze({
|
|
228
|
+
send: (t) => {
|
|
229
|
+
if (I) return Promise.reject(c("Room stream transport is closed"));
|
|
230
|
+
let n;
|
|
231
|
+
try {
|
|
232
|
+
n = s(t, h);
|
|
233
|
+
} catch (e) {
|
|
234
|
+
return Promise.reject(e);
|
|
235
|
+
}
|
|
236
|
+
return j + n.byteLength > g ? (G(1009, "Room stream output exceeded its budget"), Promise.reject(new e({
|
|
237
|
+
budget: "maxQueuedBytes",
|
|
238
|
+
limit: g
|
|
239
|
+
}))) : new Promise((e, t) => {
|
|
240
|
+
j += n.byteLength, A.push({
|
|
241
|
+
bytes: n,
|
|
242
|
+
resolve: e,
|
|
243
|
+
reject: t
|
|
244
|
+
}), Z();
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
onFrame: (e) => $(O, e, !1)
|
|
248
|
+
}),
|
|
249
|
+
...x === void 0 ? {} : { unreliable: Object.freeze({
|
|
250
|
+
maxDatagramBytes: x.maxDatagramBytes,
|
|
251
|
+
send: (e) => {
|
|
252
|
+
x.offer(e), Q();
|
|
253
|
+
},
|
|
254
|
+
onFrame: (e) => $(k, e, !0)
|
|
255
|
+
}) },
|
|
256
|
+
stats: () => ({
|
|
257
|
+
rttMs: null,
|
|
258
|
+
queuedBytes: j,
|
|
259
|
+
droppedDatagrams: x?.droppedDatagrams ?? 0
|
|
260
|
+
}),
|
|
261
|
+
close: G,
|
|
262
|
+
closeAsync: W
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
export { l as makeRoomStreamTransport };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { ROOM_SUBJECT_PRIVACY_TABLE as t } from "./identities.js";
|
|
3
|
+
import { canonicalRoomJson as n } from "./checkpointJson.js";
|
|
4
|
+
import { and as r, eq as i, inSet as a } from "@voltro/database";
|
|
5
|
+
import { createHash as o } from "node:crypto";
|
|
6
|
+
// src/subjectAdmission.ts
|
|
7
|
+
var s = (t, r) => {
|
|
8
|
+
if (![t, r].every((e) => typeof e == "string" && e.trim().length > 0 && e.length <= 191)) throw new e({ detail: "Rooms Subject admission requires an explicit tenant and identity" });
|
|
9
|
+
return o("sha256").update(n([t, r])).digest("hex");
|
|
10
|
+
}, c = async (n, a) => {
|
|
11
|
+
let o = a.tenantId, c = a.subjectId;
|
|
12
|
+
if (typeof o != "string" || !o.trim() || o.length > 191) throw new e({ detail: "Rooms Subject admission requires an explicit tenant" });
|
|
13
|
+
if (c === null) return;
|
|
14
|
+
let l = s(o, c), u;
|
|
15
|
+
try {
|
|
16
|
+
u = await n.query({
|
|
17
|
+
table: t,
|
|
18
|
+
predicate: r(i("tenantId", o), i("subjectKey", l)),
|
|
19
|
+
order: [],
|
|
20
|
+
take: 2,
|
|
21
|
+
skip: void 0,
|
|
22
|
+
projection: ["tenantId", "subjectKey"]
|
|
23
|
+
});
|
|
24
|
+
} catch {
|
|
25
|
+
throw new e({ detail: "Rooms Subject admission could not be verified" });
|
|
26
|
+
}
|
|
27
|
+
if (!Array.isArray(u) || u.length > 1 || u.some((e) => typeof e != "object" || !e || e.tenantId !== o || e.subjectKey !== l)) throw new e({ detail: "Rooms Subject admission observation changed scope" });
|
|
28
|
+
if (u.length !== 0) throw new e({ detail: "Rooms Subject admission is fenced" });
|
|
29
|
+
}, l = async (n, o, c) => {
|
|
30
|
+
if (typeof o != "string" || !o.trim() || o.length > 191) throw new e({ detail: "Rooms Subject admission requires an explicit tenant" });
|
|
31
|
+
let l = [...new Set(c.map((e) => s(o, e)))];
|
|
32
|
+
if (l.length === 0) return;
|
|
33
|
+
let u;
|
|
34
|
+
try {
|
|
35
|
+
u = await n.query({
|
|
36
|
+
table: t,
|
|
37
|
+
predicate: r(i("tenantId", o), a("subjectKey", l)),
|
|
38
|
+
order: [],
|
|
39
|
+
take: l.length + 1,
|
|
40
|
+
skip: void 0,
|
|
41
|
+
projection: ["tenantId", "subjectKey"]
|
|
42
|
+
});
|
|
43
|
+
} catch {
|
|
44
|
+
throw new e({ detail: "Rooms Subject admission could not be verified" });
|
|
45
|
+
}
|
|
46
|
+
if (!Array.isArray(u) || u.some((e) => typeof e != "object" || !e || e.tenantId !== o || !l.includes(e.subjectKey))) throw new e({ detail: "Rooms Subject admission observation changed scope" });
|
|
47
|
+
if (u.length !== 0) throw new e({ detail: "Rooms Subject admission is fenced" });
|
|
48
|
+
};
|
|
49
|
+
export { c as assertRoomSubjectAdmission, l as assertRoomSubjectsAdmission, s as roomSubjectPrivacyKey };
|