@tachybase/utils 1.3.42 → 1.3.44

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.
Files changed (55) hide show
  1. package/lib/client.d.ts +0 -3
  2. package/lib/client.js +0 -22
  3. package/lib/date.d.ts +1 -1
  4. package/lib/date.js +9 -9
  5. package/lib/dayjs.d.ts +1 -10
  6. package/lib/dayjs.js +4 -22
  7. package/lib/index.d.ts +2 -6
  8. package/lib/index.js +0 -27
  9. package/lib/parse-date.js +21 -11
  10. package/lib/parse-filter.js +4 -4
  11. package/package.json +1 -1
  12. package/lib/decorators.d.ts +0 -16
  13. package/lib/decorators.js +0 -94
  14. package/lib/typedi/container-instance.class.d.ts +0 -109
  15. package/lib/typedi/container-instance.class.js +0 -340
  16. package/lib/typedi/container-registry.class.d.ts +0 -51
  17. package/lib/typedi/container-registry.class.js +0 -95
  18. package/lib/typedi/decorators/inject-many.decorator.d.ts +0 -8
  19. package/lib/typedi/decorators/inject-many.decorator.js +0 -56
  20. package/lib/typedi/decorators/inject.decorator.d.ts +0 -9
  21. package/lib/typedi/decorators/inject.decorator.js +0 -56
  22. package/lib/typedi/decorators/service.decorator.d.ts +0 -6
  23. package/lib/typedi/decorators/service.decorator.js +0 -49
  24. package/lib/typedi/empty.const.d.ts +0 -6
  25. package/lib/typedi/empty.const.js +0 -27
  26. package/lib/typedi/error/cannot-inject-value.error.d.ts +0 -11
  27. package/lib/typedi/error/cannot-inject-value.error.js +0 -40
  28. package/lib/typedi/error/cannot-instantiate-value.error.d.ts +0 -11
  29. package/lib/typedi/error/cannot-instantiate-value.error.js +0 -49
  30. package/lib/typedi/error/service-not-found.error.d.ts +0 -11
  31. package/lib/typedi/error/service-not-found.error.js +0 -49
  32. package/lib/typedi/index.d.ts +0 -17
  33. package/lib/typedi/index.js +0 -49
  34. package/lib/typedi/interfaces/container-options.interface.d.ts +0 -45
  35. package/lib/typedi/interfaces/container-options.interface.js +0 -15
  36. package/lib/typedi/interfaces/handler.interface.d.ts +0 -27
  37. package/lib/typedi/interfaces/handler.interface.js +0 -15
  38. package/lib/typedi/interfaces/service-metadata.interface.d.ts +0 -53
  39. package/lib/typedi/interfaces/service-metadata.interface.js +0 -15
  40. package/lib/typedi/interfaces/service-options.interface.d.ts +0 -6
  41. package/lib/typedi/interfaces/service-options.interface.js +0 -15
  42. package/lib/typedi/token.class.d.ts +0 -11
  43. package/lib/typedi/token.class.js +0 -37
  44. package/lib/typedi/types/abstract-constructable.type.d.ts +0 -9
  45. package/lib/typedi/types/abstract-constructable.type.js +0 -15
  46. package/lib/typedi/types/container-identifier.type.d.ts +0 -4
  47. package/lib/typedi/types/container-identifier.type.js +0 -15
  48. package/lib/typedi/types/container-scope.type.d.ts +0 -1
  49. package/lib/typedi/types/container-scope.type.js +0 -15
  50. package/lib/typedi/types/service-identifier.type.d.ts +0 -8
  51. package/lib/typedi/types/service-identifier.type.js +0 -15
  52. package/lib/typedi/utils/resolve-to-type-wrapper.util.d.ts +0 -15
  53. package/lib/typedi/utils/resolve-to-type-wrapper.util.js +0 -39
  54. /package/lib/{typedi/types → types}/constructable.type.d.ts +0 -0
  55. /package/lib/{typedi/types → types}/constructable.type.js +0 -0
