@antelopejs/interface-core 0.2.3 → 0.2.5
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 +86 -17
- package/dist/index.d.ts +4 -1
- package/dist/index.js +0 -13
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +14 -2
- package/dist/internal.js +17 -1
- package/dist/internal.js.map +1 -1
- package/dist/modules.d.ts +3 -2
- package/dist/modules.js.map +1 -1
- package/dist/proxies.d.ts +25 -7
- package/dist/proxies.js +89 -79
- package/dist/proxies.js.map +1 -1
- package/dist/tests/module-ownership-context.test.js +3 -3
- package/dist/tests/module-ownership-context.test.js.map +1 -1
- package/dist/tests/ownership-call-chain.test.js +261 -0
- package/dist/tests/ownership-call-chain.test.js.map +1 -0
- package/docs/1.introduction.md +29 -3
- package/docs/2.proxies.md +101 -36
- package/docs/3.decorators.md +25 -1
- package/docs/4.metadata.md +25 -1
- package/docs/5.modules.md +26 -7
- package/docs/6.logging.md +42 -20
- package/docs/7.configuration.md +33 -12
- package/docs/8.runtime.md +15 -0
- package/docs/assets/proxy-lifecycles.svg +21 -0
- package/docs/tsconfig.json +16 -0
- package/package.json +11 -4
- package/skills/core-interface/SKILL.md +3 -4
- package/dist/caller-binding.d.ts +0 -12
- package/dist/caller-binding.js +0 -105
- package/dist/caller-binding.js.map +0 -1
- package/dist/responsible-module.d.ts +0 -23
- package/dist/responsible-module.js +0 -56
- package/dist/responsible-module.js.map +0 -1
- package/dist/tests/caller-context.test.js +0 -154
- package/dist/tests/caller-context.test.js.map +0 -1
- package/dist/tests/provider-context.test.d.ts +0 -1
- package/dist/tests/provider-context.test.js +0 -109
- package/dist/tests/provider-context.test.js.map +0 -1
- package/dist/tests/responsible-module.test.d.ts +0 -1
- package/dist/tests/responsible-module.test.js +0 -109
- package/dist/tests/responsible-module.test.js.map +0 -1
- /package/dist/tests/{caller-context.test.d.ts → ownership-call-chain.test.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,32 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @antelopejs/interface-core
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
|
-
<a href="https://www.npmjs.com/package/@antelopejs/interface-core"><img src="https://img.shields.io/npm/v/@antelopejs/interface-core?style=for-the-badge&labelColor=000000&color=000000"
|
|
5
|
-
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/
|
|
6
|
-
<a href="https://discord.gg/sjK28QHrA7"><img src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"
|
|
7
|
-
<a href="
|
|
4
|
+
<a href="https://www.npmjs.com/package/@antelopejs/interface-core"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-core?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
5
|
+
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-core?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
6
|
+
<a href="https://discord.gg/sjK28QHrA7"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
|
|
7
|
+
<a href="https://interfaces.antelopejs.com/docs/core"><img alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
|
-
The
|
|
10
|
+
The primitives every AntelopeJS interface is built from: proxies that cross module boundaries, decorator factories, module lifecycle events, structured logging and project configuration.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## What it offers
|
|
13
|
+
|
|
14
|
+
- `InterfaceFunction` declares a contract function; `ImplementInterface` attaches a module's implementation to it. Calls made before the implementation attaches wait in a queue.
|
|
15
|
+
- `AsyncProxy`, `EventProxy` and `RegisteringProxy` carry calls, events and registrations between modules, and detach when a module unloads.
|
|
16
|
+
- `@antelopejs/interface-core/decorators` builds typed class, method, property and parameter decorators.
|
|
17
|
+
- `@antelopejs/interface-core/modules` exposes lifecycle events and module management functions.
|
|
18
|
+
- `@antelopejs/interface-core/logging` writes structured logs on named channels; `@antelopejs/interface-core/config` provides `defineConfig` for `antelope.config.ts`.
|
|
19
|
+
|
|
20
|
+
## Implementations
|
|
21
|
+
|
|
22
|
+
| Module | Notes |
|
|
23
|
+
| -------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
24
|
+
| [`@antelopejs/core`](https://github.com/AntelopeJS/antelopejs) | The AntelopeJS runtime and `ajs` CLI implement this interface |
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
Add the package to any module that declares or implements an interface:
|
|
13
29
|
|
|
14
30
|
```bash
|
|
15
|
-
|
|
31
|
+
pnpm add @antelopejs/interface-core
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
No extra module is needed: the core provides the implementation.
|
|
35
|
+
|
|
36
|
+
## Quick start
|
|
37
|
+
|
|
38
|
+
Declare a contract:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
// src/interface/index.ts
|
|
42
|
+
import { InterfaceFunction } from "@antelopejs/interface-core";
|
|
43
|
+
|
|
44
|
+
export const GetGreeting = InterfaceFunction<(name: string) => string>();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Implement it and call it from a module:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// src/index.ts
|
|
51
|
+
import { ImplementInterface } from "@antelopejs/interface-core";
|
|
52
|
+
import { Logging } from "@antelopejs/interface-core/logging";
|
|
53
|
+
import * as Greeting from "./interface";
|
|
54
|
+
|
|
55
|
+
export function construct() {
|
|
56
|
+
ImplementInterface(Greeting, {
|
|
57
|
+
GetGreeting: (name: string) => `Hello, ${name}`,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function start() {
|
|
62
|
+
Logging.Info(await Greeting.GetGreeting("Ada"));
|
|
63
|
+
}
|
|
16
64
|
```
|
|
17
65
|
|
|
66
|
+
An interface function always returns a promise, even when the implementation is synchronous.
|
|
67
|
+
|
|
18
68
|
## Documentation
|
|
19
69
|
|
|
20
|
-
|
|
70
|
+
- [Introduction](./docs/1.introduction.md)
|
|
71
|
+
- [Proxies, attachment leases and errors](./docs/2.proxies.md)
|
|
72
|
+
- [Decorators](./docs/3.decorators.md)
|
|
73
|
+
- [Metadata](./docs/4.metadata.md)
|
|
74
|
+
- [Modules](./docs/5.modules.md)
|
|
75
|
+
- [Logging](./docs/6.logging.md)
|
|
76
|
+
- [Configuration](./docs/7.configuration.md)
|
|
77
|
+
- [Runtime](./docs/8.runtime.md)
|
|
78
|
+
|
|
79
|
+
## Compatibility
|
|
21
80
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
81
|
+
`@antelopejs/core` implements this package. Use the line your core version declares:
|
|
82
|
+
|
|
83
|
+
| `@antelopejs/core` | `@antelopejs/interface-core` |
|
|
84
|
+
| -------------------- | ---------------------------- |
|
|
85
|
+
| `1.12.x` to `1.13.x` | `0.1.x` |
|
|
86
|
+
| `1.14.x` to `1.15.1` | `0.2.x` |
|
|
87
|
+
| `1.15.2` | `>=0.2.3 <0.3.0` |
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
Read [CONTRIBUTING.md](./CONTRIBUTING.md) before you open a pull request. The local checks are:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pnpm install
|
|
95
|
+
pnpm lint
|
|
96
|
+
pnpm test
|
|
97
|
+
```
|
|
29
98
|
|
|
30
99
|
## License
|
|
31
100
|
|
|
32
|
-
|
|
101
|
+
[Apache-2.0](./LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -31,11 +31,14 @@ type InterfaceToImpl<T> = T extends infer P ? {
|
|
|
31
31
|
* Implements an interface with the provided implementation.
|
|
32
32
|
*
|
|
33
33
|
* Links a declared interface with its implementation, setting up the necessary proxies
|
|
34
|
-
*
|
|
34
|
+
* for cross-module communication. EventProxy declarations need no implementation.
|
|
35
|
+
* Validates all required handlers before attaching: async proxies need a function,
|
|
36
|
+
* and registering proxies need both register and unregister callbacks.
|
|
35
37
|
*
|
|
36
38
|
* @param declaration The interface declaration to implement
|
|
37
39
|
* @param implementation The implementation of the interface
|
|
38
40
|
* @returns An object containing the declaration and implementation
|
|
41
|
+
* @throws {TypeError} For malformed arguments, object cycles, or missing handlers.
|
|
39
42
|
*/
|
|
40
43
|
export declare function ImplementInterface<T extends Record<string, unknown>, T2 extends InterfaceToImpl<T>>(declaration: T, implementation: T2): {
|
|
41
44
|
declaration: T;
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,6 @@ exports.ImplementInterface = ImplementInterface;
|
|
|
20
20
|
exports.GetInterfaceInstances = GetInterfaceInstances;
|
|
21
21
|
exports.GetInterfaceInstance = GetInterfaceInstance;
|
|
22
22
|
require("reflect-metadata");
|
|
23
|
-
const logging_1 = require("./logging");
|
|
24
23
|
const internal_1 = require("./internal");
|
|
25
24
|
const proxies_1 = require("./proxies");
|
|
26
25
|
__exportStar(require("./errors"), exports);
|
|
@@ -33,18 +32,6 @@ Object.defineProperty(exports, "InterfaceFunction", { enumerable: true, get: fun
|
|
|
33
32
|
Object.defineProperty(exports, "IsInterfaceProxy", { enumerable: true, get: function () { return proxies_2.IsInterfaceProxy; } });
|
|
34
33
|
Object.defineProperty(exports, "RegisteringProxy", { enumerable: true, get: function () { return proxies_2.RegisteringProxy; } });
|
|
35
34
|
Object.defineProperty(exports, "RunWithResponsibleModule", { enumerable: true, get: function () { return proxies_2.RunWithResponsibleModule; } });
|
|
36
|
-
internal_1.internal.asyncContextReporter = (trace) => {
|
|
37
|
-
const lastSite = trace[trace.length - 1];
|
|
38
|
-
if (lastSite?.getFileName() !== "node:internal/timers") {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const tracestr = trace
|
|
42
|
-
.filter((site) => !site.getFileName()?.startsWith("node:internal/"))
|
|
43
|
-
.map((site) => site.toString())
|
|
44
|
-
.join("\n - ");
|
|
45
|
-
logging_1.Logging.Error("GetResponsibleModule called from within an async context, this will break hot reloading!\n - " +
|
|
46
|
-
tracestr);
|
|
47
|
-
};
|
|
48
35
|
/**
|
|
49
36
|
* Gets metadata for a target object using the specified metadata class.
|
|
50
37
|
*
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoCA,kCAuBC;AA0LD,gDAmBC;AAUD,sDAMC;AAWD,oDAUC;AA7SD,4BAA0B;AAG1B,yCAAgE;AAChE,uCAMmB;AAEnB,2CAAyB;AAEzB,qCASmB;AARjB,qGAAA,UAAU,OAAA;AACV,qGAAA,UAAU,OAAA;AACV,oHAAA,yBAAyB,OAAA;AACzB,+GAAA,oBAAoB,OAAA;AACpB,4GAAA,iBAAiB,OAAA;AACjB,2GAAA,gBAAgB,OAAA;AAChB,2GAAA,gBAAgB,OAAA;AAChB,mHAAA,wBAAwB,OAAA;AAG1B;;;;;;;;;;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,MAAM,CAAC,CAAC;QACxB,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;YACrB,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAC9C,IAAI,SAAS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AAI,EAAE,cAAc,EAAE,IAAU,EAAE,CAAC;AAC3D,CAAC;AAED;;;;;;;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,OAAO,mBAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;AAClE,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;AAED,4CAA0B;AAC1B,4CAA0B"}
|
package/dist/internal.d.ts
CHANGED
|
@@ -15,10 +15,20 @@ export interface InterfaceConnection {
|
|
|
15
15
|
/** Whether this connection is the one a plain import of the interface reaches. */
|
|
16
16
|
selected: boolean;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* What a context runs: a module generation's work, or an interface package's
|
|
20
|
+
* own work, entered while the package is evaluated.
|
|
21
|
+
*/
|
|
22
|
+
export type ModuleContextKind = "module" | "interface";
|
|
18
23
|
/** Module identity and provider routes propagated through asynchronous work. */
|
|
19
24
|
export interface ModuleExecutionContext {
|
|
20
25
|
/** Stable module ID used by existing lifecycle and attribution APIs. */
|
|
21
26
|
module: string;
|
|
27
|
+
/**
|
|
28
|
+
* `"interface"` for an interface package's own context. An attachment made
|
|
29
|
+
* in it runs its callbacks in the caller's context. Defaults to `"module"`.
|
|
30
|
+
*/
|
|
31
|
+
kind?: ModuleContextKind;
|
|
22
32
|
/** Unique lifecycle generation ID. Defaults to the module ID when omitted. */
|
|
23
33
|
owner?: string;
|
|
24
34
|
/** Provider ID used when attaching implementations. */
|
|
@@ -26,7 +36,7 @@ export interface ModuleExecutionContext {
|
|
|
26
36
|
/** Provider selections keyed by stable interface proxy identity. */
|
|
27
37
|
providerRoutes?: Readonly<Record<string, string>>;
|
|
28
38
|
}
|
|
29
|
-
interface ActiveModuleExecutionContext extends ModuleExecutionContext {
|
|
39
|
+
export interface ActiveModuleExecutionContext extends ModuleExecutionContext {
|
|
30
40
|
owner: string;
|
|
31
41
|
ownershipToken: symbol;
|
|
32
42
|
}
|
|
@@ -85,10 +95,12 @@ export interface InterfaceRuntime {
|
|
|
85
95
|
}
|
|
86
96
|
/** @internal */
|
|
87
97
|
export declare const internal: InterfaceRuntime;
|
|
98
|
+
export declare function isModuleContextActive(context: ActiveModuleExecutionContext): boolean;
|
|
88
99
|
export declare function runWithModuleContext<T>(context: ModuleExecutionContext, callback: () => T): T;
|
|
89
100
|
export declare function captureModuleContext(): ActiveModuleExecutionContext | undefined;
|
|
90
101
|
export declare function runWithCapturedModuleContext<T>(context: ActiveModuleExecutionContext, callback: () => T): T;
|
|
102
|
+
export declare function runAsCapturedCaller<T>(context: ActiveModuleExecutionContext | undefined, callback: () => T): T;
|
|
103
|
+
export declare function enterModuleContext<T>(context: ActiveModuleExecutionContext | undefined, callback: () => T): T;
|
|
91
104
|
export declare function peekModuleContext(): ModuleExecutionContext | undefined;
|
|
92
105
|
export declare function getModuleContext(): ModuleExecutionContext | undefined;
|
|
93
106
|
export declare function invalidateModuleContext(owner: string): void;
|
|
94
|
-
export {};
|
package/dist/internal.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.internal = exports.RUNTIME_SYMBOL = exports.RUNTIME_PROTOCOL_VERSION = void 0;
|
|
4
|
+
exports.isModuleContextActive = isModuleContextActive;
|
|
4
5
|
exports.runWithModuleContext = runWithModuleContext;
|
|
5
6
|
exports.captureModuleContext = captureModuleContext;
|
|
6
7
|
exports.runWithCapturedModuleContext = runWithCapturedModuleContext;
|
|
8
|
+
exports.runAsCapturedCaller = runAsCapturedCaller;
|
|
9
|
+
exports.enterModuleContext = enterModuleContext;
|
|
7
10
|
exports.peekModuleContext = peekModuleContext;
|
|
8
11
|
exports.getModuleContext = getModuleContext;
|
|
9
12
|
exports.invalidateModuleContext = invalidateModuleContext;
|
|
@@ -69,8 +72,11 @@ function getOwnerToken(owner) {
|
|
|
69
72
|
exports.internal.activeOwnerTokens.set(owner, token);
|
|
70
73
|
return token;
|
|
71
74
|
}
|
|
75
|
+
function isModuleContextActive(context) {
|
|
76
|
+
return (exports.internal.activeOwnerTokens.get(context.owner) === context.ownershipToken);
|
|
77
|
+
}
|
|
72
78
|
function assertActiveModuleContext(context) {
|
|
73
|
-
if (
|
|
79
|
+
if (!isModuleContextActive(context)) {
|
|
74
80
|
throw new errors_1.ModuleContextInvalidatedError(context.module);
|
|
75
81
|
}
|
|
76
82
|
}
|
|
@@ -101,6 +107,16 @@ function runWithCapturedModuleContext(context, callback) {
|
|
|
101
107
|
assertActiveModuleContext(context);
|
|
102
108
|
return exports.internal.executionContext.run(context, callback);
|
|
103
109
|
}
|
|
110
|
+
function runAsCapturedCaller(context, callback) {
|
|
111
|
+
return context
|
|
112
|
+
? exports.internal.executionContext.run(context, callback)
|
|
113
|
+
: exports.internal.executionContext.exit(callback);
|
|
114
|
+
}
|
|
115
|
+
function enterModuleContext(context, callback) {
|
|
116
|
+
return context
|
|
117
|
+
? exports.internal.executionContext.run(context, callback)
|
|
118
|
+
: callback();
|
|
119
|
+
}
|
|
104
120
|
function peekModuleContext() {
|
|
105
121
|
return exports.internal.executionContext.getStore();
|
|
106
122
|
}
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":";;;AA6KA,sDAMC;AAQD,oDAkBC;AAED,oDAQC;AAED,oEAMC;AAED,kDAOC;AAED,gDAOC;AAED,8CAEC;AAED,4CAEC;AAED,0DAEC;AA7PD,uDAAqD;AAErD,qCAAyD;AAE5C,QAAA,wBAAwB,GAAG,CAAC,CAAC;AAC7B,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAoG/E,SAAS,WAAW,CAAI,GAAwB,EAAE,GAAW,EAAE,KAAQ;IACrE,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAK,CAAC;IAC5C,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,aAAa;IACpB,MAAM,OAAO,GAAqB;QAChC,QAAQ,EAAE,gCAAwB;QAClC,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,IAAI,GAAG,EAAE;QACrB,cAAc,EAAE,IAAI,GAAG,EAAE;QACzB,kBAAkB,EAAE,IAAI,GAAG,EAAE;QAC7B,WAAW,EAAE,IAAI,GAAG,EAAE;QACtB,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAGvC;QACD,gBAAgB,EAAE,IAAI,oCAAiB,EAAgC;QACvE,iBAAiB,EAAE,IAAI,GAAG,EAAE;QAC5B,iBAAiB,EAAE,CAAC;QAC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AAO,CAAC;AACjB,CAAC;AAED,SAAgB,4BAA4B,CAC1C,OAAqC,EACrC,QAAiB;IAEjB,yBAAyB,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,gBAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAED,SAAgB,mBAAmB,CACjC,OAAiD,EACjD,QAAiB;IAEjB,OAAO,OAAO;QACZ,CAAC,CAAC,gBAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC;QAClD,CAAC,CAAC,gBAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAED,SAAgB,kBAAkB,CAChC,OAAiD,EACjD,QAAiB;IAEjB,OAAO,OAAO;QACZ,CAAC,CAAC,gBAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC;QAClD,CAAC,CAAC,QAAQ,EAAE,CAAC;AACjB,CAAC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,gBAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;AAC9C,CAAC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,oBAAoB,EAAE,CAAC;AAChC,CAAC;AAED,SAAgB,uBAAuB,CAAC,KAAa;IACnD,gBAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/modules.d.ts
CHANGED
|
@@ -77,8 +77,9 @@ export interface ModuleDefinition {
|
|
|
77
77
|
*/
|
|
78
78
|
config?: unknown;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
80
|
+
* Runtime import override map with array values.
|
|
81
|
+
* This differs intentionally from AntelopeModuleConfig.importOverrides,
|
|
82
|
+
* the project-file contract used by defineConfig and SaveModuleDeclaration.
|
|
82
83
|
*/
|
|
83
84
|
importOverrides?: Record<string, string[]>;
|
|
84
85
|
/**
|
package/dist/modules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":";;;AAaA,oDAKC;AAGD,4CAEC;AAiJD,oCAEC;AAzKD,uCAA0D;AAC1D,yCAQoB;AAEpB,oFAAoF;AACpF,SAAgB,oBAAoB,CAClC,OAA+B,EAC/B,QAAiB;IAEjB,OAAO,IAAA,+BAAoB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC;AAED,kEAAkE;AAClE,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,2BAAgB,GAAE,CAAC;AAC5B,CAAC;AAID;;;;;GAKG;AACH,IAAiB,MAAM,CAgDtB;AAhDD,WAAiB,MAAM;IACrB;;;;;;;OAOG;IACU,wBAAiB,GAAG,IAAI,oBAAU,CAC7C,2BAA2B,CAC5B,CAAC;IAEF;;;;;;;OAOG;IACU,oBAAa,GAAG,IAAI,oBAAU,CACzC,uBAAuB,CACxB,CAAC;IAEF;;;;;;;OAOG;IACU,oBAAa,GAAG,IAAI,oBAAU,CACzC,uBAAuB,CACxB,CAAC;IAEF;;;;;;;OAOG;IACU,sBAAe,GAAG,IAAI,oBAAU,CAC3C,yBAAyB,CAC1B,CAAC;AACJ,CAAC,EAhDgB,MAAM,sBAAN,MAAM,QAgDtB;AAED,SAAS,UAAU,CACjB,OAA4C,EAC5C,MAAc,EACd,SAAiB;IAEjB,IAAI,CAAC;QACH,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;YACzB,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mBAAQ,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;IAChE,CA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E,KAAK,CAAC,CAAC;AAC7B,CAAC;AAwDD;;;;;;;GAOG;AACU,QAAA,WAAW,GAAG,IAAA,2BAAiB,EAC1C,qBAAqB,CACtB,CAAC;AAEF;;;;;;;;GAQG;AACU,QAAA,aAAa,GAAG,IAAA,2BAAiB,EAC5C,uBAAuB,CACxB,CAAC;AAEF;;;;;;;;;GASG;AACU,QAAA,UAAU,GACrB,IAAA,2BAAiB,EAMf,oBAAoB,CAAC,CAAC;AAE1B;;;;;;;;GAQG;AACU,QAAA,WAAW,GAAG,IAAA,2BAAiB,EAC1C,qBAAqB,CACtB,CAAC;AAEF;;;;;;;;GAQG;AACU,QAAA,UAAU,GACrB,IAAA,2BAAiB,EAA2B,oBAAoB,CAAC,CAAC;AAEpE;;;;;;;;GAQG;AACU,QAAA,aAAa,GAAG,IAAA,2BAAiB,EAC5C,uBAAuB,CACxB,CAAC;AAEF;;;;;;;;;GASG;AACU,QAAA,YAAY,GAAG,IAAA,2BAAiB,EAC3C,sBAAsB,CACvB,CAAC;AAiBF;;;;;GAKG;AACU,QAAA,sBAAsB,GAAG,IAAA,2BAAiB,EAErD,gCAAgC,CAAC,CAAC;AAEpC;;;;;;;;;;;;;GAaG;AACU,QAAA,qBAAqB,GAAG,IAAA,2BAAiB,EAEpD,+BAA+B,CAAC,CAAC;AAEnC;;;;;GAKG;AACU,QAAA,uBAAuB,GAAG,IAAA,2BAAiB,EAEtD,iCAAiC,CAAC,CAAC"}
|
package/dist/proxies.d.ts
CHANGED
|
@@ -24,7 +24,10 @@ export declare class AsyncProxy<T extends Func = Func, R = Awaited<ReturnType<T>
|
|
|
24
24
|
private attachment?;
|
|
25
25
|
private queue;
|
|
26
26
|
constructor(identity?: string);
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Attaches the provider callback, replacing any previous one, and replays
|
|
29
|
+
* queued calls. The callback runs in the context it was attached in.
|
|
30
|
+
*/
|
|
28
31
|
onCall(callback: T, manualDetach?: boolean): AttachmentLease;
|
|
29
32
|
/** Detaches the leased attachment, or the current one when called without a lease. */
|
|
30
33
|
detach(lease?: AttachmentLease): void;
|
|
@@ -33,7 +36,14 @@ export declare class AsyncProxy<T extends Func = Func, R = Awaited<ReturnType<T>
|
|
|
33
36
|
private invoke;
|
|
34
37
|
private replayQueue;
|
|
35
38
|
}
|
|
36
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Creates a callable interface function backed by an asynchronous proxy.
|
|
41
|
+
* The typed contract always returns a Promise. Use ImplementInterface to attach
|
|
42
|
+
* a provider; the runtime-only `.proxy` property is absent from the return type.
|
|
43
|
+
* Construct AsyncProxy directly when typed attachment/lease control is needed.
|
|
44
|
+
*
|
|
45
|
+
* @param identity Optional diagnostic name for the underlying proxy.
|
|
46
|
+
*/
|
|
37
47
|
export declare function InterfaceFunction<T extends Func = Func, R = Awaited<ReturnType<T>>>(identity?: string): (...args: Parameters<T>) => Promise<R>;
|
|
38
48
|
/** Proxy for register and unregister handlers, served by a single provider. */
|
|
39
49
|
export declare class RegisteringProxy<T extends RegisterFunction = RegisterFunction> {
|
|
@@ -41,11 +51,19 @@ export declare class RegisteringProxy<T extends RegisterFunction = RegisterFunct
|
|
|
41
51
|
private handlers;
|
|
42
52
|
private readonly registered;
|
|
43
53
|
constructor(identity?: string);
|
|
44
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Attaches only the register callback, run in the context it was attached in,
|
|
56
|
+
* then replays stored registrations. Returns a lease for this callback; an
|
|
57
|
+
* existing unregister callback remains.
|
|
58
|
+
*/
|
|
45
59
|
onRegister(callback: T, manualDetach?: boolean): AttachmentLease;
|
|
46
60
|
/** Attaches an unregister callback, sharing the register callback's owner when it is the caller's. */
|
|
47
61
|
onUnregister(callback: (id: RID<T>) => void): AttachmentLease;
|
|
48
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Installs both callbacks under one lease before replaying registrations.
|
|
64
|
+
* Replay reports synchronous failures and continues; provider side effects
|
|
65
|
+
* are not rolled back. Pass the returned lease to detach both callbacks safely.
|
|
66
|
+
*/
|
|
49
67
|
onHandlers(register: T, unregister: (id: RID<T>) => void, manualDetach?: boolean): AttachmentLease;
|
|
50
68
|
/** Detaches the leased handlers, or both handlers when called without a lease. */
|
|
51
69
|
detach(lease?: AttachmentLease): void;
|
|
@@ -65,7 +83,7 @@ export declare class RegisteringProxy<T extends RegisterFunction = RegisterFunct
|
|
|
65
83
|
private replayRegistrations;
|
|
66
84
|
}
|
|
67
85
|
type EventFunction = (...args: any[]) => void;
|
|
68
|
-
/** Module-aware event handler collection; each handler runs in
|
|
86
|
+
/** Module-aware event handler collection; each handler runs in the context it was registered in. */
|
|
69
87
|
export declare class EventProxy<T extends EventFunction = EventFunction> {
|
|
70
88
|
readonly [PROXY_BRAND]: ProxyBrand;
|
|
71
89
|
private registered;
|
|
@@ -81,6 +99,6 @@ export declare class EventProxy<T extends EventFunction = EventFunction> {
|
|
|
81
99
|
/** Unregisters handlers owned by a destroyed module generation. */
|
|
82
100
|
unregisterOwner(owner: string): void;
|
|
83
101
|
}
|
|
84
|
-
/** Gets the
|
|
85
|
-
export declare function GetResponsibleModule(
|
|
102
|
+
/** Gets the module whose work is running, from the async module context. */
|
|
103
|
+
export declare function GetResponsibleModule(): string | undefined;
|
|
86
104
|
export {};
|