@snowtop/ent 0.1.19 → 0.1.21-test1
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/base.d.ts +3 -1
- package/core/clause.d.ts +50 -47
- package/core/clause.js +238 -149
- package/core/config.d.ts +1 -0
- package/core/context.js +1 -1
- package/core/ent.d.ts +2 -3
- package/core/ent.js +27 -17
- package/core/query/custom_clause_query.d.ts +5 -2
- package/core/query/custom_clause_query.js +30 -4
- package/core/query/custom_query.js +1 -0
- package/core/query/query.d.ts +12 -6
- package/core/query/query.js +125 -29
- package/core/query/shared_test.js +20 -7
- package/core/query_impl.d.ts +7 -1
- package/core/query_impl.js +30 -13
- package/graphql/query/shared_edge_connection.js +3 -6
- package/package.json +2 -2
- package/scripts/fix_action_exports.d.ts +1 -0
- package/scripts/fix_action_exports.js +75 -0
- package/testutils/builder.d.ts +12 -1
- package/testutils/builder.js +35 -2
- package/testutils/db/temp_db.js +1 -1
- package/tsc/ast.d.ts +4 -1
- package/tsc/ast.js +6 -2
- package/tsc/transform.js +1 -1
package/core/base.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ export interface DataOptions {
|
|
|
68
68
|
}
|
|
69
69
|
export interface SelectBaseDataOptions extends DataOptions {
|
|
70
70
|
fields: string[];
|
|
71
|
+
fieldsAlias?: string;
|
|
72
|
+
disableFieldsAlias?: boolean;
|
|
71
73
|
}
|
|
72
74
|
export interface SelectDataOptions extends SelectBaseDataOptions {
|
|
73
75
|
key: string;
|
|
@@ -88,7 +90,7 @@ export interface QueryDataOptions<T extends Data = Data, K = keyof T> {
|
|
|
88
90
|
groupby?: K;
|
|
89
91
|
limit?: number;
|
|
90
92
|
disableTransformations?: boolean;
|
|
91
|
-
join?: JoinOptions;
|
|
93
|
+
join?: JoinOptions[];
|
|
92
94
|
}
|
|
93
95
|
export interface LoadRowOptions extends QueryableDataOptions {
|
|
94
96
|
}
|
package/core/clause.d.ts
CHANGED
|
@@ -16,9 +16,10 @@ export declare class inClause<T extends Data, K = keyof T> implements Clause<T,
|
|
|
16
16
|
private col;
|
|
17
17
|
private value;
|
|
18
18
|
private type;
|
|
19
|
+
private overrideAlias?;
|
|
19
20
|
protected op: InClauseOperator;
|
|
20
21
|
static getPostgresInClauseValuesThreshold(): number;
|
|
21
|
-
constructor(col: K, value: any[], type?: string);
|
|
22
|
+
constructor(col: K, value: any[], type?: string, overrideAlias?: string | undefined);
|
|
22
23
|
clause(idx: number, alias?: string): string;
|
|
23
24
|
columns(): K[];
|
|
24
25
|
values(): any[];
|
|
@@ -33,37 +34,37 @@ export declare class notInClause<T extends Data, K = keyof T> extends inClause<T
|
|
|
33
34
|
* only works with postgres gin indexes
|
|
34
35
|
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
35
36
|
*/
|
|
36
|
-
export declare function PostgresArrayContainsValue<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
|
|
37
|
+
export declare function PostgresArrayContainsValue<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
37
38
|
/**
|
|
38
39
|
* creates a clause to determine if every item in the list is stored in the array stored in the column in the db
|
|
39
40
|
* only works with postgres gin indexes
|
|
40
41
|
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
41
42
|
*/
|
|
42
|
-
export declare function PostgresArrayContains<T extends Data, K = keyof T>(col: K, value: any[]): Clause<T, K>;
|
|
43
|
+
export declare function PostgresArrayContains<T extends Data, K = keyof T>(col: K, value: any[], overrideAlias?: string): Clause<T, K>;
|
|
43
44
|
/**
|
|
44
45
|
* creates a clause to determine if the given value is NOT contained in the array stored in the column in the db
|
|
45
46
|
* only works with postgres gin indexes
|
|
46
47
|
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
47
48
|
*/
|
|
48
|
-
export declare function PostgresArrayNotContainsValue<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
|
|
49
|
+
export declare function PostgresArrayNotContainsValue<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
49
50
|
/**
|
|
50
51
|
* creates a clause to determine if every item in the list is NOT stored in the array stored in the column in the db
|
|
51
52
|
* only works with postgres gin indexes
|
|
52
53
|
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
53
54
|
*/
|
|
54
|
-
export declare function PostgresArrayNotContains<T extends Data, K = keyof T>(col: K, value: any[]): Clause<T, K>;
|
|
55
|
+
export declare function PostgresArrayNotContains<T extends Data, K = keyof T>(col: K, value: any[], overrideAlias?: string): Clause<T, K>;
|
|
55
56
|
/**
|
|
56
57
|
* creates a clause to determine if the arrays overlap, that is, do they have any elements in common
|
|
57
58
|
* only works with postgres gin indexes
|
|
58
59
|
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
59
60
|
*/
|
|
60
|
-
export declare function PostgresArrayOverlaps<T extends Data, K = keyof T>(col: K, value: any[]): Clause<T, K>;
|
|
61
|
+
export declare function PostgresArrayOverlaps<T extends Data, K = keyof T>(col: K, value: any[], overrideAlias?: string): Clause<T, K>;
|
|
61
62
|
/**
|
|
62
63
|
* creates a clause to determine if the arrays do not overlap, that is, do they have any elements in common
|
|
63
64
|
* only works with postgres gin indexes
|
|
64
65
|
* https://www.postgresql.org/docs/current/indexes-types.html#INDEXES-TYPES-GIN
|
|
65
66
|
*/
|
|
66
|
-
export declare function PostgresArrayNotOverlaps<T extends Data, K = keyof T>(col: K, value: any[]): Clause<T, K>;
|
|
67
|
+
export declare function PostgresArrayNotOverlaps<T extends Data, K = keyof T>(col: K, value: any[], overrideAlias?: string): Clause<T, K>;
|
|
67
68
|
/**
|
|
68
69
|
* @deprecated use PostgresArrayContainsValue
|
|
69
70
|
*/
|
|
@@ -72,18 +73,18 @@ export declare function ArrayEq<T extends Data, K = keyof T>(col: K, value: any)
|
|
|
72
73
|
* @deprecated use PostgresNotArrayContains
|
|
73
74
|
*/
|
|
74
75
|
export declare function ArrayNotEq<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
|
|
75
|
-
export declare function Eq<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
|
|
76
|
-
export declare function StartsWith<T extends Data, K = keyof T>(col: K, value: string): Clause<T, K>;
|
|
77
|
-
export declare function EndsWith<T extends Data, K = keyof T>(col: K, value: string): Clause<T, K>;
|
|
78
|
-
export declare function Contains<T extends Data, K = keyof T>(col: K, value: string): Clause<T, K>;
|
|
79
|
-
export declare function StartsWithIgnoreCase<T extends Data, K = keyof T>(col: K, value: string): Clause<T, K>;
|
|
80
|
-
export declare function EndsWithIgnoreCase<T extends Data, K = keyof T>(col: K, value: string): Clause<T, K>;
|
|
81
|
-
export declare function ContainsIgnoreCase<T extends Data, K = keyof T>(col: K, value: string): Clause<T, K>;
|
|
82
|
-
export declare function NotEq<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
|
|
83
|
-
export declare function Greater<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
|
|
84
|
-
export declare function Less<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
|
|
85
|
-
export declare function GreaterEq<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
|
|
86
|
-
export declare function LessEq<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
|
|
76
|
+
export declare function Eq<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
77
|
+
export declare function StartsWith<T extends Data, K = keyof T>(col: K, value: string, overrideAlias?: string): Clause<T, K>;
|
|
78
|
+
export declare function EndsWith<T extends Data, K = keyof T>(col: K, value: string, overrideAlias?: string): Clause<T, K>;
|
|
79
|
+
export declare function Contains<T extends Data, K = keyof T>(col: K, value: string, overrideAlias?: string): Clause<T, K>;
|
|
80
|
+
export declare function StartsWithIgnoreCase<T extends Data, K = keyof T>(col: K, value: string, overrideAlias?: string): Clause<T, K>;
|
|
81
|
+
export declare function EndsWithIgnoreCase<T extends Data, K = keyof T>(col: K, value: string, overrideAlias?: string): Clause<T, K>;
|
|
82
|
+
export declare function ContainsIgnoreCase<T extends Data, K = keyof T>(col: K, value: string, overrideAlias?: string): Clause<T, K>;
|
|
83
|
+
export declare function NotEq<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
84
|
+
export declare function Greater<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
85
|
+
export declare function Less<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
86
|
+
export declare function GreaterEq<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
87
|
+
export declare function LessEq<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
87
88
|
export declare function And<T extends Data, K = keyof T>(...args: Clause<T, K>[]): Clause<T, K>;
|
|
88
89
|
export declare function AndOptional<T extends Data, K = keyof T>(...args: (Clause<T, K> | undefined)[]): Clause<T, K>;
|
|
89
90
|
export declare function Or<T extends Data, K = keyof T>(...args: Clause<T, K>[]): Clause<T, K>;
|
|
@@ -96,40 +97,42 @@ export declare function In<T extends Data, K = keyof T>(col: K, ...values: any):
|
|
|
96
97
|
* @deprecated use UUidIn, TextIn, IntegerIn, or TypeIn
|
|
97
98
|
*/
|
|
98
99
|
export declare function In<T extends Data, K = keyof T>(col: K, values: any[], type?: string): Clause<T, K>;
|
|
99
|
-
export declare function UuidIn<T extends Data, K = keyof T>(col: K, values: ID[]): Clause<T, K>;
|
|
100
|
-
export declare function IntegerIn<T extends Data, K = keyof T>(col: K, values: number[]): Clause<T, K>;
|
|
101
|
-
export declare function TextIn<T extends Data, K = keyof T>(col: K, values: any[]): Clause<T, K>;
|
|
102
|
-
export declare function DBTypeIn<T extends Data, K = keyof T>(col: K, values: any[], typ: string): Clause<T, K>;
|
|
103
|
-
export declare function UuidNotIn<T extends Data, K = keyof T>(col: K, values: ID[]): Clause<T, K>;
|
|
104
|
-
export declare function IntegerNotIn<T extends Data, K = keyof T>(col: K, values: number[]): Clause<T, K>;
|
|
105
|
-
export declare function TextNotIn<T extends Data, K = keyof T>(col: K, values: any[]): Clause<T, K>;
|
|
106
|
-
export declare function DBTypeNotIn<T extends Data, K = keyof T>(col: K, values: any[], typ: string): Clause<T, K>;
|
|
100
|
+
export declare function UuidIn<T extends Data, K = keyof T>(col: K, values: ID[], overrideAlias?: string): Clause<T, K>;
|
|
101
|
+
export declare function IntegerIn<T extends Data, K = keyof T>(col: K, values: number[], overrideAlias?: string): Clause<T, K>;
|
|
102
|
+
export declare function TextIn<T extends Data, K = keyof T>(col: K, values: any[], overrideAlias?: string): Clause<T, K>;
|
|
103
|
+
export declare function DBTypeIn<T extends Data, K = keyof T>(col: K, values: any[], typ: string, overrideAlias?: string): Clause<T, K>;
|
|
104
|
+
export declare function UuidNotIn<T extends Data, K = keyof T>(col: K, values: ID[], overrideAlias?: string): Clause<T, K>;
|
|
105
|
+
export declare function IntegerNotIn<T extends Data, K = keyof T>(col: K, values: number[], overrideAlias?: string): Clause<T, K>;
|
|
106
|
+
export declare function TextNotIn<T extends Data, K = keyof T>(col: K, values: any[], overrideAlias?: string): Clause<T, K>;
|
|
107
|
+
export declare function DBTypeNotIn<T extends Data, K = keyof T>(col: K, values: any[], typ: string, overrideAlias?: string): Clause<T, K>;
|
|
107
108
|
interface TsQuery {
|
|
108
109
|
language: "english" | "french" | "german" | "simple";
|
|
109
110
|
value: string;
|
|
110
111
|
}
|
|
111
|
-
export declare function TsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
|
|
112
|
-
export declare function PlainToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
|
|
113
|
-
export declare function PhraseToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
|
|
114
|
-
export declare function WebsearchToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
|
|
115
|
-
export declare function TsVectorColTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
|
|
116
|
-
export declare function TsVectorPlainToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
|
|
117
|
-
export declare function TsVectorPhraseToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
|
|
118
|
-
export declare function TsVectorWebsearchToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery): Clause<T, K>;
|
|
112
|
+
export declare function TsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery, overrideAlias?: string): Clause<T, K>;
|
|
113
|
+
export declare function PlainToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery, overrideAlias?: string): Clause<T, K>;
|
|
114
|
+
export declare function PhraseToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery, overrideAlias?: string): Clause<T, K>;
|
|
115
|
+
export declare function WebsearchToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery, overrideAlias?: string): Clause<T, K>;
|
|
116
|
+
export declare function TsVectorColTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery, overrideAlias?: string): Clause<T, K>;
|
|
117
|
+
export declare function TsVectorPlainToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery, overrideAlias?: string): Clause<T, K>;
|
|
118
|
+
export declare function TsVectorPhraseToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery, overrideAlias?: string): Clause<T, K>;
|
|
119
|
+
export declare function TsVectorWebsearchToTsQuery<T extends Data, K = keyof T>(col: K, val: string | TsQuery, overrideAlias?: string): Clause<T, K>;
|
|
119
120
|
export declare function sensitiveValue(val: any): SensitiveValue;
|
|
120
|
-
export declare function JSONObjectFieldKeyASJSON<T extends Data, K = keyof T>(col: K, field: string): keyof T;
|
|
121
|
-
export declare function JSONObjectFieldKeyAsText<T extends Data, K = keyof T>(col: K, field: string): keyof T;
|
|
121
|
+
export declare function JSONObjectFieldKeyASJSON<T extends Data, K = keyof T>(col: K, field: string, overrideAlias?: string): keyof T;
|
|
122
|
+
export declare function JSONObjectFieldKeyAsText<T extends Data, K = keyof T>(col: K, field: string, overrideAlias?: string): keyof T;
|
|
122
123
|
type predicate = "==" | ">" | "<" | "!=" | ">=" | "<=";
|
|
123
|
-
export declare function JSONPathValuePredicate<T extends Data, K = keyof T>(dbCol: K, path: string, val: any, pred: predicate): Clause<T, K>;
|
|
124
|
-
export declare function JSONKeyExists<T extends Data, K = keyof T>(dbCol: K, val: any): Clause<T, K>;
|
|
125
|
-
export declare function JSONBKeyInList<T extends Data, K = keyof T>(dbCol: K, jsonCol: string, val: any): Clause<T, K>;
|
|
126
|
-
export declare function JSONKeyInList<T extends Data, K = keyof T>(dbCol: K, jsonCol: string, val: any): Clause<T, K>;
|
|
127
|
-
export declare function PaginationMultipleColsSubQuery<T extends Data, K = keyof T>(col: K, op: string, tableName: string, uniqueCol: K, val: any): Clause<T, K>;
|
|
128
|
-
export declare function
|
|
129
|
-
|
|
130
|
-
export declare function
|
|
131
|
-
export declare function
|
|
132
|
-
export declare function
|
|
124
|
+
export declare function JSONPathValuePredicate<T extends Data, K = keyof T>(dbCol: K, path: string, val: any, pred: predicate, overrideAlias?: string): Clause<T, K>;
|
|
125
|
+
export declare function JSONKeyExists<T extends Data, K = keyof T>(dbCol: K, val: any, overrideAlias?: string): Clause<T, K>;
|
|
126
|
+
export declare function JSONBKeyInList<T extends Data, K = keyof T>(dbCol: K, jsonCol: string, val: any, overrideAlias?: string): Clause<T, K>;
|
|
127
|
+
export declare function JSONKeyInList<T extends Data, K = keyof T>(dbCol: K, jsonCol: string, val: any, overrideAlias?: string): Clause<T, K>;
|
|
128
|
+
export declare function PaginationMultipleColsSubQuery<T extends Data, K = keyof T>(col: K, op: string, tableName: string, uniqueCol: K, val: any, overrideAlias?: string): Clause<T, K>;
|
|
129
|
+
export declare function PaginationMultipleColsQuery<T extends Data, K = keyof T>(sortCol: K, cursorCol: K, less: boolean, // if true, <, if false, >
|
|
130
|
+
sortValue: any, cursorValue: any, overrideAlias?: string): Clause<T, K>;
|
|
131
|
+
export declare function Add<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
132
|
+
export declare function Subtract<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
133
|
+
export declare function Multiply<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
134
|
+
export declare function Divide<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
135
|
+
export declare function Modulo<T extends Data, K = keyof T>(col: K, value: any, overrideAlias?: string): Clause<T, K>;
|
|
133
136
|
export declare function getCombinedClause<V extends Data = Data, K = keyof V>(options: Pick<SelectDataOptions, "clause">, cls: Clause<V, K>, checkIntersection?: boolean): Clause<V, K>;
|
|
134
137
|
export declare function getCombinedClause<V extends Data = Data, K = keyof V>(options: Pick<SelectDataOptions, "clause">, cls: Clause<V, K> | undefined, checkIntersection?: boolean): Clause<V, K> | undefined;
|
|
135
138
|
export declare function Expression<T extends Data, K = keyof T>(expression: string): Clause<T, K>;
|