@crowdedkingdoms/crowdyjs 18.23.1 → 18.25.0-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.
Files changed (55) hide show
  1. package/MIGRATION.md +91 -0
  2. package/README.md +181 -28
  3. package/dist/crowdy-client.d.ts +10 -1
  4. package/dist/crowdy-client.d.ts.map +1 -1
  5. package/dist/crowdy-client.js +5 -0
  6. package/dist/default-origin.d.ts +6 -6
  7. package/dist/default-origin.d.ts.map +1 -1
  8. package/dist/default-origin.js +6 -6
  9. package/dist/domains/admin.d.ts +4 -0
  10. package/dist/domains/admin.d.ts.map +1 -1
  11. package/dist/domains/admin.js +1 -0
  12. package/dist/domains/apps.d.ts +49 -3
  13. package/dist/domains/apps.d.ts.map +1 -1
  14. package/dist/domains/apps.js +52 -3
  15. package/dist/domains/auth.d.ts +145 -16
  16. package/dist/domains/auth.d.ts.map +1 -1
  17. package/dist/domains/auth.js +158 -16
  18. package/dist/domains/inputLog.d.ts +9 -2
  19. package/dist/domains/inputLog.d.ts.map +1 -1
  20. package/dist/domains/inputLog.js +9 -2
  21. package/dist/domains/managedPlayers.d.ts +66 -3
  22. package/dist/domains/managedPlayers.d.ts.map +1 -1
  23. package/dist/domains/managedPlayers.js +19 -3
  24. package/dist/domains/moderation.d.ts +53 -0
  25. package/dist/domains/moderation.d.ts.map +1 -0
  26. package/dist/domains/moderation.js +68 -0
  27. package/dist/domains/platform.d.ts +16 -0
  28. package/dist/domains/platform.d.ts.map +1 -1
  29. package/dist/domains/platform.js +17 -0
  30. package/dist/domains/portal.d.ts +88 -8
  31. package/dist/domains/portal.d.ts.map +1 -1
  32. package/dist/domains/portal.js +80 -8
  33. package/dist/domains/safety.d.ts +164 -0
  34. package/dist/domains/safety.d.ts.map +1 -0
  35. package/dist/domains/safety.js +168 -0
  36. package/dist/domains/users.d.ts +9 -1
  37. package/dist/domains/users.d.ts.map +1 -1
  38. package/dist/domains/users.js +9 -1
  39. package/dist/errors.d.ts +163 -0
  40. package/dist/errors.d.ts.map +1 -1
  41. package/dist/errors.js +188 -0
  42. package/dist/generated/graphql-schema.d.ts +568 -17
  43. package/dist/generated/graphql-schema.d.ts.map +1 -1
  44. package/dist/generated/graphql-schema.js +64 -0
  45. package/dist/generated/graphql.d.ts +378 -0
  46. package/dist/generated/graphql.d.ts.map +1 -1
  47. package/dist/generated/graphql.js +24 -3
  48. package/dist/index.d.ts +12 -9
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +6 -4
  51. package/dist/live-coding/assets/browser-authoring-index.json +1 -1
  52. package/dist/live-coding/assets/manifest.json +1 -1
  53. package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
  54. package/dist/live-coding/browser-authoring-index.generated.js +265 -6
  55. package/package.json +1 -1
@@ -127,6 +127,38 @@ export declare class BrowserSessionPkceStore implements PkceStore {
127
127
  set(state: string, verifier: string): void;
128
128
  remove(state: string): void;
129
129
  }
