Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@furystack/inject
Advanced tools
dependency injection provider for FuryStack
Injectors act as containers, they are responsible for creating / retrieving service instances based on the provided Injectable metadata. You can create an injector with simply instantiating the class
const myInjector = new Injector()
You can organize your injector(s) in trees by creating child injectors. You can use the children and services with scoped lifetime for contextual services.
const childInjector = myInjector.createChild({ owner: 'myCustomContext' })
You can create an injectable service from a plain class when decorating with the @Injectable()
decorator.
@Injectable({
/** Injectable options */
})
export class MySercive {
/** ...service implementation... */
constructor(s1: OtherInjectableService, s2: AnotherInjectableService) {}
}
The constructor parameters (s1: OtherInjectableService
and s2: AnotherInjectableService
) should be also decorated and will be resolved recursively.
You can define a specific Lifetime for Injectable services on the decorator
@Injectable({
lifetime: 'transient',
})
export class MySercive {
/** ...service implementation... */
}
The lifetime can be
Injectables can only depend on services with longer lifetime, e.g. a transient can depend on a singleton, but inversing it will throw an error
You can retrieve a service by calling
const service = myInjector.getInstance(MySercive)
There are cases that you have to set a service instance explicitly. You can do that in the following way
class MyService {
constructor(public readonly foo: string)
}
myInjector.setExplicitInstance(new MyService('bar'))
FAQs
Core FuryStack package
We found that @furystack/inject demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.