New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@discordx/di

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@discordx/di - npm Package Compare versions

Comparing version 3.0.3 to 3.1.0

4

build/cjs/logic/impl/TsyringeDependencyRegistryEngine.d.ts

@@ -5,3 +5,3 @@ import type { DependencyContainer } from "tsyringe";

export declare class TsyringeDependencyRegistryEngine extends AbstractConfigurableDependencyInjector<DependencyContainer> {
static readonly token: unique symbol;
static token: symbol;
private static _instance;

@@ -12,2 +12,4 @@ static get instance(): TsyringeDependencyRegistryEngine;

getAllServices(): Set<unknown>;
setToken(token: symbol): this;
private getInstanceCashingSingletonFactory;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TsyringeDependencyRegistryEngine = void 0;
const tsyringe_1 = require("tsyringe");
const AbstractConfigurableDependencyInjector_js_1 = require("../AbstractConfigurableDependencyInjector.js");

@@ -19,9 +20,13 @@ class TsyringeDependencyRegistryEngine extends AbstractConfigurableDependencyInjector_js_1.AbstractConfigurableDependencyInjector {

}
this._serviceSet.add(classType);
const clazz = classType;
const instanceCashingSingletonFactory = this.getInstanceCashingSingletonFactory(clazz);
if (this.useToken) {
this.injector.registerSingleton(TsyringeDependencyRegistryEngine.token, clazz);
return;
this.injector.register(TsyringeDependencyRegistryEngine.token, {
useFactory: instanceCashingSingletonFactory,
});
}
this._serviceSet.add(classType);
this.injector.registerSingleton(clazz);
else {
this.injector.registerSingleton(clazz);
}
}

