@treeseed/sdk 0.12.60 → 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 -245
  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 +5 -5
  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 +51 -15
  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 +2 -2
  22. package/dist/operations/services/railway-deploy.js +36 -91
  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 +519 -684
  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 +147 -0
  35. package/dist/reconcile/providers/railway-iac.js +289 -16
  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 +4 -0
  42. package/dist/workflow-support.d.ts +1 -1
  43. package/dist/workflow-support.js +3 -1
  44. package/package.json +1 -2
@@ -16,15 +16,16 @@ import {
16
16
  configuredRailwayServices,
17
17
  findStaleTreeseedOperationsRunnerResources,
18
18
  isTreeseedOperationsRunnerResourceName,
19
- railwayLegacyAliasMigrationPolicy
19
+ railwayObsoleteAliasCleanupPolicy
20
20
  } from "./railway-deploy.js";
21
+ import { railwayTreeDxServiceName } from "./railway-source-policy.js";
21
22
  import { discoverTreeseedApplications } from "../../hosting/apps.js";
22
23
  import {
23
24
  collectTreeseedHostedServiceChecks
24
25
  } from "./hosted-service-checks.js";
25
26
  const DEFAULT_RETRY_ATTEMPTS = 3;
26
27
  const DEFAULT_RETRY_INTERVAL_MS = 1500;
27
- const DEFAULT_RAILWAY_DEPLOYMENT_SETTLE_ATTEMPTS = 120;
28
+ const DEFAULT_RAILWAY_DEPLOYMENT_SETTLE_ATTEMPTS = 12;
28
29
  const DEFAULT_RAILWAY_DEPLOYMENT_SETTLE_INTERVAL_MS = 5e3;
29
30
  function sleep(ms) {
30
31
  return new Promise((resolve2) => setTimeout(resolve2, ms));
@@ -92,9 +93,16 @@ async function inspectRailwayServiceDeploymentHealthWithRetry(input) {
92
93
  });
93
94
  lastDeployment = deployment;
94
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
+ }
95
99
  } catch (error) {
96
100
  lastError = error;
97
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
+ }
98
106
  if (attempt + 1 < attempts) await sleep(intervalMs);
99
107
  }
100
108
  return lastDeployment ?? {
@@ -236,13 +244,37 @@ async function collectRailwayObservations(options) {
236
244
  const inspectedRunnerScopes = /* @__PURE__ */ new Set();
237
245
  const selectedServiceKeys = selectedServiceKeySet(options);
238
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
+ };
239
271
  try {
240
272
  const workspace = await resolveRailwayWorkspaceContext({ env: options.env, fetchImpl: options.fetchImpl });
241
273
  const projects = await listRailwayProjects({ workspaceId: workspace.id, env: options.env, fetchImpl: options.fetchImpl });
242
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));
243
275
  const siblingTarget = options.target === "staging" ? "prod" : options.target === "prod" ? "staging" : null;
244
276
  const configuredSiblingServices = siblingTarget ? configuredRailwayServices(options.tenantRoot, siblingTarget, options.env, { identityOnly: true }).filter((entry) => entry.enabled !== false).filter((entry) => entry.key === "operationsRunner") : [];
