Skip to content

Commit 4c2ca98

Browse files
committed
0.3.0 compatibility fixes
1 parent 7217c2c commit 4c2ca98

4 files changed

Lines changed: 2 additions & 167 deletions

File tree

lib/client.js

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
var request = require("request"),
99
url = require("url"),
10-
defaultDataContext = require("./dataContext.js"),
1110
concat = require('concat-stream');
1211

1312
module.exports = function (url, username, password) {
@@ -18,37 +17,6 @@ var Client = function (url, username, password) {
1817
this.url = url;
1918
this.username = username;
2019
this.password = password;
21-
this.entitySets = defaultDataContext;
22-
}
23-
24-
/**
25-
* Create jaydata entity context able to do quries and CRUD over a remote jsreport server entities
26-
* @param cb nodejs style callback
27-
*/
28-
Client.prototype.createDataContext = function (cb) {
29-
30-
if (!this.DataContext) {
31-
this.DataContext = $data.EntityContext.extend("entity.Context", this.entitySets);
32-
}
33-
var dataContext = new (this.DataContext)({
34-
name: 'oData',
35-
oDataServiceHost: url.resolve(this.url, "odata"),
36-
user: this.username,
37-
password: this.password
38-
});
39-
40-
dataContext.onReady(function (context) {
41-
cb(null, context);
42-
});
43-
};
44-
45-
Client.prototype.registerAdditionalEntitySet = function (name, type) {
46-
var entitySet = { type: $data.EntitySet, elementType: type };
47-
this.entitySets[name] = entitySet;
48-
}
49-
50-
Client.prototype.createEntityType = function (name, attributes) {
51-
return $data.Class.define(name, $data.Entity, null, attributes, null);
5220
}
5321

5422
/**

lib/dataContext.js

Lines changed: 0 additions & 93 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsreport-client",
3-
"version": "0.0.1",
3+
"version": "0.3.0",
44
"author": {
55
"name": "Jan Blaha",
66
"email": "jan.blaha@hotmail.com"
@@ -23,7 +23,6 @@
2323
},
2424
"dependencies": {
2525
"concat-stream": "^1.4.6",
26-
"jaydata": "^1.3.6",
2726
"request": "^2.40.0"
2827
}
2928
}

test/clientTest.js

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ describe('testing client', function () {
1919
httpPort: 3000
2020
}).start().then(function(bootstrapper) {
2121
reporter = bootstrapper.reporter;
22-
23-
reporter.dataProvider.dropStore().then(function() {
24-
done();
25-
}).catch(done);
22+
done();
2623
}).catch(done);
2724
});
2825

@@ -82,42 +79,6 @@ describe('testing client', function () {
8279
});
8380
});
8481
});
85-
86-
it('should be able to use jaydata context',function(done){
87-
client(url + "/").createDataContext(function(err, dataContext) {
88-
should.exist(dataContext)
89-
done();
90-
});
91-
});
92-
93-
it('createDataContext should create and read template',function(done){
94-
client(url + "/").createDataContext(function(err, dataContext) {
95-
dataContext.templates.add({
96-
content: "hello"
97-
});
98-
99-
dataContext.saveChanges().then(function() {
100-
dataContext.templates.toArray().then(function(res) {
101-
res[0].content.should.be.equal("hello");
102-
done();
103-
}).catch(done)
104-
}).catch(done);
105-
});
106-
});
107-
108-
it('creating entity should update its shortid',function(done){
109-
client(url + "/").createDataContext(function(err, dataContext) {
110-
111-
var template = dataContext.templates.add({
112-
content: "hello"
113-
});
114-
115-
dataContext.saveChanges().then(function() {
116-
template.shortid.should.be.ok;
117-
done();
118-
}).catch(done);
119-
});
120-
});
12182
});
12283

12384
describe('testing client without connection', function () {

0 commit comments

Comments
 (0)