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
@@ -3097,6 +3097,17 @@ class Identification {
3097
3097
  }
3098
3098
  }
3099
3099
 
3100
+ setSessionWithOptions(session, forcePathInclusion) {
3101
+ const Store = this.getStore();
3102
+ const options = this.getStoreOptions(session, forcePathInclusion);
3103
+
3104
+ if (session) {
3105
+ new Store(options).setItem(SESSION_KEY, session);
3106
+ } else if (this.session) {
3107
+ new Store(options).removeItem(SESSION_KEY);
3108
+ }
3109
+ }
3110
+
3100
3111
  getStore() {
3101
3112
  if (isNode()) return NodeStore;
3102
3113
 
@@ -3112,7 +3123,7 @@ class Identification {
3112
3123
  /* Generates the appropriate path for storing your session (applicable only to cookies) */
3113
3124
 
3114
3125
 
3115
- getStoreOptions(session) {
3126
+ getStoreOptions(session, forcePathInclusion) {
3116
3127
  const mySession = session || this.session;
3117
3128
  if (!mySession || isNode()) return '';
3118
3129
  const {
@@ -3126,7 +3137,7 @@ class Identification {
3126
3137
  const isCustomDomain = !isLocal && window.location.pathname.split('/')[1] !== 'app';
3127
3138
  const isEpicenterDomain = !isLocal && !isCustomDomain;
3128
3139
 
3129
- if (objectType === 'user' && isEpicenterDomain) {
3140
+ if ((objectType === 'user' || forcePathInclusion) && isEpicenterDomain) {
3130
3141
  const {
3131
3142
  accountShortName,
3132
3143
  projectShortName
@@ -4047,9 +4058,9 @@ class CometdAdapter {
4047
4058
  const channelProtocol = ((_project$channelProto = project.channelProtocol) === null || _project$channelProto === void 0 ? void 0 : _project$channelProto.toLowerCase()) || DEFAULT_CHANNEL_PROTOCOL;
4048
4059
  const {
4049
4060
  CometD
4050
- } = await import('./cometd-ab539345.js').then(function (n) { return n.c; });
4051
- const AckExtension = (await import('./AckExtension-6ecead0e.js').then(function (n) { return n.A; })).default;
4052
- const ReloadExtension = (await import('./ReloadExtension-5c5fac92.js').then(function (n) { return n.R; })).default;
4061
+ } = await import('./cometd-8498d64f.js').then(function (n) { return n.c; });
4062
+ const AckExtension = (await import('./AckExtension-755114ce.js').then(function (n) { return n.A; })).default;
4063
+ const ReloadExtension = (await import('./ReloadExtension-22370c97.js').then(function (n) { return n.R; })).default;
4053
4064
  this.cometd = new CometD();
4054
4065
  const {
4055
4066
  apiProtocol,
@@ -4423,10 +4434,14 @@ function setLocalSession(session) {
4423
4434
  async function removeLocalSession() {
4424
4435
  identification.session = undefined;
4425
4436
  await cometdAdapter.disconnect();
4426
- }
4437
+ } // forcePathInclusion should be used to force an admin login to include the path in the generated cookie
4438
+ // use cases for this include when an admin login should be limited in scope to a single project
4439
+ // this prevents login issues when trying to access other simulations
4440
+
4427
4441
  async function login(credentials, optionals = {}) {
4428
4442
  const {
4429
4443
  objectType,
4444
+ forcePathInclusion,
4430
4445
  ...routingOptions
4431
4446
  } = optionals;
4432
4447
  let payload;
@@ -4464,7 +4479,7 @@ async function login(credentials, optionals = {}) {
4464
4479
  body
4465
4480
  }) => body);
4466
4481
  await removeLocalSession();
4467
- identification.session = session;
4482
+ identification.setSessionWithOptions(session, forcePathInclusion !== null && forcePathInclusion !== void 0 ? forcePathInclusion : false);
4468
4483
  return session;
4469
4484
  }
4470
4485
  /**
@@ -4484,6 +4499,7 @@ async function regenerate(groupOrAccount, optionals = {}) {
4484
4499
  const {
4485
4500
  objectType = 'user',
4486
4501
  accountShortName,
4502
+ forcePathInclusion,
4487
4503
  ...routingOptions
4488
4504
  } = optionals;
4489
4505
  const session = await new Router().patch('/authentication', {
@@ -4497,7 +4513,7 @@ async function regenerate(groupOrAccount, optionals = {}) {
4497
4513
  body
4498
4514
  }) => body);
4499
4515
  await removeLocalSession();
4500
- identification.session = session;
4516
+ identification.setSessionWithOptions(session, forcePathInclusion !== null && forcePathInclusion !== void 0 ? forcePathInclusion : false);
4501
4517
  return session;
4502
4518
  }
4503
4519
  async function sso(optionals = {}) {
@@ -4921,19 +4937,22 @@ var email = /*#__PURE__*/Object.freeze({
4921
4937
  * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
4922
4938
  * @param [optionals.draft] Flag to indicate the episode is a draft (intended when used for settings scoping)
4923
4939
  * @param [optionals.runLimit] Optional argument to define the number of runs that can be made using this episode as the scope
4940
+ * @param [optionals.category] Optional argument to allow for establishing episode hierarchies
4924
4941
  * @returns promise that resolves to the newly created episode
4925
4942
  */
4926
4943
  async function create$9(name, groupName, optionals = {}) {
4927
4944
  const {
4928
4945
  draft,
4929
4946
  runLimit,
4947
+ category,
4930
4948
  ...routingOptions
4931
4949
  } = optionals;
4932
4950
  return await new Router().post("/episode/".concat(groupName), {
4933
4951
  body: {
4934
4952
  name,
4935
4953
  draft,
4936
- runLimit
4954
+ runLimit,
4955
+ category
4937
4956
  },
4938
4957
  ...routingOptions
4939
4958
  }).then(({
@@ -6668,7 +6687,7 @@ async function update$2(vaultKey, items, optionals = {}) {
6668
6687
  ...routingOptions
6669
6688
  } = optionals;
6670
6689
  return await new Router().withSearchParams({
6671
- MutationKey: mutationKey
6690
+ mutationKey: mutationKey
6672
6691
  }).put("/vault/".concat(vaultKey), {
6673
6692
  body: {
6674
6693
  set: (_items$set = items.set) !== null && _items$set !== void 0 ? _items$set : {},
@@ -6731,7 +6750,7 @@ async function remove$1(vaultKey, optionals = {}) {
6731
6750
  ...routingOptions
6732
6751
  } = optionals;
6733
6752
  return await new Router().withSearchParams({
6734
- MutationKey: mutationKey
6753
+ mutationKey: mutationKey
6735
6754
  }).delete("/vault/".concat(vaultKey), routingOptions).then(({
6736
6755
  body
6737
6756
  }) => body);
@@ -9255,9 +9274,9 @@ var utilities = /*#__PURE__*/Object.freeze({
9255
9274
  });
9256
9275
 
9257
9276
  /* yes, this string template literal is weird;
9258
- * it's cause rollup does not recogize 3.27.2 as an individual token otherwise */
9277
+ * it's cause rollup does not recogize 3.28.0 as an individual token otherwise */
9259
9278
 
9260
- const version = "Epicenter (v".concat('3.27.2', ") for Module | Build Date: 2024-06-20T23:39:57.667Z");
9279
+ const version = "Epicenter (v".concat('3.28.0', ") for Module | Build Date: 2024-07-24T21:07:46.629Z");
9261
9280
  const UNAUTHORIZED = 401;
9262
9281
  const FORBIDDEN = 403;
9263
9282
  const DEFAULT_ERROR_HANDLERS = {};
@@ -9313,4 +9332,4 @@ DEFAULT_ERROR_HANDLERS.authInvalidated = errorManager.registerHandler(error => e
9313
9332
  Object.freeze(DEFAULT_ERROR_HANDLERS);
9314
9333
 
9315
9334
  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 };
9316
- //# sourceMappingURL=epicenter-4b895c15.js.map
9335
+ //# sourceMappingURL=epicenter-46d3b19d.js.map