@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,98 @@
|
|
|
1
|
+
import { RoomAuthoringError as e } from "./errors.js";
|
|
2
|
+
//#region src/schemaHistory.ts
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
throw new e({
|
|
5
|
+
room: t,
|
|
6
|
+
detail: n
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
var n = (e) => JSON.stringify([e.scope, e.id]), r = (e, r = {}) => {
|
|
10
|
+
let i = {
|
|
11
|
+
maxRooms: 256,
|
|
12
|
+
maxHistoricalFields: 16384,
|
|
13
|
+
...r
|
|
14
|
+
};
|
|
15
|
+
for (let e of Object.values(i)) (!Number.isSafeInteger(e) || e < 1) && t("catalog", "Schema history budgets must be positive safe integers");
|
|
16
|
+
let a = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
17
|
+
if (!a(e) || e.version !== 1 || !a(e.rooms)) return t("catalog", "Malformed Rooms schema history");
|
|
18
|
+
let o = Object.keys(e.rooms).sort();
|
|
19
|
+
if (o.length > i.maxRooms) return t("catalog", "Room schema history exceeds its room budget");
|
|
20
|
+
let s = Object.create(null);
|
|
21
|
+
for (let r of o) {
|
|
22
|
+
let o = e.rooms[r];
|
|
23
|
+
if (!r.trim() || !a(o) || typeof o.schemaHash != "number" || !Number.isSafeInteger(o.schemaHash) || o.schemaHash < 0 || o.schemaHash > 4294967295 || typeof o.revision != "number" || !Number.isSafeInteger(o.revision) || o.revision < 1 || !Array.isArray(o.fields) || o.fields.length > i.maxHistoricalFields) return t(r, "Malformed room field history");
|
|
24
|
+
let c = /* @__PURE__ */ new Set(), l = [];
|
|
25
|
+
for (let e of o.fields) {
|
|
26
|
+
if (!a(e) || typeof e.scope != "string" || !e.scope.startsWith("root") || typeof e.name != "string" || !e.name || typeof e.id != "number" || !Number.isSafeInteger(e.id) || e.id < 1 || typeof e.active != "boolean") return t(r, "Malformed historical field identity");
|
|
27
|
+
let i = {
|
|
28
|
+
scope: e.scope,
|
|
29
|
+
name: e.name,
|
|
30
|
+
id: e.id,
|
|
31
|
+
active: e.active
|
|
32
|
+
};
|
|
33
|
+
if (c.has(n(i))) return t(r, "Duplicate historical field identity");
|
|
34
|
+
c.add(n(i)), l.push(Object.freeze(i));
|
|
35
|
+
}
|
|
36
|
+
l.sort((e, t) => e.scope < t.scope ? -1 : e.scope > t.scope ? 1 : e.id - t.id), s[r] = Object.freeze({
|
|
37
|
+
schemaHash: o.schemaHash,
|
|
38
|
+
revision: o.revision,
|
|
39
|
+
fields: Object.freeze(l)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return Object.freeze({
|
|
43
|
+
version: 1,
|
|
44
|
+
rooms: Object.freeze(s)
|
|
45
|
+
});
|
|
46
|
+
}, i = (e, i, a, o, s = {}) => {
|
|
47
|
+
let c = {
|
|
48
|
+
maxRooms: 256,
|
|
49
|
+
maxHistoricalFields: 16384,
|
|
50
|
+
...s
|
|
51
|
+
};
|
|
52
|
+
(!i.trim() || !Number.isSafeInteger(a) || a < 0 || a > 4294967295) && t(i, "Invalid room schema identity");
|
|
53
|
+
for (let e of Object.values(c)) (!Number.isSafeInteger(e) || e < 1) && t(i, "Schema history budgets must be positive safe integers");
|
|
54
|
+
let l = r(e ?? {
|
|
55
|
+
version: 1,
|
|
56
|
+
rooms: {}
|
|
57
|
+
}, c), u = Object.keys(l.rooms);
|
|
58
|
+
!Object.hasOwn(l.rooms, i) && u.length >= c.maxRooms && t(i, "Room schema history exceeds its room budget");
|
|
59
|
+
let d = Object.hasOwn(l.rooms, i) ? l.rooms[i] : void 0, f = new Map((d?.fields ?? []).map((e) => [n(e), e])), p = (e) => {
|
|
60
|
+
(!e || typeof e.scope != "string" || !e.scope.startsWith("root") || typeof e.name != "string" || !e.name || !Number.isSafeInteger(e.id) || e.id < 1) && t(i, "Malformed historical field identity");
|
|
61
|
+
};
|
|
62
|
+
o.length > c.maxHistoricalFields && t(i, "Field manifest exceeds its history budget");
|
|
63
|
+
let m = /* @__PURE__ */ new Map();
|
|
64
|
+
for (let e of o) {
|
|
65
|
+
p(e);
|
|
66
|
+
let r = n(e), a = f.get(r);
|
|
67
|
+
m.has(r) && t(i, "Duplicate current field identity"), a && (!a.active || a.name !== e.name) && t(i, `Field id ${e.id} in ${e.scope} cannot be reused`), m.set(r, Object.freeze({
|
|
68
|
+
scope: e.scope,
|
|
69
|
+
name: e.name,
|
|
70
|
+
id: e.id,
|
|
71
|
+
active: !0
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
let h = [...f].map(([e, t]) => m.get(e) ?? Object.freeze({
|
|
75
|
+
scope: t.scope,
|
|
76
|
+
name: t.name,
|
|
77
|
+
id: t.id,
|
|
78
|
+
active: !1
|
|
79
|
+
}));
|
|
80
|
+
for (let [e, t] of m) f.has(e) || h.push(t);
|
|
81
|
+
h.length > c.maxHistoricalFields && t(i, "Historical field identities exceed their budget");
|
|
82
|
+
let g = d ? d.revision + (d.schemaHash === a ? 0 : 1) : 1;
|
|
83
|
+
Number.isSafeInteger(g) || t(i, "Schema history revision is exhausted"), h.sort((e, t) => e.scope < t.scope ? -1 : e.scope > t.scope ? 1 : e.id - t.id);
|
|
84
|
+
let _ = Object.freeze({
|
|
85
|
+
schemaHash: a,
|
|
86
|
+
revision: g,
|
|
87
|
+
fields: Object.freeze(h)
|
|
88
|
+
});
|
|
89
|
+
return Object.freeze({
|
|
90
|
+
version: 1,
|
|
91
|
+
rooms: Object.freeze({
|
|
92
|
+
...l.rooms,
|
|
93
|
+
[i]: _
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { i as advanceRoomSchemaHistory, r as validateRoomSchemaHistory };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { ProtocolError as e, SeatExpired as t } from "./errors.js";
|
|
2
|
+
import { ROOM_SEATS_TABLE as n } from "./identities.js";
|
|
3
|
+
import { assertRoomSubjectAdmission as r } from "./subjectAdmission.js";
|
|
4
|
+
import { worldTargetSeatBindingFromReceipt as i } from "./worldSeatBinding.js";
|
|
5
|
+
import { captureRoomSeatInputReceipt as a } from "./inputReceipts.js";
|
|
6
|
+
import { WorldSourceSeatPending as o } from "./worldSourceSeatPending.js";
|
|
7
|
+
import { and as s, eq as c, gt as l } from "@voltro/database";
|
|
8
|
+
import { Effect as u } from "effect";
|
|
9
|
+
//#region src/seatStore.ts
|
|
10
|
+
var d = (e) => s(c("roomId", e.roomId), c("sessionId", e.sessionId), c("tenantId", e.tenantId), c("subjectId", e.subjectId), c("epoch", e.epoch), c("nonce", e.nonce), c("role", e.role)), f = (t) => u.tryPromise({
|
|
11
|
+
try: t,
|
|
12
|
+
catch: (t) => t instanceof o ? t : new e({ detail: "Durable Rooms seat operation failed" })
|
|
13
|
+
}), p = (t) => {
|
|
14
|
+
if (!/^[a-f0-9]{64}$/.test(t)) throw new e({ detail: "Seat credential digest is invalid" });
|
|
15
|
+
return t;
|
|
16
|
+
}, m = async (u, f, m, h) => {
|
|
17
|
+
await r(u, f);
|
|
18
|
+
let g = s(d(f), c("token", p(m)), c("state", "reserved"), c("expiresAt", new Date(f.expiresAt)), l("expiresAt", h)), _ = (await u.query({
|
|
19
|
+
table: n,
|
|
20
|
+
predicate: g,
|
|
21
|
+
order: [],
|
|
22
|
+
take: 1,
|
|
23
|
+
skip: void 0,
|
|
24
|
+
projection: [
|
|
25
|
+
"id",
|
|
26
|
+
"inputReceipt",
|
|
27
|
+
"reservationBatchReceipt",
|
|
28
|
+
"worldSourceTransitionId"
|
|
29
|
+
],
|
|
30
|
+
lock: "update"
|
|
31
|
+
}))[0];
|
|
32
|
+
if (!_) throw new t({ sessionId: f.sessionId });
|
|
33
|
+
if (_.worldSourceTransitionId != null) throw new o();
|
|
34
|
+
let v = a(_.inputReceipt), y = i(_.reservationBatchReceipt);
|
|
35
|
+
if (v?.discardedThrough !== void 0 && !y) throw new e({ detail: "Discarded input cursor requires its durable World Seat binding" });
|
|
36
|
+
if (v && v.checkpointEpoch > f.epoch) throw new e({ detail: "Seat input receipt belongs to a newer ownership epoch" });
|
|
37
|
+
if (await u.updateMany("_voltro_room_seats", {
|
|
38
|
+
state: "connected",
|
|
39
|
+
updatedAt: h
|
|
40
|
+
}, { where: s(g, c("id", _.id)) }) !== 1) throw new t({ sessionId: f.sessionId });
|
|
41
|
+
return Object.freeze({
|
|
42
|
+
lastAppliedSeq: v?.lastAppliedSeq ?? -1,
|
|
43
|
+
...v?.discardedThrough === void 0 ? {} : { discardedThrough: v.discardedThrough },
|
|
44
|
+
...y ? { worldTarget: y } : {}
|
|
45
|
+
});
|
|
46
|
+
}, h = async (t, i, a) => {
|
|
47
|
+
await r(t, i);
|
|
48
|
+
let l = await t.query({
|
|
49
|
+
table: n,
|
|
50
|
+
predicate: s(d(i), c("token", p(a)), c("state", "connected")),
|
|
51
|
+
order: [],
|
|
52
|
+
take: 2,
|
|
53
|
+
skip: void 0,
|
|
54
|
+
projection: ["id", "worldSourceTransitionId"],
|
|
55
|
+
lock: "update"
|
|
56
|
+
});
|
|
57
|
+
if (l.length !== 1) throw new e({ detail: "Room Seat lost its connected admission" });
|
|
58
|
+
if (l[0].worldSourceTransitionId != null) throw new o();
|
|
59
|
+
}, g = (i, a, o) => {
|
|
60
|
+
if (!Number.isFinite(o) || o <= 0) throw new e({ detail: "Room seat grace must be a positive duration" });
|
|
61
|
+
let l = () => {
|
|
62
|
+
let t = a();
|
|
63
|
+
if (!Number.isFinite(t) || t < 0) throw new e({ detail: "Room seat wall clock is invalid" });
|
|
64
|
+
return new Date(t);
|
|
65
|
+
};
|
|
66
|
+
return Object.freeze({
|
|
67
|
+
reserve: (e, a, o) => {
|
|
68
|
+
let s = Object.freeze({ ...a });
|
|
69
|
+
return f(async () => {
|
|
70
|
+
let a = l();
|
|
71
|
+
if (s.expiresAt <= a.getTime()) throw new t({ sessionId: s.sessionId });
|
|
72
|
+
await r(i, s);
|
|
73
|
+
let { subjectType: c, subjectKind: u, attributes: d, ...f } = s;
|
|
74
|
+
await i.insert(n, {
|
|
75
|
+
id: e,
|
|
76
|
+
...f,
|
|
77
|
+
attributes: d ?? null,
|
|
78
|
+
token: p(o),
|
|
79
|
+
state: "reserved",
|
|
80
|
+
expiresAt: new Date(s.expiresAt),
|
|
81
|
+
graceUntil: null,
|
|
82
|
+
inputReceipt: null,
|
|
83
|
+
reservationBatchKey: null,
|
|
84
|
+
reservationBatchReceipt: null,
|
|
85
|
+
reservationBatchReissueReceipt: null,
|
|
86
|
+
worldSourceTransitionId: null,
|
|
87
|
+
createdAt: a,
|
|
88
|
+
updatedAt: a
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
revalidate: (e, t) => f(() => i.transactional((n) => h(n, e, t))),
|
|
93
|
+
consume: (n, r) => {
|
|
94
|
+
let a = Object.freeze({ ...n });
|
|
95
|
+
return u.uninterruptible(u.tryPromise({
|
|
96
|
+
try: () => i.transactional((e) => m(e, a, r, l())),
|
|
97
|
+
catch: (n) => n instanceof t || n instanceof e ? n : new e({ detail: "Durable Rooms seat admission failed" })
|
|
98
|
+
}));
|
|
99
|
+
},
|
|
100
|
+
disconnect: (e, t, r) => f(async () => {
|
|
101
|
+
let a = l(), u = t === "reconnecting";
|
|
102
|
+
await i.updateMany(n, {
|
|
103
|
+
state: u ? "grace" : "released",
|
|
104
|
+
graceUntil: u ? new Date(a.getTime() + o) : null,
|
|
105
|
+
updatedAt: a
|
|
106
|
+
}, { where: s(d(e), c("token", p(r)), c("state", "connected")) });
|
|
107
|
+
}),
|
|
108
|
+
exportSubject: (e, t) => f(async () => {
|
|
109
|
+
let r = await i.query({
|
|
110
|
+
table: n,
|
|
111
|
+
predicate: s(c("tenantId", e), c("subjectId", t)),
|
|
112
|
+
order: [],
|
|
113
|
+
take: void 0,
|
|
114
|
+
skip: void 0,
|
|
115
|
+
projection: [
|
|
116
|
+
"id",
|
|
117
|
+
"roomId",
|
|
118
|
+
"sessionId",
|
|
119
|
+
"subjectId",
|
|
120
|
+
"tenantId",
|
|
121
|
+
"epoch",
|
|
122
|
+
"role",
|
|
123
|
+
"state",
|
|
124
|
+
"inputReceipt",
|
|
125
|
+
"expiresAt",
|
|
126
|
+
"graceUntil",
|
|
127
|
+
"createdAt",
|
|
128
|
+
"updatedAt"
|
|
129
|
+
]
|
|
130
|
+
}), a = [
|
|
131
|
+
"id",
|
|
132
|
+
"roomId",
|
|
133
|
+
"sessionId",
|
|
134
|
+
"subjectId",
|
|
135
|
+
"tenantId",
|
|
136
|
+
"epoch",
|
|
137
|
+
"role",
|
|
138
|
+
"state",
|
|
139
|
+
"inputReceipt",
|
|
140
|
+
"expiresAt",
|
|
141
|
+
"graceUntil",
|
|
142
|
+
"createdAt",
|
|
143
|
+
"updatedAt"
|
|
144
|
+
];
|
|
145
|
+
return r.map((e) => Object.fromEntries(a.filter((t) => Object.hasOwn(e, t)).map((t) => [t, e[t]])));
|
|
146
|
+
}),
|
|
147
|
+
eraseSubject: (e, t) => f(() => i.deleteMany(n, { where: s(c("tenantId", e), c("subjectId", t)) }))
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
//#endregion
|
|
151
|
+
export { m as consumeRoomSeatInTransaction, g as dataStoreRoomSeats, h as revalidateRoomSeatInTransaction };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { resolveRoomSeatTokenStrategies as t, signRoomSeat as n, signRoomSeatWithStrategies as r, verifiedRoomSeatClaims as i } from "./seats.js";
|
|
3
|
+
import { Effect as a } from "effect";
|
|
4
|
+
import { randomBytes as o } from "node:crypto";
|
|
5
|
+
//#region src/seatStrategyFixtures.ts
|
|
6
|
+
var s = () => ({
|
|
7
|
+
roomId: "room",
|
|
8
|
+
sessionId: "seat",
|
|
9
|
+
tenantId: "tenant",
|
|
10
|
+
subjectId: "player",
|
|
11
|
+
epoch: 1,
|
|
12
|
+
role: "player",
|
|
13
|
+
nonce: "fixture-generation",
|
|
14
|
+
expiresAt: 2e4
|
|
15
|
+
}), c = () => ({ current: {
|
|
16
|
+
kid: "fixture-seat",
|
|
17
|
+
secret: o(32).toString("base64url")
|
|
18
|
+
} }), l = {
|
|
19
|
+
sign: (e, t, r) => new Uint8Array([254, ...n(e, t, r)]),
|
|
20
|
+
verify: (t, n, r) => {
|
|
21
|
+
if (t[0] !== 254) throw new e({ detail: "Fixture seat framing is absent" });
|
|
22
|
+
return i(t.subarray(1), n, r);
|
|
23
|
+
}
|
|
24
|
+
}, u = (n) => a.sync(() => {
|
|
25
|
+
let i = s(), a = c(), o = t(n ? l : {}), u = r(i, a, 1e3, o), d = o.verify(u, a, 1e3);
|
|
26
|
+
if (Object.keys(i).some((e) => d[e] !== i[e])) throw new e({ detail: "Fixture seat strategy changed authority" });
|
|
27
|
+
return u[0] === 254 ? "framed" : "session";
|
|
28
|
+
}), d = {
|
|
29
|
+
kind: "slot",
|
|
30
|
+
defaultImplementation: n,
|
|
31
|
+
defaultProbe: {
|
|
32
|
+
run: () => u(!1),
|
|
33
|
+
expected: "session"
|
|
34
|
+
},
|
|
35
|
+
overrideProbe: {
|
|
36
|
+
run: () => u(!0),
|
|
37
|
+
expected: "framed"
|
|
38
|
+
}
|
|
39
|
+
}, f = {
|
|
40
|
+
kind: "slot",
|
|
41
|
+
defaultImplementation: i,
|
|
42
|
+
defaultProbe: {
|
|
43
|
+
run: () => u(!1),
|
|
44
|
+
expected: "session"
|
|
45
|
+
},
|
|
46
|
+
overrideProbe: {
|
|
47
|
+
run: () => u(!0),
|
|
48
|
+
expected: "framed"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { d as roomSeatSignSlotFixture, f as roomSeatVerifySlotFixture };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ProtocolError as e, RoomForbidden as t } from "./errors.js";
|
|
2
|
+
import { resolveIdentityAuthority as n } from "@voltro/protocol";
|
|
3
|
+
import { Effect as r } from "effect";
|
|
4
|
+
//#region src/seatSubject.ts
|
|
5
|
+
var i = (e) => {
|
|
6
|
+
if (e.subjectId === null) return {
|
|
7
|
+
type: "anonymous",
|
|
8
|
+
id: null,
|
|
9
|
+
tenantId: e.tenantId
|
|
10
|
+
};
|
|
11
|
+
let t = e.subjectType ?? "user";
|
|
12
|
+
return t === "user" ? {
|
|
13
|
+
type: t,
|
|
14
|
+
id: e.subjectId,
|
|
15
|
+
tenantId: e.tenantId,
|
|
16
|
+
...e.subjectKind === "guest" ? { kind: "guest" } : {}
|
|
17
|
+
} : {
|
|
18
|
+
type: t,
|
|
19
|
+
id: e.subjectId,
|
|
20
|
+
tenantId: e.tenantId
|
|
21
|
+
};
|
|
22
|
+
}, a = (i, a, o) => r.flatMap(r.tryPromise({
|
|
23
|
+
try: () => n(i, {
|
|
24
|
+
origin: "room",
|
|
25
|
+
headers: {},
|
|
26
|
+
clientId: void 0,
|
|
27
|
+
store: o.getStore?.()
|
|
28
|
+
}, o.authority),
|
|
29
|
+
catch: () => new e({ detail: "Room seat authority resolution failed" })
|
|
30
|
+
}), (n) => n.kind === "resolved" ? r.succeed(n.subject) : n.kind === "vetoed" ? r.fail(new t({ roomId: a })) : r.fail(new e({ detail: "Room seat authority is unavailable" }))), o = (e = {}) => (t) => a(i(t), t.roomId, e), s = (e = {}) => (t) => a(t, "", e);
|
|
31
|
+
//#endregion
|
|
32
|
+
export { s as roomControlSubjectResolver, i as roomSeatSubjectIdentity, o as roomSeatSubjectResolver };
|
package/dist/seats.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ProtocolError as e, RoomForbidden as t, SeatExpired as n } from "./errors.js";
|
|
2
|
+
import { captureRoomSeatAttributes as r } from "./room.js";
|
|
3
|
+
import { Result as i, Schema as a } from "effect";
|
|
4
|
+
import { createHash as o } from "node:crypto";
|
|
5
|
+
import { MIN_SESSION_SECRET_LENGTH as s, signSession as c, verifySessionKeyed as l } from "@voltro/protocol/session";
|
|
6
|
+
//#region src/seats.ts
|
|
7
|
+
var u = a.Struct({
|
|
8
|
+
purpose: a.Literal("voltro.rooms.seat.v1"),
|
|
9
|
+
roomId: a.NonEmptyString,
|
|
10
|
+
sessionId: a.NonEmptyString,
|
|
11
|
+
subjectId: a.NullOr(a.NonEmptyString),
|
|
12
|
+
subjectType: a.optionalKey(a.Literals([
|
|
13
|
+
"user",
|
|
14
|
+
"apiKey",
|
|
15
|
+
"serviceAccount"
|
|
16
|
+
])),
|
|
17
|
+
subjectKind: a.optionalKey(a.Literal("guest")),
|
|
18
|
+
tenantId: a.NonEmptyString,
|
|
19
|
+
epoch: a.Int.pipe(a.check(a.isGreaterThanOrEqualTo(0))),
|
|
20
|
+
nonce: a.NonEmptyString,
|
|
21
|
+
expiresAt: a.Number.pipe(a.check(a.isFinite()), a.check(a.isGreaterThan(0))),
|
|
22
|
+
role: a.Literals(["player", "spectator"]),
|
|
23
|
+
attributes: a.optionalKey(a.Record(a.String, a.Union([
|
|
24
|
+
a.String,
|
|
25
|
+
a.Number,
|
|
26
|
+
a.Boolean,
|
|
27
|
+
a.Null
|
|
28
|
+
])))
|
|
29
|
+
}), d = {
|
|
30
|
+
roomId: !0,
|
|
31
|
+
sessionId: !0,
|
|
32
|
+
subjectId: !0,
|
|
33
|
+
subjectType: !0,
|
|
34
|
+
subjectKind: !0,
|
|
35
|
+
tenantId: !0,
|
|
36
|
+
epoch: !0,
|
|
37
|
+
nonce: !0,
|
|
38
|
+
expiresAt: !0,
|
|
39
|
+
role: !0,
|
|
40
|
+
attributes: !0
|
|
41
|
+
}, f = (e, t, n) => e === "attributes" ? t.attributes === void 0 == (n.attributes === void 0) && (t.attributes === void 0 || JSON.stringify(r(t.roomId, t.attributes)) === JSON.stringify(r(n.roomId, n.attributes))) : t[e] === n[e], p = (t) => {
|
|
42
|
+
if (t.attributes === void 0) return t;
|
|
43
|
+
try {
|
|
44
|
+
return {
|
|
45
|
+
...t,
|
|
46
|
+
attributes: r(t.roomId, t.attributes)
|
|
47
|
+
};
|
|
48
|
+
} catch {
|
|
49
|
+
throw new e({ detail: "Invalid Room seat attributes" });
|
|
50
|
+
}
|
|
51
|
+
}, m = (t) => {
|
|
52
|
+
for (let n of [t.current, ...t.previous ? [t.previous] : []]) if (!n || typeof n.kid != "string" || !n.kid.trim() || typeof n.secret != "string" || n.secret.length < s) throw new e({ detail: "Project-owned Rooms signing keys are required; there is no fallback" });
|
|
53
|
+
if (t.previous?.kid === t.current.kid) throw new e({ detail: "Rooms rotation keys require distinct identities" });
|
|
54
|
+
}, h = (e) => o("sha256").update(e).digest("hex"), g = (t, r, i) => {
|
|
55
|
+
m(r);
|
|
56
|
+
let o = p(a.decodeUnknownSync(u)({
|
|
57
|
+
...t,
|
|
58
|
+
purpose: "voltro.rooms.seat.v1"
|
|
59
|
+
}));
|
|
60
|
+
if (!Number.isFinite(i) || i < 0 || o.expiresAt <= i) throw new n({ sessionId: o.sessionId });
|
|
61
|
+
if (!r.current.secret || !r.current.kid) throw new e({ detail: "Rooms signing key is required" });
|
|
62
|
+
return new TextEncoder().encode(c({
|
|
63
|
+
type: "serviceAccount",
|
|
64
|
+
id: o.sessionId,
|
|
65
|
+
tenantId: o.tenantId,
|
|
66
|
+
auditActorId: null,
|
|
67
|
+
metadata: o
|
|
68
|
+
}, r.current, {
|
|
69
|
+
now: () => i,
|
|
70
|
+
ttlSeconds: Math.ceil((o.expiresAt - Math.floor(i / 1e3) * 1e3) / 1e3)
|
|
71
|
+
}));
|
|
72
|
+
}, _ = (t, r, o) => {
|
|
73
|
+
if (m(r), !Number.isFinite(o) || o < 0 || t.byteLength < 1 || t.byteLength > 8192) throw new e({ detail: "Invalid seat token or clock" });
|
|
74
|
+
let s;
|
|
75
|
+
try {
|
|
76
|
+
s = new TextDecoder("utf-8", { fatal: !0 }).decode(t);
|
|
77
|
+
} catch {
|
|
78
|
+
throw new e({ detail: "Invalid seat token encoding" });
|
|
79
|
+
}
|
|
80
|
+
let c = l(s, r, { now: () => o });
|
|
81
|
+
if (!c || c.subject.type !== "serviceAccount") throw new n({ sessionId: "" });
|
|
82
|
+
let d = a.decodeUnknownResult(u)(c.subject.metadata);
|
|
83
|
+
if (i.isFailure(d)) throw new e({ detail: "Token is not a Rooms seat credential" });
|
|
84
|
+
let f = p(d.success);
|
|
85
|
+
if (c.subject.id !== f.sessionId || c.subject.tenantId !== f.tenantId) throw new e({ detail: "Seat identity does not match its signed carrier" });
|
|
86
|
+
if (f.expiresAt <= o) throw new n({ sessionId: f.sessionId });
|
|
87
|
+
let { purpose: h, ...g } = f;
|
|
88
|
+
return Object.freeze(g);
|
|
89
|
+
}, v = (e, r, i, a, o = _) => {
|
|
90
|
+
let s = x(e, r, i, o);
|
|
91
|
+
if (s.roomId !== a.roomId || s.tenantId !== a.tenantId) throw new t({ roomId: a.roomId });
|
|
92
|
+
if (s.epoch !== a.epoch) throw new n({ sessionId: s.sessionId });
|
|
93
|
+
return s;
|
|
94
|
+
}, y = (t = {}) => {
|
|
95
|
+
if (!t || typeof t != "object" || Array.isArray(t) || Object.keys(t).some((e) => !["sign", "verify"].includes(e)) || t.sign !== void 0 && typeof t.sign != "function" || t.verify !== void 0 && typeof t.verify != "function") throw new e({ detail: "Invalid Room seat-token strategy slots" });
|
|
96
|
+
return Object.freeze({
|
|
97
|
+
sign: t.sign ?? g,
|
|
98
|
+
verify: t.verify ?? _
|
|
99
|
+
});
|
|
100
|
+
}, b = (t, r) => {
|
|
101
|
+
if (!Number.isFinite(r) || r < 0 || !t || typeof t != "object") throw new e({ detail: "Invalid Room seat strategy identity or clock" });
|
|
102
|
+
let o = a.decodeUnknownResult(u)({
|
|
103
|
+
...t,
|
|
104
|
+
purpose: "voltro.rooms.seat.v1"
|
|
105
|
+
});
|
|
106
|
+
if (i.isFailure(o)) throw new e({ detail: "Room seat strategy returned malformed identity" });
|
|
107
|
+
if (o.success.expiresAt <= r) throw new n({ sessionId: o.success.sessionId });
|
|
108
|
+
let { purpose: s, ...c } = p(o.success);
|
|
109
|
+
return Object.freeze(c);
|
|
110
|
+
}, x = (r, i, a, o = _) => {
|
|
111
|
+
if (m(i), !(r instanceof Uint8Array) || r.byteLength < 1 || r.byteLength > 8192) throw new e({ detail: "Invalid Room seat-token strategy bytes" });
|
|
112
|
+
try {
|
|
113
|
+
return b(o(Uint8Array.from(r), structuredClone(i), a), a);
|
|
114
|
+
} catch (r) {
|
|
115
|
+
throw r instanceof e || r instanceof n || r instanceof t ? r : new e({ detail: "Room seat verification strategy failed" });
|
|
116
|
+
}
|
|
117
|
+
}, S = (t, r, i, a) => {
|
|
118
|
+
m(r);
|
|
119
|
+
let o = b(t, i), s;
|
|
120
|
+
try {
|
|
121
|
+
s = a.sign(structuredClone(o), structuredClone(r), i);
|
|
122
|
+
} catch (t) {
|
|
123
|
+
throw t instanceof e || t instanceof n ? t : new e({ detail: "Room seat signing strategy failed" });
|
|
124
|
+
}
|
|
125
|
+
let c = x(s, r, i, a.verify);
|
|
126
|
+
if (Object.keys(d).some((e) => !f(e, c, o))) throw new e({ detail: "Room seat-token strategies changed the issued identity" });
|
|
127
|
+
return Uint8Array.from(s);
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
export { m as assertRoomSeatSecrets, y as resolveRoomSeatTokenStrategies, h as roomSeatTokenDigest, g as signRoomSeat, S as signRoomSeatWithStrategies, _ as verifiedRoomSeatClaims, v as verifyRoomSeat, x as verifyRoomSeatWithStrategy };
|