reactivedb
Advanced tools
Comparing version
@@ -1,14 +0,13 @@ | ||
import { ReactiveDBException } from './Exception'; | ||
export declare const NonExistentTable: (tableName: string) => ReactiveDBException; | ||
export declare const UnmodifiableTable: () => ReactiveDBException; | ||
export declare const InvalidQuery: () => ReactiveDBException; | ||
export declare const AliasConflict: (column: string, tableName: string) => ReactiveDBException; | ||
export declare const GraphFailed: (err: Error) => ReactiveDBException; | ||
export declare const NotImplemented: () => ReactiveDBException; | ||
export declare const UnexpectedRelationship: () => ReactiveDBException; | ||
export declare const InvalidType: (expect?: [string, string] | undefined) => ReactiveDBException; | ||
export declare const UnexpectedTransactionUse: () => ReactiveDBException; | ||
export declare const PrimaryKeyNotProvided: () => ReactiveDBException; | ||
export declare const PrimaryKeyConflict: () => ReactiveDBException; | ||
export declare const DatabaseIsNotEmpty: () => ReactiveDBException; | ||
export declare const NotConnected: () => ReactiveDBException; | ||
export declare const NonExistentTable: (tableName: string) => string; | ||
export declare const UnmodifiableTable: () => string; | ||
export declare const InvalidQuery: () => string; | ||
export declare const AliasConflict: (column: string, tableName: string) => string; | ||
export declare const GraphFailed: (err: Error) => string; | ||
export declare const NotImplemented: () => string; | ||
export declare const UnexpectedRelationship: () => string; | ||
export declare const InvalidType: (expect?: [string, string] | undefined) => string; | ||
export declare const UnexpectedTransactionUse: () => string; | ||
export declare const PrimaryKeyNotProvided: () => string; | ||
export declare const PrimaryKeyConflict: () => string; | ||
export declare const DatabaseIsNotEmpty: () => string; | ||
export declare const NotConnected: () => string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Exception_1 = require("./Exception"); | ||
exports.NonExistentTable = function (tableName) { return new Exception_1.ReactiveDBException("Table: `" + tableName + "` cannot be found."); }; | ||
exports.UnmodifiableTable = function () { return new Exception_1.ReactiveDBException("Method: defineSchema cannot be invoked since schema is existed or database is connected"); }; | ||
exports.InvalidQuery = function () { return new Exception_1.ReactiveDBException('Only navigation properties were included in query.'); }; | ||
exports.AliasConflict = function (column, tableName) { return new Exception_1.ReactiveDBException("Definition conflict, Column: `" + column + "` on table: " + tableName + "."); }; | ||
exports.GraphFailed = function (err) { return new Exception_1.ReactiveDBException("Graphify query result failed, due to: " + err.message + "."); }; | ||
exports.NotImplemented = function () { return new Exception_1.ReactiveDBException('Not implemented yet.'); }; | ||
exports.UnexpectedRelationship = function () { return new Exception_1.ReactiveDBException('Unexpected relationship was specified.'); }; | ||
exports.NonExistentTable = function (tableName) { return "Table: `" + tableName + "` cannot be found."; }; | ||
exports.UnmodifiableTable = function () { return "Method: defineSchema cannot be invoked since schema is existed or database is connected"; }; | ||
exports.InvalidQuery = function () { return 'Only navigation properties were included in query.'; }; | ||
exports.AliasConflict = function (column, tableName) { return "Definition conflict, Column: `" + column + "` on table: " + tableName + "."; }; | ||
exports.GraphFailed = function (err) { return "Graphify query result failed, due to: " + err.message + "."; }; | ||
exports.NotImplemented = function () { return 'Not implemented yet.'; }; | ||
exports.UnexpectedRelationship = function () { return 'Unexpected relationship was specified.'; }; | ||
exports.InvalidType = function (expect) { | ||
@@ -16,9 +15,9 @@ var message = 'Unexpected data type'; | ||
} | ||
return new Exception_1.ReactiveDBException(message + '.'); | ||
return message + '.'; | ||
}; | ||
exports.UnexpectedTransactionUse = function () { return new Exception_1.ReactiveDBException('Please use Database#transaction to get a transaction scope first.'); }; | ||
exports.PrimaryKeyNotProvided = function () { return new Exception_1.ReactiveDBException("Primary key was not provided."); }; | ||
exports.PrimaryKeyConflict = function () { return new Exception_1.ReactiveDBException("Primary key was already provided."); }; | ||
exports.DatabaseIsNotEmpty = function () { return new Exception_1.ReactiveDBException('Method: load cannnot be invoked since database is not empty.'); }; | ||
exports.NotConnected = function () { return new Exception_1.ReactiveDBException('Method: dispose cannnot be invoked before database is connected.'); }; | ||
exports.UnexpectedTransactionUse = function () { return 'Please use Database#transaction to get a transaction scope first.'; }; | ||
exports.PrimaryKeyNotProvided = function () { return "Primary key was not provided."; }; | ||
exports.PrimaryKeyConflict = function () { return "Primary key was already provided."; }; | ||
exports.DatabaseIsNotEmpty = function () { return 'Method: load cannnot be invoked since database is not empty.'; }; | ||
exports.NotConnected = function () { return 'Method: dispose cannnot be invoked before database is connected.'; }; | ||
//# sourceMappingURL=database.js.map |
@@ -1,7 +0,3 @@ | ||
export interface ReactiveDBException extends Error { | ||
export declare class ReactiveDBException extends Error { | ||
constructor(message: string); | ||
} | ||
export interface ReactiveDBExceptionCtor { | ||
new (message: string): ReactiveDBException; | ||
readonly prototype: ReactiveDBException; | ||
} | ||
export declare const ReactiveDBException: ReactiveDBExceptionCtor; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function ReactiveDBExceptionCtor(message) { | ||
var err = Error.call(this, message); | ||
this.name = err.name; | ||
this.message = message; | ||
this.stack = err.stack; | ||
return this; | ||
} | ||
ReactiveDBExceptionCtor.prototype = Object.create(Error.prototype, { | ||
constructor: { | ||
value: ReactiveDBExceptionCtor, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
var tslib_1 = require("tslib"); | ||
var ReactiveDBException = /** @class */ (function (_super) { | ||
tslib_1.__extends(ReactiveDBException, _super); | ||
function ReactiveDBException(message) { | ||
var _this = _super.call(this, message) || this; | ||
_this.name = 'ReactiveDBError'; | ||
Object.setPrototypeOf(_this, ReactiveDBException.prototype); | ||
return _this; | ||
} | ||
}); | ||
exports.ReactiveDBException = ReactiveDBExceptionCtor; | ||
return ReactiveDBException; | ||
}(Error)); | ||
exports.ReactiveDBException = ReactiveDBException; | ||
//# sourceMappingURL=Exception.js.map |
@@ -1,2 +0,5 @@ | ||
export * from './database'; | ||
export * from './token'; | ||
import * as dbErrMsg from './database'; | ||
import * as tokenErrMsg from './token'; | ||
export { dbErrMsg }; | ||
export { tokenErrMsg }; | ||
export { ReactiveDBException as Exception } from './Exception'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./database"), exports); | ||
tslib_1.__exportStar(require("./token"), exports); | ||
var dbErrMsg = require("./database"); | ||
exports.dbErrMsg = dbErrMsg; | ||
var tokenErrMsg = require("./token"); | ||
exports.tokenErrMsg = tokenErrMsg; | ||
var Exception_1 = require("./Exception"); | ||
exports.Exception = Exception_1.ReactiveDBException; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,2 @@ | ||
import { ReactiveDBException } from './Exception'; | ||
export declare const TokenConsumed: () => ReactiveDBException; | ||
export declare const TokenConcatFailed: (msg?: string | undefined) => ReactiveDBException; | ||
export declare const TokenConsumed: () => string; | ||
export declare const TokenConcatFailed: (msg?: string | undefined) => string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Exception_1 = require("./Exception"); | ||
exports.TokenConsumed = function () { return new Exception_1.ReactiveDBException('QueryToken was already consumed.'); }; | ||
exports.TokenConsumed = function () { return 'QueryToken was already consumed.'; }; | ||
exports.TokenConcatFailed = function (msg) { | ||
var errMsg = 'Token cannot be concated' + ((msg ? ' due to: ' + msg : '') + "."); | ||
return new Exception_1.ReactiveDBException(errMsg); | ||
return errMsg; | ||
}; | ||
//# sourceMappingURL=token.js.map |
{ | ||
"name": "reactivedb", | ||
"version": "0.10.2", | ||
"version": "0.10.3-alpha.1-lazyassert", | ||
"description": "Reactive ORM for Lovefield", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -1,23 +0,21 @@ | ||
import { ReactiveDBException } from './Exception' | ||
export const NonExistentTable = | ||
(tableName: string) => new ReactiveDBException(`Table: \`${tableName}\` cannot be found.`) | ||
(tableName: string) => `Table: \`${tableName}\` cannot be found.` | ||
export const UnmodifiableTable = | ||
() => new ReactiveDBException(`Method: defineSchema cannot be invoked since schema is existed or database is connected`) | ||
() => `Method: defineSchema cannot be invoked since schema is existed or database is connected` | ||
export const InvalidQuery = | ||
() => new ReactiveDBException('Only navigation properties were included in query.') | ||
() => 'Only navigation properties were included in query.' | ||
export const AliasConflict = | ||
(column: string, tableName: string) => new ReactiveDBException(`Definition conflict, Column: \`${column}\` on table: ${tableName}.`) | ||
(column: string, tableName: string) => `Definition conflict, Column: \`${column}\` on table: ${tableName}.` | ||
export const GraphFailed = | ||
(err: Error) => new ReactiveDBException(`Graphify query result failed, due to: ${err.message}.`) | ||
(err: Error) => `Graphify query result failed, due to: ${err.message}.` | ||
export const NotImplemented = | ||
() => new ReactiveDBException('Not implemented yet.') | ||
() => 'Not implemented yet.' | ||
export const UnexpectedRelationship = | ||
() => new ReactiveDBException('Unexpected relationship was specified.') | ||
() => 'Unexpected relationship was specified.' | ||
@@ -30,18 +28,18 @@ export const InvalidType = | ||
} | ||
return new ReactiveDBException(message + '.') | ||
return message + '.' | ||
} | ||
export const UnexpectedTransactionUse = | ||
() => new ReactiveDBException('Please use Database#transaction to get a transaction scope first.') | ||
() => 'Please use Database#transaction to get a transaction scope first.' | ||
export const PrimaryKeyNotProvided = | ||
() => new ReactiveDBException(`Primary key was not provided.`) | ||
() => `Primary key was not provided.` | ||
export const PrimaryKeyConflict = | ||
() => new ReactiveDBException(`Primary key was already provided.`) | ||
() => `Primary key was already provided.` | ||
export const DatabaseIsNotEmpty = | ||
() => new ReactiveDBException('Method: load cannnot be invoked since database is not empty.') | ||
() => 'Method: load cannnot be invoked since database is not empty.' | ||
export const NotConnected = | ||
() => new ReactiveDBException('Method: dispose cannnot be invoked before database is connected.') | ||
() => 'Method: dispose cannnot be invoked before database is connected.' |
@@ -1,25 +0,9 @@ | ||
export interface ReactiveDBException extends Error { } | ||
export class ReactiveDBException extends Error { | ||
export interface ReactiveDBExceptionCtor { | ||
new(message: string): ReactiveDBException | ||
readonly prototype: ReactiveDBException | ||
} | ||
constructor(message: string) { | ||
super(message) | ||
this.name = 'ReactiveDBError'; | ||
(Object as any).setPrototypeOf(this, ReactiveDBException.prototype) | ||
} | ||
function ReactiveDBExceptionCtor(this: ReactiveDBException, message: string): ReactiveDBException { | ||
const err = Error.call(this, message) | ||
this.name = err.name | ||
this.message = message | ||
this.stack = err.stack | ||
return this | ||
} | ||
ReactiveDBExceptionCtor.prototype = Object.create(Error.prototype, { | ||
constructor: { | ||
value: ReactiveDBExceptionCtor, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}) | ||
export const ReactiveDBException = ReactiveDBExceptionCtor as any as ReactiveDBExceptionCtor |
@@ -1,2 +0,7 @@ | ||
export * from './database' | ||
export * from './token' | ||
import * as dbErrMsg from './database' | ||
import * as tokenErrMsg from './token' | ||
export { dbErrMsg } | ||
export { tokenErrMsg } | ||
export { ReactiveDBException as Exception } from './Exception' |
@@ -1,5 +0,3 @@ | ||
import { ReactiveDBException } from './Exception' | ||
export const TokenConsumed = | ||
() => new ReactiveDBException('QueryToken was already consumed.') | ||
() => 'QueryToken was already consumed.' | ||
@@ -9,3 +7,3 @@ export const TokenConcatFailed = | ||
const errMsg = 'Token cannot be concated' + `${ msg ? ' due to: ' + msg : '' }.` | ||
return new ReactiveDBException(errMsg) | ||
return errMsg | ||
} |
@@ -9,3 +9,3 @@ import { Observable } from 'rxjs/Observable' | ||
import * as lf from 'lovefield' | ||
import * as Exception from '../exception' | ||
import { dbErrMsg, Exception } from '../exception' | ||
import * as typeDefinition from './helper/definition' | ||
@@ -52,3 +52,3 @@ import Version from '../version' | ||
const schema = this.schemas.get(name) | ||
assert(schema, Exception.NonExistentTable(name)) | ||
assert(schema, dbErrMsg.NonExistentTable(name)) | ||
return schema! | ||
@@ -63,7 +63,7 @@ } | ||
const advanced = !this.schemaDefs.has(tableName) && !this.connected | ||
assert(advanced, Exception.UnmodifiableTable()) | ||
assert(advanced, dbErrMsg.UnmodifiableTable()) | ||
const hasPK = Object.keys(schema) | ||
.some((key: string) => schema[key].primaryKey === true) | ||
assert(hasPK, Exception.PrimaryKeyNotProvided()) | ||
assert(hasPK, dbErrMsg.PrimaryKeyNotProvided()) | ||
@@ -105,3 +105,3 @@ this.schemaDefs.set(tableName, schema) | ||
load(data: any) { | ||
assert(!this.connected, Exception.DatabaseIsNotEmpty()) | ||
assert(!this.connected, dbErrMsg.DatabaseIsNotEmpty()) | ||
@@ -186,3 +186,3 @@ const load = (db: lf.Database) => { | ||
if (type !== 'Object') { | ||
return Observable.throw(Exception.InvalidType(['Object', type])) | ||
return Observable.throw(new Exception(dbErrMsg.InvalidType(['Object', type]))) | ||
} | ||
@@ -360,3 +360,3 @@ | ||
if (!this.connected) { | ||
return Observable.throw(Exception.NotConnected()) | ||
return Observable.throw(new Exception(dbErrMsg.NotConnected())) | ||
} | ||
@@ -381,3 +381,3 @@ | ||
attachTx(_: TransactionEffects) { | ||
throw Exception.UnexpectedTransactionUse() | ||
throw new Exception(dbErrMsg.UnexpectedTransactionUse()) | ||
} | ||
@@ -495,3 +495,3 @@ | ||
if (def.primaryKey) { | ||
assert(!primaryKey[0], Exception.PrimaryKeyConflict()) | ||
assert(!primaryKey[0], dbErrMsg.PrimaryKeyConflict()) | ||
primaryKey.push(key) | ||
@@ -620,3 +620,3 @@ } | ||
default: | ||
throw Exception.InvalidType() | ||
throw new Exception(dbErrMsg.InvalidType()) | ||
} | ||
@@ -659,3 +659,3 @@ } | ||
.every(key => contains(key, navigators)) | ||
assert(!onlyNavigator, Exception.InvalidQuery()) | ||
assert(!onlyNavigator, dbErrMsg.InvalidQuery()) | ||
@@ -680,3 +680,3 @@ if (!hasKey) { | ||
columns.push(...ret.columns) | ||
assert(!rootDefinition[key], Exception.AliasConflict(key, tableName)) | ||
assert(!rootDefinition[key], dbErrMsg.AliasConflict(key, tableName)) | ||
@@ -773,3 +773,3 @@ if ((defs as ColumnDef).column) { | ||
const pkVal = compoundEntites[pk] | ||
assert(pkVal !== undefined, Exception.PrimaryKeyNotProvided()) | ||
assert(pkVal !== undefined, dbErrMsg.PrimaryKeyNotProvided()) | ||
@@ -776,0 +776,0 @@ const [ table ] = Database.getTables(db, tableName) |
@@ -5,3 +5,3 @@ import { forEach } from '../../utils' | ||
import { Relationship } from '../../interface' | ||
import * as Exception from '../../exception' | ||
import { Exception, dbErrMsg } from '../../exception' | ||
@@ -21,5 +21,5 @@ export function revise(relation: Relationship, def: Object) { | ||
case Relationship.manyToMany: | ||
throw Exception.NotImplemented() | ||
throw new Exception(dbErrMsg.NotImplemented()) | ||
default: | ||
throw Exception.UnexpectedRelationship() | ||
throw new Exception(dbErrMsg.UnexpectedRelationship()) | ||
} | ||
@@ -26,0 +26,0 @@ |
import { identity } from '../../utils' | ||
import * as Exception from '../../exception' | ||
import { Exception, dbErrMsg } from '../../exception' | ||
@@ -15,4 +15,4 @@ const nestJS = require('nesthydrationjs')() | ||
} catch (e) { | ||
throw Exception.GraphFailed(e) | ||
throw new Exception(dbErrMsg.GraphFailed(e)) | ||
} | ||
} |
@@ -5,3 +5,3 @@ import * as lf from 'lovefield' | ||
import { fieldIdentifier } from '../symbols' | ||
import * as Exception from '../../exception' | ||
import { dbErrMsg } from '../../exception' | ||
@@ -71,3 +71,3 @@ export class Mutation { | ||
private toUpdater() { | ||
assert(this.meta, Exception.PrimaryKeyNotProvided()) | ||
assert(this.meta, dbErrMsg.PrimaryKeyNotProvided()) | ||
@@ -90,3 +90,3 @@ const query = this.db.update(this.table) | ||
private toRow() { | ||
assert(this.meta, Exception.PrimaryKeyNotProvided()) | ||
assert(this.meta, dbErrMsg.PrimaryKeyNotProvided()) | ||
@@ -93,0 +93,0 @@ return { |
@@ -14,3 +14,3 @@ import { Observer } from 'rxjs/Observer' | ||
import * as lf from 'lovefield' | ||
import * as Exception from '../../exception' | ||
import { tokenErrMsg } from '../../exception' | ||
import { predicatableQuery, graph } from '../helper' | ||
@@ -32,3 +32,3 @@ import { identity, forEach, assert, warn } from '../../utils' | ||
const nextSkip = acc.skip! + acc.limit! | ||
assert(current.skip === nextSkip, Exception.TokenConcatFailed(` | ||
assert(current.skip === nextSkip, tokenErrMsg.TokenConcatFailed(` | ||
skip should be serial, | ||
@@ -61,3 +61,3 @@ expect: ${JSON.stringify(acc, null, 2)} | ||
dist.values = () => { | ||
assert(!dist.consumed, Exception.TokenConsumed()) | ||
assert(!dist.consumed, tokenErrMsg.TokenConsumed()) | ||
dist.consumed = true | ||
@@ -231,3 +231,3 @@ return Observable.from(metaDatas).pipe( | ||
) | ||
assert(equal, Exception.TokenConcatFailed()) | ||
assert(equal, tokenErrMsg.TokenConcatFailed()) | ||
@@ -234,0 +234,0 @@ return Selector.concatFactory(this, ...selectors) |
@@ -1,11 +0,7 @@ | ||
export function assert(condition: any, error: Error | string) { | ||
if (condition) { | ||
return | ||
} | ||
import { ReactiveDBException } from '../exception/Exception' | ||
if (error instanceof Error) { | ||
throw error | ||
} else if (typeof error === 'string') { | ||
throw new Error(error) | ||
export function assert(condition: any, message: string) { | ||
if (!condition) { | ||
throw new ReactiveDBException(message) | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
export default '0.10.2' | ||
export default '0.10.3-alpha.1-lazyassert' |
@@ -9,3 +9,3 @@ "use strict"; | ||
var lf = require("lovefield"); | ||
var Exception = require("../exception"); | ||
var exception_1 = require("../exception"); | ||
var typeDefinition = require("./helper/definition"); | ||
@@ -47,3 +47,3 @@ var version_1 = require("../version"); | ||
var schema = _this.schemas.get(name); | ||
utils_1.assert(schema, Exception.NonExistentTable(name)); | ||
utils_1.assert(schema, exception_1.dbErrMsg.NonExistentTable(name)); | ||
return schema; | ||
@@ -67,6 +67,6 @@ }; | ||
var advanced = !this.schemaDefs.has(tableName) && !this.connected; | ||
utils_1.assert(advanced, Exception.UnmodifiableTable()); | ||
utils_1.assert(advanced, exception_1.dbErrMsg.UnmodifiableTable()); | ||
var hasPK = Object.keys(schema) | ||
.some(function (key) { return schema[key].primaryKey === true; }); | ||
utils_1.assert(hasPK, Exception.PrimaryKeyNotProvided()); | ||
utils_1.assert(hasPK, exception_1.dbErrMsg.PrimaryKeyNotProvided()); | ||
this.schemaDefs.set(tableName, schema); | ||
@@ -88,3 +88,3 @@ return this; | ||
var _this = this; | ||
utils_1.assert(!this.connected, Exception.DatabaseIsNotEmpty()); | ||
utils_1.assert(!this.connected, exception_1.dbErrMsg.DatabaseIsNotEmpty()); | ||
var load = function (db) { | ||
@@ -156,3 +156,3 @@ utils_1.forEach(data.tables, function (entities, name) { | ||
if (type !== 'Object') { | ||
return Observable_1.Observable.throw(Exception.InvalidType(['Object', type])); | ||
return Observable_1.Observable.throw(new exception_1.Exception(exception_1.dbErrMsg.InvalidType(['Object', type]))); | ||
} | ||
@@ -302,3 +302,3 @@ var _a = utils_1.tryCatch(this.findSchema)(tableName), schema = _a[0], err = _a[1]; | ||
if (!this.connected) { | ||
return Observable_1.Observable.throw(Exception.NotConnected()); | ||
return Observable_1.Observable.throw(new exception_1.Exception(exception_1.dbErrMsg.NotConnected())); | ||
} | ||
@@ -318,3 +318,3 @@ var cleanUp = function (db) { | ||
Database.prototype.attachTx = function (_) { | ||
throw Exception.UnexpectedTransactionUse(); | ||
throw new exception_1.Exception(exception_1.dbErrMsg.UnexpectedTransactionUse()); | ||
}; | ||
@@ -406,3 +406,3 @@ Database.prototype.executor = function (db, queries) { | ||
if (def.primaryKey) { | ||
utils_1.assert(!primaryKey[0], Exception.PrimaryKeyConflict()); | ||
utils_1.assert(!primaryKey[0], exception_1.dbErrMsg.PrimaryKeyConflict()); | ||
primaryKey.push(key); | ||
@@ -504,3 +504,3 @@ } | ||
default: | ||
throw Exception.InvalidType(); | ||
throw new exception_1.Exception(exception_1.dbErrMsg.InvalidType()); | ||
} | ||
@@ -533,3 +533,3 @@ }; | ||
.every(function (key) { return utils_1.contains(key, navigators); }); | ||
utils_1.assert(!onlyNavigator, Exception.InvalidQuery()); | ||
utils_1.assert(!onlyNavigator, exception_1.dbErrMsg.InvalidQuery()); | ||
if (!hasKey) { | ||
@@ -550,3 +550,3 @@ // 保证主键一定比关联字段更早的被遍历到 | ||
columns.push.apply(columns, ret.columns); | ||
utils_1.assert(!rootDefinition[key], Exception.AliasConflict(key, tableName)); | ||
utils_1.assert(!rootDefinition[key], exception_1.dbErrMsg.AliasConflict(key, tableName)); | ||
if (defs.column) { | ||
@@ -622,3 +622,3 @@ rootDefinition[key] = defs; | ||
var pkVal = compoundEntites[pk]; | ||
utils_1.assert(pkVal !== undefined, Exception.PrimaryKeyNotProvided()); | ||
utils_1.assert(pkVal !== undefined, exception_1.dbErrMsg.PrimaryKeyNotProvided()); | ||
var table = Database.getTables(db, tableName)[0]; | ||
@@ -625,0 +625,0 @@ var identifier = symbols_1.fieldIdentifier(tableName, pkVal); |
@@ -7,3 +7,3 @@ "use strict"; | ||
var interface_2 = require("../../interface"); | ||
var Exception = require("../../exception"); | ||
var exception_1 = require("../../exception"); | ||
function revise(relation, def) { | ||
@@ -22,5 +22,5 @@ switch (relation) { | ||
case interface_2.Relationship.manyToMany: | ||
throw Exception.NotImplemented(); | ||
throw new exception_1.Exception(exception_1.dbErrMsg.NotImplemented()); | ||
default: | ||
throw Exception.UnexpectedRelationship(); | ||
throw new exception_1.Exception(exception_1.dbErrMsg.UnexpectedRelationship()); | ||
} | ||
@@ -27,0 +27,0 @@ return def; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("../../utils"); | ||
var Exception = require("../../exception"); | ||
var exception_1 = require("../../exception"); | ||
var nestJS = require('nesthydrationjs')(); | ||
@@ -15,3 +15,3 @@ exports.LiteralArray = 'LiteralArray'; | ||
catch (e) { | ||
throw Exception.GraphFailed(e); | ||
throw new exception_1.Exception(exception_1.dbErrMsg.GraphFailed(e)); | ||
} | ||
@@ -18,0 +18,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
var symbols_1 = require("../symbols"); | ||
var Exception = require("../../exception"); | ||
var exception_1 = require("../../exception"); | ||
var Mutation = /** @class */ (function () { | ||
@@ -52,3 +52,3 @@ function Mutation(db, table, initialParams) { | ||
var _this = this; | ||
utils_1.assert(this.meta, Exception.PrimaryKeyNotProvided()); | ||
utils_1.assert(this.meta, exception_1.dbErrMsg.PrimaryKeyNotProvided()); | ||
var query = this.db.update(this.table); | ||
@@ -68,3 +68,3 @@ query.where(this.table[this.meta.key].eq(this.meta.val)); | ||
Mutation.prototype.toRow = function () { | ||
utils_1.assert(this.meta, Exception.PrimaryKeyNotProvided()); | ||
utils_1.assert(this.meta, exception_1.dbErrMsg.PrimaryKeyNotProvided()); | ||
return { | ||
@@ -71,0 +71,0 @@ table: this.table, |
@@ -14,3 +14,3 @@ "use strict"; | ||
var lf = require("lovefield"); | ||
var Exception = require("../../exception"); | ||
var exception_1 = require("../../exception"); | ||
var helper_1 = require("../helper"); | ||
@@ -49,3 +49,3 @@ var utils_1 = require("../../utils"); | ||
var nextSkip = acc.skip + acc.limit; | ||
utils_1.assert(current.skip === nextSkip, Exception.TokenConcatFailed("\n skip should be serial,\n expect: " + JSON.stringify(acc, null, 2) + "\n actual: " + nextSkip + "\n ")); | ||
utils_1.assert(current.skip === nextSkip, exception_1.tokenErrMsg.TokenConcatFailed("\n skip should be serial,\n expect: " + JSON.stringify(acc, null, 2) + "\n actual: " + nextSkip + "\n ")); | ||
return current; | ||
@@ -67,3 +67,3 @@ }); | ||
dist.values = function () { | ||
utils_1.assert(!dist.consumed, Exception.TokenConsumed()); | ||
utils_1.assert(!dist.consumed, exception_1.tokenErrMsg.TokenConsumed()); | ||
dist.consumed = true; | ||
@@ -211,3 +211,3 @@ return Observable_1.Observable.from(metaDatas).pipe(mergeMap_1.mergeMap(function (metaData) { return metaData.values(); }), reduce_1.reduce(function (acc, val) { return acc.concat(val); })); | ||
}); | ||
utils_1.assert(equal, Exception.TokenConcatFailed()); | ||
utils_1.assert(equal, exception_1.tokenErrMsg.TokenConcatFailed()); | ||
return Selector.concatFactory.apply(Selector, [this].concat(selectors)); | ||
@@ -214,0 +214,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
export declare function assert(condition: any, error: Error | string): void; | ||
export declare function assert(condition: any, message: string): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function assert(condition, error) { | ||
if (condition) { | ||
return; | ||
var Exception_1 = require("../exception/Exception"); | ||
function assert(condition, message) { | ||
if (!condition) { | ||
throw new Exception_1.ReactiveDBException(message); | ||
} | ||
if (error instanceof Error) { | ||
throw error; | ||
} | ||
else if (typeof error === 'string') { | ||
throw new Error(error); | ||
} | ||
} | ||
exports.assert = assert; | ||
//# sourceMappingURL=assert.js.map |
@@ -1,2 +0,2 @@ | ||
declare const _default: "0.10.2"; | ||
declare const _default: "0.10.3-alpha.1-lazyassert"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '0.10.2'; | ||
exports.default = '0.10.3-alpha.1-lazyassert'; | ||
//# sourceMappingURL=version.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
278225
-0.59%4917
-0.57%