@treeseed/sdk 0.12.31 → 0.12.33

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.
@@ -452,7 +452,7 @@ async function waitForRailwayManagedDeploymentsSettled(tenantRoot, scope, {
452
452
  } = {}) {
453
453
  const startMs = performance.now();
454
454
  const deadline = Date.now() + timeoutMs;
455
- const projectId = services.find((service) => typeof service.projectId === "string" && service.projectId.trim())?.projectId ?? null;
455
+ const projectId = await resolveRailwayDeploymentProjectId(services, { env, fetchImpl });
456
456
  if (!projectId) {
457
457
  return {
458
458
  ok: false,
@@ -571,6 +571,23 @@ async function waitForRailwayManagedDeploymentsSettled(tenantRoot, scope, {
571
571
  await sleep(pollMs);
572
572
  }
573
573
  }
574
+ async function resolveRailwayDeploymentProjectId(services, { env = process.env, fetchImpl = fetch } = {}) {
575
+ const configuredProjectId = services.find((service) => typeof service.projectId === "string" && service.projectId.trim())?.projectId?.trim();
576
+ if (configuredProjectId) {
577
+ return configuredProjectId;
578
+ }
579
+ const projectName = services.find((service) => typeof service.projectName === "string" && service.projectName.trim())?.projectName?.trim();
580
+ if (!projectName) {
581
+ return null;
582
+ }
583
+ try {
584
+ const workspace = await resolveRailwayWorkspaceContext({ env, fetchImpl });
585
+ const projects = await listRailwayProjects({ env, workspaceId: workspace.id, fetchImpl });
586
+ return projects.find((project) => project.name === projectName)?.id ?? null;
587
+ } catch {
588
+ return null;
589
+ }
590
+ }
574
591
  async function fetchRailwayProjectDeploymentStatus({ projectId, env = process.env, fetchImpl = fetch }) {
575
592
  const payload = await railwayGraphqlRequest({
576
593
  query: `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.12.31",
3
+ "version": "0.12.33",
4
4
  "description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {