@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.
- package/README.md +125 -57
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -1
- package/dist/crowdy-client.d.ts +41 -13
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +41 -16
- package/dist/domains/apps.d.ts +48 -20
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +58 -35
- package/dist/domains/auth.d.ts +33 -22
- package/dist/domains/auth.d.ts.map +1 -1
- package/dist/domains/auth.js +51 -33
- package/dist/domains/udp.d.ts +9 -1
- package/dist/domains/udp.d.ts.map +1 -1
- package/dist/domains/udp.js +14 -1
- package/dist/domains/users.d.ts +19 -16
- package/dist/domains/users.d.ts.map +1 -1
- package/dist/domains/users.js +21 -39
- package/dist/generated/graphql.d.ts +1077 -7
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +16 -9
- package/dist/index.d.ts +29 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -15
- package/dist/realtime.d.ts +3 -0
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +3 -0
- package/dist/types.d.ts +2 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -33
- package/dist/world.d.ts +9 -0
- package/dist/world.d.ts.map +1 -1
- package/dist/world.js +17 -0
- package/package.json +2 -1
- package/dist/domains/appAccess.d.ts +0 -23
- package/dist/domains/appAccess.d.ts.map +0 -1
- package/dist/domains/appAccess.js +0 -42
- package/dist/domains/billing.d.ts +0 -17
- package/dist/domains/billing.d.ts.map +0 -1
- package/dist/domains/billing.js +0 -31
- package/dist/domains/organizations.d.ts +0 -33
- package/dist/domains/organizations.d.ts.map +0 -1
- package/dist/domains/organizations.js +0 -90
- package/dist/domains/payments.d.ts +0 -20
- package/dist/domains/payments.d.ts.map +0 -1
- package/dist/domains/payments.js +0 -28
- package/dist/domains/quotas.d.ts +0 -20
- package/dist/domains/quotas.d.ts.map +0 -1
- package/dist/domains/quotas.js +0 -34
package/dist/domains/apps.js
CHANGED
|
@@ -1,49 +1,72 @@
|
|
|
1
|
-
import { AppDocument, AppBySlugDocument, MyAppsDocument, AppsForOrgDocument, MarketplaceAppsDocument, CreateAppDocument, UpdateAppDocument, ArchiveAppDocument, SetAppVisibilityDocument, } from '../generated/graphql.js';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
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
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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(
|
|
11
|
-
this.
|
|
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
|
-
|
|
18
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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.
|
|
55
|
+
const data = await this.management.request(MyAppsDocument, {});
|
|
27
56
|
return data.myApps;
|
|
28
57
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
}
|
package/dist/domains/auth.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
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
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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
|
|
13
|
-
private
|
|
14
|
-
constructor(
|
|
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
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
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,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/domains/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAUL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,OAAO;IAEhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,SAAS;IAGrC;;;;OAIG;IACG,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAQnE,wEAAwE;IAClE,QAAQ,CACZ,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAQxC;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAMhC,2DAA2D;IACrD,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAKpC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK7C,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOrD,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAO1D,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOxD,cAAc,CAClB,eAAe,EAAE,MAAM,EACvB,WAAW,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"}
|
package/dist/domains/auth.js
CHANGED
|
@@ -1,70 +1,88 @@
|
|
|
1
|
-
import { LoginDocument, RegisterDocument, LogoutDocument, LogoutAllDevicesDocument, ConfirmEmailDocument, RequestPasswordResetDocument, ResetPasswordDocument, ResendConfirmationEmailDocument, ChangePasswordDocument, } from '../generated/graphql.js';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
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
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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(
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
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.
|
|
23
|
+
const data = await this.graphql.request(LoginDocument, { input });
|
|
16
24
|
if (data.login?.token) {
|
|
17
|
-
this.
|
|
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.
|
|
31
|
+
const data = await this.graphql.request(RegisterDocument, { input });
|
|
23
32
|
if (data.register?.token) {
|
|
24
|
-
this.
|
|
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.
|
|
30
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
67
|
-
|
|
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
|
}
|
package/dist/domains/udp.d.ts
CHANGED
|
@@ -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,
|
|
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,EAErC,KAAK,uCAAuC,EAC7C,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,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;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;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"}
|
package/dist/domains/udp.js
CHANGED
|
@@ -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
|
package/dist/domains/users.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
2
|
+
* Users sub-client. Targets `cks-management-api` — game-api never exposes
|
|
3
|
+
* identity mutations after the split.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
|
12
|
-
constructor(
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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;
|
|
1
|
+
{"version":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"}
|
package/dist/domains/users.js
CHANGED
|
@@ -1,53 +1,35 @@
|
|
|
1
|
-
import { MeDocument, UserDocument, UsersPaginatedDocument, UpdateGamertagDocument, UpdateUserStateDocument, SetSuperAdminDocument, SetEarlyAccessOverrideDocument, UpdateUserTypeDocument, ForceLogoutUserDocument, DeleteMyAccountDocument, } from '../generated/graphql.js';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Users sub-client. Targets `cks-management-api` — game-api never exposes
|
|
3
|
+
* identity mutations after the split.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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(
|
|
11
|
-
this.
|
|
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.
|
|
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.
|
|
24
|
+
const data = await this.graphql.request(UpdateGamertagDocument, { input });
|
|
27
25
|
return data.updateGamertag;
|
|
28
26
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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.
|
|
32
|
+
const data = await this.graphql.request(DeleteMyAccountDocument);
|
|
51
33
|
return data.deleteMyAccount;
|
|
52
34
|
}
|
|
53
35
|
}
|