dsh-workbench-vault 0.3.11 → 0.3.12
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 +403 -97
- package/lib/domain/actions.js +21 -21
- package/lib/index.js +1 -1
- package/package.json +3 -3
package/lib/client.js
CHANGED
|
@@ -1111,6 +1111,255 @@ var require_styles = __commonJS({
|
|
|
1111
1111
|
}
|
|
1112
1112
|
});
|
|
1113
1113
|
|
|
1114
|
+
// packages/addons/lib/switch.cjs
|
|
1115
|
+
var require_switch = __commonJS({
|
|
1116
|
+
"packages/addons/lib/switch.cjs"(exports2, module2) {
|
|
1117
|
+
"use strict";
|
|
1118
|
+
var SWITCH_STYLES = [
|
|
1119
|
+
".wbctl-switch{display:inline-flex;align-items:center;gap:7px;min-height:24px;padding:2px;border:0;background:transparent;font:inherit;font-size:12px;color:var(--wb-muted,#6b7280);cursor:pointer;user-select:none;border-radius:999px}",
|
|
1120
|
+
".wbctl-switch-track{position:relative;display:inline-flex;align-items:center;box-sizing:border-box;width:34px;height:20px;padding:2px;border-radius:999px;background:color-mix(in oklab,currentColor 22%,transparent);transition:background .16s ease;flex:none}",
|
|
1121
|
+
".wbctl-switch-knob{display:block;width:16px;height:16px;border-radius:50%;background:var(--wb-card,#fff);box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .16s ease}",
|
|
1122
|
+
".wbctl-switch[aria-checked=true]{color:var(--wb-accent,#2563eb)}",
|
|
1123
|
+
".wbctl-switch[aria-checked=true] .wbctl-switch-track{background:var(--wb-accent,#2563eb)}",
|
|
1124
|
+
".wbctl-switch[aria-checked=true] .wbctl-switch-knob{transform:translateX(14px)}",
|
|
1125
|
+
".wbctl-switch:hover:not(:disabled) .wbctl-switch-track{outline:1px solid var(--wb-accent,#2563eb)}",
|
|
1126
|
+
".wbctl-switch:focus-visible{outline:2px solid var(--wb-accent,#2563eb);outline-offset:2px}",
|
|
1127
|
+
".wbctl-switch:disabled{opacity:.45;cursor:not-allowed}",
|
|
1128
|
+
".wbctl-switch-text{white-space:nowrap}",
|
|
1129
|
+
"@media (prefers-reduced-motion:reduce){.wbctl-switch-track,.wbctl-switch-knob{transition:none}}"
|
|
1130
|
+
];
|
|
1131
|
+
function Switch(props) {
|
|
1132
|
+
var h = props.h;
|
|
1133
|
+
var on = props.checked === true || props.checked === "true";
|
|
1134
|
+
var disabled = !!props.disabled;
|
|
1135
|
+
var text = props.label;
|
|
1136
|
+
if (props.showState) text = on ? props.onText || "\u5F00" : props.offText || "\u5173";
|
|
1137
|
+
return h(
|
|
1138
|
+
"button",
|
|
1139
|
+
{
|
|
1140
|
+
type: "button",
|
|
1141
|
+
role: "switch",
|
|
1142
|
+
"aria-checked": on ? "true" : "false",
|
|
1143
|
+
className: "wbctl-switch" + (props.className ? " " + props.className : ""),
|
|
1144
|
+
disabled,
|
|
1145
|
+
title: props.title,
|
|
1146
|
+
"aria-label": text ? void 0 : props.ariaLabel,
|
|
1147
|
+
onClick: function(e) {
|
|
1148
|
+
e.preventDefault();
|
|
1149
|
+
if (disabled) return;
|
|
1150
|
+
if (typeof props.onChange === "function") props.onChange(!on);
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
h(
|
|
1154
|
+
"span",
|
|
1155
|
+
{ className: "wbctl-switch-track", "aria-hidden": "true" },
|
|
1156
|
+
h("span", { className: "wbctl-switch-knob" })
|
|
1157
|
+
),
|
|
1158
|
+
text ? h("span", { className: "wbctl-switch-text" }, text) : null
|
|
1159
|
+
);
|
|
1160
|
+
}
|
|
1161
|
+
module2.exports = { Switch, styles: SWITCH_STYLES };
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
|
|
1165
|
+
// packages/addons/lib/number-field.cjs
|
|
1166
|
+
var require_number_field = __commonJS({
|
|
1167
|
+
"packages/addons/lib/number-field.cjs"(exports2, module2) {
|
|
1168
|
+
"use strict";
|
|
1169
|
+
var React = require("react");
|
|
1170
|
+
var NUM = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/;
|
|
1171
|
+
var TEXT = {
|
|
1172
|
+
zh: {
|
|
1173
|
+
required: "\u8BF7\u586B\u5199\u6570\u5B57",
|
|
1174
|
+
invalid: "\u8BF7\u8F93\u5165\u6570\u5B57",
|
|
1175
|
+
integer: "\u9700\u8981\u662F\u6574\u6570",
|
|
1176
|
+
min: "\u4E0D\u80FD\u5C0F\u4E8E {min}",
|
|
1177
|
+
max: "\u4E0D\u80FD\u5927\u4E8E {max}",
|
|
1178
|
+
range: "\u9700\u8981\u5728 {min}\u2013{max} \u4E4B\u95F4",
|
|
1179
|
+
step: "\u9700\u8981\u662F {step} \u7684\u500D\u6570",
|
|
1180
|
+
unit: "\u5355\u4F4D"
|
|
1181
|
+
},
|
|
1182
|
+
en: {
|
|
1183
|
+
required: "Please enter a number",
|
|
1184
|
+
invalid: "Please enter a number",
|
|
1185
|
+
integer: "Must be a whole number",
|
|
1186
|
+
min: "Must be at least {min}",
|
|
1187
|
+
max: "Must be at most {max}",
|
|
1188
|
+
range: "Must be between {min} and {max}",
|
|
1189
|
+
step: "Must be a multiple of {step}",
|
|
1190
|
+
unit: "unit"
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
function messages(lang) {
|
|
1194
|
+
return lang === "en" ? TEXT.en : TEXT.zh;
|
|
1195
|
+
}
|
|
1196
|
+
function fill(text, vars) {
|
|
1197
|
+
return String(text).replace(/\{(\w+)\}/g, function(m, key) {
|
|
1198
|
+
return vars && vars[key] !== void 0 ? String(vars[key]) : m;
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
function validateNumber(raw, opts) {
|
|
1202
|
+
var o = opts || {};
|
|
1203
|
+
var M = messages(o.lang);
|
|
1204
|
+
var text = raw === null || raw === void 0 ? "" : String(raw).trim();
|
|
1205
|
+
if (text === "") {
|
|
1206
|
+
return o.allowEmpty ? { ok: true, value: null, error: "" } : { ok: false, value: null, error: M.required };
|
|
1207
|
+
}
|
|
1208
|
+
if (!NUM.test(text)) return { ok: false, value: null, error: M.invalid };
|
|
1209
|
+
var n = Number(text);
|
|
1210
|
+
if (!isFinite(n)) return { ok: false, value: null, error: M.invalid };
|
|
1211
|
+
if (o.integer && Math.round(n) !== n) return { ok: false, value: null, error: M.integer };
|
|
1212
|
+
var hasMin = o.min !== void 0 && o.min !== null && o.min !== "";
|
|
1213
|
+
var hasMax = o.max !== void 0 && o.max !== null && o.max !== "";
|
|
1214
|
+
if (hasMin && hasMax && n >= o.min && n <= o.max) {
|
|
1215
|
+
} else if (hasMin && hasMax) {
|
|
1216
|
+
return { ok: false, value: null, error: fill(M.range, { min: o.min, max: o.max }) };
|
|
1217
|
+
} else if (hasMin && n < o.min) {
|
|
1218
|
+
return { ok: false, value: null, error: fill(M.min, { min: o.min }) };
|
|
1219
|
+
} else if (hasMax && n > o.max) {
|
|
1220
|
+
return { ok: false, value: null, error: fill(M.max, { max: o.max }) };
|
|
1221
|
+
}
|
|
1222
|
+
if (o.step && Number(o.step) > 0) {
|
|
1223
|
+
var q = n / Number(o.step);
|
|
1224
|
+
if (Math.abs(q - Math.round(q)) > 1e-9) {
|
|
1225
|
+
return { ok: false, value: null, error: fill(M.step, { step: o.step }) };
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
return { ok: true, value: n, error: "" };
|
|
1229
|
+
}
|
|
1230
|
+
function rangeHint(opts, lang) {
|
|
1231
|
+
var o = opts || {};
|
|
1232
|
+
var M = messages(lang);
|
|
1233
|
+
var en = lang === "en";
|
|
1234
|
+
var hasMin = o.min !== void 0 && o.min !== null && o.min !== "";
|
|
1235
|
+
var hasMax = o.max !== void 0 && o.max !== null && o.max !== "";
|
|
1236
|
+
var parts = [];
|
|
1237
|
+
if (hasMin && hasMax) parts.push(String(o.min) + "\u2013" + String(o.max));
|
|
1238
|
+
else if (hasMin) parts.push((en ? "\u2265 " : "\u2265 ") + String(o.min));
|
|
1239
|
+
else if (hasMax) parts.push((en ? "\u2264 " : "\u2264 ") + String(o.max));
|
|
1240
|
+
if (o.integer) parts.push(en ? "whole numbers" : "\u6574\u6570");
|
|
1241
|
+
else if (o.step && Number(o.step) > 0) parts.push((en ? "step " : "\u6B65\u957F ") + String(o.step));
|
|
1242
|
+
return parts.join(en ? ", " : "\uFF0C");
|
|
1243
|
+
}
|
|
1244
|
+
function NumberField(props) {
|
|
1245
|
+
var h = props.h || React.createElement;
|
|
1246
|
+
var lang = props.lang;
|
|
1247
|
+
var M = messages(lang);
|
|
1248
|
+
var text = props.value === null || props.value === void 0 ? "" : String(props.value);
|
|
1249
|
+
var draftS = React.useState(text);
|
|
1250
|
+
var draft = draftS[0];
|
|
1251
|
+
var setDraft = draftS[1];
|
|
1252
|
+
var focusS = React.useState(false);
|
|
1253
|
+
var focused = focusS[0];
|
|
1254
|
+
var setFocused = focusS[1];
|
|
1255
|
+
var errS = React.useState("");
|
|
1256
|
+
var err = errS[0];
|
|
1257
|
+
var setErr = errS[1];
|
|
1258
|
+
var lastRef = React.useRef(text);
|
|
1259
|
+
var skipBlurRef = React.useRef(false);
|
|
1260
|
+
React.useEffect(
|
|
1261
|
+
function() {
|
|
1262
|
+
if (focused) return;
|
|
1263
|
+
if (lastRef.current === text) return;
|
|
1264
|
+
lastRef.current = text;
|
|
1265
|
+
setDraft(text);
|
|
1266
|
+
setErr("");
|
|
1267
|
+
},
|
|
1268
|
+
[text, focused]
|
|
1269
|
+
);
|
|
1270
|
+
function commit(raw) {
|
|
1271
|
+
var r = validateNumber(raw, props);
|
|
1272
|
+
if (!r.ok) {
|
|
1273
|
+
setErr(r.error);
|
|
1274
|
+
if (typeof props.onValidChange === "function") props.onValidChange(false, r.error);
|
|
1275
|
+
return false;
|
|
1276
|
+
}
|
|
1277
|
+
setErr("");
|
|
1278
|
+
if (typeof props.onValidChange === "function") props.onValidChange(true, "");
|
|
1279
|
+
var cur = props.value === null || props.value === void 0 ? null : Number(props.value);
|
|
1280
|
+
if (r.value !== cur) {
|
|
1281
|
+
lastRef.current = r.value === null ? "" : String(r.value);
|
|
1282
|
+
if (typeof props.onCommit === "function") props.onCommit(r.value);
|
|
1283
|
+
}
|
|
1284
|
+
return true;
|
|
1285
|
+
}
|
|
1286
|
+
var hint = props.hint !== void 0 ? props.hint : rangeHint(props, lang);
|
|
1287
|
+
var shown = props.hint === false ? "" : hint;
|
|
1288
|
+
return h(
|
|
1289
|
+
"span",
|
|
1290
|
+
{ className: "wbctl-num" + (props.wide ? " is-wide" : "") + (props.className ? " " + props.className : "") },
|
|
1291
|
+
h(
|
|
1292
|
+
"span",
|
|
1293
|
+
{ className: "wbctl-num-box" },
|
|
1294
|
+
h("input", {
|
|
1295
|
+
className: "wbctl-num-input" + (err ? " is-invalid" : ""),
|
|
1296
|
+
type: "text",
|
|
1297
|
+
inputMode: props.integer || Number(props.step) === 1 ? "numeric" : "decimal",
|
|
1298
|
+
value: draft,
|
|
1299
|
+
disabled: !!props.disabled,
|
|
1300
|
+
placeholder: props.placeholder,
|
|
1301
|
+
title: props.title,
|
|
1302
|
+
"aria-label": props.ariaLabel,
|
|
1303
|
+
"aria-invalid": err ? "true" : void 0,
|
|
1304
|
+
onFocus: function() {
|
|
1305
|
+
setFocused(true);
|
|
1306
|
+
},
|
|
1307
|
+
onChange: function(e) {
|
|
1308
|
+
setDraft(e.target.value);
|
|
1309
|
+
if (err) setErr("");
|
|
1310
|
+
if (typeof props.onDraft === "function") props.onDraft(e.target.value);
|
|
1311
|
+
},
|
|
1312
|
+
onBlur: function() {
|
|
1313
|
+
setFocused(false);
|
|
1314
|
+
if (skipBlurRef.current) {
|
|
1315
|
+
skipBlurRef.current = false;
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
commit(draft);
|
|
1319
|
+
},
|
|
1320
|
+
onKeyDown: function(e) {
|
|
1321
|
+
if (e.key === "Enter") {
|
|
1322
|
+
e.preventDefault();
|
|
1323
|
+
if (e.target && e.target.blur) e.target.blur();
|
|
1324
|
+
} else if (e.key === "Escape") {
|
|
1325
|
+
e.preventDefault();
|
|
1326
|
+
skipBlurRef.current = true;
|
|
1327
|
+
setDraft(text);
|
|
1328
|
+
setErr("");
|
|
1329
|
+
if (e.target && e.target.blur) e.target.blur();
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
}),
|
|
1333
|
+
props.unit ? h("span", { className: "wbctl-num-unit" }, props.unit) : null
|
|
1334
|
+
),
|
|
1335
|
+
err ? h("span", { className: "wbctl-num-err", role: "alert" }, err) : shown ? h("span", { className: "wbctl-num-hint" }, shown) : null
|
|
1336
|
+
);
|
|
1337
|
+
}
|
|
1338
|
+
var NUMBER_STYLES = [
|
|
1339
|
+
".wbctl-num{display:inline-flex;flex-direction:column;gap:3px;min-width:0;max-width:100%}",
|
|
1340
|
+
".wbctl-num.is-wide{display:flex;width:100%}",
|
|
1341
|
+
".wbctl-num-box{display:inline-flex;align-items:center;gap:6px;min-width:0}",
|
|
1342
|
+
".wbctl-num-input{box-sizing:border-box;width:96px;min-width:0;padding:6px 9px;border:1px solid var(--wb-line,rgba(127,127,127,.35));border-radius:6px;background:var(--wb-surface,var(--wb-card,transparent));color:inherit;font:inherit;font-size:13px;font-variant-numeric:tabular-nums;transition:border-color .14s ease,outline-color .14s ease}",
|
|
1343
|
+
".wbctl-num-input:hover:not(:disabled){border-color:var(--wb-border,var(--wb-line))}",
|
|
1344
|
+
".wbctl-num-input:focus{outline:2px solid color-mix(in oklab,var(--wb-accent,#2563eb) 55%,transparent);outline-offset:1px;border-color:var(--wb-accent,#2563eb)}",
|
|
1345
|
+
".wbctl-num-input.is-invalid{border-color:var(--wb-danger,#dc2626)}",
|
|
1346
|
+
".wbctl-num-input.is-invalid:focus{outline-color:color-mix(in oklab,var(--wb-danger,#dc2626) 55%,transparent)}",
|
|
1347
|
+
".wbctl-num-input:disabled{opacity:.5;cursor:not-allowed}",
|
|
1348
|
+
".wbctl-num-unit{color:var(--wb-muted,inherit);font-size:12px;white-space:nowrap}",
|
|
1349
|
+
".wbctl-num-hint{color:var(--wb-muted,inherit);font-size:11px;line-height:1.4}",
|
|
1350
|
+
".wbctl-num-err{color:var(--wb-danger,#dc2626);font-size:11px;line-height:1.4}",
|
|
1351
|
+
"@media (prefers-reduced-motion:reduce){.wbctl-num-input{transition:none}}"
|
|
1352
|
+
];
|
|
1353
|
+
module2.exports = {
|
|
1354
|
+
NumberField,
|
|
1355
|
+
validateNumber,
|
|
1356
|
+
rangeHint,
|
|
1357
|
+
messages,
|
|
1358
|
+
styles: NUMBER_STYLES
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
|
|
1114
1363
|
// packages/addons/lib/client-common.cjs
|
|
1115
1364
|
var require_client_common = __commonJS({
|
|
1116
1365
|
"packages/addons/lib/client-common.cjs"(exports2, module2) {
|
|
@@ -1217,6 +1466,11 @@ var require_client_common = __commonJS({
|
|
|
1217
1466
|
call,
|
|
1218
1467
|
errText,
|
|
1219
1468
|
fmtTime,
|
|
1469
|
+
Switch: require_switch().Switch,
|
|
1470
|
+
switchStyles: require_switch().styles,
|
|
1471
|
+
NumberField: require_number_field().NumberField,
|
|
1472
|
+
numberFieldStyles: require_number_field().styles,
|
|
1473
|
+
validateNumber: require_number_field().validateNumber,
|
|
1220
1474
|
Btn,
|
|
1221
1475
|
Field,
|
|
1222
1476
|
Notice,
|
|
@@ -3664,13 +3918,6 @@ var require_data_style = __commonJS({
|
|
|
3664
3918
|
"." + P + "-search input:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
|
|
3665
3919
|
"." + P + "-select{border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:7px 10px;font:inherit;font-size:12px;outline:none}",
|
|
3666
3920
|
"." + P + "-select:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
|
|
3667
|
-
"." + P + "-switch{position:relative;display:inline-flex;align-items:center;gap:7px;cursor:pointer;font-size:12px;color:var(--cfg-muted);user-select:none;padding:4px 2px}",
|
|
3668
|
-
"." + P + "-switch input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}",
|
|
3669
|
-
"." + P + "-track{position:relative;width:34px;height:20px;border-radius:999px;background:color-mix(in oklab,currentColor 18%,transparent);transition:background .16s ease;flex:none}",
|
|
3670
|
-
"." + P + "-track::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-label-primary,currentColor);transition:transform .16s ease,background .16s ease}",
|
|
3671
|
-
"." + P + "-switch input:checked+." + P + "-track{background:var(--dsw-alias-brand-primary,currentColor)}",
|
|
3672
|
-
"." + P + "-switch input:checked+." + P + "-track::after{transform:translateX(14px);background:var(--dsw-alias-label-primary-inverted,var(--dsw-alias-bg-base))}",
|
|
3673
|
-
"." + P + "-switch input:focus-visible+." + P + "-track{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
3674
3921
|
"." + P + "-btn{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--cfg-line);background:transparent;color:var(--cfg-muted);border-radius:8px;padding:6px 10px;font:inherit;font-size:11.5px;cursor:pointer;white-space:nowrap;transition:background .12s ease,color .12s ease}",
|
|
3675
3922
|
"." + P + "-btn:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
|
|
3676
3923
|
"." + P + "-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
@@ -3699,8 +3946,8 @@ var require_data_style = __commonJS({
|
|
|
3699
3946
|
"." + P + "-foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-top:2px;font-size:11.5px;color:var(--cfg-muted)}",
|
|
3700
3947
|
"." + P + "-grow{flex:1}",
|
|
3701
3948
|
"." + P + "-pageinfo{font-variant-numeric:tabular-nums}",
|
|
3702
|
-
"." + P + "-jump{width:56px;
|
|
3703
|
-
"." + P + "-jump
|
|
3949
|
+
"." + P + "-jump .wbctl-num-input{width:56px;padding:4px 7px;font-size:11.5px;text-align:right}",
|
|
3950
|
+
"." + P + "-jump .wbctl-num-hint{display:none}",
|
|
3704
3951
|
"." + P + "-empty{border:1px dashed var(--cfg-line);border-radius:11px;padding:44px 16px;text-align:center;font-size:12.5px;color:var(--cfg-muted)}",
|
|
3705
3952
|
"." + P + "-err{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 32%,var(--cfg-line));border-radius:10px;padding:9px 12px;color:var(--dsw-alias-state-error-primary,inherit);font-size:12px;line-height:1.5}",
|
|
3706
3953
|
"." + P + "-skwrap{display:flex;flex-direction:column;gap:1px;padding:2px}",
|
|
@@ -3738,7 +3985,7 @@ var require_data_style = __commonJS({
|
|
|
3738
3985
|
"." + P + "-images img{width:36px;height:36px;object-fit:cover;border-radius:5px}",
|
|
3739
3986
|
"." + P + "-gallery{display:flex;flex-direction:column;gap:12px;overflow:auto;flex:1}",
|
|
3740
3987
|
"." + P + "-gallery img{width:100%;height:auto;object-fit:contain;border-radius:8px}"
|
|
3741
|
-
].join("\n");
|
|
3988
|
+
].concat(require_switch().styles).concat(require_number_field().styles).join("\n");
|
|
3742
3989
|
if (DOMAIN === "storage") {
|
|
3743
3990
|
var buttons = "." + P + " :is(button)";
|
|
3744
3991
|
CSS += buttons + "{border:none;background:var(--wb-btn-bg);min-height:var(--wb-btn-size-sm);min-width:var(--wb-btn-size-sm)}" + buttons + ":enabled:hover{background:var(--wb-btn-hover-bg)}" + buttons + ":enabled:active{background:var(--wb-btn-active-bg)}" + buttons + ":disabled{background:var(--wb-btn-bg);color:var(--cfg-muted)}" + buttons + ":focus-visible{outline:var(--wb-btn-focus);outline-offset:var(--wb-btn-focus-offset)}." + P + "-fcell:has(button) input{padding-right:34px}";
|
|
@@ -3766,8 +4013,10 @@ var require_data_view = __commonJS({
|
|
|
3766
4013
|
"packages/addons/lib/data-view.cjs"(exports2, module2) {
|
|
3767
4014
|
"use strict";
|
|
3768
4015
|
var React = require("react");
|
|
4016
|
+
var NF = require_number_field();
|
|
3769
4017
|
var h = React.createElement;
|
|
3770
4018
|
var COPY = require_data_copy();
|
|
4019
|
+
var SW = require_switch();
|
|
3771
4020
|
module2.exports = function createDataView(options) {
|
|
3772
4021
|
var DOMAIN = options.domain;
|
|
3773
4022
|
function icon(name) {
|
|
@@ -4321,17 +4570,18 @@ var require_data_view = __commonJS({
|
|
|
4321
4570
|
h("button", { type: "button", className: P + "-btn", disabled: !data || page >= pages, onClick: function() {
|
|
4322
4571
|
setPage(Math.min(pages, page + 1));
|
|
4323
4572
|
} }, t.next + " \u203A"),
|
|
4324
|
-
h(
|
|
4573
|
+
h(NF.NumberField, {
|
|
4574
|
+
h,
|
|
4575
|
+
lang,
|
|
4325
4576
|
className: P + "-jump",
|
|
4326
|
-
|
|
4577
|
+
value: page,
|
|
4327
4578
|
min: 1,
|
|
4328
4579
|
max: pages,
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
}
|
|
4580
|
+
integer: true,
|
|
4581
|
+
ariaLabel: t.jump,
|
|
4582
|
+
hint: false,
|
|
4583
|
+
onCommit: function(next) {
|
|
4584
|
+
if (next !== null) setPage(next);
|
|
4335
4585
|
}
|
|
4336
4586
|
}),
|
|
4337
4587
|
data && data.queryMs !== void 0 ? h("span", null, fmt(t.queryTime, { n: data.queryMs })) : null
|
|
@@ -4428,25 +4678,23 @@ var require_data_view = __commonJS({
|
|
|
4428
4678
|
}
|
|
4429
4679
|
})
|
|
4430
4680
|
),
|
|
4431
|
-
h(
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4681
|
+
h(SW.Switch, {
|
|
4682
|
+
h,
|
|
4683
|
+
checked: includeDeleted,
|
|
4684
|
+
label: t.includeDeleted,
|
|
4685
|
+
onChange: function(next) {
|
|
4686
|
+
setIncludeDeleted(next);
|
|
4436
4687
|
setPage(1);
|
|
4437
|
-
}
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
h("span", { className: P + "-track" }),
|
|
4448
|
-
h("span", null, t.showSystem)
|
|
4449
|
-
),
|
|
4688
|
+
}
|
|
4689
|
+
}),
|
|
4690
|
+
h(SW.Switch, {
|
|
4691
|
+
h,
|
|
4692
|
+
checked: showSystem,
|
|
4693
|
+
label: t.showSystem,
|
|
4694
|
+
onChange: function(next) {
|
|
4695
|
+
setShowSystem(next);
|
|
4696
|
+
}
|
|
4697
|
+
}),
|
|
4450
4698
|
h("span", { className: P + "-grow" }),
|
|
4451
4699
|
h(
|
|
4452
4700
|
"label",
|
|
@@ -4604,16 +4852,13 @@ var require_action_schema_style = __commonJS({
|
|
|
4604
4852
|
"." + P + "-cardmeta{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0;min-height:24px}",
|
|
4605
4853
|
"." + P + "-cardhead code{font-weight:640;overflow-wrap:anywhere;min-width:0}",
|
|
4606
4854
|
"." + P + "-hintline{margin:0;color:var(--dsw-alias-label-tertiary,inherit);font-size:11.5px;line-height:1.5}",
|
|
4607
|
-
"." + P + "-
|
|
4608
|
-
"." + P + "-
|
|
4609
|
-
"." + P + "-
|
|
4610
|
-
|
|
4611
|
-
"." + P + "-
|
|
4612
|
-
"." + P + "-
|
|
4613
|
-
"." + P + "-
|
|
4614
|
-
"." + P + "-toggle:disabled{opacity:.6;cursor:progress}",
|
|
4615
|
-
"@media(prefers-reduced-motion:reduce){." + P + "-track::before{transition:none}}",
|
|
4616
|
-
// 安全约束(不可放开):用警示色描边,和可切换的开关区分开。
|
|
4855
|
+
"." + P + "-origins{display:inline-flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}",
|
|
4856
|
+
"." + P + "-origins-label{font-size:11px;color:var(--wb-muted);white-space:nowrap}",
|
|
4857
|
+
"." + P + "-origin{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;color:var(--wb-muted);cursor:pointer;user-select:none}",
|
|
4858
|
+
// 该 action 本身不支持的来源:整项置灰、不可点,示意「不是没开,是开不了」。
|
|
4859
|
+
"." + P + "-origin-off{opacity:.55;cursor:not-allowed}",
|
|
4860
|
+
"." + P + "-origin input[type=checkbox]{width:13px;height:13px;margin:0;accent-color:var(--wb-accent);cursor:inherit}",
|
|
4861
|
+
"." + P + "-origin input[type=checkbox]:focus-visible{outline:2px solid var(--wb-accent);outline-offset:2px}",
|
|
4617
4862
|
"." + P + "-locked{border-color:var(--wb-warn,#b7791f);color:var(--wb-warn,#b7791f)}",
|
|
4618
4863
|
"." + P + "-desc{margin:0;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55;font-size:12.5px}",
|
|
4619
4864
|
// 搜索命中:用品牌色透明度叠加而不是写死浅色,深浅主题都可读;继承文字颜色、不覆盖 ::selection。
|
|
@@ -4666,15 +4911,20 @@ var require_action_schema_view = __commonJS({
|
|
|
4666
4911
|
zh: {
|
|
4667
4912
|
title: "Action",
|
|
4668
4913
|
hint: "\u8FD0\u884C\u65F6\u6CE8\u518C \xB7 \u53EA\u8BFB",
|
|
4669
|
-
switchHint: "
|
|
4670
|
-
hostHint: "\u5BBF\u4E3B action \u7684
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4914
|
+
switchHint: "\u5141\u8BB8\u6765\u6E90\u843D\u672C\u673A\u3001\u5373\u6539\u5373\u751F\u6548\uFF1A\u52FE\u4E0A\u7684\u6765\u6E90\u624D\u80FD\u8C03\u7528\u8BE5 action\uFF0C\u5176\u4F59\u4F1A\u88AB ACTION_ORIGIN_DENIED \u62E6\u4E0B\u3002",
|
|
4915
|
+
hostHint: "\u5BBF\u4E3B action \u7684\u5141\u8BB8\u6765\u6E90\uFF1B\u6807\u300C\u6765\u6E90\u56FA\u5B9A\u300D\u7684\u4E0D\u53EF\u4FEE\u6539\u3002",
|
|
4916
|
+
originsLabel: "\u5141\u8BB8\u6765\u6E90",
|
|
4917
|
+
originUi: "\u754C\u9762",
|
|
4918
|
+
originPlugin: "\u63D2\u4EF6",
|
|
4919
|
+
originAgent: "agent",
|
|
4920
|
+
originSync: "\u540C\u6B65",
|
|
4921
|
+
originsSaving: "\u4FDD\u5B58\u4E2D\u2026",
|
|
4922
|
+
originsToast: "\u5DF2\u66F4\u65B0\u5141\u8BB8\u6765\u6E90",
|
|
4923
|
+
originsFail: "\u66F4\u65B0\u5141\u8BB8\u6765\u6E90\u5931\u8D25",
|
|
4924
|
+
originsEmpty: "\u81F3\u5C11\u8981\u4FDD\u7559\u4E00\u4E2A\u6765\u6E90",
|
|
4925
|
+
originsUnsupported: "\u8BE5 action \u672C\u8EAB\u4E0D\u652F\u6301\u8FD9\u4E2A\u6765\u6E90",
|
|
4926
|
+
originsPinned: "\u6765\u6E90\u56FA\u5B9A",
|
|
4927
|
+
originsPinnedHint: "\u8BE5 action \u7684\u5141\u8BB8\u6765\u6E90\u88AB\u56FA\u5B9A\uFF08\u5B89\u5168\u7EA6\u675F\uFF09\uFF0C\u4E0D\u80FD\u4FEE\u6539",
|
|
4678
4928
|
domain: "\u57DF",
|
|
4679
4929
|
versionLabel: "\u7248\u672C",
|
|
4680
4930
|
shell: "\u5BBF\u4E3B",
|
|
@@ -4688,6 +4938,8 @@ var require_action_schema_view = __commonJS({
|
|
|
4688
4938
|
onlyOptional: "\u65E0\u5FC5\u586B\u9879",
|
|
4689
4939
|
filterType: "\u53C2\u6570\u7C7B\u578B",
|
|
4690
4940
|
allTypes: "\u5168\u90E8\u7C7B\u578B",
|
|
4941
|
+
filterOrigin: "\u5141\u8BB8\u6765\u6E90",
|
|
4942
|
+
allOrigins: "\u5168\u90E8\u6765\u6E90",
|
|
4691
4943
|
colName: "\u53C2\u6570",
|
|
4692
4944
|
colType: "\u7C7B\u578B",
|
|
4693
4945
|
colReq: "\u5FC5\u586B",
|
|
@@ -4720,15 +4972,22 @@ var require_action_schema_view = __commonJS({
|
|
|
4720
4972
|
en: {
|
|
4721
4973
|
title: "Actions",
|
|
4722
4974
|
hint: "runtime registry \xB7 read-only",
|
|
4723
|
-
switchHint: "
|
|
4724
|
-
hostHint: "
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4975
|
+
switchHint: "Allowed origins are stored locally and apply immediately: only checked origins may call the action; others get ACTION_ORIGIN_DENIED.",
|
|
4976
|
+
hostHint: "Allowed origins for host actions; items marked pinned cannot be changed.",
|
|
4977
|
+
originsLabel: "Origins",
|
|
4978
|
+
originUi: "UI",
|
|
4979
|
+
originPlugin: "Plugin",
|
|
4980
|
+
originAgent: "Agent",
|
|
4981
|
+
originSync: "Sync",
|
|
4982
|
+
originsSaving: "Saving\u2026",
|
|
4983
|
+
originsToast: "Allowed origins updated",
|
|
4984
|
+
originsFail: "Failed to update allowed origins",
|
|
4985
|
+
originsEmpty: "Keep at least one origin",
|
|
4986
|
+
originsUnsupported: "This action does not support this origin",
|
|
4987
|
+
originsPinned: "Pinned",
|
|
4988
|
+
originsPinnedHint: "Allowed origins are pinned for this action (security constraint) and cannot be changed",
|
|
4989
|
+
originsDefaultOn: "Allowed by default",
|
|
4990
|
+
originsDefaultOff: "Off by default, can be enabled",
|
|
4732
4991
|
domain: "Domain",
|
|
4733
4992
|
versionLabel: "Version",
|
|
4734
4993
|
shell: "Host",
|
|
@@ -4742,6 +5001,8 @@ var require_action_schema_view = __commonJS({
|
|
|
4742
5001
|
onlyOptional: "No required",
|
|
4743
5002
|
filterType: "Param type",
|
|
4744
5003
|
allTypes: "All types",
|
|
5004
|
+
filterOrigin: "Origins",
|
|
5005
|
+
allOrigins: "All origins",
|
|
4745
5006
|
colName: "Param",
|
|
4746
5007
|
colType: "Type",
|
|
4747
5008
|
colReq: "Required",
|
|
@@ -4885,6 +5146,8 @@ var require_action_schema_view = __commonJS({
|
|
|
4885
5146
|
var reqMode = reqState[0], setReqMode = reqState[1];
|
|
4886
5147
|
var typeState = React.useState("");
|
|
4887
5148
|
var typePick = typeState[0], setTypePick = typeState[1];
|
|
5149
|
+
var originFilterState = React.useState("");
|
|
5150
|
+
var originPick = originFilterState[0], setOriginPick = originFilterState[1];
|
|
4888
5151
|
var toastState = React.useState("");
|
|
4889
5152
|
var toast = toastState[0], setToast = toastState[1];
|
|
4890
5153
|
var savingState = React.useState("");
|
|
@@ -4940,38 +5203,53 @@ var require_action_schema_view = __commonJS({
|
|
|
4940
5203
|
plainCopy(text);
|
|
4941
5204
|
done();
|
|
4942
5205
|
}
|
|
4943
|
-
|
|
5206
|
+
var ORIGINS = ["ui", "plugin", "agent", "sync"];
|
|
5207
|
+
var originText = { ui: t.originUi, plugin: t.originPlugin, agent: t.originAgent, sync: t.originSync };
|
|
5208
|
+
function setOrigins(action, origin) {
|
|
4944
5209
|
var name = action.name;
|
|
5210
|
+
var current = Array.isArray(action.origins) ? action.origins.slice() : [];
|
|
5211
|
+
var index = current.indexOf(origin);
|
|
5212
|
+
var next = index >= 0 ? current.filter(function(o) {
|
|
5213
|
+
return o !== origin;
|
|
5214
|
+
}) : current.concat([origin]);
|
|
5215
|
+
if (next.length === 0) {
|
|
5216
|
+
setToast(t.originsEmpty);
|
|
5217
|
+
return;
|
|
5218
|
+
}
|
|
5219
|
+
next = ORIGINS.filter(function(o) {
|
|
5220
|
+
return next.indexOf(o) >= 0;
|
|
5221
|
+
});
|
|
4945
5222
|
setSaving(name);
|
|
4946
5223
|
setToast("");
|
|
4947
5224
|
var fail = function(e) {
|
|
4948
5225
|
setSaving("");
|
|
4949
|
-
setToast(t.
|
|
5226
|
+
setToast(t.originsFail + "\uFF1A" + String(e && e.message || e || ""));
|
|
4950
5227
|
};
|
|
4951
5228
|
var done = function(r) {
|
|
4952
5229
|
setSaving("");
|
|
4953
5230
|
var payload = r && typeof r === "object" && Object.prototype.hasOwnProperty.call(r, "result") ? r.result : r;
|
|
4954
5231
|
if (r && r.ok === false) {
|
|
4955
|
-
setToast(t.
|
|
5232
|
+
setToast(t.originsFail + "\uFF1A" + String(r.error || r.text || ""));
|
|
4956
5233
|
return;
|
|
4957
5234
|
}
|
|
4958
|
-
var value = payload &&
|
|
5235
|
+
var value = payload && Array.isArray(payload.origins) ? payload.origins : next;
|
|
5236
|
+
var source = payload && typeof payload.source === "string" ? payload.source : action.originsSource;
|
|
4959
5237
|
setSnap(function(prev) {
|
|
4960
5238
|
if (!prev || !Array.isArray(prev.actions)) return prev;
|
|
4961
5239
|
return Object.assign({}, prev, {
|
|
4962
5240
|
actions: prev.actions.map(function(a) {
|
|
4963
5241
|
if (!a || a.name !== name) return a;
|
|
4964
|
-
return Object.assign({}, a, {
|
|
5242
|
+
return Object.assign({}, a, { origins: value, originsSource: source });
|
|
4965
5243
|
})
|
|
4966
5244
|
});
|
|
4967
5245
|
});
|
|
4968
|
-
setToast(
|
|
5246
|
+
setToast(t.originsToast);
|
|
4969
5247
|
};
|
|
4970
5248
|
if (!api || typeof api.call !== "function") {
|
|
4971
5249
|
fail(new Error("no call api"));
|
|
4972
5250
|
return;
|
|
4973
5251
|
}
|
|
4974
|
-
Promise.resolve(api.call("actions.
|
|
5252
|
+
Promise.resolve(api.call("actions.setActionOrigins", { action: name, origins: next })).then(done, fail);
|
|
4975
5253
|
}
|
|
4976
5254
|
var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
|
|
4977
5255
|
return a && a.domain === DOMAIN;
|
|
@@ -5006,6 +5284,7 @@ var require_action_schema_view = __commonJS({
|
|
|
5006
5284
|
if (typePick && !rows.some(function(row) {
|
|
5007
5285
|
return row.types.indexOf(typePick) >= 0;
|
|
5008
5286
|
})) return false;
|
|
5287
|
+
if (originPick && (!Array.isArray(a.origins) || a.origins.indexOf(originPick) < 0)) return false;
|
|
5009
5288
|
return true;
|
|
5010
5289
|
});
|
|
5011
5290
|
function paramRow(row) {
|
|
@@ -5021,33 +5300,45 @@ var require_action_schema_view = __commonJS({
|
|
|
5021
5300
|
h("td", null, Highlight.hit(row.description, kw))
|
|
5022
5301
|
);
|
|
5023
5302
|
}
|
|
5024
|
-
function
|
|
5025
|
-
if (action.
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
title: t.agentLockedHint,
|
|
5029
|
-
"data-agent-locked": action.name
|
|
5030
|
-
}, t.agentLocked);
|
|
5303
|
+
function originsChips(action) {
|
|
5304
|
+
if (!Array.isArray(action.origins)) return null;
|
|
5305
|
+
if (action.originsSource === "invalid") {
|
|
5306
|
+
return h("span", { className: P + "-badge " + P + "-locked", title: t.originsPinnedHint, "data-origins-invalid": action.name }, t.originsPinned);
|
|
5031
5307
|
}
|
|
5032
|
-
if (typeof action.agentEnabled !== "boolean") return null;
|
|
5033
5308
|
var busy = saving === action.name;
|
|
5309
|
+
var pinned = action.name === "actions.setActionOrigins";
|
|
5310
|
+
var supported = Array.isArray(action.originsDeclared) ? action.originsDeclared : action.origins;
|
|
5034
5311
|
return h(
|
|
5035
|
-
"
|
|
5036
|
-
{
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5312
|
+
"div",
|
|
5313
|
+
{ className: P + "-origins", "data-origins-row": action.name },
|
|
5314
|
+
h("span", { className: P + "-origins-label" }, t.originsLabel),
|
|
5315
|
+
ORIGINS.map(function(origin) {
|
|
5316
|
+
var on = action.origins.indexOf(origin) >= 0;
|
|
5317
|
+
var allowed = supported.indexOf(origin) >= 0;
|
|
5318
|
+
var preset = Array.isArray(action.originsDefault) ? action.originsDefault : supported;
|
|
5319
|
+
var byDefault = preset.indexOf(origin) >= 0;
|
|
5320
|
+
return h(
|
|
5321
|
+
"label",
|
|
5322
|
+
{
|
|
5323
|
+
key: origin,
|
|
5324
|
+
className: P + "-origin" + (allowed ? "" : " " + P + "-origin-off"),
|
|
5325
|
+
title: pinned ? t.originsPinnedHint : !allowed ? t.originsUnsupported : originText[origin] + " \xB7 " + action.name + " \xB7 " + (byDefault ? t.originsDefaultOn : t.originsDefaultOff)
|
|
5326
|
+
},
|
|
5327
|
+
h("input", {
|
|
5328
|
+
type: "checkbox",
|
|
5329
|
+
checked: on,
|
|
5330
|
+
disabled: busy || pinned || !allowed,
|
|
5331
|
+
"data-origin": origin,
|
|
5332
|
+
"data-origin-row": action.name,
|
|
5333
|
+
"data-origin-supported": allowed ? "1" : "0",
|
|
5334
|
+
onChange: function() {
|
|
5335
|
+
setOrigins(action, origin);
|
|
5336
|
+
}
|
|
5337
|
+
}),
|
|
5338
|
+
h("span", null, originText[origin])
|
|
5339
|
+
);
|
|
5340
|
+
}),
|
|
5341
|
+
busy ? h("span", { className: P + "-origins-label" }, t.originsSaving) : null
|
|
5051
5342
|
);
|
|
5052
5343
|
}
|
|
5053
5344
|
function card(action) {
|
|
@@ -5068,7 +5359,7 @@ var require_action_schema_view = __commonJS({
|
|
|
5068
5359
|
return row.required;
|
|
5069
5360
|
}) ? h("span", { className: P + "-badge " + P + "-req" }, t.required) : null
|
|
5070
5361
|
),
|
|
5071
|
-
|
|
5362
|
+
originsChips(action)
|
|
5072
5363
|
),
|
|
5073
5364
|
action.description ? h("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
|
|
5074
5365
|
rows.length ? h(
|
|
@@ -5191,6 +5482,21 @@ var require_action_schema_view = __commonJS({
|
|
|
5191
5482
|
return h("option", { value: name, key: name }, name);
|
|
5192
5483
|
})
|
|
5193
5484
|
)
|
|
5485
|
+
),
|
|
5486
|
+
h(
|
|
5487
|
+
"label",
|
|
5488
|
+
{ className: P + "-none" },
|
|
5489
|
+
t.filterOrigin + " ",
|
|
5490
|
+
h(
|
|
5491
|
+
"select",
|
|
5492
|
+
{ value: originPick, "aria-label": t.filterOrigin, "data-origin-filter": "", onChange: function(e) {
|
|
5493
|
+
setOriginPick(e.target.value);
|
|
5494
|
+
} },
|
|
5495
|
+
h("option", { value: "" }, t.allOrigins),
|
|
5496
|
+
ORIGINS.map(function(origin) {
|
|
5497
|
+
return h("option", { value: origin, key: origin }, originText[origin]);
|
|
5498
|
+
})
|
|
5499
|
+
)
|
|
5194
5500
|
)
|
|
5195
5501
|
) : null,
|
|
5196
5502
|
body,
|
|
@@ -5268,7 +5574,7 @@ var GLYPHS = require_icons2().ICONS;
|
|
|
5268
5574
|
ensureStyles();
|
|
5269
5575
|
host.registerAddon({
|
|
5270
5576
|
id: "wb-addon-vault",
|
|
5271
|
-
version: "0.3.
|
|
5577
|
+
version: "0.3.12",
|
|
5272
5578
|
icon: GLYPHS["shield-check"],
|
|
5273
5579
|
views: [
|
|
5274
5580
|
{ id: "status", icon: tabIcon("shield"), title: { zh: "\u4FDD\u9669\u7BB1", en: "Vault" }, component: withProps(require_status(), "\u4FDD\u9669\u7BB1") },
|
package/lib/domain/actions.js
CHANGED
|
@@ -23,7 +23,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
api.action("vault.setup", {
|
|
26
|
-
|
|
26
|
+
origins: ["ui"],
|
|
27
27
|
description: "首次初始化保险箱:设置口令与解锁模式 A/B/C,默认 A(每次启动锁定)。口令包裹会上云。",
|
|
28
28
|
input: {
|
|
29
29
|
type: "object",
|
|
@@ -42,7 +42,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
api.action("vault.unlock", {
|
|
45
|
-
|
|
45
|
+
origins: ["ui"],
|
|
46
46
|
description: "用主口令解锁保险箱;连续 5 次失败锁定 5 分钟。",
|
|
47
47
|
input: {
|
|
48
48
|
type: "object",
|
|
@@ -57,7 +57,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
api.action("vault.lock", {
|
|
60
|
-
|
|
60
|
+
origins: ["ui"],
|
|
61
61
|
description: "立即清除内存中的 DEK;插件后台可用它主动锁定。",
|
|
62
62
|
input: { type: "object", properties: {}, additionalProperties: false },
|
|
63
63
|
execute: (_args, ctx) => {
|
|
@@ -68,7 +68,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
api.action("vault.setUnlockMode", {
|
|
71
|
-
|
|
71
|
+
origins: ["ui"],
|
|
72
72
|
description: "切换解锁模式:A 全锁 / B 自动解锁但查看需口令 / C 自动解锁且查看免口令。",
|
|
73
73
|
input: {
|
|
74
74
|
type: "object",
|
|
@@ -86,7 +86,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
api.action("vault.changePassphrase", {
|
|
89
|
-
|
|
89
|
+
origins: ["ui"],
|
|
90
90
|
description: "修改主口令:只重包 DEK 并让 passphrase_rev 加一,不重新加密所有 secret。",
|
|
91
91
|
input: {
|
|
92
92
|
type: "object",
|
|
@@ -122,7 +122,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
api.action("vault.secretCreate", {
|
|
125
|
-
|
|
125
|
+
origins: ["ui"],
|
|
126
126
|
description: "新增凭据;secret 只在内存加密后落库,审计中该字段显示为 ***。",
|
|
127
127
|
input: {
|
|
128
128
|
type: "object",
|
|
@@ -145,7 +145,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
145
145
|
});
|
|
146
146
|
|
|
147
147
|
api.action("vault.secretUpdate", {
|
|
148
|
-
|
|
148
|
+
origins: ["ui"],
|
|
149
149
|
description: "更新名称/类型/备注或轮换明文;改名称或类型会重加密,改归属不会。",
|
|
150
150
|
input: {
|
|
151
151
|
type: "object",
|
|
@@ -168,7 +168,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
api.action("vault.secretDelete", {
|
|
171
|
-
|
|
171
|
+
origins: ["ui"],
|
|
172
172
|
description: "软删除凭据;已绑定它的连接器会在下次运行时提示凭据失效。",
|
|
173
173
|
input: {
|
|
174
174
|
type: "object",
|
|
@@ -185,7 +185,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
185
185
|
registerSetActions({ api, sets, groups, vault, only, KINDS });
|
|
186
186
|
|
|
187
187
|
api.action("vault.secretReveal", {
|
|
188
|
-
|
|
188
|
+
origins: ["ui"],
|
|
189
189
|
description: "在界面上显示一条凭据明文;B 模式必须再输口令,agent/plugin 一律拒绝。",
|
|
190
190
|
input: {
|
|
191
191
|
type: "object",
|
|
@@ -203,7 +203,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
203
203
|
});
|
|
204
204
|
|
|
205
205
|
api.action("vault.lease", {
|
|
206
|
-
|
|
206
|
+
origins: ["ui"],
|
|
207
207
|
description: "后台插件租用凭据明文,ttl 30–300 秒;只允许 plugin origin,传 subject 时校验绑定。",
|
|
208
208
|
input: {
|
|
209
209
|
type: "object",
|
|
@@ -224,7 +224,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
224
224
|
});
|
|
225
225
|
|
|
226
226
|
api.action("vault.rotateDeviceKey", {
|
|
227
|
-
|
|
227
|
+
origins: ["ui"],
|
|
228
228
|
description: "重写自动解锁的 device key 包裹;B/C 模式可用,需要主口令。",
|
|
229
229
|
input: {
|
|
230
230
|
type: "object",
|
|
@@ -252,7 +252,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
252
252
|
});
|
|
253
253
|
|
|
254
254
|
api.action("vault.groupCreate", {
|
|
255
|
-
|
|
255
|
+
origins: ["ui"],
|
|
256
256
|
description: "新建凭据分组;组名唯一。",
|
|
257
257
|
input: {
|
|
258
258
|
type: "object",
|
|
@@ -271,7 +271,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
271
271
|
});
|
|
272
272
|
|
|
273
273
|
api.action("vault.groupUpdate", {
|
|
274
|
-
|
|
274
|
+
origins: ["ui"],
|
|
275
275
|
description: "改名/描述/色标;不改动组内凭据的密文。",
|
|
276
276
|
input: {
|
|
277
277
|
type: "object",
|
|
@@ -291,7 +291,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
291
291
|
});
|
|
292
292
|
|
|
293
293
|
api.action("vault.groupDelete", {
|
|
294
|
-
|
|
294
|
+
origins: ["ui"],
|
|
295
295
|
description: "软删除分组:组内凭据移到 moveTo,未指定则移出分组;组上的绑定一并软删。",
|
|
296
296
|
input: {
|
|
297
297
|
type: "object",
|
|
@@ -309,7 +309,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
309
309
|
});
|
|
310
310
|
|
|
311
311
|
api.action("vault.subjectRegister", {
|
|
312
|
-
|
|
312
|
+
origins: ["ui"],
|
|
313
313
|
description: "业务插件注册自己的关联类型(幂等),供组详情页显示可读标题。",
|
|
314
314
|
input: {
|
|
315
315
|
type: "object",
|
|
@@ -328,7 +328,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
328
328
|
});
|
|
329
329
|
|
|
330
330
|
api.action("vault.bind", {
|
|
331
|
-
|
|
331
|
+
origins: ["ui"],
|
|
332
332
|
description: "把业务对象关联到凭据分组(重复绑定幂等);vault 不校验对象是否存在。",
|
|
333
333
|
input: {
|
|
334
334
|
type: "object",
|
|
@@ -347,7 +347,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
347
347
|
});
|
|
348
348
|
|
|
349
349
|
api.action("vault.unbind", {
|
|
350
|
-
|
|
350
|
+
origins: ["ui"],
|
|
351
351
|
description: "解除一个业务对象与分组的关联(软删)。",
|
|
352
352
|
input: {
|
|
353
353
|
type: "object",
|
|
@@ -398,7 +398,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
398
398
|
});
|
|
399
399
|
|
|
400
400
|
api.action("vault.subjectSecrets", {
|
|
401
|
-
|
|
401
|
+
origins: ["ui"],
|
|
402
402
|
description: "后台插件只读:某个业务对象经分组可见的凭据清单(不含明文),拿到 id 后再 lease。",
|
|
403
403
|
input: {
|
|
404
404
|
type: "object",
|
|
@@ -413,7 +413,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
413
413
|
});
|
|
414
414
|
|
|
415
415
|
api.action("vault.bindingPurge", {
|
|
416
|
-
|
|
416
|
+
origins: ["ui"],
|
|
417
417
|
description: "插件卸载/业务对象删除时清理自己的绑定引用(硬删)。",
|
|
418
418
|
input: {
|
|
419
419
|
type: "object",
|
|
@@ -447,7 +447,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
447
447
|
});
|
|
448
448
|
|
|
449
449
|
api.action("vault.dataTables", {
|
|
450
|
-
|
|
450
|
+
origins: ["ui"],
|
|
451
451
|
description: "只读:数据页表清单。",
|
|
452
452
|
input: { type: "object", properties: {}, additionalProperties: false },
|
|
453
453
|
execute: (_args, ctx) => {
|
|
@@ -481,7 +481,7 @@ export function registerVaultActions(api, vault, groups) {
|
|
|
481
481
|
});
|
|
482
482
|
|
|
483
483
|
api.action("vault.dataQuery", {
|
|
484
|
-
|
|
484
|
+
origins: ["ui"],
|
|
485
485
|
description: "只读:数据页查询;密文列一律掩码。",
|
|
486
486
|
input: {
|
|
487
487
|
type: "object",
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-workbench-vault",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "个人工作台凭据保险箱:加密保存密码与 token,agent 只见掩码",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"addon": {
|
|
17
17
|
"id": "wb-addon-vault",
|
|
18
18
|
"title": "凭据保险箱",
|
|
19
|
-
"version": "0.3.
|
|
19
|
+
"version": "0.3.12",
|
|
20
20
|
"minShell": "0.8.0",
|
|
21
21
|
"tables": [
|
|
22
22
|
"vault_header",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"dsh-workbench-host": "^0.
|
|
71
|
+
"dsh-workbench-host": "^0.9.1"
|
|
72
72
|
},
|
|
73
73
|
"dsh": {
|
|
74
74
|
"bundle": {
|