29 lines
876 B
TypeScript
29 lines
876 B
TypeScript
import { z } from "zod/v4";
|
|
|
|
import { ConfigurationSchema } from "./access/access-definition";
|
|
|
|
export const SoftwareInstallationInputSchema = z.strictObject({
|
|
assetId: z.uuid(),
|
|
resourceId: z.uuid(),
|
|
licenseResourceId: z.uuid().nullable(),
|
|
version: z.string().trim().max(100).nullable(),
|
|
state: ConfigurationSchema,
|
|
notes: z.string().trim().max(4000).nullable(),
|
|
});
|
|
|
|
export type SoftwareInstallationInput = z.infer<typeof SoftwareInstallationInputSchema>;
|
|
|
|
export class SoftwareInstallationError extends Error {
|
|
constructor(public readonly code: string) {
|
|
super(code);
|
|
}
|
|
}
|
|
|
|
export const SOFTWARE_STATE_TRANSITIONS = {
|
|
pending: ["pending", "configured", "never_configured"],
|
|
configured: ["configured", "removal_pending"],
|
|
removal_pending: ["removal_pending", "removed"],
|
|
removed: ["removed"],
|
|
never_configured: ["never_configured"],
|
|
} as const;
|