bigal 10.0.0-beta1 → 10.0.0-beta5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bigal",
|
|
3
|
-
"version": "10.0.0-
|
|
3
|
+
"version": "10.0.0-beta5",
|
|
4
4
|
"description": "A fast and lightweight orm for postgres and node.js, written in typescript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"typescript": "^4.5.4"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
|
+
"check:types": "tsc -p tsconfig.lint.json --noEmit",
|
|
61
62
|
"prebuild": "rimraf dist",
|
|
62
63
|
"build": "tsc",
|
|
63
64
|
"test": "mocha -r ts-node/register tests/**/*.tests.ts",
|
package/query/WhereQuery.d.ts
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import type { Entity, NotEntityBrand } from '../Entity';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
id: unknown;
|
|
7
|
-
} | null : Exclude<(TValue | null)[] | TValue, undefined> | null;
|
|
2
|
+
import type { ExcludeEntityCollections, ExcludeFunctions } from '../types';
|
|
3
|
+
declare type ExcludeUndefined<T> = Exclude<T, undefined>;
|
|
4
|
+
export declare type LiteralValues<TValue> = (ExcludeUndefined<TValue> | null)[] | ExcludeUndefined<TValue> | null;
|
|
5
|
+
export declare type WhereClauseValue<TValue> = TValue extends NotEntityBrand | undefined ? Exclude<TValue, NotEntityBrand | undefined> : Extract<TValue, Entity> extends undefined ? LiteralValues<TValue> : (ExcludeUndefined<Exclude<TValue, Entity>> | null)[] | (Pick<Extract<ExcludeUndefined<TValue>, Entity>, 'id'> | null)[] | ExcludeUndefined<Exclude<TValue, Entity>> | Pick<Extract<ExcludeUndefined<TValue>, Entity>, 'id'> | null;
|
|
8
6
|
export declare type StringConstraint<TValue extends string> = {
|
|
9
|
-
[P in 'contains' | 'endsWith' | 'like' | 'startsWith']?:
|
|
7
|
+
[P in 'contains' | 'endsWith' | 'like' | 'startsWith']?: LiteralValues<TValue>;
|
|
10
8
|
};
|
|
11
9
|
export declare type NumberOrDateConstraint<TValue extends Date | number> = {
|
|
12
|
-
[P in '<' | '<=' | '>' | '>=']?:
|
|
10
|
+
[P in '<' | '<=' | '>' | '>=']?: LiteralValues<TValue>;
|
|
13
11
|
};
|
|
14
12
|
export declare type NegatableConstraint<TValue> = TValue | {
|
|
15
13
|
'!': TValue;
|
|
16
14
|
};
|
|
17
15
|
export declare type WhereQueryStatement<TValue> = TValue extends string ? NegatableConstraint<StringConstraint<TValue> | WhereClauseValue<TValue>> : TValue extends Date | number ? NegatableConstraint<NumberOrDateConstraint<TValue> | WhereClauseValue<TValue>> : NegatableConstraint<WhereClauseValue<TValue>>;
|
|
18
16
|
export declare type WhereQuery<T extends Entity> = {
|
|
19
|
-
[K in keyof T as ExcludeEntityCollections<T[K], ExcludeFunctions<T[K], K>>]?: K extends 'id' ? WhereQueryStatement<T | T[K]> : T[K] extends (infer U)[] | undefined ? WhereQueryStatement<U> :
|
|
20
|
-
'!':
|
|
17
|
+
[K in keyof T as ExcludeEntityCollections<T[K], ExcludeFunctions<T[K], K>>]?: K extends 'id' ? WhereQueryStatement<T | T[K]> : T[K] extends (infer U)[] | undefined ? WhereQueryStatement<U> : (ExcludeUndefined<T[K]> | null)[] | T[K] | WhereQueryStatement<T[K]> | {
|
|
18
|
+
'!': LiteralValues<T[K]>;
|
|
21
19
|
};
|
|
22
20
|
} & {
|
|
23
21
|
or?: WhereQuery<T>[];
|
|
24
22
|
};
|
|
23
|
+
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { Entity, NotEntityBrand } from '../Entity';
|
|
2
|
-
import type { EntityPrimitiveOrId } from './EntityPrimitiveOrId';
|
|
3
2
|
import type { ExcludeEntityCollections } from './ExcludeEntityCollections';
|
|
4
3
|
import type { ExcludeFunctions } from './ExcludeFunctions';
|
|
5
|
-
import type { QueryResult } from './QueryResult';
|
|
6
4
|
/**
|
|
7
5
|
* Changes all Entity value properties to Primitive (string|number) | Pick<Entity, 'id'>
|
|
8
6
|
*/
|
|
9
7
|
export declare type CreateUpdateParams<T extends Entity> = {
|
|
10
|
-
[K in keyof T as ExcludeEntityCollections<T[K]
|
|
8
|
+
[K in keyof T as ExcludeEntityCollections<NonNullable<T[K]>, ExcludeFunctions<T[K], K>>]?: T[K] extends NotEntityBrand | undefined ? T[K] : Extract<T[K], Entity> extends undefined ? T[K] : Exclude<T[K], Entity> | Pick<Extract<T[K], Entity>, 'id'>;
|
|
11
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Entity } from '../Entity';
|
|
2
|
-
export declare type EntityPrimitiveOrId<T extends Entity
|
|
2
|
+
export declare type EntityPrimitiveOrId<T extends Entity> = Extract<NonNullable<T>, Entity> extends Entity ? Exclude<NonNullable<T>, Entity> | Pick<T, 'id'> : T;
|