myorm_pg 2.5.2 → 2.6.0

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 (60) hide show
  1. package/lib/Index.d.ts +32 -32
  2. package/lib/Index.js +53 -53
  3. package/lib/core/decorators/SchemasDecorators.d.ts +44 -44
  4. package/lib/core/decorators/SchemasDecorators.js +144 -144
  5. package/lib/core/decorators/SchemasDecorators.js.map +1 -1
  6. package/lib/core/design/Type.d.ts +38 -37
  7. package/lib/core/design/Type.d.ts.map +1 -1
  8. package/lib/core/design/Type.js +142 -137
  9. package/lib/core/design/Type.js.map +1 -1
  10. package/lib/core/enums/DBTypes.d.ts +18 -18
  11. package/lib/core/enums/DBTypes.js +22 -22
  12. package/lib/core/enums/DBTypes.js.map +1 -1
  13. package/lib/core/enums/RelationType.d.ts +6 -6
  14. package/lib/core/enums/RelationType.js +10 -10
  15. package/lib/core/enums/RelationType.js.map +1 -1
  16. package/lib/core/exceptions/ConnectionFailException.d.ts +4 -4
  17. package/lib/core/exceptions/ConnectionFailException.js +12 -12
  18. package/lib/core/exceptions/ConstraintFailException.d.ts +4 -4
  19. package/lib/core/exceptions/ConstraintFailException.js +12 -12
  20. package/lib/core/exceptions/Exception.d.ts +4 -4
  21. package/lib/core/exceptions/Exception.js +9 -9
  22. package/lib/core/exceptions/InvalidOperationException.d.ts +5 -5
  23. package/lib/core/exceptions/InvalidOperationException.js +13 -13
  24. package/lib/core/exceptions/NotImplementedException.d.ts +4 -4
  25. package/lib/core/exceptions/NotImplementedException.js +12 -12
  26. package/lib/core/exceptions/QueryFailException.d.ts +5 -5
  27. package/lib/core/exceptions/QueryFailException.js +13 -13
  28. package/lib/core/exceptions/TypeNotSuportedException.d.ts +4 -4
  29. package/lib/core/exceptions/TypeNotSuportedException.js +12 -12
  30. package/lib/core/objects/DBOperationLogHandler.d.ts +15 -15
  31. package/lib/core/objects/DBOperationLogHandler.js +16 -16
  32. package/lib/core/objects/DBOperationLogHandler.js.map +1 -1
  33. package/lib/core/objects/interfaces/IDBConnection.d.ts +13 -13
  34. package/lib/core/objects/interfaces/IDBConnection.js +2 -2
  35. package/lib/core/objects/interfaces/IDBContext.d.ts +41 -41
  36. package/lib/core/objects/interfaces/IDBContext.js +2 -2
  37. package/lib/core/objects/interfaces/IDBManager.d.ts +12 -12
  38. package/lib/core/objects/interfaces/IDBManager.js +2 -2
  39. package/lib/core/objects/interfaces/IDBSet.d.ts +38 -35
  40. package/lib/core/objects/interfaces/IDBSet.d.ts.map +1 -1
  41. package/lib/core/objects/interfaces/IDBSet.js +2 -2
  42. package/lib/core/objects/interfaces/IStatement.d.ts +16 -16
  43. package/lib/core/objects/interfaces/IStatement.js +15 -15
  44. package/lib/core/objects/interfaces/IStatement.js.map +1 -1
  45. package/lib/implementations/PGDBConnection.d.ts +18 -18
  46. package/lib/implementations/PGDBConnection.js +102 -102
  47. package/lib/implementations/PGDBContext.d.ts +55 -55
  48. package/lib/implementations/PGDBContext.js +298 -298
  49. package/lib/implementations/PGDBManager.d.ts +31 -31
  50. package/lib/implementations/PGDBManager.js +242 -242
  51. package/lib/implementations/PGDBSet.d.ts +52 -48
  52. package/lib/implementations/PGDBSet.d.ts.map +1 -1
  53. package/lib/implementations/PGDBSet.js +984 -928
  54. package/lib/implementations/PGDBSet.js.map +1 -1
  55. package/lib/implementations/PGFluentField.d.ts +17 -17
  56. package/lib/implementations/PGFluentField.js +153 -153
  57. package/lib/implementations/PGSetHelper.d.ts +18 -18
  58. package/lib/implementations/PGSetHelper.js +47 -47
  59. package/lib/implementations/PGSetHelper.js.map +1 -1
  60. package/package.json +1 -1