130
+ /** {@link PortalAPI.minecraftChallenge}'s answer: a one-time server id for Mojang's session join. */
131
+ export interface MinecraftChallenge {
132
+ /** 40 hex characters: pass it unchanged as the server id of Mojang's session join, then to `signInWithMinecraft`. */
133
+ serverId: string;
134
+ /** ISO-8601 UTC; the server id is refused after it (two minutes). */
135
+ expiresAt: string;
136
+ }
137
+ /** A document the player accepted in game, at the version they saw. */
138
+ export interface AcceptedLegalDocument {
139
+ documentId: string;
140
+ version: string;
141
+ }
142
+ /** {@link PortalAPI.signInWithMinecraft}'s input. */
143
+ export interface MinecraftSignInParams {
144
+ /** The app {@link PortalAPI.minecraftChallenge} was asked for. */
145
+ appId: string;
146
+ /** The Minecraft account name the client is signed in with. */
147
+ username: string;
148
+ /** The challenge's server id, after the client joined it through Mojang's session service. */
149
+ serverId: string;
150
+ /** From the age screen: `YYYY-MM-DD` (or `YYYY-MM`); only the age bracket is kept. */
151
+ birthDate: string;
152
+ /** ISO 3166-1 alpha-2. */
153
+ country: string;
154
+ /** A player under 18 confirmed a parent or guardian agreed; required true under 18. */
155
+ parentalConfirmation?: boolean;
156
+ /**
157
+ * Every document `auth.playerLegalDocuments()` and `auth.appRequiredDocuments(appId)` name,
158
+ * at those versions, which the player accepted in game (recorded with method `IN_GAME`).
159
+ */
160
+ acceptedDocuments: AcceptedLegalDocument[];
161
+ }
130
162
  export interface PortalConsentState {
131
163
  appId: string;
132
164
  appName: string | null;
@@ -212,12 +244,14 @@ export declare function defaultHostedSignInUrl(graphqlEndpoint: string): string;
212
244
  export declare function isHostedSignInRequiredError(error: unknown): boolean;
213
245
  /**
214
246
  * `LEGAL_ACCEPTANCE_REQUIRED`: the player has not stored the current required
215
- * legal documents and the age-of-majority attestation, so no gameplay token is
216
- * issued ({@link PortalAPI.mintAppToken}, {@link PortalAPI.createAuthorizationCode},
217
- * {@link PortalAPI.refresh}), and a browser `auth.register` without both boxes is
218
- * refused. A browser game sends the player back through {@link PortalAPI.signIn},
219
- * where Studio's `/authorize` asks; a native client shows its own clickwrap and
220
- * calls `auth.recordPlayerConsents`. ck-api v2.35.0.
247
+ * documents (the platform's player documents, the app's own since ck-api v2.60.0,
248
+ * and the age-of-majority attestation while the platform asks for it), so no
249
+ * gameplay token is issued ({@link PortalAPI.mintAppToken},
250
+ * {@link PortalAPI.createAuthorizationCode}, {@link PortalAPI.refresh}), and a
251
+ * browser `auth.register` without the boxes is refused. A browser game sends the
252
+ * player back through {@link PortalAPI.signIn}, where Studio's `/authorize` asks; a
253
+ * native client shows its own clickwrap and calls `auth.recordPlayerConsents`.
254
+ * `legalAcceptanceRequiredOf` reads which documents are missing. ck-api v2.35.0.
221
255
  */
222
256
  export declare function isLegalAcceptanceRequiredError(error: unknown): boolean;
223
257
  export declare class PortalAPI {
@@ -246,6 +280,17 @@ export declare class PortalAPI {
246
280
  * paid apps require an existing entitlement. Refused with
247
281
  * `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError}) until the
248
282
  * player's consents are stored (`auth.recordPlayerConsents`, ck-api v2.35.0).
283
+ *
284
+ * **The player gate (ck-api v2.60.0)** runs at every mint and refresh, in this
285
+ * order: `TERRITORY_NOT_SUPPORTED` (`territoryNotSupportedOf`) for a country
286
+ * Crowded Kingdoms does not serve; `AGE_REQUIRED` (`ageRequiredOf`) while the
287
+ * player's age is unknown (`auth.recordPlayerAge`); `AGE_REQUIREMENT_NOT_MET`
288
+ * (`ageRequirementNotMetOf`) under the app's, the country's or the platform's
289
+ * youngest age; then the documents. A player under 18 is also refused
290
+ * `SAFETY_LOG_REQUIRED` (`safetyLogRequiredOf`) in an app without the safety log,
291
+ * then `SAFETY_MODERATOR_REQUIRED` (`safetyModeratorRequiredOf`, ck-api v2.61.0) in
292
+ * one whose organization has appointed no safety moderator. None of them is fixed
293
+ * by retrying, and no refusal names an age.
249
294
  */
250
295
  mintAppToken(appId: string): Promise<AppTokenResponse>;
251
296
  /**
@@ -274,7 +319,9 @@ export declare class PortalAPI {
274
319
  * Refused with `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError})
275
320
  * when the player's stored consents are missing or a required document has a
276
321
  * new version (ck-api v2.35.0). Retrying cannot succeed: send a browser player
277
- * back through {@link signIn}, where `/authorize` asks for them.
322
+ * back through {@link signIn}, where `/authorize` asks for them. The player gate's
323
+ * other refusals ({@link mintAppToken}) apply at a refresh too: a country the
324
+ * platform stopped serving, or an app that raised its minimum age.
278
325
  */
279
326
  refresh(currentServer?: CurrentServer): Promise<AppTokenResponse>;
280
327
  /**
@@ -289,6 +336,10 @@ export declare class PortalAPI {
289
336
  * A refresh is also refused with `ORG_LEGAL_ACCEPTANCE_REQUIRED`
290
337
  * ({@link orgLegalAcceptanceRequiredOf}) while the organization has not accepted the
291
338
  * current Org-Managed Players Addendum; only an admin of the organization can fix that.
339
+ * Since ck-api v2.60.0 the organization's server passes the player's `ageYears` and
340
+ * `country` to the mint, and the mint and every refresh answer the player gate's refusals
341
+ * ({@link mintAppToken}); a refresh only has the stored age bracket, so it is refused once
342
+ * that bracket is wholly below the app's youngest age.
292
343
  *
293
344
  * Refuses an org token (`cko_…`). That is the organization's server credential: it signs
294
345
  * in any of the organization's players, so a device must never hold one.
@@ -304,12 +355,41 @@ export declare class PortalAPI {
304
355
  * `extensions.reason` ({@link assertionRejectedOf}); resending the same assertion cannot
305
356
  * succeed, so ask the sign-in service for a new one. A valid assertion is refused with
306
357
  * `ORG_LEGAL_ACCEPTANCE_REQUIRED` ({@link orgLegalAcceptanceRequiredOf}) while the
307
- * organization has not accepted the current Org-Managed Players Addendum.
358
+ * organization has not accepted the current Org-Managed Players Addendum, and with the
359
+ * player gate's refusals ({@link mintAppToken}) for the age and country it asserts: the
360
+ * claims `ageYears` and `country` (`ManagedPlayerAssertionClaims`, ck-api v2.60.0), which
361
+ * become required once the platform admits players under 18.
308
362
  */
309
363
  exchangeManagedPlayerAssertion(params: {
310
364
  appId: string;
311
365
  assertion: string;
312
366
  }): Promise<AppTokenResponse>;
367
+ /**
368
+ * Start a Minecraft sign-in: a one-time server id for the app, good for two minutes. The
369
+ * Minecraft client joins it through Mojang's session service as the account signed in to
370
+ * the game (the request a client makes to join any online-mode server), then calls
371
+ * {@link signInWithMinecraft}. Ask for it yourself, and never join a server id something
372
+ * else hands you: whoever holds a joined server id can sign in as that account.
373
+ *
374
+ * Open only to Crowded Kingdoms' own apps: any other app is refused `FORBIDDEN`, and a
375
+ * tier without Minecraft sign-in `FEATURE_DISABLED`. Public; rate-limited per address.
376
+ * ck-api v2.60.0.
377
+ */
378
+ minecraftChallenge(appId: string): Promise<MinecraftChallenge>;
379
+ /**
380
+ * Sign a Minecraft player in to one of Crowded Kingdoms' own apps, and store the app token
381
+ * (as {@link adoptAppToken} does). The API asks Mojang whether `username` joined with the
382
+ * challenge's `serverId` and admits the player only on a yes; the player is an org-managed
383
+ * player of the app's organization, identified by its Minecraft account, and refreshes
384
+ * with {@link refresh}. Public. ck-api v2.60.0.
385
+ *
386
+ * Refusals: `MINECRAFT_VERIFICATION_FAILED` (`minecraftVerificationFailedOf`, with the
387
+ * reason: start again from {@link minecraftChallenge}), `MINECRAFT_VERIFICATION_UNAVAILABLE`
388
+ * (`minecraftVerificationUnavailableOf`: Mojang did not answer; retry shortly), the player
389
+ * gate's ({@link mintAppToken}), `LEGAL_ACCEPTANCE_REQUIRED` when `acceptedDocuments` misses
390
+ * one (`legalAcceptanceRequiredOf` lists them), and `ORG_LEGAL_ACCEPTANCE_REQUIRED`.
391
+ */
392
+ signInWithMinecraft(params: MinecraftSignInParams): Promise<AppTokenResponse>;
313
393
  /** Whether portaling into an app needs a consent prompt (Overworld side). */
314
394
  getConsent(appId: string): Promise<PortalConsentState>;
315
395
  /** Record the user's consent for an app (call from the consent screen). */
@@ -1 +1 @@
1
- {"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/domains/portal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACpE,qFAAqF;IACrF,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,UAA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AAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAS/B;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IA8BnD;;;;;;OAMG;IACG,oBAAoB,CACxB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAQnC;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAa3D;;;;;;OAMG;IACG,sBAAsB,CAC1B,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GACtD,OAAO,CAAC,MAAM,CAAC;IAoClB;;;;;OAKG;IACG,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;CAmBvE"}
@@ -66,6 +66,8 @@ const RefreshAppTokenDocument = parse(`mutation RefreshAppToken { refreshAppToke
66
66
  // v1.83.7 (no `currentServer` argument, no `authorizedServer` field) keeps refreshing.
67
67
  const RefreshAppTokenOnServerDocument = parse(`mutation RefreshAppTokenOnServer($currentServer: CurrentServerInput) { refreshAppToken(currentServer: $currentServer) { ${APP_TOKEN_FIELDS} authorizedServer { ip4 clientPort } } }`);
68
68
  const ExchangeManagedPlayerAssertionDocument = parse(`mutation ExchangeManagedPlayerAssertion($input: ExchangeManagedPlayerAssertionInput!) { exchangeManagedPlayerAssertion(input: $input) { ${APP_TOKEN_FIELDS} } }`);
69
+ const MinecraftChallengeDocument = parse(`mutation MinecraftChallenge($appId: BigInt!) { minecraftChallenge(appId: $appId) { serverId expiresAt } }`);
70
+ const SignInWithMinecraftDocument = parse(`mutation SignInWithMinecraft($input: SignInWithMinecraftInput!) { signInWithMinecraft(input: $input) { ${APP_TOKEN_FIELDS} } }`);
69
71
  /** What every org token starts with: an organization's server credential, never a device's. */
70
72
  const ORG_TOKEN_PREFIX = 'cko_';
71
73
  /** Thrown by {@link PortalAPI.handleAuthorizeRequest} when the user must consent. */
@@ -121,12 +123,14 @@ export function isHostedSignInRequiredError(error) {
121
123
  }
122
124
  /**
123
125
  * `LEGAL_ACCEPTANCE_REQUIRED`: the player has not stored the current required
124
- * legal documents and the age-of-majority attestation, so no gameplay token is
125
- * issued ({@link PortalAPI.mintAppToken}, {@link PortalAPI.createAuthorizationCode},
126
- * {@link PortalAPI.refresh}), and a browser `auth.register` without both boxes is
127
- * refused. A browser game sends the player back through {@link PortalAPI.signIn},
128
- * where Studio's `/authorize` asks; a native client shows its own clickwrap and
129
- * calls `auth.recordPlayerConsents`. ck-api v2.35.0.
126
+ * documents (the platform's player documents, the app's own since ck-api v2.60.0,
127
+ * and the age-of-majority attestation while the platform asks for it), so no
128
+ * gameplay token is issued ({@link PortalAPI.mintAppToken},
129
+ * {@link PortalAPI.createAuthorizationCode}, {@link PortalAPI.refresh}), and a
130
+ * browser `auth.register` without the boxes is refused. A browser game sends the
131
+ * player back through {@link PortalAPI.signIn}, where Studio's `/authorize` asks; a
132
+ * native client shows its own clickwrap and calls `auth.recordPlayerConsents`.
133
+ * `legalAcceptanceRequiredOf` reads which documents are missing. ck-api v2.35.0.
130
134
  */
131
135
  export function isLegalAcceptanceRequiredError(error) {
132
136
  const e = error;
@@ -165,6 +169,17 @@ export class PortalAPI {
165
169
  * paid apps require an existing entitlement. Refused with
166
170
  * `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError}) until the
