@indiegems/gem-web-sdk 11.1.2 → 12.0.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 +14 -0
- package/README.md +3 -1
- package/dist/game.d.ts +49 -0
- package/dist/gem-web-sdk.bridge.js +1 -1
- package/dist/gem-web-sdk.esm.js +2 -2
- package/dist/gem-web-sdk.function.js +2 -2
- package/dist/gem-web-sdk.game.js +2 -2
- package/dist/gem-web-sdk.min.js +2 -2
- package/dist/gem-web-sdk.sdk.js +2 -2
- package/dist/gem-web-sdk.server.js +2 -2
- package/dist/index.d.ts +66 -4
- package/dist/sdk.d.ts +49 -0
- package/docs/api/api-reference-function.md +7916 -0
- package/docs/api/api-reference-game.md +191 -3
- package/docs/api/api-reference-server.md +5 -3
- package/docs/api/reference.json +9491 -3
- package/docs/changelog.md +14 -0
- package/docs/getting-started.md +5 -2
- package/docs/manifest.json +12 -12
- package/docs/rooms-and-matches.md +64 -1
- package/docs/server-bundles.md +2 -2
- package/docs/serverless-functions-js.md +118 -44
- package/docs/serverless-functions.md +26 -11
- package/package.json +1 -1
- package/schema/bridge.v1.json +84 -0
- package/schema/capabilities.public.json +6 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The browser surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk`
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v12.0.0, the version of the package this file ships in. Every symbol below carries an explicit anchor, its `anchor` in `reference.json` beside this file.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/game` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|
|
@@ -3832,8 +3832,10 @@ the callback instead.
|
|
|
3832
3832
|
|
|
3833
3833
|
- `ready` — a usable token is held.
|
|
3834
3834
|
- `pending` — no token yet, or one is being fetched.
|
|
3835
|
-
- `degraded` — the last attempt failed but another may succeed
|
|
3836
|
-
|
|
3835
|
+
- `degraded` — the last attempt failed but another may succeed, and the SDK
|
|
3836
|
+
makes it on its own: once any wait the platform named has passed, or
|
|
3837
|
+
otherwise at growing intervals of up to a minute. Keep playing. `ready`
|
|
3838
|
+
follows when an attempt succeeds, with no call of yours needed to cause it.
|
|
3837
3839
|
- `lost` — terminal for this session. Signing back in is the only way
|
|
3838
3840
|
forward, and retrying will not produce one.
|
|
3839
3841
|
|
|
@@ -15307,6 +15309,36 @@ room. A double fire — the push and the reconcile landing together, or the
|
|
|
15307
15309
|
event arriving just as the player presses your own button — costs one
|
|
15308
15310
|
redundant request and never a second seat.
|
|
15309
15311
|
|
|
15312
|
+
<a id="roomeventmap-partyqueued"></a>
|
|
15313
|
+
|
|
15314
|
+
## RoomEventMap.partyQueued
|
|
15315
|
+
|
|
15316
|
+
```ts
|
|
15317
|
+
partyQueued: [PartyTicket]
|
|
15318
|
+
```
|
|
15319
|
+
|
|
15320
|
+
This player's party is queued for a match: its leader called
|
|
15321
|
+
`queueForMatch`, and this player is on that ticket.
|
|
15322
|
+
|
|
15323
|
+
The ticket is a view — show a searching screen from it, and await its
|
|
15324
|
+
`outcome` to take the screen down. It has no `cancel()`: the ticket is
|
|
15325
|
+
the leader's.
|
|
15326
|
+
|
|
15327
|
+
```js
|
|
15328
|
+
gem.rooms.on('partyQueued', async (ticket) => {
|
|
15329
|
+
showSearching({ canCancel: false });
|
|
15330
|
+
const outcome = await ticket.outcome;
|
|
15331
|
+
if (outcome.status !== 'matched') backToMenu(outcome.status);
|
|
15332
|
+
});
|
|
15333
|
+
```
|
|
15334
|
+
|
|
15335
|
+
When the outcome is `matched` the room arrives as `seated`, as it does
|
|
15336
|
+
for any seat this player's party was given.
|
|
15337
|
+
|
|
15338
|
+
NOT RAISED FOR THE PLAYER WHO QUEUED — they hold the ticket itself — and
|
|
15339
|
+
not raised at all under an arcade page that does not relay ticket
|
|
15340
|
+
events. See [PartyTicket](#partyticket).
|
|
15341
|
+
|
|
15310
15342
|
<a id="roomeventmap-listed"></a>
|
|
15311
15343
|
|
|
15312
15344
|
## RoomEventMap.listed
|
|
@@ -16125,6 +16157,25 @@ Set from the moment [RoomManager.queueForMatch](#roommanager-queueformatch) answ
|
|
|
16125
16157
|
ticket ends — so it is `null` again by the time a matched ticket's room is
|
|
16126
16158
|
[RoomManager.currentRoom](#roommanager-currentroom).
|
|
16127
16159
|
|
|
16160
|
+
<a id="roommanager-partyticket"></a>
|
|
16161
|
+
|
|
16162
|
+
## RoomManager.partyTicket
|
|
16163
|
+
|
|
16164
|
+
```ts
|
|
16165
|
+
readonly partyTicket: PartyTicket | null
|
|
16166
|
+
```
|
|
16167
|
+
|
|
16168
|
+
The matchmaking ticket this player's PARTY is waiting on, or `null` — a
|
|
16169
|
+
ticket this game did not create, which it can show and cannot cancel.
|
|
16170
|
+
|
|
16171
|
+
Set when the arcade page reports that the party's leader queued, and
|
|
16172
|
+
`null` again once that ticket ends. Never set beside
|
|
16173
|
+
[RoomManager.currentTicket](#roommanager-currentticket): the player who queued holds that one.
|
|
16174
|
+
The `partyQueued` event is raised when this is set.
|
|
16175
|
+
|
|
16176
|
+
Always `null` under a page that does not relay ticket events. See
|
|
16177
|
+
[PartyTicket](#partyticket).
|
|
16178
|
+
|
|
16128
16179
|
<a id="roommanager-currentmatch"></a>
|
|
16129
16180
|
|
|
16130
16181
|
## RoomManager.currentMatch
|
|
@@ -16549,6 +16600,143 @@ Safe to call more than once, and after the ticket has ended.
|
|
|
16549
16600
|
|
|
16550
16601
|
**Returns.** The same promise as [MatchTicket.outcome](#matchticket-outcome).
|
|
16551
16602
|
|
|
16603
|
+
<a id="partyticketstatus"></a>
|
|
16604
|
+
|
|
16605
|
+
## PartyTicketStatus
|
|
16606
|
+
|
|
16607
|
+
```ts
|
|
16608
|
+
type PartyTicketStatus = "queued" | "matched" | "expired" | "cancelled" | "failed" | "lost"
|
|
16609
|
+
```
|
|
16610
|
+
|
|
16611
|
+
Where a party's ticket is, as far as this player's game has been told:
|
|
16612
|
+
`queued` while it waits, and anything else for good.
|
|
16613
|
+
|
|
16614
|
+
- `matched` — the party is seated and the match is starting. The room arrives
|
|
16615
|
+
as a `seated` event.
|
|
16616
|
+
- `expired` — it waited too long, or its owner's game stopped keeping it alive.
|
|
16617
|
+
- `cancelled` — the leader backed out, or the party changed.
|
|
16618
|
+
- `failed` — the platform formed a match and could not start it, repeatedly.
|
|
16619
|
+
- `lost` — nothing more was heard about it by the time it must have ended.
|
|
16620
|
+
|
|
16621
|
+
<a id="partyticketoutcome"></a>
|
|
16622
|
+
|
|
16623
|
+
## PartyTicketOutcome
|
|
16624
|
+
|
|
16625
|
+
```ts
|
|
16626
|
+
type PartyTicketOutcome = { status: "matched" } | { status: "expired"; reason: string } | { status: "cancelled"; reason: string } | { status: "failed"; reason: string } | { status: "lost" }
|
|
16627
|
+
```
|
|
16628
|
+
|
|
16629
|
+
How a party's ticket ended. Branch on `status`.
|
|
16630
|
+
|
|
16631
|
+
`matched` CARRIES NO ROOM. The room is reported the way a party's seat always
|
|
16632
|
+
is — the `seated` event — and that is where a game joins it. The SDK looks
|
|
16633
|
+
for the seat the moment it hears `matched`.
|
|
16634
|
+
|
|
16635
|
+
`reason` says why, where the platform gave one: `timed_out` or
|
|
16636
|
+
`heartbeat_lapsed` for `expired`, `requested` or `party_changed` for
|
|
16637
|
+
`cancelled`, `handoff_failed` for `failed`. Treat a value you do not
|
|
16638
|
+
recognise as the status alone.
|
|
16639
|
+
|
|
16640
|
+
`lost` is the SDK's own ending, not the platform's: the ticket's lifetime
|
|
16641
|
+
ran out and no ending was heard. Whatever happened, the party is not
|
|
16642
|
+
waiting any more.
|
|
16643
|
+
|
|
16644
|
+
<a id="partyticket"></a>
|
|
16645
|
+
|
|
16646
|
+
## PartyTicket
|
|
16647
|
+
|
|
16648
|
+
```ts
|
|
16649
|
+
interface PartyTicket
|
|
16650
|
+
```
|
|
16651
|
+
|
|
16652
|
+
The matchmaking ticket this player's party is waiting on — a ticket this
|
|
16653
|
+
game did not create. What `gem.rooms.partyTicket` holds, and what the
|
|
16654
|
+
`partyQueued` event hands you.
|
|
16655
|
+
|
|
16656
|
+
READ-ONLY, ON PURPOSE. There is no `cancel()`: a party is one ticket and it
|
|
16657
|
+
is its leader's to cancel. A player who wants out leaves the party, which
|
|
16658
|
+
ends the ticket for everyone.
|
|
16659
|
+
|
|
16660
|
+
```js
|
|
16661
|
+
gem.rooms.on('partyQueued', async (ticket) => {
|
|
16662
|
+
showSearching({ canCancel: false });
|
|
16663
|
+
const outcome = await ticket.outcome;
|
|
16664
|
+
if (outcome.status !== 'matched') backToMenu(outcome.status);
|
|
16665
|
+
// `matched`: your `seated` handler has the room.
|
|
16666
|
+
});
|
|
16667
|
+
```
|
|
16668
|
+
|
|
16669
|
+
ONLY WHERE THE ARCADE PAGE RELAYS IT. Under a page that does not, there is
|
|
16670
|
+
no party ticket and no `partyQueued`, and a member is carried into the match
|
|
16671
|
+
by `seated` with no lead-up. Build the searching screen as an extra, never
|
|
16672
|
+
as a step the match depends on.
|
|
16673
|
+
|
|
16674
|
+
**Guides.** [rooms-and-matches](../rooms-and-matches.md)
|
|
16675
|
+
|
|
16676
|
+
<a id="partyticket-id"></a>
|
|
16677
|
+
|
|
16678
|
+
## PartyTicket.id
|
|
16679
|
+
|
|
16680
|
+
```ts
|
|
16681
|
+
readonly id: string
|
|
16682
|
+
```
|
|
16683
|
+
|
|
16684
|
+
The ticket's id. For logs and bug reports; nothing you call takes it.
|
|
16685
|
+
|
|
16686
|
+
<a id="partyticket-status"></a>
|
|
16687
|
+
|
|
16688
|
+
## PartyTicket.status
|
|
16689
|
+
|
|
16690
|
+
```ts
|
|
16691
|
+
readonly status: PartyTicketStatus
|
|
16692
|
+
```
|
|
16693
|
+
|
|
16694
|
+
Where the ticket is, as far as this game has been told. Changes once, from
|
|
16695
|
+
`queued` to how it ended.
|
|
16696
|
+
|
|
16697
|
+
<a id="partyticket-partysize"></a>
|
|
16698
|
+
|
|
16699
|
+
## PartyTicket.partySize
|
|
16700
|
+
|
|
16701
|
+
```ts
|
|
16702
|
+
readonly partySize: number
|
|
16703
|
+
```
|
|
16704
|
+
|
|
16705
|
+
How many players the ticket seats: the size of the party. 0 when the page
|
|
16706
|
+
did not say.
|
|
16707
|
+
|
|
16708
|
+
<a id="partyticket-queuedat"></a>
|
|
16709
|
+
|
|
16710
|
+
## PartyTicket.queuedAt
|
|
16711
|
+
|
|
16712
|
+
```ts
|
|
16713
|
+
readonly queuedAt: number
|
|
16714
|
+
```
|
|
16715
|
+
|
|
16716
|
+
When the ticket joined the queue, in Unix seconds. 0 when the page did not
|
|
16717
|
+
say.
|
|
16718
|
+
|
|
16719
|
+
<a id="partyticket-expiresat"></a>
|
|
16720
|
+
|
|
16721
|
+
## PartyTicket.expiresAt
|
|
16722
|
+
|
|
16723
|
+
```ts
|
|
16724
|
+
readonly expiresAt: number
|
|
16725
|
+
```
|
|
16726
|
+
|
|
16727
|
+
When the ticket gives up if it is still waiting, in Unix seconds. Good for
|
|
16728
|
+
a countdown. 0 when the page did not say.
|
|
16729
|
+
|
|
16730
|
+
<a id="partyticket-outcome"></a>
|
|
16731
|
+
|
|
16732
|
+
## PartyTicket.outcome
|
|
16733
|
+
|
|
16734
|
+
```ts
|
|
16735
|
+
readonly outcome: Promise<PartyTicketOutcome>
|
|
16736
|
+
```
|
|
16737
|
+
|
|
16738
|
+
How the ticket ends. Settles exactly once and never rejects.
|
|
16739
|
+
|
|
16552
16740
|
<a id="roomstatus"></a>
|
|
16553
16741
|
|
|
16554
16742
|
## RoomStatus
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The server surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk`
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v12.0.0, the version of the package this file ships in. Every symbol below carries an explicit anchor, its `anchor` in `reference.json` beside this file.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/server` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|
|
@@ -766,8 +766,10 @@ the callback instead.
|
|
|
766
766
|
|
|
767
767
|
- `ready` — a usable token is held.
|
|
768
768
|
- `pending` — no token yet, or one is being fetched.
|
|
769
|
-
- `degraded` — the last attempt failed but another may succeed
|
|
770
|
-
|
|
769
|
+
- `degraded` — the last attempt failed but another may succeed, and the SDK
|
|
770
|
+
makes it on its own: once any wait the platform named has passed, or
|
|
771
|
+
otherwise at growing intervals of up to a minute. Keep playing. `ready`
|
|
772
|
+
follows when an attempt succeeds, with no call of yours needed to cause it.
|
|
771
773
|
- `lost` — terminal for this session. Signing back in is the only way
|
|
772
774
|
forward, and retrying will not produce one.
|
|
773
775
|
|