6.2 KiB
6.2 KiB
Changelog
All notable changes to @gamecult/cultmesh-ts are recorded here, following
Keep a Changelog.
Unreleased
Added
publishRudpDocumentOncetakeswriteReceipts: true: it sends a hello listingcultnet.write_admitted.v0andcultnet.error.v1and, against a server that lists both back, resolves only on that write'swrite_admitted, rejects withCultMeshRudpWriteRefusedError(now also carrying anerror.v1) on its refusal and with the newCultMeshRudpWriteUnconfirmedError(reason:window_elapsedafter 5000 ms,session_ended, orlocal_send_failed) when nothing settles it. Without the option, or against a server that did not advertise, there is no hello and the window is 500 ms; a put nothing settled in it is unconfirmed too, no longer "published" (behaviour change: a server that applies a put but answers nothing now yieldsCultMeshRudpWriteUnconfirmedError, as the spec requires). A legacy server's echo of the put's id is not admission: onlywrite_admittedis. The flush that sends the put is bounded by the result window, and a send not acknowledged by then islocal_send_failed.resultWindowMsoverrides either window.publishRudpDocumentAndWaitForReceiptis not changed.
Breaking
publishRudpDocumentOnceno longer treats a window with no refusal as published: a put nothing settled in its result window (500 ms, or 5000 ms against a receipt-capable server) rejectsCultMeshRudpWriteUnconfirmedError, and a legacy server's echo of the put's id is not admission. It now resolves"admitted"(only on awrite_admitted) or"sent". Migration: a caller whose server cannot answer a write yet (for example Odin, until it is receipt-capable) passessendOnly: trueper call and treats"sent"as "sent", never as admitted. Receipts stay opt-in (writeReceipts: true); neither mode is the default.- The package is renamed
cultmesh-tsto@gamecult/cultmesh-ts(the repo already scopes@gamecult/cultcache-ts), so the unscoped name cannot be claimed by someone else. Import from@gamecult/cultmesh-tsand its subpaths; the API is unchanged. Depends on@gamecult/cultnet-ts. asSchemaAliasis removed fromCultMeshDocumentHandle,CultMeshCollectionHandleand their bound forms. Read the handle by the schema you mean.CultMeshDocumentCatalog(document,tryDocument,latest,replace,submitPrediction,authoritativeWriter,predictionWriter,watch) andCultMeshCollectionCatalog(collection,tryCollection,latest,watchChanges) take<TDocument = never, TSchema>and yieldCultMeshCatalogValue<TDocument, TSchema>: an explicit type argument wins, a CultCache document definition names its own value type, and a bare schema descriptor yieldsunknown. A value type is no longer inferred from a value or an expected result. Theparseoption is removed from these calls, and a lookup by type answers with that type's handle or none, not an alias of a compatible schema.createRudpDocumentServertakeswriteAuthorityTimeoutMs(defaultCULTMESH_RUDP_DOCUMENT_SERVER_DEFAULT_DECIDE_TIMEOUT_MS, 5000; a value outside 1..2147483647 throwsRangeError): a write authority whosedecide()has not settled by then refuses the write like one that throws (write_not_authorized, andonErrorhears of it), so a hung authority no longer holds up the session's later frames.createRudpDocumentServerrefuses every peer put and delete unless it is given awriteAuthority. A refused write is answered with the typedwrite_not_authorizednaming the record key (the bytes pinned inerror-vectors.json), andonDocumentPutRawis never called; passwriteAuthority: new CultMeshGrantAllWrites()to keep the old accept-everything behaviour. The authority is asked before the put is sized or decoded and before any handler runs, with the canonical schema id and the peer's address (the schema id is resolved to its canonical form first, which is the timing residual below); one that throws, rejects or answers anything butgranted: truerefuses. A frame the server cannot read is judged as the write it looks like (a put when it does not decode at all), so an ungranted peer getswrite_not_authorizedfor it too; a granted peer getsonErrorand a typedmessage_invalidrefusal (details.fieldismessage). A put carrying a wrong-typedshardIdorshardEpochis judged with null shard fields and, once granted, refused withmessage_invalidnaming that field. A refusal's record key and reason are clipped (64 and 96 UTF-8 bytes) so the refusal is at most 309 bytes; amaxPayloadBytesbelow that cannot carry it, and the peer then hears nothing (the failure goes toonError). Residual: ungranted peers can still distinguish registered from unregistered schemas by timing. A peerdocument_deletenow reaches the newonDocumentDeleteRawonce granted (without it, a text refusal) instead of the unsupported-request error.- Adding a document or collection to a catalog under a schema id or schema name another type already holds is refused with
SchemaConflictError.
Added
createRudpDocumentServerends a session afterCULTMESH_RUDP_DOCUMENT_SERVER_MAX_CONSECUTIVE_REFUSED_FRAMES(8) consecutive undecodable frames or consecutive deletes the write authority refuses; fewer are answered and the session is kept. Any decoded frame resets the undecodable run, any decoded non-refused-delete frame resets the delete run. The same cap holds in every runtime.CultMeshCatalogValue<TDocument, TSchema>, exported.documentByIdandtryDocumentByIdonCultMeshDocumentCatalog, which address one document by its document id when a catalog holds several documents of one type.
Dependencies
- Needs the cultcache-ts release that ships with this change (its manifest range moves with that release): it imports
schemaIdentityOfandSchemaConflictError, which 0.14.x does not export.
[0.2.0]
Added
cultmesh-ts/content: an HTTPS content provider.createContentChunkHandlerserves CDN chunks from aContentChunkStore(createDirectoryChunkStorefor a directory of chunks) with bounded reads, andtoNodeListenermounts the handler on a Node HTTP server.
Changed
- Depends on
cultnet-ts^0.3.0.