@indiegems/gem-web-sdk 9.1.3 → 10.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 +19 -0
- package/README.md +1 -2
- package/dist/function.d.ts +1 -1
- package/dist/game.d.ts +72 -21
- 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 +1 -1
- package/dist/index.d.ts +71 -23
- package/dist/sdk.d.ts +72 -21
- package/docs/api/api-reference-game.md +2844 -2564
- package/docs/api/api-reference-server.md +706 -706
- package/docs/api/reference.json +791 -1927
- package/docs/changelog.md +19 -0
- package/docs/daily-challenges.md +123 -1
- package/docs/getting-started.md +5 -5
- package/docs/manifest.json +14 -14
- package/docs/platform-rules.md +2 -2
- package/docs/rooms-and-matches.md +128 -4
- package/docs/server-bundles.md +4 -4
- package/docs/serverless-functions-js.md +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,25 @@ Its entries are grouped under up to five headings:
|
|
|
16
16
|
- **Rebuild**: a type changed. Recompile against the new version; code that compiles today keeps compiling unless the entry says otherwise.
|
|
17
17
|
- **New capability**: something a game can now do. Nothing changes unless you use it.
|
|
18
18
|
|
|
19
|
+
## 10.0.0
|
|
20
|
+
|
|
21
|
+
Upgrading from 9.1.4. Impact: required.
|
|
22
|
+
|
|
23
|
+
### Rebuild
|
|
24
|
+
|
|
25
|
+
- The OrderSource type now accepts two more values, test_account_provision and developer_grant. Recompile your game. If your code handles order sources in an exhaustive switch or a lookup table typed by OrderSource, add handling for both new values, or the build may fail to compile.
|
|
26
|
+
|
|
27
|
+
### New capability
|
|
28
|
+
|
|
29
|
+
- A game can now put a player in a matchmaking queue for a mode that needs a formed lobby. Call RoomManager.queueForMatch with the template slugs you want. It returns a MatchTicket whose outcome settles once and whose cancel method leaves the queue. When the platform finds a match it creates the room, seats everyone and starts the match, and you follow it with the same code you use for any joined room. Options are described by QueueForMatchOptions. Ticket endings are described by MatchTicketOutcome, and the waiting state by MatchTicketStatus. RoomManager.currentTicket exposes the ticket the player is waiting on. The SDK keeps the ticket alive by itself, cancels it when the tab closes, and lets a player queue from inside a room. After a match the player leaves the room they queued from when the tab closes.
|
|
30
|
+
- The lower-level rooms API now has createTicket, heartbeatTicket and cancelTicket calls for working with matchmaking tickets directly. Most games should use RoomManager.queueForMatch, which sends the heartbeats and cancellation for you.
|
|
31
|
+
|
|
32
|
+
## 9.1.4
|
|
33
|
+
|
|
34
|
+
Upgrading from 9.1.3. Impact: none.
|
|
35
|
+
|
|
36
|
+
Nothing in this release asks anything of a game.
|
|
37
|
+
|
|
19
38
|
## 9.1.3
|
|
20
39
|
|
|
21
40
|
Upgrading from 9.1.2. Impact: none.
|
package/README.md
CHANGED
|
@@ -5,8 +5,7 @@ progress, leaderboards, currencies and items, rooms and matches, and the server
|
|
|
5
5
|
One dependency covers both halves of a game — the browser client and its dedicated server.
|
|
6
6
|
|
|
7
7
|
**Everything you need to build against it is in this package.** The guides are in [`docs/`](docs/),
|
|
8
|
-
the full API reference is in [`docs/api/`](docs/api/), and both
|
|
9
|
-
developer site serves at <https://gemarcade.com/developer/docs>, at the version you installed.
|
|
8
|
+
the full API reference is in [`docs/api/`](docs/api/), and both describe the version you installed.
|
|
10
9
|
Read them here rather than guessing from the type declarations, which carry signatures only.
|
|
11
10
|
|
|
12
11
|
## Start here
|
package/dist/function.d.ts
CHANGED
|
@@ -168,7 +168,7 @@ type BucketConfig = Boundary & {
|
|
|
168
168
|
type BucketResetInterval = "never" | "daily" | "weekly" | "monthly";
|
|
169
169
|
type EntityType = "player" | "character";
|
|
170
170
|
type ItemCategory = "cosmetic" | "progression";
|
|
171
|
-
type OrderSource = "real_money_purchase" | "real_money_refund" | "full_game_purchase" | "full_game_refund" | "platform_purchase" | "reward" | "admin" | "system" | "promo" | "game_consume" | "play" | "recipe" | "transfer" | "platform_funded_game_inventory_purchase" | "earning_reset";
|
|
171
|
+
type OrderSource = "real_money_purchase" | "real_money_refund" | "full_game_purchase" | "full_game_refund" | "platform_purchase" | "reward" | "admin" | "system" | "promo" | "game_consume" | "play" | "recipe" | "transfer" | "platform_funded_game_inventory_purchase" | "earning_reset" | "test_account_provision" | "developer_grant";
|
|
172
172
|
type PlatformPrice = {
|
|
173
173
|
"platform_currency_id": string;
|
|
174
174
|
"price": number;
|
package/dist/game.d.ts
CHANGED
|
@@ -147,6 +147,11 @@ type AffixSelection = {
|
|
|
147
147
|
"pool": AffixPoolRef;
|
|
148
148
|
"respect_groups"?: boolean;
|
|
149
149
|
};
|
|
150
|
+
type BackfillPolicy = "fill_existing_first" | "prefer_new_match";
|
|
151
|
+
type BackfillSettings = {
|
|
152
|
+
"enabled": boolean;
|
|
153
|
+
"policy"?: BackfillPolicy;
|
|
154
|
+
};
|
|
150
155
|
type Boundary = {
|
|
151
156
|
"boundary"?: string;
|
|
152
157
|
"reset_time"?: string;
|
|
@@ -220,11 +225,20 @@ type LevelDefinition = {
|
|
|
220
225
|
"rewards"?: RecipeOperation[];
|
|
221
226
|
"threshold": number;
|
|
222
227
|
};
|
|
228
|
+
type MatchmakingSettings = {
|
|
229
|
+
"backfill"?: null | BackfillSettings;
|
|
230
|
+
"cluster_stagger_seconds"?: number;
|
|
231
|
+
"enabled": boolean;
|
|
232
|
+
"fill_window_seconds"?: number;
|
|
233
|
+
"strategy"?: MatchmakingStrategy;
|
|
234
|
+
"ticket_expiry_seconds"?: number | null;
|
|
235
|
+
};
|
|
236
|
+
type MatchmakingStrategy = "fifo";
|
|
223
237
|
type OrderBySpec = {
|
|
224
238
|
"column": RunValueColumn;
|
|
225
239
|
"direction": SortDirection;
|
|
226
240
|
};
|
|
227
|
-
type OrderSource = "real_money_purchase" | "real_money_refund" | "full_game_purchase" | "full_game_refund" | "platform_purchase" | "reward" | "admin" | "system" | "promo" | "game_consume" | "play" | "recipe" | "transfer" | "platform_funded_game_inventory_purchase" | "earning_reset";
|
|
241
|
+
type OrderSource = "real_money_purchase" | "real_money_refund" | "full_game_purchase" | "full_game_refund" | "platform_purchase" | "reward" | "admin" | "system" | "promo" | "game_consume" | "play" | "recipe" | "transfer" | "platform_funded_game_inventory_purchase" | "earning_reset" | "test_account_provision" | "developer_grant";
|
|
228
242
|
type OverflowBehavior = "fail" | "clamp" | "allow";
|
|
229
243
|
type PityEffect = "guarantee_tier" | {
|
|
230
244
|
"weight_boost": {
|
|
@@ -442,6 +456,7 @@ type SnapshotGameRoomTemplate = {
|
|
|
442
456
|
"id": string;
|
|
443
457
|
"idle_timeout_seconds"?: number | null;
|
|
444
458
|
"match_type": string;
|
|
459
|
+
"matchmaking"?: null | MatchmakingSettings;
|
|
445
460
|
"max_match_duration_seconds"?: number | null;
|
|
446
461
|
"max_players": number;
|
|
447
462
|
"min_players": number;
|
|
@@ -513,6 +528,7 @@ type SnapshotProgression = {
|
|
|
513
528
|
"display_name"?: string | null;
|
|
514
529
|
"icon_url"?: string | null;
|
|
515
530
|
"id": string;
|
|
531
|
+
"localized"?: Record<string, unknown>;
|
|
516
532
|
"progression_type": string;
|
|
517
533
|
"slug"?: string | null;
|
|
518
534
|
"sort_order": number;
|
|
@@ -550,6 +566,7 @@ type SnapshotRewardedPlacement = {
|
|
|
550
566
|
"grants": SnapshotRewardGrant[];
|
|
551
567
|
"max_held"?: number | null;
|
|
552
568
|
"max_per_day"?: number | null;
|
|
569
|
+
"min_watch_secs"?: number | null;
|
|
553
570
|
"placement": string;
|
|
554
571
|
"reward_class": string;
|
|
555
572
|
"without_ads": string;
|
|
@@ -1514,26 +1531,6 @@ interface ClusterTarget {
|
|
|
1514
1531
|
readonly id: string;
|
|
1515
1532
|
readonly pressure: string;
|
|
1516
1533
|
}
|
|
1517
|
-
type RoomArgScalar = string | number | boolean;
|
|
1518
|
-
type RoomArgValue$1 = RoomArgScalar | readonly RoomArgScalar[];
|
|
1519
|
-
type RoomArgs = Readonly<Record<string, RoomArgValue$1>>;
|
|
1520
|
-
type RoomArgType = "string" | "int" | "float" | "bool" | (string & {});
|
|
1521
|
-
interface RoomArgEntry {
|
|
1522
|
-
readonly name: string;
|
|
1523
|
-
readonly type: RoomArgType;
|
|
1524
|
-
readonly list: boolean;
|
|
1525
|
-
readonly required: boolean;
|
|
1526
|
-
readonly mutable: boolean;
|
|
1527
|
-
readonly fixed?: RoomArgValue$1;
|
|
1528
|
-
readonly default?: RoomArgValue$1;
|
|
1529
|
-
readonly description?: string;
|
|
1530
|
-
readonly allowed?: readonly RoomArgScalar[];
|
|
1531
|
-
readonly min?: number;
|
|
1532
|
-
readonly max?: number;
|
|
1533
|
-
readonly minItems?: number;
|
|
1534
|
-
readonly maxItems?: number;
|
|
1535
|
-
readonly maxLength?: number;
|
|
1536
|
-
}
|
|
1537
1534
|
type DedicatedServerFailure = "timeout" | "aborted" | "allocation_failed" | "no_server_ready" | "start_rate_limited" | "p2p_unavailable" | "unsupported_protocol" | "credential_expired" | "credential_reused" | "join_rate_limited" | "signaling_unavailable" | "signaling_failed" | "offer_refused" | "invalid_sdp" | "media_refused" | "connection_failed" | "join_refused" | "match_ended" | "misconfigured";
|
|
1538
1535
|
declare class DedicatedServerError extends Error {
|
|
1539
1536
|
readonly reason: DedicatedServerFailure;
|
|
@@ -1642,6 +1639,26 @@ interface TransportAdvert {
|
|
|
1642
1639
|
declare function readTemplateTransports(value: unknown): readonly TransportKind[] | null;
|
|
1643
1640
|
declare function readTransportAdvert(settings: unknown, forMatch?: string): TransportAdvert | null;
|
|
1644
1641
|
declare function webTransportAvailable(): boolean;
|
|
1642
|
+
type RoomArgScalar = string | number | boolean;
|
|
1643
|
+
type RoomArgValue$1 = RoomArgScalar | readonly RoomArgScalar[];
|
|
1644
|
+
type RoomArgs = Readonly<Record<string, RoomArgValue$1>>;
|
|
1645
|
+
type RoomArgType = "string" | "int" | "float" | "bool" | (string & {});
|
|
1646
|
+
interface RoomArgEntry {
|
|
1647
|
+
readonly name: string;
|
|
1648
|
+
readonly type: RoomArgType;
|
|
1649
|
+
readonly list: boolean;
|
|
1650
|
+
readonly required: boolean;
|
|
1651
|
+
readonly mutable: boolean;
|
|
1652
|
+
readonly fixed?: RoomArgValue$1;
|
|
1653
|
+
readonly default?: RoomArgValue$1;
|
|
1654
|
+
readonly description?: string;
|
|
1655
|
+
readonly allowed?: readonly RoomArgScalar[];
|
|
1656
|
+
readonly min?: number;
|
|
1657
|
+
readonly max?: number;
|
|
1658
|
+
readonly minItems?: number;
|
|
1659
|
+
readonly maxItems?: number;
|
|
1660
|
+
readonly maxLength?: number;
|
|
1661
|
+
}
|
|
1645
1662
|
type RoomStatus = "open" | "in_game" | "closed" | (string & {});
|
|
1646
1663
|
type MatchConnectionState = "disconnected" | "connecting" | "connected" | "suspended";
|
|
1647
1664
|
type MatchSessionPhase = "none" | "starting" | "ready" | "connected" | "suspended" | "ended" | (string & {});
|
|
@@ -1739,6 +1756,38 @@ interface RoomOperationError {
|
|
|
1739
1756
|
readonly message: string;
|
|
1740
1757
|
readonly retryable: boolean;
|
|
1741
1758
|
}
|
|
1759
|
+
interface QueueForMatchOptions {
|
|
1760
|
+
readonly templateSlugs: readonly string[];
|
|
1761
|
+
readonly partyId?: string;
|
|
1762
|
+
readonly signal?: AbortSignal;
|
|
1763
|
+
}
|
|
1764
|
+
type MatchTicketStatus = "queued" | "matched" | "expired" | "cancelled" | "failed" | "lost" | "unavailable";
|
|
1765
|
+
type MatchTicketOutcome = {
|
|
1766
|
+
readonly status: "matched";
|
|
1767
|
+
readonly room: Room;
|
|
1768
|
+
} | {
|
|
1769
|
+
readonly status: "expired";
|
|
1770
|
+
readonly reason: string;
|
|
1771
|
+
} | {
|
|
1772
|
+
readonly status: "cancelled";
|
|
1773
|
+
readonly reason: string;
|
|
1774
|
+
} | {
|
|
1775
|
+
readonly status: "failed";
|
|
1776
|
+
readonly reason: string;
|
|
1777
|
+
} | {
|
|
1778
|
+
readonly status: "lost";
|
|
1779
|
+
} | {
|
|
1780
|
+
readonly status: "unavailable";
|
|
1781
|
+
};
|
|
1782
|
+
interface MatchTicket {
|
|
1783
|
+
readonly id: string;
|
|
1784
|
+
readonly status: MatchTicketStatus;
|
|
1785
|
+
readonly partySize: number;
|
|
1786
|
+
readonly queuedAt: number;
|
|
1787
|
+
readonly expiresAt: number;
|
|
1788
|
+
readonly outcome: Promise<MatchTicketOutcome>;
|
|
1789
|
+
cancel(): Promise<MatchTicketOutcome>;
|
|
1790
|
+
}
|
|
1742
1791
|
interface CreateRoomOptions {
|
|
1743
1792
|
readonly name: string;
|
|
1744
1793
|
readonly maxPlayers?: number;
|
|
@@ -1881,6 +1930,7 @@ interface RoomManager {
|
|
|
1881
1930
|
join(roomId: string, options?: JoinRoomOptions): Promise<Room>;
|
|
1882
1931
|
joinByCode(code: string, options?: JoinRoomOptions): Promise<Room>;
|
|
1883
1932
|
quickJoin(options: QuickJoinOptions): Promise<Room>;
|
|
1933
|
+
queueForMatch(options: QueueForMatchOptions): Promise<MatchTicket>;
|
|
1884
1934
|
list(options?: ListRoomsOptions): Promise<RoomPage>;
|
|
1885
1935
|
myRooms(signal?: AbortSignal): Promise<readonly RoomSummary[]>;
|
|
1886
1936
|
leave(options?: {
|
|
@@ -1906,6 +1956,7 @@ interface RoomManager {
|
|
|
1906
1956
|
}): Promise<void>;
|
|
1907
1957
|
readonly gameId: string | null;
|
|
1908
1958
|
readonly currentRoom: Room | null;
|
|
1959
|
+
readonly currentTicket: MatchTicket | null;
|
|
1909
1960
|
readonly currentMatch: ReadyMatch | null;
|
|
1910
1961
|
readonly matchConnectionState: MatchConnectionState;
|
|
1911
1962
|
readonly matchSession: MatchSession;
|