Skip to content

Commit

Permalink
feat(core): use local types
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Nov 10, 2021
1 parent 62ffdc6 commit 558782d
Show file tree
Hide file tree
Showing 42 changed files with 64 additions and 79 deletions.
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './lib/utils';
export * from './lib/initialize-utils';
export * from './lib/member-map-functions';
export * from './lib/naming-conventions';
export * from './lib/types';
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type {
Mapping,
PrimitiveConstructorWithDate,
ValueSelector,
} from '@automapper/types';
} from '../types';
import {
MapFnClassId,
MappingPropertiesClassId,
MappingPropertyClassId,
MappingTransformationClassId,
} from '@automapper/types';
} from '../types';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {
Mapping,
MemberMapReturn,
PreConditionReturn,
} from '@automapper/types';
import { MappingClassId } from '@automapper/types';
} from '../types';
import { MappingClassId } from '../types';
import { createMapForMember } from './create-map-for-member.util';
import { createMapForSelf } from './create-map-for-self.util';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import type {
PreConditionReturn,
Selector,
SelectorReturn,
} from '@automapper/types';
} from '../types';
import {
MapFnClassId,
MappingClassId,
MappingPropertiesClassId,
TransformationType,
} from '@automapper/types';
} from '../types';
import { isSamePath } from '../utils';
import { getMemberPath } from './get-member-path.util';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { Mapping, Selector } from '@automapper/types';
import type { Mapping, Selector } from '../types';
import {
MapFnClassId,
MappingClassId,
MappingPropertiesClassId,
MappingPropertyClassId,
MappingTransformationClassId,
TransformationType,
} from '@automapper/types';
} from '../types';
import { get } from '../utils';

export function createMapForSelf<TSource, TDestination>(
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/create-mapper/create-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type {
Mapping,
PrimitiveConstructorWithDate,
ValueSelector,
} from '@automapper/types';
import { MappingClassId } from '@automapper/types';
} from '../types';
import { MappingClassId } from '../types';
import { mapArray, mapMutate, mapReturn } from '../map';
import { createMapFluentFunction } from './create-map-fluent-function.util';
import { mappingNullCheck } from '../utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Dictionary, Selector } from '@automapper/types';
import type { Dictionary, Selector } from '../types';

const PROXY_TARGET = (): undefined => undefined;
const PROXY_OBJECT = createProxy(PROXY_TARGET);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CreateMapOptions, Mapping } from '@automapper/types';
import { MappingClassId } from '@automapper/types';
import type { CreateMapOptions, Mapping } from '../types';
import { MappingClassId } from '../types';
import { isDefined } from '../utils';
import { extendMappings } from './extend-mappings.util';
import { getFlatteningSourcePaths } from './get-flattening-source-paths.util';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Mapping } from '@automapper/types';
import { MappingClassId, MappingPropertiesClassId } from '@automapper/types';
import type { Mapping } from '../types';
import { MappingClassId, MappingPropertiesClassId } from '../types';
import { isSamePath } from '../utils';

export function extendMappings(bases: Mapping[], mapping: Mapping) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NamingConvention } from '@automapper/types';
import type { NamingConvention } from '@automapper/core';

export function getFlatteningSourcePaths(
src: Record<string, unknown>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NamingConvention } from '@automapper/types';
import type { NamingConvention } from '../types';

/**
* Convert namingConventions params to [convention, convention] format
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NamingConvention } from '@automapper/types';
import type { NamingConvention } from '../types';
import { isDefined, isEmpty, isSamePath } from '../utils';

export function getNestedMetaKeyAtDestinationPath(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NamingConvention } from '@automapper/types';
import type { NamingConvention } from '../types';
import { isDefined } from '../utils';

export function getSourcePropertyPath(
Expand Down
8 changes: 2 additions & 6 deletions packages/core/src/lib/initialize-utils/map-initialize.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import type {
Dictionary,
MapInitializeReturn,
SelectorReturn,
} from '@automapper/types';
import { TransformationType } from '@automapper/types';
import type { Dictionary, MapInitializeReturn, SelectorReturn } from '../types';
import { TransformationType } from '../types';
import { get } from '../utils';

export function mapInitialize<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MapFnClassId, TransformationType } from '@automapper/types';
import { MapFnClassId, TransformationType } from '../../types';
import { mapInitialize } from '../map-initialize';

describe('MapInitializeFunction', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/lib/map/assert-unmapped-properties.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Dictionary, ErrorHandler } from '@automapper/types';
import type { Dictionary, ErrorHandler } from '../types';

/**
* Depends on implementation of plugin.initializeMapping
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/map/map-member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type {
MapWithArgumentsReturn,
MapWithReturn,
MemberMapReturn,
} from '@automapper/types';
import { MapFnClassId, TransformationType } from '@automapper/types';
} from '../types';
import { MapFnClassId, TransformationType } from '../types';

/**
* Instruction on how to map a particular member on the destination
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/map/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type {
MapOptions,
Mapper,
Mapping,
} from '@automapper/types';
import { MapFnClassId, TransformationType } from '@automapper/types';
} from '../types';
import { MapFnClassId, TransformationType } from '../types';
import { get, isEmpty, mappingNullCheck, set, setMutate } from '../utils';
import { mapMember } from './map-member';
import { assertUnmappedProperties } from './assert-unmapped-properties';
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/member-map-functions/condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type {
ConditionReturn,
Dictionary,
SelectorReturn,
} from '@automapper/types';
import { TransformationType } from '@automapper/types';
} from '../types';
import { TransformationType } from '../types';
import { get } from '../utils';

export function condition<
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/member-map-functions/convert-using.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {
Dictionary,
Selector,
SelectorReturn,
} from '@automapper/types';
import { TransformationType } from '@automapper/types';
} from '../types';
import { TransformationType } from '../types';

export function convertUsing<
TSource extends Dictionary<TSource> = any,
Expand Down
8 changes: 2 additions & 6 deletions packages/core/src/lib/member-map-functions/from-value.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import type {
Dictionary,
FromValueReturn,
SelectorReturn,
} from '@automapper/types';
import { TransformationType } from '@automapper/types';
import type { Dictionary, FromValueReturn, SelectorReturn } from '../types';
import { TransformationType } from '../types';

export function fromValue<
TDestination extends Dictionary<TDestination> = any,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/member-map-functions/ignore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IgnoreReturn } from '@automapper/types';
import { TransformationType } from '@automapper/types';
import type { IgnoreReturn } from '../types';
import { TransformationType } from '../types';

export function ignore(): IgnoreReturn {
return [TransformationType.Ignore];
Expand Down
8 changes: 2 additions & 6 deletions packages/core/src/lib/member-map-functions/map-defer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import type {
DeferFunction,
Dictionary,
MapDeferReturn,
} from '@automapper/types';
import { SelectorReturn, TransformationType } from '@automapper/types';
import type { DeferFunction, Dictionary, MapDeferReturn } from '../types';
import { SelectorReturn, TransformationType } from '../types';

export function mapDefer<
TSource extends Dictionary<TSource> = any,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/member-map-functions/map-from.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {
Resolver,
SelectorReturn,
ValueSelector,
} from '@automapper/types';
import { TransformationType } from '@automapper/types';
} from '../types';
import { TransformationType } from '../types';
import { isResolver } from '../utils';

export function mapFrom<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type {
MapWithArgumentsReturn,
Resolver,
SelectorReturn,
} from '@automapper/types';
import { TransformationType } from '@automapper/types';
} from '../types';
import { TransformationType } from '../types';
import { isResolver } from '../utils';

export function mapWithArguments<
Expand Down
8 changes: 2 additions & 6 deletions packages/core/src/lib/member-map-functions/map-with.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import type {
Dictionary,
MapWithReturn,
SelectorReturn,
} from '@automapper/types';
import { TransformationType, Unpacked, ValueSelector } from '@automapper/types';
import type { Dictionary, MapWithReturn, SelectorReturn } from '../types';
import { TransformationType, Unpacked, ValueSelector } from '../types';

type Constructor<TModel> = new (...args: unknown[]) => TModel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type {
Dictionary,
NullSubstitutionReturn,
SelectorReturn,
} from '@automapper/types';
import { TransformationType } from '@automapper/types';
} from '../types';
import { TransformationType } from '../types';
import { get } from '../utils';

export function nullSubstitution<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
Dictionary,
PreConditionReturn,
SelectorReturn,
} from '@automapper/types';
} from '../types';

export function preCondition<
TSource extends Dictionary<TSource> = any,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MapFnClassId, TransformationType } from '@automapper/types';
import { MapFnClassId, TransformationType } from '../../types';
import { condition } from '../condition';

describe('ConditionFunction', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Converter } from '@automapper/types';
import { MapFnClassId, TransformationType } from '@automapper/types';
import type { Converter } from '../../types';
import { MapFnClassId, TransformationType } from '../../types';
import { convertUsing } from '../convert-using';

describe('ConvertUsingFunction', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MapFnClassId, TransformationType } from '@automapper/types';
import { MapFnClassId, TransformationType } from '../../types';
import { fromValue } from '../from-value';

describe('FromValueFunction', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MapFnClassId, TransformationType } from '@automapper/types';
import { MapFnClassId, TransformationType } from '../../types';
import { ignore } from '../ignore';

describe('IgnoreFunction', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MapFnClassId, TransformationType } from '@automapper/types';
import { MapFnClassId, TransformationType } from '../../types';
import { ignore } from '../ignore';
import { mapDefer } from '../map-defer';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Resolver } from '@automapper/types';
import { MapFnClassId, TransformationType } from '@automapper/types';
import type { Resolver } from '../../types';
import { MapFnClassId, TransformationType } from '../../types';
import { mapFrom } from '../map-from';

describe('MapFromFunction', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MapFnClassId, TransformationType } from '@automapper/types';
import { MapFnClassId, TransformationType } from '../../types';
import { mapWithArguments } from '../map-with-arguments';

describe('MapWithArgumentsFunction', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Mapper } from '@automapper/types';
import { MapFnClassId, TransformationType } from '@automapper/types';
import type { Mapper } from '../../types';
import { MapFnClassId, TransformationType } from '../../types';
import { mapWith } from '../map-with';

describe('MapWithFunction', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MapFnClassId, TransformationType } from '@automapper/types';
import { MapFnClassId, TransformationType } from '../../types';
import { nullSubstitution } from '../null-substitution';

describe('NullSubstitutionFunction', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NamingConvention } from '@automapper/types';
import { NamingConvention } from '../types';

/**
* CamelCaseNamingConvention
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NamingConvention } from '@automapper/types';
import { NamingConvention } from '../types';

/**
* PascalCaseNamingConvention
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NamingConvention } from '@automapper/types';
import { NamingConvention } from '../types';

/**
* SnakeCaseNamingConvention
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/lib/utils/is-resolver.util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Resolver } from '@automapper/types';
import type { Resolver } from '../types';

export function isResolver(fn: unknown): fn is Resolver {
return 'resolve' in (fn as Record<string, unknown>);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/lib/utils/mapping-null-check.util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ErrorHandler, Mapping } from '@automapper/types';
import type { ErrorHandler, Mapping } from '../types';

export function mappingNullCheck(
mapping: Mapping | undefined,
Expand Down

0 comments on commit 558782d

Please sign in to comment.