@luminix/support 0.0.1-beta.7 → 0.1.0-beta.1
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/support.js +3700 -3160
- package/package.json +1 -1
- package/types/Arr.d.ts +25 -18
- package/types/Contracts/EventSource.d.ts +4 -0
- package/types/DateTime.d.ts +9 -0
- package/types/Func.d.ts +10 -0
- package/types/Http/Response.d.ts +5 -3
- package/types/Obj.d.ts +20 -14
- package/types/Query.d.ts +10 -3
- package/types/Str.d.ts +25 -10
- package/types/index.d.ts +21 -10
- package/.eslintignore +0 -3
- package/.eslintrc.cjs +0 -39
- package/graph.svg +0 -421
- package/tsconfig.json +0 -25
- package/vite.config.js +0 -17
package/package.json
CHANGED
package/types/Arr.d.ts
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
export declare class ArrMacros {
|
|
2
|
+
[x: string]: (...args: any[]) => any;
|
|
3
|
+
}
|
|
4
|
+
declare class ArrStatic {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* Calculates the Cartesian product of the given arrays.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
cartesian<T>(...arrays: T[][]): T[][];
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* Gets an array of random elements from the given `array`.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
sampleSize(array: any[], n: number): any[];
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* Returns a shuffled copy of `array`.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
shuffle<T>(array: T[]): T[];
|
|
23
|
+
}
|
|
24
|
+
declare const Arr: ArrStatic & ArrMacros & import('./Mixins/Macroable').MacroableInterface<ArrMacros>;
|
|
25
|
+
export default Arr;
|
|
@@ -5,10 +5,14 @@ export type Event<TData = any, TSource extends EventSource = any> = TData & {
|
|
|
5
5
|
export type EventMap = {
|
|
6
6
|
[key: string]: (event: Event) => void;
|
|
7
7
|
};
|
|
8
|
+
export type EventMapOf<TSource extends EventSource> = TSource extends EventSource<infer T> ? T : never;
|
|
9
|
+
export type EventsOf<TSource extends EventSource> = keyof EventMapOf<TSource>;
|
|
10
|
+
export type EventCallbackOf<TSource extends EventSource, E extends EventsOf<TSource>> = EventMapOf<TSource>[E];
|
|
8
11
|
export default class EventSource<TEvents extends EventMap = EventMap> {
|
|
9
12
|
private emitter;
|
|
10
13
|
constructor();
|
|
11
14
|
on<E extends keyof TEvents>(event: E, callback: TEvents[E]): Unsubscribe;
|
|
12
15
|
once<E extends keyof TEvents>(event: E, callback: TEvents[E]): void;
|
|
13
16
|
emit<E extends keyof TEvents>(event: E, ...data: Parameters<TEvents[E]>): void;
|
|
17
|
+
flushEvents(): void;
|
|
14
18
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class DateTimeMacros {
|
|
2
|
+
[x: string]: (...args: any[]) => any;
|
|
3
|
+
}
|
|
4
|
+
declare class DateTimeStatic {
|
|
5
|
+
parse(value: Date | string): Date;
|
|
6
|
+
toDateTimeLocal(value: Date | string): string;
|
|
7
|
+
}
|
|
8
|
+
declare const DateTime: DateTimeStatic & DateTimeMacros & import('./Mixins/Macroable').MacroableInterface<DateTimeMacros>;
|
|
9
|
+
export default DateTime;
|
package/types/Func.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DebouncedFunc, DebounceSettings, ThrottleSettings } from 'lodash-es';
|
|
2
|
+
export declare class FuncMacros {
|
|
3
|
+
[x: string]: (...args: any[]) => any;
|
|
4
|
+
}
|
|
5
|
+
declare class FuncStatic {
|
|
6
|
+
throttle<T extends (...args: any) => any>(func: T, wait?: number, options?: ThrottleSettings): DebouncedFunc<T>;
|
|
7
|
+
debounce<T extends (...args: any) => any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFunc<T>;
|
|
8
|
+
}
|
|
9
|
+
declare const Func: FuncStatic & FuncMacros & import('./Mixins/Macroable').MacroableInterface<FuncMacros>;
|
|
10
|
+
export default Func;
|
package/types/Http/Response.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
export default class Response<TResponse = any, TData = any> {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
constructor(
|
|
3
|
+
protected _response: AxiosResponse<TResponse, TData>;
|
|
4
|
+
protected _error?: Error | undefined;
|
|
5
|
+
constructor(_response: AxiosResponse<TResponse, TData>, _error?: Error | undefined);
|
|
6
|
+
error(): Error | undefined;
|
|
6
7
|
body(): string;
|
|
7
8
|
json(): TResponse;
|
|
8
9
|
json<K extends keyof TResponse>(key: K): TResponse[K];
|
|
9
10
|
json(key: string, defaultValue?: any): any;
|
|
11
|
+
has(key: string): boolean;
|
|
10
12
|
status(): number;
|
|
11
13
|
successful(): boolean;
|
|
12
14
|
redirect(): boolean;
|
package/types/Obj.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
export declare class ObjMacros {
|
|
2
|
+
[x: string]: (...args: any[]) => any;
|
|
3
|
+
}
|
|
4
|
+
export declare class ObjStatic {
|
|
5
|
+
fromQuery(searchParams: URLSearchParams): Record<string, any>;
|
|
6
|
+
fromFormData(formData: FormData): Record<string, any>;
|
|
7
|
+
get(object: any, path: string, defaultValue?: any): any;
|
|
8
|
+
has(object: any, path: string): boolean;
|
|
9
|
+
isEmpty(object: any): boolean;
|
|
10
|
+
isEqual(object: any, other: any): boolean;
|
|
11
|
+
merge(object: any, ...sources: any[]): any;
|
|
12
|
+
omit(object: any, ...paths: string[]): any;
|
|
13
|
+
pick(object: any, ...paths: string[]): any;
|
|
14
|
+
set(object: any, path: string, value: any): void;
|
|
15
|
+
toQuery(object: any): URLSearchParams;
|
|
16
|
+
toFormData(object: any): FormData;
|
|
17
|
+
unset(object: any, path: string): void;
|
|
18
|
+
}
|
|
19
|
+
declare const Obj: ObjStatic & ObjMacros & import('./Mixins/Macroable').MacroableInterface<ObjMacros>;
|
|
20
|
+
export default Obj;
|
package/types/Query.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export declare class QueryMacros {
|
|
3
|
+
[x: string]: (...args: any[]) => any;
|
|
4
|
+
}
|
|
5
|
+
declare class QueryStatic {
|
|
6
|
+
fromObject(object: object): URLSearchParams;
|
|
7
|
+
toObject(searchParams: URLSearchParams): Record<string, any>;
|
|
8
|
+
merge(...parts: (string | URLSearchParams)[]): URLSearchParams;
|
|
9
|
+
}
|
|
10
|
+
declare const Query: QueryStatic & QueryMacros & import('./Mixins/Macroable').MacroableInterface<QueryMacros>;
|
|
11
|
+
export default Query;
|
package/types/Str.d.ts
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export declare class StrMacros {
|
|
2
|
+
[x: string]: (...args: any[]) => any;
|
|
3
|
+
}
|
|
4
|
+
declare class StrStatic {
|
|
5
|
+
after(string: string, search: string): string;
|
|
6
|
+
afterLast(string: string, search: string): string;
|
|
7
|
+
before(string: string, search: string): string;
|
|
8
|
+
beforeLast(string: string, search: string): string;
|
|
9
|
+
camel(string: string): string;
|
|
10
|
+
lcfirst(string: string): string;
|
|
11
|
+
lower(string: string): string;
|
|
12
|
+
kebab(string: string): string;
|
|
13
|
+
padBoth(string: string, length: number, chars?: string): string;
|
|
14
|
+
padLeft(string: string, length: number, chars?: string): string;
|
|
15
|
+
padRight(string: string, length: number, chars?: string): string;
|
|
16
|
+
readable(string: string): string;
|
|
17
|
+
studly(string: string): string;
|
|
18
|
+
snake(string: string): string;
|
|
19
|
+
title(string: string): string;
|
|
20
|
+
trim(string: string, chars?: string): string;
|
|
21
|
+
ucfirst(string: string): string;
|
|
22
|
+
upper(string: string): string;
|
|
23
|
+
}
|
|
24
|
+
declare const Str: StrStatic & StrMacros & import('./Mixins/Macroable').MacroableInterface<StrMacros>;
|
|
25
|
+
export default Str;
|
package/types/index.d.ts
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
|
+
import { default as axios } from 'axios';
|
|
1
2
|
import { default as Application } from './App/Application';
|
|
2
3
|
import { default as Client } from './Http/Client';
|
|
3
4
|
import { default as Collection } from './Collection';
|
|
4
5
|
import { default as EventSource } from './Contracts/EventSource';
|
|
6
|
+
import { default as Macroable } from './Mixins/Macroable';
|
|
5
7
|
import { default as MakeFacade } from './Mixins/MakeFacade';
|
|
6
8
|
import { default as PropertyBag } from './PropertyBag';
|
|
7
9
|
import { default as reader } from './reader';
|
|
8
10
|
import { default as Reducible } from './Mixins/Reducible';
|
|
9
11
|
import { default as Request } from './Http/Request';
|
|
10
12
|
import { default as Response } from './Http/Response';
|
|
11
|
-
import { default as Macroable } from './Mixins/Macroable';
|
|
12
13
|
import { default as ServiceProvider } from './App/ServiceProvider';
|
|
13
14
|
import { default as isValidationError } from './Http/Utils/isValidationError';
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
15
|
+
import { default as Arr } from './Arr';
|
|
16
|
+
import { default as DateTime } from './DateTime';
|
|
17
|
+
import { default as Func } from './Func';
|
|
18
|
+
import { default as Obj } from './Obj';
|
|
19
|
+
import { default as Query } from './Query';
|
|
20
|
+
import { default as Str } from './Str';
|
|
21
|
+
import * as immer from 'immer';
|
|
22
|
+
export { Application, Arr, Client, Collection, DateTime, EventSource, Func, isValidationError, Macroable, MakeFacade, Obj, PropertyBag, reader, Reducible, Request, Response, ServiceProvider, Query, Str, axios, immer, };
|
|
23
|
+
export type { ArrMacros } from './Arr';
|
|
24
|
+
export type { DateTimeMacros } from './DateTime';
|
|
25
|
+
export type { FuncMacros } from './Func';
|
|
26
|
+
export type { ObjMacros } from './Obj';
|
|
27
|
+
export type { QueryMacros } from './Query';
|
|
28
|
+
export type { StrMacros } from './Str';
|
|
18
29
|
export type { ApplicationInterface, ApplicationEvents } from './App/Interfaces';
|
|
19
|
-
export type { Event } from './Contracts/EventSource';
|
|
30
|
+
export type { Event, EventMap, EventMapOf, EventsOf, EventCallbackOf } from './Contracts/EventSource';
|
|
31
|
+
export type { RequestOptions } from './Http/Client';
|
|
20
32
|
export type { MacroableOf, MacroableInterface } from './Mixins/Macroable';
|
|
21
33
|
export type { HasFacadeAccessor, FacadeOf } from './Mixins/MakeFacade';
|
|
22
|
-
export type { ReducibleInterface, ReducibleOf } from './Mixins/Reducible';
|
|
23
|
-
export type {
|
|
34
|
+
export type { ReducibleInterface, ReducibleOf, ReducerCallback } from './Mixins/Reducible';
|
|
35
|
+
export type { CollectionIteratorCallback } from './Collection';
|
|
24
36
|
export type { Constructor, TypeOf, JsonObject, JsonValue } from './Js';
|
|
25
|
-
export type {
|
|
26
|
-
export { Application, Arr, Client, Collection, EventSource, isValidationError, Macroable, MakeFacade, Obj, PropertyBag, reader, Reducible, Request, Response, ServiceProvider, Query, Str, };
|
|
37
|
+
export type { PropertyBagEventMap } from './PropertyBag';
|
package/.eslintignore
DELETED
package/.eslintrc.cjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line no-undef
|
|
2
|
-
module.exports = {
|
|
3
|
-
'env': {
|
|
4
|
-
'browser': true,
|
|
5
|
-
'es2021': true
|
|
6
|
-
},
|
|
7
|
-
'extends': [
|
|
8
|
-
'eslint:recommended',
|
|
9
|
-
'plugin:@typescript-eslint/recommended'
|
|
10
|
-
],
|
|
11
|
-
'overrides': [
|
|
12
|
-
],
|
|
13
|
-
'parser': '@typescript-eslint/parser',
|
|
14
|
-
'parserOptions': {
|
|
15
|
-
'ecmaVersion': 'latest',
|
|
16
|
-
'sourceType': 'module'
|
|
17
|
-
},
|
|
18
|
-
'plugins': [
|
|
19
|
-
'@typescript-eslint'
|
|
20
|
-
],
|
|
21
|
-
'rules': {
|
|
22
|
-
'indent': [
|
|
23
|
-
'error',
|
|
24
|
-
4
|
|
25
|
-
],
|
|
26
|
-
'linebreak-style': [
|
|
27
|
-
'error',
|
|
28
|
-
'unix'
|
|
29
|
-
],
|
|
30
|
-
'quotes': [
|
|
31
|
-
'error',
|
|
32
|
-
'single'
|
|
33
|
-
],
|
|
34
|
-
'semi': [
|
|
35
|
-
'error',
|
|
36
|
-
'always'
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
};
|