@nexo-alpha/core 0.1.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/LICENSE +21 -0
- package/dist/api.d.ts +10 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +2 -0
- package/dist/api.js.map +1 -0
- package/dist/application.d.ts +47 -0
- package/dist/application.d.ts.map +1 -0
- package/dist/application.js +116 -0
- package/dist/application.js.map +1 -0
- package/dist/constraint.d.ts +5 -0
- package/dist/constraint.d.ts.map +1 -0
- package/dist/constraint.js +2 -0
- package/dist/constraint.js.map +1 -0
- package/dist/decision.d.ts +7 -0
- package/dist/decision.d.ts.map +1 -0
- package/dist/decision.js +2 -0
- package/dist/decision.js.map +1 -0
- package/dist/development-state.d.ts +9 -0
- package/dist/development-state.d.ts.map +1 -0
- package/dist/development-state.js +2 -0
- package/dist/development-state.js.map +1 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +21 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +7 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +16 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/job.d.ts +6 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +2 -0
- package/dist/job.js.map +1 -0
- package/dist/module.d.ts +18 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +2 -0
- package/dist/module.js.map +1 -0
- package/dist/service.d.ts +7 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +2 -0
- package/dist/service.js.map +1 -0
- package/package.json +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nexo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
|
|
2
|
+
export interface NexoApi {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly method: HttpMethod;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly description?: string;
|
|
7
|
+
readonly purpose?: string;
|
|
8
|
+
readonly dependencies?: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,SAAS,GACT,MAAM,CAAC;AAEX,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C"}
|
package/dist/api.js
ADDED
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { NexoModule } from "./module.js";
|
|
2
|
+
import type { NexoApi } from "./api.js";
|
|
3
|
+
import type { NexoService } from "./service.js";
|
|
4
|
+
import type { NexoDecision } from "./decision.js";
|
|
5
|
+
import type { NexoConstraint } from "./constraint.js";
|
|
6
|
+
import type { DevelopmentState } from "./development-state.js";
|
|
7
|
+
import { NexoEventBus } from "./events.js";
|
|
8
|
+
export interface ApplicationOptions {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly version?: string;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
readonly config?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export type ApplicationState = "created" | "initializing" | "running" | "stopping" | "stopped";
|
|
15
|
+
export declare class NexoApplication {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly version: string;
|
|
18
|
+
readonly description?: string | undefined;
|
|
19
|
+
readonly events: NexoEventBus;
|
|
20
|
+
private readonly modules;
|
|
21
|
+
private readonly config;
|
|
22
|
+
private readonly decisions;
|
|
23
|
+
private readonly constraints;
|
|
24
|
+
private developmentState;
|
|
25
|
+
private _state;
|
|
26
|
+
constructor(options: ApplicationOptions);
|
|
27
|
+
get state(): ApplicationState;
|
|
28
|
+
module(module: NexoModule): this;
|
|
29
|
+
getModule(name: string): NexoModule | undefined;
|
|
30
|
+
getModules(): readonly NexoModule[];
|
|
31
|
+
getConfig<T = unknown>(key: string): T | undefined;
|
|
32
|
+
getAllConfig(): Readonly<Record<string, unknown>>;
|
|
33
|
+
getDependencies(moduleName: string): readonly string[];
|
|
34
|
+
getDependents(moduleName: string): readonly string[];
|
|
35
|
+
getApis(): readonly NexoApi[];
|
|
36
|
+
getServices(): readonly NexoService[];
|
|
37
|
+
addDecision(decision: NexoDecision): this;
|
|
38
|
+
getDecisions(): readonly NexoDecision[];
|
|
39
|
+
addConstraint(constraint: NexoConstraint): this;
|
|
40
|
+
getConstraints(): readonly NexoConstraint[];
|
|
41
|
+
setDevelopmentState(patch: Partial<DevelopmentState>): this;
|
|
42
|
+
getDevelopmentState(): DevelopmentState;
|
|
43
|
+
start(): Promise<void>;
|
|
44
|
+
stop(): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
export declare function createApplication(options: ApplicationOptions): NexoApplication;
|
|
47
|
+
//# sourceMappingURL=application.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,C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,MAAM,EAAE;IAItD,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IAMpD,OAAO,IAAI,SAAS,OAAO,EAAE;IAI7B,WAAW,IAAI,SAAS,WAAW,EAAE;IAMrC,WAAW,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAKzC,YAAY,IAAI,SAAS,YAAY,EAAE;IAIvC,aAAa,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI;IAK/C,cAAc,IAAI,SAAS,cAAc,EAAE;IAI3C,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAK3D,mBAAmB,IAAI,gBAAgB;IAIjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAqB5B;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,eAAe,CAEjB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { NexoConfigurationError, NexoLifecycleError } from "./errors.js";
|
|
2
|
+
import { NexoEventBus } from "./events.js";
|
|
3
|
+
export class NexoApplication {
|
|
4
|
+
name;
|
|
5
|
+
version;
|
|
6
|
+
description;
|
|
7
|
+
events = new NexoEventBus();
|
|
8
|
+
modules = new Map();
|
|
9
|
+
config;
|
|
10
|
+
decisions = [];
|
|
11
|
+
constraints = [];
|
|
12
|
+
developmentState = {
|
|
13
|
+
completed: [],
|
|
14
|
+
inProgress: [],
|
|
15
|
+
blocked: [],
|
|
16
|
+
knownIssues: []
|
|
17
|
+
};
|
|
18
|
+
_state = "created";
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.name = options.name;
|
|
21
|
+
this.version = options.version ?? "0.1.0";
|
|
22
|
+
this.description = options.description;
|
|
23
|
+
this.config = options.config ?? {};
|
|
24
|
+
}
|
|
25
|
+
get state() {
|
|
26
|
+
return this._state;
|
|
27
|
+
}
|
|
28
|
+
module(module) {
|
|
29
|
+
if (this.modules.has(module.name)) {
|
|
30
|
+
throw new NexoConfigurationError(`Nexo module "${module.name}" is already registered.`);
|
|
31
|
+
}
|
|
32
|
+
this.modules.set(module.name, module);
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
getModule(name) {
|
|
36
|
+
return this.modules.get(name);
|
|
37
|
+
}
|
|
38
|
+
getModules() {
|
|
39
|
+
return [...this.modules.values()];
|
|
40
|
+
}
|
|
41
|
+
getConfig(key) {
|
|
42
|
+
return this.config[key];
|
|
43
|
+
}
|
|
44
|
+
getAllConfig() {
|
|
45
|
+
return this.config;
|
|
46
|
+
}
|
|
47
|
+
getDependencies(moduleName) {
|
|
48
|
+
return this.modules.get(moduleName)?.dependencies ?? [];
|
|
49
|
+
}
|
|
50
|
+
getDependents(moduleName) {
|
|
51
|
+
return [...this.modules.values()]
|
|
52
|
+
.filter((module) => module.dependencies?.includes(moduleName))
|
|
53
|
+
.map((module) => module.name);
|
|
54
|
+
}
|
|
55
|
+
getApis() {
|
|
56
|
+
return [...this.modules.values()].flatMap((module) => module.apis ?? []);
|
|
57
|
+
}
|
|
58
|
+
getServices() {
|
|
59
|
+
return [...this.modules.values()].flatMap((module) => module.services ?? []);
|
|
60
|
+
}
|
|
61
|
+
addDecision(decision) {
|
|
62
|
+
this.decisions.push(decision);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
getDecisions() {
|
|
66
|
+
return [...this.decisions];
|
|
67
|
+
}
|
|
68
|
+
addConstraint(constraint) {
|
|
69
|
+
this.constraints.push(constraint);
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
getConstraints() {
|
|
73
|
+
return [...this.constraints];
|
|
74
|
+
}
|
|
75
|
+
setDevelopmentState(patch) {
|
|
76
|
+
this.developmentState = { ...this.developmentState, ...patch };
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
getDevelopmentState() {
|
|
80
|
+
return this.developmentState;
|
|
81
|
+
}
|
|
82
|
+
async start() {
|
|
83
|
+
if (this._state === "running") {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (this._state !== "created" && this._state !== "stopped") {
|
|
87
|
+
throw new NexoLifecycleError(`Cannot start application while in "${this._state}" state.`);
|
|
88
|
+
}
|
|
89
|
+
this._state = "initializing";
|
|
90
|
+
for (const module of this.modules.values()) {
|
|
91
|
+
await module.initialize?.();
|
|
92
|
+
}
|
|
93
|
+
for (const module of this.modules.values()) {
|
|
94
|
+
await module.start?.();
|
|
95
|
+
}
|
|
96
|
+
this._state = "running";
|
|
97
|
+
}
|
|
98
|
+
async stop() {
|
|
99
|
+
if (this._state === "stopped") {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (this._state !== "running") {
|
|
103
|
+
throw new NexoLifecycleError(`Cannot stop application while in "${this._state}" state.`);
|
|
104
|
+
}
|
|
105
|
+
this._state = "stopping";
|
|
106
|
+
const modules = [...this.modules.values()].reverse();
|
|
107
|
+
for (const module of modules) {
|
|
108
|
+
await module.stop?.();
|
|
109
|
+
}
|
|
110
|
+
this._state = "stopped";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export function createApplication(options) {
|
|
114
|
+
return new NexoApplication(options);
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgB3C,MAAM,OAAO,eAAe;IACjB,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,WAAW,CAAsB;IACjC,MAAM,GAAiB,IAAI,YAAY,EAAE,CAAC;IAElC,OAAO,GAAG,IAAI,GAAG,EAAsB,CAAC;IACxC,MAAM,CAAoC;IAC1C,SAAS,GAAmB,EAAE,CAA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,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACxB,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAC/B,OAA2B;IAE3B,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraint.d.ts","sourceRoot":"","sources":["../src/constraint.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraint.js","sourceRoot":"","sources":["../src/constraint.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision.d.ts","sourceRoot":"","sources":["../src/decision.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
package/dist/decision.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision.js","sourceRoot":"","sources":["../src/decision.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DevelopmentState {
|
|
2
|
+
readonly currentObjective?: string;
|
|
3
|
+
readonly completed: readonly string[];
|
|
4
|
+
readonly inProgress: readonly string[];
|
|
5
|
+
readonly blocked: readonly string[];
|
|
6
|
+
readonly knownIssues: readonly string[];
|
|
7
|
+
readonly nextStep?: string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=development-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"development-state.d.ts","sourceRoot":"","sources":["../src/development-state.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"development-state.js","sourceRoot":"","sources":["../src/development-state.ts"],"names":[],"mappings":""}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class NexoError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
constructor(code: string, message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class NexoConfigurationError extends NexoError {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class NexoLifecycleError extends NexoError {
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAM1C;AAED,qBAAa,sBAAuB,SAAQ,SAAS;gBACvC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,EAAE,MAAM;CAI5B"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class NexoError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
constructor(code, message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "NexoError";
|
|
6
|
+
this.code = code;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class NexoConfigurationError extends NexoError {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super("NEXO_CONFIGURATION_ERROR", message);
|
|
12
|
+
this.name = "NexoConfigurationError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class NexoLifecycleError extends NexoError {
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super("NEXO_LIFECYCLE_ERROR", message);
|
|
18
|
+
this.name = "NexoLifecycleError";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,IAAI,CAAS;IAEtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IACnD,YAAY,OAAe;QACzB,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class NexoEventBus {
|
|
2
|
+
private readonly emitter;
|
|
3
|
+
on(event: string, listener: (...args: unknown[]) => void): this;
|
|
4
|
+
off(event: string, listener: (...args: unknown[]) => void): this;
|
|
5
|
+
emit(event: string, ...args: unknown[]): boolean;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAE9C,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI;IAK/D,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI;IAKhE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO;CAGjD"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
export class NexoEventBus {
|
|
3
|
+
emitter = new EventEmitter();
|
|
4
|
+
on(event, listener) {
|
|
5
|
+
this.emitter.on(event, listener);
|
|
6
|
+
return this;
|
|
7
|
+
}
|
|
8
|
+
off(event, listener) {
|
|
9
|
+
this.emitter.off(event, listener);
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
emit(event, ...args) {
|
|
13
|
+
return this.emitter.emit(event, ...args);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,OAAO,YAAY;IACN,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC;IAE9C,EAAE,CAAC,KAAa,EAAE,QAAsC;QACtD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,QAAsC;QACvD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,KAAa,EAAE,GAAG,IAAe;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { createApplication, NexoApplication } from "./application.js";
|
|
2
|
+
export type { ApplicationOptions, ApplicationState } from "./application.js";
|
|
3
|
+
export type { NexoModule } from "./module.js";
|
|
4
|
+
export type { NexoService } from "./service.js";
|
|
5
|
+
export type { NexoApi, HttpMethod } from "./api.js";
|
|
6
|
+
export type { NexoJob } from "./job.js";
|
|
7
|
+
export type { NexoDecision } from "./decision.js";
|
|
8
|
+
export type { NexoConstraint } from "./constraint.js";
|
|
9
|
+
export type { DevelopmentState } from "./development-state.js";
|
|
10
|
+
export { NexoEventBus } from "./events.js";
|
|
11
|
+
export { NexoError, NexoConfigurationError, NexoLifecycleError } from "./errors.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,WAAW,EACZ,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,OAAO,EACP,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,OAAO,EACR,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAoC1B,OAAO,EACL,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC"}
|
package/dist/job.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
package/dist/job.js
ADDED
package/dist/job.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.js","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":""}
|
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NexoApi } from "./api.js";
|
|
2
|
+
import type { NexoService } from "./service.js";
|
|
3
|
+
import type { NexoJob } from "./job.js";
|
|
4
|
+
export interface NexoModule {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description?: string;
|
|
7
|
+
readonly purpose?: string;
|
|
8
|
+
readonly status?: string;
|
|
9
|
+
readonly dependencies?: readonly string[];
|
|
10
|
+
readonly apis?: readonly NexoApi[];
|
|
11
|
+
readonly services?: readonly NexoService[];
|
|
12
|
+
readonly events?: readonly string[];
|
|
13
|
+
readonly jobs?: readonly NexoJob[];
|
|
14
|
+
initialize?(): Promise<void> | void;
|
|
15
|
+
start?(): Promise<void> | void;
|
|
16
|
+
stop?(): Promise<void> | void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAEnC,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC/B"}
|
package/dist/module.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C"}
|
package/dist/service.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nexo-alpha/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Core runtime for the Nexo application framework",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.json",
|
|
20
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
21
|
+
"test": "node --test",
|
|
22
|
+
"clean": "rm -rf dist"
|
|
23
|
+
}
|
|
24
|
+
}
|