@nizza/core 0.5.0-beta.12 → 0.5.0-beta.14
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.
- package/dist/index.cjs +13 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4533 -1955
- package/dist/index.mjs.map +1 -1
- package/dist/lib/nizza-store/NizzaStore.d.ts +27 -11
- package/dist/lib/nizza-store/NizzaStore.v2.d.ts +3 -1
- package/dist/lib/nizza-store/NizzaStore.v3.d.ts +7 -0
- package/dist/lib/nizza-store/index.d.ts +1 -0
- package/dist/lib/nizza-store/useNizza.d.ts +11 -0
- package/dist/lib/types/nizza/globalStore.d.ts +7 -15
- package/dist/lib/utils/logger.d.ts +2 -4
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { NizzaAccount } from '../accounts';
|
|
2
|
+
import { BroadcastChannelEventBus } from '../event-buses';
|
|
3
|
+
import { NizzaStore as INizzaStore, NizzaConfig, NizzaProductDataSource } from '../types';
|
|
4
|
+
import { Logger } from '../utils/logger';
|
|
5
|
+
export declare class NizzaStore implements INizzaStore {
|
|
6
|
+
private static _instance;
|
|
7
|
+
readonly version = "1.0.5";
|
|
8
|
+
readonly instanceId: string;
|
|
9
|
+
private _config;
|
|
10
|
+
private _account?;
|
|
11
|
+
private _productDataSource;
|
|
12
|
+
private _eventBus;
|
|
13
|
+
readonly log: Logger;
|
|
14
|
+
private constructor();
|
|
15
|
+
static instance(): NizzaStore;
|
|
16
|
+
configure(config: NizzaConfig): Promise<void>;
|
|
17
|
+
private setAccount;
|
|
18
|
+
setProductDataSource(dataSource: NizzaProductDataSource): void;
|
|
19
|
+
get config(): NizzaConfig | null;
|
|
20
|
+
get account(): NizzaAccount | undefined;
|
|
21
|
+
get accountName(): string | undefined;
|
|
22
|
+
get productDataSource(): NizzaProductDataSource | undefined;
|
|
23
|
+
get eventBus(): BroadcastChannelEventBus;
|
|
24
|
+
}
|
|
25
|
+
export declare const nizza: NizzaStore;
|
|
26
|
+
export declare const logger: import("loglevel").Logger;
|
|
27
|
+
export declare const coreLogger: import("loglevel").Logger;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { NizzaStore } from '../types';
|
|
2
|
-
export declare const nizza: NizzaStore;
|
|
2
|
+
export declare const nizza: import("./NizzaStore").NizzaStore | NizzaStore;
|
|
3
|
+
export declare const logger: import("loglevel").Logger;
|
|
4
|
+
export declare const coreLogger: import("loglevel").Logger;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NizzaConfig, NizzaProductDataSource, NizzaStore } from '../types';
|
|
2
|
+
export declare const configure: (config: NizzaConfig) => Promise<void>;
|
|
3
|
+
export declare const setProductDataSource: (dataSource: NizzaProductDataSource) => void;
|
|
4
|
+
export declare const nizza: import("./NizzaStore").NizzaStore | NizzaStore;
|
|
5
|
+
export declare const useNizza: any;
|
|
6
|
+
export declare const logger: import("loglevel").Logger;
|
|
7
|
+
export declare const coreLogger: import("loglevel").Logger;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NizzaStore } from './NizzaStore';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook for selecting and observing specific properties from NizzaStore.
|
|
4
|
+
*
|
|
5
|
+
* @param selector - A function that receives the NizzaStore instance and returns the selected part.
|
|
6
|
+
* @returns The selected store part, being observed for changes.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const accountName = useNizza(store => store.accountName);
|
|
10
|
+
*/
|
|
11
|
+
export declare function useNizza<T>(selector: (store: NizzaStore) => T): T;
|
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
import { StoreApi, UseBoundStore } from 'zustand';
|
|
2
1
|
import { NizzaAccount } from '../../accounts';
|
|
3
2
|
import { BroadcastChannelEventBus } from '../../event-buses';
|
|
4
|
-
import {
|
|
3
|
+
import { Logger } from '../../utils';
|
|
5
4
|
import { NizzaProductDataSource } from './productDataSource';
|
|
6
5
|
export interface GlobalStoreConfig {
|
|
7
6
|
account: string;
|
|
8
7
|
getProductDataSource?: () => Promise<any> | any;
|
|
9
8
|
}
|
|
10
|
-
export interface GlobalState {
|
|
11
|
-
config: GlobalStoreConfig | null;
|
|
12
|
-
account?: any;
|
|
13
|
-
productDataSource?: any;
|
|
14
|
-
}
|
|
15
9
|
export interface GlobalStore {
|
|
16
10
|
version: string;
|
|
17
|
-
store: UseBoundStore<StoreApi<any>>;
|
|
18
11
|
instanceId: string;
|
|
19
|
-
|
|
12
|
+
config: GlobalStoreConfig | null;
|
|
13
|
+
account?: any;
|
|
14
|
+
productDataSource?: any;
|
|
15
|
+
log: Logger;
|
|
20
16
|
eventBus: BroadcastChannelEventBus;
|
|
21
|
-
state: GlobalState;
|
|
22
17
|
configure: (config: GlobalStoreConfig) => Promise<void>;
|
|
23
18
|
setProductDataSource: (dataSource: any) => void;
|
|
24
19
|
}
|
|
@@ -26,14 +21,11 @@ export interface NizzaConfig extends GlobalStoreConfig {
|
|
|
26
21
|
account: string;
|
|
27
22
|
getProductDataSource?: () => Promise<NizzaProductDataSource> | NizzaProductDataSource;
|
|
28
23
|
}
|
|
29
|
-
export interface
|
|
24
|
+
export interface NizzaStore extends GlobalStore {
|
|
30
25
|
config: NizzaConfig | null;
|
|
31
26
|
account?: NizzaAccount;
|
|
27
|
+
accountName?: string;
|
|
32
28
|
productDataSource?: NizzaProductDataSource;
|
|
33
|
-
}
|
|
34
|
-
export interface NizzaStore extends GlobalStore {
|
|
35
|
-
store: UseBoundStore<StoreApi<NizzaState>>;
|
|
36
|
-
state: NizzaState;
|
|
37
29
|
configure: (config: NizzaConfig) => Promise<void>;
|
|
38
30
|
setProductDataSource: (dataSource: NizzaProductDataSource) => void;
|
|
39
31
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Logger as LogLevelLogger } from 'loglevel';
|
|
2
|
-
export declare class
|
|
3
|
-
private static instance;
|
|
2
|
+
export declare class Logger {
|
|
4
3
|
private defaultLevel;
|
|
5
4
|
private namePrefix;
|
|
6
|
-
|
|
7
|
-
static create(namePrefix: string): NizzaLogger;
|
|
5
|
+
constructor(namePrefix?: string);
|
|
8
6
|
createLogger(context: string): LogLevelLogger;
|
|
9
7
|
}
|
package/dist/package.json
CHANGED