@alchemy.run/planetscale 0.0.0-stage → 2.0.0-beta.84

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.
Files changed (123) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +87 -2
  3. package/lib/AuthProvider.d.ts +64 -0
  4. package/lib/AuthProvider.d.ts.map +1 -0
  5. package/lib/AuthProvider.js +384 -0
  6. package/lib/AuthProvider.js.map +1 -0
  7. package/lib/Branch.d.ts +128 -0
  8. package/lib/Branch.d.ts.map +1 -0
  9. package/lib/Branch.js +420 -0
  10. package/lib/Branch.js.map +1 -0
  11. package/lib/Contributions.d.ts +7 -0
  12. package/lib/Contributions.d.ts.map +1 -0
  13. package/lib/Contributions.js +6 -0
  14. package/lib/Contributions.js.map +1 -0
  15. package/lib/Credentials.d.ts +33 -0
  16. package/lib/Credentials.d.ts.map +1 -0
  17. package/lib/Credentials.js +65 -0
  18. package/lib/Credentials.js.map +1 -0
  19. package/lib/Database.d.ts +138 -0
  20. package/lib/Database.d.ts.map +1 -0
  21. package/lib/Database.js +1 -0
  22. package/lib/Database.js.map +1 -0
  23. package/lib/MySQL/MySQLBranch.d.ts +87 -0
  24. package/lib/MySQL/MySQLBranch.d.ts.map +1 -0
  25. package/lib/MySQL/MySQLBranch.js +15 -0
  26. package/lib/MySQL/MySQLBranch.js.map +1 -0
  27. package/lib/MySQL/MySQLClusterSize.d.ts +32 -0
  28. package/lib/MySQL/MySQLClusterSize.d.ts.map +1 -0
  29. package/lib/MySQL/MySQLClusterSize.js +111 -0
  30. package/lib/MySQL/MySQLClusterSize.js.map +1 -0
  31. package/lib/MySQL/MySQLDatabase.d.ts +141 -0
  32. package/lib/MySQL/MySQLDatabase.d.ts.map +1 -0
  33. package/lib/MySQL/MySQLDatabase.js +294 -0
  34. package/lib/MySQL/MySQLDatabase.js.map +1 -0
  35. package/lib/MySQL/MySQLMigrations.d.ts +24 -0
  36. package/lib/MySQL/MySQLMigrations.d.ts.map +1 -0
  37. package/lib/MySQL/MySQLMigrations.js +106 -0
  38. package/lib/MySQL/MySQLMigrations.js.map +1 -0
  39. package/lib/MySQL/MySQLOrigin.d.ts +15 -0
  40. package/lib/MySQL/MySQLOrigin.d.ts.map +1 -0
  41. package/lib/MySQL/MySQLOrigin.js +2 -0
  42. package/lib/MySQL/MySQLOrigin.js.map +1 -0
  43. package/lib/MySQL/MySQLPassword.d.ts +116 -0
  44. package/lib/MySQL/MySQLPassword.d.ts.map +1 -0
  45. package/lib/MySQL/MySQLPassword.js +212 -0
  46. package/lib/MySQL/MySQLPassword.js.map +1 -0
  47. package/lib/MySQL/index.d.ts +6 -0
  48. package/lib/MySQL/index.d.ts.map +1 -0
  49. package/lib/MySQL/index.js +6 -0
  50. package/lib/MySQL/index.js.map +1 -0
  51. package/lib/OAuthClient.d.ts +32 -0
  52. package/lib/OAuthClient.d.ts.map +1 -0
  53. package/lib/OAuthClient.js +52 -0
  54. package/lib/OAuthClient.js.map +1 -0
  55. package/lib/Postgres/PostgresBranch.d.ts +75 -0
  56. package/lib/Postgres/PostgresBranch.d.ts.map +1 -0
  57. package/lib/Postgres/PostgresBranch.js +15 -0
  58. package/lib/Postgres/PostgresBranch.js.map +1 -0
  59. package/lib/Postgres/PostgresClusterSize.d.ts +77 -0
  60. package/lib/Postgres/PostgresClusterSize.d.ts.map +1 -0
  61. package/lib/Postgres/PostgresClusterSize.js +89 -0
  62. package/lib/Postgres/PostgresClusterSize.js.map +1 -0
  63. package/lib/Postgres/PostgresDatabase.d.ts +95 -0
  64. package/lib/Postgres/PostgresDatabase.d.ts.map +1 -0
  65. package/lib/Postgres/PostgresDatabase.js +294 -0
  66. package/lib/Postgres/PostgresDatabase.js.map +1 -0
  67. package/lib/Postgres/PostgresDefaultRole.d.ts +94 -0
  68. package/lib/Postgres/PostgresDefaultRole.d.ts.map +1 -0
  69. package/lib/Postgres/PostgresDefaultRole.js +187 -0
  70. package/lib/Postgres/PostgresDefaultRole.js.map +1 -0
  71. package/lib/Postgres/PostgresMigrations.d.ts +24 -0
  72. package/lib/Postgres/PostgresMigrations.d.ts.map +1 -0
  73. package/lib/Postgres/PostgresMigrations.js +116 -0
  74. package/lib/Postgres/PostgresMigrations.js.map +1 -0
  75. package/lib/Postgres/PostgresOrigin.d.ts +15 -0
  76. package/lib/Postgres/PostgresOrigin.d.ts.map +1 -0
  77. package/lib/Postgres/PostgresOrigin.js +2 -0
  78. package/lib/Postgres/PostgresOrigin.js.map +1 -0
  79. package/lib/Postgres/PostgresRole.d.ts +142 -0
  80. package/lib/Postgres/PostgresRole.d.ts.map +1 -0
  81. package/lib/Postgres/PostgresRole.js +268 -0
  82. package/lib/Postgres/PostgresRole.js.map +1 -0
  83. package/lib/Postgres/index.d.ts +7 -0
  84. package/lib/Postgres/index.d.ts.map +1 -0
  85. package/lib/Postgres/index.js +7 -0
  86. package/lib/Postgres/index.js.map +1 -0
  87. package/lib/Providers.d.ts +24 -0
  88. package/lib/Providers.d.ts.map +1 -0
  89. package/lib/Providers.js +40 -0
  90. package/lib/Providers.js.map +1 -0
  91. package/lib/Util.d.ts +93 -0
  92. package/lib/Util.d.ts.map +1 -0
  93. package/lib/Util.js +135 -0
  94. package/lib/Util.js.map +1 -0
  95. package/lib/index.d.ts +9 -0
  96. package/lib/index.d.ts.map +1 -0
  97. package/lib/index.js +9 -0
  98. package/lib/index.js.map +1 -0
  99. package/package.json +94 -3
  100. package/src/AuthProvider.ts +571 -0
  101. package/src/Branch.ts +657 -0
  102. package/src/Contributions.ts +9 -0
  103. package/src/Credentials.ts +116 -0
  104. package/src/Database.ts +152 -0
  105. package/src/MySQL/MySQLBranch.ts +109 -0
  106. package/src/MySQL/MySQLClusterSize.ts +185 -0
  107. package/src/MySQL/MySQLDatabase.ts +521 -0
  108. package/src/MySQL/MySQLMigrations.ts +182 -0
  109. package/src/MySQL/MySQLOrigin.ts +15 -0
  110. package/src/MySQL/MySQLPassword.ts +428 -0
  111. package/src/MySQL/index.ts +5 -0
  112. package/src/OAuthClient.ts +59 -0
  113. package/src/Postgres/PostgresBranch.ts +97 -0
  114. package/src/Postgres/PostgresClusterSize.ts +262 -0
  115. package/src/Postgres/PostgresDatabase.ts +469 -0
  116. package/src/Postgres/PostgresDefaultRole.ts +340 -0
  117. package/src/Postgres/PostgresMigrations.ts +193 -0
  118. package/src/Postgres/PostgresOrigin.ts +15 -0
  119. package/src/Postgres/PostgresRole.ts +547 -0
  120. package/src/Postgres/index.ts +6 -0
  121. package/src/Providers.ts +67 -0
  122. package/src/Util.ts +205 -0
  123. package/src/index.ts +14 -0
