@atlantjs/backend 1.0.20 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +0,0 @@
1
- import { Newable, Abstract } from "@atlantjs/arch";
2
- type ServiceIdentifier<T = unknown> = Newable<T> | Abstract<T>;
3
- interface ContainerStorage {
4
- get<T>(type: ServiceIdentifier<T>): T;
5
- }
6
- export declare class Container {
7
- private static storage;
8
- static useStorage(newStorage: ContainerStorage): void;
9
- static get<T>(identifier: ServiceIdentifier<T>): T;
10
- }
11
- export {};
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Container = void 0;
4
- const default_container_1 = require("./default-container");
5
- class Container {
6
- static useStorage(newStorage) {
7
- Container.storage = newStorage;
8
- }
9
- static get(identifier) {
10
- return Container.storage.get(identifier);
11
- }
12
- }
13
- exports.Container = Container;
14
- Container.storage = new default_container_1.DefaultContainer();
@@ -1,4 +0,0 @@
1
- export declare class DefaultContainer {
2
- private readonly instances;
3
- get<T>(type: new (...args: never[]) => T): T;
4
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultContainer = void 0;
4
- class DefaultContainer {
5
- constructor() {
6
- this.instances = [];
7
- }
8
- get(type) {
9
- let instance = this.instances.find((instance) => instance.type === type);
10
- if (!instance) {
11
- instance = {
12
- type,
13
- object: new type(),
14
- };
15
- this.instances.push(instance);
16
- }
17
- return instance.object;
18
- }
19
- }
20
- exports.DefaultContainer = DefaultContainer;