245
- const retainedMigrationAliases = options.target === "staging" ? railwayLegacyAliasMigrationPolicy("staging", configuredServices).retainedResourceNames : [];
277
+ const retainedObsoleteAliases = options.target === "staging" ? railwayObsoleteAliasCleanupPolicy("staging", configuredServices).retainedResourceNames : [];
246
278
  if (selectedServiceKeys.size === 0 || selectedServiceKeys.has("api") || selectedServiceKeys.has("operationsRunner")) {
247
279
  for (const descriptor of treeseedDatabaseDescriptors(options.tenantRoot, options)) {
248
280
  await verifyRailwayPostgresTopology({ descriptor, configuredServices, projects, options, issues });
@@ -257,7 +289,7 @@ async function collectRailwayObservations(options) {
257
289
  issues.push(`${service.serviceName}: Railway project ${service.projectName} was not found.`);
258
290
  continue;
259
291
  }
260
- const environments = await listRailwayEnvironments({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl });
292
+ const environments = await environmentsFor(project.id);
261
293
  const environment = findByName(environments, service.railwayEnvironment);
262
294
  if (!environment?.id) {
263
295
  issues.push(`${service.serviceName}: Railway environment ${service.railwayEnvironment} was not found.`);
@@ -266,7 +298,7 @@ async function collectRailwayObservations(options) {
266
298
  const volumeScope = `${project.id}:${environment.id}`;
267
299
  if (!inspectedVolumeScopes.has(volumeScope)) {
268
300
  inspectedVolumeScopes.add(volumeScope);
269
- const volumes2 = await listRailwayVolumes({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => []);
301
+ const volumes2 = await volumesFor(project.id);
270
302
  for (const volume of volumes2) {
271
303
  if (isRetainedDetachedRailwayVolume(volume.name)) {
272
304
  continue;
@@ -282,23 +314,23 @@ async function collectRailwayObservations(options) {
282
314
  }
283
315
  }
284
316
  }
285
- const services = await listRailwayServices({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl });
317
+ const services = await servicesFor(project.id);
286
318
  const runnerScope = `${project.id}:${environment.id}`;
287
319
  if (service.key === "operationsRunner" && !inspectedRunnerScopes.has(runnerScope)) {
288
320
  inspectedRunnerScopes.add(runnerScope);
289
321
  const desiredRunnerNames = /* @__PURE__ */ new Set([
290
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),
291
323
  ...configuredSiblingServices.filter((entry) => entry.projectId ? entry.projectId === project.id : entry.projectName === project.name).map((entry) => entry.serviceName).filter((name) => Boolean(name) && isTreeseedOperationsRunnerResourceName(name)),
292
- ...retainedMigrationAliases.filter((name) => isTreeseedOperationsRunnerResourceName(name) && !name.endsWith("-volume"))
324
+ ...retainedObsoleteAliases.filter((name) => isTreeseedOperationsRunnerResourceName(name) && !name.endsWith("-volume"))
293
325
  ]);
294
326
  const desiredRunnerServiceIds = new Set(services.filter((entry) => desiredRunnerNames.has(entry.name)).map((entry) => entry.id));
295
327
  for (const staleService of findStaleTreeseedOperationsRunnerResources(services, desiredRunnerNames)) {
296
328
  issues.push(`${staleService.name}: stale operations runner Railway service remains in project ${project.name}.`);
297
329
  }
298
- const volumes2 = await listRailwayVolumes({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => []);
330
+ const volumes2 = await volumesFor(project.id);
299
331
  const desiredRunnerVolumeNames = /* @__PURE__ */ new Set([
300
332
  ...[...desiredRunnerNames].map((name) => `${name}-volume`),
301
- ...retainedMigrationAliases.filter((name) => name.endsWith("-volume"))
333
+ ...retainedObsoleteAliases.filter((name) => name.endsWith("-volume"))
302
334
  ]);
303
335
  for (const staleVolume of findStaleTreeseedOperationsRunnerResources(volumes2, desiredRunnerVolumeNames)) {
304
336
  const activeInstances = activeRailwayVolumeInstances(staleVolume);
@@ -317,7 +349,7 @@ async function collectRailwayObservations(options) {
317
349
  const [instance, variables, volumes] = await Promise.all([
318
350
  getRailwayServiceInstance({ serviceId: railwayService.id, environmentId: environment.id, env: options.env, fetchImpl: options.fetchImpl }),
319
351
  listRailwayVariables({ projectId: project.id, environmentId: environment.id, serviceId: railwayService.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => ({})),
320
- listRailwayVolumes({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => [])
352
+ volumesFor(project.id)
321
353
  ]);
322
354
  const mountedVolume = Array.isArray(volumes) ? volumes.find((entry) => {
323
355
  const instances = Array.isArray(entry.instances) ? entry.instances : Array.isArray(entry.volumeInstances) ? entry.volumeInstances : [];
@@ -332,6 +364,8 @@ async function collectRailwayObservations(options) {
332
364
  const deployment = await inspectRailwayServiceDeploymentHealthWithRetry({
333
365
  serviceId: railwayService.id,
334
366
  environmentId: environment.id,
367
+ serviceName: service.serviceName,
368
+ acceptSleeping: service.runtimeMode === "serverless",
335
369
  options
336
370
  }).catch((error) => ({
337
371
  ok: false,
@@ -394,20 +428,21 @@ async function collectRailwayObservations(options) {
394
428
  issues.push(`public-treedx: Railway project ${projectName} was not found.`);
395
429
  continue;
396
430
  }
397
- const environments = await listRailwayEnvironments({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl });
431
+ const environments = await environmentsFor(project.id);
398
432
  const environment = findByName(environments, environmentName);
399
433
  if (!environment?.id) {
400
434
  issues.push(`public-treedx: Railway environment ${environmentName} was not found.`);
401
435
  continue;
402
436
  }
403
437
  const [services, volumes] = await Promise.all([
404
- listRailwayServices({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }),
405
- listRailwayVolumes({ projectId: project.id, env: options.env, fetchImpl: options.fetchImpl }).catch(() => [])
438
+ servicesFor(project.id),
439
+ volumesFor(project.id)
406
440
  ]);
407
441
  for (let index = 1; index <= bootstrapCount; index += 1) {
408
- const serviceName = indexedName("public-treedx-node", index);
442
+ const logicalServiceName = indexedName("public-treedx-node", index);
443
+ const serviceName = railwayTreeDxServiceName(index, options.target);
409
444
  const volumeName = `${serviceName}-volume`;
410
- 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;
411
446
  const volumeMountPath = typeof configuredNode?.volumeMountPath === "string" && configuredNode.volumeMountPath.trim() ? configuredNode.volumeMountPath.trim() : "/data";
412
447
  const service = findByName(services, serviceName);
413
448
  if (!service?.id) {
@@ -417,6 +452,7 @@ async function collectRailwayObservations(options) {
417
452
  const deployment = await inspectRailwayServiceDeploymentHealthWithRetry({
418
453
  serviceId: service.id,
419
454
  environmentId: environment.id,
455
+ serviceName,
420
456
  options
421
457
  }).catch((error) => ({
422
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
+ }>;