@steedos/odata-v4-typeorm 1.20.0 → 2.2.27
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/LICENSE +21 -21
- package/README.md +125 -125
- package/config/default.json +6 -6
- package/{build/lib → lib}/createFilter.d.ts +13 -13
- package/{build/lib → lib}/createFilter.js +17 -15
- package/lib/createFilter.js.map +1 -0
- package/{build/lib → lib}/createQuery.d.ts +13 -13
- package/{build/lib → lib}/createQuery.js +14 -12
- package/lib/createQuery.js.map +1 -0
- package/{build/lib → lib}/executeQuery.d.ts +5 -5
- package/{build/lib → lib}/executeQuery.js +277 -268
- package/lib/executeQuery.js.map +1 -0
- package/{build/lib → lib}/index.d.ts +6 -6
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -0
- package/{build/lib → lib}/odataQueryMiddleware.d.ts +3 -3
- package/{build/lib → lib}/odataQueryMiddleware.js +29 -26
- package/lib/odataQueryMiddleware.js.map +1 -0
- package/{build/lib → lib}/sqlOptions.d.ts +7 -7
- package/lib/sqlOptions.js +3 -0
- package/{build/lib → lib}/sqlOptions.js.map +1 -1
- package/{build/lib → lib}/visitor.d.ts +20 -20
- package/{build/lib → lib}/visitor.js +308 -302
- package/lib/visitor.js.map +1 -0
- package/package.json +40 -52
- package/src/{lib/createFilter.ts → createFilter.ts} +26 -26
- package/src/{lib/createQuery.ts → createQuery.ts} +22 -22
- package/src/{lib/executeQuery.ts → executeQuery.ts} +291 -282
- package/src/{lib/index.ts → index.ts} +6 -6
- package/src/{lib/odataQueryMiddleware.ts → odataQueryMiddleware.ts} +17 -17
- package/src/{lib/sqlOptions.ts → sqlOptions.ts} +7 -7
- package/src/{lib/visitor.ts → visitor.ts} +301 -298
- package/tsconfig.json +11 -10
- package/build/example/sql.d.ts +0 -0
- package/build/example/sql.js +0 -131
- package/build/example/sql.js.map +0 -1
- package/build/lib/createFilter.js.map +0 -1
- package/build/lib/createQuery.js.map +0 -1
- package/build/lib/executeQuery.js.map +0 -1
- package/build/lib/index.js +0 -12
- package/build/lib/index.js.map +0 -1
- package/build/lib/odataQueryMiddleware.js.map +0 -1
- package/build/lib/sqlOptions.js +0 -2
- package/build/lib/visitor.js.map +0 -1
- package/src/example/sql.ts +0 -82
- package/src/example/world.sql +0 -5388
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
return
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
function
|
|
7
|
-
step(
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
exports
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.executeQuery = exports.odataQuery = void 0;
|
|
13
|
+
const executeQuery_1 = require("./executeQuery");
|
|
14
|
+
Object.defineProperty(exports, "executeQuery", { enumerable: true, get: function () { return executeQuery_1.executeQuery; } });
|
|
15
|
+
function odataQuery(repositoryOrQueryBuilder) {
|
|
16
|
+
return (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
const alias = '';
|
|
19
|
+
const result = yield (0, executeQuery_1.executeQuery)(repositoryOrQueryBuilder, req.query, { alias });
|
|
20
|
+
return res.status(200).json(result);
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
console.log('ODATA ERROR', e);
|
|
24
|
+
res.status(500).json({ message: 'Internal server error.', error: { message: e.message } });
|
|
25
|
+
}
|
|
26
|
+
return next();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.odataQuery = odataQuery;
|
|
27
30
|
//# sourceMappingURL=odataQueryMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odataQueryMiddleware.js","sourceRoot":"","sources":["../src/odataQueryMiddleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA4C;AAiBxB,6FAjBZ,2BAAY,OAiBY;AAfhC,SAAS,UAAU,CAAC,wBAA6B;IAC/C,OAAO,CAAO,GAAQ,EAAE,GAAQ,EAAE,IAAI,EAAE,EAAE;QACxC,IAAI;YACF,MAAM,KAAK,GAAG,EAAE,CAAC;YAEjB,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAY,EAAC,wBAAwB,EAAE,GAAG,CAAC,KAAK,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC;YAChF,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACrC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,aAAa,EAAC,CAAC,CAAC,CAAC;YAC7B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAC,OAAO,EAAE,wBAAwB,EAAE,KAAK,EAAE,EAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAC,EAAC,CAAC,CAAC;SACxF;QACD,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC,CAAA,CAAA;AACH,CAAC;AAEO,gCAAU"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SQLLang } from 'odata-v4-sql';
|
|
2
|
-
export interface SqlOptions {
|
|
3
|
-
useParameters?: boolean;
|
|
4
|
-
type?: SQLLang;
|
|
5
|
-
alias: string;
|
|
6
|
-
version?: string;
|
|
7
|
-
}
|
|
1
|
+
import { SQLLang } from 'odata-v4-sql';
|
|
2
|
+
export interface SqlOptions {
|
|
3
|
+
useParameters?: boolean;
|
|
4
|
+
type?: SQLLang;
|
|
5
|
+
alias: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlOptions.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"sqlOptions.js","sourceRoot":"","sources":["../src/sqlOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Token } from 'odata-v4-parser/lib/lexer';
|
|
2
|
-
import { Visitor } from 'odata-v4-sql/lib/visitor';
|
|
3
|
-
export declare class TypeOrmVisitor extends Visitor {
|
|
4
|
-
includes: TypeOrmVisitor[];
|
|
5
|
-
alias: string;
|
|
6
|
-
constructor(options: any);
|
|
7
|
-
from(table: string): string;
|
|
8
|
-
asMsSql(): this;
|
|
9
|
-
asPostgreSql(): this;
|
|
10
|
-
asType(): this;
|
|
11
|
-
protected VisitExpand(node: Token, context: any): void;
|
|
12
|
-
protected VisitSelectItem(node: Token, context: any): void;
|
|
13
|
-
protected VisitODataIdentifier(node: Token, context: any): void;
|
|
14
|
-
private getIdentifier
|
|
15
|
-
protected VisitEqualsExpression(node: Token, context: any): void;
|
|
16
|
-
protected VisitNotEqualsExpression(node: Token, context: any): void;
|
|
17
|
-
protected VisitLiteral(node: Token, context: any): void;
|
|
18
|
-
protected VisitNotExpression(node: Token, context: any): void;
|
|
19
|
-
protected VisitMethodCallExpression(node: Token, context: any): void;
|
|
20
|
-
}
|
|
1
|
+
import { Token } from 'odata-v4-parser/lib/lexer';
|
|
2
|
+
import { Visitor } from 'odata-v4-sql/lib/visitor';
|
|
3
|
+
export declare class TypeOrmVisitor extends Visitor {
|
|
4
|
+
includes: TypeOrmVisitor[];
|
|
5
|
+
alias: string;
|
|
6
|
+
constructor(options: any);
|
|
7
|
+
from(table: string): string;
|
|
8
|
+
asMsSql(): this;
|
|
9
|
+
asPostgreSql(): this;
|
|
10
|
+
asType(): this;
|
|
11
|
+
protected VisitExpand(node: Token, context: any): void;
|
|
12
|
+
protected VisitSelectItem(node: Token, context: any): void;
|
|
13
|
+
protected VisitODataIdentifier(node: Token, context: any): void;
|
|
14
|
+
private getIdentifier;
|
|
15
|
+
protected VisitEqualsExpression(node: Token, context: any): void;
|
|
16
|
+
protected VisitNotEqualsExpression(node: Token, context: any): void;
|
|
17
|
+
protected VisitLiteral(node: Token, context: any): void;
|
|
18
|
+
protected VisitNotExpression(node: Token, context: any): void;
|
|
19
|
+
protected VisitMethodCallExpression(node: Token, context: any): void;
|
|
20
|
+
}
|