|
|
@ -17,17 +17,11 @@ import stopProcessSchema from "./schemas/stop-process"; |
|
|
|
import killProcessSchema from "./schemas/kill-process"; |
|
|
|
import killProcessSchema from "./schemas/kill-process"; |
|
|
|
import commandSchema from "./schemas/command"; |
|
|
|
import commandSchema from "./schemas/command"; |
|
|
|
|
|
|
|
|
|
|
|
export class SMClient { |
|
|
|
export class SMClient extends SchemaClient { |
|
|
|
schemaClient: SchemaClient |
|
|
|
baseUrl = 'http://fmw.sipachev.sv' |
|
|
|
|
|
|
|
|
|
|
|
constructor() { |
|
|
|
|
|
|
|
this.schemaClient = new SchemaClient({ |
|
|
|
|
|
|
|
baseUrl: 'http://fmw.sipachev.sv' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async getCommands(): Promise<ResponseInterface<CommandResponseInterface[]>> { |
|
|
|
async getCommands(): Promise<ResponseInterface<CommandResponseInterface[]>> { |
|
|
|
let { responseData, headers } = await this.schemaClient.send(commandsSchema, {}) |
|
|
|
let { responseData, headers } = await this.send(commandsSchema, {}) |
|
|
|
return { |
|
|
|
return { |
|
|
|
data: responseData, |
|
|
|
data: responseData, |
|
|
|
headers: headers |
|
|
|
headers: headers |
|
|
@ -35,7 +29,7 @@ export class SMClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async getCommand(name: string): Promise<ResponseInterface<CommandResponseInterface>> { |
|
|
|
async getCommand(name: string): Promise<ResponseInterface<CommandResponseInterface>> { |
|
|
|
let { responseData, headers } = await this.schemaClient.send(commandSchema, { |
|
|
|
let { responseData, headers } = await this.send(commandSchema, { |
|
|
|
commandName: name |
|
|
|
commandName: name |
|
|
|
}) |
|
|
|
}) |
|
|
|
return { |
|
|
|
return { |
|
|
@ -45,7 +39,7 @@ export class SMClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async runCommand(data: any): Promise<ResponseInterface> { |
|
|
|
async runCommand(data: any): Promise<ResponseInterface> { |
|
|
|
let { headers } = await this.schemaClient.send(runCommandsSchema, data) |
|
|
|
let { headers } = await this.send(runCommandsSchema, data) |
|
|
|
return { |
|
|
|
return { |
|
|
|
data: null, |
|
|
|
data: null, |
|
|
|
headers: headers |
|
|
|
headers: headers |
|
|
@ -53,7 +47,7 @@ export class SMClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async getProcesses(data: GetProcessesRequest | PaginationRequest): Promise<ResponseInterface<ProcessesResponseInterface[]>> { |
|
|
|
async getProcesses(data: GetProcessesRequest | PaginationRequest): Promise<ResponseInterface<ProcessesResponseInterface[]>> { |
|
|
|
let { responseData, headers } = await this.schemaClient.send(processesSchema, data) |
|
|
|
let { responseData, headers } = await this.send(processesSchema, data) |
|
|
|
return { |
|
|
|
return { |
|
|
|
data: responseData, |
|
|
|
data: responseData, |
|
|
|
headers: headers |
|
|
|
headers: headers |
|
|
@ -61,7 +55,7 @@ export class SMClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async repeatProcess(data: RepeatProcessRequest): Promise<ResponseInterface> { |
|
|
|
async repeatProcess(data: RepeatProcessRequest): Promise<ResponseInterface> { |
|
|
|
let { responseData, headers } = await this.schemaClient.send(repeatProcessSchema, data) |
|
|
|
let { responseData, headers } = await this.send(repeatProcessSchema, data) |
|
|
|
return { |
|
|
|
return { |
|
|
|
data: responseData as ProcessesResponseInterface[], |
|
|
|
data: responseData as ProcessesResponseInterface[], |
|
|
|
headers: headers |
|
|
|
headers: headers |
|
|
@ -69,7 +63,7 @@ export class SMClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async getProcessOutput(data: ProcessOutputRequest): Promise<ResponseInterface> { |
|
|
|
async getProcessOutput(data: ProcessOutputRequest): Promise<ResponseInterface> { |
|
|
|
let { responseData, headers } = await this.schemaClient.send(processOutputSchema, data) |
|
|
|
let { responseData, headers } = await this.send(processOutputSchema, data) |
|
|
|
return { |
|
|
|
return { |
|
|
|
data: responseData, |
|
|
|
data: responseData, |
|
|
|
headers: headers |
|
|
|
headers: headers |
|
|
@ -77,7 +71,7 @@ export class SMClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async playProcess(id: string): Promise<ResponseInterface> { |
|
|
|
async playProcess(id: string): Promise<ResponseInterface> { |
|
|
|
let { headers } = await this.schemaClient.send(playProcessSchema, {id}) |
|
|
|
let { headers } = await this.send(playProcessSchema, {id}) |
|
|
|
return { |
|
|
|
return { |
|
|
|
data: null, |
|
|
|
data: null, |
|
|
|
headers: headers |
|
|
|
headers: headers |
|
|
@ -85,7 +79,7 @@ export class SMClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async pauseProcess(id: string): Promise<ResponseInterface> { |
|
|
|
async pauseProcess(id: string): Promise<ResponseInterface> { |
|
|
|
let { headers } = await this.schemaClient.send(pauseProcessSchema, {id}) |
|
|
|
let { headers } = await this.send(pauseProcessSchema, {id}) |
|
|
|
return { |
|
|
|
return { |
|
|
|
data: null, |
|
|
|
data: null, |
|
|
|
headers: headers |
|
|
|
headers: headers |
|
|
@ -93,7 +87,7 @@ export class SMClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async stopProcess(id: string): Promise<ResponseInterface> { |
|
|
|
async stopProcess(id: string): Promise<ResponseInterface> { |
|
|
|
let { headers } = await this.schemaClient.send(stopProcessSchema, {id}) |
|
|
|
let { headers } = await this.send(stopProcessSchema, {id}) |
|
|
|
return { |
|
|
|
return { |
|
|
|
data: null, |
|
|
|
data: null, |
|
|
|
headers: headers |
|
|
|
headers: headers |
|
|
@ -101,7 +95,7 @@ export class SMClient { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async killProcess(id: string): Promise<ResponseInterface> { |
|
|
|
async killProcess(id: string): Promise<ResponseInterface> { |
|
|
|
let { headers } = await this.schemaClient.send(killProcessSchema, {id}) |
|
|
|
let { headers } = await this.send(killProcessSchema, {id}) |
|
|
|
return { |
|
|
|
return { |
|
|
|
data: null, |
|
|
|
data: null, |
|
|
|
headers: headers |
|
|
|
headers: headers |
|
|
|