@@ -33,3 +38,3 @@ getService(classType) {

const clazz = classType;
if (this.useToken) {
if (this.useToken && !tsyringe_1.container.isRegistered(clazz)) {
return (this.injector

@@ -54,4 +59,16 @@ .resolveAll(TsyringeDependencyRegistryEngine.token)

}
setToken(token) {
TsyringeDependencyRegistryEngine.token = token;
return this;
}
getInstanceCashingSingletonFactory(clazz) {
return (0, tsyringe_1.instanceCachingFactory)((c) => {
if (!c.isRegistered(clazz)) {
c.registerSingleton(clazz);
}
return c.resolve(clazz);
});
}
}
exports.TsyringeDependencyRegistryEngine = TsyringeDependencyRegistryEngine;
//# sourceMappingURL=TsyringeDependencyRegistryEngine.js.map

@@ -6,3 +6,3 @@ import type { Container, Service } from "typedi";

export declare class TypeDiDependencyRegistryEngine extends AbstractConfigurableDependencyInjector<typeof Container> {
static readonly token: Token<unknown>;
static token: Token<unknown>;
private static _instance;

@@ -13,4 +13,5 @@ private service;

setService(service: typeof Service): this;
setToken<T>(token: Token<T>): this;
getAllServices(): Set<unknown>;
getService<T>(classType: T): InstanceOf<T> | null;
}

@@ -37,2 +37,6 @@ "use strict";

}
setToken(token) {
TypeDiDependencyRegistryEngine.token = token;
return this;
}
getAllServices() {

@@ -39,0 +43,0 @@ if (!this.injector) {

@@ -12,3 +12,3 @@ import { DefaultDependencyRegistryEngine, TsyringeDependencyRegistryEngine, TypeDiDependencyRegistryEngine, } from "./logic/impl/index.js";

*/
export class DIService {
class DIService {
static _diEngineToUse = defaultDependencyRegistryEngine;

@@ -51,2 +51,3 @@ static _instance;

}
export { DIService };
//# sourceMappingURL=index.js.map

@@ -5,3 +5,3 @@ import type { DependencyContainer } from "tsyringe";

export declare class TsyringeDependencyRegistryEngine extends AbstractConfigurableDependencyInjector<DependencyContainer> {
static readonly token: unique symbol;
static token: symbol;
private static _instance;

@@ -12,2 +12,4 @@ static get instance(): TsyringeDependencyRegistryEngine;

getAllServices(): Set<unknown>;
setToken(token: symbol): this;
private getInstanceCashingSingletonFactory;
}

@@ -0,3 +1,4 @@

import { container, instanceCachingFactory } from "tsyringe";
import { AbstractConfigurableDependencyInjector } from "../AbstractConfigurableDependencyInjector.js";
export class TsyringeDependencyRegistryEngine extends AbstractConfigurableDependencyInjector {
class TsyringeDependencyRegistryEngine extends AbstractConfigurableDependencyInjector {
static token = Symbol("discordx");

@@ -16,9 +17,13 @@ static _instance;

}
this._serviceSet.add(classType);
const clazz = classType;
const instanceCashingSingletonFactory = this.getInstanceCashingSingletonFactory(clazz);
if (this.useToken) {
this.injector.registerSingleton(TsyringeDependencyRegistryEngine.token, clazz);
return;
this.injector.register(TsyringeDependencyRegistryEngine.token, {
useFactory: instanceCashingSingletonFactory,
});
}
this._serviceSet.add(classType);
this.injector.registerSingleton(clazz);
else {
this.injector.registerSingleton(clazz);
}
}

@@ -30,3 +35,3 @@ getService(classType) {

const clazz = classType;
if (this.useToken) {
if (this.useToken && !container.isRegistered(clazz)) {
return (this.injector

@@ -51,3 +56,16 @@ .resolveAll(TsyringeDependencyRegistryEngine.token)

}
setToken(token) {
TsyringeDependencyRegistryEngine.token = token;
return this;
}
getInstanceCashingSingletonFactory(clazz) {
return instanceCachingFactory((c) => {
if (!c.isRegistered(clazz)) {
c.registerSingleton(clazz);
}
return c.resolve(clazz);
});
}
}
export { TsyringeDependencyRegistryEngine };
//# sourceMappingURL=TsyringeDependencyRegistryEngine.js.map

@@ -6,3 +6,3 @@ import type { Container, Service } from "typedi";

export declare class TypeDiDependencyRegistryEngine extends AbstractConfigurableDependencyInjector<typeof Container> {
static readonly token: Token<unknown>;
static token: Token<unknown>;
private static _instance;

@@ -13,4 +13,5 @@ private service;

setService(service: typeof Service): this;
setToken<T>(token: Token<T>): this;
getAllServices(): Set<unknown>;
getService<T>(classType: T): InstanceOf<T> | null;
}
import { Token } from "typedi";
import { AbstractConfigurableDependencyInjector } from "../AbstractConfigurableDependencyInjector.js";
export class TypeDiDependencyRegistryEngine extends AbstractConfigurableDependencyInjector {
class TypeDiDependencyRegistryEngine extends AbstractConfigurableDependencyInjector {
static token = new Token("discordx");

@@ -34,2 +34,6 @@ static _instance;

}
setToken(token) {
TypeDiDependencyRegistryEngine.token = token;
return this;
}
getAllServices() {

@@ -61,2 +65,3 @@ if (!this.injector) {

}
export { TypeDiDependencyRegistryEngine };
//# sourceMappingURL=TypeDiDependencyRegistryEngine.js.map

@@ -0,6 +1,13 @@

# [3.1.0](https://github.com/discordx-ts/discordx/releases/tag/di-3.1.0) (2023-05-05)
## Changed
- dep update + tsyringe example ([#938](https://github.com/discordx-ts/discordx/issues/938)) ([6f0b98](https://github.com/discordx-ts/discordx/commit/6f0b98b511c5f2e5c95e318aa02d0f62b28e768a))
- update DefaultDependencyRegistryEngine.ts ([#908](https://github.com/discordx-ts/discordx/issues/908)) ([36ad1b](https://github.com/discordx-ts/discordx/commit/36ad1b545244edc748101ef85b1f8dd093debffe))
- typescript bump ([3f1b3d](https://github.com/discordx-ts/discordx/commit/3f1b3df16b964e06956e319a05c4dd8bd2997a99))
## Routine Tasks
- fix tokenization injection ([#942](https://github.com/discordx-ts/discordx/issues/942)) ([1c118b](https://github.com/discordx-ts/discordx/commit/1c118bd8999d19f3bb21d307322228f4c47e39bb))
# [3.0.1](https://github.com/discordx-ts/discordx/releases/tag/di-3.0.1) (2022-08-07)

@@ -7,0 +14,0 @@

{
"name": "@discordx/di",
"version": "3.0.3",
"version": "3.1.0",
"private": false,

@@ -60,4 +60,4 @@ "description": "dependency injection service with TSyringe support",

"devDependencies": {
"@types/node": "^18.11.18",
"typescript": "4.9.4"
"@types/node": "^18.15.11",
"typescript": "5.0.4"
},

@@ -64,0 +64,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc