UNPKG

@treecg/ldes-orchestrator

Version:

Fills the gaps that a Linked Data Platform (LDP) cannot do by itself for creating a Linked Data Event Stream (LDES) in LDP.

81 lines (80 loc) 3.17 kB
/*************************************** * Title: LDESinSolid * Description: class for LDES in Solid * Author: Wout Slabbinck (wout.slabbinck@ugent.be) * Created on 01/12/2021 *****************************************/ import { Session } from "@rubensworks/solid-client-authn-isomorphic"; import { AccessSubject } from "./util/Acl"; import { ACLConfig, LDESConfig } from "./util/Interfaces"; export declare class LDESinSolid { private readonly _ldesConfig; private readonly _aclConfig; private readonly _session; private readonly _amount; private static readonly staticLogger; private readonly logger; constructor(ldesConfig: LDESConfig, aclConfig: ACLConfig, session: Session); constructor(ldesConfig: LDESConfig, aclConfig: ACLConfig, session: Session, amount: number); get ldesConfig(): LDESConfig; get aclConfig(): ACLConfig; get session(): Session; get amount(): number; static getConfig(base: string, session: Session): Promise<{ ldesConfig: LDESConfig; aclConfig: ACLConfig; }>; getAmountResources(): Promise<number>; getCurrentContainer(): Promise<string>; /** * Fetches the iri and transforms the contents to a N3 Store * Note: currently only works for text/turle * @param iri * @param session * @returns {Promise<Store>} */ private static fetchStore; /** * Creates a container. Only succeeds when a new container was created * @param iri * @param session * @returns {Promise<void>} */ private static createContainer; private static updateAcl; private static addShape; private static updateInbox; private static addRelation; /** * Creates a new LDES in LDP. * First the ldp:Container is created where everything will reside. * Then a new container is added as defined in the UML sequence diagram for LDES in LDP. * Finally a root is created (instead of updated). * * When the public can append to the new container, @param accessSubject should be AccessSubject.Public or left blank. * When only the owner can append to the new container, it should be AccessSubject.Agent. * * @param accessSubject * @returns {Promise<void>} */ createLDESinLDP(accessSubject?: AccessSubject): Promise<void>; /** * Creates a new container when the old container is deemed full. * It follows the sequence described in the UML sequence diagram for LDES in LDP. * * When the public can append to the new container, @param accessSubject should be AccessSubject.Public or left blank. * When only the owner can append to the new container, it should be AccessSubject.Agent. * * @param accessSubject * @returns {Promise<void>} */ createNewContainer(accessSubject?: AccessSubject): Promise<void>; /** * Create the AclBody * When the subject is public, everybody is allowed to interact with the accompanying resources * @param accessSubject * @param accessMode mode for interacting with the accompanying resource * @returns {Acl[]} */ private createACLBody; }