@inversifyjs/core
Advanced tools
Comparing version 1.1.2 to 1.2.0
# @inversifyjs/core | ||
## 1.2.0 | ||
### Minor Changes | ||
- fca62ce: Added `LegacyTarget` model. | ||
- fca62ce: Added `getTargets`. | ||
- c588a5a: Added `getClassMetadataFromMetadataReader`. | ||
### Patch Changes | ||
- 6469c67: Updated `getClassMetadata` to correctly fetch name and target names | ||
## 1.1.2 | ||
@@ -4,0 +16,0 @@ |
@@ -0,2 +1,6 @@ | ||
import { getTargets } from './legacyTarget/calculations/getTargets'; | ||
import { LegacyTarget } from './legacyTarget/models/LegacyTarget'; | ||
import { LegacyTargetType } from './legacyTarget/models/LegacyTargetType'; | ||
import { getClassMetadata } from './metadata/calculations/getClassMetadata'; | ||
import { getClassMetadataFromMetadataReader } from './metadata/calculations/getClassMetadataFromMetadataReader'; | ||
import { ClassElementMetadata } from './metadata/models/ClassElementMetadata'; | ||
@@ -6,2 +10,5 @@ import { ClassElementMetadataKind } from './metadata/models/ClassElementMetadataKind'; | ||
import { ClassMetadataLifecycle } from './metadata/models/ClassMetadataLifecycle'; | ||
import { LegacyMetadata } from './metadata/models/LegacyMetadata'; | ||
import { LegacyMetadataMap } from './metadata/models/LegacyMetadataMap'; | ||
import { LegacyMetadataReader } from './metadata/models/LegacyMetadataReader'; | ||
import { ManagedClassElementMetadata } from './metadata/models/ManagedClassElementMetadata'; | ||
@@ -12,4 +19,5 @@ import { MetadataName } from './metadata/models/MetadataName'; | ||
import { UnmanagedClassElementMetadata } from './metadata/models/UnmanagedClassElementMetadata'; | ||
export type { ClassElementMetadata, ClassMetadata, ClassMetadataLifecycle, ManagedClassElementMetadata, MetadataName, MetadataTag, MetadataTargetName, UnmanagedClassElementMetadata, }; | ||
export { ClassElementMetadataKind, getClassMetadata }; | ||
import { LegacyQueryableString } from './string/models/LegacyQueryableString'; | ||
export type { ClassElementMetadata, ClassMetadata, ClassMetadataLifecycle, LegacyMetadata, LegacyMetadataMap, LegacyMetadataReader, LegacyQueryableString, LegacyTarget, LegacyTargetType, ManagedClassElementMetadata, MetadataName, MetadataTag, MetadataTargetName, UnmanagedClassElementMetadata, }; | ||
export { ClassElementMetadataKind, getClassMetadata, getClassMetadataFromMetadataReader, getTargets, }; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getClassMetadata = exports.ClassElementMetadataKind = void 0; | ||
exports.getTargets = exports.getClassMetadataFromMetadataReader = exports.getClassMetadata = exports.ClassElementMetadataKind = void 0; | ||
const getTargets_1 = require("./legacyTarget/calculations/getTargets"); | ||
Object.defineProperty(exports, "getTargets", { enumerable: true, get: function () { return getTargets_1.getTargets; } }); | ||
const getClassMetadata_1 = require("./metadata/calculations/getClassMetadata"); | ||
Object.defineProperty(exports, "getClassMetadata", { enumerable: true, get: function () { return getClassMetadata_1.getClassMetadata; } }); | ||
const getClassMetadataFromMetadataReader_1 = require("./metadata/calculations/getClassMetadataFromMetadataReader"); | ||
Object.defineProperty(exports, "getClassMetadataFromMetadataReader", { enumerable: true, get: function () { return getClassMetadataFromMetadataReader_1.getClassMetadataFromMetadataReader; } }); | ||
const ClassElementMetadataKind_1 = require("./metadata/models/ClassElementMetadataKind"); | ||
Object.defineProperty(exports, "ClassElementMetadataKind", { enumerable: true, get: function () { return ClassElementMetadataKind_1.ClassElementMetadataKind; } }); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getClassElementMetadataFromLegacyMetadata = getClassElementMetadataFromLegacyMetadata; | ||
const InversifyCoreError_1 = require("../../error/models/InversifyCoreError"); | ||
const InversifyCoreErrorKind_1 = require("../../error/models/InversifyCoreErrorKind"); | ||
const keys_1 = require("../../reflectMetadata/data/keys"); | ||
@@ -14,7 +16,7 @@ const ClassElementMetadataKind_1 = require("../models/ClassElementMetadataKind"); | ||
if (multiInjectMetadata === undefined && injectMetadata === undefined) { | ||
throw new Error('Expected @inject, @multiInject or @unmanaged metadata'); | ||
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.missingInjectionDecorator, 'Expected @inject, @multiInject or @unmanaged metadata'); | ||
} | ||
const nameMetadata = metadataList.find((metadata) => metadata.key === keys_1.NAME_TAG); | ||
const nameMetadata = metadataList.find((metadata) => metadata.key === keys_1.NAMED_TAG); | ||
const optionalMetadata = metadataList.find((metadata) => metadata.key === keys_1.OPTIONAL_TAG); | ||
const targetNameMetadata = metadataList.find((metadata) => metadata.key === keys_1.NAMED_TAG); | ||
const targetNameMetadata = metadataList.find((metadata) => metadata.key === keys_1.NAME_TAG); | ||
const managedClassElementMetadata = { | ||
@@ -41,3 +43,3 @@ kind: injectMetadata === undefined | ||
if (multiInjectMetadata !== undefined || injectMetadata !== undefined) { | ||
throw new Error('Expected a single @inject, @multiInject or @unmanaged metadata'); | ||
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.missingInjectionDecorator, 'Expected a single @inject, @multiInject or @unmanaged metadata'); | ||
} | ||
@@ -44,0 +46,0 @@ return { |
import { Newable } from '@inversifyjs/common'; | ||
import { ClassMetadata } from '../models/ClassMetadata'; | ||
export declare function getClassMetadata<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): ClassMetadata; | ||
export declare function getClassMetadata(type: Newable): ClassMetadata; | ||
//# sourceMappingURL=getClassMetadata.d.ts.map |
import { Newable } from '@inversifyjs/common'; | ||
import { ClassElementMetadata } from '../models/ClassElementMetadata'; | ||
export declare function getClassMetadataConstructorArguments<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): ClassElementMetadata[]; | ||
export declare function getClassMetadataConstructorArguments(type: Newable): ClassElementMetadata[]; | ||
//# sourceMappingURL=getClassMetadataConstructorArguments.d.ts.map |
@@ -6,4 +6,4 @@ "use strict"; | ||
const keys_1 = require("../../reflectMetadata/data/keys"); | ||
const getClassElementMetadataFromLegacyMetadata_1 = require("./getClassElementMetadataFromLegacyMetadata"); | ||
const getClassElementMetadataFromNewable_1 = require("./getClassElementMetadataFromNewable"); | ||
const getConstructorArgumentMetadataFromLegacyMetadata_1 = require("./getConstructorArgumentMetadataFromLegacyMetadata"); | ||
function getClassMetadataConstructorArguments(type) { | ||
@@ -17,3 +17,3 @@ const typescriptMetadataList = (0, reflect_metadata_utils_1.getReflectMetadata)(type, keys_1.DESIGN_PARAM_TYPES); | ||
constructorArgumentsMetadata[index] = | ||
(0, getClassElementMetadataFromLegacyMetadata_1.getClassElementMetadataFromLegacyMetadata)(metadataList); | ||
(0, getConstructorArgumentMetadataFromLegacyMetadata_1.getConstructorArgumentMetadataFromLegacyMetadata)(type, index, metadataList); | ||
} | ||
@@ -20,0 +20,0 @@ } |
import { Newable } from '@inversifyjs/common'; | ||
import { ClassElementMetadata } from '../models/ClassElementMetadata'; | ||
export declare function getClassMetadataProperties<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): Map<string | symbol, ClassElementMetadata>; | ||
export declare function getClassMetadataProperties(type: Newable): Map<string | symbol, ClassElementMetadata>; | ||
//# sourceMappingURL=getClassMetadataProperties.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
const keys_1 = require("../../reflectMetadata/data/keys"); | ||
const getClassElementMetadataFromLegacyMetadata_1 = require("./getClassElementMetadataFromLegacyMetadata"); | ||
const getPropertyMetadataFromLegacyMetadata_1 = require("./getPropertyMetadataFromLegacyMetadata"); | ||
function getClassMetadataProperties(type) { | ||
@@ -14,3 +14,3 @@ const propertiesLegacyMetadata = (0, reflect_metadata_utils_1.getReflectMetadata)(type, keys_1.TAGGED_PROP); | ||
const legacyMetadata = propertiesLegacyMetadata[property]; | ||
propertiesMetadata.set(property, (0, getClassElementMetadataFromLegacyMetadata_1.getClassElementMetadataFromLegacyMetadata)(legacyMetadata)); | ||
propertiesMetadata.set(property, (0, getPropertyMetadataFromLegacyMetadata_1.getPropertyMetadataFromLegacyMetadata)(type, property, legacyMetadata)); | ||
} | ||
@@ -17,0 +17,0 @@ } |
@@ -1,5 +0,5 @@ | ||
export interface LegacyMetadata { | ||
export interface LegacyMetadata<TValue = unknown> { | ||
key: string | number | symbol; | ||
value: unknown; | ||
value: TValue; | ||
} | ||
//# sourceMappingURL=LegacyMetadata.d.ts.map |
@@ -6,3 +6,2 @@ "use strict"; | ||
exports.NAMED_TAG = 'named'; | ||
// The name of the target at design time | ||
exports.NAME_TAG = 'name'; | ||
@@ -9,0 +8,0 @@ // The for unmanaged injections (in base classes when using inheritance) |
@@ -0,2 +1,6 @@ | ||
import { getTargets } from './legacyTarget/calculations/getTargets'; | ||
import { LegacyTarget } from './legacyTarget/models/LegacyTarget'; | ||
import { LegacyTargetType } from './legacyTarget/models/LegacyTargetType'; | ||
import { getClassMetadata } from './metadata/calculations/getClassMetadata'; | ||
import { getClassMetadataFromMetadataReader } from './metadata/calculations/getClassMetadataFromMetadataReader'; | ||
import { ClassElementMetadata } from './metadata/models/ClassElementMetadata'; | ||
@@ -6,2 +10,5 @@ import { ClassElementMetadataKind } from './metadata/models/ClassElementMetadataKind'; | ||
import { ClassMetadataLifecycle } from './metadata/models/ClassMetadataLifecycle'; | ||
import { LegacyMetadata } from './metadata/models/LegacyMetadata'; | ||
import { LegacyMetadataMap } from './metadata/models/LegacyMetadataMap'; | ||
import { LegacyMetadataReader } from './metadata/models/LegacyMetadataReader'; | ||
import { ManagedClassElementMetadata } from './metadata/models/ManagedClassElementMetadata'; | ||
@@ -12,4 +19,5 @@ import { MetadataName } from './metadata/models/MetadataName'; | ||
import { UnmanagedClassElementMetadata } from './metadata/models/UnmanagedClassElementMetadata'; | ||
export type { ClassElementMetadata, ClassMetadata, ClassMetadataLifecycle, ManagedClassElementMetadata, MetadataName, MetadataTag, MetadataTargetName, UnmanagedClassElementMetadata, }; | ||
export { ClassElementMetadataKind, getClassMetadata }; | ||
import { LegacyQueryableString } from './string/models/LegacyQueryableString'; | ||
export type { ClassElementMetadata, ClassMetadata, ClassMetadataLifecycle, LegacyMetadata, LegacyMetadataMap, LegacyMetadataReader, LegacyQueryableString, LegacyTarget, LegacyTargetType, ManagedClassElementMetadata, MetadataName, MetadataTag, MetadataTargetName, UnmanagedClassElementMetadata, }; | ||
export { ClassElementMetadataKind, getClassMetadata, getClassMetadataFromMetadataReader, getTargets, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,4 +1,6 @@ | ||
import { getTargets } from './legacyTarget/calculations/getTargets'; | ||
import { getClassMetadata } from './metadata/calculations/getClassMetadata'; | ||
import { getClassMetadataFromMetadataReader } from './metadata/calculations/getClassMetadataFromMetadataReader'; | ||
import { ClassElementMetadataKind } from './metadata/models/ClassElementMetadataKind'; | ||
export { ClassElementMetadataKind, getClassMetadata }; | ||
export { ClassElementMetadataKind, getClassMetadata, getClassMetadataFromMetadataReader, getTargets, }; | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,3 @@ | ||
import { InversifyCoreError } from '../../error/models/InversifyCoreError'; | ||
import { InversifyCoreErrorKind } from '../../error/models/InversifyCoreErrorKind'; | ||
import { INJECT_TAG, MULTI_INJECT_TAG, NAME_TAG, NAMED_TAG, NON_CUSTOM_TAG_KEYS, OPTIONAL_TAG, UNMANAGED_TAG, } from '../../reflectMetadata/data/keys'; | ||
@@ -11,7 +13,7 @@ import { ClassElementMetadataKind } from '../models/ClassElementMetadataKind'; | ||
if (multiInjectMetadata === undefined && injectMetadata === undefined) { | ||
throw new Error('Expected @inject, @multiInject or @unmanaged metadata'); | ||
throw new InversifyCoreError(InversifyCoreErrorKind.missingInjectionDecorator, 'Expected @inject, @multiInject or @unmanaged metadata'); | ||
} | ||
const nameMetadata = metadataList.find((metadata) => metadata.key === NAME_TAG); | ||
const nameMetadata = metadataList.find((metadata) => metadata.key === NAMED_TAG); | ||
const optionalMetadata = metadataList.find((metadata) => metadata.key === OPTIONAL_TAG); | ||
const targetNameMetadata = metadataList.find((metadata) => metadata.key === NAMED_TAG); | ||
const targetNameMetadata = metadataList.find((metadata) => metadata.key === NAME_TAG); | ||
const managedClassElementMetadata = { | ||
@@ -38,3 +40,3 @@ kind: injectMetadata === undefined | ||
if (multiInjectMetadata !== undefined || injectMetadata !== undefined) { | ||
throw new Error('Expected a single @inject, @multiInject or @unmanaged metadata'); | ||
throw new InversifyCoreError(InversifyCoreErrorKind.missingInjectionDecorator, 'Expected a single @inject, @multiInject or @unmanaged metadata'); | ||
} | ||
@@ -41,0 +43,0 @@ return { |
import { Newable } from '@inversifyjs/common'; | ||
import { ClassMetadata } from '../models/ClassMetadata'; | ||
export declare function getClassMetadata<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): ClassMetadata; | ||
export declare function getClassMetadata(type: Newable): ClassMetadata; | ||
//# sourceMappingURL=getClassMetadata.d.ts.map |
import { Newable } from '@inversifyjs/common'; | ||
import { ClassElementMetadata } from '../models/ClassElementMetadata'; | ||
export declare function getClassMetadataConstructorArguments<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): ClassElementMetadata[]; | ||
export declare function getClassMetadataConstructorArguments(type: Newable): ClassElementMetadata[]; | ||
//# sourceMappingURL=getClassMetadataConstructorArguments.d.ts.map |
import { getReflectMetadata } from '@inversifyjs/reflect-metadata-utils'; | ||
import { DESIGN_PARAM_TYPES, TAGGED } from '../../reflectMetadata/data/keys'; | ||
import { getClassElementMetadataFromLegacyMetadata } from './getClassElementMetadataFromLegacyMetadata'; | ||
import { getClassElementMetadataFromNewable } from './getClassElementMetadataFromNewable'; | ||
import { getConstructorArgumentMetadataFromLegacyMetadata } from './getConstructorArgumentMetadataFromLegacyMetadata'; | ||
export function getClassMetadataConstructorArguments(type) { | ||
@@ -13,3 +13,3 @@ const typescriptMetadataList = getReflectMetadata(type, DESIGN_PARAM_TYPES); | ||
constructorArgumentsMetadata[index] = | ||
getClassElementMetadataFromLegacyMetadata(metadataList); | ||
getConstructorArgumentMetadataFromLegacyMetadata(type, index, metadataList); | ||
} | ||
@@ -16,0 +16,0 @@ } |
import { Newable } from '@inversifyjs/common'; | ||
import { ClassElementMetadata } from '../models/ClassElementMetadata'; | ||
export declare function getClassMetadataProperties<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): Map<string | symbol, ClassElementMetadata>; | ||
export declare function getClassMetadataProperties(type: Newable): Map<string | symbol, ClassElementMetadata>; | ||
//# sourceMappingURL=getClassMetadataProperties.d.ts.map |
import { getReflectMetadata } from '@inversifyjs/reflect-metadata-utils'; | ||
import { TAGGED_PROP } from '../../reflectMetadata/data/keys'; | ||
import { getClassElementMetadataFromLegacyMetadata } from './getClassElementMetadataFromLegacyMetadata'; | ||
import { getPropertyMetadataFromLegacyMetadata } from './getPropertyMetadataFromLegacyMetadata'; | ||
export function getClassMetadataProperties(type) { | ||
@@ -10,3 +10,3 @@ const propertiesLegacyMetadata = getReflectMetadata(type, TAGGED_PROP); | ||
const legacyMetadata = propertiesLegacyMetadata[property]; | ||
propertiesMetadata.set(property, getClassElementMetadataFromLegacyMetadata(legacyMetadata)); | ||
propertiesMetadata.set(property, getPropertyMetadataFromLegacyMetadata(type, property, legacyMetadata)); | ||
} | ||
@@ -13,0 +13,0 @@ } |
@@ -1,5 +0,5 @@ | ||
export interface LegacyMetadata { | ||
export interface LegacyMetadata<TValue = unknown> { | ||
key: string | number | symbol; | ||
value: unknown; | ||
value: TValue; | ||
} | ||
//# sourceMappingURL=LegacyMetadata.d.ts.map |
// Used for named bindings | ||
export const NAMED_TAG = 'named'; | ||
// The name of the target at design time | ||
export const NAME_TAG = 'name'; | ||
@@ -5,0 +4,0 @@ // The for unmanaged injections (in base classes when using inheritance) |
@@ -17,5 +17,5 @@ { | ||
"@stryker-mutator/typescript-checker": "8.6.0", | ||
"@types/node": "20.17.5", | ||
"@typescript-eslint/eslint-plugin": "8.12.2", | ||
"@typescript-eslint/parser": "8.12.2", | ||
"@types/node": "22.9.0", | ||
"@typescript-eslint/eslint-plugin": "8.13.0", | ||
"@typescript-eslint/parser": "8.13.0", | ||
"eslint": "9.14.0", | ||
@@ -66,3 +66,3 @@ "jest": "29.7.0", | ||
"sideEffects": false, | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"scripts": { | ||
@@ -69,0 +69,0 @@ "build": "pnpm run build:cjs && pnpm run build:esm", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
184541
365
1613
1