@faiber/faiber-state-sdk 0.5.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/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @faiber/faiber-state-sdk
2
+
3
+ TypeScript client for Infera State worlds, rooms, authoritative state, WASM endpoints, realtime replication, and client prediction.
4
+
5
+ ```ts
6
+ const ticket = (await faiber.state.join(roomId, userId)).data.data;
7
+ const realtime = new StateRealtimeClient(ticket);
8
+ realtime.on("patch", patch => applyServerPatch(patch));
9
+ await realtime.connect();
10
+ realtime.sendInput({ move_x: 5, move_z: -1 }, "unreliable");
11
+ ```
12
+
13
+ Browsers use the reliable WebSocket channel by default. Native mobile/desktop hosts can inject a `DatagramTransport` for UDP or QUIC traffic. `PredictionBuffer` replays unacknowledged input after each authoritative patch.
14
+
15
+ All HTTP methods use the shared `FaiberClient`, so Bearer tokens and secure-cookie credentials,
16
+ Axios errors, cancellation signals, and custom request options are preserved. The realtime socket
17
+ authenticates with the short-lived ticket returned by the authorized `join` call.
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/axios/index.d.ts","../../core/dist/types.d.ts","../../core/dist/env.d.ts","../../core/dist/auth.d.ts","../../core/dist/client.d.ts","../../core/dist/resource.d.ts","../../core/dist/openapi.d.ts","../../core/dist/index.d.ts","../src/types.ts","../src/api.ts","../src/prediction.ts","../src/realtime.ts","../src/index.ts"],"fileIdsList":[[61],[60,61],[60,61,62,63,64,65,66],[60,61,64],[60],[67,68],[68,69,70,71],[68],[67]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"2343ec253c90c370449755739733f5f429f58cffdb51a50977bb4a042012fa8f","impliedFormat":99},{"version":"82eefab40d1de575b71604dce5f5d408e023c6b241977b4840bff5ca5d330477","impliedFormat":99},{"version":"82065c5512d8d6f81b26cf13ea9ecd3e558be9560f7b5c62260858219ecd87f7","impliedFormat":99},{"version":"ed17ed1b2bcf384c88bc6cec6b427989b98db99fc7ad35a50605501a463bbc53","impliedFormat":99},{"version":"82bf4efcca8ab8764a91ac126c0af605ab6717ee94b2316461b5fa388b27e165","impliedFormat":99},{"version":"82ffc9a1d95766c8f6f6bb4316b1d83e9d6a1d4ec41057d1a897cca70176bfc1","impliedFormat":99},{"version":"3f5eeb0a84713ccf640b9a6af4629e006f59d7629abc3fc95af2efb062fd0b83","impliedFormat":99},{"version":"66a0cb4d019dd780c2fb5c2942778929ec55715bb5a0f3b80aac4c0b92e35d16","impliedFormat":99},{"version":"cc4b4b72168360226a319dd38cc098589644a025d25c4434569769f80ce7e381","signature":"b107ce9c9d9e532f04a994de49b3988ece2beecb270ee1e77d5c8fb1e0e81235","impliedFormat":99},{"version":"de9a4e71678669aa12436b38cb1e58982fa7da1974eb8850f6a730f3cbb3b55f","signature":"b2e8c703155f9dca0f9743408f2c3b90d7120297f8016e9171311b057c6c8f6f","impliedFormat":99},{"version":"408a1f9df47e527c6dcff25d2c2cbef9d04186ea643d055704ccc54016bc0732","signature":"9960b39e2a2cf4d4b3b843ce69c83ed77a89cab83ade288d57c1677baf18fbab","impliedFormat":99},{"version":"932fe992ca283174320af6d550cceb10d86cf1309130f20099f695dd062b0f16","signature":"6d4dea0a46463c93a6a7b918af4e93b6374e3aa8f948e26a16efc744335a355c","impliedFormat":99},{"version":"5762fc28bc25857ea9b54907f1cd6c38cb48fed4c0dd5efc4d8edaaefec55d0a","impliedFormat":99}],"root":[[68,72]],"options":{"composite":true,"declaration":true,"declarationMap":true,"exactOptionalPropertyTypes":true,"module":199,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"tsBuildInfoFile":"./.tsbuildinfo","verbatimModuleSyntax":true},"referencedMap":[[63,1],[64,2],[62,1],[67,3],[66,4],[65,4],[61,5],[69,6],[72,7],[70,8],[71,8],[68,9]],"latestChangedDtsFile":"./api.d.ts","version":"5.9.3"}
package/dist/api.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ import { ServiceApi, type RequestOptions } from "@faiber/sdk-core";
2
+ import type * as T from "./types.js";
3
+ export declare class StateApi extends ServiceApi {
4
+ /** Lists worlds visible to the IDP-authorized organization. */
5
+ worlds(options?: RequestOptions): Promise<import("axios").AxiosResponse<T.WorldListResponse, any, {}>>;
6
+ /** Gets one world by UUID. */
7
+ world(id: string, options?: RequestOptions): Promise<import("axios").AxiosResponse<T.WorldResponse, any, {}>>;
8
+ /** Creates a world; omitted configuration uses server defaults. */
9
+ createWorld(data: T.CreateWorldInput, options?: RequestOptions<T.CreateWorldInput>): Promise<import("axios").AxiosResponse<T.WorldResponse, T.CreateWorldInput, {}>>;
10
+ /** Updates mutable world configuration using the backend's PUT contract. */
11
+ updateWorld(id: string, data: T.UpdateWorldInput, options?: RequestOptions<T.UpdateWorldInput>): Promise<import("axios").AxiosResponse<T.WorldResponse, T.UpdateWorldInput, {}>>;
12
+ /** Lists rooms belonging to a world. */
13
+ rooms(worldId: string, options?: RequestOptions): Promise<import("axios").AxiosResponse<T.RoomListResponse, any, {}>>;
14
+ /** Gets one authoritative room snapshot. */
15
+ room(id: string, options?: RequestOptions): Promise<import("axios").AxiosResponse<T.RoomResponse, any, {}>>;
16
+ /** Creates a room using the server's default capacity when omitted. */
17
+ createRoom(worldId: string, data: T.CreateRoomInput, options?: RequestOptions<T.CreateRoomInput>): Promise<import("axios").AxiosResponse<T.RoomResponse, T.CreateRoomInput, {}>>;
18
+ /** Joins a room and returns a short-lived realtime ticket. */
19
+ join(roomId: string, userId: string, options?: RequestOptions<{
20
+ user_id: string;
21
+ }>): Promise<import("axios").AxiosResponse<T.JoinResponse, {
22
+ user_id: string;
23
+ }, {}>>;
24
+ /** Lists uploaded WASM modules for a world. */
25
+ wasmModules(worldId: string, options?: RequestOptions): Promise<import("axios").AxiosResponse<{
26
+ data: T.WasmModuleInfo[];
27
+ }, any, {}>>;
28
+ /** Uploads a base64-encoded WASM module and its exported functions. */
29
+ uploadWasm(worldId: string, data: T.UploadWasmInput, options?: RequestOptions<T.UploadWasmInput>): Promise<import("axios").AxiosResponse<{
30
+ data: T.WasmModuleInfo;
31
+ }, T.UploadWasmInput, {}>>;
32
+ /** Lists callable WASM endpoints registered for a world. */
33
+ endpoints(worldId: string, options?: RequestOptions): Promise<import("axios").AxiosResponse<{
34
+ data: T.WasmEndpoint[];
35
+ }, any, {}>>;
36
+ /** Registers a callable WASM export for a world. */
37
+ createEndpoint(worldId: string, data: T.CreateWasmEndpointInput, options?: RequestOptions<T.CreateWasmEndpointInput>): Promise<import("axios").AxiosResponse<{
38
+ data: T.WasmEndpoint;
39
+ }, T.CreateWasmEndpointInput, {}>>;
40
+ /** Invokes a registered WASM endpoint and returns the authoritative state patch. */
41
+ invoke(roomId: string, slug: string, data: T.InvokeWasmInput, options?: RequestOptions<T.InvokeWasmInput>): Promise<import("axios").AxiosResponse<T.StatePatchResponse, T.InvokeWasmInput, {}>>;
42
+ }
43
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,KAAK,CAAC,MAAM,YAAY,CAAC;AACrC,qBAAa,QAAS,SAAQ,UAAU;IACtC,+DAA+D;IAC/D,MAAM,CAAC,OAAO,CAAC,EAAC,cAAc;IAC9B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,EAAC,MAAM,EAAC,OAAO,CAAC,EAAC,cAAc;IACvC,mEAAmE;IACnE,WAAW,CAAC,IAAI,EAAC,CAAC,CAAC,gBAAgB,EAAC,OAAO,CAAC,EAAC,cAAc,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAC/E,4EAA4E;IAC5E,WAAW,CAAC,EAAE,EAAC,MAAM,EAAC,IAAI,EAAC,CAAC,CAAC,gBAAgB,EAAC,OAAO,CAAC,EAAC,cAAc,CAAC,CAAC,CAAC,gBAAgB,CAAC;IACzF,wCAAwC;IACxC,KAAK,CAAC,OAAO,EAAC,MAAM,EAAC,OAAO,CAAC,EAAC,cAAc;IAC5C,4CAA4C;IAC5C,IAAI,CAAC,EAAE,EAAC,MAAM,EAAC,OAAO,CAAC,EAAC,cAAc;IACtC,uEAAuE;IACvE,UAAU,CAAC,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,CAAC,CAAC,eAAe,EAAC,OAAO,CAAC,EAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC;IAC3F,8DAA8D;IAC9D,IAAI,CAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,CAAC,EAAC,cAAc,CAAC;QAAC,OAAO,EAAC,MAAM,CAAA;KAAC,CAAC;iBAAkD,MAAM;;IAClI,+CAA+C;IAC/C,WAAW,CAAC,OAAO,EAAC,MAAM,EAAC,OAAO,CAAC,EAAC,cAAc;cAA+B,CAAC,CAAC,cAAc,EAAE;;IACnG,uEAAuE;IACvE,UAAU,CAAC,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,CAAC,CAAC,eAAe,EAAC,OAAO,CAAC,EAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC;cAAgC,CAAC,CAAC,cAAc;;IAC3I,4DAA4D;IAC5D,SAAS,CAAC,OAAO,EAAC,MAAM,EAAC,OAAO,CAAC,EAAC,cAAc;cAA+B,CAAC,CAAC,YAAY,EAAE;;IAC/F,oDAAoD;IACpD,cAAc,CAAC,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,CAAC,CAAC,uBAAuB,EAAC,OAAO,CAAC,EAAC,cAAc,CAAC,CAAC,CAAC,uBAAuB,CAAC;cAAgC,CAAC,CAAC,YAAY;;IAC7J,oFAAoF;IACpF,MAAM,CAAC,MAAM,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,CAAC,CAAC,eAAe,EAAC,OAAO,CAAC,EAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC;CACnG"}
package/dist/api.js ADDED
@@ -0,0 +1,30 @@
1
+ import { ServiceApi } from "@faiber/sdk-core";
2
+ export class StateApi extends ServiceApi {
3
+ /** Lists worlds visible to the IDP-authorized organization. */
4
+ worlds(options) { return this.client.get("/api/v1/worlds", undefined, options); }
5
+ /** Gets one world by UUID. */
6
+ world(id, options) { return this.client.get(`/api/v1/worlds/${encodeURIComponent(id)}`, undefined, options); }
7
+ /** Creates a world; omitted configuration uses server defaults. */
8
+ createWorld(data, options) { return this.client.post("/api/v1/worlds", data, options); }
9
+ /** Updates mutable world configuration using the backend's PUT contract. */
10
+ updateWorld(id, data, options) { return this.client.put(`/api/v1/worlds/${encodeURIComponent(id)}`, data, options); }
11
+ /** Lists rooms belonging to a world. */
12
+ rooms(worldId, options) { return this.client.get(`/api/v1/worlds/${encodeURIComponent(worldId)}/rooms`, undefined, options); }
13
+ /** Gets one authoritative room snapshot. */
14
+ room(id, options) { return this.client.get(`/api/v1/rooms/${encodeURIComponent(id)}`, undefined, options); }
15
+ /** Creates a room using the server's default capacity when omitted. */
16
+ createRoom(worldId, data, options) { return this.client.post(`/api/v1/worlds/${encodeURIComponent(worldId)}/rooms`, data, options); }
17
+ /** Joins a room and returns a short-lived realtime ticket. */
18
+ join(roomId, userId, options) { return this.client.post(`/api/v1/rooms/${encodeURIComponent(roomId)}/join`, { user_id: userId }, options); }
19
+ /** Lists uploaded WASM modules for a world. */
20
+ wasmModules(worldId, options) { return this.client.get(`/api/v1/worlds/${encodeURIComponent(worldId)}/wasm`, undefined, options); }
21
+ /** Uploads a base64-encoded WASM module and its exported functions. */
22
+ uploadWasm(worldId, data, options) { return this.client.post(`/api/v1/worlds/${encodeURIComponent(worldId)}/wasm`, data, options); }
23
+ /** Lists callable WASM endpoints registered for a world. */
24
+ endpoints(worldId, options) { return this.client.get(`/api/v1/worlds/${encodeURIComponent(worldId)}/endpoints`, undefined, options); }
25
+ /** Registers a callable WASM export for a world. */
26
+ createEndpoint(worldId, data, options) { return this.client.post(`/api/v1/worlds/${encodeURIComponent(worldId)}/endpoints`, data, options); }
27
+ /** Invokes a registered WASM endpoint and returns the authoritative state patch. */
28
+ invoke(roomId, slug, data, options) { return this.client.post(`/api/v1/rooms/${encodeURIComponent(roomId)}/endpoints/${encodeURIComponent(slug)}`, data, options); }
29
+ }
30
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,kBAAkB,CAAC;AAEnE,MAAM,OAAO,QAAS,SAAQ,UAAU;IACtC,+DAA+D;IAC/D,MAAM,CAAC,OAAuB,IAA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EAAE,EAAC,IAAI,EAAC,OAAO,CAAC,CAAA,CAAA,CAAC;CACvQ"}
@@ -0,0 +1,5 @@
1
+ export * from "./types.js";
2
+ export * from "./api.js";
3
+ export * from "./prediction.js";
4
+ export * from "./realtime.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./types.js";
2
+ export * from "./api.js";
3
+ export * from "./prediction.js";
4
+ export * from "./realtime.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { Entity, InputFrame, StatePatch } from "./types.js";
2
+ export interface PredictionAdapter<TState, TInput> {
3
+ clone(state: TState): TState;
4
+ apply(state: TState, input: TInput, deltaSeconds: number): TState;
5
+ reconcile(predicted: TState, authoritative: TState): TState;
6
+ }
7
+ export interface PredictionFrame<TState, TInput> {
8
+ sequence: number;
9
+ input: TInput;
10
+ state: TState;
11
+ deltaSeconds: number;
12
+ }
13
+ export declare class PredictionBuffer<TState, TInput> {
14
+ private readonly adapter;
15
+ private readonly limit;
16
+ private frames;
17
+ constructor(adapter: PredictionAdapter<TState, TInput>, limit?: number);
18
+ predict(sequence: number, state: TState, input: TInput, deltaSeconds: number): TState;
19
+ acknowledge(sequence: number, authoritative: TState): TState;
20
+ clear(): void;
21
+ }
22
+ export interface TransformState {
23
+ x: number;
24
+ y: number;
25
+ z: number;
26
+ }
27
+ export declare const transformPrediction: PredictionAdapter<TransformState, Record<string, number>>;
28
+ export type PredictionMessage = InputFrame | StatePatch | Entity;
29
+ //# sourceMappingURL=prediction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prediction.d.ts","sourceRoot":"","sources":["../src/prediction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjE,MAAM,WAAW,iBAAiB,CAAC,MAAM,EAAC,MAAM;IAAE,KAAK,CAAC,KAAK,EAAC,MAAM,GAAE,MAAM,CAAC;IAAA,KAAK,CAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,EAAC,YAAY,EAAC,MAAM,GAAE,MAAM,CAAC;IAAA,SAAS,CAAC,SAAS,EAAC,MAAM,EAAC,aAAa,EAAC,MAAM,GAAE,MAAM,CAAA;CAAC;AACjM,MAAM,WAAW,eAAe,CAAC,MAAM,EAAC,MAAM;IAAE,QAAQ,EAAC,MAAM,CAAC;IAAA,KAAK,EAAC,MAAM,CAAC;IAAA,KAAK,EAAC,MAAM,CAAC;IAAA,YAAY,EAAC,MAAM,CAAA;CAAC;AAC9G,qBAAa,gBAAgB,CAAC,MAAM,EAAC,MAAM;IAE7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAAkC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAD5F,OAAO,CAAC,MAAM,CAAqC;gBACtB,OAAO,EAAC,iBAAiB,CAAC,MAAM,EAAC,MAAM,CAAC,EAAkB,KAAK,SAAI;IAChG,OAAO,CAAC,QAAQ,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,EAAC,YAAY,EAAC,MAAM,GAAE,MAAM;IAC7E,WAAW,CAAC,QAAQ,EAAC,MAAM,EAAC,aAAa,EAAC,MAAM,GAAE,MAAM;IACxD,KAAK;CACN;AACD,MAAM,WAAW,cAAc;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC;AAC3D,eAAO,MAAM,mBAAmB,EAAC,iBAAiB,CAAC,cAAc,EAAC,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,CAA0S,CAAC;AAClY,MAAM,MAAM,iBAAiB,GAAC,UAAU,GAAC,UAAU,GAAC,MAAM,CAAC"}
@@ -0,0 +1,16 @@
1
+ export class PredictionBuffer {
2
+ adapter;
3
+ limit;
4
+ frames = [];
5
+ constructor(adapter, limit = 120) {
6
+ this.adapter = adapter;
7
+ this.limit = limit;
8
+ }
9
+ predict(sequence, state, input, deltaSeconds) { const next = this.adapter.apply(this.adapter.clone(state), input, deltaSeconds); this.frames.push({ sequence, input, state: this.adapter.clone(next), deltaSeconds }); if (this.frames.length > this.limit)
10
+ this.frames.shift(); return next; }
11
+ acknowledge(sequence, authoritative) { const pending = this.frames.filter(frame => frame.sequence > sequence); this.frames = pending; let current = this.adapter.clone(authoritative); for (const frame of pending)
12
+ current = this.adapter.apply(current, frame.input, frame.deltaSeconds); return current; }
13
+ clear() { this.frames = []; }
14
+ }
15
+ export const transformPrediction = { clone: value => ({ ...value }), apply: (state, input, dt) => ({ x: state.x + (input.move_x ?? 0) * dt, y: state.y + (input.move_y ?? 0) * dt, z: state.z + (input.move_z ?? 0) * dt }), reconcile: (predicted, server) => ({ x: server.x + (predicted.x - server.x) * .15, y: server.y + (predicted.y - server.y) * .15, z: server.z + (predicted.z - server.z) * .15 }) };
16
+ //# sourceMappingURL=prediction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prediction.js","sourceRoot":"","sources":["../src/prediction.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,gBAAgB;IAEE;IAA0D;IAD/E,MAAM,GAAkC,EAAE,CAAC;IACnD,YAA6B,OAAwC,EAAkB,QAAM,GAAG;QAAnE,YAAO,GAAP,OAAO,CAAiC;QAAkB,UAAK,GAAL,KAAK,CAA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,EAAC,KAAK,EAAC,EAAE,EAAC,EAAE,CAAA,CAAC,EAAC,CAAC,EAAC,KAAK,CAAC,CAAC,GAAC,CAAC,KAAK,CAAC,MAAM,IAAE,CAAC,CAAC,GAAC,EAAE,EAAC,CAAC,EAAC,KAAK,CAAC,CAAC,GAAC,CAAC,KAAK,CAAC,MAAM,IAAE,CAAC,CAAC,GAAC,EAAE,EAAC,CAAC,EAAC,KAAK,CAAC,CAAC,GAAC,CAAC,KAAK,CAAC,MAAM,IAAE,CAAC,CAAC,GAAC,EAAE,EAAC,CAAC,EAAC,SAAS,EAAC,CAAC,SAAS,EAAC,MAAM,EAAC,EAAE,CAAA,CAAC,EAAC,CAAC,EAAC,MAAM,CAAC,CAAC,GAAC,CAAC,SAAS,CAAC,CAAC,GAAC,MAAM,CAAC,CAAC,CAAC,GAAC,GAAG,EAAC,CAAC,EAAC,MAAM,CAAC,CAAC,GAAC,CAAC,SAAS,CAAC,CAAC,GAAC,MAAM,CAAC,CAAC,CAAC,GAAC,GAAG,EAAC,CAAC,EAAC,MAAM,CAAC,CAAC,GAAC,CAAC,SAAS,CAAC,CAAC,GAAC,MAAM,CAAC,CAAC,CAAC,GAAC,GAAG,EAAC,CAAC,EAAC,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { InputFrame, JoinTicket, Room, ServerEvent, StatePatch } from "./types.js";
2
+ type EventMap = {
3
+ snapshot: Room;
4
+ patch: StatePatch;
5
+ player_joined: Extract<ServerEvent, {
6
+ type: "player_joined";
7
+ }>;
8
+ player_left: Extract<ServerEvent, {
9
+ type: "player_left";
10
+ }>;
11
+ ack: Extract<ServerEvent, {
12
+ type: "ack";
13
+ }>;
14
+ error: Error;
15
+ close: CloseEvent;
16
+ };
17
+ export interface DatagramTransport {
18
+ send(frame: InputFrame): void | Promise<void>;
19
+ close(): void;
20
+ }
21
+ export interface RealtimeOptions {
22
+ WebSocket?: typeof WebSocket;
23
+ datagram?: DatagramTransport;
24
+ reconnect?: boolean;
25
+ reconnectDelayMs?: number;
26
+ }
27
+ export declare class StateRealtimeClient {
28
+ readonly ticket: JoinTicket;
29
+ private readonly options;
30
+ private socket?;
31
+ private listeners;
32
+ private sequence;
33
+ private closed;
34
+ constructor(ticket: JoinTicket, options?: RealtimeOptions);
35
+ connect(): Promise<void>;
36
+ on<K extends keyof EventMap>(type: K, listener: (value: EventMap[K]) => void): () => void;
37
+ sendInput(values: InputFrame["values"], delivery?: InputFrame["delivery"]): number;
38
+ ping(): void;
39
+ close(): void;
40
+ private send;
41
+ private receive;
42
+ private emit;
43
+ }
44
+ export {};
45
+ //# sourceMappingURL=realtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../src/realtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxF,KAAK,QAAQ,GAAC;IAAC,QAAQ,EAAC,IAAI,CAAC;IAAA,KAAK,EAAC,UAAU,CAAC;IAAA,aAAa,EAAC,OAAO,CAAC,WAAW,EAAC;QAAC,IAAI,EAAC,eAAe,CAAA;KAAC,CAAC,CAAC;IAAA,WAAW,EAAC,OAAO,CAAC,WAAW,EAAC;QAAC,IAAI,EAAC,aAAa,CAAA;KAAC,CAAC,CAAC;IAAA,GAAG,EAAC,OAAO,CAAC,WAAW,EAAC;QAAC,IAAI,EAAC,KAAK,CAAA;KAAC,CAAC,CAAC;IAAA,KAAK,EAAC,KAAK,CAAC;IAAA,KAAK,EAAC,UAAU,CAAA;CAAC,CAAC;AAClO,MAAM,WAAW,iBAAiB;IAAC,IAAI,CAAC,KAAK,EAAC,UAAU,GAAE,IAAI,GAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAAA,KAAK,IAAG,IAAI,CAAA;CAAC;AAC1F,MAAM,WAAW,eAAe;IAAC,SAAS,CAAC,EAAC,OAAO,SAAS,CAAC;IAAA,QAAQ,CAAC,EAAC,iBAAiB,CAAC;IAAA,SAAS,CAAC,EAAC,OAAO,CAAC;IAAA,gBAAgB,CAAC,EAAC,MAAM,CAAA;CAAC;AACrI,qBAAa,mBAAmB;IAElB,QAAQ,CAAC,MAAM,EAAC,UAAU;IAAC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAD/D,OAAO,CAAC,MAAM,CAAC,CAAW;IAAA,OAAO,CAAC,SAAS,CAAoD;IAAA,OAAO,CAAC,QAAQ,CAAG;IAAA,OAAO,CAAC,MAAM,CAAO;gBAClH,MAAM,EAAC,UAAU,EAAkB,OAAO,GAAC,eAAkB;IAClF,OAAO,IAAG,OAAO,CAAC,IAAI,CAAC;IACvB,EAAE,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAC,QAAQ,EAAC,CAAC,KAAK,EAAC,QAAQ,CAAC,CAAC,CAAC,KAAG,IAAI,GAAE,MAAI,IAAI;IAChF,SAAS,CAAC,MAAM,EAAC,UAAU,CAAC,QAAQ,CAAC,EAAC,QAAQ,GAAC,UAAU,CAAC,UAAU,CAAc,GAAE,MAAM;IAC1F,IAAI;IACJ,KAAK;IACL,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,IAAI;CACb"}
@@ -0,0 +1,48 @@
1
+ export class StateRealtimeClient {
2
+ ticket;
3
+ options;
4
+ socket;
5
+ listeners = new Map();
6
+ sequence = 0;
7
+ closed = false;
8
+ constructor(ticket, options = {}) {
9
+ this.ticket = ticket;
10
+ this.options = options;
11
+ }
12
+ connect() { const Socket = this.options.WebSocket ?? globalThis.WebSocket; if (!Socket)
13
+ return Promise.reject(new Error("WebSocket is unavailable; provide RealtimeOptions.WebSocket")); const url = new URL(this.ticket.websocket_url); url.searchParams.set("room_id", this.ticket.room_id); url.searchParams.set("player_id", this.ticket.player_id); url.searchParams.set("ticket", this.ticket.ticket); return new Promise((resolve, reject) => { const socket = new Socket(url); this.socket = socket; socket.onopen = () => resolve(); socket.onerror = () => reject(new Error("Unable to connect to Infera State")); socket.onmessage = event => this.receive(String(event.data)); socket.onclose = event => { this.emit("close", event); if (!this.closed && this.options.reconnect !== false)
14
+ setTimeout(() => void this.connect(), this.options.reconnectDelayMs ?? 750); }; }); }
15
+ on(type, listener) { let set = this.listeners.get(type); if (!set) {
16
+ set = new Set();
17
+ this.listeners.set(type, set);
18
+ } set.add(listener); return () => set?.delete(listener); }
19
+ sendInput(values, delivery = "unreliable") { const sequence = ++this.sequence; const frame = { room_id: this.ticket.room_id, player_id: this.ticket.player_id, ticket: this.ticket.ticket, sequence, delivery, values }; if (delivery !== "reliable" && this.options.datagram)
20
+ void this.options.datagram.send(frame);
21
+ else
22
+ this.send({ type: "input", frame }); return sequence; }
23
+ ping() { this.send({ type: "ping" }); }
24
+ close() { this.closed = true; this.options.datagram?.close(); this.socket?.close(); }
25
+ send(value) { const Socket = this.options.WebSocket ?? globalThis.WebSocket; if (!Socket || this.socket?.readyState !== Socket.OPEN)
26
+ throw new Error("State realtime connection is not open"); this.socket.send(JSON.stringify(value)); }
27
+ receive(raw) { try {
28
+ const event = JSON.parse(raw);
29
+ if (event.type === "snapshot")
30
+ this.emit("snapshot", event.room);
31
+ else if (event.type === "patch")
32
+ this.emit("patch", event.patch);
33
+ else if (event.type === "player_joined")
34
+ this.emit("player_joined", event);
35
+ else if (event.type === "player_left")
36
+ this.emit("player_left", event);
37
+ else if (event.type === "ack")
38
+ this.emit("ack", event);
39
+ else if (event.type === "error")
40
+ this.emit("error", new Error(`${event.code}: ${event.message}`));
41
+ }
42
+ catch (reason) {
43
+ this.emit("error", reason instanceof Error ? reason : new Error(String(reason)));
44
+ } }
45
+ emit(type, value) { for (const listener of this.listeners.get(type) ?? [])
46
+ listener(value); }
47
+ }
48
+ //# sourceMappingURL=realtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.js","sourceRoot":"","sources":["../src/realtime.ts"],"names":[],"mappings":"AAIA,MAAM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AAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAC,KAAK,CAAC,CAAC;aAAK,IAAG,KAAK,CAAC,IAAI,KAAG,aAAa;YAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAC,KAAK,CAAC,CAAC;aAAK,IAAG,KAAK,CAAC,IAAI,KAAG,KAAK;YAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAC,KAAK,CAAC,CAAC;aAAK,IAAG,KAAK,CAAC,IAAI,KAAG,OAAO;YAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAC,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;IAAA,CAAC;IAAA,OAAM,MAAM,EAAC,CAAC;QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAC,MAAM,YAAY,KAAK,CAAA,CAAC,CAAA,MAAM,CAAA,CAAC,CAAA,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IAAA,CAAC,CAAA,CAAC;IAC7iB,IAAI,CAA2B,IAAM,EAAC,KAAiB,IAAE,KAAI,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAE,EAAE;QAAC,QAAQ,CAAC,KAAc,CAAC,CAAA,CAAA,CAAC;CAC9I"}
@@ -0,0 +1,194 @@
1
+ import type { ApiEnvelope, JsonObject, JsonValue } from "@faiber/sdk-core";
2
+ export type PropertyType = "boolean" | "integer" | "number" | "string" | "vec2" | "vec3" | "quaternion" | "json";
3
+ export type PropertyAuthority = "server" | "owner" | "shared";
4
+ export interface StateProperty {
5
+ name: string;
6
+ kind: PropertyType;
7
+ authority: PropertyAuthority;
8
+ replicated: boolean;
9
+ predicted: boolean;
10
+ default: JsonValue;
11
+ }
12
+ export interface StatePropertyInput {
13
+ name: string;
14
+ kind: PropertyType;
15
+ authority?: PropertyAuthority;
16
+ replicated?: boolean;
17
+ predicted?: boolean;
18
+ default?: JsonValue;
19
+ }
20
+ export interface ComponentSchema {
21
+ name: string;
22
+ properties: StateProperty[];
23
+ }
24
+ export interface ComponentSchemaInput {
25
+ name: string;
26
+ properties: StatePropertyInput[];
27
+ }
28
+ export interface ReplicationConfig {
29
+ tick_rate: number;
30
+ snapshot_rate: number;
31
+ interest_radius: number;
32
+ history_ticks: number;
33
+ }
34
+ export interface PhysicsConfig {
35
+ enabled: boolean;
36
+ dimensions: number;
37
+ gravity: [number, number, number];
38
+ deterministic: boolean;
39
+ }
40
+ export interface World {
41
+ id: string;
42
+ organization_id: string;
43
+ name: string;
44
+ slug: string;
45
+ components: ComponentSchema[];
46
+ replication: ReplicationConfig;
47
+ physics: PhysicsConfig;
48
+ created_at: string;
49
+ updated_at: string;
50
+ }
51
+ export interface CreateWorldInput {
52
+ name: string;
53
+ slug: string;
54
+ components?: ComponentSchemaInput[];
55
+ replication?: Partial<ReplicationConfig>;
56
+ physics?: Partial<PhysicsConfig>;
57
+ }
58
+ export interface UpdateWorldInput {
59
+ name?: string | null;
60
+ components?: ComponentSchemaInput[] | null;
61
+ replication?: Partial<ReplicationConfig> | null;
62
+ physics?: Partial<PhysicsConfig> | null;
63
+ }
64
+ export type RoomStatus = "waiting" | "running" | "paused" | "closed";
65
+ export interface Player {
66
+ id: string;
67
+ user_id: string;
68
+ joined_at: string;
69
+ last_input: number;
70
+ }
71
+ export interface Entity {
72
+ id: string;
73
+ owner_id: string | null;
74
+ components: Record<string, JsonObject>;
75
+ revision: number;
76
+ }
77
+ export interface Room {
78
+ id: string;
79
+ world_id: string;
80
+ organization_id: string;
81
+ name: string;
82
+ capacity: number;
83
+ status: RoomStatus;
84
+ tick: number;
85
+ players: Record<string, Player>;
86
+ entities: Record<string, Entity>;
87
+ created_at: string;
88
+ }
89
+ export interface CreateRoomInput {
90
+ name: string;
91
+ capacity?: number;
92
+ }
93
+ export interface JoinTicket {
94
+ room_id: string;
95
+ player_id: string;
96
+ ticket: string;
97
+ websocket_url: string;
98
+ udp_address: string;
99
+ expires_at: string;
100
+ }
101
+ export type Delivery = "reliable" | "unreliable" | "acked";
102
+ export interface InputFrame {
103
+ room_id: string;
104
+ player_id: string;
105
+ ticket?: string;
106
+ sequence: number;
107
+ delivery?: Delivery;
108
+ values: JsonObject;
109
+ }
110
+ export interface StatePatch {
111
+ room_id: string;
112
+ tick: number;
113
+ sequence: number;
114
+ entity_id: string;
115
+ component: string;
116
+ values: JsonObject;
117
+ reliable: boolean;
118
+ }
119
+ export type ServerEvent = {
120
+ type: "snapshot";
121
+ room: Room;
122
+ } | {
123
+ type: "patch";
124
+ patch: StatePatch;
125
+ } | {
126
+ type: "player_joined";
127
+ room_id: string;
128
+ player: Player;
129
+ } | {
130
+ type: "player_left";
131
+ room_id: string;
132
+ player_id: string;
133
+ } | {
134
+ type: "ack";
135
+ sequence: number;
136
+ tick: number;
137
+ } | {
138
+ type: "pong";
139
+ tick: number;
140
+ } | {
141
+ type: "error";
142
+ code: string;
143
+ message: string;
144
+ };
145
+ export type ClientEvent = {
146
+ type: "input";
147
+ frame: InputFrame;
148
+ } | {
149
+ type: "ack";
150
+ sequence: number;
151
+ } | {
152
+ type: "ping";
153
+ };
154
+ export interface WasmModuleInfo {
155
+ id: string;
156
+ world_id: string;
157
+ name: string;
158
+ sha256: string;
159
+ exports: string[];
160
+ created_at: string;
161
+ }
162
+ export interface UploadWasmInput {
163
+ name: string;
164
+ wasm_base64: string;
165
+ exports?: string[];
166
+ }
167
+ export interface WasmEndpoint {
168
+ id: string;
169
+ world_id: string;
170
+ module_id: string;
171
+ slug: string;
172
+ export: string;
173
+ component: string;
174
+ reliable: boolean;
175
+ }
176
+ export interface CreateWasmEndpointInput {
177
+ module_id: string;
178
+ slug: string;
179
+ export: string;
180
+ component: string;
181
+ reliable?: boolean;
182
+ }
183
+ export interface InvokeWasmInput {
184
+ player_id: string;
185
+ entity_id: string;
186
+ inputs?: number[];
187
+ }
188
+ export type WorldListResponse = ApiEnvelope<World[]>;
189
+ export type WorldResponse = ApiEnvelope<World>;
190
+ export type RoomListResponse = ApiEnvelope<Room[]>;
191
+ export type RoomResponse = ApiEnvelope<Room>;
192
+ export type JoinResponse = ApiEnvelope<JoinTicket>;
193
+ export type StatePatchResponse = ApiEnvelope<StatePatch>;
194
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3E,MAAM,MAAM,YAAY,GAAG,SAAS,GAAC,SAAS,GAAC,QAAQ,GAAC,QAAQ,GAAC,MAAM,GAAC,MAAM,GAAC,YAAY,GAAC,MAAM,CAAC;AACnG,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAC,OAAO,GAAC,QAAQ,CAAC;AAC1D,MAAM,WAAW,aAAa;IAAG,IAAI,EAAC,MAAM,CAAC;IAAC,IAAI,EAAC,YAAY,CAAC;IAAC,SAAS,EAAC,iBAAiB,CAAC;IAAC,UAAU,EAAC,OAAO,CAAC;IAAC,SAAS,EAAC,OAAO,CAAC;IAAC,OAAO,EAAC,SAAS,CAAA;CAAE;AACxJ,MAAM,WAAW,kBAAkB;IAAG,IAAI,EAAC,MAAM,CAAC;IAAC,IAAI,EAAC,YAAY,CAAC;IAAC,SAAS,CAAC,EAAC,iBAAiB,CAAC;IAAC,UAAU,CAAC,EAAC,OAAO,CAAC;IAAC,SAAS,CAAC,EAAC,OAAO,CAAC;IAAC,OAAO,CAAC,EAAC,SAAS,CAAA;CAAE;AACjK,MAAM,WAAW,eAAe;IAAG,IAAI,EAAC,MAAM,CAAC;IAAC,UAAU,EAAC,aAAa,EAAE,CAAA;CAAE;AAC5E,MAAM,WAAW,oBAAoB;IAAG,IAAI,EAAC,MAAM,CAAC;IAAC,UAAU,EAAC,kBAAkB,EAAE,CAAA;CAA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WAAW,CAAC,UAAU,CAAC,CAAC;AAAC,MAAM,MAAM,kBAAkB,GAAC,WAAW,CAAC,UAAU,CAAC,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@faiber/faiber-state-sdk",
3
+ "version": "0.5.0",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "dependencies": {
19
+ "@faiber/sdk-core": "0.5.0"
20
+ }
21
+ }