2026-10-05 11:13:51 +00:00
|
|
|
import { z } from "zod/v4";
|
|
|
|
|
|
|
|
|
|
import { FieldTypeSchema, ResourceDefinitionSchema } from "../api/domain/resource-definition";
|
|
|
|
|
|
|
|
|
|
export type { ResourceDefinitionSpec, ResourceFieldType } from "../api/domain/resource-definition";
|
|
|
|
|
|
|
|
|
|
export { FieldTypeSchema, ResourceDefinitionSchema };
|
|
|
|
|
export const CatalogParamsSchema = z.strictObject({
|
|
|
|
|
scope: z.union([z.literal("global"), z.uuid()]),
|
|
|
|
|
});
|
|
|
|
|
export const CatalogItemParamsSchema = CatalogParamsSchema.extend({ id: z.uuid() });
|
|
|
|
|
export const SaveDefinitionRequestSchema = z.strictObject({ values: ResourceDefinitionSchema });
|
|
|
|
|
export const AvailabilityRequestSchema = z.strictObject({ active: z.boolean().nullable() });
|
|
|
|
|
export const CatalogItemSchema = z.strictObject({
|
|
|
|
|
id: z.uuid(),
|
|
|
|
|
companyId: z.uuid().nullable(),
|
|
|
|
|
builtin: z.boolean(),
|
2026-10-05 15:01:32 +00:00
|
|
|
builtinKey: z.string().nullable().optional(),
|
2026-10-05 11:13:51 +00:00
|
|
|
active: z.boolean(),
|
|
|
|
|
effectiveActive: z.boolean(),
|
|
|
|
|
overridden: z.boolean(),
|
|
|
|
|
values: ResourceDefinitionSchema,
|
|
|
|
|
bindings: z.array(z.strictObject({ id: z.uuid(), fieldId: z.uuid(), required: z.boolean() })),
|
|
|
|
|
});
|
|
|
|
|
export const CatalogResponseSchema = z.strictObject({ items: z.array(CatalogItemSchema) });
|
|
|
|
|
export const SaveDefinitionResponseSchema = CatalogResponseSchema.extend({ savedId: z.uuid() });
|
|
|
|
|
export type CatalogItemDTO = z.infer<typeof CatalogItemSchema>;
|
|
|
|
|
export type CatalogResponseDTO = z.infer<typeof CatalogResponseSchema>;
|
|
|
|
|
export type SaveDefinitionResponseDTO = z.infer<typeof SaveDefinitionResponseSchema>;
|
|
|
|
|
|
|
|
|
|
export * from "./inventory";
|