收敛客户端静态发布链路
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { hostApiFetch } from '@/lib/host-api';
|
||||
import type { WorksCloudDeploymentRecord } from '../../shared/works-cloud-deployment';
|
||||
|
||||
export type ProjectPublic = {
|
||||
app_id: string;
|
||||
@@ -12,6 +11,8 @@ export type ProjectPublic = {
|
||||
status?: string | null;
|
||||
updated_at?: string | null;
|
||||
playable?: boolean;
|
||||
play_url?: string | null;
|
||||
/** @deprecated Use play_url. Kept for one client compatibility release. */
|
||||
runtime_url?: string | null;
|
||||
creator_name?: string | null;
|
||||
buddy_name?: string | null;
|
||||
@@ -109,15 +110,6 @@ export type WorksProjectStatusDetail = {
|
||||
versions: WorksProjectVersion[];
|
||||
};
|
||||
|
||||
export type WorksProjectUploadInput = {
|
||||
accessToken: string;
|
||||
appId: string;
|
||||
projectId: string;
|
||||
versionName: string;
|
||||
changeLog: string;
|
||||
zipFilePath: string;
|
||||
};
|
||||
|
||||
export type WorksStaticPackageSummary = {
|
||||
archiveName: string;
|
||||
sha256: string;
|
||||
@@ -293,7 +285,7 @@ export function toPlazaCard(project: ProjectPublic): PlazaCard {
|
||||
difficulty: project.difficulty ?? null,
|
||||
updatedAt: project.updated_at ?? null,
|
||||
playable: Boolean(project.playable),
|
||||
runtimeUrl: project.runtime_url ?? null,
|
||||
runtimeUrl: project.play_url ?? project.runtime_url ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -414,25 +406,6 @@ export async function fetchCurrentWorksProjectStatus(
|
||||
return assertSuccess(response, 'status', 'Failed to load Works Square project status');
|
||||
}
|
||||
|
||||
export async function uploadWorksProjectZip(
|
||||
input: WorksProjectUploadInput,
|
||||
): Promise<WorksProjectVersionUpload> {
|
||||
const response = await hostApiFetch<WorksActionResponse<'upload', WorksProjectVersionUpload>>(
|
||||
`/api/works/projects/${encodeURIComponent(input.appId)}/versions/upload`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
accessToken: input.accessToken,
|
||||
projectId: input.projectId,
|
||||
versionName: input.versionName,
|
||||
changeLog: input.changeLog,
|
||||
zipFilePath: input.zipFilePath,
|
||||
}),
|
||||
},
|
||||
);
|
||||
return assertSuccess(response, 'upload', 'Failed to upload Works Square project zip');
|
||||
}
|
||||
|
||||
export async function publishWorksProjectSource(
|
||||
input: WorksProjectSourcePublishInput,
|
||||
): Promise<WorksProjectSourcePublishResult> {
|
||||
@@ -460,28 +433,6 @@ export async function publishWorksProjectSource(
|
||||
return { package: response.package, upload: response.upload };
|
||||
}
|
||||
|
||||
export async function armWorksCloudDeployment(projectId: string): Promise<WorksCloudDeploymentRecord> {
|
||||
const response = await hostApiFetch<WorksActionResponse<'deployment', WorksCloudDeploymentRecord>>(
|
||||
`/api/opencode/projects/${encodeURIComponent(projectId)}/works-cloud-deploy`,
|
||||
{ method: 'POST', body: JSON.stringify({}) },
|
||||
);
|
||||
return assertSuccess(response, 'deployment', 'Failed to arm cloud deployment');
|
||||
}
|
||||
|
||||
export async function fetchWorksCloudDeployment(
|
||||
projectId: string,
|
||||
): Promise<WorksCloudDeploymentRecord | null> {
|
||||
const response = await hostApiFetch<{
|
||||
success: boolean;
|
||||
deployment?: WorksCloudDeploymentRecord | null;
|
||||
error?: string;
|
||||
}>(`/api/opencode/projects/${encodeURIComponent(projectId)}/works-cloud-deploy`);
|
||||
if (!response.success) {
|
||||
throw new WorksSquareApiError(response.error || 'Failed to read cloud deployment status');
|
||||
}
|
||||
return response.deployment ?? null;
|
||||
}
|
||||
|
||||
export async function fetchWorksProjectVersions(
|
||||
accessToken: string,
|
||||
appId: string,
|
||||
|
||||
Reference in New Issue
Block a user