@luminix/core 0.0.1-beta.0 → 0.0.1-beta.2
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/contracts/Builder.d.ts +3 -2
- package/dist/contracts/Collection.d.ts +3 -3
- package/dist/contracts/ModelCollection.d.ts +1 -0
- package/dist/contracts/Plugin.d.ts +1 -0
- package/dist/contracts/PropertyBag.d.ts +4 -11
- package/dist/contracts/Relation/BelongsTo.d.ts +2 -1
- package/dist/contracts/Relation/BelongsToMany.d.ts +3 -2
- package/dist/contracts/Relation/HasMany.d.ts +3 -2
- package/dist/contracts/Relation/HasOne.d.ts +2 -1
- package/dist/contracts/Relation/HasOneOrMany.d.ts +2 -1
- package/dist/contracts/Relation/MorphMany.d.ts +3 -2
- package/dist/contracts/Relation/MorphOne.d.ts +2 -1
- package/dist/contracts/Relation/MorphOneOrMany.d.ts +2 -1
- package/dist/contracts/Relation/MorphTo.d.ts +2 -1
- package/dist/contracts/Relation/MorphToMany.d.ts +2 -1
- package/dist/contracts/Relation.d.ts +1 -0
- package/dist/core.js +1317 -1322
- package/dist/facades/App.d.ts +4 -3
- package/dist/facades/Auth.d.ts +1 -0
- package/dist/facades/Error.d.ts +2 -1
- package/dist/facades/Log.d.ts +1 -0
- package/dist/facades/Model.d.ts +3 -2
- package/dist/facades/Route.d.ts +6 -5
- package/dist/helpers/app.d.ts +1 -0
- package/dist/helpers/auth.d.ts +3 -1
- package/dist/helpers/collect.d.ts +1 -1
- package/dist/helpers/config.d.ts +1 -0
- package/dist/helpers/error.d.ts +1 -0
- package/dist/helpers/log.d.ts +1 -0
- package/dist/helpers/model.d.ts +1 -0
- package/dist/helpers/route.d.ts +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/mixins/BaseModel.d.ts +1 -0
- package/dist/mixins/HasEvents.d.ts +2 -1
- package/dist/mixins/Reducible.d.ts +1 -0
- package/dist/support/collection.d.ts +1 -0
- package/dist/support/model.d.ts +1 -0
- package/dist/types/App.d.ts +1 -0
- package/dist/types/Auth.d.ts +1 -0
- package/dist/types/Builder.d.ts +3 -1
- package/dist/types/Collection.d.ts +1 -0
- package/dist/types/Config.d.ts +2 -1
- package/dist/types/Error.d.ts +3 -1
- package/dist/types/Event.d.ts +1 -0
- package/dist/types/Model.d.ts +2 -1
- package/dist/types/PropertyBag.d.ts +25 -0
- package/dist/types/Reducer.d.ts +1 -0
- package/dist/types/Relation.d.ts +1 -0
- package/dist/types/Route.d.ts +1 -0
- package/package.json +2 -2
package/dist/facades/App.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AppFacades, AppFacade, AppEvents } from '../types/App';
|
|
2
|
-
import Plugin from '../contracts/Plugin';
|
|
2
|
+
import { default as Plugin } from '../contracts/Plugin';
|
|
3
3
|
import { AppConfiguration } from '../types/Config';
|
|
4
4
|
import { Unsubscribe } from 'nanoevents';
|
|
5
|
+
|
|
5
6
|
declare class App implements AppFacade {
|
|
6
7
|
private facades;
|
|
7
8
|
private booted;
|
|
@@ -18,8 +19,8 @@ declare class App implements AppFacade {
|
|
|
18
19
|
}
|
|
19
20
|
declare const _default: {
|
|
20
21
|
new (...args: any[]): {
|
|
21
|
-
"__#1@#emitter": import(
|
|
22
|
-
"__#1@#createNanoEvents"(): import(
|
|
22
|
+
"__#1@#emitter": import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
|
|
23
|
+
"__#1@#createNanoEvents"(): import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
|
|
23
24
|
on<E extends keyof AppEvents>(event: E, callback: AppEvents[E]): Unsubscribe;
|
|
24
25
|
once<E_1 extends keyof AppEvents>(event: E_1, callback: AppEvents[E_1]): void;
|
|
25
26
|
emit<E_2 extends keyof AppEvents>(event: E_2, data?: Omit<Parameters<AppEvents[E_2]>[0], "source">): void;
|
package/dist/facades/Auth.d.ts
CHANGED
package/dist/facades/Error.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import PropertyBag from '../contracts/PropertyBag';
|
|
1
|
+
import { default as PropertyBag } from '../contracts/PropertyBag';
|
|
2
2
|
import { ErrorFacade, ValidationError } from '../types/Error';
|
|
3
|
+
|
|
3
4
|
export declare const isValidationError: (error: unknown) => error is ValidationError;
|
|
4
5
|
declare class Error implements ErrorFacade {
|
|
5
6
|
private bags;
|
package/dist/facades/Log.d.ts
CHANGED
package/dist/facades/Model.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { AppFacade, GlobalModelEvents, ModelFacade as ModelFacadeInterface } fro
|
|
|
3
3
|
import { Unsubscribe } from 'nanoevents';
|
|
4
4
|
import { Reducer, ReducerCallback, Unsubscribe as UnsubscribeReducer } from '../types/Reducer';
|
|
5
5
|
import { Collection } from '../contracts/Collection';
|
|
6
|
+
|
|
6
7
|
declare class ModelFacade implements ModelFacadeInterface {
|
|
7
8
|
private readonly _schema;
|
|
8
9
|
private _models;
|
|
@@ -29,8 +30,8 @@ declare class ModelFacade implements ModelFacadeInterface {
|
|
|
29
30
|
}
|
|
30
31
|
declare const _default: {
|
|
31
32
|
new (...args: any[]): {
|
|
32
|
-
"__#1@#emitter": import(
|
|
33
|
-
"__#1@#createNanoEvents"(): import(
|
|
33
|
+
"__#1@#emitter": import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
|
|
34
|
+
"__#1@#createNanoEvents"(): import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
|
|
34
35
|
on<E extends keyof GlobalModelEvents>(event: E, callback: GlobalModelEvents[E]): Unsubscribe;
|
|
35
36
|
once<E_1 extends keyof GlobalModelEvents>(event: E_1, callback: GlobalModelEvents[E_1]): void;
|
|
36
37
|
emit<E_2 extends keyof GlobalModelEvents>(event: E_2, data?: Omit<Parameters<GlobalModelEvents[E_2]>[0], "source">): void;
|
package/dist/facades/Route.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RouteDefinition, RouteTuple as RouteTuple, HttpMethod, RouteGenerator, RouteCallConfig } from '../types/Route';
|
|
2
2
|
import { ErrorFacade } from '../types/Error';
|
|
3
|
+
|
|
3
4
|
declare class Route {
|
|
4
5
|
private routes;
|
|
5
6
|
private error;
|
|
@@ -11,18 +12,18 @@ declare class Route {
|
|
|
11
12
|
url(generator: RouteGenerator): string;
|
|
12
13
|
methods(generator: RouteGenerator): HttpMethod[];
|
|
13
14
|
exists(name: string): boolean;
|
|
14
|
-
call(generator: RouteGenerator, config?: RouteCallConfig): Promise<import(
|
|
15
|
+
call(generator: RouteGenerator, config?: RouteCallConfig): Promise<import('axios').AxiosResponse<any, any>>;
|
|
15
16
|
toString(): string;
|
|
16
17
|
[reducer: string]: unknown;
|
|
17
18
|
}
|
|
18
19
|
declare const _default: {
|
|
19
20
|
new (...args: any[]): {
|
|
20
21
|
reducers: {
|
|
21
|
-
[name: string]: import(
|
|
22
|
+
[name: string]: import('../types/Collection').Collection<import('../types/Reducer').Reducer>;
|
|
22
23
|
};
|
|
23
|
-
reducer(name: string, callback: import(
|
|
24
|
-
removeReducer(name: string, callback: import(
|
|
25
|
-
getReducer(name: string): import(
|
|
24
|
+
reducer(name: string, callback: import('../types/Reducer').ReducerCallback, priority?: number): () => void;
|
|
25
|
+
removeReducer(name: string, callback: import('../types/Reducer').ReducerCallback): void;
|
|
26
|
+
getReducer(name: string): import('../types/Collection').Collection<import('../types/Reducer').Reducer>;
|
|
26
27
|
hasReducer(name: string): boolean;
|
|
27
28
|
clearReducer(name: string): void;
|
|
28
29
|
flushReducers(): void;
|
package/dist/helpers/app.d.ts
CHANGED
package/dist/helpers/auth.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function collect<T = unknown>(items: T[]): import(
|
|
1
|
+
export default function collect<T = unknown>(items: T[]): import('../types/Collection').Collection<T>;
|
package/dist/helpers/config.d.ts
CHANGED
package/dist/helpers/error.d.ts
CHANGED
package/dist/helpers/log.d.ts
CHANGED
package/dist/helpers/model.d.ts
CHANGED
package/dist/helpers/route.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import app from './helpers/app';
|
|
2
|
-
import auth from './helpers/auth';
|
|
3
|
-
import collect from './helpers/collect';
|
|
4
|
-
import config from './helpers/config';
|
|
5
|
-
import error from './helpers/error';
|
|
6
|
-
import log from './helpers/log';
|
|
7
|
-
import model from './helpers/model';
|
|
8
|
-
import route from './helpers/route';
|
|
1
|
+
import { default as app } from './helpers/app';
|
|
2
|
+
import { default as auth } from './helpers/auth';
|
|
3
|
+
import { default as collect } from './helpers/collect';
|
|
4
|
+
import { default as config } from './helpers/config';
|
|
5
|
+
import { default as error } from './helpers/error';
|
|
6
|
+
import { default as log } from './helpers/log';
|
|
7
|
+
import { default as model } from './helpers/model';
|
|
8
|
+
import { default as route } from './helpers/route';
|
|
9
9
|
import { isValidationError } from './facades/Error';
|
|
10
|
-
import Plugin from './contracts/Plugin';
|
|
11
|
-
import PropertyBag from './contracts/PropertyBag';
|
|
10
|
+
import { default as Plugin } from './contracts/Plugin';
|
|
11
|
+
import { default as PropertyBag } from './contracts/PropertyBag';
|
|
12
12
|
import { isModel } from './support/model';
|
|
13
13
|
import { isCollection } from './support/collection';
|
|
14
14
|
import { Reducible } from './mixins/Reducible';
|
|
15
15
|
import { HasEvents } from './mixins/HasEvents';
|
|
16
|
+
|
|
16
17
|
export { app, auth, collect, config, error, log, model, route, isCollection, isValidationError, isModel, Plugin, PropertyBag, Reducible, HasEvents, };
|
|
17
18
|
export type { AppFacade } from './types/App';
|
|
18
19
|
export type { AuthFacade } from './types/Auth';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseModel, Model as ModelInterface } from '../types/Model';
|
|
2
2
|
import { AppFacades } from '../types/App';
|
|
3
|
+
|
|
3
4
|
export declare function BaseModelFactory(facades: AppFacades, abstract: string): typeof BaseModel;
|
|
4
5
|
export declare function ModelFactory(facades: AppFacades, abstract: string, CustomModel: typeof BaseModel): typeof ModelInterface;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Emitter } from 'nanoevents';
|
|
2
2
|
import { EventSourceEvents, EventSource } from '../types/Event';
|
|
3
3
|
import { Constructor } from '../types/Support';
|
|
4
|
+
|
|
4
5
|
export declare function isEventSource<T>(value: T): value is T & EventSource<any>;
|
|
5
6
|
export declare function HasEvents<T extends EventSourceEvents, U extends Constructor>(Base: U): {
|
|
6
7
|
new (...args: any[]): {
|
|
7
8
|
"__#1@#emitter": Emitter<EventSourceEvents>;
|
|
8
9
|
"__#1@#createNanoEvents"(): Emitter<EventSourceEvents>;
|
|
9
|
-
on<E extends keyof T>(event: E, callback: T[E]): import(
|
|
10
|
+
on<E extends keyof T>(event: E, callback: T[E]): import('nanoevents').Unsubscribe;
|
|
10
11
|
once<E_1 extends keyof T>(event: E_1, callback: T[E_1]): void;
|
|
11
12
|
emit<E_2 extends keyof T>(event: E_2, data?: Omit<Parameters<T[E_2]>[0], "source">): void;
|
|
12
13
|
[Symbol.toStringTag]: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReducerCallback, Reducer } from '../types/Reducer';
|
|
2
2
|
import { Constructor } from '../types/Support';
|
|
3
3
|
import { Collection } from '../types/Collection';
|
|
4
|
+
|
|
4
5
|
export declare function Reducible<T extends Constructor>(Base: T): {
|
|
5
6
|
new (...args: any[]): {
|
|
6
7
|
reducers: {
|
package/dist/support/model.d.ts
CHANGED
package/dist/types/App.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { RouteFacade } from './Route';
|
|
|
7
7
|
import { EventSource, Event } from './Event';
|
|
8
8
|
import { ErrorFacade } from './Error';
|
|
9
9
|
import { ReducibleInterface } from './Reducer';
|
|
10
|
+
|
|
10
11
|
type Plugin = PluginInterface<AppFacade, AppFacades>;
|
|
11
12
|
export type GlobalModelEvents = {
|
|
12
13
|
'save': (e: ModelGlobalEvent) => void;
|
package/dist/types/Auth.d.ts
CHANGED
package/dist/types/Builder.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { default as PropertyBag } from '../contracts/PropertyBag';
|
|
2
2
|
import { Event, EventSource } from './Event';
|
|
3
3
|
import { JsonObject, JsonValue } from './Support';
|
|
4
4
|
import { Operator, Collection } from './Collection';
|
|
5
|
+
import { PropertyBagEventMap } from './PropertyBag';
|
|
6
|
+
|
|
5
7
|
export type Scope<R, C> = (builder: BuilderInterface<R, C>) => BuilderInterface<R, C> | void;
|
|
6
8
|
export type ExtendedOperator = Operator | 'like' | 'notLike' | 'between' | 'notBetween' | 'isNull' | 'isNotNull';
|
|
7
9
|
export type BuilderInterface<R, C> = EventSource<BuilderEventMap<R, C>> & {
|
package/dist/types/Config.d.ts
CHANGED
package/dist/types/Error.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { default as PropertyBag } from '../contracts/PropertyBag';
|
|
2
2
|
import { Event, EventSource } from './Event';
|
|
3
|
+
import { PropertyBagEventMap } from './PropertyBag';
|
|
4
|
+
|
|
3
5
|
export type ErrorEventMap = {
|
|
4
6
|
change: (e: ErrorChangeEvent) => void;
|
|
5
7
|
};
|
package/dist/types/Event.d.ts
CHANGED
package/dist/types/Model.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { EventSource, Event } from './Event';
|
|
|
3
3
|
import { Collection } from './Collection';
|
|
4
4
|
import { RelationInterface, BuilderInterface, Scope, ExtendedOperator } from './Relation';
|
|
5
5
|
import { JsonObject, JsonValue } from './Support';
|
|
6
|
+
|
|
6
7
|
export type RelationRepository = Record<string, RelationInterface<Model, ModelPaginatedResponse>>;
|
|
7
8
|
export type ModelEvents = {
|
|
8
9
|
'change': (e: ModelChangeEvent) => void;
|
|
@@ -131,7 +132,7 @@ export type ModelQuery = JsonObject & {
|
|
|
131
132
|
page?: number;
|
|
132
133
|
per_page?: number;
|
|
133
134
|
order_by?: string;
|
|
134
|
-
|
|
135
|
+
where?: JsonObject;
|
|
135
136
|
tab?: string;
|
|
136
137
|
minified?: boolean;
|
|
137
138
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Unsubscribe } from 'nanoevents';
|
|
2
|
+
import { Event } from './Event';
|
|
3
|
+
|
|
4
|
+
export type PropertyBagChangeEvent<T extends object> = Event<PropertyBag<T>> & {
|
|
5
|
+
path: string;
|
|
6
|
+
value: unknown;
|
|
7
|
+
type: 'set' | 'merge' | 'delete';
|
|
8
|
+
};
|
|
9
|
+
export type PropertyBagEventMap<T extends object = any> = {
|
|
10
|
+
'change': (e: PropertyBagChangeEvent<T>) => void;
|
|
11
|
+
};
|
|
12
|
+
export type PropertyBag<T extends object> = {
|
|
13
|
+
get(path: string, defaultValue?: unknown): unknown;
|
|
14
|
+
set(path: string, value: unknown): void;
|
|
15
|
+
merge(path: string, value: unknown): void;
|
|
16
|
+
has(path: string): boolean;
|
|
17
|
+
delete(path: string): void;
|
|
18
|
+
lock(path: string): void;
|
|
19
|
+
clone(): PropertyBag<T>;
|
|
20
|
+
all(): T;
|
|
21
|
+
isEmpty(): boolean;
|
|
22
|
+
on<K extends keyof PropertyBagEventMap<T>>(event: K, callback: PropertyBagEventMap<T>[K]): Unsubscribe;
|
|
23
|
+
once<K extends keyof PropertyBagEventMap<T>>(event: K, callback: PropertyBagEventMap<T>[K]): void;
|
|
24
|
+
emit<K extends keyof PropertyBagEventMap<T>>(event: K, payload: Omit<Parameters<PropertyBagEventMap<T>[K]>[0], 'source'>): void;
|
|
25
|
+
};
|
package/dist/types/Reducer.d.ts
CHANGED
package/dist/types/Relation.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BuilderInterface, ExtendedOperator, Scope } from './Builder';
|
|
2
2
|
import { Collection } from './Collection';
|
|
3
3
|
import { Constructor, JsonValue } from './Support';
|
|
4
|
+
|
|
4
5
|
export type { BuilderInterface, ExtendedOperator, Scope, };
|
|
5
6
|
export type RelationInterface<R, C> = {
|
|
6
7
|
guessInverseRelation(): string;
|
package/dist/types/Route.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luminix/core",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.2",
|
|
4
4
|
"description": "> Projeto em desenvolvimento",
|
|
5
5
|
"main": "dist/core.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"ts-jest": "^29.1.2",
|
|
29
29
|
"typescript": "^5.3.3",
|
|
30
30
|
"vite": "^5.0.12",
|
|
31
|
-
"vite-plugin-dts": "^
|
|
31
|
+
"vite-plugin-dts": "^4.0.0-beta.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"axios": "^1.6.4",
|