@softistx/janus 0.73.1 → 0.74.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.
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  createMemoryApiKeys2,
12
12
  createMemoryInvitations2,
13
13
  createMemoryStores2
14
- } from "./chunks/index-k6y18nx9.js";
14
+ } from "./chunks/index-7h34nqrm.js";
15
15
  import {
16
16
  JanusError2,
17
17
  UserInvalidError2,
@@ -3265,6 +3265,10 @@ function assertSocialLinks(store, where) {
3265
3265
  throw new TypeError(`${where}: store.socialLinks has no method ${method}, which the port requires`);
3266
3266
  }
3267
3267
  }
3268
+ const counter = store.countSocialLinks;
3269
+ if (counter !== undefined && typeof counter !== "function") {
3270
+ throw new TypeError(`${where}: store.socialLinks.countSocialLinks must be a function or absent`);
3271
+ }
3268
3272
  }
3269
3273
  function assertPasskeys(store, where) {
3270
3274
  if (store === undefined)
@@ -6653,6 +6657,16 @@ async function unlinkAccount(context, user, link) {
6653
6657
  });
6654
6658
  return true;
6655
6659
  }
6660
+ async function countLinks(context, query) {
6661
+ const { provider } = query ?? {};
6662
+ if (typeof provider !== "string")
6663
+ return 0;
6664
+ const store = linkStore(context);
6665
+ if (store.countSocialLinks === undefined) {
6666
+ throw new UnsupportedError2("social.countLinks: store.socialLinks does not implement countSocialLinks — use a store that does, or implement the method", { slot: "socialLinks", operation: "countSocialLinks" });
6667
+ }
6668
+ return store.countSocialLinks(provider);
6669
+ }
6656
6670
  async function listLinks(context, user) {
6657
6671
  const id = refId(user);
6658
6672
  if (!isId2(id) || context.store.socialLinks === undefined)
@@ -6684,6 +6698,7 @@ function socialApi(context) {
6684
6698
  complete: (input, options) => completeFlow(context, finishers, input, options),
6685
6699
  unlink: (user, link) => unlinkAccount(context, user, link),
6686
6700
  list: (user) => listLinks(context, user),
6701
+ countLinks: (query) => countLinks(context, query),
6687
6702
  cookie: socialCookie(context)
6688
6703
  };
6689
6704
  }
@@ -6929,5 +6944,5 @@ export {
6929
6944
  systemClock
6930
6945
  };
6931
6946
 
6932
- //# debugId=72063D91C6C7511964756E2164756E21
6947
+ //# debugId=0EFDFA41D3F43A2F64756E2164756E21
6933
6948
  //# sourceMappingURL=index.js.map