Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kinvey-backend-sdk

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kinvey-backend-sdk - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

3

CHANGELOG.md
## Changelog
### 0.1.2
* Updated bson library to v0.4.15
### 0.1.1

@@ -4,0 +7,0 @@ * Updated contributors

4

package.json
{
"name": "kinvey-backend-sdk",
"version": "0.1.1",
"version": "0.1.2",
"description": "Backend SDK",

@@ -16,3 +16,3 @@ "engines": {

"moment": "2.10.6",
"bson":"0.4.11",
"bson":"0.4.15",
"kinvey-code-task-runner": "0.1.1"

@@ -19,0 +19,0 @@ },

@@ -21,2 +21,10 @@ # Kinvey Backend SDK (beta)

You then must initialize the sdk to retrieve a reference to the backend service:
```
var service = sdk.service(function(err, service) {
// code goes here
};
```
## DataLink framework

@@ -149,43 +157,44 @@

The following is an examp
The following is an example
```
var sdk = require('kinvey-backend-sdk');
var dataLink = sdk.dataLink; // gets the datalink object from the SDK
var service = sdk.service(function(err, service) {
var dataLink = service.dataLink; // gets the datalink object from the service
var notImplementedHandler = function(request, complete) {
complete("These methods are not implemented").notImplemented().done();
};
var notImplementedHandler = function(request, complete) {
complete("These methods are not implemented").notImplemented().done();
};
var getRecordById = function(request, complete) {
var entityId = request.entityId;
var entity;
var getRecordById = function(request, complete) {
var entityId = request.entityId;
var entity;
// Do some logic to get the entity id from the remote data store
// Assume that data is retrieved and stored in "entity" variable
// Do some logic to get the entity id from the remote data store
// Assume that data is retrieved and stored in "entity" variable
// After entity is retrieved, check to see if it exists
if (typeof entity === 'undefined' or entity === null or entity = {}) {
return complete("The entity could not be found").notFound().next();
} else {
// return the entity
return complete(entity).ok().next();
// After entity is retrieved, check to see if it exists
if (typeof entity === 'undefined' || entity === null || entity === {}) {
return complete("The entity could not be found").notFound().next();
} else {
// return the entity
return complete(entity).ok().next();
}
}
}
// set the collection
var widgets = dataLink.collection('widgets');
// set the collection
var widgets = dataLink.collection('widgets');
// wire up the event that we want to process
widgets.onGetById(getRecordById);
// wire up the event that we want to process
widgets.onGetById(getRecordById);
// wire up the events that we are not implementing
widgets.onGetByQuery(notImplementedHandler);
widgets.onGetAll(notImplementedHandler);
widgets.onGetCount(notImplementedHandler);
widgets.onInsert(notImplementedHandler);
widgets.onUpdate(notImplementedHandler);
widgets.onDeleteAll(notImplementedHandler);
widgets.onDeleteByQuery(notImplementedHandler);
widgets.onDeleteById(notImplementedHandler);
// wire up the events that we are not implementing
widgets.onGetByQuery(notImplementedHandler);
widgets.onGetAll(notImplementedHandler);
widgets.onGetCount(notImplementedHandler);
widgets.onInsert(notImplementedHandler);
widgets.onUpdate(notImplementedHandler);
widgets.onDeleteAll(notImplementedHandler);
widgets.onDeleteByQuery(notImplementedHandler);
widgets.onDeleteById(notImplementedHandler);
};
```

@@ -192,0 +201,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc