@crowdedkingdoms/crowdyjs 18.0.0-dev.1 → 18.0.1-dev.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.
@@ -1,5 +1,5 @@
1
1
  import type { GraphQLClient } from '../client.js';
2
- import { type MeQuery, type UpdateGamertagInput, type UpdateGamertagMutation, type UserQuery, type UsersPaginatedQuery, type UsersPaginatedQueryVariables, type UsersConnectionQuery, type UsersConnectionQueryVariables, type SetSuperAdminMutation, type SetOperatorMutation, type SetEarlyAccessOverrideMutation, type UpdateUserTypeMutation, type ForceLogoutUserMutation, type UpdateUserStateMutation, type UpdateUserStateInput, type FreePlayWindowQuery } from '../generated/graphql.js';
2
+ import { type MeQuery, type UpdateGamertagInput, type UpdateGamertagMutation, type UserQuery, type UpdateUserStateMutation, type UpdateUserStateInput, type FreePlayWindowQuery } from '../generated/graphql.js';
3
3
  /**
4
4
  * User identity & account management — exposed as `client.users`.
5
5
  *
@@ -8,8 +8,8 @@ import { type MeQuery, type UpdateGamertagInput, type UpdateGamertagMutation, ty
8
8
  * exposes these identity mutations — calling them against a game-api endpoint
9
9
  * throws {@link CrowdyGraphQLError} with `FORBIDDEN`, directing you to the
10
10
  * management API. Only the read/identity surface a game client realistically
11
- * needs lives here; super-admin / operator screens use the management UI
12
- * directly rather than the SDK.
11
+ * needs lives here; platform administration (super-admin and operator fields)
12
+ * is not in the SDK: call the API directly from your own tooling.
13
13
  *
14
14
  * Every method needs a valid session (a bearer token set by
15
15
  * `client.auth.login()` / `register()` or `client.setToken()`); without one the
@@ -62,84 +62,17 @@ export declare class UsersAPI {
62
62
  */
63
63
  freePlayWindow(): Promise<FreePlayWindowQuery['freePlayWindowInfo']>;
64
64
  /**
65
- * Look up any user by id. **Super-admin only** (regular callers can only read
66
- * their own profile via {@link me}).
65
+ * Look up a user by id. Requires a valid session.
67
66
  *
68
67
  * @param id - Numeric user id (`BigInt` as a decimal string).
69
68
  * @returns The {@link User}, or `null` if no such user.
70
69
  */
71
70
  get(id: string): Promise<UserQuery['user']>;
