@encore.dev/sdk 2.0.0-beta.15 → 2.0.0-beta.16
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 +111 -101
- package/app_meta.ts +56 -54
- package/config/config.ts +60 -57
- package/config/secrets.ts +45 -52
- package/config/value.ts +23 -26
- package/cron/mod.ts +28 -29
- package/dist/app_meta.d.ts +52 -50
- package/dist/app_meta.d.ts.map +1 -1
- package/dist/app_meta.js +2 -2
- package/dist/app_meta.js.map +1 -1
- package/dist/config/config.d.ts +58 -55
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +8 -9
- package/dist/config/config.js.map +1 -1
- package/dist/config/secrets.d.ts +45 -52
- package/dist/config/secrets.d.ts.map +1 -1
- package/dist/config/secrets.js +8 -9
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/value.d.ts +20 -23
- package/dist/config/value.d.ts.map +1 -1
- package/dist/config/value.js +20 -23
- package/dist/config/value.js.map +1 -1
- package/dist/cron/mod.d.ts +26 -27
- package/dist/cron/mod.d.ts.map +1 -1
- package/dist/cron/mod.js +13 -14
- package/dist/cron/mod.js.map +1 -1
- package/dist/frontends/mod.d.ts +20 -19
- package/dist/frontends/mod.d.ts.map +1 -1
- package/dist/frontends/mod.js +20 -19
- package/dist/frontends/mod.js.map +1 -1
- package/dist/gateway/errors.d.ts +28 -30
- package/dist/gateway/errors.d.ts.map +1 -1
- package/dist/gateway/errors.js +29 -31
- package/dist/gateway/errors.js.map +1 -1
- package/dist/gateway/match.d.ts +54 -54
- package/dist/gateway/match.d.ts.map +1 -1
- package/dist/gateway/match.js +56 -56
- package/dist/gateway/match.js.map +1 -1
- package/dist/gateway/middleware.d.ts +62 -64
- package/dist/gateway/middleware.d.ts.map +1 -1
- package/dist/gateway/middleware.js +1 -1
- package/dist/gateway/middleware.js.map +1 -1
- package/dist/gateway/mod.d.ts +64 -67
- package/dist/gateway/mod.d.ts.map +1 -1
- package/dist/gateway/mod.js +72 -76
- package/dist/gateway/mod.js.map +1 -1
- package/dist/gateway/request.d.ts +138 -134
- package/dist/gateway/request.d.ts.map +1 -1
- package/dist/gateway/request.js +117 -108
- package/dist/gateway/request.js.map +1 -1
- package/dist/gateway/serve.d.ts +29 -34
- package/dist/gateway/serve.d.ts.map +1 -1
- package/dist/gateway/serve.js +51 -56
- package/dist/gateway/serve.js.map +1 -1
- package/dist/gateways/mod.d.ts +23 -21
- package/dist/gateways/mod.d.ts.map +1 -1
- package/dist/gateways/mod.js +25 -23
- package/dist/gateways/mod.js.map +1 -1
- package/dist/internal/runtime/napi/napi.cjs +1 -1
- package/dist/internal/runtime/napi/napi.d.cts +10 -3
- package/dist/internal/runtime/shutdown.d.ts +75 -57
- package/dist/internal/runtime/shutdown.d.ts.map +1 -1
- package/dist/internal/runtime/shutdown.js +88 -84
- package/dist/internal/runtime/shutdown.js.map +1 -1
- package/dist/log/logger.d.ts +43 -37
- package/dist/log/logger.d.ts.map +1 -1
- package/dist/log/logger.js +26 -25
- package/dist/log/logger.js.map +1 -1
- package/dist/metrics/mod.d.ts +133 -114
- package/dist/metrics/mod.d.ts.map +1 -1
- package/dist/metrics/mod.js +109 -101
- package/dist/metrics/mod.js.map +1 -1
- package/dist/otel.d.ts +6 -3
- package/dist/otel.d.ts.map +1 -1
- package/dist/otel.js +6 -3
- package/dist/otel.js.map +1 -1
- package/dist/pubsub/subscription.d.ts +88 -116
- package/dist/pubsub/subscription.d.ts.map +1 -1
- package/dist/pubsub/subscription.js +14 -17
- package/dist/pubsub/subscription.js.map +1 -1
- package/dist/pubsub/topic.d.ts +86 -113
- package/dist/pubsub/topic.d.ts.map +1 -1
- package/dist/pubsub/topic.js +68 -82
- package/dist/pubsub/topic.js.map +1 -1
- package/dist/reqctx/mod.d.ts +83 -86
- package/dist/reqctx/mod.d.ts.map +1 -1
- package/dist/reqctx/mod.js +39 -41
- package/dist/reqctx/mod.js.map +1 -1
- package/dist/services/index.d.ts +76 -75
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +73 -71
- package/dist/services/index.js.map +1 -1
- package/dist/shutdown/mod.d.ts +26 -25
- package/dist/shutdown/mod.d.ts.map +1 -1
- package/dist/shutdown/mod.js +26 -25
- package/dist/shutdown/mod.js.map +1 -1
- package/dist/storage/clickhouse/database.d.ts +113 -115
- package/dist/storage/clickhouse/database.d.ts.map +1 -1
- package/dist/storage/clickhouse/database.js +65 -79
- package/dist/storage/clickhouse/database.js.map +1 -1
- package/dist/storage/clickhouse/errors.d.ts +25 -26
- package/dist/storage/clickhouse/errors.d.ts.map +1 -1
- package/dist/storage/clickhouse/errors.js +15 -17
- package/dist/storage/clickhouse/errors.js.map +1 -1
- package/dist/storage/clickhouse/mod.d.ts +10 -10
- package/dist/storage/clickhouse/mod.js +10 -10
- package/dist/storage/objects/bucket.d.ts +196 -225
- package/dist/storage/objects/bucket.d.ts.map +1 -1
- package/dist/storage/objects/bucket.js +71 -84
- package/dist/storage/objects/bucket.js.map +1 -1
- package/dist/storage/objects/error.d.ts +4 -4
- package/dist/storage/objects/error.js +4 -4
- package/dist/storage/postgres/database.d.ts +124 -149
- package/dist/storage/postgres/database.d.ts.map +1 -1
- package/dist/storage/postgres/database.js +98 -135
- package/dist/storage/postgres/database.js.map +1 -1
- package/dist/storage/postgres/errors.d.ts +42 -48
- package/dist/storage/postgres/errors.d.ts.map +1 -1
- package/dist/storage/postgres/errors.js +44 -51
- package/dist/storage/postgres/errors.js.map +1 -1
- package/dist/storage/postgres/interval.d.ts +19 -19
- package/dist/storage/postgres/interval.d.ts.map +1 -1
- package/dist/storage/postgres/interval.js +21 -21
- package/dist/storage/postgres/interval.js.map +1 -1
- package/dist/storage/redis/bitfield.d.ts +48 -23
- package/dist/storage/redis/bitfield.d.ts.map +1 -1
- package/dist/storage/redis/bitfield.js +38 -19
- package/dist/storage/redis/bitfield.js.map +1 -1
- package/dist/storage/redis/command.d.ts +16 -12
- package/dist/storage/redis/command.d.ts.map +1 -1
- package/dist/storage/redis/command.js +16 -12
- package/dist/storage/redis/command.js.map +1 -1
- package/dist/storage/redis/commands.d.ts +99 -100
- package/dist/storage/redis/commands.d.ts.map +1 -1
- package/dist/storage/redis/commands.js +84 -85
- package/dist/storage/redis/commands.js.map +1 -1
- package/dist/storage/redis/database.d.ts +138 -122
- package/dist/storage/redis/database.d.ts.map +1 -1
- package/dist/storage/redis/database.js +120 -101
- package/dist/storage/redis/database.js.map +1 -1
- package/dist/storage/redis/mod.d.ts +52 -48
- package/dist/storage/redis/mod.d.ts.map +1 -1
- package/dist/storage/redis/mod.js +52 -48
- package/dist/storage/redis/mod.js.map +1 -1
- package/dist/storage/redis/options.d.ts +26 -24
- package/dist/storage/redis/options.d.ts.map +1 -1
- package/dist/storage/redis/options.js.map +1 -1
- package/dist/storage/redis/pubsub.d.ts +16 -16
- package/dist/storage/redis/pubsub.d.ts.map +1 -1
- package/dist/storage/redis/pubsub.js +14 -14
- package/dist/storage/redis/pubsub.js.map +1 -1
- package/dist/storage/redis/reply.d.ts +80 -72
- package/dist/storage/redis/reply.d.ts.map +1 -1
- package/dist/storage/redis/reply.js +53 -46
- package/dist/storage/redis/reply.js.map +1 -1
- package/dist/storage/redis/scan.d.ts +4 -4
- package/dist/storage/redis/scan.d.ts.map +1 -1
- package/dist/storage/redis/scan.js +6 -6
- package/dist/storage/redis/scan.js.map +1 -1
- package/dist/storage/redis/script.d.ts +28 -21
- package/dist/storage/redis/script.d.ts.map +1 -1
- package/dist/storage/redis/script.js +29 -22
- package/dist/storage/redis/script.js.map +1 -1
- package/dist/storage/redis/target.d.ts +17 -1
- package/dist/storage/redis/target.d.ts.map +1 -1
- package/dist/storage/redis/target.js +30 -1
- package/dist/storage/redis/target.js.map +1 -1
- package/dist/storage/redis/wire.d.ts +6 -6
- package/dist/storage/redis/wire.d.ts.map +1 -1
- package/dist/storage/redis/wire.js +6 -6
- package/dist/storage/redis/wire.js.map +1 -1
- package/dist/testing/mod.d.ts +83 -88
- package/dist/testing/mod.d.ts.map +1 -1
- package/dist/testing/mod.js +75 -81
- package/dist/testing/mod.js.map +1 -1
- package/dist/testing/playwright.d.ts +28 -32
- package/dist/testing/playwright.d.ts.map +1 -1
- package/dist/testing/playwright.js +22 -27
- package/dist/testing/playwright.js.map +1 -1
- package/dist/testing/puppeteer.d.ts +11 -12
- package/dist/testing/puppeteer.d.ts.map +1 -1
- package/dist/testing/puppeteer.js +17 -18
- package/dist/testing/puppeteer.js.map +1 -1
- package/dist/testing/system.d.ts +72 -90
- package/dist/testing/system.d.ts.map +1 -1
- package/dist/testing/system.js +90 -107
- package/dist/testing/system.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/frontends/mod.test.ts +6 -2
- package/frontends/mod.ts +20 -19
- package/gateway/errors.ts +30 -32
- package/gateway/match.ts +61 -57
- package/gateway/middleware.ts +62 -64
- package/gateway/mod.ts +73 -76
- package/gateway/request.ts +143 -140
- package/gateway/serve.ts +58 -63
- package/gateways/mod.ts +25 -23
- package/internal/runtime/napi/napi.cjs +1 -1
- package/internal/runtime/napi/napi.d.cts +10 -3
- package/internal/runtime/shutdown.ts +113 -101
- package/log/logger.test.ts +8 -0
- package/log/logger.ts +48 -45
- package/metrics/mod.ts +138 -122
- package/otel.ts +6 -3
- package/package.json +1 -1
- package/pubsub/subscription.ts +93 -123
- package/pubsub/topic.ts +96 -130
- package/reqctx/mod.ts +83 -86
- package/services/index.ts +78 -78
- package/shutdown/mod.ts +26 -25
- package/storage/clickhouse/database.ts +115 -129
- package/storage/clickhouse/errors.ts +27 -29
- package/storage/clickhouse/mod.ts +10 -10
- package/storage/objects/bucket.ts +209 -239
- package/storage/objects/error.ts +4 -4
- package/storage/postgres/database.ts +131 -164
- package/storage/postgres/errors.ts +45 -52
- package/storage/postgres/interval.ts +21 -21
- package/storage/redis/bitfield.ts +51 -26
- package/storage/redis/command.ts +16 -12
- package/storage/redis/commands.ts +99 -100
- package/storage/redis/database.ts +145 -123
- package/storage/redis/mod.ts +52 -48
- package/storage/redis/options.ts +26 -24
- package/storage/redis/pubsub.ts +14 -14
- package/storage/redis/redis.test.ts +17 -2
- package/storage/redis/reply.ts +85 -77
- package/storage/redis/scan.ts +6 -6
- package/storage/redis/script.ts +29 -22
- package/storage/redis/target.ts +34 -1
- package/storage/redis/wire.ts +8 -8
- package/testing/mod.ts +99 -105
- package/testing/playwright.ts +32 -37
- package/testing/puppeteer.ts +22 -23
- package/testing/system.ts +117 -133
|
@@ -2,41 +2,33 @@ import { activeCtxBytes } from '../../internal/otel/index.js';
|
|
|
2
2
|
import * as runtime from '../../internal/runtime/mod.js';
|
|
3
3
|
import { currentScope, testMode } from '../../internal/testing/scope.js';
|
|
4
4
|
import { native, TooManyRowsError } from './errors.js';
|
|
5
|
-
/** Base class containing shared query
|
|
5
|
+
/** Base class containing shared query and execution methods. */
|
|
6
6
|
class BaseQueryExecutor {
|
|
7
7
|
handle;
|
|
8
|
-
/**
|
|
9
|
-
* the current test's instance of it, in test mode.
|
|
10
|
-
* @internal */
|
|
8
|
+
/** Native handle or lazy per-test resolver. @internal */
|
|
11
9
|
constructor(handle) {
|
|
12
10
|
this.handle = handle;
|
|
13
11
|
}
|
|
14
|
-
/**
|
|
12
|
+
/** Native handle on which statements execute. */
|
|
15
13
|
get impl() {
|
|
16
14
|
return typeof this.handle === 'function' ? this.handle() : this.handle;
|
|
17
15
|
}
|
|
18
16
|
/**
|
|
19
|
-
*
|
|
20
|
-
* with
|
|
21
|
-
*
|
|
22
|
-
* It returns an async generator, that allows iterating over the results
|
|
23
|
-
* in a streaming fashion using `for await`.
|
|
17
|
+
* Streams rows from a parameterized tagged-template SQL query, replacing
|
|
18
|
+
* `${value}` placeholders with `$1`, `$2`, ... to prevent SQL injection.
|
|
19
|
+
* Iterate over results with `for await`.
|
|
24
20
|
*
|
|
25
21
|
* @example
|
|
26
|
-
*
|
|
27
22
|
* const email = "foo@example.com";
|
|
28
|
-
* const result = database.query`SELECT id FROM users WHERE email=${email}
|
|
29
|
-
*
|
|
30
|
-
* This produces the query: "SELECT id FROM users WHERE email=$1".
|
|
23
|
+
* const result = database.query`SELECT id FROM users WHERE email=${email}`;
|
|
24
|
+
* // Executes: "SELECT id FROM users WHERE email=$1"
|
|
31
25
|
*/
|
|
32
26
|
async *query(strings, ...params) {
|
|
33
27
|
yield* this.rawQuery(buildQuery(strings, params), ...params);
|
|
34
28
|
}
|
|
35
29
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* It returns an async generator, that allows iterating over the results
|
|
39
|
-
* in a streaming fashion using `for await`.
|
|
30
|
+
* Streams rows from a raw parameterized SQL query using `$1`, `$2`, ...
|
|
31
|
+
* placeholders. Iterate over results with `for await`.
|
|
40
32
|
*
|
|
41
33
|
* @example
|
|
42
34
|
* const query = "SELECT id FROM users WHERE email=$1";
|
|
@@ -46,8 +38,8 @@ class BaseQueryExecutor {
|
|
|
46
38
|
* }
|
|
47
39
|
*
|
|
48
40
|
* @param query - The raw SQL query string.
|
|
49
|
-
* @param params -
|
|
50
|
-
* @returns An async generator
|
|
41
|
+
* @param params - Positional parameters for the query.
|
|
42
|
+
* @returns An async generator yielding rows from the query result.
|
|
51
43
|
*/
|
|
52
44
|
async *rawQuery(query, ...params) {
|
|
53
45
|
const cursor = await native(this.impl.query(query, buildQueryArgs(params), activeCtxBytes()));
|
|
@@ -64,28 +56,20 @@ class BaseQueryExecutor {
|
|
|
64
56
|
}
|
|
65
57
|
}
|
|
66
58
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* It returns an array of all results.
|
|
59
|
+
* Executes a parameterized tagged-template SQL query and collects all rows
|
|
60
|
+
* into an array.
|
|
71
61
|
*
|
|
72
62
|
* @example
|
|
73
|
-
*
|
|
74
63
|
* const email = "foo@example.com";
|
|
75
|
-
* const
|
|
76
|
-
*
|
|
77
|
-
* This produces the query: "SELECT id FROM users WHERE email=$1".
|
|
64
|
+
* const rows = await database.queryAll`SELECT id FROM users WHERE email=${email}`;
|
|
78
65
|
*/
|
|
79
66
|
async queryAll(strings, ...params) {
|
|
80
67
|
return this.rawQueryAll(buildQuery(strings, params), ...params);
|
|
81
68
|
}
|
|
82
69
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* It returns an array of all results.
|
|
70
|
+
* Executes a raw parameterized SQL query and collects all rows into an array.
|
|
86
71
|
*
|
|
87
72
|
* @example
|
|
88
|
-
*
|
|
89
73
|
* const query = "SELECT id FROM users WHERE email=$1";
|
|
90
74
|
* const email = "foo@example.com";
|
|
91
75
|
* const rows = await database.rawQueryAll(query, email);
|
|
@@ -97,31 +81,30 @@ class BaseQueryExecutor {
|
|
|
97
81
|
return rows;
|
|
98
82
|
}
|
|
99
83
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
84
|
+
* Executes a parameterized tagged-template SQL query expecting at most one
|
|
85
|
+
* row. Returns `null` if no rows match, or throws {@link TooManyRowsError}
|
|
86
|
+
* if more than one row matches.
|
|
103
87
|
*
|
|
104
88
|
* @example
|
|
105
89
|
* const email = "foo@example.com";
|
|
106
|
-
* const
|
|
90
|
+
* const row = await database.queryRow`SELECT id FROM users WHERE email=${email}`;
|
|
107
91
|
*/
|
|
108
92
|
async queryRow(strings, ...params) {
|
|
109
93
|
return this.rawQueryRow(buildQuery(strings, params), ...params);
|
|
110
94
|
}
|
|
111
95
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
96
|
+
* Executes a raw parameterized SQL query expecting at most one row. Returns
|
|
97
|
+
* `null` if no rows match, or throws {@link TooManyRowsError} if more than
|
|
98
|
+
* one row matches.
|
|
115
99
|
*
|
|
116
100
|
* @example
|
|
117
101
|
* const query = "SELECT id FROM users WHERE email=$1";
|
|
118
102
|
* const email = "foo@example.com";
|
|
119
103
|
* const result = await database.rawQueryRow(query, email);
|
|
120
|
-
* console.log(result);
|
|
121
104
|
*
|
|
122
105
|
* @param query - The raw SQL query string.
|
|
123
|
-
* @param params -
|
|
124
|
-
* @returns A promise
|
|
106
|
+
* @param params - Positional parameters for the query.
|
|
107
|
+
* @returns A promise resolving to the single matching row or `null`.
|
|
125
108
|
*/
|
|
126
109
|
async rawQueryRow(query, ...params) {
|
|
127
110
|
let first = null;
|
|
@@ -133,17 +116,18 @@ class BaseQueryExecutor {
|
|
|
133
116
|
return first;
|
|
134
117
|
}
|
|
135
118
|
/**
|
|
136
|
-
*
|
|
119
|
+
* Executes a parameterized tagged-template statement and returns the
|
|
120
|
+
* affected row count.
|
|
137
121
|
*
|
|
138
122
|
* @example
|
|
139
123
|
* const email = "foo@example.com";
|
|
140
|
-
* const result = database.exec`DELETE FROM users WHERE email=${email}
|
|
124
|
+
* const result = await database.exec`DELETE FROM users WHERE email=${email}`;
|
|
141
125
|
*/
|
|
142
126
|
async exec(strings, ...params) {
|
|
143
127
|
return this.rawExec(buildQuery(strings, params), ...params);
|
|
144
128
|
}
|
|
145
129
|
/**
|
|
146
|
-
*
|
|
130
|
+
* Executes a raw parameterized statement and returns the affected row count.
|
|
147
131
|
*
|
|
148
132
|
* @example
|
|
149
133
|
* const query = "DELETE FROM users WHERE email=$1";
|
|
@@ -151,8 +135,8 @@ class BaseQueryExecutor {
|
|
|
151
135
|
* await database.rawExec(query, email);
|
|
152
136
|
*
|
|
153
137
|
* @param query - The raw SQL query string.
|
|
154
|
-
* @param params -
|
|
155
|
-
* @returns The affected
|
|
138
|
+
* @param params - Positional parameters for the statement.
|
|
139
|
+
* @returns The affected row count after the statement completes.
|
|
156
140
|
*/
|
|
157
141
|
async rawExec(query, ...params) {
|
|
158
142
|
const cursor = await native(this.impl.query(query, buildQueryArgs(params), activeCtxBytes()));
|
|
@@ -173,9 +157,8 @@ const isolationLevels = {
|
|
|
173
157
|
serializable: runtime.SQLIsolationLevel.Serializable,
|
|
174
158
|
};
|
|
175
159
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* `readOnly: false` on a read handle's pool or connection.
|
|
160
|
+
* Starts a transaction on `impl` with validated `options`. Throws `TypeError`
|
|
161
|
+
* for unknown isolation levels or `readOnly: false` on a read-only handle.
|
|
179
162
|
*/
|
|
180
163
|
async function beginOn(impl, options) {
|
|
181
164
|
let opts;
|
|
@@ -187,7 +170,7 @@ async function beginOn(impl, options) {
|
|
|
187
170
|
`expected one of ${Object.keys(isolationLevels).join(', ')}`);
|
|
188
171
|
}
|
|
189
172
|
if (readOnly === false && impl.isReadOnly()) {
|
|
190
|
-
throw new TypeError(
|
|
173
|
+
throw new TypeError('read-only database handles cannot start read-write transactions (readOnly cannot be false)');
|
|
191
174
|
}
|
|
192
175
|
opts = {
|
|
193
176
|
isolation: isolation === undefined ? undefined : isolationLevels[isolation],
|
|
@@ -198,27 +181,27 @@ async function beginOn(impl, options) {
|
|
|
198
181
|
return new Transaction(await native(impl.begin(opts, activeCtxBytes())));
|
|
199
182
|
}
|
|
200
183
|
/**
|
|
201
|
-
* A query handle
|
|
202
|
-
*
|
|
203
|
-
*
|
|
184
|
+
* A scoped query handle safe to pass into application or library code. Obtain
|
|
185
|
+
* one with `read()`, `write()`, `admin()`, `acquire()`, or `begin()`.
|
|
186
|
+
* {@link Database} deliberately does not extend `Queryable`.
|
|
204
187
|
*/
|
|
205
188
|
export class Queryable extends BaseQueryExecutor {
|
|
206
189
|
queryableBrand = true;
|
|
207
190
|
}
|
|
208
191
|
/**
|
|
209
|
-
* A database handle with access recorded by Encore
|
|
192
|
+
* A database handle with an access level recorded statically by Encore at its
|
|
193
|
+
* creation site (`read()`, `write()`, or `admin()`).
|
|
210
194
|
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
* or admin handle runs read-write.
|
|
195
|
+
* Read handles execute on read-only connections where writes fail with a
|
|
196
|
+
* `DatabaseError` (`code: "read_only_transaction"`, SQLSTATE 25006), and any
|
|
197
|
+
* transactions or connections they create are also read-only. Write and admin
|
|
198
|
+
* handles execute read-write.
|
|
216
199
|
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
200
|
+
* When no dedicated read-only pool is configured, read handles share the
|
|
201
|
+
* primary pool with `default_transaction_read_only = on` (which guards against
|
|
202
|
+
* accidental writes, though explicit `SET default_transaction_read_only = off`
|
|
203
|
+
* would lift it); with a dedicated read-only pool, the database role itself
|
|
204
|
+
* enforces read-only permissions.
|
|
222
205
|
*/
|
|
223
206
|
export class DatabaseRef extends Queryable {
|
|
224
207
|
/** @internal */
|
|
@@ -226,42 +209,38 @@ export class DatabaseRef extends Queryable {
|
|
|
226
209
|
super(impl);
|
|
227
210
|
}
|
|
228
211
|
/**
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* `primary` is set), and otherwise to the primary. Either way its session
|
|
234
|
-
* is read-only (`default_transaction_read_only` is on), so a write fails
|
|
235
|
-
* with SQLSTATE 25006 until SQL on it turns that off; through the
|
|
236
|
-
* read-only pool, its role refuses writes still.
|
|
212
|
+
* PostgreSQL connection string for connecting with an external client using
|
|
213
|
+
* this handle's access level. Write/admin handles connect read-write; read
|
|
214
|
+
* handles connect to the read-only replica pool if configured (unless
|
|
215
|
+
* `primary: true` was passed) with `default_transaction_read_only` enabled.
|
|
237
216
|
*/
|
|
238
217
|
get connectionString() {
|
|
239
218
|
return this.impl.connString();
|
|
240
219
|
}
|
|
241
220
|
/**
|
|
242
|
-
* Acquires a
|
|
243
|
-
* See {@link Database.acquire}.
|
|
221
|
+
* Acquires a dedicated connection from the pool with this handle's access
|
|
222
|
+
* level. See {@link Database.acquire}.
|
|
244
223
|
*/
|
|
245
224
|
async acquire() {
|
|
246
225
|
return new Connection(await native(this.impl.acquire(activeCtxBytes())));
|
|
247
226
|
}
|
|
248
227
|
/**
|
|
249
|
-
* Begins a transaction with this handle's access
|
|
250
|
-
*
|
|
228
|
+
* Begins a transaction with this handle's access level (always read-only for
|
|
229
|
+
* read handles). See {@link Database.begin}.
|
|
251
230
|
*/
|
|
252
231
|
async begin(options) {
|
|
253
232
|
return beginOn(this.impl, options);
|
|
254
233
|
}
|
|
255
234
|
}
|
|
256
235
|
/**
|
|
257
|
-
*
|
|
258
|
-
*
|
|
236
|
+
* Declares a PostgreSQL database. Encore provisions the database, runs its
|
|
237
|
+
* migrations, and returns this handle.
|
|
259
238
|
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
239
|
+
* To reference an existing database without declaring a duplicate, use
|
|
240
|
+
* {@link Database.named}.
|
|
262
241
|
*/
|
|
263
242
|
export class Database extends BaseQueryExecutor {
|
|
264
|
-
/**
|
|
243
|
+
/** Cached read handles, created on first use. */
|
|
265
244
|
reader;
|
|
266
245
|
primaryReader;
|
|
267
246
|
dbName;
|
|
@@ -270,16 +249,16 @@ export class Database extends BaseQueryExecutor {
|
|
|
270
249
|
this.dbName = name;
|
|
271
250
|
}
|
|
272
251
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
252
|
+
* References an existing database by name. Use `new Database(name)` to
|
|
253
|
+
* declare a new database.
|
|
275
254
|
*/
|
|
276
255
|
static named(name) {
|
|
277
256
|
return new Database(name);
|
|
278
257
|
}
|
|
279
258
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
259
|
+
* Returns a read-only handle. Queries run on read-only connections (routed
|
|
260
|
+
* to a read replica when available unless `options.primary` is `true`), and
|
|
261
|
+
* write statements fail.
|
|
283
262
|
*/
|
|
284
263
|
read(options = {}) {
|
|
285
264
|
if (options.primary) {
|
|
@@ -287,11 +266,11 @@ export class Database extends BaseQueryExecutor {
|
|
|
287
266
|
}
|
|
288
267
|
return (this.reader ??= this.ref(runtime.SQLAccess.Read));
|
|
289
268
|
}
|
|
290
|
-
/**
|
|
269
|
+
/** Returns a read-write handle. */
|
|
291
270
|
write() {
|
|
292
271
|
return new DatabaseRef(testMode ? () => this.impl : this.impl);
|
|
293
272
|
}
|
|
294
|
-
/**
|
|
273
|
+
/** Returns an admin handle with read, write, and admin access. */
|
|
295
274
|
admin() {
|
|
296
275
|
return this.write();
|
|
297
276
|
}
|
|
@@ -308,24 +287,23 @@ export class Database extends BaseQueryExecutor {
|
|
|
308
287
|
});
|
|
309
288
|
}
|
|
310
289
|
/**
|
|
311
|
-
* Returns
|
|
312
|
-
* read-
|
|
313
|
-
* {@link DatabaseRef.connectionString}.
|
|
290
|
+
* Returns a read-write PostgreSQL connection string for external clients.
|
|
291
|
+
* For a read-only connection string, use {@link DatabaseRef.connectionString}.
|
|
314
292
|
*/
|
|
315
293
|
get connectionString() {
|
|
316
294
|
return this.impl.connString();
|
|
317
295
|
}
|
|
318
296
|
/**
|
|
319
|
-
* Acquires a
|
|
297
|
+
* Acquires a dedicated connection from the pool.
|
|
298
|
+
*
|
|
299
|
+
* When closed or garbage-collected, the connection is returned to the pool.
|
|
300
|
+
* Session settings and roles changed directly via `SET`, `set_config`, or
|
|
301
|
+
* `SET ROLE` are reset before reuse (changes made inside stored functions or
|
|
302
|
+
* procedures are not tracked automatically). To scope a setting such as a
|
|
303
|
+
* tenant ID for row-level security to one unit of work, use
|
|
304
|
+
* `set_config(name, value, true)` inside a transaction.
|
|
320
305
|
*
|
|
321
|
-
*
|
|
322
|
-
* Settings and the role its session was given (`SET`, `set_config`,
|
|
323
|
-
* `SET ROLE`) are reset before the pool lends it again, when a statement
|
|
324
|
-
* sent on it did so: one a function or procedure changes is not noticed,
|
|
325
|
-
* and stays for the next borrower. To scope a setting to a unit of work,
|
|
326
|
-
* such as a tenant id for row-level security, set it in a transaction with
|
|
327
|
-
* `set_config(name, value, true)`, which ends with it.
|
|
328
|
-
* @returns a new connection to the database
|
|
306
|
+
* @returns A dedicated {@link Connection} implementing `AsyncDisposable`.
|
|
329
307
|
*/
|
|
330
308
|
async acquire() {
|
|
331
309
|
const impl = await native(this.impl.acquire(activeCtxBytes()));
|
|
@@ -334,9 +312,8 @@ export class Database extends BaseQueryExecutor {
|
|
|
334
312
|
/**
|
|
335
313
|
* Begins a database transaction.
|
|
336
314
|
*
|
|
337
|
-
* Prefer
|
|
338
|
-
*
|
|
339
|
-
* the variable goes out of scope:
|
|
315
|
+
* Prefer `await using`, which automatically rolls back the transaction if
|
|
316
|
+
* neither `commit()` nor `rollback()` is called before leaving the scope:
|
|
340
317
|
*
|
|
341
318
|
* ```ts
|
|
342
319
|
* await using tx = await db.begin();
|
|
@@ -344,38 +321,32 @@ export class Database extends BaseQueryExecutor {
|
|
|
344
321
|
* await tx.commit();
|
|
345
322
|
* ```
|
|
346
323
|
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
* `options` sets the transaction's isolation level and whether it is
|
|
351
|
-
* read-only or deferrable:
|
|
324
|
+
* Otherwise, always call `commit()` or `rollback()` explicitly to avoid
|
|
325
|
+
* leaked transactions. Pass `options` to configure isolation level,
|
|
326
|
+
* read-only mode, or deferrability:
|
|
352
327
|
*
|
|
353
328
|
* ```ts
|
|
354
329
|
* await using tx = await db.begin({isolation: 'serializable'});
|
|
355
330
|
* ```
|
|
356
331
|
*
|
|
357
|
-
* @returns
|
|
332
|
+
* @returns A {@link Transaction} implementing `AsyncDisposable`.
|
|
358
333
|
*/
|
|
359
334
|
async begin(options) {
|
|
360
335
|
return beginOn(this.impl, options);
|
|
361
336
|
}
|
|
362
337
|
}
|
|
363
338
|
/**
|
|
364
|
-
* Represents
|
|
339
|
+
* Represents an active database transaction.
|
|
365
340
|
*
|
|
366
|
-
* `
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
* out of scope:
|
|
341
|
+
* Implements `AsyncDisposable` for use with `await using`, automatically
|
|
342
|
+
* rolling back if neither `commit()` nor `rollback()` is called before leaving
|
|
343
|
+
* the scope:
|
|
370
344
|
*
|
|
371
345
|
* ```ts
|
|
372
346
|
* await using tx = await db.begin();
|
|
373
347
|
* await tx.exec`INSERT INTO ...`;
|
|
374
348
|
* await tx.commit();
|
|
375
349
|
* ```
|
|
376
|
-
*
|
|
377
|
-
* If you can't use `await using`, make sure to always call `commit` or
|
|
378
|
-
* `rollback` yourself to prevent hanging transactions.
|
|
379
350
|
*/
|
|
380
351
|
export class Transaction extends Queryable {
|
|
381
352
|
done = false;
|
|
@@ -384,7 +355,7 @@ export class Transaction extends Queryable {
|
|
|
384
355
|
super(impl);
|
|
385
356
|
}
|
|
386
357
|
/**
|
|
387
|
-
*
|
|
358
|
+
* Commits the transaction.
|
|
388
359
|
*/
|
|
389
360
|
async commit() {
|
|
390
361
|
try {
|
|
@@ -395,7 +366,7 @@ export class Transaction extends Queryable {
|
|
|
395
366
|
}
|
|
396
367
|
}
|
|
397
368
|
/**
|
|
398
|
-
*
|
|
369
|
+
* Rolls back the transaction.
|
|
399
370
|
*/
|
|
400
371
|
async rollback() {
|
|
401
372
|
try {
|
|
@@ -412,7 +383,7 @@ export class Transaction extends Queryable {
|
|
|
412
383
|
}
|
|
413
384
|
}
|
|
414
385
|
/**
|
|
415
|
-
* Represents a dedicated connection
|
|
386
|
+
* Represents a dedicated PostgreSQL connection acquired from the pool.
|
|
416
387
|
*/
|
|
417
388
|
export class Connection extends Queryable {
|
|
418
389
|
/** @internal */
|
|
@@ -420,9 +391,9 @@ export class Connection extends Queryable {
|
|
|
420
391
|
super(impl);
|
|
421
392
|
}
|
|
422
393
|
/**
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
394
|
+
* Begins a transaction that exclusively borrows this connection until it
|
|
395
|
+
* completes (always read-only on connections acquired from a read handle).
|
|
396
|
+
* See {@link Database.begin}.
|
|
426
397
|
*/
|
|
427
398
|
async begin(options) {
|
|
428
399
|
return beginOn(this.impl, options);
|
|
@@ -437,11 +408,7 @@ export class Connection extends Queryable {
|
|
|
437
408
|
await native(this.impl.close());
|
|
438
409
|
}
|
|
439
410
|
}
|
|
440
|
-
/**
|
|
441
|
-
* The handle of the database `name` in test mode, for each call: the current
|
|
442
|
-
* test's instance of it, or the process's own outside any test, made on
|
|
443
|
-
* first use.
|
|
444
|
-
*/
|
|
411
|
+
/** Resolves the database handle for `name` in test mode (per-test or process fallback). */
|
|
445
412
|
function testHandle(name) {
|
|
446
413
|
let own;
|
|
447
414
|
return () => currentScope()?.sqlDatabase(name) ?? (own ??= runtime.RT.sqlDatabase(name));
|
|
@@ -459,11 +426,7 @@ function buildQuery(strings, expr) {
|
|
|
459
426
|
function buildQueryArgs(params) {
|
|
460
427
|
return new runtime.QueryArgs(params.map(p => (Array.isArray(p) ? p.map(param) : param(p))));
|
|
461
428
|
}
|
|
462
|
-
/**
|
|
463
|
-
* `p` as the native module takes it: null for undefined, and a
|
|
464
|
-
* `Temporal.Duration`'s ISO 8601 string, which Postgres parses as an
|
|
465
|
-
* `interval`.
|
|
466
|
-
*/
|
|
429
|
+
/** Converts `undefined` to `null` and `Temporal.Duration` to ISO 8601 strings for PostgreSQL. */
|
|
467
430
|
function param(p) {
|
|
468
431
|
if (p === undefined)
|
|
469
432
|
return null;
|
|
@@ -471,7 +434,7 @@ function param(p) {
|
|
|
471
434
|
return p.toString();
|
|
472
435
|
return p;
|
|
473
436
|
}
|
|
474
|
-
/**
|
|
437
|
+
/** Detects `Temporal.Duration` instances when the runtime supports Temporal. */
|
|
475
438
|
function isTemporalDuration(p) {
|
|
476
439
|
return (typeof p === 'object' &&
|
|
477
440
|
p !== null &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../../storage/postgres/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../../storage/postgres/database.ts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