domain-knex
Advanced tools
Comparing version 0.0.13 to 0.0.17
@@ -47,3 +47,3 @@ "use strict"; | ||
var domainSchema = new domain_schema_1.default(schema); | ||
var tableName = humps_1.decamelize(domainSchema.__.name); | ||
var tableName = humps_1.decamelize(domainSchema.name); | ||
var parentPath = []; | ||
@@ -67,3 +67,3 @@ var selectItems = []; | ||
if (domainSchema.__.transient) { | ||
throw new Error("Unable to create tables for transient schema: " + domainSchema.__.name); | ||
throw new Error("Unable to create tables for transient schema: " + domainSchema.name); | ||
} | ||
@@ -100,3 +100,3 @@ return this._createTables(null, domainSchema, []); | ||
else { | ||
throw new Error("Don't know how to handle type " + type.__.name + " of " + tableName + "." + columnName); | ||
throw new Error("Don't know how to handle type " + type.name + " of " + tableName + "." + columnName); | ||
} | ||
@@ -118,8 +118,8 @@ if (value.unique) { | ||
return __generator(this, function (_a) { | ||
if (seen.indexOf(schema.__.name) >= 0) { | ||
if (seen.indexOf(schema.name) >= 0) { | ||
return [2, Promise.resolve(null)]; | ||
} | ||
seen.push(schema.__.name); | ||
seen.push(schema.name); | ||
domainSchema = new domain_schema_1.default(schema); | ||
tableName = humps_1.decamelize(domainSchema.__.name); | ||
tableName = humps_1.decamelize(domainSchema.name); | ||
return [2, this.knex.schema.createTable(tableName, function (table) { | ||
@@ -147,7 +147,7 @@ if (parentTableName) { | ||
promises.push(newPromise); | ||
debug("Schema key: " + tableName + "." + column + " -> " + type.__.name); | ||
debug("Schema key: " + tableName + "." + column + " -> " + type.name); | ||
} | ||
else if (!value.transient && key !== 'id') { | ||
DomainKnex._addColumn(tableName, table, key, value); | ||
debug("Scalar key: " + tableName + "." + column + " -> " + type.__.name); | ||
debug("Scalar key: " + tableName + "." + column + " -> " + type.name); | ||
} | ||
@@ -161,7 +161,7 @@ } | ||
DomainKnex.prototype._getTableNames = function (domainSchema, seen) { | ||
if (seen.indexOf(domainSchema.__.name) >= 0) { | ||
if (seen.indexOf(domainSchema.name) >= 0) { | ||
return []; | ||
} | ||
seen.push(domainSchema.__.name); | ||
var tableName = humps_1.decamelize(domainSchema.__.name); | ||
seen.push(domainSchema.name); | ||
var tableName = humps_1.decamelize(domainSchema.name); | ||
var tableNames = []; | ||
@@ -182,6 +182,6 @@ if (domainSchema.__.transient) { | ||
DomainKnex.prototype._getSelectFields = function (fields, parentPath, domainSchema, selectItems, joinNames, seen) { | ||
if (seen.indexOf(domainSchema.__.name) >= 0) { | ||
if (seen.indexOf(domainSchema.name) >= 0) { | ||
return; | ||
} | ||
seen.push(domainSchema.__.name); | ||
seen.push(domainSchema.name); | ||
for (var _i = 0, _a = Object.keys(fields); _i < _a.length; _i++) { | ||
@@ -194,3 +194,3 @@ var key = _a[_i]; | ||
var as = parentPath.length > 0 ? parentPath.join('_') + "_" + key : key; | ||
selectItems.push(humps_1.decamelize(domainSchema.__.name) + "." + humps_1.decamelize(key) + " as " + as); | ||
selectItems.push(humps_1.decamelize(domainSchema.name) + "." + humps_1.decamelize(key) + " as " + as); | ||
} | ||
@@ -201,3 +201,3 @@ } | ||
if (!type.__.transient) { | ||
joinNames.push(humps_1.decamelize(type.__.name)); | ||
joinNames.push(humps_1.decamelize(type.name)); | ||
} | ||
@@ -204,0 +204,0 @@ parentPath.push(key); |
{ | ||
"name": "domain-knex", | ||
"version": "0.0.13", | ||
"version": "0.0.17", | ||
"description": "Knex generator for Domain Schema", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/sysgears/domain-schema.git", |
Sorry, the diff of this file is not supported yet
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
21085