@snowtop/ent 0.1.0-alpha117 → 0.1.0-alpha118

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
@@ -23,17 +23,6 @@ export declare class inClause<T extends Data, K = keyof T> implements Clause<T,
23
23
  logValues(): any[];
24
24
  instanceKey(): string;
25
25
  }
26
- declare class compositeClause<T extends Data, K = keyof T> implements Clause<T, K> {
27
- private clauses;
28
- private sep;
29
- compositeOp: string;
30
- constructor(clauses: Clause<T, K>[], sep: string);
31
- clause(idx: number): string;
32
- columns(): K[];
33
- values(): any[];
34
- logValues(): any[];
35
- instanceKey(): string;
36
- }
37
26
  /**
38
27
  * creates a clause to determine if the given value is contained in the array stored in the column in the db
39
28
  * only works with postgres gin indexes
@@ -84,9 +73,9 @@ export declare function Greater<T extends Data, K = keyof T>(col: K, value: any)
84
73
  export declare function Less<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
85
74
  export declare function GreaterEq<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
86
75
  export declare function LessEq<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
87
- export declare function And<T extends Data, K = keyof T>(...args: Clause<T, K>[]): compositeClause<T, K>;
76
+ export declare function And<T extends Data, K = keyof T>(...args: Clause<T, K>[]): Clause<T, K>;
88
77
  export declare function AndOptional<T extends Data, K = keyof T>(...args: (Clause<T, K> | undefined)[]): Clause<T, K>;
89
- export declare function Or<T extends Data, K = keyof T>(...args: Clause<T, K>[]): compositeClause<T, K>;
78
+ export declare function Or<T extends Data, K = keyof T>(...args: Clause<T, K>[]): Clause<T, K>;
90
79
  export declare function OrOptional<T extends Data, K = keyof T>(...args: (Clause<T, K> | undefined)[]): Clause<T, K>;
91
80
  export declare function In<T extends Data, K = keyof T>(col: K, ...values: any): Clause<T, K>;
92
81
  export declare function In<T extends Data, K = keyof T>(col: K, values: any[], type?: string): Clause<T, K>;
@@ -103,25 +92,11 @@ export declare function TsVectorPlainToTsQuery<T extends Data, K = keyof T>(col:
103
92
  export declare function TsVectorPhraseToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
104
93
  export declare function TsVectorWebsearchToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
105
94
  export declare function sensitiveValue(val: any): SensitiveValue;
106
- export declare function JSONObjectFieldKeyASJSON<T extends Data, K = keyof T>(col: K, field: string): string;
107
- export declare function JSONObjectFieldKeyAsText<T extends Data, K = keyof T>(col: K, field: string): string;
95
+ export declare function JSONObjectFieldKeyASJSON<T extends Data, K = keyof T>(col: K, field: string): keyof T;
96
+ export declare function JSONObjectFieldKeyAsText<T extends Data, K = keyof T>(col: K, field: string): keyof T;
108
97
  type predicate = "==" | ">" | "<" | "!=" | ">=" | "<=";
109
98
  export declare function JSONPathValuePredicate<T extends Data, K = keyof T>(dbCol: K, path: string, val: any, pred: predicate): Clause<T, K>;
110
- declare class paginationMultipleColumnsSubQueryClause<T extends Data, K = keyof T> implements Clause<T, K> {
111
- private col;
112
- private op;
113
- private tableName;
114
- private uniqueCol;
115
- private val;
116
- constructor(col: K, op: string, tableName: string, uniqueCol: K, val: any);
117
- private buildSimpleQuery;
118
- clause(idx: number): string;
119
- columns(): K[];
120
- values(): any[];
121
- logValues(): any[];
122
- instanceKey(): string;
123
- }
124
- export declare function PaginationMultipleColsSubQuery<T extends Data, K = keyof T>(col: K, op: string, tableName: string, uniqueCol: K, val: any): paginationMultipleColumnsSubQueryClause<Data, K>;
99
+ export declare function PaginationMultipleColsSubQuery<T extends Data, K = keyof T>(col: K, op: string, tableName: string, uniqueCol: K, val: any): Clause<T, K>;
125
100
  export declare function Add<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
126
101
  export declare function Subtract<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
127
102
  export declare function Multiply<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
package/core/clause.js CHANGED
@@ -623,10 +623,12 @@ exports.sensitiveValue = sensitiveValue;
623
623
  // see test in db_clause.test.ts
624
624
  // unclear best time to use this...
625
625
  function JSONObjectFieldKeyASJSON(col, field) {
626
+ // type as keyof T to make it easier to use in other queries
626
627
  return `${col}->'${field}'`;
627
628
  }
628
629
  exports.JSONObjectFieldKeyASJSON = JSONObjectFieldKeyASJSON;
629
630
  function JSONObjectFieldKeyAsText(col, field) {
631
+ // type as keyof T to make it easier to use in other queries
630
632
  return `${col}->>'${field}'`;
631
633
  }
632
634
  exports.JSONObjectFieldKeyAsText = JSONObjectFieldKeyAsText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowtop/ent",
3
- "version": "0.1.0-alpha117",
3
+ "version": "0.1.0-alpha118",
4
4
  "description": "snowtop ent framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",