openxiangda 1.0.98 → 1.0.100
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.
- package/lib/cli.js +72 -16
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -8567,7 +8567,9 @@ function clonePlainJson(value) {
|
|
|
8567
8567
|
function workflowEquals(bound, desired, existing) {
|
|
8568
8568
|
if (!existing) return false;
|
|
8569
8569
|
const desiredDefinition = resolveManifestPlainJson(desired, 'definitionJson', 'definitionFile');
|
|
8570
|
-
const desiredView =
|
|
8570
|
+
const desiredView =
|
|
8571
|
+
resolveManifestPlainJson(desired, 'viewJson', 'viewFile', true) ??
|
|
8572
|
+
resolveManifestPlainJson(desired, 'previewJson', 'previewFile', true);
|
|
8571
8573
|
const desiredFormUuid = resolveManifestFormUuid(bound, desired);
|
|
8572
8574
|
return (
|
|
8573
8575
|
String(existing.resourceCode || '') === String(desired.code || desired.resourceCode || '') &&
|
|
@@ -8582,7 +8584,9 @@ function automationEquals(target, desired, existing) {
|
|
|
8582
8584
|
if (!existing) return false;
|
|
8583
8585
|
const desiredDefinition = resolveManifestPlainJson(desired, 'definitionJson', 'definitionFile');
|
|
8584
8586
|
applyResourceBindingsToRuntimeDefinition(target.bound, desired, desiredDefinition);
|
|
8585
|
-
const desiredView =
|
|
8587
|
+
const desiredView =
|
|
8588
|
+
resolveManifestPlainJson(desired, 'viewJson', 'viewFile', true) ??
|
|
8589
|
+
resolveManifestPlainJson(desired, 'previewJson', 'previewFile', true);
|
|
8586
8590
|
const automationPayload = resolveAutomationManifestPayload(target, desired);
|
|
8587
8591
|
const desiredTags =
|
|
8588
8592
|
desired.tags === undefined
|
|
@@ -8597,17 +8601,29 @@ function automationEquals(target, desired, existing) {
|
|
|
8597
8601
|
? Boolean(desired.isEnabled)
|
|
8598
8602
|
: undefined;
|
|
8599
8603
|
|
|
8604
|
+
const matches = {
|
|
8605
|
+
resourceCode: String(existing.resourceCode || '') === String(desired.code || desired.resourceCode || ''),
|
|
8606
|
+
name: String(existing.name || '') === String(desired.name || desired.code || ''),
|
|
8607
|
+
description: String(existing.description || '') === String(desired.description || ''),
|
|
8608
|
+
formUuid: String(existing.formUuid || '') === String(automationPayload.formUuid || ''),
|
|
8609
|
+
triggerConfig: jsonEqualsForPlan(existing.triggerConfig, automationPayload.triggerConfig, desired.__dir),
|
|
8610
|
+
definitionJson: jsonEqualsForPlan(existing.definitionJson, desiredDefinition, desired.__dir),
|
|
8611
|
+
viewJson: optionalJsonEqualsForPlan(existing.viewJson, desiredView, desired.__dir),
|
|
8612
|
+
tags: desiredTags === undefined ? true : String(existing.tags || '') === desiredTags,
|
|
8613
|
+
published: desired.publish ? Boolean(existing.isPublished) === true : true,
|
|
8614
|
+
enabled: desiredEnabled === undefined ? true : Boolean(existing.isEnabled) === desiredEnabled,
|
|
8615
|
+
};
|
|
8600
8616
|
return (
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8617
|
+
matches.resourceCode &&
|
|
8618
|
+
matches.name &&
|
|
8619
|
+
matches.description &&
|
|
8620
|
+
matches.formUuid &&
|
|
8621
|
+
matches.triggerConfig &&
|
|
8622
|
+
matches.definitionJson &&
|
|
8623
|
+
matches.viewJson &&
|
|
8624
|
+
matches.tags &&
|
|
8625
|
+
matches.published &&
|
|
8626
|
+
matches.enabled
|
|
8611
8627
|
);
|
|
8612
8628
|
}
|
|
8613
8629
|
|
|
@@ -8785,6 +8801,7 @@ function normalizeJsonForPlan(value, baseDir, keyName) {
|
|
|
8785
8801
|
result.runtimeMode = result.runtimeMode || 'trusted_node';
|
|
8786
8802
|
result.sourceType = result.sourceType || 'file_snapshot';
|
|
8787
8803
|
}
|
|
8804
|
+
if (result.code === '') delete result.code;
|
|
8788
8805
|
return sortObjectForStableJson(result);
|
|
8789
8806
|
}
|
|
8790
8807
|
|
|
@@ -8795,12 +8812,15 @@ function normalizeLocalSourceFileForPlan(localPath, baseDir) {
|
|
|
8795
8812
|
const resolvedLocalPath = fs.existsSync(baseResolvedPath)
|
|
8796
8813
|
? baseResolvedPath
|
|
8797
8814
|
: cwdResolvedPath;
|
|
8798
|
-
const
|
|
8799
|
-
if (
|
|
8815
|
+
const sourceInfo = getJsCodeSourceInfoForPlan(resolvedLocalPath);
|
|
8816
|
+
if (sourceInfo) {
|
|
8817
|
+
ensureJsCodeBundleForPlan(sourceInfo);
|
|
8818
|
+
}
|
|
8819
|
+
if (sourceInfo?.bundlePath && fs.existsSync(sourceInfo.bundlePath)) {
|
|
8800
8820
|
return {
|
|
8801
8821
|
sha256: crypto
|
|
8802
8822
|
.createHash('sha256')
|
|
8803
|
-
.update(fs.readFileSync(bundlePath))
|
|
8823
|
+
.update(fs.readFileSync(sourceInfo.bundlePath))
|
|
8804
8824
|
.digest('hex'),
|
|
8805
8825
|
};
|
|
8806
8826
|
}
|
|
@@ -8810,6 +8830,10 @@ function normalizeLocalSourceFileForPlan(localPath, baseDir) {
|
|
|
8810
8830
|
}
|
|
8811
8831
|
|
|
8812
8832
|
function resolveJsCodeBundlePathForPlan(localPath) {
|
|
8833
|
+
return getJsCodeSourceInfoForPlan(localPath)?.bundlePath || null;
|
|
8834
|
+
}
|
|
8835
|
+
|
|
8836
|
+
function getJsCodeSourceInfoForPlan(localPath) {
|
|
8813
8837
|
const extension = path.extname(localPath).toLowerCase();
|
|
8814
8838
|
if (extension && extension !== '.ts' && extension !== '.tsx') return null;
|
|
8815
8839
|
const normalized = localPath.replace(/\\/g, '/');
|
|
@@ -8824,7 +8848,39 @@ function resolveJsCodeBundlePathForPlan(localPath) {
|
|
|
8824
8848
|
? 'automations'
|
|
8825
8849
|
: 'js-code-nodes';
|
|
8826
8850
|
const workspaceRoot = findWorkspaceRoot(localPath);
|
|
8827
|
-
|
|
8851
|
+
const scriptCode = matched[1];
|
|
8852
|
+
return {
|
|
8853
|
+
workspaceRoot,
|
|
8854
|
+
sourceKind,
|
|
8855
|
+
scriptCode,
|
|
8856
|
+
bundlePath: path.join(workspaceRoot, 'dist', sourceKind, scriptCode, 'index.cjs'),
|
|
8857
|
+
};
|
|
8858
|
+
}
|
|
8859
|
+
|
|
8860
|
+
const jsCodePlanBuildCache = new Set();
|
|
8861
|
+
|
|
8862
|
+
function ensureJsCodeBundleForPlan(sourceInfo) {
|
|
8863
|
+
if (fs.existsSync(sourceInfo.bundlePath)) return;
|
|
8864
|
+
const cacheKey = [
|
|
8865
|
+
sourceInfo.workspaceRoot,
|
|
8866
|
+
sourceInfo.sourceKind,
|
|
8867
|
+
sourceInfo.scriptCode,
|
|
8868
|
+
].join('\0');
|
|
8869
|
+
if (jsCodePlanBuildCache.has(cacheKey)) return;
|
|
8870
|
+
jsCodePlanBuildCache.add(cacheKey);
|
|
8871
|
+
const result = runWorkspaceJsCodeBuild(
|
|
8872
|
+
sourceInfo.workspaceRoot,
|
|
8873
|
+
sourceInfo.scriptCode,
|
|
8874
|
+
sourceInfo.sourceKind
|
|
8875
|
+
);
|
|
8876
|
+
if (result.status !== 0) {
|
|
8877
|
+
if (result.stdout) process.stderr.write(result.stdout);
|
|
8878
|
+
if (result.stderr) process.stderr.write(result.stderr);
|
|
8879
|
+
fail(`JS_CODE bundle构建失败,无法生成资源计划: ${sourceInfo.scriptCode}`);
|
|
8880
|
+
}
|
|
8881
|
+
if (!fs.existsSync(sourceInfo.bundlePath)) {
|
|
8882
|
+
fail(`JS_CODE bundle构建未生成产物,无法生成资源计划: ${sourceInfo.bundlePath}`);
|
|
8883
|
+
}
|
|
8828
8884
|
}
|
|
8829
8885
|
|
|
8830
8886
|
function sortObjectForStableJson(value) {
|