npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@yaagoub/decorators

v2.0.8

Published

Angular decorators

Readme

decorators

Official Documentation

For detailed documentation, visit yaagoub.org decorators.

Request Handlers with @yaagoub/decorators

This guide demonstrates how to handle HTTP requests in Angular using decorators from the @yaagoub/decorators library.

Setup

Use provideDecoratorsConfig in your app.config.ts to initialize global configuration:

import { provideDecoratorsConfig } from '@yaagoub/decorators';

export const appConfig: ApplicationConfig = {
  providers: [
    provideDecoratorsConfig(),
  ],
};

Example

import { HttpClient, Get, returnType } from '@yaagoub/decorators';
import { Observable } from 'rxjs';

@HttpClient('/sources/api/v1')
export class ViewsService {
  @Get({
    path: '/views',
    options: {
      responseType: 'json',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer token',
      },
    },
  })
  getViews(): Observable<any> {
    return returnType<any>();
  }
}

// Usage
const views = new ViewsService();

views.getViews().subscribe({
  next: (res) => console.log(res),
  error: (err) => console.error(err),
  complete: () => console.log('Completed'),
});

Usage

import { BasePath, Get, Res, HttpRespose } from '@yaagoub/decorators';

@HttpClient('/sources/api/v1')
@DefaultHeaders({
  'x-test': 'class-header',
  'x-test-writable': 'class-header-write', // this header is writable (4º priority)
  'x-class-only': 'class-only-value',
})
export class ViewsService {
 @Get({
    path: '/testMethod',
    options: {
      headers: {
        'x-test-1': 'decorator-header-1',
        'x-test-writable': 'decorator-header-write', // this header is writable (2º priority)
        'x-get-options-only': 'get-options-only-value',
      },
    },
  })
  @Headers({
    'x-test-2': 'method-header-2',
    'x-test-writable': 'method-header-write', // this header is writable (3º priority)
    'x-method-only': 'method-only-value',
  })
  getViews(
    @Header('x-test-3') header: string,
    @Header('x-test-writable') writableHeader: string, // this header is writable (1º priority)
  ): Observable<any> {
    return returnType();
  }
}

const views = new ViewsService()
views.getViews('x-test-3-value','x-test-writable-value').subscribe({
  next: (res: any) => {
    console.log(res)
  },
  error: (err: any) => {
    console.error(err)
  },
  complete: () => {
    console.log('completed')
  }
})
;

Mapper Decorator

import { Mapper } from '@yaagoub/decorators';

interface DestinationType {
  property1: string;
  property2: number;
  propertyC: string;
}
interface SourceType {
  property1: string;
  property2: number;
  propertyC: string;
}

export class MapperToDestination {
  @Mapper<DestinationType>()
  static toDestination(source: SourceType): DestinationType {
    return source as any;
  }
}

const example = new ExampleClass();
const result = example.exampleMethod();
console.log(result);
// Output: { propertyA: "example", propertyB: 42, propertyC: "example" }

Decoradores HTTP

for setup please visit SETUP

501. @Get – Defines a GET request handler for a specific route.

502. @Post – Defines a POST request handler for a specific route.

503. @Put – Defines a PUT request handler for a specific route.

504. @Delete – Defines a DELETE request handler for a specific route.

505. @Patch – Defines a PATCH request handler for a specific route.

506. @Head – Defines a HEAD request handler for a specific route.

507. @Options – Defines an OPTIONS request handler for a specific route.

508. @HttpClient - Defines a base endpoint

509. @Path - Defines a param

510. @body - Defines a body of the request

514. @Mapper - Maps properties from one type to anotherrepresentation

....................................................................

for setup please visit SETUP

516. @LogDebug - Logs debug information to the server or to the console

517. @LogError - Logs error information to the server or to the console

518. @LogInfo - Logs informational messages to the server or to the console

519. @LogWarn - Logs warning messages to the server or to the console

520. @Log - Logs class general information to the server or to the console

....................................................................