@luminix/core 0.0.1-beta.9 → 0.1.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/core.js +1034 -1922
- package/package.json +5 -9
- package/types/contracts/Builder.d.ts +46 -0
- package/types/contracts/ModelCollection.d.ts +7 -0
- package/{dist → types}/contracts/Plugin.d.ts +3 -3
- package/{dist → types}/contracts/Relation/BelongsTo.d.ts +3 -5
- package/{dist → types}/contracts/Relation/BelongsToMany.d.ts +7 -9
- package/{dist → types}/contracts/Relation/HasMany.d.ts +6 -7
- package/{dist → types}/contracts/Relation/HasOne.d.ts +3 -4
- package/{dist → types}/contracts/Relation/HasOneOrMany.d.ts +0 -1
- package/{dist → types}/contracts/Relation/MorphMany.d.ts +6 -7
- package/{dist → types}/contracts/Relation/MorphOne.d.ts +3 -4
- package/{dist → types}/contracts/Relation/MorphOneOrMany.d.ts +0 -1
- package/{dist → types}/contracts/Relation/MorphTo.d.ts +0 -1
- package/types/contracts/Relation/MorphToMany.d.ts +8 -0
- package/{dist → types}/contracts/Relation.d.ts +12 -9
- package/types/facades/App.d.ts +12 -0
- package/types/facades/Auth.d.ts +7 -0
- package/types/facades/Config.d.ts +7 -0
- package/types/facades/Error.d.ts +10 -0
- package/types/facades/Http.d.ts +8 -0
- package/types/facades/Log.d.ts +7 -0
- package/types/facades/Model.d.ts +8 -0
- package/types/facades/Route.d.ts +7 -0
- package/types/helpers/app.d.ts +4 -0
- package/{dist → types}/helpers/auth.d.ts +0 -1
- package/types/helpers/collect.d.ts +2 -0
- package/{dist → types}/helpers/config.d.ts +0 -1
- package/{dist → types}/helpers/error.d.ts +0 -1
- package/types/helpers/log.d.ts +5 -0
- package/{dist → types}/helpers/model.d.ts +2 -3
- package/{dist → types}/helpers/route.d.ts +2 -2
- package/{dist → types}/index.d.ts +10 -10
- package/types/mixins/BaseModel.d.ts +7 -0
- package/types/providers/LuminixServiceProvider.d.ts +9 -0
- package/types/services/AuthService.d.ts +18 -0
- package/{dist/facades/Error.d.ts → types/services/ErrorService.d.ts} +2 -6
- package/types/services/HttpService.d.ts +21 -0
- package/{dist/facades/Log.d.ts → types/services/LogService.d.ts} +2 -4
- package/types/services/ModelService.d.ts +21 -0
- package/types/services/RouteService.d.ts +21 -0
- package/{dist → types}/support/model.d.ts +0 -1
- package/types/types/App.d.ts +88 -0
- package/{dist → types}/types/Auth.d.ts +0 -1
- package/types/types/Builder.d.ts +46 -0
- package/{dist → types}/types/Config.d.ts +4 -2
- package/types/types/Error.d.ts +17 -0
- package/types/types/Http.d.ts +20 -0
- package/{dist → types}/types/Model.d.ts +61 -43
- package/{dist → types}/types/Relation.d.ts +1 -2
- package/types/types/Route.d.ts +27 -0
- package/{dist → types}/types/Support.d.ts +3 -2
- package/vite.config.js +2 -2
- package/dist/contracts/Builder.d.ts +0 -53
- package/dist/contracts/Collection.d.ts +0 -190
- package/dist/contracts/ModelCollection.d.ts +0 -9
- package/dist/contracts/PropertyBag.d.ts +0 -21
- package/dist/contracts/Relation/MorphToMany.d.ts +0 -16
- package/dist/facades/App.d.ts +0 -37
- package/dist/facades/Auth.d.ts +0 -14
- package/dist/facades/Model.d.ts +0 -41
- package/dist/facades/Route.d.ts +0 -32
- package/dist/helpers/app.d.ts +0 -5
- package/dist/helpers/collect.d.ts +0 -1
- package/dist/helpers/log.d.ts +0 -5
- package/dist/mixins/BaseModel.d.ts +0 -5
- package/dist/mixins/HasEvents.d.ts +0 -15
- package/dist/mixins/Reducible.d.ts +0 -17
- package/dist/support/collection.d.ts +0 -4
- package/dist/support/reader.d.ts +0 -2
- package/dist/support/searchParams.d.ts +0 -1
- package/dist/types/App.d.ts +0 -79
- package/dist/types/Builder.d.ts +0 -51
- package/dist/types/Collection.d.ts +0 -1804
- package/dist/types/Error.d.ts +0 -31
- package/dist/types/Event.d.ts +0 -14
- package/dist/types/PropertyBag.d.ts +0 -25
- package/dist/types/Reducer.d.ts +0 -17
- package/dist/types/Route.d.ts +0 -22
- /package/{dist → types}/exceptions/AttributeNotFillableException.d.ts +0 -0
- /package/{dist → types}/exceptions/FacadeNotFoundException.d.ts +0 -0
- /package/{dist → types}/exceptions/MethodNotImplementedException.d.ts +0 -0
- /package/{dist → types}/exceptions/ModelInvalidRelatedTypeException.d.ts +0 -0
- /package/{dist → types}/exceptions/ModelNotFoundException.d.ts +0 -0
- /package/{dist → types}/exceptions/ModelNotPersistedException.d.ts +0 -0
- /package/{dist → types}/exceptions/ModelWithoutPrimaryKeyException.d.ts +0 -0
- /package/{dist → types}/exceptions/NoEmbedException.d.ts +0 -0
- /package/{dist → types}/exceptions/NoInverseRelationException.d.ts +0 -0
- /package/{dist → types}/exceptions/NotModelException.d.ts +0 -0
- /package/{dist → types}/exceptions/NotReducibleException.d.ts +0 -0
- /package/{dist → types}/exceptions/ReducerOverrideException.d.ts +0 -0
- /package/{dist → types}/exceptions/RouteNotFoundException.d.ts +0 -0
- /package/{dist → types}/exceptions/UnsupportedRelationException.d.ts +0 -0
- /package/{dist → types}/types/Log.d.ts +0 -0
- /package/{dist → types}/types/Plugin.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luminix/core",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
4
|
"description": "> Projeto em desenvolvimento",
|
|
5
|
-
"
|
|
6
|
-
"types": "
|
|
5
|
+
"module": "dist/core.js",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
|
+
"prebuild": "rm -rf types",
|
|
9
10
|
"build": "tsc && vite build",
|
|
10
11
|
"lint": "eslint ./src ./tests --ext .ts",
|
|
11
12
|
"lint:fix": "eslint ./src ./tests --ext .ts --fix",
|
|
@@ -18,22 +19,17 @@
|
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"devDependencies": {
|
|
20
21
|
"@types/jest": "^29.5.12",
|
|
21
|
-
"@types/lodash": "^4.14.202",
|
|
22
|
-
"@types/object-path": "^0.11.4",
|
|
23
22
|
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
|
24
23
|
"@typescript-eslint/parser": "^7.1.0",
|
|
25
24
|
"eslint": "^8.57.0",
|
|
26
25
|
"jest": "^29.7.0",
|
|
27
26
|
"jest-environment-jsdom": "^29.7.0",
|
|
28
|
-
"nanoevents": "^9.0.0",
|
|
29
27
|
"ts-jest": "^29.1.2",
|
|
30
28
|
"typescript": "^5.3.3",
|
|
31
29
|
"vite": "^5.0.12",
|
|
32
30
|
"vite-plugin-dts": "^4.0.0-beta.1"
|
|
33
31
|
},
|
|
34
32
|
"peerDependencies": {
|
|
35
|
-
"
|
|
36
|
-
"immer": "^10.0.3",
|
|
37
|
-
"lodash": "^4.17.21"
|
|
33
|
+
"@luminix/support": "^0.0.1-beta.7"
|
|
38
34
|
}
|
|
39
35
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Collection, EventSource, JsonValue } from '@luminix/support';
|
|
2
|
+
import { BuilderEventMap as BuilderEvents, BuilderInterface as BuilderBase, ExtendedOperator } from '../types/Builder';
|
|
3
|
+
import { Model, ModelPaginatedResponse, ModelQuery } from '../types/Model';
|
|
4
|
+
import { ModelFacade } from '../types/App';
|
|
5
|
+
import { RouteFacade } from '../types/Route';
|
|
6
|
+
import { ConfigFacade } from '../types/Config';
|
|
7
|
+
type BuilderInterface = BuilderBase<Model, ModelPaginatedResponse>;
|
|
8
|
+
type BuilderEventMap = BuilderEvents<Model, ModelPaginatedResponse>;
|
|
9
|
+
declare class Builder extends EventSource<BuilderEventMap> implements BuilderInterface {
|
|
10
|
+
protected services: {
|
|
11
|
+
config: ConfigFacade;
|
|
12
|
+
model: ModelFacade;
|
|
13
|
+
route: RouteFacade;
|
|
14
|
+
};
|
|
15
|
+
protected abstract: string;
|
|
16
|
+
protected query: ModelQuery;
|
|
17
|
+
private bag;
|
|
18
|
+
constructor(services: {
|
|
19
|
+
config: ConfigFacade;
|
|
20
|
+
model: ModelFacade;
|
|
21
|
+
route: RouteFacade;
|
|
22
|
+
}, abstract: string, query?: ModelQuery);
|
|
23
|
+
lock(path: string): void;
|
|
24
|
+
whereBetween(key: string, value: [JsonValue, JsonValue]): this;
|
|
25
|
+
whereNotBetween(key: string, value: [JsonValue, JsonValue]): this;
|
|
26
|
+
whereNull(key: string): this;
|
|
27
|
+
whereNotNull(key: string): this;
|
|
28
|
+
limit(value: number): this;
|
|
29
|
+
where(scope: (builder: BuilderInterface) => BuilderInterface | void): this;
|
|
30
|
+
where(key: string, value: JsonValue): this;
|
|
31
|
+
where(key: string, operator: ExtendedOperator, value: JsonValue): this;
|
|
32
|
+
with(relation: string | string[]): this;
|
|
33
|
+
withOnly(relation: string | string[]): this;
|
|
34
|
+
without(relation: string | string[]): this;
|
|
35
|
+
orderBy(column: string, direction?: 'asc' | 'desc'): this;
|
|
36
|
+
searchBy(term: string): this;
|
|
37
|
+
minified(): this;
|
|
38
|
+
unset(key: string): this;
|
|
39
|
+
include(searchParams: URLSearchParams): this;
|
|
40
|
+
private exec;
|
|
41
|
+
get(page?: number, replaceLinksWith?: string): Promise<ModelPaginatedResponse>;
|
|
42
|
+
first(): Promise<Model | null>;
|
|
43
|
+
find(id: string | number): Promise<Model | null>;
|
|
44
|
+
all(): Promise<Collection<Model>>;
|
|
45
|
+
}
|
|
46
|
+
export default Builder;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Collection } from '@luminix/support';
|
|
2
|
+
import { Model } from '../types/Model';
|
|
3
|
+
declare class ModelCollection extends Collection<Model> {
|
|
4
|
+
[Symbol.toStringTag]: string;
|
|
5
|
+
intersect(values: Collection<Model> | Model[]): Collection<Model>;
|
|
6
|
+
}
|
|
7
|
+
export default ModelCollection;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AppFacade,
|
|
2
|
-
|
|
1
|
+
import { AppFacade, AppContainers } from '../types/App';
|
|
2
|
+
/** @deprecated */
|
|
3
3
|
export default abstract class Plugin {
|
|
4
4
|
readonly name?: string;
|
|
5
5
|
readonly version?: string;
|
|
6
6
|
register(_app: AppFacade): void;
|
|
7
|
-
boot(_facades:
|
|
7
|
+
boot(_facades: AppContainers): void;
|
|
8
8
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { default as Relation } from '../Relation';
|
|
1
|
+
import { default as Relation, RelationServices } from '../Relation';
|
|
2
2
|
import { Model, ModelPaginatedResponse, RelationMetaData } from '../../types/Model';
|
|
3
|
-
import { AppFacades } from '../../types/App';
|
|
4
3
|
import { BuilderInterface as Builder } from '../../types/Builder';
|
|
5
|
-
|
|
6
4
|
type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
|
|
7
5
|
export default class BelongsTo extends Relation {
|
|
6
|
+
protected services: RelationServices;
|
|
8
7
|
protected meta: RelationMetaData;
|
|
9
|
-
protected facades: AppFacades;
|
|
10
8
|
protected parent: Model;
|
|
11
9
|
protected items: Model | null;
|
|
12
|
-
constructor(
|
|
10
|
+
constructor(services: RelationServices, meta: RelationMetaData, parent: Model, items?: Model | null);
|
|
13
11
|
isSingle(): boolean;
|
|
14
12
|
isMultiple(): boolean;
|
|
15
13
|
query(): BuilderInterface;
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Collection } from '@luminix/support';
|
|
2
|
+
import { default as Relation, RelationServices } from '../Relation';
|
|
2
3
|
import { Model, ModelPaginatedResponse, RelationMetaData } from '../../types/Model';
|
|
3
|
-
import { AppFacades } from '../../types/App';
|
|
4
4
|
import { BuilderInterface as Builder } from '../../types/Builder';
|
|
5
|
-
import { Collection as CollectionInterface } from '../../types/Collection';
|
|
6
5
|
import { JsonObject } from '../../types/Support';
|
|
7
|
-
|
|
8
6
|
type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
|
|
9
7
|
export default class BelongsToMany extends Relation {
|
|
8
|
+
protected services: RelationServices;
|
|
10
9
|
protected meta: RelationMetaData;
|
|
11
|
-
protected facades: AppFacades;
|
|
12
10
|
protected parent: Model;
|
|
13
|
-
protected items:
|
|
14
|
-
constructor(
|
|
11
|
+
protected items: Collection<Model> | null;
|
|
12
|
+
constructor(services: RelationServices, meta: RelationMetaData, parent: Model, items?: Collection<Model> | null);
|
|
15
13
|
isSingle(): boolean;
|
|
16
14
|
isMultiple(): boolean;
|
|
17
15
|
query(): BuilderInterface;
|
|
18
16
|
get(page?: number, replaceLinksWith?: string): Promise<ModelPaginatedResponse>;
|
|
19
|
-
all(): Promise<
|
|
17
|
+
all(): Promise<Collection<Model>>;
|
|
20
18
|
first(): Promise<Model | null>;
|
|
21
19
|
find(id: string | number): Promise<Model | null>;
|
|
22
|
-
attachQuietly(id: string | number, pivot?: JsonObject): Promise<import('
|
|
20
|
+
attachQuietly(id: string | number, pivot?: JsonObject): Promise<import('@luminix/support').Response<unknown, any>>;
|
|
23
21
|
attach(id: string | number, pivot?: JsonObject): Promise<void>;
|
|
24
22
|
detachQuietly(id: string | number): Promise<void>;
|
|
25
23
|
detach(id: string | number): Promise<void>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Collection } from '@luminix/support';
|
|
2
2
|
import { Model, RelationMetaData } from '../../types/Model';
|
|
3
3
|
import { default as HasOneOrMany } from './HasOneOrMany';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { RelationServices } from '../Relation';
|
|
6
5
|
export default class HasMany extends HasOneOrMany {
|
|
6
|
+
protected services: RelationServices;
|
|
7
7
|
protected meta: RelationMetaData;
|
|
8
|
-
protected facades: AppFacades;
|
|
9
8
|
protected parent: Model;
|
|
10
|
-
protected items:
|
|
11
|
-
constructor(
|
|
9
|
+
protected items: Collection<Model> | null;
|
|
10
|
+
constructor(services: RelationServices, meta: RelationMetaData, parent: Model, items?: Collection<Model> | null);
|
|
12
11
|
isSingle(): boolean;
|
|
13
12
|
isMultiple(): boolean;
|
|
14
13
|
get(page?: number, replaceLinksWith?: string): Promise<import('../../types/Model').ModelPaginatedResponse>;
|
|
15
|
-
all(): Promise<
|
|
14
|
+
all(): Promise<Collection<Model>>;
|
|
16
15
|
first(): Promise<Model | null>;
|
|
17
16
|
find(id: string | number): Promise<Model | null>;
|
|
18
17
|
saveManyQuietly(models: Model[]): Promise<void>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Model, RelationMetaData } from '../../types/Model';
|
|
2
|
-
import { AppFacades } from '../../types/App';
|
|
3
2
|
import { default as HasOneOrMany } from './HasOneOrMany';
|
|
4
|
-
|
|
3
|
+
import { RelationServices } from '../Relation';
|
|
5
4
|
export default class HasOne extends HasOneOrMany {
|
|
5
|
+
protected services: RelationServices;
|
|
6
6
|
protected meta: RelationMetaData;
|
|
7
|
-
protected facades: AppFacades;
|
|
8
7
|
protected parent: Model;
|
|
9
8
|
protected items: Model | null;
|
|
10
|
-
constructor(
|
|
9
|
+
constructor(services: RelationServices, meta: RelationMetaData, parent: Model, items?: Model | null);
|
|
11
10
|
isSingle(): boolean;
|
|
12
11
|
isMultiple(): boolean;
|
|
13
12
|
get(): Promise<Model | null>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BuilderInterface as Builder } from '../../types/Builder';
|
|
2
2
|
import { Model, ModelPaginatedResponse } from '../../types/Model';
|
|
3
3
|
import { default as Relation } from '../Relation';
|
|
4
|
-
|
|
5
4
|
type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
|
|
6
5
|
export default class HasOneOrMany extends Relation {
|
|
7
6
|
query(): BuilderInterface;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Collection } from '@luminix/support';
|
|
2
2
|
import { Model, RelationMetaData } from '../../types/Model';
|
|
3
3
|
import { default as MorphOneOrMany } from './MorphOneOrMany';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { RelationServices } from '../Relation';
|
|
6
5
|
export default class MorphMany extends MorphOneOrMany {
|
|
6
|
+
protected services: RelationServices;
|
|
7
7
|
protected meta: RelationMetaData;
|
|
8
|
-
protected facades: AppFacades;
|
|
9
8
|
protected parent: Model;
|
|
10
|
-
protected items:
|
|
11
|
-
constructor(
|
|
9
|
+
protected items: Collection<Model> | null;
|
|
10
|
+
constructor(services: RelationServices, meta: RelationMetaData, parent: Model, items?: Collection<Model> | null);
|
|
12
11
|
isSingle(): boolean;
|
|
13
12
|
isMultiple(): boolean;
|
|
14
13
|
get(page?: number, replaceLinksWith?: string): Promise<import('../../types/Model').ModelPaginatedResponse>;
|
|
15
|
-
all(): Promise<
|
|
14
|
+
all(): Promise<Collection<Model>>;
|
|
16
15
|
first(): Promise<Model | null>;
|
|
17
16
|
find(id: string | number): Promise<Model | null>;
|
|
18
17
|
saveManyQuietly(models: Model[]): Promise<void>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { AppFacades } from '../../types/App';
|
|
2
1
|
import { Model, RelationMetaData } from '../../types/Model';
|
|
3
2
|
import { default as MorphOneOrMany } from './MorphOneOrMany';
|
|
4
|
-
|
|
3
|
+
import { RelationServices } from '../Relation';
|
|
5
4
|
export default class MorphOne extends MorphOneOrMany {
|
|
5
|
+
protected services: RelationServices;
|
|
6
6
|
protected meta: RelationMetaData;
|
|
7
|
-
protected facades: AppFacades;
|
|
8
7
|
protected parent: Model;
|
|
9
8
|
protected items: Model | null;
|
|
10
|
-
constructor(
|
|
9
|
+
constructor(services: RelationServices, meta: RelationMetaData, parent: Model, items?: Model | null);
|
|
11
10
|
isSingle(): boolean;
|
|
12
11
|
isMultiple(): boolean;
|
|
13
12
|
get(): Promise<Model | null>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BuilderInterface as Builder } from '../../types/Builder';
|
|
2
2
|
import { Model, ModelPaginatedResponse } from '../../types/Model';
|
|
3
3
|
import { default as HasOneOrMany } from './HasOneOrMany';
|
|
4
|
-
|
|
5
4
|
type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
|
|
6
5
|
export default class MorphOneOrMany extends HasOneOrMany {
|
|
7
6
|
query(): BuilderInterface;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BuilderInterface as Builder } from '../../types/Builder';
|
|
2
|
+
import { Model, ModelPaginatedResponse } from '../../types/Model';
|
|
3
|
+
import { default as BelongsToMany } from './BelongsToMany';
|
|
4
|
+
type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
|
|
5
|
+
export default class MorphToMany extends BelongsToMany {
|
|
6
|
+
query(): BuilderInterface;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Collection, JsonValue } from '@luminix/support';
|
|
2
2
|
import { BaseModel, Model, ModelPaginatedResponse, RelationMetaData } from '../types/Model';
|
|
3
3
|
import { BuilderInterface as Builder, Scope as ScopeBase, ExtendedOperator } from '../types/Builder';
|
|
4
|
-
import { Collection as CollectionInterface } from '../types/Collection';
|
|
5
4
|
import { RelationInterface as RelationBase } from '../types/Relation';
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { ModelFacade } from '../types/App';
|
|
6
|
+
import { RouteFacade } from '../types/Route';
|
|
8
7
|
type RelationInterface = RelationBase<Model, ModelPaginatedResponse>;
|
|
9
8
|
type BuilderInterface = Builder<Model, ModelPaginatedResponse>;
|
|
10
9
|
type Scope = ScopeBase<Model, ModelPaginatedResponse>;
|
|
10
|
+
export type RelationServices = {
|
|
11
|
+
model: ModelFacade;
|
|
12
|
+
route: RouteFacade;
|
|
13
|
+
};
|
|
11
14
|
export default class Relation implements RelationInterface {
|
|
15
|
+
protected services: RelationServices;
|
|
12
16
|
protected meta: RelationMetaData;
|
|
13
|
-
protected facades: AppFacades;
|
|
14
17
|
protected parent: BaseModel;
|
|
15
|
-
protected items: Model |
|
|
18
|
+
protected items: Model | Collection<Model> | null;
|
|
16
19
|
private unsubscribeQuery;
|
|
17
|
-
constructor(
|
|
20
|
+
constructor(services: RelationServices, meta: RelationMetaData, parent: BaseModel, items?: Model | Collection<Model> | null);
|
|
18
21
|
make(data: JsonValue): void;
|
|
19
22
|
guessInverseRelation(): string;
|
|
20
|
-
set(items: Model |
|
|
23
|
+
set(items: Model | Collection<Model> | null): void;
|
|
21
24
|
getForeignKey(): string | null;
|
|
22
25
|
getName(): string;
|
|
23
26
|
getType(): "HasOne" | "HasMany" | "BelongsTo" | "BelongsToMany" | "MorphOne" | "MorphMany" | "MorphTo" | "MorphToMany" | "MorphedByMany";
|
|
@@ -25,7 +28,7 @@ export default class Relation implements RelationInterface {
|
|
|
25
28
|
getRelated(): typeof Model;
|
|
26
29
|
query(): Builder<Model, ModelPaginatedResponse>;
|
|
27
30
|
isLoaded(): boolean;
|
|
28
|
-
getLoadedItems(): Model |
|
|
31
|
+
getLoadedItems(): Model | Collection<Model> | null;
|
|
29
32
|
isSingle(): boolean;
|
|
30
33
|
isMultiple(): boolean;
|
|
31
34
|
getParent(): BaseModel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HasFacadeAccessor, Application, FacadeOf, MacroableInterface } from '@luminix/support';
|
|
2
|
+
import { AppContainers, AppMacros } from '../types/App';
|
|
3
|
+
declare module '@luminix/support' {
|
|
4
|
+
interface ApplicationInterface extends MacroableInterface<AppMacros>, AppMacros {
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare class AppFacade implements HasFacadeAccessor {
|
|
8
|
+
getFacadeAccessor(): string | object;
|
|
9
|
+
down(): void;
|
|
10
|
+
}
|
|
11
|
+
declare const App: FacadeOf<Application<AppContainers> & AppMacros & MacroableInterface<AppMacros>, AppFacade>;
|
|
12
|
+
export default App;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HasFacadeAccessor } from '@luminix/support';
|
|
2
|
+
import { default as AuthService } from '../services/AuthService';
|
|
3
|
+
declare class AuthFacade implements HasFacadeAccessor {
|
|
4
|
+
getFacadeAccessor(): string | object;
|
|
5
|
+
}
|
|
6
|
+
declare const Auth: import('@luminix/support').FacadeOf<AuthService, AuthFacade>;
|
|
7
|
+
export default Auth;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HasFacadeAccessor, PropertyBag } from '@luminix/support';
|
|
2
|
+
import { AppConfiguration } from '../types/Config';
|
|
3
|
+
declare class ConfigFacade implements HasFacadeAccessor {
|
|
4
|
+
getFacadeAccessor(): string | object;
|
|
5
|
+
}
|
|
6
|
+
declare const Config: import('@luminix/support').FacadeOf<PropertyBag<AppConfiguration>, ConfigFacade>;
|
|
7
|
+
export default Config;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HasFacadeAccessor, Response } from '@luminix/support';
|
|
2
|
+
import { ValidationError } from '../types/Error';
|
|
3
|
+
import { default as ErrorService } from '../services/ErrorService';
|
|
4
|
+
/** @deprecated */
|
|
5
|
+
export declare const isValidationError: (response: unknown) => response is Response<ValidationError, any>;
|
|
6
|
+
declare class ErrorFacade implements HasFacadeAccessor {
|
|
7
|
+
getFacadeAccessor(): string | object;
|
|
8
|
+
}
|
|
9
|
+
declare const Error: import('@luminix/support').FacadeOf<ErrorService, ErrorFacade>;
|
|
10
|
+
export default Error;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HasFacadeAccessor } from '@luminix/support';
|
|
2
|
+
import { HttpService } from '../services/HttpService';
|
|
3
|
+
import { HttpMacro } from '../types/Http';
|
|
4
|
+
declare class HttpFacade implements HasFacadeAccessor {
|
|
5
|
+
getFacadeAccessor(): string | object;
|
|
6
|
+
}
|
|
7
|
+
declare const Http: import('@luminix/support').FacadeOf<HttpService, HttpFacade & Record<string, HttpMacro> & import('@luminix/support').MacroableInterface<Record<string, HttpMacro>> & HasFacadeAccessor>;
|
|
8
|
+
export default Http;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HasFacadeAccessor } from '@luminix/support';
|
|
2
|
+
import { default as LogService } from '../services/LogService';
|
|
3
|
+
declare class LogFacade implements HasFacadeAccessor {
|
|
4
|
+
getFacadeAccessor(): string | object;
|
|
5
|
+
}
|
|
6
|
+
declare const Log: import('@luminix/support').FacadeOf<LogService, LogFacade>;
|
|
7
|
+
export default Log;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HasFacadeAccessor, ReducibleInterface } from '@luminix/support';
|
|
2
|
+
import { ModelService } from '../services/ModelService';
|
|
3
|
+
import { ModelReducers } from '../types/Model';
|
|
4
|
+
declare class ModelFacade implements HasFacadeAccessor {
|
|
5
|
+
getFacadeAccessor(): string | object;
|
|
6
|
+
}
|
|
7
|
+
declare const Model: import('@luminix/support').FacadeOf<ModelService & ModelReducers & ReducibleInterface<ModelReducers>, ModelFacade>;
|
|
8
|
+
export default Model;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HasFacadeAccessor } from '@luminix/support';
|
|
2
|
+
import { RouteService } from '../services/RouteService';
|
|
3
|
+
declare class RouteFacade implements HasFacadeAccessor {
|
|
4
|
+
getFacadeAccessor(): string | object;
|
|
5
|
+
}
|
|
6
|
+
declare const Route: import('@luminix/support').FacadeOf<RouteService, RouteFacade>;
|
|
7
|
+
export default Route;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Model } from '../types/Model';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
declare function model(): ModelFacade;
|
|
2
|
+
import { AppContainers } from '../types/App';
|
|
3
|
+
declare function model(): AppContainers['model'];
|
|
5
4
|
declare function model(abstract: string): typeof Model;
|
|
6
5
|
export default model;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RouteFacade, RouteReplacer } from '../types/Route';
|
|
2
|
-
|
|
3
|
-
declare function route(): RouteFacade
|
|
2
|
+
import { FacadeOf, HasFacadeAccessor } from '@luminix/support';
|
|
3
|
+
declare function route(): FacadeOf<RouteFacade, HasFacadeAccessor>;
|
|
4
4
|
declare function route(name: string, parameters?: RouteReplacer): string;
|
|
5
5
|
export default route;
|
|
@@ -6,19 +6,19 @@ import { default as error } from './helpers/error';
|
|
|
6
6
|
import { default as log } from './helpers/log';
|
|
7
7
|
import { default as model } from './helpers/model';
|
|
8
8
|
import { default as route } from './helpers/route';
|
|
9
|
-
import {
|
|
9
|
+
import { default as App } from './facades/App';
|
|
10
|
+
import { default as Auth } from './facades/Auth';
|
|
11
|
+
import { default as Config } from './facades/Config';
|
|
12
|
+
import { default as Error, isValidationError } from './facades/Error';
|
|
13
|
+
import { default as Http } from './facades/Http';
|
|
14
|
+
import { default as Log } from './facades/Log';
|
|
15
|
+
import { default as Model } from './facades/Model';
|
|
16
|
+
import { default as Route } from './facades/Route';
|
|
10
17
|
import { default as Plugin } from './contracts/Plugin';
|
|
11
|
-
import { default as PropertyBag } from './contracts/PropertyBag';
|
|
12
18
|
import { isModel } from './support/model';
|
|
13
|
-
|
|
14
|
-
import { Reducible } from './mixins/Reducible';
|
|
15
|
-
import { HasEvents } from './mixins/HasEvents';
|
|
16
|
-
|
|
17
|
-
export { app, auth, collect, config, error, log, model, route, isCollection, isValidationError, isModel, Plugin, PropertyBag, Reducible, HasEvents, };
|
|
19
|
+
export { app, App, auth, Auth, collect, config, Config, error, Error, Http, log, Log, model, Model, route, Route, isValidationError, isModel, Plugin, };
|
|
18
20
|
export type { AppFacade } from './types/App';
|
|
19
21
|
export type { AuthFacade } from './types/Auth';
|
|
20
22
|
export type { LogFacade } from './types/Log';
|
|
21
|
-
export type { ReducibleInterface } from './types/Reducer';
|
|
22
23
|
export type { RouteFacade } from './types/Route';
|
|
23
|
-
export type { Model, BaseModel } from './types/Model';
|
|
24
|
-
export type { EventSource } from './types/Event';
|
|
24
|
+
export type { Model as ModelType, BaseModel } from './types/Model';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseModel, Model as ModelInterface } from '../types/Model';
|
|
2
|
+
import { ModelFacade } from '../types/App';
|
|
3
|
+
import { RouteFacade } from '../types/Route';
|
|
4
|
+
import { LogFacade } from '../types/Log';
|
|
5
|
+
import { ConfigFacade } from '../types/Config';
|
|
6
|
+
export declare function BaseModelFactory(Config: ConfigFacade, Log: LogFacade, ModelFacade: ModelFacade, Route: RouteFacade, abstract: string): typeof BaseModel;
|
|
7
|
+
export declare function ModelFactory(ModelFacade: ModelFacade, abstract: string, CustomModel: typeof BaseModel): typeof ModelInterface;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ServiceProvider } from '@luminix/support';
|
|
2
|
+
export default class LuminixServiceProvider extends ServiceProvider {
|
|
3
|
+
protected flushReady?: () => void;
|
|
4
|
+
register(): void;
|
|
5
|
+
boot(): void;
|
|
6
|
+
flush(): void;
|
|
7
|
+
registerServices(): void;
|
|
8
|
+
registerMacros(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PropertyBag } from '@luminix/support';
|
|
2
|
+
import { AuthCredentials } from '../types/Auth';
|
|
3
|
+
import { Model } from '../types/Model';
|
|
4
|
+
import { AppConfiguration } from '../types/Config';
|
|
5
|
+
import { ModelFacade } from '../types/App';
|
|
6
|
+
import { RouteFacade } from '../types/Route';
|
|
7
|
+
export default class AuthService {
|
|
8
|
+
protected config: PropertyBag<AppConfiguration>;
|
|
9
|
+
protected model: ModelFacade;
|
|
10
|
+
protected route: RouteFacade;
|
|
11
|
+
protected _user: Model | undefined;
|
|
12
|
+
constructor(config: PropertyBag<AppConfiguration>, model: ModelFacade, route: RouteFacade);
|
|
13
|
+
attempt(credentials: AuthCredentials, remember?: boolean, onSubmit?: (e: Event) => void): void;
|
|
14
|
+
check(): boolean;
|
|
15
|
+
logout(onSubmit?: (e: Event) => void): void;
|
|
16
|
+
user(): Model | undefined;
|
|
17
|
+
id(): number | string | null;
|
|
18
|
+
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const isValidationError: (error: unknown) => error is ValidationError;
|
|
5
|
-
declare class Error implements ErrorFacade {
|
|
1
|
+
import { PropertyBag } from '@luminix/support';
|
|
2
|
+
export default class ErrorService {
|
|
6
3
|
private bags;
|
|
7
4
|
constructor();
|
|
8
5
|
bag(name?: string): PropertyBag<Record<string, string>>;
|
|
@@ -12,4 +9,3 @@ declare class Error implements ErrorFacade {
|
|
|
12
9
|
get(key: string, bag?: string): string | null;
|
|
13
10
|
clear(bag?: string): void;
|
|
14
11
|
}
|
|
15
|
-
export default Error;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Client, RequestOptions } from '@luminix/support';
|
|
2
|
+
export declare class HttpService {
|
|
3
|
+
getClient(): Client;
|
|
4
|
+
baseUrl(baseUrl: string): Client;
|
|
5
|
+
asForm(): Client;
|
|
6
|
+
accept(type: string): Client;
|
|
7
|
+
acceptJson(): Client;
|
|
8
|
+
withHeaders(headers: Record<string, string>): Client;
|
|
9
|
+
withOptions(options: RequestOptions): Client;
|
|
10
|
+
withData(data: object): Client;
|
|
11
|
+
withQueryParameters(params: string | object): Client;
|
|
12
|
+
withBasicAuth(username: string, password: string): Client;
|
|
13
|
+
withToken(token: string): Client;
|
|
14
|
+
get<TResponse = any>(url: string, query?: string | object): import('@luminix/support').Request<TResponse, any>;
|
|
15
|
+
post<TResponse = any, TData = any>(url: string, data?: TData): import('@luminix/support').Request<TResponse, TData>;
|
|
16
|
+
put<TResponse = any, TData = any>(url: string, data?: TData): import('@luminix/support').Request<TResponse, TData>;
|
|
17
|
+
patch<TResponse = any, TData = any>(url: string, data?: TData): import('@luminix/support').Request<TResponse, TData>;
|
|
18
|
+
delete<TResponse = any>(url: string, query?: string | object): import('@luminix/support').Request<TResponse, any>;
|
|
19
|
+
}
|
|
20
|
+
declare const _default: import('@luminix/support').MacroableOf<typeof HttpService, Record<string, (...args: any) => Client>>;
|
|
21
|
+
export default _default;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default class Log implements LogFacade {
|
|
4
|
-
private _debug;
|
|
1
|
+
export default class LogService {
|
|
2
|
+
protected _debug: boolean;
|
|
5
3
|
constructor(_debug: boolean);
|
|
6
4
|
emergency(...args: any[]): void;
|
|
7
5
|
alert(...args: any[]): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EventSource } from '@luminix/support';
|
|
2
|
+
import { ModelSchema, ModelSchemaAttributes, Model, ModelReducers } from '../types/Model';
|
|
3
|
+
import { AppFacade, GlobalModelEvents } from '../types/App';
|
|
4
|
+
export declare class ModelService extends EventSource<GlobalModelEvents> {
|
|
5
|
+
private readonly _schema;
|
|
6
|
+
private _models;
|
|
7
|
+
[Symbol.toStringTag]: string;
|
|
8
|
+
constructor(_schema: ModelSchema);
|
|
9
|
+
boot(app: AppFacade): void;
|
|
10
|
+
schema(): ModelSchema;
|
|
11
|
+
schema(abstract: string): ModelSchemaAttributes;
|
|
12
|
+
make(): {
|
|
13
|
+
[abstract: string]: typeof Model;
|
|
14
|
+
};
|
|
15
|
+
make(abstract: string): typeof Model;
|
|
16
|
+
getRelationConstructors(abstract: string): any;
|
|
17
|
+
toString(): string;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
declare const _default: import('@luminix/support').ReducibleOf<typeof ModelService, ModelReducers>;
|
|
21
|
+
export default _default;
|