@treeseed/sdk 0.12.59 → 0.12.61

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 (44) hide show
  1. package/dist/guarantees/index.js +59 -56
  2. package/dist/hosting/contracts.d.ts +0 -19
  3. package/dist/hosting/graph.d.ts +1 -86
  4. package/dist/hosting/graph.js +96 -247
  5. package/dist/local-dev/managed-dev.js +30 -8
  6. package/dist/managed-dependencies.d.ts +3 -0
  7. package/dist/managed-dependencies.js +294 -20
  8. package/dist/operations/services/deploy.js +6 -6
  9. package/dist/operations/services/deployment-readiness.js +5 -4
  10. package/dist/operations/services/git-runner.d.ts +2 -0
  11. package/dist/operations/services/git-runner.js +23 -2
  12. package/dist/operations/services/hosted-service-checks.js +28 -0
  13. package/dist/operations/services/live-hosted-service-checks.js +56 -14
  14. package/dist/operations/services/local-cleanup.d.ts +1 -0
  15. package/dist/operations/services/local-cleanup.js +28 -9
  16. package/dist/operations/services/package-adapters.js +3 -3
  17. package/dist/operations/services/railway-api.d.ts +72 -28
  18. package/dist/operations/services/railway-api.js +321 -876
  19. package/dist/operations/services/railway-cli.d.ts +47 -0
  20. package/dist/operations/services/railway-cli.js +142 -0
  21. package/dist/operations/services/railway-deploy.d.ts +5 -0
  22. package/dist/operations/services/railway-deploy.js +47 -75
  23. package/dist/operations/services/railway-source-policy.d.ts +6 -0
  24. package/dist/operations/services/railway-source-policy.js +52 -9
  25. package/dist/operations/services/repository-save-orchestrator.d.ts +2 -0
  26. package/dist/operations/services/repository-save-orchestrator.js +45 -14
  27. package/dist/operations-types.d.ts +3 -1
  28. package/dist/platform/contracts.d.ts +1 -0
  29. package/dist/platform/deploy-config.js +2 -1
  30. package/dist/reconcile/builtin-adapters.js +524 -680
  31. package/dist/reconcile/desired-state.js +5 -3
  32. package/dist/reconcile/engine.js +34 -28
  33. package/dist/reconcile/live-acceptance.js +2 -11
  34. package/dist/reconcile/providers/railway-iac.d.ts +148 -0
  35. package/dist/reconcile/providers/railway-iac.js +294 -18
  36. package/dist/scenes/runner.js +11 -11
  37. package/dist/scripts/build-dist.js +22 -0
  38. package/dist/workflow/operations.d.ts +12 -0
  39. package/dist/workflow/operations.js +265 -90
  40. package/dist/workflow/runs.d.ts +4 -0
  41. package/dist/workflow/runs.js +25 -0
  42. package/dist/workflow-support.d.ts +1 -1
  43. package/dist/workflow-support.js +3 -1
  44. package/package.json +1 -2
@@ -15,15 +15,17 @@ import {
15
15
  import {
16
16
  configuredRailwayServices,
17
17
  findStaleTreeseedOperationsRunnerResources,
18
- isTreeseedOperationsRunnerResourceName
18
+ isTreeseedOperationsRunnerResourceName,
19
+ railwayObsoleteAliasCleanupPolicy
19
20
  } from "./railway-deploy.js";
21
+ import { railwayTreeDxServiceName } from "./railway-source-policy.js";
20
22
  import { discoverTreeseedApplications } from "../../hosting/apps.js";
21
23
  import {
22
24
  collectTreeseedHostedServiceChecks
23
25
  } from "./hosted-service-checks.js";
24
26
  const DEFAULT_RETRY_ATTEMPTS = 3;
25
27
  const DEFAULT_RETRY_INTERVAL_MS = 1500;
26
- const DEFAULT_RAILWAY_DEPLOYMENT_SETTLE_ATTEMPTS = 120;
28
+ const DEFAULT_RAILWAY_DEPLOYMENT_SETTLE_ATTEMPTS = 12;
27
29
  const DEFAULT_RAILWAY_DEPLOYMENT_SETTLE_INTERVAL_MS = 5e3;
28
30
  function sleep(ms) {
29
31
  return new Promise((resolve2) => setTimeout(resolve2, ms));
@@ -91,9 +93,16 @@ async function inspectRailwayServiceDeploymentHealthWithRetry(input) {
91
93
  });
92
94
  lastDeployment = deployment;
93
95
  if (deployment.ok) return deployment;
96
+ if (input.acceptSleeping && deployment.status === "SLEEPING") {
97
+ return { ...deployment, ok: true, message: "Serverless deployment is healthy and sleeping until requested." };
98
+ }
94
99
  } catch (error) {
95
100
  lastError = error;
96
101
  }
