New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fxjs/orm

Package Overview
Dependencies
Maintainers
2
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fxjs/orm - npm Package Compare versions

Comparing version 1.8.8 to 1.9.0

7

@types/assoc.d.ts
/// <reference path="model.d.ts" />
declare namespace FxOrmAssociation {
type AssociationType = 'extendsTo' | 'hasOne' | 'hasMany'
type AssociationKeyComputation = Function | string

@@ -83,2 +85,3 @@ interface AssociationDefinitionOptions {

addAccessor?: string
modelFindByAccessor?: string

@@ -151,6 +154,6 @@ // model: FxOrmModel.Model

interface ModelAssociationMethod__FindByOptions extends FxOrmModel.ModelOptions__Find, ModelAssociationMethod__Options {
interface ModelAssociationMethod__GetOptions extends FxOrmModel.ModelOptions__Find, ModelAssociationMethod__Options {
}
interface ModelAssociationMethod__GetOptions extends FxOrmModel.ModelOptions__Find, ModelAssociationMethod__Options {
interface ModelAssociationMethod__FindByOptions extends FxOrmModel.ModelOptions__Findby, ModelAssociationMethod__Options {
}

@@ -157,0 +160,0 @@

@@ -37,2 +37,3 @@ /// <reference types="@fxjs/sql-query" />

interface DMLDriver extends FxOrmSqlDDLSync__Driver.Driver {
db: FxOrmDb.DatabaseBase
dialect: FxSqlQueryDialect.DialectType

@@ -39,0 +40,0 @@ config: FxOrmNS.IDBConnectionConfig

/// <reference types="@fxjs/sql-query" />
/// <reference path="Validators.d.ts" />
/// <reference path="assoc.d.ts" />
/// <reference path="patch.d.ts" />

@@ -50,2 +51,3 @@ /// <reference path="hook.d.ts" />

*/
/* association about api :start */
hasOne: {

@@ -58,4 +60,31 @@ (assoc_name: string, ext_model?: Model, assoc_options?: FxOrmAssociation.AssociationDefinitionOptions_HasOne): FxOrmModel.Model

}
extendsTo: (...args: any[]) => Model;
extendsTo: {
(name: string, properties: FxOrmModel.DetailedPropertyDefinitionHash, assoc_options: FxOrmAssociation.AssociationDefinitionOptions_ExtendsTo): Model
};
associations: {
[k: string]: {
type: 'hasOne'
association: FxOrmAssociation.InstanceAssociationItem_HasOne
} | {
type: 'hasMany'
association: FxOrmAssociation.InstanceAssociationItem_HasMany
} | {
type: 'extendsTo'
association: FxOrmAssociation.InstanceAssociationItem_ExtendTos
} | {
type: FxOrmAssociation.AssociationType
association: FxOrmAssociation.InstanceAssociationItem
}
}
findBy: {
<T = any>(
ext_name: string,
conditions?: ModelQueryConditions__Find,
options?: FxOrmAssociation.ModelAssociationMethod__FindByOptions,
cb?: FxOrmNS.ExecutionCallback<T>
): FxOrmQuery.IChainFind
}
/* association about api :end */
/* data operation api :start */

@@ -275,2 +304,6 @@ create: {

}
interface ModelOptions__Findby extends ModelOptions__Find {
}

@@ -277,0 +310,0 @@ interface ModelOptions__Get extends ModelOptions__Find {}

@@ -36,2 +36,9 @@ /// <reference path="model.d.ts" />

}
findBySync: {
<T = any>(
ext_name: string,
conditions?: FxOrmModel.ModelQueryConditions__Find,
options?: FxOrmAssociation.ModelAssociationMethod__FindByOptions,
): FxOrmInstance.Instance[]
}

@@ -38,0 +45,0 @@ // it's callback version could return `this: ORM`

v1.8.8 / 2019-03-06
v1.9.0 / 2019-03-11
==================
* 1.9.0
* upgrade core dependencies to support literal where-condition-object.
* robust change for test case.
* upgrade dependency.
* upgrade core dependencies, typo robust.
* recovery fallback mysql conn in test.
* use mysql as default test db in travis-ci.
* change default mysql test connection, fix one error test case for mysql.
* upgrade key dependency.
* add type Model['associations'] and support it.
* 1.9.0-dev
* doc fix.
v1.8.8 / 2019-03-06
===================
* Release v1.8.8
* fix bad config in package.json

@@ -6,0 +23,0 @@ * enable 'compilerOptions.noImplicitAny' in tsconfig.json; upgrade key dependencies, enhance robust of typo.

@@ -93,3 +93,3 @@ const ORMError = require("./Error");

.select()
.from(opts.table, undefined, undefined)
.from(opts.table)
.select(opts.propertyList);

@@ -96,0 +96,0 @@ for (let i = 0; i < aggregates.length; i++) {

@@ -0,1 +1,2 @@

/// <reference lib="es6" />
Object.defineProperty(exports, "__esModule", { value: true });

@@ -36,1 +37,17 @@ function defineDefaultExtendsToTableName(modelTableName, assocName) {

exports.cutOffAssociatedModelFindOptions = cutOffAssociatedModelFindOptions;
function addAssociationInfoToModel(Model, association_name, opts) {
if (opts.type === 'extendsTo') {
Model.associations[association_name] = {
type: opts.type,
association: opts.association
};
}
else {
Model.associations[association_name] = {
type: opts.type,
association: opts.association
};
}
return Model.associations[association_name];
}
exports.addAssociationInfoToModel = addAssociationInfoToModel;

@@ -81,2 +81,6 @@ Object.defineProperty(exports, "__esModule", { value: true });

};
_utils_1.addAssociationInfoToModel(Model, name, {
type: 'extendsTo',
association: association
});
return association.model;

@@ -83,0 +87,0 @@ };

@@ -166,2 +166,6 @@ Object.defineProperty(exports, "__esModule", { value: true });

};
_utils_1.addAssociationInfoToModel(Model, name, {
type: 'hasMany',
association: association
});
return this;

@@ -168,0 +172,0 @@ };

@@ -12,5 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });

}
assoc_name = assoc_name || ext_model.table;
ext_model = ext_model || Model;
var association = {
name: assoc_name || ext_model.table,
name: assoc_name,
model: ext_model,

@@ -119,2 +120,6 @@ field: null,

};
_utils_1.addAssociationInfoToModel(Model, assoc_name, {
type: 'hasOne',
association
});
return this;

