Skip to content

Commit c3e2080

Browse files
committed
Updating types
1 parent 3295867 commit c3e2080

11 files changed

Lines changed: 57 additions & 41 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hds-lib",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Health Data Safe - Library",
55
"main": "src/index.js",
66
"scripts": {

types/HDSModel/HDSItemDef.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export = HDSItemDef;
22
declare class HDSItemDef {
33
constructor(key: string, definitionData: any);
4-
get eventTypes(): any[];
4+
get eventTypes(): string[];
55
get key(): string;
66
get data(): any;
77
/** @type {string} label Localized */
@@ -13,6 +13,9 @@ declare class HDSItemDef {
1313
* // TODO handle variations
1414
* @returns {Object}
1515
*/
16-
eventTemplate(): any;
16+
eventTemplate(): {
17+
streamId: string,
18+
type: string
19+
};
1720
#private;
1821
}

types/HDSModel/HDSModel-Authorizations.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import HDSModel from "./HDSModel";
2+
13
export = HDSModelAuthorizations;
24
/**
35
* Authorizations - Extension of HDSModel
46
*/
57
declare class HDSModelAuthorizations {
6-
constructor(model: any);
8+
constructor(model: HDSModel);
79
/**
810
* Get minimal Authorization set for itemKeys
911
* /!\ Does not handle requests with streamId = "*"
@@ -14,7 +16,7 @@ declare class HDSModelAuthorizations {
1416
* @param {Array<AuthorizationRequestItem>} [options.preRequest]
1517
* @return {Array<AuthorizationRequestItem>}
1618
*/
17-
forItemKeys(itemKeys: any, options?: {
19+
forItemKeys(itemKeys: string[], options?: {
1820
defaultLevel?: string;
1921
includeDefaultName?: boolean;
2022
preRequest?: Array<AuthorizationRequestItem>;
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1+
import pryv = require('pryv');
2+
import HDSItemDef from './HDSItemDef';
3+
import HDSModel from './HDSModel';
14
export = HDSModelItemsDefs;
25
/**
36
* ItemsDefs - Extension of HDSModel
47
*/
58
declare class HDSModelItemsDefs {
6-
constructor(model: any);
9+
constructor(model: HDSModel);
710
/**
811
* get item for a key
912
* @param {string} key
1013
* @param {boolean} [throwErrorIfNotFound] default `true`
1114
*/
12-
forKey(key: string, throwErrorIfNotFound?: boolean): any;
15+
forKey(key: string, throwErrorIfNotFound?: boolean): HDSItemDef;
1316
/**
1417
* get a definition for an event
1518
* @param {Event} event
1619
* @param {boolean} [throwErrorIfNotFound] default `true`
1720
*/
18-
forEvent(event: Event, throwErrorIfNotFound?: boolean): any;
21+
forEvent(event: pryv.Event, throwErrorIfNotFound?: boolean): HDSItemDef;
1922
#private;
2023
}
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import pryv = require('pryv');
12
import HDSItemDef from "./HDSItemDef";
3+
import HDSModel from './HDSModel';
24
export = HDSModelStreams;
35
/**
46
* Streams - Extension of HDSModel
57
*/
68
declare class HDSModelStreams {
7-
constructor(model: any);
9+
constructor(model: HDSModel);
810
/**
911
* Get a list of streams to be created for usage of these keys (whithout children)
1012
* @param {Array<string>|Array<HDSItemDef>} itemKeysOrDefs
@@ -16,20 +18,22 @@ declare class HDSModelStreams {
1618
nameProperty?: string;
1719
knowExistingStreamsIds?: Array<string>;
1820
}): {
19-
id: any;
20-
parentId: any;
21+
id: string;
22+
name?: string;
23+
defaultName?: string;
24+
parentId?: string;
2125
}[];
2226
/**
2327
* Get stream Data by Id;
2428
* @param {string} streamId
2529
*/
26-
getDataById(streamId: string, throwErrorIfNotFound?: boolean): any;
30+
getDataById(streamId: string, throwErrorIfNotFound?: boolean): pryv.Stream;
2731
/**
2832
* Get all parents id;
2933
* @param {string} streamId
3034
* @param {boolean} [throwErrorIfNotFound] default `true`
3135
* @param {Array} [initialArray] - a pre-filled array
3236
*/
33-
getParentsIds(streamId: string, throwErrorIfNotFound?: boolean, initialArray?: any[]): any[];
37+
getParentsIds(streamId: string, throwErrorIfNotFound?: boolean, initialArray?: string[]): string[];
3438
#private;
3539
}

types/appTemplates/AppClientAccount.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

2+
import pryv = require('pryv');
23
export = AppClientAccount;
34
declare class AppClientAccount extends Application {
4-
constructor(baseStreamId: any, connection: any, appName: any, features: any, ...args: any[]);
5+
constructor(baseStreamId: string, connection: pryv.Connection, appName: string, features: any, ...args: Application.ApplicationFeatures[]);
56
get appSettings(): {
67
canBePersonnal: boolean;
78
mustBeMaster: boolean;
@@ -13,8 +14,8 @@ declare class AppClientAccount extends Application {
1314
* @returns {CollectorClient}
1415
*/
1516
handleIncomingRequest(apiEndpoint: string, incomingEventId?: string): CollectorClient;
16-
getCollectorClientByKey(collectorKey: any): Promise<any>;
17-
getCollectorClients(forceRefresh?: boolean): Promise<any[]>;
17+
getCollectorClientByKey(collectorKey: any): Promise<CollectorClient>;
18+
getCollectorClients(forceRefresh?: boolean): Promise<CollectorClient[]>;
1819
}
1920
import Application = require("./Application");
2021
import CollectorClient = require("./CollectorClient");

types/appTemplates/Collector.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ declare class Collector {
5050
/**
5151
* Retrieve an invite by its key
5252
*/
53-
getInviteByKey(key: any): Promise<any>;
53+
getInviteByKey(key: string): Promise<CollectorInvite>;
5454
/**
5555
* Retreive all invites
5656
* @param {boolean} [forceRefresh]
5757
* @returns {Array<CollectorInvite>}
5858
*/
59-
getInvites(forceRefresh?: boolean): Array<CollectorInvite>;
60-
checkInbox(): Promise<any[]>;
59+
getInvites(forceRefresh?: boolean): Promise<CollectorInvite[]>;
60+
checkInbox(): Promise<CollectorInvite[]>;
6161
/**
6262
* Create a "pending" invite to be sent to an app using AppSharingAccount
6363
* @param {string} name a default display name for this request
@@ -66,11 +66,11 @@ declare class Collector {
6666
*/
6767
createInvite(name: string, options?: {
6868
customData?: any;
69-
}): Promise<any>;
69+
}): Promise<CollectorInvite>;
7070
/**
7171
* Get sharing api endpoint
7272
*/
73-
sharingApiEndpoint(): Promise<any>;
73+
sharingApiEndpoint(): Promise<string>;
7474
/**
7575
* @private
7676
* @param {CollectorInvite} invite
@@ -94,7 +94,7 @@ declare class Collector {
9494
* Invite Status for streamId
9595
* reverse of streamIdFor
9696
*/
97-
inviteStatusForStreamId(streamId: any): any;
97+
inviteStatusForStreamId(streamId: string): string;
9898
#private;
9999
}
100100
import CollectorInvite = require("./CollectorInvite");

types/appTemplates/CollectorClient.d.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import pryv = require('pryv');
22
import AppClientAccount from './AppClientAccount';
3+
34
export = CollectorClient;
5+
46
/**
57
* Client App in relation to an AppManagingAccount/Collector
68
*/
79
declare class CollectorClient {
10+
811
static STATUSES: Readonly<{
912
incoming: "Incoming";
1013
active: "Active";
@@ -20,8 +23,8 @@ declare class CollectorClient {
2023
* return the key to discriminate collectorClients
2124
* @param {PryvAccessInfo} accessInfo
2225
*/
23-
static keyFromInfo(info: any): string;
24-
constructor(app: any, eventData: any, accessData?: any);
26+
static keyFromInfo(info: pryv.AccessInfo): string;
27+
constructor(app: AppClientAccount, eventData: pryv.Event, accessData?: any);
2528
/** @type {AppClientAccount} */
2629
app: AppClientAccount;
2730
/** @type {PryvEvent} */
@@ -31,13 +34,13 @@ declare class CollectorClient {
3134
/** @property {String} - identified within user's account - can be used to retreive a Collector Client from an app */
3235
get key(): string;
3336
/** @property {String} - id matching an event within requester's account - used as a reference to communicate with requester */
34-
get requesterEventId(): any;
37+
get requesterEventId(): string;
3538
/** @property {String} */
36-
get requesterApiEndpoint(): any;
39+
get requesterApiEndpoint(): string;
3740
/** @property {Object} - full content of the request */
3841
get requestData(): any;
3942
/** @property {string} - one of 'Incoming', 'Active', 'Deactivated', 'Refused' */
40-
get status(): any;
43+
get status(): string;
4144
/**
4245
* @private
4346
* reset with new request Event of ApiEndpoint
@@ -50,13 +53,13 @@ declare class CollectorClient {
5053
*/
5154
accept(forceAndSkipAccessCreation?: boolean): Promise<{
5255
accessData: any;
53-
requesterEvent: any;
56+
requesterEvent: pryv.Event;
5457
}>;
5558
revoke(): Promise<{
56-
requesterEvent: any;
59+
requesterEvent: pryv.Event;
5760
}>;
5861
refuse(): Promise<{
59-
requesterEvent: any;
62+
requesterEvent: pryv.Event;
6063
}>;
6164
/**
6265
* Probable temporary internal to fix possible inconsenticies during lib early stages

types/appTemplates/CollectorInvite.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ declare class CollectorInvite {
1212
* @param {pryv.Event} eventData
1313
* @returns {string}
1414
*/
15-
static getKeyForEvent(eventData: Event): string;
15+
static getKeyForEvent(eventData: pryv.Event): string;
1616
constructor(collector: any, eventData: any);
1717
/** @type {Collector} */
1818
collector: Collector;
1919
/** @type {Event} */
2020
eventData: pryv.Event;
2121
get key(): string;
22-
get status(): any;
23-
get apiEndpoint(): any;
22+
get status(): string;
23+
get apiEndpoint(): string;
2424
/** @type {string} - on of 'revoked', 'refused' */
2525
get errorType(): string;
2626
get dateCreation(): Date;
@@ -30,16 +30,16 @@ declare class CollectorInvite {
3030
* If result is "forbidden" update and set as revoked
3131
* @returns {Object} accessInfo if valid.
3232
*/
33-
checkAndGetAccessInfo(forceRefresh?: boolean): any;
34-
get displayName(): any;
33+
checkAndGetAccessInfo(forceRefresh?: boolean): pryv.AccessInfo;
34+
get displayName(): string;
3535
/**
3636
* private
3737
* @param {*} eventData
3838
*/
39-
setEventData(eventData: any): void;
39+
setEventData(eventData: pryv.Event): void;
4040
getSharingData(): Promise<{
41-
apiEndpoint: any;
42-
eventId: any;
41+
apiEndpoint: string;
42+
eventId: string;
4343
}>;
4444
#private;
4545
}

types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ import appTemplates = require("./appTemplates/appTemplates");
77
import { localizeText } from "./localizeText";
88
import toolkit = require("./toolkit");
99
import logger = require("./logger");
10-
export declare const model: any;
10+
export declare const model: HDSModel;
1111
export declare let initHDSModel: typeof HDSModelInitAndSingleton.initHDSModel;
1212
export { pryv, settings, HDService, HDSModel, appTemplates, localizeText, localizeText as l, toolkit, logger };

0 commit comments

Comments
 (0)