alchemy 0.87.0 → 0.90.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/bin/alchemy.js +485 -543
- package/lib/cloudflare/compatibility-date.d.ts +1 -1
- package/lib/cloudflare/compatibility-date.d.ts.map +1 -1
- package/lib/cloudflare/dns-records.d.ts +6 -0
- package/lib/cloudflare/dns-records.d.ts.map +1 -1
- package/lib/cloudflare/dns-records.js +14 -12
- package/lib/cloudflare/dns-records.js.map +1 -1
- package/lib/cloudflare/index.d.ts +1 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +1 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/r2-bucket-notification.d.ts +312 -0
- package/lib/cloudflare/r2-bucket-notification.d.ts.map +1 -0
- package/lib/cloudflare/r2-bucket-notification.js +387 -0
- package/lib/cloudflare/r2-bucket-notification.js.map +1 -0
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +8 -1
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/workflow.d.ts +17 -0
- package/lib/cloudflare/workflow.d.ts.map +1 -1
- package/lib/cloudflare/workflow.js +1 -0
- package/lib/cloudflare/workflow.js.map +1 -1
- package/lib/cloudflare/wrangler.json.js +1 -0
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/docker/api.d.ts +40 -0
- package/lib/docker/api.d.ts.map +1 -1
- package/lib/docker/api.js +30 -0
- package/lib/docker/api.js.map +1 -1
- package/lib/docker/network.d.ts.map +1 -1
- package/lib/docker/network.js +24 -7
- package/lib/docker/network.js.map +1 -1
- package/lib/encrypt.d.ts.map +1 -1
- package/lib/encrypt.js +2 -2
- package/lib/encrypt.js.map +1 -1
- package/lib/planetscale/api.d.ts +1 -0
- package/lib/planetscale/api.d.ts.map +1 -1
- package/lib/planetscale/api.js +1 -1
- package/lib/planetscale/api.js.map +1 -1
- package/lib/planetscale/branch.d.ts +28 -0
- package/lib/planetscale/branch.d.ts.map +1 -1
- package/lib/planetscale/branch.js +12 -0
- package/lib/planetscale/branch.js.map +1 -1
- package/lib/planetscale/database-extensions.d.ts +515 -0
- package/lib/planetscale/database-extensions.d.ts.map +1 -0
- package/lib/planetscale/database-extensions.js +389 -0
- package/lib/planetscale/database-extensions.js.map +1 -0
- package/lib/planetscale/database.d.ts +40 -2
- package/lib/planetscale/database.d.ts.map +1 -1
- package/lib/planetscale/database.js +76 -1
- package/lib/planetscale/database.js.map +1 -1
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +1 -2
- package/lib/scope.js.map +1 -1
- package/lib/util/telemetry.d.ts +1 -6
- package/lib/util/telemetry.d.ts.map +1 -1
- package/lib/util/telemetry.js.map +1 -1
- package/package.json +6 -6
- package/src/cloudflare/dns-records.ts +25 -16
- package/src/cloudflare/index.ts +1 -0
- package/src/cloudflare/r2-bucket-notification.ts +809 -0
- package/src/cloudflare/worker.ts +8 -1
- package/src/cloudflare/workflow.ts +18 -0
- package/src/cloudflare/wrangler.json.ts +1 -0
- package/src/docker/api.ts +61 -0
- package/src/docker/network.ts +27 -7
- package/src/encrypt.ts +2 -0
- package/src/planetscale/api.ts +1 -1
- package/src/planetscale/branch.ts +45 -0
- package/src/planetscale/database-extensions.ts +947 -0
- package/src/planetscale/database.ts +141 -2
- package/src/scope.ts +1 -2
- package/src/util/telemetry.ts +1 -20
- package/workers/cloudflare-state-store.js +57 -57
- package/workers/tunnel-proxy.js +1 -1
- package/lib/state/instrumented-state-store.d.ts +0 -19
- package/lib/state/instrumented-state-store.d.ts.map +0 -1
- package/lib/state/instrumented-state-store.js +0 -68
- package/lib/state/instrumented-state-store.js.map +0 -1
- package/src/state/instrumented-state-store.ts +0 -108
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { type PlanetScaleProps } from "./api.ts";
|
|
2
|
+
import type { Branch } from "./branch.ts";
|
|
3
|
+
import type { Database } from "./database.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the pg_cron extension.
|
|
6
|
+
* Schedules and runs PostgreSQL commands inside the database.
|
|
7
|
+
*/
|
|
8
|
+
export interface PgCronConfig {
|
|
9
|
+
/**
|
|
10
|
+
* The database in which pg_cron metadata is kept.
|
|
11
|
+
* @default "postgres"
|
|
12
|
+
*/
|
|
13
|
+
databaseName?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to launch active jobs when pg_cron starts.
|
|
16
|
+
* @default "on"
|
|
17
|
+
*/
|
|
18
|
+
launchActiveJobs?: "on" | "off";
|
|
19
|
+
/**
|
|
20
|
+
* Minimum message level for pg_cron log messages.
|
|
21
|
+
* @default "warning"
|
|
22
|
+
*/
|
|
23
|
+
logMinMessages?: "error" | "warning" | "notice" | "info" | "log" | "debug";
|
|
24
|
+
/**
|
|
25
|
+
* Whether to log each job run into the job_run_details table.
|
|
26
|
+
* @default "on"
|
|
27
|
+
*/
|
|
28
|
+
logRun?: "on" | "off";
|
|
29
|
+
/**
|
|
30
|
+
* Whether to log the SQL statement of each job.
|
|
31
|
+
* @default "on"
|
|
32
|
+
*/
|
|
33
|
+
logStatement?: "on" | "off";
|
|
34
|
+
/**
|
|
35
|
+
* Maximum number of concurrently running jobs.
|
|
36
|
+
* @default 1
|
|
37
|
+
*/
|
|
38
|
+
maxRunningJobs?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Configuration for the pg_duckdb extension.
|
|
42
|
+
* Embeds DuckDB inside PostgreSQL for analytical queries.
|
|
43
|
+
*/
|
|
44
|
+
export interface PgDuckdbConfig {
|
|
45
|
+
/**
|
|
46
|
+
* The PostgreSQL role used by DuckDB.
|
|
47
|
+
* @default "pscale_superuser"
|
|
48
|
+
*/
|
|
49
|
+
postgresRole?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Memory limit for DuckDB. 0 means unlimited.
|
|
52
|
+
* @default "0"
|
|
53
|
+
*/
|
|
54
|
+
memoryLimit?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Configuration for the pg_hint_plan extension.
|
|
58
|
+
* Controls query execution plans using hints in SQL comments.
|
|
59
|
+
*/
|
|
60
|
+
export interface PgHintPlanConfig {
|
|
61
|
+
/**
|
|
62
|
+
* Whether to enable hint processing.
|
|
63
|
+
* @default "on"
|
|
64
|
+
*/
|
|
65
|
+
enableHint?: "on" | "off";
|
|
66
|
+
/**
|
|
67
|
+
* Whether to enable the hint table feature.
|
|
68
|
+
* @default "off"
|
|
69
|
+
*/
|
|
70
|
+
enableHintTable?: "on" | "off";
|
|
71
|
+
/**
|
|
72
|
+
* Message level for hint parsing messages.
|
|
73
|
+
* @default "info"
|
|
74
|
+
*/
|
|
75
|
+
parseMessages?: "error" | "warning" | "notice" | "info" | "log" | "debug";
|
|
76
|
+
/**
|
|
77
|
+
* Controls debug output of query plans.
|
|
78
|
+
* @default "off"
|
|
79
|
+
*/
|
|
80
|
+
debugPrint?: "off" | "on" | "detailed" | "verbose";
|
|
81
|
+
/**
|
|
82
|
+
* Message level for debug output.
|
|
83
|
+
* @default "info"
|
|
84
|
+
*/
|
|
85
|
+
messageLevel?: "error" | "warning" | "notice" | "info" | "log" | "debug";
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Configuration for the pg_partman background worker extension.
|
|
89
|
+
* Automates partition management for time-based and serial-based partitioning.
|
|
90
|
+
*/
|
|
91
|
+
export interface PgPartmanBgwConfig {
|
|
92
|
+
/**
|
|
93
|
+
* How often (in seconds) the background worker runs maintenance.
|
|
94
|
+
* @default 3600
|
|
95
|
+
*/
|
|
96
|
+
interval?: number;
|
|
97
|
+
/**
|
|
98
|
+
* The database to connect to for maintenance.
|
|
99
|
+
* @default "postgres"
|
|
100
|
+
*/
|
|
101
|
+
dbname?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The role to use when connecting.
|
|
104
|
+
* @default "postgres"
|
|
105
|
+
*/
|
|
106
|
+
role?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Whether to run ANALYZE on partitions after maintenance.
|
|
109
|
+
* @default "off"
|
|
110
|
+
*/
|
|
111
|
+
analyze?: "on" | "off";
|
|
112
|
+
/**
|
|
113
|
+
* Whether to use pg_jobmon for logging.
|
|
114
|
+
* @default "on"
|
|
115
|
+
*/
|
|
116
|
+
jobmon?: "on" | "off";
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Configuration for the pg_squeeze extension.
|
|
120
|
+
* Removes dead tuples from tables with minimal locking.
|
|
121
|
+
*/
|
|
122
|
+
export interface PgSqueezeConfig {
|
|
123
|
+
/**
|
|
124
|
+
* Maximum time (in milliseconds) to hold an exclusive lock during processing. 0 means no limit.
|
|
125
|
+
* @default 0
|
|
126
|
+
*/
|
|
127
|
+
maxXlockTime?: number;
|
|
128
|
+
/**
|
|
129
|
+
* Databases in which the squeeze worker auto-starts, comma-separated.
|
|
130
|
+
* @default "postgres"
|
|
131
|
+
*/
|
|
132
|
+
workerAutostart?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Number of squeeze workers per database.
|
|
135
|
+
* @default 1
|
|
136
|
+
*/
|
|
137
|
+
workersPerDatabase?: number;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Configuration for the pg_stat_statements extension.
|
|
141
|
+
* Tracks planning and execution statistics of all SQL statements.
|
|
142
|
+
*/
|
|
143
|
+
export interface PgStatStatementsConfig {
|
|
144
|
+
/**
|
|
145
|
+
* Maximum number of statements tracked.
|
|
146
|
+
* @default 5000
|
|
147
|
+
*/
|
|
148
|
+
max?: number;
|
|
149
|
+
/**
|
|
150
|
+
* Which statements to track.
|
|
151
|
+
* @default "top"
|
|
152
|
+
*/
|
|
153
|
+
track?: "top" | "all";
|
|
154
|
+
/**
|
|
155
|
+
* Whether to track utility commands.
|
|
156
|
+
* @default "on"
|
|
157
|
+
*/
|
|
158
|
+
trackUtility?: "on" | "off";
|
|
159
|
+
/**
|
|
160
|
+
* Whether to track planning statistics.
|
|
161
|
+
* @default "off"
|
|
162
|
+
*/
|
|
163
|
+
trackPlanning?: "on" | "off";
|
|
164
|
+
/**
|
|
165
|
+
* Whether to save statistics across server restarts.
|
|
166
|
+
* @default "on"
|
|
167
|
+
*/
|
|
168
|
+
save?: "on" | "off";
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Configuration for the timescaledb extension.
|
|
172
|
+
* Provides time-series data support for PostgreSQL.
|
|
173
|
+
*/
|
|
174
|
+
export interface TimescaledbConfig {
|
|
175
|
+
/**
|
|
176
|
+
* Log level for the background worker.
|
|
177
|
+
* @default "warning"
|
|
178
|
+
*/
|
|
179
|
+
bgwLogLevel?: "error" | "warning" | "notice" | "info" | "log" | "debug";
|
|
180
|
+
/**
|
|
181
|
+
* Enable chunk append optimization.
|
|
182
|
+
* @default "on"
|
|
183
|
+
*/
|
|
184
|
+
enableChunkAppend?: "on" | "off";
|
|
185
|
+
/**
|
|
186
|
+
* Enable chunk skipping optimization.
|
|
187
|
+
* @default "off"
|
|
188
|
+
*/
|
|
189
|
+
enableChunkSkipping?: "on" | "off";
|
|
190
|
+
/**
|
|
191
|
+
* Enable constraint-aware append optimization.
|
|
192
|
+
* @default "on"
|
|
193
|
+
*/
|
|
194
|
+
enableConstraintAwareAppend?: "on" | "off";
|
|
195
|
+
/**
|
|
196
|
+
* Enable constraint exclusion optimization.
|
|
197
|
+
* @default "on"
|
|
198
|
+
*/
|
|
199
|
+
enableConstraintExclusion?: "on" | "off";
|
|
200
|
+
/**
|
|
201
|
+
* Enable custom hash aggregate optimization.
|
|
202
|
+
* @default "off"
|
|
203
|
+
*/
|
|
204
|
+
enableCustomHashagg?: "on" | "off";
|
|
205
|
+
/**
|
|
206
|
+
* Enable deprecation warnings.
|
|
207
|
+
* @default "on"
|
|
208
|
+
*/
|
|
209
|
+
enableDeprecationWarnings?: "on" | "off";
|
|
210
|
+
/**
|
|
211
|
+
* Enable event triggers.
|
|
212
|
+
* @default "off"
|
|
213
|
+
*/
|
|
214
|
+
enableEventTriggers?: "on" | "off";
|
|
215
|
+
/**
|
|
216
|
+
* Enable foreign key propagation.
|
|
217
|
+
* @default "on"
|
|
218
|
+
*/
|
|
219
|
+
enableForeignKeyPropagation?: "on" | "off";
|
|
220
|
+
/**
|
|
221
|
+
* Enable logging of job execution.
|
|
222
|
+
* @default "off"
|
|
223
|
+
*/
|
|
224
|
+
enableJobExecutionLogging?: "on" | "off";
|
|
225
|
+
/**
|
|
226
|
+
* Enable now() constification.
|
|
227
|
+
* @default "on"
|
|
228
|
+
*/
|
|
229
|
+
enableNowConstify?: "on" | "off";
|
|
230
|
+
/**
|
|
231
|
+
* Enable query optimizations.
|
|
232
|
+
* @default "on"
|
|
233
|
+
*/
|
|
234
|
+
enableOptimizations?: "on" | "off";
|
|
235
|
+
/**
|
|
236
|
+
* Enable ordered append optimization.
|
|
237
|
+
* @default "on"
|
|
238
|
+
*/
|
|
239
|
+
enableOrderedAppend?: "on" | "off";
|
|
240
|
+
/**
|
|
241
|
+
* Enable parallel chunk append optimization.
|
|
242
|
+
* @default "on"
|
|
243
|
+
*/
|
|
244
|
+
enableParallelChunkAppend?: "on" | "off";
|
|
245
|
+
/**
|
|
246
|
+
* Enable qual propagation optimization.
|
|
247
|
+
* @default "on"
|
|
248
|
+
*/
|
|
249
|
+
enableQualPropagation?: "on" | "off";
|
|
250
|
+
/**
|
|
251
|
+
* Enable runtime exclusion optimization.
|
|
252
|
+
* @default "on"
|
|
253
|
+
*/
|
|
254
|
+
enableRuntimeExclusion?: "on" | "off";
|
|
255
|
+
/**
|
|
256
|
+
* Enable tiered reads.
|
|
257
|
+
* @default "on"
|
|
258
|
+
*/
|
|
259
|
+
enableTieredReads?: "on" | "off";
|
|
260
|
+
/**
|
|
261
|
+
* Enable TSS callbacks.
|
|
262
|
+
* @default "on"
|
|
263
|
+
*/
|
|
264
|
+
enableTssCallbacks?: "on" | "off";
|
|
265
|
+
/**
|
|
266
|
+
* Maximum number of cached chunks per hypertable.
|
|
267
|
+
* @default 1024
|
|
268
|
+
*/
|
|
269
|
+
maxCachedChunksPerHypertable?: number;
|
|
270
|
+
/**
|
|
271
|
+
* Maximum number of open chunks per insert.
|
|
272
|
+
* @default 1024
|
|
273
|
+
*/
|
|
274
|
+
maxOpenChunksPerInsert?: number;
|
|
275
|
+
/**
|
|
276
|
+
* Whether the database is being restored from a backup.
|
|
277
|
+
* @default "off"
|
|
278
|
+
*/
|
|
279
|
+
restoring?: "on" | "off";
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Configuration for the pgvector extension.
|
|
283
|
+
* Provides vector similarity search for PostgreSQL.
|
|
284
|
+
*/
|
|
285
|
+
export interface PgvectorConfig {
|
|
286
|
+
/**
|
|
287
|
+
* Size of the dynamic candidate list for HNSW search.
|
|
288
|
+
* @default 40
|
|
289
|
+
*/
|
|
290
|
+
hnswEfSearch?: number;
|
|
291
|
+
/**
|
|
292
|
+
* Whether to enable iterative scan for HNSW indexes.
|
|
293
|
+
* @default "off"
|
|
294
|
+
*/
|
|
295
|
+
hnswIterativeScan?: "off" | "relaxed_order" | "strict_order";
|
|
296
|
+
/**
|
|
297
|
+
* Maximum number of tuples to scan with HNSW iterative scan.
|
|
298
|
+
* @default 20000
|
|
299
|
+
*/
|
|
300
|
+
hnswMaxScanTuples?: number;
|
|
301
|
+
/**
|
|
302
|
+
* Memory multiplier for HNSW scans.
|
|
303
|
+
* @default 1
|
|
304
|
+
*/
|
|
305
|
+
hnswScanMemMultiplier?: number;
|
|
306
|
+
/**
|
|
307
|
+
* Number of probes for IVFFlat index search.
|
|
308
|
+
* @default 1
|
|
309
|
+
*/
|
|
310
|
+
ivfflatProbes?: number;
|
|
311
|
+
/**
|
|
312
|
+
* Whether to enable iterative scan for IVFFlat indexes.
|
|
313
|
+
* @default "off"
|
|
314
|
+
*/
|
|
315
|
+
ivfflatIterativeScan?: "off" | "relaxed_order" | "strict_order";
|
|
316
|
+
/**
|
|
317
|
+
* Maximum number of probes for IVFFlat iterative scan.
|
|
318
|
+
* @default 32768
|
|
319
|
+
*/
|
|
320
|
+
ivfflatMaxProbes?: number;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Configuration for the pginsights extension.
|
|
324
|
+
* Provides query performance insights.
|
|
325
|
+
*/
|
|
326
|
+
export interface PgInsightsConfig {
|
|
327
|
+
/**
|
|
328
|
+
* Whether to collect raw (un-normalized) queries.
|
|
329
|
+
* @default "off"
|
|
330
|
+
*/
|
|
331
|
+
rawQueries?: "on" | "off";
|
|
332
|
+
/**
|
|
333
|
+
* Whether to normalize schema names in queries.
|
|
334
|
+
* @default "off"
|
|
335
|
+
*/
|
|
336
|
+
normalizeSchemaNames?: "on" | "off";
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* PostgreSQL database extensions configuration.
|
|
340
|
+
*
|
|
341
|
+
* Each property represents an extension. If present (even as `{}`), the extension
|
|
342
|
+
* is enabled with the given config (or defaults). If absent/undefined, the extension
|
|
343
|
+
* is disabled.
|
|
344
|
+
*/
|
|
345
|
+
export interface DatabaseExtensions {
|
|
346
|
+
/**
|
|
347
|
+
* pg_cron - Job scheduler for PostgreSQL.
|
|
348
|
+
* Schedules and runs PostgreSQL commands on a recurring basis.
|
|
349
|
+
*/
|
|
350
|
+
pgCron?: PgCronConfig;
|
|
351
|
+
/**
|
|
352
|
+
* pg_duckdb - Embedded DuckDB for analytical queries.
|
|
353
|
+
*/
|
|
354
|
+
pgDuckdb?: PgDuckdbConfig;
|
|
355
|
+
/**
|
|
356
|
+
* pg_hint_plan - Query plan hints.
|
|
357
|
+
* Controls execution plans using hints in SQL comments.
|
|
358
|
+
*/
|
|
359
|
+
pgHintPlan?: PgHintPlanConfig;
|
|
360
|
+
/**
|
|
361
|
+
* pg_partman (background worker) - Partition management automation.
|
|
362
|
+
*/
|
|
363
|
+
pgPartmanBgw?: PgPartmanBgwConfig;
|
|
364
|
+
/**
|
|
365
|
+
* pg_squeeze - Dead tuple removal with minimal locking.
|
|
366
|
+
*/
|
|
367
|
+
pgSqueeze?: PgSqueezeConfig;
|
|
368
|
+
/**
|
|
369
|
+
* pg_stat_statements - Query execution statistics tracking.
|
|
370
|
+
*/
|
|
371
|
+
pgStatStatements?: PgStatStatementsConfig;
|
|
372
|
+
/**
|
|
373
|
+
* pg_strict - Stricter SQL behavior for PostgreSQL.
|
|
374
|
+
* This extension has no configurable parameters.
|
|
375
|
+
*/
|
|
376
|
+
pgStrict?: Record<string, never>;
|
|
377
|
+
/**
|
|
378
|
+
* timescaledb - Time-series data support.
|
|
379
|
+
*/
|
|
380
|
+
timescaledb?: TimescaledbConfig;
|
|
381
|
+
/**
|
|
382
|
+
* pgvector - Vector similarity search.
|
|
383
|
+
*/
|
|
384
|
+
vector?: PgvectorConfig;
|
|
385
|
+
/**
|
|
386
|
+
* pginsights - Query performance insights.
|
|
387
|
+
*/
|
|
388
|
+
pgInsights?: PgInsightsConfig;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* A single change within an extensions diff: add, remove, or update.
|
|
392
|
+
* @internal
|
|
393
|
+
*/
|
|
394
|
+
export interface ExtensionDiffEntry {
|
|
395
|
+
/**
|
|
396
|
+
* The shared_preload_libraries name (e.g. "pg_cron", "vector").
|
|
397
|
+
*/
|
|
398
|
+
library: string;
|
|
399
|
+
/**
|
|
400
|
+
* "add" = extension is being enabled,
|
|
401
|
+
* "remove" = extension is being disabled,
|
|
402
|
+
* "update" = extension params changed (stays enabled).
|
|
403
|
+
*/
|
|
404
|
+
action: "add" | "remove" | "update";
|
|
405
|
+
/**
|
|
406
|
+
* The pgconf parameter key-value pairs to send for this extension.
|
|
407
|
+
* Empty for "remove" actions.
|
|
408
|
+
*/
|
|
409
|
+
params: Record<string, string>;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Result of diffing two DatabaseExtensions objects.
|
|
413
|
+
* @internal
|
|
414
|
+
*/
|
|
415
|
+
export interface ExtensionsDiff {
|
|
416
|
+
/**
|
|
417
|
+
* Individual changes per extension.
|
|
418
|
+
*/
|
|
419
|
+
changes: ExtensionDiffEntry[];
|
|
420
|
+
/**
|
|
421
|
+
* True if there are any changes at all.
|
|
422
|
+
*/
|
|
423
|
+
hasChanges: boolean;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Converts a DatabaseExtensions object into a map of library name -> pgconf params.
|
|
427
|
+
* Only includes extensions that are present (enabled).
|
|
428
|
+
* @internal
|
|
429
|
+
*/
|
|
430
|
+
export declare function extensionsToParamMappings(extensions: DatabaseExtensions): Map<string, Record<string, string>>;
|
|
431
|
+
/**
|
|
432
|
+
* Computes the diff between two extension configurations.
|
|
433
|
+
*
|
|
434
|
+
* @param current - The currently active extensions (or `undefined`/`{}` if none)
|
|
435
|
+
* @param desired - The desired extensions configuration
|
|
436
|
+
* @returns An ExtensionsDiff describing what needs to change
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```ts
|
|
440
|
+
* const diff = diffExtensions(
|
|
441
|
+
* { pgCron: { maxRunningJobs: 1 } },
|
|
442
|
+
* { pgCron: { maxRunningJobs: 5 }, vector: {} },
|
|
443
|
+
* );
|
|
444
|
+
* // diff.changes = [
|
|
445
|
+
* // { library: "pg_cron", action: "update", params: { "cron.max_running_jobs": "5" } },
|
|
446
|
+
* // { library: "vector", action: "add", params: {} },
|
|
447
|
+
* // ]
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
export declare function diffExtensions(current: DatabaseExtensions | undefined, desired: DatabaseExtensions | undefined): ExtensionsDiff;
|
|
451
|
+
/**
|
|
452
|
+
* Options for updating database extensions.
|
|
453
|
+
*/
|
|
454
|
+
export interface UpdateExtensionsOptions extends PlanetScaleProps {
|
|
455
|
+
/**
|
|
456
|
+
* The organization name.
|
|
457
|
+
* @default process.env.PLANETSCALE_ORGANIZATION
|
|
458
|
+
*/
|
|
459
|
+
organization?: string;
|
|
460
|
+
/**
|
|
461
|
+
* The database name or Database resource.
|
|
462
|
+
*/
|
|
463
|
+
database: string | Database;
|
|
464
|
+
/**
|
|
465
|
+
* The branch name or Branch resource.
|
|
466
|
+
* @default "main"
|
|
467
|
+
*/
|
|
468
|
+
branch?: string | Branch;
|
|
469
|
+
/**
|
|
470
|
+
* The base URL of the PlanetScale API.
|
|
471
|
+
* @default "https://api.planetscale.com/v1"
|
|
472
|
+
*/
|
|
473
|
+
baseUrl?: string;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Updates the PostgreSQL extensions on a PlanetScale database branch.
|
|
477
|
+
*
|
|
478
|
+
* Uses the reverse-engineered two-phase change request API:
|
|
479
|
+
* 1. **Queue** — submits a change request with the desired extension config
|
|
480
|
+
* 2. **Apply** — triggers execution of the queued change
|
|
481
|
+
* 3. **Poll** — waits for the change to complete
|
|
482
|
+
*
|
|
483
|
+
* @param desired - The desired extension configuration. Extensions present are enabled;
|
|
484
|
+
* extensions absent are disabled.
|
|
485
|
+
* @param options - Connection and targeting options.
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
* ## Enable pgvector and pg_cron
|
|
489
|
+
*
|
|
490
|
+
* ```ts
|
|
491
|
+
* await updateExtensions(
|
|
492
|
+
* {
|
|
493
|
+
* vector: { hnswEfSearch: 100 },
|
|
494
|
+
* pgCron: {},
|
|
495
|
+
* },
|
|
496
|
+
* {
|
|
497
|
+
* organization: "my-org",
|
|
498
|
+
* database: "my-db",
|
|
499
|
+
* branch: "main",
|
|
500
|
+
* },
|
|
501
|
+
* );
|
|
502
|
+
* ```
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ## Disable all user extensions
|
|
506
|
+
*
|
|
507
|
+
* ```ts
|
|
508
|
+
* await updateExtensions({}, {
|
|
509
|
+
* organization: "my-org",
|
|
510
|
+
* database: "my-db",
|
|
511
|
+
* });
|
|
512
|
+
* ```
|
|
513
|
+
*/
|
|
514
|
+
export declare function updateExtensions(desired: DatabaseExtensions, options: UpdateExtensionsOptions): Promise<void>;
|
|
515
|
+
//# sourceMappingURL=database-extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-extensions.d.ts","sourceRoot":"","sources":["../../src/planetscale/database-extensions.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAS9C;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;IAC3E;;;OAGG;IACH,MAAM,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IAC5B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IAC/B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;IAC1E;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,GAAG,IAAI,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