src/lib/Repositories/SolidLoaderRepository.js
/**
     * Finds all interlocutors WebIds by looking for Invitations sent.
     * @param {string} chatUrl: URL to inspect.
     * @returns {Promise}: a promise that resolves with an array of all interlocutors found.
     */
Finds all interlocutors WebIds by looking for Invitations sent.
@param {string} chatUrl: URL to inspect.
@returns {Promise}: a promise that resolves with an array of all interlocutors found.
Finds all interlocutors WebIds by looking for Invitations sent . @param { string } chatUrl : URL to inspect . @returns { Promise } : a promise that resolves with an array of all interlocutors found .
async findWebIdOfInterlocutor(chatUrl) {
        const deferred = Q.defer();
        let results = [];
        const rdfjsSource = await this._getRDFjsSourceFromUrl(chatUrl);
        const self = this;
        this.engine.query(`SELECT * {
      ?invitation a <${namespaces.schema}InviteAction>;
			<${namespaces.schema}event> ?url;
			<${namespaces.schema}agent> ?agent;
			<${namespaces.schema}recipient> ?recipient.
    }`, {
                sources: [{
                    type: "rdfjsSource",
                    value: rdfjsSource
                }]
            })
            .then(function(result) {
                result.bindingsStream.on("data", (data) => {
                    data = data.toObject();
                    if (data["?recipient"]) {
                        var rFields = data["?recipient"].value.split("/");
                        results.push(self.encrypter.decrypt(rFields.splice(4, rFields.length).join("/"), false));
                    }
                });
                result.bindingsStream.on("end", function() {
                    deferred.resolve(results);
                });
            });
        return deferred.promise;
    }
async findWebIdOfInterlocutor ( chatUrl ) { const deferred = Q . defer ( ) ; let results = [ ] ; const rdfjsSource = await this . _getRDFjsSourceFromUrl ( chatUrl ) ; const self = this ; this . engine . query ( ` ${ namespaces . schema } ${ namespaces . schema } ${ namespaces . schema } ${ namespaces . schema } ` , { sources : [ { type : "rdfjsSource" , value : rdfjsSource } ] } ) . then ( function ( result ) { result . bindingsStream . on ( "data" , ( data ) => { data = data . toObject ( ) ; if ( data [ "?recipient" ] ) { var rFields = data [ "?recipient" ] . value . split ( "/" ) ; results . push ( self . encrypter . decrypt ( rFields . splice ( 4 , rFields . length ) . join ( "/" ) , false ) ) ; } } ) ; result . bindingsStream . on ( "end" , function ( ) { deferred . resolve ( results ) ; } ) ; } ) ; return deferred . promise ; }
Finds all interlocutors WebIds by looking for Invitations sent.
Finds all interlocutors WebIds by looking for Invitations sent .