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

@ubti/diligence-fabric-sdk

v0.8.2

Published

SDK for Diligence Framework - Multi Tenant

Downloads

134

Readme

DiligenceFabricClient SDK

TypeScript CSS3

Version npm npm Downloads

NPM

The DiligenceFabricClient SDK provides a client library for interacting with the DiligenceFabric API. This README document will guide you through the installation process, usage instructions, error handling, and provide sample code for using the SDK.

Table of Contents

Installation

You can install the DiligenceFabricClient SDK using npm or yarn:

npm install @ubti/diligence-fabric-sdk

Usage

To use the DiligenceFabricClient SDK, follow the steps below:

  1. Import the necessary classes from the SDK

    import { DiligenceFabricClient, UserInfo } from 'diligence-fabric-sdk';
  2. Setup the configuration using config/default.json or .env

    Note: You can refer env.sample or config/default.json

    # Required
    DF_TENANT_ID=
    DF_APP_ID=
    # Optional
    DF_API_URL=
    DF_API_VERSION=
  3. Create an instance of the DiligenceFabricClient class

    /* Please get the above config from environment variables based on the technology that you use like dotenv, etc.. Its the most recommended way */
       
    const client = new DiligenceFabricClient();
  4. Set the authenticated user token

    a. You can use the AuthService to login and getToken

    const resp = client.getAuthService().login("**your auth request model**)

    b. Now get the access token from the response and set token in the SDK

    const authUser = {
      Token: 'your_auth_token',
    };
    client.setAuthUser(authUser);
  5. Access the services and perform actions

    const applicationService = client.getApplicationService();
    // Use the applicationService to interact with the Application service
    
    const userService = client.getUserService();
    // Use the userService to interact with the User service
    
    const menuService = client.getMenuService();
    // Use the menuService to interact with the Menu service
    
    const authService = client.getAuthService();
    // Use the authService for authentication-related operations

Note: Ensure that you have set the authenticated user token using setAuthUser() before accessing the services.

Error Handling

If the user token is not set before accessing the services, an error will be thrown. To handle this error, wrap the code in a try-catch block:

try {
  // Access the services and perform actions here
} catch (error) {
  // Handle the error here
  console.error('Error:', error);
}

Examples

Here are some samples of the DiligenceFabricClient SDK:

  1. Authentication

    const authService = client.getAuthService();
    
    try {
      const loginResponse = await authService.login();
      console.log('Auth Response:', loginResponse);
    } catch (error) {
      console.error('Error in Login:', error);
    }
  2. Get All application menu based on the user token

    const appRoleService = client.getApplicationRoleService();
    
    try {
      const response = await appRoleService.getAllAppMenus();
      console.log('Response:', loginResponse);
    } catch (error) {
      console.error('Error in Getting All App Menus:', error);
    }

Feel free to explore the SDK and its available methods to suit your specific use cases.

To publish to NPM registry

Use the following command

npm publish @ubti/diligence-fabric-sdk --access=public

Give a Star! :star:

If you liked the project or if this project helped you, please give a star. And also please fork this repository and send us pull-requests. If you find any problem please open issue.

Did the sample not work for you as expected? Did you encounter issues trying this sample? Then please reach out to us using the GitHub Issues page.

Feedback

If you have any feedback, please reach out to us at [email protected]

Logo