All files / layers / L1 / contracts runs.ts

75% Statements 3/4
100% Branches 0/0
66.66% Functions 2/3
75% Lines 3/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 3176x 2334x       11x                                                  
import type { ApiContract } from '@/layers/interfaces'
import type { components } from '@/types/api'
 
type Run = components['schemas']['Run']
type CreateRunRequest = components['schemas']['CreateRunRequest']
type UpdateRunRequest = components['schemas']['UpdateRunRequest']
 
type RunListQuery = {
  [key: string]: string | number | boolean | undefined
}
 
export const runsContract: ApiContract<
  Run & { id: string },
  CreateRunRequest,
  UpdateRunRequest,
  RunListQuery
> = {
  idOf: (e) => e.run_id as string,
  entityPath: 'runs',
  endpoints: {
    list: '/runs',
    detail: (id) => `/runs/${id}`,
    create: '/runs',
    update: (id) => `/runs/${id}`,
  },
  subscription: {
    ssePath: '/api/v1/runs/events',
    entityName: 'run',
  },
}