pryv 2.4.1 → 2.4.3

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 +21 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pryv",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "Pryv JavaScript library",
5
5
  "keywords": [
6
6
  "Pryv",
package/src/index.d.ts CHANGED
@@ -560,7 +560,7 @@ declare module 'pryv' {
560
560
 
561
561
  export type APICallProgressHandler = (percentage: number) => void;
562
562
 
563
- export interface AccessInfo extends Access {
563
+ export type AccessInfo = Access & {
564
564
  calls: KeyValue;
565
565
  user: KeyValue;
566
566
  }
@@ -569,8 +569,8 @@ declare module 'pryv' {
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);
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>;
@@ -732,7 +732,7 @@ declare module 'pryv' {
732
732
  };
733
733
  };
734
734
 
735
- type SetupAuth = (
735
+ export const 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,34 +783,32 @@ declare module 'pryv' {
783
783
  get state(): AuthStatePayload;
784
784
  }
785
785
 
786
- export interface Auth {
786
+ export const Auth: {
787
787
  setupAuth: SetupAuth;
788
788
  AuthStates: AuthStates;
789
789
  AuthController: AuthController;
790
790
  }
791
791
 
792
- export interface CookieUtils {
793
- set(cookieKey: string, value: any, expireInDays: number): void;
794
- get(cookieKey: string): any;
795
- del(cookieKey: string): void;
796
- }
797
-
798
- type getServiceInfoFromURL = (url: string) => string;
792
+ export type getServiceInfoFromURL = (url: string) => string;
799
793
 
800
- export interface Browser {
794
+ export const Browser: {
801
795
  LoginButton: CustomLoginButton;
802
- CookieUtils: CookieUtils;
796
+ CookieUtils: {
797
+ set(cookieKey: string, value: any, expireInDays: number): void;
798
+ get(cookieKey: string): any;
799
+ del(cookieKey: string): void;
800
+ };
803
801
  AuthStates: AuthStates;
804
802
  setupAuth: SetupAuth;
805
803
  serviceInfoFromUrl: getServiceInfoFromURL;
806
804
  }
807
805
 
808
- type TokenAndAPIEndpoint = {
806
+ export type TokenAndAPIEndpoint = {
809
807
  endpoint: string;
810
808
  token: string;
811
809
  };
812
810
 
813
- export interface utils {
811
+ export const utils: {
814
812
  isBrowser(): boolean;
815
813
  extractTokenAndAPIEndpoint(apiEndpoint: string): TokenAndAPIEndpoint;
816
814
  buildAPIEndpoint(tokenAndAPI: TokenAndAPIEndpoint): string;
@@ -822,11 +820,6 @@ declare module 'pryv' {
822
820
  type version = string;
823
821
 
824
822
  let pryv: {
825
- Service: Service;
826
- Connection: Connection;
827
- Auth: Auth;
828
- Browser: Browser;
829
- utils: utils;
830
823
  version: version;
831
824
  };
832
825