From bbdd895afaca40238a6affdec1de0fe3f7e99435 Mon Sep 17 00:00:00 2001 From: Chau Tran Date: Fri, 5 Mar 2021 22:37:31 -0600 Subject: [PATCH] feat(types): add postMap to MapPlugin --- packages/sequelize/src/lib/types.ts | 0 packages/types/src/plugin.ts | 11 +++++++++++ 2 files changed, 11 insertions(+) create mode 100644 packages/sequelize/src/lib/types.ts diff --git a/packages/sequelize/src/lib/types.ts b/packages/sequelize/src/lib/types.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/types/src/plugin.ts b/packages/types/src/plugin.ts index e99d05b8a..44d3cbfb2 100644 --- a/packages/types/src/plugin.ts +++ b/packages/types/src/plugin.ts @@ -54,6 +54,17 @@ export interface MapPlugin { destinationObj?: TDestination ): [sourceInstance: TSource, destinationInstance: TDestination]; + /** + * An optional post-map function to post-process the destination after map + * + * @param destination - a key to be used to identify the information about a particular Destination + * @param destinationObj - a plain object that takes the shape of the destination + */ + postMap? = any>( + destination: TKey, + destinationObj?: TDestination + ): TDestination; + /** * An optional pre-mapArray function to prepare the sourceArray before mapArray *