@webda/postgres 4.0.0-beta.5 → 4.0.0-beta.7
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 +5 -6
- package/lib/pgpool.d.ts +6 -0
- package/lib/pgpool.d.ts.map +1 -1
- package/lib/pgpool.js +9 -2
- package/lib/pgpool.js.map +1 -1
- package/lib/postgrespubsub.service.d.ts +3 -0
- package/lib/postgrespubsub.service.d.ts.map +1 -1
- package/lib/postgrespubsub.service.js +2 -2
- package/lib/postgrespubsub.service.js.map +1 -1
- package/lib/postgresqueue.service.d.ts +3 -0
- package/lib/postgresqueue.service.d.ts.map +1 -1
- package/lib/postgresqueue.service.js +2 -2
- package/lib/postgresqueue.service.js.map +1 -1
- package/lib/postgresstore.service.d.ts +18 -0
- package/lib/postgresstore.service.d.ts.map +1 -1
- package/lib/postgresstore.service.js +36 -3
- package/lib/postgresstore.service.js.map +1 -1
- package/lib/sqlstore.d.ts +127 -11
- package/lib/sqlstore.d.ts.map +1 -1
- package/lib/sqlstore.js +379 -31
- package/lib/sqlstore.js.map +1 -1
- package/package.json +6 -6
- package/webda.module.json +31 -198
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This module is part of Webda Application Framework that allows you to quickly develop applications with all modern prerequisites: Security, Extensibility, GraphQL, REST, CloudNative [https://webda.io](https://webda.io)
|
|
4
4
|
|
|
5
|
-
<img src="https://webda.io/
|
|
5
|
+
<img src="https://webda.io/img/webda.svg" width="128" />
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
@@ -13,8 +13,6 @@ This module is part of Webda Application Framework that allows you to quickly de
|
|
|
13
13
|
|
|
14
14
|
<!-- README_HEADER -->
|
|
15
15
|
|
|
16
|
-
# @webda/postgres
|
|
17
|
-
|
|
18
16
|
> PostgreSQL-backed Store for Webda — persists model instances as JSONB rows in Postgres with automatic table creation, view generation, and full WebdaQL query support.
|
|
19
17
|
|
|
20
18
|
## When to use it
|
|
@@ -106,6 +104,7 @@ const results = await Post.query("title CONTAINS 'Hello'"); // filtered query
|
|
|
106
104
|
- Related: [`@webda/mongodb`](../mongodb) for a document-store alternative; [`@webda/aws`](../aws) for `DynamoStore`; [`@webda/core`](../core) for the `Store` base class.
|
|
107
105
|
|
|
108
106
|
<!-- README_FOOTER -->
|
|
107
|
+
|
|
109
108
|
## Sponsors
|
|
110
109
|
|
|
111
110
|
<!--
|
|
@@ -114,12 +113,12 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|
|
114
113
|
|
|
115
114
|
Arize AI is a machine learning observability and model monitoring platform. It helps you visualize, monitor, and explain your machine learning models. [Learn more](https://arize.com)
|
|
116
115
|
|
|
117
|
-
[<img src="https://
|
|
116
|
+
[<img src="https://webda.io/img/sponsors/arize.svg" width="200">](https://arize.com)
|
|
118
117
|
|
|
119
118
|
Loopingz is a software development company that provides consulting and development services. [Learn more](https://loopingz.com)
|
|
120
119
|
|
|
121
|
-
[<img src="https://
|
|
120
|
+
[<img src="https://webda.io/img/sponsors/loopingz.png" width="200">](https://loopingz.com)
|
|
122
121
|
|
|
123
122
|
Tellae is an innovative consulting firm specialized in cities transportation issues. We provide our clients, both public and private, with solutions to support your strategic and operational decisions. [Learn more](https://tellae.fr)
|
|
124
123
|
|
|
125
|
-
[<img src="https://tellae.
|
|
124
|
+
[<img src="https://webda.io/img/sponsors/tellae.svg" width="200">](https://tellae.fr)
|
package/lib/pgpool.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import pg, { PoolConfig } from "pg";
|
|
|
2
2
|
/**
|
|
3
3
|
* Build the registry key for a config. Exposed for tests.
|
|
4
4
|
*
|
|
5
|
+
* {@link SecretString} values (encrypted configuration) are unwrapped first so
|
|
6
|
+
* two configs differing only by an encrypted password do not share a pool.
|
|
7
|
+
*
|
|
5
8
|
* @param config - the pg pool config (may be undefined — pg falls back to PG* env)
|
|
6
9
|
* @returns the registry key
|
|
7
10
|
*/
|
|
@@ -18,6 +21,9 @@ export declare function poolKey(config: PoolConfig | undefined): string;
|
|
|
18
21
|
* subscription is bound to a single connection — pooled connections
|
|
19
22
|
* rotate and would silently drop the subscription.
|
|
20
23
|
*
|
|
24
|
+
* {@link SecretString} values in the config are replaced by their plain value
|
|
25
|
+
* before being handed to `pg`.
|
|
26
|
+
*
|
|
21
27
|
* @param config - the pg pool config
|
|
22
28
|
* @returns the shared pool
|
|
23
29
|
*/
|
package/lib/pgpool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgpool.d.ts","sourceRoot":"","sources":["../src/pgpool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pgpool.d.ts","sourceRoot":"","sources":["../src/pgpool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAyCpC;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAE9D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,EAAE,CAAC,IAAI,CAUnE;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/E;AAED;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAUlD"}
|
package/lib/pgpool.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SecretString } from "@webda/core";
|
|
1
2
|
import pg from "pg";
|
|
2
3
|
/**
|
|
3
4
|
* Stable JSON serializer that sorts object keys so two configs with the
|
|
@@ -33,11 +34,14 @@ const registry = new Map();
|
|
|
33
34
|
/**
|
|
34
35
|
* Build the registry key for a config. Exposed for tests.
|
|
35
36
|
*
|
|
37
|
+
* {@link SecretString} values (encrypted configuration) are unwrapped first so
|
|
38
|
+
* two configs differing only by an encrypted password do not share a pool.
|
|
39
|
+
*
|
|
36
40
|
* @param config - the pg pool config (may be undefined — pg falls back to PG* env)
|
|
37
41
|
* @returns the registry key
|
|
38
42
|
*/
|
|
39
43
|
export function poolKey(config) {
|
|
40
|
-
return stableStringify(config ?? {});
|
|
44
|
+
return stableStringify(SecretString.unwrap(config ?? {}));
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* Acquire a shared `pg.Pool` for the given config. Pools are cached by
|
|
@@ -51,6 +55,9 @@ export function poolKey(config) {
|
|
|
51
55
|
* subscription is bound to a single connection — pooled connections
|
|
52
56
|
* rotate and would silently drop the subscription.
|
|
53
57
|
*
|
|
58
|
+
* {@link SecretString} values in the config are replaced by their plain value
|
|
59
|
+
* before being handed to `pg`.
|
|
60
|
+
*
|
|
54
61
|
* @param config - the pg pool config
|
|
55
62
|
* @returns the shared pool
|
|
56
63
|
*/
|
|
@@ -61,7 +68,7 @@ export function acquirePool(config) {
|
|
|
61
68
|
entry.refCount++;
|
|
62
69
|
return entry.pool;
|
|
63
70
|
}
|
|
64
|
-
const pool = new pg.Pool(config);
|
|
71
|
+
const pool = new pg.Pool(SecretString.unwrap(config));
|
|
65
72
|
registry.set(key, { pool, refCount: 1 });
|
|
66
73
|
return pool;
|
|
67
74
|
}
|
package/lib/pgpool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgpool.js","sourceRoot":"","sources":["../src/pgpool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,IAAI,CAAC;AAEpC;;;;;;;;;GASG;AACH,SAAS,eAAe,CAAC,KAAU;IACjC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,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,CAAC;IACzC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAA8B;IAC9D,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjB,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC;QAAE,OAAO;IAC/B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;QAChC,mBAAmB;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,MAAM,OAAO,CAAC,GAAG,CACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CACd,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;QACtB,mBAAmB;IACrB,CAAC,CAAC,CACH,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -18,6 +18,9 @@ export declare class PostgresPubSubParameters extends ServiceParameters {
|
|
|
18
18
|
/**
|
|
19
19
|
* Connection settings forwarded to `pg.Client`. By default `pg` reads
|
|
20
20
|
* standard PG* environment variables.
|
|
21
|
+
*
|
|
22
|
+
* Can be encrypted with `webda config encrypt`
|
|
23
|
+
* @secret password,connectionString
|
|
21
24
|
*/
|
|
22
25
|
postgresqlServer?: ClientConfig;
|
|
23
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgrespubsub.service.d.ts","sourceRoot":"","sources":["../src/postgrespubsub.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"postgrespubsub.service.d.ts","sourceRoot":"","sources":["../src/postgrespubsub.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAa,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,EAAE,EAAE,YAAY,EAAc,MAAM,IAAI,CAAC;AAUlD;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,iBAAiB;IAC7D;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAE,GAAQ,GAAG,IAAI,CAI3B;CACF;AAED,UAAU,UAAU,CAAC,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,CAAA;KAAE,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAqB,CACxC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,wBAAwB,GAAG,wBAAwB,CAC7D,SAAQ,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3B;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAa;IACpD;;;OAGG;IACH,SAAS,CAAC,QAAQ,UAAS;IAE3B;;;;OAIG;IACH,SAAS,CAAC,OAAO,IAAI,MAAM,CAE1B;IAED;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAI1B;IAED;;OAEG;IACH,UAAgB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAmBvC;IAED;;OAEG;IACH,SAAS,CAAC,gBAAgB,IAAI,IAAI,CAQjC;IAED;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAuBxC;IAED;;;OAGG;IACG,WAAW,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBzC;IAED;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAE5B;IAED;;;;;;OAMG;IACH,OAAO,CACL,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EACrC,cAAc,CAAC,EAAE;QAAE,QAAQ,CAAC,CAAA;KAAE,EAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,GAClB,iBAAiB,CAUnB;IAED;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAoB1B;CACF;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PubSubService, ServiceParameters } from "@webda/core";
|
|
1
|
+
import { PubSubService, SecretString, ServiceParameters } from "@webda/core";
|
|
2
2
|
import { CancelablePromise, JSONUtils } from "@webda/utils";
|
|
3
3
|
import { useLog } from "@webda/workout";
|
|
4
4
|
import pg from "pg";
|
|
@@ -79,7 +79,7 @@ export default class PostgresPubSubService extends PubSubService {
|
|
|
79
79
|
if (!/^[a-z_][a-z0-9_]*$/.test(ch)) {
|
|
80
80
|
throw new Error(`Invalid channel name "${ch}" — must match /^[a-z_][a-z0-9_]*$/`);
|
|
81
81
|
}
|
|
82
|
-
const client = new pg.Client(this.parameters.postgresqlServer);
|
|
82
|
+
const client = new pg.Client(SecretString.unwrap(this.parameters.postgresqlServer));
|
|
83
83
|
client.on("notification", (msg) => {
|
|
84
84
|
if (msg.channel !== this.channel())
|
|
85
85
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgrespubsub.service.js","sourceRoot":"","sources":["../src/postgrespubsub.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"postgrespubsub.service.js","sourceRoot":"","sources":["../src/postgrespubsub.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAgC,MAAM,IAAI,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;IA4B7D;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAQ,EAAE;QACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,IAAI,CAAC,cAAc,KAAnB,IAAI,CAAC,cAAc,GAAK,GAAG,EAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAOD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,OAAO,qBAGnB,SAAQ,aAAmB;IAH7B;;QAiBE;;WAEG;QACO,cAAS,GAAuB,IAAI,GAAG,EAAE,CAAC;QACpD;;;WAGG;QACO,aAA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AAC,WAAW,GAAG,SAAS,CAAC;YAC7B,MAAM,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,gBAA8B,CAAC,CAAC;QACpE,CAAC;QACD,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;CACF;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -42,6 +42,9 @@ export declare class PostgresQueueParameters extends QueueParameters {
|
|
|
42
42
|
/**
|
|
43
43
|
* Connection settings forwarded to the chosen pg client/pool. Defaults
|
|
44
44
|
* to PG* environment variables.
|
|
45
|
+
*
|
|
46
|
+
* Can be encrypted with `webda config encrypt`
|
|
47
|
+
* @secret password,connectionString
|
|
45
48
|
*/
|
|
46
49
|
postgresqlServer?: ClientConfig | PoolConfig;
|
|
47
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgresqueue.service.d.ts","sourceRoot":"","sources":["../src/postgresqueue.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"postgresqueue.service.d.ts","sourceRoot":"","sources":["../src/postgresqueue.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe,EAAgB,MAAM,aAAa,CAAC;AAGnF,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAGlD;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IAC7C;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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Queue, QueueParameters } from "@webda/core";
|
|
1
|
+
import { Queue, QueueParameters, SecretString } from "@webda/core";
|
|
2
2
|
import { JSONUtils } from "@webda/utils";
|
|
3
3
|
import { useLog } from "@webda/workout";
|
|
4
4
|
import pg from "pg";
|
|
@@ -67,7 +67,7 @@ export default class PostgresQueueService extends Queue {
|
|
|
67
67
|
this.ownsPool = true;
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
70
|
-
this.client = new pg.Client(this.parameters.postgresqlServer);
|
|
70
|
+
this.client = new pg.Client(SecretString.unwrap(this.parameters.postgresqlServer));
|
|
71
71
|
await this.client.connect();
|
|
72
72
|
}
|
|
73
73
|
if (this.parameters.autoCreateTable) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgresqueue.service.js","sourceRoot":"","sources":["../src/postgresqueue.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"postgresqueue.service.js","sourceRoot":"","sources":["../src/postgresqueue.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAgC,MAAM,IAAI,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAmD1D;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAQ,EAAE;QACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,IAAI,CAAC,KAAK,KAAV,IAAI,CAAC,KAAK,GAAK,aAAa,EAAC;QAC7B,IAAI,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AO;QACX,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QACzB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,KAAK,mBAAmB,CAAC,CAAC;QAC3E,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,MAAM,EAAE,kCAAmC,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC5B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,gBAA8B,CAAC,CAAC;YACpE,CAAC;iBAAM,CAAC;gBACN,MAAO,MAAoB,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;oBAC3C,mBAAmB;gBACrB,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;CACF;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -11,6 +11,9 @@ export declare class PostgresParameters extends SQLStoreParameters {
|
|
|
11
11
|
usePool?: boolean;
|
|
12
12
|
/**
|
|
13
13
|
* By default use environment variables
|
|
14
|
+
*
|
|
15
|
+
* Can be encrypted with `webda config encrypt`
|
|
16
|
+
* @secret password,connectionString
|
|
14
17
|
*/
|
|
15
18
|
postgresqlServer?: ClientConfig | PoolConfig;
|
|
16
19
|
/**
|
|
@@ -97,6 +100,21 @@ export declare class PostgresStore<K extends PostgresParameters = PostgresParame
|
|
|
97
100
|
* @returns the table name
|
|
98
101
|
*/
|
|
99
102
|
resolveTable(model: ModelClass): string;
|
|
103
|
+
/**
|
|
104
|
+
* The model a table was declared for, owner of the rows written before `__type` stamping:
|
|
105
|
+
* the configured model of a single-model `table`, otherwise the model itself (its own or explicit table)
|
|
106
|
+
* @param model - the model class
|
|
107
|
+
* @returns the model identifier
|
|
108
|
+
*/
|
|
109
|
+
resolveTableModel(model: ModelClass): string | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Stamp `__type` on the rows written before stamping, with the model each table was declared for
|
|
112
|
+
*
|
|
113
|
+
* Idempotent: run it once after upgrading, before relying on the class filter of shared tables (rows without
|
|
114
|
+
* `__type` are read as the table model until then).
|
|
115
|
+
* @returns the number of rows stamped
|
|
116
|
+
*/
|
|
117
|
+
backfillTypes(): Promise<number>;
|
|
100
118
|
/**
|
|
101
119
|
* Ensure all managed model tables exist (one per model in the hierarchy).
|
|
102
120
|
* When `autoCreateTable` is false, this is a no-op.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgresstore.service.d.ts","sourceRoot":"","sources":["../src/postgresstore.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"postgresstore.service.d.ts","sourceRoot":"","sources":["../src/postgresstore.service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAcjF;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,kBAAkB;IACxD;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IAC7C;;;OAGG;IACH,eAAe,CA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IAED;;;;OAIG;IACH,eAAe,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAgB3C;IAED;;;;;OAKG;IACG,WAAW,kBA6DhB;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAe7B;CACF;eAEc,aAAa"}
|
|
@@ -32,7 +32,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
32
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
33
|
done = true;
|
|
34
34
|
};
|
|
35
|
-
import { EventRepository, InstanceCache, useApplication, useCore, useModel, useModelMetadata } from "@webda/core";
|
|
35
|
+
import { EventRepository, InstanceCache, SecretString, useApplication, useCore, useModel, useModelMetadata } from "@webda/core";
|
|
36
36
|
import pg from "pg";
|
|
37
37
|
import { acquirePool, releasePool } from "./pgpool.js";
|
|
38
38
|
import { PostgresRepository, SQLStore, SQLStoreParameters } from "./sqlstore.js";
|
|
@@ -114,7 +114,7 @@ let PostgresStore = (() => {
|
|
|
114
114
|
this.ownsPool = true;
|
|
115
115
|
}
|
|
116
116
|
else {
|
|
117
|
-
this.client = new pg.Client(this.parameters.postgresqlServer);
|
|
117
|
+
this.client = new pg.Client(SecretString.unwrap(this.parameters.postgresqlServer));
|
|
118
118
|
await this.client.connect();
|
|
119
119
|
}
|
|
120
120
|
await this.checkTable();
|
|
@@ -168,6 +168,39 @@ let PostgresStore = (() => {
|
|
|
168
168
|
// Default derivation
|
|
169
169
|
return meta.Identifier.toLowerCase().replace(/\//g, "_");
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* The model a table was declared for, owner of the rows written before `__type` stamping:
|
|
173
|
+
* the configured model of a single-model `table`, otherwise the model itself (its own or explicit table)
|
|
174
|
+
* @param model - the model class
|
|
175
|
+
* @returns the model identifier
|
|
176
|
+
*/
|
|
177
|
+
resolveTableModel(model) {
|
|
178
|
+
const meta = useModelMetadata(model);
|
|
179
|
+
if (!meta) {
|
|
180
|
+
return undefined;
|
|
181
|
+
}
|
|
182
|
+
if (!this.parameters.tables?.[meta.Identifier] &&
|
|
183
|
+
this.parameters.models?.length === 1 &&
|
|
184
|
+
this.parameters.table &&
|
|
185
|
+
(this.parameters.models[0] === meta.Identifier || this.handleModel(model) >= 0)) {
|
|
186
|
+
return this.parameters.models[0];
|
|
187
|
+
}
|
|
188
|
+
return meta.Identifier;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Stamp `__type` on the rows written before stamping, with the model each table was declared for
|
|
192
|
+
*
|
|
193
|
+
* Idempotent: run it once after upgrading, before relying on the class filter of shared tables (rows without
|
|
194
|
+
* `__type` are read as the table model until then).
|
|
195
|
+
* @returns the number of rows stamped
|
|
196
|
+
*/
|
|
197
|
+
async backfillTypes() {
|
|
198
|
+
let count = 0;
|
|
199
|
+
for (const repo of this.getRepositories()) {
|
|
200
|
+
count += await repo.backfillTypes();
|
|
201
|
+
}
|
|
202
|
+
return count;
|
|
203
|
+
}
|
|
171
204
|
/**
|
|
172
205
|
* Ensure all managed model tables exist (one per model in the hierarchy).
|
|
173
206
|
* When `autoCreateTable` is false, this is a no-op.
|
|
@@ -222,7 +255,7 @@ let PostgresStore = (() => {
|
|
|
222
255
|
getRepository(model) {
|
|
223
256
|
const meta = useModelMetadata(model);
|
|
224
257
|
const table = this.resolveTable(model);
|
|
225
|
-
const inner = new PostgresRepository(model, meta.PrimaryKey, this.client, table, meta.PrimaryKeySeparator, () => this.ensureTable(inner));
|
|
258
|
+
const inner = new PostgresRepository(model, meta.PrimaryKey, this.client, table, meta.PrimaryKeySeparator, () => this.ensureTable(inner), this.resolveTableModel(model));
|
|
226
259
|
// Wrap in EventRepository so typed CRUD events fire; consumers reach them
|
|
227
260
|
// via useRepository(model).on(...).
|
|
228
261
|
return new EventRepository(model, meta.PrimaryKey, inner, meta.PrimaryKeySeparator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgresstore.service.js","sourceRoot":"","sources":["../src/postgresstore.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"postgresstore.service.js","sourceRoot":"","sources":["../src/postgresstore.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,OAAO,EACP,QAAQ,EACR,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAgC,MAAM,IAAI,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IAwCxD;;;;OAIG;IACH,IAAI,CAAC,MAAW;QACd,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,IAAI,CAAC,eAAe,KAApB,IAAI,CAAC,eAAe,GAAK,IAAI,EAAC;QAC9B,IAAI,CAAC,OAAO,KAAZ,IAAI,CAAC,OAAO,GAAK,KAAK,EAAC;QACvB,IAAI,CAAC,UAAU,KAAf,IAAI,CAAC,UAAU,GAAK,EAAE,EAAC;QACvB,IAAI,CAAC,KAAK,KAAV,IAAI,CAAC,KAAK,GAAK,CAAC,IAAI,CAAC,EAAC;QACtB,IAAI,CAAC,MAAM,KAAX,IAAI,CAAC,MAAM,GAAK,EAAE,EAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;;;;;;;;;;;;;;GAeG;IACU,aAAa;;sBAA4D,QAAQ;;;sBAAjF,aAAiE,SAAQ,WAAW;;;gBAC/F,WAAM,GADK,mDAAa,CACI;gBAC5B;;;mB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AAC,CAAC;oBACzB,CAAC;gBACH,CAAC;YACH,CAAC;YAED;;eAEG;YACH,KAAK,CAAC,OAAO;gBACX,MAAM,MAAM,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;gBACxD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAC,EAAE,CAAC;oBAC/D,IAAI,CAAC;wBACH,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;wBAChC,IAAI,KAAK,EAAE,CAAC;4BACV,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;wBACvC,CAAC;oBACH,CAAC;oBAAC,MAAM,CAAC;wBACP,0BAA0B;oBAC5B,CAAC;gBACH,CAAC;gBACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBAC3B,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,KAAK,EAAE,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC;;;;yCAhIA,aAAa,EAAE;YAChB,wLAAA,aAAa,6DAeZ;;;;;SAhMU,aAAa;AAmT1B,eAAe,aAAa,CAAC"}
|
package/lib/sqlstore.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MemoryRepository, Store, StoreParameters } from "@webda/core";
|
|
2
2
|
import type { ModelClass, Repository } from "@webda/core";
|
|
3
3
|
import * as WebdaQL from "@webda/ql";
|
|
4
|
+
import type { AggregationQuery, AggregationResult } from "@webda/ql";
|
|
4
5
|
/** Database connection metadata */
|
|
5
6
|
export interface SQLDatabase {
|
|
6
7
|
name: string;
|
|
@@ -28,23 +29,41 @@ export interface SQLResult<T> {
|
|
|
28
29
|
rows: T[];
|
|
29
30
|
rowCount: number;
|
|
30
31
|
}
|
|
31
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Extends ComparisonExpression to emit SQL for JSONB comparisons
|
|
34
|
+
*
|
|
35
|
+
* With the JSON path of the attribute (`jsonAttribute`), comparisons follow the in-memory semantics:
|
|
36
|
+
* - a number or a boolean only matches a JSON number or boolean: a missing field, a null or another type never
|
|
37
|
+
* matches, and never raises a cast error;
|
|
38
|
+
* - `!=` matches a missing field, a null or another type (`IS DISTINCT FROM`);
|
|
39
|
+
* - strings compare the text of the value, so a number field equals its text (`n = '1'`), as the loose `==` does;
|
|
40
|
+
* - `CONTAINS` only matches an array holding the value.
|
|
41
|
+
*/
|
|
32
42
|
export declare class SQLComparisonExpression extends WebdaQL.ComparisonExpression {
|
|
43
|
+
protected readonly jsonAttribute?: string;
|
|
44
|
+
/**
|
|
45
|
+
* @param operator - the comparison operator
|
|
46
|
+
* @param attribute - the SQL text of the attribute (`data#>>'{a,b}'`)
|
|
47
|
+
* @param value - the value
|
|
48
|
+
* @param jsonAttribute - the SQL JSON of the attribute (`data#>'{a,b}'`), for typed comparisons
|
|
49
|
+
*/
|
|
50
|
+
constructor(operator: WebdaQL.ComparisonOperator, attribute: string, value: any, jsonAttribute?: string);
|
|
33
51
|
/**
|
|
34
|
-
* Single quotes are doubled so a value can never close the literal. Backslashes stay
|
|
35
|
-
* literal: with `standard_conforming_strings` (PostgreSQL default) `\\` is not an
|
|
36
|
-
* escape character in '...' strings — only LIKE gives it a meaning.
|
|
37
|
-
*
|
|
38
52
|
* @override
|
|
39
53
|
* @param value - the value to stringify
|
|
40
|
-
* @returns SQL-compatible
|
|
54
|
+
* @returns SQL-compatible literal
|
|
41
55
|
*/
|
|
42
56
|
toStringValue(value: (string | number | boolean) | (string | number | boolean)[]): string;
|
|
43
57
|
/**
|
|
44
58
|
* @override
|
|
45
|
-
* @returns SQL attribute expression
|
|
59
|
+
* @returns SQL attribute expression, typed when the value is a number or a boolean
|
|
46
60
|
*/
|
|
47
61
|
toStringAttribute(): string;
|
|
62
|
+
/**
|
|
63
|
+
* @override
|
|
64
|
+
* @returns the SQL condition
|
|
65
|
+
*/
|
|
66
|
+
toString(): string;
|
|
48
67
|
}
|
|
49
68
|
/**
|
|
50
69
|
* PostgreSQL-backed repository for a single model class.
|
|
@@ -73,8 +92,28 @@ export declare class PostgresRepository<T extends ModelClass> extends MemoryRepo
|
|
|
73
92
|
* @param table - the table name
|
|
74
93
|
* @param separator - composite key separator
|
|
75
94
|
* @param prepare - awaited before every statement (e.g. to ensure the table exists)
|
|
95
|
+
* @param tableModel - identifier of the model the table was declared for: rows without `__type` (written before
|
|
96
|
+
* stamping) belong to it. Defaults to the topmost ancestor of `model` carrying metadata.
|
|
97
|
+
*/
|
|
98
|
+
constructor(model: T, pks: string[], client: SQLClient, table: string, separator?: string, prepare?: () => Promise<void>, tableModel?: string);
|
|
99
|
+
/**
|
|
100
|
+
* Identifier of the model the table was declared for: unstamped rows belong to it
|
|
76
101
|
*/
|
|
77
|
-
|
|
102
|
+
protected readonly tableModel?: string;
|
|
103
|
+
/**
|
|
104
|
+
* @param model - a model class
|
|
105
|
+
* @returns the identifier of its topmost ancestor (itself included) carrying metadata
|
|
106
|
+
*/
|
|
107
|
+
static rootIdentifier(model: any): string | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Stamp the rows written before `__type` stamping with the table model: they keep belonging to it, and a later
|
|
110
|
+
* change of the table model cannot reassign them
|
|
111
|
+
*
|
|
112
|
+
* Idempotent; only the repository of the table model writes. Equivalent SQL:
|
|
113
|
+
* `UPDATE <table> SET data = data || jsonb_build_object('__type', '<table model>') WHERE data->>'__type' IS NULL`.
|
|
114
|
+
* @returns the number of rows stamped
|
|
115
|
+
*/
|
|
116
|
+
backfillTypes(): Promise<number>;
|
|
78
117
|
/**
|
|
79
118
|
* The backing table name for this repository's model.
|
|
80
119
|
* @returns the table name
|
|
@@ -103,6 +142,39 @@ export declare class PostgresRepository<T extends ModelClass> extends MemoryRepo
|
|
|
103
142
|
* @returns the JSONB path expression
|
|
104
143
|
*/
|
|
105
144
|
mapExpressionAttribute(attribute: string[]): string;
|
|
145
|
+
/**
|
|
146
|
+
* Map an expression attribute path array to its JSONB value (not its text)
|
|
147
|
+
* @param attribute - the attribute path
|
|
148
|
+
* @returns the JSONB path expression
|
|
149
|
+
*/
|
|
150
|
+
mapJsonAttribute(attribute: string[]): string;
|
|
151
|
+
/**
|
|
152
|
+
* Check the segments of a path written inside a SQL literal: letters, digits and `_`, like WebdaQL identifiers
|
|
153
|
+
* @param attribute - the attribute path
|
|
154
|
+
* @returns the segments, comma separated
|
|
155
|
+
* @throws Error for any other character
|
|
156
|
+
*/
|
|
157
|
+
protected checkPath(attribute: string[]): string;
|
|
158
|
+
/**
|
|
159
|
+
* SQL condition restricting rows to this model and its subclasses, as `__type` stamps them; rows without a stamp
|
|
160
|
+
* (written before stamping) belong to every model of the table
|
|
161
|
+
* @returns the condition, undefined for a model without metadata
|
|
162
|
+
*/
|
|
163
|
+
protected getClassCondition(): string | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* The type an object written by the application declares: the `__type` its row was read with (non-enumerable,
|
|
166
|
+
* set by {@link fromJSON}), else the identifier of its class. Plain data declares none, whatever its keys.
|
|
167
|
+
* @param item - the object
|
|
168
|
+
* @returns the model identifier, undefined for plain data
|
|
169
|
+
*/
|
|
170
|
+
protected declaredType(item: any): string | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* The JSON stored for an object: its fields, and its declared type in `__type` (see {@link declaredType})
|
|
173
|
+
* @param item - the object
|
|
174
|
+
* @param fallbackType - the type to stamp when the object declares none
|
|
175
|
+
* @returns the JSON text
|
|
176
|
+
*/
|
|
177
|
+
protected toStoredJSON(item: any, fallbackType?: string): string;
|
|
106
178
|
/**
|
|
107
179
|
* Build a SQL WHERE sub-expression from a write-condition.
|
|
108
180
|
* @param writeCondition - the expected value
|
|
@@ -123,10 +195,10 @@ export declare class PostgresRepository<T extends ModelClass> extends MemoryRepo
|
|
|
123
195
|
}>;
|
|
124
196
|
/**
|
|
125
197
|
* Deserialize a raw JSON object from the database into a model instance.
|
|
126
|
-
* @param
|
|
198
|
+
* @param stored - the raw JSON object from the JSONB column; its `__type` stamp becomes a non-enumerable property
|
|
127
199
|
* @returns the model instance
|
|
128
200
|
*/
|
|
129
|
-
protected fromJSON(
|
|
201
|
+
protected fromJSON(stored: any): InstanceType<T>;
|
|
130
202
|
/** @override */
|
|
131
203
|
get(primaryKey: any): Promise<any>;
|
|
132
204
|
/** @override */
|
|
@@ -154,10 +226,54 @@ export declare class PostgresRepository<T extends ModelClass> extends MemoryRepo
|
|
|
154
226
|
*/
|
|
155
227
|
duplicateExpression(expression: WebdaQL.Expression): WebdaQL.Expression;
|
|
156
228
|
/** @override — use SQL WHERE clause instead of in-memory scan */
|
|
157
|
-
query(queryStr: string): Promise<{
|
|
229
|
+
query(queryStr: string | any): Promise<{
|
|
158
230
|
results: InstanceType<T>[];
|
|
159
231
|
continuationToken?: string;
|
|
160
232
|
}>;
|
|
233
|
+
/**
|
|
234
|
+
* JSONB expression of a dotted path, JSON null folded into SQL NULL
|
|
235
|
+
* @param path - validated dotted path
|
|
236
|
+
* @returns the SQL expression
|
|
237
|
+
*/
|
|
238
|
+
protected jsonPath(path: string): string;
|
|
239
|
+
/**
|
|
240
|
+
* Translate an aggregation to SQL
|
|
241
|
+
*
|
|
242
|
+
* The query is validated again here and paths are checked once more, so they are safe to interpolate.
|
|
243
|
+
* Columns get positional names (`gN` per group path, `mN` / `nN` / `sN` per metric index), mapped back to
|
|
244
|
+
* the aliases by decode: alias length or shared prefixes never meet PostgreSQL's 63-byte identifier limit.
|
|
245
|
+
* MIN / MAX select a numeric and a text candidate, merged by decode.
|
|
246
|
+
* @param query - the aggregation
|
|
247
|
+
* @param where - extra WHERE condition (class condition), optional
|
|
248
|
+
* @returns the statement and the row decoder
|
|
249
|
+
*/
|
|
250
|
+
buildAggregationSQL(query: AggregationQuery, where?: string): {
|
|
251
|
+
sql: string;
|
|
252
|
+
decode: (row: any) => any;
|
|
253
|
+
};
|
|
254
|
+
/** @override GROUP BY over the data jsonb column */
|
|
255
|
+
protected executeAggregation(query: AggregationQuery): Promise<AggregationResult<any>>;
|
|
256
|
+
/**
|
|
257
|
+
* SQL condition selecting the rows a statement targets: its WHERE, restricted to the first LIMIT rows when the
|
|
258
|
+
* statement has a LIMIT (PostgreSQL DELETE and UPDATE have none)
|
|
259
|
+
* @param statement - the parsed statement
|
|
260
|
+
* @returns the condition
|
|
261
|
+
*/
|
|
262
|
+
protected getStatementCondition(statement: WebdaQL.Query): string;
|
|
263
|
+
/**
|
|
264
|
+
* Delete in bulk with one `DELETE ... WHERE`: no per-object event (see `Repository.deleteMany`)
|
|
265
|
+
* @override
|
|
266
|
+
*/
|
|
267
|
+
deleteMany(statement: string | WebdaQL.Query, params?: WebdaQL.QueryParameters): Promise<number>;
|
|
268
|
+
/**
|
|
269
|
+
* Update in bulk with one `UPDATE ... SET data = jsonb_set(...) WHERE`: no per-object event (see
|
|
270
|
+
* `Repository.updateMany`)
|
|
271
|
+
*
|
|
272
|
+
* SET paths and values are bound parameters (the statement went through the grammar, see `parseStatement`); the
|
|
273
|
+
* parents of a dotted target are created when missing, an existing array parent is indexed.
|
|
274
|
+
* @override
|
|
275
|
+
*/
|
|
276
|
+
updateMany(statement: string | WebdaQL.Query, params?: WebdaQL.QueryParameters): Promise<number>;
|
|
161
277
|
/** @override — iterate via paginated SQL queries */
|
|
162
278
|
iterate(queryStr: string): AsyncGenerator<InstanceType<T>, any, any>;
|
|
163
279
|
/**
|
package/lib/sqlstore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlstore.d.ts","sourceRoot":"","sources":["../src/sqlstore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAsB,eAAe,EAA4B,MAAM,aAAa,CAAC;AACrH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;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