ObjectStackObjectStack

Package Lifecycle

Package Lifecycle protocol schemas

Package lifecycle response contracts (#12038)

Response payloads for the dispatcher-served packages.* lifecycle routes — the ADR-0067 commit timeline, the ADR-0033 draft batch doors, the ADR-0070 export / adopt / duplicate family — ruled on 2026-08-27 (#12038, 1C · 2C · 3A · 4A · 5A).

Every schema here is a DESCRIBE-ONLY TRANSCRIPTION of the return type its producer already declares inline (@objectstack/metadata-protocol protocol.ts, except where a schema's own docblock says otherwise) — authoring one changes no wire byte. All of these routes are served by the runtime dispatcher ONLY (no REST twin — #12038 survey §1b), which answers through the { success, data } envelope (http-dispatcher.ts), so each schema declares the data payload, envelope-free — the same convention as PublishPackageDraftsResponseSchema and its ledger row.

packages.publish's contract is NOT here: its producer (MetadataManager.publishPackage) already has an exact published schema, PackagePublishResultSchema in @objectstack/spec/system — re-exported below into this /api namespace (ruling 5A: re-export, never a second copy) because the route-ledger resolver looks names up only in @objectstack/spec/api.

The retired PackageRollbackResponseSchema and its PackageApiContracts.rollbackPackage binding (see ./package-api.zod.ts) declared a VERSION rollback against the live COMMIT-rollback path; RollbackToPackageCommitResponseSchema below is the true contract, authored after that retirement per the ruling's sequencing (3A).

Source: packages/spec/src/api/package-lifecycle.zod.ts

TypeScript Usage

import { DiscardPackageDraftsResponseSchema, DuplicatePackageResponseSchema, ListPackageCommitsResponseSchema, PackageExportManifestSchema, PackagePublishResultSchema, ReassignOrphanedMetadataResponseSchema, RevertPackageCommitResponseSchema, RollbackToPackageCommitResponseSchema } from '@objectstack/spec/api';
import type { DiscardPackageDraftsResponse, DuplicatePackageResponse, ListPackageCommitsResponse, PackageExportManifest, PackagePublishResult, ReassignOrphanedMetadataResponse, RevertPackageCommitResponse, RollbackToPackageCommitResponse } from '@objectstack/spec/api';

// Validate data
const result = DiscardPackageDraftsResponseSchema.parse(data);

DiscardPackageDraftsResponse

Properties

PropertyTypeRequiredDescription
successbooleanTrue exactly when nothing failed.
discardedCountnumberHow many drafts were discarded.
failedCountnumberHow many drafts could not be discarded.
discarded{ type: string; name: string }[]Every draft that was discarded.
failed{ type: string; name: string; error: string; code?: string }[]Every draft the discard could not remove.

Nested Shape: DiscardPackageDraftsResponse.discarded[number]

PropertyTypeRequiredDescription
typestringMetadata type of the discarded draft.
namestringName of the discarded draft.

Nested Shape: DiscardPackageDraftsResponse.failed[number]

PropertyTypeRequiredDescription
typestringMetadata type of the failing draft.
namestringName of the failing draft.
errorstringWhy the discard failed.
codestringoptionalMachine-readable failure code, when one was recorded.

DuplicatePackageResponse

Properties

PropertyTypeRequiredDescription
successbooleanThe duplicate's own verdict: true exactly when nothing failed AND at least one item was copied.
copiedCountnumberHow many items were copied.
failedCountnumberHow many items could not be copied.
targetPackageIdstringThe new package the base was cloned into.
copied{ type: string; name: string }[]Every item that was copied.
failed{ type: string; name: string; error: string }[]Every item the clone could not copy.

Nested Shape: DuplicatePackageResponse.copied[number]

PropertyTypeRequiredDescription
typestringMetadata type of the copied item.
namestringName of the copied item.

Nested Shape: DuplicatePackageResponse.failed[number]

PropertyTypeRequiredDescription
typestringMetadata type of the failing item.
namestringName of the failing item.
errorstringWhy copying it failed.

ListPackageCommitsResponse

Properties

PropertyTypeRequiredDescription
commits{ id: string; operation: Enum<'apply' | 'revert'>; message?: string; actor?: string; … }[]The commit timeline, newest first.

Nested Shape: ListPackageCommitsResponse.commits[number]

PropertyTypeRequiredDescription
idstringCommit id.
operationEnum<'apply' | 'revert'>Whether the commit applied changes or reverted an earlier commit.
messagestringoptionalCommit message, when one was recorded.
actorstringoptionalWho made the commit, when recorded.
aiModelstringoptionalAI model that authored the change, when recorded.
parentCommitIdstringoptionalThe commit this one chains from, when recorded.
itemCountnumberHow many items the commit touched.
items{ type: string; name: string; existedBefore: boolean; prevVersion: number | null }[]The items the commit touched.
createdAtstringoptionalWhen the commit was made (ISO-8601 string), when recorded.

PackageExportManifest

Properties

PropertyTypeRequiredDescription
idstringThe exported package's id.
namestringThe exported package's machine name.
versionstringThe exported package's version.
labelstringoptionalDisplay label, when the package declares one.

PackagePublishResult

Properties

PropertyTypeRequiredDescription
successbooleanWhether the publish succeeded
packageIdstringThe package ID that was published
versionintegerNew version number after publish
publishedAtstringPublish timestamp
itemsPublishedintegerTotal metadata items published
validationErrors{ type: string; name: string; message: string }[]optionalValidation errors if publish failed

Nested Shape: PackagePublishResult.validationErrors[number]

PropertyTypeRequiredDescription
typestringMetadata type that failed validation
namestringItem name that failed validation
messagestringValidation error message

ReassignOrphanedMetadataResponse

Properties

PropertyTypeRequiredDescription
successbooleanWhether the reassignment ran.
reassignedCountnumberHow many orphaned items were adopted.
reassigned{ type: string; name: string }[]Every item that was adopted.
targetPackageIdstringThe package the items were adopted into.

Nested Shape: ReassignOrphanedMetadataResponse.reassigned[number]

PropertyTypeRequiredDescription
typestringMetadata type of the adopted item.
namestringName of the adopted item.

RevertPackageCommitResponse

Properties

PropertyTypeRequiredDescription
successbooleanTrue exactly when nothing failed.
revertedCountnumberHow many items were reverted.
failedCountnumberHow many items could not be reverted.
reverted{ type: string; name: string; action: Enum<'removed' | 'restored'> }[]Every item the revert touched.
failed{ type: string; name: string; error: string; code?: string }[]Every item the revert could not touch.
revertCommitIdstringoptionalId of the commit the revert itself created, when one was written.

Nested Shape: RevertPackageCommitResponse.reverted[number]

PropertyTypeRequiredDescription
typestringMetadata type of the reverted item.
namestringName of the reverted item.
actionEnum<'removed' | 'restored'>What the revert did to the item — removed what the commit created, or restored what it overwrote.

Nested Shape: RevertPackageCommitResponse.failed[number]

PropertyTypeRequiredDescription
typestringMetadata type of the failing item.
namestringName of the failing item.
errorstringWhy the revert failed for this item.
codestringoptionalMachine-readable failure code, when one was recorded.

RollbackToPackageCommitResponse

Properties

PropertyTypeRequiredDescription
successbooleanTrue exactly when nothing failed.
revertedCommitsstring[]Ids of the commits that were rolled back, in the order they were reverted.
failed{ commitId: string; error: string }[]Every commit the rollback could not revert.

Nested Shape: RollbackToPackageCommitResponse.failed[number]

PropertyTypeRequiredDescription
commitIdstringThe commit that could not be reverted.
errorstringWhy reverting it failed.

On this page