leoric 2.9.0 → 2.9.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/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  Connection, QueryOptions,
9
9
  Raw, ColumnMeta, AttributeMeta,
10
10
  BeforeHooksType, AfterHooksType, Collection,
11
- GeneratorReturnType,
11
+ GeneratorReturnType, Values, BoneCreateValues, BoneInstanceValues,
12
12
  } from './src/types/common';
13
13
  import { SpellMeta, Spell, SpellBookFormatResult } from './src/spell';
14
14
  import Bone from './src/bone';
@@ -19,7 +19,7 @@ export {
19
19
  DataTypes, Literal, Validator, Connection,
20
20
  Hint, IndexHint, HintInterface, INDEX_HINT_SCOPE_TYPE, INDEX_HINT_SCOPE, INDEX_HINT_TYPE,
21
21
  Bone, Raw, Collection,
22
- SpellMeta, Spell, ColumnMeta, AttributeMeta, SpellBookFormatResult
22
+ SpellMeta, Spell, ColumnMeta, AttributeMeta, SpellBookFormatResult, Values, BoneCreateValues, BoneInstanceValues,
23
23
  };
24
24
 
25
25
  export * from './src/decorators';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leoric",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "JavaScript Object-relational mapping alchemy",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -2,7 +2,7 @@ import {
2
2
  Attributes, Literal, OperatorCondition,
3
3
  BoneOptions, ResultSet, Raw,
4
4
  SetOptions, BeforeHooksType, AfterHooksType,
5
- QueryOptions, OrderOptions, QueryResult, Values as CommonValues, BoneColumns, InstanceColumns,
5
+ QueryOptions, OrderOptions, QueryResult, Values as CommonValues, BoneColumns, InstanceColumns, BoneCreateValues,
6
6
  } from '../types/common';
7
7
  import { AbstractBone } from '../types/abstract_bone';
8
8
  import { Spell } from '../spell';
@@ -60,10 +60,6 @@ type ScopeOptions = {
60
60
  override?: boolean
61
61
  }
62
62
 
63
- type Values<T extends typeof SequelizeBone> = {
64
- [Property in keyof Extract<InstanceType<T>, Literal>]?: Literal;
65
- }
66
-
67
63
  type aggregators = 'count' | 'COUNT' | 'average' | 'AVERAGE' | 'minimum' | 'MINIMUM' | 'maximum' | 'MAXIMUM' | 'sum' | 'SUM';
68
64
 
