openxiangda 1.0.240 → 1.0.241
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 +103 -2
- package/lib/delivery-v2-executor.js +4 -0
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -14524,6 +14524,20 @@ async function resource(args) {
|
|
|
14524
14524
|
const publishLease = await telemetry.runPhase('lease', async () =>
|
|
14525
14525
|
resolvePublishLeaseForWrite(config, target, flags)
|
|
14526
14526
|
);
|
|
14527
|
+
const deliveryV2BackendManifestIntent =
|
|
14528
|
+
resolveDeliveryV2BackendManifestReplacementIntent({
|
|
14529
|
+
flags,
|
|
14530
|
+
typeFilters,
|
|
14531
|
+
codeFilters,
|
|
14532
|
+
manifest,
|
|
14533
|
+
});
|
|
14534
|
+
const publishLeaseFlags = deliveryV2BackendManifestIntent
|
|
14535
|
+
? {
|
|
14536
|
+
...flags,
|
|
14537
|
+
reason: deliveryV2BackendManifestIntent.reason,
|
|
14538
|
+
'replace-reason': deliveryV2BackendManifestIntent.reason,
|
|
14539
|
+
}
|
|
14540
|
+
: flags;
|
|
14527
14541
|
const changeBaselinePreflight = await telemetry.runPhase(
|
|
14528
14542
|
'preflight',
|
|
14529
14543
|
{
|
|
@@ -14553,10 +14567,12 @@ async function resource(args) {
|
|
|
14553
14567
|
pruneCandidates,
|
|
14554
14568
|
publishLeaseId: publishLease?.leaseId,
|
|
14555
14569
|
publishLease,
|
|
14556
|
-
publishLeaseFlags
|
|
14570
|
+
publishLeaseFlags,
|
|
14557
14571
|
scopedFiles,
|
|
14558
14572
|
baseRef: flags.since || 'HEAD',
|
|
14559
|
-
replaceManifest:
|
|
14573
|
+
replaceManifest:
|
|
14574
|
+
Boolean(flags['replace-manifest']) ||
|
|
14575
|
+
Boolean(deliveryV2BackendManifestIntent),
|
|
14560
14576
|
changeId:
|
|
14561
14577
|
flags.change || getStoredChangeBaseline(target)?.changeId || null,
|
|
14562
14578
|
stagedFormBindingOverlays,
|
|
@@ -14572,6 +14588,10 @@ async function resource(args) {
|
|
|
14572
14588
|
Boolean(typeFilters?.has('workflows')),
|
|
14573
14589
|
})
|
|
14574
14590
|
);
|
|
14591
|
+
if (deliveryV2BackendManifestIntent) {
|
|
14592
|
+
result.deliveryV2BackendManifestReplacement =
|
|
14593
|
+
deliveryV2BackendManifestIntent;
|
|
14594
|
+
}
|
|
14575
14595
|
if (changeBaselinePreflight) {
|
|
14576
14596
|
result.changeBaselinePreflight = changeBaselinePreflight;
|
|
14577
14597
|
}
|
|
@@ -28265,6 +28285,86 @@ function shouldReplaceResourceManifestItem(item, resourceKey, code, options = {}
|
|
|
28265
28285
|
return options.replaceManifest === true;
|
|
28266
28286
|
}
|
|
28267
28287
|
|
|
28288
|
+
function resolveDeliveryV2BackendManifestReplacementIntent({
|
|
28289
|
+
flags = {},
|
|
28290
|
+
typeFilters = null,
|
|
28291
|
+
codeFilters = null,
|
|
28292
|
+
manifest = {},
|
|
28293
|
+
deliveryContext = activeDeliveryV2Context,
|
|
28294
|
+
} = {}) {
|
|
28295
|
+
if (!deliveryContext || !flags['stage-only']) return null;
|
|
28296
|
+
const selectedTypes = Array.from(typeFilters || []);
|
|
28297
|
+
if (
|
|
28298
|
+
selectedTypes.length === 0 ||
|
|
28299
|
+
selectedTypes.some(
|
|
28300
|
+
type => !['functions', 'automations'].includes(type)
|
|
28301
|
+
)
|
|
28302
|
+
) {
|
|
28303
|
+
return null;
|
|
28304
|
+
}
|
|
28305
|
+
if (!Array.isArray(codeFilters) || codeFilters.length === 0) {
|
|
28306
|
+
const error = new Error(
|
|
28307
|
+
'DELIVERY_BACKEND_SCOPE_MISMATCH: Delivery V2 Backend stage 缺少冻结的精确 selector'
|
|
28308
|
+
);
|
|
28309
|
+
error.code = 'DELIVERY_BACKEND_SCOPE_MISMATCH';
|
|
28310
|
+
error.retryable = false;
|
|
28311
|
+
throw error;
|
|
28312
|
+
}
|
|
28313
|
+
const expectedSelectors = unique([
|
|
28314
|
+
...(deliveryContext.targets?.functions || []).map(
|
|
28315
|
+
code => `Function:${String(code)}`
|
|
28316
|
+
),
|
|
28317
|
+
...(deliveryContext.targets?.automations || []).map(
|
|
28318
|
+
code => `Automation:${String(code)}`
|
|
28319
|
+
),
|
|
28320
|
+
]).sort();
|
|
28321
|
+
const actualSelectors = unique([
|
|
28322
|
+
...(manifest.functions || []).map(
|
|
28323
|
+
item => `Function:${getResourceItemCode(item)}`
|
|
28324
|
+
),
|
|
28325
|
+
...(manifest.automations || []).map(
|
|
28326
|
+
item => `Automation:${getResourceItemCode(item)}`
|
|
28327
|
+
),
|
|
28328
|
+
])
|
|
28329
|
+
.filter(selector => !selector.endsWith(':'))
|
|
28330
|
+
.sort();
|
|
28331
|
+
if (
|
|
28332
|
+
expectedSelectors.length === 0 ||
|
|
28333
|
+
JSON.stringify(actualSelectors) !== JSON.stringify(expectedSelectors)
|
|
28334
|
+
) {
|
|
28335
|
+
const error = new Error(
|
|
28336
|
+
`DELIVERY_BACKEND_SCOPE_MISMATCH: Delivery V2 Backend stage 与 ReleaseRun 冻结范围不一致;expected=[${expectedSelectors.join(
|
|
28337
|
+
','
|
|
28338
|
+
)}] actual=[${actualSelectors.join(',')}]`
|
|
28339
|
+
);
|
|
28340
|
+
error.code = 'DELIVERY_BACKEND_SCOPE_MISMATCH';
|
|
28341
|
+
error.retryable = false;
|
|
28342
|
+
error.expectedSelectors = expectedSelectors;
|
|
28343
|
+
error.actualSelectors = actualSelectors;
|
|
28344
|
+
throw error;
|
|
28345
|
+
}
|
|
28346
|
+
const runId = String(deliveryContext.runId || '').trim();
|
|
28347
|
+
const packageDigest = String(deliveryContext.packageDigest || '').trim();
|
|
28348
|
+
if (!runId || !/^[a-f0-9]{64}$/.test(packageDigest)) {
|
|
28349
|
+
const error = new Error(
|
|
28350
|
+
'DELIVERY_CONTROL_INVALID: Delivery V2 Backend stage 缺少 ReleaseRun/packageDigest 权威上下文'
|
|
28351
|
+
);
|
|
28352
|
+
error.code = 'DELIVERY_CONTROL_INVALID';
|
|
28353
|
+
error.retryable = false;
|
|
28354
|
+
throw error;
|
|
28355
|
+
}
|
|
28356
|
+
return {
|
|
28357
|
+
mode: 'manifest_replacement',
|
|
28358
|
+
authority: 'delivery_v2_sealed_package',
|
|
28359
|
+
runId,
|
|
28360
|
+
packageDigest,
|
|
28361
|
+
selectors: actualSelectors,
|
|
28362
|
+
reason:
|
|
28363
|
+
`Delivery V2 ReleaseRun ${runId} sealed package ${packageDigest} ` +
|
|
28364
|
+
'authoritative backend manifest and binding contract replacement',
|
|
28365
|
+
};
|
|
28366
|
+
}
|
|
28367
|
+
|
|
28268
28368
|
function buildAutomationSourcePatchSources(existingDefinition, desiredDefinition) {
|
|
28269
28369
|
const existing = existingDefinition || {};
|
|
28270
28370
|
const desired = desiredDefinition || {};
|
|
@@ -29991,6 +30091,7 @@ module.exports = {
|
|
|
29991
30091
|
buildScopeGrantSourceSyncDecision,
|
|
29992
30092
|
main,
|
|
29993
30093
|
resolveReleaseCommandScopedFiles,
|
|
30094
|
+
resolveDeliveryV2BackendManifestReplacementIntent,
|
|
29994
30095
|
resolveDataViewSourceFormCodes,
|
|
29995
30096
|
satisfiedFormCodesFromContext,
|
|
29996
30097
|
stagedDataViewFormReleaseDependencies,
|
|
@@ -882,6 +882,10 @@ function compactStepResult(stepId, result, context = {}) {
|
|
|
882
882
|
if (bindingContracts) {
|
|
883
883
|
compact.backendBindingContracts = bindingContracts;
|
|
884
884
|
}
|
|
885
|
+
if (result.deliveryV2BackendManifestReplacement) {
|
|
886
|
+
compact.backendManifestReplacement =
|
|
887
|
+
result.deliveryV2BackendManifestReplacement;
|
|
888
|
+
}
|
|
885
889
|
}
|
|
886
890
|
return compact;
|
|
887
891
|
}
|