import { DataFrame, DataObject, DataServiceDriver, Model, Constructor, RemoteService, PullOptions, PushOptions, Serializable } from '@openhps/core'; import type { Session as BrowserSession, ISessionOptions as ISessionBrowserOptions, ISessionInfo } from '@inrupt/solid-client-authn-browser'; import type { Session as NodeSession } from '@inrupt/solid-client-authn-node'; import type { IStorage, ClientAuthentication } from '@inrupt/solid-client-authn-core'; import { SolidProfileObject } from './SolidProfileObject'; import { SolidDataset } from '@inrupt/solid-client'; import { Store, IriString, RDFChangeLog } from '@openhps/rdf'; import { ISessionOptions } from '@inrupt/solid-client-authn-node'; import type { AccessModes, Thing, ThingPersisted, WithResourceInfo } from '@inrupt/solid-client/dist/interfaces'; import { StorageUtility } from '@inrupt/solid-client-authn-core'; import { ClientRegistrar } from './ClientRegistrar'; import { SessionManager } from './SessionManager'; import { DatasetSubscription } from './DatasetSubscription'; export declare abstract class SolidService extends RemoteService { protected options: SolidDataServiceOptions; storage: IStorage; protected storageUtility: StorageUtility; readonly clientRegistrar: ClientRegistrar; readonly sessionManager: SessionManager; model: Model; static readonly PREFIX = "OpenHPS:solid"; protected driver: DataServiceDriver; protected _session: SolidSession; protected _clientAuthentication: ClientAuthentication; constructor(options?: SolidDataServiceOptions); get session(): SolidSession; protected set session(value: SolidSession); get clientAuthentication(): ClientAuthentication; /** * Get the URL of a document * @param {SolidSession} session Solid session to get an URL from * @param {string} [path] Path to append to the document URL * @returns {URL} Document URL */ getDocumentURL(session: SolidSession, path?: string): Promise; getPodUrl(session: SolidSession): Promise; /** * Get a Solid dataset as an N3 Quads dataset * @param {SolidSession} session Solid session to get a thing from * @param {string} uri URI of the thing in the Solid Pod * @returns {Promise} Promise of a solid dataset store */ getDatasetStore(session: SolidSession, uri: string): Promise; createDataset(): SolidDataset; /** * Get a Solid dataset * @param {SolidSession} session Solid session to get a thing from * @param {string} uri URI of the thing in the Solid Pod * @returns {Promise} Promise of a solid dataset */ getDataset(session: SolidSession, uri: string): Promise; /** * Get a Solid dataset subscription * @param {SolidSession} session Solid session to get a subscription from * @param {string} uri URI of the thing in the Solid Pod * @returns {Promise} Promise of a solid dataset subscription */ getDatasetSubscription(session: SolidSession, uri: string): Promise; /** * Create a Solid container * @param session Solid session to create a container with * @param url URL of the container * @returns Promise of the container */ createContainer(session: SolidSession, url: IriString): Promise; deleteContainer(session: SolidSession, url: IriString): Promise; /** * Recursively delete a Solid dataset * @param session Solid session to delete a dataset with * @param dataset Dataset to delete */ deleteRecursively(session: SolidSession, dataset: SolidDataset & WithResourceInfo): Promise; /** * Recursively delete a Solid dataset * @param {SolidSession} session Solid session to delete a dataset with * @param url URL of the dataset */ deleteRecursively(session: SolidSession, url: IriString): Promise; /** * Delete a Solid dataset * @param {SolidSession} session Solid session to get a thing from * @param {string} uri URI of the thing in the Solid Pod * @returns {Promise} Promise of a solid dataset */ deleteDataset(session: SolidSession, uri: string): Promise; /** * Save a Solid dataset * @param {SolidSession} session Solid session to get a thing from * @param {string} uri URI of the thing in the Solid Pod * @param {SolidDataset | (Store & RDFChangeLog)} dataset Dataset to save at the uri * @param {boolean} [append] Append in container * @returns {Promise} Promise of a solid dataset */ saveDataset(session: SolidSession, uri: string, dataset?: SolidDataset | (Store & RDFChangeLog) | (Store & RDFChangeLog & SolidDataset) | Store, append?: boolean): Promise<(SolidDataset & WithResourceInfo) | null>; /** * Get a thing from a session Pod * @param {SolidSession} session Solid session to get a thing from * @param {string} uri URI of the thing in the Solid Pod * @returns {Promise} Persisted thing */ getThing(session: SolidSession, uri: string): Promise; /** * Set access control list for a specific object * @param {IriString} uri URI of the object * @param {Partial} access Access modes * @param {string} [webId] WebID to set access for * @param {SolidSession} [session] Session to use */ setAccess(uri: IriString, access: Partial, webId?: string, session?: SolidSession): Promise; /** * Get access control list for a specific resource * @param {SolidSession} session Session to use * @param uri * @param webId WebID to get access control list for * @returns Access control list */ getAccess(uri: IriString, webId?: string, session?: SolidSession): Promise; /** * Set a thing in a session Pod * @param {SolidSession} session Solid session to set a thing to * @param {ThingPersisted} thing Persisted thing to store in the Pod * @returns {Promise} Promise if stored */ setThing(session: SolidSession, thing: ThingPersisted): Promise; /** * Set a thing in a session Pod * @param {SolidSession} session Solid session to set a thing to * @param {Thing} thing Non-persisted thing to store in the Pod * @param {SolidDataset} [dataset] * @returns {Promise} Promise if stored */ createThing(session: SolidSession, thing: Thing, dataset?: SolidDataset): Promise; /** * Check if something is an object * @param {any} item Item to check for object * @returns {boolean} Is an object */ private _isObject; /** * Deep merge objects * @param {any} target Target object * @param {any} source Source object * @returns {any} Merged object */ private _mergeDeep; /** * Send a push to a specific remote node * @param {string} uid Remote Node UID * @param {DataFrame} frame Data frame to push * @param {PushOptions} [options] Push options */ remotePush(uid: string, frame: T, options?: PushOptions): Promise; /** * Send a pull request to a specific remote node * @param {string} uid Remote Node UID * @param {PullOptions} [options] Pull options */ remotePull(uid: string, options?: PullOptions): Promise; /** * Send an error to a remote node * @param {string} uid Remote Node UID * @param {string} event Event to send * @param {any[]} [args] Event argument */ remoteEvent(uid: string, event: string, ...args: any[]): Promise; /** * Send a remote service call * @param {string} uid Service uid * @param {string} method Method to call * @param {any[]} [args] Optional set of arguments */ remoteServiceCall(uid: string, method: string, ...args: any[]): Promise; /** * Fetch profile information * @param {SolidProfileObject} object Data object to fetch profile information for * @returns {Promise} Promise of data object with profile information */ fetchProfile(object: SolidProfileObject): Promise; /** * Store profile information * @param {SolidProfileObject} object Data object to store profile information for * @returns {Promise} Promise of storing */ storeProfile(object: SolidProfileObject): Promise; /** * Find session information by session identifier * @param {string} sessionId Session identifier * @returns {ISessionInfo & ISessionInternalInfo} Session info */ findSessionInfoById(sessionId: string): Promise; /** * Find session by session identifier * @param {string} sessionId Session identifier * @returns {SolidSession} Browser or Node session */ findSessionById(sessionId: string): Promise; /** * Find session by WebID * @param {string} webId Web Identifier * @returns {SolidSession} Browser or Node session */ findSessionByWebId(webId: string): Promise; /** * Find session by object identifier * @param {Constructor} dataType Data type of data object or data frame * @param {string} uid Object unique identifier * @returns {SolidSession} Browser or Node session */ findSessionByObjectUID(dataType: Constructor, uid: string): Promise; linkSession(object: DataObject | DataFrame, sessionId: string, type?: Serializable): Promise; unlinkSession(object: DataObject | DataFrame | string, type?: Serializable): Promise; protected abstract createSession(options: Partial): SolidSession; protected storeToDataset(store: Store): SolidDataset; } export interface SolidDataServiceOptions { /** * Client name displayed to the user */ clientName?: string; /** * Client identifier */ clientId?: string; /** * Client secret */ clientSecret?: string; /** * Automatically login after starting the server * @default false */ autoLogin?: boolean; /** * Redirect URL */ redirectUrl?: string; defaultOidcIssuer?: string; /** * Data service driver to use for key:value pairs * In a browser this should be @openhps/localstorage */ dataServiceDriver?: DataServiceDriver; } export type SolidSession = BrowserSession | NodeSession; export interface ISessionInternalInfo { /** * The refresh token associated with the session (if any). */ refreshToken?: string; /** * The OIDC issuer that issued the tokens authenticating the session. */ issuer?: string; /** * The redirect URL registered when initially logging the session in. */ redirectUrl?: string; /** * For public clients, and Solid Identity Providers that do not support Client * WebIDs, the client secret is still required at the token endpoint. */ clientAppSecret?: string; /** * The token type used by the session */ tokenType?: 'DPoP' | 'Bearer'; } export { ISessionInfo }; //# sourceMappingURL=SolidService.d.ts.map