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 🙏

© 2024 – Pkg Stats / Ryan Hefner

trc-role-permission

v1.0.1

Published

1. To Create Role <br/> Function Name: createRoleFunction <br/> Arguments : Object <br>

Downloads

2

Readme

Roles

  1. To Create Role Function Name: createRoleFunction Arguments : Object

    Example:

    let payload = {
        name: "Function Test",
        createdBy: "cs",
    };
    
    const role = await createRoleFunction(payload);

    output:

     {
     "name": 'Function Test',
     "id": '4ed05209-710b-4a8d-bdc9-1eae6949245c',
     "createdBy": 'cs',
     "status": true,
     "_id": new ObjectId('65bb22adf2f9e5cb3efa2029'),
     "createdAt": 2024-02-01T04: 48: 45.945Z,
     "updatedAt": 2024-02-01T04: 48: 45.945Z,
     "__v": 0
    }

  1. Get Role By Id Function Name: getRoleByIdFunction Arguments : roleId

    Example:

    let roleId = "4ed05209-710b-4a8d-bdc9-1eae6949245c"
    const role = await getRoleByIdFunction(roleId);

    output:

     {
     "name": 'Function Test',
     "id": '4ed05209-710b-4a8d-bdc9-1eae6949245c',
     "createdBy": 'cs',
     "status": true,
     "_id": new ObjectId('65bb22adf2f9e5cb3efa2029'),
     "createdAt": 2024-02-01T04: 48: 45.945Z,
     "updatedAt": 2024-02-01T04: 48: 45.945Z,
     "__v": 0
    }

  1. Update Role By Id Function Name: updateRoleByIdFunction Arguments : roleId,Object

    Example:

    let roleId = "4ed05209-710b-4a8d-bdc9-1eae6949245c"
    let payload = {
      name: "update role"
    }
    
    const role = await getRoleByIdFunction(roleId,payload);

    output:

     {
     "name": 'update role',
     "id": '4ed05209-710b-4a8d-bdc9-1eae6949245c',
     "createdBy": 'cs',
     "status": true,
     "_id": new ObjectId('65bb22adf2f9e5cb3efa2029'),
     "createdAt": 2024-02-01T04: 48: 45.945Z,
     "updatedAt": 2024-02-01T04: 48: 45.945Z,
     "__v": 0
    }

  1. Delete Role By Id Function Name: deleteRoleByIdFunction Arguments : roleId

    Example:

    let roleId = "4ed05209-710b-4a8d-bdc9-1eae6949245c"
    
    const role = await deleteRoleByIdFunction(roleId);

    output:

     {
     "name": 'deleted role',
     "id": '4ed05209-710b-4a8d-bdc9-1eae6949245c',
     "createdBy": 'cs',
     "status": true,
     "_id": new ObjectId('65bb22adf2f9e5cb3efa2029'),
     "createdAt": 2024-02-01T04: 48: 45.945Z,
     "updatedAt": 2024-02-01T04: 48: 45.945Z,
     "__v": 0
    }

Permissions

  1. To Create Permissions Function Name: createPermissionFunction Arguments : Object

    Example:

    let payload = {
        name: "Permission Name"
    };
    
    const permission = await createPermissionFunction(payload);

    output:

     {
     "name": 'Permission Name',
     "id": '5e210a60-bfaa-4a89-af1b-789b975b61cd',
     "status": true,
     "_id": new ObjectId('65bb2f91954dc5eb4bb641c6'),
     "createdAt": 2024-02-01T05:43:45.079Z,
     "updatedAt": 2024-02-01T05:43:45.079Z,
     "__v": 0
    }

  1. To Update Permissions Function Name: updatePermissionFunction Arguments : Object

    Example:

    let permissionId = "5e210a60-bfaa-4a89-af1b-789b975b61cd"
    let payload = {
        name: "Permission Name"
    };
    
    let permission = await updatePermissionFunction(permissionId,payload);

    output:

     {
     "name": 'Permission Name',
     "id": '5e210a60-bfaa-4a89-af1b-789b975b61cd',
     "status": true,
     "_id": new ObjectId('65bb2f91954dc5eb4bb641c6'),
     "createdAt": 2024-02-01T05:43:45.079Z,
     "updatedAt": 2024-02-01T05:43:45.079Z,
     "__v": 0
    }

  1. To Delete Permissions Function Name: deletePermissionFunction Arguments : Object

    Example:

    let permissionId = "5e210a60-bfaa-4a89-af1b-789b975b61cd"
       
    let permission = await deletePermissionFunction(permissionId);

    output:

     {
     "name": 'Deleted',
     "id": '5e210a60-bfaa-4a89-af1b-789b975b61cd',
     "status": true,
     "_id": new ObjectId('65bb2f91954dc5eb4bb641c6'),
     "createdAt": 2024-02-01T05:43:45.079Z,
     "updatedAt": 2024-02-01T05:43:45.079Z,
     "__v": 0
    }