69
65
  export class Collection<T extends SequelizeBone> extends Array<T> {
@@ -125,14 +121,14 @@ export class SequelizeBone extends AbstractBone {
125
121
  static aggregate<T extends typeof SequelizeBone>(this: T, name: BoneColumns<T>, func: aggregators, options?: SequelizeConditions<T>): Spell<T, number>;
126
122
  static aggregate<T extends typeof SequelizeBone>(this: T, name: Raw | '*', func: aggregators, options?: SequelizeConditions<T>): Spell<T, number>;
127
123
 
128
- static build<T extends typeof SequelizeBone>(this: T, values: Values<T>, options?: BoneOptions): InstanceType<T>;
124
+ static build<T extends typeof SequelizeBone>(this: T, values: BoneCreateValues<T>, options?: BoneOptions): InstanceType<T>;
129
125
 
130
126
  /**
131
127
  * see https://github.com/sequelize/sequelize/blob/a729c4df41fa3a58fbecaf879265d2fb73d80e5f/src/model.js#L2299
132
128
  * @param valueSets
133
129
  * @param options
134
130
  */
135
- static bulkBuild<T extends typeof SequelizeBone>(this:T, valueSets: Array<Values<T>>, options?: BoneOptions): Array<InstanceType<T>>;
131
+ static bulkBuild<T extends typeof SequelizeBone>(this:T, valueSets: Array<BoneCreateValues<T>>, options?: BoneOptions): Array<InstanceType<T>>;
136
132
 
137
133
  static count<T extends typeof SequelizeBone>(this: T, name?: BoneColumns<T>): Spell<T, ResultSet<T> | number>;
138
134
  static count<T extends typeof SequelizeBone>(this: T, name?: Raw | '*'): Spell<T, ResultSet<T> | number>;
@@ -213,7 +209,7 @@ export class SequelizeBone extends AbstractBone {
213
209
  increment(field: string | Raw | Array<string | Raw>, options?: QueryOptions): Spell<typeof SequelizeBone, QueryResult>;
214
210
  decrement(field: InstanceColumns<this> | Array<InstanceColumns<this>> | { [Property in keyof Extract<this, Literal>]?: number }, options?: QueryOptions): Spell<typeof SequelizeBone, QueryResult>;
215
211
  decrement(field: string | Raw | Array<string | Raw> , options?: QueryOptions): Spell<typeof SequelizeBone, QueryResult>;
216
- destroy(options?: SequelizeDestroyOptions): Promise<this| number>;
212
+ destroy<T>(this: T, options?: SequelizeDestroyOptions): Promise<T | number>;
217
213
  update<T = this>(this: T, changes?: { [Property in keyof Extract<this, Literal>]?: Literal }, opts?: SequelizeInstanceUpdateOptions<this>): Promise<number>;
218
214
  update<T = this>(this: T, changes?: { [key: string]: Literal }, opts?: SequelizeInstanceUpdateOptions<this>): Promise<number>;
219
215
 
@@ -2,7 +2,7 @@ import DataTypes, { AbstractDataType, DataType } from "../data_types";
2
2
  import {
3
3
  Pool, Literal, WhereConditions,
4
4
  Collection, ResultSet, OrderOptions,
5
- QueryOptions, AttributeMeta, AssociateOptions, Values, Connection, BulkCreateOptions,
5
+ QueryOptions, AttributeMeta, AssociateOptions, Values, Connection, BulkCreateOptions, BoneCreateValues,
6
6
  GeneratorReturnType, BoneColumns, InstanceColumns, Raw,
7
7
  } from './common';
8
8
  import { AbstractDriver } from '../drivers';
@@ -127,7 +127,7 @@ export class AbstractBone {
127
127
  * @example
128
128
  * Bone.create({ foo: 1, bar: 'baz' })
129
129
  */
130
- static create<T extends typeof AbstractBone>(this: T, values: Values<InstanceType<T>> & Partial<Record<BoneColumns<T>, Literal>>, options?: QueryOptions): Promise<InstanceType<T>>;
130
+ static create<T extends typeof AbstractBone>(this: T, values: BoneCreateValues<T> & Partial<Record<BoneColumns<T>, Literal>>, options?: QueryOptions): Promise<InstanceType<T>>;
131
131
 
132
132
  /**
133
133
  * INSERT or UPDATE rows
@@ -136,12 +136,12 @@ export class AbstractBone {
136
136
  * @param values values
137
137
  * @param opt query options
138
138
  */
139
- static upsert<T extends typeof AbstractBone>(this: T, values: Partial<Record<BoneColumns<T>, Literal>>, options?: QueryOptions): Spell<T, number>;
139
+ static upsert<T extends typeof AbstractBone>(this: T, values: BoneCreateValues<T>, options?: QueryOptions): Spell<T, number>;
140
140
 
141
141
  /**
142
142
  * Batch INSERT
143
143
  */
144
- static bulkCreate<T extends typeof AbstractBone>(this: T, records: Array<Partial<Record<BoneColumns<T>, Literal>>>, options?: BulkCreateOptions): Promise<Array<InstanceType<T>>>;
144
+ static bulkCreate<T extends typeof AbstractBone>(this: T, records: Array<BoneCreateValues<T>>, options?: BulkCreateOptions): Promise<Array<InstanceType<T>>>;
145
145
 
146
146
  /**
147
147
  * SELECT all rows. In production, when the table is at large, it is not recommended to access records in this way. To iterate over all records, {@link Bone.batch} shall be considered as the better alternative. For tables with soft delete enabled, which means they've got `deletedAt` attribute, use {@link Bone.unscoped} to discard the default scope.
@@ -316,9 +316,8 @@ export class AbstractBone {
316
316
  /**
317
317
  * Get attribute changes
318
318
  */
319
- changes<T, Key extends keyof Values<T>>(this: T, name: Key): Record<InstanceColumns<this>, [ Literal, Literal ]>;
320
- changes<T, Key extends keyof T>(this: T, name: Key): Record<InstanceColumns<this>, [ Literal, Literal ]>;
321
- changes(): Record<InstanceColumns<this>, [ Literal, Literal ]>;
319
+ changes<T, Key extends keyof Values<T>>(this: T, name: Key): Record<Key, [ T[Key] | null, T[Key] | null ]>;
320
+ changes<T, Key extends keyof Values<T>>(this: T): Record<Key, [ Literal, Literal ]>;
322
321
 
323
322
  /**
324
323
  * See if attribute was changed previously or not.
@@ -185,8 +185,19 @@ export type BoneColumns<T extends typeof AbstractBone, Key extends keyof Instanc
185
185
 
186
186
  export type InstanceColumns<T = typeof AbstractBone, Key extends keyof T = keyof Values<T>> = Key;
187
187
 
188
+ /**
189
+ * Bone.create(values: BoneCreateValues<this>);
190
+ */
191
+ export type BoneCreateValues<T extends typeof AbstractBone> = Partial<Values<InstanceType<T>>>;
192
+
188
193
  export type BeforeHooksType = 'beforeCreate' | 'beforeBulkCreate' | 'beforeUpdate' | 'beforeSave' | 'beforeUpsert' | 'beforeRemove';
189
194
  export type AfterHooksType = 'afterCreate' | 'afterBulkCreate' | 'afterUpdate' | 'afterSave' | 'afterUpsert' | 'afterRemove';
190
195
 
191
196
  // https://stackoverflow.com/a/67232225/179691
192
197
  type GeneratorReturnType<T extends Generator> = T extends Generator<any, infer R, any> ? R: never;
198
+
199
+ /**
200
+ * Plain keyMap type object of a Bone's attributes
201
+ * BoneInstanceValues<user> = { id: number, name: string }
202
+ */
203
+ export type BoneInstanceValues<T extends typeof AbstractBone> = Omit<InstanceType<T>, PickTypeKeys<InstanceType<T>, Function> | 'isNewRecord' | 'Model' | 'dataValues'>;
package/History.md DELETED
@@ -1,912 +0,0 @@
1
- 2.9.0 / 2022-11-09
2
- ==================
3
-
4
- ## What's Changed
5
- * fix: `tinytext` type error by @JimmyDaddy in https://github.com/cyjake/leoric/pull/364
6
- * fix: date strings should be parsed with system time zone considered by @cyjake in https://github.com/cyjake/leoric/pull/365
7
- * feat: support multiple level inherent by @JimmyDaddy in https://github.com/cyjake/leoric/pull/366
8
- * fix: `cast/uncast` STRING and TEXT with non-string type value, and some type definitions by @JimmyDaddy in https://github.com/cyjake/leoric/pull/368
9
-
10
-
11
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.8...v2.9.0
12
-
13
- 2.8.8 / 2022-10-25
14
- ==================
15
-
16
- ## What's Changed
17
- * fix: join query with select columns should include order columns by @cyjake in https://github.com/cyjake/leoric/pull/360
18
- * docs: support switchable dark theme, at web app level by @cyjake in https://github.com/cyjake/leoric/pull/359
19
- * fix: @Column() should not tamper parent attributes directly by @cyjake in https://github.com/cyjake/leoric/pull/362
20
- * fix: bone.update({ deletedAt: null }) and likewise methods should work by @cyjake in https://github.com/cyjake/leoric/pull/363
21
-
22
-
23
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.7...v2.8.8
24
-
25
- 2.8.7 / 2022-10-11
26
- ==================
27
-
28
- ## What's Changed
29
- * fix: enable strictNullChecks by @cyjake in https://github.com/cyjake/leoric/pull/357
30
- * fix: declaration types of realm.query() and static update values by @cyjake in https://github.com/cyjake/leoric/pull/358
31
-
32
-
33
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.6...v2.8.7
34
-
35
- 2.8.6 / 2022-10-11
36
- ==================
37
-
38
- ## What's Changed
39
- * fix: new Realm({ sequelize: true }).Bone == Realm.SequelizeBone by @cyjake in https://github.com/cyjake/leoric/pull/349
40
- * fix: edge cases in attribute.equals() by @cyjake in https://github.com/cyjake/leoric/pull/350
41
- * fix: bone.attribute(name, value?) type infer with this[name] by @cyjake in https://github.com/cyjake/leoric/pull/351
42
- * fix: ts type definitions by @JimmyDaddy in https://github.com/cyjake/leoric/pull/352
43
- * fix: this.attribute(name) should fallback to Literal by @cyjake in https://github.com/cyjake/leoric/pull/353
44
- * fix: type definitions for columns constraint by @JimmyDaddy in https://github.com/cyjake/leoric/pull/355
45
-
46
-
47
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.5...v2.8.6
48
-
49
- 2.8.5 / 2022-09-21
50
- ==================
51
-
52
- ## What's Changed
53
- * fix: deletedAt should always be checked when associating models by @cyjake in https://github.com/cyjake/leoric/pull/347
54
- * fix: generic type for getDataValue by @vagusX in https://github.com/cyjake/leoric/pull/346
55
-
56
-
57
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.4...v2.8.5
58
-
59
- 2.8.4 / 2022-09-20
60
- ==================
61
-
62
- ## What's Changed
63
- * fix: Literal type should not contain `object` & ResultSet should be derived from instance values by @cyjake in https://github.com/cyjake/leoric/pull/345
64
-
65
-
66
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.3...v2.8.4
67
-
68
- 2.8.3 / 2022-09-15
69
- ==================
70
-
71
- ## What's Changed
72
- * fix: AssociationOptions.select? should be supported by @cyjake in https://github.com/cyjake/leoric/pull/343
73
- * fix: return type of realm.query, realm.transaction, and Bone.transation by @cyjake in https://github.com/cyjake/leoric/pull/344
74
-
75
-
76
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.2...v2.8.3
77
-
78
- 2.8.2 / 2022-09-13
79
- ==================
80
-
81
- ## What's Changed
82
- * fix: AssociateOptions in HasMany, BelongdsTo decorators by @cyjake in https://github.com/cyjake/leoric/pull/341
83
- * fix: invokable dataType in decorators should work and dts fix by @JimmyDaddy in https://github.com/cyjake/leoric/pull/342
84
-
85
-
86
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.1...v2.8.2
87
-
88
- 2.8.1 / 2022-08-31
89
- ==================
90
-
91
- ## What's Changed
92
- * fix: metro exports error by @JimmyDaddy in https://github.com/cyjake/leoric/pull/339
93
- * fix: Model.count(field) in sequelize adapter by @cyjake in https://github.com/cyjake/leoric/pull/340
94
-
95
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.0...v2.8.1
96
-
97
- 2.8.0 / 2022-08-30
98
- ==================
99
-
100
- ## What's Changed
101
- * feat: refactor type definitions to export SequelizeBone, complete spell type definitions and fix index hints logic by @JimmyDaddy in https://github.com/cyjake/leoric/pull/337
102
- * fix: throw error if token is not expected when parse expr by @cyjake in https://github.com/cyjake/leoric/pull/338
103
-
104
-
105
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.7.3...v2.8.0
106
-
107
- 2.7.3 / 2022-08-25
108
- ==================
109
-
110
- ## What's Changed
111
- * fix: should skip loading models that is loaded before by @cyjake in https://github.com/cyjake/leoric/pull/335
112
-
113
-
114
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.7.2...v2.7.3
115
-
116
- 2.7.2 / 2022-08-24
117
- ==================
118
-
119
- ## What's Changed
120
- * Update associations.md by @dxhuii in https://github.com/cyjake/leoric/pull/331
121
- * refactor: refactor type definitions and fix unique not work in columnOptions by @JimmyDaddy in https://github.com/cyjake/leoric/pull/332
122
- * fix: declare more exported functions such as isBone and heresql by @cyjake in https://github.com/cyjake/leoric/pull/333
123
- * fix: INTEGER like data type and STRING extra options didn't work in polymorphism, fix decorators ColumnOptions.type to support invokable by @JimmyDaddy in https://github.com/cyjake/leoric/pull/334
124
-
125
- ## New Contributors
126
- * @dxhuii made their first contribution in https://github.com/cyjake/leoric/pull/331
127
-
128
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.7.1...v2.7.2
129
-
130
- 2.7.1 / 2022-08-24
131
- ==================
132
-
133
- ## What's Changed
134
- * fix: projects might have strictPropertyInitialization set to true by @cyjake in https://github.com/cyjake/leoric/pull/329
135
- * fix: types for validate in `Column` decorator by @vagusX in https://github.com/cyjake/leoric/pull/330
136
-
137
- ## New Contributors
138
- * @vagusX made their first contribution in https://github.com/cyjake/leoric/pull/330
139
-
140
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.7.0...v2.7.1
141
-
142
- 2.7.0 / 2022-08-24
143
- ==================
144
-
145
- ## What's Changed
146
- * fix: glue code for opts.dialectModulePath by @cyjake in https://github.com/cyjake/leoric/pull/326
147
- * fix: primaryKey in upsert values should be validate in sqlite and postgres by @JimmyDaddy in https://github.com/cyjake/leoric/pull/328
148
- * feat: change DataTypes to ts and complete decorators type definitions by @JimmyDaddy in https://github.com/cyjake/leoric/pull/319
149
-
150
-
151
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.6.3...v2.7.0
152
-
153
- 2.6.3 / 2022-08-04
154
- ==================
155
-
156
- ## What's Changed
157
- * fix: aggregator not parse null result by @killagu in https://github.com/cyjake/leoric/pull/322
158
- * test: switch the auth protocol of test mysql database by @cyjake in https://github.com/cyjake/leoric/pull/323
159
- * feat: add leoric_bone meta data to Bone by @JimmyDaddy in https://github.com/cyjake/leoric/pull/324
160
- * docs: fix declarations of findOne(primaryKey) & findOne({ $or }) by @cyjake in https://github.com/cyjake/leoric/pull/325
161
-
162
-
163
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.6.2...v2.6.3
164
-
165
- 2.6.2 / 2022-07-12
166
- ==================
167
-
168
- ## What's Changed
169
- * fix: format select with out * if use aggreator by @killagu in https://github.com/cyjake/leoric/pull/320
170
- * fix: fix transaction typing by @killagu in https://github.com/cyjake/leoric/pull/321
171
-
172
- ## New Contributors
173
- * @killagu made their first contribution in https://github.com/cyjake/leoric/pull/320
174
-
175
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.6.1...v2.6.2
176
-
177
- 2.6.1 / 2022-06-24
178
- ==================
179
-
180
- ## What's Changed
181
- * build: switch to latest postgres by @cyjake in https://github.com/cyjake/leoric/pull/316
182
- * fix: fix [bug] init models with bone class should work #317 by @JimmyDaddy in https://github.com/cyjake/leoric/pull/318
183
-
184
-
185
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.6.0...v2.6.1
186
-
187
- 2.6.0 / 2022-06-02
188
- ==================
189
-
190
- ## What's Changed
191
- * feat: support export sql query template in logger by @JimmyDaddy in https://github.com/cyjake/leoric/pull/314
192
- * fix: fix uncast date string without milliseconds error by jsCore in Android/iOS by @JimmyDaddy in https://github.com/cyjake/leoric/pull/315
193
-
194
-
195
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.5.0...v2.6.0
196
-
197
- 2.5.0 / 2022-05-13
198
- ==================
199
-
200
- ## What's Changed
201
- * feat: support disconnect and fix timestamps init by @JimmyDaddy in https://github.com/cyjake/leoric/pull/313
202
-
203
-
204
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.4.1...v2.5.0
205
-
206
- 2.4.1 / 2022-04-27
207
- ==================
208
-
209
- ## What's Changed
210
- * fix: realm.Bone.DataTypes should be invokable, Invokable.TYPE.toSqlString() get wrong default length(1), DataType definitions by @JimmyDaddy in https://github.com/cyjake/leoric/pull/307
211
-
212
-
213
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.4.0...v2.4.1
214
-
215
- 2.4.0 / 2022-04-24
216
- ==================
217
-
218
- ## What's Changed
219
- * feat: support custom driver by @JimmyDaddy in https://github.com/cyjake/leoric/pull/304
220
- * chore: update build status badge by @snapre in https://github.com/cyjake/leoric/pull/305
221
- * feat: export more ts type definitions and use deep-equal module by @JimmyDaddy in https://github.com/cyjake/leoric/pull/306
222
-
223
- ## New Contributors
224
- * @snapre made their first contribution in https://github.com/cyjake/leoric/pull/305
225
-
226
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.3.2...v2.4.0
227
-
228
- 2.3.2 / 2022-04-15
229
- ==================
230
-
231
- ## What's Changed
232
- * fix: order by raw with mix-type array in sequelize mode by @JimmyDaddy in https://github.com/cyjake/leoric/pull/298
233
- * docs: monthly updates and example about egg-orm usage with TypeScript by @cyjake in https://github.com/cyjake/leoric/pull/299
234
- * docs: monthly updates in en & docmentation about typescript support by @cyjake in https://github.com/cyjake/leoric/pull/300
235
- * fix: raw query should format replacements with extra blank by @JimmyDaddy in https://github.com/cyjake/leoric/pull/301
236
- * docs: elaborate on querying by @cyjake in https://github.com/cyjake/leoric/pull/302
237
- * feat: transaction should return result by @JimmyDaddy in https://github.com/cyjake/leoric/pull/303
238
-
239
-
240
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.3.1...v2.3.2
241
-
242
- 2.3.1 / 2022-03-22
243
- ==================
244
-
245
- ## What's Changed
246
- * fix: mysql2 Invalid Date compatible by @JimmyDaddy in https://github.com/cyjake/leoric/pull/291
247
- * fix: order by raw in sequelize mode by @JimmyDaddy in https://github.com/cyjake/leoric/pull/292
248
- * fix: bulk update query conditions duplicated in sequelize mode by @JimmyDaddy in https://github.com/cyjake/leoric/pull/293
249
- * fix: bulk destroy query conditions duplicated in sequelize mode by @JimmyDaddy in https://github.com/cyjake/leoric/pull/295
250
- * fix: drop column if not defined in attributes when alter table by @cyjake in https://github.com/cyjake/leoric/pull/296
251
-
252
-
253
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.3.0...v2.3.1
254
-
255
- 2.3.0 / 2022-03-10
256
- ==================
257
-
258
- ## What's Changed
259
- * feat: model declaration with decorators by @cyjake in https://github.com/cyjake/leoric/pull/287
260
- * feat: add VIRTUAL data type by @JimmyDaddy in https://github.com/cyjake/leoric/pull/289
261
- * fix: create instance dirty check rule fix by @JimmyDaddy in https://github.com/cyjake/leoric/pull/290
262
-
263
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.2.3...v2.3.0
264
- 2.2.3 / 2022-03-01
265
- ==================
266
-
267
- ## What's Changed
268
- * fix: normalize attribute defaultValue by @cyjake in https://github.com/cyjake/leoric/pull/285
269
- * fix: instance beforeUpdate hooks should not modify any Raw if there are no Raw assignment in them by @JimmyDaddy in https://github.com/cyjake/leoric/pull/283
270
-
271
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.2.2...v2.2.3
272
-
273
- 2.2.2 / 2022-02-28
274
- ==================
275
-
276
- ## What's Changed
277
- * fix: tddl gives misleading information_schema.columns.table_name by @cyjake in https://github.com/cyjake/leoric/pull/284
278
-
279
-
280
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.2.1...v2.2.2
281
-
282
- 2.2.1 / 2022-02-24
283
- ==================
284
-
285
- ## What's Changed
286
- * fix: realm.DataTypes should be invokable by @cyjake in https://github.com/cyjake/leoric/pull/282
287
-
288
-
289
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.2.0...v2.2.1
290
-
291
- 2.2.0 / 2022-02-24
292
- ==================
293
-
294
- ## What's Changed
295
- * fix: add missing `password` field for `ConnectOptions` by @luckydrq in https://github.com/cyjake/leoric/pull/280
296
- * feat: integer types (mostly mysql specific) by @cyjake in https://github.com/cyjake/leoric/pull/281
297
-
298
-
299
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.1.1...v2.2.0
300
-
301
- 2.1.1 / 2022-02-23
302
- ==================
303
-
304
- ## What's Changed
305
- * fix: fix #274 update with fields option by @JimmyDaddy in https://github.com/cyjake/leoric/pull/275
306
- * fix: upsert should set createdAt by default while createdAt not set by @JimmyDaddy in https://github.com/cyjake/leoric/pull/277
307
- * fix: previousChanges should check instance is new record or not while specific attributes' values were undefined by @JimmyDaddy in https://github.com/cyjake/leoric/pull/276
308
- * docs: add types for realm by @luckydrq in https://github.com/cyjake/leoric/pull/278
309
-
310
- ## New Contributors
311
- * @luckydrq made their first contribution in https://github.com/cyjake/leoric/pull/278
312
-
313
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.1.0...v2.1.1
314
-
315
- 2.1.0 / 2022-02-17
316
- ==================
317
-
318
- ## What's Changed
319
- * feat: fix #270 sequelize mode bulkBuild by @JimmyDaddy in https://github.com/cyjake/leoric/pull/273
320
- * fix: mysql delete/remove/destroy with limit and orders by @JimmyDaddy in https://github.com/cyjake/leoric/pull/272
321
-
322
-
323
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.0.4...v2.1.0
324
-
325
- 2.0.4 / 2022-02-16
326
- ==================
327
-
328
- ## What's Changed
329
- * fix: fix unit test error by @LB4027221 in https://github.com/cyjake/leoric/pull/269
330
- * fix: attribute.defaultValue should be set when init attributes by @cyjake in https://github.com/cyjake/leoric/pull/271
331
-
332
-
333
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.0.3...v2.0.4
334
-
335
- 2.0.3 / 2022-02-11
336
- ==================
337
-
338
- ## What's Changed
339
- * fix: default updatedAt to new date if model has no createdAt by @LB4027221 in https://github.com/cyjake/leoric/pull/268
340
-
341
- ## New Contributors
342
- * @LB4027221 made their first contribution in https://github.com/cyjake/leoric/pull/268
343
-
344
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.0.2...v2.0.3
345
-
346
- 2.0.2 / 2022-02-10
347
- ==================
348
-
349
- ## What's Changed
350
- * fix: order by alias should not throw by @cyjake in https://github.com/cyjake/leoric/pull/255
351
- * fix: fix #257 DataType.uncast should skip Raw type at type checking by @JimmyDaddy in https://github.com/cyjake/leoric/pull/258
352
- * docs: async function in transaction by @cyjake in https://github.com/cyjake/leoric/pull/259
353
- * fix: fixed #256 static create instance should check all default attri… by @JimmyDaddy in https://github.com/cyjake/leoric/pull/262
354
- * fix: fix #260 UPDATE with LIMIT and ORDER should be formatted(mysql only) by @JimmyDaddy in https://github.com/cyjake/leoric/pull/261
355
- * refactor: keep the UPDATE ... ORDER BY ... LIMIT to mysql driver by @cyjake in https://github.com/cyjake/leoric/pull/264
356
- * fix: fix #263 upsert attributes should use defaultValue while there i… by @JimmyDaddy in https://github.com/cyjake/leoric/pull/265
357
- * fix: fix restore Error `Undefined attribute "deletedAt"` by @JimmyDaddy in https://github.com/cyjake/leoric/pull/267
358
- * fix: type checking adaption by @JimmyDaddy in https://github.com/cyjake/leoric/pull/266
359
-
360
-
361
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v2.0.1...v2.0.2
362
-
363
- 2.0.1 / 2022-01-05
364
- ==================
365
-
366
- ## What's Changed
367
- * fix: format numeric result by @JimmyDaddy in https://github.com/cyjake/leoric/pull/253
368
- * fix: should still return number if value is '0.000' by @cyjake in https://github.com/cyjake/leoric/pull/254
369
-
370
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.15.1...v2.0.1
371
-
372
- 2.0.0 / 2021-12-28
373
- ==================
374
-
375
- ## What's Changed
376
- * breaking: model.sync add force/alter option by @SmartOrange in https://github.com/cyjake/leoric/pull/224
377
- * breaking: logQueryError(err, sql, duration, options) by @cyjake in https://github.com/cyjake/leoric/pull/237
378
- * test: add utf8mb4 test cases by @fengmk2 in https://github.com/cyjake/leoric/pull/239
379
- * Merge 1.x changes by @cyjake in https://github.com/cyjake/leoric/pull/249
380
-
381
- ## New Contributors
382
- * @SmartOrange made their first contribution in https://github.com/cyjake/leoric/pull/222
383
-
384
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.15.1...v2.0.0
385
-
386
- 1.15.1 / 2021-12-28
387
- ===================
388
-
389
- ## What's Changed
390
- * fix: fix #242 date string format by @JimmyDaddy in https://github.com/cyjake/leoric/pull/243
391
- * fix: update with empty conditions by @JimmyDaddy in https://github.com/cyjake/leoric/pull/241
392
- * fix: silent option's priority should be lower than valueSet by @JimmyDaddy in https://github.com/cyjake/leoric/pull/244
393
- * fix: information_schema.columns.datetime_precision by @cyjake in https://github.com/cyjake/leoric/pull/246
394
- * fix: should not hoist subquery if query is ordered by external columns by @cyjake in https://github.com/cyjake/leoric/pull/247
395
-
396
-
397
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.15.0...v1.15.1
398
-
399
- 1.15.0 / 2021-11-22
400
- ===================
401
-
402
- ## What's Changed
403
- * feat: make duration in precise milliseconds by @fengmk2 in https://github.com/cyjake/leoric/pull/236
404
- * fix: spell.increment() & spell.decrement() @cyjake https://github.com/cyjake/leoric/pull/234
405
- * fix: bulkCreate should adapte empty data @JimmyDaddy https://github.com/cyjake/leoric/pull/232
406
-
407
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.4...v1.14.5
408
-
409
- 1.14.4 / 2021-11-15
410
- ===================
411
-
412
- ## What's Changed
413
-
414
- * test: PostgreSQL v14 test case compatibility by @cyjake https://github.com/cyjake/leoric/pull/230
415
- * fix: turn off subquery optimization if query criteria contains other column by @cyjake https://github.com/cyjake/leoric/pull/229
416
- * fix: bone.changed() return `false | string[]` type by @fengmk2 https://github.com/cyjake/leoric/pull/231
417
-
418
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.3...v1.14.4
419
-
420
- 1.14.3 / 2021-11-12
421
- ===================
422
-
423
- ## What's Changed
424
- * fix: logger.logQuery should be guarded in case of error by @SmartOrange in https://github.com/cyjake/leoric/pull/222
425
- * fix: findOne without result should return null by @JimmyDaddy in https://github.com/cyjake/leoric/pull/225
426
- * fix: Literal should support bigint type by @fengmk2 in https://github.com/cyjake/leoric/pull/226
427
- * fix: select((name: string) => boolean) by @cyjake in https://github.com/cyjake/leoric/pull/227
428
-
429
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.2...v1.14.3
430
-
431
- 1.14.2 / 2021-11-01
432
- ===================
433
-
434
- ## What's Changed
435
- * fix: accept timestamps in snake case by @cyjake in https://github.com/cyjake/leoric/pull/221
436
-
437
-
438
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.1...v1.14.2
439
-
440
- 1.14.1 / 2021-11-01
441
- ===================
442
-
443
- ## What's Changed
444
- * docs: export { Collection } by @cyjake in https://github.com/cyjake/leoric/pull/220
445
-
446
-
447
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.0...v1.14.1
448
-
449
- 1.14.0 / 2021-11-01
450
- ===================
451
-
452
- Two options regarding `Model.init()` were added in this release:
453
-
454
- ```js
455
- class User extends Bone {}
456
- User.init({ name: STRING }, {
457
- timestamps: true, // which is the default
458
- paranoid: true, // which default to `false`
459
- });
460
- assert.deepEqual(Object.keys(User.attributes), [
461
- 'id',
462
- 'name',
463
- 'createdAt',
464
- 'updatedAt',
465
- 'deletedAt',
466
- ]);
467
- ```
468
-
469
- ## What's Changed
470
- * docs: update 'primayKey' typos by @freshgum-bubbles in https://github.com/cyjake/leoric/pull/211
471
- * docs: DataTypes definitions in d.ts by @cyjake in https://github.com/cyjake/leoric/pull/210
472
- * fix: fix#209 sequelize mode should update all changed fields in instance update method by @JimmyDaddy in https://github.com/cyjake/leoric/pull/212
473
- * fix: fix #213 findAndCountAll should ignore attributes by @JimmyDaddy in https://github.com/cyjake/leoric/pull/214
474
- * fix: opts.connectTimeout by @cyjake in https://github.com/cyjake/leoric/pull/216
475
- * fix: reload instance with sharding key should not throw by @cyjake in https://github.com/cyjake/leoric/pull/217
476
- * feat: timestamps should be defined by default by @cyjake in https://github.com/cyjake/leoric/pull/218
477
- * fix: instance.reload() should not rely on `static findOne()` by @cyjake in https://github.com/cyjake/leoric/pull/219
478
-
479
- ## New Contributors
480
- * @freshgum-bubbles made their first contribution in https://github.com/cyjake/leoric/pull/211
481
-
482
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.5...v1.14.0
483
-
484
- 1.13.5 / 2021-10-26
485
- ===================
486
-
487
- ## What's Changed
488
- * docs: enhance aggregation query types & fix raw query result type by @cyjake in https://github.com/cyjake/leoric/pull/208
489
-
490
-
491
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.4...v1.13.5
492
-
493
- 1.13.4 / 2021-10-25
494
- ===================
495
-
496
- ## What's Changed
497
- * docs: spell & model methods should be generic by @cyjake in https://github.com/cyjake/leoric/pull/206
498
- * docs: enhance query options, instance type, and toJSON() result type by @cyjake in https://github.com/cyjake/leoric/pull/207
499
-
500
- This version brings correct (and hopefully better) typescript definitions, with the dts checked continuously at test/types tests. With this version, users that have model types correctly pinned at Bone will get code completion including class fields. Such as:
501
-
502
- ![image](https://user-images.githubusercontent.com/252317/138683240-98ee9e79-4b3e-449c-bc95-a449d457d64f.png)
503
-
504
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.3...v1.13.4
505
-
506
- 1.13.3 / 2021-10-21
507
- ===================
508
-
509
- ## What's Changed
510
- * refactor: persist edge cases of type casting in integration tests by @cyjake in https://github.com/cyjake/leoric/pull/202
511
- * docs: renaming attributes by @cyjake in https://github.com/cyjake/leoric/pull/203
512
- * fix: JSON.uncast(string) should not serialize twice by @cyjake in https://github.com/cyjake/leoric/pull/205
513
-
514
-
515
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.2...v1.13.3
516
-
517
- 1.13.2 / 2021-10-18
518
- ===================
519
-
520
- ## What's Changed
521
- * fix: attribute.uncast([]) and realm.connect with synchronized models by @cyjake in https://github.com/cyjake/leoric/pull/201
522
-
523
-
524
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.1...v1.13.2
525
-
526
- 1.13.1 / 2021-10-18
527
- ===================
528
-
529
- ## What's Changed
530
- * fix: skip connecting if models are synchronized already by @cyjake in https://github.com/cyjake/leoric/pull/200
531
-
532
-
533
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.0...v1.13.1
534
-
535
- 1.13.0 / 2021-10-18
536
- ===================
537
-
538
- ## What's Changed
539
- * docs: monthly updates of 2021.09; support dark mode by @cyjake in https://github.com/cyjake/leoric/pull/196
540
- * feat: coerce literal values into accurate attribute type by @cyjake in https://github.com/cyjake/leoric/pull/197
541
- * fix: dispatched result should be in attribute names by @cyjake in https://github.com/cyjake/leoric/pull/198
542
-
543
-
544
- **Full Changelog**: https://github.com/cyjake/leoric/compare/v1.12.0...v1.13.0
545
-
546
- 1.12.0 / 2021-10-12
547
- ===================
548
-
549
- * feat: support custom fields query and sequelize mode export rawAttributes (#192)
550
- * refactor: collection format query result (#194)
551
- * refactor: object condition parsing and expression formatting (#191)
552
-
553
- 1.11.1 / 2021-09-28
554
- ===================
555
-
556
- This version fixes lots of issues regarding logical operator in object conditions.
557
-
558
- * fix: logical operator with multiple conditions such as (#190)
559
- * fix: sequelize mode support HAVING, and select fields raw sql support (#187)
560
- * fix: support len validator (#188)
561
- * fix: normalize logical operator conditions before formatting with spellbook (#186)
562
-
563
- 1.11.0 / 2021-09-24
564
- ===================
565
-
566
- * feat: support BINARY(length), VARBINARY(length), and BLOB (#169)
567
- * fix: logic operate should adapt one argument (#183)
568
- * fix: Bone.load() should be idempotent, make sure associations is intact (#184)
569
- * fix: selected instance isNewRecord is false (#182)
570
- * fix: set options.busyTimeout to mitigate SQLITE_BUSY (#176)
571
- * fix: turn on long stack trace of sqlite driver (#175)
572
- * docs: how to contribute (#180)
573
-
574
- 1.10.0 / 2021-09-14
575
- ===================
576
-
577
- * feat: SQLite driver should emit "connection" event when new connection is created (#168)
578
- * fix: bulkCreate(...records) should recognize custom setters (#168)
579
- * fix: attribute.equals() check should ignore defaultValue (#172)
580
-
581
- 1.9.0 / 2021-09-04
582
- ==================
583
-
584
- > should've been a major release but since existing users have all migrated to the new api...
585
-
586
- * breaking: drop the deprecated `Model.describe()` (#167)
587
-
588
- 1.8.0 / 2021-08-30
589
- ==================
590
-
591
- * feat: silent option fix #164 (#165)
592
- * feat: binary type (#166)
593
-
594
- 1.7.1 / 2021-08-17
595
- ==================
596
-
597
- * revert: drop Driver#recycleConnections due to poor interoperability (#162)
598
- * fix: validator call array arguments (#160)
599
-
600
- 1.7.0 / 2021-08-17
601
- =================
602
-
603
- * feat: close connections that exceeds opts.idleTimeout (#159)
604
- * feat: `opts.connectionLimit` support for SQLite (#159)
605
- * feat: raw query relpacements, closes #149 (#155)
606
- * fix: upsert created_at default (#154)
607
- * test: validator unit test (#157)
608
- * test: setup_hooks unit test (#158)
609
-
610
- 1.6.7 / 2021-08-05
611
- ==================
612
-
613
- * fix: prevent from calling Date.prototype.toJSON (#153)
614
-
615
- 1.6.6 / 2021-07-22
616
- ==================
617
-
618
- * fix: subclassing data type in dialects (#145)
619
- * fix: where('width / height >= 16 / 9') (#144)
620
- * docs: logging and sequelzie adapter (zh) (#142)
621
- * test: include test/unit/utils (#143)
622
- * test: more tests cases about sequelize adapter (#141)
623
-
624
- 1.6.5 / 2021-07-16
625
- ==================
626
-
627
- * fix: define assign Bone.models #140
628
-
629
- 1.6.4 / 2021-07-16
630
- ==================
631
-
632
- * refactor: connect({ Bone }) still necessary (#139)
633
- * fix: formatting select join with subqueries should not tamper the subquery itself (#138)
634
- * fix: describe table with more compatible syntax (#137)
635
-
636
- 1.6.3 / 2021-07-14
637
- ==================
638
-
639
- * fix: transaction option passing in sequelize adapter (#136)
640
- * fix: this.Model and proper Model.describe() (#135)
641
-
642
- 1.6.2 / 2021-07-09
643
- ==================
644
-
645
- * fix: convert datetime in seconds/milliseconds back to Date (#134)
646
- * fix: renamed attribute should remain enumerable (#133)
647
-
648
- 1.6.1 / 2021-07-07
649
- ==================
650
-
651
- * fix: collection convert should handle tddl results as well (#132)
652
-
653
- 1.6.0 / 2021-07-06
654
- ==================
655
-
656
- * feat: support class static attributes and hooks (#131)
657
- * fix: names defined in Bone.attributes should always be enumerable (#128)
658
- * chore: add quality badge to readme (#129)
659
-
660
- 1.5.2 / 2021-07-02
661
- ==================
662
-
663
- * fix: leave the getter properties defined in class syntax as is (#127)
664
-
665
- 1.5.1 / 2021-06-30
666
- ==================
667
-
668
- * fix: export Logger and Spell to let users intercept lower level api calls (#126)
669
-
670
- 1.5.0 / 2021-06-30
671
- ==================
672
-
673
- * feat: provide Bone.pool to be backward compatible with v0.x (#124)
674
- * feat: complete bone/spine.restore and Bone API type definitions (#125)
675
- * feat: support more data types (mediumtext, mediumint, char, date...) (#123)
676
-
677
- 1.4.1 / 2021-06-25
678
- ==================
679
-
680
- * refactor: simplify legacy timestamps support (#120)
681
- * refactor: do not subclass Bone unless asked specifically (#120)
682
-
683
- 1.4.0 / 2021-06-24
684
- ==================
685
-
686
- * feat: `realm.raw('SELECT ...')` and `Model.raw('SELECT ...')` (#94)
687
- * feat: support multiple order rules in one single string or one-dimensional array (#92)
688
- * feat: `Model.truncate()` now uses TRUNCATE if possible
689
- * feat: `Model.find().optimizerHints('SET_VAR(foreign_key_checks=OFF)')`
690
- * fix: Bone.bulkCreate() should not throw when called with non attribute (#117)
691
- * fix: batch upsert (#108)
692
- * fix: make sure connection is passed around in all queries carried out within transaction (#105)
693
- * fix: update, sequelize mode get API, destroy compitable (#104)
694
- * fix: `setDataValue` in sequelize adapter should not check prop name strictly
695
- * refactor: spell_insert (#118)
696
- * docs: about egg-orm & migrations (#119)
697
- * docs: revise instructions for installing Jekyll (#111)
698
- * docs: migrations, validations, hooks, and sequelize adapter (#103)
699
- * docs: contributing guides
700
-
701
- 1.3.0 / 2021-03-01
702
- ==================
703
-
704
- * feat: hook support
705
- * feat: dirty check (`changes()` & `previousChanges()`)
706
- * feat: compatible with mysql longtext conversion
707
- * feat: NOT condition
708
-
709
- 1.2.0 / 2020-12-10
710
- ==================
711
-
712
- * feat: `Realm.prototype.transaction()` with async function support
713
- * feat: `Realm.prototype.query()` for raw queries
714
- * feat: `logger.logQuery(sql, duration, { Model, command })`
715
- * feat: `logger.logQueryError(sql, err, duration, { Model, command })`
716
-
717
- 1.1.0 / 2020-11-23
718
- ==================
719
-
720
- * feat: JSON and JSONB data types
721
- * feat: support `stringifyObjects` option for mysql client
722
- * feat: aggregate functions for sequelize adapter
723
- * feat: `Spell.prototype.nodeify()`
724
-
725
- 1.0.3 / 2020-03-16
726
- ==================
727
-
728
- * fix: replace `deep-equal` (which is bloated) with `util.isDeepStrictEqual`
729
-
730
- 1.0.2 / 2020-03-04
731
- ==================
732
-
733
- * fix: driver.alterTable() with multiple columns to add in SQLite
734
-
735
- 1.0.1 / 2020-02-25
736
- ==================
737
-
738
- * fix: bulkCreate in sequelize shim
739
-
740
- 1.0.0 / 2020-02-24
741
- ==================
742
-
743
- First major release. Let's get serious with semver.
744
-
745
- * feat: logger.logQuery(sql, duration) & logger.logQueryError(sql, err)
746
-
747
- 0.5.3 / 2020-02-22
748
- ==================
749
-
750
- * fix: `connect({ sequelize, dialect, client })` to allow mandatory sqlite client
751
- * fix: prevent queries being performed unless model is correctly connected
752
-
753
- 0.5.2 / 2020-02-21
754
- ==================
755
-
756
- * fix: drop the default and unused `require('sqlite3')`
757
-
758
- 0.5.1 / 2020-02-21
759
- ==================
760
-
761
- * fix: `connect({ client: '@journeyapps/sqlcipher' })`
762
-
763
- 0.5.0 / 2020-02-19
764
- ==================
765
-
766
- * feat: `Bone.sync()` to synchronize model with database
767
- * feat: `Bone.createMigrationFile()` to create migration file
768
- * feat: `Bone.migrate()` to run migrations
769
- * feat: `Bone.bulkCreate()` to bulk insert records
770
- * feat: `require('leoric')` now exports `Realm` to connect with multiple databases
771
- * feat: `realm.define()` to define models in an old fashioned way
772
- * feat: `realm.connect()` to connect with database
773
- * feat: SQLite support without hacking node-sqlite3
774
- * feat: `Bone.DataTypes` for type references
775
- * feat: `Bone.init()` to initialize models
776
- * feat: an adaptor to use Leoric in (partially) Sequelize complaint API
777
- * refactor: a complete re-write of JOIN queries
778
- * refactor: added `Bone.driver` to better encapsulate and planish database nuances
779
-
780
- 0.4.5 / 2019-12-14
781
- ==================
782
-
783
- * fix: prevent primary key from being overridden with incorrect `LAST_INSERT_ID()`
784
-
785
- 0.4.4 / 2019-07-15
786
- ==================
787
-
788
- * fix: append default scope when declaring relations, fixes #10
789
-
790
- 0.4.3 / 2019-05-09
791
- ==================
792
-
793
- * fix: prevent Bone.dispatch from creating duplicated records of main table
794
-
795
- 0.4.2 / 2019-04-26
796
- ==================
797
-
798
- * feat: `Spell#orWhere()` and `Spell#orHaving()`
799
- * feat: arithmetic operators
800
- * feat: unary operators such as unary minus `-` and bit invertion `~`
801
- * fix: unset attribute should be overwritable
802
- * fix: `attributeChanged()` should be false if attribute is unset and not overwritten
803
- * fix: subclass with incomplete getter/setter should be complemented
804
- * fix: sharding key validation on `Bone.update()` and `Bone.save()`
805
- * fix: sharding key should be along with primary key on `bone.remove()`
806
- * fix: `Bone.cast()` should leave `null` as is
807
- * fix: `INSERT ... UPDATE` with `id = LAST_INSERT_ID(id)` in MySQL
808
- * fix: `Model.find({ name: { $op1, $op2 } })` object conditions with multiple operators
809
- * fix: prefixing result set with qualifiers if query contains join relations and is not dispatchable
810
- * fix: `Spell#$get(index)` with LIMIT
811
- * doc: `Model.transaction()`
812
- * doc: definition types with `index.d.ts`
813
-
814
- 0.4.1 / 2019-03-21
815
- ==================
816
-
817
- * feat: premature sharding key validation
818
- * fix: output complete SQL instead of parameterized query with values.
819
- * fix: both `connect({ model })` and `connect({ models })` are allowed.
820
- * doc: no more `.findOrCreate()`, just `.upsert()`
821
- * doc: table of contents with kramdown's `{:toc}`
822
- * chore: droped experimental sqlite3 support
823
-
824
- 0.4.0 / 2018-11-05
825
- ==================
826
-
827
- * feat: PostgreSQL support
828
- * feat: Transaction support
829
- * upgrade: (forked) SQLite client updated to SQLite 3.24
830
-
831
-
832
- 0.3.0 / 2018-10-31
833
- ==================
834
-
835
- * feat: SQLite support with a [forked sqlite3](https://github.com/cyjake/node-sqlite3)
836
- * feat: mysql2 support (which is trivial since both mysql and mysql2 share the same API)
837
- * refactor: Spell now formats SQL with the literals separated, which gets escaped by the corresponding client itself later on.
838
-
839
- 0.2.0 / 2018-01-03
840
- ==================
841
-
842
- * breaking: renaming
843
-
844
- 0.1.8 / 2017-12-31
845
- ==================
846
-
847
- * fix: implement `query.batch()` as async iterator
848
- * fix: `NOT (expr)`
849
- * fix: `IFNULL(foo, default)`
850
- * fix: support `.select(name[])`, `.select(name => {})`, and `.select("...name")`
851
- * doc: `Model => className` in association options
852
- * doc: use [jsdoc](http://usejsdoc.org) to generate docs/api
853
- * doc: `.include()`
854
-
855
- 0.1.7 / 2017-12-22
856
- ==================
857
-
858
- * refactor: `{ type: 'op', name: 'as' }` renamed to `{ type: 'alias' }`
859
- * feat: `{ type: 'mod' }` for modifier, currently only `DISTINCT` is recognized
860
- * feat: unary operators like `!` and `NOT`
861
- * feat: `IS` and `IS NOT`
862
- * fix: logic operator precendences
863
- * fix: polymorphic hasMany({ through }) relations
864
- * fix: dispatching multiple results with joins correctly
865
-
866
- 0.1.6 / 2017-12-21
867
- ==================
868
-
869
- * feat: proper `.first`, `.last`, `.all`, and `.get(index)`
870
- * fix: accept `Date`, `boolean`, and `Set` values
871
- * fix: `Model.unscoped`
872
- * fix: `Model.remove({}, true)` should be unscoped
873
-
874
- 0.1.5 / 2017-12-20
875
- ==================
876
-
877
- * refactor: encapsulate column names. Keep them from the users even if the query results can not be dispatched.
878
- * fix: complicated groups with joins should discard the use of subquery.
879
- * fix: camelCase should replace globally
880
- * fix: avoid missing attribtue exception when toJSON/toObject
881
-
882
- 0.1.4 / 2017-12-18
883
- ==================
884
-
885
- * fix: should format condition arrays by hand instead of hand it over to formatExpr
886
- * fix: whereConditions of subquery should retain the order of the whereConditions in major query
887
- * fix: calculated columns should be kept in the final columns when sorting out the attributes
888
- * fix: doesn't depend on co anymore
889
-
890
- 0.1.3 / 2017-12-17
891
- ==================
892
-
893
- * fix: `select distict foo from table`;
894
- * fix: `where (a = 1 or a = 2) and b = 3`;
895
- * doc: a syntax table to provide a better glance over the querying ability.
896
-
897
- 0.1.2 / 2017-12-14
898
- ==================
899
-
900
- * fix: copy left table's orders into subquery to make order/limit work when combined.
901
- * fix: errors should be thrown when accessing attributes that weren't selected at the first place.
902
-
903
- 0.1.1 / 2017-12-13
904
- ==================
905
-
906
- * refactor: automatic versioning on spells. When client calls query methods with chaining, new versions of spell gets duplicated. Makes reuse of spells possible.
907
- * doc: english verion is almost complete <http://cyj.me/leoric>.
908
-
909
- 0.1.0 / 2017-12-09
910
- ==================
911
-
912
- * Initial version, covers basic usage such as model authoring, database connection, query interface, and association.