Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@deboxsoft/module-core

Package Overview
Dependencies
Maintainers
1
Versions
280
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deboxsoft/module-core - npm Package Compare versions

Comparing version 1.6.2-7 to 1.7.0-0

types/di/constant.d.ts

64

index.cjs.js

@@ -45,2 +45,65 @@ 'use strict';

class ServiceNotFoundError extends DeboxError {
constructor(identifier) {
super();
this.name = "ServiceNotFoundError";
this.normalizedIdentifier = "<UNKNOWN_IDENTIFIER>";
if (typeof identifier === "string") {
this.normalizedIdentifier = identifier;
}
}
get message() {
return `Service with "${this.normalizedIdentifier}" identifier was not found in the container. Register it before usage via explicitly calling the "Container.set"`;
}
}
class ContainerDI {
constructor() {
this.metadataMap = new Map();
this.disposed = false;
}
has(identifier) {
return !!this.metadataMap.has(identifier);
}
get(identifier) {
const value = this.metadataMap.get(identifier);
if (!this.metadataMap.has(identifier)) {
throw new ServiceNotFoundError(identifier);
}
return value;
}
set(id, value) {
this.metadataMap.set(id, value);
return this;
}
remove(identifierOrIdentifierArray) {
if (Array.isArray(identifierOrIdentifierArray)) {
identifierOrIdentifierArray.forEach((id) => this.remove(id));
} else {
const serviceMetadata = this.metadataMap.get(identifierOrIdentifierArray);
if (serviceMetadata) {
this.metadataMap.delete(identifierOrIdentifierArray);
}
}
return this;
}
reset() {
this.metadataMap = new Map();
}
initializeParams(target, paramTypes) {
return paramTypes.map((paramType, index) => {
if (paramType && paramType.name && !ContainerDI.isPrimitiveParamType(paramType.name)) {
return this.get(paramType);
}
return void 0;
});
}
static isPrimitiveParamType(paramTypeName) {
return ["string", "boolean", "number", "object"].includes(paramTypeName.toLowerCase());
}
}
const container = new ContainerDI();
const Container = container;
function isObject(val) {

@@ -373,2 +436,3 @@ return val != null && typeof val === "object" && Array.isArray(val) === false;

exports.CONFIG_KEY = CONFIG_KEY;
exports.Container = Container;
exports.DeboxError = DeboxError;

@@ -375,0 +439,0 @@ exports.LOGGER_KEY = LOGGER_KEY;

65

index.js

@@ -18,2 +18,65 @@ import * as changeCase from 'change-case';

class ServiceNotFoundError extends DeboxError {
constructor(identifier) {
super();
this.name = "ServiceNotFoundError";
this.normalizedIdentifier = "<UNKNOWN_IDENTIFIER>";
if (typeof identifier === "string") {
this.normalizedIdentifier = identifier;
}
}
get message() {
return `Service with "${this.normalizedIdentifier}" identifier was not found in the container. Register it before usage via explicitly calling the "Container.set"`;
}
}
class ContainerDI {
constructor() {
this.metadataMap = new Map();
this.disposed = false;
}
has(identifier) {
return !!this.metadataMap.has(identifier);
}
get(identifier) {
const value = this.metadataMap.get(identifier);
if (!this.metadataMap.has(identifier)) {
throw new ServiceNotFoundError(identifier);
}
return value;
}
set(id, value) {
this.metadataMap.set(id, value);
return this;
}
remove(identifierOrIdentifierArray) {
if (Array.isArray(identifierOrIdentifierArray)) {
identifierOrIdentifierArray.forEach((id) => this.remove(id));
} else {
const serviceMetadata = this.metadataMap.get(identifierOrIdentifierArray);
if (serviceMetadata) {
this.metadataMap.delete(identifierOrIdentifierArray);
}
}
return this;
}
reset() {
this.metadataMap = new Map();
}
initializeParams(target, paramTypes) {
return paramTypes.map((paramType, index) => {
if (paramType && paramType.name && !ContainerDI.isPrimitiveParamType(paramType.name)) {
return this.get(paramType);
}
return void 0;
});
}
static isPrimitiveParamType(paramTypeName) {
return ["string", "boolean", "number", "object"].includes(paramTypeName.toLowerCase());
}
}
const container = new ContainerDI();
const Container = container;
function isObject(val) {

@@ -345,2 +408,2 @@ return val != null && typeof val === "object" && Array.isArray(val) === false;

export { CONFIG_KEY, DeboxError, LOGGER_KEY, Logger, index as utils };
export { CONFIG_KEY, Container, DeboxError, LOGGER_KEY, Logger, index as utils };

2

package.json
{
"name": "@deboxsoft/module-core",
"version": "1.6.2-7",
"version": "1.7.0-0",
"license": "SEE LICENSE IN LICENSE",

@@ -5,0 +5,0 @@ "maintainers": [

@@ -6,2 +6,3 @@ export { DeboxError } from "./Error";

export * from "./logger";
export * from "./di";
export * as utils from "./utils";
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