epicenter-libs 3.27.2 → 3.28.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 (43) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/browser/{AckExtension-d4aff5b6.js → AckExtension-1fe508aa.js} +3 -3
  3. package/dist/{module/AckExtension-6ecead0e.js.map → browser/AckExtension-1fe508aa.js.map} +1 -1
  4. package/dist/{module/ReloadExtension-5c5fac92.js → browser/ReloadExtension-51e9dfea.js} +3 -3
  5. package/dist/{module/ReloadExtension-5c5fac92.js.map → browser/ReloadExtension-51e9dfea.js.map} +1 -1
  6. package/dist/browser/{cometd-654b33b8.js → cometd-95666f77.js} +2 -2
  7. package/dist/browser/{cometd-654b33b8.js.map → cometd-95666f77.js.map} +1 -1
  8. package/dist/browser/{epicenter-5f3557fe.js → epicenter-53acd5e1.js} +33 -14
  9. package/dist/browser/epicenter-53acd5e1.js.map +1 -0
  10. package/dist/browser/epicenter.js +1 -1
  11. package/dist/cjs/{AckExtension-c498d906.js → AckExtension-da9f05ef.js} +3 -3
  12. package/dist/cjs/{AckExtension-c498d906.js.map → AckExtension-da9f05ef.js.map} +1 -1
  13. package/dist/cjs/{ReloadExtension-f9cee875.js → ReloadExtension-72077f71.js} +3 -3
  14. package/dist/cjs/{ReloadExtension-f9cee875.js.map → ReloadExtension-72077f71.js.map} +1 -1
  15. package/dist/cjs/{cometd-6cb7a959.js → cometd-bb7d98a6.js} +2 -2
  16. package/dist/cjs/{cometd-6cb7a959.js.map → cometd-bb7d98a6.js.map} +1 -1
  17. package/dist/cjs/{epicenter-216aaf73.js → epicenter-52f23ee7.js} +33 -14
  18. package/dist/cjs/epicenter-52f23ee7.js.map +1 -0
  19. package/dist/cjs/epicenter.js +1 -1
  20. package/dist/epicenter.js +29 -10
  21. package/dist/epicenter.js.map +1 -1
  22. package/dist/epicenter.min.js +1 -1
  23. package/dist/epicenter.min.js.map +1 -1
  24. package/dist/module/{AckExtension-6ecead0e.js → AckExtension-755114ce.js} +3 -3
  25. package/dist/{browser/AckExtension-d4aff5b6.js.map → module/AckExtension-755114ce.js.map} +1 -1
  26. package/dist/{browser/ReloadExtension-19c76dd7.js → module/ReloadExtension-22370c97.js} +3 -3
  27. package/dist/{browser/ReloadExtension-19c76dd7.js.map → module/ReloadExtension-22370c97.js.map} +1 -1
  28. package/dist/module/{cometd-ab539345.js → cometd-8498d64f.js} +2 -2
  29. package/dist/module/{cometd-ab539345.js.map → cometd-8498d64f.js.map} +1 -1
  30. package/dist/module/{epicenter-4b895c15.js → epicenter-46d3b19d.js} +33 -14
  31. package/dist/module/epicenter-46d3b19d.js.map +1 -0
  32. package/dist/module/epicenter.js +1 -1
  33. package/dist/types/adapters/authentication.d.ts +2 -0
  34. package/dist/types/adapters/episode.d.ts +2 -0
  35. package/dist/types/utils/identification.d.ts +2 -1
  36. package/package.json +1 -1
  37. package/src/adapters/authentication.ts +9 -4
  38. package/src/adapters/episode.ts +4 -2
  39. package/src/adapters/vault.ts +2 -2
  40. package/src/utils/identification.ts +12 -2
  41. package/dist/browser/epicenter-5f3557fe.js.map +0 -1
  42. package/dist/cjs/epicenter-216aaf73.js.map +0 -1
  43. package/dist/module/epicenter-4b895c15.js.map +0 -1
@@ -1970,6 +1970,17 @@ class Identification {
1970
1970
  }
1971
1971
  }
1972
1972
 
1973
+ setSessionWithOptions(session, forcePathInclusion) {
1974
+ const Store = this.getStore();
1975
+ const options = this.getStoreOptions(session, forcePathInclusion);
1976
+
1977
+ if (session) {
1978
+ new Store(options).setItem(SESSION_KEY, session);
1979
+ } else if (this.session) {
1980
+ new Store(options).removeItem(SESSION_KEY);
1981
+ }
1982
+ }
1983
+
1973
1984
  getStore() {
1974
1985
  if (isNode()) return NodeStore;
1975
1986
 
@@ -1985,7 +1996,7 @@ class Identification {
1985
1996
  /* Generates the appropriate path for storing your session (applicable only to cookies) */
1986
1997
 
1987
1998
 
1988
- getStoreOptions(session) {
1999
+ getStoreOptions(session, forcePathInclusion) {
1989
2000
  const mySession = session || this.session;
1990
2001
  if (!mySession || isNode()) return '';
1991
2002
  const {
@@ -1999,7 +2010,7 @@ class Identification {
1999
2010
  const isCustomDomain = !isLocal && window.location.pathname.split('/')[1] !== 'app';
2000
2011
  const isEpicenterDomain = !isLocal && !isCustomDomain;
2001
2012
 
2002
- if (objectType === 'user' && isEpicenterDomain) {
2013
+ if ((objectType === 'user' || forcePathInclusion) && isEpicenterDomain) {
2003
2014
  const {
2004
2015
  accountShortName,
2005
2016
  projectShortName
@@ -2920,9 +2931,9 @@ class CometdAdapter {
2920
2931
  const channelProtocol = ((_project$channelProto = project.channelProtocol) === null || _project$channelProto === void 0 ? void 0 : _project$channelProto.toLowerCase()) || DEFAULT_CHANNEL_PROTOCOL;
2921
2932
  const {
2922
2933
  CometD
2923
- } = await import('./cometd-654b33b8.js').then(function (n) { return n.c; });
2924
- const AckExtension = (await import('./AckExtension-d4aff5b6.js').then(function (n) { return n.A; })).default;
2925
- const ReloadExtension = (await import('./ReloadExtension-19c76dd7.js').then(function (n) { return n.R; })).default;
2934
+ } = await import('./cometd-95666f77.js').then(function (n) { return n.c; });
2935
+ const AckExtension = (await import('./AckExtension-1fe508aa.js').then(function (n) { return n.A; })).default;
2936
+ const ReloadExtension = (await import('./ReloadExtension-51e9dfea.js').then(function (n) { return n.R; })).default;
2926
2937
  this.cometd = new CometD();
2927
2938
  const {
2928
2939
  apiProtocol,
@@ -3296,10 +3307,14 @@ function setLocalSession(session) {
3296
3307
  async function removeLocalSession() {
3297
3308
  identification.session = undefined;
3298
3309
  await cometdAdapter.disconnect();
3299
- }
3310
+ } // forcePathInclusion should be used to force an admin login to include the path in the generated cookie
3311
+ // use cases for this include when an admin login should be limited in scope to a single project
3312
+ // this prevents login issues when trying to access other simulations
3313
+
3300
3314
  async function login(credentials, optionals = {}) {
3301
3315
  const {
3302
3316
  objectType,
3317
+ forcePathInclusion,
3303
3318
  ...routingOptions
3304
3319
  } = optionals;
3305
3320
  let payload;
@@ -3337,7 +3352,7 @@ async function login(credentials, optionals = {}) {
3337
3352
  body
3338
3353
  }) => body);
3339
3354
  await removeLocalSession();
3340
- identification.session = session;
3355
+ identification.setSessionWithOptions(session, forcePathInclusion !== null && forcePathInclusion !== void 0 ? forcePathInclusion : false);
3341
3356
  return session;
3342
3357
  }
3343
3358
  /**
@@ -3357,6 +3372,7 @@ async function regenerate(groupOrAccount, optionals = {}) {
3357
3372
  const {
3358
3373
  objectType = 'user',
3359
3374
  accountShortName,
3375
+ forcePathInclusion,
3360
3376
  ...routingOptions
3361
3377
  } = optionals;
3362
3378
  const session = await new Router().patch('/authentication', {
@@ -3370,7 +3386,7 @@ async function regenerate(groupOrAccount, optionals = {}) {
3370
3386
  body
3371
3387
  }) => body);
3372
3388
  await removeLocalSession();
3373
- identification.session = session;
3389
+ identification.setSessionWithOptions(session, forcePathInclusion !== null && forcePathInclusion !== void 0 ? forcePathInclusion : false);
3374
3390
  return session;
3375
3391
  }
3376
3392
  async function sso(optionals = {}) {
@@ -3794,19 +3810,22 @@ var email = /*#__PURE__*/Object.freeze({
3794
3810
  * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
3795
3811
  * @param [optionals.draft] Flag to indicate the episode is a draft (intended when used for settings scoping)
3796
3812
  * @param [optionals.runLimit] Optional argument to define the number of runs that can be made using this episode as the scope
3813
+ * @param [optionals.category] Optional argument to allow for establishing episode hierarchies
3797
3814
  * @returns promise that resolves to the newly created episode
3798
3815
  */
3799
3816
  async function create$9(name, groupName, optionals = {}) {
3800
3817
  const {
3801
3818
  draft,
3802
3819
  runLimit,
3820
+ category,
3803
3821
  ...routingOptions
3804
3822
  } = optionals;
3805
3823
  return await new Router().post("/episode/".concat(groupName), {
3806
3824
  body: {
3807
3825
  name,
3808
3826
  draft,
3809
- runLimit
3827
+ runLimit,
3828
+ category
3810
3829
  },
3811
3830
  ...routingOptions
3812
3831
  }).then(({
@@ -5541,7 +5560,7 @@ async function update$2(vaultKey, items, optionals = {}) {
5541
5560
  ...routingOptions
5542
5561
  } = optionals;
5543
5562
  return await new Router().withSearchParams({
5544
- MutationKey: mutationKey
5563
+ mutationKey: mutationKey
5545
5564
  }).put("/vault/".concat(vaultKey), {
5546
5565
  body: {
5547
5566
  set: (_items$set = items.set) !== null && _items$set !== void 0 ? _items$set : {},
@@ -5604,7 +5623,7 @@ async function remove$1(vaultKey, optionals = {}) {
5604
5623
  ...routingOptions
5605
5624
  } = optionals;
5606
5625
  return await new Router().withSearchParams({
5607
- MutationKey: mutationKey
5626
+ mutationKey: mutationKey
5608
5627
  }).delete("/vault/".concat(vaultKey), routingOptions).then(({
5609
5628
  body
5610
5629
  }) => body);
@@ -8128,9 +8147,9 @@ var utilities = /*#__PURE__*/Object.freeze({
8128
8147
  });
8129
8148
 
8130
8149
  /* yes, this string template literal is weird;
8131
- * it's cause rollup does not recogize 3.27.2 as an individual token otherwise */
8150
+ * it's cause rollup does not recogize 3.28.0 as an individual token otherwise */
8132
8151
 
8133
- const version = "Epicenter (v".concat('3.27.2', ") for Browsers | Build Date: 2024-06-20T23:39:51.004Z");
8152
+ const version = "Epicenter (v".concat('3.28.0', ") for Browsers | Build Date: 2024-07-24T21:07:38.530Z");
8134
8153
  const UNAUTHORIZED = 401;
8135
8154
  const FORBIDDEN = 403;
8136
8155
  const DEFAULT_ERROR_HANDLERS = {};
@@ -8186,4 +8205,4 @@ DEFAULT_ERROR_HANDLERS.authInvalidated = errorManager.registerHandler(error => e
8186
8205
  Object.freeze(DEFAULT_ERROR_HANDLERS);
8187
8206
 
8188
8207
  export { video as A, vonage as B, world as C, DEFAULT_ERROR_HANDLERS as D, somebody as E, Fault as F, daily as G, matchmaker as H, wallet as I, Channel as J, video$1 as K, vonage$1 as L, PUSH_CATEGORY as P, RITUAL as R, SCOPE_BOUNDARY as S, commonjsGlobal as a, ROLE as b, createCommonjsModule as c, config as d, errorManager as e, Router as f, account as g, admin as h, asset as i, consensus as j, email as k, authentication as l, chat as m, episode as n, group as o, leaderboard as p, presence as q, project as r, recaptcha as s, run as t, utilities as u, version as v, task as w, time as x, user as y, vault as z };
8189
- //# sourceMappingURL=epicenter-5f3557fe.js.map
8208
+ //# sourceMappingURL=epicenter-53acd5e1.js.map