Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
github.com/activedbsoft/webapi-active-query-builder-perl
SQL::QueryBuilder::WebApi::Role - a Moose role for the QueryBuilderApi
Active Query Builder Web API lets create, analyze and modify SQL queries for different database servers using RESTful HTTP requests to a cloud-based service. It requires SQL execution context (information about database schema and used database server) to be stored under the registered account at https://webapi.activequerybuilder.com/.
This role is the only component of the library that uses Moose. See SQL::QueryBuilder::WebApi::ApiFactory for non-Moosey usage.
The library consists of a set of API classes, one for each endpoint. These APIs implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming class. It also provides methods to retrieve the endpoint API objects, and the API factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
base_url
The generated code has the base_url
already set as a default value. This method
returns (and optionally sets, but only if the API client has not been
created yet) the current value of base_url
.
api_factory
Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a SQL::QueryBuilder::WebApi::PetApi instance
$self->pet_api; # the same
You can print out a summary of the generated API by running the included
autodoc
script in the bin
directory of your generated library. A few
output formats are supported:
Usage: autodoc [OPTION]
-w wide format (default)
-n narrow format
-p POD format
-H HTML format
-m Markdown format
-h print this help message
-c your application class
The -c
option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class.
To load the API packages:
use SQL::QueryBuilder::WebApi::ActiveQueryBuilderApi;
To load the models:
use SQL::QueryBuilder::WebApi::Object::Condition;
use SQL::QueryBuilder::WebApi::Object::ConditionGroup;
use SQL::QueryBuilder::WebApi::Object::HiddenColumn;
use SQL::QueryBuilder::WebApi::Object::Pagination;
use SQL::QueryBuilder::WebApi::Object::QueryColumn;
use SQL::QueryBuilder::WebApi::Object::Sorting;
use SQL::QueryBuilder::WebApi::Object::SqlQuery;
use SQL::QueryBuilder::WebApi::Object::Totals;
use SQL::QueryBuilder::WebApi::Object::Transform;
use SQL::QueryBuilder::WebApi::Object::TransformResult;
Put the Perl SDK under the 'lib' folder in your project directory, then run the following
#!/usr/bin/perl
use lib 'lib';
use strict;
use warnings;
# load the API package
use SQL::QueryBuilder::WebApi::ActiveQueryBuilderApi;
# load the models
use SQL::QueryBuilder::WebApi::Object::Condition;
use SQL::QueryBuilder::WebApi::Object::ConditionGroup;
use SQL::QueryBuilder::WebApi::Object::HiddenColumn;
use SQL::QueryBuilder::WebApi::Object::Pagination;
use SQL::QueryBuilder::WebApi::Object::QueryColumn;
use SQL::QueryBuilder::WebApi::Object::Sorting;
use SQL::QueryBuilder::WebApi::Object::SqlQuery;
use SQL::QueryBuilder::WebApi::Object::Totals;
use SQL::QueryBuilder::WebApi::Object::Transform;
use SQL::QueryBuilder::WebApi::Object::TransformResult;
# for displaying the API response data
use Data::Dumper;
my $api = SQL::QueryBuilder::WebApi::ActiveQueryBuilderApi->new();
my $metadataGuid = 'b3207f4f-b1f4-4dc2-979b-7724ed2d0221';
my $sql = 'Select customer_id, first_name From customer';
my $query = SQL::QueryBuilder::WebApi::Object::SqlQuery->new(); # SqlQuery | Information about SQL query and it's context.
$query->guid( $metadataGuid );
$query->text( $sql );
my $columns = $api->get_query_columns_post(query => $query);
print Dumper($columns);
my $transform = SQL::QueryBuilder::WebApi::Object::Transform->new();
$transform->guid( $metadataGuid );
$transform->sql( $sql );
my $filter = SQL::QueryBuilder::WebApi::Object::ConditionGroup->new();
my $condition = SQL::QueryBuilder::WebApi::Object::Condition->new();
$condition->field('customer_id');
$condition->condition_operator('Greater');
$condition->values( [ '10' ] );
$filter->conditions( [ $condition ] );
my $page = SQL::QueryBuilder::WebApi::Object::Pagination->new();
$page->skip(2);
$page->take(3);
my $order = SQL::QueryBuilder::WebApi::Object::Sorting->new();
$order->field('customer_id');
$order->order('desc');
$transform->filter($filter);
$transform->pagination($page);
$transform->sortings( [ $order ] );
my $result = $api->transform_sql_post(transform => $transform);
print Dumper($result);
All URIs are relative to https://webapi.activequerybuilder.com
Class | Method | HTTP request | Description |
---|---|---|---|
ActiveQueryBuilderApi | get_query_columns_post | POST /getQueryColumns | |
ActiveQueryBuilderApi | transform_sql_post | POST /transformSQL |
All endpoints do not require authorization.
Full source code of all clients for Active Query Builder Web API is available on GitHub. Get the source code of javascript here: https://github.com/ActiveDbSoft/webapi-active-query-builder-perl
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.