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.
@@ -6846,6 +6846,9 @@ function createProfileLogic(store, authn, utilityLogic) {
6846
6846
 
6847
6847
  function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6848
6848
  const ns = ns_ns;
6849
+ function isAbsoluteHttpUri(uri) {
6850
+ return !!uri && (uri.startsWith('https://') || uri.startsWith('http://'));
6851
+ }
6849
6852
  function getRegistrations(instance, theClass) {
6850
6853
  return store
6851
6854
  .each(undefined, ns.solid('instance'), instance)
@@ -6938,7 +6941,16 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6938
6941
  const communities = store.each(user, ns.solid('community'), undefined, preferencesFile).concat(store.each(user, ns.solid('community'), undefined, user.doc()));
6939
6942
  let result = [];
6940
6943
  for (const org of communities) {
6941
- result = result.concat(await loadTypeIndexesFor(org));
6944
+ if (org.termType !== 'NamedNode' || !isAbsoluteHttpUri(org.uri)) {
6945
+ warn(`Skipping malformed community node for ${user}: ${org}`);
6946
+ continue;
6947
+ }
6948
+ try {
6949
+ result = result.concat(await loadTypeIndexesFor(org));
6950
+ }
6951
+ catch (err) {
6952
+ warn(`Skipping community type indexes for ${org.uri}: ${err}`);
6953
+ }
6942
6954
  }
6943
6955
  return result;
6944
6956
  }
@@ -6969,10 +6981,10 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6969
6981
  function docDirUri(node) {
6970
6982
  const doc = node.doc();
6971
6983
  const dir = doc.dir();
6972
- if (dir === null || dir === void 0 ? void 0 : dir.uri)
6984
+ if ((dir === null || dir === void 0 ? void 0 : dir.uri) && isAbsoluteHttpUri(dir.uri))
6973
6985
  return dir.uri;
6974
6986
  const docUri = doc.uri;
6975
- if (!docUri) {
6987
+ if (!docUri || !isAbsoluteHttpUri(docUri)) {
6976
6988
  log(`docDirUri: missing doc uri for ${node === null || node === void 0 ? void 0 : node.uri}`);
6977
6989
  return null;
6978
6990
  }
@@ -6986,14 +6998,14 @@ function createTypeIndexLogic(store, authn, profileLogic, utilityLogic) {
6986
6998
  }
6987
6999
  function suggestPublicTypeIndex(me) {
6988
7000
  const dirUri = docDirUri(me);
6989
- if (!dirUri)
7001
+ if (!dirUri || !isAbsoluteHttpUri(dirUri))
6990
7002
  throw new Error(`suggestPublicTypeIndex: Cannot derive directory for ${me.uri}`);
6991
7003
  return (0,external_rdflib_namespaceObject.sym)(dirUri + 'publicTypeIndex.ttl');
6992
7004
  }
6993
7005
  // Note this one is based off the pref file not the profile
6994
7006
  function suggestPrivateTypeIndex(preferencesFile) {
6995
7007
  const dirUri = docDirUri(preferencesFile);
6996
- if (!dirUri)
7008
+ if (!dirUri || !isAbsoluteHttpUri(dirUri))
6997
7009
  throw new Error(`suggestPrivateTypeIndex: Cannot derive directory for ${preferencesFile.uri}`);
6998
7010
  return (0,external_rdflib_namespaceObject.sym)(dirUri + 'privateTypeIndex.ttl');
6999
7011
  }