epicenter-libs 3.11.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.
- package/CHANGELOG.md +345 -0
- package/LICENSE.md +37 -0
- package/README.md +134 -0
- package/dist/browser/AckExtension-e67c6a28.js +129 -0
- package/dist/browser/AckExtension-e67c6a28.js.map +1 -0
- package/dist/browser/ReloadExtension-b1e50033.js +253 -0
- package/dist/browser/ReloadExtension-b1e50033.js.map +1 -0
- package/dist/browser/cometd-eeabdcd4.js +3438 -0
- package/dist/browser/cometd-eeabdcd4.js.map +1 -0
- package/dist/browser/epicenter-2cce2971.js +6086 -0
- package/dist/browser/epicenter-2cce2971.js.map +1 -0
- package/dist/browser/epicenter.js +2 -0
- package/dist/browser/epicenter.js.map +1 -0
- package/dist/cjs/AckExtension-f5178e19.js +131 -0
- package/dist/cjs/AckExtension-f5178e19.js.map +1 -0
- package/dist/cjs/ReloadExtension-65b036ba.js +255 -0
- package/dist/cjs/ReloadExtension-65b036ba.js.map +1 -0
- package/dist/cjs/cometd-473408f4.js +3441 -0
- package/dist/cjs/cometd-473408f4.js.map +1 -0
- package/dist/cjs/epicenter-12ceb814.js +7248 -0
- package/dist/cjs/epicenter-12ceb814.js.map +1 -0
- package/dist/cjs/epicenter.js +54 -0
- package/dist/cjs/epicenter.js.map +1 -0
- package/dist/epicenter.js +9895 -0
- package/dist/epicenter.js.map +1 -0
- package/dist/epicenter.min.js +2 -0
- package/dist/epicenter.min.js.map +1 -0
- package/dist/module/AckExtension-6181d8b5.js +129 -0
- package/dist/module/AckExtension-6181d8b5.js.map +1 -0
- package/dist/module/ReloadExtension-eaa8c42c.js +253 -0
- package/dist/module/ReloadExtension-eaa8c42c.js.map +1 -0
- package/dist/module/cometd-af78008d.js +3438 -0
- package/dist/module/cometd-af78008d.js.map +1 -0
- package/dist/module/epicenter-9b8c92a9.js +7213 -0
- package/dist/module/epicenter-9b8c92a9.js.map +1 -0
- package/dist/module/epicenter.js +7 -0
- package/dist/module/epicenter.js.map +1 -0
- package/dist/types/adapters/account.d.ts +44 -0
- package/dist/types/adapters/admin.d.ts +33 -0
- package/dist/types/adapters/asset.d.ts +46 -0
- package/dist/types/adapters/authentication.d.ts +62 -0
- package/dist/types/adapters/channel.d.ts +39 -0
- package/dist/types/adapters/chat.d.ts +105 -0
- package/dist/types/adapters/cometd.d.ts +25 -0
- package/dist/types/adapters/email.d.ts +86 -0
- package/dist/types/adapters/episode.d.ts +91 -0
- package/dist/types/adapters/group.d.ts +273 -0
- package/dist/types/adapters/index.d.ts +21 -0
- package/dist/types/adapters/leaderboard.d.ts +68 -0
- package/dist/types/adapters/presence.d.ts +35 -0
- package/dist/types/adapters/project.d.ts +99 -0
- package/dist/types/adapters/recaptcha.d.ts +1 -0
- package/dist/types/adapters/run.d.ts +253 -0
- package/dist/types/adapters/task.d.ts +154 -0
- package/dist/types/adapters/time.d.ts +2 -0
- package/dist/types/adapters/user.d.ts +38 -0
- package/dist/types/adapters/vault.d.ts +94 -0
- package/dist/types/adapters/world.d.ts +230 -0
- package/dist/types/epicenter.d.ts +10 -0
- package/dist/types/utils/config.d.ts +90 -0
- package/dist/types/utils/constants.d.ts +290 -0
- package/dist/types/utils/cookies.d.ts +16 -0
- package/dist/types/utils/error-manager.d.ts +21 -0
- package/dist/types/utils/error.d.ts +4 -0
- package/dist/types/utils/fault.d.ts +17 -0
- package/dist/types/utils/helpers.d.ts +4 -0
- package/dist/types/utils/identification.d.ts +47 -0
- package/dist/types/utils/index.d.ts +11 -0
- package/dist/types/utils/result.d.ts +6 -0
- package/dist/types/utils/router.d.ts +157 -0
- package/dist/types/utils/store.d.ts +31 -0
- package/package.json +103 -0
- package/src/adapters/account.ts +104 -0
- package/src/adapters/admin.ts +53 -0
- package/src/adapters/asset.ts +195 -0
- package/src/adapters/authentication.ts +173 -0
- package/src/adapters/channel.ts +83 -0
- package/src/adapters/chat.ts +186 -0
- package/src/adapters/cometd.ts +297 -0
- package/src/adapters/email.ts +146 -0
- package/src/adapters/episode.ts +163 -0
- package/src/adapters/group.ts +511 -0
- package/src/adapters/index.ts +43 -0
- package/src/adapters/leaderboard.ts +122 -0
- package/src/adapters/presence.ts +63 -0
- package/src/adapters/project.ts +123 -0
- package/src/adapters/recaptcha.ts +11 -0
- package/src/adapters/run.ts +726 -0
- package/src/adapters/task.ts +213 -0
- package/src/adapters/time.ts +36 -0
- package/src/adapters/user.ts +75 -0
- package/src/adapters/vault.ts +232 -0
- package/src/adapters/world.ts +412 -0
- package/src/epicenter.ts +96 -0
- package/src/globals.d.ts +16 -0
- package/src/utils/config.ts +168 -0
- package/src/utils/constants.ts +324 -0
- package/src/utils/cookies.ts +71 -0
- package/src/utils/error-manager.ts +66 -0
- package/src/utils/error.ts +9 -0
- package/src/utils/fault.ts +39 -0
- package/src/utils/helpers.ts +7 -0
- package/src/utils/identification.ts +128 -0
- package/src/utils/index.ts +11 -0
- package/src/utils/result.ts +15 -0
- package/src/utils/router.ts +547 -0
- package/src/utils/store.ts +82 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { RoutingOptions } from '../utils/router';
|
|
2
|
+
import type { User } from './user';
|
|
3
|
+
|
|
4
|
+
import Router from '../utils/router';
|
|
5
|
+
import cometdAdapter from './cometd';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface Presence {
|
|
9
|
+
lastUpdated: number,
|
|
10
|
+
ttlSeconds: number,
|
|
11
|
+
groupRole: 'FACILITATOR' | 'REVIEWER' | 'LEADER' | 'PARTICIPANT',
|
|
12
|
+
user: User,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Makes a connection request to the cometd server; effectively marking the user as online. This isn't required to be called in order to be considered online. Subscribe to a CometD channel will do the same as well. This is just a convenience method for when you don't need to utilize the channels expect specifically for presence.
|
|
18
|
+
* Using [logout](#authAdapter-logout) will automatically disconnect for you.
|
|
19
|
+
* @example
|
|
20
|
+
* epicenter.presenceAdapter.connect()
|
|
21
|
+
* @returns promise indicating whether or not the connection was successful
|
|
22
|
+
*/
|
|
23
|
+
export async function connect(): Promise<void> {
|
|
24
|
+
await cometdAdapter.handshake();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves the presence information for a particular group
|
|
31
|
+
* @example
|
|
32
|
+
* epicenter.presenceAdapter.forGroup('0000017dd3bf540e5ada5b1e058f08f20461');
|
|
33
|
+
* @param groupKey Key associated with group
|
|
34
|
+
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
35
|
+
* @returns promise that resolves to a list of users online
|
|
36
|
+
*/
|
|
37
|
+
export async function forGroup(
|
|
38
|
+
groupKey: string,
|
|
39
|
+
optionals: RoutingOptions = {}
|
|
40
|
+
): Promise<Presence[]> {
|
|
41
|
+
return await new Router()
|
|
42
|
+
.get(`/presence/group/${groupKey}`, optionals)
|
|
43
|
+
.then(({ body }) => body);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the presence information for a particular world
|
|
49
|
+
* @example
|
|
50
|
+
* epicenter.presenceAdapter.forWorld('0000017a445032dc38cb2cecd5fc13708314')
|
|
51
|
+
* @param worldKey Key associated with world
|
|
52
|
+
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
53
|
+
* @returns promise that resolves to a list of users online
|
|
54
|
+
*/
|
|
55
|
+
export async function forWorld(
|
|
56
|
+
worldKey: string,
|
|
57
|
+
optionals: RoutingOptions = {},
|
|
58
|
+
): Promise<Presence[]> {
|
|
59
|
+
return await new Router()
|
|
60
|
+
.get(`/presence/world/${worldKey}`, optionals)
|
|
61
|
+
.then(({ body }) => body);
|
|
62
|
+
}
|
|
63
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { RoutingOptions } from '../utils/router';
|
|
2
|
+
import { ROLE, Router } from '../utils';
|
|
3
|
+
|
|
4
|
+
enum ACCESS_TYPE {
|
|
5
|
+
PUBLIC = 'PUBLIC',
|
|
6
|
+
PRIVATE = 'PRIVATE',
|
|
7
|
+
AUTHENTICATED = 'AUTHENTICATED',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
enum WORKER_PARTITION {
|
|
11
|
+
NONE = 'NONE',
|
|
12
|
+
ALL = 'ALL',
|
|
13
|
+
FREE = 'FREE',
|
|
14
|
+
LICENSED = 'LICENSED',
|
|
15
|
+
ACCOUNT = 'ACCOUNT',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
enum PHYLOGENY {
|
|
19
|
+
ORIGINAL = 'ORIGINAL',
|
|
20
|
+
HISTORICAL = 'HISTORICAL',
|
|
21
|
+
REFERENTIAL = 'REFERENTIAL',
|
|
22
|
+
ORDERED = 'ORDERED',
|
|
23
|
+
EVENTUAL = 'EVENTUAL',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
enum FILE_TYPE {
|
|
27
|
+
INSENSITIVE = 'INSENSITIVE',
|
|
28
|
+
SENSITIVE = 'SENSITIVE',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface Member {
|
|
32
|
+
role: ROLE.AUTHOR,
|
|
33
|
+
adminKey: string,
|
|
34
|
+
objectType: 'project',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface Deployment {
|
|
38
|
+
defaultGroupName: string,
|
|
39
|
+
autoCreatePlayer: boolean,
|
|
40
|
+
loginFile: string,
|
|
41
|
+
welcomeFile: string,
|
|
42
|
+
groupFile: string,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface TeamProject {
|
|
46
|
+
concurrentRunLimit: number,
|
|
47
|
+
modelFile: string,
|
|
48
|
+
available: boolean,
|
|
49
|
+
allowWorldSelfAssign: boolean,
|
|
50
|
+
legacySettings: {
|
|
51
|
+
blockDirectApiCalls: boolean,
|
|
52
|
+
channelAuthorizationRequired: boolean,
|
|
53
|
+
filePermissionsActive: boolean,
|
|
54
|
+
showEmail: boolean,
|
|
55
|
+
transmogrifierActive: boolean,
|
|
56
|
+
dataApiAllowAnonymousAccess: boolean,
|
|
57
|
+
channelVersion: number,
|
|
58
|
+
authorizationMode: 'LEGACY' | 'USER',
|
|
59
|
+
dataApiEnforceScope: boolean,
|
|
60
|
+
},
|
|
61
|
+
objectType: 'team',
|
|
62
|
+
accessType: keyof typeof ACCESS_TYPE,
|
|
63
|
+
sessionTimeoutSeconds: number,
|
|
64
|
+
projectKey: string,
|
|
65
|
+
members: Member[],
|
|
66
|
+
channelEnabled: boolean,
|
|
67
|
+
workerPartition: keyof typeof WORKER_PARTITION,
|
|
68
|
+
name: string,
|
|
69
|
+
phylogeny: keyof typeof PHYLOGENY,
|
|
70
|
+
multiPlayerEnabled: boolean,
|
|
71
|
+
shortName: string,
|
|
72
|
+
approximateRunCount: number,
|
|
73
|
+
pricing: {
|
|
74
|
+
amount: number,
|
|
75
|
+
},
|
|
76
|
+
dataRetentionDays: number,
|
|
77
|
+
fileType: keyof typeof FILE_TYPE,
|
|
78
|
+
dimensions: 'UNIVERSE' | 'MULTIVERSE',
|
|
79
|
+
deployment: Deployment,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface PersonalProject {
|
|
83
|
+
concurrentRunLimit: number,
|
|
84
|
+
available: boolean,
|
|
85
|
+
objectType: 'personal',
|
|
86
|
+
accessType: keyof typeof ACCESS_TYPE,
|
|
87
|
+
sessionTimeoutSeconds: number,
|
|
88
|
+
projectKey: string,
|
|
89
|
+
workerPartition: keyof typeof WORKER_PARTITION,
|
|
90
|
+
name: string,
|
|
91
|
+
phylogeny: keyof typeof PHYLOGENY,
|
|
92
|
+
shortName: string,
|
|
93
|
+
approximateRunCount: number,
|
|
94
|
+
fileType: keyof typeof FILE_TYPE,
|
|
95
|
+
deployment: Deployment,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
type Project =
|
|
99
|
+
| TeamProject
|
|
100
|
+
| PersonalProject;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Checks to see if the project currently has the push channels enabled
|
|
104
|
+
* @example
|
|
105
|
+
* epicenter.projectAdapter.channelsEnabled();
|
|
106
|
+
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
107
|
+
* @returns promise resolving true/false whether or not the project supports the use of push channels
|
|
108
|
+
*/
|
|
109
|
+
export async function channelsEnabled(
|
|
110
|
+
optionals: RoutingOptions = {}
|
|
111
|
+
): Promise<boolean> {
|
|
112
|
+
return await new Router()
|
|
113
|
+
.get('/project/channel/isEnabled', optionals)
|
|
114
|
+
.then(({ body }) => body);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export async function get(
|
|
118
|
+
optionals: RoutingOptions = {}
|
|
119
|
+
): Promise<Project> {
|
|
120
|
+
return await new Router()
|
|
121
|
+
.get('/project', optionals)
|
|
122
|
+
.then(({ body }) => body);
|
|
123
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {Router} from 'utils/index';
|
|
2
|
+
|
|
3
|
+
export async function google(humanKey: string) {
|
|
4
|
+
return await new Router()
|
|
5
|
+
.withAccountShortName('epicenter')
|
|
6
|
+
.withProjectShortName('manager')
|
|
7
|
+
.post('/recaptcha/google', {
|
|
8
|
+
body: {humanKey: humanKey},
|
|
9
|
+
})
|
|
10
|
+
.then(({body}) => body);
|
|
11
|
+
}
|