@@ -1,103 +1,103 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const pg_1 = __importDefault(require("pg"));
16
- const ConnectionFailException_1 = __importDefault(require("../core/exceptions/ConnectionFailException"));
17
- const QueryFailException_1 = __importDefault(require("../core/exceptions/QueryFailException"));
18
- class PGDBConnection {
19
- constructor(host, port, dababase, user, pass) {
20
- this.HostName = host;
21
- this.Port = port;
22
- this.DataBaseName = dababase;
23
- this._database = dababase;
24
- this.UserName = user;
25
- this.PassWord = pass;
26
- this.IsOpen = false;
27
- }
28
- AsPostgres() {
29
- this.DataBaseName = "postgres";
30
- return this;
31
- }
32
- Open() {
33
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
34
- if (this.IsOpen)
35
- yield this.Close();
36
- this._conn = new pg_1.default.Client({
37
- host: this.HostName,
38
- port: this.Port,
39
- database: this.DataBaseName,
40
- user: this.UserName,
41
- password: this.PassWord
42
- });
43
- this.DataBaseName = this._database;
44
- try {
45
- yield this._conn.connect();
46
- this.IsOpen = true;
47
- resolve();
48
- }
49
- catch (err) {
50
- reject(new ConnectionFailException_1.default(err.message));
51
- }
52
- }));
53
- }
54
- Query(query) {
55
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
56
- try {
57
- resolve(yield this._conn.query(query));
58
- }
59
- catch (err) {
60
- reject(new ConnectionFailException_1.default(err.message));
61
- }
62
- }));
63
- }
64
- Close() {
65
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
66
- try {
67
- yield this._conn.end();
68
- this.IsOpen = false;
69
- resolve();
70
- }
71
- catch (err) {
72
- reject(new ConnectionFailException_1.default(err.message));
73
- }
74
- }));
75
- }
76
- ExecuteNonQuery(query) {
77
- return __awaiter(this, void 0, void 0, function* () {
78
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
79
- try {
80
- yield this._conn.query(query);
81
- resolve();
82
- }
83
- catch (err) {
84
- reject(new QueryFailException_1.default(err.message, query));
85
- }
86
- }));
87
- });
88
- }
89
- Execute(query) {
90
- return __awaiter(this, void 0, void 0, function* () {
91
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
92
- try {
93
- resolve(yield this._conn.query(query));
94
- }
95
- catch (err) {
96
- reject(new QueryFailException_1.default(err.message, query));
97
- }
98
- }));
99
- });
100
- }
101
- }
102
- exports.default = PGDBConnection;
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const pg_1 = __importDefault(require("pg"));
16
+ const ConnectionFailException_1 = __importDefault(require("../core/exceptions/ConnectionFailException"));
17
+ const QueryFailException_1 = __importDefault(require("../core/exceptions/QueryFailException"));
18
+ class PGDBConnection {
19
+ constructor(host, port, dababase, user, pass) {
20
+ this.HostName = host;
21
+ this.Port = port;
22
+ this.DataBaseName = dababase;
23
+ this._database = dababase;
24
+ this.UserName = user;
25
+ this.PassWord = pass;
26
+ this.IsOpen = false;
27
+ }
28
+ AsPostgres() {
29
+ this.DataBaseName = "postgres";
30
+ return this;
31
+ }
32
+ Open() {
33
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
34
+ if (this.IsOpen)
35
+ yield this.Close();
36
+ this._conn = new pg_1.default.Client({
37
+ host: this.HostName,
38
+ port: this.Port,
39
+ database: this.DataBaseName,
40
+ user: this.UserName,
41
+ password: this.PassWord
42
+ });
43
+ this.DataBaseName = this._database;
44
+ try {
45
+ yield this._conn.connect();
46
+ this.IsOpen = true;
47
+ resolve();
48
+ }
49
+ catch (err) {
50
+ reject(new ConnectionFailException_1.default(err.message));
51
+ }
52
+ }));
53
+ }
54
+ Query(query) {
55
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
56
+ try {
57
+ resolve(yield this._conn.query(query));
58
+ }
59
+ catch (err) {
60
+ reject(new ConnectionFailException_1.default(err.message));
61
+ }
62
+ }));
63
+ }
64
+ Close() {
65
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
66
+ try {
67
+ yield this._conn.end();
68
+ this.IsOpen = false;
69
+ resolve();
70
+ }
71
+ catch (err) {
72
+ reject(new ConnectionFailException_1.default(err.message));
73
+ }
74
+ }));
75
+ }
76
+ ExecuteNonQuery(query) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
79
+ try {
80
+ yield this._conn.query(query);
81
+ resolve();
82
+ }
83
+ catch (err) {
84
+ reject(new QueryFailException_1.default(err.message, query));
85
+ }
86
+ }));
87
+ });
88
+ }
89
+ Execute(query) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
92
+ try {
93
+ resolve(yield this._conn.query(query));
94
+ }
95
+ catch (err) {
96
+ reject(new QueryFailException_1.default(err.message, query));
97
+ }
98
+ }));
99
+ });
100
+ }
101
+ }
102
+ exports.default = PGDBConnection;
103
103
  //# sourceMappingURL=PGDBConnection.js.map
