New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gelato

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gelato

Mobile Data service SDK for IBM Bluemix

latest
npmnpm
Version
0.0.18
Version published
Maintainers
1
Created
Source

Mobile Cloud Services JavaScript SDK for IBM Mobile Data for Bluemix

This package contains the required native components to interact with the IBM Mobile Cloud Services for Bluemix. You can use the JavaScript SDK to build server-side applications Node.js

When you use Bluemix to create a Mobile Cloud application, BlueMix provisions multiple services under a single application context. Your mobile application is given access to the following mobile services: Mobile Data.

Get the SDK with NPM (Node.js)

NPM is included in current Node.js distributions. To install Node.js, go to Download Node.js.

Use the following command to install the ibmdata package:

npm install gelato

##Get started

//
// edit config/default.json and enter your app info
//
// {
//     "gelato" : {
//         "agent" : <agent URL>
//         "agentPort" : <agent port>,
//         "appId" : <appid>,
//         "appSecret" : <app secret>,
//         "appKey" : <app key>
//     }
// }
//

// initialize sdk
var gelato = require('gelato')

// issue a query
gelato.query( query, function(err, docs) {
    ...
})

// find all instances of a given type
gelato.ofType(className, function(err, docs) {
    ...
})

// find the object with the given id
gelato.forObjectId(id, function(err, obj) {
    ...
})

// create an object
gelato.create(className, { "name" : "bob", age : 30 }, function(err,obj) {
    ...
})

// delete by ID
gelato.deleteById(id, function(err, res) {
   ...
})

// find all class names
gelato.classNames(function(err, names) {
   ...
})

// save an object
gelato.save(obj, function(err,res) {
   ...
})

// The low-level query API
//     limit might be lowered by implementation
gelato.query({ limit : 10, predicate : { x : 10 }}, function(err,res) {
    if (err) throw ...
    var bookmark = res.bookmark
    var objects = res.objects
    var n = objects.length
    ...
});

// The predicate API, you can't specify limit, bookmark, ...
gelato.perdicate({ x : 10}, function(err, res) {
   ...
});

// The batch API, we give you arrays of objects
//       limit is per batch
//       we'll keep feeding you objects until either:
//             - no more objects or
//             - you don't call next
gelato.batch({ limit : 10}, function(err, array, next) {
    if (err) throw ...

    if (array == null) {
        // no more objects
    } else {
        // work with array of objects
        if (needMore) {
            next()
        } else {
            // don't call next
        }
    }
})
        
// The stream API, we give you one object at a time
//       limit is a hint for how many to bring from server per request
//       we'll keep feeding you objects until either:
//             - no more objects or
//             - you don't call next
gelato.batch({ limit : 10}, function(err, obj, next) {
    if (err) throw ...

    if (array == null) {
        // no more objects
    } else {
        // work with array of objects
        if (needMore) {
            next()
        } else {
            // don't call next
        }
    }
})
        
// convenience predicate generator
var predicate = gelato.eq('x',10).eq('.className',"Person").gen();
var predicate = gelato.eq('x',10).or(gelato.eq('y',100)).gen();

// you can also generate complete queries
var query = gelato.eq('x',10).gt('y',200).limit(10).bookmark('ERFVs').gen();

// you can also issue a query directly
gelato.eq('x',10).eq('z','abc').stream(function(err,obj,next) {
    ....
})

// generic RPC
gelato.rpc('service','method',attributes,function(err, reply) {
    ...
})

##Learn More

Licensed Materials - Property of IBM (C) Copyright IBM Corp. 2013, 2014. All Rights Reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

Terms of Use | Notices

FAQs

Package last updated on 03 Dec 2014

Did you know?

Socket

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.

Install

Related posts