The auth, data and live providers to connect a Refine app to ActivityPods Pods. It requires @refinedev/core 5. See the auth provider and data provider pages for usage examples.
authProvider
Create a Refine auth provider using the Solid-OIDC flow.
Return the current session as { token, webId }, or undefined if there is none or if it expired
handleCallback()
Complete the OIDC flow on the redirectUri route. Return { webId, redirect }
registerApp(webId?)
Return the URI of the app registration. If the app is not registered, or if its access needs changed, redirect to the authorization screen and return undefined
The configuration of each Refine resource. See below
jsonContext
Any
ActivityStreams’ context
JSON-LD context sent with created and updated resources, and used to expand the types
readAccessGrants
Boolean
false
Also list the resources found through the access grants of the app registration. This is slow and rarely needed
Resources
The keys of resources are the names of the Refine resources. Each value must have one of these properties:
Property
Type
Description
shapeTreeUri
String
URI of the shape tree of the resource. This is the recommended option
types
String or Array
Types of the resource, as CURIEs or full URIs. Used when shapeTreeUri is not set
Methods
Method
Description
getList
Read the container of the resource. See Lists for the supported filters, sorters and pagination
getOne
Fetch a resource. Resources on other servers are fetched through the proxy of the user’s Pod
getMany
Same as getOne for several resources. The resources which cannot be fetched are left out
create
Post the resource to its container, with the types of the resource, and return it as stored by the Pod
update
Fetch the current version of the resource, apply the given variables and replace it. The properties which are not in the variables, such as those added by a backend, are kept
deleteOne
Delete the resource
The custom method is not implemented. To call other endpoints, use fetchWithSession.
liveProvider
Create a Refine live provider using WebSocket channels. It requires Pod providers running a version of ActivityPods above 2.3.15.
Options
Property
Type
Default
Description
authProvider
Object
required
The auth provider created above
resources
Object
required
The same value as for the data provider
jsonContext
Any
ActivityStreams’ context
The same value as for the data provider
Subscriptions
Watching
Channel
Events
One or more IDs
One channel per resource
updated and deleted
A list
One channel on the resource’s container
created and deleted of its items
Lists are not notified when one of their items is updated. Nothing happens for the resources which are not in resources.
A wrapper around fetch which sets the JSON-LD Accept and Content-Type headers, adds the bearer token if there is one, and parses the response. If the response is not successful, it throws an error with the status and the body of the response.
Same as fetchJson, as the logged user. A Pod only accepts the tokens it issued, so requests to other servers go through the proxy of the user’s Pod, which signs them on behalf of the user. You can get the session with useAuthProvider.
Other functions
Function
Description
resolveAuthAgent(webId, token?)
Return { authAgent, appRegistrationUri }: the authorization agent of the user, and the app registration if there is one