import type { ExtractStrict } from 'type-fest'; import type { EndpointFromPaths } from '../types'; import type { components, paths } from './draft.contract'; type DraftEndpoints = EndpointFromPaths; export type CreateDraftItemEndpoint = ExtractStrict; export type GetDraftItemsEndpoint = ExtractStrict; export type ReplaceDraftItemEndpoint = ExtractStrict; /** TODO(sfl): narrow to the union of known flow names once the backend enumerates them. */ export type FlowName = string; export type QueryKeyDraft = ['draft', string, FlowName]; /** * TODO: this is clunky, align with BE */ export type CreateDraftItemRequest = Omit & { payload: object; }; /** Only the payload is passed in by the caller; `flowIntent` comes from the hook */ export type CreateDraftItemPayload = Pick; /** TODO: fix this optional BE stuff, it's not optional */ export type DraftItemResponse = Omit & { draftItemId: string; payload: object; }; export type DraftItemsResponse = Omit & { items?: DraftItemResponse[]; }; /** `draftItemId` is a path parameter; `expectedRevision` and `payload` form the request body */ export type ReplaceDraftItemRequest = Omit & { draftItemId: string; payload: object; }; export {};