feat!: client storage is read-only, storage.save and storage.delete removed
This commit is contained in:
@@ -77,7 +77,7 @@ refresh clears tokens and emits `signed-out`. Details:
|
||||
| Auth | `client.auth` | service |
|
||||
| Player | `client.player` (`player`, `identities`, `balances`, `items`) | `SyncedState<PlayerProfile>` |
|
||||
| Catalog currencies | `client.catalog` | `SyncedState<Map<string, CatalogCurrency>>` |
|
||||
| Player storage | `client.storage` + `.save(type, data)` / `.delete(type)` | `SyncedState<GetStorageResponse>` + mutations |
|
||||
| Player storage | `client.storage`, read-only | `SyncedState<GetStorageResponse>` |
|
||||
| Modules | `client.modules.call<T>(module, fn, args?, { moduleVersion? })` | resolves to `result` as `T` |
|
||||
|
||||
## Module calls through generated clients
|
||||
|
||||
@@ -5,8 +5,7 @@ Per-player storage, one item per `type`. `StorageDomain`, revision key
|
||||
|
||||
```ts
|
||||
client.storage.value // GetStorageResponse | undefined
|
||||
await client.storage.save(type, data);
|
||||
await client.storage.delete(type);
|
||||
await client.storage.reload();
|
||||
```
|
||||
|
||||
```ts
|
||||
@@ -21,10 +20,8 @@ interface StorageItem {
|
||||
}
|
||||
```
|
||||
|
||||
- `save(type: string, data: string): Promise<void>`: upserts the item of
|
||||
`type` (the server keeps one item per player and type), then invalidates.
|
||||
- `delete(type: string): Promise<void>`: deletes the item of `type`, then
|
||||
invalidates.
|
||||
- The client cannot write storage. Module functions (kernel `Storage.Set`) and
|
||||
the batch admin API write it; call `reload()` after a module call that saved.
|
||||
|
||||
## Limits and notes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user