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.
mosaic-rest-js
Advanced tools
#mosaic-rest-js
This is a js library for Backbase REST API.
var BBRest = require('mosaic-rest-js'),
var bbrest = new BBRest({
portal: 'myPortal'
});
require(['bbrest'], function(BBRest) {
var bbrest = new BBRest({
portal: 'myPortal'
});
})
// list portals
bbrest.server().get().then(function(value) {
if (value.statusCode === 200) {
console.log('Response OK');
}
});
// add portal
bbrest.server().post('addPortal.xml').then(function(d) {
console.log(d);
});
// update portal
bbrest.server().put('updatePortal.xml').then(function(d) {
console.log(d);
});
// list 5 items from catalog
bbrest.catalog().query({ps:5}).get().then(function(d) {
console.log(d);
});
npm install // install nodejs dependencies
bower install // install bower dependecies
gulp node // build node distribution file
gulp jquery // build browser jQuery based ditribution file
gulp angular // build browser Angular based ditribution file
gulp min // minify browser distribution files
gulp test-node // run node tests (requires running portal)
gulp test-jq // run jQuery phantomjs tests (requires running portal)
gulp test-ng // run Angular phantomjs tests (requires running portal)
BBRest Constructor.
configuration defaults:
{
scheme: 'http',
host: 'localhost',
port: '7777',
context: 'portalserver',
username: 'admin',
password: 'admin',
portal: null // name of the targeted portal,
plugin: null // function to pre-process data
}
Prepares request on server domain. API Reference
Valid Requests, returning promises:
bbrest.server().get(); // returns list of portals
bbrest.server().post('path.to.xml'); // creates a portal
bbrest.server().put('path.to.xml'); // updates portal(s)
Prepares request on portal domain. API Reference
Valid Requests, returning promises:
bbrest.portal().put('path.to.xml'); // updates portal
bbrest.portal().delete(); // deletes the portal
bbrest.portal().get(); // returns portal data
bbrest.portal().rights().get(); // returns portal rights
bbrest.portal().rights().put('path.to.xml'); // updates portal rights
bbrest.portal().tags().get(); // returns portal tags
bbrest.portal().tags().post('path.to.xml'); // creates a tag
bbrest.portal().tags('myTag').delete(); // deletes a tag
Prepares request on server catalog. API Reference
Valid Requests, returning promises:
bbrest.catalog().get(); // returns server catalog
bbrest.catalog().post('path.to.xml'); // add item(s) to server catalog
bbrest.catalog().put('path.to.xml'); // updates item(s) in server catalog
bbrest.catalog().delete('path.to.xml'); // batch delete items from the server catalog
bbrest.catalog('myItem').get(); // returns item from the server catalog
bbrest.catalog('myItem').delete(); // deletes item from the server catalog
Prepares request on portal catalog. API Reference
Valid Requests, returning promises:
bbrest.portalCatalog().get(); // returns portal catalog
bbrest.portalCatalog().post('path.to.xml'); // add item(s) to portal catalog
bbrest.portalCatalog().put('path.to.xml'); // updates item(s) in portal catalog
bbrest.portalCatalog().delete('path.to.xml'); // batch delete items from the portal catalog
bbrest.portalCatalog('myItem').get(); // returns item from the portal catalog
bbrest.portalCatalog('myItem').delete(); // deletes item from the portal catalog
Prepares page request. API Reference
Valid Requests, returning promises:
bbrest.page().get(); // returns portal pages
bbrest.page().post('path.to.xml'); // creates page(s)
bbrest.page().put('path.to.xml'); // updates page(s)
bbrest.page('name').get(); // returns page
bbrest.page('name').put('path.to.xml'); // updates page
bbrest.page('name').delete(); // deletes page
bbrest.page('name').rights().get(); // returns page rights
bbrest.page('name').rights().put('path.to.xml'); // updates page rights
Prepares container request. API Reference
Valid Requests, returning promises:
bbrest.container().get(); // returns portal containers
bbrest.container().post('path.to.xml'); // creates a container(s)
bbrest.container().put('path.to.xml'); // updates container(s)
bbrest.container('name').get(); // returns container
bbrest.container('name').put('path.to.xml'); // updates container
bbrest.container('name').delete(); // deletes container
bbrest.container('name').rights().get(); // returns container rights
bbrest.container('name').rights().put('path.to.xml'); // updates container rights
Prepares widget request. API Reference
Valid Requests, returning promises:
bbrest.widget().get(); // returns portal widgets
bbrest.widget().post('path.to.xml'); // creates a widget(s)
bbrest.widget().put('path.to.xml'); // updates widget(s)
bbrest.widget('name').get(); // returns widget
bbrest.widget('name').put('path.to.xml'); // updates widget
bbrest.widget('name').delete(); // deletes widget
bbrest.widget('name').rights().get(); // returns widget rights
bbrest.widget('name').rights().put('path.to.xml'); // updates widget rights
Prepares link request. API Reference
Valid Requests, returning promises:
bbrest.link().get(); // returns portal links
bbrest.link().post('path.to.xml'); // creates link(s)
bbrest.link().put('path.to.xml'); // updates link(s)
bbrest.link('name').get(); // returns link
bbrest.link('name').put('path.to.xml'); // updates link
bbrest.link('name').delete(); // deletes link
bbrest.link('name').rights().get(); // returns link rights
bbrest.link('name').rights().put('path.to.xml'); // updates link rights
Prepares template request. API Reference
Valid Requests, returning promises:
bbrest.template().get(); // returns portal templates
bbrest.template().post('path.to.xml'); // creates template(s)
bbrest.template('name').get(); // returns template
bbrest.template('name').put('path.to.xml'); // updates template
bbrest.template('name').rights().get(); // returns template rights
bbrest.template('name').rights().put('path.to.xml'); // updates template rights
Prepares user request. API Reference
Valid Requests, returning promises:
bbrest.user().get(); // returns list of users
bbrest.user().post('path.to.xml'); // creates a user
bbrest.user('user').get(); // returns user
bbrest.user('user').put('path.to.xml'); // updates user
bbrest.user('user').delete(); // deletes user
bbrest.user('user', true).get(); // returns groups that user belongs to
bbrest.user('user', true).post('path.to.xml'); // adds user to group(s)
bbrest.user('user', true, 'group').delete(); // removes user from a group
Prepares group request. API Reference
Valid Requests, returning promises:
bbrest.group().get(); // returns list of groups
bbrest.group().post('path.to.xml'); // creates a group
bbrest.group('group').get(); // returns group
bbrest.group('group').put('path.to.xml'); // updates group
bbrest.group('group').delete(); // deletes group
bbrest.group('group', true).get(); // returns users that belong to a group
bbrest.group('group', true).post('path.to.xml'); // adds user(s) to group
bbrest.group('group', true, 'user').delete(); // removes user from a group
Prepares audit trails request. API Reference
Valid Requests, returning promises:
bbrest.audit().get(); // returns auditEvents
bbrest.audit(true).get(); // returns auditMetaData
Prepares cache request. API Reference
Valid Requests, returning promises:
bbrest.cache('all').delete(); // sends all of the below requests one by one
bbrest.cache('globalModelCache').delete();
bbrest.cache('retrievedWidgetCache').delete();
bbrest.cache('widgetChromeStaticCache').delete();
bbrest.cache('serverSideClosureCache').delete();
bbrest.cache('urlLevelCache').delete();
bbrest.cache('webCache').delete();
bbrest.cache('gModelCache').delete();
bbrest.cache('uuidFromExtendedItemNamesCache').delete();
bbrest.cache('springAclSidCacheRegion').delete();
bbrest.cache('contextNameToItemNameToUuidCache').delete();
bbrest.cache('widgetCache').delete();
bbrest.cache('uuidToContentReferencesCache').delete();
bbrest.cache('springAclCacheRegion').delete();
bbrest.cache('itemUuidToReferencingLinkUuidsCache').delete();
bbrest.cache('uuidToCacheKeysCache').delete();
bbrest.cache('versionBundleCache').delete();
You can get bookmarklet to delete all caches at once.
Performs POST or PUT request by finding the right BBRest method from the data.
Valid Request, returning promises:
bbrest.auto('path.to.xml');
Imports portal. API Reference
Valid Requests, returning promises:
bbrest.import().post('path.to.xml'); // imports xml
bbrest.import().file('/path/to/exported.zip').post(); // uploads and imports zip archive
Exports portal. API Reference
To get archive of the portal from the server, you need to make 2 requests. In first one, we send type of export and get back the id of exported archive in response. With second request we pass that id and local path where archive will be downloaded.
Valid Requests, returning promises:
// export as xml in response
bbrest.export().get();
// prepare file export
bbrest.export().post('path.to.xml').then(data) {
// data is xml or js object if plugin is used
var id = data.body.exportResponse.identifier; // get id of the archive
return bbrest.export(id).file('local.path.zip').get(); // returns promise
}
Modifies request to target rights.
Modifies request to target tags
Defines modifiers. API Reference
Defines path to the file where export is downloaded.
Performs GET request
Performs POST request
bbrest.config.plugin = function(data) {
return jxon.jsToString(data); // converts js object in jxon notation to XML string which will be posted
}
bbrest.widget('myWidget').post(jxonObj);
Performs PUT request
Performs DELETE request
response value:
{
error: // true if is error
statusCode: // http status code
statusInfo: // http status code description or error infor
body: // contains body of the server response,
href: // request location,
method: // request method,
reqBody: // request body,
file: // file name,
headers: // response headers
}
FAQs
nodejs library for Backbase REST API
The npm package mosaic-rest-js receives a total of 13 weekly downloads. As such, mosaic-rest-js popularity was classified as not popular.
We found that mosaic-rest-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
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.