Skip to content

Latest commit

Β 

History

History
1473 lines (968 loc) Β· 107 KB

CHANGELOG.md

File metadata and controls

1473 lines (968 loc) Β· 107 KB

8.7.12 (2023-11-11)

0.0.0 (2023-10-20)

0.0.0 (2023-10-20)

8.7.9 (2023-10-20)

8.7.8 (2023-10-20)

⚠ BREAKING CHANGES

  • types: @automapper/types is removed
  • core: mapWith signature now accepts the models directly instead of a deferred function. This allows to use mapWith easier
  • classes: AutoMap only accepts an optional config object now. Positional arguments overload has been removed
  • Cutting a new major version due upgrade to NestJS v8
  • Upgrade to Nx 12.3.3
  • pojos: Previously, null was used to skip properties. Now, use false instead, null means something else.
  • This release enables strict mode for automapper. The type is stricter which might affect your current implementations.

Features

  • add core (04cd18c)
  • classes/mapped-types: add Mapped Types (46e02ba)
  • classes: add AUTOMAP_PROPERTIES_METADATA_KEY to public api (1165380)
  • classes: add logic to handle @autoMapIgnore JSDoc comment (2de6893), closes #395
  • classes: add logic to handle getter only properties (d081ac6)
  • classes: add logic to take advantage of transformer plugin if used (f3aca21)
  • classes: add shim file for browsers (#354) (4feff72), closes #353
  • classes: expose Constructible type (2c3eaf0)
  • classes: expose instantiate (b2dd592)
  • classes: remove AutoMap without config object (95479ca)
  • classes: store source and destination on mapping; use .name instead of toString() (6b0530c)
  • classes: strict mode friendly (bac51e9)
  • classes: use core types (985def8)
  • core: add ability to pass in destinationObj and mutate on map instead of return (46e920d)
  • core: add autoMap mapping configuration (#538) (5906add)
  • core: add basic TypeConverter for primitives (83fd239)
  • core: add core (5fe3f93)
  • core: add custom properties to isolate forMember configuration (e5b7028), closes #497
  • core: add forSelf (140a37c)
  • core: add isFileConstructor util (54d2b65)
  • core: add logger (51a7984)
  • core: add logic to run preMapArray if available when invoking mapArray (f1f97f3)
  • core: add mapWithArguments (2732300)
  • core: add partial support for ES6 computed property names (#293) (93d3f66), closes #289
  • core: adjust mapWith signature (2df08ac)
  • core: adjust set() to have setMutate() and not return (bdd6d17)
  • core: adjust typings to support more custom type converter (6ef280f)
  • core: allow mapWithArguments to accept Resolver (8f1dfc6)
  • core: allow preMap and postMap to also be called with the Mapping (1e0fa62)
  • core: allow shorthand syntax for same identifiers w/ createMap and map (f06bf24)
  • core: applyMetadata now needs to know whether it's applying to a model as Source or as Destination (70d267a)
  • core: better error message for mapping operation error (550d8e8)
  • core: MapCallback is now called with extraArguments (60a1da8)
  • core: move types into core (62ffdc6)
  • core: start storing Source and Destination keys on Mapping (73d19a3)
  • core: strict mode friendly (5178c3c)
  • core: support strong type extraArguments (0cd5119)
  • core: use local types (558782d)
  • core: use model's name on mapping error message (#518) (09bb926)
  • core: use postMap if available (fb22792)
  • core: use proxy to get members from selector function (#301) (704c6ad)
  • enable strict mode (6456bec)
  • experimental/transformer-plugin: add transformer plugin for classes package (67cdd29)
  • mikro: add mikro plugin (6f52813)
  • nestjs: add 9.X.X compatibility #488 (#494) (e815c54)
  • nestjs: add MapInterceptor (1a811e5)
  • nestjs: add MapPipe to transform Query and Body (d8198e0)
  • nestjs: add nestjs integration package (db550c3)
  • nestjs: strict mode friendly (64abad4)
  • nestjs: use core types (a21f5a3)
  • pojos: allow to pass in null for createMetadataMap to treat something as primitives (7357ad5)
  • pojos: expose instantiate as public API (528b193)
  • pojos: store source and destination on mapping (2fd60bc)
  • pojos: strict mode friendly (deedc1b)
  • pojos: support File as a metadata constructor (0eafe05)
  • pojos: use core types (d601da2)
  • prepare for beta (17e2199)
  • repo: change to use ESM while still supporting cjs (7866e00)
  • sequelize: add postMap to instantiate a Model instance from map result (9552516)
  • sequelize: add sequelize plugin (b9105bb)
  • sequelize: use core types (35c28a8)
  • start working on some core functionalities (5d4fe2b)
  • test: use core types (f562ca0)
  • types: add MapArrayOptions and adjust mapArray signature (9d2df49)
  • types: add mapWithArguments to typing definitions (4b52da3)
  • types: add postMap to MapPlugin (bbdd895)
  • types: moving types to core to retire @automapper/types (ccfcf94)
  • types: strict mode friendly (f8e6211)
  • update Nx (04e3673)
  • upgrade nest 8 (f23ee9a), closes #313
  • upgrade Nx (ea0eff6)
  • upgrade packages (329828e)
  • use array to store paths (#303) (d201093)
  • zod: init zod (aa010cd)

Bug Fixes

  • [docs] Wrong hyperlink #476 (#490) (96af5f9)
  • add exports field since web:rollup does not add it by default (a2c2df1), closes #485 #483
  • adjust all peer deps (88650ad)
  • adjust config (b074b21)
  • classes, core: add ability to map Date[] types (#399) (cb27b1a), closes #397 #397
  • classes: add a metadataTracker to track identifier whose metadata has already been extracted (7cd1ae2)
  • classes: add script to update plugin version for jest (018c666), closes #528
  • classes: adjust code smell (cf53a1f)
  • classes: adjust packageJson exports to include secondary entry points (a82c0c3)
  • classes: clean up optional chaining operator on function calls (e6c3299)
  • classes: clean up transformer plugin to ensure decorator is ignored (e82e9a1)
  • classes: ensure to use return value of concat() (705cbec)
  • classes: expose getMetadataList as public API (b5bde21)
  • classes: fix infinity loop with circular dependency models (3360992)
  • classes: get type from typeNode in the case type isn't sufficient enough (4ab3549)
  • classes: isPrimitiveConstructor also returns true for Array constructor (c5d111d), closes #249
  • classes: make sure to reassign metadataList (ebd53dc)
  • classes: merge metadata from Reflection and Factory fn (393a7d3)
  • classes: move all single functions to exported utils (219b917)
  • classes: only save metadata if typeFn is not null (3f03f8c)
  • classes: rename PrimitiveWithDate to PrimitiveExtended (34d8a52)
  • classes: rename types.d.ts to types.ts to include with bundle (3a15f72)
  • classes: skip empty metadataList before looping (88ecf9c)
  • classes: treat property as primitives if metaResult is null. Default Date to undefined if valueAtKey is undefined (8e17527), closes #254
  • classes: use aliasSymbol and aliasTypeArguments for transformer plugin if they exist (6b0b5ae)
  • classes: use class constructor's name instead of constructor function (#452) (8b413f9)
  • classes: widen Constructible type (a394e5c), closes #365
  • core: add check to only run nest map on applicable identifiers in map member (262f86b), closes #480
  • core: add custom node inspect to log meaningful message for Mapper (empty object as Proxy) (de9725a)
  • core: add non-null assertion to mapMemberFn[misc] when transformation type is MapFrom/MapWith (746e94e)
  • core: add prototype properties (getters, setters) to destinationPath (15ad713), closes #334
  • core: adjust code smell (736f58d)
  • core: adjust getFlatteningPaths to flatten more as needed (b8734ec)
  • core: adjust getFlatteningSourcePath to take into account multiple parts path with naming conventions (811568e)
  • core: adjust how unmapped properties assertion work (3f2bb0e), closes #394
  • core: adjust isDefined (6187453)
  • core: adjust logger impl (33978de)
  • core: allow same identifier to be mapped with custom mapping if such mapping is created (73e1224), closes #479
  • core: change how File is handled in map (57df4ad)
  • core: check null and fail fast in getPathRecursive (449da22)
  • core: clean up optional chaining (d223d79)
  • core: cleanup default serializer options (653cbb7)
  • core: condition and substitutions should respect automap nature of a property (1ab671d), closes #461
  • core: consolidate some logic between forMember and createInitialMapping (88397b4)
  • core: ensure applyTypeConverter to work correctly (0f1b689)
  • core: ensure forMember (custom) will always override forSelf (ef7471a)
  • core: ensure forMember to always push mapping property to customProperties (27c1ca0)
  • core: ensure properties that aren't on destination won't be mapped from forSelf (390b8bb)
  • core: ensure to call mapArray with mapWith if sourceValue is an Array (0eef348), closes #253
  • core: export symbols (a87acb5)
  • core: extend uses customProperties instead of properties because it is custom (b29f2ef)
  • core: fail fast when mapping is not found (95a196f)
  • core: fallback to primitive if constructor/function is undefined (ac5030f)
  • core: fix freezing of source object after mapping (#468) (a95563d), closes #467 #467
  • core: handle stringify symbol (0f7f90d), closes #501
  • core: improve error message for logging (c9db5c4)
  • core: make sure to bind plugin to preMap this context (19479a3)
  • core: map as-is for same identifiers (270cb53), closes #460
  • core: move isDateConstructor and isPrimitiveConstructor from plugins to core (997528b)
  • core: not clearing metadataMap on dispose (f2ae39c)
  • core: null check for source selector on MapFrom (a489d9c)
  • core: null check mapping before applying typeConverters (5d87147)
  • core: null check mappingProp and nestedMappingPair before continue (850cafb)
  • core: null/undefined check for source in map and mapArray (b37d29a)
  • core: only add writable property to unmappedKeys (aa565aa)
  • core: pass extraArguments down to nested mapping (10465be)
  • core: relax addTypeConverter return to include undefined (20c250c)
  • core: remove constraint on postMap (remove seal on destination) (2c38340), closes #450
  • core: remove properties added by istanbul for not failing in test coverage (1dcdcdb)
  • core: rename default serializer to strategy initializer (2a1b4b4)
  • core: rename PrimitiveWithDate to PrimitiveExtended (4c299ff)
  • core: revert export symbols as no need (bb5d32f)
  • core: run beforeMap in mapArray with an empty array instead (2975071)
  • core: send extraArgs from original map operation to mapWith operations (65c6a74), closes #509
  • core: skip key that is a method in getPathRecursive (5a56529), closes #396
  • core: skip nested mapping for array prop if destination identifier is primitive (d2327bc)
  • core: treat null metadata/Date same as null value aka just map the value. add logic for isNullMetadata to MappingPropert (97f260d)
  • core: treat property that is typed-converted as-is because they cannot go through normal mapping pipeline (819485f)
  • core: update applyMetadata to ensure selfReference properties are handled (109b5f0)
  • core: use isEmpty to check for nested metakey instead of using length (0329e6e)
  • core: use readonly access modifier in MappingStrategy interface instead of get. (#478) (bc6b2f1)
  • core: utilize extraArguments in mapArray (ac5bb40)
  • experimental/transformer-plugin: adjust merging options with default options (c4c123b)
  • experimental/transformer-plugin: adjust transformer plugin to have a workaround for ESM (1f862d0)
  • experimental/transformer-plugin: fix options (bac5074)
  • experimental/transformer-plugin: fix publish (c90047a), closes #261
  • experimental/transformer-plugin: move into classes (05aae8a)
  • handle peer dependencies version (82e447a), closes #482
  • mikro: adjust instantiate logic (bcf004e)
  • mikro: adjust instantiate logic (attempt 2) (6f6ae9f)
  • mikro: adjust instantiate logic (attempt) (75b4367)
  • mikro: adjust serializeEntity to return the object with id for uninitialized reference (62f5c0f)
  • mikro: allow entity serializer to be customizable (f4f7d29)
  • mikro: assign id before serialize entity (068d25b)
  • mikro: cannot read properties of undefined (reading 'id') bug (#493) (4fe4e37)
  • mikro: ensure preMapArray run instantiate correctly (7b2ef67)
  • mikro: ensure serializeEntity follows the metadata object to accommodate depth of serialization (54cd373)
  • mikro: recursively unwrap collections (a445b3b)
  • mikro: remove redundant util (a943c10)
  • mikro: run toJSON on reference (a5e2a67)
  • mikro: serialize entity in instantiate as well (635fba2)
  • mikro: serialize entity properly (4a18543)
  • mikro: serialize reference (567bd73)
  • mikro: serialize reference (attempt 2) (47da73e)
  • mikro: skipping symbol (83494e6)
  • mikro: use getEntity as unwrap value instead of recursion (292759c)
  • nestjs: adjust globalNamingConventions options to also accept a single NamingConvention (822c790)
  • nestjs: bump peerDeps (11fbc5c)
  • nestjs: ensure mapper is safe for accessing with optional chaining (83307f5)
  • nestjs: fix memoize util (e56887b)
  • nestjs: make sure mapOptions passed in as null if it's empty (93e3761), closes #247
  • nestjs: make sure to support Nest7 as well (8235720)
  • nestjs: move addProfile code to the micro task queue (70b268c), closes #264
  • nestjs: revert back to resolved Promise. nextTick seems to run a little behind (5a91c31)
  • nestjs: use process.nextTick instead of resolved Promise (4dd8da6)
  • pojos: add Array to isPrimitiveConstructor (6415463)
  • pojos: adjust code smell (4682fbf)
  • pojos: adjust typings for createMetadataMap (18cc504)
  • pojos: clean up optional chaining operator on function calls (65304a7)
  • pojos: treat property as primitives if metaResult is null. Date member to be returned as undefined if valueAtKey is undefined (3e474ab)
  • remove target default on package that affects the secondary entry point (4993411)
  • repo: adjust exports field in package json across packages (f462395)
  • repo: remove peerDeps (f6ef2a0)
  • repo: use js:swc for all packages (03e4577)
  • sequelize: make options optional (8355120)
  • sequelize: only run intiialize on sequelize model (05c3d82)
  • should not map undefined value when mapMutate (#317) (416e498)
  • transformer-plugin: try get typeReference and null check for property assignment (d447783)
  • types: add instantiate to MapPlugin public API (53343f9)
  • types: add isNullMetadata to MappingTransformation (a0b39d9)
  • types: adjust type of Primitive type converter (f30b9c4)
  • types: remove all named tuples to support TS <4 (9de3c72)
  • types: replace unknown record type in mapWithArguments by any (#347) (8160498), closes #346

Documentations

  • add @huybn5776 as a contributor (2414b79)
  • add @jasonmerino as a contributor (809e447)
  • add @jmplahitko as a contributor (3ff1b7b)
  • add @micalevisk as a contributor (29500ad)
  • add @nartc as a contributor (2c837c7)
  • add @roblopz as a contributor (a45bc0a)
  • add @robsonhermes as a contributor (04f5755)
  • add @AliYusuf95 as a contributor (956aceb)
  • add @Alwinator as a contributor (5fe1547)
  • add @LennartH as a contributor (2f7c948)
  • add @VPecquerie as a contributor (2f5c5af)
  • add all contributors (9c732c3)
  • add basic docs about transformer plugin (8bf0ab5)
  • add CONTRIBUTING guide (df72029)
  • add Custom Type Converter (05f02a5)
  • add docs about enums and array of objects (eaef681), closes #263
  • add docs about MapPipe (8a8d673)
  • add docs for extra arguments (6aa778c)
  • add docs for transformer plugin (6c92ee6)
  • add docsearch (768c632)
  • add documentation about extending a plugin (f7869f2)
  • add documentation on self mapping (3a3b84d)
  • add documentations about properties with number (bc51b24)
  • add docusaurus (c0a406d)
  • add ForSelf doc to sidebars (9f0f478)
  • add github actions badges to README (fd4e705)
  • add information about strict mode (90d61e4)
  • add lookup types limitation on custom type converter (#370) (9ab6023)
  • add mapped-types docs (050b538)
  • add migration notes for Enum properties (7c4cf6f)
  • add sequelize to docs site' (2848e46)
  • add sonarcloud badges (a7f9712)
  • add warning about type converters (2ce47f1)
  • adjust algolia search again (031db42)
  • adjust CONTRIBUTING guide (a8adf5d)
  • adjust doc search settings (00d25ce)
  • adjust docs (ed01cfe)
  • adjust docs (f5c1bd3)
  • adjust docs for sequelize (7ba77ce)
  • adjust docs on transformer plugin (4e3a009)
  • adjust README, docs, and package.json (33d9d9b)
  • adjust typo (04ebb42)
  • bump node version for docusaurus workflow (fcb93a5)
  • classes: add comment about limitation of array properties (#326) (866e311)
  • classes: add more comments to AutoMap decorator (b00a01c)
  • classes: fix link issue (#327) (2030b50)
  • clean up whitespace (6e7d199)
  • component: added required tsconfig switches for @AutoMap (#309) (7d6ab91), closes #307
  • core: add documentations about mapMutate (a50fed2)
  • core: add documentations for forSelf (e896a22)
  • core: add documentations on AutoMapperLogger (53b7b40)
  • core: add to readme nestjs package (7174acb)
  • core: adjust documentation (193d541)
  • core: adjust readme (8094bb7)
  • core: adjust README (ad9e29b)
  • core: adjust README (c9bf760)
  • core: update packages (01ad5cd)
  • core: update README (e441928)
  • core: update some basic to READMEs (25a3fe2)
  • display last updated date and author (#390) (0e0956b)
  • explain about singular option for nestjs (fed7d2d)
  • fix mikro pagakage name on readme (#487) (13b7305)
  • modify docs on sequelize (18971db)
  • nestjs: add docs about MapInterceptor (69acb8e)
  • nestjs: add MapInterceptor signature (8d6e42d)
  • nestjs: add nestjs-integration-test application to test nestjs package (1575fba)
  • nestjs: formatting (a1bd05e)
  • remove 'odd-property name' limitation (99e0efd)
  • remove all reference to automapper/types (9e44e17)
  • remove limitation to Custom Type Converter (a28d320)
  • remove types from readme (31ab69f)
  • sequelize: mention extending classes (232a83d)
  • set docs default color mode to dark (ee609be)
  • update (aca0d8d)
  • update @roblopz as a contributor (cd23868)
  • update docs (f645777)
  • update docs (e59ce14)
  • update docs deps and add new docs (16719ff)
  • update docusaurus (8ad45f8)
  • update docusaurus (3b439b4)
  • update docusaurus and adjust extend plugin example (023b67d), closes #320
  • update docusaurus beta (9e09d67)
  • update migrations docs about map() and skipUnmappedAssertions (9af378e)
  • update package.json with repo info (13a8fc0)
  • update README about nartc/automapper (3885bef)
  • update README and add migrations docs (76c3127)
  • update various TODOs in docs (b1a6d56)

8.7.7 (2022-10-25)

Bug Fixes

  • core: extend uses customProperties instead of properties because it is custom (b29f2ef)
  • core: send extraArgs from original map operation to mapWith operations (65c6a74), closes #509

8.7.6 (2022-08-31)

Bug Fixes

8.7.5 (2022-08-03)

8.7.4 (2022-08-02)

8.7.3 (2022-08-02)

Bug Fixes

  • remove target default on package that affects the secondary entry point (4993411)

8.7.2 (2022-07-31)

Re-release due to erroneous artifacts in 8.7.1

8.7.1 (2022-07-29)

Bug Fixes

  • core: ensure forMember to always push mapping property to customProperties (27c1ca0)

8.7.0 (2022-07-27)

Features

  • core: add custom properties to isolate forMember configuration (e5b7028), closes #497

8.6.0 (2022-07-25)

Features

Bug Fixes

Documentations

8.5.1 (2022-07-13)

Features

  • core: MapCallback is now called with extraArguments (60a1da8)

Bug Fixes

  • classes: get type from typeNode in the case type isn't sufficient enough (4ab3549)
  • classes: use aliasSymbol and aliasTypeArguments for transformer plugin if they exist (6b0b5ae)
  • core: skip nested mapping for array prop if destination identifier is primitive (d2327bc)

Documentations

8.5.0 (2022-07-05)

Bug Fixes

  • core: adjust logger impl (33978de)

Documentations

  • core: add documentations on AutoMapperLogger (53b7b40)

8.5.0-beta.0 (2022-07-02)

Features

8.4.1 (2022-07-01)

Bug Fixes

  • add exports field since web:rollup does not add it by default (a2c2df1), closes #485 #483
  • handle peer dependencies version (82e447a), closes #482

Documentations

8.4.0 (2022-07-01)

Features

  • core: allow shorthand syntax for same identifiers w/ createMap and map (f06bf24)

Bug Fixes

  • adjust all peer deps (88650ad)
  • core: add check to only run nest map on applicable identifiers in map member (262f86b), closes #480
  • core: allow same identifier to be mapped with custom mapping if such mapping is created (73e1224), closes #479
  • core: cleanup default serializer options (653cbb7)
  • core: rename default serializer to strategy initializer (2a1b4b4)

Documentations

8.3.7 (2022-06-02)

Bug Fixes

  • core: use readonly access modifier in MappingStrategy interface instead of get. (#478) (bc6b2f1)

Documentations

  • bump node version for docusaurus workflow (fcb93a5)
  • update docusaurus (8ad45f8)

8.3.7-beta.0 (2022-05-27)

Documentations

8.3.6 (2022-05-06)

Bug Fixes

8.3.5 (2022-05-05)

Documentations

8.3.4 (2022-05-04)

Bug Fixes

  • core: treat property that is typed-converted as-is because they cannot go through normal mapping pipeline (819485f)

Documentations

8.3.3 (2022-04-13)

Bug Fixes

  • core: condition and substitutions should respect automap nature of a property (1ab671d), closes #461
  • core: map as-is for same identifiers (270cb53), closes #460### 8.3.2 (2022-04-11)

Bug Fixes

  • core: update applyMetadata to ensure selfReference properties are handled (109b5f0)

8.3.1 (2022-04-11)

Bug Fixes

  • classes: adjust packageJson exports to include secondary entry points (a82c0c3)

8.3.0 (2022-04-11)

Features

  • core: applyMetadata now needs to know whether it's applying to a model as Source or as Destination (70d267a)

Bug Fixes

  • core: not clearing metadataMap on dispose (f2ae39c)

8.2.4 (2022-04-10)

Bug Fixes

  • core: add custom node inspect to log meaningful message for Mapper (empty object as Proxy) (de9725a)

8.2.3 (2022-04-07)

Bug Fixes

  • classes: use class constructor's name instead of constructor function (#452) (8b413f9)
  • core: remove constraint on postMap (remove seal on destination) (2c38340), closes #450

8.2.2 (2022-04-07)

Bug Fixes

  • mikro: adjust serializeEntity to return the object with id for uninitialized reference (62f5c0f)

8.2.1 (2022-04-07)

Bug Fixes

  • core: adjust getFlatteningPaths to flatten more as needed (b8734ec)

8.2.0 (2022-04-07)

Features

  • core: allow preMap and postMap to also be called with the Mapping (1e0fa62)

Bug Fixes

  • mikro: ensure serializeEntity follows the metadata object to accommodate depth of serialization (54cd373)

8.1.0 (2022-04-03)## 8.1.0-beta.0 (2022-04-03)

Features

  • repo: change to use ESM while still supporting cjs (7866e00)

8.0.1 (2022-03-30)

Bug Fixes

  • classes: add a metadataTracker to track identifier whose metadata has already been extracted (7cd1ae2)
  • core: revert export symbols as no need (bb5d32f)

8.0.1-beta.1 (2022-03-30)

Bug Fixes

  • classes: fix infinity loop with circular dependency models (3360992)
  • core: export symbols (a87acb5)

8.0.1-beta.0 (2022-03-30)

Bug Fixes

  • repo: adjust exports field in package json across packages (f462395)

8.0.0 (2022-03-30)

It is finally here πŸŽ‰. Highlights:

  • Smaller bundle-size
  • Support CJS and ESM
  • Functional approach with tree-shake in mind
  • Custom Constructor

Check out the Migration Guide

7.3.14 (2022-03-05)

Bug Fixes

  • mikro: use getEntity as unwrap value instead of recursion (292759c)

7.3.13 (2022-03-05)

Bug Fixes

  • mikro: recursively unwrap collections (a445b3b)

7.3.12 (2022-03-05)

Bug Fixes

  • mikro: run toJSON on reference (a5e2a67)

7.3.11 (2022-03-05)

Bug Fixes

Features

Bug Fixes

Bug Fixes

  • mikro: serialize reference (attempt 2) (47da73e)

7.3.9 (2022-02-26)

Bug Fixes

  • mikro: serialize reference (567bd73)

7.3.8 (2022-02-25)

Bug Fixes

  • mikro: adjust instantiate logic (attempt 2) (6f6ae9f)

7.3.7 (2022-02-25)

Bug Fixes

  • mikro: adjust instantiate logic (attempt) (75b4367)

7.3.6 (2022-02-25)

Bug Fixes

  • mikro: allow entity serializer to be customizable (f4f7d29)

7.3.5 (2022-02-25)

Bug Fixes

  • mikro: assign id before serialize entity (068d25b)

7.3.4 (2022-02-25)

Bug Fixes

  • mikro: adjust instantiate logic (bcf004e)

7.3.3 (2022-02-25)

Bug Fixes

7.3.2 (2022-02-25)

Bug Fixes

  • mikro: serialize entity in instantiate as well (635fba2)

7.3.1 (2022-02-25)

Bug Fixes

  • mikro: serialize entity properly (4a18543)

7.3.0 (2022-02-25)

Features

  • mikro: add mikro plugin (6f52813)

Bug Fixes

  • repo: use js:swc for all packages (03e4577)

7.2.1 (2022-01-11)

Bug Fixes

  • classes, core: add ability to map Date[] types (#399) (cb27b1a), closes #397 #397
  • core: relax addTypeConverter return to include undefined (20c250c)
  • core: skip key that is a method in getPathRecursive (5a56529), closes #396

Documentations

7.2.0 (2022-01-06)

Features

  • classes: add logic to handle @autoMapIgnore JSDoc comment (2de6893), closes #395

Bug Fixes

  • core: adjust how unmapped properties assertion work (3f2bb0e), closes #394

Documentations

  • display last updated date and author (#390) (0e0956b)

7.1.1 (2021-12-23)

Bug Fixes

  • core: fallback to primitive if constructor/function is undefined (ac5030f)

7.1.0 (2021-12-20)

Features

  • core: adjust typings to support more custom type converter (6ef280f)

Documentations

  • remove limitation to Custom Type Converter (a28d320)
  • update docusaurus (3b439b4)

7.0.3 (2021-12-19)

Bug Fixes

  • core: improve error message for logging (c9db5c4)

7.0.2 (2021-11-12)

Bug Fixes

  • classes: rename PrimitiveWithDate to PrimitiveExtended (34d8a52)
  • core: change how File is handled in map (57df4ad)
  • core: rename PrimitiveWithDate to PrimitiveExtended (4c299ff)

Documentations

  • add ForSelf doc to sidebars (9f0f478)
  • remove all reference to automapper/types (9e44e17)

7.0.1 (2021-11-11)

Documentations

  • remove types from readme (31ab69f)

7.0.0 (2021-11-11)

⚠ BREAKING CHANGES

  • types: @automapper/types is removed

@automapper/types has been removed and the types have been moved to automapper-core. This is to reduce the amount of libraries that the consumers have to install. The types themselves are untouched, you can probably fix this with a simple Find and Replace.

Features

  • classes: use core types (985def8)
  • core: add isFileConstructor util (54d2b65)
  • core: move types into core (62ffdc6)
  • core: use local types (558782d)
  • nestjs: use core types (a21f5a3)
  • pojos: support File as a metadata constructor (0eafe05)
  • pojos: use core types (d601da2)
  • sequelize: use core types (35c28a8)
  • test: use core types (f562ca0)
  • types: moving types to core to retire @automapper/types (ccfcf94)

Documentations

  • add lookup types limitation on custom type converter (#370) (9ab6023)
  • core: add documentations for forSelf (e896a22)

Refactor

  • pojos: clean up if check (0470fb3)

6.3.1 (2021-10-28)

Bug Fixes

  • types: adjust type of Primitive type converter (f30b9c4)

Refactor

  • classes: clean up model visitor (1126755)

Documentations

6.3.0 (2021-10-26)

Features

Bug Fixes

  • classes: widen Constructible type (a394e5c), closes #365

6.2.1 (2021-09-21)

Bug Fixes

  • core: ensure applyTypeConverter to work correctly (0f1b689)

6.2.0 (2021-09-21)

Features

  • classes: store source and destination on mapping; use .name instead of toString() (6b0530c)
  • core: start storing Source and Destination keys on Mapping (73d19a3)
  • core: support strong type extraArguments (0cd5119)
  • pojos: store source and destination on mapping (2fd60bc)

Bug Fixes

  • types: replace unknown record type in mapWithArguments by any (#347) (8160498), closes #346

Documentations

  • remove 'odd-property name' limitation (99e0efd)

6.1.4 (2021-09-10)

Bug Fixes

  • transformer-plugin: try get typeReference and null check for property assignment (d447783)

6.1.3 (2021-08-30)

Bug Fixes

  • core: ensure properties that aren't on destination won't be mapped from forSelf (390b8bb)

6.1.2 (2021-08-30)

Bug Fixes

  • nestjs: make sure to support Nest7 as well (8235720)

6.1.1 (2021-08-27)

Bug Fixes

  • core: ensure forMember (custom) will always override forSelf (ef7471a)

6.1.0 (2021-08-26)

Features

6.0.2 (2021-08-22)

Bug Fixes

  • core: add prototype properties (getters, setters) to destinationPath (15ad713), closes #334

6.0.1 (2021-08-16)

Documentations

Refactor

  • classes: clean up typings (45edfda)
  • core: clean up core libs (ddb11e5)
  • core: remove some any types (cdc2f9a)
  • pojos: clean up typings (f43705a)

6.0.0 (2021-08-02)

⚠ BREAKING CHANGES

  • core: mapWith signature now accepts the models directly instead of a deferred function. This allows to use mapWith easier
// before
mapWith(
    () => Dto,
    (s) => s.value,
    () => Source
);

// after
mapWith(Dto, Source, (s) => s.value);
  • classes: AutoMap only accepts an optional config object now. Positional arguments overload has been removed
// deprecated and removed
@AutoMap(() => Foo)

// please migrate
@AutoMap({typeFn: () => Foo})

Features

  • classes: remove AutoMap without config object (95479ca)
  • core: add basic TypeConverter for primitives (83fd239)

Sometimes, you need to set a common converter for one type to another when the property names are matching between a Source and a Destination. For example, suppose we have a Source type:

export class Source {
    @AutoMap()
    value1!: string;
    @AutoMap()
    value2!: string;
    @AutoMap()
    value3!: string;
}

and you would like to map it to the following Destination type:

export class Destination {
    @AutoMap()
    value1!: number;
    @AutoMap()
    value2!: Date;
    @AutoMap()
    value3!: boolean;
}

If we were to try and map Source -> Destination as-is, we would end up with mismatch values and types on the Destination. Eg: Source.value1 will be mapped to Destination.value1 even though the types of each value1 are different. Destination.value1 will end up with string value even though it is declared as number. This is because AutoMapper does not know anything and will not try to make any assumptions about these value types.

To solve this issue, you must supply Custom Type Converters to a specific Mapper:

const mapper = createMapper(/*...*/);

mapper
    .addTypeConverter(String, Number, (str) => parseInt(str))
    .addTypeConverter(String, Date, (str) => new Date(str))
    .addTypeConverter(String, Boolean, (str) => Boolean(str));

mapper.createMap(Source, Destination);

Here, we're telling AutoMapper:

  • If you are mapping a String to a Number, use parseInt()
  • If you are mapping a String to a Date, use new Date()
  • If you are mapping a String to a Boolean, use Boolean()
const source = new Source();
source.value1 = '123';
source.value2 = '10/14/1991';
source.value3 = 'truthy';

const destination = mapper.map(source, Destination, Source);
/**
 * Destination {
    value1: 123, // number
    value2: Mon Oct 14 1991 00:00:00 GMT-0500 (Central Daylight Time), // a Date instance
    value3; true // boolean
 * }
 */
  • core: adjust mapWith signature (2df08ac)

Bug Fixes

  • core: fail fast when mapping is not found (95a196f)
  • core: null check mapping before applying typeConverters (5d87147)
  • core: null check mappingProp and nestedMappingPair before continue (850cafb)

Refactor

  • classes: always add metaResult to nestedConstructible (to account for primitives) (5717928)
  • core: clean up createMapper with less null coalescing (cdcc39a)
  • core: clean up initialize mappings (8239789)
  • core: reformat map (81992a1)
  • pojos: always add metaResult to nestedMetadata (to account for primitives) (00cce02)

Documentations

  • add Custom Type Converter (05f02a5)
  • classes: add comment about limitation of array properties (#326) (866e311)
  • classes: fix link issue (#327) (2030b50)

5.0.1 (2021-07-22)

Bug Fixes

5.0.0 (2021-07-22)

⚠ BREAKING CHANGES

  • Cutting a new major version due upgrade to NestJS v8

Features

Bug Fixes

  • should not map undefined value when mapMutate (#317) (416e498)

Refactor

  • core: extract setMemberReturn function (b67d5ee)

Documentations

4.2.2 (2021-07-08)

Refactor

  • classes: use cached length for loops (21435b7)
  • core: use cached length for loops; misc. variable changes (697ee81)
  • pojos: use cached length for loops (6740a5d)

4.2.1 (2021-07-02)

Bug Fixes

  • core: only add writable property to unmappedKeys (aa565aa)

Documentations

Refactor

4.2.0 (2021-06-15)

Features

4.1.0 (2021-06-09)

Features

  • core: use proxy to get members from selector function (#301) (704c6ad)

Documentations

4.0.0 (2021-05-18)

⚠ BREAKING CHANGES

  • Upgrade to Nx 12.3.3

Features

3.5.2 (2021-04-09)

Bug Fixes

  • types: remove all named tuples to support TS <4 (9de3c72)

Documentations

  • classes: add more comments to AutoMap decorator (b00a01c)

3.5.1 (2021-04-09)

Bug Fixes

  • classes: only save metadata if typeFn is not null (3f03f8c)

3.5.0 (2021-04-07)

Features

  • classes: add logic to handle getter only properties (d081ac6)

Deprecations:

  • classes: AutoMap decorator now accepts an AutoMapOptions instead. The other usage have been marked deprecated.
class Foo {
    // before
    @AutoMap(() => Bar)
    bar: Bar;

    // after
    @AutoMap({ typeFn: () => Baz })
    baz: Baz;
}
  • core: allow mapWithArguments to accept Resolver (8f1dfc6)

Refactor

  • core: move isResolver to utils (ea2bc42)

Documentations

  • update docs deps and add new docs (16719ff)

3.4.2 (2021-03-22)

Bug Fixes

  • core: pass extraArguments down to nested mapping (10465be)

3.4.1 (2021-03-16)

Bug Fixes

  • nestjs: fix memoize util (e56887b)

3.4.0 (2021-03-14)

Features

  • nestjs: add MapPipe to transform Query and Body (d8198e0)

Bug Fixes

  • core: add non-null assertion to mapMemberFn[misc] when transformation type is MapFrom/MapWith (746e94e)

Documentations

3.3.0 (2021-03-12)

Bug Fixes

  • classes: expose getMetadataList as public API (b5bde21)

Features

  • classes/mapped-types: add Mapped Types (46e02ba)

3.2.2 (2021-03-06)

Bug Fixes

  • sequelize: only run intiialize on sequelize model (05c3d82)

3.2.1 (2021-03-06)

Bug Fixes

  • sequelize: make options optional (8355120)

3.2.0 (2021-03-06)

Features

  • core: use postMap if available (fb22792)
  • sequelize: add postMap to instantiate a Model instance from map result (9552516)
  • types: add postMap to MapPlugin (bbdd895)

3.1.0 (2021-03-06)

Bug Fixes

  • classes: move all single functions to exported utils (219b917)
  • core: make sure to bind plugin to preMap this context (19479a3)
  • types: add instantiate to MapPlugin public API (53343f9)

Features

  • classes: expose Constructible type (2c3eaf0)
  • classes: expose instantiate (b2dd592)
  • pojos: expose instantiate as public API (528b193)
  • sequelize: add sequelize plugin (b9105bb)

3.0.11 (2021-03-04)

Bug Fixes

  • core: null check for source selector on MapFrom (a489d9c)

3.0.10 (2021-02-26)

Bug Fixes

  • classes: make sure to reassign metadataList (ebd53dc)

3.0.9 (2021-02-26)

Bug Fixes

  • core: use isEmpty to check for nested metakey instead of using length (0329e6e)

3.0.8 (2021-02-24)

Bug Fixes

  • classes: clean up optional chaining operator on function calls (e6c3299)
  • core: clean up optional chaining (d223d79)
  • core: run beforeMap in mapArray with an empty array instead (2975071)
  • nestjs: revert back to resolved Promise. nextTick seems to run a little behind (5a91c31)
  • nestjs: use process.nextTick instead of resolved Promise (4dd8da6)
  • pojos: clean up optional chaining operator on function calls (65304a7)

3.0.7 (2021-02-22)

Bug Fixes

  • nestjs: move addProfile code to the micro task queue (70b268c), closes #264

3.0.6 (2021-02-21)

Bug Fixes

  • experimental/transformer-plugin: adjust transformer plugin to have a workaround for ESM (1f862d0)

3.0.5 (2021-02-19)

Bug Fixes

  • classes: merge metadata from Reflection and Factory fn (393a7d3)
  • experimental/transformer-plugin: fix options (bac5074)
  • experimental/transformer-plugin: adjust merging options with default options (c4c123b)

3.0.2 (2021-02-19)

Bug Fixes

  • experimental/transformer-plugin: fix publish (c90047a), closes #261

3.0.1 (2021-02-19)

Bug Fixes

  • experimental/transformer-plugin: move into classes (05aae8a)

3.0.0 (2021-02-19)

Bug Fixes

  • classes: treat property as primitives if metaResult is null. Default Date to undefined if valueAtKey is undefined (8e17527), closes #254
  • core: treat null metadata/Date same as null value aka just map the value. add logic for isNullMetadata to MappingPropert (97f260d)
  • pojos: treat property as primitives if metaResult is null. Date member to be returned as undefined if valueAtKey is undefined (3e474ab)
  • types: add isNullMetadata to MappingTransformation (a0b39d9)

Features

  • classes: add logic to take advantage of transformer plugin if used (f3aca21)
  • experimental/transformer-plugin: add transformer plugin for classes package (67cdd29)
  • pojos: allow to pass in null for createMetadataMap to treat something as primitives (7357ad5)

BREAKING CHANGES

  • pojos: Previously, null was used to skip properties. Now, use false instead, null means something else.

2.2.1 (2021-02-14)

Bug Fixes

  • core: move isDateConstructor and isPrimitiveConstructor from plugins to core (997528b)
  • core: utilize extraArguments in mapArray (ac5bb40)

Refactor

  • core: clean up misc (61f4f65)
  • classes/pojos: use isDateConstructor and isPrimitiveConstructor from core (b1dc211, 66a2f33)

2.2.0 (2021-02-14)

Features

  • core: add mapWithArguments (2732300)
  • types: add mapWithArguments to typing definitions (4b52da3)

2.1.1 (2021-02-06)

Bug Fixes

  • core: null/undefined check for source in map and mapArray (b37d29a)

2.1.0 (2021-02-03)

Bug Fixes

Features

  • classes: add AUTOMAP_PROPERTIES_METADATA_KEY to public api (1165380)

2.0.1 (2021-02-02)

Bug Fixes

  • core: ensure to call mapArray with mapWith if sourceValue is an Array (0eef348), closes #253

2.0.0 (2021-01-31)

Features

  • enable strict mode (6456bec)
  • classes: strict mode friendly (bac51e9)
  • core: strict mode friendly (5178c3c)
  • nestjs: strict mode friendly (64abad4)
  • pojos: strict mode friendly (deedc1b)
  • types: strict mode friendly (f8e6211)

BREAKING CHANGES

  • This release enables strict mode for automapper. The type is stricter which might affect your current implementations.

1.2.0 (2021-01-31)

Features

  • core: add logic to run preMapArray if available when invoking mapArray (f1f97f3)
  • types: add MapArrayOptions and adjust mapArray signature (9d2df49)

Documentations

  • Add documentation on how to extend a plugin. Please check Docs for more information.

1.1.1 (2021-01-30)

Bug Fixes

  • classes: ensure to use return value of concat() (705cbec)

1.1.0 (2021-01-30)

Bug Fixes

  • classes: adjust code smell (cf53a1f)
  • core: adjust code smell (736f58d)
  • pojos: adjust code smell (4682fbf)

Features

  • core: better error message for mapping operation error (550d8e8)

1.0.4 (2021-01-29)

Bug Fixes

  • nestjs: ensure mapper is safe for accessing with optional chaining (83307f5)

1.0.3 (2021-01-28)

Bug Fixes

  • pojos: add Array to isPrimitiveConstructor. This is to match with the behavior in classes (6415463)

1.0.2 (2021-01-28)

Bug Fixes

  • classes: isPrimitiveConstructor also returns true for Array constructor (c5d111d), closes #249

1.0.1 (2021-01-25)

Bug Fixes

  • nestjs: make sure mapOptions passed in as null if it's empty (93e3761), closes #247

1.0.0 (2021-01-17)

Official release 1.0.0

Please check out README for more information

1.0.0-beta.9 (2021-01-11)

Refactor

  • nestjs: use global options in DynamicModule for forRoot instead of @Global decorator (8f05d8f)

Bug Fixes

  • nestjs: adjust globalNamingConventions options to also accept a single NamingConvention (822c790)

Features

  • nestjs: add MapInterceptor (1a811e5)

1.0.0-beta.8 (2021-01-09)

Refactor

  • core: adjust public API of core (d86af1d)

1.0.0-beta.7 (2021-01-08)

Bug Fixes

  • core: adjust getFlatteningSourcePath to take into account multiple parts path with naming conventions (811568e)

1.0.0-beta.6 (2021-01-07)

Features

  • core: add ability to pass in destinationObj and mutate on map instead of return (46e920d)
  • core: adjust set() to have setMutate() and not return (bdd6d17)

1.0.0-beta.5 (2021-01-05)

Bug Fixes

  • classes: rename types.d.ts to types.ts to include with bundle (3a15f72)
  • pojos: adjust typings for createMetadataMap (18cc504)

1.0.0-beta.4 (2021-01-05)

Bug Fixes

  • core: remove properties added by istanbul for not failing in test coverage (1dcdcdb)

1.0.0-beta.3 (2021-01-04)

Bug Fixes

  • classes: skip empty metadataList before looping (88ecf9c)
  • core: check null and fail fast in getPathRecursive (449da22)

1.0.0-beta.2 (2021-01-04)

1.0.0-beta.1 (2021-01-04)

1.0.0-beta.0 (2021-01-04)

Bug Fixes

Features

  • nestjs: add nestjs integration package (db550c3)
  • add core (04cd18c)
  • prepare for beta (17e2199)
  • start working on some core functionalities (5d4fe2b)