@antelopejs/interface-core 0.0.12 → 0.0.14
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/dist/config.d.ts +16 -0
- package/dist/config.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/logging/index.js +0 -1
- package/dist/logging/index.js.map +1 -1
- package/dist/modules.d.ts +1 -1
- package/dist/modules.js +23 -4
- package/dist/modules.js.map +1 -1
- package/dist/proxies.js +1 -1
- package/dist/proxies.js.map +1 -1
- package/dist/tests/async-proxy-call.test.js.map +1 -1
- package/dist/tests/generation-cleanup.test.js +1 -1
- package/dist/tests/generation-cleanup.test.js.map +1 -1
- package/dist/tests/implement-interface-validation.test.js +2 -2
- package/dist/tests/implement-interface-validation.test.js.map +1 -1
- package/dist/tests/interface-connections.test.js +1 -1
- package/dist/tests/interface-connections.test.js.map +1 -1
- package/dist/tests/module-ownership-context.test.js +2 -2
- package/dist/tests/module-ownership-context.test.js.map +1 -1
- package/dist/tests/modules.test.js +2 -2
- package/dist/tests/modules.test.js.map +1 -1
- package/dist/tests/provider-context.test.js +1 -1
- package/dist/tests/provider-context.test.js.map +1 -1
- package/dist/tests/provider-routing.test.js +1 -1
- package/dist/tests/provider-routing.test.js.map +1 -1
- package/dist/tests/queue-and-cleanup.test.js +2 -2
- package/dist/tests/queue-and-cleanup.test.js.map +1 -1
- package/dist/tests/registering-proxy-replay.test.js.map +1 -1
- package/dist/tests/responsible-module.test.js +25 -25
- package/dist/tests/responsible-module.test.js.map +1 -1
- package/dist/tests/root-declarations.test.js +2 -2
- package/dist/tests/root-declarations.test.js.map +1 -1
- package/dist/tests/runtime-protocol.test.js +3 -3
- package/dist/tests/runtime-protocol.test.js.map +1 -1
- package/dist/tests/runtime.test.js +1 -1
- package/dist/tests/runtime.test.js.map +1 -1
- package/dist/tests/stub-mode.test.js +2 -2
- package/dist/tests/stub-mode.test.js.map +1 -1
- package/dist/tests/teardown-module-context.test.d.ts +1 -0
- package/dist/tests/teardown-module-context.test.js +53 -0
- package/dist/tests/teardown-module-context.test.js.map +1 -0
- package/docs/1.introduction.md +14 -3
- package/docs/2.proxies.md +19 -5
- package/docs/3.decorators.md +32 -20
- package/docs/4.metadata.md +9 -5
- package/docs/5.modules.md +12 -12
- package/docs/6.logging.md +14 -13
- package/docs/7.configuration.md +82 -30
- package/docs/8.runtime.md +5 -5
- package/package.json +54 -45
- package/skills/core-interface/SKILL.md +44 -8
package/docs/7.configuration.md
CHANGED
|
@@ -34,7 +34,11 @@ export default defineConfig({
|
|
|
34
34
|
database: "@antelopejs/database",
|
|
35
35
|
auth: {
|
|
36
36
|
version: "1.0.0",
|
|
37
|
-
source: {
|
|
37
|
+
source: {
|
|
38
|
+
type: "package",
|
|
39
|
+
package: "@antelopejs/auth",
|
|
40
|
+
version: "1.0.0",
|
|
41
|
+
},
|
|
38
42
|
config: { secret: "my-secret" },
|
|
39
43
|
},
|
|
40
44
|
},
|
|
@@ -48,7 +52,11 @@ export default defineConfig((ctx) => {
|
|
|
48
52
|
name: "my-project",
|
|
49
53
|
modules: {
|
|
50
54
|
database: {
|
|
51
|
-
source: {
|
|
55
|
+
source: {
|
|
56
|
+
type: "package",
|
|
57
|
+
package: "@antelopejs/database",
|
|
58
|
+
version: "1.0.0",
|
|
59
|
+
},
|
|
52
60
|
config: {
|
|
53
61
|
host: ctx.env === "production" ? "db.prod.internal" : "localhost",
|
|
54
62
|
},
|
|
@@ -62,15 +70,15 @@ export default defineConfig((ctx) => {
|
|
|
62
70
|
|
|
63
71
|
The root configuration object for an AntelopeJS project.
|
|
64
72
|
|
|
65
|
-
| Property
|
|
66
|
-
|
|
|
67
|
-
| `name`
|
|
68
|
-
| `cacheFolder`
|
|
69
|
-
| `modules`
|
|
70
|
-
| `logging`
|
|
71
|
-
| `envOverrides`
|
|
72
|
-
| `environments`
|
|
73
|
-
| `test`
|
|
73
|
+
| Property | Type | Description |
|
|
74
|
+
| -------------- | ------------------------------------------------ | ----------------------------------------- |
|
|
75
|
+
| `name` | `string` | Project name |
|
|
76
|
+
| `cacheFolder` | `string` | Optional custom cache directory |
|
|
77
|
+
| `modules` | `Record<string, string \| AntelopeModuleConfig>` | Module definitions (shorthand or full) |
|
|
78
|
+
| `logging` | `AntelopeLogging` | Optional logging configuration |
|
|
79
|
+
| `envOverrides` | `Record<string, string \| string[]>` | Optional environment variable overrides |
|
|
80
|
+
| `environments` | `Record<string, Partial<AntelopeConfig>>` | Optional per-environment config overrides |
|
|
81
|
+
| `test` | `AntelopeTestConfig` | Optional test configuration |
|
|
74
82
|
|
|
75
83
|
## Module sources
|
|
76
84
|
|
|
@@ -146,35 +154,79 @@ Like the local source, `local-folder` also accepts an optional `reloadCommand` t
|
|
|
146
154
|
|
|
147
155
|
Full module configuration within the project config.
|
|
148
156
|
|
|
149
|
-
| Property | Type
|
|
150
|
-
| ----------------- |
|
|
151
|
-
| `version` | `string`
|
|
152
|
-
| `source` | `ModuleSource*`
|
|
153
|
-
| `config` | `unknown`
|
|
154
|
-
| `importOverrides` | `ImportOverride[] \| Record<string, string>`
|
|
155
|
-
| `disabledExports` | `string[]`
|
|
157
|
+
| Property | Type | Description |
|
|
158
|
+
| ----------------- | -------------------------------------------- | ----------------------------------------------------- |
|
|
159
|
+
| `version` | `string` | Optional version constraint |
|
|
160
|
+
| `source` | `ModuleSource*` | Source definition (local, git, package, local-folder) |
|
|
161
|
+
| `config` | `unknown` | Optional runtime configuration |
|
|
162
|
+
| `importOverrides` | `ImportOverride[] \| Record<string, string>` | Optional import path redirections |
|
|
163
|
+
| `disabledExports` | `string[]` | Optional list of exports to disable |
|
|
156
164
|
|
|
157
165
|
## `AntelopeLogging`
|
|
158
166
|
|
|
159
167
|
Logging configuration within the project config.
|
|
160
168
|
|
|
161
|
-
| Property
|
|
162
|
-
|
|
|
163
|
-
| `enabled`
|
|
164
|
-
| `moduleTracking`
|
|
165
|
-
| `channelFilter`
|
|
166
|
-
| `formatter`
|
|
167
|
-
| `dateFormat`
|
|
169
|
+
| Property | Type | Description |
|
|
170
|
+
| ---------------- | ---------------------------------- | ------------------------------------------------- |
|
|
171
|
+
| `enabled` | `boolean` | Enable or disable logging |
|
|
172
|
+
| `moduleTracking` | `object` | Track module-level logging with includes/excludes |
|
|
173
|
+
| `channelFilter` | `Record<string, number \| string>` | Filter log output by channel and level |
|
|
174
|
+
| `formatter` | `Record<string, string>` | Custom formatters per channel |
|
|
175
|
+
| `dateFormat` | `string` | Date format string for log timestamps |
|
|
176
|
+
|
|
177
|
+
## Config variables
|
|
178
|
+
|
|
179
|
+
A module can publish named values other modules reference from their own configuration. The provider declares the names it publishes in its `package.json`, returns them from `construct`, and the core substitutes them into every consumer before that consumer constructs.
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"name": "api",
|
|
184
|
+
"antelopeJs": {
|
|
185
|
+
"configVars": ["API_PORT"]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
import type { ConfigVars } from "@antelopejs/interface-core/config";
|
|
192
|
+
|
|
193
|
+
export async function construct(config: unknown): Promise<ConfigVars> {
|
|
194
|
+
const port = await bindPort(config);
|
|
195
|
+
return { API_PORT: port };
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
A consumer references the value with `${@<moduleName>.<VAR_NAME>}`, where `<moduleName>` is the module key used in the project configuration:
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
export default defineConfig({
|
|
203
|
+
name: "my-project",
|
|
204
|
+
modules: {
|
|
205
|
+
api: { version: "1.0.0" },
|
|
206
|
+
dms: {
|
|
207
|
+
version: "1.0.0",
|
|
208
|
+
config: { apiBaseUrl: "http://127.0.0.1:${@api.API_PORT}" },
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
| Type | Definition | Description |
|
|
215
|
+
| ---------------- | -------------------------------- | --------------------------------------------------- |
|
|
216
|
+
| `ConfigVarValue` | `string \| number \| boolean` | A single published value |
|
|
217
|
+
| `ConfigVars` | `Record<string, ConfigVarValue>` | The record `construct` returns to publish variables |
|
|
218
|
+
|
|
219
|
+
Values are resolved once, at construct time, and never re-resolved afterwards. See the core documentation for the resolution order and the failure modes.
|
|
168
220
|
|
|
169
221
|
## `AntelopeTestConfig`
|
|
170
222
|
|
|
171
223
|
Test configuration for the project.
|
|
172
224
|
|
|
173
|
-
| Property | Type
|
|
174
|
-
| --------- |
|
|
175
|
-
| `folder` | `string`
|
|
176
|
-
| `setup` | `Function`
|
|
177
|
-
| `cleanup` | `Function`
|
|
225
|
+
| Property | Type | Description |
|
|
226
|
+
| --------- | ---------- | ------------------------------------------------------ |
|
|
227
|
+
| `folder` | `string` | Optional test folder path |
|
|
228
|
+
| `setup` | `Function` | Optional async setup function returning partial config |
|
|
229
|
+
| `cleanup` | `Function` | Optional async cleanup function |
|
|
178
230
|
|
|
179
231
|
## Next steps
|
|
180
232
|
|
package/docs/8.runtime.md
CHANGED
|
@@ -23,11 +23,11 @@ const info = await GetRuntimeInfo();
|
|
|
23
23
|
// { dev: true, projectPath: "/path/to/project", env: "default" }
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
| Field | Description
|
|
27
|
-
| ------------- |
|
|
28
|
-
| `dev` | `true` when running under `ajs project dev`, `false` otherwise
|
|
29
|
-
| `projectPath` | Absolute path to the root of the running project
|
|
30
|
-
| `env` | Name of the active configuration environment
|
|
26
|
+
| Field | Description |
|
|
27
|
+
| ------------- | -------------------------------------------------------------- |
|
|
28
|
+
| `dev` | `true` when running under `ajs project dev`, `false` otherwise |
|
|
29
|
+
| `projectPath` | Absolute path to the root of the running project |
|
|
30
|
+
| `env` | Name of the active configuration environment |
|
|
31
31
|
|
|
32
32
|
## `RegisterDevServer`
|
|
33
33
|
|
package/package.json
CHANGED
|
@@ -1,48 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/interface-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "AntelopeJS core interface primitives - proxies, decorators, interface functions, and logging",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"core",
|
|
8
|
+
"interface"
|
|
9
9
|
],
|
|
10
|
+
"license": "Apache-2.0",
|
|
10
11
|
"repository": {
|
|
11
12
|
"type": "git",
|
|
12
13
|
"url": "git+https://github.com/AntelopeJS/interface-core.git"
|
|
13
14
|
},
|
|
14
|
-
"license": "Apache-2.0",
|
|
15
|
-
"packageManager": "pnpm@10.6.5",
|
|
16
|
-
"main": "dist/index.js",
|
|
17
|
-
"types": "dist/index.d.ts",
|
|
18
15
|
"files": [
|
|
19
16
|
"dist",
|
|
20
17
|
"docs",
|
|
21
18
|
"skills"
|
|
22
19
|
],
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"types": "./dist/index.d.ts",
|
|
26
|
-
"default": "./dist/index.js"
|
|
27
|
-
},
|
|
28
|
-
"./*": {
|
|
29
|
-
"types": "./dist/*.d.ts",
|
|
30
|
-
"default": "./dist/*.js"
|
|
31
|
-
},
|
|
32
|
-
"./config": {
|
|
33
|
-
"types": "./dist/config.d.ts",
|
|
34
|
-
"default": "./dist/config.js"
|
|
35
|
-
},
|
|
36
|
-
"./logging": {
|
|
37
|
-
"types": "./dist/logging/index.d.ts",
|
|
38
|
-
"default": "./dist/logging/index.js"
|
|
39
|
-
},
|
|
40
|
-
"./logging/*": {
|
|
41
|
-
"types": "./dist/logging/*.d.ts",
|
|
42
|
-
"default": "./dist/logging/*.js"
|
|
43
|
-
},
|
|
44
|
-
"./package.json": "./package.json"
|
|
45
|
-
},
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
46
22
|
"typesVersions": {
|
|
47
23
|
"*": {
|
|
48
24
|
"decorators": [
|
|
@@ -71,37 +47,70 @@
|
|
|
71
47
|
]
|
|
72
48
|
}
|
|
73
49
|
},
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"types": "./dist/index.d.ts",
|
|
53
|
+
"default": "./dist/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./*": {
|
|
56
|
+
"types": "./dist/*.d.ts",
|
|
57
|
+
"default": "./dist/*.js"
|
|
58
|
+
},
|
|
59
|
+
"./config": {
|
|
60
|
+
"types": "./dist/config.d.ts",
|
|
61
|
+
"default": "./dist/config.js"
|
|
62
|
+
},
|
|
63
|
+
"./logging": {
|
|
64
|
+
"types": "./dist/logging/index.d.ts",
|
|
65
|
+
"default": "./dist/logging/index.js"
|
|
66
|
+
},
|
|
67
|
+
"./logging/*": {
|
|
68
|
+
"types": "./dist/logging/*.d.ts",
|
|
69
|
+
"default": "./dist/logging/*.js"
|
|
70
|
+
},
|
|
71
|
+
"./package.json": "./package.json"
|
|
72
|
+
},
|
|
73
|
+
"publishConfig": {
|
|
74
|
+
"access": "public",
|
|
75
|
+
"provenance": true
|
|
76
|
+
},
|
|
74
77
|
"scripts": {
|
|
75
78
|
"build": "rimraf dist && tsc",
|
|
76
|
-
"format": "
|
|
77
|
-
"lint:fix": "
|
|
78
|
-
"lint": "
|
|
79
|
+
"format": "oxfmt .",
|
|
80
|
+
"lint:fix": "oxlint --fix",
|
|
81
|
+
"lint": "oxlint",
|
|
79
82
|
"prepack": "pnpm run build",
|
|
80
|
-
"release": "pnpm run lint && pnpm run prepack && release-it",
|
|
81
|
-
"test": "pnpm run build &&
|
|
82
|
-
"test:package": "node test/package-consumer.mjs"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"test": "src/antelope.test.ts",
|
|
86
|
-
"skills": [
|
|
87
|
-
"./skills"
|
|
88
|
-
]
|
|
83
|
+
"release": "pnpm run lint && pnpm run test && pnpm run test:package && pnpm run prepack && release-it",
|
|
84
|
+
"test": "pnpm run build && mocha 'dist/tests/**/*.test.js'",
|
|
85
|
+
"test:package": "node test/package-consumer.mjs",
|
|
86
|
+
"format:check": "oxfmt --check .",
|
|
87
|
+
"knip": "knip"
|
|
89
88
|
},
|
|
90
89
|
"dependencies": {
|
|
91
90
|
"reflect-metadata": "^0.2.2"
|
|
92
91
|
},
|
|
93
92
|
"devDependencies": {
|
|
94
|
-
"@
|
|
93
|
+
"@antelopejs/tooling-configs": "^0.0.4",
|
|
95
94
|
"@types/chai": "^4.3.20",
|
|
96
95
|
"@types/mocha": "^10.0.10",
|
|
97
96
|
"@types/node": "^22.19.15",
|
|
98
97
|
"chai": "^4.5.0",
|
|
98
|
+
"eslint-plugin-perfectionist": "^5.11.0",
|
|
99
|
+
"knip": "^6.34.0",
|
|
100
|
+
"mocha": "^11.7.5",
|
|
101
|
+
"oxfmt": "^0.66.0",
|
|
102
|
+
"oxlint": "1.81.0",
|
|
103
|
+
"oxlint-tsgolint": "^7.0.2001",
|
|
99
104
|
"release-it": "^19.2.4",
|
|
100
105
|
"release-it-changelogen": "^0.1.0",
|
|
101
106
|
"rimraf": "^6.1.3",
|
|
102
107
|
"typescript": "^5.9.3"
|
|
103
108
|
},
|
|
104
|
-
"
|
|
105
|
-
|
|
109
|
+
"packageManager": "pnpm@10.6.5",
|
|
110
|
+
"antelopeJs": {
|
|
111
|
+
"test": "src/antelope.test.ts",
|
|
112
|
+
"skills": [
|
|
113
|
+
"./skills"
|
|
114
|
+
]
|
|
106
115
|
}
|
|
107
116
|
}
|
|
@@ -16,12 +16,48 @@ factories, `GetMetadata`, and config types are ordinary consumer-side helpers (n
|
|
|
16
16
|
## Import paths
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
import {
|
|
20
|
+
InterfaceFunction,
|
|
21
|
+
ImplementInterface,
|
|
22
|
+
GetMetadata,
|
|
23
|
+
GetInterfaceInstances,
|
|
24
|
+
GetInterfaceInstance,
|
|
25
|
+
AsyncProxy,
|
|
26
|
+
EventProxy,
|
|
27
|
+
RegisteringProxy,
|
|
28
|
+
GetResponsibleModule,
|
|
29
|
+
} from "@antelopejs/interface-core";
|
|
30
|
+
import {
|
|
31
|
+
MakeClassDecorator,
|
|
32
|
+
MakeMethodDecorator,
|
|
33
|
+
MakePropertyDecorator,
|
|
34
|
+
MakeParameterDecorator,
|
|
35
|
+
} from "@antelopejs/interface-core/decorators"; // + many combined variants
|
|
36
|
+
import {
|
|
37
|
+
Events,
|
|
38
|
+
ListModules,
|
|
39
|
+
GetModuleInfo,
|
|
40
|
+
LoadModule,
|
|
41
|
+
StartModule,
|
|
42
|
+
StopModule,
|
|
43
|
+
DestroyModule,
|
|
44
|
+
ReloadModule,
|
|
45
|
+
} from "@antelopejs/interface-core/modules";
|
|
46
|
+
import {
|
|
47
|
+
AsyncProxy,
|
|
48
|
+
EventProxy,
|
|
49
|
+
RegisteringProxy,
|
|
50
|
+
} from "@antelopejs/interface-core/proxies"; // same classes the root entry re-exports; pick one import site
|
|
51
|
+
import {
|
|
52
|
+
GetRuntimeInfo,
|
|
53
|
+
RegisterDevServer,
|
|
54
|
+
DEV_REGISTRY_PATH,
|
|
55
|
+
} from "@antelopejs/interface-core/runtime";
|
|
56
|
+
import {
|
|
57
|
+
defineConfig,
|
|
58
|
+
type AntelopeConfig,
|
|
59
|
+
type AntelopeModuleConfig,
|
|
60
|
+
} from "@antelopejs/interface-core/config";
|
|
25
61
|
import { Logging } from "@antelopejs/interface-core/logging";
|
|
26
62
|
```
|
|
27
63
|
|
|
@@ -65,8 +101,8 @@ implemented; providers `emit` on them, consumers `register`/`unregister` handler
|
|
|
65
101
|
```ts
|
|
66
102
|
import { Logging } from "@antelopejs/interface-core/logging";
|
|
67
103
|
|
|
68
|
-
Logging.Info("hello");
|
|
69
|
-
const ch = new Logging.Channel("database");
|
|
104
|
+
Logging.Info("hello"); // main channel; also Error/Warn/Debug/Trace
|
|
105
|
+
const ch = new Logging.Channel("database"); // named channel
|
|
70
106
|
ch.Debug("query", { ms: 12 });
|
|
71
107
|
```
|
|
72
108
|
|