Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [7.10.0]

### Added
- Added `InjectFromBaseOptionsLifecycle`.
- Added `InjectFromHierarchyOptionsLifecycle`.

### Changed
- Updated `injectFromBase` with `lifecycle` property.
- Updated `injectFromHierarchy` with `lifecycle` property.

## [7.9.1]

### Changed
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"description": "A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.",
"dependencies": {
"@inversifyjs/common": "1.5.2",
"@inversifyjs/container": "1.12.7",
"@inversifyjs/core": "8.0.0"
"@inversifyjs/container": "1.13.0",
"@inversifyjs/core": "9.0.0"
},
"devEngines": {
"packageManager": {
Expand Down Expand Up @@ -89,5 +89,5 @@
"test:cjs": "nyc --reporter=lcov mocha lib/cjs/test/*.test.js lib/cjs/test/**/*.test.js --reporter spec"
},
"sideEffects": false,
"version": "7.9.1"
"version": "7.10.0"
}
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ export {
GetAllOptions,
GetOptions,
GetOptionsTagConstraint,
InjectFromBaseOptions,
InjectFromBaseOptionsLifecycle,
InjectFromHierarchyOptions,
InjectFromHierarchyOptionsLifecycle,
MetadataName,
MetadataTag,
MultiInjectOptions,
OptionalGetOptions,
// eslint-disable-next-line @typescript-eslint/no-deprecated
Provider,
ResolutionContext,
bindingScopeValues,
Expand Down
6 changes: 1 addition & 5 deletions src/test/annotation/post_construct.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ describe('@postConstruct', () => {
function setup() {
class Katana {
@postConstruct()
public testMethod1() {
/* ... */
}

@postConstruct()
public testMethod2() {
public testMethod1() {
/* ... */
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/test/bugs/issue_1297.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,24 @@ describe('Issue 1297', () => {
const container: Container = new Container();

const onActivationHandlerSpy: sinon.SinonSpy<
// eslint-disable-next-line @typescript-eslint/no-deprecated
[ResolutionContext, Provider<Katana>],
// eslint-disable-next-line @typescript-eslint/no-deprecated
Provider<Katana>
> = sinon.spy<
(
_: ResolutionContext,
// eslint-disable-next-line @typescript-eslint/no-deprecated
injectableObj: Provider<Katana>,
// eslint-disable-next-line @typescript-eslint/no-deprecated
) => Provider<Katana>
// eslint-disable-next-line @typescript-eslint/no-deprecated
>((_: ResolutionContext, injectableObj: Provider<Katana>) => injectableObj);

container
// eslint-disable-next-line @typescript-eslint/no-deprecated
.bind<Provider<Katana>>('Provider<Katana>')
// eslint-disable-next-line @typescript-eslint/no-deprecated
.toProvider(
(_context: ResolutionContext) => async () =>
Promise.resolve(new Katana()),
Expand Down
4 changes: 4 additions & 0 deletions src/test/features/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('Provider', () => {
const container: Container = new Container();

container.bind<Ninja>('Ninja').to(Ninja).inSingletonScope();
// eslint-disable-next-line @typescript-eslint/no-deprecated
container.bind<NinjaMasterProvider>('Provider<NinjaMaster>').toProvider(
(context: ResolutionContext) => async () =>
new Promise<NinjaMaster>(
Expand Down Expand Up @@ -109,8 +110,10 @@ describe('Provider', () => {

container.bind<Sword>('Sword').to(Katana);

// eslint-disable-next-line @typescript-eslint/no-deprecated
type SwordProvider = Provider<Sword, [string, number]>;

// eslint-disable-next-line @typescript-eslint/no-deprecated
container.bind<SwordProvider>('SwordProvider').toProvider(
(context: ResolutionContext): SwordProvider =>
async (material: string, damage: number) =>
Expand Down Expand Up @@ -162,6 +165,7 @@ describe('Provider', () => {

container.bind<Warrior>('Warrior').to(Ninja).inSingletonScope(); // Value is singleton!

// eslint-disable-next-line @typescript-eslint/no-deprecated
container.bind<WarriorProvider>('WarriorProvider').toProvider(
(context: ResolutionContext) => async (increaseLevel: number) =>
new Promise<Warrior>((resolve: (value: Warrior) => void) => {
Expand Down
1 change: 1 addition & 0 deletions src/test/inversify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,7 @@ describe('InversifyJS', () => {
container.bind<Ninja>('Ninja').to(NinjaWithProvider);
container.bind<Katana>('Katana').to(Katana);

// eslint-disable-next-line @typescript-eslint/no-deprecated
container.bind<KatanaProvider>('Provider<Katana>').toProvider(
(context: ResolutionContext) => async () =>
new Promise<Katana>((resolve: (value: Katana) => void) => {
Expand Down
Loading