@warp-works/core
Advanced tools
Comparing version 0.7.2 to 0.8.0
@@ -1,2 +0,2 @@ | ||
// const debug = require('debug')('HS:authorization'); | ||
// const debug = require('debug')('W2:authorization'); | ||
@@ -3,0 +3,0 @@ function isWriteAccessRelationship(relationship) { |
@@ -15,3 +15,3 @@ const path = require('path'); | ||
outputPath: process.env.OUTPUT_PATH || path.join(processCwd, "..", "warpjs", "runtime"), | ||
projectPath: process.env.PROJECT_PATH || path.join(processCwd, "..", "IIC-Data") | ||
projectPath: process.env.PROJECT_PATH || path.join(processCwd, "..", "w2projects") | ||
}; | ||
@@ -18,0 +18,0 @@ |
@@ -1,2 +0,2 @@ | ||
// const debug = require('debug')('HS:headstart'); | ||
// const debug = require('debug')('W2:warpworks'); | ||
const fs = require('fs'); | ||
@@ -9,3 +9,3 @@ const mongoClient = require('mongodb').MongoClient; | ||
const config = require('./config'); | ||
const HeadStartError = require('./headstart-error'); | ||
const WarpWorksError = require('./warpworks-error'); | ||
const models = require('./models'); | ||
@@ -25,3 +25,3 @@ const utils = require("./utils"); | ||
class HeadStart { | ||
class WarpWorks { | ||
constructor() { | ||
@@ -74,5 +74,5 @@ this.parent = null; | ||
switch (name) { | ||
// HeadStart files | ||
// WarpWorks files | ||
case "smnDemos": | ||
folder = path.join(hsRoot, "mda", "smnModels", "Demo"); | ||
folder = path.join(config.projectPath, "smnDemos"); | ||
break; | ||
@@ -96,3 +96,3 @@ | ||
default: | ||
throw new HeadStartError("Invalid directory: " + name); | ||
throw new WarpWorksError("Invalid directory: " + name); | ||
} | ||
@@ -189,3 +189,3 @@ | ||
} else { | ||
throw new HeadStartError("Internal Error: Cannot find parent class for " + this.name); | ||
throw new WarpWorksError("Internal Error: Cannot find parent class for " + this.name); | ||
} | ||
@@ -200,3 +200,3 @@ } | ||
} else { | ||
throw new HeadStartError("Internal Error: Cannot find target entity for " + this.name); | ||
throw new WarpWorksError("Internal Error: Cannot find target entity for " + this.name); | ||
} | ||
@@ -213,3 +213,3 @@ } | ||
} else { | ||
throw new HeadStartError("Internal Error: Cannot find property for " + ti.name); | ||
throw new WarpWorksError("Internal Error: Cannot find property for " + ti.name); | ||
} | ||
@@ -229,3 +229,3 @@ } | ||
} else { | ||
throw new HeadStartError("Internal Error: Cannot find relationship for " + rpi.name); | ||
throw new WarpWorksError("Internal Error: Cannot find relationship for " + rpi.name); | ||
} | ||
@@ -240,3 +240,3 @@ } | ||
} else { | ||
throw new HeadStartError("Internal Error: Cannot find basic property for " + bppi.name); | ||
throw new WarpWorksError("Internal Error: Cannot find basic property for " + bppi.name); | ||
} | ||
@@ -251,3 +251,3 @@ } | ||
} else { | ||
throw new HeadStartError("Internal Error: Cannot find enumeration for " + epi.name); | ||
throw new WarpWorksError("Internal Error: Cannot find enumeration for " + epi.name); | ||
} | ||
@@ -272,9 +272,9 @@ } | ||
if (t !== type) { | ||
throw new HeadStartError("Element is of type '" + t + "'. Expected was '" + type + "'! "); | ||
throw new WarpWorksError("Element is of type '" + t + "'. Expected was '" + type + "'! "); | ||
} | ||
if (!isValidID(id)) { | ||
throw new HeadStartError("Invalid ID!"); | ||
throw new WarpWorksError("Invalid ID!"); | ||
} | ||
if (!name) { | ||
throw new HeadStartError("No name specified for element of type: " + t); | ||
throw new WarpWorksError("No name specified for element of type: " + t); | ||
} | ||
@@ -422,3 +422,3 @@ | ||
default: | ||
throw new HeadStartError("Invalid type: " + type); | ||
throw new WarpWorksError("Invalid type: " + type); | ||
} | ||
@@ -532,3 +532,3 @@ } | ||
if (domain && domainFromModel) { | ||
throw new HeadStartError("Error: trying to add new domain #" + domainFromModel + " while also giving " + domain.name); | ||
throw new WarpWorksError("Error: trying to add new domain #" + domainFromModel + " while also giving " + domain.name); | ||
} | ||
@@ -539,3 +539,3 @@ if (!domain && domainFromModel) { | ||
if (!domain || domain == null) { | ||
throw new HeadStartError("Error creating model from SMN - no domain specified!"); | ||
throw new WarpWorksError("Error creating model from SMN - no domain specified!"); | ||
} | ||
@@ -557,3 +557,3 @@ | ||
if (domainElem) { | ||
throw new HeadStartError("Only one domain should be declared per SMN file!"); | ||
throw new WarpWorksError("Only one domain should be declared per SMN file!"); | ||
} | ||
@@ -602,3 +602,3 @@ domainElem = elem; | ||
if (domainElem.aggregations.length === 0) { | ||
throw new HeadStartError("Domain definition does not define child elements. Include '#MyDomain: {MyEntity*}' to do so!"); | ||
throw new WarpWorksError("Domain definition does not define child elements. Include '#MyDomain: {MyEntity*}' to do so!"); | ||
} | ||
@@ -617,3 +617,3 @@ for (rel in domainElem.aggregations) { | ||
if (!target) { | ||
throw new HeadStartError("Error creating new relationship: No matching entity '" + targetType + "'!"); | ||
throw new WarpWorksError("Error creating new relationship: No matching entity '" + targetType + "'!"); | ||
} | ||
@@ -629,3 +629,3 @@ target.setRootEntityStatus(true); | ||
if (!target) { | ||
throw new HeadStartError("No matching parent entity '" + entity.baseClass + "' found for entity'" + entity.name + "'!"); | ||
throw new WarpWorksError("No matching parent entity '" + entity.baseClass + "' found for entity'" + entity.name + "'!"); | ||
} | ||
@@ -647,3 +647,3 @@ entity.setParentClass(target); | ||
if (!target) { | ||
throw new HeadStartError("No matching entity '" + targetName + "' for relationship '" + rel.name + "'!"); | ||
throw new WarpWorksError("No matching entity '" + targetName + "' for relationship '" + rel.name + "'!"); | ||
} | ||
@@ -723,3 +723,3 @@ rel.setTargetEntity(target); | ||
if (!header.includes(")")) { | ||
throw new HeadStartError("Missing ')' in line " + idx); | ||
throw new WarpWorksError("Missing ')' in line " + idx); | ||
} | ||
@@ -733,3 +733,3 @@ entity = utils.extractTagValue(header, "(", ")")[0]; | ||
if (entity.length < 3) { | ||
throw new HeadStartError("Not a valid entity name: '" + entity + "' in line " + idx + " (name must have more than 2 characters)"); | ||
throw new WarpWorksError("Not a valid entity name: '" + entity + "' in line " + idx + " (name must have more than 2 characters)"); | ||
} | ||
@@ -756,3 +756,3 @@ | ||
if (!body.includes("}")) { | ||
throw new HeadStartError("Missing '}' in line " + idx); | ||
throw new WarpWorksError("Missing '}' in line " + idx); | ||
} | ||
@@ -803,3 +803,3 @@ var s = utils.extractTagValue(body, "{", "}"); | ||
if (!BasicTypes.isValid(prop.type) && !prop.type.includes("[")) { | ||
throw new HeadStartError("Invalid basic type '" + prop.type + "' in line " + idx); | ||
throw new WarpWorksError("Invalid basic type '" + prop.type + "' in line " + idx); | ||
} | ||
@@ -818,3 +818,3 @@ model[entity].properties.push(prop); | ||
// | ||
var instance = new HeadStart(); | ||
var instance = new WarpWorks(); | ||
module.exports = instance; |
@@ -1,2 +0,2 @@ | ||
// const debug = require('debug')('HS:models:base'); | ||
// const debug = require('debug')('W2:models:base'); | ||
const fs = require('fs'); | ||
@@ -37,10 +37,10 @@ const path = require('path'); | ||
// This is the top-level element; it will be resolved dynamically | ||
this.headstart = (parent && parent.constructor.name === 'HeadStart') ? parent : null; | ||
this.warpworks = (parent && parent.constructor.name === 'WarpWorks') ? parent : null; | ||
} | ||
getHeadStart() { | ||
if (!this.headstart) { | ||
this.headstart = this.parent.getHeadStart(); | ||
getWarpWorks() { | ||
if (!this.warpworks) { | ||
this.warpworks = this.parent.getWarpWorks(); | ||
} | ||
return this.headstart; | ||
return this.warpworks; | ||
} | ||
@@ -344,5 +344,5 @@ | ||
if (target[0] === '.') { | ||
fn = path.join(process.cwd(), 'public', 'HeadStart', fn); | ||
fn = path.join(process.cwd(), 'public', 'WarpWorks', fn); | ||
} else { | ||
fn = path.join(this.getHeadStart().getDir("output"), target[0], fn); | ||
fn = path.join(this.getWarpWorks().getDir("output"), target[0], fn); | ||
} | ||
@@ -349,0 +349,0 @@ |
const _ = require('lodash'); | ||
// const debug = require('debug')('HS:models:domain'); | ||
// const debug = require('debug')('W2:models:domain'); | ||
const fs = require('fs'); | ||
@@ -7,12 +7,12 @@ | ||
const Entity = require('./entity'); | ||
const HeadStartError = require('./../headstart-error'); | ||
const WarpWorksError = require('./../warpworks-error'); | ||
const utils = require('./../utils'); | ||
class DomainError extends HeadStartError { | ||
class DomainError extends WarpWorksError { | ||
} | ||
class Domain extends Base { | ||
constructor(headstart, name, desc, recreate) { | ||
// Special case - the parent of domain is headstart, which is not of type "Base" | ||
super("Domain", headstart, 1, name, desc); | ||
constructor(warpworks, name, desc, recreate) { | ||
// Special case - the parent of domain is warpworks, which is not of type "Base" | ||
super("Domain", warpworks, 1, name, desc); | ||
this.id_counter = 1; | ||
@@ -29,5 +29,5 @@ this.entities = []; | ||
save() { | ||
var fn = this.getHeadStart().getDir("domains", `${this.name}.jsn`); | ||
var fn = this.getWarpWorks().getDir("domains", `${this.name}.jsn`); | ||
fs.writeFileSync(fn, JSON.stringify(this, null, 2)); | ||
this.getHeadStart().expireDomainCache(this.name); | ||
this.getWarpWorks().expireDomainCache(this.name); | ||
} | ||
@@ -243,3 +243,3 @@ | ||
var domain = this; | ||
this.getHeadStart().useDB(domain.name, function(db) { | ||
this.getWarpWorks().useDB(domain.name, function(db) { | ||
var collection = db.collection(entityDef.getBaseClass().name); | ||
@@ -246,0 +246,0 @@ collection.insertOne(testData, function(mongoErr, mongoRes) { |
@@ -1,2 +0,2 @@ | ||
// const debug = require('debug')('HS:models:entity'); | ||
// const debug = require('debug')('W2:models:entity'); | ||
const Promise = require('bluebird'); | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const debug = require('debug')('HS:utils'); | ||
const debug = require('debug')('W2:utils'); | ||
const path = require('path'); | ||
@@ -7,3 +7,3 @@ | ||
// ***************************************************************************************************** // | ||
const HeadStartError = require('./headstart-error'); | ||
const WarpWorksError = require('./warpworks-error'); | ||
@@ -29,7 +29,7 @@ const BASE_PATH = path.resolve(path.join(__dirname, '..')); | ||
if (pos1 === -1) { | ||
throw new HeadStartError(`Missing opening tag '${openTag}'!`); | ||
throw new WarpWorksError(`Missing opening tag '${openTag}'!`); | ||
} else if (pos2 === -1) { | ||
throw new HeadStartError(`Missing closing tag '${closeTag}'!`); | ||
throw new WarpWorksError(`Missing closing tag '${closeTag}'!`); | ||
} else if (pos1 > pos2) { | ||
throw new HeadStartError(`Opening tag '${openTag}' must come before closing tag '${closeTag}'!`); | ||
throw new WarpWorksError(`Opening tag '${openTag}' must come before closing tag '${closeTag}'!`); | ||
} | ||
@@ -55,3 +55,3 @@ | ||
if (bs[1].includes(openTag)) { | ||
throw new HeadStartError("Opening tag '" + openTag + "' must be followed by closing tag '" + closeTag + "' before next opening tag!"); | ||
throw new WarpWorksError("Opening tag '" + openTag + "' must be followed by closing tag '" + closeTag + "' before next opening tag!"); | ||
} | ||
@@ -64,3 +64,3 @@ tokenSeq.push({value: bs[1], isTagValue: true}); | ||
if (str.includes(closeTag)) { | ||
throw new HeadStartError("Missing opening tag '" + openTag + "'!"); | ||
throw new WarpWorksError("Missing opening tag '" + openTag + "'!"); | ||
} | ||
@@ -67,0 +67,0 @@ tokenSeq.push({value: str, isTagValue: false}); |
{ | ||
"name": "@warp-works/core", | ||
"version": "0.7.2", | ||
"version": "0.8.0", | ||
"description": "Core library for WarpWorks", | ||
@@ -37,3 +37,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@quoin/eslint-config-quoin": "0.1.0", | ||
"@quoin/eslint-config-quoin": "0.1.1", | ||
"@quoin/node-test-helpers": "0.1.7", | ||
@@ -47,4 +47,4 @@ "eslint": "3.19.0", | ||
"bluebird": "3.5.0", | ||
"mongodb": "2.2.25" | ||
"mongodb": "2.2.26" | ||
} | ||
} |
# Releases | ||
## 0.8.0 - 2017-04-19 | ||
- Renaming variables to be in sync with new name. | ||
## 0.7.2 - 2017-04-17 | ||
@@ -4,0 +8,0 @@ |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
112891
33
1
15
+ Addedmongodb@2.2.26(transitive)
+ Addedmongodb-core@2.1.10(transitive)
+ Addedreadable-stream@2.2.7(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstring_decoder@1.0.3(transitive)
- Removedmongodb@2.2.25(transitive)
- Removedmongodb-core@2.1.9(transitive)
- Removedreadable-stream@2.1.5(transitive)
- Removedstring_decoder@0.10.31(transitive)
Updatedmongodb@2.2.26