@crowdedkingdoms/crowdyjs 8.0.0 → 8.1.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/README.md +92 -15
- package/dist/client.d.ts +8 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -0
- package/dist/crowdy-client.d.ts +22 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +21 -0
- package/dist/domains/gameModel.d.ts +54 -3
- package/dist/domains/gameModel.d.ts.map +1 -1
- package/dist/domains/gameModel.js +67 -4
- package/dist/domains/host.d.ts +14 -3
- package/dist/domains/host.d.ts.map +1 -1
- package/dist/domains/host.js +17 -3
- package/dist/domains/organizations.d.ts +3 -3
- package/dist/domains/organizations.js +3 -3
- package/dist/domains/quotas.d.ts +1 -1
- package/dist/domains/quotas.js +1 -1
- package/dist/domains/udp.d.ts +28 -17
- package/dist/domains/udp.d.ts.map +1 -1
- package/dist/domains/udp.js +28 -17
- package/dist/generated/graphql.d.ts +366 -6
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +13 -8
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/kit/blueprints.d.ts +259 -0
- package/dist/kit/blueprints.d.ts.map +1 -0
- package/dist/kit/blueprints.js +480 -0
- package/dist/kit/index.d.ts +7 -0
- package/dist/kit/index.d.ts.map +1 -0
- package/dist/kit/index.js +6 -0
- package/dist/kit/inventory.d.ts +111 -0
- package/dist/kit/inventory.d.ts.map +1 -0
- package/dist/kit/inventory.js +158 -0
- package/dist/kit/kit.d.ts +96 -0
- package/dist/kit/kit.d.ts.map +1 -0
- package/dist/kit/kit.js +98 -0
- package/dist/kit/npcs.d.ts +182 -0
- package/dist/kit/npcs.d.ts.map +1 -0
- package/dist/kit/npcs.js +106 -0
- package/dist/kit/objects.d.ts +108 -0
- package/dist/kit/objects.d.ts.map +1 -0
- package/dist/kit/objects.js +110 -0
- package/dist/kit/shared.d.ts +32 -0
- package/dist/kit/shared.d.ts.map +1 -0
- package/dist/kit/shared.js +39 -0
- package/dist/lb-cookie-store.d.ts +20 -0
- package/dist/lb-cookie-store.d.ts.map +1 -0
- package/dist/lb-cookie-store.js +73 -0
- package/dist/realtime.d.ts +20 -5
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +38 -0
- package/dist/types.d.ts +22 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/world.d.ts +13 -8
- package/dist/world.d.ts.map +1 -1
- package/dist/world.js +13 -8
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -12,7 +12,38 @@ npm install @crowdedkingdoms/crowdyjs
|
|
|
12
12
|
|
|
13
13
|
CrowdyJS v4 targets browsers by default and uses native `fetch`, `WebSocket`, `crypto`, `btoa`, and `atob`. Node tools can still use the SDK, but must provide browser-compatible globals when opening realtime connections.
|
|
14
14
|
|
|
15
|
-
> **Server compatibility:** v5.2+ targets environments on release **v0.1.19 or later** (`cks-game-api >= v0.10.3`, `cks-management-api >= v0.1.70`). The destructive mutations send an `idempotencyKey` argument that older servers don't define. v6.1's `client.gameApps.deleteGrid` additionally requires release **v0.1.33+** (`cks-game-api >= v0.12.3`).
|
|
15
|
+
> **Server compatibility:** v5.2+ targets environments on release **v0.1.19 or later** (`cks-game-api >= v0.10.3`, `cks-management-api >= v0.1.70`). The destructive mutations send an `idempotencyKey` argument that older servers don't define. v6.1's `client.gameApps.deleteGrid` additionally requires release **v0.1.33+** (`cks-game-api >= v0.12.3`). The game-model **permission effects** fields (`permissionEffects` on `gameModel.upsertFunction`/`seed`, `permissionEffectsAppliedJson` on events) require a `cks-game-api` build with the `2026-07-17-model-permission-effects` migration; older servers reject queries/mutations that include them (omit the fields and everything else keeps working).
|
|
16
|
+
|
|
17
|
+
## Standalone builds and schema refresh
|
|
18
|
+
|
|
19
|
+
CrowdyJS is a standalone public package. A clean external clone must be able to
|
|
20
|
+
run `npm install && npm run build` without sibling CKS API repos checked out.
|
|
21
|
+
For that reason the build uses committed schema artifacts in this repo:
|
|
22
|
+
|
|
23
|
+
- `schema.gql` — merged Management API + Game API SDL.
|
|
24
|
+
- `src/generated/graphql.ts` — generated TypeScript operation types.
|
|
25
|
+
|
|
26
|
+
Schema refresh is explicit:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Refresh from the published production SDLs.
|
|
30
|
+
npm run schema:sync:prod
|
|
31
|
+
npm run codegen
|
|
32
|
+
|
|
33
|
+
# Or, inside the CKS wrapper repo, refresh from local API checkouts.
|
|
34
|
+
npm run schema:sync:local
|
|
35
|
+
npm run codegen
|
|
36
|
+
|
|
37
|
+
# Or use exact file/URL sources.
|
|
38
|
+
npm run schema:sync:paths -- \
|
|
39
|
+
--management ../cks-management-api/schema.gql \
|
|
40
|
+
--game ../cks-game-api/schema.gql
|
|
41
|
+
npm run codegen
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Commit `schema.gql` and `src/generated/graphql.ts` together whenever the public
|
|
45
|
+
GraphQL surface changes. Do not make `npm run build` depend on local API repos or
|
|
46
|
+
network access; use `npm run check:schema` in CI/release work to detect drift.
|
|
16
47
|
|
|
17
48
|
## Quick start
|
|
18
49
|
|
|
@@ -26,7 +57,7 @@ const client = createCrowdyClient({
|
|
|
26
57
|
// Game API (world data + UDP proxy)
|
|
27
58
|
httpUrl: 'https://game.example.com',
|
|
28
59
|
wsUrl: 'wss://game.example.com',
|
|
29
|
-
// Management API (
|
|
60
|
+
// Management API (passwordless sign-in, profile)
|
|
30
61
|
managementUrl: 'https://management.example.com',
|
|
31
62
|
tokenStore: new BrowserLocalStorageTokenStore(),
|
|
32
63
|
realtime: {
|
|
@@ -35,19 +66,23 @@ const client = createCrowdyClient({
|
|
|
35
66
|
},
|
|
36
67
|
});
|
|
37
68
|
|
|
38
|
-
// Restore a previous session if there is one, otherwise
|
|
69
|
+
// Restore a previous session if there is one, otherwise sign in (passwordless).
|
|
39
70
|
await client.session.restore();
|
|
40
71
|
if (!client.session.getToken()) {
|
|
41
|
-
|
|
72
|
+
// Magic link: email a one-time link, then complete with the token from it.
|
|
73
|
+
await client.auth.requestLoginLink({ email: 'player@example.com', redirectUri });
|
|
74
|
+
await client.auth.completeLoginLink(tokenFromLink);
|
|
75
|
+
// Or social/OIDC: socialLoginStart('google', redirectUri) -> socialLoginComplete({ provider, code, state })
|
|
76
|
+
// Or dev/test only (server has DEV_AUTH_BYPASS): client.auth.devLogin('player@example.com')
|
|
42
77
|
}
|
|
43
78
|
|
|
44
|
-
//
|
|
45
|
-
// Identity reads run on it:
|
|
79
|
+
// Passwordless sign-in returns an identity SESSION token (Management API only);
|
|
80
|
+
// the account is created on first sign-in. Identity reads run on it:
|
|
46
81
|
const me = await client.users.me();
|
|
47
82
|
console.log(me.email);
|
|
48
83
|
```
|
|
49
84
|
|
|
50
|
-
**Gameplay needs an app-scoped token, not the
|
|
85
|
+
**Gameplay needs an app-scoped token, not the session token.** Mint one per app and
|
|
51
86
|
drive the Game API world/UDP surface (including `gameClientBootstrap`) from a
|
|
52
87
|
per-game client — see [Overworld portals & app-scoped tokens (v7)](#overworld-portals--app-scoped-tokens-v7).
|
|
53
88
|
|
|
@@ -59,18 +94,19 @@ If `managementUrl` is omitted, the SDK falls back to `httpUrl` for backwards-com
|
|
|
59
94
|
|
|
60
95
|
| Sub-client | What it does |
|
|
61
96
|
|---|---|
|
|
62
|
-
| `client.auth` |
|
|
97
|
+
| `client.auth` | Passwordless sign-in (magic link, social/OIDC, dev bypass), log out, and linked identities (`myIdentities`, `linkIdentity`/`unlinkIdentity`). |
|
|
63
98
|
| `client.users` | `me`, `updateGamertag`, profile reads. |
|
|
64
99
|
| `client.session` | Token store, `restore()`, `getToken()`, manual `setToken()`. |
|
|
65
100
|
| `client.serverStatus` | `gameClientBootstrap(appId)` — per-app version info, UDP status, spatial limits. |
|
|
66
101
|
| `client.chunks`, `client.voxels`, `client.actors`, `client.avatars`, `client.state` | World data reads + writes. |
|
|
67
|
-
| `client.host` | Game-host election + actor liveness `heartbeat`. |
|
|
102
|
+
| `client.host` | Game-host election (`get`, `amIHost`) + actor liveness `heartbeat`. `amIHost` is UI convenience only — authoritative host gating uses `gameModelInvoke`'s `is_host` policy. |
|
|
68
103
|
| `client.teleport` | Teleport requests. |
|
|
69
104
|
| `client.channels`, `client.teams` | Messaging channels and app-scoped player teams (membership + roles). |
|
|
70
105
|
| `client.gameModel` | Abstract game model: containers, properties, functions (incl. model-driven `notify_*` effects), sessions, and **automations / NPCs** (`upsertAutomation`, `runAutomation`, `automationRuns`, `automationStats`, …). |
|
|
71
106
|
| `client.udp` | UDP proxy subscriptions + spatial mutations (`sendActorUpdate`, `sendVoxelUpdate`, `sendAudioPacket`, `sendTextPacket`, `sendClientEvent`). |
|
|
72
107
|
| `client.realtime` | Connection status, manual `connect()` / `disconnect()`, `onStatus()` listener. |
|
|
73
108
|
| `client.world(appId)` | Higher-level helpers for browser games (`actor.join`, `actor.sendState`, `actor.sendText`). |
|
|
109
|
+
| `client.kit(appId)` | Game Kit: ready-made mappings of game concepts onto the game model — `kit.inventory`, `kit.objects` (lockable doors/chests with custom permissions), `kit.npcs`, plus blueprint builders + `kit.deploy(...)` for the admin "load the rules" step. |
|
|
74
110
|
|
|
75
111
|
**Studio-admin surface** (privileged; drive with a server-side / studio token, grouped under `client.admin`):
|
|
76
112
|
|
|
@@ -97,7 +133,7 @@ Auth, user reads, and the studio-admin / operator surfaces target `managementUrl
|
|
|
97
133
|
|
|
98
134
|
## Game-loop lifecycle
|
|
99
135
|
|
|
100
|
-
1.
|
|
136
|
+
1. Sign in (passwordless) on the identity client with `client.auth` — `requestLoginLink`/`completeLoginLink` (magic link), `socialLoginStart`/`socialLoginComplete` (social/OIDC), or `devLogin` (dev/test only) — or `client.session.restore()`. This yields the **session token** (Management API only).
|
|
101
137
|
2. Mint an **app-scoped token** for the app (`identity.portal.mintAppToken(appId)`, or the PKCE portal flow across origins) and build a per-game client holding it (`game.setToken(token)`). The gameplay steps below run on that **game** client.
|
|
102
138
|
3. Subscribe to UDP proxy notifications with `game.udp.subscribe(handlers, appId)` — `appId` is **required** (the SDK opens the realtime socket on demand and scopes it to that app).
|
|
103
139
|
4. Join a chunk by sending an initial actor update.
|
|
@@ -233,6 +269,45 @@ await actor.sendToActor(
|
|
|
233
269
|
|
|
234
270
|
The world helpers are thin wrappers over `client.udp.*` with the appId pre-bound — convenient for browser games. Advanced callers can always use `client.udp.*` with the generated GraphQL input types directly.
|
|
235
271
|
|
|
272
|
+
## Game Kit
|
|
273
|
+
|
|
274
|
+
`client.kit(appId)` maps traditional game concepts onto the abstract game
|
|
275
|
+
model + automations API. Studios **deploy blueprints** (the admin "load the
|
|
276
|
+
state/rules" step, requires `manage_apps`); game clients then use the typed
|
|
277
|
+
runtime helpers. Everything composes `client.gameModel` — no new server
|
|
278
|
+
surface.
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
// Studio setup (admin context):
|
|
282
|
+
import { inventoryBlueprint, lockBlueprint, npcBlueprint } from '@crowdedkingdoms/crowdyjs';
|
|
283
|
+
|
|
284
|
+
await admin.kit(appId).deploy([
|
|
285
|
+
inventoryBlueprint(),
|
|
286
|
+
lockBlueprint({ objectTypeName: 'Door', authority: { kind: 'key' } }),
|
|
287
|
+
npcBlueprint({
|
|
288
|
+
behaviors: [{
|
|
289
|
+
name: 'npc-wander',
|
|
290
|
+
role: 'wanderer',
|
|
291
|
+
trigger: { intervalMs: 60000 },
|
|
292
|
+
mutations: [
|
|
293
|
+
{ target: 'self', property: 'x', expression: 'self.x + rand_int(-2, 2)' },
|
|
294
|
+
{ target: 'self', property: 'z', expression: 'self.z + rand_int(-2, 2)' },
|
|
295
|
+
],
|
|
296
|
+
}],
|
|
297
|
+
}),
|
|
298
|
+
]);
|
|
299
|
+
|
|
300
|
+
// Game client (player token):
|
|
301
|
+
const kit = game.kit(appId);
|
|
302
|
+
const bag = await kit.inventory.ensure(me.userId);
|
|
303
|
+
const result = await kit.objects.open(doorId, { keyId });
|
|
304
|
+
if (!result.success) console.warn('locked:', result.errorMessage);
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
See the docs guides [Modeling game concepts](https://docs.crowdedkingdoms.com/game-api/modeling-game-concepts)
|
|
308
|
+
(the underlying model) and [Game Kit](https://docs.crowdedkingdoms.com/crowdyjs/game-kit)
|
|
309
|
+
(the SDK surface).
|
|
310
|
+
|
|
236
311
|
## Errors
|
|
237
312
|
|
|
238
313
|
Transport and protocol failures throw structured error classes:
|
|
@@ -269,10 +344,10 @@ The key parameter is optional and trailing, so it's safe to omit. Requires a ser
|
|
|
269
344
|
|
|
270
345
|
## Overworld portals & app-scoped tokens (v7)
|
|
271
346
|
|
|
272
|
-
As of v7 gameplay requires an **app-scoped token**, not the
|
|
273
|
-
returns an **identity session token** (Management API only —
|
|
274
|
-
admin, and minting); each game is entered with a short-lived token
|
|
275
|
-
that one app, so a game stack never receives the player's full session.
|
|
347
|
+
As of v7 gameplay requires an **app-scoped token**, not the session token.
|
|
348
|
+
Passwordless sign-in returns an **identity session token** (Management API only —
|
|
349
|
+
account, studio admin, and minting); each game is entered with a short-lived token
|
|
350
|
+
confined to that one app, so a game stack never receives the player's full session.
|
|
276
351
|
|
|
277
352
|
Use two clients: an Overworld/identity client (session token) and a per-game
|
|
278
353
|
client (app token), sharing only the Management URL.
|
|
@@ -280,7 +355,9 @@ client (app token), sharing only the Management URL.
|
|
|
280
355
|
```ts
|
|
281
356
|
// Overworld/identity client
|
|
282
357
|
const overworld = createCrowdyClient({ managementUrl, tokenStore: new BrowserLocalStorageTokenStore('crowdyjs:session') });
|
|
283
|
-
|
|
358
|
+
// Passwordless sign-in (magic link, social/OIDC, or dev bypass) yields the session token.
|
|
359
|
+
await overworld.auth.requestLoginLink({ email, redirectUri });
|
|
360
|
+
await overworld.auth.completeLoginLink(tokenFromLink);
|
|
284
361
|
|
|
285
362
|
// Native / same-origin: mint directly, then build a game client.
|
|
286
363
|
const t = await overworld.portal.mintAppToken(appId);
|
package/dist/client.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
10
10
|
import type { SessionStore } from './session.js';
|
|
11
11
|
import type { CrowdyLogger } from './logger.js';
|
|
12
|
+
import type { LbCookieStore } from './lb-cookie-store.js';
|
|
12
13
|
/**
|
|
13
14
|
* Configuration for {@link GraphQLClient}, the low-level HTTP transport. You
|
|
14
15
|
* normally don't build this yourself — `CrowdyClient` constructs the transport
|
|
@@ -38,6 +39,12 @@ export interface GraphQLClientConfig {
|
|
|
38
39
|
* that discards all output.
|
|
39
40
|
*/
|
|
40
41
|
logger?: CrowdyLogger;
|
|
42
|
+
/**
|
|
43
|
+
* Optional sticky-LB cookie jar for game-api requests. When set, the
|
|
44
|
+
* client forwards `cks_ga` on HTTP and ingests `Set-Cookie` from responses
|
|
45
|
+
* so mutations stay pinned to the same upstream as the WS subscription.
|
|
46
|
+
*/
|
|
47
|
+
lbCookieStore?: LbCookieStore;
|
|
41
48
|
}
|
|
42
49
|
/**
|
|
43
50
|
* Low-level HTTP transport for GraphQL operations against the game or
|
|
@@ -65,6 +72,7 @@ export declare class GraphQLClient {
|
|
|
65
72
|
private readonly timeout;
|
|
66
73
|
private readonly session;
|
|
67
74
|
private readonly logger;
|
|
75
|
+
private readonly lbCookieStore?;
|
|
68
76
|
/**
|
|
69
77
|
* @param config - Endpoint, timeout, and logger options; see
|
|
70
78
|
* {@link GraphQLClientConfig}.
|
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,YAAY,EAAE,MAA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AW,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;CAmDd;AAED;;;GAGG;AACH,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -46,6 +46,7 @@ export class GraphQLClient {
|
|
|
46
46
|
this.timeout = config.timeout || 60000;
|
|
47
47
|
this.session = session;
|
|
48
48
|
this.logger = config.logger ?? silentLogger;
|
|
49
|
+
this.lbCookieStore = config.lbCookieStore;
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
51
52
|
* The resolved GraphQL endpoint URL this client POSTs to.
|
|
@@ -105,6 +106,7 @@ export class GraphQLClient {
|
|
|
105
106
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
106
107
|
const token = this.session.getToken();
|
|
107
108
|
const signal = options.signal ?? controller.signal;
|
|
109
|
+
const lbCookie = this.lbCookieStore?.headerValue();
|
|
108
110
|
try {
|
|
109
111
|
const requestBody = { query, variables };
|
|
110
112
|
const response = await fetch(this.graphqlEndpoint, {
|
|
@@ -112,11 +114,14 @@ export class GraphQLClient {
|
|
|
112
114
|
headers: {
|
|
113
115
|
'Content-Type': 'application/json',
|
|
114
116
|
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
117
|
+
...(lbCookie ? { Cookie: lbCookie } : {}),
|
|
115
118
|
},
|
|
116
119
|
body: JSON.stringify(requestBody),
|
|
120
|
+
credentials: this.lbCookieStore ? 'include' : 'same-origin',
|
|
117
121
|
signal,
|
|
118
122
|
});
|
|
119
123
|
clearTimeout(timeoutId);
|
|
124
|
+
this.lbCookieStore?.ingestSetCookie(response.headers);
|
|
120
125
|
if (!response.ok) {
|
|
121
126
|
const errorText = await response.text();
|
|
122
127
|
throw new CrowdyHttpError(response.status, errorText);
|
package/dist/crowdy-client.d.ts
CHANGED
|
@@ -22,10 +22,12 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { AuthState } from './auth-state.js';
|
|
24
24
|
import { GraphQLClient } from './client.js';
|
|
25
|
+
import { LbCookieStore } from './lb-cookie-store.js';
|
|
25
26
|
import { SubscriptionManager } from './subscriptions.js';
|
|
26
27
|
import type { CrowdyLogger } from './logger.js';
|
|
27
28
|
import type { TokenStore } from './session.js';
|
|
28
29
|
import { WorldClient } from './world.js';
|
|
30
|
+
import { GameKitClient, type GameKitOptions } from './kit/index.js';
|
|
29
31
|
import { AuthAPI } from './domains/auth.js';
|
|
30
32
|
import { UsersAPI } from './domains/users.js';
|
|
31
33
|
import { AppsAPI } from './domains/apps.js';
|
|
@@ -101,6 +103,12 @@ export interface CrowdyClientConfig {
|
|
|
101
103
|
/** Default timeout for `...AndWait` round-trips that await a matching echo. */
|
|
102
104
|
waitTimeoutMs?: number;
|
|
103
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* Optional sticky-LB cookie jar shared with the game-api HTTP client. Node
|
|
108
|
+
* runtimes must forward `cks_ga` on the WebSocket upgrade; browsers send it
|
|
109
|
+
* automatically once HTTP has stored the cookie via `credentials: 'include'`.
|
|
110
|
+
*/
|
|
111
|
+
lbCookieStore?: LbCookieStore;
|
|
104
112
|
}
|
|
105
113
|
export declare class CrowdyClient {
|
|
106
114
|
/** Shared token state for both game-api and management-api requests. */
|
|
@@ -189,6 +197,20 @@ export declare class CrowdyClient {
|
|
|
189
197
|
* @param appId - The app to scope realtime traffic to (BigInt as a decimal string).
|
|
190
198
|
*/
|
|
191
199
|
world(appId: string): WorldClient;
|
|
200
|
+
/**
|
|
201
|
+
* App-scoped **Game Kit** facade over `client.gameModel`: high-level
|
|
202
|
+
* building blocks that map traditional game concepts onto Game Models +
|
|
203
|
+
* Automations — `kit.inventory` (bags/item stacks), `kit.objects` (lockable
|
|
204
|
+
* doors/chests with custom permissions), `kit.npcs` (server-driven NPCs),
|
|
205
|
+
* and the studio-side `kit.deploy(blueprints)` that loads the matching
|
|
206
|
+
* rules/state into the app (requires `manage_apps`). See
|
|
207
|
+
* {@link GameKitClient} and the "CrowdyJS → Game Kit" docs guide.
|
|
208
|
+
*
|
|
209
|
+
* @param appId - The app to scope model calls to (BigInt as a decimal string).
|
|
210
|
+
* @param options - Optional per-helper config when your blueprints use
|
|
211
|
+
* non-default type names/prefixes.
|
|
212
|
+
*/
|
|
213
|
+
kit(appId: string, options?: GameKitOptions): GameKitClient;
|
|
192
214
|
/** Closes the WebSocket and clears the in-memory auth token. */
|
|
193
215
|
close(): void;
|
|
194
216
|
}
|
|
@@ -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,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,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;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;A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AM,GAAE,kBAAuB,GAC9B,YAAY,CAEd"}
|
package/dist/crowdy-client.js
CHANGED
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { AuthState } from './auth-state.js';
|
|
24
24
|
import { GraphQLClient } from './client.js';
|
|
25
|
+
import { LbCookieStore } from './lb-cookie-store.js';
|
|
25
26
|
import { SubscriptionManager } from './subscriptions.js';
|
|
26
27
|
import { WorldClient } from './world.js';
|
|
28
|
+
import { GameKitClient } from './kit/index.js';
|
|
27
29
|
import { AuthAPI } from './domains/auth.js';
|
|
28
30
|
import { UsersAPI } from './domains/users.js';
|
|
29
31
|
import { AppsAPI } from './domains/apps.js';
|
|
@@ -55,16 +57,19 @@ import { GameModelAPI } from './domains/gameModel.js';
|
|
|
55
57
|
export class CrowdyClient {
|
|
56
58
|
constructor(config = {}) {
|
|
57
59
|
this.session = new AuthState(config.tokenStore);
|
|
60
|
+
const lbCookieStore = config.lbCookieStore ?? new LbCookieStore();
|
|
58
61
|
this.graphql = new GraphQLClient({
|
|
59
62
|
httpUrl: config.httpUrl,
|
|
60
63
|
graphqlEndpoint: config.graphqlEndpoint ?? toGraphqlEndpoint(config.httpUrl, 'graphql'),
|
|
61
64
|
timeout: config.timeout,
|
|
62
65
|
logger: config.logger,
|
|
66
|
+
lbCookieStore,
|
|
63
67
|
}, this.session);
|
|
64
68
|
this.realtime = new SubscriptionManager({
|
|
65
69
|
wsUrl: config.wsUrl,
|
|
66
70
|
wsEndpoint: config.wsEndpoint ?? toGraphqlEndpoint(config.wsUrl, 'graphql'),
|
|
67
71
|
logger: config.logger,
|
|
72
|
+
lbCookieStore,
|
|
68
73
|
...config.realtime,
|
|
69
74
|
}, this.session);
|
|
70
75
|
const managementGraphqlEndpoint = config.managementGraphqlEndpoint ??
|
|
@@ -136,6 +141,22 @@ export class CrowdyClient {
|
|
|
136
141
|
world(appId) {
|
|
137
142
|
return new WorldClient(appId, this.udp);
|
|
138
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* App-scoped **Game Kit** facade over `client.gameModel`: high-level
|
|
146
|
+
* building blocks that map traditional game concepts onto Game Models +
|
|
147
|
+
* Automations — `kit.inventory` (bags/item stacks), `kit.objects` (lockable
|
|
148
|
+
* doors/chests with custom permissions), `kit.npcs` (server-driven NPCs),
|
|
149
|
+
* and the studio-side `kit.deploy(blueprints)` that loads the matching
|
|
150
|
+
* rules/state into the app (requires `manage_apps`). See
|
|
151
|
+
* {@link GameKitClient} and the "CrowdyJS → Game Kit" docs guide.
|
|
152
|
+
*
|
|
153
|
+
* @param appId - The app to scope model calls to (BigInt as a decimal string).
|
|
154
|
+
* @param options - Optional per-helper config when your blueprints use
|
|
155
|
+
* non-default type names/prefixes.
|
|
156
|
+
*/
|
|
157
|
+
kit(appId, options) {
|
|
158
|
+
return new GameKitClient(appId, this.gameModel, options);
|
|
159
|
+
}
|
|
139
160
|
/** Closes the WebSocket and clears the in-memory auth token. */
|
|
140
161
|
close() {
|
|
141
162
|
this.realtime.close();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GraphQLClient } from '../client.js';
|
|
2
|
-
import { type GameModelCreateSessionMutation, type GameModelCreateSessionMutationVariables, type GameModelJoinSessionMutation, type GameModelJoinSessionMutationVariables, type GameModelSetSessionTurnMutation, type GameModelSetSessionTurnMutationVariables, type GameModelCreateContainerMutation, type GameModelCreateContainerMutationVariables, type GameModelSetPropertyMutation, type GameModelSetPropertyMutationVariables, type GameModelAddEdgeMutation, type GameModelAddEdgeMutationVariables, type GameModelInvokeMutation, type GameModelInvokeMutationVariables, type GameModelContainerQuery, type GameModelContainerQueryVariables, type GameModelContainersQuery, type GameModelContainersQueryVariables, type GameModelContainerStateQuery, type GameModelContainerStateQueryVariables, type GameModelTraverseQuery, type GameModelTraverseQueryVariables, type GameModelSessionQuery, type GameModelSessionQueryVariables, type GameModelSessionsQuery, type GameModelSessionsQueryVariables, type GameModelEventsQuery, type GameModelEventsQueryVariables, type GameModelSeedMutation, type GameModelSeedMutationVariables, type GameModelUpsertContainerTypeMutation, type GameModelUpsertContainerTypeMutationVariables, type GameModelUpsertPropertyDefMutation, type GameModelUpsertPropertyDefMutationVariables, type GameModelUpsertFunctionMutation, type GameModelUpsertFunctionMutationVariables, type GameModelDeleteFunctionMutation, type GameModelDeleteFunctionMutationVariables, type GameModelDefineFeatureMutation, type GameModelDefineFeatureMutationVariables, type GameModelGrantTierFeatureMutation, type GameModelGrantTierFeatureMutationVariables, type GameModelSetPolicyMutation, type GameModelSetPolicyMutationVariables, type GameModelTypeSchemaQuery, type GameModelTypeSchemaQueryVariables, type GameModelContainerTypesQuery, type GameModelContainerTypesQueryVariables, type GameModelPropertyDefsQuery, type GameModelPropertyDefsQueryVariables, type GameModelFunctionQuery, type GameModelFunctionQueryVariables, type GameModelFunctionsQuery, type GameModelFunctionsQueryVariables, type GameModelFeaturesQuery, type GameModelFeaturesQueryVariables, type GameModelTierFeaturesQuery, type GameModelTierFeaturesQueryVariables, type GameModelPolicyQuery, type GameModelPolicyQueryVariables, type GameModelRevokeTierFeatureMutation, type GameModelRevokeTierFeatureMutationVariables, type GameModelEventsConnectionQuery, type GameModelEventsConnectionQueryVariables, type GameModelUpsertAutomationMutation, type GameModelUpsertAutomationMutationVariables, type GameModelDeleteAutomationMutation, type GameModelDeleteAutomationMutationVariables, type GameModelSetAutomationEnabledMutation, type GameModelSetAutomationEnabledMutationVariables, type GameModelUpsertAutomationTriggerMutation, type GameModelUpsertAutomationTriggerMutationVariables, type GameModelDeleteAutomationTriggerMutation, type GameModelDeleteAutomationTriggerMutationVariables, type GameModelSetAutomationPolicyMutation, type GameModelSetAutomationPolicyMutationVariables, type GameModelRunAutomationMutation, type GameModelRunAutomationMutationVariables, type GameModelAutomationsQuery, type GameModelAutomationsQueryVariables, type GameModelAutomationQuery, type GameModelAutomationQueryVariables, type GameModelAutomationTriggersQuery, type GameModelAutomationTriggersQueryVariables, type GameModelAutomationPolicyQuery, type GameModelAutomationPolicyQueryVariables, type GameModelAutomationRunsQuery, type GameModelAutomationRunsQueryVariables, type GameModelAutomationStatsQuery, type GameModelAutomationStatsQueryVariables, type GameModelAppDiagnosticsQuery, type GameModelAppDiagnosticsQueryVariables } from '../generated/graphql.js';
|
|
2
|
+
import { type GameModelCreateSessionMutation, type GameModelCreateSessionMutationVariables, type GameModelJoinSessionMutation, type GameModelJoinSessionMutationVariables, type GameModelSetSessionTurnMutation, type GameModelSetSessionTurnMutationVariables, type GameModelCreateContainerMutation, type GameModelCreateContainerMutationVariables, type GameModelDeleteContainerMutation, type GameModelDeleteContainerMutationVariables, type GameModelSetPropertyMutation, type GameModelSetPropertyMutationVariables, type GameModelAddEdgeMutation, type GameModelAddEdgeMutationVariables, type GameModelDeleteEdgeMutation, type GameModelDeleteEdgeMutationVariables, type GameModelInvokeMutation, type GameModelInvokeMutationVariables, type GameModelContainerQuery, type GameModelContainerQueryVariables, type GameModelContainersQuery, type GameModelContainersQueryVariables, type GameModelContainerStateQuery, type GameModelContainerStateQueryVariables, type GameModelTraverseQuery, type GameModelTraverseQueryVariables, type GameModelSessionQuery, type GameModelSessionQueryVariables, type GameModelSessionsQuery, type GameModelSessionsQueryVariables, type GameModelEventsQuery, type GameModelEventsQueryVariables, type GameModelSeedMutation, type GameModelSeedMutationVariables, type GameModelUpsertContainerTypeMutation, type GameModelUpsertContainerTypeMutationVariables, type GameModelUpsertPropertyDefMutation, type GameModelUpsertPropertyDefMutationVariables, type GameModelDeletePropertyDefMutation, type GameModelDeletePropertyDefMutationVariables, type GameModelDeleteContainerTypeMutation, type GameModelDeleteContainerTypeMutationVariables, type GameModelUpsertFunctionMutation, type GameModelUpsertFunctionMutationVariables, type GameModelDeleteFunctionMutation, type GameModelDeleteFunctionMutationVariables, type GameModelDefineFeatureMutation, type GameModelDefineFeatureMutationVariables, type GameModelGrantTierFeatureMutation, type GameModelGrantTierFeatureMutationVariables, type GameModelSetPolicyMutation, type GameModelSetPolicyMutationVariables, type GameModelTypeSchemaQuery, type GameModelTypeSchemaQueryVariables, type GameModelContainerTypesQuery, type GameModelContainerTypesQueryVariables, type GameModelPropertyDefsQuery, type GameModelPropertyDefsQueryVariables, type GameModelFunctionQuery, type GameModelFunctionQueryVariables, type GameModelFunctionsQuery, type GameModelFunctionsQueryVariables, type GameModelFeaturesQuery, type GameModelFeaturesQueryVariables, type GameModelTierFeaturesQuery, type GameModelTierFeaturesQueryVariables, type GameModelPolicyQuery, type GameModelPolicyQueryVariables, type GameModelRevokeTierFeatureMutation, type GameModelRevokeTierFeatureMutationVariables, type GameModelEventsConnectionQuery, type GameModelEventsConnectionQueryVariables, type GameModelUpsertAutomationMutation, type GameModelUpsertAutomationMutationVariables, type GameModelDeleteAutomationMutation, type GameModelDeleteAutomationMutationVariables, type GameModelSetAutomationEnabledMutation, type GameModelSetAutomationEnabledMutationVariables, type GameModelUpsertAutomationTriggerMutation, type GameModelUpsertAutomationTriggerMutationVariables, type GameModelDeleteAutomationTriggerMutation, type GameModelDeleteAutomationTriggerMutationVariables, type GameModelSetAutomationPolicyMutation, type GameModelSetAutomationPolicyMutationVariables, type GameModelRunAutomationMutation, type GameModelRunAutomationMutationVariables, type GameModelAutomationsQuery, type GameModelAutomationsQueryVariables, type GameModelAutomationQuery, type GameModelAutomationQueryVariables, type GameModelAutomationTriggersQuery, type GameModelAutomationTriggersQueryVariables, type GameModelAutomationPolicyQuery, type GameModelAutomationPolicyQueryVariables, type GameModelAutomationRunsQuery, type GameModelAutomationRunsQueryVariables, type GameModelAutomationStatsQuery, type GameModelAutomationStatsQueryVariables, type GameModelAppDiagnosticsQuery, type GameModelAppDiagnosticsQueryVariables } from '../generated/graphql.js';
|
|
3
3
|
/**
|
|
4
4
|
* Abstract **game-model** sub-client on the **game-api** — a schema-driven,
|
|
5
5
|
* server-authoritative layer for modelling game/world logic on top of the
|
|
@@ -52,8 +52,9 @@ import { type GameModelCreateSessionMutation, type GameModelCreateSessionMutatio
|
|
|
52
52
|
* `client.auth.login()` or `client.setToken()`) scoped to the target app, or it
|
|
53
53
|
* throws {@link CrowdyGraphQLError} (`UNAUTHENTICATED` / `SCOPE_MISSING`). The
|
|
54
54
|
* **studio-authoring** methods ({@link seed}, {@link upsertContainerType},
|
|
55
|
-
* {@link upsertPropertyDef}, {@link
|
|
56
|
-
* {@link
|
|
55
|
+
* {@link upsertPropertyDef}, {@link deletePropertyDef}, {@link upsertFunction},
|
|
56
|
+
* {@link deleteFunction}, {@link deleteContainerType}, {@link defineFeature},
|
|
57
|
+
* {@link grantTierFeature}, {@link setPolicy}) and the
|
|
57
58
|
* {@link typeSchema} query additionally require the app-admin **`manage_apps`**
|
|
58
59
|
* permission (otherwise `FORBIDDEN`, with `extensions.requiredPermission ===
|
|
59
60
|
* 'manage_apps'`); the runtime/player methods need only a valid token plus
|
|
@@ -139,6 +140,18 @@ export declare class GameModelAPI {
|
|
|
139
140
|
* unknown type, or `BAD_USER_INPUT` for malformed properties.
|
|
140
141
|
*/
|
|
141
142
|
createContainer(input: GameModelCreateContainerMutationVariables['input']): Promise<GameModelCreateContainerMutation['gameModelCreateContainer']>;
|
|
143
|
+
/**
|
|
144
|
+
* **Containers** — delete a container instance. Cascades its instance
|
|
145
|
+
* properties and any edges connected to it. Allowed for an app admin or the
|
|
146
|
+
* container owner. **Destructive.**
|
|
147
|
+
*
|
|
148
|
+
* @param variables - `{ appId, containerId }`: `appId` (decimal string) and
|
|
149
|
+
* the container UUID to delete.
|
|
150
|
+
* @returns `true` if a container was deleted, `false` if none matched.
|
|
151
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
|
|
152
|
+
* `FORBIDDEN` if the caller is neither an app admin nor the owner.
|
|
153
|
+
*/
|
|
154
|
+
deleteContainer(variables: GameModelDeleteContainerMutationVariables): Promise<GameModelDeleteContainerMutation['gameModelDeleteContainer']>;
|
|
142
155
|
/**
|
|
143
156
|
* **Containers** — set a single property value on a container directly (outside
|
|
144
157
|
* a function). Allowed only when the property's `writable` rule
|
|
@@ -169,6 +182,17 @@ export declare class GameModelAPI {
|
|
|
169
182
|
* `NOT_FOUND` if either container is unknown, or `BAD_USER_INPUT`.
|
|
170
183
|
*/
|
|
171
184
|
addEdge(input: GameModelAddEdgeMutationVariables['input']): Promise<GameModelAddEdgeMutation['gameModelAddEdge']>;
|
|
185
|
+
/**
|
|
186
|
+
* **Edges** — delete a directed relationship edge. Allowed for an app admin or
|
|
187
|
+
* the owner of the source (`from`) container. **Destructive.**
|
|
188
|
+
*
|
|
189
|
+
* @param variables - `{ appId, edgeId }`: `appId` (decimal string) and the
|
|
190
|
+
* edge UUID to delete.
|
|
191
|
+
* @returns `true` if an edge was deleted, `false` if none matched.
|
|
192
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
|
|
193
|
+
* `FORBIDDEN` if the caller may not delete the edge.
|
|
194
|
+
*/
|
|
195
|
+
deleteEdge(variables: GameModelDeleteEdgeMutationVariables): Promise<GameModelDeleteEdgeMutation['gameModelDeleteEdge']>;
|
|
172
196
|
/**
|
|
173
197
|
* **Functions** — invoke a studio-defined function against a `self` container
|
|
174
198
|
* with JSON params. This is the primary, *safe* way for players to mutate game
|
|
@@ -359,6 +383,33 @@ export declare class GameModelAPI {
|
|
|
359
383
|
* unknown container type, or `BAD_USER_INPUT`.
|
|
360
384
|
*/
|
|
361
385
|
upsertPropertyDef(input: GameModelUpsertPropertyDefMutationVariables['input']): Promise<GameModelUpsertPropertyDefMutation['gameModelUpsertPropertyDef']>;
|
|
386
|
+
/**
|
|
387
|
+
* **Property definitions** — delete a property definition from a container
|
|
388
|
+
* type. Does **not** remove instance property values already stored on
|
|
389
|
+
* containers. **Destructive.**
|
|
390
|
+
*
|
|
391
|
+
* Requires the app-admin **`manage_apps`** permission.
|
|
392
|
+
*
|
|
393
|
+
* @param variables - `{ appId, containerTypeName, key }`.
|
|
394
|
+
* @returns `true` if a definition was deleted, `false` if none matched.
|
|
395
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
|
|
396
|
+
* `FORBIDDEN` (`requiredPermission === 'manage_apps'`).
|
|
397
|
+
*/
|
|
398
|
+
deletePropertyDef(variables: GameModelDeletePropertyDefMutationVariables): Promise<GameModelDeletePropertyDefMutation['gameModelDeletePropertyDef']>;
|
|
399
|
+
/**
|
|
400
|
+
* **Container types** — delete a container type and its property definitions.
|
|
401
|
+
* Refuses if live containers of that type exist, or if functions are bound to
|
|
402
|
+
* it — delete those first. **Destructive.**
|
|
403
|
+
*
|
|
404
|
+
* Requires the app-admin **`manage_apps`** permission.
|
|
405
|
+
*
|
|
406
|
+
* @param variables - `{ appId, typeName }`.
|
|
407
|
+
* @returns `true` if a type was deleted, `false` if none matched.
|
|
408
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
|
|
409
|
+
* `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `BAD_USER_INPUT`
|
|
410
|
+
* when containers or bound functions still exist.
|
|
411
|
+
*/
|
|
412
|
+
deleteContainerType(variables: GameModelDeleteContainerTypeMutationVariables): Promise<GameModelDeleteContainerTypeMutation['gameModelDeleteContainerType']>;
|
|
362
413
|
/**
|
|
363
414
|
* **Functions** — create or update a studio-defined function: a named,
|
|
364
415
|
* sandboxed behaviour with typed parameters, declared property mutations
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gameModel.d.ts","sourceRoot":"","sources":["../../src/domains/gameModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAGL,KAAK,8BAA8B,EACnC,KAAK,uCAAuC,EAE5C,KAAK,4BAA4B,EACjC,KAAK,qCAAqC,EAE1C,KAAK,+BAA+B,EACpC,KAAK,wCAAwC,EAE7C,KAAK,gCAAgC,EACrC,KAAK,yCAAyC,EAE9C,KAAK,4BAA4B,EACjC,KAAK,qCAAqC,EAE1C,KAAK,wBAAwB,EA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O,CAAC,gCAAgC,CAAC,6BAA6B,CAAC,CAAC;IAK3E;;;;;;OAMG;IACG,gBAAgB,CACpB,SAAS,EAAE,uCAAuC,GACjD,OAAO,CAAC,8BAA8B,CAAC,2BAA2B,CAAC,CAAC;IAKvE;;;;;;;OAOG;IACG,cAAc,CAClB,SAAS,EAAE,qCAAqC,GAC/C,OAAO,CAAC,4BAA4B,CAAC,yBAAyB,CAAC,CAAC;IAKnE;;;;;;;;OAQG;IACG,eAAe,CACnB,SAAS,EAAE,sCAAsC,GAChD,OAAO,CAAC,6BAA6B,CAAC,0BAA0B,CAAC,CAAC;IAKrE;;;;;;;;OAQG;IACG,cAAc,CAClB,SAAS,EAAE,qCAAqC,GAC/C,OAAO,CAAC,4BAA4B,CAAC,yBAAyB,CAAC,CAAC;CAIpE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
// Runtime (player) ops
|
|
3
|
-
GameModelCreateSessionDocument, GameModelJoinSessionDocument, GameModelSetSessionTurnDocument, GameModelCreateContainerDocument, GameModelSetPropertyDocument, GameModelAddEdgeDocument, GameModelInvokeDocument, GameModelContainerDocument, GameModelContainersDocument, GameModelContainerStateDocument, GameModelTraverseDocument, GameModelSessionDocument, GameModelSessionsDocument, GameModelEventsDocument,
|
|
3
|
+
GameModelCreateSessionDocument, GameModelJoinSessionDocument, GameModelSetSessionTurnDocument, GameModelCreateContainerDocument, GameModelDeleteContainerDocument, GameModelSetPropertyDocument, GameModelAddEdgeDocument, GameModelDeleteEdgeDocument, GameModelInvokeDocument, GameModelContainerDocument, GameModelContainersDocument, GameModelContainerStateDocument, GameModelTraverseDocument, GameModelSessionDocument, GameModelSessionsDocument, GameModelEventsDocument,
|
|
4
4
|
// Studio authoring ops
|
|
5
|
-
GameModelSeedDocument, GameModelUpsertContainerTypeDocument, GameModelUpsertPropertyDefDocument, GameModelUpsertFunctionDocument, GameModelDeleteFunctionDocument, GameModelDefineFeatureDocument, GameModelGrantTierFeatureDocument, GameModelSetPolicyDocument, GameModelTypeSchemaDocument, GameModelContainerTypesDocument, GameModelPropertyDefsDocument, GameModelFunctionDocument, GameModelFunctionsDocument, GameModelFeaturesDocument, GameModelTierFeaturesDocument, GameModelPolicyDocument, GameModelRevokeTierFeatureDocument, GameModelEventsConnectionDocument,
|
|
5
|
+
GameModelSeedDocument, GameModelUpsertContainerTypeDocument, GameModelUpsertPropertyDefDocument, GameModelDeletePropertyDefDocument, GameModelDeleteContainerTypeDocument, GameModelUpsertFunctionDocument, GameModelDeleteFunctionDocument, GameModelDefineFeatureDocument, GameModelGrantTierFeatureDocument, GameModelSetPolicyDocument, GameModelTypeSchemaDocument, GameModelContainerTypesDocument, GameModelPropertyDefsDocument, GameModelFunctionDocument, GameModelFunctionsDocument, GameModelFeaturesDocument, GameModelTierFeaturesDocument, GameModelPolicyDocument, GameModelRevokeTierFeatureDocument, GameModelEventsConnectionDocument,
|
|
6
6
|
// Automations (autonomous processes / NPCs)
|
|
7
7
|
GameModelUpsertAutomationDocument, GameModelDeleteAutomationDocument, GameModelSetAutomationEnabledDocument, GameModelUpsertAutomationTriggerDocument, GameModelDeleteAutomationTriggerDocument, GameModelSetAutomationPolicyDocument, GameModelRunAutomationDocument, GameModelAutomationsDocument, GameModelAutomationDocument, GameModelAutomationTriggersDocument, GameModelAutomationPolicyDocument, GameModelAutomationRunsDocument, GameModelAutomationStatsDocument, GameModelAppDiagnosticsDocument, } from '../generated/graphql.js';
|
|
8
8
|
/**
|
|
@@ -57,8 +57,9 @@ GameModelUpsertAutomationDocument, GameModelDeleteAutomationDocument, GameModelS
|
|
|
57
57
|
* `client.auth.login()` or `client.setToken()`) scoped to the target app, or it
|
|
58
58
|
* throws {@link CrowdyGraphQLError} (`UNAUTHENTICATED` / `SCOPE_MISSING`). The
|
|
59
59
|
* **studio-authoring** methods ({@link seed}, {@link upsertContainerType},
|
|
60
|
-
* {@link upsertPropertyDef}, {@link
|
|
61
|
-
* {@link
|
|
60
|
+
* {@link upsertPropertyDef}, {@link deletePropertyDef}, {@link upsertFunction},
|
|
61
|
+
* {@link deleteFunction}, {@link deleteContainerType}, {@link defineFeature},
|
|
62
|
+
* {@link grantTierFeature}, {@link setPolicy}) and the
|
|
62
63
|
* {@link typeSchema} query additionally require the app-admin **`manage_apps`**
|
|
63
64
|
* permission (otherwise `FORBIDDEN`, with `extensions.requiredPermission ===
|
|
64
65
|
* 'manage_apps'`); the runtime/player methods need only a valid token plus
|
|
@@ -158,6 +159,21 @@ export class GameModelAPI {
|
|
|
158
159
|
const data = await this.gql.request(GameModelCreateContainerDocument, { input });
|
|
159
160
|
return data.gameModelCreateContainer;
|
|
160
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* **Containers** — delete a container instance. Cascades its instance
|
|
164
|
+
* properties and any edges connected to it. Allowed for an app admin or the
|
|
165
|
+
* container owner. **Destructive.**
|
|
166
|
+
*
|
|
167
|
+
* @param variables - `{ appId, containerId }`: `appId` (decimal string) and
|
|
168
|
+
* the container UUID to delete.
|
|
169
|
+
* @returns `true` if a container was deleted, `false` if none matched.
|
|
170
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
|
|
171
|
+
* `FORBIDDEN` if the caller is neither an app admin nor the owner.
|
|
172
|
+
*/
|
|
173
|
+
async deleteContainer(variables) {
|
|
174
|
+
const data = await this.gql.request(GameModelDeleteContainerDocument, variables);
|
|
175
|
+
return data.gameModelDeleteContainer;
|
|
176
|
+
}
|
|
161
177
|
/**
|
|
162
178
|
* **Containers** — set a single property value on a container directly (outside
|
|
163
179
|
* a function). Allowed only when the property's `writable` rule
|
|
@@ -194,6 +210,20 @@ export class GameModelAPI {
|
|
|
194
210
|
const data = await this.gql.request(GameModelAddEdgeDocument, { input });
|
|
195
211
|
return data.gameModelAddEdge;
|
|
196
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* **Edges** — delete a directed relationship edge. Allowed for an app admin or
|
|
215
|
+
* the owner of the source (`from`) container. **Destructive.**
|
|
216
|
+
*
|
|
217
|
+
* @param variables - `{ appId, edgeId }`: `appId` (decimal string) and the
|
|
218
|
+
* edge UUID to delete.
|
|
219
|
+
* @returns `true` if an edge was deleted, `false` if none matched.
|
|
220
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
|
|
221
|
+
* `FORBIDDEN` if the caller may not delete the edge.
|
|
222
|
+
*/
|
|
223
|
+
async deleteEdge(variables) {
|
|
224
|
+
const data = await this.gql.request(GameModelDeleteEdgeDocument, variables);
|
|
225
|
+
return data.gameModelDeleteEdge;
|
|
226
|
+
}
|
|
197
227
|
/**
|
|
198
228
|
* **Functions** — invoke a studio-defined function against a `self` container
|
|
199
229
|
* with JSON params. This is the primary, *safe* way for players to mutate game
|
|
@@ -421,6 +451,39 @@ export class GameModelAPI {
|
|
|
421
451
|
const data = await this.gql.request(GameModelUpsertPropertyDefDocument, { input });
|
|
422
452
|
return data.gameModelUpsertPropertyDef;
|
|
423
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* **Property definitions** — delete a property definition from a container
|
|
456
|
+
* type. Does **not** remove instance property values already stored on
|
|
457
|
+
* containers. **Destructive.**
|
|
458
|
+
*
|
|
459
|
+
* Requires the app-admin **`manage_apps`** permission.
|
|
460
|
+
*
|
|
461
|
+
* @param variables - `{ appId, containerTypeName, key }`.
|
|
462
|
+
* @returns `true` if a definition was deleted, `false` if none matched.
|
|
463
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`, or
|
|
464
|
+
* `FORBIDDEN` (`requiredPermission === 'manage_apps'`).
|
|
465
|
+
*/
|
|
466
|
+
async deletePropertyDef(variables) {
|
|
467
|
+
const data = await this.gql.request(GameModelDeletePropertyDefDocument, variables);
|
|
468
|
+
return data.gameModelDeletePropertyDef;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* **Container types** — delete a container type and its property definitions.
|
|
472
|
+
* Refuses if live containers of that type exist, or if functions are bound to
|
|
473
|
+
* it — delete those first. **Destructive.**
|
|
474
|
+
*
|
|
475
|
+
* Requires the app-admin **`manage_apps`** permission.
|
|
476
|
+
*
|
|
477
|
+
* @param variables - `{ appId, typeName }`.
|
|
478
|
+
* @returns `true` if a type was deleted, `false` if none matched.
|
|
479
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `SCOPE_MISSING`,
|
|
480
|
+
* `FORBIDDEN` (`requiredPermission === 'manage_apps'`), or `BAD_USER_INPUT`
|
|
481
|
+
* when containers or bound functions still exist.
|
|
482
|
+
*/
|
|
483
|
+
async deleteContainerType(variables) {
|
|
484
|
+
const data = await this.gql.request(GameModelDeleteContainerTypeDocument, variables);
|
|
485
|
+
return data.gameModelDeleteContainerType;
|
|
486
|
+
}
|
|
424
487
|
/**
|
|
425
488
|
* **Functions** — create or update a studio-defined function: a named,
|
|
426
489
|
* sandboxed behaviour with typed parameters, declared property mutations
|