167
171
  * player's consents are stored (`auth.recordPlayerConsents`, ck-api v2.35.0).
172
+ *
173
+ * **The player gate (ck-api v2.60.0)** runs at every mint and refresh, in this
174
+ * order: `TERRITORY_NOT_SUPPORTED` (`territoryNotSupportedOf`) for a country
175
+ * Crowded Kingdoms does not serve; `AGE_REQUIRED` (`ageRequiredOf`) while the
176
+ * player's age is unknown (`auth.recordPlayerAge`); `AGE_REQUIREMENT_NOT_MET`
177
+ * (`ageRequirementNotMetOf`) under the app's, the country's or the platform's
178
+ * youngest age; then the documents. A player under 18 is also refused
179
+ * `SAFETY_LOG_REQUIRED` (`safetyLogRequiredOf`) in an app without the safety log,
180
+ * then `SAFETY_MODERATOR_REQUIRED` (`safetyModeratorRequiredOf`, ck-api v2.61.0) in
181
+ * one whose organization has appointed no safety moderator. None of them is fixed
182
+ * by retrying, and no refusal names an age.
168
183
  */
169
184
  async mintAppToken(appId) {
170
185
  const data = await this.api.request(MintAppTokenDocument, {
@@ -202,7 +217,9 @@ export class PortalAPI {
202
217
  * Refused with `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError})
203
218
  * when the player's stored consents are missing or a required document has a
204
219
  * new version (ck-api v2.35.0). Retrying cannot succeed: send a browser player
205
- * back through {@link signIn}, where `/authorize` asks for them.
220
+ * back through {@link signIn}, where `/authorize` asks for them. The player gate's
221
+ * other refusals ({@link mintAppToken}) apply at a refresh too: a country the
222
+ * platform stopped serving, or an app that raised its minimum age.
206
223
  */
207
224
  async refresh(currentServer) {
208
225
  // NATIVE CLIENTS NAME THEIR SERVER. A Buddy drops datagrams for a token it was
@@ -230,6 +247,10 @@ export class PortalAPI {
230
247
  * A refresh is also refused with `ORG_LEGAL_ACCEPTANCE_REQUIRED`
231
248
  * ({@link orgLegalAcceptanceRequiredOf}) while the organization has not accepted the
232
249
  * current Org-Managed Players Addendum; only an admin of the organization can fix that.
250
+ * Since ck-api v2.60.0 the organization's server passes the player's `ageYears` and
251
+ * `country` to the mint, and the mint and every refresh answer the player gate's refusals
252
+ * ({@link mintAppToken}); a refresh only has the stored age bracket, so it is refused once
253
+ * that bracket is wholly below the app's youngest age.
233
254
  *
234
255
  * Refuses an org token (`cko_…`). That is the organization's server credential: it signs
235
256
  * in any of the organization's players, so a device must never hold one.
@@ -255,7 +276,10 @@ export class PortalAPI {
255
276
  * `extensions.reason` ({@link assertionRejectedOf}); resending the same assertion cannot
256
277
  * succeed, so ask the sign-in service for a new one. A valid assertion is refused with
257
278
  * `ORG_LEGAL_ACCEPTANCE_REQUIRED` ({@link orgLegalAcceptanceRequiredOf}) while the
258
- * organization has not accepted the current Org-Managed Players Addendum.
279
+ * organization has not accepted the current Org-Managed Players Addendum, and with the
280
+ * player gate's refusals ({@link mintAppToken}) for the age and country it asserts: the
281
+ * claims `ageYears` and `country` (`ManagedPlayerAssertionClaims`, ck-api v2.60.0), which
282
+ * become required once the platform admits players under 18.
259
283
  */
260
284
  async exchangeManagedPlayerAssertion(params) {
261
285
  const data = await this.api.request(ExchangeManagedPlayerAssertionDocument, {
@@ -264,6 +288,54 @@ export class PortalAPI {
264
288
  this.session.setToken(data.exchangeManagedPlayerAssertion.token);
265
289
  return data.exchangeManagedPlayerAssertion;
266
290
  }
291
+ // ----- Minecraft sign-in (Crowded Kingdoms' own apps) ------------------------
292
+ /**
293
+ * Start a Minecraft sign-in: a one-time server id for the app, good for two minutes. The
294
+ * Minecraft client joins it through Mojang's session service as the account signed in to
295
+ * the game (the request a client makes to join any online-mode server), then calls
296
+ * {@link signInWithMinecraft}. Ask for it yourself, and never join a server id something
297
+ * else hands you: whoever holds a joined server id can sign in as that account.
298
+ *
299
+ * Open only to Crowded Kingdoms' own apps: any other app is refused `FORBIDDEN`, and a
300
+ * tier without Minecraft sign-in `FEATURE_DISABLED`. Public; rate-limited per address.
301
+ * ck-api v2.60.0.
302
+ */
303
+ async minecraftChallenge(appId) {
304
+ const data = await this.api.request(MinecraftChallengeDocument, { appId });
305
+ return data.minecraftChallenge;
306
+ }
307
+ /**
308
+ * Sign a Minecraft player in to one of Crowded Kingdoms' own apps, and store the app token
309
+ * (as {@link adoptAppToken} does). The API asks Mojang whether `username` joined with the
310
+ * challenge's `serverId` and admits the player only on a yes; the player is an org-managed
311
+ * player of the app's organization, identified by its Minecraft account, and refreshes
312
+ * with {@link refresh}. Public. ck-api v2.60.0.
313
+ *
314
+ * Refusals: `MINECRAFT_VERIFICATION_FAILED` (`minecraftVerificationFailedOf`, with the
315
+ * reason: start again from {@link minecraftChallenge}), `MINECRAFT_VERIFICATION_UNAVAILABLE`
316
+ * (`minecraftVerificationUnavailableOf`: Mojang did not answer; retry shortly), the player
317
+ * gate's ({@link mintAppToken}), `LEGAL_ACCEPTANCE_REQUIRED` when `acceptedDocuments` misses
318
+ * one (`legalAcceptanceRequiredOf` lists them), and `ORG_LEGAL_ACCEPTANCE_REQUIRED`.
319
+ */
320
+ async signInWithMinecraft(params) {
321
+ const input = {
322
+ appId: params.appId,
323
+ username: params.username,
324
+ serverId: params.serverId,
325
+ birthDate: params.birthDate,
326
+ country: params.country,
327
+ acceptedDocuments: params.acceptedDocuments.map((doc) => ({
328
+ documentId: doc.documentId,
329
+ version: doc.version,
330
+ })),
331
+ ...(params.parentalConfirmation !== undefined
332
+ ? { parentalConfirmation: params.parentalConfirmation }
333
+ : {}),
334
+ };
335
+ const data = await this.api.request(SignInWithMinecraftDocument, { input });
336
+ this.session.setToken(data.signInWithMinecraft.token);
337
+ return data.signInWithMinecraft;
338
+ }
267
339
  // ----- Consent + connected apps ------------------------------------------
268
340
  /** Whether portaling into an app needs a consent prompt (Overworld side). */
269
341
  async getConsent(appId) {
@@ -0,0 +1,164 @@
1
+ import type { GraphQLClient } from '../client.js';
2
+ import { type MyCommSettingsQuery, type RequestParentalConsentMutation, type MyContactsQuery, type ContactRequestsQuery, type MyBlocksQuery, type FileSafetyReportMutation } from '../generated/graphql.js';
3
+ /**
4
+ * Who a medium reaches (send) or is heard from (receive): `OFF` nobody, `CONTACTS` only the
5
+ * player's accepted contacts in the app, `EVERYONE` anyone the app's own rules allow.
6
+ */
7
+ export type CommScopeValue = 'OFF' | 'CONTACTS' | 'EVERYONE';
8
+ /** What a parent consents to for a player under 18: voice (with channel audio) or webcam video. */
9
+ export type ParentalConsentFeatureValue = 'VOICE' | 'VIDEO';
10
+ /** Why a player is reported. `CHILD_SAFETY` reports come first in the moderation queue. */
11
+ export type SafetyReportReasonValue = 'CHILD_SAFETY' | 'HARASSMENT' | 'SEXUAL_CONTENT' | 'HATE' | 'SELF_HARM' | 'CHEATING' | 'OTHER';
12
+ /** The player's choices for {@link SafetyAPI.setCommSettings}; a field left out keeps its choice. */
13
+ export interface CommChoicesInput {
14
+ /** Whom the player's voice may reach. */
15
+ voiceSend?: CommScopeValue;
16
+ /** Whose voice the player may hear. */
17
+ voiceReceive?: CommScopeValue;
18
+ /** Whom the player's video may reach. */
19
+ videoSend?: CommScopeValue;
20
+ /** Whose video the player may see. */
21
+ videoReceive?: CommScopeValue;
22
+ }
23
+ /** A report for {@link SafetyAPI.fileReport}. */
24
+ export interface SafetyReportFiling {
25
+ /** The app both players are in. */
26
+ appId: string;
27
+ /** The player reported (`BigInt` as a decimal string). */
28
+ reportedUserId: string;
29
+ /**
30
+ * The reported player's actor, when the client knows it: the 32 hex digits the realtime
31
+ * wire uses (as `generateCrowdyUuid` makes them). Leave it out otherwise; any other form is
32
+ * refused with `BAD_USER_INPUT`.
33
+ */
34
+ reportedActorUuid?: string;
35
+ reason: SafetyReportReasonValue;
36
+ /** What happened, in the reporter's words: at most 1,000 characters. */
37
+ details?: string;
38
+ /**
39
+ * When it happened, within the past year (an ISO-8601 string or a `Date`). The report
40
+ * covers both players' recorded sessions from 15 minutes before it to the filing.
41
+ */
42
+ occurredAt: string | Date;
43
+ }
44
+ /** {@link SafetyAPI.commSettings}: the effective scopes, the player's choices and the caps. */
45
+ export type PlayerCommSettings = MyCommSettingsQuery['myCommSettings'];
46
+ /** One accepted contact ({@link SafetyAPI.contacts}) or a request's answer. */
47
+ export type PlayerContactRecord = MyContactsQuery['myContacts'][number];
48
+ /** A contact request waiting for an answer ({@link SafetyAPI.contactRequests}). */
49
+ export type ContactRequestRecord = ContactRequestsQuery['contactRequests'][number];
50
+ /** A player the caller blocked ({@link SafetyAPI.blocks}). */
51
+ export type PlayerBlockRecord = MyBlocksQuery['myBlocks'][number];
52
+ /** {@link SafetyAPI.requestParentalConsent}'s answer. */
53
+ export type ParentalConsentRequestResult = RequestParentalConsentMutation['requestParentalConsent'];
54
+ /** {@link SafetyAPI.fileReport}'s receipt. */
55
+ export type SafetyReportReceiptRecord = FileSafetyReportMutation['fileSafetyReport'];
56
+ /**
57
+ * A player's own safety and communication controls in one app — exposed as `client.safety`
58
+ * (ck-api v2.60.0, the teen safety program).
59
+ *
60
+ * **Game plane.** Every call takes the app-scoped token for `appId` on the client built for
61
+ * the app (`portal.signIn`, `portal.mintAppToken`, or a managed player's token), as gameplay
62
+ * does; an identity session token is refused.
63
+ *
64
+ * What it controls, all enforced by the platform rather than by your client:
65
+ *
66
+ * - **Voice and video scopes** ({@link commSettings}, {@link setCommSettings}): for each of
67
+ * voice and video, whom the player sends to and hears from: `OFF`, `CONTACTS` or
68
+ * `EVERYONE`. The realtime servers enforce the EFFECTIVE scopes on both sides. A player
69
+ * can only ever lower them below what policy allows: an adult may choose anything
70
+ * (`EVERYONE` by default); a player under 18 has each medium `OFF` until a parent consents
71
+ * ({@link requestParentalConsent}) and then at most `CONTACTS`.
72
+ * - **Contacts** ({@link contacts}, {@link contactRequests}, {@link requestContact},
73
+ * {@link acceptContact}, {@link removeContact}): a mutual list per app. It is what a
74
+ * `CONTACTS` scope admits.
75
+ * - **Blocks** ({@link blocks}, {@link block}, {@link unblock}): nothing of any kind (voice,
76
+ * video, text, direct messages) passes between two players while either has blocked the
77
+ * other, both ways, and the blocked player is not told.
78
+ * - **Reports** ({@link fileReport}): the app's moderators read them (`client.moderation`).
79
+ *
80
+ * Every change that affects what reaches the player (scopes, contacts, blocks, a parent's
81
+ * consent) reaches its live sessions within a second. Ids are `BigInt` decimal strings.
82
+ * `SOCIAL_LIMIT_REACHED` ({@link socialLimitReachedOf}) refuses a request past the limits
83
+ * (100 waiting requests, 1,000 contacts and 1,000 blocks per app); `NOT_FOUND` names a player
84
+ * the app does not know.
85
+ *
86
+ * Show the player the notice and the recording indicator the app's safety log needs
87
+ * (`apps.recording(appId)`): what a player says and sends may be recorded for moderators.
88
+ */
89
+ export declare class SafetyAPI {
90
+ private readonly api;
91
+ constructor(api: GraphQLClient);
92
+ /**
93
+ * The player's voice and video settings in the app: the effective scopes (`voiceSend`,
94
+ * `voiceReceive`, `videoSend`, `videoReceive`), what the player picked (`choices`, null
95
+ * where it kept the default), what policy allows now (`voiceAllowed`, `videoAllowed`),
96
+ * whether a parent consented (`voiceConsent`, `videoConsent`) and `isMinor`.
97
+ */
98
+ commSettings(appId: string): Promise<PlayerCommSettings>;
99
+ /**
100
+ * Change the player's choices; fields left out keep theirs. A choice above what policy
101
+ * allows is kept and applies only up to the cap, so the effective scope can only go down.
102
+ * Returns the settings after the change.
103
+ */
104
+ setCommSettings(appId: string, choices: CommChoicesInput): Promise<PlayerCommSettings>;
105
+ /**
106
+ * For a player under 18: ask a parent, through the platform's consent service, to allow
107
+ * one medium in this app. The service emails `parentEmail`; once the parent consents the
108
+ * medium opens, up to `CONTACTS`. Crowded Kingdoms does not store the address.
109
+ *
110
+ * `status` is `REQUESTED` (the email went out), `ALREADY_GRANTED` or `NOT_REQUIRED` (the
111
+ * player is 18 or over; nothing was sent). Refused with `PARENTAL_CONSENT_UNAVAILABLE`
112
+ * ({@link parentalConsentUnavailableOf}, whose `reason` says whether the deployment has no
113
+ * consent service or the service refused or did not answer), and `RATE_LIMITED` after
114
+ * three requests in an hour.
115
+ */
116
+ requestParentalConsent(appId: string, feature: ParentalConsentFeatureValue, parentEmail: string): Promise<ParentalConsentRequestResult>;
117
+ /** The player's accepted contacts in the app, most recent first (at most 1,000). */
118
+ contacts(appId: string): Promise<PlayerContactRecord[]>;
119
+ /**
120
+ * Contact requests waiting in the app: `INCOMING` ones other players sent (answer with
121
+ * {@link acceptContact} or {@link removeContact}), then `OUTGOING` ones the player sent
122
+ * ({@link removeContact} cancels one), newest first.
123
+ */
124
+ contactRequests(appId: string): Promise<ContactRequestRecord[]>;
125
+ /**
126
+ * Ask another player of the app to be a contact. `state` is `PENDING`, or `ACCEPTED` when
127
+ * they had already asked the player; asking again changes nothing. Refused while the player
128
+ * has blocked them ({@link unblock} first).
129
+ */
130
+ requestContact(appId: string, userId: string): Promise<PlayerContactRecord>;
131
+ /** Accept another player's request: both become each other's contacts. `NOT_FOUND` when they have not asked. */
132
+ acceptContact(appId: string, userId: string): Promise<PlayerContactRecord>;
133
+ /**
134
+ * Remove a contact, decline the other player's request, or cancel the player's own:
135
+ * everything between the two in the app goes, both ways. False when there was nothing.
136
+ */
137
+ removeContact(appId: string, userId: string): Promise<boolean>;
138
+ /** The players the player blocked in the app, most recent first (at most 1,000). */
139
+ blocks(appId: string): Promise<PlayerBlockRecord[]>;
140
+ /**
141
+ * Block another player of the app: nothing passes between the two, either way, on every
142
+ * session of both within a second, and the app's hubs can ask (`players.blocked`). Any
143
+ * contact or request between them goes too. The blocked player is not told, and its contact
144
+ * requests to the player are dropped. Blocking again changes nothing.
145
+ */
146
+ block(appId: string, userId: string): Promise<PlayerBlockRecord>;
147
+ /**
148
+ * Lift a block the player set. A contact the block removed does not come back. False when
149
+ * there was no such block.
150
+ */
151
+ unblock(appId: string, userId: string): Promise<boolean>;
152
+ /**
153
+ * Report another player of the app to its moderators. The report covers both players'
154
+ * recorded sessions (the app's safety log) from 15 minutes before `occurredAt` to now, and
155
+ * the platform preserves them with both identities for the moderators. The reported player
156
+ * is not told.
157
+ *
158
+ * Refused with `NOT_FOUND` for a player the app does not know, `BAD_USER_INPUT` for the
159
+ * player itself, `details` over 1,000 characters, an `occurredAt` outside the past year or
160
+ * an actor id that is not 32 hex digits, and `RATE_LIMITED` after 20 reports in an hour.
161
+ */
162
+ fileReport(report: SafetyReportFiling): Promise<SafetyReportReceiptRecord>;
163
+ }
164
+ //# sourceMappingURL=safety.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/domains/safety.ts"],"names":[],"mappings":"AAAA,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CAAC,mBAAmB,CAAC;IAKhF;;;OAGG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKpE,oFAAoF;IAC9E,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAKzD;;;;;OAKG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAKtE;;;OAGG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK9D;;;;;;;;;OASG;IACG,UAAU,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAiBjF"}
@@ -0,0 +1,168 @@
1
+ import { MyCommSettingsDocument, SetMyCommSettingsDocument, RequestParentalConsentDocument, MyContactsDocument, ContactRequestsDocument, RequestContactDocument, AcceptContactDocument, RemoveContactDocument, MyBlocksDocument, BlockPlayerDocument, UnblockPlayerDocument, FileSafetyReportDocument, } from '../generated/graphql.js';
2
+ /**
3
+ * A player's own safety and communication controls in one app — exposed as `client.safety`
4
+ * (ck-api v2.60.0, the teen safety program).
5
+ *
6
+ * **Game plane.** Every call takes the app-scoped token for `appId` on the client built for
7
+ * the app (`portal.signIn`, `portal.mintAppToken`, or a managed player's token), as gameplay
8
+ * does; an identity session token is refused.
9
+ *
10
+ * What it controls, all enforced by the platform rather than by your client:
11
+ *
12
+ * - **Voice and video scopes** ({@link commSettings}, {@link setCommSettings}): for each of
13
+ * voice and video, whom the player sends to and hears from: `OFF`, `CONTACTS` or
14
+ * `EVERYONE`. The realtime servers enforce the EFFECTIVE scopes on both sides. A player
15
+ * can only ever lower them below what policy allows: an adult may choose anything
16
+ * (`EVERYONE` by default); a player under 18 has each medium `OFF` until a parent consents
17
+ * ({@link requestParentalConsent}) and then at most `CONTACTS`.
18
+ * - **Contacts** ({@link contacts}, {@link contactRequests}, {@link requestContact},
19
+ * {@link acceptContact}, {@link removeContact}): a mutual list per app. It is what a
20
+ * `CONTACTS` scope admits.
21
+ * - **Blocks** ({@link blocks}, {@link block}, {@link unblock}): nothing of any kind (voice,
22
+ * video, text, direct messages) passes between two players while either has blocked the
23
+ * other, both ways, and the blocked player is not told.
24
+ * - **Reports** ({@link fileReport}): the app's moderators read them (`client.moderation`).
25
+ *
26
+ * Every change that affects what reaches the player (scopes, contacts, blocks, a parent's
27
+ * consent) reaches its live sessions within a second. Ids are `BigInt` decimal strings.
28
+ * `SOCIAL_LIMIT_REACHED` ({@link socialLimitReachedOf}) refuses a request past the limits
29
+ * (100 waiting requests, 1,000 contacts and 1,000 blocks per app); `NOT_FOUND` names a player
30
+ * the app does not know.
31
+ *
32
+ * Show the player the notice and the recording indicator the app's safety log needs
33
+ * (`apps.recording(appId)`): what a player says and sends may be recorded for moderators.
34
+ */
35
+ export class SafetyAPI {
36
+ constructor(api) {
37
+ this.api = api;
38
+ }
39
+ /**
40
+ * The player's voice and video settings in the app: the effective scopes (`voiceSend`,
41
+ * `voiceReceive`, `videoSend`, `videoReceive`), what the player picked (`choices`, null
42
+ * where it kept the default), what policy allows now (`voiceAllowed`, `videoAllowed`),
43
+ * whether a parent consented (`voiceConsent`, `videoConsent`) and `isMinor`.
44
+ */
45
+ async commSettings(appId) {
46
+ const data = await this.api.request(MyCommSettingsDocument, { appId });
47
+ return data.myCommSettings;
48
+ }
49
+ /**
50
+ * Change the player's choices; fields left out keep theirs. A choice above what policy
51
+ * allows is kept and applies only up to the cap, so the effective scope can only go down.
52
+ * Returns the settings after the change.
53
+ */
54
+ async setCommSettings(appId, choices) {
55
+ const input = {};
56
+ for (const key of ['voiceSend', 'voiceReceive', 'videoSend', 'videoReceive']) {
57
+ const value = choices[key];
58
+ if (value !== undefined)
59
+ input[key] = value;
60
+ }
61
+ const data = await this.api.request(SetMyCommSettingsDocument, { appId, input });
62
+ return data.setMyCommSettings;
63
+ }
64
+ /**
65
+ * For a player under 18: ask a parent, through the platform's consent service, to allow
66
+ * one medium in this app. The service emails `parentEmail`; once the parent consents the
67
+ * medium opens, up to `CONTACTS`. Crowded Kingdoms does not store the address.
68
+ *
69
+ * `status` is `REQUESTED` (the email went out), `ALREADY_GRANTED` or `NOT_REQUIRED` (the
70
+ * player is 18 or over; nothing was sent). Refused with `PARENTAL_CONSENT_UNAVAILABLE`
71
+ * ({@link parentalConsentUnavailableOf}, whose `reason` says whether the deployment has no
72
+ * consent service or the service refused or did not answer), and `RATE_LIMITED` after
73
+ * three requests in an hour.
74
+ */
75
+ async requestParentalConsent(appId, feature, parentEmail) {
76
+ const data = await this.api.request(RequestParentalConsentDocument, {
77
+ appId,
78
+ feature: feature,
79
+ parentEmail,
80
+ });
81
+ return data.requestParentalConsent;
82
+ }
83
+ /** The player's accepted contacts in the app, most recent first (at most 1,000). */
84
+ async contacts(appId) {
85
+ const data = await this.api.request(MyContactsDocument, { appId });
86
+ return data.myContacts;
87
+ }
88
+ /**
89
+ * Contact requests waiting in the app: `INCOMING` ones other players sent (answer with
90
+ * {@link acceptContact} or {@link removeContact}), then `OUTGOING` ones the player sent
91
+ * ({@link removeContact} cancels one), newest first.
92
+ */
93
+ async contactRequests(appId) {
94
+ const data = await this.api.request(ContactRequestsDocument, { appId });
95
+ return data.contactRequests;
96
+ }
97
+ /**
98
+ * Ask another player of the app to be a contact. `state` is `PENDING`, or `ACCEPTED` when
99
+ * they had already asked the player; asking again changes nothing. Refused while the player
100
+ * has blocked them ({@link unblock} first).
101
+ */
102
+ async requestContact(appId, userId) {
103
+ const data = await this.api.request(RequestContactDocument, { appId, userId });
104
+ return data.requestContact;
105
+ }
106
+ /** Accept another player's request: both become each other's contacts. `NOT_FOUND` when they have not asked. */
107
+ async acceptContact(appId, userId) {
108
+ const data = await this.api.request(AcceptContactDocument, { appId, userId });
109
+ return data.acceptContact;
110
+ }
111
+ /**
112
+ * Remove a contact, decline the other player's request, or cancel the player's own:
113
+ * everything between the two in the app goes, both ways. False when there was nothing.
114
+ */
115
+ async removeContact(appId, userId) {
116
+ const data = await this.api.request(RemoveContactDocument, { appId, userId });
117
+ return data.removeContact;
118
+ }
119
+ /** The players the player blocked in the app, most recent first (at most 1,000). */
120
+ async blocks(appId) {
121
+ const data = await this.api.request(MyBlocksDocument, { appId });
122
+ return data.myBlocks;
123
+ }
124
+ /**
125
+ * Block another player of the app: nothing passes between the two, either way, on every
126
+ * session of both within a second, and the app's hubs can ask (`players.blocked`). Any
127
+ * contact or request between them goes too. The blocked player is not told, and its contact
128
+ * requests to the player are dropped. Blocking again changes nothing.
129
+ */
130
+ async block(appId, userId) {
131
+ const data = await this.api.request(BlockPlayerDocument, { appId, userId });
132
+ return data.blockPlayer;
133
+ }
134
+ /**
135
+ * Lift a block the player set. A contact the block removed does not come back. False when
136
+ * there was no such block.
137
+ */
138
+ async unblock(appId, userId) {
139
+ const data = await this.api.request(UnblockPlayerDocument, { appId, userId });
140
+ return data.unblockPlayer;
141
+ }
142
+ /**
143
+ * Report another player of the app to its moderators. The report covers both players'
144
+ * recorded sessions (the app's safety log) from 15 minutes before `occurredAt` to now, and
145
+ * the platform preserves them with both identities for the moderators. The reported player
146
+ * is not told.
147
+ *
148
+ * Refused with `NOT_FOUND` for a player the app does not know, `BAD_USER_INPUT` for the
149
+ * player itself, `details` over 1,000 characters, an `occurredAt` outside the past year or
150
+ * an actor id that is not 32 hex digits, and `RATE_LIMITED` after 20 reports in an hour.
151
+ */
152
+ async fileReport(report) {
153
+ const occurredAt = report.occurredAt instanceof Date ? report.occurredAt.toISOString() : report.occurredAt;
154
+ const data = await this.api.request(FileSafetyReportDocument, {
155
+ input: {
156
+ appId: report.appId,
157
+ reportedUserId: report.reportedUserId,
158
+ reason: report.reason,
159
+ occurredAt,
160
+ ...(report.reportedActorUuid !== undefined
161
+ ? { reportedActorUuid: report.reportedActorUuid }
162
+ : {}),
163
+ ...(report.details !== undefined ? { details: report.details } : {}),
164
+ },
165
+ });
166
+ return data.fileSafetyReport;
167
+ }
168
+ }