@nizza/core 0.5.0-beta.0 → 0.5.0-beta.10

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,4 +1,11 @@
1
- import { NizzaStore } from '../types';
2
- export declare const nizza: NizzaStore;
3
- export declare const logger: import("loglevel").Logger;
4
- export declare const coreLogger: import("loglevel").Logger;
1
+ import { Logger } from 'loglevel';
2
+ import { StoreApi, UseBoundStore } from 'zustand';
3
+ import { NizzaConfig, NizzaProductDataSource, NizzaState, NizzaStore } from '../types';
4
+ export declare const logger: Logger;
5
+ export declare const coreLogger: Logger;
6
+ export declare let nizza: NizzaStore;
7
+ export declare let useNizza: UseBoundStore<StoreApi<NizzaState>>;
8
+ export declare function nizzaInit(): NizzaStore;
9
+ export declare function getInstance(): NizzaStore;
10
+ export declare function configure(config: NizzaConfig): Promise<void>;
11
+ export declare function setProductDataSource(dataSource: NizzaProductDataSource): void;
@@ -0,0 +1,2 @@
1
+ import { NizzaStore } from '../types';
2
+ export declare const nizza: NizzaStore;
@@ -1,6 +1,7 @@
1
+ import { StoreApi, UseBoundStore } from 'zustand';
1
2
  import { NizzaAccount } from '../../accounts';
2
3
  import { BroadcastChannelEventBus } from '../../event-buses';
3
- import { Logger } from '../../utils';
4
+ import { NizzaLogger } from '../../utils';
4
5
  import { NizzaProductDataSource } from './productDataSource';
5
6
  export interface GlobalStoreConfig {
6
7
  account: string;
@@ -8,18 +9,16 @@ export interface GlobalStoreConfig {
8
9
  }
9
10
  export interface GlobalState {
10
11
  config: GlobalStoreConfig | null;
11
- ok: boolean;
12
12
  account?: any;
13
- accountName?: string;
14
13
  productDataSource?: any;
15
14
  }
16
15
  export interface GlobalStore {
17
- state: GlobalState;
16
+ version: string;
17
+ store: UseBoundStore<StoreApi<any>>;
18
18
  instanceId: string;
19
- log: Logger;
19
+ log: NizzaLogger;
20
20
  eventBus: BroadcastChannelEventBus;
21
- readonly account?: any;
22
- readonly productDataSource?: any;
21
+ state: GlobalState;
23
22
  configure: (config: GlobalStoreConfig) => Promise<void>;
24
23
  setProductDataSource: (dataSource: any) => void;
25
24
  }
@@ -33,9 +32,8 @@ export interface NizzaState extends GlobalState {
33
32
  productDataSource?: NizzaProductDataSource;
34
33
  }
35
34
  export interface NizzaStore extends GlobalStore {
35
+ store: UseBoundStore<StoreApi<NizzaState>>;
36
36
  state: NizzaState;
37
37
  configure: (config: NizzaConfig) => Promise<void>;
38
38
  setProductDataSource: (dataSource: NizzaProductDataSource) => void;
39
- readonly account?: NizzaAccount;
40
- readonly productDataSource?: NizzaProductDataSource;
41
39
  }
@@ -1,7 +1,9 @@
1
1
  import { Logger as LogLevelLogger } from 'loglevel';
2
- export declare class Logger {
2
+ export declare class NizzaLogger {
3
+ private static instance;
3
4
  private defaultLevel;
4
5
  private namePrefix;
5
- constructor(namePrefix?: string);
6
+ private constructor();
7
+ static create(namePrefix?: string): NizzaLogger;
6
8
  createLogger(context: string): LogLevelLogger;
7
9
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.5.0-beta.0",
3
+ "version": "0.5.0-beta.10",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.cjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.5.0-beta.0",
3
+ "version": "0.5.0-beta.10",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.cjs",