leoric 2.8.6 → 2.8.7
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 +10 -0
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/data_types.ts +2 -2
- package/src/types/abstract_bone.d.ts +1 -1
- package/src/types/common.d.ts +3 -1
package/History.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
2.8.7 / 2022-10-11
|
|
2
|
+
==================
|
|
3
|
+
|
|
4
|
+
## What's Changed
|
|
5
|
+
* fix: enable strictNullChecks by @cyjake in https://github.com/cyjake/leoric/pull/357
|
|
6
|
+
* fix: declaration types of realm.query() and static update values by @cyjake in https://github.com/cyjake/leoric/pull/358
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.8.6...v2.8.7
|
|
10
|
+
|
|
1
11
|
2.8.6 / 2022-10-11
|
|
2
12
|
==================
|
|
3
13
|
|
package/index.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export default class Realm {
|
|
|
74
74
|
|
|
75
75
|
escape(value: Literal): string;
|
|
76
76
|
|
|
77
|
-
query<T
|
|
77
|
+
query<T>(sql: string, values?: Array<Literal>, options?: RawQueryOptions & { model?: T }): Promise<{ rows: T extends typeof Bone ? InstanceType<T>[] : Record<string, Literal>[], fields?: Record<string, ColumnMeta>[], affectedRows?: number }>;
|
|
78
78
|
|
|
79
79
|
transaction<T extends (options: { connection: Connection }) => Generator>(callback: T): Promise<GeneratorReturnType<ReturnType<T>>>;
|
|
80
80
|
transaction<T extends (options: { connection: Connection }) => Promise<any>>(callback: T): Promise<ReturnType<T>>;
|
package/package.json
CHANGED
package/src/data_types.ts
CHANGED
|
@@ -65,7 +65,7 @@ class STRING extends DataType {
|
|
|
65
65
|
return chunks.join(' ');
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
uncast(value: string | Raw | null): string | Raw {
|
|
68
|
+
uncast(value: string | Raw | null): string | Raw | null {
|
|
69
69
|
if (value == null || value instanceof Raw) return value;
|
|
70
70
|
return '' + value;
|
|
71
71
|
}
|
|
@@ -304,7 +304,7 @@ class DATE extends DataType {
|
|
|
304
304
|
return this._round(value);
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
uncast(value: null | Raw | string | Date | { toDate: () => Date }, _strict?: boolean): string | Date | Raw {
|
|
307
|
+
uncast(value: null | Raw | string | Date | { toDate: () => Date }, _strict?: boolean): string | Date | Raw | null | undefined {
|
|
308
308
|
const originValue = value;
|
|
309
309
|
|
|
310
310
|
// type narrowing doesn't handle `return value` correctly
|
|
@@ -32,7 +32,7 @@ export class AbstractBone {
|
|
|
32
32
|
/**
|
|
33
33
|
* The driver that powers the model
|
|
34
34
|
*/
|
|
35
|
-
static driver: AbstractDriver;
|
|
35
|
+
static driver: AbstractDriver | null;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* The connected models structured as `{ [model.name]: model }`, e.g. `Bone.model.Post => Post`
|
package/src/types/common.d.ts
CHANGED
|
@@ -177,7 +177,9 @@ export type WhereConditions<T extends typeof AbstractBone> = {
|
|
|
177
177
|
// https://stackoverflow.com/a/68077021/179691
|
|
178
178
|
export type PickTypeKeys<Obj, Type, T extends keyof Obj = keyof Obj> = ({ [P in keyof Obj]: Obj[P] extends Type ? P : never })[T];
|
|
179
179
|
|
|
180
|
-
export type
|
|
180
|
+
export type NullablePartial<T> = { [P in keyof T]?: T[P] | null };
|
|
181
|
+
|
|
182
|
+
export type Values<T> = NullablePartial<Omit<T, PickTypeKeys<T, Function> | 'isNewRecord' | 'Model' | 'dataValues'>>;
|
|
181
183
|
|
|
182
184
|
export type BoneColumns<T extends typeof AbstractBone, Key extends keyof InstanceType<T> = keyof Values<InstanceType<T>>> = Key;
|
|
183
185
|
|