@treeseed/sdk 0.12.16 → 0.12.17

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.
@@ -54,7 +54,7 @@ function defaultVerify(input) {
54
54
  issues: []
55
55
  }
56
56
  ];
57
- if (input.unit.host.id === "railway" && input.environment === "prod" && unitConfig(input).sourceMode === "image") {
57
+ if (input.unit.host.id === "railway" && input.environment === "prod" && unitConfig(input).sourceMode === "image" && input.unit.serviceType.id !== "relational-database" && unitConfig(input).resourceType !== "postgres") {
58
58
  const imageRef = unitConfig(input).imageRef;
59
59
  const hasImageRef = typeof imageRef === "string" && imageRef.trim().length > 0;
60
60
  checks.push({
@@ -2134,7 +2134,7 @@ function getPersistedCustomDomainState(input, provider, domain) {
2134
2134
  }
2135
2135
  if (provider === "railway") {
2136
2136
  try {
2137
- const state = loadTreeseedReconcileState(input.context.tenantRoot, input.context.target);
2137
+ const state = loadTreeseedReconcileState(input.context.tenantRoot, input.context.target, input.context.launchEnv);
2138
2138
  const unitId = createTreeseedReconcileUnitId("custom-domain:api", domain);
2139
2139
  const unit = state.units[unitId];
2140
2140
  const reconciled = unit?.lastReconciledState;
@@ -204,7 +204,7 @@ async function refreshTreeseedUnits({
204
204
  const units = filterUnitsBySelector(baseUnits, selector);
205
205
  const deployConfig = derived.deployConfig;
206
206
  const registry = createTreeseedReconcileRegistry(deployConfig);
207
- const reconcileState = loadTreeseedReconcileState(tenantRoot, target);
207
+ const reconcileState = loadTreeseedReconcileState(tenantRoot, target, env);
208
208
  const context = createRunContext(tenantRoot, target, env, write);
209
209
  const observations = /* @__PURE__ */ new Map();
210
210
  await runByDependencyLevel(topologicallySortDesiredUnits(units), async (unit) => {
@@ -294,7 +294,7 @@ async function reconcileTreeseedTarget({
294
294
  const persistVerifiedResult = async (persisted, verifiedResult) => {
295
295
  persistChain = persistChain.then(() => {
296
296
  persistResult(planned.state, persisted, verifiedResult);
297
- writeTreeseedReconcileState(tenantRoot, planned.state);
297
+ writeTreeseedReconcileState(tenantRoot, planned.state, env);
298
298
  });
299
299
  await persistChain;
300
300
  };
@@ -458,7 +458,7 @@ async function reconcileTreeseedTarget({
458
458
  results.push(verifiedResult);
459
459
  });
460
460
  if (!dryRun) {
461
- writeTreeseedReconcileState(tenantRoot, planned.state);
461
+ writeTreeseedReconcileState(tenantRoot, planned.state, env);
462
462
  }
463
463
  return {
464
464
  target,
@@ -477,10 +477,10 @@ async function destroyTreeseedTargetUnits({
477
477
  units: explicitUnits,
478
478
  write
479
479
  }) {
480
- const { units: allUnits, deployConfig } = deriveTreeseedDesiredUnits({ tenantRoot, target });
480
+ const { units: allUnits, deployConfig } = deriveTreeseedDesiredUnits({ tenantRoot, target, env });
481
481
  const units = filterUnitsBySelector(explicitUnits ?? allUnits, selector);
482
482
  const registry = createTreeseedReconcileRegistry(deployConfig);
483
- const reconcileState = loadTreeseedReconcileState(tenantRoot, target);
483
+ const reconcileState = loadTreeseedReconcileState(tenantRoot, target, env);
484
484
  const context = createRunContext(tenantRoot, target, env, write);
485
485
  const results = [];
486
486
  for (const unit of reverseTopologicallySortedUnits(units)) {
@@ -1,7 +1,7 @@
1
1
  import type { TreeseedDesiredUnit, TreeseedReconcileStateRecord, TreeseedReconcileTarget, TreeseedUnitPersistedState } from './contracts.js';
2
2
  export declare function migrateLegacyDeployStateUnits(legacyState: Record<string, any>, target: TreeseedReconcileTarget): Record<string, TreeseedUnitPersistedState>;
3
- export declare function loadTreeseedReconcileState(tenantRoot: string, target: TreeseedReconcileTarget): TreeseedReconcileStateRecord;
4
- export declare function writeTreeseedReconcileState(tenantRoot: string, reconcileState: TreeseedReconcileStateRecord): void;
3
+ export declare function loadTreeseedReconcileState(tenantRoot: string, target: TreeseedReconcileTarget, env?: NodeJS.ProcessEnv | Record<string, string | undefined>): TreeseedReconcileStateRecord;
4
+ export declare function writeTreeseedReconcileState(tenantRoot: string, reconcileState: TreeseedReconcileStateRecord, env?: NodeJS.ProcessEnv | Record<string, string | undefined>): void;
5
5
  export declare function ensureTreeseedPersistedUnitState(reconcileState: TreeseedReconcileStateRecord, unit: TreeseedDesiredUnit): TreeseedUnitPersistedState;
6
6
  export declare function updateTreeseedPersistedUnitState(reconcileState: TreeseedReconcileStateRecord, state: TreeseedUnitPersistedState): void;
7
7
  export declare function desiredUnitSpecHash(unit: TreeseedDesiredUnit): string;
@@ -227,8 +227,8 @@ function migrateLegacyDeployStateUnits(legacyState, target) {
227
227
  }
228
228
  return units;
229
229
  }
230
- function loadTreeseedReconcileState(tenantRoot, target) {
231
- const deployConfig = loadTreeseedPlatformConfig({ tenantRoot, environment: target.kind === "persistent" ? target.scope : "staging", env: process.env }).deployConfig;
230
+ function loadTreeseedReconcileState(tenantRoot, target, env = process.env) {
231
+ const deployConfig = loadTreeseedPlatformConfig({ tenantRoot, environment: target.kind === "persistent" ? target.scope : "staging", env }).deployConfig;
232
232
  const legacyState = loadDeployState(tenantRoot, deployConfig, { target });
233
233
  const persistedUnits = legacyState.units && typeof legacyState.units === "object" ? legacyState.units : migrateLegacyDeployStateUnits(legacyState, target);
234
234
  return {
@@ -238,8 +238,8 @@ function loadTreeseedReconcileState(tenantRoot, target) {
238
238
  units: { ...persistedUnits }
239
239
  };
240
240
  }
241
- function writeTreeseedReconcileState(tenantRoot, reconcileState) {
242
- const deployConfig = loadTreeseedPlatformConfig({ tenantRoot, environment: reconcileState.target.kind === "persistent" ? reconcileState.target.scope : "staging", env: process.env }).deployConfig;
241
+ function writeTreeseedReconcileState(tenantRoot, reconcileState, env = process.env) {
242
+ const deployConfig = loadTreeseedPlatformConfig({ tenantRoot, environment: reconcileState.target.kind === "persistent" ? reconcileState.target.scope : "staging", env }).deployConfig;
243
243
  const legacyState = loadDeployState(tenantRoot, deployConfig, { target: reconcileState.target });
244
244
  writeDeployState(tenantRoot, {
245
245
  ...legacyState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.12.16",
3
+ "version": "0.12.17",
4
4
  "description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {