diff --git a/index.d.ts b/index.d.ts index 0ed4ee7..432be34 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,14 +1,14 @@ import { AxiosInstance } from 'axios'; -export interface AppOptions { +declare interface AppOptions { readonly slug: string; } -export interface Client { +declare interface Client { app(options: AppOptions): App; } -export interface App { +declare interface App { readonly app: { slug: string }; /** @@ -20,23 +20,23 @@ export interface App { triggerBuild(buildParams?: BuildOptions): Promise; } -export interface AbortOptions { +declare interface AbortOptions { readonly reason?: string; readonly withSuccess?: boolean; readonly skipNotifications?: boolean; } -export interface FollowOptions { +declare interface FollowOptions { readonly heartbeat?: number; readonly interval?: number; } -export interface AbortResponse { +declare interface AbortResponse { readonly status?: string; readonly message?: string; } -export interface BuildDescription { +declare interface BuildDescription { readonly abort_reason: string; readonly branch: string; readonly build_number: number; @@ -62,10 +62,8 @@ export interface BuildDescription { readonly triggered_workflow: string; } -export interface Build { - abort( - options?: Pick> - ): Promise; +declare interface Build { + abort(options?: Omit): Promise; abort(options?: AbortOptions): Promise; describe(): Promise; @@ -75,19 +73,19 @@ export interface Build { isFinished(): Promise; } -export interface CommitPathsFilter { +declare interface CommitPathsFilter { readonly added?: string[]; readonly modified?: string[]; readonly removed?: string[]; } -export type BuildTargetStrategy = +declare type BuildTargetStrategy = | { branch: string } | { commitHash: string } | { workflow: string } | { tag: string }; -export interface BaseBuildOptions { +declare interface BaseBuildOptions { readonly branch?: string; readonly commitHash?: string; readonly commitMessage?: string; @@ -106,11 +104,12 @@ export interface BaseBuildOptions { readonly target?: string; } -export type BuildOptions = BaseBuildOptions & BuildTargetStrategy; +declare type BuildOptions = BaseBuildOptions & BuildTargetStrategy; -export interface ClientConfiguration { +declare interface ClientConfiguration { readonly token: string; } -export const createClient: (config: ClientConfiguration) => Client; -export default createClient; +declare function createClient(config: ClientConfiguration): Client; + +export = createClient; diff --git a/src/client.js b/src/client.js index 67db881..2a11815 100644 --- a/src/client.js +++ b/src/client.js @@ -19,5 +19,3 @@ const createClient = ({ token }) => { }; module.exports = createClient; -module.exports.createClient = createClient; -module.exports.default = createClient;