@crowdedkingdomstudios/crowdyjs 3.0.0 → 4.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.
Files changed (49) hide show
  1. package/README.md +125 -57
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +3 -1
  4. package/dist/crowdy-client.d.ts +41 -13
  5. package/dist/crowdy-client.d.ts.map +1 -1
  6. package/dist/crowdy-client.js +41 -16
  7. package/dist/domains/apps.d.ts +48 -20
  8. package/dist/domains/apps.d.ts.map +1 -1
  9. package/dist/domains/apps.js +58 -35
  10. package/dist/domains/auth.d.ts +33 -22
  11. package/dist/domains/auth.d.ts.map +1 -1
  12. package/dist/domains/auth.js +51 -33
  13. package/dist/domains/udp.d.ts +9 -1
  14. package/dist/domains/udp.d.ts.map +1 -1
  15. package/dist/domains/udp.js +14 -1
  16. package/dist/domains/users.d.ts +19 -16
  17. package/dist/domains/users.d.ts.map +1 -1
  18. package/dist/domains/users.js +21 -39
  19. package/dist/generated/graphql.d.ts +1077 -7
  20. package/dist/generated/graphql.d.ts.map +1 -1
  21. package/dist/generated/graphql.js +16 -9
  22. package/dist/index.d.ts +29 -14
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +30 -15
  25. package/dist/realtime.d.ts +3 -0
  26. package/dist/realtime.d.ts.map +1 -1
  27. package/dist/realtime.js +3 -0
  28. package/dist/types.d.ts +2 -31
  29. package/dist/types.d.ts.map +1 -1
  30. package/dist/types.js +5 -33
  31. package/dist/world.d.ts +9 -0
  32. package/dist/world.d.ts.map +1 -1
  33. package/dist/world.js +17 -0
  34. package/package.json +2 -1
  35. package/dist/domains/appAccess.d.ts +0 -23
  36. package/dist/domains/appAccess.d.ts.map +0 -1
  37. package/dist/domains/appAccess.js +0 -42
  38. package/dist/domains/billing.d.ts +0 -17
  39. package/dist/domains/billing.d.ts.map +0 -1
  40. package/dist/domains/billing.js +0 -31
  41. package/dist/domains/organizations.d.ts +0 -33
  42. package/dist/domains/organizations.d.ts.map +0 -1
  43. package/dist/domains/organizations.js +0 -90
  44. package/dist/domains/payments.d.ts +0 -20
  45. package/dist/domains/payments.d.ts.map +0 -1
  46. package/dist/domains/payments.js +0 -28
  47. package/dist/domains/quotas.d.ts +0 -20
  48. package/dist/domains/quotas.d.ts.map +0 -1
  49. package/dist/domains/quotas.js +0 -34
@@ -1,49 +1,72 @@
1
- import { AppDocument, AppBySlugDocument, MyAppsDocument, AppsForOrgDocument, MarketplaceAppsDocument, CreateAppDocument, UpdateAppDocument, ArchiveAppDocument, SetAppVisibilityDocument, } from '../generated/graphql.js';
2
1
  /**
3
- * App (game / world) lifecycle and discovery. Exposed as `client.apps`.
2
+ * Apps sub-client. Targets `cks-management-api` (where the apps catalog
3
+ * lives). After the DB split each app may be served by its own per-tenant
4
+ * cks-game-api; the marketplace returns `gameApiUrl` for those rows so the
5
+ * caller can build a per-app `CrowdyClient` against the correct endpoint.
4
6
  *
5
- * `marketplace()` is a public listing (no auth) of every app where
6
- * visibility = PUBLIC and status = LIVE; the rest of the methods require
7
- * either org-membership permissions or super admin.
7
+ * Typical pattern:
8
+ *
9
+ * const baseClient = createCrowdyClient({
10
+ * managementUrl: 'https://api.example.com',
11
+ * httpUrl: 'https://legacy-game-api.example.com', // pre-split fallback
12
+ * });
13
+ * await baseClient.auth.login({ email, password });
14
+ *
15
+ * const route = await baseClient.apps.routeFor(appId);
16
+ * if (route.splitMode && route.gameApiUrl) {
17
+ * const perAppClient = createCrowdyClient({
18
+ * managementUrl: 'https://api.example.com',
19
+ * httpUrl: route.gameApiUrl,
20
+ * wsUrl: route.gameApiUrl.replace(/^https?/, 'wss'),
21
+ * tokenStore: baseClient.session.tokenStore,
22
+ * });
23
+ * // drive gameplay through perAppClient
24
+ * }
8
25
  */
