@treeseed/sdk 0.12.13 → 0.12.14

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.
@@ -335,7 +335,7 @@ function buildProfileFromDeployConfig(input) {
335
335
  const configuredRailwayProjectName = typeof service.railway?.projectName === "string" && service.railway.projectName.trim() ? service.railway.projectName.trim() : null;
336
336
  const defaultProjectGroup = service.provider === "railway" || service.railway ? String(serviceKey).startsWith("capacityProvider") && configuredRailwayProjectName ? capacityProviderProjectGroupId(configuredRailwayProjectName) : "treeseed-control-plane" : void 0;
337
337
  const imageRefEnv = railwayImageRefEnvForService(serviceKey);
338
- const imageRef = service.railway?.imageRef ?? (imageRefEnv ? launchEnv[imageRefEnv] ?? null : null) ?? defaultRailwayImageRefForService(serviceKey, input.environment) ?? null;
338
+ const imageRef = service.railway?.imageRef ?? (input.environment === "prod" && imageRefEnv ? launchEnv[imageRefEnv] ?? null : null) ?? defaultRailwayImageRefForService(serviceKey, input.environment) ?? null;
339
339
  const sourcePolicy = railwaySourcePolicy(input, serviceKey, service, imageRef);
340
340
  services.push({
341
341
  id: serviceKey,
@@ -81,6 +81,9 @@ function railwayImageRefEnvForService(serviceKey) {
81
81
  return null;
82
82
  }
83
83
  function defaultRailwayImageRef(serviceKey, scope = "staging", env = process.env) {
84
+ if (normalizeScope(scope) !== "prod" && serviceKey !== "capacityProviderManager" && serviceKey !== "capacityProviderRunner") {
85
+ return null;
86
+ }
84
87
  if (serviceKey === "api") {
85
88
  return envValue("TREESEED_API_IMAGE_REF", env) || null;
86
89
  }
@@ -668,7 +671,8 @@ function configuredRailwayServicesForConfig(tenantRoot, scope, deployConfig, app
668
671
  const runnerIndex = offset + 1;
669
672
  const serviceName = serviceKey === "operationsRunner" ? deriveRailwayOperationsRunnerServiceName(configuredServiceName, runnerIndex) : serviceKey === "capacityProviderRunner" ? deriveRailwayCapacityProviderRunnerServiceName(configuredServiceName, runnerIndex) : configuredServiceName;
670
673
  const configuredImageRefEnv = service.railway?.imageRefEnv ?? railwayImageRefEnvForService(serviceKey);
671
- const imageRef = service.railway?.imageRef ?? (configuredImageRefEnv ? envValue(configuredImageRefEnv, imageRefEnv) || null : null) ?? defaultRailwayImageRef(serviceKey, normalizedScope, imageRefEnv);
674
+ const canUseImageRefEnv = normalizedScope === "prod" || serviceKey === "capacityProviderManager" || serviceKey === "capacityProviderRunner";
675
+ const imageRef = service.railway?.imageRef ?? (canUseImageRefEnv && configuredImageRefEnv ? envValue(configuredImageRefEnv, imageRefEnv) || null : null) ?? defaultRailwayImageRef(serviceKey, normalizedScope, imageRefEnv);
672
676
  const sourcePolicy = resolveRailwayServiceSourcePolicy({
673
677
  tenantRoot,
674
678
  scope: normalizedScope,
@@ -3821,7 +3821,7 @@ async function syncRailwayEnvironmentForScope(input, { dryRun = false, serviceKe
3821
3821
  }));
3822
3822
  const databaseLiveService = databaseDescriptor ? liveServiceByName.get(databaseDescriptor.serviceName) ?? project.services.find((candidate) => candidate.name === databaseDescriptor.serviceName) ?? null : null;
3823
3823
  const databaseDetachVolumeIds = databaseDescriptor ? activeAttachedRailwayVolumeIds(liveVolumes, databaseLiveService?.id, environment.id, `${databaseDescriptor.serviceName}-volume`) : [];
3824
- const databaseForIac = databaseDescriptor ? { ...databaseDescriptor, detachVolumeIds: databaseDetachVolumeIds, useNativePostgres: Boolean(databaseLiveService) } : null;
3824
+ const databaseForIac = databaseDescriptor ? { ...databaseDescriptor, detachVolumeIds: databaseDetachVolumeIds, useNativePostgres: false } : null;
3825
3825
  const token = String(topology.env.TREESEED_RAILWAY_API_TOKEN ?? topology.env.RAILWAY_API_TOKEN ?? "").trim();
3826
3826
  if (!token) {
3827
3827
  throw new Error(`Railway IaC reconciliation requires TREESEED_RAILWAY_API_TOKEN for ${project.name}/${environment.name}.`);
@@ -4422,7 +4422,12 @@ function collectRailwayEnvironmentSync(input, valuesOverlay = {}) {
4422
4422
  ...serviceVariables,
4423
4423
  ...serviceRefVariables,
4424
4424
  ...Object.fromEntries(entriesForService("railway-var", serviceKey)),
4425
- ...serviceKey === "operationsRunner" ? { TREESEED_MANAGER_ID: scope } : {},
4425
+ ...serviceKey === "operationsRunner" ? {
4426
+ TREESEED_MANAGER_ID: scope,
4427
+ TREESEED_PLATFORM_RUNNER_ID: configuredService?.runnerId ?? configuredService?.serviceName ?? "treeseed-api-operations-runner-01",
4428
+ TREESEED_PLATFORM_RUNNER_DATA_DIR: configuredService?.volumeMountPath ?? "/data",
4429
+ TREESEED_PLATFORM_RUNNER_ENVIRONMENT: scope === "prod" ? "production" : scope
4430
+ } : {},
4426
4431
  ...serviceKey === "api" ? apiOnlyVariables : {},
4427
4432
  ...capacityVariables
4428
4433
  }
@@ -1,7 +1,8 @@
1
1
  import type { TreeseedDesiredUnit, TreeseedReconcileTarget } from './contracts.js';
2
- export declare function deriveTreeseedDesiredUnits({ tenantRoot, target, }: {
2
+ export declare function deriveTreeseedDesiredUnits({ tenantRoot, target, env, }: {
3
3
  tenantRoot: string;
4
4
  target: TreeseedReconcileTarget;
5
+ env?: NodeJS.ProcessEnv;
5
6
  }): {
6
7
  deployConfig: import("../platform/contracts.js").TreeseedDeployConfig;
7
8
  legacyState: any;
@@ -26,9 +26,10 @@ function isPublicTreeDxNodeServiceKey(serviceKey) {
26
26
  }
27
27
  function deriveTreeseedDesiredUnits({
28
28
  tenantRoot,
29
- target
29
+ target,
30
+ env = process.env
30
31
  }) {
31
- const deployConfig = loadTreeseedPlatformConfig({ tenantRoot, environment: target.kind === "persistent" ? target.scope : "staging", env: process.env }).deployConfig;
32
+ const deployConfig = loadTreeseedPlatformConfig({ tenantRoot, environment: target.kind === "persistent" ? target.scope : "staging", env }).deployConfig;
32
33
  const legacyState = loadDeployState(tenantRoot, deployConfig, { target });
33
34
  const identity = legacyState.identity ?? resolveTreeseedResourceIdentity(deployConfig, target);
34
35
  const units = [];
@@ -27,7 +27,7 @@ function formatVerificationFailure(verification) {
27
27
  return details.length > 0 ? `Verification failed (${details.join(" | ")})` : "Verification failed.";
28
28
  }
29
29
  function createRunContext(tenantRoot, target, launchEnv, write, dryRun = false, session) {
30
- const { deployConfig } = deriveTreeseedDesiredUnits({ tenantRoot, target });
30
+ const { deployConfig } = deriveTreeseedDesiredUnits({ tenantRoot, target, env: launchEnv });
31
31
  return {
32
32
  tenantRoot,
33
33
  target,
@@ -199,7 +199,7 @@ async function refreshTreeseedUnits({
199
199
  units: explicitUnits,
200
200
  write
201
201
  }) {
202
- const derived = deriveTreeseedDesiredUnits({ tenantRoot, target });
202
+ const derived = deriveTreeseedDesiredUnits({ tenantRoot, target, env });
203
203
  const baseUnits = explicitUnits ?? filterTreeseedDesiredUnitsByBootstrapSystems(derived.units, systems);
204
204
  const units = filterUnitsBySelector(baseUnits, selector);
205
205
  const deployConfig = derived.deployConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.12.13",
3
+ "version": "0.12.14",
4
4
  "description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {