jasnell/activitystrea.ms

Support for missing ActivityPub vocabulary (sharedInbox, etc.)

aral opened this issue · 1 comments

aral commented

In trying to declare a sharedInbox endpoint on an ActivityPub Actor object, I tried:

const actor = _.person()
  
  .endpoints(_.sharedInbox().url('https://ar.al/inbox'))

I get the error _TypeError: .sharedInbox is not a function.

.sharedInbox is undefined.

I can see that it is present in the activitystreams-context package in the context.json file:

    "sharedInbox": {
      "@id": "as:sharedInbox",
      "@type": "@id"
    }

But it:

  • Doesn’t have a static method defined in activitystreams.js
  • Doesn’t have a getter defined in _models/object.js
  • Is not added to the graph in reasoner.js
  • Doesn’t have a test defined in test.js

As I’m new to the library, before I go ahead and add it in those places:

(a) Is this the right way to do it (was it just not added or am I missing something?)

(b) I see that, e.g., Image is added to the graph twice. Is this the way to do it?

graph.add({
  subject: as.Image,
  predicate: rdfs.subClassOf,
  object: as.Document
});
// ⋮
graph.add({
  subject: as.image,
  predicate: rdf.type,
  object: owl.ObjectProperty
});

(c) Is there a reason for all this duplication? Would it be a worthwhile use of time to try and refactor the library so that elements are defined once if possible to keep things DRY? (As I see it, to add sharedInbox, along with the other optional properties defined in ActivityPub §4.1streams, preferredUsername, proxyUrl, oauthAuthorizationEndpoint, oauthTokenEndpoint, provideClientKey, signClientKey) would require making ~four entries for each, so ~24 definitions.

(d) Given that ActivityPub is extensible, does this mean that the parser will break and need to be updated to support every possible extension statically?

Thanks in advance :)

CC @evanp

evanp commented

Aww, crud. Yes, it'd be nice if stuff wasn't defined in different places. For now, I'm happy to take a PR with all these changes made.