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

1.0.0 • Public • Published

Nest Logo

Stellate Module for Nest framework

NPM Version Package License NPM Downloads

Description

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

Installation

$ npm i --save nestjs-stellate

Quick Start

Using purge Interceptor

app.resolver.ts

  @Mutation()
  @UseInterceptors(new StellatePurgeInterceptor({
        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 { StellatePurgeInterceptor } from "nestjs-stellate";

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

Use purge query decorator

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

app.resolver.ts

import { StellatePurgeQuery } from "nestjs-stellate"

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

Use purge type decorator

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

app.resolver.ts

import { StellatePurgeType } from "nestjs-stellate"

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

Package Sidebar

Install

npm i nestjs-stellate

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

13 kB

Total Files

12

Last publish

Collaborators

  • volbrene