@hedhog/pagination 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/databases/abstract.database.d.ts +61 -0
  2. package/dist/databases/abstract.database.d.ts.map +1 -0
  3. package/dist/databases/abstract.database.js +643 -0
  4. package/dist/databases/abstract.database.js.map +1 -0
  5. package/dist/databases/database.d.ts +5 -0
  6. package/dist/databases/database.d.ts.map +1 -0
  7. package/dist/databases/database.factory.d.ts +7 -0
  8. package/dist/databases/database.factory.d.ts.map +1 -0
  9. package/dist/databases/database.factory.js +44 -0
  10. package/dist/databases/database.factory.js.map +1 -0
  11. package/dist/databases/database.js +9 -0
  12. package/dist/databases/database.js.map +1 -0
  13. package/dist/databases/index.d.ts +4 -0
  14. package/dist/databases/index.d.ts.map +1 -0
  15. package/dist/databases/index.js +20 -0
  16. package/dist/databases/index.js.map +1 -0
  17. package/dist/databases/mysql.database.d.ts +10 -0
  18. package/dist/databases/mysql.database.d.ts.map +1 -0
  19. package/dist/databases/mysql.database.js +17 -0
  20. package/dist/databases/mysql.database.js.map +1 -0
  21. package/dist/databases/postgres.database.d.ts +10 -0
  22. package/dist/databases/postgres.database.d.ts.map +1 -0
  23. package/dist/databases/postgres.database.js +17 -0
  24. package/dist/databases/postgres.database.js.map +1 -0
  25. package/dist/pagination.service.d.ts +16 -2
  26. package/dist/pagination.service.d.ts.map +1 -1
  27. package/dist/pagination.service.js +131 -5
  28. package/dist/pagination.service.js.map +1 -1
  29. package/dist/types/pagination.types.d.ts +1 -0
  30. package/dist/types/pagination.types.d.ts.map +1 -1
  31. package/dist/types/query-option.d.ts +5 -0
  32. package/dist/types/query-option.d.ts.map +1 -0
  33. package/dist/types/query-option.js +3 -0
  34. package/dist/types/query-option.js.map +1 -0
  35. package/dist/types/relation-n2n-result.d.ts +7 -0
  36. package/dist/types/relation-n2n-result.d.ts.map +1 -0
  37. package/dist/types/relation-n2n-result.js +3 -0
  38. package/dist/types/relation-n2n-result.js.map +1 -0
  39. package/dist/types/transaction-queries.d.ts +7 -0
  40. package/dist/types/transaction-queries.d.ts.map +1 -0
  41. package/dist/types/transaction-queries.js +3 -0
  42. package/dist/types/transaction-queries.js.map +1 -0
  43. package/package.json +6 -2
  44. package/src/databases/abstract.database.ts +833 -0
  45. package/src/databases/database.factory.ts +26 -0
  46. package/src/databases/database.ts +4 -0
  47. package/src/databases/index.ts +3 -0
  48. package/src/databases/mysql.database.ts +14 -0
  49. package/src/databases/postgres.database.ts +14 -0
  50. package/src/pagination.service.ts +216 -12
  51. package/src/types/pagination.types.ts +1 -0
  52. package/src/types/query-option.ts +4 -0
  53. package/src/types/relation-n2n-result.ts +6 -0
  54. package/src/types/transaction-queries.ts +7 -0
@@ -0,0 +1,61 @@
1
+ import { DataSource } from 'typeorm';
2
+ import { QueryOption } from '../types/query-option';
3
+ import { RelationN2NResult } from '../types/relation-n2n-result';
4
+ import { TransactionQueries } from '../types/transaction-queries';
5
+ import { Database } from './database';
6
+ import EventEmitter = require('events');
7
+ export declare class AbstractDatabase {
8
+ protected type: Database;
9
+ protected host: string;
10
+ protected user: string;
11
+ protected password: string;
12
+ protected database: string;
13
+ protected port: number;
14
+ private client;
15
+ private foreignKeys;
16
+ private foreignKeysByTable;
17
+ private primaryKeys;
18
+ private columnNameFromRelation;
19
+ private relationN2N;
20
+ private relation1N;
21
+ private columnComment;
22
+ private tableHasColumnOrder;
23
+ private eventEmitter;
24
+ private autoClose;
25
+ constructor(type: Database, host: string, user: string, password: string, database: string, port: number);
26
+ getDataSource(): DataSource;
27
+ disableAutoClose(): void;
28
+ close(): any;
29
+ on(event: string, listener: (...args: any[]) => void): EventEmitter<[never]>;
30
+ getArrayType(values: any[]): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
31
+ getWhereWithIn(columnName: string, operator: 'in' | 'nin', values: string[] | number[]): string;
32
+ static addSimpleQuotes(value: any): string;
33
+ private replacePlaceholders;
34
+ getColumnNameWithScaping(columnName: string): string;
35
+ getLimit(offset: number, limit: number): string;
36
+ getTableNameFromQuery(query: string): string | null;
37
+ hasTableColumnOrder(tableName: string): Promise<any>;
38
+ getColumnComment(tableName: string, columnName: string): Promise<any>;
39
+ getTableNameFromForeignKey(tableName: string, foreignKey: string): Promise<string>;
40
+ private shouldHandleReturning;
41
+ private isReturningSingleField;
42
+ private isReturningIdWithoutPrimaryKeys;
43
+ private isMissingPrimaryKeys;
44
+ private hasPrimaryKeys;
45
+ private hasReturning;
46
+ private formatOptions;
47
+ private addReturningToQuery;
48
+ private getResult;
49
+ getClient(): Promise<any>;
50
+ testDatabaseConnection(): Promise<boolean>;
51
+ getPrimaryKeys(tableName: string): Promise<string[]>;
52
+ getForeignKeys(tableName: string): Promise<string[]>;
53
+ getColumnNameFromRelation(tableNameOrigin: string, tableNameDestination: string): Promise<any>;
54
+ getRelation1N(tableNameOrigin: string, tableNameDestination: string): Promise<string>;
55
+ getRelationN2N(tableNameOrigin: string, tableNameDestination: string): Promise<RelationN2NResult>;
56
+ static parseQueryValue(value: any): string | number | boolean;
57
+ static objectToWhereClause(obj: any): string;
58
+ transaction(queries: TransactionQueries[]): Promise<any[]>;
59
+ query(query: string, values?: any[], options?: QueryOption): Promise<any>;
60
+ }
61
+ //# sourceMappingURL=abstract.database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract.database.d.ts","sourceRoot":"","sources":["../../src/databases/abstract.database.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,YAAY,GAAG,QAAQ,QAAQ,CAAC,CAAC;AAExC,qBAAa,gBAAgB;IAczB,SAAS,CAAC,IAAI,EAA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