nx-kv 0.48.0 → 0.48.2
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/CHANGELOG.md +43 -0
- package/package.json +1 -1
- package/src/modules/auth/actions/auth-login.ts +13 -6
- package/src/modules/auth/actions/auth-logout.ts +11 -6
- package/src/modules/auth/actions/auth-me.ts +11 -6
- package/src/modules/auth/actions/auth-status.ts +11 -6
- package/src/modules/bundled/actions/bundled-get.ts +14 -6
- package/src/modules/bundled/actions/bundled-groups.ts +11 -6
- package/src/modules/bundled/actions/bundled-install.ts +15 -6
- package/src/modules/bundled/actions/bundled-list.ts +11 -6
- package/src/modules/db/actions/db-backup.ts +12 -6
- package/src/modules/db/actions/db-migrate.ts +12 -6
- package/src/modules/db/actions/db-status.ts +11 -6
- package/src/modules/db/actions/db-verify.ts +11 -6
- package/src/modules/docs/actions/doc-add.ts +14 -6
- package/src/modules/docs/actions/doc-attach-note.ts +13 -6
- package/src/modules/docs/actions/doc-attach.ts +20 -6
- package/src/modules/docs/actions/doc-attachments.ts +11 -6
- package/src/modules/docs/actions/doc-detach.ts +13 -6
- package/src/modules/docs/actions/doc-get.ts +11 -6
- package/src/modules/docs/actions/doc-list.ts +11 -6
- package/src/modules/docs/actions/doc-remove.ts +11 -6
- package/src/modules/docs/actions/doc-update.ts +14 -6
- package/src/modules/docs/actions/docs-bind.ts +15 -6
- package/src/modules/docs/actions/docs-index.ts +11 -6
- package/src/modules/docs/actions/docs-link.ts +16 -6
- package/src/modules/docs/actions/docs-notebind.ts +15 -6
- package/src/modules/docs/actions/docs-seed.ts +11 -6
- package/src/modules/file/actions/file-content.ts +18 -10
- package/src/modules/file/actions/file-get.ts +12 -6
- package/src/modules/file/actions/file-list.ts +13 -6
- package/src/modules/file/actions/file-orphans.ts +11 -6
- package/src/modules/file/actions/file-prune.ts +12 -6
- package/src/modules/file/actions/file-remove.ts +12 -6
- package/src/modules/file/actions/file-sync.ts +15 -6
- package/src/modules/file/actions/file-upload.ts +17 -6
- package/src/modules/localtask/actions/localtask-add.ts +26 -6
- package/src/modules/localtask/actions/localtask-attach-note.ts +15 -6
- package/src/modules/localtask/actions/localtask-attach.ts +24 -6
- package/src/modules/localtask/actions/localtask-attachments.ts +13 -6
- package/src/modules/localtask/actions/localtask-cancel.ts +12 -6
- package/src/modules/localtask/actions/localtask-cancelMany.ts +13 -6
- package/src/modules/localtask/actions/localtask-chain.ts +13 -6
- package/src/modules/localtask/actions/localtask-claim.ts +14 -6
- package/src/modules/localtask/actions/localtask-clone.ts +13 -6
- package/src/modules/localtask/actions/localtask-closeMany.ts +15 -6
- package/src/modules/localtask/actions/localtask-config.ts +23 -8
- package/src/modules/localtask/actions/localtask-detach.ts +15 -6
- package/src/modules/localtask/actions/localtask-done.ts +14 -6
- package/src/modules/localtask/actions/localtask-events.ts +19 -9
- package/src/modules/localtask/actions/localtask-fork.ts +13 -6
- package/src/modules/localtask/actions/localtask-get.ts +13 -6
- package/src/modules/localtask/actions/localtask-importRemote.ts +20 -9
- package/src/modules/localtask/actions/localtask-list.ts +11 -6
- package/src/modules/localtask/actions/localtask-presence.ts +11 -6
- package/src/modules/localtask/actions/localtask-preview.ts +15 -6
- package/src/modules/localtask/actions/localtask-prune.ts +12 -6
- package/src/modules/localtask/actions/localtask-remove.ts +14 -6
- package/src/modules/localtask/actions/localtask-removeMany.ts +14 -6
- package/src/modules/localtask/actions/localtask-reopen.ts +22 -7
- package/src/modules/localtask/actions/localtask-reorder.ts +17 -6
- package/src/modules/localtask/actions/localtask-task-restore.ts +13 -6
- package/src/modules/localtask/actions/localtask-timegoalLog.ts +13 -6
- package/src/modules/localtask/actions/localtask-topic-add.ts +12 -6
- package/src/modules/localtask/actions/localtask-topic-remove.ts +13 -6
- package/src/modules/localtask/actions/localtask-topic-removeMany.ts +14 -6
- package/src/modules/localtask/actions/localtask-update.ts +24 -6
- package/src/modules/localtask/actions/localtask-wait.ts +15 -6
- package/src/modules/localtask/actions/task-move.ts +23 -6
- package/src/modules/repos/actions/board-add.ts +12 -6
- package/src/modules/repos/actions/board-assign.ts +14 -6
- package/src/modules/repos/actions/board-export.ts +11 -6
- package/src/modules/repos/actions/board-get.ts +11 -6
- package/src/modules/repos/actions/board-import.ts +17 -7
- package/src/modules/repos/actions/board-list.ts +11 -6
- package/src/modules/repos/actions/board-note.ts +13 -6
- package/src/modules/repos/actions/board-prefix.ts +12 -6
- package/src/modules/repos/actions/board-prune.ts +13 -6
- package/src/modules/repos/actions/board-rekey.ts +13 -6
- package/src/modules/repos/actions/board-remove.ts +11 -6
- package/src/modules/repos/actions/board-update.ts +13 -6
- package/src/modules/repos/actions/repo-add.ts +19 -6
- package/src/modules/repos/actions/repo-bind-topics.ts +12 -6
- package/src/modules/repos/actions/repo-bind.ts +14 -6
- package/src/modules/repos/actions/repo-clone.ts +16 -6
- package/src/modules/repos/actions/repo-detect.ts +11 -6
- package/src/modules/repos/actions/repo-doc-add.ts +17 -6
- package/src/modules/repos/actions/repo-doc-list.ts +11 -6
- package/src/modules/repos/actions/repo-doc-remove.ts +12 -6
- package/src/modules/repos/actions/repo-export.ts +14 -6
- package/src/modules/repos/actions/repo-get.ts +11 -6
- package/src/modules/repos/actions/repo-import-diff.ts +12 -6
- package/src/modules/repos/actions/repo-import.ts +16 -6
- package/src/modules/repos/actions/repo-key-migrate.ts +11 -6
- package/src/modules/repos/actions/repo-key-refresh.ts +13 -6
- package/src/modules/repos/actions/repo-key-set.ts +13 -6
- package/src/modules/repos/actions/repo-knowledge.ts +12 -6
- package/src/modules/repos/actions/repo-list.ts +11 -6
- package/src/modules/repos/actions/repo-open.ts +11 -6
- package/src/modules/repos/actions/repo-ref-add.ts +15 -6
- package/src/modules/repos/actions/repo-ref-backfill.ts +12 -6
- package/src/modules/repos/actions/repo-ref-check.ts +11 -6
- package/src/modules/repos/actions/repo-ref-clone.ts +18 -6
- package/src/modules/repos/actions/repo-ref-note.ts +14 -6
- package/src/modules/repos/actions/repo-ref-of.ts +11 -6
- package/src/modules/repos/actions/repo-ref-sync.ts +12 -6
- package/src/modules/repos/actions/repo-remote-check.ts +12 -6
- package/src/modules/repos/actions/repo-remote-list.ts +11 -6
- package/src/modules/repos/actions/repo-remote-pick.ts +12 -6
- package/src/modules/repos/actions/repo-remote.ts +13 -6
- package/src/modules/repos/actions/repo-remove.ts +11 -6
- package/src/modules/repos/actions/repo-scan.ts +13 -6
- package/src/modules/repos/actions/repo-update.ts +23 -6
- package/src/modules/setting/actions/setting-get.ts +11 -6
- package/src/modules/setting/actions/setting-set.ts +14 -6
- package/src/modules/system/actions/bootstrap.ts +9 -7
- package/src/modules/system/actions/health.ts +8 -6
- package/src/modules/system/actions/routes.ts +13 -6
- package/src/modules/system/routes.ts +1 -1
- package/src/modules/tasktool/actions/timegoal-check.ts +13 -6
- package/src/modules/tasktool/actions/timegoal-clear.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-list.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-log.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-prune.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-set.ts +13 -6
- package/src/modules/tasktool/actions/timegoal-show.ts +12 -6
- package/src/modules/tasktool/actions/timegoal-update.ts +13 -6
- package/src/modules/templates/actions/templates-add.ts +19 -6
- package/src/modules/templates/actions/templates-default.ts +15 -6
- package/src/modules/templates/actions/templates-list.ts +13 -6
- package/src/modules/templates/actions/templates-remove.ts +11 -6
- package/src/modules/templates/actions/templates-update.ts +17 -6
- package/src/modules/todo/actions/group-add.ts +12 -6
- package/src/modules/todo/actions/group-current.ts +11 -6
- package/src/modules/todo/actions/group-get.ts +11 -6
- package/src/modules/todo/actions/group-list.ts +11 -6
- package/src/modules/todo/actions/group-members.ts +11 -6
- package/src/modules/todo/actions/group-remove.ts +11 -6
- package/src/modules/todo/actions/group-update.ts +13 -6
- package/src/modules/todo/actions/group-use.ts +11 -6
- package/src/modules/todo/actions/prompt-get.ts +12 -6
- package/src/modules/todo/actions/prompt-remove.ts +12 -6
- package/src/modules/todo/actions/prompt-set.ts +13 -6
- package/src/modules/todo/actions/todo-add.ts +13 -6
- package/src/modules/todo/actions/todo-archive.ts +12 -6
- package/src/modules/todo/actions/todo-attach.ts +19 -6
- package/src/modules/todo/actions/todo-attachments.ts +14 -6
- package/src/modules/todo/actions/todo-done.ts +15 -6
- package/src/modules/todo/actions/todo-freeze.ts +14 -6
- package/src/modules/todo/actions/todo-get.ts +14 -6
- package/src/modules/todo/actions/todo-list.ts +13 -6
- package/src/modules/todo/actions/todo-remove.ts +14 -6
- package/src/modules/todo/actions/todo-unfreeze.ts +14 -6
- package/src/modules/todo/actions/todo-update.ts +17 -6
- package/src/modules/todo/actions/topic-add.ts +12 -6
- package/src/modules/todo/actions/topic-list.ts +11 -6
- package/src/modules/todo/actions/topic-remove.ts +12 -6
- package/src/runtime/action-base.ts +41 -1
- package/src/runtime/action-decorator.ts +28 -13
- package/src/runtime/codegen.ts +26 -41
- package/src/runtime/registry.ts +2 -2
- package/src/web/frontend/api/client.generated.ts +550 -698
- package/src/web/frontend/page/cloud/api.ts +99 -0
- package/src/web/frontend/page/cloud/index.tsx +13 -32
- package/src/web/frontend/page/dag/api.ts +20 -0
- package/src/web/frontend/page/dag/index.tsx +2 -5
- package/src/web/frontend/page/dir/api.ts +135 -0
- package/src/web/frontend/page/dir/index.tsx +37 -57
- package/src/web/frontend/page/dir/task-actions.ts +39 -59
- package/src/web/frontend/page/dir/task-chain.ts +2 -2
- package/src/web/frontend/page/dir/task-feedback.ts +19 -23
- package/src/web/frontend/page/dir/task-goal.ts +3 -3
- package/src/web/frontend/page/dir/task.tsx +3 -3
- package/src/web/frontend/page/doc/api.ts +82 -0
- package/src/web/frontend/page/doc/index.tsx +29 -32
- package/src/web/frontend/page/group/api.ts +24 -0
- package/src/web/frontend/page/group/index.tsx +7 -16
- package/src/web/frontend/page/overview/api.ts +16 -0
- package/src/web/frontend/page/overview/index.tsx +2 -2
- package/src/web/frontend/page/progress/api.ts +20 -0
- package/src/web/frontend/page/progress/index.tsx +3 -6
- package/src/web/frontend/page/refs/api.ts +14 -0
- package/src/web/frontend/page/refs/index.tsx +2 -4
- package/src/web/frontend/page/repos/api.ts +197 -0
- package/src/web/frontend/page/repos/bind-modals.tsx +4 -7
- package/src/web/frontend/page/repos/board-admin.tsx +6 -6
- package/src/web/frontend/page/repos/doc-search-modal.tsx +4 -4
- package/src/web/frontend/page/repos/index.tsx +10 -14
- package/src/web/frontend/page/repos/pending-section.tsx +7 -13
- package/src/web/frontend/page/repos/ref-panel.tsx +9 -14
- package/src/web/frontend/page/repos/remote-modal.tsx +4 -28
- package/src/web/frontend/page/repos/repo-form-modal.tsx +4 -4
- package/src/web/frontend/page/settings/api.ts +29 -0
- package/src/web/frontend/page/settings/index.tsx +3 -3
- package/src/web/frontend/page/settings/prompt-templates-section.tsx +4 -4
- package/src/web/frontend/page/settings/sidebar-section.tsx +2 -2
- package/src/web/public/assets/Introduction-Du_dycft.js +6 -0
- package/src/web/public/assets/{bar-B9WWmCpt.js → bar-B52NTf_v.js} +1 -1
- package/src/web/public/assets/cloud-Droja_aT.js +3 -0
- package/src/web/public/assets/{composer-panel-ByezS8Xv.js → composer-panel-DpiU2h50.js} +1 -1
- package/src/web/public/assets/dag-Ca-wjIxQ.js +1 -0
- package/src/web/public/assets/{deleted-panel-BcbtctNF.js → deleted-panel-K9GgfR8t.js} +1 -1
- package/src/web/public/assets/dir-DacRpcBt.js +5 -0
- package/src/web/public/assets/group-TPuU-QVc.js +2 -0
- package/src/web/public/assets/{index-D8MvtVAm.js → index-BkLkooKe.js} +2 -2
- package/src/web/public/assets/{md-history-BqZvzWiD.js → md-history-0GBWw4qr.js} +1 -1
- package/src/web/public/assets/overview-B3kHI66i.js +1 -0
- package/src/web/public/assets/progress-CdhFz0Lz.js +3 -0
- package/src/web/public/assets/refs-BDxfuH6R.js +1 -0
- package/src/web/public/assets/repos-C8jRM7wS.js +15 -0
- package/src/web/public/assets/{route-crumb-CWVu80du.js → route-crumb-QvahotvN.js} +1 -1
- package/src/web/public/assets/settings-BBcdGLTc.js +1 -0
- package/src/web/public/assets/{status-tag-DRl9E2Os.js → status-tag-BheHByek.js} +1 -1
- package/src/web/public/assets/task-CUkQaLBZ.js +11 -0
- package/src/web/public/assets/task-utils-_JAWRAz6.js +12 -0
- package/src/web/public/assets/{templates-Df__0k-F.js → templates-CbRyW3PJ.js} +1 -1
- package/src/web/public/assets/{tool-bar-Cv7f6p4v.js → tool-bar-BAmT-BI-.js} +1 -1
- package/src/web/public/index.html +1 -1
- package/src/modules/auth/schemas.ts +0 -27
- package/src/modules/bundled/schemas.ts +0 -32
- package/src/modules/db/schemas.ts +0 -27
- package/src/modules/docs/schemas.ts +0 -107
- package/src/modules/file/schemas.ts +0 -61
- package/src/modules/localtask/schemas.ts +0 -310
- package/src/modules/repos/schemas.ts +0 -310
- package/src/modules/setting/schemas.ts +0 -18
- package/src/modules/system/schemas.ts +0 -29
- package/src/modules/tasktool/schemas.ts +0 -52
- package/src/modules/templates/schemas.ts +0 -50
- package/src/modules/todo/schemas.ts +0 -177
- package/src/web/public/assets/Introduction-aQCeCLrV.js +0 -6
- package/src/web/public/assets/cloud-C4b8SU7C.js +0 -3
- package/src/web/public/assets/dag-jvrjx4i7.js +0 -1
- package/src/web/public/assets/dir-B82XBb1J.js +0 -5
- package/src/web/public/assets/group-BPUOO_QM.js +0 -2
- package/src/web/public/assets/overview-DMihuyzh.js +0 -1
- package/src/web/public/assets/progress-D-rMgz3w.js +0 -3
- package/src/web/public/assets/refs-D21jmrn6.js +0 -1
- package/src/web/public/assets/repos-B94tMDGs.js +0 -15
- package/src/web/public/assets/settings-DgTt4JG5.js +0 -1
- package/src/web/public/assets/task-B2x5GoV3.js +0 -11
- package/src/web/public/assets/task-utils-By8gLpHY.js +0 -12
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
// doc.attach —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import { attachToDoc as _attachToDoc } from '../attach.js';
|
|
8
8
|
import { renderAttach as _renderAttach } from '../render.js';
|
|
9
9
|
const attachToDoc: any = _attachToDoc;
|
|
10
10
|
const renderAttach: any = _renderAttach;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** doc.attach 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
ref: z.string(),
|
|
15
|
+
path: z.string().optional().describe("本机文件路径(落本机附件仓)"),
|
|
16
|
+
fileId: z.string().optional().describe("已有附件 id"),
|
|
17
|
+
url: z.string().optional().describe("外部链接(http/https)"),
|
|
18
|
+
task: z.string().optional().describe("任务全局 id(kind=task)"),
|
|
19
|
+
doc: z.string().optional().describe("另一篇文档的 ref/path(kind=ref)"),
|
|
20
|
+
name: z.string().optional().describe("显示名(默认取文件名/原名)"),
|
|
21
|
+
note: z.string().optional().describe("附件区备注"),
|
|
22
|
+
noEmbed: z.boolean().optional().describe("只写 ref_attach(role=attach),不改正文"),
|
|
23
|
+
'no-embed': z.boolean().optional().describe("同 --noEmbed"),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export class DocAttachAction extends ActionBase<typeof input> {
|
|
13
27
|
@action({
|
|
14
28
|
id: 'doc.attach',
|
|
15
29
|
cli: ['docs', 'attach'],
|
|
16
30
|
http: ['POST', '/api/docs/attach'],
|
|
17
31
|
summary: '给文档挂资源:--path / --fileId / --url / --task / --doc 之一;默认追加进正文,--no-embed 只挂附件区(不写正文)',
|
|
18
32
|
args: ['ref'],
|
|
19
|
-
input
|
|
33
|
+
input,
|
|
20
34
|
render: renderAttach,
|
|
21
35
|
})
|
|
22
|
-
async
|
|
36
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
23
37
|
return (attachToDoc as any)(ctx);
|
|
24
38
|
}
|
|
25
39
|
}
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
// doc.attachments —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import { listDocAttachments as _listDocAttachments } from '../attach.js';
|
|
8
8
|
import { renderAttachments as _renderAttachments } from '../render.js';
|
|
9
9
|
const listDocAttachments: any = _listDocAttachments;
|
|
10
10
|
const renderAttachments: any = _renderAttachments;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** doc.attachments 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
ref: z.string(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class DocAttachmentsAction extends ActionBase<typeof input> {
|
|
13
18
|
@action({
|
|
14
19
|
id: 'doc.attachments',
|
|
15
20
|
cli: ['docs', 'attachments'],
|
|
16
21
|
http: ['GET', '/api/docs/attachments'],
|
|
17
22
|
summary: '这篇文档用了哪些资源(ref_attach:图片/文件/URL/内部 task、ref 引用)',
|
|
18
23
|
args: ['ref'],
|
|
19
|
-
input
|
|
24
|
+
input,
|
|
20
25
|
render: renderAttachments,
|
|
21
26
|
})
|
|
22
|
-
async
|
|
27
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
23
28
|
|
|
24
29
|
return listDocAttachments(ctx);
|
|
25
30
|
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
// doc.detach —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import { detachFromDoc as _detachFromDoc } from '../attach.js';
|
|
8
8
|
import { renderDetach as _renderDetach } from '../render.js';
|
|
9
9
|
const detachFromDoc: any = _detachFromDoc;
|
|
10
10
|
const renderDetach: any = _renderDetach;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** doc.detach 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
ref: z.string(),
|
|
15
|
+
attachment: z.string().describe("资源 id(见 docs attachments)"),
|
|
16
|
+
purge: z.boolean().optional().describe("连资源与字节一起删(仍被引用时拒绝)"),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export class DocDetachAction extends ActionBase<typeof input> {
|
|
13
20
|
@action({
|
|
14
21
|
id: 'doc.detach',
|
|
15
22
|
cli: ['docs', 'detach'],
|
|
16
23
|
http: ['DELETE', '/api/docs/attach'],
|
|
17
24
|
summary: '解除文档与附件的关系(默认只解除关系);--purge 无人引用时连资源行与本机字节一起删',
|
|
18
25
|
args: ['ref'],
|
|
19
|
-
input
|
|
26
|
+
input,
|
|
20
27
|
render: renderDetach,
|
|
21
28
|
})
|
|
22
|
-
async
|
|
29
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
23
30
|
return (detachFromDoc as any)(ctx);
|
|
24
31
|
}
|
|
25
32
|
}
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
// doc.get —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import { getDoc as _getDoc } from '../service.js';
|
|
8
8
|
import { renderGet as _renderGet } from '../render.js';
|
|
9
9
|
const getDoc: any = _getDoc;
|
|
10
10
|
const renderGet: any = _renderGet;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** doc.get 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
ref: z.string(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class DocGetAction extends ActionBase<typeof input> {
|
|
13
18
|
@action({
|
|
14
19
|
id: 'doc.get',
|
|
15
20
|
cli: ['docs', 'get'],
|
|
16
21
|
http: ['GET', '/api/docs/item'],
|
|
17
22
|
summary: '读文档全文:rel:<路径>(或裸相对路径)= 自有;path:<绝对路径> = 外部(须在绑定闭包内);约定路径缺失时惰性播种',
|
|
18
23
|
args: ['ref'],
|
|
19
|
-
input
|
|
24
|
+
input,
|
|
20
25
|
render: renderGet,
|
|
21
26
|
})
|
|
22
|
-
async
|
|
27
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
23
28
|
|
|
24
29
|
return getDoc(ctx);
|
|
25
30
|
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
// doc.list —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import { listDocs as _listDocs } from '../service.js';
|
|
8
8
|
import { renderList as _renderList } from '../render.js';
|
|
9
9
|
const listDocs: any = _listDocs;
|
|
10
10
|
const renderList: any = _renderList;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** doc.list 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
external: z.boolean().optional().describe("附带外部绑定闭包内的文档与绑定清单"),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class DocListAction extends ActionBase<typeof input> {
|
|
13
18
|
@action({
|
|
14
19
|
id: 'doc.list',
|
|
15
20
|
cli: ['docs', 'list'],
|
|
16
21
|
http: ['GET', '/api/docs'],
|
|
17
22
|
summary: '文档树索引(自有 + 可选外部;零副作用,双链解析的数据源)',
|
|
18
|
-
input
|
|
23
|
+
input,
|
|
19
24
|
render: renderList,
|
|
20
25
|
})
|
|
21
|
-
async
|
|
26
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
22
27
|
|
|
23
28
|
return listDocs(ctx);
|
|
24
29
|
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
// doc.remove —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import { removeDoc as _removeDoc } from '../service.js';
|
|
8
8
|
const removeDoc: any = _removeDoc;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** doc.remove 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
ref: z.string(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export class DocRemoveAction extends ActionBase<typeof input> {
|
|
11
16
|
@action({
|
|
12
17
|
id: 'doc.remove',
|
|
13
18
|
cli: ['docs', 'remove'],
|
|
14
19
|
http: ['DELETE', '/api/docs/item'],
|
|
15
20
|
summary: '删除自有文档(外部绑定不可删)',
|
|
16
21
|
args: ['ref'],
|
|
17
|
-
input
|
|
22
|
+
input,
|
|
18
23
|
render: (d: any) => `已删除: ${d.rel}`,
|
|
19
24
|
})
|
|
20
|
-
async
|
|
25
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
21
26
|
|
|
22
27
|
return removeDoc(ctx);
|
|
23
28
|
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
// doc.update —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput, type ActionRunMeta } from '../../../runtime/action-base.js';
|
|
7
7
|
import { updateDoc as _updateDoc } from '../service.js';
|
|
8
8
|
import { renderWritten as _renderWritten } from '../render.js';
|
|
9
9
|
const updateDoc: any = _updateDoc;
|
|
10
10
|
const renderWritten: any = _renderWritten;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** doc.update 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
ref: z.string(),
|
|
15
|
+
body: z.string().optional().describe("Markdown 全文"),
|
|
16
|
+
bodyFile: z.string().optional().describe("从文件读全文(--body 优先);`-` = 读标准输入"),
|
|
17
|
+
'body-file': z.string().optional().describe("同 --bodyFile(连字符写法)"),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export class DocUpdateAction extends ActionBase<typeof input> {
|
|
13
21
|
@action({
|
|
14
22
|
id: 'doc.update',
|
|
15
23
|
cli: ['docs', 'set'],
|
|
16
24
|
http: ['PATCH', '/api/docs/item'],
|
|
17
25
|
summary: '写文档正文(面板保存走这里;自有走 own 树、外部走绑定闭包内原文件;写盘后摘要回写 desc / 组内 note)',
|
|
18
26
|
args: ['ref'],
|
|
19
|
-
input
|
|
27
|
+
input,
|
|
20
28
|
render: renderWritten,
|
|
21
29
|
})
|
|
22
|
-
async
|
|
30
|
+
override async run(ctx: ActionInput<this['_input']>, opts: ActionRunMeta = {}) {
|
|
23
31
|
|
|
24
32
|
return updateDoc(
|
|
25
33
|
{ ref: ctx.ref, body: ctx.body, bodyFile: opts && opts.transport === 'http' ? undefined : (ctx.bodyFile ?? ctx['body-file']) },
|
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
// docs.bind —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as refsNs from '../refs.js';
|
|
8
8
|
import { renderRef as _renderRef } from '../render.js';
|
|
9
9
|
const refs: any = refsNs;
|
|
10
10
|
const renderRef: any = _renderRef;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** docs.bind 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
repo: z.string().optional().describe("仓库(id / key / 路径 / 名称)"),
|
|
15
|
+
board: z.string().optional().describe("看板(id / key / 名称)"),
|
|
16
|
+
rel: z.string().optional().describe("自有树内路径(如 repo/github.com/me/x.md)"),
|
|
17
|
+
path: z.string().optional().describe("外部文件/目录绝对路径(如 Obsidian vault;只读,不进 zip)"),
|
|
18
|
+
reset: z.boolean().optional().describe("拆掉覆盖,回到约定路径"),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export class DocsBindAction extends ActionBase<typeof input> {
|
|
13
22
|
@action({
|
|
14
23
|
id: 'docs.bind',
|
|
15
24
|
cli: ['docs', 'bind'],
|
|
16
25
|
http: ['POST', '/api/docs/bind'],
|
|
17
26
|
summary: '绑定项目/组介绍的文档覆盖(--repo 或 --board 二选一 + --rel <自有路径> | --path <外部文件/目录>;--reset 拆回约定路径)',
|
|
18
|
-
input
|
|
27
|
+
input,
|
|
19
28
|
render: renderRef,
|
|
20
29
|
})
|
|
21
|
-
async
|
|
30
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
22
31
|
|
|
23
32
|
return refs.setDocRef(ctx);
|
|
24
33
|
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
// docs.index —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as linksNs from '../links.js';
|
|
8
8
|
const links: any = linksNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** docs.index 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export class DocsIndexAction extends ActionBase<typeof input> {
|
|
11
16
|
@action({
|
|
12
17
|
id: 'docs.index',
|
|
13
18
|
cli: ['docs', 'index'],
|
|
14
19
|
http: ['GET', '/api/docs/index'],
|
|
15
20
|
summary: '双链索引(docId + 文件名;前端点击 [[..]] 前拉一次;解析规则见 core/wikilink.js)',
|
|
16
|
-
input
|
|
21
|
+
input,
|
|
17
22
|
render: (d: any) => d.index.map((x: any) => ` ${x.name} → ${x.docId}`).join('\n') || '(空)',
|
|
18
23
|
})
|
|
19
|
-
async
|
|
24
|
+
override async run(_ctx: ActionInput<this['_input']>) {
|
|
20
25
|
|
|
21
26
|
return ({ index: await links.buildIndex() });
|
|
22
27
|
|
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
// docs.link —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as refsNs from '../refs.js';
|
|
8
8
|
import { renderLink as _renderLink } from '../render.js';
|
|
9
9
|
const refs: any = refsNs;
|
|
10
10
|
const renderLink: any = _renderLink;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** docs.link 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
board: z.string(),
|
|
15
|
+
doc: z.string().optional().describe("自有树路径 = 自有文档;盘符/绝对路径 = 外部只读引用"),
|
|
16
|
+
note: z.string().optional().describe("条目说明"),
|
|
17
|
+
tag: z.string().optional().describe("分类标签(如 qa;简介行渲染成小 chip;空串 = 清掉)"),
|
|
18
|
+
remove: z.number().optional().describe("移除第 N 条(1 起)"),
|
|
19
|
+
before: z.number().optional().describe("插到第 N 条之前(缺省追加到末尾)"),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export class DocsLinkAction extends ActionBase<typeof input> {
|
|
13
23
|
@action({
|
|
14
24
|
id: 'docs.link',
|
|
15
25
|
cli: ['docs', 'link'],
|
|
16
26
|
http: ['POST', '/api/docs/link'],
|
|
17
27
|
summary: '维护组的附加文档列表(--doc <自有路径|绝对路径> + --note/--tag;--remove <序号> 移除;--before <序号> 插位;同 doc 重复添加 = 更新)',
|
|
18
28
|
args: ['board'],
|
|
19
|
-
input
|
|
29
|
+
input,
|
|
20
30
|
render: renderLink,
|
|
21
31
|
})
|
|
22
|
-
async
|
|
32
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
23
33
|
|
|
24
34
|
return refs.setDocLink(ctx);
|
|
25
35
|
|
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
// docs.notebind —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as refsNs from '../refs.js';
|
|
8
8
|
import { renderNoteRef as _renderNoteRef } from '../render.js';
|
|
9
9
|
const refs: any = refsNs;
|
|
10
10
|
const renderNoteRef: any = _renderNoteRef;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** docs.notebind 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
board: z.string(),
|
|
15
|
+
repo: z.string().describe("仓库(id / key / 路径 / 名称)"),
|
|
16
|
+
rel: z.string().optional().describe("自有树内路径"),
|
|
17
|
+
path: z.string().optional().describe("外部文件/目录绝对路径(只读)"),
|
|
18
|
+
reset: z.boolean().optional().describe("拆掉覆盖,回到约定路径"),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export class DocsNotebindAction extends ActionBase<typeof input> {
|
|
13
22
|
@action({
|
|
14
23
|
id: 'docs.notebind',
|
|
15
24
|
cli: ['docs', 'note-bind'],
|
|
16
25
|
http: ['POST', '/api/docs/note-bind'],
|
|
17
26
|
summary: '绑定组内仓库描述的文档覆盖(--board <看板> --repo <仓库> + --rel/--path/--reset;仓库须为该组成员)',
|
|
18
27
|
args: ['board'],
|
|
19
|
-
input
|
|
28
|
+
input,
|
|
20
29
|
render: renderNoteRef,
|
|
21
30
|
})
|
|
22
|
-
async
|
|
31
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
23
32
|
|
|
24
33
|
return refs.setNoteDocRef(ctx);
|
|
25
34
|
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
// docs.seed —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as seedNs from '../seed.js';
|
|
8
8
|
import { renderSeed as _renderSeed } from '../render.js';
|
|
9
9
|
const seed: any = seedNs;
|
|
10
10
|
const renderSeed: any = _renderSeed;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** docs.seed 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
apply: z.boolean().optional().describe("执行播种(缺省只预览)"),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class DocsSeedAction extends ActionBase<typeof input> {
|
|
13
18
|
@action({
|
|
14
19
|
id: 'docs.seed',
|
|
15
20
|
cli: ['docs', 'seed'],
|
|
16
21
|
http: ['POST', '/api/docs/seed'],
|
|
17
22
|
summary: '把仓库 desc / 看板 desc / 组内 note 字符串播种成约定路径的 md(缺省预览,--apply 执行;幂等)',
|
|
18
|
-
input
|
|
23
|
+
input,
|
|
19
24
|
render: renderSeed,
|
|
20
25
|
})
|
|
21
|
-
async
|
|
26
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
22
27
|
|
|
23
28
|
return (ctx.apply ? seed.seedApply() : seed.seedPlan());
|
|
24
29
|
|
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
// file.content —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** file.content 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
fileId: z.string(),
|
|
13
|
+
group: z.number().optional().describe("工作空间 id(默认取当前)"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export class FileContentAction extends ActionBase<typeof input> {
|
|
11
17
|
@action({
|
|
12
18
|
id: 'file.content',
|
|
13
19
|
cli: ['file', 'content'],
|
|
14
20
|
http: ['GET', '/api/file/content/:fileId'],
|
|
15
21
|
summary: '取附件本体:面板内联预览;CLI 打印出图地址与本地路径',
|
|
16
22
|
args: ['fileId'],
|
|
17
|
-
input
|
|
23
|
+
input,
|
|
18
24
|
render: (d: any) => service.renderContent(d),
|
|
19
25
|
stream: true,
|
|
20
26
|
})
|
|
21
|
-
async
|
|
27
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
28
|
+
// stream:req/res/url 由 ApiRouter 在 zod parse 之后塞进 input.__raw
|
|
29
|
+
//(运行时注入,不在公共契约 schema 里——这里做局部展开让 __raw 可见)
|
|
30
|
+
const raw = ctx as typeof ctx & { __raw?: unknown };
|
|
31
|
+
return (raw.__raw
|
|
32
|
+
? service.serveContent(raw)
|
|
33
|
+
: service.getFileAction(ctx.fileId, { group: ctx.group }));
|
|
22
34
|
|
|
23
|
-
return (ctx.__raw
|
|
24
|
-
? service.serveContent(ctx)
|
|
25
|
-
: service.getFileAction(ctx.fileId, { group: ctx.group }));
|
|
26
|
-
|
|
27
35
|
}
|
|
28
36
|
}
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
// file.get —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** file.get 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
fileId: z.string(),
|
|
13
|
+
group: z.number().optional().describe("工作空间 id(默认取当前)"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export class FileGetAction extends ActionBase<typeof input> {
|
|
11
17
|
@action({
|
|
12
18
|
id: 'file.get',
|
|
13
19
|
cli: ['file', 'get'],
|
|
14
20
|
http: ['GET', '/api/file/item'],
|
|
15
21
|
summary: '查单个附件的元数据与本地路径',
|
|
16
22
|
args: ['fileId'],
|
|
17
|
-
input
|
|
23
|
+
input,
|
|
18
24
|
render: (d: any) => service.renderFileInfo(d),
|
|
19
25
|
})
|
|
20
|
-
async
|
|
26
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
21
27
|
|
|
22
28
|
return service.getFileAction(ctx.fileId, { group: ctx.group });
|
|
23
29
|
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
// file.list —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** file.list 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
group: z.number().optional().describe("工作空间 id(默认取当前)"),
|
|
13
|
+
limit: z.number().default(100),
|
|
14
|
+
offset: z.number().default(0),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class FileListAction extends ActionBase<typeof input> {
|
|
11
18
|
@action({
|
|
12
19
|
id: 'file.list',
|
|
13
20
|
cli: ['file', 'list'],
|
|
14
21
|
http: ['GET', '/api/file'],
|
|
15
22
|
summary: '列出当前用户空间的附件(含本地已同步路径)',
|
|
16
|
-
input
|
|
23
|
+
input,
|
|
17
24
|
render: (d: any) => service.renderFileList(d),
|
|
18
25
|
})
|
|
19
|
-
async
|
|
26
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
20
27
|
|
|
21
28
|
return service.listFilesAction(ctx);
|
|
22
29
|
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
// file.orphans —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** file.orphans 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export class FileOrphansAction extends ActionBase<typeof input> {
|
|
11
16
|
@action({
|
|
12
17
|
id: 'file.orphans',
|
|
13
18
|
cli: ['file', 'orphans'],
|
|
14
19
|
http: ['GET', '/api/file/orphans'],
|
|
15
20
|
summary: '列出无主资源(没有任何任务/文档关系边;删任务、删文档、删正文行之后用)',
|
|
16
|
-
input
|
|
21
|
+
input,
|
|
17
22
|
render: (d: any) => service.renderOrphans(d),
|
|
18
23
|
})
|
|
19
|
-
async
|
|
24
|
+
override async run(_ctx: ActionInput<this['_input']>) {
|
|
20
25
|
|
|
21
26
|
return service.listOrphanAttachmentsAction();
|
|
22
27
|
|