open-index/open-npm huggingface dataset:
npm package: @pankaj1791/nest-auth
Description: this is typeorm-auth extension with nestjs and dependent on @pankaj1791/nest-core library
Latest version: 0.0.1

# description

this is typeorm-auth extension with nestjs and dependent on @pankaj1791/nest-core library

# install

```typescript

npm i @pankaj179001/nest-auth @pankaj1791/nest-core
```

## Integration

```typescript
TypormAuthModule.register(
  {
    jwtSecretKey: 'Your secret key',

    disablePermission: true,

    //...additional options

    Helpers: { roles: helpers as RoleHelpers },
  },

  { dataSource: dataSource, TenantRepo: Tenant, userRepo: User },
);

  multiTenantLoginHeader?: "header name" //default is tenant-id;
 //header that is required if user is associated with multiple tenants

```

import TypormauthModule and register

## Role helpers

this are the helpers that can be used to extend the query functionality as per requirement

```typescript
export class helpers implements RoleHelpers {
  BeforeFindAll(args?: FindAllArgs) {
    console.log('function called before find all roles');
  }
  returnAble?: returnable[] = [];
}
```

## Datasource

```typescript

import { AuthEntities } from '@pankaj179001/nest-auth';

const Entities = [...AuthEntities, Tenant, User, TenantUser];

// OR

//const Entities = [...AuthEntities,'./path to your entities'];

export const dataSourceOptions: DataSourceOptions = {

type: 'postgres',

host: 'host',

port: 5432,

username: 'username',

password: 'password',

database: 'database name',

entities: Entities,

};
const dataSource = new DataSource(dataSourceOptions);

export default dataSource;

import AuthEntities from pankaj179001 nest auth library
```

# Seed Funtion

You can call the Permission Seed Function in your seed file

Example:

```typescript
await PermissionSeed<AuthRoles, AuthActions, AppModules>({
  datasource: this.datasource,

  addOnDefaultRoles: ['client'],

  defaultRoleModuleAccess: {
    client: ['Roles', 'Permissions'],
  },

  defaultRolePermissionsAccess: {
    client: {
      create: ['roles', 'users'],

      update: ['users'],
    },
  },

  ModulePermissions: [
    { module: 'Roles', subjects: ['roles'] },

    { module: 'Users', subjects: ['users'] },

    { module: 'Tenants', subjects: ['tenants'] },
  ],

  AddOnPermissions: [{ module: 'Roles', Actions: ['derive'] }],

  TruncateAuthEntities: false,
});
```

here \_ is a separater for modulename and the permission subjects

we can have add on permissions as per application business logic
Eg:

```typescript
AddOnPermissions: [{ module: 'Roles', Actions: ['derive'] }];
```

    here derive is the add on  actions which comes from  AuthActions

# Features

Role-Based Access Control (RBAC)

Customizable Authentication Strategies

Guards

Entity Inheritance

Role Permission Seed Function

# auth

This library was generated with [Nx](https://nx.dev).
npm package: @pankaj1791/nest-core
Description: This library was generated with [Nx](https://nx.dev).
Author: pankaj179001
Latest version: 0.0.1

# core

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build core` to build the library.

## Methods---

ValidationDecorators (with class-validator)----

# Error handeling---

CatchError--
errorException---

# Objects methods---

compareRelationalIds--
comparenewRecords----
TransformObject---
TransformArray---
generateNextAlphaNumString--

# Pagination----

Pagination and paginationmeta--

# common dtos(with validations)

commonPaginationQuery
CommonFilter

## Running unit tests

Run `nx test core` to execute the unit tests via [Jest](https://jestjs.io).
npm package: @pankajchavhan/demo-lib
Description: This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.14.
Latest version: 0.0.1

# DemoLib

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.14.

## Code scaffolding

Run `ng generate component component-name --project demo-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project demo-lib`.
> Note: Don't forget to add `--project demo-lib` or else it will be added to the default project in your `angular.json` file. 

## Build

Run `ng build demo-lib` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build demo-lib`, go to the dist folder `cd dist/demo-lib` and run `npm publish`.

## Running unit tests

Run `ng test demo-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.