This package has been deprecated

Author message:

The `nestjs-graphcdn` package is now deprecated. This package's functionality is now found in the `nestjs-stellate` package. See https://www.npmjs.com/package/nestjs-stellate for more details.

nestjs-graphcdn
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Nest Logo

GraphCDN Module for Nest framework

NPM Version Package License NPM Downloads

Description

This's a module for Nest to handle the purge api from GraphCDN.

Installation

$ npm i --save nestjs-graphcdn

Quick Start

Using purge Interceptor

app.resolver.ts

  @Mutation()
  @UseInterceptors(new GraphCDNPurgeInterceptor({
        serviceName: "<service-name>",
        purgeToken: "<token>",
  }))
  async upvotePost(@Args('postId') postId: number) {
    ...
  }

Global

If you want to set up interceptor as global, you have to follow Nest instructions here. Something like this.

app.module.ts

import { APP_INTERCEPTOR } from "@nestjs/core";
import { GraphCDNPurgeInterceptor } from "nestjs-graphcdn";

@Module({
  providers: [
    {
      provide: APP_INTERCEPTOR,
      useValue: new GraphCDNPurgeInterceptor({
        serviceName: "<service-name>",
        purgeToken: "<token>",
      }),
    },
  ],
})
export class ApplicationModule {}

Use purge query decorator

To purge some queries you can now use the GraphCDNPurgeQuery decorator.

app.resolver.ts

import { GraphCDNPurgeQuery } from "nestjs-graphcdn"

@Mutation()
@GraphCDNPurgeQuery(["<query-name>"])
async upvotePost(@Args('postId') postId: number) {
  ...
}

Use purge type decorator

To purge some type you can now use the GraphCDNPurgeType decorator.

app.resolver.ts

import { GraphCDNPurgeType } from "nestjs-graphcdn"

@Mutation()
@GraphCDNPurgeType("<type-name>", "<type-id-reference>")
async upvotePost(@Args('postId') postId: number) {
  ...
}

Readme

Keywords

Package Sidebar

Install

npm i nestjs-graphcdn

Weekly Downloads

2

Version

1.1.0

License

ISC

Unpacked Size

13 kB

Total Files

12

Last publish

Collaborators

  • volbrene