@@ -1,56 +1,56 @@
1
- import IDBContext, { IThreeQueryableObject, IJoiningQuery, IJoinSelectable } from "../core/objects/interfaces/IDBContext";
2
- import IDBSet from "../core/objects/interfaces/IDBSet";
3
- import IStatement from "../core/objects/interfaces/IStatement";
4
- import PGDBManager from "./PGDBManager";
5
- export default abstract class PGDBContext implements IDBContext, IThreeQueryableObject {
6
- protected _manager: PGDBManager;
7
- private _mappedTypes;
8
- constructor(manager: PGDBManager);
9
- GetMappedTypes(): (new (...args: any[]) => unknown)[];
10
- IsMapped(type: {
11
- new (...args: any[]): unknown;
12
- }): boolean;
13
- Collection<T extends Object>(cTor: {
14
- new (...args: any[]): T;
15
- }): IDBSet<T> | undefined;
16
- UpdateDatabaseAsync(): Promise<void>;
17
- ExecuteNonQuery(query: string): Promise<void>;
18
- ExecuteQuery(query: string): Promise<any>;
19
- Join(...args: (new (...args: any[]) => Object)[]): IJoiningQuery;
20
- }
21
- export declare class JoiningQuery implements IJoiningQuery {
22
- private _context;
23
- private _stack;
24
- private _onStatements;
25
- constructor(context: PGDBContext, stack: (new (...args: any[]) => Object)[]);
26
- On<C extends Object, U extends Object>(cT: {
27
- new (...args: any[]): C;
28
- }, cKey: keyof C, uT: {
29
- new (...args: any[]): U;
30
- }, uKey: keyof U): IJoiningQuery;
31
- Where<C extends Object, K extends keyof C>(cT: new (...args: any[]) => C, statement: IStatement<C, K>): IJoiningQuery;
32
- And<C extends Object, K extends keyof C>(cT: new (...args: any[]) => C, statement: IStatement<C, K>): IJoiningQuery;
33
- Or<C extends Object, K extends keyof C>(cT: new (...args: any[]) => C, statement: IStatement<C, K>): IJoiningQuery;
34
- Select<C extends Object>(cT: new (...args: any[]) => C): IJoinSelectable<C>;
35
- private CheckIfTypeIsAllowed;
36
- }
37
- export declare class JoinSelectable<T extends Object> implements IJoinSelectable<T> {
38
- private _context;
39
- private _stack;
40
- private _onStatements;
41
- private _firstOrDefault;
42
- private _type;
43
- constructor(cT: new (...args: any[]) => T, context: PGDBContext, stack: IUnion[], onStack: [string, string][]);
44
- Join<K extends keyof T>(key: K): IJoinSelectable<T>;
45
- OrderBy<K extends keyof T>(key: K): IJoinSelectable<T>;
46
- OrderDescendingBy<K extends keyof T>(key: K): IJoinSelectable<T>;
47
- ToListAsync(): Promise<T[]>;
48
- FirstOrDefaultAsync(): Promise<T | undefined>;
49
- private Reset;
50
- }
51
- interface IUnion {
52
- Type: unknown;
53
- Key?: string;
54
- }
55
- export {};
1
+ import IDBContext, { IThreeQueryableObject, IJoiningQuery, IJoinSelectable } from "../core/objects/interfaces/IDBContext";
2
+ import IDBSet from "../core/objects/interfaces/IDBSet";
3
+ import IStatement from "../core/objects/interfaces/IStatement";
4
+ import PGDBManager from "./PGDBManager";
5
+ export default abstract class PGDBContext implements IDBContext, IThreeQueryableObject {
6
+ protected _manager: PGDBManager;
7
+ private _mappedTypes;
8
+ constructor(manager: PGDBManager);
9
+ GetMappedTypes(): (new (...args: any[]) => unknown)[];
10
+ IsMapped(type: {
11
+ new (...args: any[]): unknown;
12
+ }): boolean;
13
+ Collection<T extends Object>(cTor: {
14
+ new (...args: any[]): T;
15
+ }): IDBSet<T> | undefined;
16
+ UpdateDatabaseAsync(): Promise<void>;
17
+ ExecuteNonQuery(query: string): Promise<void>;
18
+ ExecuteQuery(query: string): Promise<any>;
19
+ Join(...args: (new (...args: any[]) => Object)[]): IJoiningQuery;
20
+ }
21
+ export declare class JoiningQuery implements IJoiningQuery {
22
+ private _context;
23
+ private _stack;
24
+ private _onStatements;
25
+ constructor(context: PGDBContext, stack: (new (...args: any[]) => Object)[]);
26
+ On<C extends Object, U extends Object>(cT: {
27
+ new (...args: any[]): C;
28
+ }, cKey: keyof C, uT: {
29
+ new (...args: any[]): U;
30
+ }, uKey: keyof U): IJoiningQuery;
31
+ Where<C extends Object, K extends keyof C>(cT: new (...args: any[]) => C, statement: IStatement<C, K>): IJoiningQuery;
32
+ And<C extends Object, K extends keyof C>(cT: new (...args: any[]) => C, statement: IStatement<C, K>): IJoiningQuery;
33
+ Or<C extends Object, K extends keyof C>(cT: new (...args: any[]) => C, statement: IStatement<C, K>): IJoiningQuery;
34
+ Select<C extends Object>(cT: new (...args: any[]) => C): IJoinSelectable<C>;
35
+ private CheckIfTypeIsAllowed;
36
+ }
37
+ export declare class JoinSelectable<T extends Object> implements IJoinSelectable<T> {
38
+ private _context;
39
+ private _stack;
40
+ private _onStatements;
41
+ private _firstOrDefault;
42
+ private _type;
43
+ constructor(cT: new (...args: any[]) => T, context: PGDBContext, stack: IUnion[], onStack: [string, string][]);
44
+ Join<K extends keyof T>(key: K): IJoinSelectable<T>;
45
+ OrderBy<K extends keyof T>(key: K): IJoinSelectable<T>;
46
+ OrderDescendingBy<K extends keyof T>(key: K): IJoinSelectable<T>;
47
+ ToListAsync(): Promise<T[]>;
48
+ FirstOrDefaultAsync(): Promise<T | undefined>;
49
+ private Reset;
50
+ }
51
+ interface IUnion {
52
+ Type: unknown;
53
+ Key?: string;
54
+ }
55
+ export {};
56
56
  //# sourceMappingURL=PGDBContext.d.ts.map