epicenter-libs 3.28.2 → 3.28.4

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 (39) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/browser/{AckExtension-4ccb1b3b.js → AckExtension-69fee93e.js} +3 -3
  3. package/dist/{module/AckExtension-cd7b3bcb.js.map → browser/AckExtension-69fee93e.js.map} +1 -1
  4. package/dist/{module/ReloadExtension-da4ee10c.js → browser/ReloadExtension-cd6da590.js} +3 -3
  5. package/dist/{module/ReloadExtension-da4ee10c.js.map → browser/ReloadExtension-cd6da590.js.map} +1 -1
  6. package/dist/browser/{cometd-009d1cc7.js → cometd-374faa14.js} +2 -2
  7. package/dist/browser/{cometd-009d1cc7.js.map → cometd-374faa14.js.map} +1 -1
  8. package/dist/browser/{epicenter-ffc2b7a7.js → epicenter-098a70df.js} +50 -20
  9. package/dist/browser/epicenter-098a70df.js.map +1 -0
  10. package/dist/browser/epicenter.js +1 -1
  11. package/dist/cjs/{AckExtension-f8c57030.js → AckExtension-f996f645.js} +3 -3
  12. package/dist/cjs/{AckExtension-f8c57030.js.map → AckExtension-f996f645.js.map} +1 -1
  13. package/dist/cjs/{ReloadExtension-0d52f073.js → ReloadExtension-ae6787ad.js} +3 -3
  14. package/dist/cjs/{ReloadExtension-0d52f073.js.map → ReloadExtension-ae6787ad.js.map} +1 -1
  15. package/dist/cjs/{cometd-369eb10e.js → cometd-ef17c321.js} +2 -2
  16. package/dist/cjs/{cometd-369eb10e.js.map → cometd-ef17c321.js.map} +1 -1
  17. package/dist/cjs/{epicenter-54f0befe.js → epicenter-1208cdb9.js} +50 -20
  18. package/dist/cjs/epicenter-1208cdb9.js.map +1 -0
  19. package/dist/cjs/epicenter.js +1 -1
  20. package/dist/epicenter.js +46 -16
  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-cd7b3bcb.js → AckExtension-38cdc914.js} +3 -3
  25. package/dist/{browser/AckExtension-4ccb1b3b.js.map → module/AckExtension-38cdc914.js.map} +1 -1
  26. package/dist/{browser/ReloadExtension-26e320cf.js → module/ReloadExtension-c0fb4979.js} +3 -3
  27. package/dist/{browser/ReloadExtension-26e320cf.js.map → module/ReloadExtension-c0fb4979.js.map} +1 -1
  28. package/dist/module/{cometd-c640d287.js → cometd-a183e8ac.js} +2 -2
  29. package/dist/module/{cometd-c640d287.js.map → cometd-a183e8ac.js.map} +1 -1
  30. package/dist/module/{epicenter-e4a6d235.js → epicenter-92e49aa6.js} +50 -20
  31. package/dist/module/epicenter-92e49aa6.js.map +1 -0
  32. package/dist/module/epicenter.js +1 -1
  33. package/dist/types/adapters/leaderboard.d.ts +20 -0
  34. package/package.json +1 -1
  35. package/src/adapters/leaderboard.ts +38 -0
  36. package/src/adapters/run.ts +1 -6
  37. package/dist/browser/epicenter-ffc2b7a7.js.map +0 -1
  38. package/dist/cjs/epicenter-54f0befe.js.map +0 -1
  39. package/dist/module/epicenter-e4a6d235.js.map +0 -1
