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

kinvey-flex-sdk

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kinvey-flex-sdk - npm Package Compare versions

Comparing version 3.3.0-alpha.1 to 3.3.0-alpha.2

3

CHANGELOG.md

@@ -5,3 +5,4 @@ ## Changelog

* Added new onInsertMulti data event for handling insertion of Arrays
* Added support for arrays in dataStore.save()
* Added support for arrays in dataStore.save()
* Add option to override API version in dataStore requests

@@ -8,0 +9,0 @@ ### 3.2.1

@@ -14,2 +14,3 @@ /**

this._useUserContext = storeOptions.useUserContext || false;
this._apiVersion = storeOptions.apiVersion || this._requestContext.apiVersion;
}

@@ -56,3 +57,3 @@

'Content-Type': 'application/json',
'X-Kinvey-API-Version': this._requestContext.apiVersion,
'X-Kinvey-API-Version': this._apiVersion
};

@@ -59,0 +60,0 @@

{
"name": "kinvey-flex-sdk",
"version": "3.3.0-alpha.1",
"version": "3.3.0-alpha.2",
"description": "SDK for creating Kinvey Flex Services",

@@ -5,0 +5,0 @@ "engines": {

@@ -97,2 +97,3 @@ /**

myRunner._requestContext.should.containDeep(this.requestContext);
myRunner._apiVersion.should.eql(myRunner._requestContext.apiVersion);
});

@@ -120,2 +121,16 @@

it('should be able to override the API version', () => {
const API_VERSION = 5;
const myRunner = this.runner({ apiVersion: API_VERSION });
should.exist(myRunner.endpoint);
myRunner.endpoint.should.be.a.Function();
myRunner.endpoint.name.should.eql('endpoint');
myRunner._useBl.should.be.true();
myRunner._appMetadata.should.containDeep(this.appMetadata);
myRunner._requestContext.should.containDeep(this.requestContext);
myRunner._apiVersion.should.not.eql(myRunner._requestContext.apiVersion);
myRunner._apiVersion.should.eql(API_VERSION);
});
it('should be able to create two endpointRunner objects with different settings', () => {

@@ -333,2 +348,23 @@ const myRunner = this.runner();

it('should execute with overriden API Version', (done) => {
const API_VERSION = 5;
nock(BAAS_URL)
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.post(`/rpc/${ENVIRONMENT_ID}/custom/myEndpoint`)
.basicAuth({
user: ENVIRONMENT_ID,
pass: MASTER_SECRET
})
.reply(200, this.payload);
const endpoint = this.runner({ apiVersion: API_VERSION }).endpoint('myEndpoint');
endpoint.execute({}, (err, result) => {
should.not.exist(err);
result.should.containDeep(this.payload);
return done();
});
});
it('should prevent recursive requests to the same endpoint', (done) => {

@@ -335,0 +371,0 @@ this.taskMetadata.hookType = 'customEndpoint';

@@ -116,2 +116,3 @@ /**

myStore._requestContext.should.containDeep(this.requestContext);
myStore._apiVersion.should.eql(myStore._requestContext.apiVersion);
});

@@ -133,2 +134,12 @@

it('should create a GroupStore object that overrides the API Version', () => {
const API_VERSION = 5;
const myStore = this.store({ apiVersion: API_VERSION });
myStore._appMetadata.should.containDeep(this.appMetadata);
myStore._requestContext.should.containDeep(this.requestContext);
myStore._apiVersion.should.not.eql(myStore._requestContext.apiVersion);
myStore._apiVersion.should.eql(API_VERSION);
});
it('should be able to create two GroupStore objects with different settings', () => {

@@ -262,2 +273,18 @@ const myStore = this.store();

it('should find a single group and override the API Version', (done) => {
const API_VERSION = 5;
nock('https://baas.kinvey.com')
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.get(`/group/${environmentId}/1234`)
.reply(200, { _id: 1234, someData: 'abc' });
this.store({ apiVersion: API_VERSION }).findById('1234', (err, result) => {
should.not.exist(err);
result.should.containDeep({ _id: 1234, someData: 'abc' });
return done();
});
});
it('should prevent recursive requests to the same object that use bl', (done) => {

@@ -486,2 +513,24 @@ this.storeUserRequest({ useBl: true }).findById('1234', (err, result) => {

it('should create a new group and override the API Version', (done) => {
const API_VERSION = 5;
nock('https://baas.kinvey.com')
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.post(`/group/${environmentId}/`, {
username: 'abc'
})
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200, { _id: 1234, username: 'abc' });
this.store({ apiVersion: API_VERSION }).create({ username: 'abc' }, (err, result) => {
should.not.exist(err);
result.should.containDeep({ _id: 1234, username: 'abc' });
return done();
});
});
it('should prevent recursive requests to the same object that use bl', (done) => {

@@ -694,2 +743,25 @@ this.storeUserRequest({ useBl: true }).create({ username: 'abc' }, (err, result) => {

it('should update an existing group and override the API Version', (done) => {
const API_VERSION = 5;
nock('https://baas.kinvey.com')
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.put(`/group/${environmentId}/1234`, {
_id: 1234,
username: 'abc'
})
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200, { _id: 1234, username: 'abc' });
this.store({ apiVersion: API_VERSION }).update({ _id: 1234, username: 'abc' }, (err, result) => {
should.not.exist(err);
result.should.containDeep({ _id: 1234, username: 'abc' });
return done();
});
});
it('should prevent recursive requests to the same object that use bl', (done) => {

@@ -909,2 +981,22 @@ this.storeUserRequest({ useBl: true }).update({ _id: 1234, username: 'abc' }, (err, result) => {

it('should remove an existing group and override the API Version', (done) => {
const API_VERSION = 5;
nock('https://baas.kinvey.com')
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.delete(`/group/${environmentId}/1234`)
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200);
this.store({ apiVersion: API_VERSION }).remove('1234', (err, result) => {
should.not.exist(err);
should.not.exist(result);
return done();
});
});
it('should prevent recursive requests to the same object that use bl', (done) => {

@@ -911,0 +1003,0 @@ this.storeUserRequest({ useBl: true }).remove('1234', (err, result) => {

@@ -119,2 +119,3 @@ /**

myStore._requestContext.should.containDeep(this.requestContext);
myStore._apiVersion.should.eql(myStore._requestContext.apiVersion);
});

@@ -136,2 +137,12 @@

it('should create a RoleStore object that overrides the API version', () => {
const API_VERSION = 5;
const myStore = this.store({ apiVersion: API_VERSION });
myStore._appMetadata.should.containDeep(this.appMetadata);
myStore._requestContext.should.containDeep(this.requestContext);
myStore._apiVersion.should.not.eql(myStore._requestContext.apiVersion);
myStore._apiVersion.should.eql(API_VERSION);
});
it('should be able to create two RoleStore objects with different settings', () => {

@@ -256,2 +267,6 @@ const myStore = this.store();

.get(`/roles/${environmentId}/1234`)
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200, { _id: 1234, someData: 'abc' });

@@ -266,2 +281,22 @@

it('should find a single role and override the API Version', (done) => {
const API_VERSION = 5;
nock('https://baas.kinvey.com')
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.get(`/roles/${environmentId}/1234`)
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200, { _id: 1234, someData: 'abc' });
this.store({ apiVersion: API_VERSION }).findById('1234', (err, result) => {
should.not.exist(err);
result.should.containDeep({ _id: 1234, someData: 'abc' });
return done();
});
});
it('should prevent recursive requests to the same object that use bl', (done) => {

@@ -486,2 +521,24 @@ this.storeUserRequest({ useBl: true }).findById('1234', (err, result) => {

it('should create a new entity and override the API Version', (done) => {
const API_VERSION = 5;
nock('https://baas.kinvey.com')
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.post(`/roles/${environmentId}/`, {
username: 'abc'
})
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200, { _id: 1234, username: 'abc' });
this.store({ apiVersion: API_VERSION }).create({ username: 'abc' }, (err, result) => {
should.not.exist(err);
result.should.containDeep({ _id: 1234, username: 'abc' });
return done();
});
});
it('should prevent recursive requests to the same object that use bl', (done) => {

@@ -694,2 +751,25 @@ this.storeUserRequest({ useBl: true }).create({ username: 'abc' }, (err, result) => {

it('should update an existing role and override the API Version', (done) => {
const API_VERSION = 5;
nock('https://baas.kinvey.com')
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.put(`/roles/${environmentId}/1234`, {
_id: 1234,
username: 'abc'
})
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200, { _id: 1234, username: 'abc' });
this.store({ apiVersion: API_VERSION }).update({ _id: 1234, username: 'abc' }, (err, result) => {
should.not.exist(err);
result.should.containDeep({ _id: 1234, username: 'abc' });
return done();
});
});
it('should prevent recursive requests to the same object that use bl', (done) => {

@@ -909,2 +989,22 @@ this.storeUserRequest({ useBl: true }).update({ _id: 1234, username: 'abc' }, (err, result) => {

it('should remove a single role and override the API Version', (done) => {
const API_VERSION = 5;
nock('https://baas.kinvey.com')
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.delete(`/roles/${environmentId}/1234`)
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200);
this.store({ apiVersion: API_VERSION }).remove('1234', (err, result) => {
should.not.exist(err);
should.not.exist(result);
return done();
});
});
it('should prevent recursive requests to the same object that use bl', (done) => {

@@ -1107,2 +1207,6 @@ this.storeUserRequest({ useBl: true }).remove('1234', (err, result) => {

.get(`/roles/${environmentId}/1234/membership`)
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200, { _id: 1234, someData: 'abc' });

@@ -1117,2 +1221,22 @@

it('should list role members and override the API Version', (done) => {
const API_VERSION = 5;
nock('https://baas.kinvey.com')
.matchHeader('content-type', 'application/json')
.matchHeader('x-kinvey-api-version', `${API_VERSION}`)
.get(`/roles/${environmentId}/1234/membership`)
.basicAuth({
user: environmentId,
pass: mastersecret
})
.reply(200, { _id: 1234, someData: 'abc' });
this.store({ apiVersion: API_VERSION }).listMembers('1234', (err, result) => {
should.not.exist(err);
result.should.containDeep({ _id: 1234, someData: 'abc' });
return done();
});
});
it('should prevent recursive requests to the same object that use bl', (done) => {

@@ -1119,0 +1243,0 @@ this.storeUserRequest({ useBl: true }).listMembers('1234', (err, result) => {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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