@zaisma/cli 0.45.0 → 0.47.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/package.json
CHANGED
|
@@ -611,7 +611,7 @@ Every account earns standing from plain facts, never a hidden score, and nobody
|
|
|
611
611
|
| Links to any other site, for signed-in adults | Once established, or at once with a card that paid Zaisma (a top-up or Zaisma Pro) or a connected Stripe account that can take payments |
|
|
612
612
|
| Search engines (the sitemap, and no `noindex` on game pages) | Only once established |
|
|
613
613
|
|
|
614
|
-
A ruling closes links to other sites and search engines at once, for 30 days; a ban closes them for as long as it lasts. `GET /access` answers `standing`: `{ is_established_developer, outside_links_enabled, search_engines_enabled, returning_player_count, minimum_returning_player_count, account_age_days, minimum_account_age_days, has_card_or_stripe_account, last_ruling_at, ruling_wait_ends_at, message_for_people }`, where `message_for_people` says what's open and what opens next. The game dashboard's Links say the same under the field.
|
|
614
|
+
A ruling closes links to other sites and search engines at once, for 30 days; a ban closes them for as long as it lasts. A rejection a person at Zaisma finds wrong and approves (`message_zaisma` with the version's ID asks for one) stops counting at once: the 30 days run from the last ruling still standing, or there's no wait, and the game's history says `ruling-overturned`. `GET /access` answers `standing`: `{ is_established_developer, outside_links_enabled, search_engines_enabled, returning_player_count, minimum_returning_player_count, account_age_days, minimum_account_age_days, has_card_or_stripe_account, last_ruling_at, ruling_wait_ends_at, message_for_people }`, where `message_for_people` says what's open and what opens next. The game dashboard's Links say the same under the field.
|
|
615
615
|
|
|
616
616
|
### Bans
|
|
617
617
|
|
|
@@ -686,7 +686,7 @@ A game looks like: `slug`, `page_url`, `title`, `description`, `visibility`, `vi
|
|
|
686
686
|
- **cloud_saves_enabled:** `true` (the default) copies signed-in players' browser saves to their account, so their progress follows them to any device with no code in the game. It covers localStorage and IndexedDB (Unity, Godot and localForage saves included; databases with "cache" in the name, like Unity's download cache, are skipped), up to 5 MB per player. Set `false` for games that keep their own saves on a server. When a player has played on two devices, the progress played most recently wins and the other is kept as an earlier version; Zaisma never asks the player which to keep.
|
|
687
687
|
- **account_offer_enabled:** `true` (the default) shows guests the "Keep your progress" card once they have progress and have played 5 minutes: beside the game, it offers a free account to keep their progress. Set `false` for games that offer accounts their own way, with `Zaisma.player.signIn()`.
|
|
688
688
|
- **deleted_account_erase_enabled:** `true` (the default): when a player who played the game deletes their Zaisma account, Zaisma erases their rows from the game database, as `POST /games/:slug/database/erase-player` does, as well as sending `account_deleted` to your webhooks. Set `false` if the game must keep some of their rows (records the law says to keep, say), and handle the `account_deleted` event yourself.
|
|
689
|
-
- **multiplayer_mode:** `none`, `relay` (Zaisma passes each message to the others, no server code) or `own`: your game server, from the live version's `zaisma-server/` folder (`index.js` first, importing the folder's other `.js`, `.json` and `.wasm` files) or one `zaisma-server.js`, runs on Zaisma rooms in a sandbox that calls only the hosts in `game_server_allowed_hosts`, with the game's secrets as `room.secrets` and its own SQLite database as `room.database` (see "Your game server on Zaisma" and "The game database" in the README, and The game database below to read and change it yourself). If the live version has no game server, or one over 500 files or
|
|
689
|
+
- **multiplayer_mode:** `none`, `relay` (Zaisma passes each message to the others, no server code) or `own`: your game server, from the live version's `zaisma-server/` folder (`index.js` first, importing the folder's other `.js`, `.json` and `.wasm` files, with every other file there a data file it reads with `room.readDataFile`) or one `zaisma-server.js`, runs on Zaisma rooms in a sandbox that calls only the hosts in `game_server_allowed_hosts`, with the game's secrets as `room.secrets` and its own SQLite database as `room.database` (see "Your game server on Zaisma" and "The game database" in the README, and The game database below to read and change it yourself). If the live version has no game server, or one over 500 files or 32 MB, the change is saved and `game_server_problem` says why; rooms open once a version that works is published. Games already on a game server built into Zaisma show `built-in` and can't change it themselves. Rooms on the old setting end within a minute.
|
|
690
690
|
- **room_browsing:** for games on Zaisma rooms (`multiplayer_mode` other than `none`), where open rooms are listed so players can join them: `page` (the default) on the game page and to the game through `Zaisma.rooms.list()`, `game` only to the game (for games with their own lobby or server browser), or `off`. Room codes and invite links work either way, and the game can hide single rooms itself (see Multiplayer in the README). Whatever the setting, every game's page and the home say how many are playing now once it's 3 or more, for every game and not only multiplayer ones (no names); `GET /games/:slug` gives you the exact number. Rooms on your own servers aren't listed or counted.
|
|
691
691
|
- **friend_joins_enabled:** `true` (the default) lets Join on zaisma.com (a friend's face on /friends, "Alex is playing" on the game page, a profile's Playing now) and `Zaisma.friends.list()` take a player into the room their friend is in, for any game with rooms (Zaisma rooms, or its own servers through `Zaisma.friends.setRoom`). `false` grays Join as "This game doesn't take joins". One room turns it off instead, shown as "Private room": `Zaisma.joinRoom({ friendJoinsEnabled: false })` from the player who makes it, or `room.setFriendJoinsEnabled(false)` (the game server's, or the host's with the relay). It isn't a lock: a room's code or link still reaches it, so close the room (`setOpen(false)`) or answer `false` from `canJoin` to keep players out.
|
|
692
692
|
- **performance_measuring_enabled:** `true` (the default) has Zaisma measure how the game runs on players' devices, for `performance` in the stats (Play stats, below). `false` stops Zaisma adding its measuring script to the game's pages at all, and the stats answer `performance: null`.
|
|
@@ -78,6 +78,7 @@ export default {
|
|
|
78
78
|
// room.setListed(false), room.setOpen(false), room.reserve({ playerIds, setupData }),
|
|
79
79
|
// await room.database.query(sql, values), await room.database.batch([{ sql, values }]) (the game database, below)
|
|
80
80
|
// await room.verifyReceipt(receipt) (a purchase's signed receipt, checked; server.verifyReceipt the same)
|
|
81
|
+
// room.readDataFile("maps/docks.bin") (a data file beside the code, an ArrayBuffer; server.readDataFile the same; below)
|
|
81
82
|
```
|
|
82
83
|
|
|
83
84
|
Names follow [`docs/NAMING.md`](docs/NAMING.md): whole words, with the unit in the name. A game server with an option it doesn't take doesn't start, and says which ones it does take (`unknown_option`); the SDK refuses options and events it doesn't take the same way. Every message between a game and its room says its `type`, and a game's own messages travel in `data`; rooms count messages, not their size, so whole words cost nothing.
|
|
@@ -133,13 +134,16 @@ zaisma-server/
|
|
|
133
134
|
index.js export default { setup, onJoin, onMessage, ... }
|
|
134
135
|
physics.js import { step } from "./physics.js" works in index.js
|
|
135
136
|
levels/docks.js
|
|
137
|
+
maps/docks.bin a data file: room.readDataFile("maps/docks.bin")
|
|
136
138
|
```
|
|
137
139
|
|
|
138
|
-
- **Plain JavaScript ES modules:** `zaisma-server/index.js` default-exports the game server above, and can import the folder's other files by relative path: `.js` code, `.json` data (`import levels from "./levels.json"`) and `.wasm` WebAssembly, like a physics engine (`import mod from "./physics.wasm"` gives a `WebAssembly.Module`; `new WebAssembly.Instance(mod, imports)` starts it). Packages from npm (`import "lodash"`) and TypeScript need a build step: bundle into one `zaisma-server.js` at the top of the upload instead (`npx esbuild server.ts --format=esm --bundle --outfile=zaisma-server.js`). Up to 500 files and
|
|
140
|
+
- **Plain JavaScript ES modules:** `zaisma-server/index.js` default-exports the game server above, and can import the folder's other files by relative path: `.js` code, `.json` data (`import levels from "./levels.json"`) and `.wasm` WebAssembly, like a physics engine (`import mod from "./physics.wasm"` gives a `WebAssembly.Module`; `new WebAssembly.Instance(mod, imports)` starts it). Packages from npm (`import "lodash"`) and TypeScript need a build step: bundle into one `zaisma-server.js` at the top of the upload instead (`npx esbuild server.ts --format=esm --bundle --outfile=zaisma-server.js`), or into `zaisma-server/index.js` when it has data files. Up to 500 files and 32 MB in all, data files included (`GAME_SERVER_LIMITS`).
|
|
141
|
+
- **Data files:** every other file in `zaisma-server/` (`.bin`, `.gz`, `.txt`, anything but `.js`, `.json` and `.wasm`) ships beside the code as a data file, like prebuilt navigation meshes, level geometry or a dictionary. `room.readDataFile("maps/docks.bin")` (or `server.readDataFile` in `onRequest`, `onSchedule` and `onWebhook`) answers it as an `ArrayBuffer`, by its path from `zaisma-server/`: no base64, no download, and nothing on the meter, since it comes with the code. It's the same `ArrayBuffer` every time, shared by every room of the version running in the same place, so read it and never change it; keep what you build from it in a variable outside the handlers (`const meshes = new Map()`) and every room there shares it too. A path with no data file throws a `GameServerError` `bad_room_call`. On your own server, data files are read from the game server's folder (`--data-folder`, or `startServer({ dataFolder })`; `zaisma-server` by default).
|
|
142
|
+
- **Time to start:** each call into the game server, a tick with the messages since the last one, a join, a request, has 50 ms of CPU (`GAME_SERVER_LIMITS.maximumCallCpuDurationMs`). A start has 5 seconds (`maximumStartCpuDurationMs`): loading the game server, `setup`, `onRestored`, and a real-time room's first tick after either, so build what the match needs once (a map's navigation, its collision) in that first tick, not spread over many. The game server's top-level code, outside its handlers, has Cloudflare's 1 second as it loads (`maximumLoadCpuDurationMs`), so heavy work goes in that first tick. One copy of the game server, shared by the version's rooms in one place, has 128 MB of memory (`maximumMemorySizeBytes`), its data files included. Every second of CPU is on the game's hosting meter, starts included.
|
|
139
143
|
- **Sealed off:** nothing of Zaisma's but its own game's database and secrets, and other servers only on the hosts you list (below), so it talks to its players through `room` and its answers to their requests. State is plain JSON.
|
|
140
144
|
- **Private:** players never get its files; the game domain refuses `zaisma-server/` and `zaisma-server.js`.
|
|
141
145
|
- **Real-time rooms batch input:** in a room with `ticksPerSec`, the state stays inside the sandbox, and players' messages and bytes reach `onMessage` and `onBytes` just before the next `onTick`, in the order they came, with what they send going out then (at most a tick later). A handler that throws leaves the rest of the batch to run, and what it changed in the state before throwing stays, as on your own server, where they run as they come.
|
|
142
|
-
- **Kept in check:** an error in a handler loses that one message or tick and the match carries on. A
|
|
146
|
+
- **Kept in check:** an error in a handler loses that one message or tick and the match carries on. A call that runs past its CPU (above; a loop that never ends) is stopped, freezing the match meanwhile, and a match stopped twice ends. Your dashboard and the MCP's `get_stats` show these errors with the file and line they came from.
|
|
143
147
|
- **Updates:** rooms keep the version they started with until they end; new rooms get the live version.
|
|
144
148
|
|
|
145
149
|
The same file runs on your own machine too (below), so you can test it there or move off Zaisma any time.
|
|
@@ -427,6 +427,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
|
|
|
427
427
|
| The hosts a game's own game server can call (game server reach), and how a call it can't make fails | `game_server_allowed_hosts` (host names, or `*.example.com` for the names under one) | plain `fetch()`; a refused call throws an `OutsideCallError` with a `code` (`OutsideCallErrorCode`: `not_https`, `unreachable_host`, `host_not_allowed`, `outside_call_limit`, `too_big`, `outside_call_timeout`, `outside_call_failed`) and a `fix` (`OUTSIDE_CALL_LIMITS`: `maximumBodySizeBytes`, `timeoutSec`, `maximumCallsPerMin`) |
|
|
428
428
|
| A game's registered links: the name the game opens one by, its address, whether its game page shows it, and who it opens for | `links`, each `{ link_name, destination_url, is_on_game_page, who_can_open, review_reason }`; `who_can_open`: `everyone`, `signed_in_adults`, `waiting_for_standing`, `nobody` | `Zaisma.links.open(linkName, { path, queryParameters, ownSiteUrl })` answers a `LinkStatus`: `opened`, `stayed`; errors `unknown_link`, `bad_link_path`, `bad_link_query`, `bad_own_site_url`, `needs_player_tap` |
|
|
429
429
|
| A game's secrets: a name like an environment variable's, its text, and when it was set | `secret_name`, `secret_value` in; a secret is `{ name, set_at }` out, never its value; `deleted_secret_name` | `server.secrets` and `room.secrets` (by name, read-only); on your own server, the environment variables |
|
|
430
|
+
| A game server's data files: any file in `zaisma-server/` that isn't code, read whole, and what a game server can be and use | | `room.readDataFile(path)` and `server.readDataFile(path)` (the path from `zaisma-server/`, an `ArrayBuffer` back); `dataFolder` (`startServer`) and `--data-folder` on your own server; `GAME_SERVER_LIMITS` `{ maximumSizeBytes, maximumFileCount, maximumCallCpuDurationMs, maximumStartCpuDurationMs, maximumLoadCpuDurationMs, maximumMemorySizeBytes }`; `SERVER_CODE_FILE` (Zaisma's own code) |
|
|
430
431
|
| Something a game sells or grants | `items`, each `{ item_name, title, description, item_kind, item_category, price_minor_units, currency_code, local_prices, card_fee_note, created_at, updated_at }`; `item_kind` `permanent`, `consumable`; `item_category` `cosmetic`, `gameplay`, `content`, `currency`; `price_minor_units` `null` for an item only granted or no longer sold (then `currency_code` `null` too); `local_prices`, each `{ currency_code, price_minor_units }`, never the main currency again; `currency_code` lowercase ISO 4217 as Stripe writes it (`usd`, `brl`); `removed_item_name`; `is_on_game_page` (the game page sells it under Add-ons too); errors `no_item`, `too_many_items`, `bad_item`, `unsupported_currency`, `price_too_low`, `item_has_owners` | `ITEM_LIMITS`, `ITEM_KINDS`, `ITEM_CATEGORIES`, `CURRENCY_MINIMUM_PRICES`, `COUNTRY_CURRENCIES`, `priceFor`, `priceText`, `cardFeeNote`, `checkItem`; `Zaisma.items.list()` answers `ItemForSale` `{ itemName, title, description, itemKind, itemCategory, priceMinorUnits, currencyCode, priceText, isOwned }` |
|
|
431
432
|
| A player's purchase or grant of an item, and its proof | `purchase` `{ id, item_name, item_kind, item_count, purchase_source, purchase_status, player_id, game_account_id, paid_minor_units, currency_code, refunded_minor_units, purchased_at, refunded_at, receipt }`; `paid_minor_units` what the whole purchase paid, never the item's `price_minor_units`; `purchase_source` `sale`, `grant`; `purchase_status` `pending`, `completed`, `failed`, `refunded`, `charged_back`; `item_count` how many of the item (1 for a permanent one); `receipt` the signed token; `game_account_id` the game's own ID for the player's account in its own system, given back as sent (not a Zaisma ID, so it says no kind); `is_already_owned`; `owned_item_names`, in the pass too; key area `purchase_access`; errors `no_purchase`, `bad_item_count`, `bad_game_account_id`, `bad_purchase_source`, `bad_purchase_status`, `already_refunded`, `stripe_not_connected`, `receipts_unavailable` | `ReceiptClaims` with `receipt_version_number`, `purchase_id` (and `jti`, the same), `purchased_at`, `purchase_status`, `paid_minor_units`; header `typ` `receipt+jwt`; `ReceiptError`, `ReceiptErrorCode` (`wrong_version` beside the pass codes); `verifyReceipt`, `room.verifyReceipt(receipt)`, `server.verifyReceipt(receipt)`, `RECEIPT_TOKEN_TYPE`, `RECEIPT_VERSION_NUMBER`, `ReceiptCheckBinding`, `RECEIPT_SIGNING_KEY`, `RETIRED_RECEIPT_PUBLIC_KEYS`; columns `deleted_game_slug`, `deleted_game_title` on purchases; `ReceiptSigningService`, `receiptClaimsFor`, `ownedItemNames`, `owningPurchaseOf`, `newGrant`, `recordGrant`, `takeBack`; `player.ownedItemNames` on the game server; `Zaisma.items.owns(itemName)`, `Zaisma.items.owned()` |
|
|
432
433
|
| A game that sells itself once, and its demo | `full_game_item_name` (the permanent content item a player owns to play; `null`: free to play), `demo_game_slug` (another of the developer's games, free to play; `demo_game_id` in the games table); Browse's `?price=` one of `free`, `under_5`, `5_to_15`, `15_to_30`, `30_and_up`; errors `bad_full_game_item`, `full_game_item_in_use`, `bad_demo_game`, `account_requirement_locked`, `full_game_not_owned` | `PRICE_RANGES`, `PriceRange`, `priceRangeOf`, `fullGameOwner`, `settlePaidGame` |
|