@crowdedkingdoms/crowdyjs 15.1.0 → 15.2.0-test.1
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/dist/client.d.ts +2 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -1
- package/dist/crowdy-client.d.ts +11 -2
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +31 -5
- package/dist/default-origin.d.ts +23 -0
- package/dist/default-origin.d.ts.map +1 -0
- package/dist/default-origin.js +22 -0
- package/dist/generated/graphql.d.ts +3 -3
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/realtime.d.ts +2 -1
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +6 -1
- package/package.json +4 -2
package/dist/client.d.ts
CHANGED
|
@@ -21,7 +21,8 @@ export interface GraphQLClientConfig {
|
|
|
21
21
|
* Absolute base URL of the GraphQL HTTP service (e.g.
|
|
22
22
|
* `https://game.example.com/graphql`). Used when {@link graphqlEndpoint} is
|
|
23
23
|
* not set. When both are omitted the client falls back to
|
|
24
|
-
*
|
|
24
|
+
* {@link CROWDY_DEFAULT_HTTP_ORIGIN} — the public CK API origin for the tier
|
|
25
|
+
* this build was published for.
|
|
25
26
|
*/
|
|
26
27
|
httpUrl?: string;
|
|
27
28
|
/**
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,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OAAO,CAAC,iBAAiB,CAAC,CAEM;IAEhC;;;;;;OAMG;gBACS,MAAM,EAAE,mBAAmB,YAAK,EAAE,OAAO,EAAE,YAAY;IAkBnE;;;;;;;OAOG;IACH,yBAAyB,CACvB,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAC5D,IAAI;IAIP;;;;OAIG;IACH,WAAW,IAAI,MAAM;IAIrB;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAInC;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,OAAO,CAAC,OAAO,EAAE,UAAU,EAC/B,QAAQ,EAAE,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,EAChD,SAAS,CAAC,EAAE,UAAU,EACtB,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GACrC,OAAO,CAAC,OAAO,CAAC;IASnB;;;;;;;;;;;;;;;;;;;OAmBG;IACG,KAAK,CAAC,CAAC,GAAG,GAAG,EACjB,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACvC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GACrC,OAAO,CAAC,CAAC,CAAC;IA0Cb,0EAA0E;YAC5D,OAAO;CAyEtB;AAED;;;GAGG;AACH,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -10,6 +10,7 @@ import { print } from 'graphql';
|
|
|
10
10
|
import { silentLogger } from './logger.js';
|
|
11
11
|
import { APP_UNAVAILABLE_CODE, CrowdyAppUnavailableError, CrowdyError, CrowdyGraphQLError, CrowdyHttpError, CrowdyNetworkError, CrowdyTimeoutError, CrowdyUserCodeFaultError, } from './errors.js';
|
|
12
12
|
import { moveFromErrors } from './datacenter-redirect.js';
|
|
13
|
+
import { CROWDY_DEFAULT_HTTP_ORIGIN } from './default-origin.js';
|
|
13
14
|
/**
|
|
14
15
|
* Low-level HTTP transport for GraphQL operations against the game or
|
|
15
16
|
* management API. It POSTs operations to a single endpoint, attaches the
|
|
@@ -40,10 +41,16 @@ export class GraphQLClient {
|
|
|
40
41
|
* HTTP auth always tracks the active session.
|
|
41
42
|
*/
|
|
42
43
|
constructor(config = {}, session) {
|
|
44
|
+
// The last resort is the tier's PUBLIC origin, not localhost. Until
|
|
45
|
+
// 2026-08-23 it was `http://localhost:3000/graphql`, which is the shape
|
|
46
|
+
// field note 68 is about: an unconfigured consumer got a plausible answer
|
|
47
|
+
// (connection refused against their own machine) rather than a useful one,
|
|
48
|
+
// and the misconfiguration read as "my server is down". The literal lives in
|
|
49
|
+
// the generated `default-origin.ts` and nowhere else.
|
|
43
50
|
this.graphqlEndpoint =
|
|
44
51
|
config.graphqlEndpoint ||
|
|
45
52
|
config.httpUrl ||
|
|
46
|
-
|
|
53
|
+
`${CROWDY_DEFAULT_HTTP_ORIGIN}/graphql`;
|
|
47
54
|
this.timeout = config.timeout || 60000;
|
|
48
55
|
this.session = session;
|
|
49
56
|
this.logger = config.logger ?? silentLogger;
|
package/dist/crowdy-client.d.ts
CHANGED
|
@@ -65,9 +65,18 @@ import { MarketplaceAPI } from './domains/marketplace.js';
|
|
|
65
65
|
import { PlayerModelAPI } from './domains/playerModel.js';
|
|
66
66
|
import { DiscoveryDomain } from './domains/discovery.js';
|
|
67
67
|
export interface CrowdyClientConfig {
|
|
68
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* HTTP root. Defaults to {@link CROWDY_DEFAULT_HTTP_ORIGIN}, the public CK API
|
|
70
|
+
* origin for the tier this build of the SDK was published for — `@dev`,
|
|
71
|
+
* `@test` and `latest` each carry their own. Pass it explicitly to point at
|
|
72
|
+
* another tier, at a per-app datacenter endpoint, or at a local server.
|
|
73
|
+
*
|
|
74
|
+
* The example this line used to give was `https://api.crowdedkingdoms.com`,
|
|
75
|
+
* which is NXDOMAIN and has been for a long time. That is why the default is
|
|
76
|
+
* generated from the tier table rather than written by hand.
|
|
77
|
+
*/
|
|
69
78
|
httpUrl?: string;
|
|
70
|
-
/** WS root. */
|
|
79
|
+
/** WS root. Defaults to {@link CROWDY_DEFAULT_WS_ORIGIN}. */
|
|
71
80
|
wsUrl?: string;
|
|
72
81
|
/** GraphQL endpoint. Defaults to `${httpUrl}/graphql`. */
|
|
73
82
|
graphqlEndpoint?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crowdy-client.d.ts","sourceRoot":"","sources":["../src/crowdy-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"crowdy-client.d.ts","sourceRoot":"","sources":["../src/crowdy-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MA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,wEAAwE;IACxE,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,6DAA6D;IAC7D,QAAQ,CAAC,iBAAiB,EAAE,2BAA2B,CAAC;IAExD,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IACrC,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;gBAEnB,MAAM,GAAE,kBAAuB;IAsM3C,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIpC,0DAA0D;IAC1D,QAAQ,IAAI,MAAM,GAAG,IAAI;IAIzB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;YAczC,2BAA2B;IAczC;;;;;;;OAOG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAIjC;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa;IAS3D,gEAAgE;IAChE,KAAK,IAAI,IAAI;CAKd;AAED,wBAAgB,kBAAkB,CAChC,MAAM,GAAE,kBAAuB,GAC9B,YAAY,CAEd"}
|
package/dist/crowdy-client.js
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { AuthState } from './auth-state.js';
|
|
24
24
|
import { GraphQLClient } from './client.js';
|
|
25
|
+
import { CROWDY_DEFAULT_HTTP_ORIGIN, CROWDY_DEFAULT_WS_ORIGIN, } from './default-origin.js';
|
|
25
26
|
import { LbCookieStore } from './lb-cookie-store.js';
|
|
26
27
|
import { createBootstrapRediscover } from './bootstrap-rediscover.js';
|
|
27
28
|
import { RealtimeMetrics } from './metrics.js';
|
|
@@ -80,9 +81,34 @@ export class CrowdyClient {
|
|
|
80
81
|
}
|
|
81
82
|
this.session = new AuthState(config.tokenStore);
|
|
82
83
|
const lbCookieStore = config.lbCookieStore ?? new LbCookieStore();
|
|
84
|
+
// THE DEFAULT IS ALL-OR-NOTHING, AND THAT RULE IS LOAD-BEARING.
|
|
85
|
+
//
|
|
86
|
+
// It applies only to a client that configured NO origin at all. A caller who
|
|
87
|
+
// supplied any of the four gets exactly what they supplied and nothing
|
|
88
|
+
// invented around it, because the alternative is worse than having no
|
|
89
|
+
// default: `createCrowdyClient({ httpUrl: 'https://my-host' })` would get
|
|
90
|
+
// HTTP on their host and the WEBSOCKET on the tier default, splitting one
|
|
91
|
+
// session across two origins while looking connected. `gameModel` and
|
|
92
|
+
// `crowdyStudioAgent` refuse a missing wsUrl loudly today and must go on
|
|
93
|
+
// doing so — a refusal replaced by a silent wrong answer is a bad trade even
|
|
94
|
+
// when the wrong answer is a live host.
|
|
95
|
+
//
|
|
96
|
+
// Resolved ONCE here so every sub-client below agrees. Applied per-transport
|
|
97
|
+
// it reached two of five: `gameModel` and `crowdyStudioAgent` were handed
|
|
98
|
+
// `undefined` while the two transports had an answer, and a default that
|
|
99
|
+
// reaches some members of a set and not others is a third configuration
|
|
100
|
+
// nothing was designed for.
|
|
101
|
+
const configuredAnOrigin = Boolean(config.httpUrl?.trim() ||
|
|
102
|
+
config.wsUrl?.trim() ||
|
|
103
|
+
config.graphqlEndpoint?.trim() ||
|
|
104
|
+
config.wsEndpoint?.trim());
|
|
105
|
+
const httpUrl = configuredAnOrigin
|
|
106
|
+
? config.httpUrl
|
|
107
|
+
: CROWDY_DEFAULT_HTTP_ORIGIN;
|
|
108
|
+
const wsUrl = configuredAnOrigin ? config.wsUrl : CROWDY_DEFAULT_WS_ORIGIN;
|
|
83
109
|
this.graphql = new GraphQLClient({
|
|
84
|
-
httpUrl
|
|
85
|
-
graphqlEndpoint: config.graphqlEndpoint ?? toGraphqlEndpoint(
|
|
110
|
+
httpUrl,
|
|
111
|
+
graphqlEndpoint: config.graphqlEndpoint ?? toGraphqlEndpoint(httpUrl, 'graphql'),
|
|
86
112
|
timeout: config.timeout,
|
|
87
113
|
logger: config.logger,
|
|
88
114
|
lbCookieStore,
|
|
@@ -100,7 +126,7 @@ export class CrowdyClient {
|
|
|
100
126
|
})
|
|
101
127
|
: undefined);
|
|
102
128
|
this.realtime = new SubscriptionManager({
|
|
103
|
-
wsEndpoint: config.wsEndpoint ?? toGraphqlEndpoint(
|
|
129
|
+
wsEndpoint: config.wsEndpoint ?? toGraphqlEndpoint(wsUrl, 'graphql'),
|
|
104
130
|
logger: config.logger,
|
|
105
131
|
lbCookieStore,
|
|
106
132
|
...realtimeConfig,
|
|
@@ -179,14 +205,14 @@ export class CrowdyClient {
|
|
|
179
205
|
this.teams = new TeamsAPI(this.graphql);
|
|
180
206
|
this.udp = new UdpAPI(this.graphql, this.realtime, this.metrics);
|
|
181
207
|
this.gameModel = new GameModelAPI(this.graphql, {
|
|
182
|
-
wsUrl: config.wsEndpoint ?? toGraphqlEndpoint(
|
|
208
|
+
wsUrl: config.wsEndpoint ?? toGraphqlEndpoint(wsUrl, 'graphql'),
|
|
183
209
|
getToken: () => this.session.getToken(),
|
|
184
210
|
});
|
|
185
211
|
this.compute = new ComputeAPI(this.graphql);
|
|
186
212
|
this.playerCompute = new PlayerComputeAPI(this.graphql);
|
|
187
213
|
this.crowdyStudio = new CrowdyStudioAPI(this.graphql);
|
|
188
214
|
this.crowdyStudioAgent = new CrowdyAgentGraphQLTransport(this.graphql, {
|
|
189
|
-
wsUrl: config.wsEndpoint ?? toGraphqlEndpoint(
|
|
215
|
+
wsUrl: config.wsEndpoint ?? toGraphqlEndpoint(wsUrl, 'graphql'),
|
|
190
216
|
getToken: () => this.session.getToken(),
|
|
191
217
|
});
|
|
192
218
|
this.playerWallet = new PlayerWalletAPI(this.graphql);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED — do not edit. The operator tooling's
|
|
3
|
+
* `sync-client-origins.mjs --write --tier test` writes this file, and
|
|
4
|
+
* `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
|
|
5
|
+
* host that declaration does not carry. Regenerate; never hand-edit.
|
|
6
|
+
*
|
|
7
|
+
* THE DEFAULT IS LOAD-BEARING DURING A ROLLOUT, which is the opposite of how a
|
|
8
|
+
* default is usually thought about: while the branches are mid-migration this is
|
|
9
|
+
* what an unconfigured consumer gets, so a WRONG default on one branch is worse
|
|
10
|
+
* than no default at all. Every fallback this SDK ever removed named a host that
|
|
11
|
+
* was already dead. A generated file plus a gate is what makes this one different.
|
|
12
|
+
*
|
|
13
|
+
* Source: the operator's per-tier public CK API origin declaration, tier 'test'
|
|
14
|
+
*/
|
|
15
|
+
/** The tier this build of the SDK is published for. */
|
|
16
|
+
export declare const CROWDY_DEFAULT_TIER = "test";
|
|
17
|
+
/** The public CK API origin for that tier. */
|
|
18
|
+
export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.test.crowdedkingdoms.com";
|
|
19
|
+
/** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
|
|
20
|
+
export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.test.crowdedkingdoms.com";
|
|
21
|
+
/** The bare hostname, for callers that need to compare rather than dial. */
|
|
22
|
+
export declare const CROWDY_DEFAULT_HOST = "ck.test.crowdedkingdoms.com";
|
|
23
|
+
//# sourceMappingURL=default-origin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAEhF,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAE5E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED — do not edit. The operator tooling's
|
|
3
|
+
* `sync-client-origins.mjs --write --tier test` writes this file, and
|
|
4
|
+
* `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
|
|
5
|
+
* host that declaration does not carry. Regenerate; never hand-edit.
|
|
6
|
+
*
|
|
7
|
+
* THE DEFAULT IS LOAD-BEARING DURING A ROLLOUT, which is the opposite of how a
|
|
8
|
+
* default is usually thought about: while the branches are mid-migration this is
|
|
9
|
+
* what an unconfigured consumer gets, so a WRONG default on one branch is worse
|
|
10
|
+
* than no default at all. Every fallback this SDK ever removed named a host that
|
|
11
|
+
* was already dead. A generated file plus a gate is what makes this one different.
|
|
12
|
+
*
|
|
13
|
+
* Source: the operator's per-tier public CK API origin declaration, tier 'test'
|
|
14
|
+
*/
|
|
15
|
+
/** The tier this build of the SDK is published for. */
|
|
16
|
+
export const CROWDY_DEFAULT_TIER = 'test';
|
|
17
|
+
/** The public CK API origin for that tier. */
|
|
18
|
+
export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.test.crowdedkingdoms.com';
|
|
19
|
+
/** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
|
|
20
|
+
export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.test.crowdedkingdoms.com';
|
|
21
|
+
/** The bare hostname, for callers that need to compare rather than dial. */
|
|
22
|
+
export const CROWDY_DEFAULT_HOST = 'ck.test.crowdedkingdoms.com';
|
|
@@ -3580,7 +3580,7 @@ export type GameClientBootstrap = {
|
|
|
3580
3580
|
/** Current server version and the minimum client version the server accepts. Compare your build against minimumClientVersion before connecting; prompt the player to update if it is too old. */
|
|
3581
3581
|
versionInfo: ServerVersionInfo;
|
|
3582
3582
|
};
|
|
3583
|
-
/** The elected host user of a game (app). Election is deterministic across all
|
|
3583
|
+
/** The elected host user of a game (app). Election is deterministic across all game-api replicas: among actors that are still fresh (recently heartbeated), the user whose earliest actor was created first wins, with a uuid tiebreaker. Row lifecycle is owned by Buddy, the realtime runtime; liveness (updated_at) is owned by game-api's actorHeartbeat mutation. */
|
|
3584
3584
|
export type GameHost = {
|
|
3585
3585
|
__typename?: 'GameHost';
|
|
3586
3586
|
/** How many actors the host user currently owns in this app (always >= 1 when this object is returned). */
|
|
@@ -4508,7 +4508,7 @@ export type GraphQlServer = {
|
|
|
4508
4508
|
publicIp4: Maybe<Scalars['String']['output']>;
|
|
4509
4509
|
/** Public IPv6 address clients use to reach this server, if assigned. */
|
|
4510
4510
|
publicIp6: Maybe<Scalars['String']['output']>;
|
|
4511
|
-
/** UUID of the
|
|
4511
|
+
/** UUID of the Buddy realtime runtime instance this API server is paired with, if any. */
|
|
4512
4512
|
runtimeServerId: Maybe<Scalars['String']['output']>;
|
|
4513
4513
|
/** Current lifecycle state (see ServerState). activeGraphQLServers returns only ReadyForClients. */
|
|
4514
4514
|
status: ServerState;
|
|
@@ -7547,7 +7547,7 @@ export type Query = {
|
|
|
7547
7547
|
freePlayWindowInfo: FreePlayWindowInfo;
|
|
7548
7548
|
/** Single startup payload for browser game clients: the authenticated user, server/min-client version requirements, current UDP proxy status, realtime protocol details (subprotocol + subscription name), and the spatial send limits/constants (maxReplicationDistance, maxDecayRate, sequenceNumberModulo). Requires a bearer game token. Read-only: does not open a UDP proxy session. Call this once after login to initialize a play session. */
|
|
7549
7549
|
gameClientBootstrap: GameClientBootstrap;
|
|
7550
|
-
/** Returns the single elected host user for an app (game). Deterministic across all
|
|
7550
|
+
/** Returns the single elected host user for an app (game). Deterministic across all game-api replicas behind the LB: the user whose earliest still-connected actor row was created first wins, with a uuid tiebreaker. Returns null when no actors exist for the app. Stale actors (no recent actorHeartbeat) are excluded once HOST_ACTOR_FRESHNESS_SECONDS is enabled. Clients should poll; there is no host-change subscription in v1. */
|
|
7551
7551
|
gameHost: Maybe<GameHost>;
|
|
7552
7552
|
/** Read the best-known app-scoped number of active gameplay sessions across fresh non-Offline Buddy servers. This counts sessions, not actors or distinct users. FRESH is a complete fleet total; PARTIAL is only the supported-Buddy subset; UNAVAILABLE has no fresh observation. Partial/unavailable samples never create count-change revisions. Requires an app-scoped token for this exact app. */
|
|
7553
7553
|
gameModelActivePlayerCount: GameModelActivePlayerCountSnapshot;
|