@nizza/core 0.3.0-alpha.8 → 0.3.0-beta.0
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 +4 -4
- package/dist/index.mjs +1728 -1647
- package/dist/lib/stores/NizzaStore.d.ts +5 -4
- package/dist/lib/types/api-graphql-types.d.ts +292 -96
- package/dist/lib/types/api.d.ts +13 -0
- package/dist/lib/types/app-module.d.ts +2 -2
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/mobx-store.d.ts +2 -2
- package/dist/lib/types/nizzaGlobalObject.d.ts +1 -1
- package/dist/lib/types/products/product.d.ts +4 -4
- package/dist/lib/types/utils.d.ts +4 -4
- package/dist/lib/utils/Result.d.ts +1 -1
- package/dist/lib/utils/customStorage/utils.d.ts +1 -1
- package/dist/lib/utils/index.d.ts +2 -1
- package/dist/lib/utils/lazyLoad.d.ts +2 -2
- package/dist/lib/utils/mobxHooks.d.ts +24 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/typings/libs.d.ts +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { RouteProps } from 'react-router-dom';
|
|
2
2
|
import { StoreClass } from './mobx-store';
|
|
3
|
-
|
|
3
|
+
type Store<T extends {
|
|
4
4
|
new (): InstanceType<T>;
|
|
5
5
|
}> = Readonly<{
|
|
6
6
|
readonly class: T;
|
|
7
7
|
readonly value: InstanceType<T>;
|
|
8
8
|
}>;
|
|
9
|
-
export
|
|
9
|
+
export type AppModuleStoreList = Store<any>[];
|
|
10
10
|
export interface AppModule {
|
|
11
11
|
key: string;
|
|
12
12
|
label: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Constructor } from './utils';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type StoreClass<T = any> = Constructor<T>;
|
|
3
|
+
export type StoreFactory<T = any> = (...args: any[]) => T;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { NizzaProduct } from './base';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
2
|
+
export type NizzaGetProductHandler = (input: NizzaGetProductHandlerInput) => Promise<NizzaProduct>;
|
|
3
|
+
export type NizzaGetProductListHandler = (input: NizzaGetProductListHandlerInput) => Promise<NizzaProduct[]>;
|
|
4
|
+
type NizzaGetProductHandlerInput = {
|
|
5
5
|
productId: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type NizzaGetProductListHandlerInput = {
|
|
8
8
|
search?: string;
|
|
9
9
|
page?: number;
|
|
10
10
|
limit?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import environment from '../../environments/environment';
|
|
2
|
-
export
|
|
2
|
+
export type Constructor<T = any> = new (...args: any[]) => T;
|
|
3
3
|
export interface ApiV1Response<T = any> {
|
|
4
4
|
success: boolean;
|
|
5
5
|
message: string;
|
|
@@ -12,12 +12,12 @@ export interface ApiV2Response<T = any> {
|
|
|
12
12
|
duration: string;
|
|
13
13
|
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type Primitive = string | boolean | number;
|
|
16
16
|
export interface ApiCall extends RequestInit {
|
|
17
17
|
url: RequestInfo;
|
|
18
18
|
raw?: boolean;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
21
|
-
export
|
|
20
|
+
export type Environment<T> = typeof environment & T;
|
|
21
|
+
export type RequiredKeys<T> = {
|
|
22
22
|
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
|
|
23
23
|
}[keyof T];
|
|
@@ -9,7 +9,7 @@ export declare class Result<V, E = string> {
|
|
|
9
9
|
static fail<F = string>(error: F): Result<never, F>;
|
|
10
10
|
static combine(results: Result<any, any>[]): Result<any, any>;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export type Either<L, A> = Err<L, A> | Ok<L, A>;
|
|
13
13
|
export declare class Err<L, A> {
|
|
14
14
|
readonly value: L;
|
|
15
15
|
constructor(value: L);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type StorageType = 'localStorage' | 'sessionStorage';
|
|
2
2
|
export declare function isStorageAvailable(type: StorageType): boolean;
|
|
3
3
|
export declare function setProperty(obj: unknown, name: string, value: unknown): void;
|
|
4
4
|
export {};
|
|
@@ -2,6 +2,6 @@ import React, { ComponentProps, ReactNode } from 'react';
|
|
|
2
2
|
interface Opts {
|
|
3
3
|
fallback: ReactNode;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
export declare const lazyLoad: <T extends Promise<any>, U extends React.ComponentType<any>>(importFunc: () => T, selectorFunc?: ((s: Unpromisify<T>) => U) | undefined, opts?: Opts) => (props: React.ComponentProps<U>) => JSX.Element;
|
|
5
|
+
type Unpromisify<T> = T extends Promise<infer P> ? P : never;
|
|
6
|
+
export declare const lazyLoad: <T extends Promise<any>, U extends React.ComponentType<any>>(importFunc: () => T, selectorFunc?: ((s: Unpromisify<T>) => U) | undefined, opts?: Opts) => (props: React.ComponentProps<U>) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DependencyList, EffectCallback } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* This hook is just like the standard MobX autorun function, but it hooks into the React component
|
|
4
|
+
* lifecycle. This means the set up for the autorun only happens once, and it's automatically
|
|
5
|
+
* disposed of when the component unmounts.
|
|
6
|
+
*
|
|
7
|
+
* @param effect The function that's called when the store's properties are changed. This
|
|
8
|
+
* function is called initially when the autorun is initialized.
|
|
9
|
+
* @param deps The non-MobX dependencies that should retrigger the callback.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useAutorun(effect: EffectCallback, deps?: DependencyList): void;
|
|
12
|
+
export declare function useSelect<T>(trigger: () => T, deps?: DependencyList): T | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* This hook is just like the standard MobX reaction function, but it hooks into the React component
|
|
15
|
+
* lifecycle. This means the set up for the reaction only happens once, and it's automatically
|
|
16
|
+
* disposed of when the component unmounts.
|
|
17
|
+
*
|
|
18
|
+
* @param trigger This function determines what data will trigger the effect function to rerun.
|
|
19
|
+
* Only the *accessed* data is important in this function—not the return value.
|
|
20
|
+
* @param effect The function that's called when the store's properties are changed. This
|
|
21
|
+
* function is called initially when the autorun is initialized.
|
|
22
|
+
* @param deps The non-MobX dependencies that should retrigger the callback.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useReaction(trigger: () => any, effect: EffectCallback, deps?: DependencyList): void;
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
package/dist/typings/libs.d.ts
DELETED
|
File without changes
|