epicenter-libs 3.33.0 → 3.34.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/CHANGELOG.md +17 -0
- package/dist/browser/epicenter.js +105 -2
- package/dist/browser/epicenter.js.map +1 -1
- package/dist/cjs/epicenter.js +105 -2
- package/dist/cjs/epicenter.js.map +1 -1
- package/dist/epicenter.js +105 -2
- package/dist/epicenter.js.map +1 -1
- package/dist/epicenter.min.js +1 -1
- package/dist/epicenter.min.js.map +1 -1
- package/dist/module/epicenter.js +105 -2
- package/dist/module/epicenter.js.map +1 -1
- package/dist/types/adapters/chat.d.ts +63 -0
- package/package.json +1 -1
- package/src/adapters/chat.ts +95 -0
- package/src/utils/identification.ts +4 -0
- package/dist/test/_virtual/runtime.js +0 -3
- package/dist/test/_virtual/runtime2.js +0 -3
- package/dist/test/adapters/account.js +0 -169
- package/dist/test/adapters/admin.js +0 -53
- package/dist/test/adapters/asset.js +0 -425
- package/dist/test/adapters/authentication.js +0 -349
- package/dist/test/adapters/channel.js +0 -201
- package/dist/test/adapters/chat.js +0 -199
- package/dist/test/adapters/cometd.js +0 -514
- package/dist/test/adapters/consensus.js +0 -484
- package/dist/test/adapters/daily.js +0 -244
- package/dist/test/adapters/email.js +0 -179
- package/dist/test/adapters/episode.js +0 -175
- package/dist/test/adapters/group.js +0 -655
- package/dist/test/adapters/leaderboard.js +0 -162
- package/dist/test/adapters/matchmaker.js +0 -159
- package/dist/test/adapters/presence.js +0 -85
- package/dist/test/adapters/project.js +0 -94
- package/dist/test/adapters/recaptcha.js +0 -24
- package/dist/test/adapters/run.js +0 -1008
- package/dist/test/adapters/somebody.js +0 -154
- package/dist/test/adapters/task.js +0 -192
- package/dist/test/adapters/time.js +0 -28
- package/dist/test/adapters/user.js +0 -105
- package/dist/test/adapters/vault.js +0 -403
- package/dist/test/adapters/video.js +0 -249
- package/dist/test/adapters/vonage.js +0 -130
- package/dist/test/adapters/wallet.js +0 -130
- package/dist/test/adapters/world.js +0 -507
- package/dist/test/apis/video.js +0 -294
- package/dist/test/apis/vonage.js +0 -121
- package/dist/test/epicenter.js +0 -121
- package/dist/test/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -12
- package/dist/test/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -14
- package/dist/test/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -9
- package/dist/test/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -11
- package/dist/test/node_modules/cometd/AckExtension.js +0 -91
- package/dist/test/node_modules/cometd/CallbackPollingTransport.js +0 -148
- package/dist/test/node_modules/cometd/Client.js +0 -2160
- package/dist/test/node_modules/cometd/Extension.js +0 -47
- package/dist/test/node_modules/cometd/LongPollingTransport.js +0 -135
- package/dist/test/node_modules/cometd/ReloadExtension.js +0 -214
- package/dist/test/node_modules/cometd/RequestTransport.js +0 -252
- package/dist/test/node_modules/cometd/Transport.js +0 -167
- package/dist/test/node_modules/cometd/TransportRegistry.js +0 -107
- package/dist/test/node_modules/cometd/WebSocketTransport.js +0 -384
- package/dist/test/node_modules/cometd/cometd.js +0 -9
- package/dist/test/node_modules/regenerator-runtime/runtime.js +0 -773
- package/dist/test/utilities.js +0 -17
- package/dist/test/utils/config.js +0 -189
- package/dist/test/utils/constants.js +0 -293
- package/dist/test/utils/cookies.js +0 -75
- package/dist/test/utils/error-manager.js +0 -57
- package/dist/test/utils/error.js +0 -12
- package/dist/test/utils/fault.js +0 -34
- package/dist/test/utils/filter-parser.js +0 -68
- package/dist/test/utils/helpers.js +0 -9
- package/dist/test/utils/identification.js +0 -161
- package/dist/test/utils/result.js +0 -20
- package/dist/test/utils/router.js +0 -551
- package/dist/test/utils/store.js +0 -79
package/dist/test/apis/video.js
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import Router from '../utils/router.js';
|
|
2
|
-
|
|
3
|
-
const AFFILIATE = {
|
|
4
|
-
VONAGE: 'VONAGE',
|
|
5
|
-
DAILY: 'DAILY',
|
|
6
|
-
DOMESTIC: 'DOMESTIC'
|
|
7
|
-
};
|
|
8
|
-
const MEDIA_FORMAT = {
|
|
9
|
-
mp3: 'mp3',
|
|
10
|
-
mp4: 'mp4',
|
|
11
|
-
wav: 'wav',
|
|
12
|
-
flac: 'flac',
|
|
13
|
-
ogg: 'ogg',
|
|
14
|
-
amr: 'amr',
|
|
15
|
-
webm: 'webm'
|
|
16
|
-
};
|
|
17
|
-
const LANGUAGE_CODE = {
|
|
18
|
-
'af-ZA': 'af-ZA',
|
|
19
|
-
'ar-AE': 'ar-AE',
|
|
20
|
-
'ar-SA': 'ar-SA',
|
|
21
|
-
'cy-GB': 'cy-GB',
|
|
22
|
-
'da-DK': 'da-DK',
|
|
23
|
-
'de-CH': 'de-CH',
|
|
24
|
-
'de-DE': 'de-DE',
|
|
25
|
-
'en-AB': 'en-AB',
|
|
26
|
-
'en-AU': 'en-AU',
|
|
27
|
-
'en-GB': 'en-GB',
|
|
28
|
-
'en-IE': 'en-IE',
|
|
29
|
-
'en-IN': 'en-IN',
|
|
30
|
-
'en-US': 'en-US',
|
|
31
|
-
'en-WL': 'en-WL',
|
|
32
|
-
'es-ES': 'es-ES',
|
|
33
|
-
'es-US': 'es-US',
|
|
34
|
-
'fa-IR': 'fa-IR',
|
|
35
|
-
'fr-CA': 'fr-CA',
|
|
36
|
-
'fr-FR': 'fr-FR',
|
|
37
|
-
'ga-IE': 'ga-IE',
|
|
38
|
-
'gd-GB': 'gd-GB',
|
|
39
|
-
'he-IL': 'he-IL',
|
|
40
|
-
'hi-IN': 'hi-IN',
|
|
41
|
-
'id-ID': 'id-ID',
|
|
42
|
-
'it-IT': 'it-IT',
|
|
43
|
-
'ja-JP': 'ja-JP',
|
|
44
|
-
'ko-KR': 'ko-KR',
|
|
45
|
-
'nl-NL': 'nl-NL',
|
|
46
|
-
'pt-BR': 'pt-BR',
|
|
47
|
-
'pt-PT': 'pt-PT',
|
|
48
|
-
'ru-RU': 'ru-RU',
|
|
49
|
-
'ta-IN': 'ta-IN',
|
|
50
|
-
'te-IN': 'te-IN',
|
|
51
|
-
'tr-TR': 'tr-TR',
|
|
52
|
-
'zh-CN': 'zh-CN',
|
|
53
|
-
'zh-TW': 'zh-TW',
|
|
54
|
-
'th-TH': 'th-TH',
|
|
55
|
-
'en-ZA': 'en-ZA',
|
|
56
|
-
'en-NZ': 'en-NZ'
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Represents a video directory.
|
|
61
|
-
* @deprecated Use VideoReadOutView instead. VideoDir is an alias for backward compatibility.
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Retrieves a video URL by video key and file name
|
|
66
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/url/{VIDEO_KEY}/{FILE}`
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* import { videoAPI } from 'epicenter-libs';
|
|
70
|
-
* const url = await videoAPI.getVideoURLByKey('recording.mp4', 'video-key-123');
|
|
71
|
-
*
|
|
72
|
-
* @param file Name of the file to retrieve
|
|
73
|
-
* @param videoKey Video key identifier
|
|
74
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
75
|
-
* @returns promise that resolves to the video URL
|
|
76
|
-
*/
|
|
77
|
-
async function getVideoURLByKey(file, videoKey, optionals = {}) {
|
|
78
|
-
return await new Router().get(`/video/url/${videoKey}/${file}`, optionals).then(({
|
|
79
|
-
body
|
|
80
|
-
}) => body);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Retrieves a video URL by scope, affiliate, family, and file name
|
|
85
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/url/with/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{AFFILIATE}/{FAMILY}/{FILE}` or GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/url/with/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{USER_KEY}/{AFFILIATE}/{FAMILY}/{FILE}`
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* import { videoAPI } from 'epicenter-libs';
|
|
89
|
-
* const url = await videoAPI.getVideoURLWith(
|
|
90
|
-
* 'recording.mp4',
|
|
91
|
-
* 'my-family',
|
|
92
|
-
* 'DAILY',
|
|
93
|
-
* { scopeBoundary: 'group', scopeKey: 'group-123' },
|
|
94
|
-
* );
|
|
95
|
-
*
|
|
96
|
-
* @param file Name of the file to retrieve
|
|
97
|
-
* @param family Family identifier for the video
|
|
98
|
-
* @param affiliate Video service affiliate (VONAGE, DAILY, or DOMESTIC)
|
|
99
|
-
* @param scope Scope associated with the video
|
|
100
|
-
* @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
|
|
101
|
-
* @param scope.scopeKey Scope key, a unique identifier tied to the scope
|
|
102
|
-
* @param [scope.userKey] Optional key to scope the video to a user
|
|
103
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
104
|
-
* @returns promise that resolves to the video URL
|
|
105
|
-
*/
|
|
106
|
-
async function getVideoURLWith(file, family, affiliate, scope, optionals = {}) {
|
|
107
|
-
const {
|
|
108
|
-
scopeBoundary,
|
|
109
|
-
scopeKey,
|
|
110
|
-
userKey
|
|
111
|
-
} = scope;
|
|
112
|
-
const userKeyURIComponent = userKey ? `/${userKey}` : '';
|
|
113
|
-
return await new Router().get(`/video/url/with/${scopeBoundary}/${scopeKey}${userKeyURIComponent}/${affiliate}/${family}/${file}`, optionals).then(({
|
|
114
|
-
body
|
|
115
|
-
}) => body);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Retrieves a video directory by video key
|
|
120
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/dir/{VIDEO_KEY}`
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* import { videoAPI } from 'epicenter-libs';
|
|
124
|
-
* const dir = await videoAPI.getVideoDirectoryByKey('video-key-123');
|
|
125
|
-
*
|
|
126
|
-
* @param videoKey Video key identifier
|
|
127
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
128
|
-
* @returns promise that resolves to the video directory information
|
|
129
|
-
*/
|
|
130
|
-
async function getVideoDirectoryByKey(videoKey, optionals = {}) {
|
|
131
|
-
return await new Router().get(`/video/dir/${videoKey}`, optionals).then(({
|
|
132
|
-
body
|
|
133
|
-
}) => body);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Retrieves a video directory by scope, affiliate, and family
|
|
138
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/dir/with/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{AFFILIATE}/{FAMILY}` or GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/dir/with/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{USER_KEY}/{AFFILIATE}/{FAMILY}`
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* import { videoAPI } from 'epicenter-libs';
|
|
142
|
-
* const dir = await videoAPI.getVideoDirectoryWith(
|
|
143
|
-
* 'my-family',
|
|
144
|
-
* 'DAILY',
|
|
145
|
-
* { scopeBoundary: 'group', scopeKey: 'group-123' },
|
|
146
|
-
* );
|
|
147
|
-
*
|
|
148
|
-
* @param family Family identifier for the video
|
|
149
|
-
* @param affiliate Video service affiliate (VONAGE, DAILY, or DOMESTIC)
|
|
150
|
-
* @param scope Scope associated with the video
|
|
151
|
-
* @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
|
|
152
|
-
* @param scope.scopeKey Scope key, a unique identifier tied to the scope
|
|
153
|
-
* @param [scope.userKey] Optional key to scope the video to a user
|
|
154
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
155
|
-
* @returns promise that resolves to the video directory information
|
|
156
|
-
*/
|
|
157
|
-
async function getVideoDirectoryWith(family, affiliate, scope, optionals = {}) {
|
|
158
|
-
const {
|
|
159
|
-
scopeBoundary,
|
|
160
|
-
scopeKey,
|
|
161
|
-
userKey
|
|
162
|
-
} = scope;
|
|
163
|
-
const userKeyURIComponent = userKey ? `/${userKey}` : '';
|
|
164
|
-
return await new Router().get(`/video/dir/with/${scopeBoundary}/${scopeKey}${userKeyURIComponent}/${affiliate}/${family}`, optionals).then(({
|
|
165
|
-
body
|
|
166
|
-
}) => body);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Searches for videos
|
|
171
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/search`
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* import { videoAPI } from 'epicenter-libs';
|
|
175
|
-
* const videos = await videoAPI.getVideoSearch();
|
|
176
|
-
*
|
|
177
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
178
|
-
* @returns promise that resolves to a page of videos
|
|
179
|
-
*/
|
|
180
|
-
async function getVideoSearch(optionals = {}) {
|
|
181
|
-
return await new Router().get('/video/search', optionals).then(({
|
|
182
|
-
body
|
|
183
|
-
}) => body);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Deletes a video by video key
|
|
188
|
-
* Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/{VIDEO_KEY}`
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* import { videoAPI } from 'epicenter-libs';
|
|
192
|
-
* await videoAPI.deleteVideoByKey('video-key-123');
|
|
193
|
-
*
|
|
194
|
-
* @param videoKey Video key identifier
|
|
195
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
196
|
-
* @returns promise that resolves when the video is deleted
|
|
197
|
-
*/
|
|
198
|
-
async function deleteVideoByKey(videoKey, optionals = {}) {
|
|
199
|
-
return await new Router().delete(`/video/${videoKey}`, optionals).then(({
|
|
200
|
-
body
|
|
201
|
-
}) => body);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Processes a video with specified processors (e.g., transcription)
|
|
206
|
-
* Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/execute/{VIDEO_KEY}`
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* import { videoAPI } from 'epicenter-libs';
|
|
210
|
-
* await videoAPI.postVideoProcessor('video-key-123', {
|
|
211
|
-
* processors: [{
|
|
212
|
-
* mediaFormat: 'mp4',
|
|
213
|
-
* languageCode: 'en-US',
|
|
214
|
-
* objectType: 'transcription',
|
|
215
|
-
* }],
|
|
216
|
-
* });
|
|
217
|
-
*
|
|
218
|
-
* @param videoKey Video key identifier
|
|
219
|
-
* @param body Processing configuration
|
|
220
|
-
* @param body.processors Array of processor configurations
|
|
221
|
-
* @param [body.processors[].jobName] Optional name for the processing job
|
|
222
|
-
* @param body.processors[].mediaFormat Media format (mp3, mp4, wav, etc.)
|
|
223
|
-
* @param body.processors[].languageCode Language code for processing (e.g., 'en-US')
|
|
224
|
-
* @param [body.processors[].timeoutMinutes] Optional timeout in minutes
|
|
225
|
-
* @param [body.processors[].mediaFile] Optional specific media file to process
|
|
226
|
-
* @param body.processors[].objectType Processing type (currently 'transcription')
|
|
227
|
-
* @param [body.log] Optional log information
|
|
228
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
229
|
-
* @returns promise that resolves to true if processing started successfully
|
|
230
|
-
*/
|
|
231
|
-
async function postVideoProcessor(videoKey, body, optionals = {}) {
|
|
232
|
-
return await new Router().post(`/video/execute/${videoKey}`, {
|
|
233
|
-
body,
|
|
234
|
-
...optionals
|
|
235
|
-
}).then(({
|
|
236
|
-
body
|
|
237
|
-
}) => body);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Downloads a video file by video key and file name
|
|
242
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/download/{VIDEO_KEY}/{FILE}`
|
|
243
|
-
*
|
|
244
|
-
* @example
|
|
245
|
-
* import { videoAPI } from 'epicenter-libs';
|
|
246
|
-
* await videoAPI.downloadVideoByKey('recording.mp4', 'video-key-123');
|
|
247
|
-
*
|
|
248
|
-
* @param file Name of the file to download
|
|
249
|
-
* @param videoKey Video key identifier
|
|
250
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
251
|
-
* @returns promise that resolves when the download completes
|
|
252
|
-
*/
|
|
253
|
-
async function downloadVideoByKey(file, videoKey, optionals = {}) {
|
|
254
|
-
return await new Router().get(`/video/download/${videoKey}/${file}`, optionals).then(({
|
|
255
|
-
body
|
|
256
|
-
}) => body);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Downloads a video file by scope, affiliate, family, and file name
|
|
261
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/download/with/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{AFFILIATE}/{FAMILY}/{FILE}` or GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/video/download/with/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{USER_KEY}/{AFFILIATE}/{FAMILY}/{FILE}`
|
|
262
|
-
*
|
|
263
|
-
* @example
|
|
264
|
-
* import { videoAPI } from 'epicenter-libs';
|
|
265
|
-
* await videoAPI.downloadVideoWith(
|
|
266
|
-
* 'recording.mp4',
|
|
267
|
-
* 'my-family',
|
|
268
|
-
* 'DAILY',
|
|
269
|
-
* { scopeBoundary: 'group', scopeKey: 'group-123' },
|
|
270
|
-
* );
|
|
271
|
-
*
|
|
272
|
-
* @param file Name of the file to download
|
|
273
|
-
* @param family Family identifier for the video
|
|
274
|
-
* @param affiliate Video service affiliate (VONAGE, DAILY, or DOMESTIC)
|
|
275
|
-
* @param scope Scope associated with the video
|
|
276
|
-
* @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
|
|
277
|
-
* @param scope.scopeKey Scope key, a unique identifier tied to the scope
|
|
278
|
-
* @param [scope.userKey] Optional key to scope the video to a user
|
|
279
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
280
|
-
* @returns promise that resolves when the download completes
|
|
281
|
-
*/
|
|
282
|
-
async function downloadVideoWith(file, family, affiliate, scope, optionals = {}) {
|
|
283
|
-
const {
|
|
284
|
-
scopeBoundary,
|
|
285
|
-
scopeKey,
|
|
286
|
-
userKey
|
|
287
|
-
} = scope;
|
|
288
|
-
const userKeyURIComponent = userKey ? `/${userKey}` : '';
|
|
289
|
-
return await new Router().get(`/video/download/with/${scopeBoundary}/${scopeKey}${userKeyURIComponent}/${affiliate}/${family}/${file}`, optionals).then(({
|
|
290
|
-
body
|
|
291
|
-
}) => body);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
export { AFFILIATE, LANGUAGE_CODE, MEDIA_FORMAT, deleteVideoByKey, downloadVideoByKey, downloadVideoWith, getVideoDirectoryByKey, getVideoDirectoryWith, getVideoSearch, getVideoURLByKey, getVideoURLWith, postVideoProcessor };
|
package/dist/test/apis/vonage.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import Router from '../utils/router.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Retrieves a Vonage session ID
|
|
5
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/vonage/session`
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* import { vonageAPI } from 'epicenter-libs';
|
|
9
|
-
* const session = await vonageAPI.getSession();
|
|
10
|
-
* console.log(session.sessionId);
|
|
11
|
-
*
|
|
12
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
13
|
-
* @returns promise that resolves to an object containing the Vonage session ID
|
|
14
|
-
*/
|
|
15
|
-
async function getSession(optionals = {}) {
|
|
16
|
-
return await new Router().get('/vonage/session', optionals).then(({
|
|
17
|
-
body
|
|
18
|
-
}) => body);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Creates a token for a Vonage session
|
|
23
|
-
* Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/vonage/token`
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* import { vonageAPI } from 'epicenter-libs';
|
|
27
|
-
* const token = await vonageAPI.postToken({ sessionId: 'my-session-id' });
|
|
28
|
-
* console.log(token.token);
|
|
29
|
-
*
|
|
30
|
-
* @param body Token request body
|
|
31
|
-
* @param body.sessionId The Vonage session ID to create a token for
|
|
32
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
33
|
-
* @returns promise that resolves to an object containing the Vonage token
|
|
34
|
-
*/
|
|
35
|
-
async function postToken(body, optionals = {}) {
|
|
36
|
-
return await new Router()
|
|
37
|
-
// The initialLayoutClassList is a temporary fix for existing simulations;
|
|
38
|
-
// This should likely be implemented differently if we decide to continue using Vonage;
|
|
39
|
-
// We are currently investigating alternatives due to performance issues, so this solution just prevents API errors;
|
|
40
|
-
.post('/vonage/token', {
|
|
41
|
-
body: {
|
|
42
|
-
...body,
|
|
43
|
-
initialLayoutClassList: ['placeholder']
|
|
44
|
-
},
|
|
45
|
-
...optionals
|
|
46
|
-
}).then(({
|
|
47
|
-
body
|
|
48
|
-
}) => body);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Creates an archive for a Vonage session
|
|
53
|
-
* Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/vonage/archive`
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* import { vonageAPI } from 'epicenter-libs';
|
|
57
|
-
* const archive = await vonageAPI.postArchive({
|
|
58
|
-
* name: 'my-archive',
|
|
59
|
-
* scope: { scopeBoundary: 'group', scopeKey: 'group-123' },
|
|
60
|
-
* sessionId: 'session-id',
|
|
61
|
-
* });
|
|
62
|
-
*
|
|
63
|
-
* @param body Archive configuration
|
|
64
|
-
* @param body.name Name for the archive
|
|
65
|
-
* @param body.scope Scope associated with the archive
|
|
66
|
-
* @param body.scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
|
|
67
|
-
* @param body.scope.scopeKey Scope key, a unique identifier tied to the scope
|
|
68
|
-
* @param [body.scope.userKey] Optional key to scope the archive to a user
|
|
69
|
-
* @param body.sessionId The Vonage session ID to archive
|
|
70
|
-
* @param [body.permit] Optional permissions for the archive
|
|
71
|
-
* @param [body.ttlSeconds] Time to live in seconds for the archive
|
|
72
|
-
* @param [body.resolution] Resolution for the archive
|
|
73
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
74
|
-
* @returns promise that resolves to the created Vonage archive
|
|
75
|
-
*/
|
|
76
|
-
async function postArchive(body, optionals = {}) {
|
|
77
|
-
return await new Router().post('/vonage/archive', {
|
|
78
|
-
body,
|
|
79
|
-
...optionals
|
|
80
|
-
}).then(({
|
|
81
|
-
body
|
|
82
|
-
}) => body);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Retrieves Vonage API key information
|
|
87
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/vonage/info`
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* import { vonageAPI } from 'epicenter-libs';
|
|
91
|
-
* const info = await vonageAPI.getInfo();
|
|
92
|
-
* console.log(info.apiKey);
|
|
93
|
-
*
|
|
94
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
95
|
-
* @returns promise that resolves to an object containing the Vonage API key
|
|
96
|
-
*/
|
|
97
|
-
async function getInfo(optionals = {}) {
|
|
98
|
-
return await new Router().get('/vonage/info', optionals).then(({
|
|
99
|
-
body
|
|
100
|
-
}) => body);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Deletes a Vonage archive by its ID
|
|
105
|
-
* Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/vonage/archive/{ARCHIVE_ID}`
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* import { vonageAPI } from 'epicenter-libs';
|
|
109
|
-
* await vonageAPI.deleteArchiveByID('archive-123');
|
|
110
|
-
*
|
|
111
|
-
* @param archiveID The ID of the archive to delete
|
|
112
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
113
|
-
* @returns promise that resolves to the deleted Vonage archive
|
|
114
|
-
*/
|
|
115
|
-
async function deleteArchiveByID(archiveID, optionals = {}) {
|
|
116
|
-
return await new Router().delete(`/vonage/archive/${archiveID}`, optionals).then(({
|
|
117
|
-
body
|
|
118
|
-
}) => body);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export { deleteArchiveByID, getInfo, getSession, postArchive, postToken };
|
package/dist/test/epicenter.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import './_virtual/runtime.js';
|
|
2
|
-
import * as account from './adapters/account.js';
|
|
3
|
-
export { account as accountAdapter };
|
|
4
|
-
import * as admin from './adapters/admin.js';
|
|
5
|
-
export { admin as adminAdapter };
|
|
6
|
-
import { removeLocalSession, regenerate } from './adapters/authentication.js';
|
|
7
|
-
import * as authentication from './adapters/authentication.js';
|
|
8
|
-
export { authentication as authAdapter };
|
|
9
|
-
import * as asset from './adapters/asset.js';
|
|
10
|
-
export { asset as assetAdapter };
|
|
11
|
-
import * as email from './adapters/email.js';
|
|
12
|
-
export { email as emailAdapter };
|
|
13
|
-
import * as episode from './adapters/episode.js';
|
|
14
|
-
export { episode as episodeAdapter };
|
|
15
|
-
import * as group from './adapters/group.js';
|
|
16
|
-
export { group as groupAdapter };
|
|
17
|
-
import * as leaderboard from './adapters/leaderboard.js';
|
|
18
|
-
export { leaderboard as leaderboardAdapter };
|
|
19
|
-
import * as presence from './adapters/presence.js';
|
|
20
|
-
export { presence as presenceAdapter };
|
|
21
|
-
import * as project from './adapters/project.js';
|
|
22
|
-
export { project as projectAdapter };
|
|
23
|
-
import * as recaptcha from './adapters/recaptcha.js';
|
|
24
|
-
export { recaptcha as recaptchaAdapter };
|
|
25
|
-
import * as run from './adapters/run.js';
|
|
26
|
-
export { run as runAdapter };
|
|
27
|
-
import * as user from './adapters/user.js';
|
|
28
|
-
export { user as userAdapter };
|
|
29
|
-
import * as vault from './adapters/vault.js';
|
|
30
|
-
export { vault as vaultAdapter };
|
|
31
|
-
import * as video from './adapters/video.js';
|
|
32
|
-
export { video as videoAdapter };
|
|
33
|
-
import * as vonage from './adapters/vonage.js';
|
|
34
|
-
export { vonage as vonageAdapter };
|
|
35
|
-
import * as world from './adapters/world.js';
|
|
36
|
-
export { world as worldAdapter };
|
|
37
|
-
import * as time from './adapters/time.js';
|
|
38
|
-
export { time as timeAdapter };
|
|
39
|
-
import * as task from './adapters/task.js';
|
|
40
|
-
export { task as taskAdapter };
|
|
41
|
-
import * as chat from './adapters/chat.js';
|
|
42
|
-
export { chat as chatAdapter };
|
|
43
|
-
import * as consensus from './adapters/consensus.js';
|
|
44
|
-
export { consensus as consensusAdapter };
|
|
45
|
-
import * as somebody from './adapters/somebody.js';
|
|
46
|
-
export { somebody as somebodyAdapter };
|
|
47
|
-
import * as matchmaker from './adapters/matchmaker.js';
|
|
48
|
-
export { matchmaker as matchmakerAdapter };
|
|
49
|
-
import * as daily from './adapters/daily.js';
|
|
50
|
-
export { daily as dailyAdapter };
|
|
51
|
-
import * as wallet from './adapters/wallet.js';
|
|
52
|
-
export { wallet as walletAdapter };
|
|
53
|
-
import cometdAdapter from './adapters/cometd.js';
|
|
54
|
-
export { default as Channel } from './adapters/channel.js';
|
|
55
|
-
export { PUSH_CATEGORY, RITUAL, ROLE, SCOPE_BOUNDARY } from './utils/constants.js';
|
|
56
|
-
import { isBrowser } from './utils/helpers.js';
|
|
57
|
-
import EpicenterError from './utils/error.js';
|
|
58
|
-
export { default as Fault } from './utils/fault.js';
|
|
59
|
-
export { default as config } from './utils/config.js';
|
|
60
|
-
import identification from './utils/identification.js';
|
|
61
|
-
import errorManager from './utils/error-manager.js';
|
|
62
|
-
export { default as Router } from './utils/router.js';
|
|
63
|
-
import * as vonage$1 from './apis/vonage.js';
|
|
64
|
-
export { vonage$1 as vonageAPI };
|
|
65
|
-
import * as video$1 from './apis/video.js';
|
|
66
|
-
export { video$1 as videoAPI };
|
|
67
|
-
import * as utilities from './utilities.js';
|
|
68
|
-
export { utilities as utils };
|
|
69
|
-
|
|
70
|
-
/* yes, this string template literal is weird;
|
|
71
|
-
* it's cause rollup does not recogize 3.33.0 as an individual token otherwise */
|
|
72
|
-
const version = `Epicenter (v${'3.33.0'}) for Test | Build Date: 2025-11-20T19:19:25.745Z`;
|
|
73
|
-
const UNAUTHORIZED = 401;
|
|
74
|
-
const FORBIDDEN = 403;
|
|
75
|
-
const DEFAULT_ERROR_HANDLERS = {};
|
|
76
|
-
DEFAULT_ERROR_HANDLERS.cometdReconnected = errorManager.registerHandler(error => error.code === 'COMETD_RECONNECTED', async error => {
|
|
77
|
-
if (isBrowser()) {
|
|
78
|
-
console.warn('Cometd Reconnected. If you wish to react to this reconnection, register an error handler with identifier: error.code === "COMETD_RECONNECTED".', error);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
DEFAULT_ERROR_HANDLERS.cometdError = errorManager.registerHandler(error => error.status === FORBIDDEN && error.code === 'COMETD_ERROR', async (error, retry) => {
|
|
82
|
-
console.warn('Cometd error. Attempting to reconnect.', error);
|
|
83
|
-
await cometdAdapter.disconnect();
|
|
84
|
-
return await retry();
|
|
85
|
-
});
|
|
86
|
-
DEFAULT_ERROR_HANDLERS.authExpired = errorManager.registerHandler(error => error.status === UNAUTHORIZED && error.code === 'AUTHENTICATION_EXPIRED', async error => {
|
|
87
|
-
await removeLocalSession();
|
|
88
|
-
if (isBrowser()) {
|
|
89
|
-
// eslint-disable-next-line no-alert
|
|
90
|
-
alert('Session token has expired, try logging in again.');
|
|
91
|
-
}
|
|
92
|
-
throw error;
|
|
93
|
-
});
|
|
94
|
-
DEFAULT_ERROR_HANDLERS.authGroupExpired = errorManager.registerHandler(error => error.status === UNAUTHORIZED && error.code === 'AUTHENTICATION_GROUP_EXPIRED', async error => {
|
|
95
|
-
if (isBrowser()) {
|
|
96
|
-
// eslint-disable-next-line no-alert
|
|
97
|
-
alert('This group has expired. Try logging into a different group');
|
|
98
|
-
}
|
|
99
|
-
throw error;
|
|
100
|
-
});
|
|
101
|
-
DEFAULT_ERROR_HANDLERS.authInvalidated = errorManager.registerHandler(error => error.status === UNAUTHORIZED && error.code === 'AUTHENTICATION_INVALIDATED', async (error, retry) => {
|
|
102
|
-
try {
|
|
103
|
-
var _session$groupKey;
|
|
104
|
-
const session = identification.session;
|
|
105
|
-
if ((session === null || session === void 0 ? void 0 : session.objectType) === 'admin') {
|
|
106
|
-
throw new EpicenterError('Unhandled error: admin session was somehow invalidated');
|
|
107
|
-
}
|
|
108
|
-
const groupKey = (_session$groupKey = session === null || session === void 0 ? void 0 : session.groupKey) !== null && _session$groupKey !== void 0 ? _session$groupKey : '';
|
|
109
|
-
await regenerate(groupKey, {
|
|
110
|
-
objectType: 'user',
|
|
111
|
-
inert: true
|
|
112
|
-
});
|
|
113
|
-
return await retry();
|
|
114
|
-
} catch (_error) {
|
|
115
|
-
await removeLocalSession();
|
|
116
|
-
throw error;
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
Object.freeze(DEFAULT_ERROR_HANDLERS);
|
|
120
|
-
|
|
121
|
-
export { DEFAULT_ERROR_HANDLERS, cometdAdapter, errorManager, version };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import toPropertyKey from './toPropertyKey.js';
|
|
2
|
-
|
|
3
|
-
function _defineProperty(e, r, t) {
|
|
4
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
|
-
value: t,
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true
|
|
9
|
-
}) : e[r] = t, e;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { _defineProperty as default };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import _typeof from './typeof.js';
|
|
2
|
-
|
|
3
|
-
function toPrimitive(t, r) {
|
|
4
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
5
|
-
var e = t[Symbol.toPrimitive];
|
|
6
|
-
if (void 0 !== e) {
|
|
7
|
-
var i = e.call(t, r);
|
|
8
|
-
if ("object" != _typeof(i)) return i;
|
|
9
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
|
-
}
|
|
11
|
-
return ("string" === r ? String : Number)(t);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { toPrimitive as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function _typeof(o) {
|
|
2
|
-
"@babel/helpers - typeof";
|
|
3
|
-
|
|
4
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
5
|
-
return typeof o;
|
|
6
|
-
} : function (o) {
|
|
7
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8
|
-
}, _typeof(o);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { _typeof as default };
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Extension } from './Extension.js';
|
|
2
|
-
|
|
3
|
-
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
4
|
-
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
5
|
-
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
6
|
-
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
7
|
-
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
8
|
-
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* This client-side extension enables the client to acknowledge to the server
|
|
12
|
-
* the messages that the client has received.
|
|
13
|
-
* For the acknowledgement to work, the server must be configured with the
|
|
14
|
-
* correspondent server-side ack extension. If both client and server support
|
|
15
|
-
* the ack extension, then the ack functionality will take place automatically.
|
|
16
|
-
* By enabling this extension, all messages arriving from the server will arrive
|
|
17
|
-
* via /meta/connect, so the comet communication will be slightly chattier.
|
|
18
|
-
* The fact that all messages will return via /meta/connect means also that the
|
|
19
|
-
* messages will arrive with total order, which is not guaranteed if messages
|
|
20
|
-
* can arrive via both /meta/connect and normal response.
|
|
21
|
-
* Messages are not acknowledged one by one, but instead a batch of messages is
|
|
22
|
-
* acknowledged when the /meta/connect returns.
|
|
23
|
-
*/
|
|
24
|
-
var _serverSupportsAcks = /*#__PURE__*/new WeakMap();
|
|
25
|
-
var _batch = /*#__PURE__*/new WeakMap();
|
|
26
|
-
var _AckExtension_brand = /*#__PURE__*/new WeakSet();
|
|
27
|
-
class AckExtension extends Extension {
|
|
28
|
-
constructor(..._args) {
|
|
29
|
-
super(..._args);
|
|
30
|
-
_classPrivateMethodInitSpec(this, _AckExtension_brand);
|
|
31
|
-
_classPrivateFieldInitSpec(this, _serverSupportsAcks, false);
|
|
32
|
-
_classPrivateFieldInitSpec(this, _batch, 0);
|
|
33
|
-
}
|
|
34
|
-
registered(name, cometd) {
|
|
35
|
-
super.registered(name, cometd);
|
|
36
|
-
_assertClassBrand(_AckExtension_brand, this, _debug).call(this, "AckExtension: executing registration callback");
|
|
37
|
-
}
|
|
38
|
-
unregistered() {
|
|
39
|
-
_assertClassBrand(_AckExtension_brand, this, _debug).call(this, "AckExtension: executing unregistration callback");
|
|
40
|
-
super.unregistered();
|
|
41
|
-
}
|
|
42
|
-
incoming(message) {
|
|
43
|
-
const channel = message.channel;
|
|
44
|
-
const ext = message.ext;
|
|
45
|
-
if (channel === "/meta/handshake") {
|
|
46
|
-
if (ext) {
|
|
47
|
-
const ackField = ext.ack;
|
|
48
|
-
if (typeof ackField === "object") {
|
|
49
|
-
// New format.
|
|
50
|
-
_classPrivateFieldSet(_serverSupportsAcks, this, ackField.enabled === true);
|
|
51
|
-
const batch = ackField.batch;
|
|
52
|
-
if (typeof batch === "number") {
|
|
53
|
-
_classPrivateFieldSet(_batch, this, batch);
|
|
54
|
-
}
|
|
55
|
-
} else {
|
|
56
|
-
// Old format.
|
|
57
|
-
_classPrivateFieldSet(_serverSupportsAcks, this, ackField === true);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
_assertClassBrand(_AckExtension_brand, this, _debug).call(this, "AckExtension: server supports acknowledgements", _classPrivateFieldGet(_serverSupportsAcks, this));
|
|
61
|
-
} else if (channel === "/meta/connect" && message.successful && _classPrivateFieldGet(_serverSupportsAcks, this)) {
|
|
62
|
-
if (ext && typeof ext.ack === "number") {
|
|
63
|
-
_classPrivateFieldSet(_batch, this, ext.ack);
|
|
64
|
-
_assertClassBrand(_AckExtension_brand, this, _debug).call(this, "AckExtension: server sent batch", _classPrivateFieldGet(_batch, this));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return message;
|
|
68
|
-
}
|
|
69
|
-
outgoing(message) {
|
|
70
|
-
const channel = message.channel;
|
|
71
|
-
if (!message.ext) {
|
|
72
|
-
message.ext = {};
|
|
73
|
-
}
|
|
74
|
-
if (channel === "/meta/handshake") {
|
|
75
|
-
message.ext.ack = this.cometd && this.cometd.ackEnabled !== false;
|
|
76
|
-
_classPrivateFieldSet(_serverSupportsAcks, this, false);
|
|
77
|
-
_classPrivateFieldSet(_batch, this, 0);
|
|
78
|
-
} else if (channel === "/meta/connect") {
|
|
79
|
-
if (_classPrivateFieldGet(_serverSupportsAcks, this)) {
|
|
80
|
-
message.ext.ack = _classPrivateFieldGet(_batch, this);
|
|
81
|
-
_assertClassBrand(_AckExtension_brand, this, _debug).call(this, "AckExtension: client sending batch", _classPrivateFieldGet(_batch, this));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return message;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function _debug(text, args) {
|
|
88
|
-
this.cometd._debug(text, args);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export { AckExtension };
|