@theokit/di 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/index.cjs +72 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +150 -1
- package/dist/index.d.ts +150 -1
- package/dist/index.js +68 -2
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 461c020: Add `METADATA_KEYS.SQUAD` (`"usetheo:di:squad"`) and `METADATA_KEYS.STEP` (`"usetheo:di:step"`) — new metadata keys backing the `@Squad()` and `@Step()` decorators in `@theokit/di-agent`. Shipped as a patch (additive values on the existing exported `METADATA_KEYS`) to keep `@theokit/di-agent` and the in-progress `@theokit/orm` (prerelease `0.1.0-next.1`) inside their `^0.1.0` peer range — a `minor` (`0.2.0`) would fall outside `^0.1.x` and force both dependents to `1.0.0`.
|
|
8
|
+
|
|
9
|
+
Also: broke the `container.ts ↔ internal/module-loader.ts` type-only cycle (arch-review ADR 0001) — `loadModule` now depends on a narrow `ModuleRegistrar` interface from the leaf `types.ts` instead of the concrete `Container`. No behavior change; `Container` satisfies it structurally.
|
|
10
|
+
|
|
3
11
|
All notable changes to `@theokit/di` are documented in this file.
|
|
4
12
|
|
|
5
13
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
14
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
15
|
|
|
16
|
+
## [Unreleased]
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- `METADATA_KEYS.SQUAD` (`"usetheo:di:squad"`) — metadata key backing the `@Squad()` decorator in `@theokit/di-agent`.
|
|
21
|
+
- `METADATA_KEYS.STEP` (`"usetheo:di:step"`) — metadata key backing the `@Step()` decorator in `@theokit/di-agent`.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Broke the `container.ts ↔ internal/module-loader.ts` type-only dependency cycle (arch-review ADR 0001). `loadModule` now takes a narrow `ModuleRegistrar` interface (just `register(...)`) from the leaf `types.ts` instead of importing the concrete `Container`. No behavior change — `Container` satisfies it structurally; all 69 tests GREEN, `madge --circular` clean.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- **Documentation only:** expanded JSDoc header on `Container` class (`src/container.ts:87`) acknowledging auditor finding PV#10 from the 2026-06-06 architecture audit. The 812 LOC class size is above the 500 LOC heuristic file budget but justified as the Single-Point-of-Truth for DI resolution (registry lookup, lifecycle SINGLETON/TRANSIENT/REQUEST, `@Injectable` metadata read, alias resolution, request-scope ALS propagation, dispose chain). Splitting would fragment cohesion per `rules/architecture.md § 3` + KISS / YAGNI. ADR D422 tracks ongoing Extract-Method refactor at the method level. No code change. Plan `arch-review-fixes-2026-06-06` T11.2 records the trade-off.
|
|
30
|
+
|
|
8
31
|
## [0.1.0] - 2026-05-31
|
|
9
32
|
|
|
10
33
|
> First GA release. Promotes `0.1.0-next.0` to stable with the EC-R3-1 single-flight Promise cache fix (shipped in `0.1.0-next.0` commit `520fe7d`) plus the biome-cleanup refactors below. API contract preserved — no breaking changes from `0.1.0-next.0`.
|
package/dist/index.cjs
CHANGED
|
@@ -190,7 +190,47 @@ var METADATA_KEYS = {
|
|
|
190
190
|
/** Set<number> from `@Optional()` parameter decorators. */
|
|
191
191
|
OPTIONAL_FLAGS: "usetheo:di:optional",
|
|
192
192
|
/** TS-emitted constructor parameter types (requires `emitDecoratorMetadata`). */
|
|
193
|
-
DESIGN_PARAMTYPES: "design:paramtypes"
|
|
193
|
+
DESIGN_PARAMTYPES: "design:paramtypes",
|
|
194
|
+
/** Map<number, string> from `@Qualifier(name)` parameter decorators. */
|
|
195
|
+
QUALIFIER_NAMES: "usetheo:di:qualifier-names",
|
|
196
|
+
/** boolean from `@Primary` class decorator. */
|
|
197
|
+
PRIMARY: "usetheo:di:primary",
|
|
198
|
+
/** string | symbol from `@PostConstruct` method decorator. */
|
|
199
|
+
POST_CONSTRUCT: "usetheo:di:post-construct",
|
|
200
|
+
/** string | symbol from `@PreDestroy` method decorator. */
|
|
201
|
+
PRE_DESTROY: "usetheo:di:pre-destroy",
|
|
202
|
+
/** Map<string|symbol, SandboxOptions> from `@UseSandbox()` property decorator. */
|
|
203
|
+
SANDBOX: "usetheo:di:sandbox",
|
|
204
|
+
/** Map<string|symbol, SubAgentSpec> from `@SubAgent()` property decorator. */
|
|
205
|
+
SUBAGENT: "usetheo:di:subagent",
|
|
206
|
+
/** Map<string|symbol, SquadMetadata> from `@Squad()` property decorator. */
|
|
207
|
+
SQUAD: "usetheo:di:squad",
|
|
208
|
+
/** Map<string|symbol, StepMetadata> from `@Step()` method decorator. */
|
|
209
|
+
STEP: "usetheo:di:step",
|
|
210
|
+
/** HitlOptions from `@Hitl()` method decorator. */
|
|
211
|
+
HITL: "usetheo:di:hitl",
|
|
212
|
+
/** AutoSummarizeConfig from `@AutoSummarize()` class decorator. */
|
|
213
|
+
AUTO_SUMMARIZE: "usetheo:di:auto-summarize",
|
|
214
|
+
/** Map<string|symbol, ToolOptions> from `@Tool()` property decorator. */
|
|
215
|
+
TOOL: "usetheo:di:tool",
|
|
216
|
+
/** WorkflowOptions from `@Workflow()` class decorator. */
|
|
217
|
+
WORKFLOW: "usetheo:di:workflow",
|
|
218
|
+
/** EvalOptions from `@Eval()` class decorator. */
|
|
219
|
+
EVAL: "usetheo:di:eval",
|
|
220
|
+
/** CronMetadata from `@Cron()` method decorator. */
|
|
221
|
+
CRON: "usetheo:di:cron",
|
|
222
|
+
/** Map<string|symbol, SubscriptionOptions> from `@Subscription()` property decorator. */
|
|
223
|
+
SUBSCRIPTION: "usetheo:di:subscription",
|
|
224
|
+
/** AuthOptions from `@Auth()` class decorator. */
|
|
225
|
+
AUTH: "usetheo:di:auth",
|
|
226
|
+
/** Map<string|symbol, RetrieverOptions> from `@Retriever()` property decorator. */
|
|
227
|
+
RETRIEVER: "usetheo:di:retriever",
|
|
228
|
+
/** Map<string|symbol, RerankerOptions> from `@Reranker()` property decorator. */
|
|
229
|
+
RERANKER: "usetheo:di:reranker",
|
|
230
|
+
/** Map<string|symbol, TextSplitterOptions> from `@TextSplitter()` property decorator. */
|
|
231
|
+
TEXT_SPLITTER: "usetheo:di:text-splitter",
|
|
232
|
+
/** Map<string|symbol, MemoryScopeOptions> from `@MemoryScopeDecorator()` property decorator. */
|
|
233
|
+
MEMORY_SCOPE: "usetheo:di:memory-scope"
|
|
194
234
|
};
|
|
195
235
|
function hasReflectMetadata() {
|
|
196
236
|
return typeof Reflect !== "undefined" && typeof Reflect.getMetadata === "function";
|
|
@@ -967,6 +1007,16 @@ function Injectable(options = {}) {
|
|
|
967
1007
|
}
|
|
968
1008
|
__name(Injectable, "Injectable");
|
|
969
1009
|
|
|
1010
|
+
// src/decorators/lifecycle.ts
|
|
1011
|
+
function PostConstruct(target, propertyKey) {
|
|
1012
|
+
Reflect.defineMetadata(METADATA_KEYS.POST_CONSTRUCT, propertyKey, target.constructor);
|
|
1013
|
+
}
|
|
1014
|
+
__name(PostConstruct, "PostConstruct");
|
|
1015
|
+
function PreDestroy(target, propertyKey) {
|
|
1016
|
+
Reflect.defineMetadata(METADATA_KEYS.PRE_DESTROY, propertyKey, target.constructor);
|
|
1017
|
+
}
|
|
1018
|
+
__name(PreDestroy, "PreDestroy");
|
|
1019
|
+
|
|
970
1020
|
// src/decorators/optional.ts
|
|
971
1021
|
function Optional() {
|
|
972
1022
|
return (target, _propertyKey, parameterIndex) => {
|
|
@@ -978,6 +1028,22 @@ function Optional() {
|
|
|
978
1028
|
}
|
|
979
1029
|
__name(Optional, "Optional");
|
|
980
1030
|
|
|
1031
|
+
// src/decorators/primary.ts
|
|
1032
|
+
function Primary(target) {
|
|
1033
|
+
Reflect.defineMetadata(METADATA_KEYS.PRIMARY, true, target);
|
|
1034
|
+
}
|
|
1035
|
+
__name(Primary, "Primary");
|
|
1036
|
+
|
|
1037
|
+
// src/decorators/qualifier.ts
|
|
1038
|
+
function Qualifier(name) {
|
|
1039
|
+
return (target, _propertyKey, parameterIndex) => {
|
|
1040
|
+
const existing = Reflect.getMetadata(METADATA_KEYS.QUALIFIER_NAMES, target) ?? /* @__PURE__ */ new Map();
|
|
1041
|
+
existing.set(parameterIndex, name);
|
|
1042
|
+
Reflect.defineMetadata(METADATA_KEYS.QUALIFIER_NAMES, existing, target);
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
__name(Qualifier, "Qualifier");
|
|
1046
|
+
|
|
981
1047
|
exports.AsyncProviderInSyncResolveError = AsyncProviderInSyncResolveError;
|
|
982
1048
|
exports.Container = Container;
|
|
983
1049
|
exports.ContainerDisposedError = ContainerDisposedError;
|
|
@@ -988,9 +1054,14 @@ exports.Inject = Inject;
|
|
|
988
1054
|
exports.Injectable = Injectable;
|
|
989
1055
|
exports.InvalidExportError = InvalidExportError;
|
|
990
1056
|
exports.InvalidModuleError = InvalidModuleError;
|
|
1057
|
+
exports.METADATA_KEYS = METADATA_KEYS;
|
|
991
1058
|
exports.MissingInjectableError = MissingInjectableError;
|
|
992
1059
|
exports.Module = Module;
|
|
993
1060
|
exports.Optional = Optional;
|
|
1061
|
+
exports.PostConstruct = PostConstruct;
|
|
1062
|
+
exports.PreDestroy = PreDestroy;
|
|
1063
|
+
exports.Primary = Primary;
|
|
1064
|
+
exports.Qualifier = Qualifier;
|
|
994
1065
|
exports.ReflectMetadataMissingError = ReflectMetadataMissingError;
|
|
995
1066
|
exports.Scope = Scope;
|
|
996
1067
|
exports.ScopeViolationError = ScopeViolationError;
|