@crowdedkingdoms/crowdyjs 8.0.0 → 8.0.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/README.md CHANGED
@@ -14,6 +14,37 @@ CrowdyJS v4 targets browsers by default and uses native `fetch`, `WebSocket`, `c
14
14
 
15
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`).
16
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.
47
+
17
48
  ## Quick start
18
49
 
19
50
  ```ts
@@ -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 (login, register, profile)
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 log in.
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
- await client.auth.login({ email: 'player@example.com', password: 'secret' });
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
- // `client.auth.login()` returns an identity SESSION token (Management API only).
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 login token.** Mint one per app and
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,12 +94,12 @@ 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` | Register, log in, log out, password reset, email confirmation. |
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`, …). |
@@ -97,7 +132,7 @@ Auth, user reads, and the studio-admin / operator surfaces target `managementUrl
97
132
 
98
133
  ## Game-loop lifecycle
99
134
 
100
- 1. Authenticate on the identity client with `client.auth.login()` (or `client.session.restore()`) this yields the **session token**.
135
+ 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
136
  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
137
  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
138
  4. Join a chunk by sending an initial actor update.
@@ -269,10 +304,10 @@ The key parameter is optional and trailing, so it's safe to omit. Requires a ser
269
304
 
270
305
  ## Overworld portals & app-scoped tokens (v7)
271
306
 
272
- As of v7 gameplay requires an **app-scoped token**, not the login token. Login
273
- returns an **identity session token** (Management API only — account, studio
274
- admin, and minting); each game is entered with a short-lived token confined to
275
- that one app, so a game stack never receives the player's full session.
307
+ As of v7 gameplay requires an **app-scoped token**, not the session token.
308
+ Passwordless sign-in returns an **identity session token** (Management API only —
309
+ account, studio admin, and minting); each game is entered with a short-lived token
310
+ confined to that one app, so a game stack never receives the player's full session.
276
311
 
277
312
  Use two clients: an Overworld/identity client (session token) and a per-game
278
313
  client (app token), sharing only the Management URL.
