Socket
Book a DemoInstallSign in
Socket

nestjs-app-update

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-app-update

For more information please look at: https://digitalclub.atlassian.net/wiki/spaces/N/pages/2983854102/Force+Flexible+update+flow+for+apps?focusedCommentId=3025272837

1.0.2
latest
npmnpm
Version published
Maintainers
1
Created
Source

App-Update

For more information please look at: https://digitalclub.atlassian.net/wiki/spaces/N/pages/2983854102/Force+Flexible+update+flow+for+apps?focusedCommentId=3025272837

How to use

You can load in the endpoint by adding the following to your app module:

AppUpdateModule.forRoot({
  androidMaximumFlexibleVersion: Config.ANDROID_MAXIMUM_FLEXIBLE_VERSION,
  androidMinimalSupportedVersion: Config.ANDROID_MINIMAL_SUPPORTED_VERSION,
  iosMaximumFlexibleVersion: Config.IOS_MAXIMUM_FLEXIBLE_VERSION,
  iosMinimalSupportedVersion: Config.IOS_MINIMAL_SUPPORTED_VERSION,
}),

Make sure to also setup your config file, for example:

export const Config = {
  ANDROID_MAXIMUM_FLEXIBLE_VERSION:
    process.env.ANDROID_MAXIMUM_FLEXIBLE_VERSION ?? '1.0.0',
  ANDROID_MINIMAL_SUPPORTED_VERSION:
    process.env.ANDROID_MINIMAL_SUPPORTED_VERSION ?? '1.0.0',
  IOS_MAXIMUM_FLEXIBLE_VERSION:
    process.env.IOS_MAXIMUM_FLEXIBLE_VERSION ?? '1.0.0',
  IOS_MINIMAL_SUPPORTED_VERSION:
    process.env.IOS_MINIMAL_SUPPORTED_VERSION ?? '1.0.0',
};

Alternatively, if you need a custom endpoint you can make use of the AppUpdateService. For example:

import { Controller, Get, HttpCode, HttpStatus, Query } from '@nestjs/common';
import { ApiOkResponse, ApiOperation } from '@nestjs/swagger';
import {
  AppUpdateService,
  AppVersionStateDto,
  CheckAppVersionDto,
} from 'nestjs-app-update';
import Config from '../../../../config/config';

@Controller()
export class OwnerAppUpdateController {
  constructor(private readonly appUpdateService: AppUpdateService) {}

  @Get('/owner/version/status')
  @ApiOperation({
    summary: 'Get the state of your version for a specific platform',
  })
  @ApiOkResponse({ description: 'The version state', type: AppVersionStateDto })
  @HttpCode(HttpStatus.OK)
  public async checkVersionStatus(
    @Query() dto: CheckAppVersionDto,
  ): Promise<AppVersionStateDto> {
    return this.appUpdateService.checkVersionStatus(dto, {
      androidMaximumFlexibleVersion:
        Config.OWNER_ANDROID_MAXIMUM_FLEXIBLE_VERSION,
      androidMinimalSupportedVersion:
        Config.OWNER_ANDROID_MINIMAL_SUPPORTED_VERSION,
      iosMaximumFlexibleVersion: Config.OWNER_IOS_MAXIMUM_FLEXIBLE_VERSION,
      iosMinimalSupportedVersion: Config.OWNER_IOS_MINIMAL_SUPPORTED_VERSION,
    });
  }
}

When using this custom implementation make sure to also define a module for it:

import { Module } from '@nestjs/common';
import { AppUpdateService } from 'nestjs-app-update';
import { OwnerAppUpdateController } from './owner-app-update.controller';

@Module({
  providers: [AppUpdateService],
  controllers: [OwnerAppUpdateController],
})
export class OwnerAppUpdateModule {}

FAQs

Package last updated on 17 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.