leoric 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/History.md CHANGED
@@ -1,3 +1,12 @@
1
+ 2.8.1 / 2022-08-31
2
+ ==================
3
+
4
+ ## What's Changed
5
+ * fix: metro exports error by @JimmyDaddy in https://github.com/cyjake/leoric/pull/339
6
+ * fix: Model.count(field) in sequelize adapter by @cyjake in https://github.com/cyjake/leoric/pull/340
7
+
8
+ **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.0...v2.8.1
9
+
1
10
  2.8.0 / 2022-08-30
2
11
  ==================
3
12
 
package/index.js CHANGED
@@ -7,7 +7,7 @@ const Bone = require('./src/bone');
7
7
  const Collection = require('./src/collection');
8
8
  const { invokable: DataTypes, LENGTH_VARIANTS } = require('./src/data_types');
9
9
  const migrations = require('./src/migrations');
10
- const { sequelize, SequelizeBone} = require('./src/adapters/sequelize');
10
+ const sequelize = require('./src/adapters/sequelize');
11
11
  const { heresql } = require('./src/utils/string');
12
12
  const Hint = require('./src/hint');
13
13
  const Realm = require('./src/realm');
@@ -52,7 +52,7 @@ Object.assign(Realm, {
52
52
  connect,
53
53
  disconnect,
54
54
  Bone,
55
- SequelizeBone,
55
+ SequelizeBone: sequelize(Bone),
56
56
  Collection,
57
57
  DataTypes,
58
58
  Logger,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leoric",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "JavaScript Object-relational mapping alchemy",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -106,7 +106,7 @@ function filterOptions(options = {}) {
106
106
 
107
107
  // https://sequelize.org/master/class/lib/model.js~Model.html
108
108
  // https://sequelize.org/master/manual/model-querying-finders.html
109
- exports.sequelize = Bone => {
109
+ module.exports = function sequelize(Bone) {
110
110
  return class Spine extends Bone {
111
111
 
112
112
  /*
@@ -150,9 +150,9 @@ exports.sequelize = Bone => {
150
150
 
151
151
  /**
152
152
  * @deprecated scope is not recommended to use
153
- * @param {string} name
154
- * @param {...any} args
155
- * @returns
153
+ * @param {string} name
154
+ * @param {...any} args
155
+ * @returns
156
156
  */
157
157
  static scope(name, ...args) {
158
158
  const parentName = this.name;
@@ -278,7 +278,7 @@ exports.sequelize = Bone => {
278
278
  // static bulkCreate() {}
279
279
 
280
280
  static count(options = {}) {
281
- if (typeof options === 'string') return spell.$count(options);
281
+ if (typeof options === 'string') return super.find().$count(options);
282
282
  const { where, col, group, paranoid } = options;
283
283
  let spell = super.find(where, filterOptions(options));
284
284
  if (Array.isArray(group)) spell.$group(...group);
@@ -739,5 +739,3 @@ exports.sequelize = Bone => {
739
739
  }
740
740
  };
741
741
  };
742
-
743
- exports.SequelizeBone = this.sequelize(require('../bone'));
package/src/realm.js CHANGED
@@ -7,7 +7,7 @@ const Bone = require('./bone');
7
7
  const { findDriver, AbstractDriver } = require('./drivers');
8
8
  const { camelCase } = require('./utils/string');
9
9
  const { isBone } = require('./utils');
10
- const { sequelize } = require('./adapters/sequelize');
10
+ const sequelize = require('./adapters/sequelize');
11
11
  const Raw = require('./raw');
12
12
  const { LEGACY_TIMESTAMP_MAP } = require('./constants');
13
13