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
@@ -3107,6 +3107,17 @@ class Identification {
3107
3107
  }
3108
3108
  }
3109
3109
 
3110
+ setSessionWithOptions(session, forcePathInclusion) {
3111
+ const Store = this.getStore();
3112
+ const options = this.getStoreOptions(session, forcePathInclusion);
3113
+
3114
+ if (session) {
3115
+ new Store(options).setItem(SESSION_KEY, session);
3116
+ } else if (this.session) {
3117
+ new Store(options).removeItem(SESSION_KEY);
3118
+ }
3119
+ }
3120
+
3110
3121
  getStore() {
3111
3122
  if (isNode()) return NodeStore;
3112
3123
 
@@ -3122,7 +3133,7 @@ class Identification {
3122
3133
  /* Generates the appropriate path for storing your session (applicable only to cookies) */
3123
3134
 
3124
3135
 
3125
- getStoreOptions(session) {
3136
+ getStoreOptions(session, forcePathInclusion) {
3126
3137
  const mySession = session || this.session;
3127
3138
  if (!mySession || isNode()) return '';
3128
3139
  const {
@@ -3136,7 +3147,7 @@ class Identification {
3136
3147
  const isCustomDomain = !isLocal && window.location.pathname.split('/')[1] !== 'app';
3137
3148
  const isEpicenterDomain = !isLocal && !isCustomDomain;
3138
3149
 
3139
- if (objectType === 'user' && isEpicenterDomain) {
3150
+ if ((objectType === 'user' || forcePathInclusion) && isEpicenterDomain) {
3140
3151
  const {
3141
3152
  accountShortName,
3142
3153
  projectShortName
@@ -4057,9 +4068,9 @@ class CometdAdapter {
4057
4068
  const channelProtocol = ((_project$channelProto = project.channelProtocol) === null || _project$channelProto === void 0 ? void 0 : _project$channelProto.toLowerCase()) || DEFAULT_CHANNEL_PROTOCOL;
4058
4069
  const {
4059
4070
  CometD
4060
- } = await Promise.resolve().then(function () { return require('./cometd-6cb7a959.js'); }).then(function (n) { return n.cometd; });
4061
- const AckExtension = (await Promise.resolve().then(function () { return require('./AckExtension-c498d906.js'); }).then(function (n) { return n.AckExtension; })).default;
4062
- const ReloadExtension = (await Promise.resolve().then(function () { return require('./ReloadExtension-f9cee875.js'); }).then(function (n) { return n.ReloadExtension; })).default;
4071
+ } = await Promise.resolve().then(function () { return require('./cometd-bb7d98a6.js'); }).then(function (n) { return n.cometd; });
4072
+ const AckExtension = (await Promise.resolve().then(function () { return require('./AckExtension-da9f05ef.js'); }).then(function (n) { return n.AckExtension; })).default;
4073
+ const ReloadExtension = (await Promise.resolve().then(function () { return require('./ReloadExtension-72077f71.js'); }).then(function (n) { return n.ReloadExtension; })).default;
4063
4074
  this.cometd = new CometD();
4064
4075
  const {
4065
4076
  apiProtocol,
@@ -4433,10 +4444,14 @@ function setLocalSession(session) {
4433
4444
  async function removeLocalSession() {
4434
4445
  identification.session = undefined;
4435
4446
  await cometdAdapter.disconnect();
4436
- }
4447
+ } // forcePathInclusion should be used to force an admin login to include the path in the generated cookie
4448
+ // use cases for this include when an admin login should be limited in scope to a single project
4449
+ // this prevents login issues when trying to access other simulations
4450
+
4437
4451
  async function login(credentials, optionals = {}) {
4438
4452
  const {
4439
4453
  objectType,
4454
+ forcePathInclusion,
4440
4455
  ...routingOptions
4441
4456
  } = optionals;
4442
4457
  let payload;
@@ -4474,7 +4489,7 @@ async function login(credentials, optionals = {}) {
4474
4489
  body
4475
4490
  }) => body);
4476
4491
  await removeLocalSession();
4477
- identification.session = session;
4492
+ identification.setSessionWithOptions(session, forcePathInclusion !== null && forcePathInclusion !== void 0 ? forcePathInclusion : false);
4478
4493
  return session;
4479
4494
  }
4480
4495
  /**
@@ -4494,6 +4509,7 @@ async function regenerate(groupOrAccount, optionals = {}) {
4494
4509
  const {
4495
4510
  objectType = 'user',
4496
4511
  accountShortName,
4512
+ forcePathInclusion,
4497
4513
  ...routingOptions
4498
4514
  } = optionals;
4499
4515
  const session = await new Router().patch('/authentication', {
@@ -4507,7 +4523,7 @@ async function regenerate(groupOrAccount, optionals = {}) {
4507
4523
  body
4508
4524
  }) => body);
4509
4525
  await removeLocalSession();
4510
- identification.session = session;
4526
+ identification.setSessionWithOptions(session, forcePathInclusion !== null && forcePathInclusion !== void 0 ? forcePathInclusion : false);
4511
4527
  return session;
4512
4528
  }
4513
4529
  async function sso(optionals = {}) {
@@ -4931,19 +4947,22 @@ var email = /*#__PURE__*/Object.freeze({
4931
4947
  * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
4932
4948
  * @param [optionals.draft] Flag to indicate the episode is a draft (intended when used for settings scoping)
4933
4949
  * @param [optionals.runLimit] Optional argument to define the number of runs that can be made using this episode as the scope
4950
+ * @param [optionals.category] Optional argument to allow for establishing episode hierarchies
4934
4951
  * @returns promise that resolves to the newly created episode
4935
4952
  */
4936
4953
  async function create$9(name, groupName, optionals = {}) {
4937
4954
  const {
4938
4955
  draft,
4939
4956
  runLimit,
4957
+ category,
4940
4958
  ...routingOptions
4941
4959
  } = optionals;
4942
4960
  return await new Router().post("/episode/".concat(groupName), {
4943
4961
  body: {
4944
4962
  name,
4945
4963
  draft,
4946
- runLimit
4964
+ runLimit,
4965
+ category
4947
4966
  },
4948
4967
  ...routingOptions
4949
4968
  }).then(({
@@ -6678,7 +6697,7 @@ async function update$2(vaultKey, items, optionals = {}) {
6678
6697
  ...routingOptions
6679
6698
  } = optionals;
6680
6699
  return await new Router().withSearchParams({
6681
- MutationKey: mutationKey
6700
+ mutationKey: mutationKey
6682
6701
  }).put("/vault/".concat(vaultKey), {
6683
6702
  body: {
6684
6703
  set: (_items$set = items.set) !== null && _items$set !== void 0 ? _items$set : {},
@@ -6741,7 +6760,7 @@ async function remove$1(vaultKey, optionals = {}) {
6741
6760
  ...routingOptions
6742
6761
  } = optionals;
6743
6762
  return await new Router().withSearchParams({
6744
- MutationKey: mutationKey
6763
+ mutationKey: mutationKey
6745
6764
  }).delete("/vault/".concat(vaultKey), routingOptions).then(({
6746
6765
  body
6747
6766
  }) => body);
@@ -9265,9 +9284,9 @@ var utilities = /*#__PURE__*/Object.freeze({
9265
9284
  });
9266
9285
 
9267
9286
  /* yes, this string template literal is weird;
9268
- * it's cause rollup does not recogize 3.27.2 as an individual token otherwise */
9287
+ * it's cause rollup does not recogize 3.28.0 as an individual token otherwise */
9269
9288
 
9270
- const version = "Epicenter (v".concat('3.27.2', ") for Module | Build Date: 2024-06-20T23:39:57.667Z");
9289
+ const version = "Epicenter (v".concat('3.28.0', ") for Module | Build Date: 2024-07-24T21:07:46.629Z");
9271
9290
  const UNAUTHORIZED = 401;
9272
9291
  const FORBIDDEN = 403;
9273
9292
  const DEFAULT_ERROR_HANDLERS = {};
@@ -9359,4 +9378,4 @@ exports.vonage = vonage;
9359
9378
  exports.vonage$1 = vonage$1;
9360
9379
  exports.wallet = wallet;
9361
9380
  exports.world = world;
9362
- //# sourceMappingURL=epicenter-216aaf73.js.map
9381
+ //# sourceMappingURL=epicenter-52f23ee7.js.map