@crowdedkingdoms/crowdyjs 18.15.0 → 18.16.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.
- package/README.md +90 -17
- package/dist/crowdy-client.d.ts +3 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +3 -0
- package/dist/default-origin.d.ts +6 -6
- package/dist/default-origin.d.ts.map +1 -1
- package/dist/default-origin.js +6 -6
- package/dist/domains/admin.d.ts +4 -0
- package/dist/domains/admin.d.ts.map +1 -1
- package/dist/domains/admin.js +1 -0
- package/dist/domains/managedPlayers.d.ts +99 -0
- package/dist/domains/managedPlayers.d.ts.map +1 -0
- package/dist/domains/managedPlayers.js +149 -0
- package/dist/domains/organizations.d.ts +12 -3
- package/dist/domains/organizations.d.ts.map +1 -1
- package/dist/domains/organizations.js +11 -3
- package/dist/domains/portal.d.ts +28 -0
- package/dist/domains/portal.d.ts.map +1 -1
- package/dist/domains/portal.js +45 -0
- package/dist/errors.d.ts +27 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +33 -0
- package/dist/generated/graphql-schema.d.ts +247 -8
- package/dist/generated/graphql-schema.d.ts.map +1 -1
- package/dist/generated/graphql.d.ts +197 -0
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +18 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
|
@@ -91,10 +91,14 @@ export declare class OrganizationsAPI {
|
|
|
91
91
|
create(input: CreateOrganizationInput): Promise<CreateOrganizationMutation['createOrganization']>;
|
|
92
92
|
/**
|
|
93
93
|
* Mint a new org API token (for server-side studio backends). Requires the
|
|
94
|
-
* `manage_tokens` org permission. The plaintext secret is returned
|
|
94
|
+
* `manage_tokens` org permission. The plaintext secret (`cko_…`) is returned
|
|
95
|
+
* **once**. Keep it on the organization's server: the API refuses a request
|
|
96
|
+
* that carries it with an `Origin` header.
|
|
95
97
|
*
|
|
96
98
|
* @param input - {@link CreateOrgTokenInput}: `orgId`, optional `label` and
|
|
97
|
-
* `expiresAt
|
|
99
|
+
* `expiresAt`; for org-managed players (dev only), `scopes`
|
|
100
|
+
* (`players:mint`, `players:manage`) and `appIds` (limit the token to some
|
|
101
|
+
* of the org's apps). A token with no scope can do nothing.
|
|
98
102
|
* @returns The created token including its one-time plaintext secret.
|
|
99
103
|
*/
|
|
100
104
|
createToken(input: CreateOrgTokenInput): Promise<CreateOrgTokenMutation['createOrgToken']>;
|
|
@@ -111,9 +115,14 @@ export declare class OrganizationsAPI {
|
|
|
111
115
|
* Revoke (disable) an org token. Requires the `manage_tokens` org permission.
|
|
112
116
|
*
|
|
113
117
|
* @param orgTokenId - Numeric token id.
|
|
118
|
+
* @param options - `endSessions: true` also ends every session the token signed
|
|
119
|
+
* org-managed players in with (dev only), so their devices stop now rather than at
|
|
120
|
+
* their sessions' end.
|
|
114
121
|
* @returns `true` on success.
|
|
115
122
|
*/
|
|
116
|
-
revokeToken(orgTokenId: string
|
|
123
|
+
revokeToken(orgTokenId: string, options?: {
|
|
124
|
+
endSessions?: boolean;
|
|
125
|
+
}): Promise<RevokeOrgTokenMutation['revokeOrgToken']>;
|
|
117
126
|
/**
|
|
118
127
|
* Invite a user to an organization (by email or user id), optionally with
|
|
119
128
|
* initial roles. Requires the `manage_members` org permission.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../src/domains/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAmBL,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,sBA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G;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,CAAC;IAShE;;;;;;;OAOG;IACG,UAAU,CACd,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAOlD;;;;;;;OAOG;IACG,UAAU,CACd,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAQlD;;;;;;OAMG;IACG,UAAU,CACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;CAMnD"}
|
|
@@ -126,10 +126,14 @@ export class OrganizationsAPI {
|
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Mint a new org API token (for server-side studio backends). Requires the
|
|
129
|
-
* `manage_tokens` org permission. The plaintext secret is returned
|
|
129
|
+
* `manage_tokens` org permission. The plaintext secret (`cko_…`) is returned
|
|
130
|
+
* **once**. Keep it on the organization's server: the API refuses a request
|
|
131
|
+
* that carries it with an `Origin` header.
|
|
130
132
|
*
|
|
131
133
|
* @param input - {@link CreateOrgTokenInput}: `orgId`, optional `label` and
|
|
132
|
-
* `expiresAt
|
|
134
|
+
* `expiresAt`; for org-managed players (dev only), `scopes`
|
|
135
|
+
* (`players:mint`, `players:manage`) and `appIds` (limit the token to some
|
|
136
|
+
* of the org's apps). A token with no scope can do nothing.
|
|
133
137
|
* @returns The created token including its one-time plaintext secret.
|
|
134
138
|
*/
|
|
135
139
|
async createToken(input) {
|
|
@@ -157,11 +161,15 @@ export class OrganizationsAPI {
|
|
|
157
161
|
* Revoke (disable) an org token. Requires the `manage_tokens` org permission.
|
|
158
162
|
*
|
|
159
163
|
* @param orgTokenId - Numeric token id.
|
|
164
|
+
* @param options - `endSessions: true` also ends every session the token signed
|
|
165
|
+
* org-managed players in with (dev only), so their devices stop now rather than at
|
|
166
|
+
* their sessions' end.
|
|
160
167
|
* @returns `true` on success.
|
|
161
168
|
*/
|
|
162
|
-
async revokeToken(orgTokenId) {
|
|
169
|
+
async revokeToken(orgTokenId, options = {}) {
|
|
163
170
|
const data = await this.api.request(RevokeOrgTokenDocument, {
|
|
164
171
|
orgTokenId,
|
|
172
|
+
...(options.endSessions === undefined ? {} : { endSessions: options.endSessions }),
|
|
165
173
|
});
|
|
166
174
|
return data.revokeOrgToken;
|
|
167
175
|
}
|
package/dist/domains/portal.d.ts
CHANGED
|
@@ -275,6 +275,34 @@ export declare class PortalAPI {
|
|
|
275
275
|
* back through {@link signIn}, where `/authorize` asks for them.
|
|
276
276
|
*/
|
|
277
277
|
refresh(currentServer?: CurrentServer): Promise<AppTokenResponse>;
|
|
278
|
+
/**
|
|
279
|
+
* Store an app token the player's organization minted for it, so this client plays with
|
|
280
|
+
* it and {@link refresh} rotates it. For an org-managed player: the organization's server
|
|
281
|
+
* calls `mintManagedPlayerToken` with its org token and sends the response to the
|
|
282
|
+
* player's device, which passes it here. Returns the response unchanged; point the game
|
|
283
|
+
* client at its `gameApiUrl` / `gameApiWsUrl` as after any mint.
|
|
284
|
+
*
|
|
285
|
+
* The token refreshes until the sign-in's lifetime (the organization's setting) ends;
|
|
286
|
+
* after that `refresh()` is refused and the device gets a new token from its organization.
|
|
287
|
+
*
|
|
288
|
+
* Refuses an org token (`cko_…`). That is the organization's server credential: it signs
|
|
289
|
+
* in any of the organization's players, so a device must never hold one.
|
|
290
|
+
*/
|
|
291
|
+
adoptAppToken(response: AppTokenResponse): AppTokenResponse;
|
|
292
|
+
/**
|
|
293
|
+
* Trade an assertion the player's organization signed for the player's app token, and
|
|
294
|
+
* store it (as {@link adoptAppToken} does). For an org-managed player whose organization
|
|
295
|
+
* registered a signing key: its sign-in service signs a short JWS for the player and the
|
|
296
|
+
* device brings it here. Public: needs no session and no org token.
|
|
297
|
+
*
|
|
298
|
+
* Each assertion works once. A refusal is `ASSERTION_REJECTED`, with the failed check in
|
|
299
|
+
* `extensions.reason` ({@link assertionRejectedOf}); resending the same assertion cannot
|
|
300
|
+
* succeed, so ask the sign-in service for a new one.
|
|
301
|
+
*/
|
|
302
|
+
exchangeManagedPlayerAssertion(params: {
|
|
303
|
+
appId: string;
|
|
304
|
+
assertion: string;
|
|
305
|
+
}): Promise<AppTokenResponse>;
|
|
278
306
|
/** Whether portaling into an app needs a consent prompt (Overworld side). */
|
|
279
307
|
getConsent(appId: string): Promise<PortalConsentState>;
|
|
280
308
|
/** 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,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC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B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO7D,+DAA+D;IACzD,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAK1D,8EAA8E;IACxE,oBAAoB,CAAC,KAAK,EAAE;QAChC,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,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"}
|
package/dist/domains/portal.js
CHANGED
|
@@ -65,6 +65,9 @@ const RefreshAppTokenDocument = parse(`mutation RefreshAppToken { refreshAppToke
|
|
|
65
65
|
// Asked for only when a server is named, so a client against a Game API older than
|
|
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
|
+
const ExchangeManagedPlayerAssertionDocument = parse(`mutation ExchangeManagedPlayerAssertion($input: ExchangeManagedPlayerAssertionInput!) { exchangeManagedPlayerAssertion(input: $input) { ${APP_TOKEN_FIELDS} } }`);
|
|
69
|
+
/** What every org token starts with: an organization's server credential, never a device's. */
|
|
70
|
+
const ORG_TOKEN_PREFIX = 'cko_';
|
|
68
71
|
/** Thrown by {@link PortalAPI.handleAuthorizeRequest} when the user must consent. */
|
|
69
72
|
export class PortalConsentRequiredError extends Error {
|
|
70
73
|
constructor(appId, appName) {
|
|
@@ -213,6 +216,48 @@ export class PortalAPI {
|
|
|
213
216
|
this.session.setToken(data.refreshAppToken.token);
|
|
214
217
|
return data.refreshAppToken;
|
|
215
218
|
}
|
|
219
|
+
// ----- Org-managed players (dev only) --------------------------------------
|
|
220
|
+
/**
|
|
221
|
+
* Store an app token the player's organization minted for it, so this client plays with
|
|
222
|
+
* it and {@link refresh} rotates it. For an org-managed player: the organization's server
|
|
223
|
+
* calls `mintManagedPlayerToken` with its org token and sends the response to the
|
|
224
|
+
* player's device, which passes it here. Returns the response unchanged; point the game
|
|
225
|
+
* client at its `gameApiUrl` / `gameApiWsUrl` as after any mint.
|
|
226
|
+
*
|
|
227
|
+
* The token refreshes until the sign-in's lifetime (the organization's setting) ends;
|
|
228
|
+
* after that `refresh()` is refused and the device gets a new token from its organization.
|
|
229
|
+
*
|
|
230
|
+
* Refuses an org token (`cko_…`). That is the organization's server credential: it signs
|
|
231
|
+
* in any of the organization's players, so a device must never hold one.
|
|
232
|
+
*/
|
|
233
|
+
adoptAppToken(response) {
|
|
234
|
+
const token = response?.token;
|
|
235
|
+
if (typeof token !== 'string' || token.length === 0) {
|
|
236
|
+
throw new TypeError('adoptAppToken: the response has no token');
|
|
237
|
+
}
|
|
238
|
+
if (token.startsWith(ORG_TOKEN_PREFIX)) {
|
|
239
|
+
throw new TypeError("adoptAppToken: that is an org token, your organization's server credential. Give the device the app token mintManagedPlayerToken returns, never the org token.");
|
|
240
|
+
}
|
|
241
|
+
this.session.setToken(token);
|
|
242
|
+
return response;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Trade an assertion the player's organization signed for the player's app token, and
|
|
246
|
+
* store it (as {@link adoptAppToken} does). For an org-managed player whose organization
|
|
247
|
+
* registered a signing key: its sign-in service signs a short JWS for the player and the
|
|
248
|
+
* device brings it here. Public: needs no session and no org token.
|
|
249
|
+
*
|
|
250
|
+
* Each assertion works once. A refusal is `ASSERTION_REJECTED`, with the failed check in
|
|
251
|
+
* `extensions.reason` ({@link assertionRejectedOf}); resending the same assertion cannot
|
|
252
|
+
* succeed, so ask the sign-in service for a new one.
|
|
253
|
+
*/
|
|
254
|
+
async exchangeManagedPlayerAssertion(params) {
|
|
255
|
+
const data = await this.api.request(ExchangeManagedPlayerAssertionDocument, {
|
|
256
|
+
input: { appId: params.appId, assertion: params.assertion },
|
|
257
|
+
});
|
|
258
|
+
this.session.setToken(data.exchangeManagedPlayerAssertion.token);
|
|
259
|
+
return data.exchangeManagedPlayerAssertion;
|
|
260
|
+
}
|
|
216
261
|
// ----- Consent + connected apps ------------------------------------------
|
|
217
262
|
/** Whether portaling into an app needs a consent prompt (Overworld side). */
|
|
218
263
|
async getConsent(appId) {
|
package/dist/errors.d.ts
CHANGED
|
@@ -267,6 +267,17 @@ export declare const ACCOUNT_BLOCKED_CODE = "ACCOUNT_BLOCKED";
|
|
|
267
267
|
* request, an add or an invite; see {@link groupMemberBannedOf}.
|
|
268
268
|
*/
|
|
269
269
|
export declare const GROUP_MEMBER_BANNED_CODE = "GROUP_MEMBER_BANNED";
|
|
270
|
+
/**
|
|
271
|
+
* `extensions.code` for "an org-managed player cannot do this" (HTTP 403): it has no wallet,
|
|
272
|
+
* and its mods are refused where its organization has not switched them on for the app; see
|
|
273
|
+
* {@link managedPlayerNotAllowedOf}.
|
|
274
|
+
*/
|
|
275
|
+
export declare const MANAGED_PLAYER_NOT_ALLOWED_CODE = "MANAGED_PLAYER_NOT_ALLOWED";
|
|
276
|
+
/**
|
|
277
|
+
* `extensions.code` for "the organization's signed player assertion was refused" (HTTP 401),
|
|
278
|
+
* with the failed check in `extensions.reason`; see {@link assertionRejectedOf}.
|
|
279
|
+
*/
|
|
280
|
+
export declare const ASSERTION_REJECTED_CODE = "ASSERTION_REJECTED";
|
|
270
281
|
/**
|
|
271
282
|
* Why an app is paused, as `extensions.reason` on `APP_PAUSED` and
|
|
272
283
|
* `AppRuntimeGate.reason` carry it. Open union: the server may add one.
|
|
@@ -304,6 +315,22 @@ export declare function accountBlockedOf(value: unknown): {
|
|
|
304
315
|
} | null;
|
|
305
316
|
/** Whether an error is a `GROUP_MEMBER_BANNED` refusal (HTTP 403); only an unban lifts it. */
|
|
306
317
|
export declare function groupMemberBannedOf(value: unknown): boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Whether an error is a `MANAGED_PLAYER_NOT_ALLOWED` refusal (HTTP 403): an org-managed
|
|
320
|
+
* player asked for a wallet, or for a mod, a Crowdy Studio write or the Studio agent in an app
|
|
321
|
+
* whose organization has not switched its managed players' mods on. Not fixed by retrying.
|
|
322
|
+
*/
|
|
323
|
+
export declare function managedPlayerNotAllowedOf(value: unknown): boolean;
|
|
324
|
+
/**
|
|
325
|
+
* An `ASSERTION_REJECTED` refusal (HTTP 401) from
|
|
326
|
+
* `portal.exchangeManagedPlayerAssertion`, or `null`. `reason` is `extensions.reason`, the
|
|
327
|
+
* check that failed: for example `expired`, `replayed`, `signature`, `audience` or
|
|
328
|
+
* `unknown_key`. Resending the same assertion cannot succeed; ask the organization's
|
|
329
|
+
* sign-in service for a new one.
|
|
330
|
+
*/
|
|
331
|
+
export declare function assertionRejectedOf(value: unknown): {
|
|
332
|
+
reason: string | null;
|
|
333
|
+
} | null;
|
|
307
334
|
/**
|
|
308
335
|
* An `APP_PAUSED` refusal (HTTP 403: the app's runtime gate is not ACTIVE), or
|
|
309
336
|
* `null`. `reason` is `extensions.reason`. Show the player that the world is
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -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,CAAC,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,kBAAkB;CAKxC;AAED;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,wCAAwC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAKzC;AAED;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;IACjD,oEAAoE;IACpE,QAAQ,CAAC,aAAa,EAAE,yBAAyB,EAAE,CAAC;gBAExC,MAAM,EAAE,yBAAyB,EAAE;IAK/C;;;;;;OAMG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,GAAG,SAAS,GAC1C,OAAO,CAET;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;gBACrC,KAAK,EAAE,OAAO;CAG3B;AAED;;;;;;;GAOG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;gBACrC,SAAS,EAAE,MAAM;CAG9B;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,8DAA8D;IAC9D,QAAQ,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
|
@@ -263,6 +263,17 @@ export const ACCOUNT_BLOCKED_CODE = 'ACCOUNT_BLOCKED';
|
|
|
263
263
|
* request, an add or an invite; see {@link groupMemberBannedOf}.
|
|
264
264
|
*/
|
|
265
265
|
export const GROUP_MEMBER_BANNED_CODE = 'GROUP_MEMBER_BANNED';
|
|
266
|
+
/**
|
|
267
|
+
* `extensions.code` for "an org-managed player cannot do this" (HTTP 403): it has no wallet,
|
|
268
|
+
* and its mods are refused where its organization has not switched them on for the app; see
|
|
269
|
+
* {@link managedPlayerNotAllowedOf}.
|
|
270
|
+
*/
|
|
271
|
+
export const MANAGED_PLAYER_NOT_ALLOWED_CODE = 'MANAGED_PLAYER_NOT_ALLOWED';
|
|
272
|
+
/**
|
|
273
|
+
* `extensions.code` for "the organization's signed player assertion was refused" (HTTP 401),
|
|
274
|
+
* with the failed check in `extensions.reason`; see {@link assertionRejectedOf}.
|
|
275
|
+
*/
|
|
276
|
+
export const ASSERTION_REJECTED_CODE = 'ASSERTION_REJECTED';
|
|
266
277
|
/** The first error entry carrying `code`, from an error or a raw payload. */
|
|
267
278
|
function errorWithCode(value, code) {
|
|
268
279
|
if (!value || typeof value !== 'object')
|
|
@@ -324,6 +335,28 @@ export function accountBlockedOf(value) {
|
|
|
324
335
|
export function groupMemberBannedOf(value) {
|
|
325
336
|
return errorWithCode(value, GROUP_MEMBER_BANNED_CODE) !== null;
|
|
326
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Whether an error is a `MANAGED_PLAYER_NOT_ALLOWED` refusal (HTTP 403): an org-managed
|
|
340
|
+
* player asked for a wallet, or for a mod, a Crowdy Studio write or the Studio agent in an app
|
|
341
|
+
* whose organization has not switched its managed players' mods on. Not fixed by retrying.
|
|
342
|
+
*/
|
|
343
|
+
export function managedPlayerNotAllowedOf(value) {
|
|
344
|
+
return errorWithCode(value, MANAGED_PLAYER_NOT_ALLOWED_CODE) !== null;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* An `ASSERTION_REJECTED` refusal (HTTP 401) from
|
|
348
|
+
* `portal.exchangeManagedPlayerAssertion`, or `null`. `reason` is `extensions.reason`, the
|
|
349
|
+
* check that failed: for example `expired`, `replayed`, `signature`, `audience` or
|
|
350
|
+
* `unknown_key`. Resending the same assertion cannot succeed; ask the organization's
|
|
351
|
+
* sign-in service for a new one.
|
|
352
|
+
*/
|
|
353
|
+
export function assertionRejectedOf(value) {
|
|
354
|
+
const entry = errorWithCode(value, ASSERTION_REJECTED_CODE);
|
|
355
|
+
if (!entry)
|
|
356
|
+
return null;
|
|
357
|
+
const reason = entry.extensions?.reason;
|
|
358
|
+
return { reason: typeof reason === 'string' && reason.length > 0 ? reason : null };
|
|
359
|
+
}
|
|
327
360
|
/**
|
|
328
361
|
* An `APP_PAUSED` refusal (HTTP 403: the app's runtime gate is not ACTIVE), or
|
|
329
362
|
* `null`. `reason` is `extensions.reason`. Show the player that the world is
|