rdf-dereference.js
rdf-dereference.js copied to clipboard
Allow users to pass Comunica context through the library
The RdfDereferencerBase passes options of type IDereferenceOptions to the cbrd:Bus/RdfDereference via the mediate function as the context.
See here: https://github.com/rubensworks/rdf-dereference.js/blob/645a126a632111163a1c6ad58f9c17c46c0b2de9/lib/RdfDereferencerBase.ts#L25-L30
Since the context exposes a variety of options for users to configure Comunica, such as an HTTP proxy for example, which is quite relevant to rdf-dereference, it makes sense for users to be able to provide the context to rdf-dereference.
That could be achieved by
- Making
IDereferenceOptionsa broader type (e.g.extending it to includeRecord<string, any>) It would have to be that wide because not all context options are simple strings, some are functions or objects - Adding a separate
contextfield to theIDereferenceOptionsand passing that as the context tomediate
Of course, users could simply override Typescript to pass the context as they want currently as additional fields on the option argument, but this would make it explicit and indicate to users that it is a valid option.
Good point! Option 1 seems like the most straightforward to me. (could also be applied to https://github.com/rubensworks/rdf-parse.js)
Feel free to submit a PR on this!