@snowtop/ent 0.1.0-alpha156 → 0.1.0-alpha158

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/core/clause.d.ts CHANGED
@@ -11,11 +11,12 @@ export interface SensitiveValue {
11
11
  value(): any;
12
12
  logValue(): any;
13
13
  }
14
+ type InClauseOperator = "IN" | "NOT IN";
14
15
  export declare class inClause<T extends Data, K = keyof T> implements Clause<T, K> {
15
16
  private col;
16
17
  private value;
17
18
  private type;
18
- protected op: string;
19
+ protected op: InClauseOperator;
19
20
  static getPostgresInClauseValuesThreshold(): number;
20
21
  constructor(col: K, value: any[], type?: string);
21
22
  clause(idx: number): string;
@@ -25,7 +26,7 @@ export declare class inClause<T extends Data, K = keyof T> implements Clause<T,
25
26
  instanceKey(): string;
26
27
  }
27
28
  export declare class notInClause<T extends Data, K = keyof T> extends inClause<T, K> {
28
- protected op: string;
29
+ protected op: InClauseOperator;
29
30
  }
30
31
  /**
31
32
  * creates a clause to determine if the given value is contained in the array stored in the column in the db
package/core/clause.js CHANGED
@@ -241,7 +241,12 @@ class inClause {
241
241
  clause(idx) {
242
242
  // do a simple = when only one item
243
243
  if (this.value.length === 1) {
244
- return new simpleClause(this.col, this.value[0], "=").clause(idx);
244
+ if (this.op === "IN") {
245
+ return new simpleClause(this.col, this.value[0], "=").clause(idx);
246
+ }
247
+ else {
248
+ return new simpleClause(this.col, this.value[0], "!=").clause(idx);
249
+ }
245
250
  }
246
251
  const postgres = db_1.default.getDialect() === db_1.Dialect.Postgres;
247
252
  const postgresValuesList = postgres &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowtop/ent",
3
- "version": "0.1.0-alpha156",
3
+ "version": "0.1.0-alpha158",
4
4
  "description": "snowtop ent framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -419,13 +419,9 @@ async function main() {
419
419
  const buildClasses = (fields) => {
420
420
  fields.forEach((field) => {
421
421
  if (field.nodeName && !nodesMap.has(field.nodeName)) {
422
- // TODO don't necessarily wanna do this
423
- try {
424
- let info = imports.getInfoForClass(field.nodeName);
425
- classes[field.nodeName] = { ...info.class, path: info.file.path };
426
- buildFiles(info.file);
427
- }
428
- catch (err) { }
422
+ let info = imports.getInfoForClass(field.nodeName);
423
+ classes[field.nodeName] = { ...info.class, path: info.file.path };
424
+ buildFiles(info.file);
429
425
  }
430
426
  buildClasses2(field.args);
431
427
  buildClasses2(field.results);