@luminix/core 0.1.0-beta.0 → 0.2.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/README.md +0 -28
- package/dist/core.js +385 -380
- package/package.json +2 -2
- package/types/extensions.d.ts +10 -0
- package/types/facades/App.d.ts +0 -4
- package/types/facades/Route.d.ts +3 -2
- package/types/index.d.ts +5 -3
- package/types/providers/LuminixServiceProvider.d.ts +1 -2
- package/types/services/RouteService.d.ts +1 -1
- package/types/support/model.d.ts +1 -0
- package/types/types/App.d.ts +4 -4
- package/types/types/Builder.d.ts +2 -2
- package/types/types/Relation.d.ts +1 -2
- package/types/types/Route.d.ts +6 -5
- package/.eslintignore +0 -3
- package/.eslintrc.cjs +0 -39
- package/index.html +0 -13
- package/jest.config.js +0 -15
- package/tsconfig.json +0 -25
- package/vite.config.js +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luminix/core",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "> Projeto em desenvolvimento",
|
|
5
5
|
"module": "dist/core.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
"vite-plugin-dts": "^4.0.0-beta.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@luminix/support": "^0.0
|
|
33
|
+
"@luminix/support": "^0.3.0"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MacroableInterface } from '@luminix/support';
|
|
2
|
+
import { AppMacros } from './types/App';
|
|
3
|
+
import { Model } from './types/Model';
|
|
4
|
+
declare module '@luminix/support' {
|
|
5
|
+
interface ApplicationInterface extends MacroableInterface<AppMacros>, AppMacros {
|
|
6
|
+
}
|
|
7
|
+
interface ObjMacros {
|
|
8
|
+
isModel(value: unknown): value is Model;
|
|
9
|
+
}
|
|
10
|
+
}
|
package/types/facades/App.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { HasFacadeAccessor, Application, FacadeOf, MacroableInterface } from '@luminix/support';
|
|
2
2
|
import { AppContainers, AppMacros } from '../types/App';
|
|
3
|
-
declare module '@luminix/support' {
|
|
4
|
-
interface ApplicationInterface extends MacroableInterface<AppMacros>, AppMacros {
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
3
|
declare class AppFacade implements HasFacadeAccessor {
|
|
8
4
|
getFacadeAccessor(): string | object;
|
|
9
5
|
down(): void;
|
package/types/facades/Route.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { HasFacadeAccessor } from '@luminix/support';
|
|
1
|
+
import { HasFacadeAccessor, ReducibleInterface } from '@luminix/support';
|
|
2
2
|
import { RouteService } from '../services/RouteService';
|
|
3
|
+
import { RouteReducers } from '../types/Route';
|
|
3
4
|
declare class RouteFacade implements HasFacadeAccessor {
|
|
4
5
|
getFacadeAccessor(): string | object;
|
|
5
6
|
}
|
|
6
|
-
declare const Route: import('@luminix/support').FacadeOf<RouteService
|
|
7
|
+
declare const Route: import('@luminix/support').FacadeOf<RouteService & RouteReducers & ReducibleInterface<RouteReducers>, RouteFacade>;
|
|
7
8
|
export default Route;
|
package/types/index.d.ts
CHANGED
|
@@ -17,8 +17,10 @@ import { default as Route } from './facades/Route';
|
|
|
17
17
|
import { default as Plugin } from './contracts/Plugin';
|
|
18
18
|
import { isModel } from './support/model';
|
|
19
19
|
export { app, App, auth, Auth, collect, config, Config, error, Error, Http, log, Log, model, Model, route, Route, isValidationError, isModel, Plugin, };
|
|
20
|
-
export type { AppFacade } from './types/App';
|
|
20
|
+
export type { AppFacade, AppEvents, AppContainers } from './types/App';
|
|
21
21
|
export type { AuthFacade } from './types/Auth';
|
|
22
|
+
export type { BuilderInterface, Scope } from './types/Builder';
|
|
23
|
+
export type { AppConfiguration } from './types/Config';
|
|
22
24
|
export type { LogFacade } from './types/Log';
|
|
23
|
-
export type {
|
|
24
|
-
export type {
|
|
25
|
+
export type { Model as ModelType, BaseModel, ModelAttribute, ModelSaveOptions, ModelPaginatedResponse, ModelPaginatedLink } from './types/Model';
|
|
26
|
+
export type { RouteFacade, RouteReducers, HttpMethod, RouteGenerator } from './types/Route';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ServiceProvider } from '@luminix/support';
|
|
2
2
|
export default class LuminixServiceProvider extends ServiceProvider {
|
|
3
|
-
|
|
3
|
+
[Symbol.toStringTag]: string;
|
|
4
4
|
register(): void;
|
|
5
5
|
boot(): void;
|
|
6
|
-
flush(): void;
|
|
7
6
|
registerServices(): void;
|
|
8
7
|
registerMacros(): void;
|
|
9
8
|
}
|
|
@@ -13,7 +13,7 @@ export declare class RouteService {
|
|
|
13
13
|
url(generator: RouteGenerator): string;
|
|
14
14
|
methods(generator: RouteGenerator): HttpMethod[];
|
|
15
15
|
exists(name: string): boolean;
|
|
16
|
-
call<TResponse = any>(generator: RouteGenerator, tap?: (client: Client) => Client): Promise<Response<TResponse>>;
|
|
16
|
+
call<TResponse = any>(generator: RouteGenerator, tap?: (client: Client) => Client, errorBag?: string): Promise<Response<TResponse>>;
|
|
17
17
|
toString(): string;
|
|
18
18
|
[reducer: string]: unknown;
|
|
19
19
|
}
|
package/types/support/model.d.ts
CHANGED
package/types/types/App.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { EventSource, Event, ReducibleInterface, FacadeOf, HasFacadeAccessor, Application, MacroableInterface } from '@luminix/support';
|
|
1
|
+
import { EventSource, Event, ReducibleInterface, FacadeOf, HasFacadeAccessor, Application, MacroableInterface, Constructor } from '@luminix/support';
|
|
2
2
|
import { AppConfiguration, ConfigFacade } from './Config';
|
|
3
3
|
import { PluginInterface } from './Plugin';
|
|
4
4
|
import { LogFacade } from './Log';
|
|
5
5
|
import { BaseModel, Model, ModelPaginatedResponse, ModelReducers, ModelSchema, ModelSchemaAttributes } from './Model';
|
|
6
6
|
import { RouteFacade } from './Route';
|
|
7
7
|
import { ErrorFacade } from './Error';
|
|
8
|
-
import { Constructor } from './Support';
|
|
9
8
|
import { RelationInterface } from './Relation';
|
|
10
9
|
import { AuthFacade } from './Auth';
|
|
11
10
|
import { HttpFacade } from './Http';
|
|
@@ -36,6 +35,7 @@ export type ModelFacade = EventSource<GlobalModelEvents> & ModelReducers & Reduc
|
|
|
36
35
|
boot(app: AppFacade): void;
|
|
37
36
|
getRelationConstructors(abstract: string): Record<string, Constructor<RelationInterface<Model, ModelPaginatedResponse>>>;
|
|
38
37
|
};
|
|
38
|
+
/** @deprecated */
|
|
39
39
|
export type AppEvents = {
|
|
40
40
|
'init': (e: InitEvent) => void;
|
|
41
41
|
'booted': (e: Event<{}, AppFacade>) => void;
|
|
@@ -64,7 +64,7 @@ export type AppExternal = {
|
|
|
64
64
|
export type AppFacade = FacadeOf<Application<AppContainers> & AppMacros & MacroableInterface<AppMacros>, HasFacadeAccessor> & {
|
|
65
65
|
down(): void;
|
|
66
66
|
};
|
|
67
|
-
export
|
|
67
|
+
export declare class AppContainers {
|
|
68
68
|
auth: FacadeOf<AuthFacade, HasFacadeAccessor>;
|
|
69
69
|
config: FacadeOf<ConfigFacade, HasFacadeAccessor>;
|
|
70
70
|
error: FacadeOf<ErrorFacade, HasFacadeAccessor>;
|
|
@@ -73,7 +73,7 @@ export type AppContainers = {
|
|
|
73
73
|
model: FacadeOf<ModelFacade, HasFacadeAccessor>;
|
|
74
74
|
route: FacadeOf<RouteFacade, HasFacadeAccessor>;
|
|
75
75
|
[key: string]: any;
|
|
76
|
-
}
|
|
76
|
+
}
|
|
77
77
|
export type BootOptions = {
|
|
78
78
|
config?: AppConfiguration;
|
|
79
79
|
skipBootRequest?: boolean;
|
package/types/types/Builder.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventSource, Collection, PropertyBag,
|
|
1
|
+
import { EventSource, Collection, PropertyBag, Operator, Event, PropertyBagEventMap, JsonObject, JsonValue } from '@luminix/support';
|
|
2
2
|
export type Scope<TSingle, TMany> = (builder: BuilderInterface<TSingle, TMany>) => BuilderInterface<TSingle, TMany> | void;
|
|
3
|
-
export type ExtendedOperator =
|
|
3
|
+
export type ExtendedOperator = Operator | 'like' | 'notLike' | 'between' | 'notBetween' | 'null' | 'notNull';
|
|
4
4
|
export type BuilderInterface<TSingle, TMany = Collection<TSingle>> = EventSource<BuilderEventMap<TSingle, TMany>> & {
|
|
5
5
|
lock(path: string): void;
|
|
6
6
|
where(scope: Scope<TSingle, TMany>): BuilderInterface<TSingle, TMany>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Collection } from '@luminix/support';
|
|
1
|
+
import { Collection, Constructor, JsonValue } from '@luminix/support';
|
|
2
2
|
import { BuilderInterface, ExtendedOperator, Scope } from './Builder';
|
|
3
|
-
import { Constructor, JsonValue } from './Support';
|
|
4
3
|
export type { BuilderInterface, ExtendedOperator, Scope, };
|
|
5
4
|
export type RelationInterface<R, C> = {
|
|
6
5
|
guessInverseRelation(): string;
|
package/types/types/Route.d.ts
CHANGED
|
@@ -2,21 +2,22 @@ import { ReducibleInterface, Response, Client, RequestOptions } from '@luminix/s
|
|
|
2
2
|
export type RouteReplacer = {
|
|
3
3
|
[key: string]: string | number;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export declare class RouteReducers {
|
|
6
6
|
clientOptions(config: RequestOptions, routeName: string): RequestOptions;
|
|
7
7
|
clientError(errors: Record<string, string>, event: {
|
|
8
8
|
response: Response;
|
|
9
|
-
name
|
|
10
|
-
replace
|
|
9
|
+
name?: string;
|
|
10
|
+
replace?: RouteReplacer;
|
|
11
11
|
client: Client;
|
|
12
12
|
}): Record<string, string>;
|
|
13
13
|
replaceRouteParams(url: string): string;
|
|
14
|
-
|
|
14
|
+
[reducer: string]: (...args: any[]) => any;
|
|
15
|
+
}
|
|
15
16
|
export type RouteFacade = ReducibleInterface<RouteReducers> & {
|
|
16
17
|
get(name: string): RouteTuple;
|
|
17
18
|
url(generator: RouteGenerator): string;
|
|
18
19
|
exists(name: string): boolean;
|
|
19
|
-
call<TResponse = unknown>(generator: RouteGenerator, tap?: (client: Client) => Client): Promise<Response<TResponse>>;
|
|
20
|
+
call<TResponse = unknown>(generator: RouteGenerator, tap?: (client: Client) => Client, errorBag?: string): Promise<Response<TResponse>>;
|
|
20
21
|
methods(generator: RouteGenerator): HttpMethod[];
|
|
21
22
|
};
|
|
22
23
|
export type RouteGenerator = string | [string, RouteReplacer];
|
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
|
-
};
|
package/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Vite + TS</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/src/index.ts"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
package/jest.config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export default {
|
|
3
|
-
transform: {
|
|
4
|
-
// '^.+\\.ts?$': 'ts-jest',
|
|
5
|
-
// use babel for js
|
|
6
|
-
'^.+\\.js?$': 'babel-jest',
|
|
7
|
-
'^.+\\.ts?$': 'ts-jest',
|
|
8
|
-
},
|
|
9
|
-
testEnvironment: 'jsdom',
|
|
10
|
-
testRegex: '/tests/.*\\.(test|spec)?\\.(ts|tsx)$',
|
|
11
|
-
moduleFileExtensions: ['ts', 'js'],
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
package/tsconfig.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
7
|
-
"skipLibCheck": false,
|
|
8
|
-
|
|
9
|
-
/* Bundler mode */
|
|
10
|
-
"moduleResolution": "Node",
|
|
11
|
-
"allowImportingTsExtensions": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"isolatedModules": true,
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
|
|
17
|
-
/* Linting */
|
|
18
|
-
"strict": true,
|
|
19
|
-
"noUnusedLocals": true,
|
|
20
|
-
"noUnusedParameters": true,
|
|
21
|
-
"noFallthroughCasesInSwitch": true,
|
|
22
|
-
},
|
|
23
|
-
"include": ["src"],
|
|
24
|
-
"exclude": ["node_modules", "dist", "tests"]
|
|
25
|
-
}
|
package/vite.config.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
|
|
4
|
-
import dts from 'vite-plugin-dts';
|
|
5
|
-
|
|
6
|
-
import packageJson from './package.json';
|
|
7
|
-
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
plugins: [dts({ insertTypesEntry: true, outDir: 'types' })],
|
|
10
|
-
build: {
|
|
11
|
-
lib: {
|
|
12
|
-
entry: resolve(__dirname, 'src/index.ts'),
|
|
13
|
-
formats: ['es'],
|
|
14
|
-
},
|
|
15
|
-
rollupOptions: {
|
|
16
|
-
external: Object.keys(packageJson.peerDependencies),
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
});
|