@junobuild/core 0.0.7 → 0.0.9

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.
@@ -1,3 +1,4 @@
1
1
  export declare const delegationIdentityExpiration: bigint;
2
2
  export declare const popupWidth = 576;
3
3
  export declare const popupHeight = 576;
4
+ export declare const AUTH_TIMER_INTERVAL = 1000;
@@ -1,12 +1,15 @@
1
+ import type { User } from './types/auth.types';
1
2
  import type { Environment } from './types/env.types';
3
+ import type { Unsubscribe } from './types/subscription.types';
2
4
  export { signIn, signOut } from './services/auth.services';
3
5
  export * from './services/doc.services';
4
6
  export * from './services/storage.services';
5
7
  export * from './types/auth.types';
6
8
  export * from './types/doc.types';
9
+ export * from './types/env.types';
7
10
  export { ListOrder, ListPaginate, ListParams, ListResults } from './types/list.types';
8
11
  export * from './types/satellite.types';
9
12
  export * from './types/storage.types';
10
- import type { User } from './types/auth.types';
11
- export declare const initJuno: (env: Environment) => Promise<void>;
12
- export declare const authSubscribe: (callback: (authUser: User | null) => void) => (() => void);
13
+ export * from './types/subscription.types';
14
+ export declare const initJuno: (env: Environment) => Promise<Unsubscribe[]>;
15
+ export declare const authSubscribe: (callback: (authUser: User | null) => void) => Unsubscribe;
@@ -0,0 +1,3 @@
1
+ import type { EnvironmentWorker } from '../types/env.types';
2
+ import type { Unsubscribe } from '../types/subscription.types';
3
+ export declare const initAuthTimeoutWorker: (auth: EnvironmentWorker) => Unsubscribe;
@@ -1,4 +1,5 @@
1
1
  import type { User } from '../types/auth.types';
2
+ import type { Unsubscribe } from '../types/subscription.types';
2
3
  import { Store } from './store';
3
4
  export declare class AuthStore extends Store<User | null> {
4
5
  private static instance;
@@ -7,7 +8,7 @@ export declare class AuthStore extends Store<User | null> {
7
8
  static getInstance(): AuthStore;
8
9
  set(authUser: User | null): void;
9
10
  get(): User | null;
10
- subscribe(callback: (data: User | null) => void): () => void;
11
+ subscribe(callback: (data: User | null) => void): Unsubscribe;
11
12
  isLoggedIn(): boolean;
12
13
  reset(): void;
13
14
  }
@@ -1,4 +1,10 @@
1
1
  import type { Satellite } from './satellite.types';
2
+ export type EnvironmentWorkerPath = string;
3
+ export type EnvironmentWorker = true | EnvironmentWorkerPath;
4
+ export interface EnvironmentWorkers {
5
+ auth?: EnvironmentWorker;
6
+ }
2
7
  export type Environment = {
3
8
  localIdentityCanisterId?: string;
9
+ workers?: EnvironmentWorkers;
4
10
  } & Required<Pick<Satellite, 'satelliteId'>>;
@@ -0,0 +1,5 @@
1
+ export type PostMessageRequest = 'junoStartAuthTimer' | 'junoStopAuthTimer';
2
+ export type PostMessageResponse = 'junoSignOutAuthTimer';
3
+ export interface PostMessage {
4
+ msg: PostMessageRequest | PostMessageResponse;
5
+ }
@@ -0,0 +1 @@
1
+ export type Unsubscribe = () => void;
@@ -0,0 +1,2 @@
1
+ import { AuthClient } from '@dfinity/auth-client';
2
+ export declare const createAuthClient: () => Promise<AuthClient>;
@@ -0,0 +1,4 @@
1
+ export declare const emit: <T>({ message, detail }: {
2
+ message: string;
3
+ detail?: T | undefined;
4
+ }) => void;
@@ -0,0 +1,6 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * The timer is executed only if user has signed in
4
+ */
5
+ export declare const startTimer: () => NodeJS.Timer;
6
+ export declare const stopTimer: () => void;