Add publisher release versions to plugins

This commit is contained in:
2026-09-18 01:16:45 -04:00
parent 166f039ae6
commit a718efc9e7
15 changed files with 167 additions and 29 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ export async function GET({ url }: { url: URL }) {
target_rel_path: script?.target_rel_path ?? '',
kind: script?.kind ?? bs.kind ?? 'script',
version: version
? { id: version.id, version: version.version, sha256: version.sha256 }
? { id: version.id, version: version.version, release_version: version.release_version, sha256: version.sha256 }
: null
};
});
+1 -1
View File
@@ -24,7 +24,7 @@ export async function GET({ params }: { params: { id: string } }) {
target_rel_path: script?.target_rel_path ?? '',
kind: script?.kind ?? bs.kind ?? 'script',
version: version
? { id: version.id, version: version.version, sha256: version.sha256 }
? { id: version.id, version: version.version, release_version: version.release_version, sha256: version.sha256 }
: null
};
});
+3 -1
View File
@@ -42,6 +42,7 @@ export async function GET({ url }: { url: URL }) {
? {
id: versions[0].id,
version: versions[0].version,
release_version: versions[0].release_version,
sha256: versions[0].sha256,
size: versions[0].size,
state: versions[0].state,
@@ -58,7 +59,7 @@ export async function GET({ url }: { url: URL }) {
// Multipart POST — creates an artifact + version 1 from either an uploaded
// file (script/plugin/baseline) or a text body (config overlay). Fields:
// name, scopeType, scopeValue, notes, kind (defaults to 'script'),
// name, scopeType, scopeValue, notes, releaseVersion, kind (defaults to 'script'),
// content (file). Configs may alternatively send `text` as a form field.
export async function POST({ request, url }: { request: Request; url: URL }) {
const form = await request.formData();
@@ -104,6 +105,7 @@ export async function POST({ request, url }: { request: Request; url: URL }) {
scopeValue,
content,
notes,
releaseVersion: form.has('releaseVersion') ? String(form.get('releaseVersion')) : undefined,
kind
});
return json({ ok: true, script, versionId: version.id });
+1
View File
@@ -23,6 +23,7 @@ export async function GET({ params }: { params: { id: string } }) {
const versions = listVersions(id).map((v) => ({
id: v.id,
version: v.version,
release_version: v.release_version,
sha256: v.sha256,
size: v.size,
notes: v.notes,
@@ -7,7 +7,7 @@ function parseId(idRaw: string): number | null {
}
// Multipart POST — creates a new version from an uploaded file. Fields:
// content (file), notes (optional). Response includes a "betaRequired" hint
// content (file), notes and releaseVersion (optional). Response includes a "betaRequired" hint
// when the script has a scope so the UI can nudge the operator to open a beta.
export async function POST({ params, request }: { params: { id: string }; request: Request }) {
const scriptId = parseId(params.id);
@@ -22,12 +22,14 @@ export async function POST({ params, request }: { params: { id: string }; reques
const content = Buffer.from(await file.arrayBuffer());
try {
const version = uploadNewVersion(scriptId, content, notes);
const releaseVersion = form.has('releaseVersion') ? String(form.get('releaseVersion')) : undefined;
const version = uploadNewVersion(scriptId, content, notes, releaseVersion);
return json({
ok: true,
version: {
id: version.id,
version: version.version,
release_version: version.release_version,
sha256: version.sha256,
size: version.size,
notes: version.notes,