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.2.0 to 3.3.0

6

CHANGELOG.md
# @discordx/di
## 3.3.0
### Minor Changes
- refactor: added clearAllServices method for engine and updated DIService to act as bridge for engine only
## 3.2.0

@@ -4,0 +10,0 @@

33

dist/index.d.ts

@@ -14,2 +14,6 @@ import { DependencyContainer, FactoryFunction } from 'tsyringe';

/**
* Clear all Discord service classes
*/
clearAllServices(): void;
/**
* Get all Discord service classes

@@ -31,4 +35,5 @@ * @returns {Set<unknown>}

static get instance(): DefaultDependencyRegistryEngine;
addService<T>(classType: T): void;
clearAllServices(): void;
getAllServices(): Set<unknown>;
addService<T>(classType: T): void;
getService<T>(classType: T): InstanceOf<T>;

@@ -44,2 +49,3 @@ }

abstract addService<T>(classType: T): void;
abstract clearAllServices(): void;
abstract getAllServices(): Set<unknown>;

@@ -56,2 +62,3 @@ abstract getService<T>(classType: T): InstanceOf<T> | null;

addService<T>(classType: T): void;
clearAllServices(): void;
getService<T>(classType: T): InstanceOf<T> | null;

@@ -70,2 +77,3 @@ getAllServices(): Set<unknown>;

addService<T>(classType: T): void;
clearAllServices(): void;
setService(service: typeof Service): this;

@@ -87,25 +95,12 @@ setToken<T>(token: Token<T>): this;

declare class DIService {
private static _diEngineToUse;
private static _instance;
private static _engine;
static get engine(): IDependencyRegistryEngine;
static set engine(engine: IDependencyRegistryEngine);
static get instance(): DIService;
/**
* Get all Discord service classes
* @returns {Set<unknown>}
* @deprecated use DIService.engine instead
*/
static get allServices(): Set<unknown>;
/**
* Add a service from the IOC container.
* @param {T} classType - The type of service to add
*/
addService<T>(classType: T): void;
/**
* Get a service from the IOC container
* @param {T} classType - the Class of the service to retrieve
* @returns {InstanceOf<T> | null} the instance of this service or null if there is no instance
*/
getService<T>(classType: T): InstanceOf<T> | null;
static get instance(): IDependencyRegistryEngine;
private constructor();
}
export { AbstractConfigurableDependencyInjector, DIService, DefaultDependencyRegistryEngine, IDependencyRegistryEngine, InstanceOf, TsyringeDependencyRegistryEngine, TypeDiDependencyRegistryEngine, defaultDependencyRegistryEngine, tsyringeDependencyRegistryEngine, typeDiDependencyRegistryEngine };
export { AbstractConfigurableDependencyInjector, DIService, DefaultDependencyRegistryEngine, type IDependencyRegistryEngine, type InstanceOf, TsyringeDependencyRegistryEngine, TypeDiDependencyRegistryEngine, defaultDependencyRegistryEngine, tsyringeDependencyRegistryEngine, typeDiDependencyRegistryEngine };

@@ -44,5 +44,2 @@ "use strict";

}
getAllServices() {
return new Set(this._services.values());
}
addService(classType) {

@@ -53,2 +50,8 @@ const clazz = classType;

}
clearAllServices() {
this._services.clear();
}
getAllServices() {
return new Set(this._services.values());
}
getService(classType) {

@@ -103,2 +106,8 @@ return this._services.get(classType);

}
clearAllServices() {
if (!this.injector) {
throw new Error("Please set the container!");
}
this.injector.clearInstances();
}
getService(classType) {

@@ -179,2 +188,8 @@ if (!this.injector) {

}
clearAllServices() {
if (!this.injector) {
throw new Error("Please set the Service!");
}
this.injector.reset();
}
setService(service) {

@@ -221,38 +236,17 @@ this.service = service;

var DIService = class _DIService {
static _diEngineToUse = defaultDependencyRegistryEngine;
static _instance;
static _engine = defaultDependencyRegistryEngine;
static get engine() {
return _DIService._diEngineToUse;
return _DIService._engine;
}
static set engine(engine) {
_DIService._diEngineToUse = engine;
_DIService._engine = engine;
}
static get instance() {
if (!this._instance) {
this._instance = new _DIService();
}
return this._instance;
}
/**
* Get all Discord service classes
* @returns {Set<unknown>}
* @deprecated use DIService.engine instead
*/
static get allServices() {
return _DIService.engine.getAllServices();
static get instance() {
return this.engine;
}
/**
* Add a service from the IOC container.
* @param {T} classType - The type of service to add
*/
addService(classType) {
_DIService.engine.addService(classType);
constructor() {
}
/**
* Get a service from the IOC container
* @param {T} classType - the Class of the service to retrieve
* @returns {InstanceOf<T> | null} the instance of this service or null if there is no instance
*/
getService(classType) {
return _DIService.engine.getService(classType);
}
};

@@ -259,0 +253,0 @@ // Annotate the CommonJS export names for ESM import in node:

{
"name": "@discordx/di",
"version": "3.2.0",
"version": "3.3.0",
"private": false,

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

"devDependencies": {
"@types/node": "^20.8.10",
"typescript": "5.2.2"
"@types/node": "^20.10.1",
"typescript": "5.3.2"
},

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

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