26
+ import { AppDocument, AppBySlugDocument, MyAppsDocument, } from '../generated/graphql.js';
27
+ function appRouteFromAppRow(row) {
28
+ if (!row || typeof row !== 'object')
29
+ return null;
30
+ const r = row;
31
+ if (typeof r.appId !== 'string')
32
+ return null;
33
+ return {
34
+ appId: r.appId,
35
+ splitMode: typeof r.splitMode === 'boolean' ? r.splitMode : false,
36
+ gameApiUrl: typeof r.gameApiUrl === 'string' && r.gameApiUrl ? r.gameApiUrl : null,
37
+ };
38
+ }
9
39
  export class AppsAPI {
10
- constructor(gql) {
11
- this.gql = gql;
12
- }
13
- async marketplace(args = {}) {
14
- const data = await this.gql.request(MarketplaceAppsDocument, args);
15
- return data.apps;
40
+ constructor(management) {
41
+ this.management = management;
16
42
  }
17
- async byId(appId) {
18
- const data = await this.gql.request(AppDocument, { appId });
43
+ /** Fetch a single app by id. */
44
+ async app(appId) {
45
+ const data = await this.management.request(AppDocument, { appId });
19
46
  return data.app;
20
47
  }
21
- async bySlug(args) {
22
- const data = await this.gql.request(AppBySlugDocument, args);
48
+ /** Fetch by org slug + app slug (marketplace links). */
49
+ async appBySlug(orgSlug, appSlug) {
50
+ const data = await this.management.request(AppBySlugDocument, { orgSlug, appSlug });
23
51
  return data.appBySlug;
24
52
  }
53
+ /** Apps the caller can play (org membership OR active access). */
25
54
  async myApps() {
26
- const data = await this.gql.request(MyAppsDocument, undefined);
55
+ const data = await this.management.request(MyAppsDocument, {});
27
56
  return data.myApps;
28
57
  }
29
- async forOrg(orgSlug) {
30
- const data = await this.gql.request(AppsForOrgDocument, { orgSlug });
31
- return data.appsForOrg;
32
- }
33
- async create(input) {
34
- const data = await this.gql.request(CreateAppDocument, { input });
35
- return data.createApp;
36
- }
37
- async update(args) {
38
- const data = await this.gql.request(UpdateAppDocument, args);
39
- return data.updateApp;
40
- }
41
- async archive(appId) {
42
- const data = await this.gql.request(ArchiveAppDocument, { appId });
43
- return data.archiveApp;
44
- }
45
- async setVisibility(args) {
46
- const data = await this.gql.request(SetAppVisibilityDocument, args);
47
- return data.setAppVisibility;
58
+ /**
59
+ * Convenience: returns just the routing tuple for a given app. If the
60
+ * app row is missing or the API does not expose split-mode fields yet,
61
+ * returns `{ appId, splitMode: false, gameApiUrl: null }` so the caller
62
+ * keeps using the legacy single-endpoint deployment.
63
+ */
64
+ async routeFor(appId) {
65
+ const row = await this.app(appId);
66
+ return (appRouteFromAppRow(row) ?? {
67
+ appId,
68
+ splitMode: false,
69
+ gameApiUrl: null,
70
+ });
48
71
  }
49
72
  }
@@ -1,32 +1,43 @@
1
- import type { GraphQLClient } from '../client.js';
2
- import type { AuthState } from '../auth-state.js';
3
- import { type LoginMutation, type LoginMutationVariables, type RegisterMutation, type RegisterMutationVariables, type LogoutMutation, type LogoutAllDevicesMutation, type ConfirmEmailMutationVariables, type RequestPasswordResetMutationVariables, type ResetPasswordMutationVariables, type ResendConfirmationEmailMutationVariables } from '../generated/graphql.js';
4
1
  /**
5
- * Authentication operations. Exposed as `client.auth.<method>`.
2
+ * Auth sub-client. Talks to `cks-management-api` (NOT the game API) because
3
+ * the management API owns the `game_tokens` table that backs every login /
4
+ * register / password / email-confirm flow.
6
5
  *
7
- * `login` / `register` write the returned token into the shared `AuthState`
8
- * so the WebSocket subscription manager picks it up automatically. `logout`
9
- * / `logoutAllDevices` clear it.
6
+ * The returned `token` is a `game_tokens` row that game-api will validate
7
+ * against the same shared Postgres. Once the SDK has a token, the rest of
8
+ * the sub-clients (chunks, voxels, actors, udp, ...) use it transparently
9
+ * via the shared `AuthState`.
10
10
  */
11
+ import type { GraphQLClient } from '../client.js';
12
+ import type { AuthState } from '../auth-state.js';
13
+ import { type LoginMutation, type LoginUserInput, type RegisterMutation, type RegisterUserInput, type ResetPasswordInput } from '../generated/graphql.js';
11
14
  export declare class AuthAPI {
12
- private gql;
13
- private authState;
14
- constructor(gql: GraphQLClient, authState: AuthState);
15
- login(input: LoginMutationVariables['input']): Promise<LoginMutation['login']>;
16
- register(input: RegisterMutationVariables['input']): Promise<RegisterMutation['register']>;
17
- logout(): Promise<LogoutMutation['logout']>;
18
- logoutAllDevices(): Promise<LogoutAllDevicesMutation['logoutAllDevices']>;
15
+ private readonly graphql;
16
+ private readonly session;
17
+ constructor(graphql: GraphQLClient, session: AuthState);
19
18
  /**
20
- * Manual token override - lets callers seed an existing session token
21
- * (e.g. on app reload) or stamp out the in-memory token without firing
22
- * a logout mutation. Pass `null` to clear.
19
+ * Log in and persist the resulting `game_tokens` bearer token via the
20
+ * shared `AuthState`. All subsequent SDK calls (game-api or
21
+ * management-api) include it automatically.
23
22
  */
23
+ login(input: LoginUserInput): Promise<LoginMutation['login']>;
24
+ /** Register a new user. Same token-persistence behaviour as `login`. */
25
+ register(input: RegisterUserInput): Promise<RegisterMutation['register']>;
26
+ /**
27
+ * Single-device logout. Clears the in-memory token after a successful
28
+ * server-side revoke so other sub-clients don't keep using it.
29
+ */
30
+ logout(): Promise<boolean>;
31
+ /** Revoke every `game_tokens` row for the current user. */
32
+ logoutAllDevices(): Promise<boolean>;
33
+ confirmEmail(token: string): Promise<boolean>;
34
+ requestPasswordReset(email: string): Promise<boolean>;
35
+ resetPassword(input: ResetPasswordInput): Promise<boolean>;
36
+ resendConfirmationEmail(email: string): Promise<boolean>;
37
+ changePassword(currentPassword: string, newPassword: string): Promise<boolean>;
38
+ /** Imperatively replace the in-memory bearer token (e.g. on rehydrate). */
24
39
  setToken(token: string | null): void;
40
+ /** Read the current bearer token. */
25
41
  getToken(): string | null;
26
- confirmEmail(token: ConfirmEmailMutationVariables['token']): Promise<boolean>;
27
- requestPasswordReset(email: RequestPasswordResetMutationVariables['email']): Promise<boolean>;
28
- resetPassword(input: ResetPasswordMutationVariables['input']): Promise<boolean>;
29
- resendConfirmationEmail(email: ResendConfirmationEmailMutationVariables['email']): Promise<boolean>;
30
- changePassword(currentPassword: string, newPassword: string): Promise<boolean>;
31
42
  }
32
43
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/domains/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EA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W,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC;IAQnB,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIpC,qCAAqC;IACrC,QAAQ,IAAI,MAAM,GAAG,IAAI;CAG1B"}
@@ -1,70 +1,88 @@
1
- import { LoginDocument, RegisterDocument, LogoutDocument, LogoutAllDevicesDocument, ConfirmEmailDocument, RequestPasswordResetDocument, ResetPasswordDocument, ResendConfirmationEmailDocument, ChangePasswordDocument, } from '../generated/graphql.js';
2
1
  /**
3
- * Authentication operations. Exposed as `client.auth.<method>`.
2
+ * Auth sub-client. Talks to `cks-management-api` (NOT the game API) because
3
+ * the management API owns the `game_tokens` table that backs every login /
4
+ * register / password / email-confirm flow.
4
5
  *
5
- * `login` / `register` write the returned token into the shared `AuthState`
6
- * so the WebSocket subscription manager picks it up automatically. `logout`
7
- * / `logoutAllDevices` clear it.
6
+ * The returned `token` is a `game_tokens` row that game-api will validate
7
+ * against the same shared Postgres. Once the SDK has a token, the rest of
8
+ * the sub-clients (chunks, voxels, actors, udp, ...) use it transparently
9
+ * via the shared `AuthState`.
8
10
  */
11
+ import { ChangePasswordDocument, ConfirmEmailDocument, LoginDocument, LogoutAllDevicesDocument, LogoutDocument, RegisterDocument, RequestPasswordResetDocument, ResendConfirmationEmailDocument, ResetPasswordDocument, } from '../generated/graphql.js';
9
12
  export class AuthAPI {
10
- constructor(gql, authState) {
11
- this.gql = gql;
12
- this.authState = authState;
13
+ constructor(graphql, session) {
14
+ this.graphql = graphql;
15
+ this.session = session;
13
16
  }
17
+ /**
18
+ * Log in and persist the resulting `game_tokens` bearer token via the
19
+ * shared `AuthState`. All subsequent SDK calls (game-api or
20
+ * management-api) include it automatically.
21
+ */
14
22
  async login(input) {
15
- const data = await this.gql.request(LoginDocument, { input });
23
+ const data = await this.graphql.request(LoginDocument, { input });
16
24
  if (data.login?.token) {
17
- this.authState.setToken(data.login.token);
25
+ this.session.setToken(data.login.token);
18
26
  }
19
27
  return data.login;
20
28
  }
29
+ /** Register a new user. Same token-persistence behaviour as `login`. */
21
30
  async register(input) {
22
- const data = await this.gql.request(RegisterDocument, { input });
31
+ const data = await this.graphql.request(RegisterDocument, { input });
23
32
  if (data.register?.token) {
24
- this.authState.setToken(data.register.token);
33
+ this.session.setToken(data.register.token);
25
34
  }
26
35
  return data.register;
27
36
  }
37
+ /**
38
+ * Single-device logout. Clears the in-memory token after a successful
39
+ * server-side revoke so other sub-clients don't keep using it.
40
+ */
28
41
  async logout() {
29
- const data = await this.gql.request(LogoutDocument, undefined);
30
- this.authState.setToken(null);
42
+ const data = await this.graphql.request(LogoutDocument);
43
+ this.session.setToken(null);
31
44
  return data.logout;
32
45
  }
46
+ /** Revoke every `game_tokens` row for the current user. */
33
47
  async logoutAllDevices() {
34
- const data = await this.gql.request(LogoutAllDevicesDocument, undefined);
35
- this.authState.setToken(null);
48
+ const data = await this.graphql.request(LogoutAllDevicesDocument);
36
49
  return data.logoutAllDevices;
37
50
  }
38
- /**
39
- * Manual token override - lets callers seed an existing session token
40
- * (e.g. on app reload) or stamp out the in-memory token without firing
41
- * a logout mutation. Pass `null` to clear.
42
- */
43
- setToken(token) {
44
- this.authState.setToken(token);
45
- }
46
- getToken() {
47
- return this.authState.getToken();
48
- }
49
51
  async confirmEmail(token) {
50
- const data = await this.gql.request(ConfirmEmailDocument, { token });
52
+ const data = await this.graphql.request(ConfirmEmailDocument, { token });
51
53
  return data.confirmEmail;
52
54
  }
53
55
  async requestPasswordReset(email) {
54
- const data = await this.gql.request(RequestPasswordResetDocument, { email });
56
+ const data = await this.graphql.request(RequestPasswordResetDocument, {
57
+ email,
58
+ });
55
59
  return data.requestPasswordReset;
56
60
  }
57
61
  async resetPassword(input) {
58
- const data = await this.gql.request(ResetPasswordDocument, { input });
62
+ const data = await this.graphql.request(ResetPasswordDocument, {
63
+ input,
64
+ });
59
65
  return data.resetPassword;
60
66
  }
61
67
  async resendConfirmationEmail(email) {
62
- const data = await this.gql.request(ResendConfirmationEmailDocument, { email });
68
+ const data = await this.graphql.request(ResendConfirmationEmailDocument, {
69
+ email,
70
+ });
63
71
  return data.resendConfirmationEmail;
64
72
  }
65
73
  async changePassword(currentPassword, newPassword) {
66
- const vars = { currentPassword, newPassword };
67
- const data = await this.gql.request(ChangePasswordDocument, vars);
74
+ const data = await this.graphql.request(ChangePasswordDocument, {
75
+ currentPassword,
76
+ newPassword,
77
+ });
68
78
  return data.changePassword;
69
79
  }
80
+ /** Imperatively replace the in-memory bearer token (e.g. on rehydrate). */
81
+ setToken(token) {
82
+ this.session.setToken(token);
83
+ }
84
+ /** Read the current bearer token. */
85
+ getToken() {
86
+ return this.session.getToken();
87
+ }
70
88
  }
@@ -1,6 +1,6 @@
1
1
  import type { GraphQLClient } from '../client.js';
2
2
  import type { SubscriptionManager, UdpNotificationHandlers } from '../subscriptions.js';
3
- import { type ConnectUdpProxyMutation, type UdpProxyConnectionStatusQuery, type SendActorUpdateMutationVariables, type SendVoxelUpdateMutationVariables, type SendAudioPacketMutationVariables, type SendTextPacketMutationVariables, type SendClientEventMutationVariables } from '../generated/graphql.js';
3
+ import { type ConnectUdpProxyMutation, type UdpProxyConnectionStatusQuery, type SendActorUpdateMutationVariables, type SendVoxelUpdateMutationVariables, type SendAudioPacketMutationVariables, type SendTextPacketMutationVariables, type SendClientEventMutationVariables, type SendSingleActorMessageMutationVariables } from '../generated/graphql.js';
4
4
  import type { SpatialNotification } from '../realtime.js';
5
5
  /**
6
6
  * UDP proxy access for browser-style clients that can't open raw UDP
@@ -37,6 +37,14 @@ export declare class UdpAPI {
37
37
  sendClientEventAndWait(input: SendClientEventMutationVariables['input'], options?: {
38
38
  timeoutMs?: number;
39
39
  }): Promise<SpatialNotification>;
40
+ /**
41
+ * Send a direct actor-to-actor message, delivered only to the actor whose
42
+ * UUID matches `input.targetUuid` (the sender must know that actor's chunk).
43
+ * Fire-and-forget: the sender receives no echo, so there is no
44
+ * `sendSingleActorMessageAndWait` variant. The target receives a
45
+ * `SingleActorMessageNotification` on its `udpNotifications` subscription.
46
+ */
47
+ sendSingleActorMessage(input: SendSingleActorMessageMutationVariables['input']): Promise<boolean>;
40
48
  /**
41
49
  * Subscribe to udpNotifications. Pass any combination of typename
42
50
  * handlers; the returned function detaches all of them. The first
@@ -1 +1 @@
1
- {"version":3,"file":"udp.d.ts","sourceRoot":"","sources":["../../src/domains/udp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,KAAK,uBAAuB,EAG5B,KAAK,6BAA6B,EAElC,KAAK,gCAAgC,EAErC,KAAK,gCAAgC,EAErC,KAAK,gCAAgC,EAErC,KAAK,+BAA+B,EAEpC,KAAK,gCAAgC,EACtC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D;;;;;;GAMG;AACH,qBAAa,MAAM;IAIf,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,IAAI;IAJd,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2B;gBAG3C,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,mBAAmB;IAG7B,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;IAK9D,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAK9B,gBAAgB,IAAI,OAAO,CAC/B,6BAA6B,CAAC,0BAA0B,CAAC,CAC1D;IAQK,eAAe,CACnB,KAAK,EAAE,gCAAgC,CAAC,OAAO,CAAC,GAC/C,OAAO,CAAC,OAAO,CAAC;IAKb,sBAAsB,CAC1B,KAAK,EAAE,gCAAgC,CAAC,OAAO,CAAC,EAChD,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACnC,OAAO,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GAC/C,OAAO,CAAC,OAAO,CAAC;IAKb,sBAAsB,CAC1B,KAAK,EAAE,gCAAgC,CAAC,OAAO,CAAC,EAChD,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACnC,OAAO,CAAC,mBAAmB,CAAC;IAOzB,cAAc,CAClB,KAAK,EAAE,+BAA+B,CAAC,OAAO,CAAC,GAC9C,OAAO,CAAC,OAAO,CAAC;IAKb,qBAAqB,CACzB,KAAK,EAAE,+BAA+B,CAAC,OAAO,CAAC,EAC/C,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACnC,OAAO,CAAC,mBAAmB,CAAC;IAOzB,eAAe,CACnB,KAAK,EAAE,gCAAgC,CAAC,OAAO,CAAC,GAC/C,OAAO,CAAC,OAAO,CAAC;IAKb,sBAAsB,CAC1B,KAAK,EAAE,gCAAgC,CAAC,OAAO,CAAC,EAChD,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACnC,OAAO,CAAC,mBAAmB,CAAC;IAO/B;;;;;;OAMG;IACG,sBAAsB,CAC1B,KAAK,EAAE,uCAAuC,CAAC,OAAO,CAAC,GACtD,OAAO,CAAC,OAAO,CAAC;IAOnB;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,IAAI;IAIxD,OAAO,CAAC,YAAY;CAQrB"}
@@ -1,4 +1,4 @@
1
- import { ConnectUdpProxyDocument, DisconnectUdpProxyDocument, UdpProxyConnectionStatusDocument, SendActorUpdateDocument, SendVoxelUpdateDocument, SendAudioPacketDocument, SendTextPacketDocument, SendClientEventDocument, } from '../generated/graphql.js';
1
+ import { ConnectUdpProxyDocument, DisconnectUdpProxyDocument, UdpProxyConnectionStatusDocument, SendActorUpdateDocument, SendVoxelUpdateDocument, SendAudioPacketDocument, SendTextPacketDocument, SendClientEventDocument, SendSingleActorMessageDocument, } from '../generated/graphql.js';
2
2
  import { SequenceAllocator } from '../utils.js';
3
3
  /**
4
4
  * UDP proxy access for browser-style clients that can't open raw UDP
@@ -75,6 +75,19 @@ export class UdpAPI {
75
75
  await this.sendClientEvent(request);
76
76
  return wait;
77
77
  }
78
+ /**
79
+ * Send a direct actor-to-actor message, delivered only to the actor whose
80
+ * UUID matches `input.targetUuid` (the sender must know that actor's chunk).
81
+ * Fire-and-forget: the sender receives no echo, so there is no
82
+ * `sendSingleActorMessageAndWait` variant. The target receives a
83
+ * `SingleActorMessageNotification` on its `udpNotifications` subscription.
84
+ */
85
+ async sendSingleActorMessage(input) {
86
+ const data = await this.gql.request(SendSingleActorMessageDocument, {
87
+ input,
88
+ });
89
+ return data.sendSingleActorMessage;
90
+ }
78
91
  /**
79
92
  * Subscribe to udpNotifications. Pass any combination of typename
80
93
  * handlers; the returned function detaches all of them. The first
@@ -1,24 +1,27 @@
1
- import type { GraphQLClient } from '../client.js';
2
- import { type MeQuery, type UserQuery, type UserQueryVariables, type UsersPaginatedQuery, type UsersPaginatedQueryVariables, type UpdateGamertagMutation, type UpdateGamertagMutationVariables, type UpdateUserStateMutation, type UpdateUserStateMutationVariables, type SetSuperAdminMutation, type SetSuperAdminMutationVariables, type SetEarlyAccessOverrideMutation, type SetEarlyAccessOverrideMutationVariables, type UpdateUserTypeMutation, type UpdateUserTypeMutationVariables, type ForceLogoutUserMutationVariables } from '../generated/graphql.js';
3
1
  /**
4
- * User profile / directory queries and mutations. Exposed as `client.users`.
2
+ * Users sub-client. Targets `cks-management-api` game-api never exposes
3
+ * identity mutations after the split.
5
4
  *
6
- * The legacy `list` / `byGamertag` / `byEmail` triple has been collapsed
7
- * into a single super-admin-gated `searchPaginated` (server-side
8
- * `usersPaginated`).
5
+ * Only the read/identity surface that game clients realistically need is
6
+ * here. Super-admin / operator screens use cks-management-ui (Apollo)
7
+ * directly rather than the SDK.
9
8
  */
9
+ import type { GraphQLClient } from '../client.js';
10
+ import { type MeQuery, type UpdateGamertagInput, type UpdateGamertagMutation } from '../generated/graphql.js';
10
11
  export declare class UsersAPI {
11
- private gql;
12
- constructor(gql: GraphQLClient);
12
+ private readonly graphql;
13
+ constructor(graphql: GraphQLClient);
14
+ /**
15
+ * Validate the current Bearer token and return the user record. Returns
16
+ * null if the token is expired/revoked. Use this for session restore on
17
+ * SDK init.
18
+ */
13
19
  me(): Promise<MeQuery['me']>;
14
- byId(id: UserQueryVariables['id']): Promise<UserQuery['user']>;
15
- searchPaginated(args?: UsersPaginatedQueryVariables): Promise<UsersPaginatedQuery['usersPaginated']>;
16
- updateGamertag(input: UpdateGamertagMutationVariables['input']): Promise<UpdateGamertagMutation['updateGamertag']>;
17
- updateUserState(input: UpdateUserStateMutationVariables['input']): Promise<UpdateUserStateMutation['updateUserState']>;
18
- setSuperAdmin(args: SetSuperAdminMutationVariables): Promise<SetSuperAdminMutation['setSuperAdmin']>;
19
- setEarlyAccessOverride(args: SetEarlyAccessOverrideMutationVariables): Promise<SetEarlyAccessOverrideMutation['setEarlyAccessOverride']>;
20
- updateUserType(args: UpdateUserTypeMutationVariables): Promise<UpdateUserTypeMutation['updateUserType']>;
21
- forceLogoutUser(userId: ForceLogoutUserMutationVariables['userId']): Promise<boolean>;
20
+ updateGamertag(input: UpdateGamertagInput): Promise<UpdateGamertagMutation['updateGamertag']>;
21
+ /**
22
+ * Soft-deletes the current user's account: anonymizes PII and revokes
23
+ * sessions. Wallet / donation history stays intact via FK.
24
+ */
22
25
  deleteMyAccount(): Promise<boolean>;
23
26
  }
24
27
  //# sourceMappingURL=users.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/domains/users.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAEL,KAAK,OAAO,EAEZ,KAAK,SAAS,EACd,KAAK,kBAAkB,EAEvB,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EAEjC,KAAK,sBAAsB,EAC3B,KAA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3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/domains/users.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,aAAa;IAEnD;;;;OAIG;IACG,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAK5B,cAAc,CAClB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IAKpD;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;CAI1C"}
@@ -1,53 +1,35 @@
1
- import { MeDocument, UserDocument, UsersPaginatedDocument, UpdateGamertagDocument, UpdateUserStateDocument, SetSuperAdminDocument, SetEarlyAccessOverrideDocument, UpdateUserTypeDocument, ForceLogoutUserDocument, DeleteMyAccountDocument, } from '../generated/graphql.js';
2
1
  /**
3
- * User profile / directory queries and mutations. Exposed as `client.users`.
2
+ * Users sub-client. Targets `cks-management-api` game-api never exposes
3
+ * identity mutations after the split.
4
4
  *
5
- * The legacy `list` / `byGamertag` / `byEmail` triple has been collapsed
6
- * into a single super-admin-gated `searchPaginated` (server-side
7
- * `usersPaginated`).
5
+ * Only the read/identity surface that game clients realistically need is
6
+ * here. Super-admin / operator screens use cks-management-ui (Apollo)
7
+ * directly rather than the SDK.
8
8
  */
9
+ import { MeDocument, UpdateGamertagDocument, DeleteMyAccountDocument, } from '../generated/graphql.js';
9
10
  export class UsersAPI {
10
- constructor(gql) {
11
- this.gql = gql;
12
- }
11
+ constructor(graphql) {
12
+ this.graphql = graphql;
13
+ }
14
+ /**
15
+ * Validate the current Bearer token and return the user record. Returns
16
+ * null if the token is expired/revoked. Use this for session restore on
17
+ * SDK init.
18
+ */
13
19
  async me() {
14
- const data = await this.gql.request(MeDocument, undefined);
20
+ const data = await this.graphql.request(MeDocument);
15
21
  return data.me;
16
22
  }
17
- async byId(id) {
18
- const data = await this.gql.request(UserDocument, { id });
19
- return data.user;
20
- }
21
- async searchPaginated(args = {}) {
22
- const data = await this.gql.request(UsersPaginatedDocument, args);
23
- return data.usersPaginated;
24
- }
25
23
  async updateGamertag(input) {
26
- const data = await this.gql.request(UpdateGamertagDocument, { input });
24
+ const data = await this.graphql.request(UpdateGamertagDocument, { input });
27
25
  return data.updateGamertag;
28
26
  }
29
- async updateUserState(input) {
30
- const data = await this.gql.request(UpdateUserStateDocument, { input });
31
- return data.updateUserState;
32
- }
33
- async setSuperAdmin(args) {
34
- const data = await this.gql.request(SetSuperAdminDocument, args);
35
- return data.setSuperAdmin;
36
- }
37
- async setEarlyAccessOverride(args) {
38
- const data = await this.gql.request(SetEarlyAccessOverrideDocument, args);
39
- return data.setEarlyAccessOverride;
40
- }
41
- async updateUserType(args) {
42
- const data = await this.gql.request(UpdateUserTypeDocument, args);
43
- return data.updateUserType;
44
- }
45
- async forceLogoutUser(userId) {
46
- const data = await this.gql.request(ForceLogoutUserDocument, { userId });
47
- return data.forceLogoutUser;
48
- }
27
+ /**
28
+ * Soft-deletes the current user's account: anonymizes PII and revokes
29
+ * sessions. Wallet / donation history stays intact via FK.
30
+ */
49
31
  async deleteMyAccount() {
50
- const data = await this.gql.request(DeleteMyAccountDocument, undefined);
32
+ const data = await this.graphql.request(DeleteMyAccountDocument);
51
33
  return data.deleteMyAccount;
52
34
  }
53
35
  }