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.
Files changed (76) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/browser/epicenter.js +105 -2
  3. package/dist/browser/epicenter.js.map +1 -1
  4. package/dist/cjs/epicenter.js +105 -2
  5. package/dist/cjs/epicenter.js.map +1 -1
  6. package/dist/epicenter.js +105 -2
  7. package/dist/epicenter.js.map +1 -1
  8. package/dist/epicenter.min.js +1 -1
  9. package/dist/epicenter.min.js.map +1 -1
  10. package/dist/module/epicenter.js +105 -2
  11. package/dist/module/epicenter.js.map +1 -1
  12. package/dist/types/adapters/chat.d.ts +63 -0
  13. package/package.json +1 -1
  14. package/src/adapters/chat.ts +95 -0
  15. package/src/utils/identification.ts +4 -0
  16. package/dist/test/_virtual/runtime.js +0 -3
  17. package/dist/test/_virtual/runtime2.js +0 -3
  18. package/dist/test/adapters/account.js +0 -169
  19. package/dist/test/adapters/admin.js +0 -53
  20. package/dist/test/adapters/asset.js +0 -425
  21. package/dist/test/adapters/authentication.js +0 -349
  22. package/dist/test/adapters/channel.js +0 -201
  23. package/dist/test/adapters/chat.js +0 -199
  24. package/dist/test/adapters/cometd.js +0 -514
  25. package/dist/test/adapters/consensus.js +0 -484
  26. package/dist/test/adapters/daily.js +0 -244
  27. package/dist/test/adapters/email.js +0 -179
  28. package/dist/test/adapters/episode.js +0 -175
  29. package/dist/test/adapters/group.js +0 -655
  30. package/dist/test/adapters/leaderboard.js +0 -162
  31. package/dist/test/adapters/matchmaker.js +0 -159
  32. package/dist/test/adapters/presence.js +0 -85
  33. package/dist/test/adapters/project.js +0 -94
  34. package/dist/test/adapters/recaptcha.js +0 -24
  35. package/dist/test/adapters/run.js +0 -1008
  36. package/dist/test/adapters/somebody.js +0 -154
  37. package/dist/test/adapters/task.js +0 -192
  38. package/dist/test/adapters/time.js +0 -28
  39. package/dist/test/adapters/user.js +0 -105
  40. package/dist/test/adapters/vault.js +0 -403
  41. package/dist/test/adapters/video.js +0 -249
  42. package/dist/test/adapters/vonage.js +0 -130
  43. package/dist/test/adapters/wallet.js +0 -130
  44. package/dist/test/adapters/world.js +0 -507
  45. package/dist/test/apis/video.js +0 -294
  46. package/dist/test/apis/vonage.js +0 -121
  47. package/dist/test/epicenter.js +0 -121
  48. package/dist/test/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -12
  49. package/dist/test/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -14
  50. package/dist/test/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -9
  51. package/dist/test/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -11
  52. package/dist/test/node_modules/cometd/AckExtension.js +0 -91
  53. package/dist/test/node_modules/cometd/CallbackPollingTransport.js +0 -148
  54. package/dist/test/node_modules/cometd/Client.js +0 -2160
  55. package/dist/test/node_modules/cometd/Extension.js +0 -47
  56. package/dist/test/node_modules/cometd/LongPollingTransport.js +0 -135
  57. package/dist/test/node_modules/cometd/ReloadExtension.js +0 -214
  58. package/dist/test/node_modules/cometd/RequestTransport.js +0 -252
  59. package/dist/test/node_modules/cometd/Transport.js +0 -167
  60. package/dist/test/node_modules/cometd/TransportRegistry.js +0 -107
  61. package/dist/test/node_modules/cometd/WebSocketTransport.js +0 -384
  62. package/dist/test/node_modules/cometd/cometd.js +0 -9
  63. package/dist/test/node_modules/regenerator-runtime/runtime.js +0 -773
  64. package/dist/test/utilities.js +0 -17
  65. package/dist/test/utils/config.js +0 -189
  66. package/dist/test/utils/constants.js +0 -293
  67. package/dist/test/utils/cookies.js +0 -75
  68. package/dist/test/utils/error-manager.js +0 -57
  69. package/dist/test/utils/error.js +0 -12
  70. package/dist/test/utils/fault.js +0 -34
  71. package/dist/test/utils/filter-parser.js +0 -68
  72. package/dist/test/utils/helpers.js +0 -9
  73. package/dist/test/utils/identification.js +0 -161
  74. package/dist/test/utils/result.js +0 -20
  75. package/dist/test/utils/router.js +0 -551
  76. package/dist/test/utils/store.js +0 -79
