devops-mcp-server-extension 1.0.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/LICENSE +218 -0
- package/README.md +527 -0
- package/README.zh-cn.md +503 -0
- package/dist/common/errors.js +77 -0
- package/dist/common/modularTemplates.js +483 -0
- package/dist/common/pipelineTemplates.js +19 -0
- package/dist/common/toolsetManager.js +123 -0
- package/dist/common/toolsets.js +23 -0
- package/dist/common/types.js +60 -0
- package/dist/common/utils.js +381 -0
- package/dist/common/version.js +1 -0
- package/dist/index.js +225 -0
- package/dist/operations/appstack/appOrchestrations.js +260 -0
- package/dist/operations/appstack/appTags.js +168 -0
- package/dist/operations/appstack/appTemplates.js +72 -0
- package/dist/operations/appstack/applications.js +171 -0
- package/dist/operations/appstack/changeOrders.js +320 -0
- package/dist/operations/appstack/changeRequests.js +288 -0
- package/dist/operations/appstack/deploymentResources.js +286 -0
- package/dist/operations/appstack/globalVars.js +221 -0
- package/dist/operations/appstack/releaseWorkflows.js +695 -0
- package/dist/operations/appstack/variableGroups.js +245 -0
- package/dist/operations/codeup/branches.js +157 -0
- package/dist/operations/codeup/changeRequestComments.js +140 -0
- package/dist/operations/codeup/changeRequests.js +230 -0
- package/dist/operations/codeup/commits.js +121 -0
- package/dist/operations/codeup/compare.js +30 -0
- package/dist/operations/codeup/files.js +249 -0
- package/dist/operations/codeup/repositories.js +71 -0
- package/dist/operations/codeup/types.js +414 -0
- package/dist/operations/flow/hostGroup.js +52 -0
- package/dist/operations/flow/pipeline.js +609 -0
- package/dist/operations/flow/pipelineJob.js +126 -0
- package/dist/operations/flow/resourceMember.js +137 -0
- package/dist/operations/flow/serviceConnection.js +27 -0
- package/dist/operations/flow/tag.js +191 -0
- package/dist/operations/flow/types.js +523 -0
- package/dist/operations/flow/vmDeployOrder.js +171 -0
- package/dist/operations/organization/members.js +106 -0
- package/dist/operations/organization/organization.js +110 -0
- package/dist/operations/organization/types.js +111 -0
- package/dist/operations/packages/artifacts.js +71 -0
- package/dist/operations/packages/repositories.js +39 -0
- package/dist/operations/packages/types.js +56 -0
- package/dist/operations/projex/effort.js +122 -0
- package/dist/operations/projex/project.js +243 -0
- package/dist/operations/projex/sprint.js +103 -0
- package/dist/operations/projex/types.js +618 -0
- package/dist/operations/projex/workitem.js +826 -0
- package/dist/operations/testhub/testcases.js +240 -0
- package/dist/operations/testhub/testplans.js +128 -0
- package/dist/tool-handlers/appstack-app-release-workflows.js +103 -0
- package/dist/tool-handlers/appstack-change-orders.js +55 -0
- package/dist/tool-handlers/appstack-change-requests.js +49 -0
- package/dist/tool-handlers/appstack-deployment-resources.js +31 -0
- package/dist/tool-handlers/appstack-global-vars.js +37 -0
- package/dist/tool-handlers/appstack-orchestrations.js +49 -0
- package/dist/tool-handlers/appstack-release-workflows.js +37 -0
- package/dist/tool-handlers/appstack-tags.js +37 -0
- package/dist/tool-handlers/appstack-templates.js +19 -0
- package/dist/tool-handlers/appstack-variable-groups.js +55 -0
- package/dist/tool-handlers/appstack.js +37 -0
- package/dist/tool-handlers/base.js +25 -0
- package/dist/tool-handlers/code-management.js +150 -0
- package/dist/tool-handlers/commit.js +31 -0
- package/dist/tool-handlers/effort.js +103 -0
- package/dist/tool-handlers/index.js +119 -0
- package/dist/tool-handlers/organization.js +72 -0
- package/dist/tool-handlers/packages.js +32 -0
- package/dist/tool-handlers/pipeline.js +289 -0
- package/dist/tool-handlers/project-management.js +201 -0
- package/dist/tool-handlers/resourceMember.js +43 -0
- package/dist/tool-handlers/service-connections.js +16 -0
- package/dist/tool-handlers/tag.js +64 -0
- package/dist/tool-handlers/test-management.js +74 -0
- package/dist/tool-handlers/vmDeployOrder.js +50 -0
- package/dist/tool-registry/appstack-app-release-workflows.js +80 -0
- package/dist/tool-registry/appstack-change-orders.js +40 -0
- package/dist/tool-registry/appstack-change-requests.js +35 -0
- package/dist/tool-registry/appstack-deployment-resources.js +20 -0
- package/dist/tool-registry/appstack-global-vars.js +25 -0
- package/dist/tool-registry/appstack-orchestrations.js +35 -0
- package/dist/tool-registry/appstack-release-workflows.js +25 -0
- package/dist/tool-registry/appstack-tags.js +25 -0
- package/dist/tool-registry/appstack-templates.js +10 -0
- package/dist/tool-registry/appstack-variable-groups.js +40 -0
- package/dist/tool-registry/appstack.js +25 -0
- package/dist/tool-registry/base.js +19 -0
- package/dist/tool-registry/code-management.js +109 -0
- package/dist/tool-registry/commit.js +20 -0
- package/dist/tool-registry/effort.js +39 -0
- package/dist/tool-registry/index.js +7 -0
- package/dist/tool-registry/organization.js +65 -0
- package/dist/tool-registry/packages.js +21 -0
- package/dist/tool-registry/pipeline.js +190 -0
- package/dist/tool-registry/project-management.js +143 -0
- package/dist/tool-registry/resourceMember.js +29 -0
- package/dist/tool-registry/service-connections.js +10 -0
- package/dist/tool-registry/tag.js +44 -0
- package/dist/tool-registry/test-management.js +59 -0
- package/dist/tool-registry/vmDeployOrder.js +34 -0
- package/package.json +52 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import * as utils from "../../common/utils.js";
|
|
2
|
+
import { resolveOrganizationId } from "../organization/organization.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
// 定义VM部署单相关的Zod模式
|
|
5
|
+
export const DeployOrderMachineActionSchema = z.object({
|
|
6
|
+
type: z.string().nullable().optional().describe("类型 RetryVMDeployMachine重试机器部署 SkipVMDeployMachine跳过机器部署 LogVMDeployMachine查看机器部署日志"),
|
|
7
|
+
disable: z.boolean().nullable().optional().describe("当前用户是否有权限进行后续 action"),
|
|
8
|
+
params: z.object({}).nullable().optional().describe("参数"),
|
|
9
|
+
});
|
|
10
|
+
export const DeployOrderMachineSchema = z.object({
|
|
11
|
+
createTime: z.number().int().nullable().optional().describe("创建时间"),
|
|
12
|
+
updateTime: z.number().int().nullable().optional().describe("更新时间"),
|
|
13
|
+
status: z.string().nullable().optional().describe("状态 Success成功 Pending待部署 Running部署中 Cancelled取消 Queued部署等待中 Failed失败 Skipped已跳过"),
|
|
14
|
+
machineSn: z.string().nullable().optional().describe("机器sn"),
|
|
15
|
+
clientStatus: z.string().nullable().optional().describe("机器状态 ok(正常) error(连接失败)"),
|
|
16
|
+
ip: z.string().nullable().optional().describe("机器ip"),
|
|
17
|
+
batchNum: z.number().int().nullable().optional().describe("部署批次"),
|
|
18
|
+
actions: z.array(DeployOrderMachineActionSchema).nullable().optional().describe("操作列表"),
|
|
19
|
+
});
|
|
20
|
+
export const DeployOrderDeployMachinesSchema = z.object({
|
|
21
|
+
hostGroupId: z.number().int().nullable().optional().describe("主机组Id"),
|
|
22
|
+
batchNum: z.number().int().nullable().optional().describe("发布批次"),
|
|
23
|
+
deployMachines: z.array(DeployOrderMachineSchema).nullable().optional().describe("部署机器列表"),
|
|
24
|
+
});
|
|
25
|
+
export const DeployOrderActionSchema = z.object({
|
|
26
|
+
type: z.string().nullable().optional().describe("类型 StopVMDeployOrder 取消部署单 ResumeVMDeployOrder 继续部署单运行"),
|
|
27
|
+
disable: z.boolean().nullable().optional().describe("当前用户是否有权限进行后续 action"),
|
|
28
|
+
params: z.object({}).nullable().optional().describe("参数"),
|
|
29
|
+
});
|
|
30
|
+
export const DeployOrderSchema = z.object({
|
|
31
|
+
deployOrderId: z.number().int().nullable().optional().describe("部署单id"),
|
|
32
|
+
createTime: z.number().int().nullable().optional().describe("创建时间"),
|
|
33
|
+
updateTime: z.number().int().nullable().optional().describe("更新时间"),
|
|
34
|
+
creator: z.string().nullable().optional().describe("创建人"),
|
|
35
|
+
currentBatch: z.number().int().nullable().optional().describe("当前发布批次"),
|
|
36
|
+
totalBatch: z.number().int().nullable().optional().describe("总发布批次"),
|
|
37
|
+
status: z.string().nullable().optional().describe("发布状态 Waiting暂停 Running部署中 Cancelled已取消 Success成功"),
|
|
38
|
+
exceptionCode: z.string().nullable().optional().describe("错误码"),
|
|
39
|
+
actions: z.array(DeployOrderActionSchema).nullable().optional().describe("操作列表"),
|
|
40
|
+
deployMachineInfo: DeployOrderDeployMachinesSchema.nullable().optional().describe("部署机器信息"),
|
|
41
|
+
});
|
|
42
|
+
export const DeployOrderLogSchema = z.object({
|
|
43
|
+
deployLog: z.string().nullable().optional().describe("部署日志"),
|
|
44
|
+
aliyunRegion: z.string().nullable().optional().describe("部署地域"),
|
|
45
|
+
deployLogPath: z.string().nullable().optional().describe("部署日志路径"),
|
|
46
|
+
deployBeginTime: z.string().nullable().optional().describe("部署开始时间"),
|
|
47
|
+
deployEndTime: z.string().nullable().optional().describe("部署结束时间"),
|
|
48
|
+
});
|
|
49
|
+
// 定义API请求参数的Zod模式
|
|
50
|
+
export const BaseVMDeployOrderSchema = z.object({
|
|
51
|
+
organizationId: z.string().describe("企业Id"),
|
|
52
|
+
pipelineId: z.string().describe("流水线Id"),
|
|
53
|
+
deployOrderId: z.string().describe("部署单Id"),
|
|
54
|
+
});
|
|
55
|
+
export const StopVMDeployOrderSchema = BaseVMDeployOrderSchema;
|
|
56
|
+
export const SkipVMDeployMachineSchema = BaseVMDeployOrderSchema.extend({
|
|
57
|
+
machineSn: z.string().describe("机器sn"),
|
|
58
|
+
});
|
|
59
|
+
export const RetryVMDeployMachineSchema = BaseVMDeployOrderSchema.extend({
|
|
60
|
+
machineSn: z.string().describe("机器sn"),
|
|
61
|
+
});
|
|
62
|
+
export const ResumeVMDeployOrderSchema = BaseVMDeployOrderSchema;
|
|
63
|
+
export const GetVMDeployOrderSchema = BaseVMDeployOrderSchema;
|
|
64
|
+
export const GetVMDeployMachineLogSchema = BaseVMDeployOrderSchema.extend({
|
|
65
|
+
machineSn: z.string().describe("机器sn"),
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* 终止机器部署
|
|
69
|
+
* @param organizationId 企业Id
|
|
70
|
+
* @param pipelineId 流水线Id
|
|
71
|
+
* @param deployOrderId 部署单Id
|
|
72
|
+
* @returns 是否成功
|
|
73
|
+
*/
|
|
74
|
+
export async function stopVMDeployOrderFunc(organizationId, pipelineId, deployOrderId) {
|
|
75
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
76
|
+
const url = utils.isRegionEdition()
|
|
77
|
+
? `/oapi/v1/flow/pipelines/${pipelineId}/deploy/${deployOrderId}/stop`
|
|
78
|
+
: `/oapi/v1/flow/organizations/${finalOrgId}/pipelines/${pipelineId}/deploy/${deployOrderId}/stop`;
|
|
79
|
+
const response = await utils.yunxiaoRequest(url, {
|
|
80
|
+
method: "PUT",
|
|
81
|
+
});
|
|
82
|
+
return Boolean(response);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 跳过机器部署
|
|
86
|
+
* @param organizationId 企业Id
|
|
87
|
+
* @param pipelineId 流水线Id
|
|
88
|
+
* @param deployOrderId 部署单Id
|
|
89
|
+
* @param machineSn 机器sn
|
|
90
|
+
* @returns 是否成功
|
|
91
|
+
*/
|
|
92
|
+
export async function skipVMDeployMachineFunc(organizationId, pipelineId, deployOrderId, machineSn) {
|
|
93
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
94
|
+
const url = utils.isRegionEdition()
|
|
95
|
+
? `/oapi/v1/flow/pipelines/${pipelineId}/deploy/${deployOrderId}/machine/${machineSn}/skip`
|
|
96
|
+
: `/oapi/v1/flow/organizations/${finalOrgId}/pipelines/${pipelineId}/deploy/${deployOrderId}/machine/${machineSn}/skip`;
|
|
97
|
+
const response = await utils.yunxiaoRequest(url, {
|
|
98
|
+
method: "PUT",
|
|
99
|
+
});
|
|
100
|
+
return Boolean(response);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 重试机器部署
|
|
104
|
+
* @param organizationId 企业Id
|
|
105
|
+
* @param pipelineId 流水线Id
|
|
106
|
+
* @param deployOrderId 部署单Id
|
|
107
|
+
* @param machineSn 机器sn
|
|
108
|
+
* @returns 是否成功
|
|
109
|
+
*/
|
|
110
|
+
export async function retryVMDeployMachineFunc(organizationId, pipelineId, deployOrderId, machineSn) {
|
|
111
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
112
|
+
const url = utils.isRegionEdition()
|
|
113
|
+
? `/oapi/v1/flow/pipelines/${pipelineId}/deploy/${deployOrderId}/machine/${machineSn}/retry`
|
|
114
|
+
: `/oapi/v1/flow/organizations/${finalOrgId}/pipelines/${pipelineId}/deploy/${deployOrderId}/machine/${machineSn}/retry`;
|
|
115
|
+
const response = await utils.yunxiaoRequest(url, {
|
|
116
|
+
method: "PUT",
|
|
117
|
+
});
|
|
118
|
+
return Boolean(response);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 继续部署单运行
|
|
122
|
+
* @param organizationId 企业Id
|
|
123
|
+
* @param pipelineId 流水线Id
|
|
124
|
+
* @param deployOrderId 部署单Id
|
|
125
|
+
* @returns 是否成功
|
|
126
|
+
*/
|
|
127
|
+
export async function resumeVMDeployOrderFunc(organizationId, pipelineId, deployOrderId) {
|
|
128
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
129
|
+
const url = utils.isRegionEdition()
|
|
130
|
+
? `/oapi/v1/flow/pipelines/${pipelineId}/deploy/${deployOrderId}/resume`
|
|
131
|
+
: `/oapi/v1/flow/organizations/${finalOrgId}/pipelines/${pipelineId}/deploy/${deployOrderId}/resume`;
|
|
132
|
+
const response = await utils.yunxiaoRequest(url, {
|
|
133
|
+
method: "PUT",
|
|
134
|
+
});
|
|
135
|
+
return Boolean(response);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 获取部署单详情
|
|
139
|
+
* @param organizationId 企业Id
|
|
140
|
+
* @param pipelineId 流水线id
|
|
141
|
+
* @param deployOrderId 部署Id
|
|
142
|
+
* @returns 部署单详情
|
|
143
|
+
*/
|
|
144
|
+
export async function getVMDeployOrderFunc(organizationId, pipelineId, deployOrderId) {
|
|
145
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
146
|
+
const url = utils.isRegionEdition()
|
|
147
|
+
? `/oapi/v1/flow/pipelines/${pipelineId}/deploy/${deployOrderId}`
|
|
148
|
+
: `/oapi/v1/flow/organizations/${finalOrgId}/pipelines/${pipelineId}/deploy/${deployOrderId}`;
|
|
149
|
+
const response = await utils.yunxiaoRequest(url, {
|
|
150
|
+
method: "GET",
|
|
151
|
+
});
|
|
152
|
+
return DeployOrderSchema.parse(response);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* 查询机器部署日志
|
|
156
|
+
* @param organizationId 企业Id
|
|
157
|
+
* @param pipelineId 流水线Id
|
|
158
|
+
* @param deployOrderId 部署单Id
|
|
159
|
+
* @param machineSn 机器sn
|
|
160
|
+
* @returns 机器部署日志
|
|
161
|
+
*/
|
|
162
|
+
export async function getVMDeployMachineLogFunc(organizationId, pipelineId, deployOrderId, machineSn) {
|
|
163
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
164
|
+
const url = utils.isRegionEdition()
|
|
165
|
+
? `/oapi/v1/flow/pipelines/${pipelineId}/deploy/${deployOrderId}/machine/${machineSn}/log`
|
|
166
|
+
: `/oapi/v1/flow/organizations/${finalOrgId}/pipelines/${pipelineId}/deploy/${deployOrderId}/machine/${machineSn}/log`;
|
|
167
|
+
const response = await utils.yunxiaoRequest(url, {
|
|
168
|
+
method: "GET",
|
|
169
|
+
});
|
|
170
|
+
return DeployOrderLogSchema.parse(response);
|
|
171
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { OrganizationMembersSchema, MemberInfoSchema, SearchOrganizationMembersResultSchema, } from './types.js';
|
|
2
|
+
import { buildUrl, yunxiaoRequest, isRegionEdition } from "../../common/utils.js";
|
|
3
|
+
import { resolveOrganizationId } from "./organization.js";
|
|
4
|
+
/**
|
|
5
|
+
* 查询组织成员列表
|
|
6
|
+
* @param organizationId 组织ID
|
|
7
|
+
* @param page 当前页,默认1
|
|
8
|
+
* @param perPage 每页数据条数,默认100
|
|
9
|
+
* @returns 组织成员列表
|
|
10
|
+
*/
|
|
11
|
+
export const getOrganizationMembersFunc = async (organizationId, page = 1, perPage = 100) => {
|
|
12
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
13
|
+
const url = isRegionEdition()
|
|
14
|
+
? `/oapi/v1/platform/members`
|
|
15
|
+
: `/oapi/v1/platform/organizations/${finalOrgId}/members`;
|
|
16
|
+
const params = {
|
|
17
|
+
page: page,
|
|
18
|
+
perPage: perPage
|
|
19
|
+
};
|
|
20
|
+
const urlWithParams = buildUrl(url, params);
|
|
21
|
+
const response = await yunxiaoRequest(urlWithParams, {
|
|
22
|
+
method: "GET",
|
|
23
|
+
});
|
|
24
|
+
// 验证响应数据结构
|
|
25
|
+
return OrganizationMembersSchema.parse(response);
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 查询组织成员详细信息
|
|
29
|
+
* @param organizationId 组织ID
|
|
30
|
+
* @param memberId 成员ID
|
|
31
|
+
* @returns 组织成员详细信息
|
|
32
|
+
*/
|
|
33
|
+
export const getOrganizationMemberInfoFunc = async (organizationId, memberId) => {
|
|
34
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
35
|
+
const url = isRegionEdition()
|
|
36
|
+
? `/oapi/v1/platform/members/${memberId}`
|
|
37
|
+
: `/oapi/v1/platform/organizations/${finalOrgId}/members/${memberId}`;
|
|
38
|
+
const response = await yunxiaoRequest(url, {
|
|
39
|
+
method: "GET",
|
|
40
|
+
});
|
|
41
|
+
return MemberInfoSchema.parse(response);
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 搜索组织成员
|
|
45
|
+
* @param organizationId 组织ID
|
|
46
|
+
* @param includeChildren
|
|
47
|
+
* @param page 当前页,默认1
|
|
48
|
+
* @param perPage 每页数据条数,默认100
|
|
49
|
+
* @param deptIds
|
|
50
|
+
* @param nextToken
|
|
51
|
+
* @param query
|
|
52
|
+
* @param roleIds
|
|
53
|
+
* @param statuses
|
|
54
|
+
* @returns 搜索到的组织成员列表
|
|
55
|
+
*/
|
|
56
|
+
export const searchOrganizationMembersFunc = async (organizationId, includeChildren = false, page = 1, perPage = 100, deptIds, nextToken, query, roleIds, statuses) => {
|
|
57
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
58
|
+
const url = isRegionEdition()
|
|
59
|
+
? `/oapi/v1/platform/members:search`
|
|
60
|
+
: `/oapi/v1/platform/organizations/${finalOrgId}/members:search`;
|
|
61
|
+
const payload = {
|
|
62
|
+
page: page,
|
|
63
|
+
perPage: perPage
|
|
64
|
+
};
|
|
65
|
+
if (deptIds) {
|
|
66
|
+
payload.deptIds = deptIds;
|
|
67
|
+
}
|
|
68
|
+
if (nextToken) {
|
|
69
|
+
payload.nextToken = nextToken;
|
|
70
|
+
}
|
|
71
|
+
if (query) {
|
|
72
|
+
payload.query = query;
|
|
73
|
+
}
|
|
74
|
+
if (roleIds) {
|
|
75
|
+
payload.roleIds = roleIds;
|
|
76
|
+
}
|
|
77
|
+
if (statuses) {
|
|
78
|
+
payload.statuses = statuses;
|
|
79
|
+
}
|
|
80
|
+
const response = await yunxiaoRequest(url, {
|
|
81
|
+
method: "POST",
|
|
82
|
+
body: payload,
|
|
83
|
+
});
|
|
84
|
+
// 验证响应数据结构
|
|
85
|
+
return SearchOrganizationMembersResultSchema.parse(response);
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* 通过用户ID查询组织成员详细信息
|
|
89
|
+
* @param organizationId 组织ID
|
|
90
|
+
* @param userId 用户ID
|
|
91
|
+
* @returns 组织成员详细信息
|
|
92
|
+
*/
|
|
93
|
+
export const getOrganizationMemberByUserIdInfoFunc = async (organizationId, userId) => {
|
|
94
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
95
|
+
const url = isRegionEdition()
|
|
96
|
+
? `/oapi/v1/platform/members:readByUser`
|
|
97
|
+
: `/oapi/v1/platform/organizations/${finalOrgId}/members:readByUser`;
|
|
98
|
+
const params = {
|
|
99
|
+
userId: userId
|
|
100
|
+
};
|
|
101
|
+
const urlWithParams = buildUrl(url, params);
|
|
102
|
+
const response = await yunxiaoRequest(urlWithParams, {
|
|
103
|
+
method: "GET",
|
|
104
|
+
});
|
|
105
|
+
return MemberInfoSchema.parse(response);
|
|
106
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { buildUrl, yunxiaoRequest, isRegionEdition, getRegionDefaultOrganizationId } from "../../common/utils.js";
|
|
2
|
+
import { CurrentOrganizationInfoSchema, UserOrganizationsInfoSchema, CurrentUserSchema, OrganizationDepartmentsSchema, DepartmentInfoSchema, OrganizationRoleSchema, OrganizationRole, } from "./types.js";
|
|
3
|
+
export async function getCurrentOrganizationInfoFunc() {
|
|
4
|
+
const url = "/oapi/v1/platform/user";
|
|
5
|
+
const response = await yunxiaoRequest(url, {
|
|
6
|
+
method: "GET",
|
|
7
|
+
});
|
|
8
|
+
const responseData = response;
|
|
9
|
+
const mappedResponse = {
|
|
10
|
+
lastOrganization: responseData.lastOrganization, // Organization ID
|
|
11
|
+
userId: responseData.id, // Map API's "id" to userId
|
|
12
|
+
userName: responseData.name // Map API's "name" to userName
|
|
13
|
+
};
|
|
14
|
+
return CurrentOrganizationInfoSchema.parse(mappedResponse);
|
|
15
|
+
}
|
|
16
|
+
export async function getUserOrganizationsFunc() {
|
|
17
|
+
const url = "/oapi/v1/platform/organizations";
|
|
18
|
+
const response = await yunxiaoRequest(url, {
|
|
19
|
+
method: "GET",
|
|
20
|
+
});
|
|
21
|
+
if (!Array.isArray(response)) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
return UserOrganizationsInfoSchema.parse(response);
|
|
25
|
+
}
|
|
26
|
+
export async function getOrganizationDepartmentsFunc(organizationId, parentId) {
|
|
27
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
28
|
+
const baseUrl = isRegionEdition()
|
|
29
|
+
? `/oapi/v1/platform/departments`
|
|
30
|
+
: `/oapi/v1/platform/organizations/${finalOrgId}/departments`;
|
|
31
|
+
const params = {};
|
|
32
|
+
if (parentId) {
|
|
33
|
+
params.parentId = parentId;
|
|
34
|
+
}
|
|
35
|
+
const url = buildUrl(baseUrl, params);
|
|
36
|
+
const response = await yunxiaoRequest(url, {
|
|
37
|
+
method: "GET"
|
|
38
|
+
});
|
|
39
|
+
return OrganizationDepartmentsSchema.parse(response);
|
|
40
|
+
}
|
|
41
|
+
export async function getOrganizationDepartmentInfoFunc(organizationId, id) {
|
|
42
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
43
|
+
const url = isRegionEdition()
|
|
44
|
+
? `/oapi/v1/platform/departments/${id}`
|
|
45
|
+
: `/oapi/v1/platform/organizations/${finalOrgId}/departments/${id}`;
|
|
46
|
+
const response = await yunxiaoRequest(url, {
|
|
47
|
+
method: "GET",
|
|
48
|
+
});
|
|
49
|
+
return DepartmentInfoSchema.parse(response);
|
|
50
|
+
}
|
|
51
|
+
export async function getOrganizationDepartmentAncestorsFunc(organizationId, id) {
|
|
52
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
53
|
+
const url = isRegionEdition()
|
|
54
|
+
? `/oapi/v1/platform/departments/${id}/ancestors`
|
|
55
|
+
: `/oapi/v1/platform/organizations/${finalOrgId}/departments/${id}/ancestors`;
|
|
56
|
+
const response = await yunxiaoRequest(url, {
|
|
57
|
+
method: "GET",
|
|
58
|
+
});
|
|
59
|
+
return OrganizationDepartmentsSchema.parse(response);
|
|
60
|
+
}
|
|
61
|
+
;
|
|
62
|
+
export async function listOrganizationRolesFunc(organizationId) {
|
|
63
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
64
|
+
const url = isRegionEdition()
|
|
65
|
+
? `/oapi/v1/platform/roles`
|
|
66
|
+
: `/oapi/v1/platform/organizations/${finalOrgId}/roles`;
|
|
67
|
+
const response = await yunxiaoRequest(url, {
|
|
68
|
+
method: "GET"
|
|
69
|
+
});
|
|
70
|
+
return OrganizationRole.parse(response);
|
|
71
|
+
}
|
|
72
|
+
export async function getOrganizationRoleFunc(organizationId, roleId) {
|
|
73
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
74
|
+
const url = isRegionEdition()
|
|
75
|
+
? `/oapi/v1/platform/roles/${roleId}`
|
|
76
|
+
: `/oapi/v1/platform/organizations/${finalOrgId}/roles/${roleId}`;
|
|
77
|
+
const response = await yunxiaoRequest(url, {
|
|
78
|
+
method: "GET"
|
|
79
|
+
});
|
|
80
|
+
return OrganizationRoleSchema.parse(response);
|
|
81
|
+
}
|
|
82
|
+
export async function getCurrentUserFunc() {
|
|
83
|
+
const url = "/oapi/v1/platform/user";
|
|
84
|
+
const response = await yunxiaoRequest(url, {
|
|
85
|
+
method: "GET",
|
|
86
|
+
});
|
|
87
|
+
return CurrentUserSchema.parse(response);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 统一解析 organizationId:
|
|
91
|
+
* - region 站:无论传什么 / 不传,最终统一用 getRegionDefaultOrganizationId()
|
|
92
|
+
* - 中心站:
|
|
93
|
+
* - 传入 explicitOrgId 则使用
|
|
94
|
+
* - 未传则从 /platform/user 的 lastOrganization 补充
|
|
95
|
+
*/
|
|
96
|
+
export async function resolveOrganizationId(explicitOrgId) {
|
|
97
|
+
if (isRegionEdition()) {
|
|
98
|
+
// region 模式:统一使用默认占位 orgId
|
|
99
|
+
return getRegionDefaultOrganizationId();
|
|
100
|
+
}
|
|
101
|
+
// 中心站模式
|
|
102
|
+
if (explicitOrgId && explicitOrgId !== "default") {
|
|
103
|
+
return explicitOrgId;
|
|
104
|
+
}
|
|
105
|
+
const info = await getCurrentOrganizationInfoFunc();
|
|
106
|
+
if (!info.lastOrganization) {
|
|
107
|
+
throw new Error("organizationId is required when using Yunxiao central edition");
|
|
108
|
+
}
|
|
109
|
+
return info.lastOrganization;
|
|
110
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Organization Role related types
|
|
3
|
+
export const OrganizationRoleSchema = z.object({
|
|
4
|
+
id: z.string().describe("Role ID"),
|
|
5
|
+
name: z.string().describe("Role name"),
|
|
6
|
+
organizationId: z.string().describe("Organization ID"),
|
|
7
|
+
permissions: z.array(z.string()).describe("Role permission list")
|
|
8
|
+
});
|
|
9
|
+
export const OrganizationRole = z.array(OrganizationRoleSchema);
|
|
10
|
+
export const ListOrganizationRolesSchema = z.object({
|
|
11
|
+
organizationId: z.string().describe("Organization ID")
|
|
12
|
+
});
|
|
13
|
+
export const GetOrganizationRoleSchema = z.object({
|
|
14
|
+
organizationId: z.string().describe("Organization ID"),
|
|
15
|
+
roleId: z.string().describe("Role ID")
|
|
16
|
+
});
|
|
17
|
+
// Organization Department related types
|
|
18
|
+
export const GetOrganizationDepartmentAncestorsSchema = z.object({
|
|
19
|
+
organizationId: z.string().describe("Organization ID"),
|
|
20
|
+
id: z.string().describe("Department ID"),
|
|
21
|
+
});
|
|
22
|
+
export const GetOrganizationDepartmentInfoSchema = z.object({
|
|
23
|
+
organizationId: z.string().describe("Organization ID"),
|
|
24
|
+
id: z.string().describe("Department ID"),
|
|
25
|
+
});
|
|
26
|
+
export const GetOrganizationDepartmentsSchema = z.object({
|
|
27
|
+
organizationId: z.string().describe("Organization ID"),
|
|
28
|
+
parentId: z.string().optional().describe("Parent department ID"),
|
|
29
|
+
});
|
|
30
|
+
// Organization related types
|
|
31
|
+
export const CurrentOrganizationInfoSchema = z.object({
|
|
32
|
+
lastOrganization: z.string().optional().describe("Organization ID of the most recent login, used for subsequent API calls, should be used as organizationId"),
|
|
33
|
+
userId: z.string().optional().describe("Current user ID, not the organization ID"),
|
|
34
|
+
userName: z.string().optional().describe("Current user name"),
|
|
35
|
+
});
|
|
36
|
+
export const OrganizationInfoSchema = z.object({
|
|
37
|
+
id: z.string().optional().describe("Organization ID"),
|
|
38
|
+
name: z.string().optional().describe("Organization name"),
|
|
39
|
+
description: z.string().optional().describe("Organization description"),
|
|
40
|
+
});
|
|
41
|
+
export const UserOrganizationsInfoSchema = z.array(OrganizationInfoSchema);
|
|
42
|
+
// User related types
|
|
43
|
+
export const UserInfoSchema = z.object({
|
|
44
|
+
id: z.string().nullable().optional().describe("User ID"),
|
|
45
|
+
name: z.string().nullable().optional().describe("User name"),
|
|
46
|
+
});
|
|
47
|
+
// Current user information schema
|
|
48
|
+
export const CurrentUserSchema = z.object({
|
|
49
|
+
id: z.string().nullable().optional().describe("User ID"),
|
|
50
|
+
name: z.string().optional().describe("Display name"),
|
|
51
|
+
email: z.string().optional().describe("Email address"),
|
|
52
|
+
username: z.string().optional().describe("Login account name"),
|
|
53
|
+
lastOrganization: z.string().optional().describe("Last login organization ID"),
|
|
54
|
+
staffId: z.string().optional().describe("Staff ID"),
|
|
55
|
+
nickName: z.string().optional().describe("Nickname"),
|
|
56
|
+
sysDeptIds: z.array(z.string()).optional().describe("Department IDs"),
|
|
57
|
+
createdAt: z.string().optional().describe("Creation time (ISO 8601格式)"),
|
|
58
|
+
deletedAt: z.string().optional().describe("Deletion time (ISO 8601格式)")
|
|
59
|
+
});
|
|
60
|
+
// Organization Department related types
|
|
61
|
+
export const DepartmentInfoSchema = z.object({
|
|
62
|
+
creatorId: z.string().optional().describe("创建人 ID"),
|
|
63
|
+
id: z.string().optional().describe("部门 ID"),
|
|
64
|
+
name: z.string().optional().describe("部门名称"),
|
|
65
|
+
organizationId: z.string().optional().describe("组织 ID"),
|
|
66
|
+
parentId: z.string().optional().describe("父部门 ID"),
|
|
67
|
+
hasSub: z.boolean().optional().describe("是否有子部门")
|
|
68
|
+
});
|
|
69
|
+
export const OrganizationDepartmentsSchema = z.array(DepartmentInfoSchema);
|
|
70
|
+
// Organization Member related types
|
|
71
|
+
export const MemberInfoSchema = z.object({
|
|
72
|
+
deptIds: z.array(z.string()).optional().describe("所属组织部门列表"),
|
|
73
|
+
id: z.string().optional().describe("成员 ID"),
|
|
74
|
+
joined: z.string().optional().describe("加入时间 (ISO 8601格式)"),
|
|
75
|
+
name: z.string().optional().describe("成员名"),
|
|
76
|
+
organizationId: z.string().optional().describe("组织 ID"),
|
|
77
|
+
roleIds: z.array(z.string()).optional().describe("角色信息"),
|
|
78
|
+
status: z.string().optional().describe("成员状态,可选值:ENABLED,DISABLED,UNDELETED,DELETED,NORMAL_USING,UNVISITED"),
|
|
79
|
+
userId: z.string().optional().describe("用户 ID"),
|
|
80
|
+
visited: z.string().optional().describe("最后访问时间 (ISO 8601格式)"),
|
|
81
|
+
});
|
|
82
|
+
export const OrganizationMembersSchema = z.array(MemberInfoSchema);
|
|
83
|
+
// Organization Member detail types
|
|
84
|
+
export const GetOrganizationMemberInfoSchema = z.object({
|
|
85
|
+
organizationId: z.string().describe("组织 ID"),
|
|
86
|
+
memberId: z.string().describe("成员 ID"),
|
|
87
|
+
});
|
|
88
|
+
// Get organization member by user ID types
|
|
89
|
+
export const GetOrganizationMemberByUserIdInfoSchema = z.object({
|
|
90
|
+
organizationId: z.string().describe("组织 ID"),
|
|
91
|
+
userId: z.string().describe("用户 ID"),
|
|
92
|
+
});
|
|
93
|
+
// Search organization members types
|
|
94
|
+
export const SearchOrganizationMembersSchema = z.object({
|
|
95
|
+
organizationId: z.string().describe("Organization ID, can be found in the basic information page of the organization admin console"),
|
|
96
|
+
deptIds: z.array(z.string()).optional().describe("Department IDs to search for"),
|
|
97
|
+
query: z.string().optional().describe("Search query"),
|
|
98
|
+
includeChildren: z.boolean().optional().describe("Whether to include sub-departments"),
|
|
99
|
+
nextToken: z.string().optional().describe("Next token for pagination"),
|
|
100
|
+
roleIds: z.array(z.string()).optional().describe("Role IDs to search for"),
|
|
101
|
+
statuses: z.array(z.string()).optional().describe("User statuses, posibble values: ENABLED,DISABLED,UNDELETED,DELETED,NORMAL_USING,UNVISITED。ENABLED=NORMAL_USING+UNVISITED;UNDELETED=ENABLED+DISABLED"),
|
|
102
|
+
page: z.number().int().optional().describe("Current page number, defaults to 1"),
|
|
103
|
+
perPage: z.number().int().optional().describe("Number of items per page, defaults to 100")
|
|
104
|
+
});
|
|
105
|
+
export const SearchOrganizationMembersResultSchema = z.array(MemberInfoSchema);
|
|
106
|
+
// Get organization members schema
|
|
107
|
+
export const GetOrganizationMembersSchema = z.object({
|
|
108
|
+
organizationId: z.string().describe("Organization ID"),
|
|
109
|
+
page: z.number().int().optional().describe("Page number"),
|
|
110
|
+
perPage: z.number().int().optional().describe("Page size"),
|
|
111
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { yunxiaoRequest, buildUrl, isRegionEdition } from "../../common/utils.js";
|
|
2
|
+
import { resolveOrganizationId } from "../organization/organization.js";
|
|
3
|
+
import { ArtifactSchema, } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* 查询制品信息
|
|
6
|
+
* @param organizationId
|
|
7
|
+
* @param repoId
|
|
8
|
+
* @param repoType
|
|
9
|
+
* @param page
|
|
10
|
+
* @param perPage
|
|
11
|
+
* @param search
|
|
12
|
+
* @param orderBy
|
|
13
|
+
* @param sort
|
|
14
|
+
* @returns 制品信息列表
|
|
15
|
+
*/
|
|
16
|
+
export async function listArtifactsFunc(organizationId, repoId, repoType, page, perPage, search, orderBy = "latestUpdate", sort = "desc") {
|
|
17
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
18
|
+
const baseUrl = isRegionEdition()
|
|
19
|
+
? `/oapi/v1/packages/repositories/${repoId}/artifacts`
|
|
20
|
+
: `/oapi/v1/packages/organizations/${finalOrgId}/repositories/${repoId}/artifacts`;
|
|
21
|
+
const queryParams = {
|
|
22
|
+
repoType,
|
|
23
|
+
};
|
|
24
|
+
if (page !== undefined) {
|
|
25
|
+
queryParams.page = page;
|
|
26
|
+
}
|
|
27
|
+
if (perPage !== undefined) {
|
|
28
|
+
queryParams.perPage = perPage;
|
|
29
|
+
}
|
|
30
|
+
if (search !== undefined) {
|
|
31
|
+
queryParams.search = search;
|
|
32
|
+
}
|
|
33
|
+
queryParams.orderBy = orderBy;
|
|
34
|
+
queryParams.sort = sort;
|
|
35
|
+
const url = buildUrl(baseUrl, queryParams);
|
|
36
|
+
const response = await yunxiaoRequest(url, {
|
|
37
|
+
method: "GET",
|
|
38
|
+
});
|
|
39
|
+
if (!Array.isArray(response)) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
return response.map(artifact => ArtifactSchema.parse(artifact));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 查看单个制品信息
|
|
46
|
+
* @param organizationId
|
|
47
|
+
* @param repoId
|
|
48
|
+
* @param id
|
|
49
|
+
* @param repoType
|
|
50
|
+
* @returns 制品信息
|
|
51
|
+
*/
|
|
52
|
+
export async function getArtifactFunc(organizationId, repoId, id, repoType) {
|
|
53
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
54
|
+
const baseUrl = isRegionEdition()
|
|
55
|
+
? `/oapi/v1/packages/repositories/${repoId}/artifacts/${id}`
|
|
56
|
+
: `/oapi/v1/packages/organizations/${finalOrgId}/repositories/${repoId}/artifacts/${id}`;
|
|
57
|
+
const queryParams = {
|
|
58
|
+
repoType,
|
|
59
|
+
};
|
|
60
|
+
const url = buildUrl(baseUrl, queryParams);
|
|
61
|
+
try {
|
|
62
|
+
const response = await yunxiaoRequest(url, {
|
|
63
|
+
method: "GET",
|
|
64
|
+
});
|
|
65
|
+
return ArtifactSchema.parse(response);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error(`Error fetching artifact: ${error}`);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { yunxiaoRequest, buildUrl, isRegionEdition } from "../../common/utils.js";
|
|
2
|
+
import { resolveOrganizationId } from "../organization/organization.js";
|
|
3
|
+
import { PackageRepositorySchema, } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* 查看制品仓库信息
|
|
6
|
+
* @param organizationId
|
|
7
|
+
* @param repoTypes
|
|
8
|
+
* @param repoCategories
|
|
9
|
+
* @param perPage
|
|
10
|
+
* @param page
|
|
11
|
+
* @returns 制品仓库信息列表
|
|
12
|
+
*/
|
|
13
|
+
export async function listPackageRepositoriesFunc(organizationId, repoTypes, repoCategories, perPage, page) {
|
|
14
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
15
|
+
const baseUrl = isRegionEdition()
|
|
16
|
+
? `/oapi/v1/packages/repositories`
|
|
17
|
+
: `/oapi/v1/packages/organizations/${finalOrgId}/repositories`;
|
|
18
|
+
const queryParams = {};
|
|
19
|
+
if (repoTypes !== undefined) {
|
|
20
|
+
queryParams.repoTypes = repoTypes;
|
|
21
|
+
}
|
|
22
|
+
if (repoCategories !== undefined) {
|
|
23
|
+
queryParams.repoCategories = repoCategories;
|
|
24
|
+
}
|
|
25
|
+
if (perPage !== undefined) {
|
|
26
|
+
queryParams.perPage = perPage;
|
|
27
|
+
}
|
|
28
|
+
if (page !== undefined) {
|
|
29
|
+
queryParams.page = page;
|
|
30
|
+
}
|
|
31
|
+
const url = buildUrl(baseUrl, queryParams);
|
|
32
|
+
const response = await yunxiaoRequest(url, {
|
|
33
|
+
method: "GET",
|
|
34
|
+
});
|
|
35
|
+
if (!Array.isArray(response)) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
return response.map(repo => PackageRepositorySchema.parse(repo));
|
|
39
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Package Repository related schemas
|
|
3
|
+
export const PackageRepositorySchema = z.object({
|
|
4
|
+
accessLevel: z.string().nullable().optional().describe("Access level: PRIVATE - Private repository (only accessible to repository members), INTERNAL - Organization-wide visibility (accessible to all organization members)"),
|
|
5
|
+
latestUpdate: z.number().int().nullable().optional().describe("Latest update time in milliseconds"),
|
|
6
|
+
repoCategory: z.string().nullable().optional().describe("Repository mode: Hybrid/Local/Proxy/ProxyCache/Group"),
|
|
7
|
+
repoDesc: z.string().nullable().optional().describe("Repository description"),
|
|
8
|
+
repoDescriptor: z.string().nullable().optional().describe("Repository descriptor file"),
|
|
9
|
+
repoId: z.string().nullable().optional().describe("Repository ID"),
|
|
10
|
+
repoName: z.string().nullable().optional().describe("Repository name"),
|
|
11
|
+
repoType: z.string().nullable().optional().describe("Repository type: GENERIC/DOCKER/MAVEN/NPM/NUGET"),
|
|
12
|
+
star: z.boolean().nullable().optional().describe("Whether the repository is favorited"),
|
|
13
|
+
});
|
|
14
|
+
export const ListPackageRepositoriesSchema = z.object({
|
|
15
|
+
organizationId: z.string().describe("Organization ID"),
|
|
16
|
+
repoTypes: z.string().optional().describe("Repository types, available values: GENERIC/DOCKER/MAVEN/NPM/NUGET, multiple types can be separated by commas"),
|
|
17
|
+
repoCategories: z.string().optional().describe("Repository modes, available values: Hybrid/Local/Proxy/ProxyCache/Group, multiple modes can be separated by commas"),
|
|
18
|
+
perPage: z.number().int().optional().default(8).describe("Number of items per page, default value is 8"),
|
|
19
|
+
page: z.number().int().optional().default(1).describe("Current page number"),
|
|
20
|
+
});
|
|
21
|
+
// Artifact related schemas
|
|
22
|
+
export const ArtifactVersionSchema = z.object({
|
|
23
|
+
createTime: z.number().int().nullable().optional().describe("Creation time in milliseconds"),
|
|
24
|
+
creator: z.string().nullable().optional().describe("Creator"),
|
|
25
|
+
gmtDownload: z.number().int().nullable().optional().describe("Latest download time in milliseconds"),
|
|
26
|
+
id: z.number().int().nullable().optional().describe("Artifact version ID"),
|
|
27
|
+
modifier: z.string().nullable().optional().describe("Modifier"),
|
|
28
|
+
updateTime: z.number().int().nullable().optional().describe("Modification time in milliseconds"),
|
|
29
|
+
version: z.string().nullable().optional().describe("Version number"),
|
|
30
|
+
});
|
|
31
|
+
export const ArtifactSchema = z.object({
|
|
32
|
+
downloadCount: z.number().int().nullable().optional().describe("Download count"),
|
|
33
|
+
gmtDownload: z.number().int().nullable().optional().describe("Latest download time in milliseconds"),
|
|
34
|
+
id: z.number().int().nullable().optional().describe("Artifact ID"),
|
|
35
|
+
latestUpdate: z.number().int().nullable().optional().describe("Latest update time in milliseconds"),
|
|
36
|
+
module: z.string().nullable().optional().describe("Module name"),
|
|
37
|
+
organization: z.string().nullable().optional().describe("Organization information"),
|
|
38
|
+
repositoryId: z.string().nullable().optional().describe("Repository ID"),
|
|
39
|
+
versions: z.array(ArtifactVersionSchema).nullable().optional().describe("Version list"),
|
|
40
|
+
});
|
|
41
|
+
export const ListArtifactsSchema = z.object({
|
|
42
|
+
organizationId: z.string().describe("Organization ID"),
|
|
43
|
+
repoId: z.string().describe("Repository ID"),
|
|
44
|
+
repoType: z.string().describe("Repository type, available values: GENERIC/DOCKER/MAVEN/NPM/NUGET"),
|
|
45
|
+
page: z.number().int().optional().default(1).describe("Current page number"),
|
|
46
|
+
perPage: z.number().int().optional().default(8).describe("Number of items per page, default is 10"),
|
|
47
|
+
search: z.string().optional().describe("Search by package name"),
|
|
48
|
+
orderBy: z.string().optional().default("latestUpdate").describe("Sort method: latestUpdate - by latest update time in milliseconds; gmtDownload - by latest download time in milliseconds"),
|
|
49
|
+
sort: z.string().optional().default("desc").describe("Sort order: asc - ascending; desc - descending"),
|
|
50
|
+
});
|
|
51
|
+
export const GetArtifactSchema = z.object({
|
|
52
|
+
organizationId: z.string().describe("Organization ID"),
|
|
53
|
+
repoId: z.string().describe("Repository ID"),
|
|
54
|
+
id: z.number().int().describe("Artifact ID, can be obtained from ListArtifacts API"),
|
|
55
|
+
repoType: z.string().describe("Repository type, available values: GENERIC/DOCKER/MAVEN/NPM/NUGET/PYPI"),
|
|
56
|
+
});
|