Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nodejs support #160

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a995b90
load the OData in node
Aug 11, 2016
21468a1
added dependencies
Aug 12, 2016
1a2a905
put the missing line of OData require back
Aug 15, 2016
ba4702b
map stream type to byte
Aug 15, 2016
f64d75a
small changes for allowing ODataAdapter base class function initializ…
Aug 16, 2016
7e332c5
make the OData adapter keep a reference of an intended OData instance
Aug 16, 2016
9c9403c
fix the entity type key finding
Aug 16, 2016
8dc2944
add odata4 adaptor
Aug 16, 2016
ebb1e72
fixes for getting association for v4 of odata
Aug 16, 2016
1f2931f
add q promise dependency
Aug 17, 2016
47dbf6b
make the parser a separated and overridable class
Aug 22, 2016
197bd99
the new parser class is ready
Aug 22, 2016
62a26c6
make the navigationproperty parsing function a virtual function
Aug 23, 2016
75decc5
add preliminary collection data type support
Aug 23, 2016
6ef0ea5
make the datajs/odatajs library changable
Aug 24, 2016
a494eb7
missing changes from last commit
Aug 24, 2016
330cb57
minor bug fixes
Aug 24, 2016
3bd51ed
a bit more fixes for window global variable definition
Aug 25, 2016
f1084bc
change a few functions in adapter into the memeber function
Aug 25, 2016
1b1ad55
bug fixes
Aug 26, 2016
de21eb2
create batch request header from adapter's default headers
Aug 31, 2016
642fc66
add function parsing
Sep 13, 2016
f5cbf74
more updates on the OData function parsing
Sep 13, 2016
26c4152
a small fix for thee fuction parsing
Sep 15, 2016
7498032
added a fix for adding function type into the EntityManager when Enti…
Sep 21, 2016
d4f8c00
working on Collection data type parsing
Sep 23, 2016
feb7970
a quick hack for an issue in v4 when the data type of a complex type …
Sep 26, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion build/adapters/breeze.dataService.odata.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@
var proto = ctor.prototype; // minifies better (as seen in jQuery)

proto.initialize = function () {
OData = core.requireLib("OData", "Needed to support remote OData services");
// if OData is null, it is either not included in the html file or it is run in the node
// so we try to load datajs, if this is run in browser, it trigger the error
// if it is in node, we load it from window.OData
if (!OData) {
core.requireLib("datajs", "Needed to support remote OData services");

OData = window.OData;
}
OData.jsonHandler.recognizeDates = true;
};
// borrow from AbstractDataServiceAdapter
Expand Down
9 changes: 8 additions & 1 deletion build/breeze.base.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
* Author: Jay Traband
*/

(function(global){
if (typeof window === "undefined") {
window = this;
window.require = require;
}
})(this);

