@fxjs/orm
Advanced tools
Comparing version 1.4.3-postalpha.3 to 1.4.3-postalpha.4
/// <reference path="./orm_mirror/orm.d.ts" /> | ||
import orm from './orm_mirror/orm' | ||
declare module "@fxjs/orm" { | ||
export = orm; | ||
} |
/// <reference path="sql-query.d.ts" /> | ||
/// <reference path="../3rd.d.ts" /> | ||
declare module "@fxjs/orm" { | ||
import events = require('events'); | ||
import sqlquery = require('sqlquery'); | ||
import SqlQueryNS from 'sqlquery' | ||
import events = require('events'); | ||
import sqlquery = require('sqlquery'); | ||
import SqlQueryNS from 'sqlquery' | ||
declare namespace orm { | ||
type Buffer = Class_Buffer | ||
@@ -138,2 +139,3 @@ | ||
name: string; | ||
field?: OrigDetailedModelProperty; | ||
// is the association is extendsTo | ||
@@ -187,3 +189,3 @@ extension?: boolean; | ||
addAccessor: string; | ||
addAccessor?: string; | ||
@@ -200,3 +202,3 @@ required?: boolean; | ||
hooks: Hooks | ||
field: OrigDetailedModelProperty | ||
field?: OrigDetailedModelProperty | ||
@@ -369,11 +371,11 @@ mergeTable: string | ||
*/ | ||
readonly isInstance: boolean; | ||
isInstance(): boolean; | ||
/** | ||
* @noenum | ||
*/ | ||
isPersisted: boolean; | ||
isPersisted(): boolean; | ||
/** | ||
* @noenum | ||
*/ | ||
readonly isShell: boolean; | ||
isShell(): boolean; | ||
validate(callback: (errors: Error[]) => void); | ||
@@ -412,3 +414,3 @@ /* all fixed: end */ | ||
(model: FibOrmFixedModel, opts: object): FibOrmFixedModelInstance | ||
new (model: FibOrmFixedModel, opts: object): void | ||
new (model: FibOrmFixedModel, opts: object): FibOrmFixedModelInstance | ||
} | ||
@@ -508,5 +510,12 @@ | ||
order?: any; | ||
only? | ||
offset?: number; | ||
} | ||
export interface ModelAssociationMethod__Options { | ||
autoFetch: boolean | ||
cascadeRemove: boolean | ||
autoSave: boolean | ||
identityCache: boolean | ||
autoFetchLimit: number | ||
@@ -524,2 +533,3 @@ __merge: ModelAssociationMethod__ComputationPayload__Merge | ||
export interface ModelAssociationMethod__FindOptions extends ModelMethod__FindOptions, ModelAssociationMethod__Options { | ||
} | ||
@@ -581,3 +591,3 @@ | ||
clear(): Model; | ||
clear(...args: any): Model; | ||
@@ -598,5 +608,5 @@ table: string; | ||
remove(callback: (err: Error) => void): Instance; | ||
isInstance: boolean; | ||
isInstance(): boolean; | ||
isPersisted(): boolean; | ||
isShell: boolean; | ||
isShell(): boolean; | ||
validate(callback: (errors: Error[]) => void); | ||
@@ -700,3 +710,3 @@ model: Model; | ||
model: FibOrmFixedModel; | ||
options: ChainFindOptions | ||
options: ChainFindInstanceOptions | ||
} | ||
@@ -714,4 +724,2 @@ | ||
offset | ||
exists | ||
__eager | ||
keys | ||
@@ -721,4 +729,11 @@ newInstance | ||
associations | ||
/* in instance */ | ||
exists? | ||
__eager? | ||
} | ||
export interface ChainFindInstanceOptions extends ChainFindOptions { | ||
} | ||
/* | ||
@@ -858,4 +873,2 @@ * Classes | ||
} | ||
export = orm; | ||
} | ||
} |
v1.4.3-postalpha.3 / 2018-10-11 | ||
v1.4.3-postalpha.4 / 2018-10-12 | ||
================== | ||
* upgrade '@fibjs/enforce', typo fix | ||
v1.4.3-postalpha.3 / 2018-10-11 | ||
=============================== | ||
* Release v1.4.3-postalpha.3 | ||
* upgrade '@fibjs/enforce', do typo fix. | ||
@@ -6,0 +12,0 @@ |
@@ -1,5 +0,6 @@ | ||
var aliases = require('./Drivers/aliases'); | ||
module.exports.add = addAdapter; | ||
module.exports.get = getAdapter; | ||
var adapters = {}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const aliases = require("./Drivers/aliases"); | ||
exports.add = addAdapter; | ||
exports.get = getAdapter; | ||
const adapters = {}; | ||
function addAdapter(name, constructor) { | ||
@@ -6,0 +7,0 @@ adapters[name] = constructor; |
var ORMError = require("./Error"); | ||
var Utilities = require("./Utilities"); | ||
module.exports = AggregateFunctions; | ||
function AggregateFunctions(opts) { | ||
function addAggregate(proto, fun, builder) { | ||
if (Array.isArray(fun)) { | ||
proto[fun[0].toLowerCase()] = builder((fun[1] || fun[0]).toLowerCase()); | ||
} | ||
else { | ||
proto[fun.toLowerCase()] = builder(fun.toLowerCase()); | ||
} | ||
} | ||
function aggregateAlias(fun, fields) { | ||
return fun + (fields && fields.length ? "_" + fields.join("_") : ""); | ||
} | ||
module.exports = function AggregateFunctions(opts) { | ||
if (typeof opts.driver.getQuery !== "function") { | ||
@@ -139,13 +149,2 @@ throw new ORMError('NO_SUPPORT', "This driver does not support aggregate functions"); | ||
return proto; | ||
} | ||
function addAggregate(proto, fun, builder) { | ||
if (Array.isArray(fun)) { | ||
proto[fun[0].toLowerCase()] = builder((fun[1] || fun[0]).toLowerCase()); | ||
} | ||
else { | ||
proto[fun.toLowerCase()] = builder(fun.toLowerCase()); | ||
} | ||
} | ||
function aggregateAlias(fun, fields) { | ||
return fun + (fields && fields.length ? "_" + fields.join("_") : ""); | ||
} | ||
}; |
@@ -16,2 +16,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Hook = require("./Hook"); | ||
const AggregateFunctions = require("./AggregateFunctions"); | ||
const AvailableHooks = [ | ||
@@ -25,3 +26,3 @@ "beforeCreate", "afterCreate", | ||
]; | ||
function Model(opts) { | ||
exports.Model = function (opts) { | ||
opts = _.defaults(opts || {}, { keys: [] }); | ||
@@ -465,3 +466,3 @@ opts.keys = Array.isArray(opts.keys) ? opts.keys : [opts.keys]; | ||
} | ||
return new require("./AggregateFunctions")({ | ||
return new AggregateFunctions({ | ||
table: opts.table, | ||
@@ -662,3 +663,2 @@ driver_name: opts.driver_name, | ||
return model; | ||
} | ||
exports.Model = Model; | ||
}; |
@@ -1,25 +0,20 @@ | ||
var util = require("util"); | ||
var events = require("events"); | ||
var url = require("url"); | ||
var hat = require("hat"); | ||
var Query = require("sql-query"); | ||
var enforce = require("@fibjs/enforce"); | ||
var _ = require("lodash"); | ||
var Model = require("./Model").Model; | ||
var DriverAliases = require("./Drivers/aliases"); | ||
var adapters = require("./Adapters"); | ||
var Settings = require("./Settings"); | ||
var Singleton = require("./Singleton"); | ||
var ORMError = require("./Error"); | ||
var Utilities = require("./Utilities"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const util = require("util"); | ||
const events = require("events"); | ||
const url = require("url"); | ||
const hat = require("hat"); | ||
const Query = require("sql-query"); | ||
const _ = require("lodash"); | ||
const Model_1 = require("./Model"); | ||
const DriverAliases = require("./Drivers/aliases"); | ||
const adapters = require("./Adapters"); | ||
const ORMError = require("./Error"); | ||
const Utilities = require("./Utilities"); | ||
exports.enforce = require("@fibjs/enforce"); | ||
exports.Settings = require("./Settings"); | ||
exports.singleton = require("./Singleton"); | ||
// Deprecated, use enforce | ||
exports.validators = require("./Validators"); | ||
// specific to ORM, not in enforce for now | ||
enforce.equalToProperty = exports.validators.equalToProperty; | ||
enforce.unique = exports.validators.unique; | ||
exports.enforce = enforce; | ||
exports.singleton = Singleton; | ||
exports.settings = new Settings.Container(Settings.defaults()); | ||
const SettingsInstance = exports.settings = new exports.Settings.Container(exports.Settings.defaults()); | ||
exports.Property = require("./Property"); | ||
exports.Settings = Settings; | ||
exports.ErrorCodes = ORMError.codes; | ||
@@ -43,3 +38,3 @@ exports.Text = Query.Text; | ||
var Driver = adapters.get(proto); | ||
var settings = new Settings.Container(exports.settings.get('*')); | ||
var settings = new exports.Settings.Container(SettingsInstance.get('*')); | ||
var driver = new Driver(null, connection, { | ||
@@ -105,3 +100,3 @@ debug: (opts.query && opts.query.debug === 'true'), | ||
var Driver = adapters.get(proto); | ||
var settings = new Settings.Container(exports.settings.get('*')); | ||
var settings = new exports.Settings.Container(SettingsInstance.get('*')); | ||
var driver = new Driver(opts, null, { | ||
@@ -195,3 +190,3 @@ debug: 'debug' in opts.query ? opts.query.debug : settings.get("connection.debug"), | ||
} | ||
this.models[name] = new Model({ | ||
this.models[name] = new Model_1.Model({ | ||
db: this, | ||
@@ -198,0 +193,0 @@ settings: this.settings, |
@@ -29,7 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
}; | ||
exports.Container = Settings; | ||
exports.defaults = function () { | ||
return default_settings; | ||
}; | ||
function Settings(settings) { | ||
exports.Container = function (settings) { | ||
this.settings = settings; | ||
@@ -59,3 +58,3 @@ return { | ||
}; | ||
} | ||
}; | ||
function set(key, value, obj) { | ||
@@ -62,0 +61,0 @@ const p = key.indexOf("."); |
{ | ||
"name": "@fxjs/orm", | ||
"version": "1.4.3-postalpha.3", | ||
"version": "1.4.3-postalpha.4", | ||
"description": "Object Relational Mapping for fibjs", | ||
@@ -41,3 +41,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@fibjs/enforce": "0.0.2", | ||
"@fibjs/enforce": "0.0.5", | ||
"async": "^2.6.1", | ||
@@ -44,0 +44,0 @@ "bluebird": "^3.5.2", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
267432
6602
5
44
+ Added@fibjs/enforce@0.0.5(transitive)
- Removed@fibjs/enforce@0.0.2(transitive)
Updated@fibjs/enforce@0.0.5