How to use the class-transformer.plainToClassFromExist function in class-transformer

To help you get started, we’ve selected a few class-transformer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dilame / instagram-private-api / src / core / feed.factory.ts View on Github external
public reelsTray(reason: 'pull_to_refresh' | 'cold_start' = 'cold_start'): ReelsTrayFeed {
    return plainToClassFromExist(new ReelsTrayFeed(this.client), { reason });
  }
github dilame / instagram-private-api / src / core / feed.factory.ts View on Github external
public mediaInlineChildComments(mediaId: string, commentId: string, minId?: string): MediaInlineChildCommentsFeed {
    return plainToClassFromExist(new MediaInlineChildCommentsFeed(this.client), {
      mediaId,
      commentId,
      nextMinId: minId,
    });
  }
github magishift / magishift.core / packages / crud / src / pipes / dtoValidation.pipe.ts View on Github external
private async plainToClass(dto: TDto, obj: any): Promise {
    if (!obj) {
      return undefined;
    }

    const result = plainToClassFromExist(dto, obj);

    const errors = await validate(result, {
      whitelist: true,
    });

    if (errors.length > 0) {
      throw new BadRequestException(errors);
    }

    const repository = getRepository(this.entity);

    await Promise.all(
      repository.metadata.columns.map(async (column: ColumnMetadata) => {
        const propType = GetPropertyType(repository.metadata.columns, column.propertyName);

        if (
github dilame / instagram-private-api / src / core / feed.factory.ts View on Github external
public storyQuizParticipants(
    mediaId: string,
    stickerId: string | number,
  ): MediaStickerResponsesFeed<
    StoryQuizParticipantsFeedResponseRootObject,
    StoryQuizParticipantsFeedResponseParticipantsItem
  > {
    return plainToClassFromExist(new MediaStickerResponsesFeed(this.client), {
      mediaId,
      stickerId,
      name: 'story_quiz_participants',
      rootName: 'participant_info',
      itemName: 'participants',
    });
  }
github magishift / magishift.core / src / utils / objectMapper.utils.ts View on Github external
export function DtoFromObject(plain: object, dto: TDto): TDto {
  if (!plain) {
    return undefined;
  }

  const result = plainToClassFromExist(dto, plain);

  return result;
}
github dilame / instagram-private-api / src / core / feed.factory.ts View on Github external
public reelsMedia(options: { userIds: Array; source?: IgAppModule }): ReelsMediaFeed {
    return plainToClassFromExist(new ReelsMediaFeed(this.client), options);
  }