@luminix/core 0.0.1-beta.1 → 0.0.1-beta.10
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 +5 -2
- package/dist/contracts/Collection.d.ts +1 -2
- package/dist/contracts/ModelCollection.d.ts +1 -1
- package/dist/core.js +914 -838
- package/dist/exceptions/AttributeNotFillableException.d.ts +1 -1
- package/dist/exceptions/FacadeNotFoundException.d.ts +1 -1
- package/dist/exceptions/MethodNotImplementedException.d.ts +1 -1
- package/dist/exceptions/ModelInvalidRelatedTypeException.d.ts +1 -1
- package/dist/exceptions/ModelNotFoundException.d.ts +1 -1
- package/dist/exceptions/ModelNotPersistedException.d.ts +1 -1
- package/dist/exceptions/ModelWithoutPrimaryKeyException.d.ts +1 -1
- package/dist/exceptions/NoEmbedException.d.ts +1 -1
- package/dist/exceptions/NoInverseRelationException.d.ts +1 -1
- package/dist/exceptions/NotModelException.d.ts +1 -1
- package/dist/exceptions/NotReducibleException.d.ts +1 -1
- package/dist/exceptions/ReducerOverrideException.d.ts +1 -1
- package/dist/exceptions/RouteNotFoundException.d.ts +1 -1
- package/dist/exceptions/UnsupportedRelationException.d.ts +1 -1
- package/dist/facades/App.d.ts +8 -2
- package/dist/facades/Model.d.ts +2 -3
- package/dist/helpers/auth.d.ts +3 -1
- package/dist/mixins/BaseModel.d.ts +2 -2
- package/dist/mixins/HasEvents.d.ts +1 -2
- package/dist/types/App.d.ts +7 -0
- package/dist/types/Builder.d.ts +4 -0
- package/dist/types/Model.d.ts +30 -6
- package/package.json +3 -2
- package/vite.config.js +3 -1
- package/graph.png +0 -0
package/dist/facades/App.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AppFacades, AppFacade, AppEvents } from '../types/App';
|
|
|
2
2
|
import { default as Plugin } from '../contracts/Plugin';
|
|
3
3
|
import { AppConfiguration } from '../types/Config';
|
|
4
4
|
import { Unsubscribe } from 'nanoevents';
|
|
5
|
+
import { Constructor } from '../types/Support';
|
|
5
6
|
|
|
6
7
|
declare class App implements AppFacade {
|
|
7
8
|
private facades;
|
|
@@ -13,19 +14,24 @@ declare class App implements AppFacade {
|
|
|
13
14
|
bind<K extends keyof AppFacades>(key: K, facade: AppFacades[K]): void;
|
|
14
15
|
plugins(): Plugin[];
|
|
15
16
|
boot(configObject?: AppConfiguration): Promise<AppFacades>;
|
|
17
|
+
environment(): string;
|
|
18
|
+
environment(...environments: string[]): boolean;
|
|
19
|
+
getPlugin<T extends Plugin>(abstract: Constructor<T>): T | undefined;
|
|
20
|
+
hasDebugModeEnabled(): boolean;
|
|
21
|
+
isLocal(): boolean;
|
|
22
|
+
isProduction(): boolean;
|
|
16
23
|
on<E extends keyof AppEvents>(_: E, __: AppEvents[E]): Unsubscribe;
|
|
17
24
|
once<E extends keyof AppEvents>(_: E, __: AppEvents[E]): void;
|
|
18
25
|
emit<E extends keyof AppEvents>(_: E, __?: Omit<Parameters<AppEvents[E]>[0], 'source'>): void;
|
|
19
26
|
}
|
|
20
27
|
declare const _default: {
|
|
21
28
|
new (...args: any[]): {
|
|
22
|
-
|
|
29
|
+
emitter: import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
|
|
23
30
|
"__#1@#createNanoEvents"(): import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
|
|
24
31
|
on<E extends keyof AppEvents>(event: E, callback: AppEvents[E]): Unsubscribe;
|
|
25
32
|
once<E_1 extends keyof AppEvents>(event: E_1, callback: AppEvents[E_1]): void;
|
|
26
33
|
emit<E_2 extends keyof AppEvents>(event: E_2, data?: Omit<Parameters<AppEvents[E_2]>[0], "source">): void;
|
|
27
34
|
[Symbol.toStringTag]: string;
|
|
28
35
|
};
|
|
29
|
-
name: string;
|
|
30
36
|
} & typeof App;
|
|
31
37
|
export default _default;
|
package/dist/facades/Model.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Collection } from '../contracts/Collection';
|
|
|
7
7
|
declare class ModelFacade implements ModelFacadeInterface {
|
|
8
8
|
private readonly _schema;
|
|
9
9
|
private _models;
|
|
10
|
-
|
|
10
|
+
[Symbol.toStringTag]: string;
|
|
11
11
|
constructor(_schema: ModelSchema);
|
|
12
12
|
boot(app: AppFacade): void;
|
|
13
13
|
schema(): ModelSchema;
|
|
@@ -30,13 +30,12 @@ declare class ModelFacade implements ModelFacadeInterface {
|
|
|
30
30
|
}
|
|
31
31
|
declare const _default: {
|
|
32
32
|
new (...args: any[]): {
|
|
33
|
-
|
|
33
|
+
emitter: import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
|
|
34
34
|
"__#1@#createNanoEvents"(): import('nanoevents').Emitter<import('../types/Event').EventSourceEvents>;
|
|
35
35
|
on<E extends keyof GlobalModelEvents>(event: E, callback: GlobalModelEvents[E]): Unsubscribe;
|
|
36
36
|
once<E_1 extends keyof GlobalModelEvents>(event: E_1, callback: GlobalModelEvents[E_1]): void;
|
|
37
37
|
emit<E_2 extends keyof GlobalModelEvents>(event: E_2, data?: Omit<Parameters<GlobalModelEvents[E_2]>[0], "source">): void;
|
|
38
38
|
[Symbol.toStringTag]: string;
|
|
39
39
|
};
|
|
40
|
-
name: string;
|
|
41
40
|
} & typeof ModelFacade;
|
|
42
41
|
export default _default;
|
package/dist/helpers/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseModel, Model as ModelInterface } from '../types/Model';
|
|
2
|
-
import { AppFacades } from '../types/App';
|
|
2
|
+
import { AppFacade, AppFacades } from '../types/App';
|
|
3
3
|
|
|
4
|
-
export declare function BaseModelFactory(
|
|
4
|
+
export declare function BaseModelFactory(app: AppFacade, abstract: string): typeof BaseModel;
|
|
5
5
|
export declare function ModelFactory(facades: AppFacades, abstract: string, CustomModel: typeof BaseModel): typeof ModelInterface;
|
|
@@ -5,12 +5,11 @@ import { Constructor } from '../types/Support';
|
|
|
5
5
|
export declare function isEventSource<T>(value: T): value is T & EventSource<any>;
|
|
6
6
|
export declare function HasEvents<T extends EventSourceEvents, U extends Constructor>(Base: U): {
|
|
7
7
|
new (...args: any[]): {
|
|
8
|
-
|
|
8
|
+
emitter: Emitter<EventSourceEvents>;
|
|
9
9
|
"__#1@#createNanoEvents"(): Emitter<EventSourceEvents>;
|
|
10
10
|
on<E extends keyof T>(event: E, callback: T[E]): import('nanoevents').Unsubscribe;
|
|
11
11
|
once<E_1 extends keyof T>(event: E_1, callback: T[E_1]): void;
|
|
12
12
|
emit<E_2 extends keyof T>(event: E_2, data?: Omit<Parameters<T[E_2]>[0], "source">): void;
|
|
13
13
|
[Symbol.toStringTag]: string;
|
|
14
14
|
};
|
|
15
|
-
name: string;
|
|
16
15
|
} & U;
|
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
|
+
import { Constructor } from './Support';
|
|
10
11
|
|
|
11
12
|
type Plugin = PluginInterface<AppFacade, AppFacades>;
|
|
12
13
|
export type GlobalModelEvents = {
|
|
@@ -48,6 +49,12 @@ export type AppExternal = {
|
|
|
48
49
|
make<T extends keyof AppFacades>(key: T): AppFacades[T];
|
|
49
50
|
plugins: () => Plugin[];
|
|
50
51
|
on: EventSource<AppEvents>['once'];
|
|
52
|
+
environment(): string;
|
|
53
|
+
environment(...environments: string[]): boolean;
|
|
54
|
+
getPlugin<T extends Plugin>(abstract: Constructor<T>): T | undefined;
|
|
55
|
+
hasDebugModeEnabled(): boolean;
|
|
56
|
+
isLocal(): boolean;
|
|
57
|
+
isProduction(): boolean;
|
|
51
58
|
};
|
|
52
59
|
export type AppFacade = AppExternal & {
|
|
53
60
|
has(key: string): boolean;
|
package/dist/types/Builder.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export type BuilderInterface<R, C> = EventSource<BuilderEventMap<R, C>> & {
|
|
|
12
12
|
where(key: string, value: JsonValue): BuilderInterface<R, C>;
|
|
13
13
|
where(key: string, operator: ExtendedOperator, value: JsonValue): BuilderInterface<R, C>;
|
|
14
14
|
where(key: string | Scope<R, C>, operatorOrValue?: ExtendedOperator | JsonValue, value?: JsonValue): BuilderInterface<R, C>;
|
|
15
|
+
with(relation: string | string[]): BuilderInterface<R, C>;
|
|
16
|
+
withOnly(relation: string | string[]): BuilderInterface<R, C>;
|
|
17
|
+
without(relation: string | string[]): BuilderInterface<R, C>;
|
|
15
18
|
whereNull(key: string): BuilderInterface<R, C>;
|
|
16
19
|
whereNotNull(key: string): BuilderInterface<R, C>;
|
|
17
20
|
whereBetween(key: string, value: [JsonValue, JsonValue]): BuilderInterface<R, C>;
|
|
@@ -20,6 +23,7 @@ export type BuilderInterface<R, C> = EventSource<BuilderEventMap<R, C>> & {
|
|
|
20
23
|
searchBy(term: string): BuilderInterface<R, C>;
|
|
21
24
|
minified(): BuilderInterface<R, C>;
|
|
22
25
|
limit(value: number): BuilderInterface<R, C>;
|
|
26
|
+
include(searchParams: URLSearchParams): BuilderInterface<R, C>;
|
|
23
27
|
get(page?: number, replaceLinksWith?: string): Promise<C>;
|
|
24
28
|
all(): Promise<Collection<R>>;
|
|
25
29
|
first(): Promise<R | null>;
|
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
|
+
import { RouteGenerator } from './Route';
|
|
6
7
|
|
|
7
8
|
export type RelationRepository = Record<string, RelationInterface<Model, ModelPaginatedResponse>>;
|
|
8
9
|
export type ModelEvents = {
|
|
@@ -45,18 +46,25 @@ export declare class BaseModel implements EventSource<ModelEvents> {
|
|
|
45
46
|
setAttribute(key: string, value: unknown): void;
|
|
46
47
|
getKey(): string | number;
|
|
47
48
|
getKeyName(): string;
|
|
48
|
-
fill(attributes:
|
|
49
|
+
fill(attributes: object): void;
|
|
49
50
|
toJson(): JsonObject;
|
|
50
51
|
diff(): JsonObject;
|
|
51
52
|
getType(): string;
|
|
52
53
|
dump(): void;
|
|
53
|
-
save(options?: ModelSaveOptions): Promise<AxiosResponse
|
|
54
|
+
save(options?: ModelSaveOptions): Promise<AxiosResponse | void>;
|
|
54
55
|
update(attributes: JsonObject): Promise<void>;
|
|
55
|
-
delete(): Promise<AxiosResponse
|
|
56
|
-
forceDelete(): Promise<AxiosResponse
|
|
57
|
-
restore(): Promise<AxiosResponse
|
|
56
|
+
delete(): Promise<AxiosResponse>;
|
|
57
|
+
forceDelete(): Promise<AxiosResponse>;
|
|
58
|
+
restore(): Promise<AxiosResponse>;
|
|
58
59
|
refresh(): Promise<void>;
|
|
59
60
|
relation(relationName: string): RelationInterface<Model, ModelPaginatedResponse> | undefined;
|
|
61
|
+
getErrorBag(method: string): string;
|
|
62
|
+
getRouteForSave(): RouteGenerator;
|
|
63
|
+
getRouteForUpdate(): RouteGenerator;
|
|
64
|
+
getRouteForDelete(): RouteGenerator;
|
|
65
|
+
getRouteForRestore(): RouteGenerator;
|
|
66
|
+
getRouteForForceDelete(): RouteGenerator;
|
|
67
|
+
getRouteForRefresh(): RouteGenerator;
|
|
60
68
|
static getSchemaName(): string;
|
|
61
69
|
static getSchema(): ModelSchemaAttributes;
|
|
62
70
|
static query(): BuilderInterface<Model, ModelPaginatedResponse>;
|
|
@@ -91,7 +99,7 @@ export declare class BaseModel implements EventSource<ModelEvents> {
|
|
|
91
99
|
}
|
|
92
100
|
export declare class Model extends BaseModel {
|
|
93
101
|
[key: string]: any;
|
|
94
|
-
|
|
102
|
+
[Symbol.toStringTag]: string;
|
|
95
103
|
}
|
|
96
104
|
export interface ModelSaveOptions {
|
|
97
105
|
additionalPayload?: object;
|
|
@@ -107,6 +115,21 @@ export interface ModelTableColumnDefinition {
|
|
|
107
115
|
sortable?: boolean;
|
|
108
116
|
}
|
|
109
117
|
export interface ModelSchemaAttributes {
|
|
118
|
+
attributes: {
|
|
119
|
+
appended: true | null;
|
|
120
|
+
cast: string | null;
|
|
121
|
+
default: string | null;
|
|
122
|
+
fillable: boolean;
|
|
123
|
+
hidden: boolean;
|
|
124
|
+
increments: boolean;
|
|
125
|
+
name: string;
|
|
126
|
+
nullable: boolean;
|
|
127
|
+
phpType: string | null;
|
|
128
|
+
primary: boolean;
|
|
129
|
+
type: string | null;
|
|
130
|
+
unique: boolean;
|
|
131
|
+
virtual: boolean;
|
|
132
|
+
}[];
|
|
110
133
|
displayName: {
|
|
111
134
|
singular: string;
|
|
112
135
|
plural: string;
|
|
@@ -117,6 +140,7 @@ export interface ModelSchemaAttributes {
|
|
|
117
140
|
primaryKey: string;
|
|
118
141
|
timestamps: boolean;
|
|
119
142
|
labeledBy: string;
|
|
143
|
+
[key: string]: any;
|
|
120
144
|
}
|
|
121
145
|
export interface RelationMetaData {
|
|
122
146
|
model: string;
|
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.10",
|
|
4
4
|
"description": "> Projeto em desenvolvimento",
|
|
5
5
|
"main": "dist/core.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"lint:fix": "eslint ./src ./tests --ext .ts --fix",
|
|
12
12
|
"test": "jest",
|
|
13
13
|
"test:coverage": "jest --coverage",
|
|
14
|
-
"ci": "npm run lint && npm run test"
|
|
14
|
+
"ci": "npm run lint && npm run test",
|
|
15
|
+
"publish:beta": "npm run build && npm publish --tag beta"
|
|
15
16
|
},
|
|
16
17
|
"author": "",
|
|
17
18
|
"license": "MIT",
|
package/vite.config.js
CHANGED
|
@@ -3,6 +3,8 @@ import { resolve } from 'path';
|
|
|
3
3
|
|
|
4
4
|
import dts from 'vite-plugin-dts';
|
|
5
5
|
|
|
6
|
+
import packageJson from './package.json';
|
|
7
|
+
|
|
6
8
|
export default defineConfig({
|
|
7
9
|
plugins: [dts({ insertTypesEntry: true })],
|
|
8
10
|
build: {
|
|
@@ -11,7 +13,7 @@ export default defineConfig({
|
|
|
11
13
|
formats: ['es']
|
|
12
14
|
},
|
|
13
15
|
rollupOptions: {
|
|
14
|
-
external:
|
|
16
|
+
external: Object.keys(packageJson.peerDependencies),
|
|
15
17
|
}
|
|
16
18
|
},
|
|
17
19
|
|
package/graph.png
DELETED
|
Binary file
|