pryv 2.4.0 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.ts +36 -36
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pryv",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Pryv JavaScript library",
5
5
  "keywords": [
6
6
  "Pryv",
package/src/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  declare module 'pryv' {
2
2
  type Timestamp = number;
3
3
  type Identifier = string;
4
- type Level = 'read' | 'contribute' | 'manage' | 'create-only';
5
- type KeyValue = { [key: string]: string | number };
4
+ export type Level = 'read' | 'contribute' | 'manage' | 'create-only';
5
+ export type KeyValue = { [key: string]: string | number };
6
6
 
7
- type Attachment = {
7
+ export type Attachment = {
8
8
  id: Identifier;
9
9
  fileName: string;
10
10
  type: string;
@@ -12,7 +12,7 @@ declare module 'pryv' {
12
12
  readToken: string;
13
13
  };
14
14
 
15
- type Stream = {
15
+ export type Stream = {
16
16
  id: Identifier;
17
17
  name: string;
18
18
  parentId?: Identifier;
@@ -25,7 +25,7 @@ declare module 'pryv' {
25
25
  modifiedBy: Identifier;
26
26
  };
27
27
 
28
- type Event = {
28
+ export type Event = {
29
29
  id: Identifier;
30
30
  streamIds: Identifier[];
31
31
  streamId: Identifier;
@@ -44,14 +44,14 @@ declare module 'pryv' {
44
44
  modifiedBy: Identifier;
45
45
  };
46
46
 
47
- type Permission = {
47
+ export type Permission = {
48
48
  streamId: Identifier;
49
49
  level: Level;
50
50
  feature?: 'selfRevoke';
51
51
  setting?: 'forbidden';
52
52
  };
53
53
 
54
- type Access = {
54
+ export type Access = {
55
55
  id: Identifier;
56
56
  token: string;
57
57
  type?: 'personal' | 'app' | 'shared';
@@ -77,7 +77,7 @@ declare module 'pryv' {
77
77
  accessToken: string;
78
78
  };
79
79
 
80
- type AccountInformation = {
80
+ export type AccountInformation = {
81
81
  username: string;
82
82
  email: string;
83
83
  language: string;
@@ -101,7 +101,7 @@ declare module 'pryv' {
101
101
  errorId?: string;
102
102
  };
103
103
 
104
- type HFSeries = {
104
+ export type HFSeries = {
105
105
  format: 'flatJSON';
106
106
  fields: string[];
107
107
  points: Array<number | string>;
@@ -112,7 +112,7 @@ declare module 'pryv' {
112
112
  timestamp: Timestamp;
113
113
  };
114
114
 
115
- type WebHook = {
115
+ export type WebHook = {
116
116
  id: Identifier;
117
117
  accessId: Identifier;
118
118
  url: string;
@@ -130,25 +130,25 @@ declare module 'pryv' {
130
130
  modifiedBy: Identifier;
131
131
  };
132
132
 
133
- type ItemDeletion = {
133
+ export type ItemDeletion = {
134
134
  id: Identifier;
135
135
  deleted?: Timestamp;
136
136
  };
137
137
 
138
- type Error = {
138
+ export type Error = {
139
139
  id: string;
140
140
  message: string;
141
141
  data?: any;
142
142
  subErrors?: Error[];
143
143
  };
144
144
 
145
- type StreamsQuery = {
145
+ export type StreamsQuery = {
146
146
  any?: Identifier[];
147
147
  all?: Identifier[];
148
148
  not?: Identifier[];
149
149
  };
150
150
 
151
- type EventQueryParams = {
151
+ export type EventQueryParams = {
152
152
  fromTime: Timestamp;
153
153
  toTime: Timestamp;
154
154
  streams: string[];
@@ -163,11 +163,11 @@ declare module 'pryv' {
163
163
  includeDeletion: boolean;
164
164
  };
165
165
 
166
- type EventQueryParamsStreamQuery = Omit<EventQueryParams, 'streams'> & {
166
+ export type EventQueryParamsStreamQuery = Omit<EventQueryParams, 'streams'> & {
167
167
  streams: string[] | StreamsQuery;
168
168
  };
169
169
 
170
- type EditMetadata = 'created' | 'createdBy' | 'modified' | 'modifiedBy';
170
+ export type EditMetadata = 'created' | 'createdBy' | 'modified' | 'modifiedBy';
171
171
 
172
172
  export type APICallMethods = {
173
173
  // mfa
@@ -534,7 +534,7 @@ declare module 'pryv' {
534
534
  ) => Promise<any>;
535
535
  export type StreamedEventsHandler = (event: Event) => void;
536
536
 
537
- type StreamedEventsResult = {
537
+ export type StreamedEventsResult = {
538
538
  eventsCount?: number;
539
539
  eventsDeletionsCount?: number;
540
540
  meta: {
@@ -560,17 +560,17 @@ declare module 'pryv' {
560
560
 
561
561
  export type APICallProgressHandler = (percentage: number) => void;
562
562
 
563
- interface AccessInfo extends Access {
563
+ export class AccessInfo extends Access {
564
564
  calls: KeyValue;
565
565
  user: KeyValue;
566
566
  }
567
567
 
568
- type EventAPICallRes = {
568
+ export type EventAPICallRes = {
569
569
  event?: Event;
570
570
  } & PossibleError;
571
571
 
572
- export interface Connection {
573
- new (apiEndpoint: string, service?: Service): Connection;
572
+ export class Connection {
573
+ constructor (apiEndpoint: string, service?: Service): Connection;
574
574
  get service(): Service;
575
575
  username(): Promise<string>;
576
576
  api<Calls extends APICall[] = APICall[]>(
@@ -650,11 +650,11 @@ declare module 'pryv' {
650
650
  [key: string]: any;
651
651
  };
652
652
 
653
- export interface Service {
654
- new (
653
+ export class Service {
654
+ constructor (
655
655
  serviceInfoUrl: string,
656
656
  serviceCustomizations?: serviceCustomizations,
657
- ): Service;
657
+ );
658
658
  info(forceFetch?: boolean): Promise<ServiceInfo>;
659
659
  setServiceInfo(serviceInfo: Partial<ServiceInfo>): Promise<void>;
660
660
  assets(forceFetch?: boolean): Promise<AssetsConfig>;
@@ -681,7 +681,7 @@ declare module 'pryv' {
681
681
  | 'ACCEPTED'
682
682
  | 'SIGNOUT';
683
683
 
684
- type StateChangeTypes = {
684
+ export type StateChangeTypes = {
685
685
  LOADING: {};
686
686
  INITIALIZED: {
687
687
  serviceInfo: ServiceInfo;
@@ -732,7 +732,7 @@ declare module 'pryv' {
732
732
  };
733
733
  };
734
734
 
735
- type SetupAuth = (
735
+ export type SetupAuth = (
736
736
  settings: AuthSettings,
737
737
  serviceInfoUrl: string,
738
738
  serviceCustomizations?: serviceCustomizations,
@@ -754,7 +754,7 @@ declare module 'pryv' {
754
754
  message?: string;
755
755
  };
756
756
 
757
- export interface CustomLoginButton {
757
+ export type CustomLoginButton = {
758
758
  init?: () => Promise<void>;
759
759
  getAuthorizationData(): string;
760
760
  onStateChange(state: AuthStatePayload): Promise<void>;
@@ -763,12 +763,12 @@ declare module 'pryv' {
763
763
  deleteAuthorizationData?: () => Promise<void>;
764
764
  }
765
765
 
766
- export interface AuthController {
767
- new (
766
+ export class AuthController {
767
+ constructor (
768
768
  authSettings: AuthSettings,
769
769
  service: Service,
770
770
  loginButton: CustomLoginButton,
771
- ): AuthController;
771
+ );
772
772
  init(): Promise<void>;
773
773
  stopAuthRequest(msg: string): void;
774
774
  handleClick(): Promise<void>;
@@ -783,21 +783,21 @@ declare module 'pryv' {
783
783
  get state(): AuthStatePayload;
784
784
  }
785
785
 
786
- export interface Auth {
786
+ export type Auth = {
787
787
  setupAuth: SetupAuth;
788
788
  AuthStates: AuthStates;
789
789
  AuthController: AuthController;
790
790
  }
791
791
 
792
- export interface CookieUtils {
792
+ export type CookieUtils = {
793
793
  set(cookieKey: string, value: any, expireInDays: number): void;
794
794
  get(cookieKey: string): any;
795
795
  del(cookieKey: string): void;
796
796
  }
797
797
 
798
- type getServiceInfoFromURL = (url: string) => string;
798
+ export type getServiceInfoFromURL = (url: string) => string;
799
799
 
800
- export interface Browser {
800
+ export type Browser = {
801
801
  LoginButton: CustomLoginButton;
802
802
  CookieUtils: CookieUtils;
803
803
  AuthStates: AuthStates;
@@ -805,12 +805,12 @@ declare module 'pryv' {
805
805
  serviceInfoFromUrl: getServiceInfoFromURL;
806
806
  }
807
807
 
808
- type TokenAndAPIEndpoint = {
808
+ export type TokenAndAPIEndpoint = {
809
809
  endpoint: string;
810
810
  token: string;
811
811
  };
812
812
 
813
- export interface utils {
813
+ export type utils = {
814
814
  isBrowser(): boolean;
815
815
  extractTokenAndAPIEndpoint(apiEndpoint: string): TokenAndAPIEndpoint;
816
816
  buildAPIEndpoint(tokenAndAPI: TokenAndAPIEndpoint): string;