@nan0web/core 1.0.3 → 1.1.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 +16 -10
- package/package.json +55 -53
- package/src/AppCore.js +53 -45
- package/src/Model.js +47 -0
- package/src/ProjectModel.js +74 -0
- package/src/index.js +7 -8
- package/types/AppCore.d.ts +39 -8
- package/types/Model.d.ts +32 -0
- package/types/ProjectModel.d.ts +62 -0
- package/types/index.d.ts +7 -4
- package/src/README.md.js +0 -219
- package/src/registry/ApiRegistry.js +0 -7
- package/src/registry/CommandRegistry.js +0 -50
- package/src/registry/ComponentRegistry.js +0 -51
- package/src/registry/RouteRegistry.js +0 -50
- package/src/registry/UiRegistry.js +0 -7
- package/src/system/Validator.js +0 -55
- package/src/system/integrator.js +0 -84
- package/src/system/main.js +0 -82
- package/types/registry/ApiRegistry.d.ts +0 -3
- package/types/registry/CommandRegistry.d.ts +0 -42
- package/types/registry/ComponentRegistry.d.ts +0 -42
- package/types/registry/RouteRegistry.d.ts +0 -42
- package/types/registry/UiRegistry.d.ts +0 -3
- package/types/system/Validator.d.ts +0 -30
- package/types/system/integrator.d.ts +0 -30
- package/types/system/main.d.ts +0 -1
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registry for API route namespaces
|
|
3
|
-
* Tracks registered prefixes and their owners
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* const registry = new RouteRegistry()
|
|
7
|
-
* registry.register('auth', { setup: (router) => { ... }, owner: '@nan0web/auth.app' })
|
|
8
|
-
* registry.has('auth') // true
|
|
9
|
-
*/
|
|
10
|
-
export default class RouteRegistry {
|
|
11
|
-
/**
|
|
12
|
-
* Register a namespace prefix
|
|
13
|
-
* @param {string} prefix - URL prefix (e.g. 'auth')
|
|
14
|
-
* @param {{ setup: Function, owner: string }} config - Setup function and package name
|
|
15
|
-
* @returns {this}
|
|
16
|
-
*/
|
|
17
|
-
register(prefix: string, config: {
|
|
18
|
-
setup: Function;
|
|
19
|
-
owner: string;
|
|
20
|
-
}): this;
|
|
21
|
-
/**
|
|
22
|
-
* Get all registered routes
|
|
23
|
-
* @returns {Map<string, { setup: Function, owner: string }>}
|
|
24
|
-
*/
|
|
25
|
-
getRoutes(): Map<string, {
|
|
26
|
-
setup: Function;
|
|
27
|
-
owner: string;
|
|
28
|
-
}>;
|
|
29
|
-
/**
|
|
30
|
-
* Check if prefix exists
|
|
31
|
-
* @param {string} prefix
|
|
32
|
-
* @returns {boolean}
|
|
33
|
-
*/
|
|
34
|
-
has(prefix: string): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Get owner of prefix
|
|
37
|
-
* @param {string} prefix
|
|
38
|
-
* @returns {string | null}
|
|
39
|
-
*/
|
|
40
|
-
getOwner(prefix: string): string | null;
|
|
41
|
-
#private;
|
|
42
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates application integration before registration
|
|
3
|
-
* Checks for namespace collisions across all registries
|
|
4
|
-
*/
|
|
5
|
-
export default class SystemValidator {
|
|
6
|
-
/**
|
|
7
|
-
* @param {Object} registries - System-wide registries
|
|
8
|
-
* @param {RouteRegistry} registries.apiRegistry - Manages API route prefixes
|
|
9
|
-
* @param {CommandRegistry} registries.cliRegistry - Manages CLI commands
|
|
10
|
-
* @param {ComponentRegistry} [registries.uiRegistry] - Manages UI components
|
|
11
|
-
*/
|
|
12
|
-
constructor({ apiRegistry, cliRegistry, uiRegistry }: {
|
|
13
|
-
apiRegistry: RouteRegistry;
|
|
14
|
-
cliRegistry: CommandRegistry;
|
|
15
|
-
uiRegistry?: ComponentRegistry | undefined;
|
|
16
|
-
});
|
|
17
|
-
apiRegistry: RouteRegistry;
|
|
18
|
-
cliRegistry: CommandRegistry;
|
|
19
|
-
uiRegistry: ComponentRegistry;
|
|
20
|
-
/**
|
|
21
|
-
* Validate application configuration for potential conflicts
|
|
22
|
-
* @param {Object} application - Must have register() method
|
|
23
|
-
* @param {Object} [configuration] - Custom integration settings
|
|
24
|
-
* @returns {Array<string>} List of collision errors
|
|
25
|
-
*/
|
|
26
|
-
validate(application: any, configuration?: any): Array<string>;
|
|
27
|
-
}
|
|
28
|
-
import RouteRegistry from '../registry/RouteRegistry.js';
|
|
29
|
-
import CommandRegistry from '../registry/CommandRegistry.js';
|
|
30
|
-
import ComponentRegistry from '../registry/ComponentRegistry.js';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integrates applications based on configuration file.
|
|
3
|
-
* The config is loaded lazily to avoid TS JSON‑module issues.
|
|
4
|
-
*/
|
|
5
|
-
export class AppIntegrator {
|
|
6
|
-
apiRegistry: ApiRegistry;
|
|
7
|
-
cliRegistry: CliRegistry;
|
|
8
|
-
uiRegistry: UiRegistry;
|
|
9
|
-
validator: SystemValidator;
|
|
10
|
-
/**
|
|
11
|
-
* Load the apps configuration (JSON) at runtime.
|
|
12
|
-
* @returns {Promise<Record<string, any>>}
|
|
13
|
-
*/
|
|
14
|
-
_loadConfig(): Promise<Record<string, any>>;
|
|
15
|
-
/**
|
|
16
|
-
* Register all configured applications.
|
|
17
|
-
*/
|
|
18
|
-
registerAll(): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Internal registration logic.
|
|
21
|
-
* @param {string} packageName
|
|
22
|
-
* @param {object} app
|
|
23
|
-
* @param {object} cfg
|
|
24
|
-
*/
|
|
25
|
-
_registerApp(packageName: string, app: object, cfg: object): void;
|
|
26
|
-
}
|
|
27
|
-
import ApiRegistry from '../registry/ApiRegistry.js';
|
|
28
|
-
import CliRegistry from '../registry/CommandRegistry.js';
|
|
29
|
-
import UiRegistry from '../registry/UiRegistry.js';
|
|
30
|
-
import SystemValidator from './Validator.js';
|
package/types/system/main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|