dsh-plugin-opc 0.1.17 → 0.1.19
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/client.js +63 -16
- package/lib/index.js +37 -5
- package/package.json +1 -1
- package/runtime/app_delivery_migration.py +3 -1
package/lib/client.js
CHANGED
|
@@ -30307,7 +30307,7 @@ function AppDeliveryConfig({
|
|
|
30307
30307
|
);
|
|
30308
30308
|
const renderConfigCard = (item, index3) => {
|
|
30309
30309
|
const original = originals.find((o) => o.key === item.key);
|
|
30310
|
-
const candidates = resources.filter((r) => matches(original || item, r));
|
|
30310
|
+
const candidates = resources.filter((r) => matches(original || item, r) && (r.type !== "minio-app-storage" || configs.some((config2) => config2.resource_id === r.id)));
|
|
30311
30311
|
const selected = resources.find((r) => r.id === item.resource_id);
|
|
30312
30312
|
const changed = !!item.resource_id || !!original && item.value !== original.value;
|
|
30313
30313
|
const hasOriginalFileSource = original?.value_source === "original" || original?.has_original_value;
|
|
@@ -30366,7 +30366,13 @@ function AppDeliveryConfig({
|
|
|
30366
30366
|
"aria-label": `\u4F7F\u7528${resource.name}\u66FF\u6362 ${item.key}`,
|
|
30367
30367
|
disabled: item.resource_id === resource.id,
|
|
30368
30368
|
className: `oa-btn oa-btn-sm ${item.resource_id === resource.id ? "oa-btn-accent-soft" : ""}`,
|
|
30369
|
-
onClick: () =>
|
|
30369
|
+
onClick: () => {
|
|
30370
|
+
if (resource.type === "minio-app-storage") {
|
|
30371
|
+
onChange(configs.map((config2) => resource.env_keys.includes(config2.key) ? { ...config2, value: "", value_source: "resource", resource_id: resource.id } : config2));
|
|
30372
|
+
return;
|
|
30373
|
+
}
|
|
30374
|
+
update(index3, { ...item, value: "", value_source: "resource", resource_id: resource.id });
|
|
30375
|
+
}
|
|
30370
30376
|
},
|
|
30371
30377
|
item.resource_id === resource.id ? "\u2713 " : "\u6539\u7528 ",
|
|
30372
30378
|
resource.name
|
|
@@ -56529,6 +56535,16 @@ function AppsPanel({
|
|
|
56529
56535
|
const [step2State, setStep2State] = (0, import_react8.useState)(null);
|
|
56530
56536
|
const [configSubTab, setConfigSubTab] = (0, import_react8.useState)("configs");
|
|
56531
56537
|
const [configDrafts, setConfigDrafts] = (0, import_react8.useState)([]);
|
|
56538
|
+
const [storageBindings, setStorageBindings] = (0, import_react8.useState)({});
|
|
56539
|
+
const [existingStorage, setExistingStorage] = (0, import_react8.useState)([]);
|
|
56540
|
+
const volumeResources = resources.filter((resource) => resource.type === "local-directory" || resource.type === "aliyun-oss-volume");
|
|
56541
|
+
const volumeMounts = wizardJob?.proposal?.contract?.storage_mounts ?? [];
|
|
56542
|
+
const volumeOptions = (mount) => volumeResources.filter((resource) => mount.kind !== "sqlite" || resource.type === "local-directory");
|
|
56543
|
+
const storageSelections = Object.fromEntries(volumeMounts.filter((mount) => !existingStorage.some((old) => old.container_path === mount.container_path)).map((mount) => {
|
|
56544
|
+
const options = volumeOptions(mount);
|
|
56545
|
+
const selected = options.find((resource) => resource.id === storageBindings[mount.container_path]);
|
|
56546
|
+
return [mount.container_path, (selected ?? options.find((resource) => resource.is_default) ?? options[0])?.id ?? ""];
|
|
56547
|
+
}));
|
|
56532
56548
|
const [originalConfigs, setOriginalConfigs] = (0, import_react8.useState)([]);
|
|
56533
56549
|
const [versionNote, setVersionNote] = (0, import_react8.useState)("");
|
|
56534
56550
|
const draftSaveTimerRef = (0, import_react8.useRef)(null);
|
|
@@ -56699,17 +56715,23 @@ function AppsPanel({
|
|
|
56699
56715
|
const draftRaw = api.appConfigDraft ? await api.appConfigDraft(job.id, contextId).catch(() => "null") : "null";
|
|
56700
56716
|
const draft = parseJson(draftRaw, null);
|
|
56701
56717
|
const { configs, originals } = mergeJobConfigs(job, draft);
|
|
56702
|
-
|
|
56718
|
+
const detail = job.upgrade ? parseJson(await api.appDetails(job.slug, contextId), null) : null;
|
|
56719
|
+
const objectStorage = resources.find((resource) => resource.type === "minio-app-storage" && detail?.resource_ids?.includes(resource.id));
|
|
56720
|
+
setConfigDrafts(draft || !objectStorage ? configs : configs.map((config2) => objectStorage.env_keys.includes(config2.key) ? { ...config2, value: "", value_source: "resource", resource_id: objectStorage.id } : config2));
|
|
56703
56721
|
setOriginalConfigs(originals);
|
|
56704
56722
|
setVersionNote(draft?.versionNote ?? job.versionNote ?? "");
|
|
56723
|
+
setStorageBindings(draft?.storageBindings ?? {});
|
|
56724
|
+
setExistingStorage(detail?.storage_mounts ?? []);
|
|
56705
56725
|
} catch {
|
|
56706
56726
|
const { configs, originals } = mergeJobConfigs(job, null);
|
|
56707
56727
|
setConfigDrafts(configs);
|
|
56708
56728
|
setOriginalConfigs(originals);
|
|
56709
56729
|
setVersionNote(job.versionNote ?? "");
|
|
56730
|
+
setStorageBindings({});
|
|
56731
|
+
setExistingStorage([]);
|
|
56710
56732
|
}
|
|
56711
56733
|
},
|
|
56712
|
-
[api, contextId]
|
|
56734
|
+
[api, contextId, resources]
|
|
56713
56735
|
);
|
|
56714
56736
|
const progressJobId = wizardJob?.id;
|
|
56715
56737
|
const progressStatus = wizardJob?.status;
|
|
@@ -57021,21 +57043,21 @@ function AppsPanel({
|
|
|
57021
57043
|
if (request === sourceSelection.current) setWizardError(readErrorMessage(error62, "\u6253\u5F00\u76EE\u5F55\u9009\u62E9\u5668\u5931\u8D25"));
|
|
57022
57044
|
}
|
|
57023
57045
|
};
|
|
57024
|
-
const saveDraft = (0, import_react8.useCallback)((job, rows, note) => {
|
|
57046
|
+
const saveDraft = (0, import_react8.useCallback)((job, rows, note, storage) => {
|
|
57025
57047
|
if (!api.appSaveConfigDraft || !job.artifactHash) return Promise.resolve();
|
|
57026
|
-
const body = JSON.stringify({ artifactHash: job.artifactHash, rows: sanitizeConfigRowsForApi(rows), versionNote: note });
|
|
57048
|
+
const body = JSON.stringify({ artifactHash: job.artifactHash, rows: sanitizeConfigRowsForApi(rows), versionNote: note, storageBindings: storage });
|
|
57027
57049
|
const request = draftSaveRequest.current.catch(() => {
|
|
57028
57050
|
}).then(() => api.appSaveConfigDraft(job.id, body, contextId));
|
|
57029
57051
|
draftSaveRequest.current = request;
|
|
57030
57052
|
return request;
|
|
57031
57053
|
}, [api, contextId]);
|
|
57032
57054
|
const scheduleDraftSave = (0, import_react8.useCallback)(
|
|
57033
|
-
(job, nextConfigs, nextNote) => {
|
|
57055
|
+
(job, nextConfigs, nextNote, storage) => {
|
|
57034
57056
|
if (!api.appSaveConfigDraft || !job.artifactHash) return;
|
|
57035
57057
|
if (draftSaveTimerRef.current) window.clearTimeout(draftSaveTimerRef.current);
|
|
57036
57058
|
draftSaveTimerRef.current = window.setTimeout(() => {
|
|
57037
57059
|
draftSaveTimerRef.current = null;
|
|
57038
|
-
void saveDraft(job, nextConfigs, nextNote).catch((error62) => {
|
|
57060
|
+
void saveDraft(job, nextConfigs, nextNote, storage).catch((error62) => {
|
|
57039
57061
|
setWizardError(readErrorMessage(error62, "\u914D\u7F6E\u8349\u7A3F\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"));
|
|
57040
57062
|
});
|
|
57041
57063
|
}, 450);
|
|
@@ -57047,7 +57069,7 @@ function AppsPanel({
|
|
|
57047
57069
|
window.clearTimeout(draftSaveTimerRef.current);
|
|
57048
57070
|
draftSaveTimerRef.current = null;
|
|
57049
57071
|
}
|
|
57050
|
-
if (wizardJob?.status === "ready" && wizardStep === 3) await saveDraft(wizardJob, configDrafts, versionNote);
|
|
57072
|
+
if (wizardJob?.status === "ready" && wizardStep === 3) await saveDraft(wizardJob, configDrafts, versionNote, storageBindings);
|
|
57051
57073
|
};
|
|
57052
57074
|
const leaveWizard = async () => {
|
|
57053
57075
|
if (wizardBusy) return;
|
|
@@ -57065,11 +57087,11 @@ function AppsPanel({
|
|
|
57065
57087
|
};
|
|
57066
57088
|
const handleStep3ConfigsChange = (nextConfigs) => {
|
|
57067
57089
|
setConfigDrafts(nextConfigs);
|
|
57068
|
-
if (wizardJob) scheduleDraftSave(wizardJob, nextConfigs, versionNote);
|
|
57090
|
+
if (wizardJob) scheduleDraftSave(wizardJob, nextConfigs, versionNote, storageBindings);
|
|
57069
57091
|
};
|
|
57070
57092
|
const handleStep3NoteChange = (nextNote) => {
|
|
57071
57093
|
setVersionNote(nextNote);
|
|
57072
|
-
if (wizardJob) scheduleDraftSave(wizardJob, configDrafts, nextNote);
|
|
57094
|
+
if (wizardJob) scheduleDraftSave(wizardJob, configDrafts, nextNote, storageBindings);
|
|
57073
57095
|
};
|
|
57074
57096
|
const handleReturnToReview = async () => {
|
|
57075
57097
|
if (!wizardJob) return;
|
|
@@ -57098,6 +57120,11 @@ function AppsPanel({
|
|
|
57098
57120
|
setConfigSubTab("configs");
|
|
57099
57121
|
return;
|
|
57100
57122
|
}
|
|
57123
|
+
if (Object.values(storageSelections).some((id) => !id)) {
|
|
57124
|
+
setWizardError("\u8BF7\u4E3A\u65B0\u589E\u6301\u4E45\u5316\u76EE\u5F55\u9009\u62E9\u5DF2\u542F\u7528\u7684 Platform \u5377\u8D44\u6E90");
|
|
57125
|
+
setConfigSubTab("configs");
|
|
57126
|
+
return;
|
|
57127
|
+
}
|
|
57101
57128
|
if (!wizardJob.artifactHash) {
|
|
57102
57129
|
setWizardError("\u4EA4\u4ED8\u5305\u5C1A\u672A\u51C6\u5907\u5B8C\u6210\uFF0C\u8BF7\u8FD4\u56DE\u65B9\u6848\u6838\u5BF9\u91CD\u65B0\u751F\u6210\u4EA4\u4ED8\u5305");
|
|
57103
57130
|
return;
|
|
@@ -57111,6 +57138,7 @@ function AppsPanel({
|
|
|
57111
57138
|
JSON.stringify({
|
|
57112
57139
|
artifactHash: wizardJob.artifactHash,
|
|
57113
57140
|
config: cleanConfigs,
|
|
57141
|
+
storageBindings: storageSelections,
|
|
57114
57142
|
versionNote: versionNote.trim()
|
|
57115
57143
|
}),
|
|
57116
57144
|
contextId
|
|
@@ -57123,6 +57151,7 @@ function AppsPanel({
|
|
|
57123
57151
|
artifactHash: wizardJob.artifactHash,
|
|
57124
57152
|
confirmationToken,
|
|
57125
57153
|
config: cleanConfigs,
|
|
57154
|
+
storageBindings: storageSelections,
|
|
57126
57155
|
versionNote: versionNote.trim()
|
|
57127
57156
|
}),
|
|
57128
57157
|
contextId
|
|
@@ -57433,7 +57462,7 @@ function AppsPanel({
|
|
|
57433
57462
|
const portNum = Number.parseInt(containerPort, 10);
|
|
57434
57463
|
const slugValid = SLUG_RE.test(toAppSlug(appSlug, { allowTrailingDash: false }));
|
|
57435
57464
|
const canSubmitStep1 = !wizardBusy && appName.trim().length > 0 && slugValid && (Boolean(upgradeTarget) || slugCheck.available !== false) && Number.isInteger(portNum) && portNum >= 1 && portNum <= 65535 && Boolean(zipFile || sourcePath.trim());
|
|
57436
|
-
const missingConfigAlert = wizardJob ? validateConfigsForPublish(configDrafts, wizardJob.port ?? opcConfig.defaultPort) : null;
|
|
57465
|
+
const missingConfigAlert = wizardJob ? validateConfigsForPublish(configDrafts, wizardJob.port ?? opcConfig.defaultPort) || (Object.values(storageSelections).some((id) => !id) ? "\u65B0\u589E\u6301\u4E45\u5316\u76EE\u5F55\u9700\u8981\u5DF2\u542F\u7528\u7684 Platform \u5377\u8D44\u6E90" : null) : null;
|
|
57437
57466
|
return /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-overlay-view" }, /* @__PURE__ */ import_react8.default.createElement("header", { className: "oa-overlay-header oa-wizard-header" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-wizard-heading" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-wizard-identity" }, /* @__PURE__ */ import_react8.default.createElement("span", { className: "oa-wizard-icon" }, /* @__PURE__ */ import_react8.default.createElement(AppIcon, { name: upgrading ? "refresh" : "plus", size: 16 })), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-wizard-title" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-wizard-title-line" }, /* @__PURE__ */ import_react8.default.createElement("h2", null, upgrading ? "\u5347\u7EA7\u5E94\u7528\u5E76\u90E8\u7F72\u65B0\u7248\u672C" : "\u65B0\u5EFA\u5E76\u90E8\u7F72\u5E94\u7528"), (wizardJob?.slug || appSlug) && /* @__PURE__ */ import_react8.default.createElement("span", { className: "oa-code", title: wizardJob?.slug || appSlug }, wizardJob?.slug || appSlug)), /* @__PURE__ */ import_react8.default.createElement("p", null, upgrading ? "\u9009\u62E9\u65B0\u7248\u6E90\u7801\uFF0C\u7531 AI \u68C0\u67E5\u6539\u9020\u65B9\u6848\uFF0C\u518D\u6838\u5BF9\u5E76\u90E8\u7F72\u3002" : "\u9009\u62E9\u5E94\u7528\uFF0CAI \u5B8C\u6210\u6280\u672F\u51C6\u5907\uFF0C\u4F60\u53EA\u9700\u5904\u7406\u5FC5\u8981\u95EE\u9898\u5E76\u786E\u8BA4\u90E8\u7F72\u3002"))), /* @__PURE__ */ import_react8.default.createElement(
|
|
57438
57467
|
"button",
|
|
57439
57468
|
{
|
|
@@ -57646,7 +57675,25 @@ function AppsPanel({
|
|
|
57646
57675
|
placeholder: wizardJob.upgrade ? "\u4F8B\u5982\uFF1A\u65B0\u589E\u5BA1\u6279\u5BFC\u51FA\u63A5\u53E3\u3001\u4FEE\u590D\u73AF\u5883\u53D8\u91CF\u8BFB\u53D6" : "\u4F8B\u5982\uFF1A\u9996\u6B21\u4E0A\u7EBF\u53D1\u5E03",
|
|
57647
57676
|
onChange: (e) => handleStep3NoteChange(e.target.value)
|
|
57648
57677
|
}
|
|
57649
|
-
))), missingConfigAlert ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-alert oa-alert-warn" }, /* @__PURE__ */ import_react8.default.createElement(AppIcon, { name: "warning", size: 16 }), /* @__PURE__ */ import_react8.default.createElement("div", null, missingConfigAlert)) : /* @__PURE__ */ import_react8.default.createElement("div", { role: "status", className: "oa-alert oa-alert-ok" }, /* @__PURE__ */ import_react8.default.createElement(AppIcon, { name: "check", size: 16 }), /* @__PURE__ */ import_react8.default.createElement("div", null, "\u8FD0\u884C\u914D\u7F6E\u4E0E\u4F9D\u8D56\u8D44\u6E90\u5DF2\u6821\u9A8C\u5C31\u7EEA\uFF0C\u53EF\u70B9\u51FB\u53F3\u4E0B\u89D2\u6309\u94AE\u786E\u8BA4\u5E76\u53D1\u5E03\u4E0A\u7EBF\u3002")), configSubTab === "configs" && /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-form-card" }, /* @__PURE__ */ import_react8.default.createElement(
|
|
57678
|
+
))), missingConfigAlert ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-alert oa-alert-warn" }, /* @__PURE__ */ import_react8.default.createElement(AppIcon, { name: "warning", size: 16 }), /* @__PURE__ */ import_react8.default.createElement("div", null, missingConfigAlert)) : /* @__PURE__ */ import_react8.default.createElement("div", { role: "status", className: "oa-alert oa-alert-ok" }, /* @__PURE__ */ import_react8.default.createElement(AppIcon, { name: "check", size: 16 }), /* @__PURE__ */ import_react8.default.createElement("div", null, "\u8FD0\u884C\u914D\u7F6E\u4E0E\u4F9D\u8D56\u8D44\u6E90\u5DF2\u6821\u9A8C\u5C31\u7EEA\uFF0C\u53EF\u70B9\u51FB\u53F3\u4E0B\u89D2\u6309\u94AE\u786E\u8BA4\u5E76\u53D1\u5E03\u4E0A\u7EBF\u3002")), configSubTab === "configs" && /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-form-card" }, volumeMounts.length > 0 && /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard-head" }, "\u6301\u4E45\u5316\u76EE\u5F55\u4E0E\u5B58\u50A8\u8D44\u6E90"), volumeMounts.map((mount) => {
|
|
57679
|
+
const existing = existingStorage.find((old) => old.container_path === mount.container_path);
|
|
57680
|
+
const options = volumeOptions(mount);
|
|
57681
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { key: mount.container_path, className: "oa-hint" }, /* @__PURE__ */ import_react8.default.createElement("label", null, /* @__PURE__ */ import_react8.default.createElement("code", null, mount.container_path), " ", mount.purpose || "", existing ? /* @__PURE__ */ import_react8.default.createElement("span", null, " \xB7 \u590D\u7528 ", existing.storage_location || existing.host_path || existing.volume_name || "\u73B0\u6709\u6302\u8F7D") : /* @__PURE__ */ import_react8.default.createElement(
|
|
57682
|
+
"select",
|
|
57683
|
+
{
|
|
57684
|
+
"aria-label": `\u5B58\u50A8\u8D44\u6E90 ${mount.container_path}`,
|
|
57685
|
+
value: storageSelections[mount.container_path],
|
|
57686
|
+
disabled: wizardBusy || options.length === 0,
|
|
57687
|
+
onChange: (event) => {
|
|
57688
|
+
const next = { ...storageBindings, [mount.container_path]: event.target.value };
|
|
57689
|
+
setStorageBindings(next);
|
|
57690
|
+
scheduleDraftSave(wizardJob, configDrafts, versionNote, next);
|
|
57691
|
+
}
|
|
57692
|
+
},
|
|
57693
|
+
options.length === 0 && /* @__PURE__ */ import_react8.default.createElement("option", { value: "" }, mount.kind === "sqlite" ? "\u7B49\u5F85\u7BA1\u7406\u5458\u914D\u7F6E\u672C\u5730\u78C1\u76D8\u5377" : "\u7B49\u5F85\u7BA1\u7406\u5458\u914D\u7F6E\u5B58\u50A8"),
|
|
57694
|
+
options.map((resource) => /* @__PURE__ */ import_react8.default.createElement("option", { key: resource.id, value: resource.id }, resource.name, " \xB7 ", resource.type === "aliyun-oss-volume" ? "\u963F\u91CC\u4E91 OSS" : "\u672C\u5730\u78C1\u76D8"))
|
|
57695
|
+
)));
|
|
57696
|
+
})), /* @__PURE__ */ import_react8.default.createElement(
|
|
57650
57697
|
AppDeliveryConfig,
|
|
57651
57698
|
{
|
|
57652
57699
|
configs: configDrafts,
|
|
@@ -57888,7 +57935,7 @@ function AppsPanel({
|
|
|
57888
57935
|
}
|
|
57889
57936
|
}
|
|
57890
57937
|
)),
|
|
57891
|
-
detailTab === "storage" && /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-form-card", style: { display: "flex", flexDirection: "column", gap: 14 } }, /* @__PURE__ */ import_react8.default.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", flexWrap: "wrap", gap: 10 } }, /* @__PURE__ */ import_react8.default.createElement("div", null, /* @__PURE__ */ import_react8.default.createElement("strong", { style: { fontSize: 14, color: "#0f172a" } }, "\u6301\u4E45\u5316\u6570\u636E\u5377\u4E0E\u6587\u4EF6\u5907\u4EFD"), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u5E94\u7528\u6570\u636E\u5E93\u3001\u4E0A\u4F20\u9644\u4EF6\u53CA\u4E1A\u52A1\u6301\u4E45\u5316\u76EE\u5F55\u5C06\u5728\u7248\u672C\u5347\u7EA7\u4E0E\u91CD\u542F\u65F6\u4FDD\u7559\u3002")), storageOverview && storageOverview.mounts_count > 0 && /* @__PURE__ */ import_react8.default.createElement(
|
|
57938
|
+
detailTab === "storage" && /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-form-card", style: { display: "flex", flexDirection: "column", gap: 14 } }, /* @__PURE__ */ import_react8.default.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", flexWrap: "wrap", gap: 10 } }, /* @__PURE__ */ import_react8.default.createElement("div", null, /* @__PURE__ */ import_react8.default.createElement("strong", { style: { fontSize: 14, color: "#0f172a" } }, "\u6301\u4E45\u5316\u6570\u636E\u5377\u4E0E\u6587\u4EF6\u5907\u4EFD"), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u5E94\u7528\u6570\u636E\u5E93\u3001\u4E0A\u4F20\u9644\u4EF6\u53CA\u4E1A\u52A1\u6301\u4E45\u5316\u76EE\u5F55\u5C06\u5728\u7248\u672C\u5347\u7EA7\u4E0E\u91CD\u542F\u65F6\u4FDD\u7559\u3002")), storageOverview && storageOverview.source !== "swarm" && storageOverview.mounts_count > 0 && /* @__PURE__ */ import_react8.default.createElement(
|
|
57892
57939
|
"button",
|
|
57893
57940
|
{
|
|
57894
57941
|
type: "button",
|
|
@@ -57897,7 +57944,7 @@ function AppsPanel({
|
|
|
57897
57944
|
},
|
|
57898
57945
|
/* @__PURE__ */ import_react8.default.createElement(AppIcon, { name: "archive", size: 13 }),
|
|
57899
57946
|
/* @__PURE__ */ import_react8.default.createElement("span", null, "\u4E0B\u8F7D\u5168\u90E8\u5B58\u50A8\u5907\u4EFD")
|
|
57900
|
-
)), !storageOverview ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-alert oa-alert-info" }, "\u6682\u65E0\u6301\u4E45\u5316\u5B58\u50A8\u7EDF\u8BA1\u4FE1\u606F\u3002") : /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-grid-3" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u6302\u8F7D\u5377\u6570\u91CF"), /* @__PURE__ */ import_react8.default.createElement("div", { style: { fontSize: 20, fontWeight: 700, color: "#0f172a", marginTop: 4 } }, storageOverview.mounts_count)), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u5B58\u50A8\u6587\u4EF6\u603B\u6570"), /* @__PURE__ */ import_react8.default.createElement("div", { style: { fontSize: 20, fontWeight: 700, color: "#0f172a", marginTop: 4 } }, storageOverview.total_files)), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u5DF2\u5360\u7528\u7A7A\u95F4"), /* @__PURE__ */ import_react8.default.createElement("div", { style: { fontSize: 20, fontWeight: 700, color: "#0f172a", marginTop: 4 } }, storageOverview.total_human))), storageOverview.mounts.length === 0 ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u6B64\u5E94\u7528\
|
|
57947
|
+
)), !storageOverview ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-alert oa-alert-info" }, "\u6682\u65E0\u6301\u4E45\u5316\u5B58\u50A8\u7EDF\u8BA1\u4FE1\u606F\u3002") : /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, storageOverview.object_storage && /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard" }, /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u5BF9\u8C61\u5B58\u50A8"), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u8D44\u6E90 ", storageOverview.object_storage.resource_id, " \xB7 Bucket ", /* @__PURE__ */ import_react8.default.createElement("code", null, storageOverview.object_storage.bucket))), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-grid-3" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u6302\u8F7D\u5377\u6570\u91CF"), /* @__PURE__ */ import_react8.default.createElement("div", { style: { fontSize: 20, fontWeight: 700, color: "#0f172a", marginTop: 4 } }, storageOverview.mounts_count)), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u5B58\u50A8\u6587\u4EF6\u603B\u6570"), /* @__PURE__ */ import_react8.default.createElement("div", { style: { fontSize: 20, fontWeight: 700, color: "#0f172a", marginTop: 4 } }, storageOverview.source === "swarm" ? "\u2014" : storageOverview.total_files)), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u5DF2\u5360\u7528\u7A7A\u95F4"), /* @__PURE__ */ import_react8.default.createElement("div", { style: { fontSize: 20, fontWeight: 700, color: "#0f172a", marginTop: 4 } }, storageOverview.total_human))), storageOverview.mounts.length === 0 ? /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u6B64\u5E94\u7528\u6CA1\u6709\u76EE\u5F55\u6302\u8F7D\u3002") : /* @__PURE__ */ import_react8.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 10 } }, storageOverview.mounts.map((m) => /* @__PURE__ */ import_react8.default.createElement("div", { key: m.name, className: "oa-subcard" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard-head" }, /* @__PURE__ */ import_react8.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" } }, /* @__PURE__ */ import_react8.default.createElement("strong", { style: { color: "#0f172a" } }, m.name), /* @__PURE__ */ import_react8.default.createElement("span", { className: "oa-code" }, m.container_path), m.seed_protected && /* @__PURE__ */ import_react8.default.createElement("span", { className: "oa-pill oa-pill-ok" }, "\u521D\u59CB\u79CD\u5B50\u53D7\u4FDD\u62A4"), m.status && /* @__PURE__ */ import_react8.default.createElement("span", { className: "oa-pill" }, m.status)), storageOverview.source !== "swarm" && /* @__PURE__ */ import_react8.default.createElement(
|
|
57901
57948
|
"button",
|
|
57902
57949
|
{
|
|
57903
57950
|
type: "button",
|
|
@@ -57905,7 +57952,7 @@ function AppsPanel({
|
|
|
57905
57952
|
onClick: () => void handleDownloadPlatformArtifact(detailApp.slug, { storage: true, mount: m.name }, `\u5377 ${m.name} \u5907\u4EFD`)
|
|
57906
57953
|
},
|
|
57907
57954
|
"\u4E0B\u8F7D\u6B64\u5377\u5907\u4EFD"
|
|
57908
|
-
)), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u5927\u5C0F\uFF1A", m.size_human ?? formatFileSize(m.size_bytes), " \xB7 \u6587\u4EF6\u6570\uFF1A
|
|
57955
|
+
)), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-hint" }, "\u5927\u5C0F\uFF1A", m.size_human ?? formatFileSize(m.size_bytes), storageOverview.source === "swarm" ? "" : ` \xB7 \u6587\u4EF6\u6570\uFF1A${m.file_count ?? 0}`, m.resource_id ? ` \xB7 \u8D44\u6E90\uFF1A${m.resource_id}` : "", m.storage_location ? ` \xB7 OSS\uFF1A${m.storage_location}` : m.host_path ? ` \xB7 \u8DEF\u5F84\uFF1A${m.host_path}` : m.volume_name ? ` \xB7 \u5377\uFF1A${m.volume_name}` : "", m.purpose ? ` \xB7 \u7528\u9014\uFF1A${m.purpose}` : ""), m.sample_files && m.sample_files.length > 0 && /* @__PURE__ */ import_react8.default.createElement("div", { style: { marginTop: 6, display: "flex", flexWrap: "wrap", gap: 6 } }, m.sample_files.slice(0, 6).map((sf) => /* @__PURE__ */ import_react8.default.createElement("span", { key: sf, className: "oa-code" }, sf)))))))),
|
|
57909
57956
|
detailTab === "versions" && /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-form-card", style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard-head", style: { marginBottom: 0 } }, /* @__PURE__ */ import_react8.default.createElement("span", null, "\u4EA4\u4ED8\u7248\u672C\u4E0E\u5236\u54C1\u5F52\u6863"), /* @__PURE__ */ import_react8.default.createElement("span", { className: "oa-hint" }, "\u652F\u6301\u4E0B\u8F7D\u4EFB\u610F\u7248\u672C\u955C\u50CF\u6E90\u7801\u5305\u3001\u6280\u80FD\u5305\u6216\u6267\u884C\u7248\u672C\u56DE\u6EDA")), rollbackTarget && /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-subcard", style: { borderColor: "#fde68a", background: "#fffbeb" } }, /* @__PURE__ */ import_react8.default.createElement("div", { style: { fontWeight: 650, color: "#92400e", marginBottom: 6 } }, "\u786E\u8BA4\u56DE\u6EDA\u5230\u5386\u53F2\u7248\u672C v", rollbackTarget.version, "\uFF1F"), /* @__PURE__ */ import_react8.default.createElement("p", { className: "oa-hint", style: { color: "#92400e", marginBottom: 10 } }, ROLLBACK_NOTICE), /* @__PURE__ */ import_react8.default.createElement("div", { className: "oa-field", style: { marginBottom: 10 } }, /* @__PURE__ */ import_react8.default.createElement("label", { className: "oa-label", htmlFor: `${formId}-rollback-reason` }, "\u56DE\u6EDA\u539F\u56E0\u8BF4\u660E\uFF08\u53EF\u9009\uFF09"), /* @__PURE__ */ import_react8.default.createElement(
|
|
57910
57957
|
"input",
|
|
57911
57958
|
{
|
package/lib/index.js
CHANGED
|
@@ -2658,6 +2658,7 @@ ${trimmedFeedback}` : trimmedFeedback || prevFailure).slice(-24e3);
|
|
|
2658
2658
|
job.configDraft = {
|
|
2659
2659
|
artifactHash: input.artifactHash,
|
|
2660
2660
|
rows: rows.map((row) => ({ key: row.key, resource_id: row.resource_id, local_connection_confirmed: row.local_connection_confirmed === true })),
|
|
2661
|
+
storageBindings: readStorageBindings(input.storageBindings),
|
|
2661
2662
|
versionNote: typeof input.versionNote === "string" ? input.versionNote.slice(0, 1024) : ""
|
|
2662
2663
|
};
|
|
2663
2664
|
job.confirmationToken = void 0;
|
|
@@ -2850,8 +2851,30 @@ ${trimmedFeedback}` : trimmedFeedback || prevFailure).slice(-24e3);
|
|
|
2850
2851
|
if (!c.resource_id && !c.value && origValues[c.key]) return { ...c, value: origValues[c.key], value_source: "original" };
|
|
2851
2852
|
return { ...c, value_source: c.resource_id ? "resource" : "manual" };
|
|
2852
2853
|
});
|
|
2854
|
+
const storageBindings = readStorageBindings(input.storageBindings);
|
|
2855
|
+
const declaredMounts = job.proposal.contract.storage_mounts ?? [];
|
|
2856
|
+
if (Object.keys(storageBindings).some((path) => !declaredMounts.some((mount) => mount.container_path === path))) {
|
|
2857
|
+
throw new Error("\u5B58\u50A8\u9009\u62E9\u5FC5\u987B\u5BF9\u5E94\u5DF2\u786E\u8BA4\u7684\u6301\u4E45\u5316\u76EE\u5F55");
|
|
2858
|
+
}
|
|
2859
|
+
if (input.storageBindings !== void 0 && declaredMounts.some((mount) => !storageBindings[mount.container_path])) {
|
|
2860
|
+
const existing = job.upgrade ? (await this.platform("/" + job.slug, expected)).storage_mounts ?? [] : [];
|
|
2861
|
+
if (declaredMounts.some((mount) => !storageBindings[mount.container_path] && !existing.some((old) => old.container_path === mount.container_path))) {
|
|
2862
|
+
throw new Error("\u8BF7\u4E3A\u65B0\u589E\u6301\u4E45\u5316\u76EE\u5F55\u9009\u62E9 Platform \u5377\u8D44\u6E90");
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2853
2865
|
const ids = [...new Set(configs.flatMap((c) => c.resource_id ? [c.resource_id] : []))].sort();
|
|
2854
|
-
const available = ids.length ? (await this.platform("/resources", expected)).resources ?? [] : [];
|
|
2866
|
+
const available = ids.length || Object.keys(storageBindings).length ? (await this.platform("/resources", expected)).resources ?? [] : [];
|
|
2867
|
+
for (const [path, id] of Object.entries(storageBindings)) {
|
|
2868
|
+
const resource = available.find((resource2) => resource2.id === id && ["local-directory", "aliyun-oss-volume", "docker-volume"].includes(resource2.type));
|
|
2869
|
+
if (!resource) throw new Error(`\u6301\u4E45\u5316\u76EE\u5F55\u7684\u5B58\u50A8\u8D44\u6E90\u4E0D\u53EF\u7528\uFF1A${path}`);
|
|
2870
|
+
if (resource.type === "aliyun-oss-volume" && declaredMounts.find((mount) => mount.container_path === path)?.kind === "sqlite") {
|
|
2871
|
+
throw new Error(`SQLite \u76EE\u5F55\u5FC5\u987B\u4F7F\u7528\u672C\u5730\u78C1\u76D8\u5377\uFF1A${path}`);
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
const storageMounts = declaredMounts.map((mount) => {
|
|
2875
|
+
const { resource_id: _resource, storage_node_id: _node, ...declaration } = mount;
|
|
2876
|
+
return { ...declaration, resource_id: storageBindings[mount.container_path] };
|
|
2877
|
+
});
|
|
2855
2878
|
for (const item of configs) {
|
|
2856
2879
|
if (item.resource_id && (item.value || !available.some((r) => r.id === item.resource_id && r.env_keys?.includes(item.key)))) {
|
|
2857
2880
|
throw new Error(`\u914D\u7F6E\u9879\u7684\u8D44\u6E90\u9009\u62E9\u65E0\u6548\uFF1A${item.key}`);
|
|
@@ -2877,8 +2900,8 @@ ${trimmedFeedback}` : trimmedFeedback || prevFailure).slice(-24e3);
|
|
|
2877
2900
|
}));
|
|
2878
2901
|
const note = input.versionNote ?? input.version_note;
|
|
2879
2902
|
const versionNote = typeof note === "string" && note.trim() ? note.trim() : job.versionNote ?? "";
|
|
2880
|
-
const digest = fingerprint({ hashes: job.hashes, url: job.url, port: job.port, bindings, ids, versionNote });
|
|
2881
|
-
return { bindings, configs, ids, versionNote, digest };
|
|
2903
|
+
const digest = fingerprint({ hashes: job.hashes, url: job.url, port: job.port, bindings, ids, storageMounts, versionNote });
|
|
2904
|
+
return { bindings, configs, ids, storageMounts, versionNote, digest };
|
|
2882
2905
|
}
|
|
2883
2906
|
async confirmDeployment(id, input, expected) {
|
|
2884
2907
|
const scope = this.scope(expected);
|
|
@@ -2905,7 +2928,7 @@ ${trimmedFeedback}` : trimmedFeedback || prevFailure).slice(-24e3);
|
|
|
2905
2928
|
if (job.status !== "ready" || input.artifactHash !== fingerprint(job.hashes) || !job.proposal || !job.revision) throw new Error("\u4EA4\u4ED8\u5305\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u6838\u5BF9");
|
|
2906
2929
|
if (job.proposal.contract.runtime?.port !== (job.port ?? 8080)) throw new Error("\u4EA4\u4ED8\u5305\u7AEF\u53E3\u4E0E\u5DF2\u786E\u8BA4\u7AEF\u53E3\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u5206\u6790\u5E76\u6253\u5305");
|
|
2907
2930
|
await worker({ action: "validate_credential_references", root, contract: job.proposal.contract }, scope.signal);
|
|
2908
|
-
const { bindings, configs, ids, versionNote, digest } = await this.deploymentConfiguration(job, input, expected);
|
|
2931
|
+
const { bindings, configs, ids, storageMounts, versionNote, digest } = await this.deploymentConfiguration(job, input, expected);
|
|
2909
2932
|
if (!job.confirmationToken || input.confirmationToken !== job.confirmationToken || (await this.credentials.read(`confirm-${id}`)).digest !== digest) {
|
|
2910
2933
|
throw new Error("\u4EA4\u4ED8\u5305\u3001\u914D\u7F6E\u6216\u8D44\u6E90\u4E0E\u6700\u7EC8\u786E\u8BA4\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u786E\u8BA4");
|
|
2911
2934
|
}
|
|
@@ -2938,7 +2961,7 @@ ${trimmedFeedback}` : trimmedFeedback || prevFailure).slice(-24e3);
|
|
|
2938
2961
|
version_note: versionNote,
|
|
2939
2962
|
app_config: JSON.stringify(bindings),
|
|
2940
2963
|
resource_ids: JSON.stringify(ids),
|
|
2941
|
-
storage_mounts: JSON.stringify(
|
|
2964
|
+
storage_mounts: JSON.stringify(storageMounts)
|
|
2942
2965
|
})) form.append(key, String(value));
|
|
2943
2966
|
scope.assertCurrent();
|
|
2944
2967
|
await this.credentials.write(`publish-config-${requestId}`, { rows: JSON.stringify(configs) });
|
|
@@ -3526,6 +3549,15 @@ ${JSON.stringify({ params, body })}`);
|
|
|
3526
3549
|
});
|
|
3527
3550
|
}
|
|
3528
3551
|
};
|
|
3552
|
+
function readStorageBindings(input) {
|
|
3553
|
+
if (input === void 0) return {};
|
|
3554
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) throw new Error("\u5B58\u50A8\u914D\u7F6E\u683C\u5F0F\u65E0\u6548");
|
|
3555
|
+
const entries = Object.entries(input);
|
|
3556
|
+
if (entries.some(([path, id]) => !path.startsWith("/") || typeof id !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,63}$/.test(id))) {
|
|
3557
|
+
throw new Error("\u5B58\u50A8\u914D\u7F6E\u683C\u5F0F\u65E0\u6548");
|
|
3558
|
+
}
|
|
3559
|
+
return Object.fromEntries(entries);
|
|
3560
|
+
}
|
|
3529
3561
|
|
|
3530
3562
|
// src/host/app-agent.ts
|
|
3531
3563
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
package/package.json
CHANGED
|
@@ -123,6 +123,7 @@ def inspect_local_file_storage(
|
|
|
123
123
|
dir_seed_files: dict[str, list[str]] = {}
|
|
124
124
|
dir_has_code: set[str] = set()
|
|
125
125
|
code_referenced_dirs: set[str] = set()
|
|
126
|
+
sqlite_dirs: set[str] = set()
|
|
126
127
|
|
|
127
128
|
for p in sorted(source.rglob("*")):
|
|
128
129
|
if p.is_symlink():
|
|
@@ -189,6 +190,7 @@ def inspect_local_file_storage(
|
|
|
189
190
|
if any(p.suffix.lower() in _SOURCE_CODE_EXTENSIONS for p in parent.rglob("*") if p.is_file()):
|
|
190
191
|
continue
|
|
191
192
|
rel_dir = parent.relative_to(source).as_posix()
|
|
193
|
+
sqlite_dirs.add(rel_dir)
|
|
192
194
|
dir_seed_files.setdefault(rel_dir, []).extend(p.relative_to(source).as_posix() for p in parent.rglob("*") if p.is_file() and not p.is_symlink())
|
|
193
195
|
|
|
194
196
|
for d in sorted(code_referenced_dirs):
|
|
@@ -223,7 +225,7 @@ def inspect_local_file_storage(
|
|
|
223
225
|
"relative_path": rel_dir,
|
|
224
226
|
"container_path": container_path,
|
|
225
227
|
"purpose": purpose,
|
|
226
|
-
"kind": meta["kind"],
|
|
228
|
+
"kind": "sqlite" if any(d == rel_dir or d.startswith(rel_dir + "/") for d in sqlite_dirs) else meta["kind"],
|
|
227
229
|
"volume_name": f"opc-vol-{clean_slug}-{vol_suffix}",
|
|
228
230
|
"storage_backend": "docker_volume",
|
|
229
231
|
"seed_files_count": len(seeds),
|