@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
@@ -25,6 +25,12 @@ export declare class UsersAPI {
25
25
  * Validate the current bearer token and return the authenticated user record.
26
26
  * Handy for restoring a session on SDK init.
27
27
  *
28
+ * `ageBracket` is `unknown` until the player gives an age (`auth.recordPlayerAge`; a
29
+ * managed player's comes from its organization), then `under_13`, `13_15`, `16_17` or
30
+ * `18_plus`; `country` is the declared or asserted country (ck-api v2.60.0, which this
31
+ * selection needs). Use them for your logic, never as text: no screen shows a player an
32
+ * age.
33
+ *
28
34
  * @returns The {@link User}, or `null` if the token is missing, expired, or
29
35
  * revoked (an invalid token resolves to `null` rather than throwing).
30
36
  * @throws {CrowdyGraphQLError} on transport/validation failures.
@@ -49,7 +55,9 @@ export declare class UsersAPI {
49
55
  * **Destructive, self-service** soft-delete of the caller's **own** account:
50
56
  * anonymizes PII and revokes all sessions. Wallet, voxel, and donation history
51
57
  * stay intact via foreign keys. Acts only on the caller (no target argument).
52
- * Requires a valid session.
58
+ * Requires a valid session. Since ck-api v2.60.0 an open or escalated safety
59
+ * report about the account puts it under a legal hold first: the account still
60
+ * closes, but its content and identity are kept until the report is resolved.
53
61
  *
54
62
  * @returns `true` on success.
55
63
  * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session, or
@@ -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,EASL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,aAAa;IAEnD;;;;;;;OAOG;IACG,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAKlC;;;;;;;;;;;;;OAaG;IACG,cAAc,CAClB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IAKpD;;;;;;;;;OASG;IACG,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAKzC;;;;;OAKG;IACG,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;IAK1E;;;;;;;;OAQG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAKjD;;;;;;OAMG;IACG,aAAa,CACjB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAK/C;;;;;;OAMG;IACG,cAAc,CAClB,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAWjD;;;;;;OAMG;IACG,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O,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAWjD;;;;;;OAMG;IACG,WAAW,CACf,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;CAIvD"}
@@ -25,6 +25,12 @@ export class UsersAPI {
25
25
  * Validate the current bearer token and return the authenticated user record.
26
26
  * Handy for restoring a session on SDK init.
27
27
  *
28
+ * `ageBracket` is `unknown` until the player gives an age (`auth.recordPlayerAge`; a
29
+ * managed player's comes from its organization), then `under_13`, `13_15`, `16_17` or
30
+ * `18_plus`; `country` is the declared or asserted country (ck-api v2.60.0, which this
31
+ * selection needs). Use them for your logic, never as text: no screen shows a player an
32
+ * age.
33
+ *
28
34
  * @returns The {@link User}, or `null` if the token is missing, expired, or
29
35
  * revoked (an invalid token resolves to `null` rather than throwing).
30
36
  * @throws {CrowdyGraphQLError} on transport/validation failures.
@@ -55,7 +61,9 @@ export class UsersAPI {
55
61
  * **Destructive, self-service** soft-delete of the caller's **own** account:
56
62
  * anonymizes PII and revokes all sessions. Wallet, voxel, and donation history
57
63
  * stay intact via foreign keys. Acts only on the caller (no target argument).
58
- * Requires a valid session.
64
+ * Requires a valid session. Since ck-api v2.60.0 an open or escalated safety
65
+ * report about the account puts it under a legal hold first: the account still
66
+ * closes, but its content and identity are kept until the report is resolved.
59
67
  *
60
68
  * @returns `true` on success.
61
69
  * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session, or
package/dist/errors.d.ts CHANGED
@@ -284,6 +284,78 @@ export declare const ASSERTION_REJECTED_CODE = "ASSERTION_REJECTED";
284
284
  * provisioning; see {@link orgLegalAcceptanceRequiredOf}.
285
285
  */
286
286
  export declare const ORG_LEGAL_ACCEPTANCE_REQUIRED_CODE = "ORG_LEGAL_ACCEPTANCE_REQUIRED";
287
+ /**
288
+ * `extensions.code` for "the player has not accepted the current required documents" (HTTP
289
+ * 403): the platform's player documents or the app's own, listed in
290
+ * `extensions.missingDocuments`; see {@link legalAcceptanceRequiredOf}.
291
+ */
292
+ export declare const LEGAL_ACCEPTANCE_REQUIRED_CODE = "LEGAL_ACCEPTANCE_REQUIRED";
293
+ /**
294
+ * `extensions.code` for "the player's age is not known" (HTTP 403), at a token's mint or
295
+ * refresh, or the developer documents for an account with no age; see {@link ageRequiredOf}.
296
+ */
297
+ export declare const AGE_REQUIRED_CODE = "AGE_REQUIRED";
298
+ /**
299
+ * `extensions.code` for "the player may not play this" by age (HTTP 403); see
300
+ * {@link ageRequirementNotMetOf}.
301
+ */
302
+ export declare const AGE_REQUIREMENT_NOT_MET_CODE = "AGE_REQUIREMENT_NOT_MET";
303
+ /**
304
+ * `extensions.code` for "Crowded Kingdoms does not serve the player's country" (HTTP 403); see
305
+ * {@link territoryNotSupportedOf}.
306
+ */
307
+ export declare const TERRITORY_NOT_SUPPORTED_CODE = "TERRITORY_NOT_SUPPORTED";
308
+ /**
309
+ * `extensions.code` for "the app does not keep the safety log where it must" (HTTP 403); see
310
+ * {@link safetyLogRequiredOf}.
311
+ */
312
+ export declare const SAFETY_LOG_REQUIRED_CODE = "SAFETY_LOG_REQUIRED";
313
+ /**
314
+ * `extensions.code` for "the app admits players under 18 and its organization has appointed no
315
+ * safety moderator" (HTTP 403); see {@link safetyModeratorRequiredOf}.
316
+ */
317
+ export declare const SAFETY_MODERATOR_REQUIRED_CODE = "SAFETY_MODERATOR_REQUIRED";
318
+ /**
319
+ * `extensions.code` for "parental consent cannot be requested right now" (HTTP 503), with why in
320
+ * `extensions.reason`; see {@link parentalConsentUnavailableOf}.
321
+ */
322
+ export declare const PARENTAL_CONSENT_UNAVAILABLE_CODE = "PARENTAL_CONSENT_UNAVAILABLE";
323
+ /**
324
+ * `extensions.code` for "the player has as many contacts, waiting requests or blocks in the app
325
+ * as the platform allows" (HTTP 409); see {@link socialLimitReachedOf}.
326
+ */
327
+ export declare const SOCIAL_LIMIT_REACHED_CODE = "SOCIAL_LIMIT_REACHED";
328
+ /**
329
+ * `extensions.code` for "the Minecraft account could not be confirmed" (HTTP 401), with the
330
+ * failed check in `extensions.reason`; see {@link minecraftVerificationFailedOf}.
331
+ */
332
+ export declare const MINECRAFT_VERIFICATION_FAILED_CODE = "MINECRAFT_VERIFICATION_FAILED";
333
+ /**
334
+ * `extensions.code` for "Mojang's session service did not answer" (HTTP 503, retryable); see
335
+ * {@link minecraftVerificationUnavailableOf}.
336
+ */
337
+ export declare const MINECRAFT_VERIFICATION_UNAVAILABLE_CODE = "MINECRAFT_VERIFICATION_UNAVAILABLE";
338
+ /**
339
+ * Why a Minecraft sign-in was not confirmed, as `extensions.reason` carries it. Open union:
340
+ * the server may add one.
341
+ */
342
+ export type MinecraftVerificationFailure = 'malformed' | 'forged' | 'expired' | 'not_joined' | 'replayed' | (string & {});
343
+ /**
344
+ * Why parental consent cannot be requested, as `extensions.reason` on
345
+ * `PARENTAL_CONSENT_UNAVAILABLE` carries it: `not_configured` (the deployment has no consent
346
+ * service), `provider_refused` (the service refused the request) or `provider_unavailable` (it
347
+ * did not answer). Open union: the server may add one.
348
+ */
349
+ export type ParentalConsentUnavailableReason = 'not_configured' | 'provider_refused' | 'provider_unavailable' | (string & {});
350
+ /** One document a refused player still has to accept, from `extensions.missingDocuments`. */
351
+ export interface MissingLegalDocument {
352
+ /** The document's stable id, such as `player-terms` or an app's own `rules`. */
353
+ documentId: string;
354
+ /** The version the player has to accept. */
355
+ version: string;
356
+ /** The app whose own document it is; null for a platform document. */
357
+ appId: string | null;
358
+ }
287
359
  /**
288
360
  * Why an app is paused, as `extensions.reason` on `APP_PAUSED` and
289
361
  * `AppRuntimeGate.reason` carry it. Open union: the server may add one.
@@ -347,6 +419,97 @@ export declare function assertionRejectedOf(value: unknown): {
347
419
  * player never gets.
348
420
  */
349
421
  export declare function orgLegalAcceptanceRequiredOf(value: unknown): boolean;
422
+ /**
423
+ * A `LEGAL_ACCEPTANCE_REQUIRED` refusal (HTTP 403), or `null`. `missingDocuments` is what the
424
+ * player still has to accept: the platform's player documents (`appId` null) and the app's own
425
+ * (`appId` set). Show those documents, then record the player's agreement
426
+ * (`auth.recordPlayerConsents`, with the app's `appId` for its own); a browser game sends the
427
+ * player back through `portal.signIn`, where Studio asks. Empty when the server did not list
428
+ * them (an older API, or a refused `register` or `recordPlayerConsents`). Not fixed by retrying.
429
+ * Distinct from the organization's `ORG_LEGAL_ACCEPTANCE_REQUIRED`
430
+ * ({@link orgLegalAcceptanceRequiredOf}).
431
+ */
432
+ export declare function legalAcceptanceRequiredOf(value: unknown): {
433
+ missingDocuments: MissingLegalDocument[];
434
+ } | null;
435
+ /**
436
+ * Whether an error is an `AGE_REQUIRED` refusal (HTTP 403): the player's age is not known.
437
+ * For an account, ask the player's birth date and country on your own neutral screen and call
438
+ * `auth.recordPlayerAge`, then mint again; a browser game sends the player back through
439
+ * `portal.signIn`, where Studio asks. For an org-managed player, the organization sends
440
+ * `ageYears` and `country` when it signs the player in. Not fixed by retrying as is.
441
+ */
442
+ export declare function ageRequiredOf(value: unknown): boolean;
443
+ /**
444
+ * Whether an error is an `AGE_REQUIREMENT_NOT_MET` refusal (HTTP 403): by age, the player may
445
+ * not play this app, or create or administer an organization. Not retryable, and asking for
446
+ * the age again changes nothing: an account keeps the answer it gave, and since ck-api v2.61.0
447
+ * the same client (address and user agent) is refused at sign-up and `auth.recordPlayerAge`
448
+ * for 24 hours whatever it sends, and an org-managed player at its sign-ins. An account that
449
+ * answers `recordPlayerAge` with an age under 13 is deleted.
450
+ *
451
+ * Deliberately a boolean. No refusal names an age (the platform's neutral age screen): tell the
452
+ * player they cannot play this, without naming an age or a minimum, and do not offer to enter
453
+ * the date again. v2.60.0 put `minimumAge` and `ageBracket` in the extensions (v2.61.0 does
454
+ * not); this reader never surfaces them, and a game must not show them.
455
+ */
456
+ export declare function ageRequirementNotMetOf(value: unknown): boolean;
457
+ /**
458
+ * A `TERRITORY_NOT_SUPPORTED` refusal (HTTP 403), or `null`: Crowded Kingdoms does not serve
459
+ * the player's country (the one they connect from, the one they declared, or the one their
460
+ * organization asserted). `country` is `extensions.country` (ISO 3166-1 alpha-2), null when the
461
+ * server did not say. Not retryable; tell the player it is not available where they are.
462
+ */
463
+ export declare function territoryNotSupportedOf(value: unknown): {
464
+ country: string | null;
465
+ } | null;
466
+ /**
467
+ * Whether an error is a `SAFETY_LOG_REQUIRED` refusal (HTTP 403): the app does not keep the
468
+ * safety log (replay logging) where it must. A player under 18 gets it at the mint of an app
469
+ * without one, and an app admitting players under 18 cannot turn its log off. The player
470
+ * cannot fix it: the app's admins turn the log on (`apps.update`) or raise its minimum age.
471
+ */
472
+ export declare function safetyLogRequiredOf(value: unknown): boolean;
473
+ /**
474
+ * Whether an error is a `SAFETY_MODERATOR_REQUIRED` refusal (HTTP 403, ck-api v2.61.0): a player
475
+ * under 18 is refused a token in an app that admits players under 18 while the app's
476
+ * organization has appointed no safety moderator (a member whose own role grants
477
+ * `moderate_safety`; an admin alone does not count). The player cannot fix it: tell them the
478
+ * app cannot admit them yet. The organization appoints one; `App.hasSafetyModerator` (on
479
+ * `apps.app`, for the organization's members) says whether it has.
480
+ */
481
+ export declare function safetyModeratorRequiredOf(value: unknown): boolean;
482
+ /**
483
+ * A `PARENTAL_CONSENT_UNAVAILABLE` refusal (HTTP 503) from `safety.requestParentalConsent`, or
484
+ * `null`: a parent cannot be asked right now. `reason` is `extensions.reason`:
485
+ * `not_configured` (the deployment has no consent service; retrying soon does not help),
486
+ * `provider_refused` or `provider_unavailable` (the service refused or did not answer); null
487
+ * from an API that does not say. Voice and video stay off for the player meanwhile.
488
+ */
489
+ export declare function parentalConsentUnavailableOf(value: unknown): {
490
+ reason: ParentalConsentUnavailableReason | null;
491
+ } | null;
492
+ /**
493
+ * Whether an error is a `SOCIAL_LIMIT_REACHED` refusal (HTTP 409): the player already has as
494
+ * many contacts, waiting contact requests or blocks in the app as the platform allows (the
495
+ * message says which). Remove some first; not fixed by retrying.
496
+ */
497
+ export declare function socialLimitReachedOf(value: unknown): boolean;
498
+ /**
499
+ * A `MINECRAFT_VERIFICATION_FAILED` refusal (HTTP 401) from `portal.signInWithMinecraft`, or
500
+ * `null`. `reason` is `extensions.reason`: `malformed`, `forged`, `expired`, `not_joined` or
501
+ * `replayed`. Never resend the same server id: ask for a new challenge
502
+ * (`portal.minecraftChallenge`) and join it again.
503
+ */
504
+ export declare function minecraftVerificationFailedOf(value: unknown): {
505
+ reason: MinecraftVerificationFailure | null;
506
+ } | null;
507
+ /**
508
+ * Whether an error is a `MINECRAFT_VERIFICATION_UNAVAILABLE` refusal (HTTP 503): Mojang's
509
+ * session service did not answer, so the account was not confirmed. Retryable shortly, with a
510
+ * new challenge.
511
+ */
512
+ export declare function minecraftVerificationUnavailableOf(value: unknown): boolean;
350
513
  /**
351
514
  * An `APP_PAUSED` refusal (HTTP 403: the app's runtime gate is not ACTIVE), or
352
515
  * `null`. `reason` is `extensions.reason`. Show the player that the world is
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iFAAiF;AACjF,MAAM,WAAW,yBAAyB;IACxC,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC/B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,oEAAoE;AACpE,MAAM,WAAW,kBAAkB;IACjC,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,CAA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AAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO;CAKnG;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;CAAG"}
package/dist/errors.js CHANGED
@@ -280,6 +280,57 @@ export const ASSERTION_REJECTED_CODE = 'ASSERTION_REJECTED';
280
280
  * provisioning; see {@link orgLegalAcceptanceRequiredOf}.
281
281
  */
282
282
  export const ORG_LEGAL_ACCEPTANCE_REQUIRED_CODE = 'ORG_LEGAL_ACCEPTANCE_REQUIRED';
283
+ /**
284
+ * `extensions.code` for "the player has not accepted the current required documents" (HTTP
285
+ * 403): the platform's player documents or the app's own, listed in
286
+ * `extensions.missingDocuments`; see {@link legalAcceptanceRequiredOf}.
287
+ */
288
+ export const LEGAL_ACCEPTANCE_REQUIRED_CODE = 'LEGAL_ACCEPTANCE_REQUIRED';
289
+ /**
290
+ * `extensions.code` for "the player's age is not known" (HTTP 403), at a token's mint or
291
+ * refresh, or the developer documents for an account with no age; see {@link ageRequiredOf}.
292
+ */
293
+ export const AGE_REQUIRED_CODE = 'AGE_REQUIRED';
294
+ /**
295
+ * `extensions.code` for "the player may not play this" by age (HTTP 403); see
296
+ * {@link ageRequirementNotMetOf}.
297
+ */
298
+ export const AGE_REQUIREMENT_NOT_MET_CODE = 'AGE_REQUIREMENT_NOT_MET';
299
+ /**
300
+ * `extensions.code` for "Crowded Kingdoms does not serve the player's country" (HTTP 403); see
301
+ * {@link territoryNotSupportedOf}.
302
+ */
303
+ export const TERRITORY_NOT_SUPPORTED_CODE = 'TERRITORY_NOT_SUPPORTED';
304
+ /**
305
+ * `extensions.code` for "the app does not keep the safety log where it must" (HTTP 403); see
306
+ * {@link safetyLogRequiredOf}.
307
+ */
308
+ export const SAFETY_LOG_REQUIRED_CODE = 'SAFETY_LOG_REQUIRED';
309
+ /**
310
+ * `extensions.code` for "the app admits players under 18 and its organization has appointed no
311
+ * safety moderator" (HTTP 403); see {@link safetyModeratorRequiredOf}.
312
+ */
313
+ export const SAFETY_MODERATOR_REQUIRED_CODE = 'SAFETY_MODERATOR_REQUIRED';
314
+ /**
315
+ * `extensions.code` for "parental consent cannot be requested right now" (HTTP 503), with why in
316
+ * `extensions.reason`; see {@link parentalConsentUnavailableOf}.
317
+ */
318
+ export const PARENTAL_CONSENT_UNAVAILABLE_CODE = 'PARENTAL_CONSENT_UNAVAILABLE';
319
+ /**
320
+ * `extensions.code` for "the player has as many contacts, waiting requests or blocks in the app
321
+ * as the platform allows" (HTTP 409); see {@link socialLimitReachedOf}.
322
+ */
323
+ export const SOCIAL_LIMIT_REACHED_CODE = 'SOCIAL_LIMIT_REACHED';
324
+ /**
325
+ * `extensions.code` for "the Minecraft account could not be confirmed" (HTTP 401), with the
326
+ * failed check in `extensions.reason`; see {@link minecraftVerificationFailedOf}.
327
+ */
328
+ export const MINECRAFT_VERIFICATION_FAILED_CODE = 'MINECRAFT_VERIFICATION_FAILED';
329
+ /**
330
+ * `extensions.code` for "Mojang's session service did not answer" (HTTP 503, retryable); see
331
+ * {@link minecraftVerificationUnavailableOf}.
332
+ */
333
+ export const MINECRAFT_VERIFICATION_UNAVAILABLE_CODE = 'MINECRAFT_VERIFICATION_UNAVAILABLE';
283
334
  /** The first error entry carrying `code`, from an error or a raw payload. */
284
335
  function errorWithCode(value, code) {
285
336
  if (!value || typeof value !== 'object')
@@ -375,6 +426,143 @@ export function assertionRejectedOf(value) {
375
426
  export function orgLegalAcceptanceRequiredOf(value) {
376
427
  return errorWithCode(value, ORG_LEGAL_ACCEPTANCE_REQUIRED_CODE) !== null;
377
428
  }
429
+ /**
430
+ * A `LEGAL_ACCEPTANCE_REQUIRED` refusal (HTTP 403), or `null`. `missingDocuments` is what the
431
+ * player still has to accept: the platform's player documents (`appId` null) and the app's own
432
+ * (`appId` set). Show those documents, then record the player's agreement
433
+ * (`auth.recordPlayerConsents`, with the app's `appId` for its own); a browser game sends the
434
+ * player back through `portal.signIn`, where Studio asks. Empty when the server did not list
435
+ * them (an older API, or a refused `register` or `recordPlayerConsents`). Not fixed by retrying.
436
+ * Distinct from the organization's `ORG_LEGAL_ACCEPTANCE_REQUIRED`
437
+ * ({@link orgLegalAcceptanceRequiredOf}).
438
+ */
439
+ export function legalAcceptanceRequiredOf(value) {
440
+ const entry = errorWithCode(value, LEGAL_ACCEPTANCE_REQUIRED_CODE);
441
+ if (!entry)
442
+ return null;
443
+ const listed = entry.extensions?.missingDocuments;
444
+ const missingDocuments = [];
445
+ if (Array.isArray(listed)) {
446
+ for (const item of listed) {
447
+ const doc = item;
448
+ if (typeof doc?.documentId !== 'string' || typeof doc.version !== 'string')
449
+ continue;
450
+ const appId = doc.appId;
451
+ missingDocuments.push({
452
+ documentId: doc.documentId,
453
+ version: doc.version,
454
+ appId: typeof appId === 'string' && appId.length > 0
455
+ ? appId
456
+ : typeof appId === 'number'
457
+ ? String(appId)
458
+ : null,
459
+ });
460
+ }
461
+ }
462
+ return { missingDocuments };
463
+ }
464
+ /**
465
+ * Whether an error is an `AGE_REQUIRED` refusal (HTTP 403): the player's age is not known.
466
+ * For an account, ask the player's birth date and country on your own neutral screen and call
467
+ * `auth.recordPlayerAge`, then mint again; a browser game sends the player back through
468
+ * `portal.signIn`, where Studio asks. For an org-managed player, the organization sends
469
+ * `ageYears` and `country` when it signs the player in. Not fixed by retrying as is.
470
+ */
471
+ export function ageRequiredOf(value) {
472
+ return errorWithCode(value, AGE_REQUIRED_CODE) !== null;
473
+ }
474
+ /**
475
+ * Whether an error is an `AGE_REQUIREMENT_NOT_MET` refusal (HTTP 403): by age, the player may
476
+ * not play this app, or create or administer an organization. Not retryable, and asking for
477
+ * the age again changes nothing: an account keeps the answer it gave, and since ck-api v2.61.0
478
+ * the same client (address and user agent) is refused at sign-up and `auth.recordPlayerAge`
479
+ * for 24 hours whatever it sends, and an org-managed player at its sign-ins. An account that
480
+ * answers `recordPlayerAge` with an age under 13 is deleted.
481
+ *
482
+ * Deliberately a boolean. No refusal names an age (the platform's neutral age screen): tell the
483
+ * player they cannot play this, without naming an age or a minimum, and do not offer to enter
484
+ * the date again. v2.60.0 put `minimumAge` and `ageBracket` in the extensions (v2.61.0 does
485
+ * not); this reader never surfaces them, and a game must not show them.
486
+ */
487
+ export function ageRequirementNotMetOf(value) {
488
+ return errorWithCode(value, AGE_REQUIREMENT_NOT_MET_CODE) !== null;
489
+ }
490
+ /**
491
+ * A `TERRITORY_NOT_SUPPORTED` refusal (HTTP 403), or `null`: Crowded Kingdoms does not serve
492
+ * the player's country (the one they connect from, the one they declared, or the one their
493
+ * organization asserted). `country` is `extensions.country` (ISO 3166-1 alpha-2), null when the
494
+ * server did not say. Not retryable; tell the player it is not available where they are.
495
+ */
496
+ export function territoryNotSupportedOf(value) {
497
+ const entry = errorWithCode(value, TERRITORY_NOT_SUPPORTED_CODE);
498
+ if (!entry)
499
+ return null;
500
+ const country = entry.extensions?.country;
501
+ return { country: typeof country === 'string' && country.length > 0 ? country : null };
502
+ }
503
+ /**
504
+ * Whether an error is a `SAFETY_LOG_REQUIRED` refusal (HTTP 403): the app does not keep the
505
+ * safety log (replay logging) where it must. A player under 18 gets it at the mint of an app
506
+ * without one, and an app admitting players under 18 cannot turn its log off. The player
507
+ * cannot fix it: the app's admins turn the log on (`apps.update`) or raise its minimum age.
508
+ */
509
+ export function safetyLogRequiredOf(value) {
510
+ return errorWithCode(value, SAFETY_LOG_REQUIRED_CODE) !== null;
511
+ }
512
+ /**
513
+ * Whether an error is a `SAFETY_MODERATOR_REQUIRED` refusal (HTTP 403, ck-api v2.61.0): a player
514
+ * under 18 is refused a token in an app that admits players under 18 while the app's
515
+ * organization has appointed no safety moderator (a member whose own role grants
516
+ * `moderate_safety`; an admin alone does not count). The player cannot fix it: tell them the
517
+ * app cannot admit them yet. The organization appoints one; `App.hasSafetyModerator` (on
518
+ * `apps.app`, for the organization's members) says whether it has.
519
+ */
520
+ export function safetyModeratorRequiredOf(value) {
521
+ return errorWithCode(value, SAFETY_MODERATOR_REQUIRED_CODE) !== null;
522
+ }
523
+ /**
524
+ * A `PARENTAL_CONSENT_UNAVAILABLE` refusal (HTTP 503) from `safety.requestParentalConsent`, or
525
+ * `null`: a parent cannot be asked right now. `reason` is `extensions.reason`:
526
+ * `not_configured` (the deployment has no consent service; retrying soon does not help),
527
+ * `provider_refused` or `provider_unavailable` (the service refused or did not answer); null
528
+ * from an API that does not say. Voice and video stay off for the player meanwhile.
529
+ */
530
+ export function parentalConsentUnavailableOf(value) {
531
+ const entry = errorWithCode(value, PARENTAL_CONSENT_UNAVAILABLE_CODE);
532
+ if (!entry)
533
+ return null;
534
+ const reason = entry.extensions?.reason;
535
+ return { reason: typeof reason === 'string' && reason.length > 0 ? reason : null };
536
+ }
537
+ /**
538
+ * Whether an error is a `SOCIAL_LIMIT_REACHED` refusal (HTTP 409): the player already has as
539
+ * many contacts, waiting contact requests or blocks in the app as the platform allows (the
540
+ * message says which). Remove some first; not fixed by retrying.
541
+ */
542
+ export function socialLimitReachedOf(value) {
543
+ return errorWithCode(value, SOCIAL_LIMIT_REACHED_CODE) !== null;
544
+ }
545
+ /**
546
+ * A `MINECRAFT_VERIFICATION_FAILED` refusal (HTTP 401) from `portal.signInWithMinecraft`, or
547
+ * `null`. `reason` is `extensions.reason`: `malformed`, `forged`, `expired`, `not_joined` or
548
+ * `replayed`. Never resend the same server id: ask for a new challenge
549
+ * (`portal.minecraftChallenge`) and join it again.
550
+ */
551
+ export function minecraftVerificationFailedOf(value) {
552
+ const entry = errorWithCode(value, MINECRAFT_VERIFICATION_FAILED_CODE);
553
+ if (!entry)
554
+ return null;
555
+ const reason = entry.extensions?.reason;
556
+ return { reason: typeof reason === 'string' && reason.length > 0 ? reason : null };
557
+ }
558
+ /**
559
+ * Whether an error is a `MINECRAFT_VERIFICATION_UNAVAILABLE` refusal (HTTP 503): Mojang's
560
+ * session service did not answer, so the account was not confirmed. Retryable shortly, with a
561
+ * new challenge.
562
+ */
563
+ export function minecraftVerificationUnavailableOf(value) {
564
+ return errorWithCode(value, MINECRAFT_VERIFICATION_UNAVAILABLE_CODE) !== null;
565
+ }
378
566
  /**
379
567
  * An `APP_PAUSED` refusal (HTTP 403: the app's runtime gate is not ACTIVE), or
380
568
  * `null`. `reason` is `extensions.reason`. Show the player that the world is