@@ -121,0 +126,0 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
function execQuery() {
var query, cb;
if (arguments.length == 2) {
var query = arguments[0];
var cb = arguments[1];
query = arguments[0];
cb = arguments[1];
}
else if (arguments.length == 3) {
var query = this.query.escape(arguments[0], arguments[1]);
var cb = arguments[2];
query = this.query.escape(arguments[0], arguments[1]);
cb = arguments[2];
}

@@ -11,0 +12,0 @@ return this.execSimpleQuery(query, cb);

@@ -94,3 +94,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

var q = this.query.select()
.from(table, undefined, undefined)
.from(table)
.select(fields);

@@ -136,3 +136,3 @@ if (opts.offset) {

var q = this.query.select()
.from(table, undefined, undefined)
.from(table)
.count(null, 'c');

@@ -139,0 +139,0 @@ if (opts.merge) {

@@ -66,3 +66,4 @@ Object.defineProperty(exports, "__esModule", { value: true });

var q = this.query.select()
.from(table, undefined, undefined).select(fields);
.from(table)
.select(fields);
if (opts.offset) {

@@ -111,3 +112,3 @@ q.offset(opts.offset);

var q = this.query.select()
.from(table, undefined, undefined)
.from(table)
.count(null, 'c');

@@ -114,0 +115,0 @@ if (opts.merge) {

@@ -609,2 +609,11 @@ /// <reference lib="es2017" />

const currFields = {};
model.findBy = function (ext_name, conditions, findby_options, cb) {
const findByAccessor = model.associations[ext_name].association.modelFindByAccessor;
if (!findByAccessor || typeof model[findByAccessor] !== 'function')
throw `invalid extension name ${ext_name} provided!`;
if (typeof cb === 'function')
return model[findByAccessor](conditions, findby_options, cb);
return model[findByAccessor](conditions, findby_options);
};
model.findBySync = util.sync(model.findBy);
model.addProperty = function (propIn, options) {

@@ -691,2 +700,3 @@ var cType;

}
model.associations = {};
OneAssociation.prepare(model, one_associations);

@@ -693,0 +703,0 @@ ManyAssociation.prepare(m_opts.db, model, many_associations);

@@ -68,3 +68,2 @@ Object.defineProperty(exports, "__esModule", { value: true });

return result_prop;
// return opts.prop;
};
{
"name": "@fxjs/orm",
"version": "1.8.8",
"version": "1.9.0",
"description": "Object Relational Mapping for fibjs",

@@ -38,2 +38,5 @@ "main": "lib",

"0.26.1"
],
"travis_services": [
"mysql"
]

@@ -43,4 +46,4 @@ },

"@fibjs/enforce": "0.0.8",
"@fxjs/sql-ddl-sync": "^0.3.1",
"@fxjs/sql-query": "^0.2.1",
"@fxjs/sql-ddl-sync": "^0.3.5",
"@fxjs/sql-query": "^0.2.4",
"lodash.clonedeep": "^4.5.0",

@@ -51,3 +54,3 @@ "lodash.flatten": "^4.4.0",

"devDependencies": {
"@fibjs/ci": "^2.1.0",
"@fibjs/ci": "^2.2.0",
"@types/fibjs": "^0.26.5",

@@ -62,6 +65,6 @@ "@types/lodash.clonedeep": "^4.5.6",

"peerDependencies": {
"@fxjs/sql-ddl-sync": ">= 0.3.1 < 0.4",
"@fxjs/sql-query": ">= 0.2.1 < 0.3",
"@fxjs/sql-ddl-sync": ">= 0.3.5 < 0.4",
"@fxjs/sql-query": ">= 0.2.4 < 0.3",
"@fibjs/enforce": ">= 0.0.8 < 0.1"
}
}

@@ -830,6 +830,6 @@ ## Object Relational Mapping for fibjs

modelFindByAccessor | model | ✔️ | ✔️ | ✔️ | `Pet.findByOwnersSync({name: "Butt"})`
```
Those accessors makes sense for all associations (`hasOne`, `hasMany`, `extendsTo`), view details in [test cases](./test/integration)
Those accessors makes sense for all associations (`hasOne`, `hasMany`, `extendsTo`), view details in [test cases](./test/integration).
## Transaction support

@@ -836,0 +836,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc