solid-logic 4.0.3 → 4.0.4-5074310

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.
@@ -6901,6 +6901,9 @@ function createProfileLogic(store, authn, utilityLogic) {
6901
6901
 
6902
6902
  function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6903
6903
  const ns = ns_ns;
6904
+ function isAbsoluteHttpUri(uri) {
6905
+ return !!uri && (uri.startsWith('https://') || uri.startsWith('http://'));
6906
+ }
6904
6907
  function getRegistrations(instance, theClass) {
6905
6908
  return store
6906
6909
  .each(undefined, ns.solid('instance'), instance)
@@ -6993,7 +6996,16 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6993
6996
  const communities = store.each(user, ns.solid('community'), undefined, preferencesFile).concat(store.each(user, ns.solid('community'), undefined, user.doc()));
6994
6997
  let result = [];
6995
6998
  for (const org of communities) {
6996
- result = result.concat(await loadTypeIndexesFor(org));
6999
+ if (org.termType !== 'NamedNode' || !isAbsoluteHttpUri(org.uri)) {
7000
+ warn(`Skipping malformed community node for ${user}: ${org}`);
7001
+ continue;
7002
+ }
7003
+ try {
7004
+ result = result.concat(await loadTypeIndexesFor(org));
7005
+ }
7006
+ catch (err) {
7007
+ warn(`Skipping community type indexes for ${org.uri}: ${err}`);
7008
+ }
6997
7009
  }
6998
7010
  return result;
6999
7011
  }
@@ -7024,10 +7036,10 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
7024
7036
  function docDirUri(node) {
7025
7037
  const doc = node.doc();
7026
7038
  const dir = doc.dir();
7027
- if (dir === null || dir === void 0 ? void 0 : dir.uri)
7039
+ if ((dir === null || dir === void 0 ? void 0 : dir.uri) && isAbsoluteHttpUri(dir.uri))
7028
7040
  return dir.uri;
7029
7041
  const docUri = doc.uri;
7030
- if (!docUri) {
7042
+ if (!docUri || !isAbsoluteHttpUri(docUri)) {
7031
7043
  log(`docDirUri: missing doc uri for ${node === null || node === void 0 ? void 0 : node.uri}`);
7032
7044
  return null;
7033
7045
  }
@@ -7041,14 +7053,14 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
7041
7053
  }
7042
7054
  function suggestPublicTypeIndex(me) {
7043
7055
  const dirUri = docDirUri(me);
7044
- if (!dirUri)
7056
+ if (!dirUri || !isAbsoluteHttpUri(dirUri))
7045
7057
  throw new Error(`suggestPublicTypeIndex: Cannot derive directory for ${me.uri}`);
7046
7058
  return (0,external_$rdf_.sym)(dirUri + 'publicTypeIndex.ttl');
7047
7059
  }
7048
7060
  // Note this one is based off the pref file not the profile
7049
7061
  function suggestPrivateTypeIndex(preferencesFile) {
7050
7062
  const dirUri = docDirUri(preferencesFile);
7051
- if (!dirUri)
7063
+ if (!dirUri || !isAbsoluteHttpUri(dirUri))
7052
7064
  throw new Error(`suggestPrivateTypeIndex: Cannot derive directory for ${preferencesFile.uri}`);
7053
7065
  return (0,external_$rdf_.sym)(dirUri + 'privateTypeIndex.ttl');
7054
7066
  }