-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
717 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { DataTypesEnum } from "./utils/data-types-enum"; | ||
import { CSRestOptions } from "./utils/axios-factory"; | ||
import Auth from "./handlers/auth"; | ||
import Nodes from "./handlers/nodes"; | ||
import Workflow from "./handlers/workflow"; | ||
import RHCore from "./handlers/rhcore"; | ||
import Search from "./handlers/search"; | ||
import Members from "./handlers/members"; | ||
import Versions from "./handlers/versions"; | ||
import WebReports from "./handlers/webreports"; | ||
import RPCClient from "./rpc-client/index"; | ||
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios"; | ||
export default class Session { | ||
protected readonly axios: AxiosInstance; | ||
protected _nodes: Nodes; | ||
protected _auth: Auth; | ||
protected _workflow: any; | ||
protected _rhcore: RHCore; | ||
protected _members: Members; | ||
protected _search: Search; | ||
protected _webreports: WebReports; | ||
protected _versions: Versions; | ||
readonly baseUrl: string; | ||
constructor(options: CSRestOptions); | ||
get nodes(): Nodes; | ||
get auth(): Auth; | ||
get workflow(): Workflow; | ||
get rhcore(): RHCore; | ||
get members(): Members; | ||
get search(): Search; | ||
get webreports(): WebReports; | ||
get versions(): Versions; | ||
get dataTypesEnum(): typeof DataTypesEnum; | ||
rpcClient(relativePath?: string): RPCClient; | ||
_isObject(value: unknown): value is Object; | ||
_isString(value: unknown): value is string; | ||
_isBoolean(value: unknown): value is boolean; | ||
_isFile(value: any): value is File; | ||
objectToForm(obj: Record<string, any>): any; | ||
putForm(url: any, params: any): Promise<AxiosResponse<any, any>>; | ||
postForm(url: any, params: any): Promise<AxiosResponse<any, any>>; | ||
patchForm(url: any, params: any): Promise<AxiosResponse<any, any>>; | ||
deleteForm(url: any, params: any): Promise<AxiosResponse<any, any>>; | ||
putBody(url: any, body: any): Promise<AxiosResponse<any, any>>; | ||
postBody(url: any, body: any): Promise<AxiosResponse<any, any>>; | ||
patchBody(url: any, body: any): Promise<AxiosResponse<any, any>>; | ||
deleteBody(url: any, body: any): Promise<AxiosResponse<any, any>>; | ||
get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>; | ||
post<T = any, R = AxiosResponse<T>>(url: string, data?: T, config?: AxiosRequestConfig): Promise<R>; | ||
put<T = any, R = AxiosResponse<T>>(url: string, data?: T, config?: AxiosRequestConfig): Promise<R>; | ||
patch<T = any, R = AxiosResponse<T>>(url: string, data?: T, config?: AxiosRequestConfig): Promise<R>; | ||
options<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>; | ||
delete<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>; | ||
$get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import ServiceAbstract from "./service-abstract"; | ||
declare class Auth extends ServiceAbstract { | ||
auth(): Promise<import("axios").AxiosResponse<any, any>>; | ||
} | ||
export default Auth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Session from "../Session"; | ||
import ServiceAbstract from "./service-abstract"; | ||
declare class Members extends ServiceAbstract { | ||
readonly USER: number; | ||
readonly GROUP: number; | ||
constructor(session: Session); | ||
userQuery(query: any, options?: {}, version?: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
member(id: any, version?: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
} | ||
export default Members; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import ServiceAbstract from "./service-abstract"; | ||
declare class Nodes extends ServiceAbstract { | ||
addablenodetypes(dataid: any): Promise<import("axios").AxiosResponse<any, any>>; | ||
addDocument({ parent_id, fileHandler, apiVersion, name, options, }: { | ||
parent_id: number; | ||
fileHandler: File | string; | ||
apiVersion?: "v1" | "v2"; | ||
name?: string; | ||
options?: Record<string, any>; | ||
}): Promise<import("axios").AxiosResponse<any, any>>; | ||
addDocumentMajor({ parent_id, fileHandler, name, description, options, }: { | ||
parent_id: number; | ||
fileHandler: File | string; | ||
name?: string; | ||
description?: string; | ||
options: Record<string, any>; | ||
}): Promise<import("axios").AxiosResponse<any, any>>; | ||
addItem(type: any, parent_id: any, name: any, params?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
node({ dataid, apiVersion, params }: { | ||
dataid: any; | ||
apiVersion?: string; | ||
params?: {}; | ||
}): Promise<import("axios").AxiosResponse<any, any>>; | ||
ancestors(dataid: any, params?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
volumeInfo(objType: any): Promise<import("axios").AxiosResponse<any, any>>; | ||
volumes(): Promise<import("axios").AxiosResponse<any, any>>; | ||
addFolder(parent_id: any, name: any, params?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
addGeneration(parent_id: any, name: any, original_id: any, version_number: any, params?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
nodes(dataid: any, params?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
children(dataid: any, params?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
delete(dataid: any): Promise<import("axios").AxiosResponse<any, any>>; | ||
download({ dataid, apiVersion, filePath }: { | ||
dataid: any; | ||
apiVersion?: string; | ||
filePath: any; | ||
}): Promise<unknown>; | ||
audit({ dataid, apiVersion, params }: { | ||
dataid: any; | ||
apiVersion?: string; | ||
params?: {}; | ||
}): Promise<import("axios").AxiosResponse<any, any>>; | ||
} | ||
export default Nodes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import ServiceAbstract from "./service-abstract"; | ||
declare class RHCore extends ServiceAbstract { | ||
scriptNode(id: any, body?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
} | ||
export default RHCore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import ServiceAbstract from "./service-abstract"; | ||
declare class Search extends ServiceAbstract { | ||
search(where: any, params?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
regions(params?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
} | ||
export default Search; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type Session from "../Session"; | ||
declare class ServiceAbstract { | ||
protected _session: Session; | ||
constructor(session: Session); | ||
get session(): Session; | ||
} | ||
export default ServiceAbstract; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import ServiceAbstract from "./service-abstract"; | ||
declare class Versions extends ServiceAbstract { | ||
addVersion({ dataid, fileHandler, apiVersion, fileName, options, }: { | ||
dataid: number; | ||
fileHandler: File | string; | ||
apiVersion?: "v1" | "v2"; | ||
fileName?: string; | ||
options?: Record<string, any>; | ||
}): Promise<import("axios").AxiosResponse<any, any>>; | ||
download({ dataid, version, filePath }: { | ||
dataid: any; | ||
version: any; | ||
filePath: any; | ||
}): Promise<unknown>; | ||
list(dataid: number): Promise<import("axios").AxiosResponse<any, any>>; | ||
version(dataid: any, version_number?: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
promote({ dataid, versionNumber, description }: { | ||
dataid: any; | ||
versionNumber: any; | ||
description?: any; | ||
}): Promise<import("axios").AxiosResponse<any, any>>; | ||
deleteVersion({ dataid, versionNumber, apiVersion }: { | ||
dataid: any; | ||
versionNumber: any; | ||
apiVersion?: string; | ||
}): Promise<import("axios").AxiosResponse<any, any>>; | ||
purge({ dataid, number_to_keep }: { | ||
dataid: any; | ||
number_to_keep?: number; | ||
}): Promise<import("axios").AxiosResponse<any, any>>; | ||
} | ||
export default Versions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import ServiceAbstract from "./service-abstract"; | ||
declare class WebReports extends ServiceAbstract { | ||
run(dataid: any, params?: {}): Promise<import("axios").AxiosResponse<any, any>>; | ||
} | ||
export default WebReports; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import ServiceAbstract from "./service-abstract"; | ||
import { components } from "../types/cs-rest-types/schema"; | ||
type forms_WorkflowPropertiesFormInfo = components["schemas"]["forms_WorkflowPropertiesFormInfo"]; | ||
type draftprocesses_DraftProcess_Put = components["schemas"]["draftprocesses_DraftProcess_Put"]; | ||
import { TDraftProcess, TWorkflowPut, WorkflowInitiator } from "../utils/workflow-initiator"; | ||
declare class Workflow extends ServiceAbstract { | ||
workflowInitiator(mapId: number): WorkflowInitiator; | ||
start(mapId: number): Promise<forms_WorkflowPropertiesFormInfo>; | ||
draftprocesses(workflowId: number): Promise<TDraftProcess>; | ||
draftprocessesUpdate(draftprocessId: number): Promise<forms_WorkflowPropertiesFormInfo>; | ||
draftprocessesPut(draftprocessId: number, body: TWorkflowPut): Promise<{ | ||
results: draftprocesses_DraftProcess_Put; | ||
}>; | ||
} | ||
export default Workflow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import RPCClient from "./rpc-client"; | ||
import { RPCError } from "./rpc-client/error-codes"; | ||
import Session from "./Session"; | ||
declare const isRPCError: (e: RPCError | any) => e is RPCError; | ||
export { isRPCError, RPCError, Session, RPCClient }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
declare const ErrorCodes: { | ||
readonly PARSEERROR: { | ||
readonly code: -32700; | ||
readonly message: "Parse error"; | ||
}; | ||
readonly INVALIDREQUEST: { | ||
readonly code: -32600; | ||
readonly message: "Invalid Request"; | ||
}; | ||
readonly METHODNOTFOUND: { | ||
readonly code: -32601; | ||
readonly message: "Method not found"; | ||
}; | ||
readonly INVALIDPARAMS: { | ||
readonly code: -32602; | ||
readonly message: "Invalid params"; | ||
}; | ||
readonly INTERNALERROR: { | ||
readonly code: -32603; | ||
readonly message: "Internal error"; | ||
}; | ||
}; | ||
type ErrorMessage = { | ||
message: string; | ||
code: number; | ||
data: Array<any> | Record<string, any>; | ||
}; | ||
declare class RPCError extends Error { | ||
code: number; | ||
data: Array<any> | Record<string, any>; | ||
constructor(message?: string | ErrorMessage, data?: any, code?: number); | ||
} | ||
export { RPCError, ErrorCodes }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Session from "../Session"; | ||
type requestObjectType = { | ||
jsonrpc: string; | ||
method: string; | ||
id: number; | ||
params: Record<string, any> | Array<any>; | ||
}; | ||
export default class RPCClient { | ||
session: Session; | ||
relativePath: string; | ||
_batchQueue: Array<requestObjectType>; | ||
constructor(session: Session, relativePath: string); | ||
requestObject(method: string, params: Record<string, any> | Array<any>, id: number): requestObjectType; | ||
handleResponse(data: any): any; | ||
request(method: string, params: any, id?: number): Promise<any>; | ||
resetQueue(): void; | ||
queue(method: string, params: any, id?: number): RPCClient; | ||
batch(throwOnError?: boolean): Promise<any>; | ||
rhnode(dataid: any, method: any, args?: any[], id?: number): Promise<any>; | ||
rhnodeQueue(dataid: any, method: any, args?: any[], id?: number): RPCClient; | ||
} | ||
export {}; |
Oops, something went wrong.