@crowdedkingdoms/crowdyjs 13.9.0 → 14.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/MIGRATION.md +44 -0
- package/README.md +68 -33
- package/dist/binary-relay.d.ts +1 -1
- package/dist/binary-relay.js +1 -1
- package/dist/crowdy-client.d.ts +29 -34
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +42 -40
- package/dist/domains/appAccess.d.ts +3 -3
- package/dist/domains/appAccess.d.ts.map +1 -1
- package/dist/domains/appAccess.js +16 -16
- package/dist/domains/apps.d.ts +4 -8
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +19 -23
- package/dist/domains/auth.d.ts +1 -1
- package/dist/domains/billing.d.ts +3 -3
- package/dist/domains/billing.d.ts.map +1 -1
- package/dist/domains/billing.js +9 -9
- package/dist/domains/controlPlane.d.ts +2 -2
- package/dist/domains/controlPlane.d.ts.map +1 -1
- package/dist/domains/controlPlane.js +4 -4
- package/dist/domains/discovery.d.ts +50 -0
- package/dist/domains/discovery.d.ts.map +1 -0
- package/dist/domains/discovery.js +35 -0
- package/dist/domains/marketplace.d.ts +4 -5
- package/dist/domains/marketplace.d.ts.map +1 -1
- package/dist/domains/marketplace.js +25 -26
- package/dist/domains/organizations.d.ts +3 -3
- package/dist/domains/organizations.d.ts.map +1 -1
- package/dist/domains/organizations.js +22 -22
- package/dist/domains/payments.d.ts +3 -3
- package/dist/domains/payments.d.ts.map +1 -1
- package/dist/domains/payments.js +11 -11
- package/dist/domains/platform.d.ts +5 -6
- package/dist/domains/platform.d.ts.map +1 -1
- package/dist/domains/platform.js +6 -7
- package/dist/domains/portal.d.ts +19 -2
- package/dist/domains/portal.d.ts.map +1 -1
- package/dist/domains/portal.js +12 -12
- package/dist/domains/quotas.d.ts +3 -3
- package/dist/domains/quotas.d.ts.map +1 -1
- package/dist/domains/quotas.js +8 -8
- package/dist/domains/serverStatus.d.ts +1 -2
- package/dist/domains/serverStatus.d.ts.map +1 -1
- package/dist/domains/serverStatus.js +1 -2
- package/dist/domains/sharedEnvironment.d.ts +3 -3
- package/dist/domains/sharedEnvironment.d.ts.map +1 -1
- package/dist/domains/sharedEnvironment.js +15 -15
- package/dist/domains/udp.d.ts +1 -1
- package/dist/domains/udp.js +1 -1
- package/dist/domains/usage.d.ts +2 -2
- package/dist/domains/usage.d.ts.map +1 -1
- package/dist/domains/usage.js +5 -5
- package/dist/domains/users.d.ts +1 -1
- package/dist/domains/users.js +1 -1
- package/dist/generated/graphql.d.ts +65 -16
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +1 -0
- package/dist/index.d.ts +10 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -16
- package/dist/kit/decks.d.ts +1 -1
- package/dist/kit/npcs.d.ts +2 -2
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/kit/worldsim.d.ts +1 -1
- package/dist/rediscover.d.ts +7 -3
- package/dist/rediscover.d.ts.map +1 -1
- package/dist/rediscover.js +7 -3
- package/dist/session.d.ts +21 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +23 -0
- package/package.json +1 -1
package/MIGRATION.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
# CrowdyJS v14 — one endpoint (breaking)
|
|
2
|
+
|
|
3
|
+
v13 made the two GraphQL origins optional-but-supported. v14 removes the second
|
|
4
|
+
one entirely, because `cks-management-api` has been retired: the management
|
|
5
|
+
surface is served by the unified API, and there is nothing else to point at.
|
|
6
|
+
|
|
7
|
+
**What changed**
|
|
8
|
+
|
|
9
|
+
- **`managementUrl` and `managementGraphqlEndpoint` removed** from
|
|
10
|
+
`CrowdyClientConfig`. Passing either now **throws** rather than being ignored —
|
|
11
|
+
a JavaScript caller that kept the old option would otherwise have its identity
|
|
12
|
+
calls silently redirected to `httpUrl`, or nowhere at all if `managementUrl`
|
|
13
|
+
was the only URL it set.
|
|
14
|
+
- **`client.management` removed.** Use `client.graphql`; it reaches every
|
|
15
|
+
surface. `MarketplaceAPI` also collapsed from two transports to one.
|
|
16
|
+
|
|
17
|
+
**What did not change:** the two-**token** model. An identity session token is
|
|
18
|
+
still rejected for gameplay, and you still mint a short-lived app-scoped token
|
|
19
|
+
per app. Keep using two clients — one per token — they just no longer need a
|
|
20
|
+
shared management URL.
|
|
21
|
+
|
|
22
|
+
**Upgrading**
|
|
23
|
+
|
|
24
|
+
```diff
|
|
25
|
+
const client = createCrowdyClient({
|
|
26
|
+
- httpUrl: 'https://game.example.com',
|
|
27
|
+
- wsUrl: 'wss://game.example.com',
|
|
28
|
+
- managementUrl: 'https://management.example.com',
|
|
29
|
+
+ httpUrl: 'https://api.example.com/graphql',
|
|
30
|
+
+ wsUrl: 'wss://api.example.com/graphql',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
-await client.management.request(SomeDocument);
|
|
34
|
+
+await client.graphql.request(SomeDocument);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If you configured both to the same origin under v13, delete the `managementUrl`
|
|
38
|
+
line and you are done.
|
|
39
|
+
|
|
40
|
+
**One thing worth getting right:** the per-game client should use the
|
|
41
|
+
`gameApiUrl` / `gameApiWsUrl` that `mintAppToken` returns, not a hardcoded host.
|
|
42
|
+
An app lives in a single datacenter, and those fields name it. The identity
|
|
43
|
+
client can stay on the shared origin.
|
|
44
|
+
|
|
1
45
|
# CrowdyJS v13 — unified galaxy API (breaking)
|
|
2
46
|
|
|
3
47
|
The platform merged the Management API and Game API into ONE server on the
|
package/README.md
CHANGED
|
@@ -39,11 +39,9 @@ import {
|
|
|
39
39
|
} from '@crowdedkingdoms/crowdyjs';
|
|
40
40
|
|
|
41
41
|
const client = createCrowdyClient({
|
|
42
|
-
//
|
|
43
|
-
httpUrl: 'https://
|
|
44
|
-
wsUrl: 'wss://
|
|
45
|
-
// Management API (passwordless sign-in, profile, admin)
|
|
46
|
-
managementUrl: 'https://management.example.com',
|
|
42
|
+
// One API: identity, studio admin, world data and the UDP proxy.
|
|
43
|
+
httpUrl: 'https://api.example.com/graphql',
|
|
44
|
+
wsUrl: 'wss://api.example.com/graphql',
|
|
47
45
|
tokenStore: new BrowserLocalStorageTokenStore(),
|
|
48
46
|
realtime: {
|
|
49
47
|
retryAttempts: 8,
|
|
@@ -61,33 +59,34 @@ if (!client.session.getToken()) {
|
|
|
61
59
|
// Or dev/test only (server has DEV_AUTH_BYPASS): client.auth.devLogin('player@example.com')
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
// Passwordless sign-in returns an identity SESSION token (
|
|
62
|
+
// Passwordless sign-in returns an identity SESSION token (rejected for gameplay);
|
|
65
63
|
// the account is created on first sign-in. Identity reads run on it:
|
|
66
64
|
const me = await client.users.me();
|
|
67
65
|
console.log(me.email);
|
|
68
66
|
```
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
There is one endpoint. `managementUrl` was removed in v14 — see
|
|
69
|
+
[MIGRATION.md](MIGRATION.md).
|
|
72
70
|
|
|
73
71
|
**Gameplay needs an app-scoped token, not the session token.** Mint one per
|
|
74
|
-
app and drive the
|
|
72
|
+
app and drive the world/UDP surface from a per-game client — see
|
|
75
73
|
[Authentication](#authentication-session-token-vs-app-scoped-tokens).
|
|
76
74
|
|
|
77
75
|
## Authentication: session token vs app-scoped tokens
|
|
78
76
|
|
|
79
|
-
Passwordless sign-in returns an **identity session token**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
Passwordless sign-in returns an **identity session token** good for account,
|
|
78
|
+
studio admin and token minting, and **rejected for gameplay**. Each game is
|
|
79
|
+
entered with a short-lived **app-scoped token** confined to that one app, so a
|
|
80
|
+
game stack never receives the player's full session.
|
|
83
81
|
|
|
84
82
|
Use two clients: an Overworld/identity client (session token) and a per-game
|
|
85
|
-
client (app token),
|
|
83
|
+
client (app token). They never share a token store, and they need not share a
|
|
84
|
+
URL — `mintAppToken` returns the endpoint for the app's own datacenter.
|
|
86
85
|
|
|
87
86
|
```ts
|
|
88
87
|
// Overworld/identity client
|
|
89
88
|
const overworld = createCrowdyClient({
|
|
90
|
-
|
|
89
|
+
httpUrl: apiUrl,
|
|
91
90
|
tokenStore: new BrowserLocalStorageTokenStore('crowdyjs:session'),
|
|
92
91
|
});
|
|
93
92
|
// Passwordless sign-in (magic link, social/OIDC, or dev bypass) yields the session token.
|
|
@@ -99,7 +98,6 @@ const t = await overworld.portal.mintAppToken(appId);
|
|
|
99
98
|
const game = createCrowdyClient({
|
|
100
99
|
httpUrl: t.gameApiUrl!,
|
|
101
100
|
wsUrl: t.gameApiWsUrl!,
|
|
102
|
-
managementUrl,
|
|
103
101
|
tokenStore: new BrowserLocalStorageTokenStore('crowdyjs:app:' + appId),
|
|
104
102
|
});
|
|
105
103
|
game.setToken(t.token);
|
|
@@ -158,7 +156,7 @@ lifecycle to preserve.
|
|
|
158
156
|
|
|
159
157
|
1. Sign in (passwordless) on the identity client with `client.auth`, or
|
|
160
158
|
restore a stored session with `client.session.restore()`. This yields the
|
|
161
|
-
**session token
|
|
159
|
+
**session token**, which gameplay rejects.
|
|
162
160
|
2. Mint an **app-scoped token** for the app (`identity.portal.mintAppToken(appId)`,
|
|
163
161
|
or the PKCE portal flow across origins) and build a per-game client holding
|
|
164
162
|
it (`game.setToken(token)`). The gameplay steps below run on that **game**
|
|
@@ -224,12 +222,11 @@ grouped under `client.admin` and mirrored at the top level):
|
|
|
224
222
|
|---|---|
|
|
225
223
|
| `client.operator` | Platform compute ceilings (`computePlatformCeilings`, `setComputePlatformCeilings`). Infrastructure operations live in the separate infra-control-plane service, not this SDK. |
|
|
226
224
|
|
|
227
|
-
Auth, user reads
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
token** for that app.
|
|
225
|
+
Auth, user reads and the studio-admin / operator surfaces use the **identity
|
|
226
|
+
session token**; the world/UDP surfaces require an **app-scoped token** for that
|
|
227
|
+
app. Both go to the same endpoint.
|
|
231
228
|
|
|
232
|
-
CrowdyJS wraps the full public
|
|
229
|
+
CrowdyJS wraps the full public API surface — every
|
|
233
230
|
non-deprecated public root field has a typed method, with Relay `*Connection`
|
|
234
231
|
cursor-pagination variants alongside the legacy offset lists. The SDK never
|
|
235
232
|
relaxes server-side authorization: exposing an operation here just gives you a
|
|
@@ -241,7 +238,7 @@ not from an untrusted browser.
|
|
|
241
238
|
|
|
242
239
|
`mintAppToken` returns `gameApiUrl` / `gameApiWsUrl`, so you rarely need a
|
|
243
240
|
separate routing query. When you do (e.g. pre-flight discovery), query the
|
|
244
|
-
app's routing fields
|
|
241
|
+
app's routing fields:
|
|
245
242
|
|
|
246
243
|
```graphql
|
|
247
244
|
query AppForRouting($appId: BigInt!) {
|
|
@@ -323,6 +320,45 @@ while `AUTH_REQUIRED` / `APP_ID_REQUIRED` must be fixed by the caller first.
|
|
|
323
320
|
Unsubscribing stops delivery only; call `client.udp.disconnect()` to close the
|
|
324
321
|
UDP proxy session.
|
|
325
322
|
|
|
323
|
+
### Surviving the loss of an instance (direct connect)
|
|
324
|
+
|
|
325
|
+
**If your environment uses direct connect, set `realtime.discoveryUrl`.** Under
|
|
326
|
+
direct connect `mintAppToken` hands the client ONE api instance, and without a way
|
|
327
|
+
to ask for another the client cannot leave it: it re-dials a dead host until its
|
|
328
|
+
retries run out and then sits there, connected to nothing.
|
|
329
|
+
|
|
330
|
+
```ts
|
|
331
|
+
const bootstrap = await client.udp.gameClientBootstrap(appId);
|
|
332
|
+
|
|
333
|
+
const client = createCrowdyClient({
|
|
334
|
+
httpUrl: bootstrap.gameApiUrl,
|
|
335
|
+
wsUrl: bootstrap.gameApiWsUrl,
|
|
336
|
+
realtime: {
|
|
337
|
+
// The LOAD BALANCER, not the instance above. A discovery URL that dies with
|
|
338
|
+
// the instance it exists to replace is worse than none.
|
|
339
|
+
discoveryUrl: bootstrap.discoveryUrl,
|
|
340
|
+
},
|
|
341
|
+
});
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
That is the whole integration — the SDK builds re-discovery from the URL itself,
|
|
345
|
+
so recovery does not depend on every game remembering to write a callback. Pass an
|
|
346
|
+
explicit `realtime.rediscover` only to override it (e.g. `createMintRediscover`
|
|
347
|
+
when you hold an identity client and would rather re-mint than reuse a token near
|
|
348
|
+
expiry).
|
|
349
|
+
|
|
350
|
+
**Requires 13.9.0 or later, and the version matters more than it looks.** Before
|
|
351
|
+
13.9.0 the escalation to re-discovery was reachable only by a client that had
|
|
352
|
+
NEVER connected: a session that was working and then lost its instance re-dialled
|
|
353
|
+
one dead address forever, logging only `Binary relay socket error`. Setting
|
|
354
|
+
`discoveryUrl` on an older build therefore changes nothing in the case you set it
|
|
355
|
+
for. `ck-api` must be v1.20.0+ to return `discoveryUrl` at all.
|
|
356
|
+
|
|
357
|
+
**Pass a `logger`.** Everything the SDK knows about losing an instance it says
|
|
358
|
+
through that logger, including an explicit warning when it cannot move. With none
|
|
359
|
+
wired, a client that failed to re-discover and one that never tried look
|
|
360
|
+
identical.
|
|
361
|
+
|
|
326
362
|
## Spatial sends
|
|
327
363
|
|
|
328
364
|
```ts
|
|
@@ -671,8 +707,7 @@ The key parameter is optional and trailing, so it's safe to omit.
|
|
|
671
707
|
## Low-level GraphQL access
|
|
672
708
|
|
|
673
709
|
Typed sub-client methods are first-class, but generated operation documents
|
|
674
|
-
are also available through a transport escape hatch
|
|
675
|
-
Game API and `client.management` for the Management API:
|
|
710
|
+
are also available through a transport escape hatch, `client.graphql`:
|
|
676
711
|
|
|
677
712
|
```ts
|
|
678
713
|
import { VersionInfoDocument } from '@crowdedkingdoms/crowdyjs/generated';
|
|
@@ -680,8 +715,9 @@ import { VersionInfoDocument } from '@crowdedkingdoms/crowdyjs/generated';
|
|
|
680
715
|
const data = await client.graphql.request(VersionInfoDocument);
|
|
681
716
|
```
|
|
682
717
|
|
|
683
|
-
For any brand-new server field not yet wrapped, `client.graphql.request(...)`
|
|
684
|
-
`client.management
|
|
718
|
+
For any brand-new server field not yet wrapped, `client.graphql.request(...)`
|
|
719
|
+
always works. (`client.management` was removed in v14 along with the second
|
|
720
|
+
endpoint; `client.graphql` reaches every surface.)
|
|
685
721
|
|
|
686
722
|
## Maintainers: schema artifacts and fixtures
|
|
687
723
|
|
|
@@ -689,20 +725,19 @@ CrowdyJS is a standalone public package: a clean clone builds with
|
|
|
689
725
|
`npm install && npm run build` using the artifacts committed to this repo —
|
|
690
726
|
no other repositories and no network access required:
|
|
691
727
|
|
|
692
|
-
- `schema.gql` —
|
|
728
|
+
- `schema.gql` — the unified API SDL (management and game surfaces).
|
|
693
729
|
- `src/generated/graphql.ts` — generated TypeScript operation types.
|
|
694
730
|
|
|
695
|
-
Schema refresh is explicit, from the published
|
|
696
|
-
|
|
697
|
-
[game-api.graphql](https://docs.crowdedkingdoms.com/schema/game-api.graphql)):
|
|
731
|
+
Schema refresh is explicit, from the published
|
|
732
|
+
[SDL](https://docs.crowdedkingdoms.com/schema/game-api.graphql):
|
|
698
733
|
|
|
699
734
|
```bash
|
|
700
735
|
npm run schema:sync:prod
|
|
701
736
|
npm run codegen
|
|
702
737
|
```
|
|
703
738
|
|
|
704
|
-
(`npm run schema:sync:paths -- --
|
|
705
|
-
|
|
739
|
+
(`npm run schema:sync:paths -- --schema <file-or-url>` accepts an explicit
|
|
740
|
+
source, and `npm run schema:sync:local` reads `../cks-game-api/schema.gql`.) Commit `schema.gql` and `src/generated/graphql.ts`
|
|
706
741
|
together whenever the public GraphQL surface changes; `npm run check:schema`
|
|
707
742
|
detects drift in CI/release work.
|
|
708
743
|
|
package/dist/binary-relay.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface BinaryRelayCallbacks {
|
|
|
49
49
|
* than an unbalanced fleet.
|
|
50
50
|
*
|
|
51
51
|
* Compares the last two labels, so `ck-api-4.pgc.prod.cp.cks-env.com` and
|
|
52
|
-
* `ck.
|
|
52
|
+
* `ck.prod.cp.cks-env.com` match, and `evil.example.com` does not.
|
|
53
53
|
*/
|
|
54
54
|
export declare function isSameEstate(current: string, candidate: string): boolean;
|
|
55
55
|
export interface BinaryRelayConfig {
|
package/dist/binary-relay.js
CHANGED
|
@@ -38,7 +38,7 @@ const UNAVAILABLE_AFTER_RECONNECT_FAILURES = 3;
|
|
|
38
38
|
* than an unbalanced fleet.
|
|
39
39
|
*
|
|
40
40
|
* Compares the last two labels, so `ck-api-4.pgc.prod.cp.cks-env.com` and
|
|
41
|
-
* `ck.
|
|
41
|
+
* `ck.prod.cp.cks-env.com` match, and `evil.example.com` does not.
|
|
42
42
|
*/
|
|
43
43
|
export function isSameEstate(current, candidate) {
|
|
44
44
|
const host = (raw) => {
|
package/dist/crowdy-client.d.ts
CHANGED
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
* access everything via the typed sub-clients (`client.auth`, `client.udp`,
|
|
4
4
|
* `client.chunks`, ...).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* All sub-clients share ONE GraphQL endpoint: `httpUrl` / `graphqlEndpoint`, with
|
|
7
|
+
* `wsUrl` / `wsEndpoint` for subscriptions. Identity (`auth`, `users`, `portal`) and
|
|
8
|
+
* world/replication (`chunks`, `voxels`, `actors`, `udp`, ...) are surfaces of the
|
|
9
|
+
* same API, not separate services.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* BREAKING in v14: `managementUrl` and `managementGraphqlEndpoint` were removed,
|
|
12
|
+
* along with the `client.management` escape hatch, when `cks-management-api` was
|
|
13
|
+
* retired and its surface absorbed into the unified API. Set `httpUrl` and use
|
|
14
|
+
* `client.graphql`.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `client.auth.login()` returns, every subsequent SDK call (against either
|
|
21
|
-
* endpoint) carries the Bearer token automatically.
|
|
16
|
+
* One `AuthState` backs the whole client, so once `client.auth` has a token every
|
|
17
|
+
* subsequent call carries it. Note that this is per-client by design: drive identity
|
|
18
|
+
* from a client holding the session token and gameplay from a per-app client holding
|
|
19
|
+
* that app's app-scoped token, because a session token is rejected for gameplay.
|
|
20
|
+
* Those two clients may point at different origins — an app lives in one datacenter,
|
|
21
|
+
* and `mintAppToken` returns its `gameApiUrl` / `gameApiWsUrl`.
|
|
22
22
|
*/
|
|
23
23
|
import { AuthState } from './auth-state.js';
|
|
24
24
|
import { GraphQLClient } from './client.js';
|
|
@@ -63,26 +63,17 @@ import { CrowdyAgentGraphQLTransport } from './crowdy-agent/graphql-transport.js
|
|
|
63
63
|
import { PlayerWalletAPI } from './domains/playerWallet.js';
|
|
64
64
|
import { MarketplaceAPI } from './domains/marketplace.js';
|
|
65
65
|
import { PlayerModelAPI } from './domains/playerModel.js';
|
|
66
|
+
import { DiscoveryDomain } from './domains/discovery.js';
|
|
66
67
|
export interface CrowdyClientConfig {
|
|
67
|
-
/**
|
|
68
|
+
/** HTTP root (e.g. `https://api.crowdedkingdoms.com`). */
|
|
68
69
|
httpUrl?: string;
|
|
69
|
-
/**
|
|
70
|
+
/** WS root. */
|
|
70
71
|
wsUrl?: string;
|
|
71
|
-
/**
|
|
72
|
+
/** GraphQL endpoint. Defaults to `${httpUrl}/graphql`. */
|
|
72
73
|
graphqlEndpoint?: string;
|
|
73
|
-
/**
|
|
74
|
+
/** WS endpoint. Defaults to `${wsUrl}/graphql`. */
|
|
74
75
|
wsEndpoint?: string;
|
|
75
|
-
/**
|
|
76
|
-
* management-api HTTP root (e.g.
|
|
77
|
-
* `https://dev-management-api.crowdedkingdoms.com`). When set,
|
|
78
|
-
* `client.auth` and `client.users` route here. If left empty the SDK
|
|
79
|
-
* falls back to `httpUrl` for backwards-compatibility with the legacy
|
|
80
|
-
* single-endpoint deployment, but new code should set this explicitly.
|
|
81
|
-
*/
|
|
82
|
-
managementUrl?: string;
|
|
83
|
-
/** management-api GraphQL endpoint. Defaults to `${managementUrl}/graphql`. */
|
|
84
|
-
managementGraphqlEndpoint?: string;
|
|
85
|
-
/** Per-request HTTP timeout in milliseconds (applies to both endpoints). */
|
|
76
|
+
/** Per-request HTTP timeout in milliseconds. */
|
|
86
77
|
timeout?: number;
|
|
87
78
|
/**
|
|
88
79
|
* Persistence for the Bearer token across reloads. `BrowserLocalStorageTokenStore`
|
|
@@ -176,9 +167,9 @@ export interface CrowdyClientConfig {
|
|
|
176
167
|
}
|
|
177
168
|
export declare class CrowdyClient {
|
|
178
169
|
private gameplayTokenRefresh;
|
|
179
|
-
/** Shared token state for
|
|
170
|
+
/** Shared token state for every request this client makes. */
|
|
180
171
|
readonly session: AuthState;
|
|
181
|
-
/**
|
|
172
|
+
/** HTTP client for the API. */
|
|
182
173
|
readonly graphql: GraphQLClient;
|
|
183
174
|
/** game-api WebSocket subscription manager. */
|
|
184
175
|
readonly realtime: SubscriptionManager;
|
|
@@ -191,8 +182,6 @@ export declare class CrowdyClient {
|
|
|
191
182
|
* fields (not wire framing). See {@link RealtimeMetrics}.
|
|
192
183
|
*/
|
|
193
184
|
readonly metrics: RealtimeMetrics;
|
|
194
|
-
/** management-api HTTP client. Same `AuthState` as `graphql`. */
|
|
195
|
-
readonly management: GraphQLClient;
|
|
196
185
|
/** Auth + session: login, register, logout, password/email flows. */
|
|
197
186
|
readonly auth: AuthAPI;
|
|
198
187
|
/** Current-user identity: `me`, gamertag, account deletion. */
|
|
@@ -205,6 +194,12 @@ export declare class CrowdyClient {
|
|
|
205
194
|
* app token.
|
|
206
195
|
*/
|
|
207
196
|
readonly portal: PortalAPI;
|
|
197
|
+
/**
|
|
198
|
+
* Where each app lives. Unauthenticated, and meant to be called BEFORE login against
|
|
199
|
+
* the shared origin, so the session and the app token are both written in the app's
|
|
200
|
+
* own datacenter rather than wherever DNS happened to point.
|
|
201
|
+
*/
|
|
202
|
+
readonly discovery: DiscoveryDomain;
|
|
208
203
|
/** Public platform discovery (shared game-api URL, free app quota). */
|
|
209
204
|
readonly platform: PlatformAPI;
|
|
210
205
|
/** Organizations, members, RBAC roles, and org API tokens (studio admin). */
|
|
@@ -224,7 +219,7 @@ export declare class CrowdyClient {
|
|
|
224
219
|
/** Operator (control-plane) surface — requires `is_operator`. */
|
|
225
220
|
readonly operator: ControlPlaneAPI;
|
|
226
221
|
/**
|
|
227
|
-
* Studio-admin facade grouping the privileged management sub-clients
|
|
222
|
+
* Studio-admin facade grouping the privileged management-surface sub-clients
|
|
228
223
|
* (`organizations`, `appAccess`, `billing`, `payments`, `quotas`,
|
|
229
224
|
* `usage`, `sharedEnvironment`, `grids`) under one namespace.
|
|
230
225
|
*/
|
|
@@ -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;AAC5C,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,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACr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,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;IA+I3C,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
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
* access everything via the typed sub-clients (`client.auth`, `client.udp`,
|
|
4
4
|
* `client.chunks`, ...).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* All sub-clients share ONE GraphQL endpoint: `httpUrl` / `graphqlEndpoint`, with
|
|
7
|
+
* `wsUrl` / `wsEndpoint` for subscriptions. Identity (`auth`, `users`, `portal`) and
|
|
8
|
+
* world/replication (`chunks`, `voxels`, `actors`, `udp`, ...) are surfaces of the
|
|
9
|
+
* same API, not separate services.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* BREAKING in v14: `managementUrl` and `managementGraphqlEndpoint` were removed,
|
|
12
|
+
* along with the `client.management` escape hatch, when `cks-management-api` was
|
|
13
|
+
* retired and its surface absorbed into the unified API. Set `httpUrl` and use
|
|
14
|
+
* `client.graphql`.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `client.auth.login()` returns, every subsequent SDK call (against either
|
|
21
|
-
* endpoint) carries the Bearer token automatically.
|
|
16
|
+
* One `AuthState` backs the whole client, so once `client.auth` has a token every
|
|
17
|
+
* subsequent call carries it. Note that this is per-client by design: drive identity
|
|
18
|
+
* from a client holding the session token and gameplay from a per-app client holding
|
|
19
|
+
* that app's app-scoped token, because a session token is rejected for gameplay.
|
|
20
|
+
* Those two clients may point at different origins — an app lives in one datacenter,
|
|
21
|
+
* and `mintAppToken` returns its `gameApiUrl` / `gameApiWsUrl`.
|
|
22
22
|
*/
|
|
23
23
|
import { AuthState } from './auth-state.js';
|
|
24
24
|
import { GraphQLClient } from './client.js';
|
|
@@ -63,9 +63,21 @@ import { CrowdyAgentGraphQLTransport } from './crowdy-agent/graphql-transport.js
|
|
|
63
63
|
import { PlayerWalletAPI } from './domains/playerWallet.js';
|
|
64
64
|
import { MarketplaceAPI } from './domains/marketplace.js';
|
|
65
65
|
import { PlayerModelAPI } from './domains/playerModel.js';
|
|
66
|
+
import { DiscoveryDomain } from './domains/discovery.js';
|
|
66
67
|
export class CrowdyClient {
|
|
67
68
|
constructor(config = {}) {
|
|
68
69
|
this.gameplayTokenRefresh = null;
|
|
70
|
+
// TypeScript rejects these, JavaScript would not: a caller still passing
|
|
71
|
+
// managementUrl would have its identity calls silently sent to httpUrl, or
|
|
72
|
+
// nowhere at all if managementUrl was the only URL it set. Say so instead.
|
|
73
|
+
for (const removed of ['managementUrl', 'managementGraphqlEndpoint']) {
|
|
74
|
+
if (config[removed] !== undefined) {
|
|
75
|
+
throw new TypeError(`\`${removed}\` was removed in CrowdyJS v14: the management and game ` +
|
|
76
|
+
`surfaces are one API at one endpoint. Pass \`httpUrl\` (and \`wsUrl\`) ` +
|
|
77
|
+
`instead, and use \`client.graphql\` where you used \`client.management\`. ` +
|
|
78
|
+
`Per-app gameplay endpoints come from mintAppToken's gameApiUrl/gameApiWsUrl.`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
69
81
|
this.session = new AuthState(config.tokenStore);
|
|
70
82
|
const lbCookieStore = config.lbCookieStore ?? new LbCookieStore();
|
|
71
83
|
this.graphql = new GraphQLClient({
|
|
@@ -118,30 +130,20 @@ export class CrowdyClient {
|
|
|
118
130
|
}
|
|
119
131
|
: {}),
|
|
120
132
|
}, this.session, this.metrics);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
this.
|
|
133
|
-
this.
|
|
134
|
-
this.
|
|
135
|
-
this.portal = new PortalAPI(this.management, this.session, config.pkceStore);
|
|
136
|
-
this.platform = new PlatformAPI(this.management);
|
|
137
|
-
this.organizations = new OrganizationsAPI(this.management);
|
|
138
|
-
this.appAccess = new AppAccessAPI(this.management);
|
|
139
|
-
this.billing = new BillingAPI(this.management);
|
|
140
|
-
this.payments = new PaymentsAPI(this.management);
|
|
141
|
-
this.quotas = new QuotasAPI(this.management);
|
|
142
|
-
this.usage = new UsageAPI(this.management);
|
|
143
|
-
this.sharedEnvironment = new SharedEnvironmentAPI(this.management);
|
|
144
|
-
this.operator = new ControlPlaneAPI(this.management);
|
|
133
|
+
this.auth = new AuthAPI(this.graphql, this.session);
|
|
134
|
+
this.users = new UsersAPI(this.graphql);
|
|
135
|
+
this.apps = new AppsAPI(this.graphql);
|
|
136
|
+
this.portal = new PortalAPI(this.graphql, this.session, config.pkceStore);
|
|
137
|
+
this.discovery = new DiscoveryDomain(this.graphql);
|
|
138
|
+
this.platform = new PlatformAPI(this.graphql);
|
|
139
|
+
this.organizations = new OrganizationsAPI(this.graphql);
|
|
140
|
+
this.appAccess = new AppAccessAPI(this.graphql);
|
|
141
|
+
this.billing = new BillingAPI(this.graphql);
|
|
142
|
+
this.payments = new PaymentsAPI(this.graphql);
|
|
143
|
+
this.quotas = new QuotasAPI(this.graphql);
|
|
144
|
+
this.usage = new UsageAPI(this.graphql);
|
|
145
|
+
this.sharedEnvironment = new SharedEnvironmentAPI(this.graphql);
|
|
146
|
+
this.operator = new ControlPlaneAPI(this.graphql);
|
|
145
147
|
this.chunks = new ChunksAPI(this.graphql);
|
|
146
148
|
this.voxels = new VoxelsAPI(this.graphql);
|
|
147
149
|
this.actors = new ActorsAPI(this.graphql);
|
|
@@ -162,8 +164,8 @@ export class CrowdyClient {
|
|
|
162
164
|
wsUrl: config.wsEndpoint ?? toGraphqlEndpoint(config.wsUrl, 'graphql'),
|
|
163
165
|
getToken: () => this.session.getToken(),
|
|
164
166
|
});
|
|
165
|
-
this.playerWallet = new PlayerWalletAPI(this.
|
|
166
|
-
this.marketplace = new MarketplaceAPI(this.graphql
|
|
167
|
+
this.playerWallet = new PlayerWalletAPI(this.graphql);
|
|
168
|
+
this.marketplace = new MarketplaceAPI(this.graphql);
|
|
167
169
|
this.playerModel = new PlayerModelAPI(this.graphql);
|
|
168
170
|
this.avatars = new AvatarsAPI(this.graphql);
|
|
169
171
|
this.host = new HostAPI(this.graphql);
|
|
@@ -4,7 +4,7 @@ import { type AppAccessTiersQuery, type MyAppAccessQuery, type AppUserAccessByAp
|
|
|
4
4
|
* App access tiers + per-user access grants — exposed as `client.appAccess`
|
|
5
5
|
* (and grouped under `client.admin`).
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Part of the management surface. Tiers define the runtime-permission bundles
|
|
8
8
|
* (`access`, `teleport`, `update_voxel_data`, `use_voice_chat`, ...) a player
|
|
9
9
|
* gets; grants attach a user to a tier. New apps auto-provision an open default
|
|
10
10
|
* tier, so most players need no explicit grant.
|
|
@@ -17,8 +17,8 @@ import { type AppAccessTiersQuery, type MyAppAccessQuery, type AppUserAccessByAp
|
|
|
17
17
|
* per the permission notes above.
|
|
18
18
|
*/
|
|
19
19
|
export declare class AppAccessAPI {
|
|
20
|
-
private readonly
|
|
21
|
-
constructor(
|
|
20
|
+
private readonly api;
|
|
21
|
+
constructor(api: GraphQLClient);
|
|
22
22
|
/**
|
|
23
23
|
* List the access tiers defined for an app. **Public.**
|
|
24
24
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appAccess.d.ts","sourceRoot":"","sources":["../../src/domains/appAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAcL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,qCAAqC,EAC1C,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"appAccess.d.ts","sourceRoot":"","sources":["../../src/domains/appAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAcL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,K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