@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.
@@ -5082,6 +5082,11 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5082
5082
  includeUnacceptedBoosts
5083
5083
  });
5084
5084
  },
5085
+ countBoostRecipients: async (_learnCard, uri, includeUnacceptedBoosts = true) => {
5086
+ if (!userData)
5087
+ throw new Error("Please make an account first!");
5088
+ return client.boost.getBoostRecipientCount.query({ uri, includeUnacceptedBoosts });
5089
+ },
5085
5090
  updateBoost: async (_learnCard, uri, updates, credential) => {
5086
5091
  if (!userData)
5087
5092
  throw new Error("Please make an account first!");
@@ -5110,7 +5115,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5110
5115
  throw new Error("Please make an account first!");
5111
5116
  return client.boost.deleteBoost.mutate({ uri });
5112
5117
  },
5113
- sendBoost: async (_learnCard, profileId, boostUri, encrypt = true) => {
5118
+ sendBoost: async (_learnCard, profileId, boostUri, options = { encrypt: true }) => {
5114
5119
  if (!userData)
5115
5120
  throw new Error("Please make an account first!");
5116
5121
  const result = await _learnCard.invoke.resolveFromLCN(boostUri);
@@ -5120,7 +5125,7 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5120
5125
  const targetProfile = await _learnCard.invoke.getProfile(profileId);
5121
5126
  if (!targetProfile)
5122
5127
  throw new Error("Target profile not found");
5123
- const boost = data.data;
5128
+ let boost = data.data;
5124
5129
  boost.issuanceDate = new Date().toISOString();
5125
5130
  boost.issuer = _learnCard.id.did();
5126
5131
  if (Array.isArray(boost.credentialSubject)) {
@@ -5131,11 +5136,13 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5131
5136
  } else {
5132
5137
  boost.credentialSubject.id = targetProfile.did;
5133
5138
  }
5134
- if (boost?.type?.includes("BoostCredential")) {
5139
+ if (boost?.type?.includes("BoostCredential"))
5135
5140
  boost.boostId = boostUri;
5141
+ if (typeof options === "object" && options.overideFn) {
5142
+ boost = options.overideFn(boost);
5136
5143
  }
5137
5144
  const vc = await _learnCard.invoke.issueCredential(boost);
5138
- if (!encrypt) {
5145
+ if (typeof options === "object" && !options.encrypt || !options) {
5139
5146
  return client.boost.sendBoost.mutate({
5140
5147
  profileId,
5141
5148
  uri: boostUri,
@@ -5249,7 +5256,8 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
5249
5256
  resolveFromLCN: async (_learnCard, uri) => {
5250
5257
  const result = await client.storage.resolve.query({ uri });
5251
5258
  return UnsignedVCValidator.or(VCValidator).or(VPValidator).or(JWEValidator).or(ConsentFlowContractValidator).or(ConsentFlowTermsValidator).parseAsync(result);
5252
- }
5259
+ },
5260
+ getLCNClient: () => client
5253
5261
  }
5254
5262
  };
5255
5263
  }, "getLearnCardNetworkPlugin");