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
@@ -1,4 +1,4 @@
1
- export { J as Channel, D as DEFAULT_ERROR_HANDLERS, F as Fault, P as PUSH_CATEGORY, R as RITUAL, b as ROLE, f as Router, S as SCOPE_BOUNDARY, g as accountAdapter, h as adminAdapter, i as assetAdapter, l as authAdapter, m as chatAdapter, d as config, j as consensusAdapter, G as dailyAdapter, k as emailAdapter, n as episodeAdapter, e as errorManager, o as groupAdapter, p as leaderboardAdapter, H as matchmakerAdapter, q as presenceAdapter, r as projectAdapter, s as recaptchaAdapter, t as runAdapter, E as somebodyAdapter, w as taskAdapter, x as timeAdapter, y as userAdapter, u as utils, z as vaultAdapter, v as version, K as videoAPI, A as videoAdapter, L as vonageAPI, B as vonageAdapter, I as walletAdapter, C as worldAdapter } from './epicenter-e4a6d235.js';
1
+ export { J as Channel, D as DEFAULT_ERROR_HANDLERS, F as Fault, P as PUSH_CATEGORY, R as RITUAL, b as ROLE, f as Router, S as SCOPE_BOUNDARY, g as accountAdapter, h as adminAdapter, i as assetAdapter, l as authAdapter, m as chatAdapter, d as config, j as consensusAdapter, G as dailyAdapter, k as emailAdapter, n as episodeAdapter, e as errorManager, o as groupAdapter, p as leaderboardAdapter, H as matchmakerAdapter, q as presenceAdapter, r as projectAdapter, s as recaptchaAdapter, t as runAdapter, E as somebodyAdapter, w as taskAdapter, x as timeAdapter, y as userAdapter, u as utils, z as vaultAdapter, v as version, K as videoAPI, A as videoAdapter, L as vonageAPI, B as vonageAdapter, I as walletAdapter, C as worldAdapter } from './epicenter-92e49aa6.js';
2
2
  import 'stream';
3
3
  import 'http';
4
4
  import 'url';
@@ -66,4 +66,24 @@ export declare function update(collection: string, scope: {
66
66
  */
67
67
  export declare function list(collection: string, scope: GenericScope, searchOptions: GenericSearchOptions, optionals?: RoutingOptions): Promise<Leaderboard[]>;
68
68
  export declare function get(collection: string, scope: GenericScope, searchOptions: GenericSearchOptions, optionals?: RoutingOptions): Promise<Leaderboard[]>;
69
+ /**
70
+ * Returns the total count in the given collection
71
+ * @example
72
+ * import { leaderboardAdapter } from 'epicenter-libs';
73
+ * const leaderboard = await leaderboardAdapter.getCount('myLeaderboard', scope, {
74
+ * filter: [
75
+ * 'tag.role=doctor', // look for leaderboard entries tagged with role=doctor
76
+ * 'score.total>0' // where the users scored a total higher than 0
77
+ * ],
78
+ * });
79
+ * @param collection Name of the leaderboard
80
+ * @param scope Scope attached to the leaderboard entry; allows for scoping
81
+ * @param scope.scopeBoundary Can be a couple things, commonly group, project, episode, or world
82
+ * @param scope.scopeKey Key of the resource defined by the scope boundary
83
+ * @param searchOptions Search options for the query
84
+ * @param [searchOptions.filter] Filters for searching
85
+ * @param [optionals] Optional arguments; pass network call options overrides here.
86
+ * @returns promise that resolves to the number of entries in hte leaderboard
87
+ */
88
+ export declare function getCount(collection: string, scope: GenericScope, searchOptions: GenericSearchOptions, optionals?: RoutingOptions): Promise<number>;
69
89
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epicenter-libs",
3
- "version": "3.28.2",
3
+ "version": "3.28.4",
4
4
  "main": "dist/cjs/epicenter.js",
5
5
  "module": "dist/module/epicenter.js",
6
6
  "browser": "dist/browser/epicenter.js",
@@ -124,4 +124,42 @@ export async function get(
124
124
  ): Promise<Leaderboard[]> {
125
125
  console.warn('DEPRECATION WARNING: leaderboardAdapter.get is deprecated and will be removed with the next release. Use leaderboardAdapter.list instead.');
126
126
  return await list(collection, scope, searchOptions, optionals);
127
+ }
128
+
129
+
130
+ /**
131
+ * Returns the total count in the given collection
132
+ * @example
133
+ * import { leaderboardAdapter } from 'epicenter-libs';
134
+ * const leaderboard = await leaderboardAdapter.getCount('myLeaderboard', scope, {
135
+ * filter: [
136
+ * 'tag.role=doctor', // look for leaderboard entries tagged with role=doctor
137
+ * 'score.total>0' // where the users scored a total higher than 0
138
+ * ],
139
+ * });
140
+ * @param collection Name of the leaderboard
141
+ * @param scope Scope attached to the leaderboard entry; allows for scoping
142
+ * @param scope.scopeBoundary Can be a couple things, commonly group, project, episode, or world
143
+ * @param scope.scopeKey Key of the resource defined by the scope boundary
144
+ * @param searchOptions Search options for the query
145
+ * @param [searchOptions.filter] Filters for searching
146
+ * @param [optionals] Optional arguments; pass network call options overrides here.
147
+ * @returns promise that resolves to the number of entries in hte leaderboard
148
+ */
149
+ export async function getCount(
150
+ collection: string,
151
+ scope: GenericScope,
152
+ searchOptions: GenericSearchOptions,
153
+ optionals: RoutingOptions = {}
154
+ ): Promise<number> {
155
+ const { scopeBoundary, scopeKey } = scope;
156
+ const { filter = [] } = searchOptions;
157
+ const searchParams = {
158
+ filter: filter.join(';') || undefined,
159
+ };
160
+
161
+ return await new Router()
162
+ .withSearchParams(searchParams)
163
+ .get(`/leaderboard/count/${scopeBoundary}/${scopeKey}/${collection}`, optionals)
164
+ .then(({ body }) => body);
127
165
  }
@@ -505,13 +505,11 @@ export async function getVariables(
505
505
  return variableMap;
506
506
  }, {} as Record<string, unknown>);
507
507
 
508
- const searchParams = { timeout };
509
508
  const uriComponent = hasMultiple ? '' : `/${runKey.length === 1 ? runKey[0] : runKey}`;
510
509
  const include = variables.join(';');
511
- const body = hasMultiple ? { include, runKey } : { ritual, include };
510
+ const body = hasMultiple ? { runKey, include, timeout } : { ritual, include, timeout };
512
511
  const additional = ignorable ? { ignorable } : {};
513
512
  return await new Router()
514
- .withSearchParams(searchParams)
515
513
  .post(`/run/variable${uriComponent}`, {
516
514
  body: {
517
515
  ...body,
@@ -601,16 +599,13 @@ export async function getMetadata(
601
599
  } & RoutingOptions = {}
602
600
  ): Promise<Record<string, unknown>> {
603
601
  const {
604
- timeout,
605
602
  ...routingOptions
606
603
  } = optionals;
607
604
  const include = metadata.join(';');
608
605
  const hasMultiple = Array.isArray(runKey) && runKey.length > 1;
609
- const searchParams = { timeout };
610
606
 
611
607
  const runKeyArg = Array.isArray(runKey) ? runKey : [runKey];
612
608
  return await new Router()
613
- .withSearchParams(searchParams)
614
609
  .post('/run/meta', {
615
610
  body: {
616
611
  include,