Skip to content

Commit 48e5c6a

Browse files
committed
adding getCollectorById
1 parent 46c0573 commit 48e5c6a

5 files changed

Lines changed: 13 additions & 8 deletions

File tree

docs/hds-lib.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/hds-lib.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/appTemplates/AppClientAccount.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ class AppClientAccount extends Application {
5252
return collectorClient;
5353
}
5454

55+
async getCollectorClientByKey (collectorKey) {
56+
// ensure collectors are initialized
57+
await this.getCollectorClients();
58+
return this.cache.collectorClientsMap[collectorKey];
59+
}
60+
5561
async getCollectorClients (forceRefresh = false) {
5662
if (!forceRefresh && this.cache.collectorClientsMapInitialized) return Object.values(this.cache.collectoClientsMap);
5763
const apiCalls = [{

src/appTemplates/Collector.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class Collector {
174174
}
175175

176176
async checkInbox () {
177-
const tempr = [];
177+
const newCollectorInvites = [];
178178

179179
const params = { types: ['credentials/collector-v1'], limit: 1, streams: [this.streamIdFor(Collector.STREAMID_SUFFIXES.inbox)] };
180180
const incomingCredentials = await this.appManaging.connection.apiOne('events.get', params, 'events');
@@ -209,9 +209,9 @@ class Collector {
209209
if (errors.length > 0) throw new HDSLibError('Error activating incoming request', errors);
210210
const eventUpdated = results[0].event;
211211
const inviteUpdated = this.#addOrUpdateInvite(eventUpdated);
212-
tempr.push(inviteUpdated);
212+
newCollectorInvites.push(inviteUpdated);
213213
}
214-
return tempr;
214+
return newCollectorInvites;
215215
}
216216

217217
/**

src/appTemplates/CollectorClient.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ class CollectorClient {
3232
}
3333

3434
get status () {
35-
// TODO the following test is bogus this.eventData.status does not exists
36-
if (!this.accessData && this.eventData.status === CollectorClient.STATUSES.refused) {
37-
return CollectorClient.STATUSES.refused;
35+
if (!this.accessData) {
36+
return CollectorClient.STATUSES.active;
3837
}
3938
if (this.accessData) return CollectorClient.STATUSES.active;
4039
return CollectorClient.STATUSES.incoming;

0 commit comments

Comments
 (0)