(function (global, definition) {
var def = function(){ return definition(global); };

Expand Down Expand Up @@ -413,7 +420,7 @@ function __requireLib(libNames, errMessage) {

// Returns the 'libName' module if loaded or else returns undefined
function __requireLibCore(libName) {
var window = global.window;
// var window = global.window;
if (!window) return; // Must run in a browser. Todo: add commonjs support

// get library from browser globals if we can
Expand Down
10 changes: 5 additions & 5 deletions build/breeze.base.min.js

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions build/breeze.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
* Author: Jay Traband
*/

(function(global){
if (typeof window === "undefined") {
window = this;
window.require = require;
}
})(this);

(function (global, definition) {
var def = function(){ return definition(global); };

Expand Down Expand Up @@ -413,7 +420,7 @@ function __requireLib(libNames, errMessage) {

// Returns the 'libName' module if loaded or else returns undefined
function __requireLibCore(libName) {
var window = global.window;
// var window = global.window;
if (!window) return; // Must run in a browser. Todo: add commonjs support

// get library from browser globals if we can
Expand Down Expand Up @@ -16534,7 +16541,14 @@ breeze.SaveOptions = SaveOptions;
var proto = ctor.prototype; // minifies better (as seen in jQuery)

proto.initialize = function () {
OData = core.requireLib("OData", "Needed to support remote OData services");
// if OData is null, it is either not included in the html file or it is run in the node
// so we try to load datajs, if this is run in browser, it trigger the error
// if it is in node, we load it from window.OData
if (!OData) {
core.requireLib("datajs", "Needed to support remote OData services");

OData = window.OData;
}
OData.jsonHandler.recognizeDates = true;
};
// borrow from AbstractDataServiceAdapter
Expand Down
2 changes: 1 addition & 1 deletion build/breeze.intellisense.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated on: Mon Jul 18 2016 23:44:55 GMT-0700 (Pacific Daylight Time)
// Generated on: Thu Aug 11 2016 15:17:52 GMT+1000 (AEST)
intellisense.annotate(breeze.core, {
'Enum': function() {
/// <signature>
Expand Down
12 changes: 6 additions & 6 deletions build/breeze.min.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "breeze-build",
"version": "0.1.3",
"main": "breeze.debug",
"devDependencies": {
"event-stream": "^3.2.1",
"gulp": "^3.8.10",
Expand All @@ -16,5 +17,13 @@
"handlebars": "^3.0.1",
"through": "2.3.6 ",
"yuidocjs": "^0.3.50"
},
"dependencies": {
"datajs": "^1.0.3",
"jquery": "^3.1.0",
"odatajs": "^4.0.0",
"q": "^1.4.1",
"xmldom": "^0.1.22",
"xmlhttprequest": "^1.8.0"
}
}
2 changes: 1 addition & 1 deletion docs/api-docs/files/a01_coreFns.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ <h1 class="file-heading">File: a01_coreFns.js</h1>

// Returns the &#x27;libName&#x27; module if loaded or else returns undefined
function __requireLibCore(libName) {
var window = global.window;
// var window = global.window;
if (!window) return; // Must run in a browser. Todo: add commonjs support

// get library from browser globals if we can
Expand Down
9 changes: 9 additions & 0 deletions src/_head.jsfrag
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
* Author: Jay Traband
*/

(function(global){
if (typeof window === "undefined") {
window = this; // global could be a just a local object (this init function)
window.require = require;
window.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
window.DOMParser = require('xmldom').DOMParser;
}
})(this);

(function (global, definition) {
var def = function(){ return definition(global); };

Expand Down
2 changes: 1 addition & 1 deletion src/a01_coreFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ function __requireLib(libNames, errMessage) {

// Returns the 'libName' module if loaded or else returns undefined
function __requireLibCore(libName) {
var window = global.window;
// var window = global.window;
if (!window) return; // Must run in a browser. Todo: add commonjs support

// get library from browser globals if we can
Expand Down
11 changes: 6 additions & 5 deletions src/a30_complexArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ breeze.makeComplexArray = (function () {

function setAspect(co, arr) {
var coAspect = co.complexAspect;
// if already attached - exit
if (coAspect.parent === arr.parent) return null;
coAspect.parent = arr.parent;
coAspect.parentProperty = arr.parentProperty;

if (coAspect) {
// if already attached - exit
if (coAspect.parent === arr.parent) return null;
coAspect.parent = arr.parent;
coAspect.parentProperty = arr.parentProperty;
}
return coAspect;
}

Expand Down
14 changes: 13 additions & 1 deletion src/a37_dataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,16 @@ var DataType = (function () {
parseRawValue: parseRawBinary
});
/**
@property Collection {DataType}
@final
@static
**/
DataType.Collection = DataType.addSymbol({
defaultValue: [],
isCollection: true,
dataType: null
});
/**
@property Undefined {DataType}
@final
@static
Expand Down Expand Up @@ -482,7 +492,9 @@ var DataType = (function () {
var parts = typeName.split(".");
if (parts.length > 1) {
var simpleName = parts[1];
if (simpleName === "image") {
var lowerCaseName = simpleName.toLowerCase();
// we could have Edm.Stream type
if (lowerCaseName === "image" || lowerCaseName === "stream") {
// hack
dt = DataType.Byte;
} else if (parts.length === 2) {
Expand Down
Loading