@crowdedkingdoms/crowdyjs 1.0.1 → 7.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.
@@ -392,6 +392,24 @@ export declare enum AppStatus {
392
392
  /** Published and purchasable/playable; eligible for the public marketplace when visibility=PUBLIC. */
393
393
  Live = "LIVE"
394
394
  }
395
+ /** A short-lived, app-scoped gameplay token (Overworld portal). Confined to a single app: usable only against that app's Game API + Buddy realtime surface (plus read-only `me` and same-app `refreshAppToken`). It CANNOT perform management operations and CANNOT mint tokens for other apps, so a game stack that receives it never gets the player's full identity session. */
396
+ export type AppTokenResponse = {
397
+ __typename?: 'AppTokenResponse';
398
+ /** The app this token is confined to, as a String. */
399
+ appId: Scalars['String']['output'];
400
+ /** ISO-8601 UTC expiry. Call `refreshAppToken` (same app) before this, or re-portal through the Overworld for a different app. */
401
+ expiresAt: Scalars['String']['output'];
402
+ /** Base HTTPS URL of the Game API that serves this app (null if the app has no dedicated/shared game-api route yet). */
403
+ gameApiUrl: Maybe<Scalars['String']['output']>;
404
+ /** WebSocket URL of the Game API that serves this app (wss://), for realtime subscriptions. */
405
+ gameApiWsUrl: Maybe<Scalars['String']['output']>;
406
+ /** Identifier of the underlying game_token row, as a String. */
407
+ gameTokenId: Scalars['String']['output'];
408
+ /** Browser launch URL for this app (where the player's browser plays it), if configured. */
409
+ launchUrl: Maybe<Scalars['String']['output']>;
410
+ /** Opaque app-scoped gameplay token. Send to the target app's Game API as `Authorization: Bearer <token>` (and in the realtime `connectionParams`). Do NOT send it to the Management API for anything other than `me`/`refreshAppToken`. */
411
+ token: Scalars['String']['output'];
412
+ };
395
413
  /** Aggregate byte totals for one app over the requested window. All *Bytes fields are string counters (may exceed Int range). */
396
414
  export type AppUsageRollupRow = {
397
415
  __typename?: 'AppUsageRollupRow';
@@ -1728,6 +1746,17 @@ export type CreateOrganizationInput = {
1728
1746
  /** Unique URL slug; lowercase letters, numbers, and dashes only (1-128 characters). */
1729
1747
  slug: Scalars['String']['input'];
1730
1748
  };
1749
+ /** Input for createPortalAuthorizationCode: the Overworld (identity origin, holding the session token) mints a one-time code the destination game exchanges for an app token. Browser handoff path; pair with a PKCE verifier held by the destination game origin. */
1750
+ export type CreatePortalAuthorizationCodeInput = {
1751
+ /** Numeric id of the target app the player is portaling into. */
1752
+ appId: Scalars['BigInt']['input'];
1753
+ /** PKCE code challenge (recommended). Base64url(SHA-256(verifier)) when method is S256. The destination game generates the verifier+challenge so the verifier never leaves its origin. */
1754
+ codeChallenge: Scalars['String']['input'];
1755
+ /** PKCE method: "S256" (default, recommended) or "plain". */
1756
+ codeChallengeMethod?: InputMaybe<Scalars['String']['input']>;
1757
+ /** Where to redirect the player after issuing the code. Must match the target app's configured launch_url origin when set. */
1758
+ redirectUri: Scalars['String']['input'];
1759
+ };
1731
1760
  /** Create a runtime session. */
1732
1761
  export type CreateSessionInput = {
1733
1762
  /** The app (tenant) the session belongs to. */
@@ -1848,6 +1877,13 @@ export type EnvironmentUsageSummary = {
1848
1877
  /** Peak/average replication send rates. */
1849
1878
  replicationRates: UsageRatePeaks;
1850
1879
  };
1880
+ /** Input for exchangePortalCode: the destination game (public client) trades a one-time portal code for an app-scoped gameplay token. Public (the code + PKCE verifier authorize the call). */
1881
+ export type ExchangePortalCodeInput = {
1882
+ /** The one-time authorization code received on the redirect. */
1883
+ code: Scalars['String']['input'];
1884
+ /** PKCE code verifier matching the challenge supplied when the code was created. Required when the code was created with a challenge. */
1885
+ codeVerifier?: InputMaybe<Scalars['String']['input']>;
1886
+ };
1851
1887
  /** An org's free shared app slot quota usage. */
1852
1888
  export type FreeAppQuota = {
1853
1889
  __typename?: 'FreeAppQuota';
@@ -2860,6 +2896,11 @@ export type LoginUserInput = {
2860
2896
  /** Account password (min 8 characters). */
2861
2897
  password: Scalars['String']['input'];
2862
2898
  };
2899
+ /** Input for mintAppToken: directly mint an app-scoped gameplay token for the calling user (native/direct path, no browser redirect). */
2900
+ export type MintAppTokenInput = {
2901
+ /** Numeric id of the app to mint a confined gameplay token for. Free/open apps are auto-granted access; paid apps require an existing entitlement (else FORBIDDEN). */
2902
+ appId: Scalars['BigInt']['input'];
2903
+ };
2863
2904
  export type Mutation = {
2864
2905
  __typename?: 'Mutation';
2865
2906
  /** Liveness heartbeat for the authenticated user's actors in an app. Refreshes actors.updated_at for every actor row the user owns so the user stays host-eligible, then returns the freshly-elected host (same shape as the gameHost query) so a client can fold its poll and heartbeat into one round-trip. Call on an interval shorter than HOST_ACTOR_FRESHNESS_SECONDS. Only refreshes rows that already exist (created by Buddy on chunk entry); returns null when no fresh actors exist for the app. */
@@ -2910,6 +2951,8 @@ export type Mutation = {
2910
2951
  createOrgToken: OrgTokenWithSecret;
2911
2952
  /** Creates a new organization and makes the authenticated caller its owner (with full permissions). Requires a valid session token. */
2912
2953
  createOrganization: Organization;
2954
+ /** Create a one-time, PKCE-bound portal authorization code (browser handoff). The Overworld identity origin (holding the SESSION token) calls this; redirect the player to the destination game carrying the code, which the game exchanges via exchangePortalCode. Requires a SESSION token. */
2955
+ createPortalAuthorizationCode: PortalAuthorizationCode;
2913
2956
  /** Create a team. Whether the caller may create one is governed by the per-app team policy (app_group_policies: admin | member | anyone). The caller becomes the owner and is granted a system 'leader' role holding every team permission. New teams default to the app's default membership policy unless overridden. */
2914
2957
  createTeam: Group;
2915
2958
  /** Create a custom (non-system) team role granting the given team permission keys. Requires the 'manage_roles' team permission (app admins bypass). Permission keys must be valid team permission keys (group_permission_defs). */
@@ -2942,6 +2985,8 @@ export type Mutation = {
2942
2985
  destroyEnvironment: CksEnvironmentChangeOrder;
2943
2986
  /** Close the UDP proxy session and socket for this game token. Unsubscribing from udpNotifications does not disconnect; use this mutation (or rely on server inactivity timeout). */
2944
2987
  disconnectUdpProxy: Scalars['Boolean']['output'];
2988
+ /** Exchange a one-time portal authorization code (with the matching PKCE verifier) for an app-scoped gameplay token. Public (the code + verifier authorize the call); called by the destination game at its own origin so the game never sees the player's session token. */
2989
+ exchangePortalCode: AppTokenResponse;
2945
2990
  /** ADMIN/DESTRUCTIVE: revokes ALL of the target user’s sessions by deleting every game_token row, forcing re-authentication on every device. Returns true if at least one session was revoked. Requires a super-admin bearer game token (and the management API enabled). NOTE: management-owned in cks-game-api (throws ForbiddenException) — use cks-management-api. */
2946
2991
  forceLogoutUser: Scalars['Boolean']['output'];
2947
2992
  /** Create a directed relationship edge between two containers (the game model is a graph), with a relationship type and optional weight. Requires a valid token. */
@@ -3016,6 +3061,8 @@ export type Mutation = {
3016
3061
  logout: Scalars['Boolean']['output'];
3017
3062
  /** Ends every active session for the authenticated user (deletes all their game_tokens and records revocations). Requires a valid session token. Use logout to end only the current session. */
3018
3063
  logoutAllDevices: Scalars['Boolean']['output'];
3064
+ /** Mint a short-lived, app-scoped gameplay token for the calling user (native/direct path; no browser redirect). Requires an identity SESSION token (app tokens cannot mint). Free/open apps auto-grant access; paid apps require an existing entitlement (else FORBIDDEN). Side effect: may create an app_user_access row on the app's free default tier. */
3065
+ mintAppToken: AppTokenResponse;
3019
3066
  /** Publishes an app to the shared game-api environment. Free under the org's app-slot quota (result.free = true); beyond the quota, publish still succeeds and hourly usage is debited from the org wallet. Requires the 'manage_apps' permission on the app's org. Blocked when SHARED_GAME_API_URL is not configured. */
3020
3067
  publishAppToShared: PublishAppResult;
3021
3068
  /** Operator only (is_operator). Cuts a new environment release from a cks-game-api git tag: ingests it as available and commits the manifest to the git ref. SIDE EFFECT: makes the version the new redeploy target and writes to GitHub. Use force to overwrite. Writes an audit entry. */
@@ -3028,6 +3075,8 @@ export type Mutation = {
3028
3075
  putCpSecret: CpSecretRow;
3029
3076
  /** Redeploys the environment to a target release version (input.version) or, when omitted, the latest available version for its class, reusing its current flavors/scaling and linked apps. Preserves the environment URLs. No-op-safe: re-running when already at latest still redeploys. If a prior deploy failed but stayed in_progress, it is abandoned first so the redeploy can proceed. Requires the 'manage_environments' org permission. */
3030
3077
  redeployEnvironment: CksEnvironmentChangeOrder;
3078
+ /** Rotate the calling app token for a fresh one (same app, extended TTL) and revoke the old. Call before the current token expires to keep playing without bouncing back through the Overworld. Allowed for app-scoped tokens; re-checks entitlement. */
3079
+ refreshAppToken: AppTokenResponse;
3031
3080
  /** Creates a new (initially unconfirmed) account, sends a confirmation email, and returns an AuthResponse with a session `token` for immediate login (send as `Authorization: Bearer <token>`). Public; throws if the email already exists. */
3032
3081
  register: AuthResponse;
3033
3082
  /** Remove a member from a channel. Requires the 'manage_members' channel permission, except that any member may remove themselves. Notifies Buddy to stop routing to the removed member. Returns true if a membership was removed. */
@@ -3237,6 +3286,9 @@ export type MutationCreateOrgTokenArgs = {
3237
3286
  export type MutationCreateOrganizationArgs = {
3238
3287
  input: CreateOrganizationInput;
3239
3288
  };
3289
+ export type MutationCreatePortalAuthorizationCodeArgs = {
3290
+ input: CreatePortalAuthorizationCodeInput;
3291
+ };
3240
3292
  export type MutationCreateTeamArgs = {
3241
3293
  input: CreateTeamInput;
3242
3294
  };
@@ -3285,6 +3337,9 @@ export type MutationDeleteUserAppStateArgs = {
3285
3337
  export type MutationDestroyEnvironmentArgs = {
3286
3338
  input: DestroyEnvironmentInput;
3287
3339
  };
3340
+ export type MutationExchangePortalCodeArgs = {
3341
+ input: ExchangePortalCodeInput;
3342
+ };
3288
3343
  export type MutationForceLogoutUserArgs = {
3289
3344
  userId: Scalars['BigInt']['input'];
3290
3345
  };
@@ -3397,6 +3452,9 @@ export type MutationLinkAppToEnvironmentArgs = {
3397
3452
  export type MutationLoginArgs = {
3398
3453
  loginUserInput: LoginUserInput;
3399
3454
  };
3455
+ export type MutationMintAppTokenArgs = {
3456
+ input: MintAppTokenInput;
3457
+ };
3400
3458
  export type MutationPublishAppToSharedArgs = {
3401
3459
  appId: Scalars['BigInt']['input'];
3402
3460
  cancelUrl?: InputMaybe<Scalars['String']['input']>;
@@ -3944,6 +4002,16 @@ export type PlayerPulse = {
3944
4002
  /** Number of studios in the percentile comparison pool (studios with all_time_peak > 0). */
3945
4003
  poolSize: Scalars['Int']['output'];
3946
4004
  };
4005
+ /** A one-time portal authorization code. Redirect the player to `redirectUri` carrying `code`; the destination game exchanges it (with its PKCE verifier) via exchangePortalCode for an app token. Single-use and short-lived. */
4006
+ export type PortalAuthorizationCode = {
4007
+ __typename?: 'PortalAuthorizationCode';
4008
+ /** The one-time authorization code. Deliver it to the destination game origin only (e.g. as a `code` query param on redirectUri). */
4009
+ code: Scalars['String']['output'];
4010
+ /** ISO-8601 UTC expiry of the code (typically ~60s). */
4011
+ expiresAt: Scalars['String']['output'];
4012
+ /** The validated redirect URI the player should be sent to. */
4013
+ redirectUri: Scalars['String']['output'];
4014
+ };
3947
4015
  /** Postgres billing tier: bandwidth allotment and capacity charge. Usage metering deferred. */
3948
4016
  export type PostgresBillingTier = {
3949
4017
  __typename?: 'PostgresBillingTier';
@@ -5320,6 +5388,8 @@ export declare enum UdpErrorCode {
5320
5388
  PasswordTooLong = "PASSWORD_TOO_LONG",
5321
5389
  /** Password failed minimum-length validation. */
5322
5390
  PasswordTooShort = "PASSWORD_TOO_SHORT",
5391
+ /** The app-scoped gameplay token has expired. Refresh it (same app, via refreshAppToken) before it lapses, or re-portal through the Overworld for a fresh token, then re-authorize the realtime session. */
5392
+ TokenExpired = "TOKEN_EXPIRED",
5323
5393
  /** The caller lacks the runtime/grid permission required for this action. Grid permissions can load asynchronously, so the first message to a newly entered region may transiently return this — retry shortly. */
5324
5394
  Unauthorized = "UNAUTHORIZED",
5325
5395
  /** Unspecified server error (1). Retry; if it persists, report it. */