@finema/core 1.0.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.
@@ -0,0 +1,2 @@
1
+ export * from './utils';
2
+ export * from './lib';
@@ -0,0 +1,30 @@
1
+ import { AxiosInstance, AxiosRequestConfig, CancelTokenSource, CancelTokenStatic, Method } from 'axios';
2
+ export interface IResponse<T = any> {
3
+ data: T;
4
+ status: number;
5
+ statusText: string;
6
+ headers: any;
7
+ config: AxiosRequestConfig;
8
+ request?: any;
9
+ }
10
+ export interface IRequester {
11
+ get: <T>(path: string, options?: AxiosRequestConfig) => Promise<IResponse<T>>;
12
+ put: <T>(path: string, payload: any, options?: AxiosRequestConfig) => Promise<IResponse<T>>;
13
+ delete: <T>(path: string, options?: AxiosRequestConfig) => Promise<IResponse<T>>;
14
+ post: <T>(path: string, payload: any, options?: AxiosRequestConfig) => Promise<IResponse<T>>;
15
+ create: <T>(method: Method, path: string, payload: any, options?: AxiosRequestConfig) => Promise<IResponse<T>>;
16
+ }
17
+ export declare class Requester {
18
+ cancelToken: CancelTokenStatic;
19
+ source: CancelTokenSource;
20
+ isCancel: (value: any) => boolean;
21
+ service: AxiosInstance;
22
+ private readonly options;
23
+ constructor(options?: AxiosRequestConfig);
24
+ get<T>(path: string, options?: AxiosRequestConfig): Promise<IResponse<T>>;
25
+ put<T>(path: string, payload: any, options?: AxiosRequestConfig): Promise<IResponse<T>>;
26
+ delete<T>(path: string, options?: AxiosRequestConfig): Promise<IResponse<T>>;
27
+ post<T>(path: string, payload: any, options?: AxiosRequestConfig): Promise<IResponse<T>>;
28
+ create<T>(method: Method, path: string, payload: any, options?: AxiosRequestConfig): Promise<IResponse<T>>;
29
+ }
30
+ export declare const NewRequester: IRequester;
@@ -0,0 +1,3 @@
1
+ import { IAPIListState, IAPIOptions, IStatus } from './types';
2
+ import { IListLoaderOptions, IListRunLoaderOptions } from './loaderTypes';
3
+ export declare const apiListHelper: <T, O>(state: () => IAPIListState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateItems: (data: T[]) => void, opts: IListLoaderOptions<T, O> & IListRunLoaderOptions<T, O>) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { IAPIObjectState, IAPIOptions, IStatus } from './types';
2
+ import { IObjectLoaderOptions, IObjectRunLoaderOptions } from './loaderTypes';
3
+ export declare const apiObjectHelper: <T, B, O>(state: () => IAPIObjectState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, data: B | undefined, opts: IObjectLoaderOptions<T, B, O> & IObjectRunLoaderOptions<T, O>) => Promise<void>;
@@ -0,0 +1,7 @@
1
+ import { IAPIAddState, IAPIDeleteState, IAPIFetchState, IAPIFindState, IAPIOptions, IAPIUpdateState, IPageOptions, IStatus } from './types';
2
+ import { IPageDeleteLoaderOptions, IPageFetchLoaderOptions, IPageFindLoaderOptions, IPageLoaderOptions, IPageUpdateLoaderOptions } from './loaderTypes';
3
+ export declare const apiAddHelper: <T>(state: () => IAPIAddState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, onUpdateItems: (data: any[]) => void, data: any, opts: IPageLoaderOptions<any> & IPageFetchLoaderOptions) => Promise<void>;
4
+ export declare const apiDeleteHelper: <T>(state: () => IAPIDeleteState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, _onUpdateData: (data: T) => void, onUpdateItems: (data: T[]) => void, id: string | number, opts: IPageLoaderOptions<any> & IPageDeleteLoaderOptions) => Promise<void>;
5
+ export declare const apiFetchHelper: <T>(state: () => IAPIFetchState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IPageOptions) => void, onUpdateItems: (items: T[]) => void, page: number, query: string, opts: IPageLoaderOptions<T> & IPageFetchLoaderOptions<any>) => Promise<void>;
6
+ export declare const apiFindHelper: <T>(state: () => IAPIFindState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: any) => void, id: string | number, opts: IPageLoaderOptions<T> & IPageFindLoaderOptions<Record<string, any>>) => Promise<void>;
7
+ export declare const updateHelper: <T>(state: () => IAPIUpdateState<T>, onUpdateStatus: (status: IStatus) => void, onUpdateOptions: (options: IAPIOptions) => void, onUpdateData: (data: T) => void, _onUpdateItems: (data: T[]) => void, onUpdateOldData: (data: T) => void, id: string | number, data: any, opts: IPageLoaderOptions<any> & IPageUpdateLoaderOptions) => Promise<void>;
@@ -0,0 +1,4 @@
1
+ export declare const CONFIG: {
2
+ LIMIT_PER_PAGE: number;
3
+ DEFAULT_PRIMARY: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ import { IListLoaderOptions, IUseListLoader } from './loaderTypes';
2
+ export declare const useListLoader: <T = any, O = Record<string, any>>(loaderOptions: IListLoaderOptions<T, O>) => IUseListLoader<T, O>;
@@ -0,0 +1,2 @@
1
+ import { IObjectLoaderOptions, IUseObjectLoader } from './loaderTypes';
2
+ export declare const useObjectLoader: <T = any, B = any, O = Record<string, any>>(loaderOptions: IObjectLoaderOptions<T, B, O>) => IUseObjectLoader<T, B, O>;
@@ -0,0 +1,11 @@
1
+ import { IPageLoaderOptions, IUsePageLoader } from './loaderTypes';
2
+ export declare const initPageOptions: () => {
3
+ currentPageCount: number;
4
+ currentPage: number;
5
+ totalPage: number;
6
+ totalCount: number;
7
+ limit: number;
8
+ search: string;
9
+ primary: string;
10
+ };
11
+ export declare const usePageLoader: <T = any>(loaderOptions: IPageLoaderOptions<T>) => IUsePageLoader<T>;
@@ -0,0 +1,133 @@
1
+ import { AxiosRequestConfig, Method } from 'axios';
2
+ import { Ref, UnwrapRef } from 'vue';
3
+ import { IAPIOptions, IPageOptions, IStatus } from './types';
4
+ export interface IPageFetchLoaderOptions<D = Record<string, any>> {
5
+ isMock?: boolean;
6
+ params?: Record<string, any>;
7
+ expire?: number;
8
+ data?: D;
9
+ }
10
+ export interface IPageFindLoaderOptions<D = Record<string, any>> {
11
+ isMock?: boolean;
12
+ params?: Record<string, any>;
13
+ expire?: number;
14
+ data?: D;
15
+ }
16
+ export interface IPageUpdateLoaderOptions<D = Record<string, any>> {
17
+ isMock?: boolean;
18
+ params?: Record<string, any>;
19
+ data?: D;
20
+ }
21
+ export interface IPageDeleteLoaderOptions<D = Record<string, any>> {
22
+ isMock?: boolean;
23
+ params?: Record<string, any>;
24
+ data?: D;
25
+ }
26
+ export interface IPageAddLoaderOptions<D = Record<string, any>> {
27
+ isMock?: boolean;
28
+ params?: Record<string, any>;
29
+ data?: D;
30
+ }
31
+ export interface IObjectRunLoaderOptions<T, D = Record<string, any>> {
32
+ mockItem?: T;
33
+ isMock?: boolean;
34
+ params?: Record<string, any>;
35
+ expire?: number;
36
+ data?: D;
37
+ }
38
+ export interface IListRunLoaderOptions<T, D = Record<string, any>> {
39
+ mockItems?: T[];
40
+ isMock?: boolean;
41
+ params?: Record<string, any>;
42
+ expire?: number;
43
+ data?: D;
44
+ }
45
+ export interface IPageLoaderOptions<T> {
46
+ prefix?: string;
47
+ baseURL: string;
48
+ primary?: string;
49
+ isMock?: boolean;
50
+ mockItems?: T[];
51
+ getBaseRequestOptions?: () => AxiosRequestConfig;
52
+ fetch?: {
53
+ getURL?: (page: number, query: string, opts: IPageFetchLoaderOptions<any>) => string;
54
+ getRequestOptions?: (page: number, query: string, opts: IPageFetchLoaderOptions<any>) => AxiosRequestConfig;
55
+ };
56
+ find?: {
57
+ getURL?: (id: string | number, opts: IPageFindLoaderOptions<any>) => string;
58
+ getRequestOptions?: (id: string | number, opts: IPageFindLoaderOptions<any>) => AxiosRequestConfig;
59
+ };
60
+ update?: {
61
+ getURL?: (id: string | number, data: any, opts: IPageUpdateLoaderOptions<any>) => string;
62
+ getRequestOptions?: (id: string | number, data: any, opts: IPageUpdateLoaderOptions<any>) => AxiosRequestConfig;
63
+ };
64
+ delete?: {
65
+ getURL?: (id: string | number, opts: IPageDeleteLoaderOptions<any>) => string;
66
+ getRequestOptions?: (id: string | number, opts: IPageDeleteLoaderOptions<any>) => AxiosRequestConfig;
67
+ };
68
+ add?: {
69
+ getURL?: (data: any, opts: IPageAddLoaderOptions<any>) => string;
70
+ getRequestOptions?: (data: any, opts: IPageAddLoaderOptions<any>) => AxiosRequestConfig;
71
+ };
72
+ }
73
+ export interface IObjectLoaderOptions<T, B, O> {
74
+ prefix?: string;
75
+ url: string;
76
+ method: Method;
77
+ primary?: string;
78
+ mockItem?: T;
79
+ getURL?: (data: B | undefined, opts: IObjectRunLoaderOptions<T, O>) => string;
80
+ getRequestOptions?: (data: B | undefined, opts: IObjectRunLoaderOptions<T, O>) => AxiosRequestConfig;
81
+ }
82
+ export interface IListLoaderOptions<T, O> {
83
+ prefix?: string;
84
+ url: string;
85
+ primary?: string;
86
+ mockItems?: T[];
87
+ getURL?: (opts: IListRunLoaderOptions<T, O>) => string;
88
+ getRequestOptions?: (opts: IListRunLoaderOptions<T, O>) => AxiosRequestConfig;
89
+ }
90
+ export interface IUsePageLoader<T> {
91
+ fetchStatus: Ref<IStatus>;
92
+ findStatus: Ref<IStatus>;
93
+ addStatus: Ref<IStatus>;
94
+ updateStatus: Ref<IStatus>;
95
+ deleteStatus: Ref<IStatus>;
96
+ fetchOptions: Ref<IPageOptions>;
97
+ deleteOptions: Ref<IAPIOptions>;
98
+ addOptions: Ref<IAPIOptions>;
99
+ findOptions: Ref<IAPIOptions>;
100
+ updateOptions: Ref<IAPIOptions>;
101
+ clear: () => void;
102
+ fetch: (page?: number, query?: string, opts?: IPageFetchLoaderOptions) => Promise<void>;
103
+ search: (query: string, opts?: IPageFetchLoaderOptions) => Promise<void>;
104
+ find: (id: string, opts?: any) => Promise<void>;
105
+ update: (id: string, data: any, opts?: any) => Promise<void>;
106
+ add: (data: any, opts?: IPageAddLoaderOptions) => Promise<void>;
107
+ remove: (id: string, opts?: IPageDeleteLoaderOptions) => Promise<void>;
108
+ setFetchLoading: () => void;
109
+ setFindLoading: () => void;
110
+ fetchItems: Ref<UnwrapRef<T[]>>;
111
+ findItem: Ref<UnwrapRef<T | null>>;
112
+ deleteItem: Ref<UnwrapRef<T | null>>;
113
+ addItem: Ref<UnwrapRef<T | null>>;
114
+ updateItem: Ref<UnwrapRef<T | null>>;
115
+ }
116
+ export interface IUseObjectLoader<T, B, O> {
117
+ status: Ref<IStatus>;
118
+ data: Ref<UnwrapRef<T | null>>;
119
+ options: Ref<IAPIOptions>;
120
+ run: (data?: B, opts?: IObjectRunLoaderOptions<T, O>) => Promise<void>;
121
+ clear: () => void;
122
+ setLoading: () => void;
123
+ setData: (data: T | null) => void;
124
+ }
125
+ export interface IUseListLoader<T, O> {
126
+ status: Ref<IStatus>;
127
+ items: Ref<UnwrapRef<T[]>>;
128
+ options: Ref<Record<string, any>>;
129
+ run: (opts?: IListRunLoaderOptions<T, O>) => void;
130
+ setItems: (items: T[]) => void;
131
+ clear: () => void;
132
+ setLoading: () => void;
133
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,89 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ export interface IAPIOptions {
3
+ _status?: number;
4
+ _timestamp?: number;
5
+ request?: Partial<AxiosRequestConfig>;
6
+ [key: string]: any;
7
+ }
8
+ export interface IPageOptions extends IAPIOptions {
9
+ currentPageCount: number;
10
+ currentPage: number;
11
+ totalPage: number;
12
+ totalCount: number;
13
+ limit: number;
14
+ search?: string;
15
+ primary?: string;
16
+ }
17
+ export interface IStatus {
18
+ isError: boolean;
19
+ isSuccess: boolean;
20
+ isLoading: boolean;
21
+ isLoaded: boolean;
22
+ errorData: any | null;
23
+ }
24
+ export interface IAPIFetchState<T> {
25
+ items: T[];
26
+ status: IStatus;
27
+ options: IPageOptions;
28
+ }
29
+ export interface IAPIFindState<T> {
30
+ data: T;
31
+ status: IStatus;
32
+ options: IAPIOptions;
33
+ }
34
+ export interface IAPIAddState<T> {
35
+ data: T;
36
+ items: T[];
37
+ status: IStatus;
38
+ options: IAPIOptions;
39
+ }
40
+ export interface IAPIObjectState<T> {
41
+ data: T | null;
42
+ status: IStatus;
43
+ options: IAPIOptions;
44
+ }
45
+ export interface IAPIListState<T> {
46
+ items: T[];
47
+ status: IStatus;
48
+ options: IAPIOptions;
49
+ }
50
+ export interface IAPIDeleteState<T> {
51
+ data: T;
52
+ items: T[];
53
+ status: IStatus;
54
+ options: IAPIOptions;
55
+ }
56
+ export interface IAPIUpdateState<T> {
57
+ data: T;
58
+ oldData: T;
59
+ items: T[] | undefined | null;
60
+ status: IStatus;
61
+ options: IAPIOptions;
62
+ }
63
+ export interface IPageState<T> {
64
+ deleteStatus: IStatus;
65
+ updateStatus: IStatus;
66
+ addStatus: IStatus;
67
+ findStatus: IStatus;
68
+ fetchStatus: IStatus;
69
+ fetchItems: T[];
70
+ findItem: null | T;
71
+ addItem: null | T;
72
+ updateItem: null | T;
73
+ deleteItem: null | T | any;
74
+ findOptions: object;
75
+ addOptions: object;
76
+ deleteOptions: object;
77
+ updateOptions: object;
78
+ fetchOptions: IPageOptions;
79
+ }
80
+ export interface IObjectState<T> {
81
+ data: T | null;
82
+ status: IStatus;
83
+ options: IAPIOptions;
84
+ }
85
+ export interface IListState<T> {
86
+ items: T[];
87
+ status: IStatus;
88
+ options: IAPIOptions;
89
+ }
@@ -0,0 +1,9 @@
1
+ interface IGetParams {
2
+ params?: {
3
+ [key: string]: any;
4
+ };
5
+ }
6
+ export declare const getParams: (opts: IGetParams, reqOptions: IGetParams) => {
7
+ [key: string]: any;
8
+ } | undefined;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ export * from './Requester';
2
+ export * from './api/apiListHelper';
3
+ export * from './api/apiObjectHelper';
4
+ export * from './api/apiPageHelper';
5
+ export * from './api/loaderList';
6
+ export * from './api/loaderObject';
7
+ export * from './api/loaderPage';
8
+ export * from './api/loaderTypes';
9
+ export * from './api/types';
10
+ export * from './api/utils';
@@ -0,0 +1,7 @@
1
+ import { IOption } from './types';
2
+ export declare class ArrayHelper {
3
+ static toOptions(data: any[], valueAttr?: string, labelAttr?: string): IOption[];
4
+ static toArray<T>(value: any): Array<T | any>;
5
+ static isEmpty(value: any): boolean;
6
+ static create: (length: number) => any[];
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { CookieSerializeOptions } from 'cookie';
2
+ export declare class CookieHelper {
3
+ static set(name: string, data: any, options?: CookieSerializeOptions): void;
4
+ static get(name: string, options?: {
5
+ fromRes?: boolean;
6
+ parseJSON?: boolean;
7
+ }): any;
8
+ static remove(name: string, opts?: CookieSerializeOptions): void;
9
+ }
@@ -0,0 +1,6 @@
1
+ export declare class FileHelper {
2
+ static toBase64: (file: File) => Promise<string>;
3
+ static printByURL: (link: string) => void;
4
+ static readFileAsync: (file: File) => Promise<string>;
5
+ static dataURLtoFile: (dataUrl: string, filename: string) => Promise<File>;
6
+ }
@@ -0,0 +1,18 @@
1
+ import { AxiosError } from 'axios';
2
+ import { IStatus } from '../lib/api/types.ts';
3
+ import { IOption } from './types';
4
+ export declare class ObjectHelper {
5
+ static createOption(value: any, label?: string): IOption;
6
+ static toOption(data: any, valueAttr?: string, labelAttr?: string): IOption;
7
+ static toOptions(data: any, valueAttr?: string, labelAttr?: string): IOption[];
8
+ static toStatus(obj: any): IStatus;
9
+ static toLoadingStatus(obj: any): any;
10
+ static toItemsSuccessStatus(obj: any, items: any[]): any;
11
+ static toObjectSuccessStatus(obj: any, data?: any): any;
12
+ static toErrorStatus(obj: any, error: AxiosError | any): any;
13
+ static toSuccessStatus(obj: any): any;
14
+ static toCompleteStatus(obj: any): any;
15
+ static createStatus(): IStatus;
16
+ static isInvalidParams(errorData: any): boolean;
17
+ static isEmpty: (object: any) => boolean;
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { IError } from './types';
2
+ export declare class ParamHelper {
3
+ static getBoolTrue: (bool: any) => boolean;
4
+ static getBoolFalse: (bool: any) => boolean;
5
+ static isNotFoundError: (error: IError | any) => boolean;
6
+ static isChangeWithFalse: (value: boolean, oldValue: boolean) => boolean;
7
+ static isChangeWithTrue: (value: boolean, oldValue: boolean) => boolean;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare class StringHelper {
2
+ static genString: (length?: number) => string;
3
+ static withComma: (value?: number | string) => string;
4
+ static copyToClipBoard: (value?: string) => Promise<void>;
5
+ static split: (str: string | null | undefined, separator: string | RegExp) => string[];
6
+ static joinURL: (value: any, value2: any) => string;
7
+ static truncate: (str: any, num?: number) => any;
8
+ static getError: (errorData: {
9
+ code: string;
10
+ message: any;
11
+ fields: object;
12
+ } | any, defaultErrorMessage?: string) => any;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export declare class TimeHelper {
2
+ static toUTC: (time: string) => string;
3
+ static toLocal: (time: string) => string;
4
+ static getCurrentDate: () => string;
5
+ static getDateFormTime: (time: string) => string;
6
+ static getDateFormTimeWithLocal: (time: string) => string;
7
+ static getISODateTimeFormTime: (time: string) => string;
8
+ static getDateTimeFormTime: (time: string) => string;
9
+ static getTimeFormTime: (time: string) => string;
10
+ static getCurrentDateTime: () => string;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import * as fake from '@faker-js/faker';
2
+ export declare const faker: typeof fake;
@@ -0,0 +1,9 @@
1
+ export * from './ObjectHelper';
2
+ export * from './ParamHelper';
3
+ export * from './TimeHelper';
4
+ export * from './ArrayHelper';
5
+ export * from './FileHelper';
6
+ export * from './StringHelper';
7
+ export * from './CookieHelper';
8
+ export * from './faker';
9
+ export * from './lodash';
@@ -0,0 +1,99 @@
1
+ import * as lodash from 'lodash';
2
+ export declare const _get: {
3
+ <TObject extends object, TKey extends keyof TObject>(object: TObject, path: TKey | [TKey]): TObject[TKey];
4
+ <TObject_1 extends object, TKey_1 extends keyof TObject_1>(object: TObject_1 | null | undefined, path: TKey_1 | [TKey_1]): TObject_1[TKey_1] | undefined;
5
+ <TObject_2 extends object, TKey_2 extends keyof TObject_2, TDefault>(object: TObject_2 | null | undefined, path: TKey_2 | [TKey_2], defaultValue: TDefault): TDefault | Exclude<TObject_2[TKey_2], undefined>;
6
+ <TObject_3 extends object, TKey1 extends keyof TObject_3, TKey2 extends keyof TObject_3[TKey1]>(object: TObject_3, path: [TKey1, TKey2]): TObject_3[TKey1][TKey2];
7
+ <TObject_4 extends object, TKey1_1 extends keyof TObject_4, TKey2_1 extends keyof TObject_4[TKey1_1]>(object: TObject_4 | null | undefined, path: [TKey1_1, TKey2_1]): TObject_4[TKey1_1][TKey2_1] | undefined;
8
+ <TObject_5 extends object, TKey1_2 extends keyof TObject_5, TKey2_2 extends keyof TObject_5[TKey1_2], TDefault_1>(object: TObject_5 | null | undefined, path: [TKey1_2, TKey2_2], defaultValue: TDefault_1): TDefault_1 | Exclude<TObject_5[TKey1_2][TKey2_2], undefined>;
9
+ <TObject_6 extends object, TKey1_3 extends keyof TObject_6, TKey2_3 extends keyof TObject_6[TKey1_3], TKey3 extends keyof TObject_6[TKey1_3][TKey2_3]>(object: TObject_6, path: [TKey1_3, TKey2_3, TKey3]): TObject_6[TKey1_3][TKey2_3][TKey3];
10
+ <TObject_7 extends object, TKey1_4 extends keyof TObject_7, TKey2_4 extends keyof TObject_7[TKey1_4], TKey3_1 extends keyof TObject_7[TKey1_4][TKey2_4]>(object: TObject_7 | null | undefined, path: [TKey1_4, TKey2_4, TKey3_1]): TObject_7[TKey1_4][TKey2_4][TKey3_1] | undefined;
11
+ <TObject_8 extends object, TKey1_5 extends keyof TObject_8, TKey2_5 extends keyof TObject_8[TKey1_5], TKey3_2 extends keyof TObject_8[TKey1_5][TKey2_5], TDefault_2>(object: TObject_8 | null | undefined, path: [TKey1_5, TKey2_5, TKey3_2], defaultValue: TDefault_2): TDefault_2 | Exclude<TObject_8[TKey1_5][TKey2_5][TKey3_2], undefined>;
12
+ <TObject_9 extends object, TKey1_6 extends keyof TObject_9, TKey2_6 extends keyof TObject_9[TKey1_6], TKey3_3 extends keyof TObject_9[TKey1_6][TKey2_6], TKey4 extends keyof TObject_9[TKey1_6][TKey2_6][TKey3_3]>(object: TObject_9, path: [TKey1_6, TKey2_6, TKey3_3, TKey4]): TObject_9[TKey1_6][TKey2_6][TKey3_3][TKey4];
13
+ <TObject_10 extends object, TKey1_7 extends keyof TObject_10, TKey2_7 extends keyof TObject_10[TKey1_7], TKey3_4 extends keyof TObject_10[TKey1_7][TKey2_7], TKey4_1 extends keyof TObject_10[TKey1_7][TKey2_7][TKey3_4]>(object: TObject_10 | null | undefined, path: [TKey1_7, TKey2_7, TKey3_4, TKey4_1]): TObject_10[TKey1_7][TKey2_7][TKey3_4][TKey4_1] | undefined;
14
+ <TObject_11 extends object, TKey1_8 extends keyof TObject_11, TKey2_8 extends keyof TObject_11[TKey1_8], TKey3_5 extends keyof TObject_11[TKey1_8][TKey2_8], TKey4_2 extends keyof TObject_11[TKey1_8][TKey2_8][TKey3_5], TDefault_3>(object: TObject_11 | null | undefined, path: [TKey1_8, TKey2_8, TKey3_5, TKey4_2], defaultValue: TDefault_3): TDefault_3 | Exclude<TObject_11[TKey1_8][TKey2_8][TKey3_5][TKey4_2], undefined>;
15
+ <T>(object: lodash.NumericDictionary<T>, path: number): T;
16
+ <T_1>(object: lodash.NumericDictionary<T_1> | null | undefined, path: number): T_1 | undefined;
17
+ <T_2, TDefault_4>(object: lodash.NumericDictionary<T_2> | null | undefined, path: number, defaultValue: TDefault_4): T_2 | TDefault_4;
18
+ <TDefault_5>(object: null | undefined, path: lodash.PropertyPath, defaultValue: TDefault_5): TDefault_5;
19
+ (object: null | undefined, path: lodash.PropertyPath): undefined;
20
+ <TObject_12, TPath extends string>(data: TObject_12, path: TPath): string extends TPath ? any : lodash.GetFieldType<TObject_12, TPath>;
21
+ <TObject_13, TPath_1 extends string, TDefault_6 = lodash.GetFieldType<TObject_13, TPath_1>>(data: TObject_13, path: TPath_1, defaultValue: TDefault_6): TDefault_6 | Exclude<lodash.GetFieldType<TObject_13, TPath_1>, null | undefined>;
22
+ (object: any, path: lodash.PropertyPath, defaultValue?: any): any;
23
+ };
24
+ export declare const _range: {
25
+ (start: number, end?: number | undefined, step?: number | undefined): number[];
26
+ (end: number, index: string | number, guard: object): number[];
27
+ };
28
+ export declare const _concat: <T>(...values: lodash.Many<T>[]) => T[];
29
+ export declare const _toNumber: (value: any) => number;
30
+ export declare const _isUndefined: (value: any) => value is undefined;
31
+ export declare const _dropRight: <T>(array: lodash.List<T> | null | undefined, n?: number | undefined) => T[];
32
+ export declare const _intersection: <T>(...arrays: (lodash.List<T> | null | undefined)[]) => T[];
33
+ export declare const _set: {
34
+ <T extends object>(object: T, path: lodash.PropertyPath, value: any): T;
35
+ <TResult>(object: object, path: lodash.PropertyPath, value: any): TResult;
36
+ };
37
+ export declare const _map: {
38
+ <T, TResult>(collection: T[] | null | undefined, iteratee: lodash.ArrayIterator<T, TResult>): TResult[];
39
+ <T_1, TResult_1>(collection: lodash.List<T_1> | null | undefined, iteratee: lodash.ListIterator<T_1, TResult_1>): TResult_1[];
40
+ <T_2>(collection: lodash.Dictionary<T_2> | lodash.NumericDictionary<T_2> | null | undefined): T_2[];
41
+ <T_3 extends object, TResult_2>(collection: T_3 | null | undefined, iteratee: lodash.ObjectIterator<T_3, TResult_2>): TResult_2[];
42
+ <T_4, K extends keyof T_4>(collection: lodash.Dictionary<T_4> | lodash.NumericDictionary<T_4> | null | undefined, iteratee: K): T_4[K][];
43
+ <T_5>(collection: lodash.Dictionary<T_5> | lodash.NumericDictionary<T_5> | null | undefined, iteratee?: string | undefined): any[];
44
+ <T_6>(collection: lodash.Dictionary<T_6> | lodash.NumericDictionary<T_6> | null | undefined, iteratee?: object | undefined): boolean[];
45
+ };
46
+ export declare const _flatDeep: <T>(array: lodash.ListOfRecursiveArraysOrValues<T> | null | undefined) => lodash.Flat<T>[];
47
+ export declare const _uniq: <T>(array: lodash.List<T> | null | undefined) => T[];
48
+ export declare const _sortBy: {
49
+ <T>(collection: lodash.List<T> | null | undefined, ...iteratees: lodash.Many<lodash.ListIteratee<T>>[]): T[];
50
+ <T_1 extends object>(collection: T_1 | null | undefined, ...iteratees: lodash.Many<lodash.ObjectIteratee<T_1>>[]): T_1[keyof T_1][];
51
+ };
52
+ export declare const _uniqBy: <T>(array: lodash.List<T> | null | undefined, iteratee: lodash.ValueIteratee<T>) => T[];
53
+ export declare const _random: {
54
+ (floating?: boolean | undefined): number;
55
+ (max: number, floating?: boolean | undefined): number;
56
+ (min: number, max: number, floating?: boolean | undefined): number;
57
+ (min: number, index: string | number, guard: object): number;
58
+ };
59
+ export declare const _cloneDeep: <T>(value: T) => T;
60
+ export declare const _isEmpty: {
61
+ <T extends {
62
+ __trapAny: any;
63
+ }>(value?: T | undefined): boolean;
64
+ (value: string): value is "";
65
+ (value: Map<any, any> | Set<any> | lodash.List<any> | null | undefined): boolean;
66
+ (value: object): boolean;
67
+ <T_1 extends object>(value: T_1 | null | undefined): value is lodash.EmptyObjectOf<T_1> | null | undefined;
68
+ (value?: any): boolean;
69
+ };
70
+ export declare const _isObject: (value?: any) => value is object;
71
+ export declare const _isArray: {
72
+ (value?: any): value is any[];
73
+ <T>(value?: any): value is any[];
74
+ };
75
+ export declare const _findIndex: <T>(array: lodash.List<T> | null | undefined, predicate?: lodash.ListIterateeCustom<T, boolean> | undefined, fromIndex?: number | undefined) => number;
76
+ export declare const _isEqual: (value: any, other: any) => boolean;
77
+ export declare const _difference: <T>(array: lodash.List<T> | null | undefined, ...values: lodash.List<T>[]) => T[];
78
+ export declare const _shuffle: {
79
+ <T>(collection: lodash.List<T> | null | undefined): T[];
80
+ <T_1 extends object>(collection: T_1 | null | undefined): T_1[keyof T_1][];
81
+ };
82
+ export declare const _size: (collection: string | object | null | undefined) => number;
83
+ export declare const _toPairs: {
84
+ <T>(object?: lodash.Dictionary<T> | lodash.NumericDictionary<T> | undefined): [string, T][];
85
+ (object?: object | undefined): [string, any][];
86
+ };
87
+ export declare const _orderBy: {
88
+ <T>(collection: lodash.List<T> | null | undefined, iteratees?: lodash.Many<lodash.ListIterator<T, unknown>> | undefined, orders?: lodash.Many<boolean | "asc" | "desc"> | undefined): T[];
89
+ <T_1>(collection: lodash.List<T_1> | null | undefined, iteratees?: lodash.Many<lodash.ListIteratee<T_1>> | undefined, orders?: lodash.Many<boolean | "asc" | "desc"> | undefined): T_1[];
90
+ <T_2 extends object>(collection: T_2 | null | undefined, iteratees?: lodash.Many<lodash.ObjectIterator<T_2, unknown>> | undefined, orders?: lodash.Many<boolean | "asc" | "desc"> | undefined): T_2[keyof T_2][];
91
+ <T_3 extends object>(collection: T_3 | null | undefined, iteratees?: lodash.Many<lodash.ObjectIteratee<T_3>> | undefined, orders?: lodash.Many<boolean | "asc" | "desc"> | undefined): T_3[keyof T_3][];
92
+ };
93
+ export declare const _fromPairs: {
94
+ <T>(pairs: lodash.List<[lodash.PropertyName, T]> | null | undefined): lodash.Dictionary<T>;
95
+ (pairs: lodash.List<any[]> | null | undefined): lodash.Dictionary<any>;
96
+ };
97
+ export declare const _xor: <T>(...arrays: (lodash.List<T> | null | undefined)[]) => T[];
98
+ export declare const _clone: (object: any) => any;
99
+ export declare const _debounce: <T extends (...args: any[]) => any>(func: T, wait?: number) => lodash.DebouncedFunc<T>;
@@ -0,0 +1,8 @@
1
+ export interface IOption {
2
+ value: any;
3
+ label: string;
4
+ }
5
+ export interface IError {
6
+ code: string;
7
+ message: string;
8
+ }
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@finema/core",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "main": "./dist/core.umd.cjs",
9
+ "module": "./dist/core.js",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/core.js",
13
+ "require": "./dist/core.umd.cjs"
14
+ }
15
+ },
16
+ "types": "./dist/index.d.ts",
17
+ "dependencies": {
18
+ "@faker-js/faker": "^7.6.0",
19
+ "axios": "^1.2.6",
20
+ "cookie": "^0.5.0",
21
+ "cookie-universal": "^2.2.2",
22
+ "dayjs": "^1.11.7",
23
+ "lodash": "^4.17.21",
24
+ "url-join": "^5.0.0",
25
+ "vue": "^3.3.4"
26
+ },
27
+ "devDependencies": {
28
+ "@types/lodash": "^4.14.195",
29
+ "@vitejs/plugin-vue": "^4.2.3",
30
+ "typescript": "^5.0.2",
31
+ "vite": "^4.4.0",
32
+ "vitest": "^0.33.0",
33
+ "vue-tsc": "^1.8.3"
34
+ },
35
+ "scripts": {
36
+ "test": "vitest run",
37
+ "dev": "vite",
38
+ "build": "vite build && vue-tsc --emitDeclarationOnly",
39
+ "preview": "vite preview"
40
+ }
41
+ }