gaoding-cli 1.0.0-alpha.20 → 1.0.0-alpha.22
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/contracts/operations/dam.copy/input.schema.json +19 -0
- package/contracts/operations/dam.copy/output.schema.json +19 -0
- package/contracts/operations/dam.download/input.schema.json +14 -0
- package/contracts/operations/dam.download/output.schema.json +25 -0
- package/contracts/operations/dam.folder.list/input.schema.json +15 -0
- package/contracts/operations/dam.folder.list/output.schema.json +37 -0
- package/contracts/operations/dam.list/output.schema.json +3 -3
- package/contracts/operations/dam.move/input.schema.json +19 -0
- package/contracts/operations/dam.move/output.schema.json +18 -0
- package/contracts/operations/dam.recycle.list/input.schema.json +13 -0
- package/contracts/operations/dam.recycle.list/output.schema.json +34 -0
- package/contracts/operations/dam.recycle.restore/input.schema.json +14 -0
- package/contracts/operations/dam.recycle.restore/output.schema.json +6 -0
- package/contracts/operations/dam.rename/input.schema.json +18 -0
- package/contracts/operations/dam.rename/output.schema.json +18 -0
- package/contracts/operations/dam.repository.list/input.schema.json +8 -0
- package/contracts/operations/dam.repository.list/output.schema.json +52 -0
- package/contracts/operations/dam.search/output.schema.json +3 -3
- package/contracts/operations/dam.tag.list/input.schema.json +12 -0
- package/contracts/operations/dam.tag.list/output.schema.json +26 -0
- package/dist/src/bootstrap/create-runtime.js +25 -1
- package/dist/src/bootstrap/validators.js +39 -0
- package/dist/src/cli/dam-commands.js +248 -1
- package/dist/src/cli/errors.js +36 -2
- package/dist/src/cli/presenter.js +12 -0
- package/dist/src/features/dam/dam-api-adapter.js +369 -28
- package/dist/src/features/dam/file-downloader.js +242 -0
- package/dist/src/features/dam/operation-executor.js +72 -0
- package/dist/src/features/dam/repository-catalog.js +127 -0
- package/dist/src/features/dam/use-cases.js +323 -11
- package/dist/src/features/editor/bridge-server.js +6 -1
- package/dist/src/platform/signature.js +2 -1
- package/dist/src/platform/signed-http-transport.js +9 -1
- package/package.json +1 -1
- package/skills/gd-cli/SKILL.md +1 -1
- package/skills/gd-cli/references/dam.md +45 -13
- package/skills/gd-cli/references/editor.md +3 -1
- package/skills/gd-cli/references/errors.md +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamCopyInput",
|
|
4
|
+
"description": "复制一个 DAM 素材或文件夹。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["entry_id", "kind", "targetFolderId"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"entry_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"kind": { "$ref": "#/$defs/kind" },
|
|
11
|
+
"repositoryId": { "$ref": "#/$defs/nonblank" },
|
|
12
|
+
"targetRepositoryId": { "$ref": "#/$defs/nonblank" },
|
|
13
|
+
"targetFolderId": { "$ref": "#/$defs/nonblank" }
|
|
14
|
+
},
|
|
15
|
+
"$defs": {
|
|
16
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
17
|
+
"kind": { "type": "string", "enum": ["asset", "folder"] }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamCopyResult",
|
|
4
|
+
"description": "复制后的 DAM 条目位置。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["source_entry_id", "kind", "repository_id", "folder_id"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"source_entry_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"kind": { "$ref": "#/$defs/kind" },
|
|
11
|
+
"repository_id": { "$ref": "#/$defs/nonblank" },
|
|
12
|
+
"folder_id": { "$ref": "#/$defs/nonblank" },
|
|
13
|
+
"copied_entry_id": { "$ref": "#/$defs/nonblank" }
|
|
14
|
+
},
|
|
15
|
+
"$defs": {
|
|
16
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
17
|
+
"kind": { "type": "string", "enum": ["asset", "folder"] }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamDownloadInput",
|
|
4
|
+
"description": "下载一个 DAM 素材。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["asset_id"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"asset_id": { "$ref": "#/$defs/nonblank", "description": "单个素材 ID。" },
|
|
10
|
+
"repositoryId": { "$ref": "#/$defs/nonblank", "description": "资源库 ID。" },
|
|
11
|
+
"outputDir": { "$ref": "#/$defs/nonblank", "default": ".", "description": "输出目录。" }
|
|
12
|
+
},
|
|
13
|
+
"$defs": { "nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" } }
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamDownloadResult",
|
|
4
|
+
"description": "一个 DAM 素材下载后的本地文件。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["asset_id", "files"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"asset_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"files": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/file" } }
|
|
11
|
+
},
|
|
12
|
+
"$defs": {
|
|
13
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
14
|
+
"file": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": ["path", "bytes", "sha256"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"path": { "$ref": "#/$defs/nonblank" },
|
|
20
|
+
"bytes": { "type": "integer", "minimum": 0 },
|
|
21
|
+
"sha256": { "type": "string", "pattern": "^[a-fA-F0-9]{64}$" }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamFolderListInput",
|
|
4
|
+
"description": "列出一个 DAM 资源库中的文件夹。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"repositoryId": { "$ref": "#/$defs/nonblank", "description": "资源库 ID。" },
|
|
9
|
+
"parentId": { "$ref": "#/$defs/nonblank", "default": "0", "description": "父文件夹 ID。" },
|
|
10
|
+
"query": { "$ref": "#/$defs/nonblank", "description": "文件夹标题关键词。" },
|
|
11
|
+
"page": { "type": "integer", "minimum": 1, "default": 1, "description": "页码。" },
|
|
12
|
+
"pageSize": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20, "description": "每页数量。" }
|
|
13
|
+
},
|
|
14
|
+
"$defs": { "nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" } }
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamFolderListResult",
|
|
4
|
+
"description": "DAM 文件夹分页结果。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["repository_id", "parent_id", "page", "page_size", "total", "folders"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"repository_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"parent_id": { "$ref": "#/$defs/nonblank" },
|
|
11
|
+
"page": { "type": "integer", "minimum": 1 },
|
|
12
|
+
"page_size": { "type": "integer", "minimum": 1, "maximum": 100 },
|
|
13
|
+
"total": { "type": "integer", "minimum": 0 },
|
|
14
|
+
"folders": { "type": "array", "items": { "$ref": "#/$defs/folder" } }
|
|
15
|
+
},
|
|
16
|
+
"$defs": {
|
|
17
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
18
|
+
"permission": { "type": "string", "enum": ["OWNER", "MANAGE", "EDIT", "USE", "READ"] },
|
|
19
|
+
"folder": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"required": ["folder_id", "title", "parent_id", "repository_id", "child_folder_count", "asset_count"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"folder_id": { "$ref": "#/$defs/nonblank" },
|
|
25
|
+
"title": { "$ref": "#/$defs/nonblank" },
|
|
26
|
+
"parent_id": { "$ref": "#/$defs/nonblank" },
|
|
27
|
+
"repository_id": { "$ref": "#/$defs/nonblank" },
|
|
28
|
+
"permission_code": { "$ref": "#/$defs/permission" },
|
|
29
|
+
"child_folder_count": { "type": "integer", "minimum": 0 },
|
|
30
|
+
"asset_count": { "type": "integer", "minimum": 0 },
|
|
31
|
+
"path": { "$ref": "#/$defs/nonblank" },
|
|
32
|
+
"created_at": { "$ref": "#/$defs/nonblank" },
|
|
33
|
+
"updated_at": { "$ref": "#/$defs/nonblank" }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"title": "DamListResult",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "一批 DAM 素材概要;服务端实际返回数量可能大于请求的 page_size。",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"additionalProperties": false,
|
|
7
7
|
"required": ["repository_ids", "page_size", "total", "finish", "assets"],
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"items": { "$ref": "#/$defs/nonblank" },
|
|
13
13
|
"description": "本次查询的资源库 ID。"
|
|
14
14
|
},
|
|
15
|
-
"page_size": { "type": "integer", "minimum": 1, "maximum": 100, "description": "本次 DAM
|
|
15
|
+
"page_size": { "type": "integer", "minimum": 1, "maximum": 100, "description": "本次 DAM 请求的分页大小;实际 assets 数量可能大于该值。" },
|
|
16
16
|
"total": { "type": "integer", "minimum": 0, "description": "匹配素材总数。" },
|
|
17
17
|
"finish": { "type": "boolean", "description": "是否已到最后一页。" },
|
|
18
18
|
"next_cursor": { "$ref": "#/$defs/nonblank", "description": "下一页游标。" },
|
|
19
19
|
"assets": {
|
|
20
20
|
"type": "array",
|
|
21
21
|
"items": { "$ref": "#/$defs/assetSummary" },
|
|
22
|
-
"description": "
|
|
22
|
+
"description": "服务端本批返回的全部素材概要,不按 page_size 在本地截断。"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"$defs": {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamMoveInput",
|
|
4
|
+
"description": "移动一个 DAM 素材或文件夹。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["entry_id", "kind", "targetFolderId"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"entry_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"kind": { "$ref": "#/$defs/kind" },
|
|
11
|
+
"repositoryId": { "$ref": "#/$defs/nonblank" },
|
|
12
|
+
"targetRepositoryId": { "$ref": "#/$defs/nonblank" },
|
|
13
|
+
"targetFolderId": { "$ref": "#/$defs/nonblank" }
|
|
14
|
+
},
|
|
15
|
+
"$defs": {
|
|
16
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
17
|
+
"kind": { "type": "string", "enum": ["asset", "folder"] }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamMoveResult",
|
|
4
|
+
"description": "移动后的 DAM 条目位置。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["entry_id", "kind", "repository_id", "folder_id"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"entry_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"kind": { "$ref": "#/$defs/kind" },
|
|
11
|
+
"repository_id": { "$ref": "#/$defs/nonblank" },
|
|
12
|
+
"folder_id": { "$ref": "#/$defs/nonblank" }
|
|
13
|
+
},
|
|
14
|
+
"$defs": {
|
|
15
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
16
|
+
"kind": { "type": "string", "enum": ["asset", "folder"] }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamRecycleListInput",
|
|
4
|
+
"description": "列出一个 DAM 资源库的回收站。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"repositoryId": { "$ref": "#/$defs/nonblank" },
|
|
9
|
+
"page": { "type": "integer", "minimum": 1, "default": 1 },
|
|
10
|
+
"pageSize": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }
|
|
11
|
+
},
|
|
12
|
+
"$defs": { "nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" } }
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamRecycleListResult",
|
|
4
|
+
"description": "DAM 回收站分页结果。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["repository_id", "page", "page_size", "total", "entries"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"repository_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"page": { "type": "integer", "minimum": 1 },
|
|
11
|
+
"page_size": { "type": "integer", "minimum": 1, "maximum": 100 },
|
|
12
|
+
"total": { "type": "integer", "minimum": 0 },
|
|
13
|
+
"entries": { "type": "array", "items": { "$ref": "#/$defs/entry" } }
|
|
14
|
+
},
|
|
15
|
+
"$defs": {
|
|
16
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
17
|
+
"assetType": { "type": "string", "enum": ["image", "video", "audio", "font", "template", "file"] },
|
|
18
|
+
"entry": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"required": ["entry_id", "kind", "title", "remaining_days"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"entry_id": { "$ref": "#/$defs/nonblank" },
|
|
24
|
+
"kind": { "type": "string", "enum": ["asset", "folder"] },
|
|
25
|
+
"title": { "$ref": "#/$defs/nonblank" },
|
|
26
|
+
"remaining_days": { "type": "integer", "minimum": 0 },
|
|
27
|
+
"deleted_at": { "$ref": "#/$defs/nonblank" },
|
|
28
|
+
"type": { "$ref": "#/$defs/assetType" },
|
|
29
|
+
"format": { "$ref": "#/$defs/nonblank" },
|
|
30
|
+
"cover_url": { "type": "string", "format": "uri" }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamRecycleRestoreInput",
|
|
4
|
+
"description": "恢复一个 DAM 回收站条目。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["entry_id", "kind"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"entry_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"kind": { "type": "string", "enum": ["asset", "folder"] },
|
|
11
|
+
"repositoryId": { "$ref": "#/$defs/nonblank" }
|
|
12
|
+
},
|
|
13
|
+
"$defs": { "nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" } }
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamRenameInput",
|
|
4
|
+
"description": "重命名一个 DAM 素材或文件夹。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["entry_id", "kind", "title"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"entry_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"kind": { "$ref": "#/$defs/kind" },
|
|
11
|
+
"title": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": ".*\\S.*" },
|
|
12
|
+
"repositoryId": { "$ref": "#/$defs/nonblank" }
|
|
13
|
+
},
|
|
14
|
+
"$defs": {
|
|
15
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
16
|
+
"kind": { "type": "string", "enum": ["asset", "folder"] }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamRenameResult",
|
|
4
|
+
"description": "重命名后的 DAM 条目。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["entry_id", "kind", "repository_id", "title"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"entry_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"kind": { "$ref": "#/$defs/kind" },
|
|
11
|
+
"repository_id": { "$ref": "#/$defs/nonblank" },
|
|
12
|
+
"title": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": ".*\\S.*" }
|
|
13
|
+
},
|
|
14
|
+
"$defs": {
|
|
15
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
16
|
+
"kind": { "type": "string", "enum": ["asset", "folder"] }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamRepositoryListResult",
|
|
4
|
+
"description": "当前组织可用的规范化 DAM 资源库目录。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["repositories"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"repositories": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"minItems": 1,
|
|
12
|
+
"items": { "$ref": "#/$defs/repository" },
|
|
13
|
+
"description": "可被 DAM 命令直接使用的资源库。"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"$defs": {
|
|
17
|
+
"nonblank": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"minLength": 1,
|
|
20
|
+
"pattern": ".*\\S.*"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"required": ["repository_id", "name", "type", "is_default"],
|
|
26
|
+
"properties": {
|
|
27
|
+
"repository_id": {
|
|
28
|
+
"$ref": "#/$defs/nonblank",
|
|
29
|
+
"description": "可直接传给 DAM 命令的资源库 ID。"
|
|
30
|
+
},
|
|
31
|
+
"name": {
|
|
32
|
+
"$ref": "#/$defs/nonblank",
|
|
33
|
+
"description": "资源库名称。"
|
|
34
|
+
},
|
|
35
|
+
"type": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": ["personal", "team", "enterprise", "draft"],
|
|
38
|
+
"description": "规范化资源库类型。"
|
|
39
|
+
},
|
|
40
|
+
"permission_code": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"enum": ["OWNER", "MANAGE", "EDIT", "USE", "READ"],
|
|
43
|
+
"description": "服务端明确返回的资源库权限。"
|
|
44
|
+
},
|
|
45
|
+
"is_default": {
|
|
46
|
+
"type": "boolean",
|
|
47
|
+
"description": "未显式指定资源库时是否使用该项。"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"title": "DamSearchResult",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "一批 DAM 素材搜索结果;服务端实际返回数量可能大于请求的 page_size。",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"additionalProperties": false,
|
|
7
7
|
"required": ["repository_ids", "page_size", "total", "finish", "assets"],
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"items": { "$ref": "#/$defs/nonblank" },
|
|
13
13
|
"description": "本次查询的资源库 ID。"
|
|
14
14
|
},
|
|
15
|
-
"page_size": { "type": "integer", "minimum": 1, "maximum": 100, "description": "本次 DAM
|
|
15
|
+
"page_size": { "type": "integer", "minimum": 1, "maximum": 100, "description": "本次 DAM 请求的分页大小;实际 assets 数量可能大于该值。" },
|
|
16
16
|
"total": { "type": "integer", "minimum": 0, "description": "匹配素材总数。" },
|
|
17
17
|
"finish": { "type": "boolean", "description": "是否已到最后一页。" },
|
|
18
18
|
"next_cursor": { "$ref": "#/$defs/nonblank", "description": "下一页游标。" },
|
|
19
19
|
"assets": {
|
|
20
20
|
"type": "array",
|
|
21
21
|
"items": { "$ref": "#/$defs/assetSummary" },
|
|
22
|
-
"description": "
|
|
22
|
+
"description": "服务端本批返回的全部素材概要,不按 page_size 在本地截断。"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"$defs": {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamTagListInput",
|
|
4
|
+
"description": "列出一个 DAM 资源库中的标签。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"repositoryId": { "$ref": "#/$defs/nonblank", "description": "资源库 ID。" },
|
|
9
|
+
"query": { "$ref": "#/$defs/nonblank", "description": "标签名称关键词。" }
|
|
10
|
+
},
|
|
11
|
+
"$defs": { "nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" } }
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DamTagListResult",
|
|
4
|
+
"description": "DAM 标签列表结果。",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["repository_id", "tags"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"repository_id": { "$ref": "#/$defs/nonblank" },
|
|
10
|
+
"tags": { "type": "array", "items": { "$ref": "#/$defs/tag" } }
|
|
11
|
+
},
|
|
12
|
+
"$defs": {
|
|
13
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
|
|
14
|
+
"tag": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": ["tag_id", "name", "asset_count"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"tag_id": { "$ref": "#/$defs/nonblank" },
|
|
20
|
+
"name": { "$ref": "#/$defs/nonblank" },
|
|
21
|
+
"group_id": { "$ref": "#/$defs/nonblank" },
|
|
22
|
+
"asset_count": { "type": "integer", "minimum": 0 }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -8,6 +8,9 @@ import { createAuthUseCases } from "../features/auth/use-cases.js";
|
|
|
8
8
|
import { createSsoService } from "../features/auth/sso-service.js";
|
|
9
9
|
import { createCreativeAgentAdapter } from "../features/agent/creative-agent-adapter.js";
|
|
10
10
|
import { createDamApiAdapter } from "../features/dam/dam-api-adapter.js";
|
|
11
|
+
import { createDamFileDownloader } from "../features/dam/file-downloader.js";
|
|
12
|
+
import { createDamOperationExecutor } from "../features/dam/operation-executor.js";
|
|
13
|
+
import { createDamRepositoryCatalog } from "../features/dam/repository-catalog.js";
|
|
11
14
|
import { createDamRegisteredUploader } from "../features/dam/registered-uploader.js";
|
|
12
15
|
import { createDamTransientUploader } from "../features/dam/transient-uploader.js";
|
|
13
16
|
import { createDamStorageUploader } from "../features/dam/storage-upload.js";
|
|
@@ -40,7 +43,7 @@ const productionEndpoints = {
|
|
|
40
43
|
toolApi: new URL("https://gdcli.gaoding.com/api"),
|
|
41
44
|
damApi: new URL("https://gdcli.gaoding.com/api"),
|
|
42
45
|
ssoApi: new URL("https://www.gaoding.com/api/sso"),
|
|
43
|
-
authPageOrigin: new URL("https://www.gaoding.
|
|
46
|
+
authPageOrigin: new URL("https://www.gaoding.art")
|
|
44
47
|
};
|
|
45
48
|
export function createProductionRuntime(options = {}) {
|
|
46
49
|
const bundledSkills = loadBundledSkills(fileURLToPath(import.meta.url));
|
|
@@ -146,8 +149,17 @@ export function createProductionRuntime(options = {}) {
|
|
|
146
149
|
const validators = createContractValidators();
|
|
147
150
|
const modelCatalog = createMnsCatalogAdapter({ transport: mnsTransport });
|
|
148
151
|
const damApi = createDamApiAdapter({ transport: damTransport });
|
|
152
|
+
const damRepositories = createDamRepositoryCatalog({ transport: damTransport });
|
|
153
|
+
const damOperations = createDamOperationExecutor({
|
|
154
|
+
now: () => now().getTime(),
|
|
155
|
+
sleep: async (milliseconds, signal) => {
|
|
156
|
+
await delay(milliseconds, undefined, { signal });
|
|
157
|
+
},
|
|
158
|
+
annotate: (context) => { telemetry.annotate(context); }
|
|
159
|
+
});
|
|
149
160
|
const dam = createDamUseCases({
|
|
150
161
|
api: damApi,
|
|
162
|
+
repositories: damRepositories,
|
|
151
163
|
storage: storageUpload,
|
|
152
164
|
uploader: createDamRegisteredUploader({
|
|
153
165
|
api: damApi,
|
|
@@ -156,9 +168,21 @@ export function createProductionRuntime(options = {}) {
|
|
|
156
168
|
now,
|
|
157
169
|
telemetry
|
|
158
170
|
}),
|
|
171
|
+
downloader: createDamFileDownloader({ fetch }),
|
|
172
|
+
operations: damOperations,
|
|
173
|
+
sleep: async (milliseconds, signal) => {
|
|
174
|
+
await delay(milliseconds, undefined, { signal });
|
|
175
|
+
},
|
|
159
176
|
validate: {
|
|
177
|
+
repositoryList: validators.damRepositoryListOutput,
|
|
160
178
|
list: validators.damListOutput,
|
|
161
179
|
search: validators.damSearchOutput,
|
|
180
|
+
folderList: validators.damFolderListOutput,
|
|
181
|
+
tagList: validators.damTagListOutput,
|
|
182
|
+
download: validators.damDownloadOutput,
|
|
183
|
+
rename: validators.damRenameOutput,
|
|
184
|
+
move: validators.damMoveOutput,
|
|
185
|
+
copy: validators.damCopyOutput,
|
|
162
186
|
get: validators.damGetOutput,
|
|
163
187
|
upload: validators.damUploadOutput,
|
|
164
188
|
delete: validators.damDeleteOutput
|
|
@@ -6,12 +6,25 @@ const agentSendOutputSchema = contractSchema("agent.send", "output");
|
|
|
6
6
|
const authStatusSchema = contractSchema("auth.status", "output");
|
|
7
7
|
const damDeleteInputSchema = contractSchema("dam.delete", "input");
|
|
8
8
|
const damDeleteOutputSchema = contractSchema("dam.delete", "output");
|
|
9
|
+
const damCopyInputSchema = contractSchema("dam.copy", "input");
|
|
10
|
+
const damCopyOutputSchema = contractSchema("dam.copy", "output");
|
|
11
|
+
const damDownloadInputSchema = contractSchema("dam.download", "input");
|
|
12
|
+
const damDownloadOutputSchema = contractSchema("dam.download", "output");
|
|
13
|
+
const damFolderListInputSchema = contractSchema("dam.folder.list", "input");
|
|
14
|
+
const damFolderListOutputSchema = contractSchema("dam.folder.list", "output");
|
|
9
15
|
const damGetInputSchema = contractSchema("dam.get", "input");
|
|
10
16
|
const damGetOutputSchema = contractSchema("dam.get", "output");
|
|
11
17
|
const damListInputSchema = contractSchema("dam.list", "input");
|
|
12
18
|
const damListOutputSchema = contractSchema("dam.list", "output");
|
|
19
|
+
const damMoveInputSchema = contractSchema("dam.move", "input");
|
|
20
|
+
const damMoveOutputSchema = contractSchema("dam.move", "output");
|
|
21
|
+
const damRepositoryListOutputSchema = contractSchema("dam.repository.list", "output");
|
|
22
|
+
const damRenameInputSchema = contractSchema("dam.rename", "input");
|
|
23
|
+
const damRenameOutputSchema = contractSchema("dam.rename", "output");
|
|
13
24
|
const damSearchInputSchema = contractSchema("dam.search", "input");
|
|
14
25
|
const damSearchOutputSchema = contractSchema("dam.search", "output");
|
|
26
|
+
const damTagListInputSchema = contractSchema("dam.tag.list", "input");
|
|
27
|
+
const damTagListOutputSchema = contractSchema("dam.tag.list", "output");
|
|
15
28
|
const damUploadInputSchema = contractSchema("dam.upload", "input");
|
|
16
29
|
const damUploadOutputSchema = contractSchema("dam.upload", "output");
|
|
17
30
|
const editorApplyInputSchema = contractSchema("editor.apply", "input");
|
|
@@ -50,16 +63,29 @@ export function createContractValidators() {
|
|
|
50
63
|
const agentSendInput = ajv.compile(agentSendInputSchema);
|
|
51
64
|
const agentSendOutput = ajv.compile(agentSendOutputSchema);
|
|
52
65
|
const authStatus = ajv.compile(authStatusSchema);
|
|
66
|
+
const damFolderListInput = ajv.compile(damFolderListInputSchema);
|
|
67
|
+
const damFolderListOutput = ajv.compile(damFolderListOutputSchema);
|
|
53
68
|
const damListInput = ajv.compile(damListInputSchema);
|
|
54
69
|
const damListOutput = ajv.compile(damListOutputSchema);
|
|
70
|
+
const damRepositoryListOutput = ajv.compile(damRepositoryListOutputSchema);
|
|
71
|
+
const damRenameInput = ajv.compile(damRenameInputSchema);
|
|
72
|
+
const damRenameOutput = ajv.compile(damRenameOutputSchema);
|
|
73
|
+
const damMoveInput = ajv.compile(damMoveInputSchema);
|
|
74
|
+
const damMoveOutput = ajv.compile(damMoveOutputSchema);
|
|
75
|
+
const damCopyInput = ajv.compile(damCopyInputSchema);
|
|
76
|
+
const damCopyOutput = ajv.compile(damCopyOutputSchema);
|
|
55
77
|
const damSearchInput = ajv.compile(damSearchInputSchema);
|
|
56
78
|
const damSearchOutput = ajv.compile(damSearchOutputSchema);
|
|
79
|
+
const damTagListInput = ajv.compile(damTagListInputSchema);
|
|
80
|
+
const damTagListOutput = ajv.compile(damTagListOutputSchema);
|
|
57
81
|
const damGetInput = ajv.compile(damGetInputSchema);
|
|
58
82
|
const damGetOutput = ajv.compile(damGetOutputSchema);
|
|
59
83
|
const damUploadInput = ajv.compile(damUploadInputSchema);
|
|
60
84
|
const damUploadOutput = ajv.compile(damUploadOutputSchema);
|
|
61
85
|
const damDeleteInput = ajv.compile(damDeleteInputSchema);
|
|
62
86
|
const damDeleteOutput = ajv.compile(damDeleteOutputSchema);
|
|
87
|
+
const damDownloadInput = ajv.compile(damDownloadInputSchema);
|
|
88
|
+
const damDownloadOutput = ajv.compile(damDownloadOutputSchema);
|
|
63
89
|
const editorConnectInput = ajv.compile(editorConnectInputSchema);
|
|
64
90
|
const editorConnectOutput = ajv.compile(editorConnectOutputSchema);
|
|
65
91
|
const editorDisconnectOutput = ajv.compile(editorDisconnectOutputSchema);
|
|
@@ -81,16 +107,29 @@ export function createContractValidators() {
|
|
|
81
107
|
agentSendInput: assertion(agentSendInput, InputContractError),
|
|
82
108
|
agentSendOutput: assertion(agentSendOutput, OutputContractError),
|
|
83
109
|
authStatus: assertion(authStatus, OutputContractError),
|
|
110
|
+
damRepositoryListOutput: assertion(damRepositoryListOutput, OutputContractError),
|
|
84
111
|
damListInput: assertion(damListInput, InputContractError),
|
|
85
112
|
damListOutput: assertion(damListOutput, OutputContractError),
|
|
86
113
|
damSearchInput: assertion(damSearchInput, InputContractError),
|
|
87
114
|
damSearchOutput: assertion(damSearchOutput, OutputContractError),
|
|
115
|
+
damFolderListInput: assertion(damFolderListInput, InputContractError),
|
|
116
|
+
damFolderListOutput: assertion(damFolderListOutput, OutputContractError),
|
|
117
|
+
damTagListInput: assertion(damTagListInput, InputContractError),
|
|
118
|
+
damTagListOutput: assertion(damTagListOutput, OutputContractError),
|
|
88
119
|
damGetInput: assertion(damGetInput, InputContractError),
|
|
89
120
|
damGetOutput: assertion(damGetOutput, OutputContractError),
|
|
90
121
|
damUploadInput: assertion(damUploadInput, InputContractError),
|
|
91
122
|
damUploadOutput: assertion(damUploadOutput, OutputContractError),
|
|
92
123
|
damDeleteInput: assertion(damDeleteInput, InputContractError),
|
|
93
124
|
damDeleteOutput: assertion(damDeleteOutput, OutputContractError),
|
|
125
|
+
damDownloadInput: assertion(damDownloadInput, InputContractError),
|
|
126
|
+
damDownloadOutput: assertion(damDownloadOutput, OutputContractError),
|
|
127
|
+
damRenameInput: assertion(damRenameInput, InputContractError),
|
|
128
|
+
damRenameOutput: assertion(damRenameOutput, OutputContractError),
|
|
129
|
+
damMoveInput: assertion(damMoveInput, InputContractError),
|
|
130
|
+
damMoveOutput: assertion(damMoveOutput, OutputContractError),
|
|
131
|
+
damCopyInput: assertion(damCopyInput, InputContractError),
|
|
132
|
+
damCopyOutput: assertion(damCopyOutput, OutputContractError),
|
|
94
133
|
editorConnectInput: assertion(editorConnectInput, InputContractError),
|
|
95
134
|
editorConnectOutput: assertion(editorConnectOutput, OutputContractError),
|
|
96
135
|
editorDisconnectOutput: assertion(editorDisconnectOutput, OutputContractError),
|