@learncard/learn-cloud-plugin 2.0.12 → 2.0.14

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.
@@ -15696,20 +15696,35 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
15696
15696
  },
15697
15697
  read: {
15698
15698
  get: async (_learnCard, uri) => {
15699
+ learnCard.debug?.("LearnCloud read.get", uri);
15699
15700
  if (!uri)
15700
15701
  return void 0;
15701
15702
  const parts = uri.split(":");
15703
+ learnCard.debug?.("LearnCloud read.get parts:", parts);
15702
15704
  if (parts.length !== 5)
15703
15705
  return void 0;
15704
15706
  const [lc, method, uriUrl] = parts;
15705
- if (lc !== "lc" || method !== "cloud")
15707
+ if (lc !== "lc" || method !== "cloud") {
15708
+ learnCard.debug?.("LearnCloud read.get not cloud URI!", { lc, method });
15706
15709
  return void 0;
15707
- if (uriUrl.replace(/https?:\/\//g, "") !== url.replace(/https?:\\/g, "").replace(/:/g, "%3A")) {
15708
- const fullUrl = uriUrl.startsWith("http") ? uriUrl : `http${uriUrl.includes("http") ? "" : "s"}://${uriUrl}`;
15710
+ }
15711
+ if (uriUrl.replace(/https?:\/\//g, "") !== url.replace(/https?:\/\//g, "").replace(/:/g, "%3A")) {
15712
+ const fullUrl = (uriUrl.startsWith("http") ? uriUrl : `http${uriUrl.includes("http") || uriUrl.includes("localhost") ? "" : "s"}://${uriUrl}`).replaceAll("%3A", ":");
15713
+ learnCard.debug?.("LearnCloud read.get different LearnCloud!", {
15714
+ uriUrl,
15715
+ url,
15716
+ fullUrl,
15717
+ comparison: {
15718
+ a: uriUrl.replace(/https?:\/\//g, ""),
15719
+ b: url.replace(/https?:\/\//g, "").replace(/:/g, "%3A")
15720
+ }
15721
+ });
15709
15722
  const otherClient = await getOtherClient(fullUrl);
15710
15723
  try {
15711
15724
  const result = await otherClient.storage.resolve.query({ uri });
15725
+ learnCard.debug?.("LearnCloud read.get result", result);
15712
15726
  const decryptedResult = await _learnCard.invoke.getDIDObject().decryptDagJWE(result);
15727
+ learnCard.debug?.("LearnCloud read.get decryptedResult", decryptedResult);
15713
15728
  return await VCValidator.or(VPValidator).parseAsync(decryptedResult);
15714
15729
  } catch (error) {
15715
15730
  _learnCard.debug?.(error);
@@ -15718,7 +15733,9 @@ var getLearnCloudPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url, u
15718
15733
  }
15719
15734
  try {
15720
15735
  const result = await client.storage.resolve.query({ uri });
15736
+ learnCard.debug?.("LearnCloud read.get result", result);
15721
15737
  const decryptedResult = await _learnCard.invoke.getDIDObject().decryptDagJWE(result);
15738
+ learnCard.debug?.("LearnCloud read.get decryptedResult", decryptedResult);
15722
15739
  return await VCValidator.or(VPValidator).parseAsync(decryptedResult);
15723
15740
  } catch (error) {
15724
15741
  _learnCard.debug?.(error);