@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/dist/index.d.cts
CHANGED
|
@@ -137,6 +137,24 @@ interface GraphEdge {
|
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Lightweight DI container. See `README.md` for usage examples.
|
|
140
|
+
*
|
|
141
|
+
* **Auditor-acknowledged size (info-level):** the 2026-06-06 architecture
|
|
142
|
+
* audit (`/loop-architecture-review` Phase 3 principles-auditor) flagged
|
|
143
|
+
* this class as 812 LOC (above the 500 LOC heuristic file budget) under
|
|
144
|
+
* principle violation PV#10 (SRP / clean_function category, INFO severity).
|
|
145
|
+
* The auditor's own description annotates it as "large but justified DI
|
|
146
|
+
* orchestrator". The class is the Single-Point-of-Truth for DI resolution:
|
|
147
|
+
* registry lookup, lifecycle (SINGLETON/TRANSIENT/REQUEST), `@Injectable`
|
|
148
|
+
* metadata read, alias resolution, request-scope ALS propagation, and
|
|
149
|
+
* dispose chain. Splitting these concerns into separate classes would
|
|
150
|
+
* fragment cohesion and force consumers to coordinate across an internal
|
|
151
|
+
* micro-interface that adds no testability or extensibility per
|
|
152
|
+
* `rules/architecture.md § 3` (module cohesion) + KISS / YAGNI. ADR D422
|
|
153
|
+
* documents an ongoing Extract-Method refactor targeting individual long
|
|
154
|
+
* methods (not class-level split). Plan `arch-review-fixes-2026-06-06`
|
|
155
|
+
* T11.2 documents this trade-off; audit DB row `principle_violations.id=10`
|
|
156
|
+
* @ `packages/di/src/container.ts:87`; report at
|
|
157
|
+
* `architecture-output/final_report.md § Findings by dimension` PV#10.
|
|
140
158
|
*/
|
|
141
159
|
declare class Container {
|
|
142
160
|
private readonly registrations;
|
|
@@ -316,6 +334,44 @@ interface InjectableOptions {
|
|
|
316
334
|
*/
|
|
317
335
|
declare function Injectable(options?: InjectableOptions): ClassDecorator;
|
|
318
336
|
|
|
337
|
+
/**
|
|
338
|
+
* @PostConstruct — method called after DI resolution completes.
|
|
339
|
+
* All constructor dependencies are injected before this method runs.
|
|
340
|
+
*
|
|
341
|
+
* Supports async methods (EC-1): if the method returns a Promise,
|
|
342
|
+
* the Container awaits it before returning the instance.
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```ts
|
|
346
|
+
* @Injectable()
|
|
347
|
+
* class CacheService {
|
|
348
|
+
* private cache!: Map<string, unknown>
|
|
349
|
+
*
|
|
350
|
+
* @PostConstruct
|
|
351
|
+
* async init() {
|
|
352
|
+
* this.cache = await loadCacheFromRedis()
|
|
353
|
+
* }
|
|
354
|
+
* }
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
declare function PostConstruct(target: object, propertyKey: string | symbol): void;
|
|
358
|
+
/**
|
|
359
|
+
* @PreDestroy — method called during container.dispose().
|
|
360
|
+
* Called BEFORE Disposable.dispose() (EC-3).
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* @Injectable()
|
|
365
|
+
* class DbConnection {
|
|
366
|
+
* @PreDestroy
|
|
367
|
+
* async close() {
|
|
368
|
+
* await this.pool.end()
|
|
369
|
+
* }
|
|
370
|
+
* }
|
|
371
|
+
* ```
|
|
372
|
+
*/
|
|
373
|
+
declare function PreDestroy(target: object, propertyKey: string | symbol): void;
|
|
374
|
+
|
|
319
375
|
/**
|
|
320
376
|
* Module declaration shape accepted by `@Module({...})`.
|
|
321
377
|
*
|
|
@@ -361,6 +417,42 @@ declare function Module(metadata: ModuleMetadata): ClassDecorator;
|
|
|
361
417
|
*/
|
|
362
418
|
declare function Optional(): ParameterDecorator;
|
|
363
419
|
|
|
420
|
+
/**
|
|
421
|
+
* @Primary — class decorator marking a provider as the default
|
|
422
|
+
* when multiple implementations exist for the same token.
|
|
423
|
+
*
|
|
424
|
+
* Resolution priority: @Qualifier > @Primary > error
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* ```ts
|
|
428
|
+
* @Injectable()
|
|
429
|
+
* @Primary
|
|
430
|
+
* class StripePayments implements PaymentGateway { ... }
|
|
431
|
+
*
|
|
432
|
+
* @Injectable()
|
|
433
|
+
* class PayPalPayments implements PaymentGateway { ... }
|
|
434
|
+
*
|
|
435
|
+
* // Without @Qualifier, StripePayments is resolved (it's @Primary)
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
declare function Primary(target: Function): void;
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* @Qualifier(name) — parameter decorator for disambiguation.
|
|
442
|
+
*
|
|
443
|
+
* When multiple providers match the same token, @Qualifier narrows
|
|
444
|
+
* the selection to the provider registered with that qualifier name.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```ts
|
|
448
|
+
* @Injectable()
|
|
449
|
+
* class OrderService {
|
|
450
|
+
* constructor(@Qualifier('stripe') private payments: PaymentGateway) {}
|
|
451
|
+
* }
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
declare function Qualifier(name: string): ParameterDecorator;
|
|
455
|
+
|
|
364
456
|
/**
|
|
365
457
|
* Typed error classes. All container failure modes use these — never
|
|
366
458
|
* `throw new Error(...)` from production code (per system type-safety rule).
|
|
@@ -462,6 +554,63 @@ declare class ReflectMetadataMissingError extends Error {
|
|
|
462
554
|
constructor();
|
|
463
555
|
}
|
|
464
556
|
|
|
557
|
+
/**
|
|
558
|
+
* Single source of truth for the metadata keys our decorators write and
|
|
559
|
+
* the container reads. Keeping them here means container.ts and
|
|
560
|
+
* decorators/*.ts agree on the wire format.
|
|
561
|
+
*/
|
|
562
|
+
|
|
563
|
+
declare const METADATA_KEYS: {
|
|
564
|
+
/** Marker that a class was decorated with `@Injectable()`. */
|
|
565
|
+
readonly INJECTABLE: "usetheo:di:injectable";
|
|
566
|
+
/** Map<number, Token> from `@Inject(token)` parameter decorators. */
|
|
567
|
+
readonly INJECT_TOKENS: "usetheo:di:inject-tokens";
|
|
568
|
+
/** Set<number> from `@Optional()` parameter decorators. */
|
|
569
|
+
readonly OPTIONAL_FLAGS: "usetheo:di:optional";
|
|
570
|
+
/** TS-emitted constructor parameter types (requires `emitDecoratorMetadata`). */
|
|
571
|
+
readonly DESIGN_PARAMTYPES: "design:paramtypes";
|
|
572
|
+
/** Map<number, string> from `@Qualifier(name)` parameter decorators. */
|
|
573
|
+
readonly QUALIFIER_NAMES: "usetheo:di:qualifier-names";
|
|
574
|
+
/** boolean from `@Primary` class decorator. */
|
|
575
|
+
readonly PRIMARY: "usetheo:di:primary";
|
|
576
|
+
/** string | symbol from `@PostConstruct` method decorator. */
|
|
577
|
+
readonly POST_CONSTRUCT: "usetheo:di:post-construct";
|
|
578
|
+
/** string | symbol from `@PreDestroy` method decorator. */
|
|
579
|
+
readonly PRE_DESTROY: "usetheo:di:pre-destroy";
|
|
580
|
+
/** Map<string|symbol, SandboxOptions> from `@UseSandbox()` property decorator. */
|
|
581
|
+
readonly SANDBOX: "usetheo:di:sandbox";
|
|
582
|
+
/** Map<string|symbol, SubAgentSpec> from `@SubAgent()` property decorator. */
|
|
583
|
+
readonly SUBAGENT: "usetheo:di:subagent";
|
|
584
|
+
/** Map<string|symbol, SquadMetadata> from `@Squad()` property decorator. */
|
|
585
|
+
readonly SQUAD: "usetheo:di:squad";
|
|
586
|
+
/** Map<string|symbol, StepMetadata> from `@Step()` method decorator. */
|
|
587
|
+
readonly STEP: "usetheo:di:step";
|
|
588
|
+
/** HitlOptions from `@Hitl()` method decorator. */
|
|
589
|
+
readonly HITL: "usetheo:di:hitl";
|
|
590
|
+
/** AutoSummarizeConfig from `@AutoSummarize()` class decorator. */
|
|
591
|
+
readonly AUTO_SUMMARIZE: "usetheo:di:auto-summarize";
|
|
592
|
+
/** Map<string|symbol, ToolOptions> from `@Tool()` property decorator. */
|
|
593
|
+
readonly TOOL: "usetheo:di:tool";
|
|
594
|
+
/** WorkflowOptions from `@Workflow()` class decorator. */
|
|
595
|
+
readonly WORKFLOW: "usetheo:di:workflow";
|
|
596
|
+
/** EvalOptions from `@Eval()` class decorator. */
|
|
597
|
+
readonly EVAL: "usetheo:di:eval";
|
|
598
|
+
/** CronMetadata from `@Cron()` method decorator. */
|
|
599
|
+
readonly CRON: "usetheo:di:cron";
|
|
600
|
+
/** Map<string|symbol, SubscriptionOptions> from `@Subscription()` property decorator. */
|
|
601
|
+
readonly SUBSCRIPTION: "usetheo:di:subscription";
|
|
602
|
+
/** AuthOptions from `@Auth()` class decorator. */
|
|
603
|
+
readonly AUTH: "usetheo:di:auth";
|
|
604
|
+
/** Map<string|symbol, RetrieverOptions> from `@Retriever()` property decorator. */
|
|
605
|
+
readonly RETRIEVER: "usetheo:di:retriever";
|
|
606
|
+
/** Map<string|symbol, RerankerOptions> from `@Reranker()` property decorator. */
|
|
607
|
+
readonly RERANKER: "usetheo:di:reranker";
|
|
608
|
+
/** Map<string|symbol, TextSplitterOptions> from `@TextSplitter()` property decorator. */
|
|
609
|
+
readonly TEXT_SPLITTER: "usetheo:di:text-splitter";
|
|
610
|
+
/** Map<string|symbol, MemoryScopeOptions> from `@MemoryScopeDecorator()` property decorator. */
|
|
611
|
+
readonly MEMORY_SCOPE: "usetheo:di:memory-scope";
|
|
612
|
+
};
|
|
613
|
+
|
|
465
614
|
/**
|
|
466
615
|
* Module-loader — walks @Module() classes in BFS order, registers their
|
|
467
616
|
* providers, validates imports + exports visibility, detects cyclic imports.
|
|
@@ -503,4 +652,4 @@ declare class CyclicModuleImportError extends Error {
|
|
|
503
652
|
constructor(cycle: ReadonlyArray<string>);
|
|
504
653
|
}
|
|
505
654
|
|
|
506
|
-
export { AsyncProviderInSyncResolveError, type ClassConstructor, type ClassProvider, Container, ContainerDisposedError, ContainerFrozenError, type ContainerOptions, CyclicDependencyError, CyclicModuleImportError, type DependencyGraph, type Disposable, type ExistingProvider, type FactoryProvider, Inject, Injectable, type InjectableOptions, InvalidExportError, InvalidModuleError, MissingInjectableError, Module, type ModuleMetadata, Optional, type Provider, ReflectMetadataMissingError, type ResolutionContext, Scope, ScopeViolationError, type Token, TokenNotFoundError, type ValueProvider, describeToken };
|
|
655
|
+
export { AsyncProviderInSyncResolveError, type ClassConstructor, type ClassProvider, Container, ContainerDisposedError, ContainerFrozenError, type ContainerOptions, CyclicDependencyError, CyclicModuleImportError, type DependencyGraph, type Disposable, type ExistingProvider, type FactoryProvider, Inject, Injectable, type InjectableOptions, InvalidExportError, InvalidModuleError, METADATA_KEYS, MissingInjectableError, Module, type ModuleMetadata, Optional, PostConstruct, PreDestroy, Primary, type Provider, Qualifier, ReflectMetadataMissingError, type ResolutionContext, Scope, ScopeViolationError, type Token, TokenNotFoundError, type ValueProvider, describeToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -137,6 +137,24 @@ interface GraphEdge {
|
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Lightweight DI container. See `README.md` for usage examples.
|
|
140
|
+
*
|
|
141
|
+
* **Auditor-acknowledged size (info-level):** the 2026-06-06 architecture
|
|
142
|
+
* audit (`/loop-architecture-review` Phase 3 principles-auditor) flagged
|
|
143
|
+
* this class as 812 LOC (above the 500 LOC heuristic file budget) under
|
|
144
|
+
* principle violation PV#10 (SRP / clean_function category, INFO severity).
|
|
145
|
+
* The auditor's own description annotates it as "large but justified DI
|
|
146
|
+
* orchestrator". The class is the Single-Point-of-Truth for DI resolution:
|
|
147
|
+
* registry lookup, lifecycle (SINGLETON/TRANSIENT/REQUEST), `@Injectable`
|
|
148
|
+
* metadata read, alias resolution, request-scope ALS propagation, and
|
|
149
|
+
* dispose chain. Splitting these concerns into separate classes would
|
|
150
|
+
* fragment cohesion and force consumers to coordinate across an internal
|
|
151
|
+
* micro-interface that adds no testability or extensibility per
|
|
152
|
+
* `rules/architecture.md § 3` (module cohesion) + KISS / YAGNI. ADR D422
|
|
153
|
+
* documents an ongoing Extract-Method refactor targeting individual long
|
|
154
|
+
* methods (not class-level split). Plan `arch-review-fixes-2026-06-06`
|
|
155
|
+
* T11.2 documents this trade-off; audit DB row `principle_violations.id=10`
|
|
156
|
+
* @ `packages/di/src/container.ts:87`; report at
|
|
157
|
+
* `architecture-output/final_report.md § Findings by dimension` PV#10.
|
|
140
158
|
*/
|
|
141
159
|
declare class Container {
|
|
142
160
|
private readonly registrations;
|
|
@@ -316,6 +334,44 @@ interface InjectableOptions {
|
|
|
316
334
|
*/
|
|
317
335
|
declare function Injectable(options?: InjectableOptions): ClassDecorator;
|
|
318
336
|
|
|
337
|
+
/**
|
|
338
|
+
* @PostConstruct — method called after DI resolution completes.
|
|
339
|
+
* All constructor dependencies are injected before this method runs.
|
|
340
|
+
*
|
|
341
|
+
* Supports async methods (EC-1): if the method returns a Promise,
|
|
342
|
+
* the Container awaits it before returning the instance.
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```ts
|
|
346
|
+
* @Injectable()
|
|
347
|
+
* class CacheService {
|
|
348
|
+
* private cache!: Map<string, unknown>
|
|
349
|
+
*
|
|
350
|
+
* @PostConstruct
|
|
351
|
+
* async init() {
|
|
352
|
+
* this.cache = await loadCacheFromRedis()
|
|
353
|
+
* }
|
|
354
|
+
* }
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
declare function PostConstruct(target: object, propertyKey: string | symbol): void;
|
|
358
|
+
/**
|
|
359
|
+
* @PreDestroy — method called during container.dispose().
|
|
360
|
+
* Called BEFORE Disposable.dispose() (EC-3).
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* @Injectable()
|
|
365
|
+
* class DbConnection {
|
|
366
|
+
* @PreDestroy
|
|
367
|
+
* async close() {
|
|
368
|
+
* await this.pool.end()
|
|
369
|
+
* }
|
|
370
|
+
* }
|
|
371
|
+
* ```
|
|
372
|
+
*/
|
|
373
|
+
declare function PreDestroy(target: object, propertyKey: string | symbol): void;
|
|
374
|
+
|
|
319
375
|
/**
|
|
320
376
|
* Module declaration shape accepted by `@Module({...})`.
|
|
321
377
|
*
|
|
@@ -361,6 +417,42 @@ declare function Module(metadata: ModuleMetadata): ClassDecorator;
|
|
|
361
417
|
*/
|
|
362
418
|
declare function Optional(): ParameterDecorator;
|
|
363
419
|
|
|
420
|
+
/**
|
|
421
|
+
* @Primary — class decorator marking a provider as the default
|
|
422
|
+
* when multiple implementations exist for the same token.
|
|
423
|
+
*
|
|
424
|
+
* Resolution priority: @Qualifier > @Primary > error
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* ```ts
|
|
428
|
+
* @Injectable()
|
|
429
|
+
* @Primary
|
|
430
|
+
* class StripePayments implements PaymentGateway { ... }
|
|
431
|
+
*
|
|
432
|
+
* @Injectable()
|
|
433
|
+
* class PayPalPayments implements PaymentGateway { ... }
|
|
434
|
+
*
|
|
435
|
+
* // Without @Qualifier, StripePayments is resolved (it's @Primary)
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
declare function Primary(target: Function): void;
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* @Qualifier(name) — parameter decorator for disambiguation.
|
|
442
|
+
*
|
|
443
|
+
* When multiple providers match the same token, @Qualifier narrows
|
|
444
|
+
* the selection to the provider registered with that qualifier name.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```ts
|
|
448
|
+
* @Injectable()
|
|
449
|
+
* class OrderService {
|
|
450
|
+
* constructor(@Qualifier('stripe') private payments: PaymentGateway) {}
|
|
451
|
+
* }
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
declare function Qualifier(name: string): ParameterDecorator;
|
|
455
|
+
|
|
364
456
|
/**
|
|
365
457
|
* Typed error classes. All container failure modes use these — never
|
|
366
458
|
* `throw new Error(...)` from production code (per system type-safety rule).
|
|
@@ -462,6 +554,63 @@ declare class ReflectMetadataMissingError extends Error {
|
|
|
462
554
|
constructor();
|
|
463
555
|
}
|
|
464
556
|
|
|
557
|
+
/**
|
|
558
|
+
* Single source of truth for the metadata keys our decorators write and
|
|
559
|
+
* the container reads. Keeping them here means container.ts and
|
|
560
|
+
* decorators/*.ts agree on the wire format.
|
|
561
|
+
*/
|
|
562
|
+
|
|
563
|
+
declare const METADATA_KEYS: {
|
|
564
|
+
/** Marker that a class was decorated with `@Injectable()`. */
|
|
565
|
+
readonly INJECTABLE: "usetheo:di:injectable";
|
|
566
|
+
/** Map<number, Token> from `@Inject(token)` parameter decorators. */
|
|
567
|
+
readonly INJECT_TOKENS: "usetheo:di:inject-tokens";
|
|
568
|
+
/** Set<number> from `@Optional()` parameter decorators. */
|
|
569
|
+
readonly OPTIONAL_FLAGS: "usetheo:di:optional";
|
|
570
|
+
/** TS-emitted constructor parameter types (requires `emitDecoratorMetadata`). */
|
|
571
|
+
readonly DESIGN_PARAMTYPES: "design:paramtypes";
|
|
572
|
+
/** Map<number, string> from `@Qualifier(name)` parameter decorators. */
|
|
573
|
+
readonly QUALIFIER_NAMES: "usetheo:di:qualifier-names";
|
|
574
|
+
/** boolean from `@Primary` class decorator. */
|
|
575
|
+
readonly PRIMARY: "usetheo:di:primary";
|
|
576
|
+
/** string | symbol from `@PostConstruct` method decorator. */
|
|
577
|
+
readonly POST_CONSTRUCT: "usetheo:di:post-construct";
|
|
578
|
+
/** string | symbol from `@PreDestroy` method decorator. */
|
|
579
|
+
readonly PRE_DESTROY: "usetheo:di:pre-destroy";
|
|
580
|
+
/** Map<string|symbol, SandboxOptions> from `@UseSandbox()` property decorator. */
|
|
581
|
+
readonly SANDBOX: "usetheo:di:sandbox";
|
|
582
|
+
/** Map<string|symbol, SubAgentSpec> from `@SubAgent()` property decorator. */
|
|
583
|
+
readonly SUBAGENT: "usetheo:di:subagent";
|
|
584
|
+
/** Map<string|symbol, SquadMetadata> from `@Squad()` property decorator. */
|
|
585
|
+
readonly SQUAD: "usetheo:di:squad";
|
|
586
|
+
/** Map<string|symbol, StepMetadata> from `@Step()` method decorator. */
|
|
587
|
+
readonly STEP: "usetheo:di:step";
|
|
588
|
+
/** HitlOptions from `@Hitl()` method decorator. */
|
|
589
|
+
readonly HITL: "usetheo:di:hitl";
|
|
590
|
+
/** AutoSummarizeConfig from `@AutoSummarize()` class decorator. */
|
|
591
|
+
readonly AUTO_SUMMARIZE: "usetheo:di:auto-summarize";
|
|
592
|
+
/** Map<string|symbol, ToolOptions> from `@Tool()` property decorator. */
|
|
593
|
+
readonly TOOL: "usetheo:di:tool";
|
|
594
|
+
/** WorkflowOptions from `@Workflow()` class decorator. */
|
|
595
|
+
readonly WORKFLOW: "usetheo:di:workflow";
|
|
596
|
+
/** EvalOptions from `@Eval()` class decorator. */
|
|
597
|
+
readonly EVAL: "usetheo:di:eval";
|
|
598
|
+
/** CronMetadata from `@Cron()` method decorator. */
|
|
599
|
+
readonly CRON: "usetheo:di:cron";
|
|
600
|
+
/** Map<string|symbol, SubscriptionOptions> from `@Subscription()` property decorator. */
|
|
601
|
+
readonly SUBSCRIPTION: "usetheo:di:subscription";
|
|
602
|
+
/** AuthOptions from `@Auth()` class decorator. */
|
|
603
|
+
readonly AUTH: "usetheo:di:auth";
|
|
604
|
+
/** Map<string|symbol, RetrieverOptions> from `@Retriever()` property decorator. */
|
|
605
|
+
readonly RETRIEVER: "usetheo:di:retriever";
|
|
606
|
+
/** Map<string|symbol, RerankerOptions> from `@Reranker()` property decorator. */
|
|
607
|
+
readonly RERANKER: "usetheo:di:reranker";
|
|
608
|
+
/** Map<string|symbol, TextSplitterOptions> from `@TextSplitter()` property decorator. */
|
|
609
|
+
readonly TEXT_SPLITTER: "usetheo:di:text-splitter";
|
|
610
|
+
/** Map<string|symbol, MemoryScopeOptions> from `@MemoryScopeDecorator()` property decorator. */
|
|
611
|
+
readonly MEMORY_SCOPE: "usetheo:di:memory-scope";
|
|
612
|
+
};
|
|
613
|
+
|
|
465
614
|
/**
|
|
466
615
|
* Module-loader — walks @Module() classes in BFS order, registers their
|
|
467
616
|
* providers, validates imports + exports visibility, detects cyclic imports.
|
|
@@ -503,4 +652,4 @@ declare class CyclicModuleImportError extends Error {
|
|
|
503
652
|
constructor(cycle: ReadonlyArray<string>);
|
|
504
653
|
}
|
|
505
654
|
|
|
506
|
-
export { AsyncProviderInSyncResolveError, type ClassConstructor, type ClassProvider, Container, ContainerDisposedError, ContainerFrozenError, type ContainerOptions, CyclicDependencyError, CyclicModuleImportError, type DependencyGraph, type Disposable, type ExistingProvider, type FactoryProvider, Inject, Injectable, type InjectableOptions, InvalidExportError, InvalidModuleError, MissingInjectableError, Module, type ModuleMetadata, Optional, type Provider, ReflectMetadataMissingError, type ResolutionContext, Scope, ScopeViolationError, type Token, TokenNotFoundError, type ValueProvider, describeToken };
|
|
655
|
+
export { AsyncProviderInSyncResolveError, type ClassConstructor, type ClassProvider, Container, ContainerDisposedError, ContainerFrozenError, type ContainerOptions, CyclicDependencyError, CyclicModuleImportError, type DependencyGraph, type Disposable, type ExistingProvider, type FactoryProvider, Inject, Injectable, type InjectableOptions, InvalidExportError, InvalidModuleError, METADATA_KEYS, MissingInjectableError, Module, type ModuleMetadata, Optional, PostConstruct, PreDestroy, Primary, type Provider, Qualifier, ReflectMetadataMissingError, type ResolutionContext, Scope, ScopeViolationError, type Token, TokenNotFoundError, type ValueProvider, describeToken };
|
package/dist/index.js
CHANGED
|
@@ -188,7 +188,47 @@ var METADATA_KEYS = {
|
|
|
188
188
|
/** Set<number> from `@Optional()` parameter decorators. */
|
|
189
189
|
OPTIONAL_FLAGS: "usetheo:di:optional",
|
|
190
190
|
/** TS-emitted constructor parameter types (requires `emitDecoratorMetadata`). */
|
|
191
|
-
DESIGN_PARAMTYPES: "design:paramtypes"
|
|
191
|
+
DESIGN_PARAMTYPES: "design:paramtypes",
|
|
192
|
+
/** Map<number, string> from `@Qualifier(name)` parameter decorators. */
|
|
193
|
+
QUALIFIER_NAMES: "usetheo:di:qualifier-names",
|
|
194
|
+
/** boolean from `@Primary` class decorator. */
|
|
195
|
+
PRIMARY: "usetheo:di:primary",
|
|
196
|
+
/** string | symbol from `@PostConstruct` method decorator. */
|
|
197
|
+
POST_CONSTRUCT: "usetheo:di:post-construct",
|
|
198
|
+
/** string | symbol from `@PreDestroy` method decorator. */
|
|
199
|
+
PRE_DESTROY: "usetheo:di:pre-destroy",
|
|
200
|
+
/** Map<string|symbol, SandboxOptions> from `@UseSandbox()` property decorator. */
|
|
201
|
+
SANDBOX: "usetheo:di:sandbox",
|
|
202
|
+
/** Map<string|symbol, SubAgentSpec> from `@SubAgent()` property decorator. */
|
|
203
|
+
SUBAGENT: "usetheo:di:subagent",
|
|
204
|
+
/** Map<string|symbol, SquadMetadata> from `@Squad()` property decorator. */
|
|
205
|
+
SQUAD: "usetheo:di:squad",
|
|
206
|
+
/** Map<string|symbol, StepMetadata> from `@Step()` method decorator. */
|
|
207
|
+
STEP: "usetheo:di:step",
|
|
208
|
+
/** HitlOptions from `@Hitl()` method decorator. */
|
|
209
|
+
HITL: "usetheo:di:hitl",
|
|
210
|
+
/** AutoSummarizeConfig from `@AutoSummarize()` class decorator. */
|
|
211
|
+
AUTO_SUMMARIZE: "usetheo:di:auto-summarize",
|
|
212
|
+
/** Map<string|symbol, ToolOptions> from `@Tool()` property decorator. */
|
|
213
|
+
TOOL: "usetheo:di:tool",
|
|
214
|
+
/** WorkflowOptions from `@Workflow()` class decorator. */
|
|
215
|
+
WORKFLOW: "usetheo:di:workflow",
|
|
216
|
+
/** EvalOptions from `@Eval()` class decorator. */
|
|
217
|
+
EVAL: "usetheo:di:eval",
|
|
218
|
+
/** CronMetadata from `@Cron()` method decorator. */
|
|
219
|
+
CRON: "usetheo:di:cron",
|
|
220
|
+
/** Map<string|symbol, SubscriptionOptions> from `@Subscription()` property decorator. */
|
|
221
|
+
SUBSCRIPTION: "usetheo:di:subscription",
|
|
222
|
+
/** AuthOptions from `@Auth()` class decorator. */
|
|
223
|
+
AUTH: "usetheo:di:auth",
|
|
224
|
+
/** Map<string|symbol, RetrieverOptions> from `@Retriever()` property decorator. */
|
|
225
|
+
RETRIEVER: "usetheo:di:retriever",
|
|
226
|
+
/** Map<string|symbol, RerankerOptions> from `@Reranker()` property decorator. */
|
|
227
|
+
RERANKER: "usetheo:di:reranker",
|
|
228
|
+
/** Map<string|symbol, TextSplitterOptions> from `@TextSplitter()` property decorator. */
|
|
229
|
+
TEXT_SPLITTER: "usetheo:di:text-splitter",
|
|
230
|
+
/** Map<string|symbol, MemoryScopeOptions> from `@MemoryScopeDecorator()` property decorator. */
|
|
231
|
+
MEMORY_SCOPE: "usetheo:di:memory-scope"
|
|
192
232
|
};
|
|
193
233
|
function hasReflectMetadata() {
|
|
194
234
|
return typeof Reflect !== "undefined" && typeof Reflect.getMetadata === "function";
|
|
@@ -965,6 +1005,16 @@ function Injectable(options = {}) {
|
|
|
965
1005
|
}
|
|
966
1006
|
__name(Injectable, "Injectable");
|
|
967
1007
|
|
|
1008
|
+
// src/decorators/lifecycle.ts
|
|
1009
|
+
function PostConstruct(target, propertyKey) {
|
|
1010
|
+
Reflect.defineMetadata(METADATA_KEYS.POST_CONSTRUCT, propertyKey, target.constructor);
|
|
1011
|
+
}
|
|
1012
|
+
__name(PostConstruct, "PostConstruct");
|
|
1013
|
+
function PreDestroy(target, propertyKey) {
|
|
1014
|
+
Reflect.defineMetadata(METADATA_KEYS.PRE_DESTROY, propertyKey, target.constructor);
|
|
1015
|
+
}
|
|
1016
|
+
__name(PreDestroy, "PreDestroy");
|
|
1017
|
+
|
|
968
1018
|
// src/decorators/optional.ts
|
|
969
1019
|
function Optional() {
|
|
970
1020
|
return (target, _propertyKey, parameterIndex) => {
|
|
@@ -976,6 +1026,22 @@ function Optional() {
|
|
|
976
1026
|
}
|
|
977
1027
|
__name(Optional, "Optional");
|
|
978
1028
|
|
|
979
|
-
|
|
1029
|
+
// src/decorators/primary.ts
|
|
1030
|
+
function Primary(target) {
|
|
1031
|
+
Reflect.defineMetadata(METADATA_KEYS.PRIMARY, true, target);
|
|
1032
|
+
}
|
|
1033
|
+
__name(Primary, "Primary");
|
|
1034
|
+
|
|
1035
|
+
// src/decorators/qualifier.ts
|
|
1036
|
+
function Qualifier(name) {
|
|
1037
|
+
return (target, _propertyKey, parameterIndex) => {
|
|
1038
|
+
const existing = Reflect.getMetadata(METADATA_KEYS.QUALIFIER_NAMES, target) ?? /* @__PURE__ */ new Map();
|
|
1039
|
+
existing.set(parameterIndex, name);
|
|
1040
|
+
Reflect.defineMetadata(METADATA_KEYS.QUALIFIER_NAMES, existing, target);
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
__name(Qualifier, "Qualifier");
|
|
1044
|
+
|
|
1045
|
+
export { AsyncProviderInSyncResolveError, Container, ContainerDisposedError, ContainerFrozenError, CyclicDependencyError, CyclicModuleImportError, Inject, Injectable, InvalidExportError, InvalidModuleError, METADATA_KEYS, MissingInjectableError, Module, Optional, PostConstruct, PreDestroy, Primary, Qualifier, ReflectMetadataMissingError, Scope, ScopeViolationError, TokenNotFoundError, describeToken };
|
|
980
1046
|
//# sourceMappingURL=index.js.map
|
|
981
1047
|
//# sourceMappingURL=index.js.map
|