soma-kit 0.0.0-stage → 0.1.0
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/README.md +539 -2
- package/bin/soma-kit.mjs +27 -0
- package/package.json +66 -4
- package/packs/ai/agent-run-card.ts +64 -0
- package/packs/ai/evaluation-card.ts +51 -0
- package/packs/ai/guardrail-policy-card.ts +48 -0
- package/packs/ai/index.ts +31 -0
- package/packs/ai/model-card.ts +55 -0
- package/packs/ai/model-routing-card.ts +49 -0
- package/packs/ai/prompt-template-card.ts +49 -0
- package/packs/ai/texts.ts +19 -0
- package/packs/commerce/address-card.ts +58 -0
- package/packs/commerce/coupon-card.ts +64 -0
- package/packs/commerce/index.ts +25 -0
- package/packs/commerce/order-card.ts +60 -0
- package/packs/commerce/purchase-order-card.ts +74 -0
- package/packs/commerce/texts.ts +14 -0
- package/packs/finance/index.ts +30 -0
- package/packs/finance/invoice-summary-card.ts +48 -0
- package/packs/finance/reconcile-board.ts +450 -0
- package/packs/finance/reconcile-case-card.ts +70 -0
- package/packs/finance/reconcile-desk/compile.ts +208 -0
- package/packs/finance/reconcile-desk/index.ts +20 -0
- package/packs/finance/reconcile-desk/shell.ts +27 -0
- package/packs/finance/texts.ts +21 -0
- package/packs/ops/change-window-card.ts +54 -0
- package/packs/ops/dependency-status-card.ts +50 -0
- package/packs/ops/error-budget-card.ts +60 -0
- package/packs/ops/execution-task-runner.ts +61 -0
- package/packs/ops/index.ts +36 -0
- package/packs/ops/integration-status-card.ts +45 -0
- package/packs/ops/release-readiness-card.ts +63 -0
- package/packs/ops/runbook-execution-card.ts +81 -0
- package/packs/ops/texts.ts +21 -0
- package/packs/security/control-evidence-card.ts +54 -0
- package/packs/security/finding-card.ts +96 -0
- package/packs/security/index.ts +29 -0
- package/packs/security/texts.ts +31 -0
- package/packs/shared/card-util.ts +60 -0
- package/packs/shared/wrap.ts +13 -0
- package/spec/generated/kit-app.schema.json +84 -0
- package/spec/generated/kit-page.schema.json +2766 -0
- package/spec/kit-grammar.json +1358 -0
- package/spec/kit-grammar.schema.json +716 -0
- package/src/app/app-config.ts +108 -0
- package/src/app/compose-apps.ts +139 -0
- package/src/app/define-kit-actions.ts +89 -0
- package/src/app/define-kit-app.ts +362 -0
- package/src/app/define-kit-pack.ts +114 -0
- package/src/app/envelope.ts +117 -0
- package/src/app/index.ts +50 -0
- package/src/app/notify-renderer.ts +114 -0
- package/src/app/paged-list-adapter.ts +246 -0
- package/src/app/server-pages.ts +303 -0
- package/src/app/server.ts +244 -0
- package/src/app/submit.types.ts +87 -0
- package/src/base/action-busy.ts +159 -0
- package/src/base/action-gate.ts +267 -0
- package/src/base/action-status.ts +31 -0
- package/src/base/alert.ts +136 -0
- package/src/base/avatar.ts +271 -0
- package/src/base/button.ts +139 -0
- package/src/base/cascader.ts +523 -0
- package/src/base/check-core.ts +214 -0
- package/src/base/checkbox.ts +35 -0
- package/src/base/choice.ts +183 -0
- package/src/base/color-picker.ts +316 -0
- package/src/base/combobox.ts +61 -0
- package/src/base/command-palette.ts +371 -0
- package/src/base/context-menu.ts +103 -0
- package/src/base/countdown.ts +168 -0
- package/src/base/date-range.ts +444 -0
- package/src/base/date.ts +899 -0
- package/src/base/divider.ts +156 -0
- package/src/base/fab.ts +192 -0
- package/src/base/icons.ts +106 -0
- package/src/base/image.ts +177 -0
- package/src/base/index.ts +214 -0
- package/src/base/input.ts +316 -0
- package/src/base/kbd.ts +99 -0
- package/src/base/link.ts +167 -0
- package/src/base/listbox-core.ts +965 -0
- package/src/base/mentions.ts +323 -0
- package/src/base/menu-button.ts +240 -0
- package/src/base/menu-core.ts +341 -0
- package/src/base/month-grid.ts +171 -0
- package/src/base/motion/aura.ts +94 -0
- package/src/base/motion/hover-3d.ts +154 -0
- package/src/base/motion/hover-gallery.ts +185 -0
- package/src/base/motion/index.ts +27 -0
- package/src/base/motion/limits.ts +75 -0
- package/src/base/motion/marquee.ts +157 -0
- package/src/base/motion/text-rotate.ts +195 -0
- package/src/base/number.ts +121 -0
- package/src/base/otp.ts +259 -0
- package/src/base/permission-gate.ts +99 -0
- package/src/base/popover.ts +352 -0
- package/src/base/popup.ts +542 -0
- package/src/base/portal-core.ts +297 -0
- package/src/base/price-text.ts +126 -0
- package/src/base/progress.ts +216 -0
- package/src/base/qr-code.ts +446 -0
- package/src/base/qty-stepper.ts +241 -0
- package/src/base/radio.ts +33 -0
- package/src/base/range.ts +444 -0
- package/src/base/rating.ts +249 -0
- package/src/base/segmented.ts +286 -0
- package/src/base/select.ts +57 -0
- package/src/base/shared.ts +708 -0
- package/src/base/swap.ts +86 -0
- package/src/base/switch.ts +111 -0
- package/src/base/tag-input.ts +464 -0
- package/src/base/tag.ts +250 -0
- package/src/base/text.ts +126 -0
- package/src/base/textarea.ts +129 -0
- package/src/base/time-picker.ts +606 -0
- package/src/base/tree-select.ts +629 -0
- package/src/base/upload.ts +548 -0
- package/src/base/virtual-list.ts +286 -0
- package/src/biz/approval-desk/compile.ts +179 -0
- package/src/biz/approval-desk/index.ts +21 -0
- package/src/biz/approval-desk/shell.ts +50 -0
- package/src/biz/auth-panel/compile.ts +196 -0
- package/src/biz/auth-panel/index.ts +24 -0
- package/src/biz/auth-panel/shell.ts +46 -0
- package/src/biz/category-crud/compile.ts +173 -0
- package/src/biz/category-crud/index.ts +19 -0
- package/src/biz/category-crud/shell.ts +29 -0
- package/src/biz/checkout-page/compile.ts +111 -0
- package/src/biz/checkout-page/index.ts +20 -0
- package/src/biz/checkout-page/shell.ts +50 -0
- package/src/biz/compose.ts +313 -0
- package/src/biz/data-components.ts +26 -0
- package/src/biz/define.ts +23 -0
- package/src/biz/import-wizard/compile.ts +204 -0
- package/src/biz/import-wizard/hub.ts +540 -0
- package/src/biz/import-wizard/index.ts +24 -0
- package/src/biz/import-wizard/shell.ts +161 -0
- package/src/biz/index.ts +80 -0
- package/src/biz/landing-page/compile.ts +67 -0
- package/src/biz/landing-page/index.ts +20 -0
- package/src/biz/landing-page/shell.ts +48 -0
- package/src/biz/link/hub.ts +255 -0
- package/src/biz/link/shared.ts +493 -0
- package/src/biz/master-sub/compile.ts +232 -0
- package/src/biz/master-sub/index.ts +20 -0
- package/src/biz/master-sub/shell.ts +56 -0
- package/src/biz/multi-board/compile.ts +234 -0
- package/src/biz/multi-board/index.ts +19 -0
- package/src/biz/multi-board/shell.ts +70 -0
- package/src/biz/names.ts +30 -0
- package/src/biz/notification-center/compile.ts +138 -0
- package/src/biz/notification-center/index.ts +29 -0
- package/src/biz/notification-center/shell.ts +42 -0
- package/src/biz/page-templates/result-page/compile.ts +46 -0
- package/src/biz/page-templates/result-page/index.ts +19 -0
- package/src/biz/page-templates/result-page/shell.ts +31 -0
- package/src/biz/page-templates/shared.ts +121 -0
- package/src/biz/page-templates/sign-in-page/compile.ts +176 -0
- package/src/biz/page-templates/sign-in-page/index.ts +18 -0
- package/src/biz/page-templates/sign-in-page/shell.ts +116 -0
- package/src/biz/record-detail/compile.ts +290 -0
- package/src/biz/record-detail/index.ts +22 -0
- package/src/biz/record-detail/shell.ts +64 -0
- package/src/biz/settings-center/compile.ts +100 -0
- package/src/biz/settings-center/index.ts +18 -0
- package/src/biz/settings-center/shell.ts +51 -0
- package/src/biz/shared/action-host.ts +469 -0
- package/src/biz/shared/coordinator.ts +516 -0
- package/src/biz/shared/index.ts +9 -0
- package/src/biz/shared/pipes.ts +58 -0
- package/src/biz/shared/runtime-hub.ts +112 -0
- package/src/biz/shared/step-values.ts +25 -0
- package/src/biz/single-form/compile.ts +146 -0
- package/src/biz/single-form/index.ts +18 -0
- package/src/biz/single-form/shell.ts +38 -0
- package/src/biz/standard-crud/bridge.ts +11 -0
- package/src/biz/standard-crud/compile.ts +546 -0
- package/src/biz/standard-crud/index.ts +18 -0
- package/src/biz/standard-crud/shell.ts +157 -0
- package/src/biz/step-form/compile.ts +400 -0
- package/src/biz/step-form/hub.ts +412 -0
- package/src/biz/step-form/index.ts +23 -0
- package/src/biz/step-form/shell.ts +96 -0
- package/src/biz/step-form/steps-ref.ts +112 -0
- package/src/biz/types.ts +96 -0
- package/src/cli/kit-cli.ts +102 -0
- package/src/compile/action-host-attach.ts +76 -0
- package/src/compile/compile-page.ts +472 -0
- package/src/compile/component-candidates.ts +147 -0
- package/src/compile/fragment.ts +104 -0
- package/src/compile/hints.ts +255 -0
- package/src/compile/index.ts +16 -0
- package/src/compile/locate.ts +166 -0
- package/src/compile/page-params.ts +80 -0
- package/src/compile/parse.ts +355 -0
- package/src/compile/redirect.ts +90 -0
- package/src/compile/registry.ts +30 -0
- package/src/compile/remove-guard.ts +99 -0
- package/src/compile/styles.ts +244 -0
- package/src/compile/types.ts +106 -0
- package/src/data/amount-breakdown.ts +132 -0
- package/src/data/anchor-nav.ts +225 -0
- package/src/data/approval-flow.ts +269 -0
- package/src/data/assignment-picker.ts +652 -0
- package/src/data/async-result-panel.ts +308 -0
- package/src/data/breadcrumbs.ts +197 -0
- package/src/data/calendar.ts +363 -0
- package/src/data/carousel.ts +408 -0
- package/src/data/chart.ts +726 -0
- package/src/data/checklist.ts +215 -0
- package/src/data/code-view.ts +415 -0
- package/src/data/comment-thread.ts +342 -0
- package/src/data/confirm-dialog.ts +144 -0
- package/src/data/context-menu.ts +216 -0
- package/src/data/d9-limits.ts +42 -0
- package/src/data/d9-util.ts +81 -0
- package/src/data/diff.ts +239 -0
- package/src/data/display-util.ts +135 -0
- package/src/data/dock.ts +152 -0
- package/src/data/embed.ts +200 -0
- package/src/data/field-mapper.ts +544 -0
- package/src/data/flow-editor-contract.ts +41 -0
- package/src/data/flow-editor.ts +2622 -0
- package/src/data/flow-remote-options.ts +257 -0
- package/src/data/footer.ts +157 -0
- package/src/data/form-draft-registry.ts +76 -0
- package/src/data/gantt.ts +430 -0
- package/src/data/hero.ts +149 -0
- package/src/data/image-viewer.ts +333 -0
- package/src/data/index.ts +268 -0
- package/src/data/item-list.ts +335 -0
- package/src/data/kanban.ts +667 -0
- package/src/data/media-grid.ts +246 -0
- package/src/data/mega-menu.ts +257 -0
- package/src/data/menu-dom.ts +169 -0
- package/src/data/menu.ts +464 -0
- package/src/data/mockup.ts +176 -0
- package/src/data/modal-dialog.ts +182 -0
- package/src/data/navbar.ts +292 -0
- package/src/data/object-form.ts +1981 -0
- package/src/data/options-bus.ts +24 -0
- package/src/data/outcome-watch.ts +40 -0
- package/src/data/overlay-portal.ts +6 -0
- package/src/data/pager.ts +473 -0
- package/src/data/permission-matrix.ts +432 -0
- package/src/data/permission-tree.ts +916 -0
- package/src/data/pricing-table.ts +269 -0
- package/src/data/prompt-dialog.ts +235 -0
- package/src/data/reaction-bar.ts +236 -0
- package/src/data/record-card.ts +413 -0
- package/src/data/record-picker.ts +489 -0
- package/src/data/redirect.ts +109 -0
- package/src/data/remote-options.ts +54 -0
- package/src/data/request-console.ts +399 -0
- package/src/data/resident.ts +58 -0
- package/src/data/result-panel.ts +160 -0
- package/src/data/rich-text.ts +626 -0
- package/src/data/row-editor.ts +1066 -0
- package/src/data/rule-builder.ts +1137 -0
- package/src/data/shape-util.ts +221 -0
- package/src/data/staged-rows.ts +69 -0
- package/src/data/stat-group.ts +231 -0
- package/src/data/static-lazy.ts +63 -0
- package/src/data/static-registry.ts +227 -0
- package/src/data/steps.ts +195 -0
- package/src/data/survey.ts +455 -0
- package/src/data/system-switcher.ts +243 -0
- package/src/data/timeline.ts +204 -0
- package/src/data/tour-guide.ts +392 -0
- package/src/data/transfer.ts +597 -0
- package/src/data/tree-check.ts +30 -0
- package/src/data/tree-table.ts +674 -0
- package/src/data/tree.ts +656 -0
- package/src/data/trend-line.ts +147 -0
- package/src/data/virtual-rows.ts +556 -0
- package/src/data/watermark.ts +140 -0
- package/src/data/wrap.ts +267 -0
- package/src/data/wrapped-candidates.ts +96 -0
- package/src/frames/blank-frame.ts +19 -0
- package/src/frames/index.ts +44 -0
- package/src/frames/page-bar.ts +185 -0
- package/src/frames/page-header.ts +185 -0
- package/src/frames/page-status.ts +54 -0
- package/src/frames/resize-handle.ts +147 -0
- package/src/frames/shared.ts +242 -0
- package/src/frames/single-frame.ts +16 -0
- package/src/frames/split-frame/index.ts +4 -0
- package/src/frames/split-frame/shell.ts +219 -0
- package/src/frames/split-frame/span.ts +64 -0
- package/src/frames/split-frame/wiring.ts +164 -0
- package/src/frames/tabs-frame/index.ts +3 -0
- package/src/frames/tabs-frame/shell.ts +112 -0
- package/src/frames/tabs-frame/wiring.ts +69 -0
- package/src/frames/top-main-frame.ts +20 -0
- package/src/frames/types.ts +72 -0
- package/src/frames/workspace-frame/extras.ts +197 -0
- package/src/frames/workspace-frame/index.ts +13 -0
- package/src/frames/workspace-frame/shell.ts +282 -0
- package/src/frames/workspace-frame/state.ts +152 -0
- package/src/frames/workspace-frame/view.ts +1013 -0
- package/src/generated/kit-grammar-runtime.ts +2822 -0
- package/src/generated/page-origin.ts +57 -0
- package/src/i18n/index.ts +22 -0
- package/src/i18n/kit-text.ts +692 -0
- package/src/i18n/resolve-text-refs.ts +128 -0
- package/src/index.ts +6 -0
- package/src/object-renderer/action-gate.ts +216 -0
- package/src/object-renderer/adopt-gate.ts +333 -0
- package/src/object-renderer/arrange.ts +411 -0
- package/src/object-renderer/candidates.ts +68 -0
- package/src/object-renderer/collapse-wiring.ts +99 -0
- package/src/object-renderer/collection-expand.ts +185 -0
- package/src/object-renderer/collection-parts.ts +653 -0
- package/src/object-renderer/collection-table.ts +503 -0
- package/src/object-renderer/collection.ts +628 -0
- package/src/object-renderer/compile-data.ts +549 -0
- package/src/object-renderer/defaults.ts +252 -0
- package/src/object-renderer/display-checks.ts +153 -0
- package/src/object-renderer/emit-events.ts +498 -0
- package/src/object-renderer/emit-object.ts +98 -0
- package/src/object-renderer/emit-static.ts +1036 -0
- package/src/object-renderer/field-policy.ts +89 -0
- package/src/object-renderer/field-value.ts +581 -0
- package/src/object-renderer/form-detail.ts +116 -0
- package/src/object-renderer/index.ts +13 -0
- package/src/object-renderer/linkage.ts +371 -0
- package/src/object-renderer/merge-class.ts +126 -0
- package/src/object-renderer/mode.ts +25 -0
- package/src/object-renderer/outcome-draft.ts +61 -0
- package/src/object-renderer/parts.ts +136 -0
- package/src/object-renderer/pick-component.ts +36 -0
- package/src/object-renderer/render-object.ts +724 -0
- package/src/object-renderer/request-actions.ts +581 -0
- package/src/object-renderer/skeleton.ts +101 -0
- package/src/object-renderer/table-actions.ts +438 -0
- package/src/object-renderer/table-summary.ts +105 -0
- package/src/object-renderer/table-tools.ts +1072 -0
- package/src/object-renderer/types.ts +936 -0
- package/src/page-target/ai-surface.ts +154 -0
- package/src/page-target/compile.ts +354 -0
- package/src/page-target/drift.ts +186 -0
- package/src/page-target/index.ts +25 -0
- package/src/page-target/intent-map.ts +137 -0
- package/src/page-target/intent-schema.ts +711 -0
- package/src/page-target/origin.ts +17 -0
- package/src/page-target/target.ts +450 -0
- package/src/page-target/writer-policy.ts +315 -0
- package/src/theme/block-theme.ts +202 -0
- package/src/theme/kit-theme-text.ts +2 -0
- package/src/theme/kit-theme.css +275 -0
- package/src/theme/kit-theme.tpl +275 -0
- package/src/theme/theme-tokens.ts +135 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// OpsReleaseReadinessCard:发布就绪卡(accept: single)。包一层内置 Checklist。
|
|
2
|
+
//
|
|
3
|
+
// 数据:{ release, version?, status?, tone?, items: [{ id, label, done?, status?, note? }] }(键名可由 map 改写)。
|
|
4
|
+
// 呈现:标题 =「发布名 版本」,检查项交给 Checklist(done / blocked / pending,blocked 显式写原因)。
|
|
5
|
+
// 结论位:数据给了 status 就用它;没给时按固定规则取——有 blocked 条目 -> 「已阻塞」(danger),全部 done -> 「可发布」(success),否则「待完成」(warning)。
|
|
6
|
+
// 文案可由 blocked_text / ready_text / pending_text 改。勾选抛 toggle / change,底部动作 `actions` 抛 action { key };`readonly` 为真时只展示。
|
|
7
|
+
|
|
8
|
+
import type { SomaComponentDefinition } from 'soma-core';
|
|
9
|
+
import { createChecklist, checkItemsOf } from '../../src/data/checklist';
|
|
10
|
+
import { list } from '../shared/card-util';
|
|
11
|
+
import { mapKeys, rec, tone, txt, wrapBuiltin, type PackProps } from '../shared/wrap';
|
|
12
|
+
import { packLabel } from '../shared/card-util';
|
|
13
|
+
import './texts';
|
|
14
|
+
|
|
15
|
+
const L = (p: PackProps, key: string): string => packLabel('ops.release_readiness', p, key);
|
|
16
|
+
|
|
17
|
+
export const OPS_RELEASE_DEFAULT_MAP = Object.freeze({
|
|
18
|
+
release: 'release', version: 'version', status: 'status', tone: 'tone', items: 'items',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export function releaseReadinessCardProps(p: PackProps): PackProps {
|
|
22
|
+
const m = mapKeys(OPS_RELEASE_DEFAULT_MAP, p.map);
|
|
23
|
+
const d = rec(p.data);
|
|
24
|
+
const states = checkItemsOf(d[m.items], p.item_map, txt(p.no_reason_text)).map((i) => i.status);
|
|
25
|
+
const given = txt(d[m.status]);
|
|
26
|
+
let status = given;
|
|
27
|
+
let t = tone(d[m.tone], 'neutral');
|
|
28
|
+
if (given === '') {
|
|
29
|
+
if (states.includes('blocked')) { status = txt(p.blocked_text); t = 'danger'; }
|
|
30
|
+
else if (states.length > 0 && states.every((s) => s === 'done')) { status = L(p, 'ready_text'); t = 'success'; }
|
|
31
|
+
else { status = L(p, 'pending_text'); t = 'warning'; }
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
data: {
|
|
35
|
+
title: [txt(d[m.release]), txt(d[m.version])].filter((s) => s !== '').join(' '),
|
|
36
|
+
status,
|
|
37
|
+
tone: t,
|
|
38
|
+
items: list(d[m.items]),
|
|
39
|
+
actions: list(p.actions),
|
|
40
|
+
},
|
|
41
|
+
map: {},
|
|
42
|
+
item_map: rec(p.item_map),
|
|
43
|
+
readonly: p.readonly === true || p.readonly === 'true',
|
|
44
|
+
no_reason_text: txt(p.no_reason_text),
|
|
45
|
+
blocked_text: txt(p.blocked_text),
|
|
46
|
+
empty_text: txt(p.empty_text),
|
|
47
|
+
class: txt(p.class),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function createOpsReleaseReadinessCard(): SomaComponentDefinition {
|
|
52
|
+
return wrapBuiltin(createChecklist(), {
|
|
53
|
+
name: 'OpsReleaseReadinessCard',
|
|
54
|
+
props: {
|
|
55
|
+
data: { type: 'object', default: {}, desc: '一次发布 { release, version?, status?, tone?, items[{ id, label, done?, status?, note? }] }' },
|
|
56
|
+
map: { type: 'object', default: {}, desc: '键名对照:release / version / status / tone / items' },
|
|
57
|
+
actions: { type: 'array', default: [], desc: '底部动作 [{ key, label, tone?, disabled? }],点击抛 action { key }' },
|
|
58
|
+
ready_text: { type: 'string', default: '', desc: '全部完成时的结论文字;空取包词条(随页面语言)' },
|
|
59
|
+
pending_text: { type: 'string', default: '', desc: '尚有未完成项时的结论文字;空取包词条(随页面语言)' },
|
|
60
|
+
},
|
|
61
|
+
adapt: releaseReadinessCardProps,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// OpsRunbookExecutionCard:Runbook 执行卡(accept: single)。包一层内置 ApprovalFlow(沿用其纵向步骤形态)。
|
|
2
|
+
//
|
|
3
|
+
// 数据:{ title, operator?, status?, steps: [{ id, name, executor?, status, time?, comment?, reason?, actions? }] }(键名可由 map 改写)。
|
|
4
|
+
// 步骤状态按固定表映射到 ApprovalFlow 的八档:pending -> pending,running -> current,done / success -> approved,failed -> rejected,
|
|
5
|
+
// skipped / blocked / returned / withdrawn 原样,其余一律 pending。步骤动作 `actions` 抛 step_action { key, step },底部动作 `actions` 抛 action { key }。
|
|
6
|
+
// 只展示并上抛意图,执行与重试由页面处理。
|
|
7
|
+
|
|
8
|
+
import type { SomaComponentDefinition } from 'soma-core';
|
|
9
|
+
import { createApprovalFlow } from '../../src/data/approval-flow';
|
|
10
|
+
import { list } from '../shared/card-util';
|
|
11
|
+
import { mapKeys, rec, txt, wrapBuiltin, type PackProps } from '../shared/wrap';
|
|
12
|
+
import { packLabel } from '../shared/card-util';
|
|
13
|
+
import './texts';
|
|
14
|
+
|
|
15
|
+
const L = (p: PackProps, key: string): string => packLabel('ops.runbook_execution', p, key);
|
|
16
|
+
|
|
17
|
+
export const OPS_RUNBOOK_DEFAULT_MAP = Object.freeze({
|
|
18
|
+
title: 'title', operator: 'operator', status: 'status', steps: 'steps',
|
|
19
|
+
});
|
|
20
|
+
export const OPS_RUNBOOK_STEP_DEFAULT_MAP = Object.freeze({
|
|
21
|
+
id: 'id', name: 'name', executor: 'executor', status: 'status', time: 'time', comment: 'comment', reason: 'reason', actions: 'actions',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const STATUS_TABLE: Readonly<Record<string, string>> = Object.freeze({
|
|
25
|
+
pending: 'pending', running: 'current', done: 'approved', success: 'approved', failed: 'rejected',
|
|
26
|
+
skipped: 'skipped', blocked: 'blocked', returned: 'returned', withdrawn: 'withdrawn',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export function runbookStatusOf(raw: unknown): string {
|
|
30
|
+
return STATUS_TABLE[txt(raw)] ?? 'pending';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function runbookExecutionCardProps(p: PackProps): PackProps {
|
|
34
|
+
const m = mapKeys(OPS_RUNBOOK_DEFAULT_MAP, p.map);
|
|
35
|
+
const sm = mapKeys(OPS_RUNBOOK_STEP_DEFAULT_MAP, p.step_map);
|
|
36
|
+
const d = rec(p.data);
|
|
37
|
+
const steps = list(d[m.steps]).map((s) => ({
|
|
38
|
+
id: s[sm.id],
|
|
39
|
+
name: s[sm.name],
|
|
40
|
+
approver: s[sm.executor],
|
|
41
|
+
status: runbookStatusOf(s[sm.status]),
|
|
42
|
+
time: s[sm.time],
|
|
43
|
+
comment: s[sm.comment],
|
|
44
|
+
reason: s[sm.reason],
|
|
45
|
+
actions: s[sm.actions],
|
|
46
|
+
}));
|
|
47
|
+
return {
|
|
48
|
+
data: {
|
|
49
|
+
title: txt(d[m.title]),
|
|
50
|
+
applicant: txt(d[m.operator]),
|
|
51
|
+
status: txt(d[m.status]),
|
|
52
|
+
steps,
|
|
53
|
+
actions: list(p.actions),
|
|
54
|
+
},
|
|
55
|
+
map: {},
|
|
56
|
+
step_map: {},
|
|
57
|
+
selectable: p.selectable === true || p.selectable === 'true',
|
|
58
|
+
labels: rec(p.labels),
|
|
59
|
+
applicant_label: L(p, 'operator_label'),
|
|
60
|
+
no_reason_text: txt(p.no_reason_text),
|
|
61
|
+
time_format: txt(p.time_format),
|
|
62
|
+
locale: txt(p.locale),
|
|
63
|
+
empty_text: L(p, 'empty_text'),
|
|
64
|
+
class: txt(p.class),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function createOpsRunbookExecutionCard(): SomaComponentDefinition {
|
|
69
|
+
return wrapBuiltin(createApprovalFlow(), {
|
|
70
|
+
name: 'OpsRunbookExecutionCard',
|
|
71
|
+
props: {
|
|
72
|
+
data: { type: 'object', default: {}, desc: '一次 Runbook 执行 { title, operator?, status?, steps[{ id, name, executor?, status, time?, comment?, reason?, actions? }] }' },
|
|
73
|
+
map: { type: 'object', default: {}, desc: '键名对照:title / operator / status / steps' },
|
|
74
|
+
step_map: { type: 'object', default: {}, desc: '步骤层键名对照:id / name / executor / status / time / comment / reason / actions' },
|
|
75
|
+
actions: { type: 'array', default: [], desc: '底部动作 [{ key, label, tone?, disabled? }],点击抛 action { key }' },
|
|
76
|
+
operator_label: { type: 'string', default: '', desc: '执行人前缀文案;空取包词条(随页面语言)' },
|
|
77
|
+
empty_text: { type: 'string', default: '', desc: '没有步骤时的文案;空取包词条(随页面语言)' },
|
|
78
|
+
},
|
|
79
|
+
adapt: runbookExecutionCardProps,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// 运维包词条表(zh-CN / en):契约默认文案为空串,空串时回退到这里。键形 pack.<包>.<卡片>.<prop 名>。
|
|
2
|
+
import { defineKitPackTexts } from '../../src/i18n/kit-text';
|
|
3
|
+
|
|
4
|
+
defineKitPackTexts({
|
|
5
|
+
'pack.ops.change_window.window_label': { 'zh-CN': '变更窗口', en: 'Change window' },
|
|
6
|
+
'pack.ops.change_window.done_text': { 'zh-CN': '已完成', en: 'Done' },
|
|
7
|
+
'pack.ops.change_window.pending_text': { 'zh-CN': '未完成', en: 'Not done' },
|
|
8
|
+
'pack.ops.error_budget.slo_label': { 'zh-CN': '目标 SLO', en: 'SLO target' },
|
|
9
|
+
'pack.ops.error_budget.consumed_label': { 'zh-CN': '已消耗', en: 'Consumed' },
|
|
10
|
+
'pack.ops.error_budget.remaining_label': { 'zh-CN': '剩余', en: 'Remaining' },
|
|
11
|
+
'pack.ops.error_budget.incidents_label': { 'zh-CN': '事件数', en: 'Incidents' },
|
|
12
|
+
'pack.ops.release_readiness.ready_text': { 'zh-CN': '可发布', en: 'Ready to release' },
|
|
13
|
+
'pack.ops.release_readiness.pending_text': { 'zh-CN': '待完成', en: 'Pending' },
|
|
14
|
+
'pack.ops.execution_task_runner.started_label': { 'zh-CN': '开始时间', en: 'Started' },
|
|
15
|
+
'pack.ops.dependency_status.version_label': { 'zh-CN': '版本', en: 'Version' },
|
|
16
|
+
'pack.ops.dependency_status.latency_label': { 'zh-CN': '延迟', en: 'Latency' },
|
|
17
|
+
'pack.ops.dependency_status.checked_label': { 'zh-CN': '最近检查', en: 'Last checked' },
|
|
18
|
+
'pack.ops.integration_status.sync_label': { 'zh-CN': '最近同步', en: 'Last sync' },
|
|
19
|
+
'pack.ops.runbook_execution.operator_label': { 'zh-CN': '执行人', en: 'Operator' },
|
|
20
|
+
'pack.ops.runbook_execution.empty_text': { 'zh-CN': '暂无执行步骤', en: 'No steps yet' },
|
|
21
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// SecurityControlEvidenceCard:控制证据卡(accept: single)。包一层内置 Checklist。
|
|
2
|
+
//
|
|
3
|
+
// 数据:{ control, source?, period_start?, period_end?, conclusion?, tone?, items?: [{ id, label, done?, status?, note? }] }(键名可由 map 改写)。
|
|
4
|
+
// 呈现:标题 =「控制项 · 来源 · 覆盖期」(给了的部分用「 · 」连接,覆盖期是「起 ~ 止」原样),结论位 = conclusion;
|
|
5
|
+
// 证据条目交给 Checklist(done / blocked / pending,blocked 显式写原因)。默认只读(`readonly` 缺省 true),底部动作 `actions` 抛 action { key }。
|
|
6
|
+
|
|
7
|
+
import type { SomaComponentDefinition } from 'soma-core';
|
|
8
|
+
import { createChecklist } from '../../src/data/checklist';
|
|
9
|
+
import { list } from '../shared/card-util';
|
|
10
|
+
import { mapKeys, rec, txt, wrapBuiltin, type PackProps } from '../shared/wrap';
|
|
11
|
+
import { packLabel } from '../shared/card-util';
|
|
12
|
+
import './texts';
|
|
13
|
+
|
|
14
|
+
export const SECURITY_EVIDENCE_DEFAULT_MAP = Object.freeze({
|
|
15
|
+
control: 'control', source: 'source', period_start: 'period_start', period_end: 'period_end', conclusion: 'conclusion', tone: 'tone', items: 'items',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export function controlEvidenceCardProps(p: PackProps): PackProps {
|
|
19
|
+
const m = mapKeys(SECURITY_EVIDENCE_DEFAULT_MAP, p.map);
|
|
20
|
+
const d = rec(p.data);
|
|
21
|
+
const from = txt(d[m.period_start]);
|
|
22
|
+
const to = txt(d[m.period_end]);
|
|
23
|
+
const period = from !== '' || to !== '' ? [from, to].filter((s) => s !== '').join(' ~ ') : '';
|
|
24
|
+
return {
|
|
25
|
+
data: {
|
|
26
|
+
title: [txt(d[m.control]), txt(d[m.source]), period].filter((s) => s !== '').join(' · '),
|
|
27
|
+
status: txt(d[m.conclusion]),
|
|
28
|
+
tone: d[m.tone],
|
|
29
|
+
items: list(d[m.items]),
|
|
30
|
+
actions: list(p.actions),
|
|
31
|
+
},
|
|
32
|
+
map: {},
|
|
33
|
+
item_map: rec(p.item_map),
|
|
34
|
+
readonly: p.readonly !== false && p.readonly !== 'false',
|
|
35
|
+
no_reason_text: txt(p.no_reason_text),
|
|
36
|
+
blocked_text: txt(p.blocked_text),
|
|
37
|
+
empty_text: packLabel('security.control_evidence', p, 'empty_text'),
|
|
38
|
+
class: txt(p.class),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function createSecurityControlEvidenceCard(): SomaComponentDefinition {
|
|
43
|
+
return wrapBuiltin(createChecklist(), {
|
|
44
|
+
name: 'SecurityControlEvidenceCard',
|
|
45
|
+
props: {
|
|
46
|
+
data: { type: 'object', default: {}, desc: '一项控制的证据 { control, source?, period_start?, period_end?, conclusion?, tone?, items?[{ id, label, done?, status?, note? }] }' },
|
|
47
|
+
map: { type: 'object', default: {}, desc: '键名对照:control / source / period_start / period_end / conclusion / tone / items' },
|
|
48
|
+
actions: { type: 'array', default: [], desc: '底部动作 [{ key, label, tone?, disabled? }],点击抛 action { key }' },
|
|
49
|
+
readonly: { type: 'boolean', default: true, desc: '只展示,不可勾选(证据默认只读)' },
|
|
50
|
+
empty_text: { type: 'string', default: '', desc: '没有证据条目时的文案;空取包词条(随页面语言)' },
|
|
51
|
+
},
|
|
52
|
+
adapt: controlEvidenceCardProps,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// FindingCard 壳:合规 / 安全「发现类」卡共用的一份实现,包一层内置 RecordCard(accept: single)。
|
|
2
|
+
// 对外是四个组件名(同一壳、不同默认文案):
|
|
3
|
+
// SecurityAccessReviewCard(权限复核)、SecurityRiskFindingCard(风险发现)、SecurityFindingCard(安全发现)、
|
|
4
|
+
// SecurityVulnerabilityRemediationCard(漏洞整改)。
|
|
5
|
+
//
|
|
6
|
+
// 数据:{ id?, title, severity?, status?, tone?, asset?, owner?, found_at?, due_at?, summary?, tags?: string[] }(键名可由 map 改写)。
|
|
7
|
+
// 呈现:标题 = title,副标题 = id,状态位 = status;事实 = 对象 / 负责人 / 发现时间 / 期限 / 说明(标签文案随四种默认值不同,页面可用 *_label 覆盖);
|
|
8
|
+
// 标签 = 严重度(severity 原样)在前,tags 在后;左侧语气色细条。
|
|
9
|
+
// 语气:数据给了 tone 就用它;否则按严重度固定表——critical / high -> danger,medium -> warning,low -> info,其他 neutral。
|
|
10
|
+
// 动作位 `actions` 抛 action { key },`selectable` 抛 select { item }。
|
|
11
|
+
|
|
12
|
+
import type { SomaComponentDefinition } from 'soma-core';
|
|
13
|
+
import { createRecordCard } from '../../src/data/record-card';
|
|
14
|
+
import { list, packLabel, pushFact, recordCardProps, strList } from '../shared/card-util';
|
|
15
|
+
import './texts';
|
|
16
|
+
import { mapKeys, rec, tone, txt, wrapBuiltin, type PackProps } from '../shared/wrap';
|
|
17
|
+
|
|
18
|
+
export const SECURITY_FINDING_DEFAULT_MAP = Object.freeze({
|
|
19
|
+
id: 'id', title: 'title', severity: 'severity', status: 'status', tone: 'tone', asset: 'asset', owner: 'owner',
|
|
20
|
+
found_at: 'found_at', due_at: 'due_at', summary: 'summary', tags: 'tags',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const SEVERITY_TONE: Readonly<Record<string, string>> = Object.freeze({
|
|
24
|
+
critical: 'danger', high: 'danger', medium: 'warning', low: 'info',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export function findingToneOf(severity: unknown, given: unknown): string {
|
|
28
|
+
return tone(given, SEVERITY_TONE[txt(severity).toLowerCase()] ?? 'neutral');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 四个组件名 -> 词条卡片段(pack.security.<段>.<prop 名>) */
|
|
32
|
+
const FINDING_TEXT_SCOPE: Readonly<Record<string, string>> = Object.freeze({
|
|
33
|
+
SecurityAccessReviewCard: 'security.access_review',
|
|
34
|
+
SecurityRiskFindingCard: 'security.risk_finding',
|
|
35
|
+
SecurityFindingCard: 'security.finding',
|
|
36
|
+
SecurityVulnerabilityRemediationCard: 'security.vulnerability_remediation',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/** scope 缺省按「安全发现」那一套文案 */
|
|
40
|
+
export function findingCardProps(p: PackProps, scope = 'security.finding'): PackProps {
|
|
41
|
+
const m = mapKeys(SECURITY_FINDING_DEFAULT_MAP, p.map);
|
|
42
|
+
const d = rec(p.data);
|
|
43
|
+
const severity = txt(d[m.severity]);
|
|
44
|
+
const facts: PackProps[] = [];
|
|
45
|
+
pushFact(facts, packLabel(scope, p, 'asset_label'), d[m.asset]);
|
|
46
|
+
pushFact(facts, packLabel(scope, p, 'owner_label'), d[m.owner]);
|
|
47
|
+
pushFact(facts, packLabel(scope, p, 'found_label'), d[m.found_at]);
|
|
48
|
+
pushFact(facts, packLabel(scope, p, 'due_label'), d[m.due_at]);
|
|
49
|
+
pushFact(facts, packLabel(scope, p, 'summary_label'), d[m.summary]);
|
|
50
|
+
return recordCardProps(p, {
|
|
51
|
+
title: txt(d[m.title]),
|
|
52
|
+
subtitle: txt(d[m.id]),
|
|
53
|
+
status: txt(d[m.status]),
|
|
54
|
+
tone: findingToneOf(severity, d[m.tone]),
|
|
55
|
+
facts,
|
|
56
|
+
tags: [...(severity !== '' ? [severity] : []), ...strList(d[m.tags])],
|
|
57
|
+
actions: list(p.actions),
|
|
58
|
+
}, true);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface FindingLabels {
|
|
62
|
+
asset: string;
|
|
63
|
+
owner: string;
|
|
64
|
+
found: string;
|
|
65
|
+
due: string;
|
|
66
|
+
summary: string;
|
|
67
|
+
desc: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** 四个组件名对应的默认文案与说明(同一壳,只有这里不同) */
|
|
71
|
+
export const SECURITY_FINDING_KINDS = Object.freeze({
|
|
72
|
+
SecurityAccessReviewCard: { asset: '复核对象', owner: '复核人', found: '发起时间', due: '复核期限', summary: '复核说明', desc: '权限复核卡:对象 / 复核人 / 期限' },
|
|
73
|
+
SecurityRiskFindingCard: { asset: '风险对象', owner: '责任人', found: '识别时间', due: '处置期限', summary: '风险说明', desc: '风险发现卡:对象 / 责任人 / 期限' },
|
|
74
|
+
SecurityFindingCard: { asset: '受影响资产', owner: '负责人', found: '发现时间', due: '处置期限', summary: '说明', desc: '安全发现卡:资产 / 负责人 / 期限' },
|
|
75
|
+
SecurityVulnerabilityRemediationCard: { asset: '受影响组件', owner: '整改负责人', found: '披露时间', due: '整改期限', summary: '整改措施', desc: '漏洞整改卡:组件 / 负责人 / 整改期限' },
|
|
76
|
+
} satisfies Record<string, FindingLabels>);
|
|
77
|
+
|
|
78
|
+
export type SecurityFindingKind = keyof typeof SECURITY_FINDING_KINDS;
|
|
79
|
+
|
|
80
|
+
export function createSecurityFindingCard(name: SecurityFindingKind): SomaComponentDefinition {
|
|
81
|
+
const l = SECURITY_FINDING_KINDS[name];
|
|
82
|
+
return wrapBuiltin(createRecordCard(), {
|
|
83
|
+
name,
|
|
84
|
+
props: {
|
|
85
|
+
data: { type: 'object', default: {}, desc: '一条发现 { id?, title, severity?, status?, tone?, asset?, owner?, found_at?, due_at?, summary?, tags? }' },
|
|
86
|
+
map: { type: 'object', default: {}, desc: '键名对照:id / title / severity / status / tone / asset / owner / found_at / due_at / summary / tags' },
|
|
87
|
+
actions: { type: 'array', default: [], desc: '底部动作 [{ key, label, tone?, disabled? }],点击抛 action { key }' },
|
|
88
|
+
asset_label: { type: 'string', default: '', desc: `对象事实行的标签;空取包词条(随页面语言,默认「${l.asset}」)` },
|
|
89
|
+
owner_label: { type: 'string', default: '', desc: `负责人事实行的标签;空取包词条(随页面语言,默认「${l.owner}」)` },
|
|
90
|
+
found_label: { type: 'string', default: '', desc: `发现时间事实行的标签;空取包词条(随页面语言,默认「${l.found}」)` },
|
|
91
|
+
due_label: { type: 'string', default: '', desc: `期限事实行的标签;空取包词条(随页面语言,默认「${l.due}」)` },
|
|
92
|
+
summary_label: { type: 'string', default: '', desc: `说明事实行的标签;空取包词条(随页面语言,默认「${l.summary}」)` },
|
|
93
|
+
},
|
|
94
|
+
adapt: (p: PackProps) => findingCardProps(p, FINDING_TEXT_SCOPE[name] ?? 'security.finding'),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// 合规 / 安全领域包:权限复核、风险发现、安全发现、漏洞整改(四张共用 FindingCard 壳)+ 控制证据。
|
|
2
|
+
// 五张卡都是包一层内置件(RecordCard / Checklist)的写死形状数据组件(accept: single),不另写底层交互。
|
|
3
|
+
// 应用登记:`defineKitApp({ packs: [securityPack] })`。
|
|
4
|
+
|
|
5
|
+
import { defineKitPack } from '../../src/app/define-kit-pack';
|
|
6
|
+
import { createSecurityControlEvidenceCard } from './control-evidence-card';
|
|
7
|
+
import { createSecurityFindingCard, SECURITY_FINDING_KINDS } from './finding-card';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
createSecurityFindingCard, findingCardProps, findingToneOf, SECURITY_FINDING_DEFAULT_MAP, SECURITY_FINDING_KINDS,
|
|
11
|
+
} from './finding-card';
|
|
12
|
+
export type { SecurityFindingKind, FindingLabels } from './finding-card';
|
|
13
|
+
export { createSecurityControlEvidenceCard, controlEvidenceCardProps, SECURITY_EVIDENCE_DEFAULT_MAP } from './control-evidence-card';
|
|
14
|
+
|
|
15
|
+
export const securityPack = defineKitPack({
|
|
16
|
+
name: 'security',
|
|
17
|
+
staticComponents: {
|
|
18
|
+
SecurityAccessReviewCard: { define: () => createSecurityFindingCard('SecurityAccessReviewCard'), accept: 'single', desc: SECURITY_FINDING_KINDS.SecurityAccessReviewCard.desc },
|
|
19
|
+
SecurityRiskFindingCard: { define: () => createSecurityFindingCard('SecurityRiskFindingCard'), accept: 'single', desc: SECURITY_FINDING_KINDS.SecurityRiskFindingCard.desc },
|
|
20
|
+
SecurityFindingCard: { define: () => createSecurityFindingCard('SecurityFindingCard'), accept: 'single', desc: SECURITY_FINDING_KINDS.SecurityFindingCard.desc },
|
|
21
|
+
SecurityVulnerabilityRemediationCard: {
|
|
22
|
+
define: () => createSecurityFindingCard('SecurityVulnerabilityRemediationCard'),
|
|
23
|
+
accept: 'single',
|
|
24
|
+
desc: SECURITY_FINDING_KINDS.SecurityVulnerabilityRemediationCard.desc,
|
|
25
|
+
},
|
|
26
|
+
SecurityControlEvidenceCard: { define: createSecurityControlEvidenceCard, accept: 'single', desc: '控制证据卡:控制项 / 来源 / 覆盖期 / 证据清单' },
|
|
27
|
+
},
|
|
28
|
+
// 每张卡都 wrapBuiltin 内置件(RecordCard / Checklist):底层类随包装元数据按页并入,不再整包并入每页
|
|
29
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// 安全包词条表(zh-CN / en):契约默认文案为空串,空串时回退到这里。键形 pack.<包>.<卡片>.<prop 名>。
|
|
2
|
+
// 发现类卡共用一个壳、四个组件名,默认文案按组件名分表(卡片段 = 组件名的 snake 形)。
|
|
3
|
+
import { defineKitPackTexts } from '../../src/i18n/kit-text';
|
|
4
|
+
|
|
5
|
+
defineKitPackTexts({
|
|
6
|
+
'pack.security.control_evidence.empty_text': { 'zh-CN': '暂无证据', en: 'No evidence yet' },
|
|
7
|
+
|
|
8
|
+
'pack.security.access_review.asset_label': { 'zh-CN': '复核对象', en: 'Review target' },
|
|
9
|
+
'pack.security.access_review.owner_label': { 'zh-CN': '复核人', en: 'Reviewer' },
|
|
10
|
+
'pack.security.access_review.found_label': { 'zh-CN': '发起时间', en: 'Initiated' },
|
|
11
|
+
'pack.security.access_review.due_label': { 'zh-CN': '复核期限', en: 'Review due' },
|
|
12
|
+
'pack.security.access_review.summary_label': { 'zh-CN': '复核说明', en: 'Review notes' },
|
|
13
|
+
|
|
14
|
+
'pack.security.risk_finding.asset_label': { 'zh-CN': '风险对象', en: 'Risk target' },
|
|
15
|
+
'pack.security.risk_finding.owner_label': { 'zh-CN': '责任人', en: 'Owner' },
|
|
16
|
+
'pack.security.risk_finding.found_label': { 'zh-CN': '识别时间', en: 'Identified' },
|
|
17
|
+
'pack.security.risk_finding.due_label': { 'zh-CN': '处置期限', en: 'Remediation due' },
|
|
18
|
+
'pack.security.risk_finding.summary_label': { 'zh-CN': '风险说明', en: 'Risk notes' },
|
|
19
|
+
|
|
20
|
+
'pack.security.finding.asset_label': { 'zh-CN': '受影响资产', en: 'Affected asset' },
|
|
21
|
+
'pack.security.finding.owner_label': { 'zh-CN': '负责人', en: 'Owner' },
|
|
22
|
+
'pack.security.finding.found_label': { 'zh-CN': '发现时间', en: 'Found' },
|
|
23
|
+
'pack.security.finding.due_label': { 'zh-CN': '处置期限', en: 'Remediation due' },
|
|
24
|
+
'pack.security.finding.summary_label': { 'zh-CN': '说明', en: 'Summary' },
|
|
25
|
+
|
|
26
|
+
'pack.security.vulnerability_remediation.asset_label': { 'zh-CN': '受影响组件', en: 'Affected component' },
|
|
27
|
+
'pack.security.vulnerability_remediation.owner_label': { 'zh-CN': '整改负责人', en: 'Remediation owner' },
|
|
28
|
+
'pack.security.vulnerability_remediation.found_label': { 'zh-CN': '披露时间', en: 'Disclosed' },
|
|
29
|
+
'pack.security.vulnerability_remediation.due_label': { 'zh-CN': '整改期限', en: 'Fix due' },
|
|
30
|
+
'pack.security.vulnerability_remediation.summary_label': { 'zh-CN': '整改措施', en: 'Remediation' },
|
|
31
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// 领域包的卡片适配小件:事实行、进度换算、RecordCard 通用外层 props。全部是纯函数。
|
|
2
|
+
|
|
3
|
+
import { list, txt, type PackProps } from './wrap';
|
|
4
|
+
import { kitPackText } from '../../src/i18n/kit-text';
|
|
5
|
+
|
|
6
|
+
/** 值是否算「给了」:undefined / null / 空串视为没给 */
|
|
7
|
+
export function has(raw: unknown): boolean {
|
|
8
|
+
return raw !== undefined && raw !== null && raw !== '';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function numOf(raw: unknown): number | null {
|
|
12
|
+
if (!has(raw)) return null;
|
|
13
|
+
const n = typeof raw === 'number' ? raw : Number(raw);
|
|
14
|
+
return Number.isFinite(n) ? n : null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** 字符串数组:数组元素转文本并丢弃空串;不是数组返回空数组 */
|
|
18
|
+
export function strList(raw: unknown): string[] {
|
|
19
|
+
return Array.isArray(raw) ? raw.map((v) => txt(v)).filter((s) => s !== '') : [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** 给了值才追加一行事实 */
|
|
23
|
+
export function pushFact(facts: PackProps[], label: unknown, value: unknown, format = ''): void {
|
|
24
|
+
if (!has(value)) return;
|
|
25
|
+
facts.push(format !== '' ? { label: txt(label), value, format } : { label: txt(label), value });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** 百分比换算(展示用,夹在 0–100);total 不大于 0 返回 undefined */
|
|
29
|
+
export function percentOf(part: number, total: number): number | undefined {
|
|
30
|
+
if (!(total > 0)) return undefined;
|
|
31
|
+
return Math.min(100, Math.max(0, (part / total) * 100));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function bool(raw: unknown): boolean {
|
|
35
|
+
return raw === true || raw === 'true';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 卡片数据 -> 内置 RecordCard 的完整 props(data 已是 RecordCard 形状,map / fields 置空) */
|
|
39
|
+
export function recordCardProps(p: PackProps, data: PackProps, rail = false): PackProps {
|
|
40
|
+
return {
|
|
41
|
+
data,
|
|
42
|
+
map: {},
|
|
43
|
+
fields: [],
|
|
44
|
+
rail,
|
|
45
|
+
selectable: bool(p.selectable),
|
|
46
|
+
locale: txt(p.locale),
|
|
47
|
+
class: txt(p.class),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { list };
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 领域包默认文案:页面给了 prop 就用页面的;没给(契约默认值是空串)回退到该包登记的词条
|
|
55
|
+
* `pack.<scope>.<prop 名>`(scope = `<包>.<卡片>`),语言取自 prop `locale`(空 = zh-CN)。
|
|
56
|
+
*/
|
|
57
|
+
export function packLabel(scope: string, p: PackProps, key: string): string {
|
|
58
|
+
const own = txt(p[key]);
|
|
59
|
+
return own !== '' ? own : kitPackText(`pack.${scope}.${key}`, txt(p.locale));
|
|
60
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "soma-kit/kit-app.schema.json",
|
|
4
|
+
"title": "soma-kit 应用配置(kit.app.yaml)",
|
|
5
|
+
"description": "键闭集对应 src/app/app-config.ts;勿手改,重新生成:npm run schema:build -w soma-kit",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"style": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "主题头文件路径(相对应用根);缺省用内置 kit-theme.css"
|
|
12
|
+
},
|
|
13
|
+
"envelope": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"description": "业务信封约定:failWhen 命中即业务失败(编进 core 的 failWhen);messagePath 失败文案位置;dataPath 成功数据位置",
|
|
17
|
+
"properties": {
|
|
18
|
+
"failWhen": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"description": "闭集谓词 { field, op, value } 或 all_of / any_of / none_of"
|
|
21
|
+
},
|
|
22
|
+
"messagePath": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "失败时业务文案在响应里的点路径(须与 failWhen 一起写)"
|
|
25
|
+
},
|
|
26
|
+
"dataPath": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "成功时数据在响应里的点路径(缺省不拆)"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"theme": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"additionalProperties": false,
|
|
35
|
+
"description": "主题声明,交 soma-foundation 求解令牌",
|
|
36
|
+
"properties": {
|
|
37
|
+
"palette_scheme": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"font_scheme": {
|
|
41
|
+
"type": "string"
|
|
42
|
+
},
|
|
43
|
+
"color": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"mode": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"baseComponents": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"description": "应用扩展的基础组件:App 开头的名字 -> 说明",
|
|
54
|
+
"propertyNames": {
|
|
55
|
+
"pattern": "^App[A-Z][A-Za-z0-9]*$"
|
|
56
|
+
},
|
|
57
|
+
"additionalProperties": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"staticObjectComponents": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"description": "应用扩展的写死形状数据组件:App 开头的名字 -> { accept, desc }",
|
|
64
|
+
"propertyNames": {
|
|
65
|
+
"pattern": "^App[A-Z][A-Za-z0-9]*$"
|
|
66
|
+
},
|
|
67
|
+
"additionalProperties": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"additionalProperties": false,
|
|
70
|
+
"properties": {
|
|
71
|
+
"accept": {
|
|
72
|
+
"enum": [
|
|
73
|
+
"single",
|
|
74
|
+
"list"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"desc": {
|
|
78
|
+
"type": "string"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|