@idosgames/core 0.20.0 → 0.21.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 CHANGED
@@ -14,6 +14,84 @@ and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.ht
14
14
 
15
15
  ## [Unreleased]
16
16
 
17
+ ## [0.21.0] - 2026-10-03
18
+
19
+ The central cache, and behaviour fixes found by playing every system of the playground on the
20
+ local stand. A game with every system used to send ~25 requests right after login; now the login is
21
+ ONE `GetClientState` that brings the state (unchanged containers are not even re-sent), the config
22
+ (by version) and the server views the game reads.
23
+
24
+ ### Added
25
+
26
+ - **`client.cache` — the central cache** (`DataCache`). Every read decides there between the local
27
+ copy and the server:
28
+ - **title config** — `configSection(key)`: served while the config version is unchanged; sections
29
+ outside the client projection (`TimedBoost`, `Marketplace`, `Match`, `AI`) that a system fetched
30
+ are kept under that same version (`SectionCache`, storage key `idos:sec:{titleID}`);
31
+ - **player state** — `ensureState(containers, { maxAgeMs?, force? })`: a container is fresh while
32
+ its `Rev` is confirmed by the server in this session (login, a slice read, or a mutation reply
33
+ `+1`); the stale containers of every caller in one tick go out as ONE versioned
34
+ `User/GetUserState`. `defineStateRule(container, { needsServer, refresh })` declares a container
35
+ the server must compute on read — built in: `Quest` (a cycle ended), `Tutorial` (lazy transitions,
36
+ once a session), `Reward` (comeback presence on read), `Character` (a hero given by default),
37
+ `Collection` (the active collection may have changed);
38
+ - **server views** — `defineView({ key, ttlMs?, expiresAt?, dependsOn?, invalidateOn? })` +
39
+ `read(view, fetch, opts)`: one request for every concurrent reader, lifetime from the data, the
40
+ TTL, the `Rev` of the containers it depends on and SDK events; `peek`, `put`, `invalidate`,
41
+ `clear`, `describe`. Built in: storefront, active deals, active events, active season, leaderboard
42
+ progress, mailbox / chat / inbox unread, marketplace my-state, coop user state.
43
+ - **Server views ride on the login.** `UserRequest.Views` / `ClientState.Views` (engine
44
+ `ClientStateViews`): the login answer carries the views asked for — `[{ Name: "*" }]` all of them,
45
+ or exactly the listed ones; a view with variants and no parameter comes for every variant (each
46
+ season chain, all enabled leaderboards). Each is the same `Data` as its own endpoint, validated
47
+ with the same schema and applied by the same service code; a failing view does not fail the login.
48
+ Which views to ask for is the client option `loginViews`: `"auto"` (default — the views the game
49
+ read in the last 3 sessions, remembered under `idos:views:{titleID}`), `"all"`, `"none"` or a list.
50
+ `CachedView.login` + `DataCache.bindLoginView` declare a view as one the login can bring.
51
+ - A view invalidated while its request is in flight (most often by its OWN reply: a read that writes
52
+ the player document reports the new version) keeps the answer for a short settle window instead of
53
+ dropping it; a value `put` later wins. Views also drop on the SDK events of the actions behind them
54
+ (`invalidateOn`), not only on the `Rev` of their containers. Mailbox replies put fresh counters.
55
+ - `ReadOptions` (`forceRefresh`, `maxAgeMs`) on those reads; `tutorial.getUserTutorialState` is a
56
+ cached view too (dropped when the `Tutorial` `Rev` moves).
57
+
58
+ ### Changed
59
+
60
+ - **Definitions are served from the title config cache.** Every `getDefinitions` whose data is a
61
+ section of the title config (season, leaderboard, collection, coop event, quest, character,
62
+ tutorial, timed event, store, chat, mailbox, timed boost, match, AI, lootbox, craft, premium,
63
+ reward, referral) answers from the cache without a request; `{ forceRefresh: true }` goes to the
64
+ server. `TitleConfig.getSection` returns a section wherever it came from (fetched or with the
65
+ config).
66
+ - The server views listed above are cached by their policy instead of hitting the server on every
67
+ call; pass `{ forceRefresh: true }` to bypass.
68
+ - `applyUserStateContainers` emits `user:inventoryUpdated` when the slice carried the inventory.
69
+ - `user.getUserState` (the versioned slice) replaces only the containers whose version moved: an
70
+ unchanged one keeps its live copy instead of the stored snapshot.
71
+ - The transport announces `user:stateVersions` BEFORE the quest/tutorial side channels, so a
72
+ listener that re-reads on `tutorial:systemProgress` already sees the dependent views dropped.
73
+
74
+ ### Fixed
75
+
76
+ - **Parallel calls with different arguments are no longer dropped.** The transport's throttle / dedup
77
+ key was the route alone, so the active season of two chains, the active coop event per chain, two
78
+ boards read at once — every call after the first came back "Duplicate request skipped". The default key
79
+ is now the route plus the request without its per-call `RelatedEntityID` (`requestKey`); the same request
80
+ twice is still deduplicated.
81
+ - **No burst over the engine's per-player limit.** The engine blocks a player for 10 s after more than 20
82
+ requests in one second, and a game with many systems sends about that many right after login. The
83
+ transport now paces request starts (`maxRequestsPerSecond`, default 15); a 429 is retried on a schedule
84
+ that outlasts the block (1.5 s / 4 s / 6 s); a 409 "Operation in progress" (the engine's per-player lock)
85
+ is retried like a transient — the handler did not run.
86
+ - **Friends counters follow friend actions.** `send/accept/decline/removeFriend` apply the server's
87
+ `Counters` (and the local patches move `IncomingCount` / `FriendsCount` / `OutgoingCount`): the friends
88
+ badge used to keep showing a request already answered.
89
+ - **An unlocked character is level 1 in the cache** (as on the server) — it used to read as still locked
90
+ until the next full state read.
91
+ - **`RealtimeSession` emits `left`** when this side leaves the room (`leave()`, page close), so whoever holds
92
+ the session (a game that took the room) knows it is over. A `SendSignal` to a member who has just left is
93
+ no longer reported as `error:global`.
94
+
17
95
  ## [0.20.0] - 2026-10-02
18
96
 
19
97
  Models and services checked against the engine's real C# handlers (types, requests, endpoints) and