@@ -0,0 +1,294 @@
1
+ import { diffMigrations, migrationsAttrs, migrationsInputOf, stampedOf, } from "@alchemy.run/sql/Migrations";
2
+ import { hashImports } from "@alchemy.run/sql/SqlFile";
3
+ import * as planetscale from "@distilled.cloud/planetscale";
4
+ import { Credentials } from "@distilled.cloud/planetscale/Credentials";
5
+ import { havePropsChanged, isResolved } from "alchemy/Diff";
6
+ import { createPhysicalName } from "alchemy/PhysicalName";
7
+ import * as Provider from "alchemy/Provider";
8
+ import { Resource } from "alchemy/Resource";
9
+ import { recordsEqual } from "alchemy/Util/equal";
10
+ import * as Effect from "effect/Effect";
11
+ import * as Stream from "effect/Stream";
12
+ import { deleteUnprotectedDatabase, PlanetscaleConflict, replaceDatabase, waitForBranchReady, waitForDatabaseReady, } from "../Util.js";
13
+ import { ensureMySQLProductionBranchClusterSize, observeDefaultKeyspaceReplicas, } from "./MySQLClusterSize.js";
14
+ import { runMySQLImports, runMySQLMigrations } from "./MySQLMigrations.js";
15
+ /** @resource */
16
+ export const MySQLDatabase = Resource("Planetscale.MySQLDatabase");
17
+ export const MySQLDatabaseProvider = () => Provider.succeed(MySQLDatabase, {
18
+ stables: ["id", "organization", "region"],
19
+ diff: Effect.fn(function* ({ news, olds, output }) {
20
+ if (!isResolved(news))
21
+ return undefined;
22
+ // Database names are rename-mutable (reconcile folds `new_name`
23
+ // into the settings sync), so `name` cannot live in the
24
+ // provider-level stables. Almost no update is a rename though —
25
+ // for those, advertise `name` as stable on the update so
26
+ // downstream consumers (branches, passwords) still resolve
27
+ // `database.name` at plan time instead of seeing `undefined` and
28
+ // falsely planning a replacement. The name only changes when the
29
+ // `name` prop itself changes: an explicit name renames iff it
30
+ // differs from the observed name, and an omitted name is
31
+ // engine-generated deterministically (stable across updates).
32
+ const nameIsStable = output?.name !== undefined &&
33
+ (news.name !== undefined ? news.name === output.name : olds?.name === undefined);
34
+ const stables = nameIsStable ? ["id", "organization", "region", "name"] : undefined;
35
+ if (news.region?.slug !== undefined &&
36
+ output?.region?.slug !== undefined &&
37
+ news.region.slug !== output.region.slug) {
38
+ return yield* replaceDatabase(news, output, "region");
39
+ }
40
+ // Replicas reconcile in place via a keyspace resize — never a
41
+ // replacement. Diff against the observed keyspace replica count so
42
+ // an adopted database whose live state already matches plans no-op.
43
+ if (news.replicas !== undefined && news.replicas !== (output?.replicas ?? olds.replicas)) {
44
+ return { action: "update", stables };
45
+ }
46
+ if (yield* diffMigrations({ news, output })) {
47
+ return { action: "update", stables };
48
+ }
49
+ if (news.importFiles?.length) {
50
+ const newHashes = yield* hashImports(news.importFiles, yield* rootDir);
51
+ if (!recordsEqual(newHashes, output?.importHashes ?? {})) {
52
+ return { action: "update", stables };
53
+ }
54
+ }
55
+ // Remaining prop changes (rename, settings, clusterSize, …) are
56
+ // in-place updates. Decide them here instead of falling back to
57
+ // the engine's default deep-compare so the conditional `name`
58
+ // stable above is attached — the default path uses the
59
+ // provider-level stables, which strip `name` from downstream plan
60
+ // resolution.
61
+ if (havePropsChanged(olds, news)) {
62
+ return { action: "update", stables };
63
+ }
64
+ // Nothing changed. Still advertise the conditional `name` stable so
65
+ // a `--force` deploy (which upgrades this noop to an update) keeps
66
+ // `name` resolvable downstream instead of falsely replacing
67
+ // consumers such as roles and passwords (#1832).
68
+ return stables ? { action: "noop", stables } : undefined;
69
+ }),
70
+ read: Effect.fn(function* ({ id, output, olds }) {
71
+ const { organization } = yield* yield* Credentials;
72
+ const databaseName = output?.name ?? (yield* createDatabaseName(id, olds?.name));
73
+ return yield* planetscale
74
+ .getDatabase({
75
+ organization,
76
+ database: databaseName,
77
+ })
78
+ .pipe(Effect.flatMap(Effect.fn(function* (data) {
79
+ if (data.kind !== "mysql") {
80
+ return yield* new PlanetscaleConflict({
81
+ message: `Planetscale database "${data.name}" has kind "${data.kind}" but this resource ` +
82
+ `is a MySQLDatabase. Use Planetscale.${data.kind === "postgresql" ? "PostgresDatabase" : data.kind}() instead, ` +
83
+ `or delete the existing database and retry.`,
84
+ });
85
+ }
86
+ // Observe the default keyspace's live replica configuration
87
+ // so adopted databases diff against reality.
88
+ const replicas = yield* observeDefaultKeyspaceReplicas(organization, data.name, data.default_branch ?? "main");
89
+ return {
90
+ id: data.id,
91
+ name: data.name,
92
+ organization,
93
+ state: data.state,
94
+ defaultBranch: data.default_branch ?? "main",
95
+ replicas,
96
+ plan: data.plan ?? "hobby",
97
+ createdAt: data.created_at,
98
+ updatedAt: data.updated_at,
99
+ htmlUrl: data.html_url,
100
+ region: { slug: data.region.slug },
101
+ migrationsDir: output?.migrationsDir ?? (olds && migrationsInputOf(olds))?.dir,
102
+ migrationsTable: output?.migrationsTable ?? (olds && migrationsInputOf(olds))?.table,
103
+ migrationsHashes: output?.migrationsHashes ?? {},
104
+ importHashes: output?.importHashes ?? {},
105
+ clusterSize: output?.clusterSize ?? "",
106
+ requireApprovalForDeploy: data.require_approval_for_deploy ?? false,
107
+ restrictBranchRegion: data.restrict_branch_region ?? false,
108
+ insightsRawQueries: data.insights_raw_queries ?? false,
109
+ productionBranchWebConsole: data.production_branch_web_console ?? false,
110
+ deletionProtection: data.deletion_protected ?? false,
111
+ automaticMigrations: data.automatic_migrations ?? false,
112
+ migrationFramework: data.migration_framework ?? undefined,
113
+ migrationTableName: data.migration_table_name ?? undefined,
114
+ allowDataBranching: data.allow_data_branching ?? false,
115
+ allowForeignKeyConstraints: data.foreign_keys_enabled ?? false,
116
+ };
117
+ })), Effect.catchTag("NotFound", () => Effect.succeed(undefined)));
118
+ }),
119
+ reconcile: Effect.fn(function* ({ id, news, output, session }) {
120
+ const { organization } = yield* yield* Credentials;
121
+ const newName = yield* createDatabaseName(id, news.name);
122
+ const clusterSize = news.clusterSize;
123
+ // Observe — read live state under either the cached name (rename
124
+ // / refresh) or the freshly-derived name (greenfield). Observing
125
+ // unconditionally absorbs the race between `read` and `reconcile`
126
+ // — if a foreign actor (or a previously-failed-to-persist
127
+ // create) produced a database under the desired name in the
128
+ // meantime, we'll find it here and skip the duplicate create.
129
+ // Adoption routing has already been gated by `read` returning
130
+ // `Unowned`, so by the time we reach reconcile any observed
131
+ // database is fair game.
132
+ const observedName = output?.name ?? newName;
133
+ let observed = yield* planetscale
134
+ .getDatabase({
135
+ organization,
136
+ database: observedName,
137
+ })
138
+ .pipe(Effect.catchTag("NotFound", () => Effect.succeed(undefined)));
139
+ // Ensure — if missing, create.
140
+ if (!observed) {
141
+ yield* session.note("Creating database...");
142
+ // Note: the API rejects the `replicas` param for mysql databases;
143
+ // replicas are converged below via the keyspace resize lifecycle.
144
+ observed = yield* planetscale.createDatabase({
145
+ organization,
146
+ name: newName,
147
+ region: news.region?.slug,
148
+ kind: "mysql",
149
+ cluster_size: clusterSize,
150
+ });
151
+ }
152
+ // Wait for the database to finish provisioning before any
153
+ // downstream sync runs. PlanetScale reports `state: "pending"`
154
+ // for a while after createDatabase returns, during which branch
155
+ // operations on this database (including our own settings PATCH)
156
+ // race against the provisioning fiber.
157
+ yield* waitForDatabaseReady(organization, observed.name, session);
158
+ if (observed.kind !== "mysql") {
159
+ return yield* new PlanetscaleConflict({
160
+ message: `Planetscale database "${observed.name}" has kind "${observed.kind}" but this resource ` +
161
+ `is a MySQLDatabase. Use Planetscale.${observed.kind === "postgresql" ? "PostgresDatabase" : observed.kind}() instead, ` +
162
+ `or delete the existing database and retry.`,
163
+ });
164
+ }
165
+ // Sync — ensure a non-`main` default branch exists before
166
+ // referencing it via `default_branch`. The branch is created
167
+ // empty (no cluster size yet); we'll size it below.
168
+ if (news.defaultBranch && news.defaultBranch !== "main") {
169
+ yield* waitForDatabaseReady(organization, observed.name, session);
170
+ const branchExists = yield* planetscale
171
+ .getBranch({
172
+ organization,
173
+ database: observed.name,
174
+ branch: news.defaultBranch,
175
+ })
176
+ .pipe(Effect.map(() => true), Effect.catchTag("NotFound", () => Effect.succeed(false)));
177
+ if (!branchExists) {
178
+ yield* planetscale.createBranch({
179
+ organization,
180
+ database: observed.name,
181
+ name: news.defaultBranch,
182
+ parent_branch: "main",
183
+ // create branch with cluster size to skip resizing when promoting the branch
184
+ cluster_size: clusterSize,
185
+ });
186
+ }
187
+ }
188
+ // Sync settings — `updateSettings` is upsert-shaped, so we can
189
+ // call it with the full desired payload on every reconcile.
190
+ const updated = yield* planetscale.updateDatabaseSettings({
191
+ organization,
192
+ database: observed.name,
193
+ new_name: newName !== observed.name ? newName : undefined,
194
+ automatic_migrations: news.automaticMigrations,
195
+ migration_framework: news.migrationFramework,
196
+ migration_table_name: news.migrationTableName,
197
+ allow_foreign_key_constraints: news.allowForeignKeyConstraints,
198
+ allow_data_branching: news.allowDataBranching,
199
+ require_approval_for_deploy: news.requireApprovalForDeploy,
200
+ restrict_branch_region: news.restrictBranchRegion,
201
+ insights_raw_queries: news.insightsRawQueries,
202
+ production_branch_web_console: news.productionBranchWebConsole,
203
+ deletion_protected: news.deletionProtection,
204
+ default_branch: news.defaultBranch,
205
+ });
206
+ // Sync cluster size and replicas on the active default branch —
207
+ // both converge in place via PlanetScale's keyspace resize
208
+ // lifecycle, diffed against the observed default keyspace.
209
+ const branch = news.defaultBranch ?? updated.default_branch ?? "main";
210
+ const keyspace = yield* ensureMySQLProductionBranchClusterSize(organization, updated.name, branch, news.clusterSize, news.replicas);
211
+ const migrationTarget = {
212
+ organization,
213
+ database: updated.name,
214
+ branch,
215
+ };
216
+ const migrationsInput = migrationsInputOf(news);
217
+ if (migrationsInput || news.importFiles?.length) {
218
+ yield* waitForBranchReady(organization, updated.name, branch, session);
219
+ }
220
+ const migrations = migrationsInput
221
+ ? yield* runMySQLMigrations(migrationTarget, migrationsInput, stampedOf(output))
222
+ : undefined;
223
+ const importHashes = news.importFiles?.length
224
+ ? yield* runMySQLImports(migrationTarget, news.importFiles, yield* rootDir, output?.importHashes ?? {})
225
+ : {};
226
+ return {
227
+ id: updated.id,
228
+ name: updated.name,
229
+ organization,
230
+ state: updated.state,
231
+ defaultBranch: updated.default_branch ?? branch,
232
+ plan: updated.plan ?? output?.plan ?? "hobby",
233
+ createdAt: updated.created_at,
234
+ updatedAt: updated.updated_at,
235
+ htmlUrl: updated.html_url,
236
+ region: { slug: updated.region.slug },
237
+ clusterSize,
238
+ replicas: keyspace.replicas,
239
+ ...migrationsAttrs({ input: migrationsInput, run: migrations, output }),
240
+ importHashes,
241
+ requireApprovalForDeploy: updated.require_approval_for_deploy ?? false,
242
+ restrictBranchRegion: updated.restrict_branch_region ?? false,
243
+ insightsRawQueries: updated.insights_raw_queries ?? false,
244
+ productionBranchWebConsole: updated.production_branch_web_console ?? false,
245
+ deletionProtection: updated.deletion_protected ?? false,
246
+ automaticMigrations: updated.automatic_migrations ?? false,
247
+ migrationFramework: updated.migration_framework ?? undefined,
248
+ migrationTableName: updated.migration_table_name ?? undefined,
249
+ allowDataBranching: updated.allow_data_branching ?? false,
250
+ allowForeignKeyConstraints: updated.foreign_keys_enabled ?? false,
251
+ };
252
+ }),
253
+ delete: Effect.fn(function* ({ output }) {
254
+ yield* deleteUnprotectedDatabase(output.organization, output.name);
255
+ }),
256
+ list: Effect.fn(function* () {
257
+ const { organization } = yield* yield* Credentials;
258
+ return yield* planetscale.listDatabases.pages({ organization }).pipe(Stream.runCollect, Effect.map((chunk) => Array.from(chunk).flatMap((page) => page.data
259
+ .filter((db) => db.kind === "mysql")
260
+ .map((data) => ({
261
+ id: data.id,
262
+ name: data.name,
263
+ organization,
264
+ state: data.state,
265
+ defaultBranch: data.default_branch ?? "main",
266
+ plan: data.plan ?? "hobby",
267
+ createdAt: data.created_at,
268
+ updatedAt: data.updated_at,
269
+ htmlUrl: data.html_url,
270
+ region: { slug: data.region.slug },
271
+ migrationsDir: undefined,
272
+ migrationsTable: undefined,
273
+ migrationsHashes: {},
274
+ importHashes: {},
275
+ clusterSize: "",
276
+ replicas: undefined,
277
+ requireApprovalForDeploy: data.require_approval_for_deploy ?? false,
278
+ restrictBranchRegion: data.restrict_branch_region ?? false,
279
+ insightsRawQueries: data.insights_raw_queries ?? false,
280
+ productionBranchWebConsole: data.production_branch_web_console ?? false,
281
+ deletionProtection: data.deletion_protected ?? false,
282
+ automaticMigrations: data.automatic_migrations ?? false,
283
+ migrationFramework: data.migration_framework ?? undefined,
284
+ migrationTableName: data.migration_table_name ?? undefined,
285
+ allowDataBranching: data.allow_data_branching ?? false,
286
+ allowForeignKeyConstraints: data.foreign_keys_enabled ?? false,
287
+ })))));
288
+ }),
289
+ });
290
+ const createDatabaseName = (id, name) => Effect.gen(function* () {
291
+ return name ?? (yield* createPhysicalName({ id, lowercase: true, maxLength: 63 }));
292
+ });
293
+ const rootDir = Effect.sync(() => process.cwd());
294
+ //# sourceMappingURL=MySQLDatabase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MySQLDatabase.js","sourceRoot":"","sources":["../../src/MySQL/MySQLDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,SAAS,GACV,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC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IAAI,CAAC,kBAAkB,IAAI,KAAK;YACpD,mBAAmB,EAAE,IAAI,CAAC,oBAAoB,IAAI,KAAK;YACvD,kBAAkB,EAAE,IAAI,CAAC,mBAAmB,IAAI,SAAS;YACzD,kBAAkB,EAAE,IAAI,CAAC,oBAAoB,IAAI,SAAS;YAC1D,kBAAkB,EAAE,IAAI,CAAC,oBAAoB,IAAI,KAAK;YACtD,0BAA0B,EAAE,IAAI,CAAC,oBAAoB,IAAI,KAAK;SAC/D,CAAC,CAAC,CACN,CACF,CACF,CAAC;IACJ,CAAC,CAAC;CACH,CAAC,CAAC;AAEL,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAE,IAAwB,EAAE,EAAE,CAClE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC,CAAC;AAEL,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type NormalizedMigrationsInput, type StampedMigrationsState } from "@alchemy.run/sql/Migrations";
2
+ import * as ps from "@distilled.cloud/planetscale";
3
+ import * as Effect from "effect/Effect";
4
+ declare const MySQLMigrationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
5
+ readonly _tag: "Planetscale::MySQLMigrationError";
6
+ } & Readonly<A>;
7
+ export declare class MySQLMigrationError extends MySQLMigrationError_base<{
8
+ message: string;
9
+ cause?: unknown;
10
+ }> {
11
+ }
12
+ export interface MySQLMigrationTarget {
13
+ organization: string;
14
+ database: string;
15
+ branch: string;
16
+ }
17
+ /**
18
+ * PlanetScale MySQL's migration adaptation is exactly this: the shared
19
+ * pipeline with a temp-password-scoped mysql2 connection as its executor.
20
+ */
21
+ export declare const runMySQLMigrations: (target: MySQLMigrationTarget, input: NormalizedMigrationsInput, stamped: StampedMigrationsState) => Effect.Effect<import("@alchemy.run/sql/Migrations").MigrationRun, import("@alchemy.run/sql/Migrations").DrizzleV0LayoutError | MySQLMigrationError | ps.CreatePasswordError | import("@alchemy.run/sql/Migrations").MigrationApplyError, import("effect/FileSystem").FileSystem | import("effect/Path").Path | ps.PlanetScaleOpContext>;
22
+ export declare const runMySQLImports: (target: MySQLMigrationTarget, importFiles: ReadonlyArray<string>, rootDir: string, previous: Record<string, string>) => Effect.Effect<Record<string, string>, MySQLMigrationError | import("effect/PlatformError").PlatformError | ps.CreatePasswordError, import("effect/FileSystem").FileSystem | import("effect/Path").Path | ps.PlanetScaleOpContext>;
23
+ export {};
24
+ //# sourceMappingURL=MySQLMigrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MySQLMigrations.d.ts","sourceRoot":"","sources":["../../src/MySQL/MySQLMigrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC5B,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;AAiBxC,qBAAa,mBAAoB,SAAQ,yBAAqD;IAC5F,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;CAAG;AAEL,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,WACrB,oBAAoB,SACrB,yBAAyB,WACvB,sBAAsB,4UAO7B,CAAC;AAEL,eAAO,MAAM,eAAe,WAClB,oBAAoB,eACf,aAAa,CAAC,MAAM,CAAC,WACzB,MAAM,YACL,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,sOAkB9B,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { makeMySQLMigrationExecutor, runMigrations, } from "@alchemy.run/sql/Migrations";
2
+ import { readSqlFile, splitSqlStatements } from "@alchemy.run/sql/SqlFile";
3
+ import * as ps from "@distilled.cloud/planetscale";
4
+ import * as Data from "effect/Data";
5
+ import * as Effect from "effect/Effect";
6
+ import * as Redacted from "effect/Redacted";
7
+ import * as Schedule from "effect/Schedule";
8
+ const MIGRATION_PASSWORD_TTL_SECONDS = 600;
9
+ // `mysql2` is an optional peer dependency — loaded lazily so importing the
10
+ // Planetscale provider never requires the driver unless migrations run.
11
+ const importMysql = () => import("mysql2/promise").catch((cause) => {
12
+ throw new Error("Failed to load the 'mysql2' driver. Install the optional peer dependency 'mysql2' to run Planetscale MySQL migrations.", { cause });
13
+ });
14
+ export class MySQLMigrationError extends Data.TaggedError("Planetscale::MySQLMigrationError") {
15
+ }
16
+ /**
17
+ * PlanetScale MySQL's migration adaptation is exactly this: the shared
18
+ * pipeline with a temp-password-scoped mysql2 connection as its executor.
19
+ */
20
+ export const runMySQLMigrations = (target, input, stamped) => runMigrations({
21
+ input,
22
+ stamped,
23
+ withExecutor: (apply) => withMySQLConnection(target, (connection) => apply(makeMySQLMigrationExecutor(connection))),
24
+ });
25
+ export const runMySQLImports = (target, importFiles, rootDir, previous) => Effect.gen(function* () {
26
+ const hashes = { ...previous };
27
+ for (const filePath of importFiles) {
28
+ const file = yield* readSqlFile(rootDir, filePath);
29
+ if (previous[filePath] === file.hash) {
30
+ hashes[filePath] = file.hash;
31
+ continue;
32
+ }
33
+ yield* runMySQLSql(target, file.sql);
34
+ hashes[filePath] = file.hash;
35
+ }
36
+ const tracked = new Set(importFiles);
37
+ for (const key of Object.keys(hashes)) {
38
+ if (!tracked.has(key))
39
+ delete hashes[key];
40
+ }
41
+ return hashes;
42
+ });
43
+ const runMySQLSql = (target, sql) => withMySQLConnection(target, (connection) => Effect.gen(function* () {
44
+ for (const statement of splitSqlStatements(sql)) {
45
+ yield* mysqlQuery(connection, statement);
46
+ }
47
+ }));
48
+ const withMySQLConnection = (target, use) => withTemporaryMySQLPassword(target, (password) => Effect.acquireUseRelease(Effect.tryPromise({
49
+ try: async () => {
50
+ const { createConnection } = await importMysql();
51
+ return createConnection({
52
+ host: password.host,
53
+ user: password.username,
54
+ password: Redacted.value(password.password),
55
+ database: target.database,
56
+ multipleStatements: true,
57
+ ssl: { rejectUnauthorized: true },
58
+ });
59
+ },
60
+ catch: toMigrationError,
61
+ }), use, (connection) => Effect.tryPromise({
62
+ try: () => connection.end(),
63
+ catch: toMigrationError,
64
+ }).pipe(Effect.ignore)));
65
+ const withTemporaryMySQLPassword = (target, use) => Effect.acquireUseRelease(Effect.gen(function* () {
66
+ const created = yield* ps.createPassword({
67
+ organization: target.organization,
68
+ database: target.database,
69
+ branch: target.branch,
70
+ role: "admin",
71
+ ttl: MIGRATION_PASSWORD_TTL_SECONDS,
72
+ });
73
+ return {
74
+ id: created.id,
75
+ host: created.access_host_url,
76
+ username: created.username,
77
+ password: created.plain_text,
78
+ };
79
+ }), use, (password) => ps
80
+ .deletePassword({
81
+ organization: target.organization,
82
+ database: target.database,
83
+ branch: target.branch,
84
+ id: password.id,
85
+ })
86
+ .pipe(
87
+ // Already-deleted passwords are a success: nothing to clean up.
88
+ Effect.catchTag("NotFound", () => Effect.void), Effect.retry({
89
+ schedule: Schedule.max([Schedule.exponential("500 millis"), Schedule.recurs(5)]),
90
+ }),
91
+ // Migrations succeeded; don't fail the parent over a release-step
92
+ // hiccup. The password's TTL bounds the orphan window; log loudly
93
+ // so an operator can clean it up manually if needed.
94
+ Effect.catch((cause) => Effect.logWarning(`Failed to delete temporary Planetscale migration password after retries. ` +
95
+ `It will expire via TTL (~${MIGRATION_PASSWORD_TTL_SECONDS}s). ` +
96
+ `organization=${target.organization} database=${target.database} ` +
97
+ `branch=${target.branch} id=${password.id}`, cause))));
98
+ const mysqlQuery = (connection, sql) => Effect.tryPromise({
99
+ try: () => connection.query(sql).then(() => undefined),
100
+ catch: toMigrationError,
101
+ });
102
+ const toMigrationError = (cause) => new MySQLMigrationError({
103
+ message: cause instanceof Error ? cause.message : String(cause),
104
+ cause,
105
+ });
106
+ //# sourceMappingURL=MySQLMigrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MySQLMigrations.js","sourceRoot":"","sources":["../../src/MySQL/MySQLMigrations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,aAAa,GAGd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAE3C,2EAA2E;AAC3E,wEAAwE;AACxE,MAAM,WAAW,GAAG,GAAG,EAAE,CACvB,MAAM,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACvC,MAAM,IAAI,KAAK,CACb,wHAAwH,EACxH,EAAE,KAAK,EAAE,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,MAAM,OAAO,mBAAoB,SAAQ,IAAI,CAAC,WAAW,CAAC,kCAAkC,CAG1F;CAAG;AAQL;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAA4B,EAC5B,KAAgC,EAChC,OAA+B,EAC/B,EAAE,CACF,aAAa,CAAC;IACZ,KAAK;IACL,OAAO;IAC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AC7C,KAAK,CACN,CACF,CACF,CACN,CAAC;AAEJ,MAAM,UAAU,GAAG,CAAC,UAAsB,EAAE,GAAW,EAAE,EAAE,CACzD,MAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;IACtD,KAAK,EAAE,gBAAgB;CACxB,CAAC,CAAC;AAEL,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAAE,EAAE,CAC1C,IAAI,mBAAmB,CAAC;IACtB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;IAC/D,KAAK;CACN,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import * as Redacted from "effect/Redacted";
2
+ /**
3
+ * The shape `Cloudflare.Hyperdrive` and other MySQL consumers accept as an
4
+ * origin. Materialized on `Planetscale.MySQLPassword` so callers can wire
5
+ * password credentials into Hyperdrive directly.
6
+ */
7
+ export type MySQLOrigin = {
8
+ scheme: "mysql";
9
+ host: string;
10
+ port: number;
11
+ database: string;
12
+ user: string;
13
+ password: Redacted.Redacted<string>;
14
+ };
15
+ //# sourceMappingURL=MySQLOrigin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MySQLOrigin.d.ts","sourceRoot":"","sources":["../../src/MySQL/MySQLOrigin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import * as Redacted from "effect/Redacted";
2
+ //# sourceMappingURL=MySQLOrigin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MySQLOrigin.js","sourceRoot":"","sources":["../../src/MySQL/MySQLOrigin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,116 @@
1
+ import * as planetscale from "@distilled.cloud/planetscale";
2
+ import * as Provider from "alchemy/Provider";
3
+ import { Resource } from "alchemy/Resource";
4
+ import * as Redacted from "effect/Redacted";
5
+ import type { Providers } from "../Providers.ts";
6
+ import type { MySQLBranch } from "./MySQLBranch.ts";
7
+ import type { MySQLDatabase } from "./MySQLDatabase.ts";
8
+ import type { MySQLOrigin } from "./MySQLOrigin.ts";
9
+ /**
10
+ * Properties for creating or updating a PlanetScale MySQL password.
11
+ *
12
+ * Passwords are only meant for MySQL databases. For PostgreSQL,
13
+ * use {@link PostgresRole} instead.
14
+ */
15
+ export interface MySQLPasswordProps {
16
+ /**
17
+ * Password name. If omitted, a unique name is generated from
18
+ * `${app}-${stage}-${id}`.
19
+ */
20
+ name?: string;
21
+ /**
22
+ * MySQL database — string name or {@link MySQLDatabase} resource.
23
+ */
24
+ database: string | MySQLDatabase;
25
+ /**
26
+ * Branch — string name or {@link MySQLBranch} resource.
27
+ * @default "main"
28
+ */
29
+ branch?: string | MySQLBranch;
30
+ /**
31
+ * The MySQL role granted to the password.
32
+ */
33
+ role: "reader" | "writer" | "admin" | "readwriter";
34
+ /**
35
+ * Whether the password is for a read replica.
36
+ */
37
+ replica?: boolean;
38
+ /**
39
+ * Time to live (seconds). The password is invalidated after this period.
40
+ */
41
+ ttl?: number;
42
+ /**
43
+ * IP CIDR ranges allowed to use this password.
44
+ */
45
+ cidrs?: string[];
46
+ }
47
+ /**
48
+ * Output attributes of a deployed PlanetScale password.
49
+ */
50
+ export interface MySQLPasswordAttributes {
51
+ /** Unique identifier for the password (stable). */
52
+ id: string;
53
+ /** Password name. If omitted, a unique name is generated from `${app}-${stage}-${id}`. */
54
+ name: string;
55
+ /** ISO 8601 timestamp at which the password expires. `null` if no TTL. */
56
+ expiresAt: string | null;
57
+ /** Hostname for the database connection. */
58
+ host: string;
59
+ /** Username for database authentication. */
60
+ username: string;
61
+ /** Password for database authentication (Redacted). */
62
+ password: Redacted.Redacted<string>;
63
+ /** Parsed connection components ready to feed into Cloudflare Hyperdrive. */
64
+ origin: MySQLOrigin;
65
+ /** Resolved organization slug. */
66
+ organization: string;
67
+ /** Resolved database name. */
68
+ database: string;
69
+ /** Resolved branch name. */
70
+ branch: string;
71
+ /** The role granted. */
72
+ role: "reader" | "writer" | "admin" | "readwriter" | (string & {});
73
+ /** Whether this password is for a read replica. */
74
+ replica: boolean | undefined;
75
+ /** TTL in seconds (if set). */
76
+ ttl: number | undefined;
77
+ /** IP CIDR ranges allowed to use this password. */
78
+ cidrs: readonly string[] | undefined;
79
+ }
80
+ /**
81
+ * A PlanetScale password for accessing a MySQL database branch.
82
+ *
83
+ * For PostgreSQL databases, use {@link PostgresRole} instead.
84
+ *
85
+ * ### Creating a Password
86
+ * **Example:** Reader password
87
+ * ```typescript
88
+ * const reader = yield* Planetscale.MySQLPassword("AppReader", {
89
+ * database: "my-db",
90
+ * role: "reader",
91
+ * });
92
+ * ```
93
+ *
94
+ * **Example:** Writer password with TTL
95
+ * ```typescript
96
+ * const writer = yield* Planetscale.MySQLPassword("AppWriter", {
97
+ * database: "my-db",
98
+ * role: "writer",
99
+ * ttl: 86400,
100
+ * });
101
+ * ```
102
+ *
103
+ * **Example:** Admin password with IP allowlist
104
+ * ```typescript
105
+ * const admin = yield* Planetscale.MySQLPassword("Admin", {
106
+ * database: "my-db",
107
+ * role: "admin",
108
+ * cidrs: ["203.0.113.0/24", "198.51.100.0/24"],
109
+ * });
110
+ * ```
111
+ */
112
+ export type MySQLPassword = Resource<"Planetscale.MySQLPassword", MySQLPasswordProps, MySQLPasswordAttributes, never, Providers>;
113
+ /** @resource */
114
+ export declare const MySQLPassword: import("alchemy/Resource").ResourceClass<MySQLPassword>;
115
+ export declare const MySQLPasswordProvider: () => import("effect/Layer").Layer<Provider.Provider<MySQLPassword>, never, import("alchemy/Stack").Stack | import("alchemy/Stage").Stage | planetscale.PlanetScaleOpContext>;
116
+ //# sourceMappingURL=MySQLPassword.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MySQLPassword.d.ts","sourceRoot":"","sources":["../../src/MySQL/MySQLPassword.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC;AAI5D,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC;IAEjC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAE9B;;OAEG;IACH,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;IAEnD;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;C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