ModuleToPermission

  1. Function To Create Permission Modules Function Name: createPermissionToModuleFunction Arguments : Object

    Example:

    let payload = {
      moduleId: "123",
      moduleName: "testModule",
      permissions: [
        {
          name: "test1",
          permissionId: "123",
          assignedBy: "vj",
        },
      ],
    };
    
    const permissionToModule = await createPermissionToModuleFunction(payload);

    output:

     {
      "id": '795233b2-a8a0-449b-beb9-c3d64e21482d',
      "moduleName": "test1",
      "moduleId": "1234",
      "permissions": [
         {
             "name": "test2",
             "permissionId": 11,
             "assignedBy": "vj"
         }
     ],
     "status": true,
     "_id": new ObjectId("65ba1b2f2fab145140390803"),
     "createdAt": 2024-01-31T10: 04: 31.088Z,
     "updatedAt": 2024-01-31T10: 04: 31.088Z,
     "__v": 0
    }

  1. Function To Create New permissions Function Name: addPermissionsToModuleFunction Arguments : moduleId,ArrayOfObject

    Example:

    let payload = [
      {
        name: "test",
        permissionId: "123",
        assignedBy: "vj",
      },
    ];
    let moduleId = "1234;";
    
    const permissions = await addPermissionsToModuleFunction(moduleId, payload);

    output:

     {
      "id": '795233b2-a8a0-449b-beb9-c3d64e21482d',
      "moduleName": "Vj",
      "moduleId": "1234",
      "permissions": [
         {
             "name": "test1",
             "permissionId": 11,
             "assignedBy": "vj"
         },
         {
             "name": "test2",
             "permissionId": 12,
             "assignedBy": "vj"
         }
    
     ],
     "status": true,
     "_id": new ObjectId("65ba1b2f2fab145140390803"),
     "createdAt": 2024-01-31T10: 04: 31.088Z,
     "updatedAt": 2024-01-31T10: 04: 31.088Z,
     "__v": 0
    }

  1. Function remove permissions Function Name: removePermissionToModuleFunction Arguments : moduleId,permissionId

    Example:

    let moduleId = "1234";
    let permissionId = "12";
    
    const permissions = await addPermissionsToModuleFunction(moduleId, permissionId);

    output:

     {
      "id": '795233b2-a8a0-449b-beb9-c3d64e21482d',
      "moduleName": "Vj",
      "moduleId": "1234",
      "permissions": [
         {
             "name": "test1",
             "permissionId": 11,
             "assignedBy": "vj"
         }
    
     ],
     "status": true,
     "_id": new ObjectId("65ba1b2f2fab145140390803"),
     "createdAt": 2024-01-31T10: 04: 31.088Z,
     "updatedAt": 2024-01-31T10: 04: 31.088Z,
     "__v": 0
    }

  1. Function update permissions Function Name: updatePermissionToModuleFunction Arguments : moduleId,permissionId

    Example:

    let moduleId = "1234";
    const modifiedPermission = {
      name: "test121",
      permissionId: "123",
      assignedBy: "user123",
    };
    
    const permissions = await addPermissionsToModuleFunction(moduleId, modifiedPermission);

    output:

     {
      "id": '795233b2-a8a0-449b-beb9-c3d64e21482d',
      "moduleName": "Vj",
      "moduleId": "1234",
      "permissions": [
         {
             "name": "test121",
             "permissionId": "123",
             "assignedBy": "user123"
         }
    
     ],
     "status": true,
     "_id": new ObjectId("65ba1b2f2fab145140390803"),
     "createdAt": 2024-01-31T10: 04: 31.088Z,
     "updatedAt": 2024-01-31T10: 04: 31.088Z,
     "__v": 0
    }