
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
abl-sdk-feathers
Advanced tools
Reference the minified script in index.html:
<script src="node_modules/abl-sdk-feathers/dst/abl-sdk.min.js"></script>
Specify the modal service as a dependency of your application:
var app = angular.module('abl', ['abl-sdk-feathers']);
Configure the $feathersProvider service
app.config(function($feathersProvider) {
$feathersProvider.setEndpoint('https://api.ablist.win');
// You can optionally provide additional opts for socket.io-client
//$feathersProvider.setSocketOpts(options);
$feathersProvider.setServices(['properties','units']);
$feathersProvider.useSocket(false);
});
Now just inject the service into any controller, service or directive where you need it.
app.controller('SampleController', ["$scope", "$feathers", function($scope, $feathers) {
var properties = $feathers.services.properties.find({}); // Returns all properties from properties service
}]);
To work with the code, just run:
npm install
npm run test
npm run start
The dependencies will install, the tests will be run (always a useful sanity check after a clean checkout) and the code will run. You can open the browser at localhost:8080 to see the samples. As you change the code in the src/
folder, it will be re-built and the browser will be updated.
The easiest way to adapt the code is to play with some of the examples in the samples
folder.
Build the minified module with:
npm run build
Run tests with:
npm run test
A coverage report is written to build\coverage
.
Debug tests with:
npm run test-debug
This will run the tests in Chrome, allowing you to debug.
Normally, and as a recommendation, you have only one indexedDB per app.
Thus in your app.js
where you define your module, you do:
.config(function ($ablDBProvider) {
$ablDBProvider
.connection('myablDB')
.upgradeDatabase(1, function(event, db, tx){
var objStore = db.createObjectStore('people', {keyPath: 'ssn'});
objStore.createIndex('name_idx', 'name', {unique: false});
objStore.createIndex('age_idx', 'age', {unique: false});
});
});
The connection method takes the databasename as parameter, the upgradeCallback has 3 parameters: function callback(event, database, transaction). AngularJS-ablDB supports incremental upgrades. Simply define what to do for each version incrementally:
angular.module('myModuleName', ['ablDB'])
.config(function ($ablDBProvider) {
$ablDBProvider
.connection('myablDB')
.upgradeDatabase(1, function(event, db, tx){
var objStore = db.createObjectStore('people', {keyPath: 'ssn'});
objStore.createIndex('name_idx', 'name', {unique: false});
objStore.createIndex('age_idx', 'age', {unique: false});
});
.upgradeDatabase(2, function(event, db, tx){
db.createObjectStore('peoplePhones', {keyPath: 'person_ssn'});
});
});
When upgrade is required only the migrations which have not been run yet will be run. For upgrading your db structure, see https://developer.mozilla.org/en-US/docs/IndexedDB/Using_IndexedDB.
You can also define your own error handlers, overwriting the default ones, which log to console.
Inside your controller you use $ablDB
like this:
angular.module('myModuleName')
.controller('myControllerName', function($scope, $ablDB) {
$scope.objects = [];
$ablDB.openStore('people', function(store){
store.insert({"ssn": "444-444-222-111","name": "John Doe", "age": 57}).then(function(e){...});
store.getAll().then(function(people) {
// Update scope
$scope.objects = people;
});
});
});
When you open a store a transaction is created for all of your actions against that store you receive a promise for each operation within your transaction and also for the transaction as a whole as the result of "openStore". The transaction resolves successfully after state has been fully persisted.
The following operations are allowed on a store..
$ablDB.openStore('people', function(store){
store.getAllKeys().then(function(e){
$scope.primaryKeys = e;
});
});
$ablDB.openStore('people', function(store){
store.clear().then(function(){
// do something
});
});
$ablDB.openStore('people', function(store){
store.delete($scope.personID).then(function(){
// do something
});
});
// build photo array to upsert
var addToPhotos = [];
for(var j=0; j < file.length; j++){
var photo = {"topicID": $scope.topicID, "filetype": file[j].filetype, "content": file[j].base64}
addToPhotos.push(photo);
}
$ablDB.openStore('people', function(store){
// multiple items
store.upsert(addToPhotos).then(function(e){
// do something
});
// single item
store.upsert({"id": $scope.topicID, "name": $scope.topicName}).then(function (e) {
// do something
});
});
// build photo array to upsert
var addToPhotos = [];
for(var j=0; j < file.length; j++){
var photo = {"topicID": $scope.topicID, "filetype": file[j].filetype, "content": file[j].base64}
addToPhotos.push(photo);
}
$ablDB.openStore('people', function(store){
// multiple items
store.insert(addToPhotos).then(function(e){
// do something
});
// single item
store.insert({"id": $scope.topicID, "name": $scope.topicName}).then(function (e) {
// do something
});
});
$ablDB.openStore('people', function(store){
store.getAll().then(function(topics) {
// Update scope
$scope.topics = topics;
});
});
$ablDB.openStore('photos', function(photos){
// build query
var find = photos.query();
find = find.$eq($scope.topicID);
find = find.$index("topicID_idx");
// update scope
photos.eachWhere(find).then(function(e){
$scope.photos = e;
});
});
$ablDB.openStore('people', function(store){
store.count().then(function(e){
$scope.count = e;
});
});
$ablDB.openStore('photos', function(photos){
photos.find($scope.key).then(function(e){
$scope.photo = e;
});
});
$ablDB.openStore('photos', function(photos){
photos.findBy($scope.indexName, $scope.key).then(function(e){
$scope.photo = e;
});
});
var find = photos.query();
find = find.$eq($scope.topicID);
find = find.$index("topicID_idx");
// available query functions
$lt(value) - less than
$gt(value) - greater than
$lte(value) - less than or equal
$gte(value) - greater than or equal
$eq(value) - equal
$between(lower, upper, doNotIncludeLowerBound? true/false, doNotIncludeUpperBound true/false) - between two bounds
$desc(unique) - descending order
$asc(unique) - ascending order
$index(value) - name of index
FAQs
ABL SDK
The npm package abl-sdk-feathers receives a total of 1 weekly downloads. As such, abl-sdk-feathers popularity was classified as not popular.
We found that abl-sdk-feathers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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 uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.