@@ -1,162 +0,0 @@
1
- import '../utils/helpers.js';
2
- import { parseFilterInput } from '../utils/filter-parser.js';
3
- import '../utils/config.js';
4
- import identification from '../utils/identification.js';
5
- import '../utils/error-manager.js';
6
- import Router from '../utils/router.js';
7
-
8
- /**
9
- * Creates a leaderboard entry.
10
- * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/leaderboard`
11
- *
12
- * @example
13
- * import { leaderboardAdapter, SCOPE_BOUNDARY } from 'epicenter-libs';
14
- * const leaderboard = await leaderboardAdapter.update(
15
- * 'class-23-leaderboard',
16
- * { scopeBoundary: SCOPE_BOUNDARY.GROUP, scopeKey: '0000017dd3bf540e5ada5b1e058f08f20461' },
17
- * [{ name: 'total', quantity: 20 }, { name: 'extraCredit', quantity: 2 }],
18
- * { tags: [{ label: 'role', content: 'doctor' }] }
19
- * );
20
- *
21
- * @param collection Name of the leaderboard
22
- * @param scope Scope attached to the leaderboard entry; allows for scoping
23
- * @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
24
- * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
25
- * @param [scope.userKey] User key for the user creating the entry; if omitted will use the one in current session
26
- * @param scores List of score objects
27
- * @param scores[].name Name of the score
28
- * @param scores[].quantity Value of the score
29
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
30
- * @param [optionals.tags] Tags for the leaderboard entry; helps to provide another layer of scope if needed
31
- * @param [optionals.allowChannel] If true, allows channel notifications for this update
32
- * @returns promise that resolves to the leaderboard entry created
33
- */
34
- async function update(collection, scope, scores, optionals = {}) {
35
- const {
36
- tags,
37
- allowChannel,
38
- ...routingOptions
39
- } = optionals;
40
- const {
41
- scopeBoundary,
42
- scopeKey,
43
- userKey
44
- } = scope;
45
- const session = identification.session;
46
- return await new Router().post('/leaderboard', {
47
- body: {
48
- scope: {
49
- scopeBoundary,
50
- scopeKey,
51
- userKey: userKey !== null && userKey !== void 0 ? userKey : session === null || session === void 0 ? void 0 : session.userKey
52
- },
53
- collection,
54
- scores,
55
- tags,
56
- allowChannel
57
- },
58
- ...routingOptions
59
- }).then(({
60
- body
61
- }) => body);
62
- }
63
-
64
- /**
65
- * Gathers leaderboard information; not paginable (hence named 'list' and not 'query')
66
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/leaderboard/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{COLLECTION}`
67
- *
68
- * @example
69
- * import { leaderboardAdapter, SCOPE_BOUNDARY } from 'epicenter-libs';
70
- * const leaderboard = await leaderboardAdapter.list('myLeaderboard', {
71
- * scopeBoundary: SCOPE_BOUNDARY.GROUP,
72
- * scopeKey: 'GROUP_KEY',
73
- * }, {
74
- * filter: [
75
- * 'tag.role=doctor', // look for leaderboard entries tagged with role=doctor
76
- * 'score.total>0' // where the users scored a total higher than 0
77
- * ],
78
- * sort: ['+score.total'], // sort results by 'total' in ascending order
79
- * first: 0,
80
- * max: 20 // retrieve only the first 20 entries
81
- * });
82
- *
83
- * @param collection Name of the leaderboard
84
- * @param scope Scope attached to the leaderboard entry; allows for scoping
85
- * @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
86
- * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
87
- * @param searchOptions Search options for the query
88
- * @param [searchOptions.filter] Filters for searching
89
- * @param [searchOptions.sort] Sorting criteria
90
- * @param [searchOptions.first] The starting index of the list returned
91
- * @param [searchOptions.max] The maximum number of entries in the list
92
- * @param [optionals] Optional arguments; pass network call options overrides here.
93
- * @returns promise that resolves to a list of leaderboard entries
94
- */
95
- async function list(collection, scope, searchOptions, optionals = {}) {
96
- const {
97
- scopeBoundary,
98
- scopeKey
99
- } = scope;
100
- const {
101
- filter,
102
- sort = [],
103
- first,
104
- max
105
- } = searchOptions;
106
- const searchParams = {
107
- filter: parseFilterInput(filter),
108
- sort: sort.join(';') || undefined,
109
- first,
110
- max
111
- };
112
- return await new Router().withSearchParams(searchParams).get(`/leaderboard/${scopeBoundary}/${scopeKey}/${collection}`, optionals).then(({
113
- body
114
- }) => body);
115
- }
116
- async function get(collection, scope, searchOptions, optionals = {}) {
117
- console.warn('DEPRECATION WARNING: leaderboardAdapter.get is deprecated and will be removed with the next release. Use leaderboardAdapter.list instead.');
118
- return await list(collection, scope, searchOptions, optionals);
119
- }
120
-
121
- /**
122
- * Returns the total count in the given collection
123
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/leaderboard/count/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{COLLECTION}`
124
- *
125
- * @example
126
- * import { leaderboardAdapter, SCOPE_BOUNDARY } from 'epicenter-libs';
127
- * const count = await leaderboardAdapter.getCount('myLeaderboard', {
128
- * scopeBoundary: SCOPE_BOUNDARY.GROUP,
129
- * scopeKey: '0000017dd3bf540e5ada5b1e058f08f20461',
130
- * }, {
131
- * filter: [
132
- * 'tag.role=doctor', // look for leaderboard entries tagged with role=doctor
133
- * 'score.total>0' // where the users scored a total higher than 0
134
- * ],
135
- * });
136
- *
137
- * @param collection Name of the leaderboard
138
- * @param scope Scope attached to the leaderboard entry; allows for scoping
139
- * @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
140
- * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
141
- * @param searchOptions Search options for the query
142
- * @param [searchOptions.filter] Filters for searching
143
- * @param [optionals] Optional arguments; pass network call options overrides here.
144
- * @returns promise that resolves to the number of entries in the leaderboard
145
- */
146
- async function getCount(collection, scope, searchOptions, optionals = {}) {
147
- const {
148
- scopeBoundary,
149
- scopeKey
150
- } = scope;
151
- const {
152
- filter
153
- } = searchOptions;
154
- const searchParams = {
155
- filter: parseFilterInput(filter)
156
- };
157
- return await new Router().withSearchParams(searchParams).get(`/leaderboard/count/${scopeBoundary}/${scopeKey}/${collection}`, optionals).then(({
158
- body
159
- }) => body);
160
- }
161
-
162
- export { get, getCount, list, update };
@@ -1,159 +0,0 @@
1
- import Router from '../utils/router.js';
2
-
3
- /**
4
- * Creates a matchmaker list; requires facilitator level authentication
5
- * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/matchmaker/udome/{NAME}`
6
- *
7
- * @example
8
- * import { matchmakerAdapter, SCOPE_BOUNDARY } from 'epicenter-libs';
9
- * const list = await matchmakerAdapter.create('my-matchmaker', 2, {
10
- * scopeBoundary: SCOPE_BOUNDARY.GROUP,
11
- * scopeKey: '0000017dd3bf540e5ada5b1e058f08f20461',
12
- * });
13
- *
14
- * @param name The name for the matchmaker list
15
- * @param partners The number of partners each participant should be assigned
16
- * @param scope Scope associated with list
17
- * @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
18
- * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
19
- * @param [optionals] Optional arguments; pass network call options overrides here.
20
- * @returns promise that resolves to the matchmaker list object
21
- */
22
- async function create(name, partners, scope, optionals = {}) {
23
- const {
24
- accountShortName,
25
- projectShortName,
26
- server
27
- } = optionals;
28
- return await new Router().withServer(server).withAccountShortName(accountShortName).withProjectShortName(projectShortName).post(`/matchmaker/udome/${name}`, {
29
- body: {
30
- scope,
31
- partners
32
- }
33
- }).then(({
34
- body
35
- }) => body);
36
- }
37
-
38
- /**
39
- * Changes the opened/closed status of a matchmaker list; requires facilitator level authentication
40
- * Base URL: PUT `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/matchmaker/udome/{UDOME_KEY}`
41
- *
42
- * @example
43
- * import { matchmakerAdapter } from 'epicenter-libs';
44
- * const list = await matchmakerAdapter.edit('udomeKey123', true);
45
- *
46
- * @param udomeKey The unique key for the targeted matchmaker list
47
- * @param closed Whether the matchmaker list is open or closed
48
- * @param [optionals] Optional arguments; pass network call options overrides here.
49
- * @returns promise that resolves to the matchmaker list object
50
- */
51
- async function edit(udomeKey, closed, optionals = {}) {
52
- const {
53
- accountShortName,
54
- projectShortName,
55
- server
56
- } = optionals;
57
- return await new Router().withServer(server).withAccountShortName(accountShortName).withProjectShortName(projectShortName).put(`/matchmaker/udome/${udomeKey}`, {
58
- body: {
59
- closed
60
- }
61
- }).then(({
62
- body
63
- }) => body);
64
- }
65
-
66
- /**
67
- * Adds the user making the request to the matchmaker list provided that it is open; requires participant authentication
68
- * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/matchmaker/udome`
69
- *
70
- * @example
71
- * import { matchmakerAdapter } from 'epicenter-libs';
72
- * const list = await matchmakerAdapter.addUser('udomeKey123');
73
- *
74
- * @param udomeKey The unique key for the targeted matchmaker list
75
- * @param [optionals] Optional arguments; pass network call options overrides here.
76
- * @returns promise that resolves to the matchmaker list object
77
- */
78
- async function addUser(udomeKey, optionals = {}) {
79
- const {
80
- accountShortName,
81
- projectShortName,
82
- server
83
- } = optionals;
84
- return await new Router().withServer(server).withAccountShortName(accountShortName).withProjectShortName(projectShortName).patch('/matchmaker/udome', {
85
- body: {
86
- udomeKey
87
- }
88
- }).then(({
89
- body
90
- }) => body);
91
- }
92
- const NOT_FOUND = 404;
93
- /**
94
- * Gets a matchmaker list based on a udomeKey; requires participant level authentication
95
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/matchmaker/udome/{UDOME_KEY}`
96
- *
97
- * @example
98
- * import { matchmakerAdapter } from 'epicenter-libs';
99
- * const list = await matchmakerAdapter.get('udomeKey123');
100
- *
101
- * @param udomeKey The unique key for the targeted matchmaker list
102
- * @param [optionals] Optional arguments; pass network call options overrides here.
103
- * @returns promise that resolves to the matchmaker list object, or undefined if not found
104
- */
105
- async function get(udomeKey, optionals = {}) {
106
- const {
107
- accountShortName,
108
- projectShortName,
109
- server
110
- } = optionals;
111
- return await new Router().withServer(server).withAccountShortName(accountShortName).withProjectShortName(projectShortName).get(`/matchmaker/udome/${udomeKey}`).catch(error => {
112
- if (error.status === NOT_FOUND) return {
113
- body: undefined
114
- };
115
- return Promise.reject(error);
116
- }).then(({
117
- body
118
- }) => body);
119
- }
120
-
121
- /**
122
- * Gets a matchmaker list based on name and scope; requires participant level authentication
123
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/matchmaker/udome/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{NAME}`
124
- *
125
- * @example
126
- * import { matchmakerAdapter, SCOPE_BOUNDARY } from 'epicenter-libs';
127
- * const list = await matchmakerAdapter.byName('my-matchmaker', {
128
- * scopeBoundary: SCOPE_BOUNDARY.GROUP,
129
- * scopeKey: 'GROUP_KEY',
130
- * });
131
- *
132
- * @param name The name of the matchmaker list
133
- * @param scope Scope associated with list
134
- * @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
135
- * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
136
- * @param [optionals] Optional arguments; pass network call options overrides here.
137
- * @returns promise that resolves to the matchmaker list object, or undefined if not found
138
- */
139
- async function byName(name, scope, optionals = {}) {
140
- const {
141
- accountShortName,
142
- projectShortName,
143
- server
144
- } = optionals;
145
- const {
146
- scopeBoundary,
147
- scopeKey
148
- } = scope;
149
- return await new Router().withServer(server).withAccountShortName(accountShortName).withProjectShortName(projectShortName).get(`/matchmaker/udome/${scopeBoundary}/${scopeKey}/${name}`).catch(error => {
150
- if (error.status === NOT_FOUND) return {
151
- body: undefined
152
- };
153
- return Promise.reject(error);
154
- }).then(({
155
- body
156
- }) => body);
157
- }
158
-
159
- export { addUser, byName, create, edit, get };
@@ -1,85 +0,0 @@
1
- import '../utils/helpers.js';
2
- import '../utils/config.js';
3
- import identification from '../utils/identification.js';
4
- import '../utils/error-manager.js';
5
- import Router from '../utils/router.js';
6
- import cometdAdapter from './cometd.js';
7
-
8
- /**
9
- * Makes a connection request to the CometD server; effectively marking the user as online.
10
- * This isn't required to be called in order to be considered online. Subscribe to a CometD
11
- * channel will do the same as well. This is just a convenience method for when you don't
12
- * need to utilize the channels except specifically for presence.
13
- * Using [logout](#authAdapter-logout) will automatically disconnect for you.
14
- * Base URL: Uses CometD push channel connection
15
- *
16
- * @example
17
- * import { presenceAdapter } from 'epicenter-libs';
18
- * await presenceAdapter.connect();
19
- *
20
- * @returns promise indicating whether or not the connection was successful
21
- */
22
- async function connect() {
23
- await cometdAdapter.handshake();
24
- return;
25
- }
26
-
27
- /**
28
- * Disconnects from CometD and removes user presence.
29
- * Using [logout](#authAdapter-logout) will automatically disconnect for you.
30
- * Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/presence/group/{GROUP_KEY}`
31
- *
32
- * @example
33
- * import { presenceAdapter } from 'epicenter-libs';
34
- * await presenceAdapter.disconnect();
35
- *
36
- * @param [optionals] Optional arguments; pass network call options overrides here.
37
- * @returns promise indicating whether or not the disconnection was successful
38
- */
39
- async function disconnect(optionals) {
40
- var _identification$sessi;
41
- const cleanup = [cometdAdapter.disconnect()];
42
- const groupKey = identification === null || identification === void 0 || (_identification$sessi = identification.session) === null || _identification$sessi === void 0 ? void 0 : _identification$sessi.groupKey;
43
- if (groupKey) {
44
- cleanup.push(new Router().delete(`/presence/group/${groupKey}`, optionals));
45
- }
46
- await Promise.allSettled(cleanup);
47
- }
48
-
49
- /**
50
- * Retrieves the presence information for a particular group
51
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/presence/group/{GROUP_KEY}`
52
- *
53
- * @example
54
- * import { presenceAdapter } from 'epicenter-libs';
55
- * const presence = await presenceAdapter.forGroup('0000017dd3bf540e5ada5b1e058f08f20461');
56
- *
57
- * @param groupKey Key associated with group
58
- * @param [optionals] Optional arguments; pass network call options overrides here.
59
- * @returns promise that resolves to a list of users online
60
- */
61
- async function forGroup(groupKey, optionals = {}) {
62
- return await new Router().get(`/presence/group/${groupKey}`, optionals).then(({
63
- body
64
- }) => body);
65
- }
66
-
67
- /**
68
- * Retrieves the presence information for a particular world
69
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/presence/world/{WORLD_KEY}`
70
- *
71
- * @example
72
- * import { presenceAdapter } from 'epicenter-libs';
73
- * const presence = await presenceAdapter.forWorld('0000017a445032dc38cb2cecd5fc13708314');
74
- *
75
- * @param worldKey Key associated with world
76
- * @param [optionals] Optional arguments; pass network call options overrides here.
77
- * @returns promise that resolves to a list of users online
78
- */
79
- async function forWorld(worldKey, optionals = {}) {
80
- return await new Router().get(`/presence/world/${worldKey}`, optionals).then(({
81
- body
82
- }) => body);
83
- }
84
-
85
- export { connect, disconnect, forGroup, forWorld };
@@ -1,94 +0,0 @@
1
- import '../utils/helpers.js';
2
- import '../utils/config.js';
3
- import '../utils/identification.js';
4
- import '../utils/error-manager.js';
5
- import Router from '../utils/router.js';
6
-
7
- const ACCESS_TYPE = {
8
- PUBLIC: 'PUBLIC',
9
- PRIVATE: 'PRIVATE',
10
- AUTHENTICATED: 'AUTHENTICATED'
11
- };
12
- const WORKER_PARTITION = {
13
- NONE: 'NONE',
14
- ALL: 'ALL',
15
- FREE: 'FREE',
16
- LICENSED: 'LICENSED',
17
- ACCOUNT: 'ACCOUNT'
18
- };
19
- const PHYLOGENY = {
20
- ORIGINAL: 'ORIGINAL',
21
- HISTORICAL: 'HISTORICAL',
22
- REFERENTIAL: 'REFERENTIAL',
23
- ORDERED: 'ORDERED',
24
- EVENTUAL: 'EVENTUAL',
25
- /**
26
- * TRANSMOGRIFIED Improves the way Epicenter runs proxies.
27
- */
28
- TRANSMOGRIFIED: 'TRANSMOGRIFIED',
29
- /**
30
- * REANIMATED Changes the default run start-up ritual.
31
- */
32
- REANIMATED: 'REANIMATED',
33
- /**
34
- * SILENT Inhibits push channel notifications unless allowChannel is true, which by default is false.
35
- */
36
- SILENT: 'SILENT'
37
- };
38
- const CHANNEL_PROTOCOL = {
39
- OUMUAMUA: 'OUMUAMUA',
40
- COMETD: 'COMETD'
41
- };
42
- /**
43
- * Checks to see if the project currently has the push channels enabled
44
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/project/channel/isEnabled`
45
- *
46
- * @example
47
- * import { projectAdapter } from 'epicenter-libs';
48
- * const enabled = await projectAdapter.channelsEnabled();
49
- *
50
- * @param [optionals] Optional arguments; pass network call options overrides here.
51
- * @returns promise resolving true/false whether or not the project supports the use of push channels
52
- */
53
- async function channelsEnabled(optionals = {}) {
54
- return await new Router().get('/project/channel/isEnabled', optionals).then(({
55
- body
56
- }) => body);
57
- }
58
-
59
- /**
60
- * Gets the current project details
61
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/project`
62
- *
63
- * @example
64
- * import { projectAdapter } from 'epicenter-libs';
65
- * const project = await projectAdapter.get();
66
- *
67
- * @param [optionals] Optional arguments; pass network call options overrides here.
68
- * @returns promise that resolves to the project object
69
- */
70
- async function get(optionals = {}) {
71
- return await new Router().get('/project', optionals).then(({
72
- body
73
- }) => body);
74
- }
75
-
76
- /**
77
- * Lists all projects in an account
78
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/manager/project/in`
79
- *
80
- * @example
81
- * import { projectAdapter } from 'epicenter-libs';
82
- * const projects = await projectAdapter.list('my-account');
83
- *
84
- * @param accountShortName The account short name
85
- * @param [optionals] Optional arguments; pass network call options overrides here.
86
- * @returns promise that resolves to an array of project objects
87
- */
88
- async function list(accountShortName, optionals = {}) {
89
- return await new Router().withAccountShortName(accountShortName).withProjectShortName('manager').get('/project/in', optionals).then(({
90
- body
91
- }) => body);
92
- }
93
-
94
- export { ACCESS_TYPE, CHANNEL_PROTOCOL, PHYLOGENY, WORKER_PARTITION, channelsEnabled, get, list };
@@ -1,24 +0,0 @@
1
- import Router from '../utils/router.js';
2
-
3
- /**
4
- * Verifies a Google reCAPTCHA token
5
- * Base URL: POST `https://forio.com/api/v3/epicenter/manager/recaptcha/google`
6
- *
7
- * @example
8
- * import { recaptchaAdapter } from 'epicenter-libs';
9
- * const result = await recaptchaAdapter.google(token);
10
- *
11
- * @param humanKey The reCAPTCHA token to verify
12
- * @returns promise that resolves to the verification result
13
- */
14
- async function google(humanKey) {
15
- return await new Router().withAccountShortName('epicenter').withProjectShortName('manager').post('/recaptcha/google', {
16
- body: {
17
- humanKey: humanKey
18
- }
19
- }).then(({
20
- body
21
- }) => body);
22
- }
23
-
24
- export { google };