@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.
Files changed (46) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +125 -125
  3. package/config/default.json +6 -6
  4. package/{build/lib → lib}/createFilter.d.ts +13 -13
  5. package/{build/lib → lib}/createFilter.js +17 -15
  6. package/lib/createFilter.js.map +1 -0
  7. package/{build/lib → lib}/createQuery.d.ts +13 -13
  8. package/{build/lib → lib}/createQuery.js +14 -12
  9. package/lib/createQuery.js.map +1 -0
  10. package/{build/lib → lib}/executeQuery.d.ts +5 -5
  11. package/{build/lib → lib}/executeQuery.js +277 -268
  12. package/lib/executeQuery.js.map +1 -0
  13. package/{build/lib → lib}/index.d.ts +6 -6
  14. package/lib/index.js +14 -0
  15. package/lib/index.js.map +1 -0
  16. package/{build/lib → lib}/odataQueryMiddleware.d.ts +3 -3
  17. package/{build/lib → lib}/odataQueryMiddleware.js +29 -26
  18. package/lib/odataQueryMiddleware.js.map +1 -0
  19. package/{build/lib → lib}/sqlOptions.d.ts +7 -7
  20. package/lib/sqlOptions.js +3 -0
  21. package/{build/lib → lib}/sqlOptions.js.map +1 -1
  22. package/{build/lib → lib}/visitor.d.ts +20 -20
  23. package/{build/lib → lib}/visitor.js +308 -302
  24. package/lib/visitor.js.map +1 -0
  25. package/package.json +40 -52
  26. package/src/{lib/createFilter.ts → createFilter.ts} +26 -26
  27. package/src/{lib/createQuery.ts → createQuery.ts} +22 -22
  28. package/src/{lib/executeQuery.ts → executeQuery.ts} +291 -282
  29. package/src/{lib/index.ts → index.ts} +6 -6
  30. package/src/{lib/odataQueryMiddleware.ts → odataQueryMiddleware.ts} +17 -17
  31. package/src/{lib/sqlOptions.ts → sqlOptions.ts} +7 -7
  32. package/src/{lib/visitor.ts → visitor.ts} +301 -298
  33. package/tsconfig.json +11 -10
  34. package/build/example/sql.d.ts +0 -0
  35. package/build/example/sql.js +0 -131
  36. package/build/example/sql.js.map +0 -1
  37. package/build/lib/createFilter.js.map +0 -1
  38. package/build/lib/createQuery.js.map +0 -1
  39. package/build/lib/executeQuery.js.map +0 -1
  40. package/build/lib/index.js +0 -12
  41. package/build/lib/index.js.map +0 -1
  42. package/build/lib/odataQueryMiddleware.js.map +0 -1
  43. package/build/lib/sqlOptions.js +0 -2
  44. package/build/lib/visitor.js.map +0 -1
  45. package/src/example/sql.ts +0 -82
  46. 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 new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments)).next());
8
- });
9
- };
10
- const executeQuery_1 = require("./executeQuery");
11
- exports.executeQuery = executeQuery_1.executeQuery;
12
- function odataQuery(repositoryOrQueryBuilder) {
13
- return (req, res, next) => __awaiter(this, void 0, void 0, function* () {
14
- try {
15
- const alias = '';
16
- const result = yield executeQuery_1.executeQuery(repositoryOrQueryBuilder, req.query, { alias });
17
- return res.status(200).json(result);
18
- }
19
- catch (e) {
20
- console.log('ODATA ERROR', e);
21
- res.status(500).json({ message: 'Internal server error.', error: { message: e.message } });
22
- }
23
- return next();
24
- });
25
- }
26
- exports.odataQuery = odataQuery;
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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=sqlOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqlOptions.js","sourceRoot":"","sources":["../../src/lib/sqlOptions.ts"],"names":[],"mappings":""}
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(originalIdentifier, context);
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
+ }