@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 665 lines 22.6 KB
Raw
1 import * as alloydb from "@distilled.cloud/gcp/alloydb_v1";
2 import { Unowned } from "alchemy/AdoptPolicy";
3 import { isResolved } from "alchemy/Diff";
4 import { createPhysicalName } from "alchemy/PhysicalName";
5 import * as Provider from "alchemy/Provider";
6 import { Resource } from "alchemy/Resource";
7 import { tagRecord } from "alchemy/Tags";
8 import * as Data from "effect/Data";
9 import * as Effect from "effect/Effect";
10 import * as Schedule from "effect/Schedule";
11 import * as Stream from "effect/Stream";
12 import { GcpEnvironment } from "../Environment.ts";
13 import {
14 createInternalLabels,
15 diffLabels,
16 hasAlchemyLabels,
17 stripInternalLabels,
18 toLabels,
19 } from "../Labels.ts";
20 import type { Providers } from "../Providers.ts";
21 import type { EncryptionConfig } from "./Cluster.ts";
22 import { waitForDeleteOperation, waitForOperation } from "./operations.ts";
23
24 const DEFAULT_BACKUP_TYPE = "ON_DEMAND";
25 const MAX_NAME_LENGTH = 63;
26
27 export type BackupProps = {
28 /**
29 * Source cluster id or full resource name
30 * (`projects/{project}/locations/{location}/clusters/{cluster}`).
31 * Immutable — changing it replaces the backup.
32 */
33 clusterName: string;
34 /**
35 * Region of the backup (`us-central1`, …). Ignored when
36 * `clusterName` is a full resource name unless set explicitly.
37 * Immutable — changing it replaces the backup. `US-CENTRAL1` is
38 * accepted and normalized to `us-central1`.
39 * @default the stack's GCP region (`GCP.Region`, else the profile region, else `us-central1`)
40 */
41 location?: string;
42 /**
43 * Backup id (the `{backup}` segment of
44 * `projects/{project}/locations/{location}/backups/{backup}`). If
45 * omitted, a unique RFC1035 name is generated. Must match
46 * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. Immutable — changing it
47 * replaces the backup.
48 */
49 backupId?: string;
50 /**
51 * User-facing display name.
52 */
53 displayName?: string;
54 /**
55 * User-provided description. Changing it replaces the backup.
56 */
57 description?: string;
58 /**
59 * User labels. Alchemy ownership labels are merged in automatically.
60 */
61 labels?: Record<string, string>;
62 /**
63 * Arbitrary client annotations (distinct from labels).
64 */
65 annotations?: Record<string, string>;
66 /**
67 * Backup type. User-created backups are `ON_DEMAND`. Immutable.
68 * @default "ON_DEMAND"
69 */
70 type?: alloydb.BackupTypeEnum | (string & {});
71 /**
72 * Customer-managed encryption. Immutable — changing it replaces the
73 * backup.
74 */
75 encryptionConfig?: EncryptionConfig;
76 /**
77 * Resource Manager tags bound at create time. Immutable.
78 */
79 tags?: Record<string, string>;
80 };
81
82 export type Backup = Resource<
83 "GCP.AlloyDB.Backup",
84 BackupProps,
85 {
86 /** Full resource name `projects/{project}/locations/{location}/backups/{backup}`. */
87 name: string;
88 /** Backup id (last path segment). */
89 backupId: string;
90 /** Source cluster resource name. */
91 clusterName: string;
92 /** Source cluster id. */
93 clusterId: string;
94 /** Project id. */
95 project: string;
96 /** Region id (`us-central1`, …). */
97 location: string;
98 /** User-facing display name. */
99 displayName: string | undefined;
100 /** User-provided description. */
101 description: string | undefined;
102 /** User labels (Alchemy ownership labels stripped). */
103 labels: Record<string, string>;
104 /** Client annotations. */
105 annotations: Record<string, string>;
106 /** Serving state (`READY`, `CREATING`, `FAILED`, …). */
107 state: string | undefined;
108 /** Backup type (`ON_DEMAND`, `AUTOMATED`, `CONTINUOUS`). */
109 type: string;
110 /** Size in bytes, as a decimal string. */
111 sizeBytes: string | undefined;
112 /** Customer-managed encryption, if any. */
113 encryptionConfig: EncryptionConfig | undefined;
114 /** Database engine major version of the source cluster. */
115 databaseVersion: string | undefined;
116 /** System-generated UID of the source cluster. */
117 clusterUid: string | undefined;
118 /** System-generated UID of the backup. */
119 uid: string | undefined;
120 /** Whether the service is reconciling intended vs actual state. */
121 reconciling: boolean;
122 /** RFC3339 creation timestamp. */
123 createTime: string | undefined;
124 /** RFC3339 last-update timestamp. */
125 updateTime: string | undefined;
126 /** RFC3339 time when creation finished. */
127 createCompletionTime: string | undefined;
128 /** RFC3339 time after which the backup may be garbage collected. */
129 expiryTime: string | undefined;
130 /** HTTP etag. */
131 etag: string | undefined;
132 },
133 never,
134 Providers
135 >;
136
137 /**
138 * An on-demand AlloyDB backup of a cluster.
139 *
140 * Changing `backupId`, `location`, `clusterName`, `type`,
141 * `encryptionConfig`, `tags`, or `description` replaces the backup.
142 * `displayName`, `labels`, and `annotations` update in place.
143 *
144 * Creating a backup typically takes several minutes and is skipIf-gated
145 * in live tests behind `GCP_TEST_ALLOYDB`.
146 *
147 * ### Creating a Backup
148 * **Example:** On-demand backup of a cluster
149 * ```typescript
150 * const cluster = yield* GCP.AlloyDB.Cluster("AppDb", {
151 * pscConfig: { pscEnabled: true },
152 * automatedBackupPolicy: { enabled: false },
153 * continuousBackupConfig: { enabled: false },
154 * });
155 * const backup = yield* GCP.AlloyDB.Backup("Nightly", {
156 * clusterName: cluster.name,
157 * displayName: "nightly",
158 * labels: { env: "prod" },
159 * });
160 * ```
161 *
162 * **Example:** Explicit id and description
163 * ```typescript
164 * const backup = yield* GCP.AlloyDB.Backup("Nightly", {
165 * clusterName: cluster.name,
166 * backupId: "app-db-nightly",
167 * displayName: "app-db-nightly",
168 * description: "manual snapshot",
169 * });
170 * ```
171 *
172 * @resource
173 * @category AlloyDB
174 */
175 export const Backup = Resource<Backup>("GCP.AlloyDB.Backup");
176
177 export class BackupNotResolved extends Data.TaggedError("GCP.AlloyDB.BackupNotResolved")<{
178 resourceName: string;
179 }> {}
180
181 export class BackupClusterMissing extends Data.TaggedError("GCP.AlloyDB.BackupClusterMissing")<{
182 message: string;
183 }> {}
184
185 export class BackupNotReady extends Data.TaggedError("GCP.AlloyDB.BackupNotReady")<{
186 resourceName: string;
187 state: string;
188 }> {}
189
190 export class BackupFailed extends Data.TaggedError("GCP.AlloyDB.BackupFailed")<{
191 resourceName: string;
192 state: string;
193 }> {}
194
195 export class BackupStillExists extends Data.TaggedError("GCP.AlloyDB.BackupStillExists")<{
196 resourceName: string;
197 }> {}
198
199 const lastSegment = (value: string | undefined) => {
200 if (value === undefined || value.length === 0) return "";
201 const trimmed = value.replace(/\/+$/, "");
202 const parts = trimmed.split("/");
203 return parts[parts.length - 1] || trimmed;
204 };
205
206 const normalizeLocation = (location: string) => lastSegment(location).toLowerCase();
207
208 const normalizeType = (type: string | undefined) => {
209 const value = (type ?? DEFAULT_BACKUP_TYPE).toUpperCase();
210 return value === "TYPE_UNSPECIFIED" ? DEFAULT_BACKUP_TYPE : value;
211 };
212
213 const rfc1035 = (name: string): string => {
214 let next = name
215 .toLowerCase()
216 .replace(/[^a-z0-9-]/g, "-")
217 .replace(/-+/g, "-")
218 .replace(/^-+|-+$/g, "");
219 if (!/^[a-z]/.test(next)) next = `b${next}`;
220 next = next.slice(0, MAX_NAME_LENGTH).replace(/-+$/g, "");
221 if (next.length === 0) return "backup";
222 if (!/[a-z0-9]$/.test(next)) next = `${next.slice(0, MAX_NAME_LENGTH - 1)}0`;
223 return next.slice(0, MAX_NAME_LENGTH);
224 };
225
226 const resourceName = (project: string, location: string, backupId: string) =>
227 `projects/${project}/locations/${location}/backups/${backupId}`;
228
229 const clusterNameOf = (project: string, location: string, clusterId: string) =>
230 `projects/${project}/locations/${location}/clusters/${clusterId}`;
231
232 const parseBackupName = (name: string) => {
233 const parts = name.split("/").filter((part) => part.length > 0);
234 const backupsAt = parts.lastIndexOf("backups");
235 const locationsAt = parts.lastIndexOf("locations");
236 const projectsAt = parts.lastIndexOf("projects");
237 return {
238 project: projectsAt >= 0 && parts[projectsAt + 1] ? parts[projectsAt + 1]! : "",
239 location: locationsAt >= 0 && parts[locationsAt + 1] ? parts[locationsAt + 1]! : "",
240 backupId: backupsAt >= 0 && parts[backupsAt + 1] ? parts[backupsAt + 1]! : lastSegment(name),
241 };
242 };
243
244 const parseClusterRef = (cluster: string, fallbackProject: string, fallbackLocation: string) => {
245 const trimmed = cluster.trim();
246 if (trimmed.length === 0) {
247 return {
248 project: fallbackProject,
249 location: normalizeLocation(fallbackLocation),
250 clusterId: "",
251 clusterName: "",
252 };
253 }
254 if (trimmed.includes("/clusters/") || trimmed.includes("projects/")) {
255 const parts = trimmed.split("/").filter((part) => part.length > 0);
256 const clustersAt = parts.lastIndexOf("clusters");
257 const locationsAt = parts.lastIndexOf("locations");
258 const projectsAt = parts.lastIndexOf("projects");
259 const clusterId = clustersAt >= 0 && parts[clustersAt + 1] ? parts[clustersAt + 1]! : "";
260 const project =
261 projectsAt >= 0 && parts[projectsAt + 1] ? parts[projectsAt + 1]! : fallbackProject;
262 const location = normalizeLocation(
263 (locationsAt >= 0 && parts[locationsAt + 1] ? parts[locationsAt + 1] : undefined) ??
264 fallbackLocation,
265 );
266 return {
267 project,
268 location,
269 clusterId,
270 clusterName: clusterNameOf(project, location, clusterId),
271 };
272 }
273 const location = normalizeLocation(fallbackLocation);
274 const clusterId = lastSegment(trimmed);
275 return {
276 project: fallbackProject,
277 location,
278 clusterId,
279 clusterName: clusterNameOf(fallbackProject, location, clusterId),
280 };
281 };
282
283 const userLabels = (
284 labels: Record<string, string | undefined> | null | undefined,
285 ): Record<string, string> => stripInternalLabels(tagRecord(labels));
286
287 const stringMapOf = (
288 map: Record<string, string | undefined> | null | undefined,
289 ): Record<string, string> =>
290 Object.fromEntries(
291 Object.entries(map ?? {}).filter(
292 (entry): entry is [string, string] => entry[1] !== undefined && entry[1].length > 0,
293 ),
294 );
295
296 const toId = (id: string, backupId: string | undefined, existing?: string) =>
297 Effect.gen(function* () {
298 return (
299 backupId ??
300 existing ??
301 rfc1035(
302 yield* createPhysicalName({
303 id,
304 maxLength: MAX_NAME_LENGTH,
305 lowercase: true,
306 }),
307 )
308 );
309 });
310
311 const fingerprint = (value: unknown): string => JSON.stringify(value ?? null);
312
313 const toEncryptionConfig = (
314 config: alloydb.EncryptionConfig | EncryptionConfig | undefined,
315 ): EncryptionConfig | undefined => {
316 const kmsKeyName = config?.kmsKeyName;
317 if (kmsKeyName === undefined || kmsKeyName.length === 0) return undefined;
318 return { kmsKeyName };
319 };
320
321 const isAvailable = (state: string | undefined) => (state ?? "").toUpperCase() === "READY";
322
323 const isFailed = (state: string | undefined) => (state ?? "").toUpperCase() === "FAILED";
324
325 const toAttrs = (backup: alloydb.Backup, project: string) => {
326 const name = backup.name ?? "";
327 const parsed = parseBackupName(name);
328 const clusterRef = parseClusterRef(
329 backup.clusterName ?? "",
330 parsed.project || project,
331 parsed.location,
332 );
333 return {
334 name,
335 backupId: parsed.backupId,
336 clusterName: backup.clusterName ?? clusterRef.clusterName,
337 clusterId: clusterRef.clusterId,
338 project: parsed.project || project,
339 location: parsed.location,
340 displayName: backup.displayName,
341 description: backup.description,
342 labels: userLabels(backup.labels),
343 annotations: stringMapOf(backup.annotations),
344 state: backup.state,
345 type: normalizeType(backup.type),
346 sizeBytes: backup.sizeBytes,
347 encryptionConfig: toEncryptionConfig(backup.encryptionConfig),
348 databaseVersion: backup.databaseVersion,
349 clusterUid: backup.clusterUid,
350 uid: backup.uid,
351 reconciling: backup.reconciling === true,
352 createTime: backup.createTime,
353 updateTime: backup.updateTime,
354 createCompletionTime: backup.createCompletionTime,
355 expiryTime: backup.expiryTime,
356 etag: backup.etag,
357 };
358 };
359
360 const isPlaceholder = (backup: alloydb.Backup) => {
361 const name = backup.name ?? "";
362 return name.endsWith("/backups/-") || name.endsWith("/backups/");
363 };
364
365 const getByName = (name: string) =>
366 alloydb
367 .getProjectsLocationsBackups({ name })
368 .pipe(Effect.catchTag("NotFound", () => Effect.undefined));
369
370 const waitUntilExists = (name: string) =>
371 getByName(name).pipe(
372 Effect.flatMap((backup) =>
373 backup ? Effect.succeed(backup) : Effect.fail(new BackupNotResolved({ resourceName: name })),
374 ),
375 Effect.retry({
376 while: (error) => error._tag === "GCP.AlloyDB.BackupNotResolved",
377 times: 8,
378 schedule: Schedule.spaced("1 second"),
379 }),
380 );
381
382 const waitUntilReady = (name: string) =>
383 Effect.gen(function* () {
384 const backup = yield* getByName(name);
385 if (backup === undefined) {
386 return yield* new BackupNotReady({ resourceName: name, state: "MISSING" });
387 }
388 if (isFailed(backup.state)) {
389 return yield* new BackupFailed({
390 resourceName: name,
391 state: backup.state ?? "FAILED",
392 });
393 }
394 if (!(isAvailable(backup.state) && backup.reconciling !== true)) {
395 return yield* new BackupNotReady({
396 resourceName: name,
397 state: backup.state ?? "STATE_UNSPECIFIED",
398 });
399 }
400 return backup;
401 }).pipe(
402 Effect.retry({
403 while: (error) => error._tag === "GCP.AlloyDB.BackupNotReady",
404 times: 120,
405 schedule: Schedule.spaced("15 seconds"),
406 }),
407 );
408
409 const waitUntilGone = (name: string) =>
410 getByName(name).pipe(
411 Effect.flatMap((backup) =>
412 backup === undefined
413 ? Effect.void
414 : Effect.fail(new BackupStillExists({ resourceName: name })),
415 ),
416 Effect.retry({
417 while: (error) => error._tag === "GCP.AlloyDB.BackupStillExists",
418 times: 120,
419 schedule: Schedule.spaced("15 seconds"),
420 }),
421 );
422
423 const toCreateBody = (
424 news: BackupProps,
425 desiredLabels: Record<string, string>,
426 clusterName: string,
427 backupType: string,
428 ): alloydb.Backup => {
429 const body: alloydb.Backup = {
430 clusterName,
431 type: backupType,
432 displayName: news.displayName,
433 labels: desiredLabels,
434 };
435 if (news.description !== undefined) {
436 body.description = news.description;
437 }
438 if (news.annotations !== undefined) {
439 body.annotations = news.annotations;
440 }
441 const encryption = toEncryptionConfig(news.encryptionConfig);
442 if (encryption !== undefined) {
443 body.encryptionConfig = encryption;
444 }
445 if (news.tags !== undefined) {
446 body.tags = news.tags;
447 }
448 return body;
449 };
450
451 export const BackupProvider = () =>
452 Provider.succeed(Backup, {
453 stables: [
454 "name",
455 "backupId",
456 "clusterName",
457 "clusterId",
458 "project",
459 "location",
460 "uid",
461 "createTime",
462 ],
463
464 diff: Effect.fn(function* ({ news, olds, output }) {
465 if (!isResolved(news)) return undefined;
466 const env = yield* GcpEnvironment.current;
467
468 const previousId = olds?.backupId ?? output?.backupId;
469 const nextId = news.backupId ?? previousId;
470 const previousCluster = lastSegment(
471 olds?.clusterName ?? output?.clusterName ?? output?.clusterId,
472 );
473 const nextCluster = lastSegment(news.clusterName ?? previousCluster);
474 const previousLocation = normalizeLocation(olds?.location ?? output?.location ?? env.region);
475 const nextLocation = normalizeLocation(news.location ?? output?.location ?? env.region);
476 const previousType = normalizeType(olds?.type ?? output?.type);
477 const nextType = normalizeType(news.type ?? output?.type);
478 const previousKey =
479 olds?.encryptionConfig?.kmsKeyName ?? output?.encryptionConfig?.kmsKeyName ?? "";
480 const nextKey = news.encryptionConfig?.kmsKeyName ?? previousKey;
481 const previousTags = fingerprint(olds?.tags ?? undefined);
482 const nextTags = fingerprint(news.tags ?? olds?.tags ?? undefined);
483
484 const replace =
485 (previousId !== undefined && nextId !== undefined && nextId !== previousId) ||
486 (previousCluster.length > 0 && nextCluster.length > 0 && previousCluster !== nextCluster) ||
487 previousLocation !== nextLocation ||
488 previousType !== nextType ||
489 previousKey !== nextKey ||
490 (news.tags !== undefined && previousTags !== nextTags) ||
491 // PATCH accepts `description` but leaves it unchanged (observed live),
492 // so a new description replaces the backup.
493 (olds !== undefined && (news.description ?? "") !== (olds.description ?? ""));
494
495 if (!replace) return undefined;
496 return {
497 action: "replace" as const,
498 deleteFirst:
499 previousLocation === nextLocation &&
500 previousCluster === nextCluster &&
501 previousId !== undefined &&
502 nextId === previousId,
503 };
504 }),
505
506 read: Effect.fn(function* ({ id, olds, output }) {
507 const env = yield* GcpEnvironment.current;
508 if (output?.name) {
509 const existing = yield* getByName(output.name);
510 if (existing === undefined) return undefined;
511 const attrs = toAttrs(existing, env.project);
512 return (yield* hasAlchemyLabels(id, tagRecord(existing.labels))) ? attrs : Unowned(attrs);
513 }
514 const backupId = yield* toId(id, olds?.backupId, output?.backupId);
515 const ref = parseClusterRef(
516 olds?.clusterName ?? output?.clusterName ?? output?.clusterId ?? "",
517 env.project,
518 olds?.location ?? output?.location ?? env.region,
519 );
520 const location = normalizeLocation(olds?.location ?? output?.location ?? ref.location);
521 const name = resourceName(env.project, location, backupId);
522 const existing = yield* getByName(name);
523 if (existing === undefined) return undefined;
524 const attrs = toAttrs(existing, env.project);
525 return (yield* hasAlchemyLabels(id, tagRecord(existing.labels))) ? attrs : Unowned(attrs);
526 }),
527
528 list: () =>
529 Effect.gen(function* () {
530 const env = yield* GcpEnvironment.current;
531 return yield* alloydb.listProjectsLocationsBackups
532 .pages({
533 parent: `projects/${env.project}/locations/-`,
534 pageSize: 1000,
535 })
536 .pipe(
537 Stream.flatMap((page) => Stream.fromIterable(page.backups ?? [])),
538 Stream.filter(
539 (backup) =>
540 !isPlaceholder(backup) &&
541 Object.keys(backup.labels ?? {}).some((key) => key.startsWith("alchemy-")),
542 ),
543 Stream.map((backup) => toAttrs(backup, env.project)),
544 Stream.runCollect,
545 Effect.map((chunk) => Array.from(chunk)),
546 Effect.catchTag("NotFound", () => Effect.succeed([])),
547 );
548 }),
549
550 reconcile: Effect.fn(function* ({ id, news, olds, output }) {
551 const env = yield* GcpEnvironment.current;
552 const backupId = yield* toId(id, news.backupId, output?.backupId);
553 const ref = parseClusterRef(
554 news.clusterName,
555 env.project,
556 news.location ?? output?.location ?? env.region,
557 );
558 if (ref.clusterId.length === 0) {
559 return yield* new BackupClusterMissing({
560 message: "GCP.AlloyDB.Backup requires `clusterName` (cluster id or full resource name)",
561 });
562 }
563 const location = normalizeLocation(news.location ?? ref.location);
564 const name = resourceName(env.project, location, backupId);
565 const backupType = normalizeType(news.type);
566 const desiredLabels = {
567 ...toLabels(news.labels),
568 ...(yield* createInternalLabels(id)),
569 };
570
571 let current = yield* getByName(output?.name ?? name);
572
573 if (current === undefined) {
574 const parent = `projects/${env.project}/locations/${location}`;
575 const created = yield* alloydb
576 .createProjectsLocationsBackups({
577 parent,
578 backupId,
579 body: toCreateBody(news, desiredLabels, ref.clusterName, backupType),
580 })
581 .pipe(
582 // The cluster only accepts backups a few minutes after its
583 // primary instance is created.
584 Effect.retry({
585 while: (error) => error._tag === "ClusterNotReadyForBackup",
586 times: 40,
587 schedule: Schedule.spaced("15 seconds"),
588 }),
589 Effect.catchTag("Conflict", () => Effect.undefined),
590 );
591 if (created !== undefined) {
592 yield* waitForOperation(created);
593 }
594 current = yield* waitUntilExists(name);
595 }
596
597 if (current === undefined) {
598 return yield* new BackupNotResolved({ resourceName: name });
599 }
600
601 if (!isAvailable(current.state) || current.reconciling === true) {
602 current = yield* waitUntilReady(name);
603 }
604
605 const observedLabels = tagRecord(current.labels);
606 const { upsert, removed } = diffLabels(observedLabels, desiredLabels);
607 const labelsChanged = upsert.length > 0 || removed.length > 0;
608 const observedDisplayName = current.displayName ?? output?.displayName ?? olds?.displayName;
609 const displayNameChanged = (observedDisplayName ?? "") !== (news.displayName ?? "");
610 const annotationsChanged =
611 news.annotations !== undefined &&
612 fingerprint(stringMapOf(current.annotations)) !== fingerprint(news.annotations);
613
614 if (labelsChanged || displayNameChanged || annotationsChanged) {
615 const updateMask = [
616 labelsChanged ? "labels" : undefined,
617 displayNameChanged ? "displayName" : undefined,
618 annotationsChanged ? "annotations" : undefined,
619 ].filter((field): field is string => field !== undefined);
620
621 const patched = yield* alloydb
622 .patchProjectsLocationsBackups({
623 name,
624 updateMask: updateMask.join(","),
625 body: {
626 name,
627 labels: desiredLabels,
628 displayName: news.displayName,
629 annotations: news.annotations,
630 },
631 })
632 .pipe(
633 Effect.retry({
634 while: (error) => error._tag === "Conflict",
635 times: 40,
636 schedule: Schedule.spaced("15 seconds"),
637 }),
638 );
639 yield* waitForOperation(patched);
640 current = yield* waitUntilReady(name);
641 }
642
643 // AlloyDB omits `displayName` from backup reads (like clusters); the
644 // desired value is what was applied.
645 return toAttrs(
646 { ...current, displayName: current.displayName ?? news.displayName },
647 env.project,
648 );
649 }),
650
651 delete: Effect.fn(function* ({ output }) {
652 const operation = yield* alloydb.deleteProjectsLocationsBackups({ name: output.name }).pipe(
653 Effect.catchTag("NotFound", () => Effect.undefined),
654 Effect.retry({
655 while: (error) => error._tag === "Conflict",
656 times: 40,
657 schedule: Schedule.spaced("15 seconds"),
658 }),
659 );
660 if (operation !== undefined) {
661 yield* waitForDeleteOperation(operation);
662 }
663 yield* waitUntilGone(output.name);
664 }),
665 });