@crowdedkingdoms/crowdyjs 13.9.0 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/MIGRATION.md +44 -0
  2. package/README.md +68 -33
  3. package/dist/binary-relay.d.ts +1 -1
  4. package/dist/binary-relay.js +1 -1
  5. package/dist/client.d.ts +27 -0
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +61 -2
  8. package/dist/crowdy-client.d.ts +29 -34
  9. package/dist/crowdy-client.d.ts.map +1 -1
  10. package/dist/crowdy-client.js +67 -40
  11. package/dist/datacenter-redirect.d.ts +49 -0
  12. package/dist/datacenter-redirect.d.ts.map +1 -0
  13. package/dist/datacenter-redirect.js +62 -0
  14. package/dist/domains/appAccess.d.ts +3 -3
  15. package/dist/domains/appAccess.d.ts.map +1 -1
  16. package/dist/domains/appAccess.js +16 -16
  17. package/dist/domains/apps.d.ts +4 -8
  18. package/dist/domains/apps.d.ts.map +1 -1
  19. package/dist/domains/apps.js +19 -23
  20. package/dist/domains/auth.d.ts +1 -1
  21. package/dist/domains/billing.d.ts +3 -3
  22. package/dist/domains/billing.d.ts.map +1 -1
  23. package/dist/domains/billing.js +9 -9
  24. package/dist/domains/controlPlane.d.ts +2 -2
  25. package/dist/domains/controlPlane.d.ts.map +1 -1
  26. package/dist/domains/controlPlane.js +4 -4
  27. package/dist/domains/discovery.d.ts +50 -0
  28. package/dist/domains/discovery.d.ts.map +1 -0
  29. package/dist/domains/discovery.js +35 -0
  30. package/dist/domains/marketplace.d.ts +4 -5
  31. package/dist/domains/marketplace.d.ts.map +1 -1
  32. package/dist/domains/marketplace.js +25 -26
  33. package/dist/domains/organizations.d.ts +3 -3
  34. package/dist/domains/organizations.d.ts.map +1 -1
  35. package/dist/domains/organizations.js +22 -22
  36. package/dist/domains/payments.d.ts +3 -3
  37. package/dist/domains/payments.d.ts.map +1 -1
  38. package/dist/domains/payments.js +11 -11
  39. package/dist/domains/platform.d.ts +5 -6
  40. package/dist/domains/platform.d.ts.map +1 -1
  41. package/dist/domains/platform.js +6 -7
  42. package/dist/domains/portal.d.ts +19 -2
  43. package/dist/domains/portal.d.ts.map +1 -1
  44. package/dist/domains/portal.js +12 -12
  45. package/dist/domains/quotas.d.ts +3 -3
  46. package/dist/domains/quotas.d.ts.map +1 -1
  47. package/dist/domains/quotas.js +8 -8
  48. package/dist/domains/serverStatus.d.ts +1 -2
  49. package/dist/domains/serverStatus.d.ts.map +1 -1
  50. package/dist/domains/serverStatus.js +1 -2
  51. package/dist/domains/sharedEnvironment.d.ts +3 -3
  52. package/dist/domains/sharedEnvironment.d.ts.map +1 -1
  53. package/dist/domains/sharedEnvironment.js +15 -15
  54. package/dist/domains/udp.d.ts +1 -1
  55. package/dist/domains/udp.js +1 -1
  56. package/dist/domains/usage.d.ts +2 -2
  57. package/dist/domains/usage.d.ts.map +1 -1
  58. package/dist/domains/usage.js +5 -5
  59. package/dist/domains/users.d.ts +1 -1
  60. package/dist/domains/users.js +1 -1
  61. package/dist/errors.d.ts +56 -0
  62. package/dist/errors.d.ts.map +1 -1
  63. package/dist/errors.js +64 -0
  64. package/dist/generated/graphql.d.ts +65 -16
  65. package/dist/generated/graphql.d.ts.map +1 -1
  66. package/dist/generated/graphql.js +1 -0
  67. package/dist/index.d.ts +13 -14
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +14 -17
  70. package/dist/kit/decks.d.ts +1 -1
  71. package/dist/kit/npcs.d.ts +2 -2
  72. package/dist/kit/npcs.d.ts.map +1 -1
  73. package/dist/kit/social.d.ts.map +1 -1
  74. package/dist/kit/worldsim.d.ts +1 -1
  75. package/dist/realtime.d.ts +26 -0
  76. package/dist/realtime.d.ts.map +1 -1
  77. package/dist/realtime.js +83 -0
  78. package/dist/rediscover.d.ts +7 -3
  79. package/dist/rediscover.d.ts.map +1 -1
  80. package/dist/rediscover.js +7 -3
  81. package/dist/session.d.ts +21 -0
  82. package/dist/session.d.ts.map +1 -1
  83. package/dist/session.js +23 -0
  84. package/package.json +1 -1
@@ -5,7 +5,7 @@ import { type SharedEnvPlansQuery, type OrgFreeAppQuotaQuery, type AppSharedSubs
5
5
  * auto-billing — exposed as `client.sharedEnvironment` (and grouped under
6
6
  * `client.admin`).
7
7
  *
8
- * Targets the **management-api**. {@link plans} is public; the read operations
8
+ * Part of the management surface. {@link plans} is public; the read operations
9
9
  * require org membership; spend-cap / auto-billing / subscription mutations
10
10
  * require the `manage_billing` org permission; {@link publishApp} currently
11
11
  * requires super-admin (preview). Monetary values are `*Cents` (minor units).
@@ -15,8 +15,8 @@ import { type SharedEnvPlansQuery, type OrgFreeAppQuotaQuery, type AppSharedSubs
15
15
  * different args.
16
16
  */
17
17
  export declare class SharedEnvironmentAPI {
18
- private readonly management;
19
- constructor(management: GraphQLClient);
18
+ private readonly api;
19
+ constructor(api: GraphQLClient);
20
20
  /**
21
21
  * Public catalog of paid shared-environment app-slot plans.
22
22
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedEnvironment.d.ts","sourceRoot":"","sources":["../../src/domains/sharedEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAaL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,gCAAgC,EACrC,KAAK,iCAAiC,EACtC,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;GAaG;AACH,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,aAAa;IAEtD;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,m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AAO,GAC/E,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;IAStD;;;;;;;;OAQG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE;QACN,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvC,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GACA,OAAO,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IAYpD;;;;;;;OAOG;IACG,kBAAkB,CACtB,KAAK,EAAE,MAAM,EACb,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,gCAAgC,CAAC,0BAA0B,CAAC,CAAC;IAQxE;;;;;;;OAOG;IACG,mBAAmB,CACvB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,EACvB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,iCAAiC,CAAC,2BAA2B,CAAC,CAAC;CAO3E"}
@@ -4,7 +4,7 @@ import { SharedEnvPlansDocument, OrgFreeAppQuotaDocument, AppSharedSubscriptionD
4
4
  * auto-billing — exposed as `client.sharedEnvironment` (and grouped under
5
5
  * `client.admin`).
6
6
  *
7
- * Targets the **management-api**. {@link plans} is public; the read operations
7
+ * Part of the management surface. {@link plans} is public; the read operations
8
8
  * require org membership; spend-cap / auto-billing / subscription mutations
9
9
  * require the `manage_billing` org permission; {@link publishApp} currently
10
10
  * requires super-admin (preview). Monetary values are `*Cents` (minor units).
@@ -14,8 +14,8 @@ import { SharedEnvPlansDocument, OrgFreeAppQuotaDocument, AppSharedSubscriptionD
14
14
  * different args.
15
15
  */
16
16
  export class SharedEnvironmentAPI {
17
- constructor(management) {
18
- this.management = management;
17
+ constructor(api) {
18
+ this.api = api;
19
19
  }
20
20
  /**
21
21
  * Public catalog of paid shared-environment app-slot plans.
@@ -23,7 +23,7 @@ export class SharedEnvironmentAPI {
23
23
  * @returns The available plans.
24
24
  */
25
25
  async plans() {
26
- const data = await this.management.request(SharedEnvPlansDocument, {});
26
+ const data = await this.api.request(SharedEnvPlansDocument, {});
27
27
  return data.sharedEnvPlans;
28
28
  }
29
29
  /**
@@ -33,7 +33,7 @@ export class SharedEnvironmentAPI {
33
33
  * @returns The {@link FreeAppQuota}.
34
34
  */
35
35
  async freeAppQuota(orgId) {
36
- const data = await this.management.request(OrgFreeAppQuotaDocument, {
36
+ const data = await this.api.request(OrgFreeAppQuotaDocument, {
37
37
  orgId,
38
38
  });
39
39
  return data.orgFreeAppQuota;
@@ -45,7 +45,7 @@ export class SharedEnvironmentAPI {
45
45
  * @returns The {@link AppSharedSubscription} or `null`.
46
46
  */
47
47
  async appSubscription(appId) {
48
- const data = await this.management.request(AppSharedSubscriptionDocument, { appId });
48
+ const data = await this.api.request(AppSharedSubscriptionDocument, { appId });
49
49
  return data.appSharedSubscription;
50
50
  }
51
51
  /**
@@ -55,7 +55,7 @@ export class SharedEnvironmentAPI {
55
55
  * @returns The {@link AppRuntimeState}.
56
56
  */
57
57
  async appRuntimeState(appId) {
58
- const data = await this.management.request(AppRuntimeStateDocument, {
58
+ const data = await this.api.request(AppRuntimeStateDocument, {
59
59
  appId,
60
60
  });
61
61
  return data.appRuntimeState;
@@ -67,7 +67,7 @@ export class SharedEnvironmentAPI {
67
67
  * @returns The {@link OrgAutoBilling} config.
68
68
  */
69
69
  async autoBilling(orgId) {
70
- const data = await this.management.request(OrgAutoBillingDocument, {
70
+ const data = await this.api.request(OrgAutoBillingDocument, {
71
71
  orgId,
72
72
  });
73
73
  return data.orgAutoBilling;
@@ -79,7 +79,7 @@ export class SharedEnvironmentAPI {
79
79
  * @returns The saved payment methods.
80
80
  */
81
81
  async paymentMethods(orgId) {
82
- const data = await this.management.request(OrgPaymentMethodsDocument, {
82
+ const data = await this.api.request(OrgPaymentMethodsDocument, {
83
83
  orgId,
84
84
  });
85
85
  return data.orgPaymentMethods;
@@ -95,7 +95,7 @@ export class SharedEnvironmentAPI {
95
95
  * @returns The {@link PublishAppResult} (free flag + optional checkout).
96
96
  */
97
97
  async publishApp(appId, opts = {}) {
98
- const data = await this.management.request(PublishAppToSharedDocument, {
98
+ const data = await this.api.request(PublishAppToSharedDocument, {
99
99
  appId,
100
100
  planId: opts.planId,
101
101
  provider: opts.provider,
@@ -113,7 +113,7 @@ export class SharedEnvironmentAPI {
113
113
  * @returns The updated {@link AppSharedSubscription}.
114
114
  */
115
115
  async cancelSubscription(appId, idempotencyKey) {
116
- const data = await this.management.request(CancelSharedSubscriptionDocument, { appId, idempotencyKey });
116
+ const data = await this.api.request(CancelSharedSubscriptionDocument, { appId, idempotencyKey });
117
117
  return data.cancelSharedSubscription;
118
118
  }
119
119
  /**
@@ -125,7 +125,7 @@ export class SharedEnvironmentAPI {
125
125
  * @returns The updated {@link AppRuntimeState}.
126
126
  */
127
127
  async setSpendCaps(appId, caps = {}) {
128
- const data = await this.management.request(SetAppSpendCapsDocument, {
128
+ const data = await this.api.request(SetAppSpendCapsDocument, {
129
129
  appId,
130
130
  hourlyLimitCents: caps.hourlyLimitCents,
131
131
  dailyLimitCents: caps.dailyLimitCents,
@@ -142,7 +142,7 @@ export class SharedEnvironmentAPI {
142
142
  * @returns The updated {@link OrgAutoBilling} config.
143
143
  */
144
144
  async setAutoBilling(orgId, config) {
145
- const data = await this.management.request(SetAutoBillingDocument, {
145
+ const data = await this.api.request(SetAutoBillingDocument, {
146
146
  orgId,
147
147
  enabled: config.enabled,
148
148
  limitCents: config.limitCents,
@@ -161,7 +161,7 @@ export class SharedEnvironmentAPI {
161
161
  * @returns The {@link PaymentMethodSetup} handle.
162
162
  */
163
163
  async setupPaymentMethod(orgId, idempotencyKey) {
164
- const data = await this.management.request(SetupSharedPaymentMethodDocument, { orgId, idempotencyKey });
164
+ const data = await this.api.request(SetupSharedPaymentMethodDocument, { orgId, idempotencyKey });
165
165
  return data.setupSharedPaymentMethod;
166
166
  }
167
167
  /**
@@ -173,7 +173,7 @@ export class SharedEnvironmentAPI {
173
173
  * @returns `true` on success.
174
174
  */
175
175
  async removePaymentMethod(orgId, paymentMethodId, idempotencyKey) {
176
- const data = await this.management.request(RemoveSharedPaymentMethodDocument, { orgId, paymentMethodId, idempotencyKey });
176
+ const data = await this.api.request(RemoveSharedPaymentMethodDocument, { orgId, paymentMethodId, idempotencyKey });
177
177
  return data.removeSharedPaymentMethod;
178
178
  }
179
179
  }
@@ -15,7 +15,7 @@ import type { SpatialNotification } from '../realtime.js';
15
15
  * WebSocket (same game-api endpoint) managed by `SubscriptionManager` — the
16
16
  * first subscriber opens it and the last to unsubscribe closes it. Every call
17
17
  * requires an authenticated session carrying a **bearer game token** (minted
18
- * by the management-api, set via `client.auth.login()` or `client.setToken()`);
18
+ * by the API, set via `client.auth.login()` or `client.setToken()`);
19
19
  * a UDP proxy session is opened lazily on the first send or subscribe if you
20
20
  * didn't call {@link connect} first.
21
21
  *
@@ -14,7 +14,7 @@ import { serializeActorUpdate, serializeAudioPacket, serializeChannelMessage, se
14
14
  * WebSocket (same game-api endpoint) managed by `SubscriptionManager` — the
15
15
  * first subscriber opens it and the last to unsubscribe closes it. Every call
16
16
  * requires an authenticated session carrying a **bearer game token** (minted
17
- * by the management-api, set via `client.auth.login()` or `client.setToken()`);
17
+ * by the API, set via `client.auth.login()` or `client.setToken()`);
18
18
  * a UDP proxy session is opened lazily on the first send or subscribe if you
19
19
  * didn't call {@link connect} first.
20
20
  *
@@ -17,8 +17,8 @@ import { type AppGraphqlOperationsQuery, type AppUsageSummaryQuery, type PlayerP
17
17
  * per the permission notes above.
18
18
  */
19
19
  export declare class UsageAPI {
20
- private readonly management;
21
- constructor(management: GraphQLClient);
20
+ private readonly api;
21
+ constructor(api: GraphQLClient);
22
22
  /**
23
23
  * Top GraphQL operations for an app ranked by bytes.
24
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/domains/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,aAAa;IAEtD;;;;;;;;OAQG;IACG,oBAAoB,CACxB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,CAAC;IAU7D;;;;;;;;OAQG;IACG,UAAU,CACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAUnD;;;;;;;;OAQG;IACG,WAAW,CACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;CAI5C"}
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/domains/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAE/C;;;;;;;;OAQG;IACG,oBAAoB,CACxB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,CAAC;IAU7D;;;;;;;;OAQG;IACG,UAAU,CACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAUnD;;;;;;;;OAQG;IACG,WAAW,CACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;CAI5C"}
@@ -16,8 +16,8 @@ import { AppGraphqlOperationsDocument, AppUsageSummaryDocument, PlayerPulseDocum
16
16
  * per the permission notes above.
17
17
  */
18
18
  export class UsageAPI {
19
- constructor(management) {
20
- this.management = management;
19
+ constructor(api) {
20
+ this.api = api;
21
21
  }
22
22
  /**
23
23
  * Top GraphQL operations for an app ranked by bytes.
@@ -29,7 +29,7 @@ export class UsageAPI {
29
29
  * @returns The top operations by usage.
30
30
  */
31
31
  async appGraphqlOperations(orgId, appId, since, limit) {
32
- const data = await this.management.request(AppGraphqlOperationsDocument, {
32
+ const data = await this.api.request(AppGraphqlOperationsDocument, {
33
33
  orgId,
34
34
  appId,
35
35
  since,
@@ -47,7 +47,7 @@ export class UsageAPI {
47
47
  * @returns The {@link AppUsageSummary}.
48
48
  */
49
49
  async appSummary(orgId, appId, since, operationLimit) {
50
- const data = await this.management.request(AppUsageSummaryDocument, {
50
+ const data = await this.api.request(AppUsageSummaryDocument, {
51
51
  orgId,
52
52
  appId,
53
53
  since,
@@ -65,7 +65,7 @@ export class UsageAPI {
65
65
  * @returns The {@link PlayerPulse} snapshot.
66
66
  */
67
67
  async playerPulse(orgId) {
68
- const data = await this.management.request(PlayerPulseDocument, { orgId });
68
+ const data = await this.api.request(PlayerPulseDocument, { orgId });
69
69
  return data.playerPulse;
70
70
  }
71
71
  }
@@ -3,7 +3,7 @@ import { type MeQuery, type UpdateGamertagInput, type UpdateGamertagMutation, ty
3
3
  /**
4
4
  * User identity & account management — exposed as `client.users`.
5
5
  *
6
- * Targets the **management-api** (every call routes to `managementUrl`). After
6
+ * Part of the management surface. After
7
7
  * the database split the users table is management-owned, so game-api no longer
8
8
  * exposes these identity mutations — calling them against a game-api endpoint
9
9
  * throws {@link CrowdyGraphQLError} with `FORBIDDEN`, directing you to the
@@ -2,7 +2,7 @@ import { MeDocument, UpdateGamertagDocument, DeleteMyAccountDocument, UserDocume
2
2
  /**
3
3
  * User identity & account management — exposed as `client.users`.
4
4
  *
5
- * Targets the **management-api** (every call routes to `managementUrl`). After
5
+ * Part of the management surface. After
6
6
  * the database split the users table is management-owned, so game-api no longer
7
7
  * exposes these identity mutations — calling them against a game-api endpoint
8
8
  * throws {@link CrowdyGraphQLError} with `FORBIDDEN`, directing you to the
package/dist/errors.d.ts CHANGED
@@ -102,6 +102,62 @@ export declare class CrowdyGraphQLError extends CrowdyError {
102
102
  */
103
103
  get extensions(): Record<string, unknown> | undefined;
104
104
  }
105
+ /**
106
+ * Extension code the API uses to say "this app's datacenter is not serving".
107
+ *
108
+ * Distinct from {@link WRONG_DATACENTER_CODE}, and the distinction is the whole
109
+ * point: that one names an endpoint to move to, this one deliberately does not,
110
+ * because there is nowhere to move to.
111
+ */
112
+ export declare const APP_UNAVAILABLE_CODE = "APP_UNAVAILABLE";
113
+ /** Extension code the API uses to say "this app lives somewhere else". */
114
+ export declare const WRONG_DATACENTER_CODE = "WRONG_DATACENTER";
115
+ /**
116
+ * The app's own datacenter is not currently serving clients.
117
+ *
118
+ * WHAT MAKES THIS DIFFERENT FROM EVERY OTHER ERROR HERE: there is nothing the
119
+ * client, the SDK, or the player can do about it. A `WRONG_DATACENTER` is fixed
120
+ * by moving, an `UNAUTHENTICATED` by logging in, a `RATE_LIMITED` by waiting a
121
+ * measurable amount of time. This one is fixed by an operator, and the honest
122
+ * thing for an application to do is stop retrying in a loop and say so.
123
+ *
124
+ * {@link message} is written by the server to be shown to a player as-is: it says
125
+ * what is happening, that it is being worked on, and that there is nothing for
126
+ * them to do. Prefer it over inventing your own wording, because the server knows
127
+ * things the client does not — whether this is a brief drain or a whole
128
+ * datacenter — and its phrasing can improve without an SDK release.
129
+ *
130
+ * It carries NO endpoint, on purpose. Do not fall back to a cached one: the
131
+ * cached one is in the datacenter that is down.
132
+ *
133
+ * ```ts
134
+ * try {
135
+ * await client.grids.chunk(appId, x, y, z);
136
+ * } catch (err) {
137
+ * if (err instanceof CrowdyAppUnavailableError) {
138
+ * showBanner(err.message); // "This app is temporarily offline..."
139
+ * return; // do not retry in a tight loop
140
+ * }
141
+ * throw err;
142
+ * }
143
+ * ```
144
+ */
145
+ export declare class CrowdyAppUnavailableError extends CrowdyGraphQLError {
146
+ /** The app the server refused to serve, when it named one. */
147
+ get appId(): string | undefined;
148
+ /**
149
+ * The datacenter that is not serving. Diagnostic only — do not show a player a
150
+ * datacenter code, and do not try to reach it.
151
+ */
152
+ get appDatacenter(): string | undefined;
153
+ /**
154
+ * Whether it is worth trying again later. True today for every case the server
155
+ * raises this for; read it rather than assuming, so a future permanent variant
156
+ * (an app placed in a datacenter that has been destroyed, say) can say false
157
+ * without the SDK changing.
158
+ */
159
+ get retryable(): boolean;
160
+ }
105
161
  /**
106
162
  * A network-level failure before any HTTP response was received: DNS failure,
107
163
  * TLS error, connection refused, or an aborted `fetch`. Generally retryable
@@ -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,MA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WAAW;CAAG"}
package/dist/errors.js CHANGED
@@ -87,6 +87,70 @@ export class CrowdyGraphQLError extends CrowdyError {
87
87
  return this.graphqlErrors[0]?.extensions;
88
88
  }
89
89
  }
90
+ /**
91
+ * Extension code the API uses to say "this app's datacenter is not serving".
92
+ *
93
+ * Distinct from {@link WRONG_DATACENTER_CODE}, and the distinction is the whole
94
+ * point: that one names an endpoint to move to, this one deliberately does not,
95
+ * because there is nowhere to move to.
96
+ */
97
+ export const APP_UNAVAILABLE_CODE = 'APP_UNAVAILABLE';
98
+ /** Extension code the API uses to say "this app lives somewhere else". */
99
+ export const WRONG_DATACENTER_CODE = 'WRONG_DATACENTER';
100
+ /**
101
+ * The app's own datacenter is not currently serving clients.
102
+ *
103
+ * WHAT MAKES THIS DIFFERENT FROM EVERY OTHER ERROR HERE: there is nothing the
104
+ * client, the SDK, or the player can do about it. A `WRONG_DATACENTER` is fixed
105
+ * by moving, an `UNAUTHENTICATED` by logging in, a `RATE_LIMITED` by waiting a
106
+ * measurable amount of time. This one is fixed by an operator, and the honest
107
+ * thing for an application to do is stop retrying in a loop and say so.
108
+ *
109
+ * {@link message} is written by the server to be shown to a player as-is: it says
110
+ * what is happening, that it is being worked on, and that there is nothing for
111
+ * them to do. Prefer it over inventing your own wording, because the server knows
112
+ * things the client does not — whether this is a brief drain or a whole
113
+ * datacenter — and its phrasing can improve without an SDK release.
114
+ *
115
+ * It carries NO endpoint, on purpose. Do not fall back to a cached one: the
116
+ * cached one is in the datacenter that is down.
117
+ *
118
+ * ```ts
119
+ * try {
120
+ * await client.grids.chunk(appId, x, y, z);
121
+ * } catch (err) {
122
+ * if (err instanceof CrowdyAppUnavailableError) {
123
+ * showBanner(err.message); // "This app is temporarily offline..."
124
+ * return; // do not retry in a tight loop
125
+ * }
126
+ * throw err;
127
+ * }
128
+ * ```
129
+ */
130
+ export class CrowdyAppUnavailableError extends CrowdyGraphQLError {
131
+ /** The app the server refused to serve, when it named one. */
132
+ get appId() {
133
+ const value = this.extensions?.appId;
134
+ return typeof value === 'string' ? value : undefined;
135
+ }
136
+ /**
137
+ * The datacenter that is not serving. Diagnostic only — do not show a player a
138
+ * datacenter code, and do not try to reach it.
139
+ */
140
+ get appDatacenter() {
141
+ const value = this.extensions?.appDatacenter;
142
+ return typeof value === 'string' ? value : undefined;
143
+ }
144
+ /**
145
+ * Whether it is worth trying again later. True today for every case the server
146
+ * raises this for; read it rather than assuming, so a future permanent variant
147
+ * (an app placed in a datacenter that has been destroyed, say) can say false
148
+ * without the SDK changing.
149
+ */
150
+ get retryable() {
151
+ return this.extensions?.retryable !== false;
152
+ }
153
+ }
90
154
  /**
91
155
  * A network-level failure before any HTTP response was received: DNS failure,
92
156
  * TLS error, connection refused, or an aborted `fetch`. Generally retryable