102
+ if (attempt === 0 || (attempt + 1) % 3 === 0) {
103
+ process.stderr.write(`[trsd][railway][live-check] service=${input.serviceName ?? input.serviceId} attempt=${attempt + 1}/${attempts} status=${lastDeployment?.status ?? "unavailable"}
104
+ `);
105
+ }
97
106
  if (attempt + 1 < attempts) await sleep(intervalMs);
98
107
  }
99
108
  return lastDeployment ?? {
@@ -235,12 +244,37 @@ async function collectRailwayObservations(options) {
235
244
  const inspectedRunnerScopes = /* @__PURE__ */ new Set();
236
245
  const selectedServiceKeys = selectedServiceKeySet(options);
237
246
  const applications = discoverTreeseedApplications(options.tenantRoot);
247
+ const environmentCache = /* @__PURE__ */ new Map();
248
+ const serviceCache = /* @__PURE__ */ new Map();
249
+ const volumeCache = /* @__PURE__ */ new Map();
250
+ const environmentsFor = (projectId) => {
251
+ const existing = environmentCache.get(projectId);
252
+ if (existing) return existing;
253
+ const loaded = listRailwayEnvironments({ projectId, env: options.env, fetchImpl: options.fetchImpl });
254
+ environmentCache.set(projectId, loaded);
255
+ return loaded;
256
+ };
257
+ const servicesFor = (projectId) => {
258
+ const existing = serviceCache.get(projectId);
259
+ if (existing) return existing;
260
+ const loaded = listRailwayServices({ projectId, env: options.env, fetchImpl: options.fetchImpl });
261
+ serviceCache.set(projectId, loaded);
262
+ return loaded;
263
+ };
264
+ const volumesFor = (projectId) => {
265
+ const existing = volumeCache.get(projectId);
266
+ if (existing) return existing;
267
+ const loaded = listRailwayVolumes({ projectId, env: options.env, fetchImpl: options.fetchImpl }).catch(() => []);
268
+ volumeCache.set(projectId, loaded);
269
+ return loaded;
270
+ };
238
271
  try {
239
272
  const workspace = await resolveRailwayWorkspaceContext({ env: options.env, fetchImpl: options.fetchImpl });
240
273
  const projects = await listRailwayProjects({ workspaceId: workspace.id, env: options.env, fetchImpl: options.fetchImpl });
241
274
  const configuredServices = configuredRailwayServices(options.tenantRoot, options.target, options.env).filter((entry) => serviceMatchesAppSelection(entry, options.tenantRoot, options.appId, applications)).filter((entry) => serviceIsSelected(selectedServiceKeys, entry.key));
242
275
  const siblingTarget = options.target === "staging" ? "prod" : options.target === "prod" ? "staging" : null;
243
276
  const configuredSiblingServices = siblingTarget ? configuredRailwayServices(options.tenantRoot, siblingTarget, options.env, { identityOnly: true }).filter((entry) => entry.enabled !== false).filter((entry) => entry.key === "operationsRunner") : [];
277
+ const retainedObsoleteAliases = options.target === "staging" ? railwayObsoleteAliasCleanupPolicy("staging", configuredServices).retainedResourceNames : [];
244
278
  if (selectedServiceKeys.size === 0 || selectedServiceKeys.has("api") || selectedServiceKeys.has("operationsRunner")) {
245
279
  for (const descriptor of treeseedDatabaseDescriptors(options.tenantRoot, options)) {
246
280
  await verifyRailwayPostgresTopology({ descriptor, configuredServices, projects, options, issues });
@@ -255,7 +289,7 @@ async function collectRailwayObservations(options) {
255
289
  issues.push(`${service.serviceName}: Railway project ${service.projectName} was not found.`);
256
290
  continue;
257
291
  }
258
- const environments = await listRailwayEnvironments({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl });
292
+ const environments = await environmentsFor(project.id);
259
293
  const environment = findByName(environments, service.railwayEnvironment);
260
294
  if (!environment?.id) {
261
295
  issues.push(`${service.serviceName}: Railway environment ${service.railwayEnvironment} was not found.`);
@@ -264,7 +298,7 @@ async function collectRailwayObservations(options) {
264
298
  const volumeScope = `${project.id}:${environment.id}`;
265
299
  if (!inspectedVolumeScopes.has(volumeScope)) {
266
300
  inspectedVolumeScopes.add(volumeScope);
267
- const volumes2 = await listRailwayVolumes({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => []);
301
+ const volumes2 = await volumesFor(project.id);
268
302
  for (const volume of volumes2) {
269
303
  if (isRetainedDetachedRailwayVolume(volume.name)) {
270
304
  continue;
@@ -280,20 +314,24 @@ async function collectRailwayObservations(options) {
280
314
  }
281
315
  }
282
316
  }
283
- const services = await listRailwayServices({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl });
317
+ const services = await servicesFor(project.id);
284
318
  const runnerScope = `${project.id}:${environment.id}`;
285
319
  if (service.key === "operationsRunner" && !inspectedRunnerScopes.has(runnerScope)) {
286
320
  inspectedRunnerScopes.add(runnerScope);
287
321
  const desiredRunnerNames = /* @__PURE__ */ new Set([
288
322
  ...configuredServices.filter((entry) => entry.key === "operationsRunner").filter((entry) => entry.projectId ? entry.projectId === project.id : entry.projectName === project.name).filter((entry) => normalizeRailwayEnvironmentName(entry.railwayEnvironment) === normalizeRailwayEnvironmentName(environment.name)).map((entry) => entry.serviceName).filter(Boolean),
289
- ...configuredSiblingServices.filter((entry) => entry.projectId ? entry.projectId === project.id : entry.projectName === project.name).map((entry) => entry.serviceName).filter((name) => Boolean(name) && isTreeseedOperationsRunnerResourceName(name))
323
+ ...configuredSiblingServices.filter((entry) => entry.projectId ? entry.projectId === project.id : entry.projectName === project.name).map((entry) => entry.serviceName).filter((name) => Boolean(name) && isTreeseedOperationsRunnerResourceName(name)),
324
+ ...retainedObsoleteAliases.filter((name) => isTreeseedOperationsRunnerResourceName(name) && !name.endsWith("-volume"))
290
325
  ]);
291
326
  const desiredRunnerServiceIds = new Set(services.filter((entry) => desiredRunnerNames.has(entry.name)).map((entry) => entry.id));
292
327
  for (const staleService of findStaleTreeseedOperationsRunnerResources(services, desiredRunnerNames)) {
293
328
  issues.push(`${staleService.name}: stale operations runner Railway service remains in project ${project.name}.`);
294
329
  }
295
- const volumes2 = await listRailwayVolumes({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => []);
296
- const desiredRunnerVolumeNames = new Set([...desiredRunnerNames].map((name) => `${name}-volume`));
330
+ const volumes2 = await volumesFor(project.id);
331
+ const desiredRunnerVolumeNames = /* @__PURE__ */ new Set([
332
+ ...[...desiredRunnerNames].map((name) => `${name}-volume`),
333
+ ...retainedObsoleteAliases.filter((name) => name.endsWith("-volume"))
334
+ ]);
297
335
  for (const staleVolume of findStaleTreeseedOperationsRunnerResources(volumes2, desiredRunnerVolumeNames)) {
298
336
  const activeInstances = activeRailwayVolumeInstances(staleVolume);
299
337
  const relevant = staleVolume.instances.length === 0 || activeInstances.length > 0;
@@ -311,7 +349,7 @@ async function collectRailwayObservations(options) {
311
349
  const [instance, variables, volumes] = await Promise.all([
312
350
  getRailwayServiceInstance({ serviceId: railwayService.id, environmentId: environment.id, env: options.env, fetchImpl: options.fetchImpl }),
313
351
  listRailwayVariables({ projectId: project.id, environmentId: environment.id, serviceId: railwayService.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => ({})),
314
- listRailwayVolumes({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => [])
352
+ volumesFor(project.id)
315
353
  ]);
316
354
  const mountedVolume = Array.isArray(volumes) ? volumes.find((entry) => {
317
355
  const instances = Array.isArray(entry.instances) ? entry.instances : Array.isArray(entry.volumeInstances) ? entry.volumeInstances : [];
@@ -326,6 +364,8 @@ async function collectRailwayObservations(options) {
326
364
  const deployment = await inspectRailwayServiceDeploymentHealthWithRetry({
327
365
  serviceId: railwayService.id,
328
366
  environmentId: environment.id,
367
+ serviceName: service.serviceName,
368
+ acceptSleeping: service.runtimeMode === "serverless",
329
369
  options
330
370
  }).catch((error) => ({
331
371
  ok: false,
@@ -388,20 +428,21 @@ async function collectRailwayObservations(options) {
388
428
  issues.push(`public-treedx: Railway project ${projectName} was not found.`);
389
429
  continue;
390
430
  }
391
- const environments = await listRailwayEnvironments({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl });
431
+ const environments = await environmentsFor(project.id);
392
432
  const environment = findByName(environments, environmentName);
393
433
  if (!environment?.id) {
394
434
  issues.push(`public-treedx: Railway environment ${environmentName} was not found.`);
395
435
  continue;
396
436
  }
397
437
  const [services, volumes] = await Promise.all([
398
- listRailwayServices({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }),
399
- listRailwayVolumes({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => [])
438
+ servicesFor(project.id),
439
+ volumesFor(project.id)
400
440
  ]);
401
441
  for (let index = 1; index <= bootstrapCount; index += 1) {
402
- const serviceName = indexedName("public-treedx-node", index);
442
+ const logicalServiceName = indexedName("public-treedx-node", index);
443
+ const serviceName = railwayTreeDxServiceName(index, options.target);
403
444
  const volumeName = `${serviceName}-volume`;
404
- const configuredNode = Array.isArray(config.services) ? config.services.find((service2) => service2?.id === serviceName || service2?.name === serviceName) : null;
445
+ const configuredNode = Array.isArray(config.services) ? config.services.find((service2) => service2?.id === logicalServiceName || service2?.name === logicalServiceName) : null;
405
446
  const volumeMountPath = typeof configuredNode?.volumeMountPath === "string" && configuredNode.volumeMountPath.trim() ? configuredNode.volumeMountPath.trim() : "/data";
406
447
  const service = findByName(services, serviceName);
407
448
  if (!service?.id) {
@@ -411,6 +452,7 @@ async function collectRailwayObservations(options) {
411
452
  const deployment = await inspectRailwayServiceDeploymentHealthWithRetry({
412
453
  serviceId: service.id,
413
454
  environmentId: environment.id,
455
+ serviceName,
414
456
  options
415
457
  }).catch((error) => ({
416
458
  ok: false,
@@ -26,4 +26,5 @@ export declare function runTreeseedLocalCleanup(input: {
26
26
  mode?: TreeseedLocalCleanupMode;
27
27
  docker?: boolean;
28
28
  npmCache?: boolean;
29
+ npmCacheRoot?: string;
29
30
  }): TreeseedLocalCleanupReport;
@@ -1,4 +1,5 @@
1
1
  import { existsSync, readdirSync, rmSync, statSync } from "node:fs";
2
+ import { homedir } from "node:os";
2
3
  import { join, resolve } from "node:path";
3
4
  import { spawnSync } from "node:child_process";
4
5
  function directoryBytes(path) {
@@ -12,15 +13,23 @@ function directoryBytes(path) {
12
13
  }
13
14
  function removeDirectory(root, relativePath) {
14
15
  const path = join(root, relativePath);
16
+ return removeDirectoryPath(relativePath, path);
17
+ }
18
+ function removeDirectoryPath(id, path) {
15
19
  const beforeBytes = directoryBytes(path);
16
- if (!existsSync(path)) return { id: relativePath, kind: "directory", path, status: "skipped", beforeBytes: 0, afterBytes: 0 };
20
+ if (!existsSync(path)) return { id, kind: "directory", path, status: "skipped", beforeBytes: 0, afterBytes: 0 };
17
21
  try {
18
22
  rmSync(path, { recursive: true, force: true });
19
- return { id: relativePath, kind: "directory", path, status: "removed", beforeBytes, afterBytes: directoryBytes(path) };
23
+ return { id, kind: "directory", path, status: "removed", beforeBytes, afterBytes: directoryBytes(path) };
20
24
  } catch (error) {
21
- return { id: relativePath, kind: "directory", path, status: "failed", beforeBytes, afterBytes: directoryBytes(path), error: error instanceof Error ? error.message : String(error) };
25
+ return { id, kind: "directory", path, status: "failed", beforeBytes, afterBytes: directoryBytes(path), error: error instanceof Error ? error.message : String(error) };
22
26
  }
23
27
  }
28
+ function workspaceRepositoryRoots(root) {
29
+ const packagesRoot = join(root, "packages");
30
+ if (!existsSync(packagesRoot)) return [];
31
+ return readdirSync(packagesRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join(packagesRoot, entry.name)).filter((path) => existsSync(join(path, ".git")) || existsSync(join(path, "package.json")) || existsSync(join(path, "treeseed.package.yaml")));
32
+ }
24
33
  function runCleanupCommand(id, kind, command, cwd) {
25
34
  const result = spawnSync(command[0], command.slice(1), { cwd, encoding: "utf8", maxBuffer: 1024 * 1024 * 16 });
26
35
  const exitCode = result.status ?? null;
@@ -37,19 +46,29 @@ function runTreeseedLocalCleanup(input) {
37
46
  const root = resolve(input.root);
38
47
  const mode = input.mode ?? "standard";
39
48
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
40
- const beforeBytes = directoryBytes(join(root, ".treeseed"));
49
+ const npmCacheRoot = resolve(input.npmCacheRoot ?? process.env.npm_config_cache ?? process.env.NPM_CONFIG_CACHE ?? join(homedir(), ".npm"));
50
+ const npmTemporaryDownloads = join(npmCacheRoot, "_cacache", "tmp");
51
+ const repositoryRoots = [root, ...workspaceRepositoryRoots(root)];
52
+ const beforeBytes = repositoryRoots.reduce((total, repositoryRoot) => total + directoryBytes(join(repositoryRoot, ".treeseed")), 0) + directoryBytes(npmTemporaryDownloads);
41
53
  const actions = [];
42
54
  const directoryTargets = mode === "aggressive" ? [
43
55
  ".treeseed/tmp",
44
56
  ".treeseed/cache",
45
- ".treeseed/scenes/runs",
46
- ".treeseed/scenes/matrix",
47
57
  ".treeseed/scenes/render"
48
58
  ] : [".treeseed/tmp", ".treeseed/cache", ".treeseed/scenes/render"];
49
- for (const target of directoryTargets) actions.push(removeDirectory(root, target));
50
- if (input.docker === true && mode === "aggressive") actions.push(runCleanupCommand("docker-system-prune", "docker", ["docker", "system", "prune", "--all", "--volumes", "--force"], root));
59
+ for (const repositoryRoot of repositoryRoots) {
60
+ const repositoryId = repositoryRoot === root ? "" : `${repositoryRoot.slice(root.length + 1)}:`;
61
+ for (const target of directoryTargets) {
62
+ actions.push(removeDirectoryPath(`${repositoryId}${target}`, join(repositoryRoot, target)));
63
+ }
64
+ }
65
+ actions.push(removeDirectoryPath("npm-cache-temporary-downloads", npmTemporaryDownloads));
66
+ if (input.docker === true && mode === "aggressive") {
67
+ actions.push(runCleanupCommand("docker-builder-prune", "docker", ["docker", "builder", "prune", "--all", "--force"], root));
68
+ actions.push(runCleanupCommand("docker-image-prune", "docker", ["docker", "image", "prune", "--all", "--force"], root));
69
+ }
51
70
  if (input.npmCache === true) actions.push(runCleanupCommand("npm-cache-clean", "npm-cache", ["npm", "cache", "clean", "--force"], root));
52
- const afterBytes = directoryBytes(join(root, ".treeseed"));
71
+ const afterBytes = repositoryRoots.reduce((total, repositoryRoot) => total + directoryBytes(join(repositoryRoot, ".treeseed")), 0) + directoryBytes(npmTemporaryDownloads);
53
72
  const completedAt = (/* @__PURE__ */ new Date()).toISOString();
54
73
  return { ok: actions.every((entry) => entry.status !== "failed"), mode, root, startedAt, completedAt, beforeBytes, afterBytes, reclaimedBytes: Math.max(0, beforeBytes - afterBytes), actions };
55
74
  }
@@ -838,12 +838,12 @@ ${needsNodeSetup ? ` - uses: actions/setup-node@v4
838
838
  function resolveWorkflowSetupCommand(adapter) {
839
839
  const scripts = adapter.metadata.scripts;
840
840
  if (isRecord(scripts) && typeof scripts["release:setup"] === "string") {
841
- return 'npm run release:setup || (echo "dependency install failed; retrying" && npm run release:setup)';
841
+ return "npm run release:setup";
842
842
  }
843
- return 'npm ci || (echo "dependency install failed; retrying" && npm ci)';
843
+ return "npm ci";
844
844
  }
845
845
  function resolveDockerImageWorkflowSetupCommand() {
846
- return 'npm ci --ignore-scripts || (echo "dependency install failed; retrying" && npm ci --ignore-scripts)';
846
+ return "npm ci --ignore-scripts";
847
847
  }
848
848
  function isRecord(value) {
849
849
  return value != null && typeof value === "object" && !Array.isArray(value);
@@ -86,6 +86,7 @@ export declare function isUsableRailwayToken(value: string | undefined | null):
86
86
  export declare function resolveRailwayApiToken(env?: NodeJS.ProcessEnv | Record<string, string | undefined>): string;
87
87
  export declare function resolveRailwayApiUrl(env?: NodeJS.ProcessEnv | Record<string, string | undefined>): string;
88
88
  export declare function resolveRailwayWorkspace(env?: NodeJS.ProcessEnv | Record<string, string | undefined>): string;
89
+ export declare function assertRailwayGraphqlReadOnly(document: string): void;
89
90
  export declare function railwayGraphqlRequest<TData = unknown>({ query, variables, env, apiToken, apiUrl, fetchImpl, timeoutMs, retries, }: {
90
91
  query: string;
91
92
  variables?: Record<string, unknown>;
@@ -167,19 +168,29 @@ export declare function ensureRailwayService({ projectId, serviceName, serviceId
167
168
  service: RailwayServiceSummary;
168
169
  created: boolean;
169
170
  }>;
170
- export declare function updateRailwayServiceImageSource({ serviceId, imageRef, env, fetchImpl, }: {
171
+ export declare function updateRailwayServiceImageSource({ projectId, serviceId, environmentId, imageRef, env, }: {
172
+ projectId?: string | null;
171
173
  serviceId: string;
174
+ environmentId?: string | null;
172
175
  imageRef: string;
173
176
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
174
177
  fetchImpl?: typeof fetch;
175
- }): Promise<RailwayServiceSummary>;
176
- export declare function updateRailwayServiceGitSource({ serviceId, sourceRepo, sourceBranch, env, fetchImpl, }: {
178
+ }): Promise<{
179
+ id: string;
180
+ name: string;
181
+ }>;
182
+ export declare function updateRailwayServiceGitSource({ projectId, serviceId, environmentId, sourceRepo, sourceBranch, env, }: {
183
+ projectId?: string | null;
177
184
  serviceId: string;
185
+ environmentId?: string | null;
178
186
  sourceRepo: string;
179
187
  sourceBranch?: string | null;
180
188
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
181
189
  fetchImpl?: typeof fetch;
182
- }): Promise<RailwayServiceSummary>;
190
+ }): Promise<{
191
+ id: string;
192
+ name: string;
193
+ }>;
183
194
  export declare function ensureRailwayGeneratedServiceDomain({ projectId, environmentId, serviceId, targetPort, env, fetchImpl, }: {
184
195
  projectId: string;
185
196
  environmentId: string;
@@ -198,7 +209,8 @@ export declare function listRailwayServiceDomains({ projectId, environmentId, se
198
209
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
199
210
  fetchImpl?: typeof fetch;
200
211
  }): Promise<RailwayServiceDomainSummary[]>;
201
- export declare function deployRailwayServiceInstance({ serviceId, environmentId, env, fetchImpl, }: {
212
+ export declare function deployRailwayServiceInstance({ projectId, serviceId, environmentId, env, fetchImpl, }: {
213
+ projectId?: string | null;
202
214
  serviceId: string;
203
215
  environmentId: string;
204
216
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
@@ -211,7 +223,7 @@ export declare function updateRailwayServiceName({ serviceId, name, env, fetchIm
211
223
  name: string;
212
224
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
213
225
  fetchImpl?: typeof fetch;
214
- }): Promise<RailwayServiceSummary>;
226
+ }): Promise<void>;
215
227
  export declare function ensureRailwayPostgresService({ projectId, environmentId, serviceName, env, fetchImpl, maxAttempts, }: {
216
228
  projectId: string;
217
229
  environmentId: string;
@@ -220,7 +232,7 @@ export declare function ensureRailwayPostgresService({ projectId, environmentId,
220
232
  fetchImpl?: typeof fetch;
221
233
  maxAttempts?: number;
222
234
  }): Promise<{
223
- service: RailwayServiceSummary;
235
+ service: void | RailwayServiceSummary;
224
236
  created: boolean;
225
237
  proof: {
226
238
  ok: boolean;
@@ -238,10 +250,13 @@ export declare function inspectRailwayServiceDeploymentHealth({ serviceId, envir
238
250
  }): Promise<{
239
251
  ok: boolean;
240
252
  status: string;
253
+ deploymentStopped: boolean;
254
+ instanceStatuses: string[];
241
255
  branch: string | null;
242
256
  repo: string | null;
243
257
  rootDirectory: string | null;
244
258
  commitHash: string | null;
259
+ image: string | null;
245
260
  requiredMountPath: string | null;
246
261
  volumeMounts: any;
247
262
  message: string;
@@ -379,31 +394,22 @@ export declare function listRailwayVolumes({ projectId, env, fetchImpl, }: {
379
394
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
380
395
  fetchImpl?: typeof fetch;
381
396
  }): Promise<RailwayVolumeSummary[]>;
382
- export declare function ensureRailwayServiceVolume({ projectId, environmentId, serviceId, name, mountPath, env, fetchImpl, settleAttempts, settleDelayMs, }: {
397
+ export declare function ensureRailwayServiceVolume({ projectId, environmentId, serviceId, name, mountPath, adoptVolumeId, env, fetchImpl, settleAttempts, settleDelayMs, }: {
383
398
  projectId: string;
384
399
  environmentId: string;
385
400
  serviceId: string;
386
401
  name: string;
387
402
  mountPath: string;
403
+ adoptVolumeId?: string | null;
388
404
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
389
405
  fetchImpl?: typeof fetch;
390
406
  settleAttempts?: number;
391
407
  settleDelayMs?: number;
392
408
  }): Promise<{
393
- volume: {
394
- instances: RailwayVolumeInstanceSummary[];
395
- id: string;
396
- name: string;
397
- projectId: string | null;
398
- };
409
+ volume: RailwayVolumeSummary;
399
410
  instance: RailwayVolumeInstanceSummary | null;
400
411
  created: boolean;
401
412
  updated: boolean;
402
- } | {
403
- volume: RailwayVolumeSummary | null;
404
- instance: RailwayVolumeInstanceSummary;
405
- created: boolean;
406
- updated: boolean;
407
413
  }>;
408
414
  export declare function listRailwayCustomDomains({ projectId, environmentId, serviceId, env, fetchImpl, }: {
409
415
  projectId: string;
@@ -423,28 +429,66 @@ export declare function ensureRailwayCustomDomain({ projectId, environmentId, se
423
429
  domain: RailwayCustomDomainSummary;
424
430
  created: boolean;
425
431
  }>;
426
- export declare function deleteRailwayCustomDomain({ domainId, env, fetchImpl, }: {
432
+ export declare function deleteRailwayCustomDomain({ projectId, environmentId, serviceId, domainId, env, fetchImpl, }: {
433
+ projectId?: string | null;
434
+ environmentId?: string | null;
435
+ serviceId?: string | null;
427
436
  domainId: string;
428
437
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
429
438
  fetchImpl?: typeof fetch;
430
- }): Promise<Record<string, unknown>>;
431
- export declare function deleteRailwayService({ serviceId, env, fetchImpl, }: {
439
+ }): Promise<{
440
+ status: string;
441
+ id: string;
442
+ } | {
443
+ status: string;
444
+ id?: undefined;
445
+ }>;
446
+ export declare function deleteRailwayService({ projectId, environmentId, serviceId, env, fetchImpl, }: {
447
+ projectId?: string | null;
448
+ environmentId?: string | null;
432
449
  serviceId: string;
433
450
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
434
451
  fetchImpl?: typeof fetch;
435
- }): Promise<Record<string, unknown>>;
436
- export declare function deleteRailwayVolume({ volumeId, env, fetchImpl, }: {
452
+ }): Promise<{
453
+ status: string;
454
+ id: string;
455
+ } | {
456
+ status: string;
457
+ id?: undefined;
458
+ }>;
459
+ export declare function deleteRailwayVolume({ projectId, environmentId, volumeId, env, fetchImpl, }: {
460
+ projectId?: string | null;
461
+ environmentId?: string | null;
437
462
  volumeId: string;
438
463
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
439
464
  fetchImpl?: typeof fetch;
440
- }): Promise<Record<string, unknown>>;
441
- export declare function deleteRailwayEnvironment({ environmentId, env, fetchImpl, }: {
465
+ }): Promise<{
466
+ status: string;
467
+ id: string;
468
+ } | {
469
+ status: string;
470
+ id?: undefined;
471
+ }>;
472
+ export declare function deleteRailwayEnvironment({ projectId, environmentId, env, fetchImpl, }: {
473
+ projectId?: string | null;
442
474
  environmentId: string;
443
475
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
444
476
  fetchImpl?: typeof fetch;
445
- }): Promise<Record<string, unknown>>;
477
+ }): Promise<{
478
+ status: string;
479
+ id: string;
480
+ } | {
481
+ status: string;
482
+ id?: undefined;
483
+ }>;
446
484
  export declare function deleteRailwayProject({ projectId, env, fetchImpl, }: {
447
485
  projectId: string;
448
486
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
449
487
  fetchImpl?: typeof fetch;
450
- }): Promise<Record<string, unknown>>;
488
+ }): Promise<{
489
+ status: string;
490
+ id: string;
491
+ } | {
492
+ status: string;
493
+ id?: undefined;
494
+ }>;