import { FetchDataResponse, CreateObjectRequest, Action, GetListRequest, NextType, ObjectStateType } from '../types'; export type FileType = File | Blob | ArrayBuffer | Uint8Array; export type WithValue = { value: T; valueRef?: never; }; export type WithValueRef = { value?: never; valueRef: string; }; export type WithMutation = { value?: never; valueRef?: never; mutation: { patch?: T; incrementBy?: number; }; }; export interface Version extends Action { version: number; } export interface ValueRef { valueRef: string; } export interface VersionInfo { at: string; rec: string; version: number; type: ObjectStateType; } export type StateType = VersionInfo & (WithValue | WithValueRef); export type IStateResponse = { object: string; owner: string; } & StateType; export type StateBase = { at?: string; ttl?: number; object?: CreateObjectRequest; }; export type IState = StateBase & (WithValue | WithValueRef | WithMutation); export interface GetStateBase { object: string; } export type GetStateRequest = GetStateBase & Partial; export interface GetStateRefRequest extends GetStateBase { valueRef: string; } export interface VersionRef extends Version { object: string; } export interface ValueRefInfo extends ValueRef { objects: VersionRef[]; fileMimeType?: string; fileName?: string; fileSize?: number; } export interface SetValueRefRequest extends GetStateBase { filename?: string; filemimetype?: string; } export type GetValueListRequest = GetStateBase & GetListRequest; export interface GetListResponse extends NextType { values: ValueRefInfo[]; } export type SubjectStateResponse = FetchDataResponse>; export type SetStateResponse = FetchDataResponse; export type VersionListResponse = FetchDataResponse; export type SetValueRefResponse = FetchDataResponse; export type GetValueRefResponse = FetchDataResponse | null>; export type ValueListRefResponse = FetchDataResponse;