@@ -1,27 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var empty_const_exports = {};
19
- __export(empty_const_exports, {
20
- EMPTY_VALUE: () => EMPTY_VALUE
21
- });
22
- module.exports = __toCommonJS(empty_const_exports);
23
- const EMPTY_VALUE = Symbol("EMPTY_VALUE");
24
- // Annotate the CommonJS export names for ESM import in node:
25
- 0 && (module.exports = {
26
- EMPTY_VALUE
27
- });
@@ -1,11 +0,0 @@
1
- import { Constructable } from '../types/constructable.type';
2
- /**
3
- * Thrown when DI cannot inject value into property decorated by @Inject decorator.
4
- */
5
- export declare class CannotInjectValueError extends Error {
6
- private target;
7
- private propertyName;
8
- name: string;
9
- get message(): string;
10
- constructor(target: Constructable<unknown>, propertyName: string);
11
- }
@@ -1,40 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var cannot_inject_value_error_exports = {};
20
- __export(cannot_inject_value_error_exports, {
21
- CannotInjectValueError: () => CannotInjectValueError
22
- });
23
- module.exports = __toCommonJS(cannot_inject_value_error_exports);
24
- const _CannotInjectValueError = class _CannotInjectValueError extends Error {
25
- constructor(target, propertyName) {
26
- super();
27
- this.target = target;
28
- this.propertyName = propertyName;
29
- this.name = "CannotInjectValueError";
30
- }
31
- get message() {
32
- return `Cannot inject value into "${this.target.constructor.name}.${this.propertyName}". Please make sure you setup reflect-metadata properly and you don't use interfaces without service tokens as injection value.`;
33
- }
34
- };
35
- __name(_CannotInjectValueError, "CannotInjectValueError");
36
- let CannotInjectValueError = _CannotInjectValueError;
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- CannotInjectValueError
40
- });
@@ -1,11 +0,0 @@
1
- import { ServiceIdentifier } from '../types/service-identifier.type';
2
- /**
3
- * Thrown when DI cannot inject value into property decorated by @Inject decorator.
4
- */
5
- export declare class CannotInstantiateValueError extends Error {
6
- name: string;
7
- /** Normalized identifier name used in the error message. */
8
- private normalizedIdentifier;
9
- get message(): string;
10
- constructor(identifier: ServiceIdentifier);
11
- }
@@ -1,49 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var cannot_instantiate_value_error_exports = {};
20
- __export(cannot_instantiate_value_error_exports, {
21
- CannotInstantiateValueError: () => CannotInstantiateValueError
22
- });
23
- module.exports = __toCommonJS(cannot_instantiate_value_error_exports);
24
- var import_token = require("../token.class");
25
- const _CannotInstantiateValueError = class _CannotInstantiateValueError extends Error {
26
- constructor(identifier) {
27
- var _a, _b;
28
- super();
29
- this.name = "CannotInstantiateValueError";
30
- /** Normalized identifier name used in the error message. */
31
- this.normalizedIdentifier = "<UNKNOWN_IDENTIFIER>";
32
- if (typeof identifier === "string") {
33
- this.normalizedIdentifier = identifier;
34
- } else if (identifier instanceof import_token.Token) {
35
- this.normalizedIdentifier = `Token<${identifier.name || "UNSET_NAME"}>`;
36
- } else if (identifier && (identifier.name || ((_a = identifier.prototype) == null ? void 0 : _a.name))) {
37
- this.normalizedIdentifier = identifier.name ? `MaybeConstructable<${identifier.name}>` : `MaybeConstructable<${(_b = identifier.prototype) == null ? void 0 : _b.name}>`;
38
- }
39
- }
40
- get message() {
41
- return `Cannot instantiate the requested value for the "${this.normalizedIdentifier}" identifier. The related metadata doesn't contain a factory or a type to instantiate.`;
42
- }
43
- };
44
- __name(_CannotInstantiateValueError, "CannotInstantiateValueError");
45
- let CannotInstantiateValueError = _CannotInstantiateValueError;
46
- // Annotate the CommonJS export names for ESM import in node:
47
- 0 && (module.exports = {
48
- CannotInstantiateValueError
49
- });
@@ -1,11 +0,0 @@
1
- import { ServiceIdentifier } from '../types/service-identifier.type';
2
- /**
3
- * Thrown when requested service was not found.
4
- */
5
- export declare class ServiceNotFoundError extends Error {
6
- name: string;
7
- /** Normalized identifier name used in the error message. */
8
- private normalizedIdentifier;
9
- get message(): string;
10
- constructor(identifier: ServiceIdentifier);
11
- }
@@ -1,49 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var service_not_found_error_exports = {};
20
- __export(service_not_found_error_exports, {
21
- ServiceNotFoundError: () => ServiceNotFoundError
22
- });
23
- module.exports = __toCommonJS(service_not_found_error_exports);
24
- var import_token = require("../token.class");
25
- const _ServiceNotFoundError = class _ServiceNotFoundError extends Error {
26
- constructor(identifier) {
27
- var _a, _b;
28
- super();
29
- this.name = "ServiceNotFoundError";
30
- /** Normalized identifier name used in the error message. */
31
- this.normalizedIdentifier = "<UNKNOWN_IDENTIFIER>";
32
- if (typeof identifier === "string") {
33
- this.normalizedIdentifier = identifier;
34
- } else if (identifier instanceof import_token.Token) {
35
- this.normalizedIdentifier = `Token<${identifier.name || "UNSET_NAME"}>`;
36
- } else if (identifier && (identifier.name || ((_a = identifier.prototype) == null ? void 0 : _a.name))) {
37
- this.normalizedIdentifier = identifier.name ? `MaybeConstructable<${identifier.name}>` : `MaybeConstructable<${(_b = identifier.prototype) == null ? void 0 : _b.name}>`;
38
- }
39
- }
40
- get message() {
41
- return `Service with "${this.normalizedIdentifier}" identifier was not found in the container. Register it before usage via explicitly calling the "Container.set" function or using the "@Service()" decorator.`;
42
- }
43
- };
44
- __name(_ServiceNotFoundError, "ServiceNotFoundError");
45
- let ServiceNotFoundError = _ServiceNotFoundError;
46
- // Annotate the CommonJS export names for ESM import in node:
47
- 0 && (module.exports = {
48
- ServiceNotFoundError
49
- });
@@ -1,17 +0,0 @@
1
- import { ContainerInstance } from './container-instance.class';
2
- export * from './decorators/inject-many.decorator';
3
- export * from './decorators/inject.decorator';
4
- export * from './decorators/service.decorator';
5
- export * from './error/cannot-inject-value.error';
6
- export * from './error/cannot-instantiate-value.error';
7
- export * from './error/service-not-found.error';
8
- export type { Handler } from './interfaces/handler.interface';
9
- export type { ServiceMetadata } from './interfaces/service-metadata.interface';
10
- export type { ServiceOptions } from './interfaces/service-options.interface';
11
- export type { Constructable } from './types/constructable.type';
12
- export type { ServiceIdentifier } from './types/service-identifier.type';
13
- export { ContainerInstance } from './container-instance.class';
14
- export { Token } from './token.class';
15
- /** We export the default container under the Container alias. */
16
- export declare const Container: ContainerInstance;
17
- export default Container;
@@ -1,49 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var typedi_exports = {};
20
- __export(typedi_exports, {
21
- Container: () => Container,
22
- ContainerInstance: () => import_container_instance2.ContainerInstance,
23
- Token: () => import_token.Token,
24
- default: () => typedi_default
25
- });
26
- module.exports = __toCommonJS(typedi_exports);
27
- var import_container_instance = require("./container-instance.class");
28
- __reExport(typedi_exports, require("./decorators/inject-many.decorator"), module.exports);
29
- __reExport(typedi_exports, require("./decorators/inject.decorator"), module.exports);
30
- __reExport(typedi_exports, require("./decorators/service.decorator"), module.exports);
31
- __reExport(typedi_exports, require("./error/cannot-inject-value.error"), module.exports);
32
- __reExport(typedi_exports, require("./error/cannot-instantiate-value.error"), module.exports);
33
- __reExport(typedi_exports, require("./error/service-not-found.error"), module.exports);
34
- var import_container_instance2 = require("./container-instance.class");
35
- var import_token = require("./token.class");
36
- const Container = import_container_instance.ContainerInstance.default;
37
- var typedi_default = Container;
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- Container,
41
- ContainerInstance,
42
- Token,
43
- ...require("./decorators/inject-many.decorator"),
44
- ...require("./decorators/inject.decorator"),
45
- ...require("./decorators/service.decorator"),
46
- ...require("./error/cannot-inject-value.error"),
47
- ...require("./error/cannot-instantiate-value.error"),
48
- ...require("./error/service-not-found.error")
49
- });
@@ -1,45 +0,0 @@
1
- export interface ContainerOptions {
2
- /**
3
- * Controls the behavior when a service is already registered with the same ID. The following values are allowed:
4
- *
5
- * - `throw` - a `ContainerCannotBeCreatedError` error is raised
6
- * - `overwrite` - the previous container is disposed and a new one is created
7
- * - `returnExisting` - returns the existing container or raises a `ContainerCannotBeCreatedError` error if the
8
- * specified options differ from the options of the existing container
9
- *
10
- * The default value is `returnExisting`.
11
- */
12
- onConflict: 'throw' | 'overwrite' | 'returnExisting';
13
- /**
14
- * Controls the behavior when a requested type doesn't exists in the current container. The following values are allowed:
15
- *
16
- * - `allowLookup` - the parent container will be checked for the dependency
17
- * - `localOnly` - a `ServiceNotFoundError` error is raised
18
- *
19
- * The default value is `allowLookup`.
20
- */
21
- lookupStrategy: 'allowLookup' | 'localOnly';
22
- /**
23
- * Enables the lookup for global (singleton) services before checking in the current container. By default every
24
- * type is first checked in the default container to return singleton services. This check bypasses the lookup strategy,
25
- * set in the container so if this behavior is not desired it can be disabled via this flag.
26
- *
27
- * The default value is `true`.
28
- */
29
- allowSingletonLookup: boolean;
30
- /**
31
- * Controls how the child container inherits the service definitions from it's parent. The following values are allowed:
32
- *
33
- * - `none` - no metadata is inherited
34
- * - `definitionOnly` - only metadata is inherited, a new instance will be created for each class
35
- * - eager classes created as soon as the container is created
36
- * - non-eager classes are created the first time they are requested
37
- * - `definitionWithValues` - both metadata and service instances are inherited
38
- * - when parent class is disposed the instances in this container are preserved
39
- * - if a service is registered but not created yet, it will be shared when created between the two container
40
- * - newly registered services won't be shared between the two container
41
- *
42
- * The default value is `none`.
43
- */
44
- inheritanceStrategy: 'none' | 'definitionOnly' | 'definitionWithValues';
45
- }
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var container_options_interface_exports = {};
15
- module.exports = __toCommonJS(container_options_interface_exports);
@@ -1,27 +0,0 @@
1
- import { ContainerInstance } from '../container-instance.class';
2
- import { Constructable } from '../types/constructable.type';
3
- /**
4
- * Used to register special "handler" which will be executed on a service class during its initialization.
5
- * It can be used to create custom decorators and set/replace service class properties and constructor parameters.
6
- */
7
- export interface Handler<T = unknown> {
8
- /**
9
- * Service object used to apply handler to.
10
- */
11
- object: Constructable<T>;
12
- /**
13
- * Class property name to set/replace value of.
14
- * Used if handler is applied on a class property.
15
- */
16
- propertyName?: string;
17
- /**
18
- * Parameter index to set/replace value of.
19
- * Used if handler is applied on a constructor parameter.
20
- */
21
- index?: number;
22
- /**
23
- * Factory function that produces value that will be set to class property or constructor parameter.
24
- * Accepts container instance which requested the value.
25
- */
26
- value: (container: ContainerInstance) => any;
27
- }
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var handler_interface_exports = {};
15
- module.exports = __toCommonJS(handler_interface_exports);
@@ -1,53 +0,0 @@
1
- import { ContainerInstance } from '../container-instance.class';
2
- import { Constructable } from '../types/constructable.type';
3
- import { ContainerIdentifier } from '../types/container-identifier.type';
4
- import { ContainerScope } from '../types/container-scope.type';
5
- import { ServiceIdentifier } from '../types/service-identifier.type';
6
- /**
7
- * Service metadata is used to initialize service and store its state.
8
- */
9
- export interface ServiceMetadata<Type = unknown> {
10
- /** Unique identifier of the referenced service. */
11
- id: ServiceIdentifier;
12
- /**
13
- * The injection scope for the service.
14
- * - a `singleton` service always will be created in the default container regardless of who registering it
15
- * - a `container` scoped service will be created once when requested from the given container
16
- * - a `transient` service will be created each time it is requested
17
- */
18
- scope: ContainerScope;
19
- /**
20
- * Class definition of the service what is used to initialize given service.
21
- * This property maybe null if the value of the service is set manually.
22
- * If id is not set then it serves as service id.
23
- */
24
- type: Constructable<Type> | null;
25
- /**
26
- * Factory function used to initialize this service.
27
- * Can be regular function ("createCar" for example),
28
- * or other service which produces this instance ([CarFactory, "createCar"] for example).
29
- */
30
- factory: [Constructable<unknown>, string] | CallableFunction | undefined;
31
- /**
32
- * Instance of the target class.
33
- */
34
- value: unknown | symbol;
35
- /**
36
- * Allows to setup multiple instances the different classes under a single service id string or token.
37
- */
38
- multiple: boolean;
39
- /**
40
- * Indicates whether a new instance should be created as soon as the class is registered.
41
- * By default the registered classes are only instantiated when they are requested from the container.
42
- *
43
- * _Note: This option is ignored for transient services._
44
- */
45
- eager: boolean;
46
- /**
47
- * Map of containers referencing this metadata. This is used when a container
48
- * is inheriting it's parents definitions and values to track the lifecycle of
49
- * the metadata. Namely, a service can be disposed only if it's only referenced
50
- * by the container being disposed.
51
- */
52
- referencedBy: Map<ContainerIdentifier, ContainerInstance>;
53
- }
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var service_metadata_interface_exports = {};
15
- module.exports = __toCommonJS(service_metadata_interface_exports);
@@ -1,6 +0,0 @@
1
- import { ServiceMetadata } from './service-metadata.interface';
2
- /**
3
- * The public ServiceOptions is partial object of ServiceMetadata and either one
4
- * of the following is set: `type`, `factory`, `value` but not more than one.
5
- */
6
- export type ServiceOptions<T = unknown> = Omit<Partial<ServiceMetadata<T>>, 'referencedBy' | 'type' | 'factory'> | Omit<Partial<ServiceMetadata<T>>, 'referencedBy' | 'value' | 'factory'> | Omit<Partial<ServiceMetadata<T>>, 'referencedBy' | 'value' | 'type'>;
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var service_options_interface_exports = {};
15
- module.exports = __toCommonJS(service_options_interface_exports);
@@ -1,11 +0,0 @@
1
- /**
2
- * Used to create unique typed service identifier.
3
- * Useful when service has only interface, but don't have a class.
4
- */
5
- export declare class Token<T> {
6
- name?: string;
7
- /**
8
- * @param name Token name, optional and only used for debugging purposes.
9
- */
10
- constructor(name?: string);
11
- }
@@ -1,37 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var token_class_exports = {};
20
- __export(token_class_exports, {
21
- Token: () => Token
22
- });
23
- module.exports = __toCommonJS(token_class_exports);
24
- const _Token = class _Token {
25
- /**
26
- * @param name Token name, optional and only used for debugging purposes.
27
- */
28
- constructor(name) {
29
- this.name = name;
30
- }
31
- };
32
- __name(_Token, "Token");
33
- let Token = _Token;
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- Token
37
- });
@@ -1,9 +0,0 @@
1
- /**
2
- * Generic type for abstract class definitions.
3
- *
4
- * Explanation: This describes a newable Function with a prototype Which is
5
- * what an abstract class is - no constructor, just the prototype.
6
- */
7
- export type AbstractConstructable<T> = NewableFunction & {
8
- prototype: T;
9
- };
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var abstract_constructable_type_exports = {};
15
- module.exports = __toCommonJS(abstract_constructable_type_exports);
@@ -1,4 +0,0 @@
1
- /**
2
- * A container identifier. This value must be unique across all containers.
3
- */
4
- export type ContainerIdentifier = string | symbol;
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var container_identifier_type_exports = {};
15
- module.exports = __toCommonJS(container_identifier_type_exports);
@@ -1 +0,0 @@
1
- export type ContainerScope = 'singleton' | 'container' | 'transient';
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var container_scope_type_exports = {};
15
- module.exports = __toCommonJS(container_scope_type_exports);
@@ -1,8 +0,0 @@
1
- import { Token } from '../token.class';
2
- import { AbstractConstructable } from './abstract-constructable.type';
3
- import { Constructable } from './constructable.type';
4
- /**
5
- * Unique service identifier.
6
- * Can be some class type, or string id, or instance of Token.
7
- */
8
- export type ServiceIdentifier<T = unknown> = Constructable<T> | AbstractConstructable<T> | CallableFunction | Token<T> | string;
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var service_identifier_type_exports = {};
15
- module.exports = __toCommonJS(service_identifier_type_exports);
@@ -1,15 +0,0 @@
1
- import { Constructable } from '../types/constructable.type';
2
- import { ServiceIdentifier } from '../types/service-identifier.type';
3
- /**
4
- * Helper function used in inject decorators to resolve the received identifier to
5
- * an eager type when possible or to a lazy type when cyclic dependencies are possibly involved.
6
- *
7
- * @param typeOrIdentifier a service identifier or a function returning a type acting as service identifier or nothing
8
- * @param target the class definition of the target of the decorator
9
- * @param propertyName the name of the property in case of a PropertyDecorator
10
- * @param index the index of the parameter in the constructor in case of ParameterDecorator
11
- */
12
- export declare function resolveToTypeWrapper(typeOrIdentifier: ((type?: never) => Constructable<unknown>) | ServiceIdentifier<unknown> | undefined, target: object, propertyName: string | symbol, index?: number): {
13
- eagerType: ServiceIdentifier | null;
14
- lazyType: (type?: never) => ServiceIdentifier;
15
- };