@learncard/network-plugin 1.7.7 → 1.7.9

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.
@@ -5058,6 +5058,11 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5058
5058
  includeUnacceptedBoosts
5059
5059
  });
5060
5060
  },
5061
+ countBoostRecipients: async (_learnCard, uri, includeUnacceptedBoosts = true) => {
5062
+ if (!userData)
5063
+ throw new Error("Please make an account first!");
5064
+ return client.boost.getBoostRecipientCount.query({ uri, includeUnacceptedBoosts });
5065
+ },
5061
5066
  updateBoost: async (_learnCard, uri, updates, credential) => {
5062
5067
  if (!userData)
5063
5068
  throw new Error("Please make an account first!");
@@ -5086,7 +5091,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5086
5091
  throw new Error("Please make an account first!");
5087
5092
  return client.boost.deleteBoost.mutate({ uri });
5088
5093
  },
5089
- sendBoost: async (_learnCard, profileId, boostUri, encrypt = true) => {
5094
+ sendBoost: async (_learnCard, profileId, boostUri, options = { encrypt: true }) => {
5090
5095
  if (!userData)
5091
5096
  throw new Error("Please make an account first!");
5092
5097
  const result = await _learnCard.invoke.resolveFromLCN(boostUri);
@@ -5096,7 +5101,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5096
5101
  const targetProfile = await _learnCard.invoke.getProfile(profileId);
5097
5102
  if (!targetProfile)
5098
5103
  throw new Error("Target profile not found");
5099
- const boost = data.data;
5104
+ let boost = data.data;
5100
5105
  boost.issuanceDate = new Date().toISOString();
5101
5106
  boost.issuer = _learnCard.id.did();
5102
5107
  if (Array.isArray(boost.credentialSubject)) {
@@ -5107,11 +5112,13 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5107
5112
  } else {
5108
5113
  boost.credentialSubject.id = targetProfile.did;
5109
5114
  }
5110
- if (boost?.type?.includes("BoostCredential")) {
5115
+ if (boost?.type?.includes("BoostCredential"))
5111
5116
  boost.boostId = boostUri;
5117
+ if (typeof options === "object" && options.overideFn) {
5118
+ boost = options.overideFn(boost);
5112
5119
  }
5113
5120
  const vc = await _learnCard.invoke.issueCredential(boost);
5114
- if (!encrypt) {
5121
+ if (typeof options === "object" && !options.encrypt || !options) {
5115
5122
  return client.boost.sendBoost.mutate({
5116
5123
  profileId,
5117
5124
  uri: boostUri,
@@ -5225,7 +5232,8 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5225
5232
  resolveFromLCN: async (_learnCard, uri) => {
5226
5233
  const result = await client.storage.resolve.query({ uri });
5227
5234
  return UnsignedVCValidator.or(VCValidator).or(VPValidator).or(JWEValidator).or(ConsentFlowContractValidator).or(ConsentFlowTermsValidator).parseAsync(result);
5228
- }
5235
+ },
5236
+ getLCNClient: () => client
5229
5237
  }
5230
5238
  };
5231
5239
  }, "getLearnCardNetworkPlugin");