breeze-sequelize
Advanced tools
Comparing version 0.5.4 to 0.5.5
{ | ||
"name": "breeze-sequelize", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "Breeze Sequelize server implementation", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -25,3 +25,3 @@ "use strict"; | ||
// omitNull: true, | ||
logging: console.log, | ||
logging: false, | ||
dialectOptions: { decimalNumbers: true }, | ||
@@ -28,0 +28,0 @@ define: { |
@@ -53,8 +53,32 @@ "use strict"; | ||
constructor(sequelizeManager, serverSideEntityQuery) { | ||
this.wasLogged = false; | ||
this.sequelizeManager = sequelizeManager; | ||
this.metadataStore = sequelizeManager.metadataStore; | ||
this.entityType = serverSideEntityQuery._getFromEntityType(this.metadataStore, true); | ||
this.entityQuery = serverSideEntityQuery; | ||
this.sqQuery = this._processQuery(); | ||
try { | ||
this.entityType = serverSideEntityQuery._getFromEntityType(this.metadataStore, true); | ||
this.sqQuery = this._processQuery(); | ||
} | ||
catch (err) { | ||
this.logQuery(); | ||
throw err; | ||
} | ||
if (this.sequelizeManager.sequelizeOptions.logging) { | ||
this.logQuery(); | ||
} | ||
} | ||
logQuery() { | ||
if (this.wasLogged) { | ||
return; | ||
} | ||
// log jsonQuery, not EntityQuery, or we get whole metadatastore | ||
const { resourceName, jsonQuery } = this.entityQuery; | ||
console.dir({ resourceName, jsonQuery }, { depth: 10 }); | ||
// remove `include` and `order` for logging, or we could get the whole sequelize model | ||
const lob = Object.assign({}, this.sqQuery); | ||
delete lob.include; | ||
delete lob.order; | ||
console.dir(lob, { depth: 10 }); | ||
this.wasLogged = true; | ||
} | ||
/** Execute the current query and return data objects */ | ||
@@ -93,2 +117,3 @@ execute(options) { | ||
} | ||
this.logQuery(); | ||
throw e; | ||
@@ -124,5 +149,2 @@ } | ||
} | ||
if (this.sequelizeManager.sequelizeOptions.logging) { | ||
console.dir(this.sqQuery, { depth: 10 }); | ||
} | ||
return this.sqQuery; | ||
@@ -129,0 +151,0 @@ } |
@@ -34,2 +34,3 @@ import { EntityQuery, EntityType, MetadataStore, NavigationProperty, VisitContext } from "breeze-client"; | ||
transaction: Transaction; | ||
private wasLogged; | ||
private _nextId; | ||
@@ -40,2 +41,3 @@ private _keyMap; | ||
constructor(sequelizeManager: SequelizeManager, serverSideEntityQuery: EntityQuery); | ||
private logQuery; | ||
/** Execute the current query and return data objects */ | ||
@@ -42,0 +44,0 @@ execute(options?: SequelizeQueryOptions): Promise<SequelizeQueryResult>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93052
1987