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.
Files changed (107) hide show
  1. package/CHANGELOG.md +345 -0
  2. package/LICENSE.md +37 -0
  3. package/README.md +134 -0
  4. package/dist/browser/AckExtension-e67c6a28.js +129 -0
  5. package/dist/browser/AckExtension-e67c6a28.js.map +1 -0
  6. package/dist/browser/ReloadExtension-b1e50033.js +253 -0
  7. package/dist/browser/ReloadExtension-b1e50033.js.map +1 -0
  8. package/dist/browser/cometd-eeabdcd4.js +3438 -0
  9. package/dist/browser/cometd-eeabdcd4.js.map +1 -0
  10. package/dist/browser/epicenter-2cce2971.js +6086 -0
  11. package/dist/browser/epicenter-2cce2971.js.map +1 -0
  12. package/dist/browser/epicenter.js +2 -0
  13. package/dist/browser/epicenter.js.map +1 -0
  14. package/dist/cjs/AckExtension-f5178e19.js +131 -0
  15. package/dist/cjs/AckExtension-f5178e19.js.map +1 -0
  16. package/dist/cjs/ReloadExtension-65b036ba.js +255 -0
  17. package/dist/cjs/ReloadExtension-65b036ba.js.map +1 -0
  18. package/dist/cjs/cometd-473408f4.js +3441 -0
  19. package/dist/cjs/cometd-473408f4.js.map +1 -0
  20. package/dist/cjs/epicenter-12ceb814.js +7248 -0
  21. package/dist/cjs/epicenter-12ceb814.js.map +1 -0
  22. package/dist/cjs/epicenter.js +54 -0
  23. package/dist/cjs/epicenter.js.map +1 -0
  24. package/dist/epicenter.js +9895 -0
  25. package/dist/epicenter.js.map +1 -0
  26. package/dist/epicenter.min.js +2 -0
  27. package/dist/epicenter.min.js.map +1 -0
  28. package/dist/module/AckExtension-6181d8b5.js +129 -0
  29. package/dist/module/AckExtension-6181d8b5.js.map +1 -0
  30. package/dist/module/ReloadExtension-eaa8c42c.js +253 -0
  31. package/dist/module/ReloadExtension-eaa8c42c.js.map +1 -0
  32. package/dist/module/cometd-af78008d.js +3438 -0
  33. package/dist/module/cometd-af78008d.js.map +1 -0
  34. package/dist/module/epicenter-9b8c92a9.js +7213 -0
  35. package/dist/module/epicenter-9b8c92a9.js.map +1 -0
  36. package/dist/module/epicenter.js +7 -0
  37. package/dist/module/epicenter.js.map +1 -0
  38. package/dist/types/adapters/account.d.ts +44 -0
  39. package/dist/types/adapters/admin.d.ts +33 -0
  40. package/dist/types/adapters/asset.d.ts +46 -0
  41. package/dist/types/adapters/authentication.d.ts +62 -0
  42. package/dist/types/adapters/channel.d.ts +39 -0
  43. package/dist/types/adapters/chat.d.ts +105 -0
  44. package/dist/types/adapters/cometd.d.ts +25 -0
  45. package/dist/types/adapters/email.d.ts +86 -0
  46. package/dist/types/adapters/episode.d.ts +91 -0
  47. package/dist/types/adapters/group.d.ts +273 -0
  48. package/dist/types/adapters/index.d.ts +21 -0
  49. package/dist/types/adapters/leaderboard.d.ts +68 -0
  50. package/dist/types/adapters/presence.d.ts +35 -0
  51. package/dist/types/adapters/project.d.ts +99 -0
  52. package/dist/types/adapters/recaptcha.d.ts +1 -0
  53. package/dist/types/adapters/run.d.ts +253 -0
  54. package/dist/types/adapters/task.d.ts +154 -0
  55. package/dist/types/adapters/time.d.ts +2 -0
  56. package/dist/types/adapters/user.d.ts +38 -0
  57. package/dist/types/adapters/vault.d.ts +94 -0
  58. package/dist/types/adapters/world.d.ts +230 -0
  59. package/dist/types/epicenter.d.ts +10 -0
  60. package/dist/types/utils/config.d.ts +90 -0
  61. package/dist/types/utils/constants.d.ts +290 -0
  62. package/dist/types/utils/cookies.d.ts +16 -0
  63. package/dist/types/utils/error-manager.d.ts +21 -0
  64. package/dist/types/utils/error.d.ts +4 -0
  65. package/dist/types/utils/fault.d.ts +17 -0
  66. package/dist/types/utils/helpers.d.ts +4 -0
  67. package/dist/types/utils/identification.d.ts +47 -0
  68. package/dist/types/utils/index.d.ts +11 -0
  69. package/dist/types/utils/result.d.ts +6 -0
  70. package/dist/types/utils/router.d.ts +157 -0
  71. package/dist/types/utils/store.d.ts +31 -0
  72. package/package.json +103 -0
  73. package/src/adapters/account.ts +104 -0
  74. package/src/adapters/admin.ts +53 -0
  75. package/src/adapters/asset.ts +195 -0
  76. package/src/adapters/authentication.ts +173 -0
  77. package/src/adapters/channel.ts +83 -0
  78. package/src/adapters/chat.ts +186 -0
  79. package/src/adapters/cometd.ts +297 -0
  80. package/src/adapters/email.ts +146 -0
  81. package/src/adapters/episode.ts +163 -0
  82. package/src/adapters/group.ts +511 -0
  83. package/src/adapters/index.ts +43 -0
  84. package/src/adapters/leaderboard.ts +122 -0
  85. package/src/adapters/presence.ts +63 -0
  86. package/src/adapters/project.ts +123 -0
  87. package/src/adapters/recaptcha.ts +11 -0
  88. package/src/adapters/run.ts +726 -0
  89. package/src/adapters/task.ts +213 -0
  90. package/src/adapters/time.ts +36 -0
  91. package/src/adapters/user.ts +75 -0
  92. package/src/adapters/vault.ts +232 -0
  93. package/src/adapters/world.ts +412 -0
  94. package/src/epicenter.ts +96 -0
  95. package/src/globals.d.ts +16 -0
  96. package/src/utils/config.ts +168 -0
  97. package/src/utils/constants.ts +324 -0
  98. package/src/utils/cookies.ts +71 -0
  99. package/src/utils/error-manager.ts +66 -0
  100. package/src/utils/error.ts +9 -0
  101. package/src/utils/fault.ts +39 -0
  102. package/src/utils/helpers.ts +7 -0
  103. package/src/utils/identification.ts +128 -0
  104. package/src/utils/index.ts +11 -0
  105. package/src/utils/result.ts +15 -0
  106. package/src/utils/router.ts +547 -0
  107. 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
+ }