@dwtechs/antity-pgsql 0.9.0 → 0.9.1

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.
@@ -24,12 +24,12 @@ SOFTWARE.
24
24
  https://github.com/DWTechs/Antity-pgsql.js
25
25
  */
26
26
 
27
- import { Entity } from "@dwtechs/antity";
28
- import { Type } from "@dwtechs/antity";
29
- import { Property } from './property';
27
+ import { Entity, Property as BaseProperty } from "@dwtechs/antity";
28
+ import type { Type, Method } from "@dwtechs/antity";
30
29
  import type { Request, Response, NextFunction } from 'express';
30
+ import type { Pool, PoolClient } from 'pg';
31
31
 
32
- export type Operation = "SELECT" | "INSERT" | "UPDATE" | "DELETE";
32
+ export type Operation = "SELECT" | "INSERT" | "UPDATE";
33
33
  export type Sort = "ASC" | "DESC";
34
34
  export type Filters = {
35
35
  [key: string]: Filter;
@@ -39,7 +39,27 @@ export type Filter = {
39
39
  subProps?: string[];
40
40
  matchMode?: MatchMode;
41
41
  };
42
- export { Type };
42
+ export type { Type };
43
+
44
+ export declare class Property extends BaseProperty {
45
+ filter: boolean;
46
+ operations: Operation[];
47
+ constructor(
48
+ key: string,
49
+ type: Type,
50
+ min: number | Date | null,
51
+ max: number | Date | null,
52
+ need: Method[],
53
+ send: boolean,
54
+ typeCheck: boolean,
55
+ filter: boolean,
56
+ operations: Operation[] | undefined,
57
+ sanitizer: ((v: unknown) => unknown) | null,
58
+ normalizer: ((v: unknown) => unknown) | null,
59
+ validator: ((v: unknown) => unknown) | null
60
+ );
61
+ }
62
+
43
63
  export type LogicalOperator = "AND" | "OR";
44
64
  export type Comparator = "=" | "<" | ">" | "<=" | ">=" | "<>" | "IS" | "IS NOT" | "IN" | "LIKE" | "NOT LIKE";
45
65
  export type MatchMode = "startsWith" | "endsWith" | "contains" | "notContains" | "equals" | "notEquals" | "between" | "in" | "lt" | "lte" | "gt" | "gte" | "is" | "isNot" | "before" | "after" | "st_contains" | "st_dwithin";
@@ -72,12 +92,12 @@ type ExpressMiddleware = (req: Request, res: Response, next: NextFunction) => vo
72
92
  type ExpressMiddlewareAsync = (req: Request, res: Response, next: NextFunction) => Promise<void>;
73
93
  type SubstackTuple = [ExpressMiddleware, ExpressMiddleware, ExpressMiddlewareAsync];
74
94
 
75
- export class SQLEntity extends Entity {
95
+ export declare class SQLEntity extends Entity {
76
96
  private _table: string;
77
97
  private _schema: string;
78
- private sel: any;
79
- private ins: any;
80
- private upd: any;
98
+ private sel: unknown;
99
+ private ins: unknown;
100
+ private upd: unknown;
81
101
 
82
102
  constructor(name: string, properties: Property[], schema?: string);
83
103
 
@@ -142,7 +162,7 @@ export class SQLEntity extends Entity {
142
162
  getHistory(req: Request, res: Response, next: NextFunction): void;
143
163
  }
144
164
 
145
- declare function filter(
165
+ export declare function filter(
146
166
  first: number,
147
167
  rows: number | null,
148
168
  sortField: string | null,
@@ -150,16 +170,9 @@ declare function filter(
150
170
  filters: Filters | null,
151
171
  ): { filterClause: string, args: (Filter["value"])[] };
152
172
 
153
- declare function execute(
173
+ export declare function execute(
154
174
  query: string,
155
175
  args: (string | number | boolean | Date | number[])[],
156
- client: any
176
+ client: Pool | PoolClient | null
157
177
  ): Promise<PGResponse>;
158
178
 
159
- export {
160
- SQLEntity,
161
- Property,
162
- filter,
163
- execute,
164
- };
165
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dwtechs/antity-pgsql",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Open source library to add PostgreSQL support to @dwtechs/Antity entities.",
5
5
  "keywords": [
6
6
  "entities"