Skip to content

Commit 0dbd9a2

Browse files
committed
Cleanup
1 parent f9a4427 commit 0dbd9a2

File tree

6 files changed

+36
-11
lines changed

6 files changed

+36
-11
lines changed

lib/PromiseExprEvaluator.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,9 @@ class PromiseExprEvaluator {
886886
return parseFloat(values[0]);
887887
}
888888
return null;
889+
case "within":
890+
console.warn("Within operation not supported");
891+
throw new Error(`Within operator not supported`);
889892
default:
890893
throw new Error(`Unknown op ${op}`);
891894
}

lib/types.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,30 @@ export interface ScalarExpr {
111111
/** Expression from final table to get value */
112112
expr: Expr;
113113
}
114+
/** @deprecated */
114115
export declare type LegacyExpr = LegacyComparisonExpr | LegacyLogicalExpr | LegacyCountExpr;
116+
/** @deprecated */
115117
export interface LegacyComparisonExpr {
116118
type: "comparison";
117119
op: string;
118120
table: string;
119121
lhs: Expr;
120122
rhs: Expr;
121123
}
124+
/** @deprecated */
122125
export interface LegacyLogicalExpr {
123126
type: "logical";
124127
op: string;
125128
table: string;
126129
exprs: Expr[];
127130
}
131+
/** @deprecated */
128132
export interface LegacyCountExpr {
129133
type: "count";
130134
table: string;
131135
}
132136
export declare type AggrStatus = "individual" | "literal" | "aggregate";
133-
/** a row is a plain object that has the following functions as properties */
137+
/** Row is a plain object that has the following functions as properties */
134138
export interface ExprEvaluatorRow {
135139
/** gets primary key of row. callback is called with (error, value) */
136140
getPrimaryKey(callback: (error: any, value?: any) => void): void;
@@ -139,12 +143,14 @@ export interface ExprEvaluatorRow {
139143
*/
140144
getField(columnId: string, callback: (error: any, value?: any) => void): void;
141145
}
146+
/** Context to evaluate an expression using the PromiseExprEvalutator */
142147
export interface ExprEvaluatorContext {
143148
/** current row. Optional for aggr expressions */
144149
row?: ExprEvaluatorRow;
145150
/** array of rows (for aggregate expressions) */
146151
rows?: ExprEvaluatorRow[];
147152
}
153+
/** Single table in a schema */
148154
export interface Table {
149155
id: string;
150156
/** localized name of table */

package-lock.json

Lines changed: 12 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"jsonql": "github:mWater/jsonql",
3030
"lodash": "^3.10.1",
3131
"lru-cache": "^7.14.0",
32-
"moment": "^2.29.4"
32+
"moment": "^2.29.4",
33+
"querystring": "^0.2.1"
3334
},
3435
"devDependencies": {
3536
"@types/chai": "^4.3.3",
@@ -40,6 +41,7 @@
4041
"canonical-json": "0.0.4",
4142
"chai": "^4.3.6",
4243
"husky": "^8.0.1",
43-
"sinon": "^14.0.0"
44+
"sinon": "^14.0.0",
45+
"typescript": "^4.8.4"
4446
}
4547
}

src/PromiseExprEvaluator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,9 @@ export class PromiseExprEvaluator {
10071007
return parseFloat(values[0])
10081008
}
10091009
return null
1010+
case "within":
1011+
console.warn("Within operation not supported")
1012+
throw new Error(`Within operator not supported`)
10101013
default:
10111014
throw new Error(`Unknown op ${op}`)
10121015
}

src/types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ export interface ScalarExpr {
146146
expr: Expr
147147
}
148148

149+
/** @deprecated */
149150
export type LegacyExpr = LegacyComparisonExpr | LegacyLogicalExpr | LegacyCountExpr
150151

152+
/** @deprecated */
151153
export interface LegacyComparisonExpr {
152154
type: "comparison"
153155
op: string
@@ -156,21 +158,23 @@ export interface LegacyComparisonExpr {
156158
rhs: Expr
157159
}
158160

161+
/** @deprecated */
159162
export interface LegacyLogicalExpr {
160163
type: "logical"
161164
op: string
162165
table: string
163166
exprs: Expr[]
164167
}
165168

169+
/** @deprecated */
166170
export interface LegacyCountExpr {
167171
type: "count"
168172
table: string
169173
}
170174

171175
export type AggrStatus = "individual" | "literal" | "aggregate"
172176

173-
/** a row is a plain object that has the following functions as properties */
177+
/** Row is a plain object that has the following functions as properties */
174178
export interface ExprEvaluatorRow {
175179
/** gets primary key of row. callback is called with (error, value) */
176180
getPrimaryKey(callback: (error: any, value?: any) => void): void
@@ -181,13 +185,15 @@ export interface ExprEvaluatorRow {
181185
getField(columnId: string, callback: (error: any, value?: any) => void): void
182186
}
183187

188+
/** Context to evaluate an expression using the PromiseExprEvalutator */
184189
export interface ExprEvaluatorContext {
185190
/** current row. Optional for aggr expressions */
186191
row?: ExprEvaluatorRow
187192
/** array of rows (for aggregate expressions) */
188193
rows?: ExprEvaluatorRow[]
189194
}
190195

196+
/** Single table in a schema */
191197
export interface Table {
192198
id: string
193199

0 commit comments

Comments
 (0)