@@ -4066,12 +4066,12 @@ class CometdAdapter {
4066
4066
  const project = await get$d();
4067
4067
  if (!project.channelEnabled) throw new EpicenterError('Push Channels are not enabled on this project');
4068
4068
  const channelProtocol = ((_project$channelProto = project.channelProtocol) === null || _project$channelProto === void 0 ? void 0 : _project$channelProto.toLowerCase()) || DEFAULT_CHANNEL_PROTOCOL;
4069
- const CometDImports = await Promise.resolve().then(function () { return require('./cometd-369eb10e.js'); }).then(function (n) { return n.cometd; });
4069
+ const CometDImports = await Promise.resolve().then(function () { return require('./cometd-ef17c321.js'); }).then(function (n) { return n.cometd; });
4070
4070
  const {
4071
4071
  CometD
4072
4072
  } = CometDImports;
4073
- const AckExtension = (await Promise.resolve().then(function () { return require('./AckExtension-f8c57030.js'); }).then(function (n) { return n.AckExtension; })).default;
4074
- const ReloadExtension = (await Promise.resolve().then(function () { return require('./ReloadExtension-0d52f073.js'); }).then(function (n) { return n.ReloadExtension; })).default;
4073
+ const AckExtension = (await Promise.resolve().then(function () { return require('./AckExtension-f996f645.js'); }).then(function (n) { return n.AckExtension; })).default;
4074
+ const ReloadExtension = (await Promise.resolve().then(function () { return require('./ReloadExtension-ae6787ad.js'); }).then(function (n) { return n.ReloadExtension; })).default;
4075
4075
  this.cometd = new CometD();
4076
4076
  const {
4077
4077
  apiProtocol,
@@ -5786,12 +5786,48 @@ async function get$9(collection, scope, searchOptions, optionals = {}) {
5786
5786
  console.warn('DEPRECATION WARNING: leaderboardAdapter.get is deprecated and will be removed with the next release. Use leaderboardAdapter.list instead.');
5787
5787
  return await list$2(collection, scope, searchOptions, optionals);
5788
5788
  }
5789
+ /**
5790
+ * Returns the total count in the given collection
5791
+ * @example
5792
+ * import { leaderboardAdapter } from 'epicenter-libs';
5793
+ * const leaderboard = await leaderboardAdapter.getCount('myLeaderboard', scope, {
5794
+ * filter: [
5795
+ * 'tag.role=doctor', // look for leaderboard entries tagged with role=doctor
5796
+ * 'score.total>0' // where the users scored a total higher than 0
5797
+ * ],
5798
+ * });
5799
+ * @param collection Name of the leaderboard
5800
+ * @param scope Scope attached to the leaderboard entry; allows for scoping
5801
+ * @param scope.scopeBoundary Can be a couple things, commonly group, project, episode, or world
5802
+ * @param scope.scopeKey Key of the resource defined by the scope boundary
5803
+ * @param searchOptions Search options for the query
5804
+ * @param [searchOptions.filter] Filters for searching
5805
+ * @param [optionals] Optional arguments; pass network call options overrides here.
5806
+ * @returns promise that resolves to the number of entries in hte leaderboard
5807
+ */
5808
+
5809
+ async function getCount(collection, scope, searchOptions, optionals = {}) {
5810
+ const {
5811
+ scopeBoundary,
5812
+ scopeKey
5813
+ } = scope;
5814
+ const {
5815
+ filter = []
5816
+ } = searchOptions;
5817
+ const searchParams = {
5818
+ filter: filter.join(';') || undefined
5819
+ };
5820
+ return await new Router().withSearchParams(searchParams).get("/leaderboard/count/".concat(scopeBoundary, "/").concat(scopeKey, "/").concat(collection), optionals).then(({
5821
+ body
5822
+ }) => body);
5823
+ }
5789
5824
 
5790
5825
  var leaderboard = /*#__PURE__*/Object.freeze({
5791
5826
  __proto__: null,
5792
5827
  update: update$4,
5793
5828
  list: list$2,
5794
- get: get$9
5829
+ get: get$9,
5830
+ getCount: getCount
5795
5831
  });
5796
5832
 
5797
5833
  /**
@@ -6257,22 +6293,21 @@ async function getVariables(runKey, variables, optionals = {}) {
6257
6293
  return variableMap;
6258
6294
  }, {});
6259
6295
 
6260
- const searchParams = {
6261
- timeout
6262
- };
6263
6296
  const uriComponent = hasMultiple ? '' : "/".concat(runKey.length === 1 ? runKey[0] : runKey);
6264
6297
  const include = variables.join(';');
6265
6298
  const body = hasMultiple ? {
6299
+ runKey,
6266
6300
  include,
6267
- runKey
6301
+ timeout
6268
6302
  } : {
6269
6303
  ritual,
6270
- include
6304
+ include,
6305
+ timeout
6271
6306
  };
6272
6307
  const additional = ignorable ? {
6273
6308
  ignorable
6274
6309
  } : {};
6275
- return await new Router().withSearchParams(searchParams).post("/run/variable".concat(uriComponent), {
6310
+ return await new Router().post("/run/variable".concat(uriComponent), {
6276
6311
  body: { ...body,
6277
6312
  ...additional
6278
6313
  },
@@ -6347,17 +6382,12 @@ async function updateVariables(runKey, update, optionals = {}) {
6347
6382
  }) => body);
6348
6383
  }
6349
6384
  async function getMetadata(runKey, metadata, optionals = {}) {
6350
- const {
6351
- timeout,
6352
- ...routingOptions
6385
+ const { ...routingOptions
6353
6386
  } = optionals;
6354
6387
  const include = metadata.join(';');
6355
6388
  const hasMultiple = Array.isArray(runKey) && runKey.length > 1;
6356
- const searchParams = {
6357
- timeout
6358
- };
6359
6389
  const runKeyArg = Array.isArray(runKey) ? runKey : [runKey];
6360
- return await new Router().withSearchParams(searchParams).post('/run/meta', {
6390
+ return await new Router().post('/run/meta', {
6361
6391
  body: {
6362
6392
  include,
6363
6393
  runKey: runKeyArg
@@ -9291,9 +9321,9 @@ var utilities = /*#__PURE__*/Object.freeze({
9291
9321
  });
9292
9322
 
9293
9323
  /* yes, this string template literal is weird;
9294
- * it's cause rollup does not recogize 3.28.1 as an individual token otherwise */
9324
+ * it's cause rollup does not recogize 3.28.4 as an individual token otherwise */
9295
9325
 
9296
- const version = "Epicenter (v".concat('3.28.1', ") for Module | Build Date: 2024-10-18T18:24:22.884Z");
9326
+ const version = "Epicenter (v".concat('3.28.4', ") for Module | Build Date: 2025-01-03T23:48:31.950Z");
9297
9327
  const UNAUTHORIZED = 401;
9298
9328
  const FORBIDDEN = 403;
9299
9329
  const DEFAULT_ERROR_HANDLERS = {};
@@ -9385,4 +9415,4 @@ exports.vonage = vonage;
9385
9415
  exports.vonage$1 = vonage$1;
9386
9416
  exports.wallet = wallet;
9387
9417
  exports.world = world;
9388
- //# sourceMappingURL=epicenter-54f0befe.js.map
9418
+ //# sourceMappingURL=epicenter-1208cdb9.js.map