@antelopejs/interface-core 0.0.2
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 +190 -0
- package/dist/antelope.test.d.ts +2 -0
- package/dist/antelope.test.js +12 -0
- package/dist/antelope.test.js.map +1 -0
- package/dist/config.d.ts +74 -0
- package/dist/config.js +8 -0
- package/dist/config.js.map +1 -0
- package/dist/decorators.d.ts +206 -0
- package/dist/decorators.js +199 -0
- package/dist/decorators.js.map +1 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +140 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +19 -0
- package/dist/internal.js +26 -0
- package/dist/internal.js.map +1 -0
- package/dist/logging/index.d.ts +139 -0
- package/dist/logging/index.js +174 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/listener.d.ts +26 -0
- package/dist/logging/listener.js +12 -0
- package/dist/logging/listener.js.map +1 -0
- package/dist/modules.d.ts +165 -0
- package/dist/modules.js +145 -0
- package/dist/modules.js.map +1 -0
- package/dist/proxies.d.ts +135 -0
- package/dist/proxies.js +272 -0
- package/dist/proxies.js.map +1 -0
- package/dist/tests/modules.test.d.ts +1 -0
- package/dist/tests/modules.test.js +27 -0
- package/dist/tests/modules.test.js.map +1 -0
- package/dist/tests/stub-mode.test.d.ts +1 -0
- package/dist/tests/stub-mode.test.js +57 -0
- package/dist/tests/stub-mode.test.js.map +1 -0
- package/package.json +98 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MakeClassDecorator = MakeClassDecorator;
|
|
4
|
+
exports.MakePropertyDecorator = MakePropertyDecorator;
|
|
5
|
+
exports.MakePropertyAndClassDecorator = MakePropertyAndClassDecorator;
|
|
6
|
+
exports.MakeMethodDecorator = MakeMethodDecorator;
|
|
7
|
+
exports.MakeMethodAndClassDecorator = MakeMethodAndClassDecorator;
|
|
8
|
+
exports.MakeMethodAndPropertyDecorator = MakeMethodAndPropertyDecorator;
|
|
9
|
+
exports.MakeMethodAndPropertyAndClassDecorator = MakeMethodAndPropertyAndClassDecorator;
|
|
10
|
+
exports.MakeParameterDecorator = MakeParameterDecorator;
|
|
11
|
+
exports.MakeParameterAndClassDecorator = MakeParameterAndClassDecorator;
|
|
12
|
+
exports.MakeParameterAndPropertyDecorator = MakeParameterAndPropertyDecorator;
|
|
13
|
+
exports.MakeParameterAndPropertyAndClassDecorator = MakeParameterAndPropertyAndClassDecorator;
|
|
14
|
+
exports.MakeParameterAndMethodDecorator = MakeParameterAndMethodDecorator;
|
|
15
|
+
exports.MakeParameterAndMethodAndClassDecorator = MakeParameterAndMethodAndClassDecorator;
|
|
16
|
+
exports.MakeParameterAndMethodAndPropertyDecorator = MakeParameterAndMethodAndPropertyDecorator;
|
|
17
|
+
exports.MakeParameterAndMethodAndPropertyAndClassDecorator = MakeParameterAndMethodAndPropertyAndClassDecorator;
|
|
18
|
+
function Decorator1(handler) {
|
|
19
|
+
return (...args) => (a) => handler(a, ...args);
|
|
20
|
+
}
|
|
21
|
+
function Decorator2(handler) {
|
|
22
|
+
return (...args) => (a, b) => handler(a, b, ...args);
|
|
23
|
+
}
|
|
24
|
+
function Decorator3(handler) {
|
|
25
|
+
return (...args) => (a, b, c) => handler(a, b, c, ...args);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a decorator factory that can be applied on classes.
|
|
29
|
+
*
|
|
30
|
+
* The callback arguments are split in two; the first for the decorator and the rest for the factory.
|
|
31
|
+
* This allows for creating custom, parameterized class decorators with type safety.
|
|
32
|
+
*
|
|
33
|
+
* @template T - Array type representing factory parameters
|
|
34
|
+
* @param handler - Decorator callback function that receives the target class and factory parameters
|
|
35
|
+
* @returns Decorator factory function that accepts parameters and returns a class decorator
|
|
36
|
+
*/
|
|
37
|
+
function MakeClassDecorator(handler) {
|
|
38
|
+
return Decorator1(handler);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a decorator factory that can be applied on properties.
|
|
42
|
+
*
|
|
43
|
+
* The callback arguments are split in two; the first 2 for the decorator and the rest for the factory.
|
|
44
|
+
* This allows for creating custom, parameterized property decorators with type safety.
|
|
45
|
+
*
|
|
46
|
+
* @template T - Array type representing factory parameters
|
|
47
|
+
* @param handler - Decorator callback function that receives the target object, property key, and factory parameters
|
|
48
|
+
* @returns Decorator factory function that accepts parameters and returns a property decorator
|
|
49
|
+
*/
|
|
50
|
+
function MakePropertyDecorator(handler) {
|
|
51
|
+
return Decorator2(handler);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a decorator factory that can be applied on classes and properties.
|
|
55
|
+
*
|
|
56
|
+
* The callback arguments are split in two; the first 2 for the decorator and the rest for the factory.
|
|
57
|
+
* This allows for creating custom, parameterized decorators that work on both classes and properties.
|
|
58
|
+
*
|
|
59
|
+
* @template T - Array type representing factory parameters
|
|
60
|
+
* @param handler - Decorator callback function that receives the target (class or object), property key
|
|
61
|
+
* (if applicable), and factory parameters
|
|
62
|
+
* @returns Decorator factory function that accepts parameters and returns a class or property decorator
|
|
63
|
+
*/
|
|
64
|
+
function MakePropertyAndClassDecorator(handler) {
|
|
65
|
+
return Decorator2(handler);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Creates a decorator factory that can be applied on methods and accessors.
|
|
69
|
+
*
|
|
70
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
71
|
+
*
|
|
72
|
+
* @param handler Decorator callback
|
|
73
|
+
* @returns Decorator factory
|
|
74
|
+
*/
|
|
75
|
+
function MakeMethodDecorator(handler) {
|
|
76
|
+
return Decorator3(handler);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Creates a decorator factory that can be applied on classes, methods, and accessors.
|
|
80
|
+
*
|
|
81
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
82
|
+
*
|
|
83
|
+
* @param handler Decorator callback
|
|
84
|
+
* @returns Decorator factory
|
|
85
|
+
*/
|
|
86
|
+
function MakeMethodAndClassDecorator(handler) {
|
|
87
|
+
return Decorator3(handler);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Creates a decorator factory that can be applied on properties, methods, and accessors.
|
|
91
|
+
*
|
|
92
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
93
|
+
*
|
|
94
|
+
* @param handler Decorator callback
|
|
95
|
+
* @returns Decorator factory
|
|
96
|
+
*/
|
|
97
|
+
function MakeMethodAndPropertyDecorator(handler) {
|
|
98
|
+
return Decorator3(handler);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Creates a decorator factory that can be applied on classes, properties, methods, and accessors.
|
|
102
|
+
*
|
|
103
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
104
|
+
*
|
|
105
|
+
* @param handler Decorator callback
|
|
106
|
+
* @returns Decorator factory
|
|
107
|
+
*/
|
|
108
|
+
function MakeMethodAndPropertyAndClassDecorator(handler) {
|
|
109
|
+
return Decorator3(handler);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Creates a decorator factory that can be applied on parameters.
|
|
113
|
+
*
|
|
114
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
115
|
+
*
|
|
116
|
+
* @param handler Decorator callback
|
|
117
|
+
* @returns Decorator factory
|
|
118
|
+
*/
|
|
119
|
+
function MakeParameterDecorator(handler) {
|
|
120
|
+
return Decorator3(handler);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Creates a decorator factory that can be applied on classes and parameters.
|
|
124
|
+
*
|
|
125
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
126
|
+
*
|
|
127
|
+
* @param handler Decorator callback
|
|
128
|
+
* @returns Decorator factory
|
|
129
|
+
*/
|
|
130
|
+
function MakeParameterAndClassDecorator(handler) {
|
|
131
|
+
return Decorator3(handler);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Creates a decorator factory that can be applied on properties and parameters.
|
|
135
|
+
*
|
|
136
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
137
|
+
*
|
|
138
|
+
* @param handler Decorator callback
|
|
139
|
+
* @returns Decorator factory
|
|
140
|
+
*/
|
|
141
|
+
function MakeParameterAndPropertyDecorator(handler) {
|
|
142
|
+
return Decorator3(handler);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Creates a decorator factory that can be applied on classes, properties, and parameters.
|
|
146
|
+
*
|
|
147
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
148
|
+
*
|
|
149
|
+
* @param handler Decorator callback
|
|
150
|
+
* @returns Decorator factory
|
|
151
|
+
*/
|
|
152
|
+
function MakeParameterAndPropertyAndClassDecorator(handler) {
|
|
153
|
+
return Decorator3(handler);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Creates a decorator factory that can be applied on methods, accessors, and parameters.
|
|
157
|
+
*
|
|
158
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
159
|
+
*
|
|
160
|
+
* @param handler Decorator callback
|
|
161
|
+
* @returns Decorator factory
|
|
162
|
+
*/
|
|
163
|
+
function MakeParameterAndMethodDecorator(handler) {
|
|
164
|
+
return Decorator3(handler);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Creates a decorator factory that can be applied on classes, methods, accessors, and parameters.
|
|
168
|
+
*
|
|
169
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
170
|
+
*
|
|
171
|
+
* @param handler Decorator callback
|
|
172
|
+
* @returns Decorator factory
|
|
173
|
+
*/
|
|
174
|
+
function MakeParameterAndMethodAndClassDecorator(handler) {
|
|
175
|
+
return Decorator3(handler);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Creates a decorator factory that can be applied on properties, methods, accessors, and parameters.
|
|
179
|
+
*
|
|
180
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
181
|
+
*
|
|
182
|
+
* @param handler Decorator callback
|
|
183
|
+
* @returns Decorator factory
|
|
184
|
+
*/
|
|
185
|
+
function MakeParameterAndMethodAndPropertyDecorator(handler) {
|
|
186
|
+
return Decorator3(handler);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Creates a decorator factory that can be applied on classes, properties, methods, accessors, and parameters.
|
|
190
|
+
*
|
|
191
|
+
* The callback arguments are split in two; the first 3 for the decorator and the rest for the factory.
|
|
192
|
+
*
|
|
193
|
+
* @param handler Decorator callback
|
|
194
|
+
* @returns Decorator factory
|
|
195
|
+
*/
|
|
196
|
+
function MakeParameterAndMethodAndPropertyAndClassDecorator(handler) {
|
|
197
|
+
return Decorator3(handler);
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":";;AA8HA,gDAIC;AAYD,sDAIC;AAaD,sEAMC;AAUD,kDAIC;AAUD,kEAMC;AAUD,wEAIC;AAUD,wFAYC;AAUD,wDAIC;AAUD,wEAMC;AAUD,8EAIC;AAUD,8FAYC;AAUD,0EAIC;AAUD,0FAYC;AAUD,gGAYC;AAUD,gHAcC;AA3SD,SAAS,UAAU,CACjB,OAA2B;IAE3B,OAAO,CAAC,GAAG,IAAO,EAAO,EAAE,CACzB,CAAC,CAAM,EAAE,EAAE,CACT,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AAC1B,CAAC;AAQD,SAAS,UAAU,CACjB,OAA2B;IAE3B,OAAO,CAAC,GAAG,IAAO,EAAO,EAAE,CACzB,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE,CACjB,OAAO,CAAC,CAAC,EAAE,CAAC,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;AAED;;;;;;;GAOG;AACH,SAAgB,iCAAiC,CAC/C,OAAoE;IAEpE,OAAO,UAAU,CAAmD,OAAO,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,yCAAyC,CACvD,OAIC;IAED,OAAO,UAAU,CAIf,OAAO,CAAC,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,+BAA+B,CAC7C,OAAkE;IAElE,OAAO,UAAU,CAAiD,OAAO,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,uCAAuC,CACrD,OAIC;IAED,OAAO,UAAU,CAIf,OAAO,CAAC,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,0CAA0C,CACxD,OAIC;IAED,OAAO,UAAU,CAIf,OAAO,CAAC,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,kDAAkD,CAGhE,OAIC;IAED,OAAO,UAAU,CAIf,OAAO,CAAC,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import type { Class } from "./decorators";
|
|
3
|
+
import { EventProxy, RegisteringProxy } from "./proxies";
|
|
4
|
+
export { AsyncProxy, EventProxy, GetResponsibleModule, RegisteringProxy, } from "./proxies";
|
|
5
|
+
/**
|
|
6
|
+
* Gets metadata for a target object using the specified metadata class.
|
|
7
|
+
*
|
|
8
|
+
* Retrieves or creates metadata associated with a target object, with optional inheritance support.
|
|
9
|
+
* This is used for reflection-based operations throughout the framework.
|
|
10
|
+
*
|
|
11
|
+
* @param target The target object to get metadata for
|
|
12
|
+
* @param meta The metadata class with a symbol key
|
|
13
|
+
* @param inherit Whether to inherit metadata from the prototype chain
|
|
14
|
+
* @returns The metadata instance
|
|
15
|
+
*/
|
|
16
|
+
export declare function GetMetadata<T extends Record<string, any>, U extends Record<string, any>>(target: U, meta: Class<T, [U]> & {
|
|
17
|
+
key: symbol;
|
|
18
|
+
}, inherit?: boolean): T;
|
|
19
|
+
type Func<A extends any[] = any[], R = any> = (...args: A) => R;
|
|
20
|
+
/**
|
|
21
|
+
* Creates an interface function proxy.
|
|
22
|
+
*
|
|
23
|
+
* Returns a function that routes calls through an AsyncProxy, allowing for module-aware
|
|
24
|
+
* asynchronous function calls that can be implemented by other modules.
|
|
25
|
+
*
|
|
26
|
+
* @returns A function that proxies calls to the implementation when available
|
|
27
|
+
*/
|
|
28
|
+
export declare function InterfaceFunction<T extends Func = Func, R = Awaited<ReturnType<T>>>(): (...args: Parameters<T>) => Promise<R>;
|
|
29
|
+
type RID<T> = T extends (id: infer P, ...args: any[]) => void ? P : never;
|
|
30
|
+
type InterfaceImplType<T> = T extends RegisteringProxy<infer P> ? {
|
|
31
|
+
register: P;
|
|
32
|
+
unregister: (id: RID<P>) => void;
|
|
33
|
+
} : T extends EventProxy ? never : T extends (...args: infer A) => infer R ? (...args: A) => Awaited<R> | R : T extends Record<string, any> ? InterfaceToImpl<T> : never;
|
|
34
|
+
type InterfaceToImpl<T> = T extends infer P ? {
|
|
35
|
+
[K in keyof P]?: InterfaceImplType<P[K]>;
|
|
36
|
+
} : never;
|
|
37
|
+
/**
|
|
38
|
+
* Implements an interface with the provided implementation.
|
|
39
|
+
*
|
|
40
|
+
* Links a declared interface with its implementation, setting up the necessary proxies
|
|
41
|
+
* and event handlers to enable cross-module communication.
|
|
42
|
+
*
|
|
43
|
+
* @param declaration The interface declaration to implement
|
|
44
|
+
* @param implementation The implementation of the interface
|
|
45
|
+
* @returns An object containing the declaration and implementation
|
|
46
|
+
*/
|
|
47
|
+
export declare function ImplementInterface<T extends Record<string, unknown>, T2 extends InterfaceToImpl<T>>(declaration: T, implementation: T2): {
|
|
48
|
+
declaration: T;
|
|
49
|
+
implementation: T2;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Please use the non-async version of this function.
|
|
53
|
+
*/
|
|
54
|
+
export declare function ImplementInterface<T extends Record<string, unknown>, T2 extends InterfaceToImpl<T>>(declaration: T | Promise<T>, implementation: T2 | Promise<T2>): Promise<{
|
|
55
|
+
declaration: Awaited<T>;
|
|
56
|
+
implementation: T2;
|
|
57
|
+
}>;
|
|
58
|
+
interface InterfaceConnection {
|
|
59
|
+
id?: string;
|
|
60
|
+
path: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Gets all instances of a specific interface across the system.
|
|
64
|
+
*
|
|
65
|
+
* Retrieves all connections to implementations of the specified interface.
|
|
66
|
+
*
|
|
67
|
+
* @param interfaceID The ID of the interface to get instances for
|
|
68
|
+
* @returns Array of interface connections
|
|
69
|
+
*/
|
|
70
|
+
export declare function GetInterfaceInstances(interfaceID: string): InterfaceConnection[];
|
|
71
|
+
/**
|
|
72
|
+
* Gets a specific instance of an interface by ID.
|
|
73
|
+
*
|
|
74
|
+
* Retrieves a specific connection to an implementation of the specified interface.
|
|
75
|
+
*
|
|
76
|
+
* @param interfaceID The ID of the interface to get an instance for
|
|
77
|
+
* @param connectionID The ID of the specific connection to retrieve
|
|
78
|
+
* @returns The interface connection or undefined if not found
|
|
79
|
+
*/
|
|
80
|
+
export declare function GetInterfaceInstance(interfaceID: string, connectionID: string): InterfaceConnection | undefined;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegisteringProxy = exports.GetResponsibleModule = exports.EventProxy = exports.AsyncProxy = void 0;
|
|
4
|
+
exports.GetMetadata = GetMetadata;
|
|
5
|
+
exports.InterfaceFunction = InterfaceFunction;
|
|
6
|
+
exports.ImplementInterface = ImplementInterface;
|
|
7
|
+
exports.GetInterfaceInstances = GetInterfaceInstances;
|
|
8
|
+
exports.GetInterfaceInstance = GetInterfaceInstance;
|
|
9
|
+
require("reflect-metadata");
|
|
10
|
+
const internal_1 = require("./internal");
|
|
11
|
+
const logging_1 = require("./logging");
|
|
12
|
+
const proxies_1 = require("./proxies");
|
|
13
|
+
var proxies_2 = require("./proxies");
|
|
14
|
+
Object.defineProperty(exports, "AsyncProxy", { enumerable: true, get: function () { return proxies_2.AsyncProxy; } });
|
|
15
|
+
Object.defineProperty(exports, "EventProxy", { enumerable: true, get: function () { return proxies_2.EventProxy; } });
|
|
16
|
+
Object.defineProperty(exports, "GetResponsibleModule", { enumerable: true, get: function () { return proxies_2.GetResponsibleModule; } });
|
|
17
|
+
Object.defineProperty(exports, "RegisteringProxy", { enumerable: true, get: function () { return proxies_2.RegisteringProxy; } });
|
|
18
|
+
internal_1.internal.asyncContextReporter = (trace) => {
|
|
19
|
+
const lastSite = trace[trace.length - 1];
|
|
20
|
+
if (lastSite?.getFileName() !== "node:internal/timers") {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const tracestr = trace
|
|
24
|
+
.filter((site) => !site.getFileName()?.startsWith("node:internal/"))
|
|
25
|
+
.map((site) => site.toString())
|
|
26
|
+
.join("\n - ");
|
|
27
|
+
logging_1.Logging.Error("GetResponsibleModule called from within an async context, this will break hot reloading!\n - " +
|
|
28
|
+
tracestr);
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Gets metadata for a target object using the specified metadata class.
|
|
32
|
+
*
|
|
33
|
+
* Retrieves or creates metadata associated with a target object, with optional inheritance support.
|
|
34
|
+
* This is used for reflection-based operations throughout the framework.
|
|
35
|
+
*
|
|
36
|
+
* @param target The target object to get metadata for
|
|
37
|
+
* @param meta The metadata class with a symbol key
|
|
38
|
+
* @param inherit Whether to inherit metadata from the prototype chain
|
|
39
|
+
* @returns The metadata instance
|
|
40
|
+
*/
|
|
41
|
+
function GetMetadata(target, meta, inherit = true) {
|
|
42
|
+
let data = Reflect.getOwnMetadata(meta.key, target);
|
|
43
|
+
if (!data) {
|
|
44
|
+
data = new meta(target);
|
|
45
|
+
const proto = Object.getPrototypeOf(target);
|
|
46
|
+
if (inherit && proto) {
|
|
47
|
+
const parent = GetMetadata(proto, meta, true);
|
|
48
|
+
if ("inherit" in data && typeof data.inherit === "function") {
|
|
49
|
+
data.inherit(parent);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
for (const key of Object.getOwnPropertyNames(parent)) {
|
|
53
|
+
if (!(key in data)) {
|
|
54
|
+
data[key] = parent[key];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
Reflect.defineMetadata(meta.key, data, target);
|
|
60
|
+
}
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Creates an interface function proxy.
|
|
65
|
+
*
|
|
66
|
+
* Returns a function that routes calls through an AsyncProxy, allowing for module-aware
|
|
67
|
+
* asynchronous function calls that can be implemented by other modules.
|
|
68
|
+
*
|
|
69
|
+
* @returns A function that proxies calls to the implementation when available
|
|
70
|
+
*/
|
|
71
|
+
function InterfaceFunction() {
|
|
72
|
+
const proxy = new proxies_1.AsyncProxy();
|
|
73
|
+
const func = (...args) => proxy.call(...args);
|
|
74
|
+
func.proxy = proxy;
|
|
75
|
+
return func;
|
|
76
|
+
}
|
|
77
|
+
function implement(decl, impl) {
|
|
78
|
+
for (const key in decl) {
|
|
79
|
+
if (key in impl) {
|
|
80
|
+
const val = decl[key];
|
|
81
|
+
if (val instanceof proxies_1.RegisteringProxy) {
|
|
82
|
+
val.onRegister(impl[key].register);
|
|
83
|
+
val.onUnregister(impl[key].unregister);
|
|
84
|
+
}
|
|
85
|
+
else if (typeof val === "function" && val.proxy instanceof proxies_1.AsyncProxy) {
|
|
86
|
+
val.proxy.onCall(impl[key]);
|
|
87
|
+
}
|
|
88
|
+
else if (val instanceof proxies_1.AsyncProxy) {
|
|
89
|
+
val.onCall(impl[key]);
|
|
90
|
+
}
|
|
91
|
+
else if (!(val instanceof proxies_1.EventProxy)) {
|
|
92
|
+
implement(val, impl[key]);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function ImplementInterface(declaration, implementation) {
|
|
98
|
+
if (declaration instanceof Promise || implementation instanceof Promise) {
|
|
99
|
+
return Promise.all([declaration, implementation]).then(([decl, impl]) => {
|
|
100
|
+
implement(decl, impl);
|
|
101
|
+
return { declaration: decl, implementation: impl };
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const decl = declaration;
|
|
105
|
+
const impl = implementation;
|
|
106
|
+
implement(decl, impl);
|
|
107
|
+
return { declaration: decl, implementation: impl };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Gets all instances of a specific interface across the system.
|
|
111
|
+
*
|
|
112
|
+
* Retrieves all connections to implementations of the specified interface.
|
|
113
|
+
*
|
|
114
|
+
* @param interfaceID The ID of the interface to get instances for
|
|
115
|
+
* @returns Array of interface connections
|
|
116
|
+
*/
|
|
117
|
+
function GetInterfaceInstances(interfaceID) {
|
|
118
|
+
const module = (0, proxies_1.GetResponsibleModule)();
|
|
119
|
+
if (!module || !(module in internal_1.internal.interfaceConnections))
|
|
120
|
+
return [];
|
|
121
|
+
const connections = internal_1.internal.interfaceConnections[module];
|
|
122
|
+
return connections[interfaceID] ?? [];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Gets a specific instance of an interface by ID.
|
|
126
|
+
*
|
|
127
|
+
* Retrieves a specific connection to an implementation of the specified interface.
|
|
128
|
+
*
|
|
129
|
+
* @param interfaceID The ID of the interface to get an instance for
|
|
130
|
+
* @param connectionID The ID of the specific connection to retrieve
|
|
131
|
+
* @returns The interface connection or undefined if not found
|
|
132
|
+
*/
|
|
133
|
+
function GetInterfaceInstance(interfaceID, connectionID) {
|
|
134
|
+
const module = (0, proxies_1.GetResponsibleModule)();
|
|
135
|
+
if (!module || !(module in internal_1.internal.interfaceConnections))
|
|
136
|
+
return;
|
|
137
|
+
const connections = internal_1.internal.interfaceConnections[module];
|
|
138
|
+
return (connections[interfaceID] ?? []).find((connection) => connection.id === connectionID);
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA4CA,kCAuBC;AAYD,8CAQC;AAiED,gDAmBC;AAeD,sDAOC;AAWD,oDAUC;AAtND,4BAA0B;AAE1B,yCAAsC;AACtC,uCAAoC;AACpC,uCAKmB;AAEnB,qCAKmB;AAJjB,qGAAA,UAAU,OAAA;AACV,qGAAA,UAAU,OAAA;AACV,+GAAA,oBAAoB,OAAA;AACpB,2GAAA,gBAAgB,OAAA;AAGlB,mBAAQ,CAAC,oBAAoB,GAAG,CAAC,KAAwB,EAAE,EAAE;IAC3D,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,IAAI,QAAQ,EAAE,WAAW,EAAE,KAAK,sBAAsB,EAAE,CAAC;QACvD,OAAO;IACT,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK;SACnB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;SACnE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;SAC9B,IAAI,CAAC,UAAU,CAAC,CAAC;IACpB,iBAAO,CAAC,KAAK,CACX,kGAAkG;QAChG,QAAQ,CACX,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,SAAgB,WAAW,CAGzB,MAAS,EAAE,IAAqC,EAAE,OAAO,GAAG,IAAI;IAChE,IAAI,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAM,CAAC;IACzD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,IAAI,IAAI,CAAC,M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EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,IAAU,EAAE,CAAC;AAC3D,CAAC;AAOD;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,WAAmB;IAEnB,MAAM,MAAM,GAAG,IAAA,8BAAoB,GAAE,CAAC;IACtC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,IAAI,mBAAQ,CAAC,oBAAoB,CAAC;QAAE,OAAO,EAAE,CAAC;IACrE,MAAM,WAAW,GAAG,mBAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC1D,OAAO,WAAW,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,WAAmB,EACnB,YAAoB;IAEpB,MAAM,MAAM,GAAG,IAAA,8BAAoB,GAAE,CAAC;IACtC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,IAAI,mBAAQ,CAAC,oBAAoB,CAAC;QAAE,OAAO;IAClE,MAAM,WAAW,GAAG,mBAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC1D,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAC1C,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,YAAY,CAC/C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface InterfaceConnection {
|
|
2
|
+
id?: string;
|
|
3
|
+
path: string;
|
|
4
|
+
}
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare const internal: {
|
|
7
|
+
moduleByFolder: {
|
|
8
|
+
dir: string;
|
|
9
|
+
id: string;
|
|
10
|
+
}[];
|
|
11
|
+
testStubMode: boolean;
|
|
12
|
+
knownAsync: Map<string, any[]>;
|
|
13
|
+
knownRegisters: Map<string, any[]>;
|
|
14
|
+
knownEvents: any[];
|
|
15
|
+
interfaceConnections: Record<string, Record<string, InterfaceConnection[]>>;
|
|
16
|
+
asyncContextReporter: ((trace: NodeJS.CallSite[]) => void) | undefined;
|
|
17
|
+
addAsyncProxy(module: string, proxy: any): void;
|
|
18
|
+
addRegisteringProxy(module: string, proxy: any): void;
|
|
19
|
+
};
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.internal = void 0;
|
|
4
|
+
function addToMapArray(map, key, value) {
|
|
5
|
+
if (!map.has(key)) {
|
|
6
|
+
map.set(key, []);
|
|
7
|
+
}
|
|
8
|
+
map.get(key)?.push(value);
|
|
9
|
+
}
|
|
10
|
+
/** @internal */
|
|
11
|
+
exports.internal = {
|
|
12
|
+
moduleByFolder: [],
|
|
13
|
+
testStubMode: false,
|
|
14
|
+
knownAsync: new Map(),
|
|
15
|
+
knownRegisters: new Map(),
|
|
16
|
+
knownEvents: [],
|
|
17
|
+
interfaceConnections: {},
|
|
18
|
+
asyncContextReporter: undefined,
|
|
19
|
+
addAsyncProxy(module, proxy) {
|
|
20
|
+
addToMapArray(exports.internal.knownAsync, module, proxy);
|
|
21
|
+
},
|
|
22
|
+
addRegisteringProxy(module, proxy) {
|
|
23
|
+
addToMapArray(exports.internal.knownRegisters, module, proxy);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":";;;AAKA,SAAS,aAAa,CAAC,GAA4B,EAAE,GAAW,EAAE,KAAU;IAC1E,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnB,CAAC;IACD,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,gBAAgB;AACH,QAAA,QAAQ,GAAG;IACtB,cAAc,EAAE,EAAmC;IACnD,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,IAAI,GAAG,EAAsB;IACzC,cAAc,EAAE,IAAI,GAAG,EAAsB;IAC7C,WAAW,EAAE,EAAW;IACxB,oBAAoB,EAAE,EAGrB;IACD,oBAAoB,EAAE,SAET;IAEb,aAAa,CAAC,MAAc,EAAE,KAAU;QACtC,aAAa,CAAC,gBAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,mBAAmB,CAAC,MAAc,EAAE,KAAU;QAC5C,aAAa,CAAC,gBAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides a structured logging system with multiple severity levels and channels.
|
|
3
|
+
*
|
|
4
|
+
* The Logging namespace offers standardized functions for logging at different severity levels
|
|
5
|
+
* through a unified interface. It supports multiple channels for categorizing logs and
|
|
6
|
+
* uses an event-based system for log collection and processing.
|
|
7
|
+
*/
|
|
8
|
+
export declare namespace Logging {
|
|
9
|
+
/**
|
|
10
|
+
* Log severity levels in descending order of importance.
|
|
11
|
+
* Higher numerical values indicate higher severity.
|
|
12
|
+
*/
|
|
13
|
+
enum Level {
|
|
14
|
+
/** Critical errors that may cause application failure */
|
|
15
|
+
ERROR = 40,
|
|
16
|
+
/** Important issues that don't prevent application functioning */
|
|
17
|
+
WARN = 30,
|
|
18
|
+
/** General application information and status updates */
|
|
19
|
+
INFO = 20,
|
|
20
|
+
/** Detailed information useful for debugging */
|
|
21
|
+
DEBUG = 10,
|
|
22
|
+
/** Highly detailed tracing information */
|
|
23
|
+
TRACE = 0,
|
|
24
|
+
/** Messages without prefix for direct display */
|
|
25
|
+
NO_PREFIX = -1
|
|
26
|
+
}
|
|
27
|
+
class Channel {
|
|
28
|
+
readonly channel: string;
|
|
29
|
+
constructor(channel: string);
|
|
30
|
+
/**
|
|
31
|
+
* Write arguments to the log channel at the ERROR level.
|
|
32
|
+
*
|
|
33
|
+
* Use for critical errors that may cause application failure or require immediate attention.
|
|
34
|
+
*
|
|
35
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
36
|
+
*/
|
|
37
|
+
Error(...args: any[]): void;
|
|
38
|
+
/**
|
|
39
|
+
* Write arguments to the log channel at the WARN level.
|
|
40
|
+
*
|
|
41
|
+
* Use for important issues that don't prevent the application from functioning
|
|
42
|
+
* but should be addressed.
|
|
43
|
+
*
|
|
44
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
45
|
+
*/
|
|
46
|
+
Warn(...args: any[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* Write arguments to the log channel at the INFO level.
|
|
49
|
+
*
|
|
50
|
+
* Use for general application information and status updates that are useful
|
|
51
|
+
* for understanding the normal operation of the system.
|
|
52
|
+
*
|
|
53
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
54
|
+
*/
|
|
55
|
+
Info(...args: any[]): void;
|
|
56
|
+
/**
|
|
57
|
+
* Write arguments to the log channel at the DEBUG level.
|
|
58
|
+
*
|
|
59
|
+
* Use for detailed information useful for debugging and troubleshooting issues.
|
|
60
|
+
*
|
|
61
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
62
|
+
*/
|
|
63
|
+
Debug(...args: any[]): void;
|
|
64
|
+
/**
|
|
65
|
+
* Write arguments to the log channel at the TRACE level.
|
|
66
|
+
*
|
|
67
|
+
* Use for highly detailed tracing information, typically only enabled during
|
|
68
|
+
* intensive debugging sessions.
|
|
69
|
+
*
|
|
70
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
71
|
+
*/
|
|
72
|
+
Trace(...args: any[]): void;
|
|
73
|
+
/**
|
|
74
|
+
* Write arguments to the log channel at the given severity level.
|
|
75
|
+
*
|
|
76
|
+
* This is the core logging function that all other logging functions ultimately call.
|
|
77
|
+
* It emits an event with the log entry that can be captured by registered listeners.
|
|
78
|
+
*
|
|
79
|
+
* @param levelId - Severity level of the log entry (use values from the Level enum)
|
|
80
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
81
|
+
*/
|
|
82
|
+
Write(levelId: number, ...args: any[]): void;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Write arguments to the main log channel at the ERROR level.
|
|
86
|
+
*
|
|
87
|
+
* Use for critical errors that may cause application failure or require immediate attention.
|
|
88
|
+
*
|
|
89
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
90
|
+
*/
|
|
91
|
+
const Error: (...args: any[]) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Write arguments to the main log channel at the WARN level.
|
|
94
|
+
*
|
|
95
|
+
* Use for important issues that don't prevent the application from functioning
|
|
96
|
+
* but should be addressed.
|
|
97
|
+
*
|
|
98
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
99
|
+
*/
|
|
100
|
+
const Warn: (...args: any[]) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Write arguments to the main log channel at the INFO level.
|
|
103
|
+
*
|
|
104
|
+
* Use for general application information and status updates that are useful
|
|
105
|
+
* for understanding the normal operation of the system.
|
|
106
|
+
*
|
|
107
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
108
|
+
*/
|
|
109
|
+
const Info: (...args: any[]) => void;
|
|
110
|
+
/**
|
|
111
|
+
* Write arguments to the main log channel at the DEBUG level.
|
|
112
|
+
*
|
|
113
|
+
* Use for detailed information useful for debugging and troubleshooting issues.
|
|
114
|
+
*
|
|
115
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
116
|
+
*/
|
|
117
|
+
const Debug: (...args: any[]) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Write arguments to the main log channel at the TRACE level.
|
|
120
|
+
*
|
|
121
|
+
* Use for highly detailed tracing information, typically only enabled during
|
|
122
|
+
* intensive debugging sessions.
|
|
123
|
+
*
|
|
124
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
125
|
+
*/
|
|
126
|
+
const Trace: (...args: any[]) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Write arguments to the specified log channel at the given severity level.
|
|
129
|
+
*
|
|
130
|
+
* This is the core logging function that all other logging functions ultimately call.
|
|
131
|
+
* It emits an event with the log entry that can be captured by registered listeners.
|
|
132
|
+
*
|
|
133
|
+
* @param levelId - Severity level of the log entry (use values from the Level enum)
|
|
134
|
+
* @param channel - Name of the channel to log to, useful for categorizing logs
|
|
135
|
+
* @param args - Values to log, which can be of any type and will be serialized appropriately
|
|
136
|
+
*/
|
|
137
|
+
function Write(levelId: number, channel: string, ...args: any[]): void;
|
|
138
|
+
}
|
|
139
|
+
export default Logging;
|