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
|
@@ -1,484 +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
|
-
/**
|
|
8
|
-
* Creates a new consensus barrier
|
|
9
|
-
* Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
13
|
-
* await consensusAdapter.create(
|
|
14
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
15
|
-
* 'SUBMISSIONS',
|
|
16
|
-
* 'ROUND1',
|
|
17
|
-
* {
|
|
18
|
-
* ROLE1: 1,
|
|
19
|
-
* ROLE2: 1,
|
|
20
|
-
* ROLE3: 2,
|
|
21
|
-
* },
|
|
22
|
-
* {
|
|
23
|
-
* ROLE1: [{ name: 'step', arguments: [] }],
|
|
24
|
-
* ROLE2: [{ name: 'step', arguments: [] }],
|
|
25
|
-
* ROLE3: [{ name: 'step', arguments: [] }],
|
|
26
|
-
* }
|
|
27
|
-
* );
|
|
28
|
-
*
|
|
29
|
-
* @param worldKey World key for the world you are making a consensus barrier for
|
|
30
|
-
* @param name Unique string to name a set of consensus barriers
|
|
31
|
-
* @param stage Unique string to name one stage of the set of consensus barriers
|
|
32
|
-
* @param expectedRoles Map where the keys are the names of each role participating and the number of users expected to submit consensus actions for each role
|
|
33
|
-
* @param defaultActions Map defining which actions to take if the role specified in the key does not submit
|
|
34
|
-
* @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
|
|
35
|
-
* @param [optionals.ttlSeconds] How long the consensus barrier lasts for.
|
|
36
|
-
* @param [optionals.transparent] If the barrier has `transparent: false`, then only one of the default actions will be sent. If it has `transparent: true` then they are all sent.
|
|
37
|
-
* @param [optionals.allowChannel] Opt into push notifications for this resource. Applicable to projects with phylogeny >= SILENT
|
|
38
|
-
* @returns promise that resolves to the newly created consensus barrier
|
|
39
|
-
*/
|
|
40
|
-
async function create(worldKey, name, stage, expectedRoles, defaultActions, optionals = {}) {
|
|
41
|
-
const {
|
|
42
|
-
ttlSeconds,
|
|
43
|
-
transparent = false,
|
|
44
|
-
allowChannel,
|
|
45
|
-
...routingOptions
|
|
46
|
-
} = optionals;
|
|
47
|
-
return await new Router().post(`/consensus/${worldKey}/${name}/${stage}`, {
|
|
48
|
-
body: {
|
|
49
|
-
expectedRoles,
|
|
50
|
-
ttlSeconds,
|
|
51
|
-
transparent,
|
|
52
|
-
actions: defaultActions,
|
|
53
|
-
allowChannel
|
|
54
|
-
},
|
|
55
|
-
...routingOptions
|
|
56
|
-
}).then(({
|
|
57
|
-
body
|
|
58
|
-
}) => body);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Load one specific consensus barrier by specifying stage
|
|
63
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
67
|
-
* await consensusAdapter.load('00000173078afb05b4ae4c726637167a1a9e', 'SUBMISSIONS', 'ROUND1');
|
|
68
|
-
*
|
|
69
|
-
* @param worldKey World key for the world you are loading a consensus barrier for
|
|
70
|
-
* @param name Unique string that names a set of consensus barriers
|
|
71
|
-
* @param stage Unique string to specify which specific barrier to load
|
|
72
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
73
|
-
* @returns promise that resolves to the consensus barrier
|
|
74
|
-
*/
|
|
75
|
-
async function load(worldKey, name, stage, optionals = {}) {
|
|
76
|
-
return await new Router().get(`/consensus/${worldKey}/${name}/${stage}`, optionals).then(({
|
|
77
|
-
body
|
|
78
|
-
}) => body);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* List all consensus barriers sharing the same name
|
|
83
|
-
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/{WORLD_KEY}/{NAME}`
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
87
|
-
* await consensusAdapter.list('00000173078afb05b4ae4c726637167a1a9e', 'SUBMISSIONS');
|
|
88
|
-
*
|
|
89
|
-
* @param worldKey World key for the world you are loading consensus barriers for
|
|
90
|
-
* @param name Unique string that specifies which set of consensus barriers to retrieve
|
|
91
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
92
|
-
* @returns promise that resolves to a list of consensus barriers
|
|
93
|
-
*/
|
|
94
|
-
async function list(worldKey, name, optionals = {}) {
|
|
95
|
-
return await new Router().get(`/consensus/${worldKey}/${name}`, optionals).then(({
|
|
96
|
-
body
|
|
97
|
-
}) => body);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Facilitator only. Marks current consensus barrier as complete. Closing the barrier will send default actions for anyone who has not arrived. If the barrier is opaque, then only one of the default actions will be sent, and if it's transparent then they are all sent
|
|
102
|
-
* Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/close/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
106
|
-
* await consensusAdapter.forceClose('00000173078afb05b4ae4c726637167a1a9e', 'SUBMISSIONS', 'ROUND1');
|
|
107
|
-
*
|
|
108
|
-
* @param worldKey World key for the world you are making a consensus barrier for
|
|
109
|
-
* @param name Unique string that names a set of consensus barriers
|
|
110
|
-
* @param stage Unique string that specifies which stage of the set of consensus barriers to close
|
|
111
|
-
* @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
|
|
112
|
-
* @param [optionals.ritual] Ritual type for processing the consensus actions
|
|
113
|
-
* @returns promise that resolves to the response
|
|
114
|
-
*/
|
|
115
|
-
async function forceClose(worldKey, name, stage, optionals = {}) {
|
|
116
|
-
const {
|
|
117
|
-
ritual,
|
|
118
|
-
...routingOptions
|
|
119
|
-
} = optionals;
|
|
120
|
-
return await new Router().post(`/consensus/close/${worldKey}/${name}/${stage}`, {
|
|
121
|
-
body: {
|
|
122
|
-
ritual
|
|
123
|
-
},
|
|
124
|
-
...routingOptions
|
|
125
|
-
}).then(({
|
|
126
|
-
body
|
|
127
|
-
}) => body);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Updates the default actions defined in .create. A user can only update their own default actions, and this call will only work for a barrier that has `transparent: true`
|
|
132
|
-
* Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/actions/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
136
|
-
* await consensusAdapter.updateDefaults(
|
|
137
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
138
|
-
* 'SUBMISSIONS',
|
|
139
|
-
* 'ROUND1',
|
|
140
|
-
* [{ name: 'var1', value: 100, objectType: 'set' }]
|
|
141
|
-
* );
|
|
142
|
-
*
|
|
143
|
-
* @param worldKey World key for the world you are making a consensus barrier for
|
|
144
|
-
* @param name Unique string to name a set of consensus barriers
|
|
145
|
-
* @param stage Unique string to name one stage of the set of consensus barriers
|
|
146
|
-
* @param actions List of objects describing the default actions to update for the current user
|
|
147
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
148
|
-
* @returns promise that resolves to the updated consensus barrier
|
|
149
|
-
*/
|
|
150
|
-
async function updateDefaults(worldKey, name, stage, actions, optionals = {}) {
|
|
151
|
-
const {
|
|
152
|
-
...routingOptions
|
|
153
|
-
} = optionals;
|
|
154
|
-
return await new Router().patch(`/consensus/actions/${worldKey}/${name}/${stage}`, {
|
|
155
|
-
body: {
|
|
156
|
-
actions
|
|
157
|
-
},
|
|
158
|
-
...routingOptions
|
|
159
|
-
}).then(({
|
|
160
|
-
body
|
|
161
|
-
}) => body);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Submits actions for your turn and marks you as having `submitted`.
|
|
166
|
-
* Note that you can still call operations from the runAdapter directly, but will bypass the consensus requirements.
|
|
167
|
-
* Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/publish/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
171
|
-
* await consensusAdapter.submitActions(
|
|
172
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
173
|
-
* 'SUBMISSIONS',
|
|
174
|
-
* 'ROUND1',
|
|
175
|
-
* [{ name: 'step', arguments: [] }],
|
|
176
|
-
* { message: 'Student side submission!' },
|
|
177
|
-
* );
|
|
178
|
-
*
|
|
179
|
-
* @param worldKey World key for the world you are making a consensus barrier for
|
|
180
|
-
* @param name Unique string to name a set of consensus barriers
|
|
181
|
-
* @param stage Unique string to name one stage of the set of consensus barriers
|
|
182
|
-
* @param actions List of objects describing the actions to send
|
|
183
|
-
* @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
|
|
184
|
-
* @param [optionals.message] Message that is stored in the barrier arrival entity; opportunity to note a description regarding this submission
|
|
185
|
-
* @param [optionals.ritual] Ritual type for processing the consensus actions
|
|
186
|
-
* @returns promise that resolves to the response. Note: the response consensus object will have `triggered: true` for the final user that submits and triggers the barrier. triggered is a virtual field, not stored in the database as part of the barrier entity, so it only appears in the response for the final user submitting
|
|
187
|
-
*/
|
|
188
|
-
async function submitActions(worldKey, name, stage, actions, optionals = {}) {
|
|
189
|
-
const {
|
|
190
|
-
message,
|
|
191
|
-
ritual,
|
|
192
|
-
...routingOptions
|
|
193
|
-
} = optionals;
|
|
194
|
-
return await new Router().post(`/consensus/publish/${worldKey}/${name}/${stage}`, {
|
|
195
|
-
body: {
|
|
196
|
-
ritual,
|
|
197
|
-
actions,
|
|
198
|
-
message
|
|
199
|
-
},
|
|
200
|
-
...routingOptions
|
|
201
|
-
}).then(({
|
|
202
|
-
body
|
|
203
|
-
}) => body);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Deletes the targeted barrier, which allows users to create a new barrier with the same name and stage
|
|
208
|
-
* Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
209
|
-
*
|
|
210
|
-
* @example
|
|
211
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
212
|
-
* await consensusAdapter.deleteBarrier(
|
|
213
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
214
|
-
* 'SUBMISSIONS',
|
|
215
|
-
* 'ROUND1',
|
|
216
|
-
* );
|
|
217
|
-
*
|
|
218
|
-
* @param worldKey World key for the world you are targeting
|
|
219
|
-
* @param name Unique string that names a set of consensus barriers
|
|
220
|
-
* @param stage Unique string to specify which specific barrier to delete
|
|
221
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
222
|
-
* @returns promise that resolves to the deleted consensus barrier
|
|
223
|
-
*/
|
|
224
|
-
async function deleteBarrier(worldKey, name, stage, optionals = {}) {
|
|
225
|
-
const {
|
|
226
|
-
...routingOptions
|
|
227
|
-
} = optionals;
|
|
228
|
-
return await new Router().delete(`/consensus/${worldKey}/${name}/${stage}`, {
|
|
229
|
-
...routingOptions
|
|
230
|
-
}).then(({
|
|
231
|
-
body
|
|
232
|
-
}) => body);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Deletes all barriers under the same name, which allows users to create new barriers with the same name and stage
|
|
237
|
-
* Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/{WORLD_KEY}/{NAME}`
|
|
238
|
-
*
|
|
239
|
-
* @example
|
|
240
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
241
|
-
* await consensusAdapter.deleteAll(
|
|
242
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
243
|
-
* 'SUBMISSIONS',
|
|
244
|
-
* );
|
|
245
|
-
*
|
|
246
|
-
* @param worldKey World key for the world you are targeting
|
|
247
|
-
* @param name Unique string that names a set of consensus barriers
|
|
248
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
249
|
-
* @returns promise that resolves to the deleted consensus barriers
|
|
250
|
-
*/
|
|
251
|
-
async function deleteAll(worldKey, name, optionals = {}) {
|
|
252
|
-
const {
|
|
253
|
-
...routingOptions
|
|
254
|
-
} = optionals;
|
|
255
|
-
return await new Router().delete(`/consensus/${worldKey}/${name}`, {
|
|
256
|
-
...routingOptions
|
|
257
|
-
}).then(({
|
|
258
|
-
body
|
|
259
|
-
}) => body);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Removes the currently logged in user from the list of users that have arrived at this barrier, thus allowing the user to redo their submission.
|
|
264
|
-
* Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/arrival/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
265
|
-
*
|
|
266
|
-
* @example
|
|
267
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
268
|
-
* await consensusAdapter.undoSubmit(
|
|
269
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
270
|
-
* 'SUBMISSIONS',
|
|
271
|
-
* 'ROUND1',
|
|
272
|
-
* );
|
|
273
|
-
*
|
|
274
|
-
* @param worldKey World key for the world you are targeting
|
|
275
|
-
* @param name Unique string that names a set of consensus barriers
|
|
276
|
-
* @param stage Unique string to specify which specific barrier to undo your submission for
|
|
277
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
278
|
-
* @returns promise that resolves to the updated consensus barrier
|
|
279
|
-
*/
|
|
280
|
-
async function undoSubmit(worldKey, name, stage, optionals = {}) {
|
|
281
|
-
const {
|
|
282
|
-
...routingOptions
|
|
283
|
-
} = optionals;
|
|
284
|
-
return await new Router().delete(`/consensus/arrival/${worldKey}/${name}/${stage}`, {
|
|
285
|
-
...routingOptions
|
|
286
|
-
}).then(({
|
|
287
|
-
body
|
|
288
|
-
}) => body);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Facilitator only; artificial triggering of the arrival of a participant to the barrier. Useful for testing or for missing participants
|
|
293
|
-
* Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/trigger/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
294
|
-
*
|
|
295
|
-
* @example
|
|
296
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
297
|
-
* await consensusAdapter.triggerFor(
|
|
298
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
299
|
-
* 'SUBMISSIONS',
|
|
300
|
-
* 'ROUND1',
|
|
301
|
-
* '0000017cb60ad697e109dcb11cdd4cfcdd1d',
|
|
302
|
-
* [{ name: 'step', arguments: [] }],
|
|
303
|
-
* { message: 'Facilitator triggered this submission!' },
|
|
304
|
-
* );
|
|
305
|
-
*
|
|
306
|
-
* @param worldKey World key for the world you are targeting
|
|
307
|
-
* @param name Unique string that names this set of consensus barriers
|
|
308
|
-
* @param stage Unique string that names the stage of targeted barrier
|
|
309
|
-
* @param userKey userKey of the user the facilitator is triggering for
|
|
310
|
-
* @param actions List of objects describing the actions to send for the specified user
|
|
311
|
-
* @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
|
|
312
|
-
* @param [optionals.message] Message that is stored in the barrier arrival entity; opportunity to note a description regarding this submission
|
|
313
|
-
* @param [optionals.ritual] Ritual type for processing the consensus actions
|
|
314
|
-
* @returns promise that resolves to the response
|
|
315
|
-
*/
|
|
316
|
-
async function triggerFor(worldKey, name, stage, userKey, actions, optionals = {}) {
|
|
317
|
-
const {
|
|
318
|
-
ritual,
|
|
319
|
-
message,
|
|
320
|
-
...routingOptions
|
|
321
|
-
} = optionals;
|
|
322
|
-
return await new Router().post(`/consensus/trigger/${worldKey}/${name}/${stage}`, {
|
|
323
|
-
body: {
|
|
324
|
-
ritual,
|
|
325
|
-
userKey,
|
|
326
|
-
message,
|
|
327
|
-
actions
|
|
328
|
-
},
|
|
329
|
-
...routingOptions
|
|
330
|
-
}).then(({
|
|
331
|
-
body
|
|
332
|
-
}) => body);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Facilitator only; removes the specified user from the list of users that have arrived at this barrier, thus allowing the user to redo their submission. This only removes the arrival, not the role expectation.
|
|
337
|
-
* Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/untrigger/{WORLD_KEY}/{NAME}/{STAGE}/{USER_KEY}`
|
|
338
|
-
*
|
|
339
|
-
* @example
|
|
340
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
341
|
-
* await consensusAdapter.undoSubmitFor(
|
|
342
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
343
|
-
* 'SUBMISSIONS',
|
|
344
|
-
* 'ROUND1',
|
|
345
|
-
* '0000017cb60ad697e109dcb11cdd4cfcdd1d',
|
|
346
|
-
* );
|
|
347
|
-
*
|
|
348
|
-
* @param worldKey World key for the world you are targeting
|
|
349
|
-
* @param name Unique string that names a set of consensus barriers
|
|
350
|
-
* @param stage Unique string to specify which specific barrier to undo submission for
|
|
351
|
-
* @param userKey userKey of the user the facilitator is undoing the submit for
|
|
352
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
353
|
-
* @returns promise that resolves to undefined if successful
|
|
354
|
-
*/
|
|
355
|
-
async function undoSubmitFor(worldKey, name, stage, userKey, optionals = {}) {
|
|
356
|
-
const {
|
|
357
|
-
...routingOptions
|
|
358
|
-
} = optionals;
|
|
359
|
-
return await new Router().delete(`/consensus/untrigger/${worldKey}/${name}/${stage}/${userKey}`, {
|
|
360
|
-
...routingOptions
|
|
361
|
-
}).then(({
|
|
362
|
-
body
|
|
363
|
-
}) => body);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Facilitator only; removes the entire role expectation from the consensus barrier based on the specified user's role assignment. This removes the expectation for that role and also removes any arrivals for that user. This is a structural change that affects all users with that role - the barrier will no longer wait for anyone with that role to submit.
|
|
368
|
-
* Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/expectation/{WORLD_KEY}/{NAME}/{STAGE}/{USER_KEY}`
|
|
369
|
-
*
|
|
370
|
-
* @example
|
|
371
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
372
|
-
* await consensusAdapter.removeRoleExpectationFor(
|
|
373
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
374
|
-
* 'SUBMISSIONS',
|
|
375
|
-
* 'ROUND1',
|
|
376
|
-
* '0000017cb60ad697e109dcb11cdd4cfcdd1d',
|
|
377
|
-
* );
|
|
378
|
-
*
|
|
379
|
-
* @param worldKey World key for the world you are targeting
|
|
380
|
-
* @param name Unique string that names a set of consensus barriers
|
|
381
|
-
* @param stage Unique string to specify which specific barrier to remove the role expectation from
|
|
382
|
-
* @param userKey userKey of a user whose role will be completely removed from the barrier expectations
|
|
383
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
384
|
-
* @returns promise that resolves to undefined if successful
|
|
385
|
-
*/
|
|
386
|
-
async function removeRoleExpectationFor(worldKey, name, stage, userKey, optionals = {}) {
|
|
387
|
-
return await new Router().delete(`/consensus/expectation/${worldKey}/${name}/${stage}/${userKey}`, optionals).then(({
|
|
388
|
-
body
|
|
389
|
-
}) => body);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Pauses the TTL countdown timer for a timed consensus barrier. When paused, the timer stops counting down and the remaining time is preserved. Only works for barriers that have a ttlSeconds value set.
|
|
394
|
-
* Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/pause/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
395
|
-
*
|
|
396
|
-
* @example
|
|
397
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
398
|
-
* await consensusAdapter.pause(
|
|
399
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
400
|
-
* 'SUBMISSIONS',
|
|
401
|
-
* 'ROUND1',
|
|
402
|
-
* );
|
|
403
|
-
*
|
|
404
|
-
* @param worldKey World key for the world you are targeting
|
|
405
|
-
* @param name Unique string that names a set of consensus barriers
|
|
406
|
-
* @param stage Unique string to specify which specific barrier to pause
|
|
407
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
408
|
-
* @returns promise that resolves to the updated consensus barrier
|
|
409
|
-
*/
|
|
410
|
-
async function pause(worldKey, name, stage, optionals = {}) {
|
|
411
|
-
return await new Router().patch(`/consensus/pause/${worldKey}/${name}/${stage}`, {
|
|
412
|
-
body: {
|
|
413
|
-
resume: false
|
|
414
|
-
},
|
|
415
|
-
...optionals
|
|
416
|
-
}).then(({
|
|
417
|
-
body
|
|
418
|
-
}) => body);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Resumes the TTL countdown timer for a paused consensus barrier. The timer continues from where it was paused. Only works for barriers that were previously paused.
|
|
423
|
-
* Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/pause/{WORLD_KEY}/{NAME}/{STAGE}`
|
|
424
|
-
*
|
|
425
|
-
* @example
|
|
426
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
427
|
-
* await consensusAdapter.resume(
|
|
428
|
-
* '00000173078afb05b4ae4c726637167a1a9e',
|
|
429
|
-
* 'SUBMISSIONS',
|
|
430
|
-
* 'ROUND1',
|
|
431
|
-
* );
|
|
432
|
-
*
|
|
433
|
-
* @param worldKey World key for the world you are targeting
|
|
434
|
-
* @param name Unique string that names a set of consensus barriers
|
|
435
|
-
* @param stage Unique string to specify which specific barrier to resume
|
|
436
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
437
|
-
* @returns promise that resolves to the updated consensus barrier
|
|
438
|
-
*/
|
|
439
|
-
async function resume(worldKey, name, stage, optionals = {}) {
|
|
440
|
-
return await new Router().patch(`/consensus/pause/${worldKey}/${name}/${stage}`, {
|
|
441
|
-
body: {
|
|
442
|
-
resume: true
|
|
443
|
-
},
|
|
444
|
-
...optionals
|
|
445
|
-
}).then(({
|
|
446
|
-
body
|
|
447
|
-
}) => body);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* Facilitator only; retrieves multiple consensus barriers across multiple worlds within a group or episode. This allows you to efficiently check the status of barriers across all specified worlds in a single API call.
|
|
452
|
-
* Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/in/{GROUP_NAME}` or POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/consensus/in/{GROUP_NAME}/{EPISODE_NAME}`
|
|
453
|
-
*
|
|
454
|
-
* @example
|
|
455
|
-
* import { consensusAdapter } from 'epicenter-libs';
|
|
456
|
-
* const barriers = await consensusAdapter.collectInGroup(
|
|
457
|
-
* {
|
|
458
|
-
* '00000173078afb05b4ae4c726637167a1a9e': { name: 'SUBMISSIONS', stage: 'ROUND1' },
|
|
459
|
-
* '00000173078afb05b4ae4c726637167a1b2f': { name: 'SUBMISSIONS', stage: 'ROUND1' },
|
|
460
|
-
* },
|
|
461
|
-
* 'my-group-name',
|
|
462
|
-
* { episodeName: 'my-episode-name' }
|
|
463
|
-
* );
|
|
464
|
-
*
|
|
465
|
-
* @param barrierMap Map of world keys to barrier name/stage pairs
|
|
466
|
-
* @param groupName Name of the group to collect barriers from
|
|
467
|
-
* @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
|
|
468
|
-
* @param [optionals.episodeName] Name of the episode to collect barriers from (optional)
|
|
469
|
-
* @returns promise that resolves to an array of consensus barriers
|
|
470
|
-
*/
|
|
471
|
-
async function collectInGroup(barrierMap, groupName, optionals = {}) {
|
|
472
|
-
const {
|
|
473
|
-
episodeName,
|
|
474
|
-
...routingOptions
|
|
475
|
-
} = optionals;
|
|
476
|
-
return await new Router().post(`/consensus/in/${groupName}${episodeName ? `/${episodeName}` : ''}`, {
|
|
477
|
-
body: barrierMap,
|
|
478
|
-
...routingOptions
|
|
479
|
-
}).then(({
|
|
480
|
-
body
|
|
481
|
-
}) => body);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
export { collectInGroup, create, deleteAll, deleteBarrier, forceClose, list, load, pause, removeRoleExpectationFor, resume, submitActions, triggerFor, undoSubmit, undoSubmitFor, updateDefaults };
|