@dwtechs/antity-pgsql 0.9.1 → 0.10.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.
- package/README.md +23 -23
- package/dist/antity-pgsql.d.ts +4 -4
- package/dist/antity-pgsql.js +5 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -62,11 +62,11 @@ const entity = new SQLEntity("consumers", [
|
|
|
62
62
|
type: "integer",
|
|
63
63
|
min: 0,
|
|
64
64
|
max: 120,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
isTypeChecked: true,
|
|
66
|
+
isFilterable: true,
|
|
67
|
+
requiredFor: ["PUT"],
|
|
68
68
|
operations: ["SELECT", "UPDATE"],
|
|
69
|
-
|
|
69
|
+
isPrivate: false,
|
|
70
70
|
sanitizer: null,
|
|
71
71
|
normalizer: null,
|
|
72
72
|
validator: null,
|
|
@@ -76,11 +76,11 @@ const entity = new SQLEntity("consumers", [
|
|
|
76
76
|
type: "string",
|
|
77
77
|
min: 0,
|
|
78
78
|
max: 255,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
isTypeChecked: true,
|
|
80
|
+
isFilterable: false,
|
|
81
|
+
requiredFor: ["POST", "PUT"],
|
|
82
82
|
operations: ["SELECT", "UPDATE"],
|
|
83
|
-
|
|
83
|
+
isPrivate: false,
|
|
84
84
|
sanitizer: null,
|
|
85
85
|
normalizer: normalizeName,
|
|
86
86
|
validator: null,
|
|
@@ -90,11 +90,11 @@ const entity = new SQLEntity("consumers", [
|
|
|
90
90
|
type: "string",
|
|
91
91
|
min: 0,
|
|
92
92
|
max: 255,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
isTypeChecked: true,
|
|
94
|
+
isFilterable: false,
|
|
95
|
+
requiredFor: ["POST", "PUT"],
|
|
96
96
|
operations: ["SELECT", "UPDATE"],
|
|
97
|
-
|
|
97
|
+
isPrivate: false,
|
|
98
98
|
sanitizer: null,
|
|
99
99
|
normalizer: normalizeName,
|
|
100
100
|
validator: null,
|
|
@@ -104,11 +104,11 @@ const entity = new SQLEntity("consumers", [
|
|
|
104
104
|
type: "string",
|
|
105
105
|
min: 0,
|
|
106
106
|
max: 255,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
isTypeChecked: true,
|
|
108
|
+
isFilterable: true,
|
|
109
|
+
requiredFor: ["POST", "PUT"],
|
|
110
110
|
operations: ["SELECT", "UPDATE"],
|
|
111
|
-
|
|
111
|
+
isPrivate: false,
|
|
112
112
|
sanitizer: null,
|
|
113
113
|
normalizer: normalizeNickname,
|
|
114
114
|
validator: null,
|
|
@@ -125,10 +125,10 @@ router.put("/", ...entity.updateArraySubstack);
|
|
|
125
125
|
router.post("/manual", entity.normalizeArray, entity.validateArray, ..., entity.add);
|
|
126
126
|
router.put("/manual", entity.normalizeArray, entity.validateArray, ..., entity.update);
|
|
127
127
|
|
|
128
|
-
router.
|
|
128
|
+
router.patch("/archive", ..., entity.archive);
|
|
129
129
|
router.delete("/", ..., entity.delete);
|
|
130
130
|
router.delete("/archived", ..., entity.deleteArchive);
|
|
131
|
-
router.get("/history", ..., entity.getHistory);
|
|
131
|
+
router.get("/:id/history", ..., entity.getHistory);
|
|
132
132
|
|
|
133
133
|
```
|
|
134
134
|
|
|
@@ -175,7 +175,7 @@ class SQLEntity {
|
|
|
175
175
|
get name(): string;
|
|
176
176
|
get table(): string;
|
|
177
177
|
get schema(): string;
|
|
178
|
-
get
|
|
178
|
+
get privateProps(): string[];
|
|
179
179
|
get properties(): Property[];
|
|
180
180
|
set name(name: string);
|
|
181
181
|
set table(table: string);
|
|
@@ -360,10 +360,10 @@ Any of these can be passed into the options object for each function.
|
|
|
360
360
|
| type | Type | Type of the property |
|
|
361
361
|
| min | number \| Date | Minimum value | 0 \| 1900-01-01
|
|
362
362
|
| max | number \| Date | Maximum value | 999999999 \| 2200-12-31
|
|
363
|
-
|
|
|
364
|
-
|
|
|
365
|
-
|
|
|
366
|
-
|
|
|
363
|
+
| requiredFor | Method[] | property is required for the listed methods only | ["PATCH", "PUT", "POST"]
|
|
364
|
+
| isPrivate | boolean | Property is unsafe to send in the response | true
|
|
365
|
+
| isTypeChecked | boolean | Type is checked during validation | false
|
|
366
|
+
| isFilterable | boolean | property is filterable in a SELECT operation | true
|
|
367
367
|
| operations | Operation[] | Property is used for the DML operations only | ["SELECT", "INSERT", "UPDATE"]
|
|
368
368
|
| sanitizer | ((v:any) => any) \| null | Custom sanitizer function if sanitize is true | null
|
|
369
369
|
| normalizer | ((v:any) => any) \| null | Custom Normalizer function if normalize is true | null
|
package/dist/antity-pgsql.d.ts
CHANGED
|
@@ -49,10 +49,10 @@ export declare class Property extends BaseProperty {
|
|
|
49
49
|
type: Type,
|
|
50
50
|
min: number | Date | null,
|
|
51
51
|
max: number | Date | null,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
requiredFor: Method[],
|
|
53
|
+
isPrivate: boolean,
|
|
54
|
+
isTypeChecked: boolean,
|
|
55
|
+
isFilterable: boolean,
|
|
56
56
|
operations: Operation[] | undefined,
|
|
57
57
|
sanitizer: ((v: unknown) => unknown) | null,
|
|
58
58
|
normalizer: ((v: unknown) => unknown) | null,
|
package/dist/antity-pgsql.js
CHANGED
|
@@ -459,7 +459,7 @@ function cleanFilters(filters, properties) {
|
|
|
459
459
|
delete filters[k];
|
|
460
460
|
continue;
|
|
461
461
|
}
|
|
462
|
-
if (!prop.
|
|
462
|
+
if (!prop.isFilterable) {
|
|
463
463
|
log.warn(`${LOGS_PREFIX}Filters: skipping unfilterable property: ${k}`);
|
|
464
464
|
delete filters[k];
|
|
465
465
|
continue;
|
|
@@ -497,10 +497,10 @@ function generateSummary(name, table, properties) {
|
|
|
497
497
|
lines.push(`│ │ ├─ Type: ${p.type}`);
|
|
498
498
|
lines.push(`│ │ ├─ Min: ${p.min}`);
|
|
499
499
|
lines.push(`│ │ ├─ Max: ${p.max}`);
|
|
500
|
-
lines.push(`│ │ ├─
|
|
501
|
-
lines.push(`│ │ ├─
|
|
502
|
-
lines.push(`│ │ ├─
|
|
503
|
-
lines.push(`│ │ ├─
|
|
500
|
+
lines.push(`│ │ ├─ RequiredFor: ${p.requiredFor}`);
|
|
501
|
+
lines.push(`│ │ ├─ IsPrivate: ${p.isPrivate}`);
|
|
502
|
+
lines.push(`│ │ ├─ IsTypeChecked: ${p.isTypeChecked}`);
|
|
503
|
+
lines.push(`│ │ ├─ IsFilterable: ${p.isFilterable}`);
|
|
504
504
|
lines.push(`│ │ ├─ Operations: [${p.operations.join(', ')}]`);
|
|
505
505
|
lines.push(`│ │ ├─ Sanitize: ${p.sanitize}`);
|
|
506
506
|
lines.push(`│ │ ├─ Normalize: ${p.normalize}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dwtechs/antity-pgsql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Open source library to add PostgreSQL support to @dwtechs/Antity entities.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"entities"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@dwtechs/checkard": "3.6.0",
|
|
40
40
|
"@dwtechs/winstan": "0.5.0",
|
|
41
|
-
"@dwtechs/antity": "0.
|
|
41
|
+
"@dwtechs/antity": "0.16.0",
|
|
42
42
|
"@dwtechs/sparray": "0.2.1",
|
|
43
43
|
"pg": "8.13.1"
|
|
44
44
|
},
|