@@ -280,7 +315,9 @@ client (app token), sharing only the Management URL.
280
315
  ```ts
281
316
  // Overworld/identity client
282
317
  const overworld = createCrowdyClient({ managementUrl, tokenStore: new BrowserLocalStorageTokenStore('crowdyjs:session') });
283
- await overworld.auth.login({ email, password });
318
+ // Passwordless sign-in (magic link, social/OIDC, or dev bypass) yields the session token.
319
+ await overworld.auth.requestLoginLink({ email, redirectUri });
320
+ await overworld.auth.completeLoginLink(tokenFromLink);
284
321
 
285
322
  // Native / same-origin: mint directly, then build a game client.
286
323
  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
  *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;;;;;;OAoBG;IACG,OAAO,CAAC,OAAO,EAAE,UAAU,EAC/B,QAAQ,EAAE,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,EAChD,SAAS,CAAC,EAAE,UAAU,EACtB,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GACrC,OAAO,CAAC,OAAO,CAAC;IASnB;;;;;;;;;;;;;;;;;;;OAmBG;IACG,KAAK,CAAC,CAAC,GAAG,GAAG,EACjB,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACvC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GACrC,OAAO,CAAC,CAAC,CAAC;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);
@@ -22,6 +22,7 @@
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';
@@ -101,6 +102,12 @@ export interface CrowdyClientConfig {
101
102
  /** Default timeout for `...AndWait` round-trips that await a matching echo. */
102
103
  waitTimeoutMs?: number;
103
104
  };
105
+ /**
106
+ * Optional sticky-LB cookie jar shared with the game-api HTTP client. Node
107
+ * runtimes must forward `cks_ga` on the WebSocket upgrade; browsers send it
108
+ * automatically once HTTP has stored the cookie via `credentials: 'include'`.
109
+ */
110
+ lbCookieStore?: LbCookieStore;
104
111
  }
105
112
  export declare class CrowdyClient {
106
113
  /** Shared token state for both game-api and management-api requests. */
@@ -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;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AA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ACzB,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,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;IAuF3C,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIpC,0DAA0D;IAC1D,QAAQ,IAAI,MAAM,GAAG,IAAI;IAIzB;;;;;;;OAOG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAIjC,gEAAgE;IAChE,KAAK,IAAI,IAAI;CAId;AAED,wBAAgB,kBAAkB,CAChC,MAAM,GAAE,kBAAuB,GAC9B,YAAY,CAEd"}
@@ -22,6 +22,7 @@
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';
27
28
  import { AuthAPI } from './domains/auth.js';
@@ -55,16 +56,19 @@ import { GameModelAPI } from './domains/gameModel.js';
55
56
  export class CrowdyClient {
56
57
  constructor(config = {}) {
57
58
  this.session = new AuthState(config.tokenStore);
59
+ const lbCookieStore = config.lbCookieStore ?? new LbCookieStore();
58
60
  this.graphql = new GraphQLClient({
59
61
  httpUrl: config.httpUrl,
60
62
  graphqlEndpoint: config.graphqlEndpoint ?? toGraphqlEndpoint(config.httpUrl, 'graphql'),
61
63
  timeout: config.timeout,
62
64
  logger: config.logger,
65
+ lbCookieStore,
63
66
  }, this.session);
64
67
  this.realtime = new SubscriptionManager({
65
68
  wsUrl: config.wsUrl,
66
69
  wsEndpoint: config.wsEndpoint ?? toGraphqlEndpoint(config.wsUrl, 'graphql'),
67
70
  logger: config.logger,
71
+ lbCookieStore,
68
72
  ...config.realtime,
69
73
  }, this.session);
70
74
  const managementGraphqlEndpoint = config.managementGraphqlEndpoint ??
@@ -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 upsertFunction}, {@link deleteFunction},
56
- * {@link defineFeature}, {@link grantTierFeature}, {@link setPolicy}) and the
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
- {"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BAAkB,CACtB,SAAS,EAAE,yCAAyC,GACnD,OAAO,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 upsertFunction}, {@link deleteFunction},
61
- * {@link defineFeature}, {@link grantTierFeature}, {@link setPolicy}) and the
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
@@ -1,5 +1,5 @@
1
1
  import type { GraphQLClient } from '../client.js';
2
- import { type GameHostQuery, type ActorHeartbeatMutation } from '../generated/graphql.js';
2
+ import { type GameHostQuery, type AmIGameHostQuery, type ActorHeartbeatMutation } from '../generated/graphql.js';
3
3
  /**
4
4
  * Game-host election + actor liveness heartbeat — exposed as `client.host`.
5
5
  *
@@ -7,8 +7,10 @@ import { type GameHostQuery, type ActorHeartbeatMutation } from '../generated/gr
7
7
  * game-api replicas (the user whose earliest still-connected actor was created
8
8
  * first wins). {@link heartbeat} refreshes the caller's actor freshness (keeping
9
9
  * them host-eligible) and returns the freshly-elected host in one round-trip —
10
- * call it on an interval shorter than the server's freshness window. Both
11
- * require a valid session; `appId` is a `BigInt` decimal string.
10
+ * call it on an interval shorter than the server's freshness window.
11
+ * {@link amIHost} is a UI convenience (not authoritative for mutations use
12
+ * `gameModelInvoke`'s `is_host` policy for that). All require a valid session;
13
+ * `appId` is a `BigInt` decimal string.
12
14
  *
13
15
  * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session.
14
16
  */
@@ -23,6 +25,15 @@ export declare class HostAPI {
23
25
  * @returns The elected {@link GameHost}, or `null`.
24
26
  */
25
27
  get(appId: string): Promise<GameHostQuery['gameHost']>;
28
+ /**
29
+ * Return whether the authenticated caller is the currently elected host for
30
+ * the app. Convenience for UI only — not authoritative for server mutations
31
+ * (use `gameModelInvoke`'s `is_host` policy for that).
32
+ *
33
+ * @param appId - The app to check host election for.
34
+ * @returns `true` if the caller is the elected host; otherwise `false`.
35
+ */
36
+ amIHost(appId: string): Promise<AmIGameHostQuery['amIGameHost']>;
26
37
  /**
27
38
  * Refresh the caller's actor freshness in an app and return the freshly
28
39
  * elected host. Returns `null` when no fresh actors exist for the app.
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/domains/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,aAAa;IAEnD;;;;;;OAMG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAK5D;;;;;;OAMG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;CAIlF"}
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/domains/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;GAaG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,aAAa;IAEnD;;;;;;OAMG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAK5D;;;;;;;OAOG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAKtE;;;;;;OAMG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;CAIlF"}
@@ -1,4 +1,4 @@
1
- import { GameHostDocument, ActorHeartbeatDocument, } from '../generated/graphql.js';
1
+ import { GameHostDocument, AmIGameHostDocument, ActorHeartbeatDocument, } from '../generated/graphql.js';
2
2
  /**
3
3
  * Game-host election + actor liveness heartbeat — exposed as `client.host`.
4
4
  *
@@ -6,8 +6,10 @@ import { GameHostDocument, ActorHeartbeatDocument, } from '../generated/graphql.
6
6
  * game-api replicas (the user whose earliest still-connected actor was created
7
7
  * first wins). {@link heartbeat} refreshes the caller's actor freshness (keeping
8
8
  * them host-eligible) and returns the freshly-elected host in one round-trip —
9
- * call it on an interval shorter than the server's freshness window. Both
10
- * require a valid session; `appId` is a `BigInt` decimal string.
9
+ * call it on an interval shorter than the server's freshness window.
10
+ * {@link amIHost} is a UI convenience (not authoritative for mutations use
11
+ * `gameModelInvoke`'s `is_host` policy for that). All require a valid session;
12
+ * `appId` is a `BigInt` decimal string.
11
13
  *
12
14
  * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session.
13
15
  */
@@ -26,6 +28,18 @@ export class HostAPI {
26
28
  const data = await this.graphql.request(GameHostDocument, { appId });
27
29
  return data.gameHost;
28
30
  }
31
+ /**
32
+ * Return whether the authenticated caller is the currently elected host for
33
+ * the app. Convenience for UI only — not authoritative for server mutations
34
+ * (use `gameModelInvoke`'s `is_host` policy for that).
35
+ *
36
+ * @param appId - The app to check host election for.
37
+ * @returns `true` if the caller is the elected host; otherwise `false`.
38
+ */
39
+ async amIHost(appId) {
40
+ const data = await this.graphql.request(AmIGameHostDocument, { appId });
41
+ return data.amIGameHost;
42
+ }
29
43
  /**
30
44
  * Refresh the caller's actor freshness in an app and return the freshly
31
45
  * elected host. Returns `null` when no fresh actors exist for the app.
@@ -101,13 +101,13 @@ export declare class OrganizationsAPI {
101
101
  * Mint a new org API token (for server-side studio backends). Requires the
102
102
  * `manage_tokens` org permission. The plaintext secret is returned **once**.
103
103
  *
104
- * @param input - {@link CreateOrgTokenInput}: `orgId`, `name`, optional
105
- * `permissions` and `expiresAt`.
104
+ * @param input - {@link CreateOrgTokenInput}: `orgId`, optional `label` and
105
+ * `expiresAt`.
106
106
  * @returns The created token including its one-time plaintext secret.
107
107
  */
108
108
  createToken(input: CreateOrgTokenInput): Promise<CreateOrgTokenMutation['createOrgToken']>;
109
109
  /**
110
- * Update an org token's metadata (name / permissions / expiry). Requires the
110
+ * Update an org token's metadata (label / active flag / expiry). Requires the
111
111
  * `manage_tokens` org permission.
112
112
  *
113
113
  * @param orgTokenId - Numeric token id.