72
71
  /**
73
- * Search/list users with offset pagination. **Super-admin only.**
72
+ * Replace the caller's own top-level state blob (base64; `null` clears it).
73
+ * Only ever writes the caller. Requires a valid session.
74
74
  *
75
- * @param opts - Optional `query` (prefix match over email/gamertag/id) and
76
- * `limit` / `offset`.
77
- * @returns A page of users.
78
- * @remarks Prefer {@link listConnection} (Relay cursor pagination) for large
79
- * result sets; the offset args here are deprecated server-side.
80
- */
81
- paginated(opts?: {
82
- query?: UsersPaginatedQueryVariables['query'];
83
- limit?: UsersPaginatedQueryVariables['limit'];
84
- offset?: UsersPaginatedQueryVariables['offset'];
85
- }): Promise<UsersPaginatedQuery['usersPaginated']>;
86
- /**
87
- * Relay-style cursor pagination over users — the preferred alternative to
88
- * {@link paginated}. **Super-admin only.** Page with `first` plus the previous
89
- * page's `pageInfo.endCursor` as `after`. See
90
- * https://docs.crowdedkingdoms.com/overview/pagination.
91
- *
92
- * @param args - Optional `first`, `after`, and `query`.
93
- * @returns A {@link UsersConnection}.
94
- */
95
- listConnection(args?: UsersConnectionQueryVariables): Promise<UsersConnectionQuery['usersConnection']>;
96
- /**
97
- * Grant or revoke the platform `is_super_admin` flag on a user. **Super-admin
98
- * only.**
99
- *
100
- * @param userId - Target user id.
101
- * @param value - `true` to grant, `false` to revoke.
102
- * @returns The updated user's `userId` + `isSuperAdmin`.
103
- */
104
- setSuperAdmin(userId: string, value: boolean): Promise<SetSuperAdminMutation['setSuperAdmin']>;
105
- /**
106
- * Grant or revoke the platform `is_operator` flag (control-plane access) on a
107
- * user. **Super-admin only.**
108
- *
109
- * @param userId - Target user id.
110
- * @param value - `true` to grant, `false` to revoke.
111
- * @returns The updated user's `userId` + `isOperator`.
112
- */
113
- setOperator(userId: string, value: boolean): Promise<SetOperatorMutation['setOperator']>;
114
- /**
115
- * Force an early-access override on a user (bypasses the early-access gate).
116
- * **Super-admin only.**
117
- *
118
- * @param userId - Target user id.
119
- * @param value - `true` to grant the override, `false` to clear it.
120
- * @returns The updated user's `userId` + `grantEarlyAccessOverride`.
121
- */
122
- setEarlyAccessOverride(userId: string, value: boolean): Promise<SetEarlyAccessOverrideMutation['setEarlyAccessOverride']>;
123
- /**
124
- * Set a user's `user_type`. **Super-admin only.**
125
- *
126
- * @param userId - Target user id.
127
- * @param value - The new user type string.
128
- * @returns The updated user's `userId` + `userType`.
129
- */
130
- updateType(userId: string, value: string): Promise<UpdateUserTypeMutation['updateUserType']>;
131
- /**
132
- * Revoke all of a user's sessions (force logout everywhere). **Super-admin
133
- * only.**
134
- *
135
- * @param userId - Target user id.
136
- * @returns `true` on success.
137
- */
138
- forceLogout(userId: string): Promise<ForceLogoutUserMutation['forceLogoutUser']>;
139
- /**
140
- * Replace a user's top-level state blob. **Super-admin only.**
141
- *
142
- * @param input - {@link UpdateUserStateInput} (`userId` + base64 `state`).
75
+ * @param input - {@link UpdateUserStateInput}: the base64 `state`.
143
76
  * @returns The updated user's `userId` + `state`.
144
77
  */
145
78
  updateState(input: UpdateUserStateInput): Promise<UpdateUserStateMutation['updateUserState']>;
@@ -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;AAClD,OAAO,EAcL,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,Q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CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAKjD;;;;;;OAMG;IACG,WAAW,CACf,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;CAIvD"}
@@ -1,4 +1,4 @@
1
- import { MeDocument, UpdateGamertagDocument, DeleteMyAccountDocument, UserDocument, UsersPaginatedDocument, UsersConnectionDocument, SetSuperAdminDocument, SetOperatorDocument, SetEarlyAccessOverrideDocument, UpdateUserTypeDocument, ForceLogoutUserDocument, UpdateUserStateDocument, FreePlayWindowDocument, } from '../generated/graphql.js';
1
+ import { MeDocument, UpdateGamertagDocument, DeleteMyAccountDocument, UserDocument, UpdateUserStateDocument, FreePlayWindowDocument, } from '../generated/graphql.js';
2
2
  /**
3
3
  * User identity & account management — exposed as `client.users`.
4
4
  *
@@ -7,8 +7,8 @@ import { MeDocument, UpdateGamertagDocument, DeleteMyAccountDocument, UserDocume
7
7
  * exposes these identity mutations — calling them against a game-api endpoint
8
8
  * throws {@link CrowdyGraphQLError} with `FORBIDDEN`, directing you to the
9
9
  * management API. Only the read/identity surface a game client realistically
10
- * needs lives here; super-admin / operator screens use the management UI
11
- * directly rather than the SDK.
10
+ * needs lives here; platform administration (super-admin and operator fields)
11
+ * is not in the SDK: call the API directly from your own tooling.
12
12
  *
13
13
  * Every method needs a valid session (a bearer token set by
14
14
  * `client.auth.login()` / `register()` or `client.setToken()`); without one the
@@ -74,8 +74,7 @@ export class UsersAPI {
74
74
  return data.freePlayWindowInfo;
75
75
  }
76
76
  /**
77
- * Look up any user by id. **Super-admin only** (regular callers can only read
78
- * their own profile via {@link me}).
77
+ * Look up a user by id. Requires a valid session.
79
78
  *
80
79
  * @param id - Numeric user id (`BigInt` as a decimal string).
81
80
  * @returns The {@link User}, or `null` if no such user.
@@ -85,107 +84,10 @@ export class UsersAPI {
85
84
  return data.user;
86
85
  }
87
86
  /**
88
- * Search/list users with offset pagination. **Super-admin only.**
87
+ * Replace the caller's own top-level state blob (base64; `null` clears it).
88
+ * Only ever writes the caller. Requires a valid session.
89
89
  *
90
- * @param opts - Optional `query` (prefix match over email/gamertag/id) and
91
- * `limit` / `offset`.
92
- * @returns A page of users.
93
- * @remarks Prefer {@link listConnection} (Relay cursor pagination) for large
94
- * result sets; the offset args here are deprecated server-side.
95
- */
96
- async paginated(opts = {}) {
97
- const data = await this.graphql.request(UsersPaginatedDocument, opts);
98
- return data.usersPaginated;
99
- }
100
- /**
101
- * Relay-style cursor pagination over users — the preferred alternative to
102
- * {@link paginated}. **Super-admin only.** Page with `first` plus the previous
103
- * page's `pageInfo.endCursor` as `after`. See
104
- * https://docs.crowdedkingdoms.com/overview/pagination.
105
- *
106
- * @param args - Optional `first`, `after`, and `query`.
107
- * @returns A {@link UsersConnection}.
108
- */
109
- async listConnection(args = {}) {
110
- const data = await this.graphql.request(UsersConnectionDocument, args);
111
- return data.usersConnection;
112
- }
113
- /**
114
- * Grant or revoke the platform `is_super_admin` flag on a user. **Super-admin
115
- * only.**
116
- *
117
- * @param userId - Target user id.
118
- * @param value - `true` to grant, `false` to revoke.
119
- * @returns The updated user's `userId` + `isSuperAdmin`.
120
- */
121
- async setSuperAdmin(userId, value) {
122
- const data = await this.graphql.request(SetSuperAdminDocument, {
123
- userId,
124
- value,
125
- });
126
- return data.setSuperAdmin;
127
- }
128
- /**
129
- * Grant or revoke the platform `is_operator` flag (control-plane access) on a
130
- * user. **Super-admin only.**
131
- *
132
- * @param userId - Target user id.
133
- * @param value - `true` to grant, `false` to revoke.
134
- * @returns The updated user's `userId` + `isOperator`.
135
- */
136
- async setOperator(userId, value) {
137
- const data = await this.graphql.request(SetOperatorDocument, {
138
- userId,
139
- value,
140
- });
141
- return data.setOperator;
142
- }
143
- /**
144
- * Force an early-access override on a user (bypasses the early-access gate).
145
- * **Super-admin only.**
146
- *
147
- * @param userId - Target user id.
148
- * @param value - `true` to grant the override, `false` to clear it.
149
- * @returns The updated user's `userId` + `grantEarlyAccessOverride`.
150
- */
151
- async setEarlyAccessOverride(userId, value) {
152
- const data = await this.graphql.request(SetEarlyAccessOverrideDocument, {
153
- userId,
154
- value,
155
- });
156
- return data.setEarlyAccessOverride;
157
- }
158
- /**
159
- * Set a user's `user_type`. **Super-admin only.**
160
- *
161
- * @param userId - Target user id.
162
- * @param value - The new user type string.
163
- * @returns The updated user's `userId` + `userType`.
164
- */
165
- async updateType(userId, value) {
166
- const data = await this.graphql.request(UpdateUserTypeDocument, {
167
- userId,
168
- value,
169
- });
170
- return data.updateUserType;
171
- }
172
- /**
173
- * Revoke all of a user's sessions (force logout everywhere). **Super-admin
174
- * only.**
175
- *
176
- * @param userId - Target user id.
177
- * @returns `true` on success.
178
- */
179
- async forceLogout(userId) {
180
- const data = await this.graphql.request(ForceLogoutUserDocument, {
181
- userId,
182
- });
183
- return data.forceLogoutUser;
184
- }
185
- /**
186
- * Replace a user's top-level state blob. **Super-admin only.**
187
- *
188
- * @param input - {@link UpdateUserStateInput} (`userId` + base64 `state`).
90
+ * @param input - {@link UpdateUserStateInput}: the base64 `state`.
189
91
  * @returns The updated user's `userId` + `state`.
190
92
  */
191
93
  async updateState(input) {