bigal 10.3.4 → 10.4.0-beta

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.4.0 - 2022-11-03
4
+
5
+ - Fix string comparison where constraint with union values
6
+ - Update npms
7
+
3
8
  ## 10.3.4 - 2022-10-11
4
9
 
5
10
  - Update npms
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigal",
3
- "version": "10.3.4",
3
+ "version": "10.4.0-beta",
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",
@@ -19,34 +19,34 @@
19
19
  "node": ">=14"
20
20
  },
21
21
  "dependencies": {
22
- "@types/lodash": "^4.14.186",
22
+ "@types/lodash": "^4.14.187",
23
23
  "@types/node": ">=14",
24
24
  "@types/pg": "^8.6.5",
25
25
  "lodash": "^4.17.21",
26
26
  "pg": "^8.8.0",
27
- "postgres-pool": "^6.0.5"
27
+ "postgres-pool": "^6.0.6"
28
28
  },
29
29
  "devDependencies": {
30
- "@faker-js/faker": "^7.5.0",
30
+ "@faker-js/faker": "^7.6.0",
31
31
  "@types/chai": "^4.3.3",
32
32
  "@types/mocha": "10.0.0",
33
- "@typescript-eslint/eslint-plugin": "^5.40.0",
34
- "@typescript-eslint/parser": "^5.40.0",
33
+ "@typescript-eslint/eslint-plugin": "^5.42.0",
34
+ "@typescript-eslint/parser": "^5.42.0",
35
35
  "chai": "^4.3.6",
36
- "eslint": "^8.25.0",
36
+ "eslint": "^8.26.0",
37
37
  "eslint-config-airbnb-base": "^15.0.0",
38
38
  "eslint-config-airbnb-typescript": "^17.0.0",
39
39
  "eslint-config-prettier": "^8.5.0",
40
40
  "eslint-plugin-import": "^2.26.0",
41
- "eslint-plugin-jsdoc": "^39.3.6",
41
+ "eslint-plugin-jsdoc": "^39.6.2",
42
42
  "eslint-plugin-mocha": "10.1.0",
43
43
  "eslint-plugin-prettier": "^4.2.1",
44
- "eslint-plugin-promise": "^6.0.1",
44
+ "eslint-plugin-promise": "^6.1.1",
45
45
  "eslint-plugin-security": "^1.5.0",
46
46
  "husky": "^8.0.1",
47
47
  "lint-staged": "^13.0.3",
48
48
  "markdownlint-cli": "^0.32.2",
49
- "mocha": "^10.0.0",
49
+ "mocha": "^10.1.0",
50
50
  "npm-run-all": "^4.1.5",
51
51
  "pinst": "^3.0.0",
52
52
  "prettier": "^2.7.1",
@@ -1,22 +1,20 @@
1
1
  import type { Entity, NotEntityBrand } from '../Entity';
2
2
  import type { ExcludeEntityCollections, ExcludeFunctions } from '../types';
3
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;
4
+ export declare type LiteralValues<TValue> = (TValue | null)[] | TValue | null;
5
+ export declare type WhereClauseValue<TValue> = TValue extends NotEntityBrand | undefined ? Exclude<TValue, NotEntityBrand | undefined> : Extract<TValue, Entity> extends undefined ? LiteralValues<ExcludeUndefined<TValue>> : (ExcludeUndefined<Exclude<TValue, Entity>> | null)[] | (Pick<Extract<ExcludeUndefined<TValue>, Entity>, 'id'> | null)[] | ExcludeUndefined<Exclude<TValue, Entity>> | Pick<Extract<ExcludeUndefined<TValue>, Entity>, 'id'> | null;
6
6
  export declare type StringConstraint<TValue extends string> = {
7
- [P in 'contains' | 'endsWith' | 'like' | 'startsWith']?: LiteralValues<TValue>;
7
+ [P in 'contains' | 'endsWith' | 'like' | 'startsWith']?: LiteralValues<ExcludeUndefined<TValue>>;
8
8
  };
9
9
  export declare type NumberOrDateConstraint<TValue extends Date | number> = {
10
- [P in '<' | '<=' | '>' | '>=']?: LiteralValues<TValue>;
10
+ [P in '<' | '<=' | '>' | '>=']?: LiteralValues<ExcludeUndefined<TValue>>;
11
11
  };
12
12
  export declare type NegatableConstraint<TValue> = TValue | {
13
13
  '!': TValue;
14
14
  };
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>>;
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>>;
16
16
  export declare type WhereQuery<T extends Entity> = {
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]>;
19
- };
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<ExcludeUndefined<U>> : NegatableConstraint<LiteralValues<ExcludeUndefined<T[K]>>> | WhereQueryStatement<ExcludeUndefined<T[K]>>;
20
18
  } & {
21
19
  or?: WhereQuery<T>[];
22
20
  };