@crowdedkingdoms/crowdyjs 18.23.1 → 18.24.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/MIGRATION.md +62 -0
- package/README.md +153 -28
- package/dist/crowdy-client.d.ts +10 -1
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +5 -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/apps.d.ts +43 -3
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +46 -3
- package/dist/domains/auth.d.ts +140 -16
- package/dist/domains/auth.d.ts.map +1 -1
- package/dist/domains/auth.js +153 -16
- package/dist/domains/inputLog.d.ts +4 -1
- package/dist/domains/inputLog.d.ts.map +1 -1
- package/dist/domains/inputLog.js +4 -1
- package/dist/domains/managedPlayers.d.ts +56 -3
- package/dist/domains/managedPlayers.d.ts.map +1 -1
- package/dist/domains/managedPlayers.js +16 -3
- package/dist/domains/moderation.d.ts +53 -0
- package/dist/domains/moderation.d.ts.map +1 -0
- package/dist/domains/moderation.js +68 -0
- package/dist/domains/platform.d.ts +13 -0
- package/dist/domains/platform.d.ts.map +1 -1
- package/dist/domains/platform.js +14 -0
- package/dist/domains/portal.d.ts +86 -8
- package/dist/domains/portal.d.ts.map +1 -1
- package/dist/domains/portal.js +78 -8
- package/dist/domains/safety.d.ts +163 -0
- package/dist/domains/safety.d.ts.map +1 -0
- package/dist/domains/safety.js +167 -0
- package/dist/domains/users.d.ts +9 -1
- package/dist/domains/users.d.ts.map +1 -1
- package/dist/domains/users.js +9 -1
- package/dist/errors.d.ts +135 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +163 -0
- package/dist/generated/graphql-schema.d.ts +522 -14
- package/dist/generated/graphql-schema.d.ts.map +1 -1
- package/dist/generated/graphql-schema.js +64 -0
- package/dist/generated/graphql.d.ts +375 -0
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +24 -3
- package/dist/index.d.ts +12 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/live-coding/assets/browser-authoring-index.json +1 -1
- package/dist/live-coding/assets/manifest.json +1 -1
- package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
- package/dist/live-coding/browser-authoring-index.generated.js +265 -6
- package/package.json +1 -1
package/dist/domains/apps.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GraphQLClient } from '../client.js';
|
|
2
|
-
import { type AppQuery, type AppBySlugQuery, type MyAppsQuery, type AppsForOrgQuery, type MarketplaceAppsQuery, type MarketplaceAppsQueryVariables, type AppsConnectionQuery, type AppsConnectionQueryVariables, type CreateAppMutation, type UpdateAppMutation, type ArchiveAppMutation, type AppCodeAdmissionModeQuery, type AppCodeAdmissionsQuery, type SetAppCodeAdmissionModeMutation, type AdmitAppCodeMutation, type RevokeAppCodeAdmissionMutation, type PlaceableDatacentersQuery, type CreateAppInput, type UpdateAppInput, type AdmitAppCodeInput, type CodeAdmissionMode } from '../generated/graphql.js';
|
|
2
|
+
import { type AppRecordingQuery, type AppRequiredDocumentInput, type SetAppRequiredDocumentsMutation, type AppQuery, type AppBySlugQuery, type MyAppsQuery, type AppsForOrgQuery, type MarketplaceAppsQuery, type MarketplaceAppsQueryVariables, type AppsConnectionQuery, type AppsConnectionQueryVariables, type CreateAppMutation, type UpdateAppMutation, type ArchiveAppMutation, type AppCodeAdmissionModeQuery, type AppCodeAdmissionsQuery, type SetAppCodeAdmissionModeMutation, type AdmitAppCodeMutation, type RevokeAppCodeAdmissionMutation, type PlaceableDatacentersQuery, type CreateAppInput, type UpdateAppInput, type AdmitAppCodeInput, type CodeAdmissionMode } from '../generated/graphql.js';
|
|
3
3
|
/**
|
|
4
4
|
* The minimal routing tuple the SDK derives from an `App` row: just enough to
|
|
5
5
|
* decide which game-api endpoint should serve a given app. Returned by
|
|
@@ -27,6 +27,12 @@ export interface AppRoute {
|
|
|
27
27
|
*/
|
|
28
28
|
gameApiUrl: string | null;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* What an app's safety log records right now ({@link AppsAPI.recording}): `enabled` (the log
|
|
32
|
+
* is on, so text chat and direct messages are recorded), `voice` (voice and channel audio)
|
|
33
|
+
* and `video` (webcam video).
|
|
34
|
+
*/
|
|
35
|
+
export type AppRecordingState = NonNullable<AppRecordingQuery['app']>['recording'];
|
|
30
36
|
/**
|
|
31
37
|
* App discovery & game-api routing — exposed as `client.apps`.
|
|
32
38
|
*
|
|
@@ -100,6 +106,29 @@ export declare class AppsAPI {
|
|
|
100
106
|
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` if the caller is not signed in.
|
|
101
107
|
*/
|
|
102
108
|
app(appId: string): Promise<AppQuery['app']>;
|
|
109
|
+
/**
|
|
110
|
+
* What the app's safety log (replay logging) records right now, for the notice and the
|
|
111
|
+
* recording indicator a game shows its players: `enabled` (the log is on: text chat and
|
|
112
|
+
* direct messages are recorded), `voice` (voice and channel audio) and `video` (webcam
|
|
113
|
+
* video). Readable with the app's own app token, so a game reads it on its gameplay client.
|
|
114
|
+
* ck-api v2.60.0.
|
|
115
|
+
*
|
|
116
|
+
* While `voice` or `video` is true, show the player a notice before they first speak or
|
|
117
|
+
* appear on camera, and an indicator while it stays true. Read it when the player enters
|
|
118
|
+
* the app; an admin's change applies within about 15 seconds. Null for an unknown app.
|
|
119
|
+
*/
|
|
120
|
+
recording(appId: string): Promise<AppRecordingState | null>;
|
|
121
|
+
/**
|
|
122
|
+
* Set the documents the app's players accept before playing, replacing the list:
|
|
123
|
+
* documents left out stop being required, and a new `version` of one asks every player of
|
|
124
|
+
* the app again at their next mint or refresh (`LEGAL_ACCEPTANCE_REQUIRED` until they accept
|
|
125
|
+
* it). At most 10; `documentId` is 1-64 lower-case letters, digits and hyphens and may not
|
|
126
|
+
* reuse a platform document's id; `url` is https. An empty list requires none. Players
|
|
127
|
+
* read the list with `auth.appRequiredDocuments(appId)` and accept it with
|
|
128
|
+
* `auth.recordPlayerConsents({ acceptLegal: true, appId })`. Requires `manage_apps` on the
|
|
129
|
+
* app. ck-api v2.60.0.
|
|
130
|
+
*/
|
|
131
|
+
setRequiredDocuments(appId: string, documents: AppRequiredDocumentInput[]): Promise<SetAppRequiredDocumentsMutation['setAppRequiredDocuments']>;
|
|
103
132
|
/**
|
|
104
133
|
* Look up a single app by its org slug + app slug (the marketplace URL path).
|
|
105
134
|
* **Public**: no authentication required, and not filtered by visibility or
|
|
@@ -222,13 +251,24 @@ export declare class AppsAPI {
|
|
|
222
251
|
* every client input they accept for the app, readable with `client.inputLog` and
|
|
223
252
|
* billed as stored input logs (crowdedkingdoms.com/pricing). Apps start with it off
|
|
224
253
|
* ("No replication logging"), and recording stops shortly after it is turned off.
|
|
254
|
+
* It is the app's safety log: an app that admits players under 18 must keep it on, so
|
|
255
|
+
* turning it off there is refused `SAFETY_LOG_REQUIRED` (ck-api v2.60.0).
|
|
256
|
+
*
|
|
257
|
+
* `replayLoggingRecordsVoice` / `replayLoggingRecordsVideo` (both true by default) keep
|
|
258
|
+
* voice and channel audio, or webcam video, in or out of the log while it is on;
|
|
259
|
+
* {@link recording} is what players are told. `minPlayerAge` (13 to 18) raises the
|
|
260
|
+
* youngest age the app admits above the platform's, never below it; `null` returns
|
|
261
|
+
* it to the platform's, and `effectiveMinPlayerAge` reads the result. Younger players
|
|
262
|
+
* are refused `AGE_REQUIREMENT_NOT_MET` at their next mint or refresh.
|
|
225
263
|
*
|
|
226
264
|
* @param appId - Numeric app id.
|
|
227
265
|
* @param input - {@link UpdateAppInput} fields to change.
|
|
228
266
|
* @returns The updated {@link App}.
|
|
229
267
|
* @throws {CrowdyGraphQLError} `FORBIDDEN`/`SCOPE_MISSING` without
|
|
230
|
-
* `manage_apps`,
|
|
231
|
-
* an org whose wallet has no spendable balance (a billing-exempt org needs none)
|
|
268
|
+
* `manage_apps`, `INPUT_LOG_FUNDS_NEEDED` when turning replay logging on for
|
|
269
|
+
* an org whose wallet has no spendable balance (a billing-exempt org needs none),
|
|
270
|
+
* or `SAFETY_LOG_REQUIRED` when turning it off in an app that admits players
|
|
271
|
+
* under 18.
|
|
232
272
|
*/
|
|
233
273
|
update(appId: string, input: UpdateAppInput): Promise<UpdateAppMutation['updateApp']>;
|
|
234
274
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/domains/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/domains/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAkBL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,KAAK,QAAQ,EAEb,KAAK,cAAc,EAEnB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAE9B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,4DAA4D;IAC5D,KAAK,EAAE,M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AAM,EACb,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAQ1C;;;;;;;OAOG;IACG,OAAO,CACX,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAI7C"}
|
package/dist/domains/apps.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppDocument, AppBySlugDocument, MyAppsDocument, AppsForOrgDocument, MarketplaceAppsDocument, AppsConnectionDocument, CreateAppDocument, UpdateAppDocument, ArchiveAppDocument, AppCodeAdmissionModeDocument, AppCodeAdmissionsDocument, SetAppCodeAdmissionModeDocument, AdmitAppCodeDocument, RevokeAppCodeAdmissionDocument, PlaceableDatacentersDocument, } from '../generated/graphql.js';
|
|
1
|
+
import { AppDocument, AppBySlugDocument, MyAppsDocument, AppsForOrgDocument, MarketplaceAppsDocument, AppsConnectionDocument, CreateAppDocument, UpdateAppDocument, ArchiveAppDocument, AppCodeAdmissionModeDocument, AppCodeAdmissionsDocument, SetAppCodeAdmissionModeDocument, AdmitAppCodeDocument, RevokeAppCodeAdmissionDocument, PlaceableDatacentersDocument, AppRecordingDocument, SetAppRequiredDocumentsDocument, } from '../generated/graphql.js';
|
|
2
2
|
function appRouteFromAppRow(row) {
|
|
3
3
|
if (!row || typeof row !== 'object')
|
|
4
4
|
return null;
|
|
@@ -113,6 +113,38 @@ export class AppsAPI {
|
|
|
113
113
|
const data = await this.api.request(AppDocument, { appId });
|
|
114
114
|
return data.app;
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* What the app's safety log (replay logging) records right now, for the notice and the
|
|
118
|
+
* recording indicator a game shows its players: `enabled` (the log is on: text chat and
|
|
119
|
+
* direct messages are recorded), `voice` (voice and channel audio) and `video` (webcam
|
|
120
|
+
* video). Readable with the app's own app token, so a game reads it on its gameplay client.
|
|
121
|
+
* ck-api v2.60.0.
|
|
122
|
+
*
|
|
123
|
+
* While `voice` or `video` is true, show the player a notice before they first speak or
|
|
124
|
+
* appear on camera, and an indicator while it stays true. Read it when the player enters
|
|
125
|
+
* the app; an admin's change applies within about 15 seconds. Null for an unknown app.
|
|
126
|
+
*/
|
|
127
|
+
async recording(appId) {
|
|
128
|
+
const data = await this.api.request(AppRecordingDocument, { appId });
|
|
129
|
+
return data.app?.recording ?? null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Set the documents the app's players accept before playing, replacing the list:
|
|
133
|
+
* documents left out stop being required, and a new `version` of one asks every player of
|
|
134
|
+
* the app again at their next mint or refresh (`LEGAL_ACCEPTANCE_REQUIRED` until they accept
|
|
135
|
+
* it). At most 10; `documentId` is 1-64 lower-case letters, digits and hyphens and may not
|
|
136
|
+
* reuse a platform document's id; `url` is https. An empty list requires none. Players
|
|
137
|
+
* read the list with `auth.appRequiredDocuments(appId)` and accept it with
|
|
138
|
+
* `auth.recordPlayerConsents({ acceptLegal: true, appId })`. Requires `manage_apps` on the
|
|
139
|
+
* app. ck-api v2.60.0.
|
|
140
|
+
*/
|
|
141
|
+
async setRequiredDocuments(appId, documents) {
|
|
142
|
+
const data = await this.api.request(SetAppRequiredDocumentsDocument, {
|
|
143
|
+
appId,
|
|
144
|
+
documents,
|
|
145
|
+
});
|
|
146
|
+
return data.setAppRequiredDocuments;
|
|
147
|
+
}
|
|
116
148
|
/**
|
|
117
149
|
* Look up a single app by its org slug + app slug (the marketplace URL path).
|
|
118
150
|
* **Public**: no authentication required, and not filtered by visibility or
|
|
@@ -260,13 +292,24 @@ export class AppsAPI {
|
|
|
260
292
|
* every client input they accept for the app, readable with `client.inputLog` and
|
|
261
293
|
* billed as stored input logs (crowdedkingdoms.com/pricing). Apps start with it off
|
|
262
294
|
* ("No replication logging"), and recording stops shortly after it is turned off.
|
|
295
|
+
* It is the app's safety log: an app that admits players under 18 must keep it on, so
|
|
296
|
+
* turning it off there is refused `SAFETY_LOG_REQUIRED` (ck-api v2.60.0).
|
|
297
|
+
*
|
|
298
|
+
* `replayLoggingRecordsVoice` / `replayLoggingRecordsVideo` (both true by default) keep
|
|
299
|
+
* voice and channel audio, or webcam video, in or out of the log while it is on;
|
|
300
|
+
* {@link recording} is what players are told. `minPlayerAge` (13 to 18) raises the
|
|
301
|
+
* youngest age the app admits above the platform's, never below it; `null` returns
|
|
302
|
+
* it to the platform's, and `effectiveMinPlayerAge` reads the result. Younger players
|
|
303
|
+
* are refused `AGE_REQUIREMENT_NOT_MET` at their next mint or refresh.
|
|
263
304
|
*
|
|
264
305
|
* @param appId - Numeric app id.
|
|
265
306
|
* @param input - {@link UpdateAppInput} fields to change.
|
|
266
307
|
* @returns The updated {@link App}.
|
|
267
308
|
* @throws {CrowdyGraphQLError} `FORBIDDEN`/`SCOPE_MISSING` without
|
|
268
|
-
* `manage_apps`,
|
|
269
|
-
* an org whose wallet has no spendable balance (a billing-exempt org needs none)
|
|
309
|
+
* `manage_apps`, `INPUT_LOG_FUNDS_NEEDED` when turning replay logging on for
|
|
310
|
+
* an org whose wallet has no spendable balance (a billing-exempt org needs none),
|
|
311
|
+
* or `SAFETY_LOG_REQUIRED` when turning it off in an app that admits players
|
|
312
|
+
* under 18.
|
|
270
313
|
*/
|
|
271
314
|
async update(appId, input) {
|
|
272
315
|
const data = await this.api.request(UpdateAppDocument, {
|
package/dist/domains/auth.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GraphQLClient } from '../client.js';
|
|
2
2
|
import type { AuthState } from '../auth-state.js';
|
|
3
|
+
import { type LegalDocument } from '../generated/graphql.js';
|
|
3
4
|
/**
|
|
4
5
|
* Authentication and account lifecycle — exposed as `client.auth`.
|
|
5
6
|
*
|
|
@@ -34,10 +35,15 @@ import type { AuthState } from '../auth-state.js';
|
|
|
34
35
|
* **Public (no session):** {@link register}, {@link login},
|
|
35
36
|
* {@link requestLoginLink}, {@link completeLoginLink}, {@link socialLoginStart},
|
|
36
37
|
* {@link socialLoginComplete}, {@link availableLoginProviders},
|
|
37
|
-
* {@link checkAuthMethod}, {@link requestPasswordReset}, {@link resetPassword}
|
|
38
|
+
* {@link checkAuthMethod}, {@link requestPasswordReset}, {@link resetPassword},
|
|
39
|
+
* and the documents to show: {@link playerLegalDocuments},
|
|
40
|
+
* {@link appRequiredDocuments}, {@link developerLegalDocuments}.
|
|
38
41
|
* **Require a session:** {@link logout}, {@link logoutAllDevices},
|
|
39
42
|
* {@link myIdentities}, {@link linkIdentity}, {@link unlinkIdentity},
|
|
40
|
-
* {@link changePassword}, {@link setInitialPassword}
|
|
43
|
+
* {@link changePassword}, {@link setInitialPassword}, and what a player or
|
|
44
|
+
* developer agrees to or answers: {@link recordPlayerConsents},
|
|
45
|
+
* {@link playerLegalAcceptance}, {@link recordPlayerAge},
|
|
46
|
+
* {@link recordDeveloperConsents}, {@link developerLegalAcceptance}.
|
|
41
47
|
*
|
|
42
48
|
* **Which password method:** the four are distinguished by what the caller has
|
|
43
49
|
* already proven, not by what they want to do. Signed in with a password →
|
|
@@ -66,6 +72,36 @@ export interface UserIdentity {
|
|
|
66
72
|
createdAt: string;
|
|
67
73
|
lastLoginAt: string | null;
|
|
68
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* A player's age bracket as the API reports it (`me.ageBracket`): `unknown` until an age is
|
|
77
|
+
* given, then `under_13`, `13_15`, `16_17` or `18_plus`. Open union: the server may add one.
|
|
78
|
+
* A bracket is for your logic; never show it to a player as an age.
|
|
79
|
+
*/
|
|
80
|
+
export type AgeBracket = 'unknown' | 'under_13' | '13_15' | '16_17' | '18_plus' | (string & {});
|
|
81
|
+
/** How a player accepted documents: on a Crowded Kingdoms or SDK form, or on the app's own screen. */
|
|
82
|
+
export type LegalAcceptanceMethodValue = 'CLICKWRAP' | 'IN_GAME';
|
|
83
|
+
/** The account after {@link AuthAPI.recordPlayerAge}. */
|
|
84
|
+
export interface PlayerAge {
|
|
85
|
+
userId: string;
|
|
86
|
+
ageBracket: AgeBracket | null;
|
|
87
|
+
/** The declared country (ISO 3166-1 alpha-2). */
|
|
88
|
+
country: string | null;
|
|
89
|
+
}
|
|
90
|
+
/** A birth date, country and parental agreement, as {@link AuthAPI.recordPlayerAge} and `register` take them. */
|
|
91
|
+
export interface PlayerAgeInput {
|
|
92
|
+
/**
|
|
93
|
+
* `YYYY-MM-DD` (`YYYY-MM` is accepted too). Only the year and month are kept, and the age
|
|
94
|
+
* is counted from the last day of that month.
|
|
95
|
+
*/
|
|
96
|
+
birthDate: string;
|
|
97
|
+
/** The country the player lives in, ISO 3166-1 alpha-2 (such as `US`). */
|
|
98
|
+
country: string;
|
|
99
|
+
/**
|
|
100
|
+
* True when a player under 18 confirmed that a parent or guardian agreed. Required true
|
|
101
|
+
* under 18; ignored at 18 or over.
|
|
102
|
+
*/
|
|
103
|
+
parentalConfirmation?: boolean;
|
|
104
|
+
}
|
|
69
105
|
/**
|
|
70
106
|
* `register` refused because the address already has an account.
|
|
71
107
|
*
|
|
@@ -211,6 +247,17 @@ export declare class AuthAPI {
|
|
|
211
247
|
* exists; the account then starts accepted. A client with no browser origin may
|
|
212
248
|
* omit them and call {@link recordPlayerConsents} before its first gameplay
|
|
213
249
|
* token.
|
|
250
|
+
*
|
|
251
|
+
* **The age (ck-api v2.60.0).** `birthDate`, `country` and, for a player under 18,
|
|
252
|
+
* `parentalConfirmation` are the answers of a neutral age screen: it asks the date
|
|
253
|
+
* of birth and the country and shows no age, and only a player under 18 sees the
|
|
254
|
+
* line that a parent or guardian agreed. They are optional until the platform
|
|
255
|
+
* admits players under 18; after that a browser sign-up without them is refused
|
|
256
|
+
* `AGE_REQUIRED`, and a request with no browser origin may give them later with
|
|
257
|
+
* {@link recordPlayerAge}. A country Crowded Kingdoms does not serve, declared or
|
|
258
|
+
* detected, is refused `TERRITORY_NOT_SUPPORTED` (`territoryNotSupportedOf`), and an
|
|
259
|
+
* age the platform does not admit `AGE_REQUIREMENT_NOT_MET`
|
|
260
|
+
* (`ageRequirementNotMetOf`); either way no account is made.
|
|
214
261
|
*/
|
|
215
262
|
register(input: {
|
|
216
263
|
email: string;
|
|
@@ -220,31 +267,108 @@ export declare class AuthAPI {
|
|
|
220
267
|
acceptLegal?: boolean;
|
|
221
268
|
/** The player is at least 18, or the age of majority where they live if higher. */
|
|
222
269
|
attestAgeOfMajority?: boolean;
|
|
270
|
+
/** Birth date, `YYYY-MM-DD` (or `YYYY-MM`); only the year and month are kept. Sent with `country`. */
|
|
271
|
+
birthDate?: string;
|
|
272
|
+
/** The country the player lives in, ISO 3166-1 alpha-2; required with `birthDate`. */
|
|
273
|
+
country?: string;
|
|
274
|
+
/** A player under 18 confirmed a parent or guardian agreed; required true under 18. */
|
|
275
|
+
parentalConfirmation?: boolean;
|
|
223
276
|
}): Promise<AuthResponse>;
|
|
224
277
|
/**
|
|
225
|
-
* Store the signed-in player's agreement to the current
|
|
226
|
-
* documents (
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
278
|
+
* Store the signed-in player's agreement to the platform's current player
|
|
279
|
+
* documents ({@link playerLegalDocuments}) and, with `appId`, to that app's own
|
|
280
|
+
* ({@link appRequiredDocuments}). Requires the identity session token;
|
|
281
|
+
* `acceptLegal` must be `true`, and repeating it is harmless.
|
|
282
|
+
*
|
|
283
|
+
* `attestAgeOfMajority` (the player is at least 18, or the age of majority where
|
|
284
|
+
* they live if higher) must be `true` while the platform still uses the
|
|
285
|
+
* attestation; once players give a birth date instead ({@link recordPlayerAge})
|
|
286
|
+
* the server ignores it, and it may be left out. `method` records how the player
|
|
287
|
+
* accepted: `CLICKWRAP` (the default; a Crowded Kingdoms or SDK form) or `IN_GAME`
|
|
288
|
+
* (the app's own screen).
|
|
230
289
|
*
|
|
231
290
|
* Since ck-api v2.35.0 a gameplay token (`portal.mintAppToken`,
|
|
232
291
|
* `portal.createAuthorizationCode`, `portal.refresh`) is refused with
|
|
233
|
-
* `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError}
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
292
|
+
* `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError};
|
|
293
|
+
* `legalAcceptanceRequiredOf` lists the missing documents) until this is stored.
|
|
294
|
+
* It records the PLAYER's agreement: call it only after they ticked the box in
|
|
295
|
+
* your own UI, which links each document. A browser game never needs it, because
|
|
296
|
+
* Studio's hosted `/authorize` asks.
|
|
297
|
+
*
|
|
298
|
+
* `appId`, `method` and leaving the attestation out need ck-api v2.60.0; the call
|
|
299
|
+
* with both flags and neither of those works against any API since v2.35.0.
|
|
237
300
|
*/
|
|
238
301
|
recordPlayerConsents(input: {
|
|
239
302
|
acceptLegal: boolean;
|
|
240
|
-
attestAgeOfMajority
|
|
303
|
+
attestAgeOfMajority?: boolean;
|
|
304
|
+
/** The app whose own documents the player also accepted (BigInt as a decimal string). */
|
|
305
|
+
appId?: string;
|
|
306
|
+
method?: LegalAcceptanceMethodValue;
|
|
307
|
+
}): Promise<boolean>;
|
|
308
|
+
/**
|
|
309
|
+
* Whether the signed-in player has stored the platform's current player
|
|
310
|
+
* documents and, while the platform asks for one, the age attestation or a birth
|
|
311
|
+
* date: whether a gameplay token would be issued. With `appId` the app's own
|
|
312
|
+
* documents count too (ck-api v2.60.0). Requires the identity session token.
|
|
313
|
+
* ck-api v2.35.0.
|
|
314
|
+
*/
|
|
315
|
+
playerLegalAcceptance(options?: {
|
|
316
|
+
appId?: string;
|
|
241
317
|
}): Promise<boolean>;
|
|
242
318
|
/**
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
319
|
+
* The platform's documents every player accepts before playing, at the versions
|
|
320
|
+
* required now: show them (with the app's own, {@link appRequiredDocuments})
|
|
321
|
+
* before {@link recordPlayerConsents}. Each has `documentId`, `version`, `title`
|
|
322
|
+
* and `url`. Public. ck-api v2.60.0.
|
|
323
|
+
*/
|
|
324
|
+
playerLegalDocuments(): Promise<LegalDocument[]>;
|
|
325
|
+
/**
|
|
326
|
+
* An app's own documents (its rules, an addendum), which its players accept on top
|
|
327
|
+
* of the platform's: record them with {@link recordPlayerConsents} and the
|
|
328
|
+
* `appId` before the player's next mint. Empty when the app requires none. Its
|
|
329
|
+
* admins set them with `apps.setRequiredDocuments`. Public. ck-api v2.60.0.
|
|
330
|
+
*/
|
|
331
|
+
appRequiredDocuments(appId: string): Promise<LegalDocument[]>;
|
|
332
|
+
/**
|
|
333
|
+
* Record the signed-in player's birth date and country, and under 18 that a parent
|
|
334
|
+
* or guardian agreed, for an account whose age is not known yet (`users.me()`'s
|
|
335
|
+
* `ageBracket` is `unknown`, and a mint answers `AGE_REQUIRED`). Only the year and
|
|
336
|
+
* month are kept. Requires the identity session token. ck-api v2.60.0.
|
|
337
|
+
*
|
|
338
|
+
* Ask on a neutral screen: the date of birth and the country, with no age shown,
|
|
339
|
+
* and the parental line only for a player under 18. Refused with `CONFLICT` once
|
|
340
|
+
* the account has an age, `TERRITORY_NOT_SUPPORTED` for a country Crowded Kingdoms
|
|
341
|
+
* does not serve (declared or detected), and `AGE_REQUIREMENT_NOT_MET` under the
|
|
342
|
+
* platform's youngest age, in which case the account keeps that answer and asking
|
|
343
|
+
* again changes nothing. Whether the player may play a given app is decided at
|
|
344
|
+
* the mint. Returns the account's `ageBracket` and `country`.
|
|
345
|
+
*/
|
|
346
|
+
recordPlayerAge(input: PlayerAgeInput): Promise<PlayerAge>;
|
|
347
|
+
/**
|
|
348
|
+
* The documents a developer accepts before creating or administering an
|
|
349
|
+
* organization, at the versions required now. Empty while the platform asks
|
|
350
|
+
* developers for nothing beyond the player documents. Public. ck-api v2.60.0.
|
|
351
|
+
*/
|
|
352
|
+
developerLegalDocuments(): Promise<LegalDocument[]>;
|
|
353
|
+
/**
|
|
354
|
+
* Whether the signed-in account has accepted the current developer documents.
|
|
355
|
+
* False means creating or administering an organization is refused with
|
|
356
|
+
* `LEGAL_ACCEPTANCE_REQUIRED` until {@link recordDeveloperConsents}. Requires the
|
|
357
|
+
* identity session token. ck-api v2.60.0.
|
|
246
358
|
*/
|
|
247
|
-
|
|
359
|
+
developerLegalAcceptance(): Promise<boolean>;
|
|
360
|
+
/**
|
|
361
|
+
* Store the signed-in account's agreement to the current developer documents
|
|
362
|
+
* ({@link developerLegalDocuments}); `acceptDeveloperTerms` must be `true`, and
|
|
363
|
+
* repeating it is harmless. It records a person's agreement: call it only after
|
|
364
|
+
* they ticked the box in your own UI, linking each document. The developer
|
|
365
|
+
* documents are for adults: an account with no age is refused `AGE_REQUIRED`
|
|
366
|
+
* ({@link recordPlayerAge} first) and one under 18 `AGE_REQUIREMENT_NOT_MET`.
|
|
367
|
+
* Requires the identity session token. ck-api v2.60.0.
|
|
368
|
+
*/
|
|
369
|
+
recordDeveloperConsents(input: {
|
|
370
|
+
acceptDeveloperTerms: boolean;
|
|
371
|
+
}): Promise<boolean>;
|
|
248
372
|
/**
|
|
249
373
|
* Email-first adaptive login: does this address have password sign-in enabled?
|
|
250
374
|
* Public, and deliberately does not reveal whether the address is registered.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/domains/auth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/domains/auth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MA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KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIpC,+CAA+C;IAC/C,QAAQ,IAAI,MAAM,GAAG,IAAI;CAG1B"}
|
package/dist/domains/auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parse } from 'graphql';
|
|
2
|
-
import { LogoutAllDevicesDocument, LogoutDocument } from '../generated/graphql.js';
|
|
2
|
+
import { LogoutAllDevicesDocument, LogoutDocument, } from '../generated/graphql.js';
|
|
3
3
|
/**
|
|
4
4
|
* The `extensions.code` of the first GraphQL error, if there is one.
|
|
5
5
|
*
|
|
@@ -130,8 +130,23 @@ const SocialLoginCompleteDocument = parse(`mutation SocialLoginComplete($input:
|
|
|
130
130
|
const LoginDocument = parse(`mutation Login($loginUserInput: LoginUserInput!) { login(loginUserInput: $loginUserInput) { ${AUTH_RESPONSE_FIELDS} } }`);
|
|
131
131
|
const RegisterDocument = parse(`mutation Register($registerUserInput: RegisterUserInput!) { register(registerUserInput: $registerUserInput) { ${AUTH_RESPONSE_FIELDS} } }`);
|
|
132
132
|
// THE CLICKWRAP (ck-api v2.35.0). A gameplay token is refused until both are stored.
|
|
133
|
+
// This document is the 18.23 one, kept byte for byte: an API before v2.60.0 declares the
|
|
134
|
+
// attestation `Boolean!`, so a nullable variable would fail validation there. It is sent
|
|
135
|
+
// whenever the call is the old one (both flags, no app, no method).
|
|
133
136
|
const RecordPlayerConsentsDocument = parse(`mutation RecordPlayerConsents($acceptLegal: Boolean!, $attestAgeOfMajority: Boolean!) { recordPlayerConsents(acceptLegal: $acceptLegal, attestAgeOfMajority: $attestAgeOfMajority) }`);
|
|
137
|
+
// ck-api v2.60.0: an app's own documents, how they were accepted, and an attestation the
|
|
138
|
+
// platform ignores once it asks for a birth date instead.
|
|
139
|
+
const RecordPlayerConsentsForAppDocument = parse(`mutation RecordPlayerConsentsForApp($acceptLegal: Boolean!, $attestAgeOfMajority: Boolean, $appId: BigInt, $method: LegalAcceptanceMethod) { recordPlayerConsents(acceptLegal: $acceptLegal, attestAgeOfMajority: $attestAgeOfMajority, appId: $appId, method: $method) }`);
|
|
134
140
|
const PlayerLegalAcceptanceDocument = parse(`query PlayerLegalAcceptance { playerLegalAcceptance }`);
|
|
141
|
+
const PlayerLegalAcceptanceForAppDocument = parse(`query PlayerLegalAcceptanceForApp($appId: BigInt!) { playerLegalAcceptance(appId: $appId) }`);
|
|
142
|
+
// THE AGE (ck-api v2.60.0). Only the year and month are kept.
|
|
143
|
+
const RecordPlayerAgeDocument = parse(`mutation RecordPlayerAge($input: RecordPlayerAgeInput!) { recordPlayerAge(input: $input) { userId ageBracket country } }`);
|
|
144
|
+
const LEGAL_DOCUMENT_FIELDS = 'documentId version title url appId';
|
|
145
|
+
const PlayerLegalDocumentsDocument = parse(`query PlayerLegalDocuments { playerLegalDocuments { ${LEGAL_DOCUMENT_FIELDS} } }`);
|
|
146
|
+
const AppRequiredDocumentsDocument = parse(`query AppRequiredDocuments($appId: BigInt!) { appRequiredDocuments(appId: $appId) { ${LEGAL_DOCUMENT_FIELDS} } }`);
|
|
147
|
+
const DeveloperLegalDocumentsDocument = parse(`query DeveloperLegalDocuments { developerLegalDocuments { ${LEGAL_DOCUMENT_FIELDS} } }`);
|
|
148
|
+
const DeveloperLegalAcceptanceDocument = parse(`query DeveloperLegalAcceptance { developerLegalAcceptance }`);
|
|
149
|
+
const RecordDeveloperConsentsDocument = parse(`mutation RecordDeveloperConsents($acceptDeveloperTerms: Boolean!) { recordDeveloperConsents(acceptDeveloperTerms: $acceptDeveloperTerms) }`);
|
|
135
150
|
// PASSWORD MANAGEMENT. Four mutations, and they are four rather than one or two
|
|
136
151
|
// on purpose: each is defined by what the CALLER has already proven, and
|
|
137
152
|
// collapsing any pair would delete the proof.
|
|
@@ -247,6 +262,17 @@ export class AuthAPI {
|
|
|
247
262
|
* exists; the account then starts accepted. A client with no browser origin may
|
|
248
263
|
* omit them and call {@link recordPlayerConsents} before its first gameplay
|
|
249
264
|
* token.
|
|
265
|
+
*
|
|
266
|
+
* **The age (ck-api v2.60.0).** `birthDate`, `country` and, for a player under 18,
|
|
267
|
+
* `parentalConfirmation` are the answers of a neutral age screen: it asks the date
|
|
268
|
+
* of birth and the country and shows no age, and only a player under 18 sees the
|
|
269
|
+
* line that a parent or guardian agreed. They are optional until the platform
|
|
270
|
+
* admits players under 18; after that a browser sign-up without them is refused
|
|
271
|
+
* `AGE_REQUIRED`, and a request with no browser origin may give them later with
|
|
272
|
+
* {@link recordPlayerAge}. A country Crowded Kingdoms does not serve, declared or
|
|
273
|
+
* detected, is refused `TERRITORY_NOT_SUPPORTED` (`territoryNotSupportedOf`), and an
|
|
274
|
+
* age the platform does not admit `AGE_REQUIREMENT_NOT_MET`
|
|
275
|
+
* (`ageRequirementNotMetOf`); either way no account is made.
|
|
250
276
|
*/
|
|
251
277
|
async register(input) {
|
|
252
278
|
const data = await this.graphql.request(RegisterDocument, {
|
|
@@ -257,32 +283,143 @@ export class AuthAPI {
|
|
|
257
283
|
return data.register;
|
|
258
284
|
}
|
|
259
285
|
/**
|
|
260
|
-
* Store the signed-in player's agreement to the current
|
|
261
|
-
* documents (
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
286
|
+
* Store the signed-in player's agreement to the platform's current player
|
|
287
|
+
* documents ({@link playerLegalDocuments}) and, with `appId`, to that app's own
|
|
288
|
+
* ({@link appRequiredDocuments}). Requires the identity session token;
|
|
289
|
+
* `acceptLegal` must be `true`, and repeating it is harmless.
|
|
290
|
+
*
|
|
291
|
+
* `attestAgeOfMajority` (the player is at least 18, or the age of majority where
|
|
292
|
+
* they live if higher) must be `true` while the platform still uses the
|
|
293
|
+
* attestation; once players give a birth date instead ({@link recordPlayerAge})
|
|
294
|
+
* the server ignores it, and it may be left out. `method` records how the player
|
|
295
|
+
* accepted: `CLICKWRAP` (the default; a Crowded Kingdoms or SDK form) or `IN_GAME`
|
|
296
|
+
* (the app's own screen).
|
|
265
297
|
*
|
|
266
298
|
* Since ck-api v2.35.0 a gameplay token (`portal.mintAppToken`,
|
|
267
299
|
* `portal.createAuthorizationCode`, `portal.refresh`) is refused with
|
|
268
|
-
* `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError}
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
300
|
+
* `LEGAL_ACCEPTANCE_REQUIRED` ({@link isLegalAcceptanceRequiredError};
|
|
301
|
+
* `legalAcceptanceRequiredOf` lists the missing documents) until this is stored.
|
|
302
|
+
* It records the PLAYER's agreement: call it only after they ticked the box in
|
|
303
|
+
* your own UI, which links each document. A browser game never needs it, because
|
|
304
|
+
* Studio's hosted `/authorize` asks.
|
|
305
|
+
*
|
|
306
|
+
* `appId`, `method` and leaving the attestation out need ck-api v2.60.0; the call
|
|
307
|
+
* with both flags and neither of those works against any API since v2.35.0.
|
|
272
308
|
*/
|
|
273
309
|
async recordPlayerConsents(input) {
|
|
274
|
-
const
|
|
310
|
+
const { acceptLegal, attestAgeOfMajority, appId, method } = input;
|
|
311
|
+
if (typeof attestAgeOfMajority === 'boolean' &&
|
|
312
|
+
appId === undefined &&
|
|
313
|
+
method === undefined) {
|
|
314
|
+
const data = await this.graphql.request(RecordPlayerConsentsDocument, {
|
|
315
|
+
acceptLegal,
|
|
316
|
+
attestAgeOfMajority,
|
|
317
|
+
});
|
|
318
|
+
return data.recordPlayerConsents;
|
|
319
|
+
}
|
|
320
|
+
const data = await this.graphql.request(RecordPlayerConsentsForAppDocument, {
|
|
321
|
+
acceptLegal,
|
|
322
|
+
...(attestAgeOfMajority !== undefined ? { attestAgeOfMajority } : {}),
|
|
323
|
+
...(appId !== undefined ? { appId } : {}),
|
|
324
|
+
...(method !== undefined ? { method } : {}),
|
|
325
|
+
});
|
|
275
326
|
return data.recordPlayerConsents;
|
|
276
327
|
}
|
|
277
328
|
/**
|
|
278
|
-
* Whether the signed-in player has the current
|
|
279
|
-
*
|
|
280
|
-
*
|
|
329
|
+
* Whether the signed-in player has stored the platform's current player
|
|
330
|
+
* documents and, while the platform asks for one, the age attestation or a birth
|
|
331
|
+
* date: whether a gameplay token would be issued. With `appId` the app's own
|
|
332
|
+
* documents count too (ck-api v2.60.0). Requires the identity session token.
|
|
333
|
+
* ck-api v2.35.0.
|
|
281
334
|
*/
|
|
282
|
-
async playerLegalAcceptance() {
|
|
283
|
-
const data =
|
|
335
|
+
async playerLegalAcceptance(options = {}) {
|
|
336
|
+
const data = options.appId !== undefined
|
|
337
|
+
? await this.graphql.request(PlayerLegalAcceptanceForAppDocument, {
|
|
338
|
+
appId: options.appId,
|
|
339
|
+
})
|
|
340
|
+
: await this.graphql.request(PlayerLegalAcceptanceDocument, {});
|
|
284
341
|
return data.playerLegalAcceptance;
|
|
285
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* The platform's documents every player accepts before playing, at the versions
|
|
345
|
+
* required now: show them (with the app's own, {@link appRequiredDocuments})
|
|
346
|
+
* before {@link recordPlayerConsents}. Each has `documentId`, `version`, `title`
|
|
347
|
+
* and `url`. Public. ck-api v2.60.0.
|
|
348
|
+
*/
|
|
349
|
+
async playerLegalDocuments() {
|
|
350
|
+
const data = await this.graphql.request(PlayerLegalDocumentsDocument, {});
|
|
351
|
+
return data.playerLegalDocuments;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* An app's own documents (its rules, an addendum), which its players accept on top
|
|
355
|
+
* of the platform's: record them with {@link recordPlayerConsents} and the
|
|
356
|
+
* `appId` before the player's next mint. Empty when the app requires none. Its
|
|
357
|
+
* admins set them with `apps.setRequiredDocuments`. Public. ck-api v2.60.0.
|
|
358
|
+
*/
|
|
359
|
+
async appRequiredDocuments(appId) {
|
|
360
|
+
const data = await this.graphql.request(AppRequiredDocumentsDocument, { appId });
|
|
361
|
+
return data.appRequiredDocuments;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Record the signed-in player's birth date and country, and under 18 that a parent
|
|
365
|
+
* or guardian agreed, for an account whose age is not known yet (`users.me()`'s
|
|
366
|
+
* `ageBracket` is `unknown`, and a mint answers `AGE_REQUIRED`). Only the year and
|
|
367
|
+
* month are kept. Requires the identity session token. ck-api v2.60.0.
|
|
368
|
+
*
|
|
369
|
+
* Ask on a neutral screen: the date of birth and the country, with no age shown,
|
|
370
|
+
* and the parental line only for a player under 18. Refused with `CONFLICT` once
|
|
371
|
+
* the account has an age, `TERRITORY_NOT_SUPPORTED` for a country Crowded Kingdoms
|
|
372
|
+
* does not serve (declared or detected), and `AGE_REQUIREMENT_NOT_MET` under the
|
|
373
|
+
* platform's youngest age, in which case the account keeps that answer and asking
|
|
374
|
+
* again changes nothing. Whether the player may play a given app is decided at
|
|
375
|
+
* the mint. Returns the account's `ageBracket` and `country`.
|
|
376
|
+
*/
|
|
377
|
+
async recordPlayerAge(input) {
|
|
378
|
+
const data = await this.graphql.request(RecordPlayerAgeDocument, {
|
|
379
|
+
input: {
|
|
380
|
+
birthDate: input.birthDate,
|
|
381
|
+
country: input.country,
|
|
382
|
+
...(input.parentalConfirmation !== undefined
|
|
383
|
+
? { parentalConfirmation: input.parentalConfirmation }
|
|
384
|
+
: {}),
|
|
385
|
+
},
|
|
386
|
+
});
|
|
387
|
+
return data.recordPlayerAge;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* The documents a developer accepts before creating or administering an
|
|
391
|
+
* organization, at the versions required now. Empty while the platform asks
|
|
392
|
+
* developers for nothing beyond the player documents. Public. ck-api v2.60.0.
|
|
393
|
+
*/
|
|
394
|
+
async developerLegalDocuments() {
|
|
395
|
+
const data = await this.graphql.request(DeveloperLegalDocumentsDocument, {});
|
|
396
|
+
return data.developerLegalDocuments;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Whether the signed-in account has accepted the current developer documents.
|
|
400
|
+
* False means creating or administering an organization is refused with
|
|
401
|
+
* `LEGAL_ACCEPTANCE_REQUIRED` until {@link recordDeveloperConsents}. Requires the
|
|
402
|
+
* identity session token. ck-api v2.60.0.
|
|
403
|
+
*/
|
|
404
|
+
async developerLegalAcceptance() {
|
|
405
|
+
const data = await this.graphql.request(DeveloperLegalAcceptanceDocument, {});
|
|
406
|
+
return data.developerLegalAcceptance;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Store the signed-in account's agreement to the current developer documents
|
|
410
|
+
* ({@link developerLegalDocuments}); `acceptDeveloperTerms` must be `true`, and
|
|
411
|
+
* repeating it is harmless. It records a person's agreement: call it only after
|
|
412
|
+
* they ticked the box in your own UI, linking each document. The developer
|
|
413
|
+
* documents are for adults: an account with no age is refused `AGE_REQUIRED`
|
|
414
|
+
* ({@link recordPlayerAge} first) and one under 18 `AGE_REQUIREMENT_NOT_MET`.
|
|
415
|
+
* Requires the identity session token. ck-api v2.60.0.
|
|
416
|
+
*/
|
|
417
|
+
async recordDeveloperConsents(input) {
|
|
418
|
+
const data = await this.graphql.request(RecordDeveloperConsentsDocument, {
|
|
419
|
+
acceptDeveloperTerms: input.acceptDeveloperTerms,
|
|
420
|
+
});
|
|
421
|
+
return data.recordDeveloperConsents;
|
|
422
|
+
}
|
|
286
423
|
/**
|
|
287
424
|
* Email-first adaptive login: does this address have password sign-in enabled?
|
|
288
425
|
* Public, and deliberately does not reveal whether the address is registered.
|
|
@@ -33,7 +33,10 @@ export interface InputLogPageOptions<Filter> {
|
|
|
33
33
|
* the app to its datacenter like any gameplay call.
|
|
34
34
|
*
|
|
35
35
|
* **Who sees what.** A player reads only the sessions and inputs they sent. A holder of
|
|
36
|
-
* `manage_apps` on the app reads every session and may filter by `userId`.
|
|
36
|
+
* `manage_apps` on the app reads every session and may filter by `userId`. A moderator
|
|
37
|
+
* (`moderate_safety`, ck-api v2.60.0) reads with {@link messages} only the sessions an open or
|
|
38
|
+
* escalated safety report covers (`client.moderation.reports(appId)`, each report's
|
|
39
|
+
* `sessions`), and every read of another player's session is audited.
|
|
37
40
|
*
|
|
38
41
|
* Inputs are kept for the input log's published retention (crowdedkingdoms.com/pricing,
|
|
39
42
|
* up to about an hour longer) and then deleted, so an old session can still be listed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputLog.d.ts","sourceRoot":"","sources":["../../src/domains/inputLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAEjC,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;AAC5E,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AACjF,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;AAC5E,sEAAsE;AACtE,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF,4FAA4F;AAC5F,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED
|
|
1
|
+
{"version":3,"file":"inputLog.d.ts","sourceRoot":"","sources":["../../src/domains/inputLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAEjC,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;AAC5E,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AACjF,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;AAC5E,sEAAsE;AACtE,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF,4FAA4F;AAC5F,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEtC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,QAAQ,CACZ,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,mBAAmB,CAAC,qBAAqB,CAAM,GACpD,OAAO,CAAC,mBAAmB,CAAC;IAS/B;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,QAAQ,CACZ,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,mBAAmB,CAAC,qBAAqB,CAAM,GACpD,OAAO,CAAC,mBAAmB,CAAC;CAQhC"}
|
package/dist/domains/inputLog.js
CHANGED
|
@@ -9,7 +9,10 @@ import { InputLogMessagesDocument, InputLogSessionsDocument, } from '../generate
|
|
|
9
9
|
* the app to its datacenter like any gameplay call.
|
|
10
10
|
*
|
|
11
11
|
* **Who sees what.** A player reads only the sessions and inputs they sent. A holder of
|
|
12
|
-
* `manage_apps` on the app reads every session and may filter by `userId`.
|
|
12
|
+
* `manage_apps` on the app reads every session and may filter by `userId`. A moderator
|
|
13
|
+
* (`moderate_safety`, ck-api v2.60.0) reads with {@link messages} only the sessions an open or
|
|
14
|
+
* escalated safety report covers (`client.moderation.reports(appId)`, each report's
|
|
15
|
+
* `sessions`), and every read of another player's session is audited.
|
|
13
16
|
*
|
|
14
17
|
* Inputs are kept for the input log's published retention (crowdedkingdoms.com/pricing,
|
|
15
18
|
* up to about an hour longer) and then deleted, so an old session can still be listed
|