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

gasper_api

v1.0.1

Published

Handles_authentication_creation_management_of_applications_databases_users_and_also_provides_a_superuser_API__brbr_Only_a_superuser_can_avail_the_superuser_API__A_superuser_can_grant_revoke_superuser_privileges_to_other_users__A_default__superuser_is_crea

Downloads

6

Readme

gasper_api

GasperApi - JavaScript client for gasper_api Handles authentication, creation/management of applications, databases, users and also provides a superuser API. Only a superuser can avail the superuser API. A superuser can grant/revoke superuser privileges to other users. A default superuser is created every time a Gasper instance is launched whose credentials are defined in the admin section of config.toml, the main configuration file. A sample configuration file is available here. Note:- Normally the applications and databases can only be managed by their owners but the superuser can bypass that check. PS:- If you want to programmatically generate a client for this API, you can find the corresponding OpenAPI specifications here. We recommend using OpenAPI-Generator for generating clients. This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0
  • Package version: 1.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://chat.sdslabs.co

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install gasper_api --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your gasper_api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var GasperApi = require('gasper_api');

var defaultClient = GasperApi.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

var api = new GasperApi.AdminApi()
var authorization = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9; // {String} Bearer Token Authentication
var app = "app_example"; // {String} The name of the application
api.deleteAppByAdmin(authorization, app).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to http://localhost:3000

Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- GasperApi.AdminApi | deleteAppByAdmin | DELETE /admin/apps/{app} | Delete an application GasperApi.AdminApi | deleteDbByAdmin | DELETE /admin/dbs/{db} | Delete a single database GasperApi.AdminApi | deleteUserByAdmin | DELETE /admin/users/{userEmail} | Delete a single user GasperApi.AdminApi | fetchAppByAdmin | GET /admin/apps/{app} | Fetch a single application GasperApi.AdminApi | fetchAppsByAdmin | GET /admin/apps | Fetch all applications with/without a filter defined by query params GasperApi.AdminApi | fetchDbByAdmin | GET /admin/dbs/{db} | Fetch a single database GasperApi.AdminApi | fetchDbsByAdmin | GET /admin/dbs | Fetch all databases with/without a filter defined by query params GasperApi.AdminApi | fetchNodeByAdmin | GET /admin/nodes/{type} | Fetch bind addresses(IP:Port) of a single microservice on all nodes GasperApi.AdminApi | fetchNodesByAdmin | GET /admin/nodes | Fetch bind addresses(IP:Port) of all microservices on all nodes GasperApi.AdminApi | fetchUserByAdmin | GET /admin/users/{userEmail} | Fetch a single user GasperApi.AdminApi | fetchUsersByAdmin | GET /admin/users | Fetch all users with/without a filter defined by query params GasperApi.AdminApi | grantSuperuserPrivilege | PATCH /admin/users/{userEmail}/grant | Grant superuser privileges to a single user GasperApi.AdminApi | revokeSuperuserPrivilege | PATCH /admin/users/{userEmail}/revoke | Revoke superuser privileges from a single user GasperApi.AppsApi | createApp | POST /apps/{language} | Create an application GasperApi.AppsApi | deleteAppByUser | DELETE /apps/{app} | Delete an application owned by a user GasperApi.AppsApi | fetchAppByUser | GET /apps/{app} | Fetch a single application owned by a user GasperApi.AppsApi | fetchAppsByUser | GET /apps | Fetch all applications owned by a user GasperApi.AppsApi | fetchLogsByUser | GET /apps/{app}/logs | Fetch logs of an application GasperApi.AppsApi | rebuildAppByUser | PATCH /apps/{app}/rebuild | Rebuild an application GasperApi.AppsApi | transferAppByUser | PATCH /apps/{app}/transfer/{userEmail} | Transfer ownership of an application to another user GasperApi.AppsApi | updateAppByUser | PUT /apps/{app} | Update an application owned by a user GasperApi.AuthApi | login | POST /auth/login | Login to get a Bearer token GasperApi.AuthApi | refresh | GET /auth/refresh | Refresh JWT token using existing token GasperApi.AuthApi | register | POST /auth/register | Register a user GasperApi.DbsApi | createDB | POST /dbs/{databaseType} | Create a database GasperApi.DbsApi | deleteDbByUser | DELETE /dbs/{db} | Delete a single database owned by a user GasperApi.DbsApi | fetchDbByUser | GET /dbs/{db} | Fetch a single database owned by a user GasperApi.DbsApi | fetchDbsByUser | GET /dbs | Fetch all databases owned by a user GasperApi.DbsApi | transferDbByUser | PATCH /dbs/{db}/transfer/{userEmail} | Transfer ownership of a database to another user

Documentation for Models

Documentation for Authorization

bearerAuth

  • Type: Bearer authentication (JWT)