@terraforge/core 0.0.17 → 0.0.18

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 (2) hide show
  1. package/dist/index.mjs +28 -5
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1097,19 +1097,42 @@ const refresh = async (app, opt) => {
1097
1097
  //#endregion
1098
1098
  //#region src/workspace/procedure/status.ts
1099
1099
  /**
1100
- * Extract static values from inputs, replacing Output/Future/Promise with a placeholder.
1101
- * This allows comparing config without needing to resolve dependencies.
1100
+ * Extract static values from inputs, omitting Output/Future/Promise values.
1101
+ * This allows comparing only the static parts of config without needing to resolve dependencies.
1102
+ * We omit dynamic values entirely rather than using placeholders, since the state file
1103
+ * contains resolved values that we can't meaningfully compare against.
1102
1104
  */
1103
1105
  const extractStaticInputs = (inputs) => {
1104
- if (inputs instanceof Output || inputs instanceof Future || inputs instanceof Promise) return "__unresolved__";
1106
+ if (inputs instanceof Output || inputs instanceof Future || inputs instanceof Promise) return;
1105
1107
  if (Array.isArray(inputs)) return inputs.map(extractStaticInputs);
1106
1108
  if (inputs !== null && typeof inputs === "object" && inputs.constructor === Object) {
1107
1109
  const result = {};
1108
- for (const [key, value] of Object.entries(inputs)) result[key] = extractStaticInputs(value);
1110
+ for (const [key, value] of Object.entries(inputs)) {
1111
+ const extracted = extractStaticInputs(value);
1112
+ if (extracted !== void 0) result[key] = extracted;
1113
+ }
1109
1114
  return result;
1110
1115
  }
1111
1116
  return inputs;
1112
1117
  };
1118
+ /**
1119
+ * Remove keys from state that correspond to dynamic (Output/Future/Promise) values in config.
1120
+ * This ensures we only compare static values that exist in both.
1121
+ */
1122
+ const filterStateToMatchConfig = (state, config) => {
1123
+ if (config instanceof Output || config instanceof Future || config instanceof Promise) return;
1124
+ if (Array.isArray(config) && Array.isArray(state)) return config.map((configItem, index) => filterStateToMatchConfig(state[index], configItem));
1125
+ if (config !== null && typeof config === "object" && config.constructor === Object && state !== null && typeof state === "object") {
1126
+ const result = {};
1127
+ for (const [key, configValue] of Object.entries(config)) {
1128
+ const stateValue = state[key];
1129
+ const filtered = filterStateToMatchConfig(stateValue, configValue);
1130
+ if (filtered !== void 0) result[key] = filtered;
1131
+ }
1132
+ return result;
1133
+ }
1134
+ return state;
1135
+ };
1113
1136
  const status = async (app, opt) => {
1114
1137
  const appState = await opt.backend.state.get(app.urn);
1115
1138
  const resources = [];
@@ -1134,7 +1157,7 @@ const status = async (app, opt) => {
1134
1157
  continue;
1135
1158
  }
1136
1159
  const currentInput = extractStaticInputs(meta.input);
1137
- const hasChanged = !compareState(extractStaticInputs(nodeState.input), currentInput);
1160
+ const hasChanged = !compareState(filterStateToMatchConfig(nodeState.input, meta.input), currentInput);
1138
1161
  resources.push({
1139
1162
  ...baseInfo,
1140
1163
  status: hasChanged ? "changed" : "created"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terraforge/core",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",