Skip to content

Commit

Permalink
feat(test): use core types
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Nov 10, 2021
1 parent 35c28a8 commit f562ca0
Show file tree
Hide file tree
Showing 41 changed files with 46 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MappingProfile } from '@automapper/types';
import { MappingProfile } from '@automapper/core';
import { AccountDTO, AccountEntity } from '../models/account';

export const accountProfile: MappingProfile = mapper => {
export const accountProfile: MappingProfile = (mapper) => {
mapper.createMap(AccountEntity, AccountDTO);
}
};
2 changes: 1 addition & 1 deletion packages/integration-test/src/lib/setup.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { classes } from '@automapper/classes';
import type { CreateMapperOptions, Mapper } from '@automapper/core';
import { createMapper } from '@automapper/core';
import { pojos } from '@automapper/pojos';
import type { CreateMapperOptions, Mapper } from '@automapper/types';

export function setup(
name: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MappingProfile } from '@automapper/types';
import { MappingProfile } from '@automapper/core';
import { setupClasses } from '../setup.spec';
import {
SimpleBar,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Converter } from '@automapper/types';
import type { Converter } from '@automapper/core';

export const dateToStringConverter: Converter<Date, string> = {
convert(source: Date): string {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MappingProfile } from '@automapper/core';
import { mapFrom } from '@automapper/core';
import type { MappingProfile } from '@automapper/types';
import { Address, AddressVm } from '../models/address';
import { PascalAddress, PascalAddressVm } from '../models/address-pascal';
import { SnakeAddress, SnakeAddressVm } from '../models/address-snake';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { MappingProfile } from '@automapper/core';
import {
condition,
ignore,
mapFrom,
nullSubstitution,
preCondition,
} from '@automapper/core';
import type { MappingProfile } from '@automapper/types';
import { Avatar, AvatarVm } from '../models/avatar';
import { PascalAvatar, PascalAvatarVm } from '../models/avatar-pascal';
import { SnakeAvatar, SnakeAvatarVm } from '../models/avatar-snake';
Expand All @@ -28,9 +28,7 @@ export const avatarProfile: MappingProfile = (mapper) => {
.forMember((d) => d.willBeIgnored, ignore())
.forMember((d) => d.shouldBeSubstituted, nullSubstitution('sub'));

mapper
.createMap(AvatarVm, Avatar)
.forMember((d) => d.shouldIgnore, ignore());
mapper.createMap(AvatarVm, Avatar).forMember((d) => d.shouldIgnore, ignore());

mapper
.createMap(Avatar, PascalAvatarVm)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MappingProfile } from '@automapper/types';
import type { MappingProfile } from '@automapper/core';
import {
CustomKeyBar,
CustomKeyBarVm,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MappingProfile } from '@automapper/core';
import { fromValue } from '@automapper/core';
import type { MappingProfile } from '@automapper/types';
import {
Foo,
FooBar,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MappingProfile } from '@automapper/types';
import type { MappingProfile } from '@automapper/core';
import { Doctor, DoctorDto } from '../models/doctor';

export const doctorProfile: MappingProfile = (mapper) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MappingProfile } from '@automapper/core';
import { mapFrom } from '@automapper/core';
import type { MappingProfile } from '@automapper/types';
import {
CompositeFairing,
Engines,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mapFrom } from '@automapper/core';
import { MappingProfile } from '@automapper/types';
import { mapFrom, MappingProfile } from '@automapper/core';
import {
EmptyFoo,
EmptyFooVm,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MapAction, Mapper, MappingProfile } from '@automapper/core';
import { mapFrom } from '@automapper/core';
import type { MapAction, Mapper, MappingProfile } from '@automapper/types';
import { SimpleUser, SimpleUserVm } from '../models/simple-user';

export const selfUserProfile: MappingProfile = (mapper) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MappingProfile } from '@automapper/types';
import type { MappingProfile } from '@automapper/core';
import {
TypeConverterCamelSource,
TypeConverterDestination,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MappingProfile } from '@automapper/core';
import { convertUsing, mapFrom, mapWith } from '@automapper/core';
import type { MappingProfile } from '@automapper/types';
import { dateToStringConverter } from '../converters/date-to-string.converter';
import { Avatar, AvatarVm } from '../models/avatar';
import { PascalAvatar, PascalAvatarVm } from '../models/avatar-pascal';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MappingProfile, Resolver } from '@automapper/core';
import { mapFrom } from '@automapper/core';
import type { MappingProfile, Resolver } from '@automapper/types';
import { User, UserVm } from '../models/user';
import { PascalUser, PascalUserVm } from '../models/user-pascal';
import { SnakeUser, SnakeUserVm } from '../models/user-snake';
Expand Down Expand Up @@ -55,11 +55,11 @@ export const userProfile: MappingProfile = (mapper) => {
.createMap(UserVm, User)
.forMember(
(d) => d.firstName,
mapFrom((s) => s.first),
mapFrom((s) => s.first)
)
.forMember(
(d) => d.lastName,
mapFrom((s) => s.last),
mapFrom((s) => s.last)
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { classes } from '@automapper/classes';
import type { ErrorHandler } from '@automapper/core';
import { createMapper } from '@automapper/core';
import { ErrorHandler } from '@automapper/types';
import {
SimpleBar,
SimpleBarVm,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Resolver } from '@automapper/core';
import { mapWithArguments } from '@automapper/core';
import type { Resolver } from '@automapper/types';
import { setupClasses } from '../setup.spec';
import {
SimpleBar,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MappingProfile } from '@automapper/types';
import type { MappingProfile } from '@automapper/core';
import { setupPojos } from '../setup.spec';
import type {
SimpleBar,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Converter } from '@automapper/types';
import type { Converter } from '@automapper/core';

export const dateToStringConverter: Converter<Date, string> = {
convert(source: Date): string {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MappingProfile } from '@automapper/core';
import { mapFrom } from '@automapper/core';
import type { MappingProfile } from '@automapper/types';
import type {
PascalAddress,
PascalAddressVm,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { MappingProfile } from '@automapper/core';
import {
condition,
ignore,
mapFrom,
nullSubstitution,
preCondition,
} from '@automapper/core';
import type { MappingProfile } from '@automapper/types';
import type {
PascalAvatar,
PascalAvatarVm,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MappingProfile } from '@automapper/types';
import { MappingProfile } from '@automapper/core';
import {
createCustomKeyFooMetadata,
CustomKeyBar,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mapFrom } from '@automapper/core';
import { MappingProfile } from '@automapper/types';
import { mapFrom, MappingProfile } from '@automapper/core';
import type {
Foo,
FooFoo,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MapAction, Mapper, MappingProfile } from '@automapper/core';
import { mapFrom } from '@automapper/core';
import type { MapAction, Mapper, MappingProfile } from '@automapper/types';
import {
createSimpleUserMetadata,
SimpleUser,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MappingProfile } from '@automapper/types';
import type { MappingProfile } from '@automapper/core';
import {
createTypeConverterMetadata,
TypeConverterCamelSource,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MappingProfile } from '@automapper/core';
import { convertUsing, mapWith } from '@automapper/core';
import type { MappingProfile } from '@automapper/types';
import { dateToStringConverter } from '../converters/date-to-string.converter';
import type {
PascalUserProfile,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MappingProfile } from '@automapper/core';
import { mapFrom } from '@automapper/core';
import type { MappingProfile } from '@automapper/types';
import type {
PascalUser,
PascalUserVm,
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-integration-test/src/app/app.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InjectMapper } from '@automapper/nestjs';
import type { Mapper } from '@automapper/types';
import type { Mapper } from '@automapper/core';
import { Injectable } from '@nestjs/common';
import { Bar, Foo, FooVm } from './models/foo';
import { getUser } from './models/get-user';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InjectMapper } from '@automapper/nestjs';
import type { Mapper } from '@automapper/types';
import type { Mapper } from '@automapper/core';
import { Controller, Get } from '@nestjs/common';
import { Bar } from '../models/foo';
import { FooExtend, FooExtendVm } from './foo-extend.model';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { classes } from '@automapper/classes';
import type { Mapper } from '@automapper/core';
import { createMapper } from '@automapper/core';
import { getMapperToken } from '@automapper/nestjs';
import type { Mapper } from '@automapper/types';
import { Test } from '@nestjs/testing';
import { FooProfile } from '../foo/foo.profile';
import { Bar } from '../models/foo';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AutomapperProfile, InjectMapper } from '@automapper/nestjs';
import type { Mapper, MappingProfile } from '@automapper/types';
import type { Mapper, MappingProfile } from '@automapper/core';
import { Injectable } from '@nestjs/common';
import { Foo, FooVm } from '../models/foo';
import { FooExtend, FooExtendVm } from './foo-extend.model';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { classes } from '@automapper/classes';
import type { Mapper } from '@automapper/core';
import { createMapper } from '@automapper/core';
import { getMapperToken } from '@automapper/nestjs';
import type { Mapper } from '@automapper/types';
import { Test } from '@nestjs/testing';
import { Bar, Foo, FooVm } from '../models/foo';
import { FooProfile } from './foo.profile';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Mapper, MappingProfile } from '@automapper/core';
import { mapFrom, mapWith } from '@automapper/core';
import { AutomapperProfile, InjectMapper } from '@automapper/nestjs';
import type { Mapper, MappingProfile } from '@automapper/types';
import { Injectable } from '@nestjs/common';
import { Bar, BarVm, Foo, FooVm } from '../models/foo';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { classes } from '@automapper/classes';
import type { Mapper } from '@automapper/core';
import { createMapper } from '@automapper/core';
import { getMapperToken } from '@automapper/nestjs';
import type { Mapper } from '@automapper/types';
import { Test } from '@nestjs/testing';
import { Address, AddressVm } from '../models/address';
import { AddressProfile } from './address.profile';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Mapper, MappingProfile } from '@automapper/core';
import { mapFrom } from '@automapper/core';
import { AutomapperProfile, InjectMapper } from '@automapper/nestjs';
import type { Mapper, MappingProfile } from '@automapper/types';
import { Injectable } from '@nestjs/common';
import { Address, AddressVm } from '../models/address';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { classes } from '@automapper/classes';
import type { Mapper } from '@automapper/core';
import { createMapper } from '@automapper/core';
import { getMapperToken } from '@automapper/nestjs';
import type { Mapper } from '@automapper/types';
import { Test } from '@nestjs/testing';
import { Avatar, AvatarVm } from '../models/avatar';
import { AvatarProfile } from './avatar.profile';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Mapper, MappingProfile } from '@automapper/core';
import {
condition,
ignore,
Expand All @@ -6,7 +7,6 @@ import {
preCondition,
} from '@automapper/core';
import { AutomapperProfile, InjectMapper } from '@automapper/nestjs';
import type { Mapper, MappingProfile } from '@automapper/types';
import { Injectable } from '@nestjs/common';
import { Avatar, AvatarVm } from '../models/avatar';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { classes } from '@automapper/classes';
import type { Mapper } from '@automapper/core';
import { createMapper } from '@automapper/core';
import { getMapperToken } from '@automapper/nestjs';
import type { Mapper } from '@automapper/types';
import { Test } from '@nestjs/testing';
import { Address, AddressVm } from '../models/address';
import { Avatar, AvatarVm } from '../models/avatar';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Converter, Mapper, MappingProfile } from '@automapper/core';
import { convertUsing, mapWith } from '@automapper/core';
import { AutomapperProfile, InjectMapper } from '@automapper/nestjs';
import type { Converter, Mapper, MappingProfile } from '@automapper/types';
import { Injectable } from '@nestjs/common';
import { Avatar, AvatarVm } from '../models/avatar';
import { UserProfile, UserProfileVm } from '../models/user-profile';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { classes } from '@automapper/classes';
import type { Mapper } from '@automapper/core';
import { CamelCaseNamingConvention, createMapper } from '@automapper/core';
import { getMapperToken } from '@automapper/nestjs';
import type { Mapper } from '@automapper/types';
import { Test } from '@nestjs/testing';
import { getUser } from '../models/get-user';
import { User, UserVm } from '../models/user';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Mapper, MappingProfile } from '@automapper/core';
import { mapFrom } from '@automapper/core';
import { AutomapperProfile, InjectMapper } from '@automapper/nestjs';
import type { Mapper, MappingProfile } from '@automapper/types';
import { Injectable } from '@nestjs/common';
import { User, UserVm } from '../models/user';

Expand Down

0 comments on commit f562ca0

Please sign in to comment.