@crowdedkingdoms/crowdyjs 18.38.0 → 18.39.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/MIGRATION.md +13 -0
- package/README.md +44 -39
- package/dist/bootstrap-rediscover.js +3 -3
- package/dist/client.js +1 -1
- package/dist/crowdy-client.js +3 -3
- package/dist/datacenter-redirect.d.ts +5 -1
- package/dist/datacenter-redirect.d.ts.map +1 -1
- package/dist/datacenter-redirect.js +8 -4
- package/dist/default-origin.d.ts +6 -6
- package/dist/default-origin.js +6 -6
- package/dist/domains/apps.d.ts +15 -13
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +12 -8
- package/dist/domains/billing.d.ts +4 -2
- package/dist/domains/billing.d.ts.map +1 -1
- package/dist/domains/billing.js +4 -2
- package/dist/domains/discovery.d.ts +5 -1
- package/dist/domains/discovery.d.ts.map +1 -1
- package/dist/domains/discovery.js +5 -3
- package/dist/domains/platform.d.ts +6 -2
- package/dist/domains/platform.d.ts.map +1 -1
- package/dist/domains/platform.js +4 -2
- package/dist/domains/portal.d.ts +6 -2
- package/dist/domains/portal.d.ts.map +1 -1
- package/dist/domains/portal.js +1 -1
- package/dist/generated/graphql-schema.d.ts +117 -58
- package/dist/generated/graphql-schema.d.ts.map +1 -1
- package/dist/generated/graphql-schema.js +4 -4
- package/dist/generated/graphql.d.ts +23 -9
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +10 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/realtime.js +2 -2
- package/dist/rediscover.d.ts +1 -1
- package/dist/rediscover.d.ts.map +1 -1
- package/dist/rediscover.js +5 -1
- package/package.json +1 -1
package/MIGRATION.md
CHANGED
|
@@ -120,6 +120,19 @@ super-admin's session). There is no SDK replacement.
|
|
|
120
120
|
`dev`'s SDL after #417 merged (`npm run schema:sync:paths -- --schema <that schema.gql>`, then
|
|
121
121
|
`npm run codegen`).
|
|
122
122
|
|
|
123
|
+
## 18.39.0: the Game API is now the Application API
|
|
124
|
+
|
|
125
|
+
Rename as you go; nothing breaks before January 1, 2027. Every result that named the Game API's URLs now carries
|
|
126
|
+
the Application API names beside the old ones:
|
|
127
|
+
|
|
128
|
+
| Was (deprecated) | Now |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `gameApiUrl`, `gameApiWsUrl` (mint results, discovery, `AppRoute`, datacenter moves) | `applicationApiUrl`, `applicationApiWsUrl` |
|
|
131
|
+
| `sharedGameApiUrl`, `sharedGameApiWsUrl` (`client.platform.config()`) | `sharedApplicationApiUrl`, `sharedApplicationApiWsUrl` |
|
|
132
|
+
|
|
133
|
+
The old properties hold the same values and are removed on January 1, 2027, when the Application API removes the
|
|
134
|
+
old GraphQL fields. This release needs Application API v2.85.0 or later.
|
|
135
|
+
|
|
123
136
|
## 18.38.0: choose the speakers each player receives
|
|
124
137
|
|
|
125
138
|
Nothing changes until you call it. With Buddy v0.49.0, `game.udp.setSpeakers({ voice, video })` tells the server
|
package/README.md
CHANGED
|
@@ -12,24 +12,29 @@ gameplay, minted per app through `client.portal`.
|
|
|
12
12
|
|
|
13
13
|
Start here:
|
|
14
14
|
|
|
15
|
-
- [SDK guide](https://docs.crowdedkingdoms.com/crowdyjs/readme) — the canonical
|
|
15
|
+
- [SDK guide](https://docs.dev.crowdedkingdoms.com/crowdyjs/readme) — the canonical
|
|
16
16
|
walkthrough of everything in this README.
|
|
17
|
-
- [Build a game](https://docs.crowdedkingdoms.com/build-a-game/intro) — a
|
|
17
|
+
- [Build a game](https://docs.dev.crowdedkingdoms.com/build-a-game/intro) — a
|
|
18
18
|
hands-on tutorial from sign-in to a playable voxel game.
|
|
19
|
-
- [Platform overview](https://docs.crowdedkingdoms.com/overview/client-workflow)
|
|
19
|
+
- [Platform overview](https://docs.dev.crowdedkingdoms.com/overview/client-workflow)
|
|
20
20
|
— how a client session flows through the platform.
|
|
21
21
|
|
|
22
22
|
## Install
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install @crowdedkingdoms/crowdyjs
|
|
25
|
+
npm install @crowdedkingdoms/crowdyjs@dev
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
This README is the `dev` branch's: it documents the release on the `dev` dist-tag
|
|
29
|
+
(`npm view @crowdedkingdoms/crowdyjs dist-tags`), and its links go to the dev docs site. A
|
|
30
|
+
plain `npm install` resolves `latest`, the production release, which has no `client.exec`.
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
**Server compatibility.** A release selects fields the Application API it was built against has,
|
|
33
|
+
so it needs that Application API or newer; promote the Application API before the SDK on each tier.
|
|
34
|
+
|
|
35
|
+
| CrowdyJS | Needs the Application API (ck-api) |
|
|
32
36
|
| --- | --- |
|
|
37
|
+
| 18.39.0 | v2.85.0 or later (selects `applicationApiUrl`, `applicationApiWsUrl` and `platformConfig`'s `sharedApplicationApi*`; the `gameApi*` names stay as deprecated aliases until January 1, 2027) |
|
|
33
38
|
| 18.33.0 | v2.73.0 or later (exec's mod builds, mods and CLIENT halves select `studioProjectId` and `studioRevision`; `exec.modClientStarter`, `crowdyStudio.links`) |
|
|
34
39
|
| 18.32.0 | v2.70.0 or later (`chunks.get` and `chunks.byDistance` select `Chunk.voxelsUpdatedAt`) |
|
|
35
40
|
| 18.31.1 | as 18.31.0 |
|
|
@@ -206,8 +211,8 @@ await identity.auth.login({ email, password }); // or register / magic link / so
|
|
|
206
211
|
|
|
207
212
|
const t = await identity.portal.mintAppToken(appId);
|
|
208
213
|
const game = createCrowdyClient({
|
|
209
|
-
httpUrl: t.
|
|
210
|
-
wsUrl: t.
|
|
214
|
+
httpUrl: t.applicationApiUrl!,
|
|
215
|
+
wsUrl: t.applicationApiWsUrl!,
|
|
211
216
|
tokenStore: new BrowserLocalStorageTokenStore('crowdyjs:app:' + appId),
|
|
212
217
|
});
|
|
213
218
|
game.setToken(t.token);
|
|
@@ -218,8 +223,8 @@ Game-to-game routes through Studio's hosted page for a fresh per-game token.
|
|
|
218
223
|
|
|
219
224
|
Notes:
|
|
220
225
|
|
|
221
|
-
- `portal.mintAppToken(appId)` returns the token plus `
|
|
222
|
-
`
|
|
226
|
+
- `portal.mintAppToken(appId)` returns the token plus `applicationApiUrl` /
|
|
227
|
+
`applicationApiWsUrl` / `expiresAt`; it does **not** store the token on the identity
|
|
223
228
|
client — set it on the per-game client.
|
|
224
229
|
- Each client's `AuthState` is observed by both its HTTP client and its
|
|
225
230
|
realtime socket, so HTTP and WebSocket auth never drift within a client.
|
|
@@ -229,8 +234,8 @@ Notes:
|
|
|
229
234
|
- Use `client.auth.setToken(token)` to seed a token externally (e.g. when
|
|
230
235
|
restoring auth from a non-default storage).
|
|
231
236
|
|
|
232
|
-
Deeper reading: [Portals & app-scoped tokens](https://docs.crowdedkingdoms.com/management-api/portals-and-app-tokens)
|
|
233
|
-
and [Sign in](https://docs.crowdedkingdoms.com/management-api/authentication).
|
|
237
|
+
Deeper reading: [Portals & app-scoped tokens](https://docs.dev.crowdedkingdoms.com/management-api/portals-and-app-tokens)
|
|
238
|
+
and [Sign in](https://docs.dev.crowdedkingdoms.com/management-api/authentication).
|
|
234
239
|
|
|
235
240
|
### Org-managed players
|
|
236
241
|
|
|
@@ -262,7 +267,7 @@ const res = await fetch('https://ck.dev.crowdedkingdoms.com/graphql', {
|
|
|
262
267
|
headers: { 'content-type': 'application/json', authorization: `Bearer ${process.env.CK_ORG_TOKEN}` },
|
|
263
268
|
body: JSON.stringify({
|
|
264
269
|
query: `mutation($i: MintManagedPlayerTokenInput!) { mintManagedPlayerToken(input: $i) {
|
|
265
|
-
token gameTokenId appId expiresAt
|
|
270
|
+
token gameTokenId appId expiresAt applicationApiUrl applicationApiWsUrl discoveryUrl launchUrl } }`,
|
|
266
271
|
variables: {
|
|
267
272
|
i: {
|
|
268
273
|
appId,
|
|
@@ -282,7 +287,7 @@ const { data } = await res.json();
|
|
|
282
287
|
```ts
|
|
283
288
|
// the player's device
|
|
284
289
|
const access = await fetch('/api/crowded-kingdoms/token').then((r) => r.json());
|
|
285
|
-
const game = createCrowdyClient({ httpUrl: access.
|
|
290
|
+
const game = createCrowdyClient({ httpUrl: access.applicationApiUrl, wsUrl: access.applicationApiWsUrl });
|
|
286
291
|
game.portal.adoptAppToken(access); // refuses an org token by mistake
|
|
287
292
|
game.world(appId).subscribe({ actorUpdate: (n) => { /* ... */ } });
|
|
288
293
|
```
|
|
@@ -341,7 +346,7 @@ surface the error and retry `game.udp.connect()` instead of rotating again.
|
|
|
341
346
|
`game.portal.refresh()` remains available for clients with no active UDP
|
|
342
347
|
lifecycle to preserve. A **native (direct-UDP) client** should pass the server it
|
|
343
348
|
is connected to — `game.portal.refresh({ ip4, clientPort })`, the pair
|
|
344
|
-
`serverWithLeastClients` handed it — so the
|
|
349
|
+
`serverWithLeastClients` handed it — so the Application API (v1.83.7+) authorizes the
|
|
345
350
|
new token on that same Buddy and answers `authorizedServer`: when it is set,
|
|
346
351
|
keep the socket and sign with the new token; when it is null, place again with
|
|
347
352
|
`serverWithLeastClients`. A Buddy silently drops datagrams for a token it was
|
|
@@ -502,7 +507,7 @@ not from an untrusted browser.
|
|
|
502
507
|
|
|
503
508
|
## Per-app routing
|
|
504
509
|
|
|
505
|
-
`mintAppToken` returns `
|
|
510
|
+
`mintAppToken` returns `applicationApiUrl` / `applicationApiWsUrl`, so you rarely need a
|
|
506
511
|
separate routing query. When you do (e.g. pre-flight discovery), query the
|
|
507
512
|
app's routing fields:
|
|
508
513
|
|
|
@@ -512,22 +517,22 @@ query AppForRouting($appId: BigInt!) {
|
|
|
512
517
|
appId
|
|
513
518
|
splitMode
|
|
514
519
|
deploymentTarget
|
|
515
|
-
|
|
520
|
+
applicationApiUrl
|
|
516
521
|
}
|
|
517
522
|
}
|
|
518
523
|
```
|
|
519
524
|
|
|
520
|
-
`
|
|
525
|
+
`applicationApiUrl` is populated for both dedicated (`splitMode`) and shared
|
|
521
526
|
(`deploymentTarget: "shared"`) apps. When it's set, build a second
|
|
522
|
-
`CrowdyClient` with `httpUrl:
|
|
527
|
+
`CrowdyClient` with `httpUrl: applicationApiUrl` (and the matching `wsUrl`) holding
|
|
523
528
|
that app's app-scoped token, then drive gameplay through that client. Apps
|
|
524
|
-
with no `
|
|
525
|
-
configured. See [Loading an app's
|
|
529
|
+
with no `applicationApiUrl` keep working against the default `httpUrl` you
|
|
530
|
+
configured. See [Loading an app's Application API](https://docs.dev.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
|
|
526
531
|
|
|
527
532
|
## Realtime notifications
|
|
528
533
|
|
|
529
534
|
`subscribe` takes the handlers **and a required `appId`** (second argument).
|
|
530
|
-
The
|
|
535
|
+
The Application API scopes the realtime session to that app and rejects an
|
|
531
536
|
app-agnostic subscription with a `RealtimeConnectionEvent`
|
|
532
537
|
(`code: 'APP_ID_REQUIRED'`); a missing or invalid gameplay token is rejected
|
|
533
538
|
with `AUTH_REQUIRED`. Run one client per app (each holding that app's
|
|
@@ -650,8 +655,8 @@ retries run out and then sits there, connected to nothing.
|
|
|
650
655
|
const bootstrap = await client.udp.gameClientBootstrap(appId);
|
|
651
656
|
|
|
652
657
|
const client = createCrowdyClient({
|
|
653
|
-
httpUrl: bootstrap.
|
|
654
|
-
wsUrl: bootstrap.
|
|
658
|
+
httpUrl: bootstrap.applicationApiUrl,
|
|
659
|
+
wsUrl: bootstrap.applicationApiWsUrl,
|
|
655
660
|
realtime: {
|
|
656
661
|
// The LOAD BALANCER, not the instance above. A discovery URL that dies with
|
|
657
662
|
// the instance it exists to replace is worse than none.
|
|
@@ -975,7 +980,7 @@ reach your bundle. Reads are synchronous snapshots and writes happen on
|
|
|
975
980
|
WebSocket events (not `requestAnimationFrame`), so render loops read freely
|
|
976
981
|
and a backgrounded tab keeps ingesting updates; pass `workerTicker()` to also
|
|
977
982
|
keep timer-driven sends at full rate while hidden. See the
|
|
978
|
-
[World Stores guide](https://docs.crowdedkingdoms.com/crowdyjs/stores).
|
|
983
|
+
[World Stores guide](https://docs.dev.crowdedkingdoms.com/crowdyjs/stores).
|
|
979
984
|
|
|
980
985
|
## Game Kit
|
|
981
986
|
|
|
@@ -1053,7 +1058,7 @@ The protocol is held to ck-exec's golden record of the starters
|
|
|
1053
1058
|
(`test/unit/fixtures/kit-protocol.json`): every module call and topic in it is replayed in
|
|
1054
1059
|
`test/unit/game-kit.test.mjs`. The blueprints, `kit.deploy`, the engines and the model-backed
|
|
1055
1060
|
helpers went with the game model in 18.0.0; the hub modules replace them. See the
|
|
1056
|
-
[Game Kit docs](https://docs.crowdedkingdoms.com/game-kit/intro) and
|
|
1061
|
+
[Game Kit docs](https://docs.dev.crowdedkingdoms.com/game-kit/intro) and
|
|
1057
1062
|
[MIGRATION.md](MIGRATION.md).
|
|
1058
1063
|
|
|
1059
1064
|
## ck-exec
|
|
@@ -1073,12 +1078,12 @@ const stop = await exec.subscribe('arena', 'm1', 'hp', (push) => {
|
|
|
1073
1078
|
exec.onReconnect((host) => console.log('moved to', host));
|
|
1074
1079
|
```
|
|
1075
1080
|
|
|
1076
|
-
- `connect` asks the
|
|
1081
|
+
- `connect` asks the Application API for a host (`execConnect`) and opens a WebSocket to its gateway.
|
|
1077
1082
|
With `nodeType` and `key`, the player lands on the host that runs that instance. On runtimes
|
|
1078
1083
|
without a global `WebSocket` (Node before 22), pass one: `{ WebSocket }` from the `ws` package.
|
|
1079
1084
|
- The connect token rides in the gateway URL, so `connect` dials only a gateway
|
|
1080
|
-
`execGatewayRefusal(
|
|
1081
|
-
the
|
|
1085
|
+
`execGatewayRefusal(applicationApiUrl, gatewayUrl)` passes: `wss:` when the Application API is `https:`, and on
|
|
1086
|
+
the Application API's estate or the platform's (a loopback Application API may name a loopback gateway, as
|
|
1082
1087
|
ck-exec's local cluster does). Any other is refused `Unavailable` without being dialed (18.1.0).
|
|
1083
1088
|
- A gateway that refuses the connect token answers the upgrade `HTTP 401` with its reason. Under
|
|
1084
1089
|
Node's `ws` package `connect` throws `Denied` with that reason; a browser cannot read a refused
|
|
@@ -1117,7 +1122,7 @@ Integers above 2^53 decode as `number` and lose precision unless you pass
|
|
|
1117
1122
|
`{ decode: { useBigInt64: true } }`. A call's whole numbers outside 32 bits (a timestamp in
|
|
1118
1123
|
milliseconds, a player id) go out as 64-bit integers (18.11.0; before, as floats, which a
|
|
1119
1124
|
hub's integer fields refuse). The wire format is in the
|
|
1120
|
-
[ck-exec docs](https://docs.crowdedkingdoms.com/exec/intro).
|
|
1125
|
+
[ck-exec docs](https://docs.dev.crowdedkingdoms.com/exec/intro).
|
|
1121
1126
|
|
|
1122
1127
|
### A mod's CLIENT half
|
|
1123
1128
|
|
|
@@ -1188,7 +1193,7 @@ counts what was dropped); `invoke` sends at most 256 KiB each way and is refused
|
|
|
1188
1193
|
module is not running. `NOT_FOUND` holds a CLIENT half back 15 s and `RATE_LIMITED` 60 s. The
|
|
1189
1194
|
grid's owner is asked about their own CLIENT halves like anyone; answer yes in `confirm` when
|
|
1190
1195
|
`prompt.authorId` is the player. See
|
|
1191
|
-
[CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves).
|
|
1196
|
+
[CLIENT halves](https://docs.dev.crowdedkingdoms.com/exec/client-halves).
|
|
1192
1197
|
|
|
1193
1198
|
## Hosting your game
|
|
1194
1199
|
|
|
@@ -1201,7 +1206,7 @@ set response headers. Then, in Studio, open the app's
|
|
|
1201
1206
|
origin as the app's **Launch URL**. The redirect URI is what admits the origin to CORS
|
|
1202
1207
|
and to the hosted sign-in return, so `portal.signIn` works there as in the
|
|
1203
1208
|
[Quick start](#quick-start).
|
|
1204
|
-
[Host your game](https://docs.crowdedkingdoms.com/build-a-game/host-your-game)
|
|
1209
|
+
[Host your game](https://docs.dev.crowdedkingdoms.com/build-a-game/host-your-game)
|
|
1205
1210
|
has the requirements and recipes.
|
|
1206
1211
|
|
|
1207
1212
|
`client.hosting`, `uploadPublishFiles`, `publishDirectory` and `manifestForDirectory`
|
|
@@ -1297,8 +1302,8 @@ CLIENT project needs ck-api `v2.25.1` or later. A CLIENT crate still on the lega
|
|
|
1297
1302
|
`mountCrowdyStudio` and the controller take `mods: client.exec`. Crowdy Studio runs nothing
|
|
1298
1303
|
on legacy player compute since 18.0.0.
|
|
1299
1304
|
|
|
1300
|
-
See [CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.crowdedkingdoms.com/exec/mods)
|
|
1301
|
-
and [Embed Crowdy Studio in your game](https://docs.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
|
|
1305
|
+
See [CLIENT halves](https://docs.dev.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.dev.crowdedkingdoms.com/exec/mods)
|
|
1306
|
+
and [Embed Crowdy Studio in your game](https://docs.dev.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
|
|
1302
1307
|
|
|
1303
1308
|
### The Studio agent (DeepSeek Harness in the browser)
|
|
1304
1309
|
|
|
@@ -1490,8 +1495,8 @@ CROWDY_TEST_APP_ID='78221653114368' \
|
|
|
1490
1495
|
**`CROWDY_HTTP_URL` is the ENTRY origin, not the gameplay origin.** Point it at
|
|
1491
1496
|
the shared multivalue name (`ck.<tier>…`), the same one a cold client resolves.
|
|
1492
1497
|
The harness then does what the SDK is built to do: sign in and mint against the
|
|
1493
|
-
entry origin, and build every gameplay client on the `
|
|
1494
|
-
`
|
|
1498
|
+
entry origin, and build every gameplay client on the `applicationApiUrl` /
|
|
1499
|
+
`applicationApiWsUrl` the mint returns, threading `discoveryUrl` into `realtime` so
|
|
1495
1500
|
instance loss is recoverable.
|
|
1496
1501
|
|
|
1497
1502
|
Do not point it at a single datacenter to "make the tests pass". That was the
|
|
@@ -1554,7 +1559,7 @@ no other repositories and no network access required:
|
|
|
1554
1559
|
`src/generated/graphql-schema.ts`, the generated schema types.
|
|
1555
1560
|
|
|
1556
1561
|
Schema refresh is explicit, from the published
|
|
1557
|
-
[SDL](https://docs.crowdedkingdoms.com/schema/game-api.graphql):
|
|
1562
|
+
[SDL](https://docs.dev.crowdedkingdoms.com/schema/game-api.graphql):
|
|
1558
1563
|
|
|
1559
1564
|
```bash
|
|
1560
1565
|
npm run schema:sync:prod
|
|
@@ -1574,7 +1579,7 @@ refresh them from an explicitly supplied source:
|
|
|
1574
1579
|
`npm run authoring-index:drift -- --source <exporter-json> [--write]`, then
|
|
1575
1580
|
`npm run authoring-index:generate`.
|
|
1576
1581
|
- The agent tool-descriptor fixture:
|
|
1577
|
-
`npm run agent-descriptors:drift -- --source <
|
|
1582
|
+
`npm run agent-descriptors:drift -- --source <application-api-fixture>`; every
|
|
1578
1583
|
build re-checks the digests.
|
|
1579
1584
|
|
|
1580
1585
|
## Migration
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* fresh `gameApiUrl`/`gameApiWsUrl`.
|
|
13
13
|
*/
|
|
14
14
|
const BOOTSTRAP_QUERY = `query CrowdyJsRediscover($appId: BigInt!) {
|
|
15
|
-
gameClientBootstrap(appId: $appId) {
|
|
15
|
+
gameClientBootstrap(appId: $appId) { applicationApiUrl applicationApiWsUrl discoveryUrl }
|
|
16
16
|
}`;
|
|
17
17
|
function graphqlEndpoint(origin) {
|
|
18
18
|
const trimmed = stripTrailingSlashes(origin);
|
|
@@ -57,14 +57,14 @@ export function createBootstrapRediscover(options) {
|
|
|
57
57
|
}
|
|
58
58
|
const body = (await res.json());
|
|
59
59
|
const found = body?.data?.gameClientBootstrap;
|
|
60
|
-
if (!found?.
|
|
60
|
+
if (!found?.applicationApiUrl && !found?.applicationApiWsUrl) {
|
|
61
61
|
// An older server that does not publish these fields yet. Say so once
|
|
62
62
|
// rather than looping on an endpoint that can never answer.
|
|
63
63
|
options.logger?.warn?.('Re-discovery returned no endpoint; this server may predate ' +
|
|
64
64
|
'gameClientBootstrap.discoveryUrl (ck-api v1.20.0).');
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
|
-
return { httpUrl: found.
|
|
67
|
+
return { httpUrl: found.applicationApiUrl, wsUrl: found.applicationApiWsUrl };
|
|
68
68
|
}
|
|
69
69
|
catch (error) {
|
|
70
70
|
// Never fatal: returning null leaves the client on its current endpoint
|
package/dist/client.js
CHANGED
|
@@ -174,7 +174,7 @@ export class GraphQLClient {
|
|
|
174
174
|
if (!moved)
|
|
175
175
|
throw error;
|
|
176
176
|
this.logger.info?.(`moved to ${move.appDatacenter ?? 'the app\u2019s datacenter'} at ` +
|
|
177
|
-
`${move.
|
|
177
|
+
`${move.applicationApiUrl} and retrying`);
|
|
178
178
|
return await this.attempt(query, variables, options);
|
|
179
179
|
}
|
|
180
180
|
}
|
package/dist/crowdy-client.js
CHANGED
|
@@ -172,7 +172,7 @@ export class CrowdyClient {
|
|
|
172
172
|
// instance-level version of that split, because the datacenter left behind
|
|
173
173
|
// holds none of the app's shards and would refuse the subscription too.
|
|
174
174
|
this.graphql.setWrongDatacenterHandler((move) => {
|
|
175
|
-
const endpoint = toGraphqlEndpoint(move.
|
|
175
|
+
const endpoint = toGraphqlEndpoint(move.applicationApiUrl, 'graphql') ?? move.applicationApiUrl;
|
|
176
176
|
if (endpoint === this.graphql.getEndpoint()) {
|
|
177
177
|
// Already there. Returning false stops the transport retrying, because a
|
|
178
178
|
// retry to the same instance is refused identically and a handler that
|
|
@@ -181,8 +181,8 @@ export class CrowdyClient {
|
|
|
181
181
|
}
|
|
182
182
|
this.graphql.setEndpoint(endpoint);
|
|
183
183
|
this.realtime.moveToDatacenter({
|
|
184
|
-
httpUrl: move.
|
|
185
|
-
wsUrl: toGraphqlEndpoint(move.
|
|
184
|
+
httpUrl: move.applicationApiUrl,
|
|
185
|
+
wsUrl: toGraphqlEndpoint(move.applicationApiWsUrl, 'graphql') ?? null,
|
|
186
186
|
datacenter: move.appDatacenter,
|
|
187
187
|
});
|
|
188
188
|
return true;
|
|
@@ -19,8 +19,12 @@
|
|
|
19
19
|
/** Where the server says this client should go instead. */
|
|
20
20
|
export interface DatacenterMove {
|
|
21
21
|
/** Absolute HTTP origin or GraphQL URL of the app's own datacenter. */
|
|
22
|
-
|
|
22
|
+
applicationApiUrl: string;
|
|
23
23
|
/** Matching websocket URL, when the server named one. */
|
|
24
|
+
applicationApiWsUrl?: string;
|
|
25
|
+
/** @deprecated Use applicationApiUrl: the Game API is now the Application API. Removed on January 1, 2027. */
|
|
26
|
+
gameApiUrl: string;
|
|
27
|
+
/** @deprecated Use applicationApiWsUrl: the Game API is now the Application API. Removed on January 1, 2027. */
|
|
24
28
|
gameApiWsUrl?: string;
|
|
25
29
|
/** The app the move is about, for logging. */
|
|
26
30
|
appId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datacenter-redirect.d.ts","sourceRoot":"","sources":["../src/datacenter-redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,
|
|
1
|
+
{"version":3,"file":"datacenter-redirect.d.ts","sourceRoot":"","sources":["../src/datacenter-redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,8GAA8G;IAC9G,UAAU,EAAE,MAAM,CAAC;IACnB,gHAAgH;IAChH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,SAAS;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC7C;AAMD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,GAClC,cAAc,GAAG,IAAI,CAuBvB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,CAAC,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,GAAG,SAAS,GACnE,cAAc,GAAG,IAAI,CAMvB"}
|
|
@@ -31,15 +31,19 @@ export function moveFromError(error) {
|
|
|
31
31
|
return null;
|
|
32
32
|
if (extensions.code !== WRONG_DATACENTER_CODE)
|
|
33
33
|
return null;
|
|
34
|
-
|
|
34
|
+
// An Application API older than v2.85.0 names only the gameApi* keys.
|
|
35
|
+
const applicationApiUrl = asString(extensions.applicationApiUrl) ?? asString(extensions.gameApiUrl);
|
|
35
36
|
// No endpoint means no move. See the note at the top: this is a contract
|
|
36
37
|
// violation rather than an ordinary case, and guessing would send the client
|
|
37
38
|
// somewhere it was not told to go.
|
|
38
|
-
if (!
|
|
39
|
+
if (!applicationApiUrl)
|
|
39
40
|
return null;
|
|
41
|
+
const applicationApiWsUrl = asString(extensions.applicationApiWsUrl) ?? asString(extensions.gameApiWsUrl);
|
|
40
42
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
applicationApiUrl,
|
|
44
|
+
applicationApiWsUrl,
|
|
45
|
+
gameApiUrl: applicationApiUrl,
|
|
46
|
+
gameApiWsUrl: applicationApiWsUrl,
|
|
43
47
|
appId: asString(extensions.appId),
|
|
44
48
|
appDatacenter: asString(extensions.appDatacenter),
|
|
45
49
|
};
|
package/dist/default-origin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED — do not edit. The operator tooling's
|
|
3
|
-
* `sync-client-origins.mjs --write --tier
|
|
3
|
+
* `sync-client-origins.mjs --write --tier test` writes this file, and
|
|
4
4
|
* `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
|
|
5
5
|
* host that declaration does not carry. Regenerate; never hand-edit.
|
|
6
6
|
*
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
* than no default at all. Every fallback this SDK ever removed named a host that
|
|
11
11
|
* was already dead. A generated file plus a gate is what makes this one different.
|
|
12
12
|
*
|
|
13
|
-
* Source: the operator's per-tier public CK API origin declaration, tier '
|
|
13
|
+
* Source: the operator's per-tier public CK API origin declaration, tier 'test'
|
|
14
14
|
*/
|
|
15
15
|
/** The tier this build of the SDK is published for. */
|
|
16
|
-
export declare const CROWDY_DEFAULT_TIER = "
|
|
16
|
+
export declare const CROWDY_DEFAULT_TIER = "test";
|
|
17
17
|
/** The public CK API origin for that tier. */
|
|
18
|
-
export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.
|
|
18
|
+
export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.test.crowdedkingdoms.com";
|
|
19
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.
|
|
20
|
+
export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.test.crowdedkingdoms.com";
|
|
21
21
|
/** The bare hostname, for callers that need to compare rather than dial. */
|
|
22
|
-
export declare const CROWDY_DEFAULT_HOST = "ck.
|
|
22
|
+
export declare const CROWDY_DEFAULT_HOST = "ck.test.crowdedkingdoms.com";
|
|
23
23
|
//# sourceMappingURL=default-origin.d.ts.map
|
package/dist/default-origin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED — do not edit. The operator tooling's
|
|
3
|
-
* `sync-client-origins.mjs --write --tier
|
|
3
|
+
* `sync-client-origins.mjs --write --tier test` writes this file, and
|
|
4
4
|
* `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
|
|
5
5
|
* host that declaration does not carry. Regenerate; never hand-edit.
|
|
6
6
|
*
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* than no default at all. Every fallback this SDK ever removed named a host that
|
|
11
11
|
* was already dead. A generated file plus a gate is what makes this one different.
|
|
12
12
|
*
|
|
13
|
-
* Source: the operator's per-tier public CK API origin declaration, tier '
|
|
13
|
+
* Source: the operator's per-tier public CK API origin declaration, tier 'test'
|
|
14
14
|
*/
|
|
15
15
|
/** The tier this build of the SDK is published for. */
|
|
16
|
-
export const CROWDY_DEFAULT_TIER = '
|
|
16
|
+
export const CROWDY_DEFAULT_TIER = 'test';
|
|
17
17
|
/** The public CK API origin for that tier. */
|
|
18
|
-
export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.
|
|
18
|
+
export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.test.crowdedkingdoms.com';
|
|
19
19
|
/** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
|
|
20
|
-
export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.
|
|
20
|
+
export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.test.crowdedkingdoms.com';
|
|
21
21
|
/** The bare hostname, for callers that need to compare rather than dial. */
|
|
22
|
-
export const CROWDY_DEFAULT_HOST = 'ck.
|
|
22
|
+
export const CROWDY_DEFAULT_HOST = 'ck.test.crowdedkingdoms.com';
|
package/dist/domains/apps.d.ts
CHANGED
|
@@ -9,22 +9,24 @@ export interface AppRoute {
|
|
|
9
9
|
/** Numeric id of the app (`BigInt` as a decimal string). */
|
|
10
10
|
appId: string;
|
|
11
11
|
/**
|
|
12
|
-
* `true` when the app's runtime data lives in a dedicated per-tenant
|
|
13
|
-
* database rather than the shared
|
|
12
|
+
* `true` when the app's runtime data lives in a dedicated per-tenant Application API
|
|
13
|
+
* database rather than the shared one. Used together with `applicationApiUrl` to
|
|
14
14
|
* route gameplay calls.
|
|
15
15
|
*/
|
|
16
16
|
splitMode: boolean;
|
|
17
17
|
/**
|
|
18
18
|
* Where the app runs: `'none'` (draft / not deployed), `'shared'` (the shared
|
|
19
|
-
*
|
|
19
|
+
* Application API), or `'dedicated'` (a provisioned per-tenant environment). `null`
|
|
20
20
|
* until the schema/codegen expose it.
|
|
21
21
|
*/
|
|
22
22
|
deploymentTarget: string | null;
|
|
23
23
|
/**
|
|
24
|
-
* The
|
|
25
|
-
* (split-mode) and shared-environment apps. When non-null, build a
|
|
26
|
-
*
|
|
24
|
+
* The Application API base URL to route gameplay to. Set for BOTH dedicated
|
|
25
|
+
* (split-mode) and shared-environment apps. When non-null, build a client
|
|
26
|
+
* against it; when `null`, fall back to the constructor `httpUrl`.
|
|
27
27
|
*/
|
|
28
|
+
applicationApiUrl: string | null;
|
|
29
|
+
/** @deprecated Use applicationApiUrl: the Game API is now the Application API. Removed on January 1, 2027. */
|
|
28
30
|
gameApiUrl: string | null;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
@@ -55,11 +57,11 @@ export type AppRecordingState = NonNullable<AppRecordingQuery['app']>['recording
|
|
|
55
57
|
* await base.auth.login({ email, password });
|
|
56
58
|
*
|
|
57
59
|
* const route = await base.apps.routeFor(appId);
|
|
58
|
-
* if (route.
|
|
60
|
+
* if (route.applicationApiUrl) {
|
|
59
61
|
* // route gameplay to the app's resolved game-api endpoint
|
|
60
62
|
* const perAppClient = createCrowdyClient({
|
|
61
|
-
* httpUrl: route.
|
|
62
|
-
* wsUrl: route.
|
|
63
|
+
* httpUrl: route.applicationApiUrl,
|
|
64
|
+
* wsUrl: route.applicationApiUrl.replace(/^http/, 'ws'),
|
|
63
65
|
* tokenStore: base.session.tokenStore,
|
|
64
66
|
* });
|
|
65
67
|
* }
|
|
@@ -155,14 +157,14 @@ export declare class AppsAPI {
|
|
|
155
157
|
myApps(): Promise<MyAppsQuery['myApps']>;
|
|
156
158
|
/**
|
|
157
159
|
* Convenience wrapper over {@link app} that returns just the {@link AppRoute}
|
|
158
|
-
* routing tuple for an app — i.e. which
|
|
159
|
-
* the app row is missing or the API does not expose the split-mode fields yet,
|
|
160
|
+
* routing tuple for an app — i.e. which Application API endpoint should serve it.
|
|
161
|
+
* If the app row is missing or the API does not expose the split-mode fields yet,
|
|
160
162
|
* returns a safe default (`{ appId, splitMode: false, deploymentTarget: null,
|
|
161
|
-
*
|
|
163
|
+
* applicationApiUrl: null }`) so the caller keeps using the legacy single-endpoint
|
|
162
164
|
* deployment.
|
|
163
165
|
*
|
|
164
166
|
* @param appId - Numeric id of the app (`BigInt` as a decimal string).
|
|
165
|
-
* @returns The {@link AppRoute}; route gameplay to `
|
|
167
|
+
* @returns The {@link AppRoute}; route gameplay to `applicationApiUrl` when non-null,
|
|
166
168
|
* otherwise fall back to the constructor `httpUrl`.
|
|
167
169
|
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` (it calls {@link app} under
|
|
168
170
|
* the hood).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/domains/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAkBL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,KAAK,QAAQ,EAEb,KAAK,cAAc,EAEnB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAE9B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,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11 +5,14 @@ function appRouteFromAppRow(row) {
|
|
|
5
5
|
const r = row;
|
|
6
6
|
if (typeof r.appId !== 'string')
|
|
7
7
|
return null;
|
|
8
|
+
const selected = r.applicationApiUrl ?? r.gameApiUrl;
|
|
9
|
+
const url = typeof selected === 'string' && selected ? selected : null;
|
|
8
10
|
return {
|
|
9
11
|
appId: r.appId,
|
|
10
12
|
splitMode: typeof r.splitMode === 'boolean' ? r.splitMode : false,
|
|
11
13
|
deploymentTarget: typeof r.deploymentTarget === 'string' ? r.deploymentTarget : null,
|
|
12
|
-
|
|
14
|
+
applicationApiUrl: url,
|
|
15
|
+
gameApiUrl: url,
|
|
13
16
|
};
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
@@ -34,11 +37,11 @@ function appRouteFromAppRow(row) {
|
|
|
34
37
|
* await base.auth.login({ email, password });
|
|
35
38
|
*
|
|
36
39
|
* const route = await base.apps.routeFor(appId);
|
|
37
|
-
* if (route.
|
|
40
|
+
* if (route.applicationApiUrl) {
|
|
38
41
|
* // route gameplay to the app's resolved game-api endpoint
|
|
39
42
|
* const perAppClient = createCrowdyClient({
|
|
40
|
-
* httpUrl: route.
|
|
41
|
-
* wsUrl: route.
|
|
43
|
+
* httpUrl: route.applicationApiUrl,
|
|
44
|
+
* wsUrl: route.applicationApiUrl.replace(/^http/, 'ws'),
|
|
42
45
|
* tokenStore: base.session.tokenStore,
|
|
43
46
|
* });
|
|
44
47
|
* }
|
|
@@ -177,14 +180,14 @@ export class AppsAPI {
|
|
|
177
180
|
}
|
|
178
181
|
/**
|
|
179
182
|
* Convenience wrapper over {@link app} that returns just the {@link AppRoute}
|
|
180
|
-
* routing tuple for an app — i.e. which
|
|
181
|
-
* the app row is missing or the API does not expose the split-mode fields yet,
|
|
183
|
+
* routing tuple for an app — i.e. which Application API endpoint should serve it.
|
|
184
|
+
* If the app row is missing or the API does not expose the split-mode fields yet,
|
|
182
185
|
* returns a safe default (`{ appId, splitMode: false, deploymentTarget: null,
|
|
183
|
-
*
|
|
186
|
+
* applicationApiUrl: null }`) so the caller keeps using the legacy single-endpoint
|
|
184
187
|
* deployment.
|
|
185
188
|
*
|
|
186
189
|
* @param appId - Numeric id of the app (`BigInt` as a decimal string).
|
|
187
|
-
* @returns The {@link AppRoute}; route gameplay to `
|
|
190
|
+
* @returns The {@link AppRoute}; route gameplay to `applicationApiUrl` when non-null,
|
|
188
191
|
* otherwise fall back to the constructor `httpUrl`.
|
|
189
192
|
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` (it calls {@link app} under
|
|
190
193
|
* the hood).
|
|
@@ -195,6 +198,7 @@ export class AppsAPI {
|
|
|
195
198
|
appId,
|
|
196
199
|
splitMode: false,
|
|
197
200
|
deploymentTarget: null,
|
|
201
|
+
applicationApiUrl: null,
|
|
198
202
|
gameApiUrl: null,
|
|
199
203
|
});
|
|
200
204
|
}
|
|
@@ -59,13 +59,15 @@ export declare class BillingAPI {
|
|
|
59
59
|
*/
|
|
60
60
|
appBudgets(orgId: string): Promise<AppBudgetsQuery['appBudgets']>;
|
|
61
61
|
/**
|
|
62
|
-
* Set (or clear) an app's monthly spend cap.
|
|
62
|
+
* Set (or clear) an app's monthly spend cap. Once the app's spend this calendar
|
|
63
|
+
* month (UTC) reaches it, the platform pauses the app (`spend_cap`) until the month
|
|
64
|
+
* ends or the cap is raised (Application API v2.84.0). Requires the `manage_billing`
|
|
63
65
|
* app permission.
|
|
64
66
|
*
|
|
65
67
|
* @param orgId - Numeric org id.
|
|
66
68
|
* @param appId - Numeric app id.
|
|
67
69
|
* @param monthlyLimitCents - Monthly cap in minor currency units (decimal
|
|
68
|
-
* string); `"0"`
|
|
70
|
+
* string); `"0"` removes the cap.
|
|
69
71
|
* @returns The updated app budget.
|
|
70
72
|
*/
|
|
71
73
|
setAppBudget(orgId: string, appId: string, monthlyLimitCents: string): Promise<SetAppBudgetMutation['setAppBudget']>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/domains/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAOL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,iCAAiC,EACtC,KAAK,0CAA0C,EAC/C,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAE/C;;;;;;;;OAQG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAK/C;;;;;;;OAOG;IACG,kBAAkB,CACtB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAC7C,OAAO,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;IASzD;;;;;;;OAOG;IACG,SAAS,CACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAQvC;;;;;;OAMG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAKvE
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/domains/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAOL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,iCAAiC,EACtC,KAAK,0CAA0C,EAC/C,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAE/C;;;;;;;;OAQG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAK/C;;;;;;;OAOG;IACG,kBAAkB,CACtB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAC7C,OAAO,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;IASzD;;;;;;;OAOG;IACG,SAAS,CACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAQvC;;;;;;OAMG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAKvE;;;;;;;;;;;OAWG;IACG,YAAY,CAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAShD;;;;;;;;OAQG;IACG,4BAA4B,CAChC,IAAI,EAAE,0CAA0C,GAC/C,OAAO,CACR,iCAAiC,CAAC,8BAA8B,CAAC,CAClE;CAWF"}
|
package/dist/domains/billing.js
CHANGED
|
@@ -75,13 +75,15 @@ export class BillingAPI {
|
|
|
75
75
|
return data.appBudgets;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
-
* Set (or clear) an app's monthly spend cap.
|
|
78
|
+
* Set (or clear) an app's monthly spend cap. Once the app's spend this calendar
|
|
79
|
+
* month (UTC) reaches it, the platform pauses the app (`spend_cap`) until the month
|
|
80
|
+
* ends or the cap is raised (Application API v2.84.0). Requires the `manage_billing`
|
|
79
81
|
* app permission.
|
|
80
82
|
*
|
|
81
83
|
* @param orgId - Numeric org id.
|
|
82
84
|
* @param appId - Numeric app id.
|
|
83
85
|
* @param monthlyLimitCents - Monthly cap in minor currency units (decimal
|
|
84
|
-
* string); `"0"`
|
|
86
|
+
* string); `"0"` removes the cap.
|
|
85
87
|
* @returns The updated app budget.
|
|
86
88
|
*/
|
|
87
89
|
async setAppBudget(orgId, appId, monthlyLimitCents) {
|
|
@@ -25,8 +25,12 @@ export interface AppEndpoint {
|
|
|
25
25
|
/** Datacenter code, e.g. `or` / `va`. Null when the app has no placement. */
|
|
26
26
|
datacenterCode: string | null;
|
|
27
27
|
/** HTTPS GraphQL origin for the app's own datacenter, or null if unplaced. */
|
|
28
|
+
applicationApiUrl: string | null;
|
|
29
|
+
/** The wss:// form of applicationApiUrl. */
|
|
30
|
+
applicationApiWsUrl: string | null;
|
|
31
|
+
/** @deprecated Use applicationApiUrl: the Game API is now the Application API. Removed on January 1, 2027. */
|
|
28
32
|
gameApiUrl: string | null;
|
|
29
|
-
/**
|
|
33
|
+
/** @deprecated Use applicationApiWsUrl: the Game API is now the Application API. Removed on January 1, 2027. */
|
|
30
34
|
gameApiWsUrl: string | null;
|
|
31
35
|
}
|
|
32
36
|
export declare class DiscoveryDomain {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/domains/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,MAAM,WAAW,WAAW;IAC1B,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,8EAA8E;IAC9E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/domains/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,MAAM,WAAW,WAAW;IAC1B,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,8EAA8E;IAC9E,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,4CAA4C;IAC5C,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,8GAA8G;IAC9G,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gHAAgH;IAChH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAE/C;;;;;OAKG;IACG,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAc3E;;;;;OAKG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAKxE"}
|