@terraforge/core 0.0.16 → 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 +39 -2
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1096,6 +1096,43 @@ const refresh = async (app, opt) => {
1096
1096
 
1097
1097
  //#endregion
1098
1098
  //#region src/workspace/procedure/status.ts
1099
+ /**
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.
1104
+ */
1105
+ const extractStaticInputs = (inputs) => {
1106
+ if (inputs instanceof Output || inputs instanceof Future || inputs instanceof Promise) return;
1107
+ if (Array.isArray(inputs)) return inputs.map(extractStaticInputs);
1108
+ if (inputs !== null && typeof inputs === "object" && inputs.constructor === Object) {
1109
+ const result = {};
1110
+ for (const [key, value] of Object.entries(inputs)) {
1111
+ const extracted = extractStaticInputs(value);
1112
+ if (extracted !== void 0) result[key] = extracted;
1113
+ }
1114
+ return result;
1115
+ }
1116
+ return inputs;
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
+ };
1099
1136
  const status = async (app, opt) => {
1100
1137
  const appState = await opt.backend.state.get(app.urn);
1101
1138
  const resources = [];
@@ -1119,8 +1156,8 @@ const status = async (app, opt) => {
1119
1156
  });
1120
1157
  continue;
1121
1158
  }
1122
- const currentInput = await resolveInputs(meta.input);
1123
- const hasChanged = !compareState(nodeState.input, currentInput);
1159
+ const currentInput = extractStaticInputs(meta.input);
1160
+ const hasChanged = !compareState(filterStateToMatchConfig(nodeState.input, meta.input), currentInput);
1124
1161
  resources.push({
1125
1162
  ...baseInfo,
1126
1163
  status: hasChanged ? "changed" : "created"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terraforge/core",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",