Sign In

@uipath/robot

Package Overview
Dependencies
Maintainers
25
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uipath/robot - npm Package Compare versions

Comparing version
1.2.9
to
1.3.0
+4
dist/Enums/jobSource.d.ts
export declare enum JobSource {
Apps = "Apps",
RobotAPI = "RobotAPI"
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobSource = void 0;
var JobSource;
(function (JobSource) {
JobSource["Apps"] = "Apps";
JobSource["RobotAPI"] = "RobotAPI";
})(JobSource = exports.JobSource || (exports.JobSource = {}));
/**
* Job state enum
*/
export declare enum JobState {
Executing = 0,
Closed = 1,
Canceled = 2,
Faulted = 3
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobState = void 0;
/**
* Job state enum
*/
var JobState;
(function (JobState) {
JobState[JobState["Executing"] = 0] = "Executing";
JobState[JobState["Closed"] = 1] = "Closed";
JobState[JobState["Canceled"] = 2] = "Canceled";
JobState[JobState["Faulted"] = 3] = "Faulted";
})(JobState = exports.JobState || (exports.JobState = {}));
export declare enum TraceEvent {
Invalid_Event = "InvalidEvent",
Get_Port = "GetPort",
Get_Processes = "GetProcesses",
Init = "Init",
Run_Robot = "RunRobot",
Job_Status_Poll = "JobStatusPoll",
User_Consent_Raised = "UserConsentRaised",
Missing_Components = "MissingComponents",
Consent_Timeout = "ConsentTimeout",
Stop_Process = "StopProcess",
Install_Process = "InstallProcess",
Send_Client_Message = "SendClientMessage"
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraceEvent = void 0;
var TraceEvent;
(function (TraceEvent) {
TraceEvent["Invalid_Event"] = "InvalidEvent";
TraceEvent["Get_Port"] = "GetPort";
TraceEvent["Get_Processes"] = "GetProcesses";
TraceEvent["Init"] = "Init";
TraceEvent["Run_Robot"] = "RunRobot";
TraceEvent["Job_Status_Poll"] = "JobStatusPoll";
TraceEvent["User_Consent_Raised"] = "UserConsentRaised";
TraceEvent["Missing_Components"] = "MissingComponents";
TraceEvent["Consent_Timeout"] = "ConsentTimeout";
TraceEvent["Stop_Process"] = "StopProcess";
TraceEvent["Install_Process"] = "InstallProcess";
TraceEvent["Send_Client_Message"] = "SendClientMessage";
})(TraceEvent = exports.TraceEvent || (exports.TraceEvent = {}));
/*!
* Copyright 2020 UiPath, Inc.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
/*!
* Microsoft Dynamic Proto Utility, 1.1.7
* Copyright (c) Microsoft and contributors. All rights reserved.
*/
/**
* Client message data model.
*/
export declare class ClientMessageData {
channelName: string;
payload: string;
/**
* Default constructor
* @param channelName Client message channel name
* @param payload Client message payload
*/
constructor(channelName: string, payload: string);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientMessageData = void 0;
/**
* Client message data model.
*/
var ClientMessageData = /** @class */ (function () {
/**
* Default constructor
* @param channelName Client message channel name
* @param payload Client message payload
*/
function ClientMessageData(channelName, payload) {
this.channelName = channelName;
this.payload = payload;
}
return ClientMessageData;
}());
exports.ClientMessageData = ClientMessageData;
export * from './job';
export * from './jobPromise';
export * from './jobResult';
export * from './jobStatus';
export * from './response';
export * from './robotProcess';
export * from './settings';
export * from './serverFeatures';
export * from './portResponse';
export * from './workflowEventData';
export * from './inputArgumentSchema';
export * from './installProcessResult';
export * from './clientMessageData';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./job"), exports);
__exportStar(require("./jobPromise"), exports);
__exportStar(require("./jobResult"), exports);
__exportStar(require("./jobStatus"), exports);
__exportStar(require("./response"), exports);
__exportStar(require("./robotProcess"), exports);
__exportStar(require("./settings"), exports);
__exportStar(require("./serverFeatures"), exports);
__exportStar(require("./portResponse"), exports);
__exportStar(require("./workflowEventData"), exports);
__exportStar(require("./inputArgumentSchema"), exports);
__exportStar(require("./installProcessResult"), exports);
__exportStar(require("./clientMessageData"), exports);
/**
* InputArgumentSchema returned by the installProcess request.
*/
export declare class InputArgumentSchema {
name: string;
type: string;
isRequired: boolean;
hasDefault: boolean;
/**
* @param name Input argument name
* @param type Input argument type
* @param isRequired Input argument is required
* @param hasDefault Input argument has default
*/
constructor(name: string, type: string, isRequired: boolean, hasDefault: boolean);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InputArgumentSchema = void 0;
/**
* InputArgumentSchema returned by the installProcess request.
*/
var InputArgumentSchema = /** @class */ (function () {
/**
* @param name Input argument name
* @param type Input argument type
* @param isRequired Input argument is required
* @param hasDefault Input argument has default
*/
function InputArgumentSchema(name, type, isRequired, hasDefault) {
this.name = name;
this.type = type;
this.isRequired = isRequired;
this.hasDefault = hasDefault;
this.name = name;
this.type = type;
this.isRequired = isRequired;
this.hasDefault = hasDefault;
}
return InputArgumentSchema;
}());
exports.InputArgumentSchema = InputArgumentSchema;
import { InputArgumentSchema } from ".";
/**
* InstallProcessResult returned by the installProcess request.
*/
export declare class InstallProcessResult {
inputArgumentsSchema: InputArgumentSchema[];
/**
* @param inputArgumentsSchema Input arguments schema
*/
constructor(inputArgumentsSchema: InputArgumentSchema[]);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstallProcessResult = void 0;
/**
* InstallProcessResult returned by the installProcess request.
*/
var InstallProcessResult = /** @class */ (function () {
/**
* @param inputArgumentsSchema Input arguments schema
*/
function InstallProcessResult(inputArgumentsSchema) {
this.inputArgumentsSchema = inputArgumentsSchema;
this.inputArgumentsSchema = inputArgumentsSchema || [];
}
return InstallProcessResult;
}());
exports.InstallProcessResult = InstallProcessResult;
import { WorkflowEventData } from '.';
/**
* Job model used to identify a running/completed Robot process
*/
export declare class Job {
processId: string;
argument?: any;
jobId: string;
internalArguments?: string;
private eventHandlers;
/**
* Default constructor
* @param processId Unique GUID of the robot process to run.
* @param argument In arguments to be passed to the robot process on execution.
*/
constructor(processId: string, argument?: any);
/**
* Method to attach event handler on the job.
* @param eventName Available job events are: 'status', 'workflow-event'.
* @param eventHanlder Event handler callback function called when event occurs.
*/
on(eventName: string, eventHanlder: (argument?: any) => void): void;
/**
* Dispatch method to trigger events.
* @param status argument to pass along while event is dispatched.
*/
dispatch: (status: string) => void;
/**
* Dispatch method to trigger events.
* @param event argument to pass along while event is dispatched.
*/
dispatchEvent: (eventData: WorkflowEventData) => void;
/**
* Send a message to a running job.
* @param channelName
* @param payload
* @returns
*/
sendClientMessage: (channelName: string, payload: string) => Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Job = void 0;
var utils_1 = require("../utils");
var constants_1 = require("../utils/constants");
var uuid_1 = require("uuid");
var uipathRobot_1 = require("../uipathRobot");
/**
* Job model used to identify a running/completed Robot process
*/
var Job = /** @class */ (function () {
/**
* Default constructor
* @param processId Unique GUID of the robot process to run.
* @param argument In arguments to be passed to the robot process on execution.
*/
function Job(processId, argument) {
var _this = this;
this.processId = processId;
this.argument = argument;
/**
* Dispatch method to trigger events.
* @param status argument to pass along while event is dispatched.
*/
this.dispatch = function (status) { return _this.eventHandlers.dispatch(constants_1.Constants.STATUS, status); };
/**
* Dispatch method to trigger events.
* @param event argument to pass along while event is dispatched.
*/
this.dispatchEvent = function (eventData) { return _this.eventHandlers.dispatch(constants_1.Constants.WORKFLOW_EVENT, eventData); };
/**
* Send a message to a running job.
* @param channelName
* @param payload
* @returns
*/
this.sendClientMessage = function (channelName, payload) { return uipathRobot_1.UiPathRobot.sendClientMessage(_this, channelName, payload); };
this.jobId = uuid_1.v4();
this.processId = processId;
this.argument = argument;
this.eventHandlers = new utils_1.Dispatcher();
}
/**
* Method to attach event handler on the job.
* @param eventName Available job events are: 'status', 'workflow-event'.
* @param eventHanlder Event handler callback function called when event occurs.
*/
Job.prototype.on = function (eventName, eventHanlder) {
switch (eventName) {
case constants_1.Constants.STATUS: {
this.eventHandlers.on(constants_1.Constants.STATUS, eventHanlder);
break;
}
case constants_1.Constants.WORKFLOW_EVENT: {
this.eventHandlers.on(constants_1.Constants.WORKFLOW_EVENT, eventHanlder);
break;
}
default: {
break;
}
}
};
return Job;
}());
exports.Job = Job;
import { JobSource } from "../Enums/jobSource";
/**
* JobArguments sent with the InvokeRobot Request.
*/
export declare class JobArguments {
inputArgs: any;
internalArgs?: string | undefined;
jobSource?: JobSource | undefined;
constructor(inputArgs: any, internalArgs?: string | undefined, jobSource?: JobSource | undefined);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobArguments = void 0;
/**
* JobArguments sent with the InvokeRobot Request.
*/
var JobArguments = /** @class */ (function () {
function JobArguments(inputArgs, internalArgs, jobSource) {
this.inputArgs = inputArgs;
this.internalArgs = internalArgs;
this.jobSource = jobSource;
}
return JobArguments;
}());
exports.JobArguments = JobArguments;
import { Job, JobResult } from './index';
import { WorkflowEventData } from './workflowEventData';
/**
* Job promise model used for resolution and/or rejection of Promise<JobResult>
*/
export declare class JobPromise implements Promise<JobResult> {
job: Job;
[Symbol.toStringTag]: string;
private promise;
/**
* Default constructor
* @param job Job to be wrapped with promise
*/
constructor(job: Job);
then<TResult1 = JobResult, TResult2 = never>(onfulfilled?: ((value: JobResult) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<JobResult | TResult>;
finally(onfinally?: (() => void) | null | undefined): Promise<JobResult>;
/**
* Method to attach job status event handlers.
* @param eventHanlder Attaches callback which is invoked on job status change.
*/
onStatus: (eventHanlder: (argument?: any) => void) => this;
/**
* Method to attach job workflow event handlers.
* @param eventHandler Attaches callback which is invoked on job workflow event.
*/
onWorkflowEvent: (eventHandler: (argument: WorkflowEventData) => void) => this;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobPromise = void 0;
var uipathRobot_1 = require("../uipathRobot");
var constants_1 = require("../utils/constants");
/**
* Job promise model used for resolution and/or rejection of Promise<JobResult>
*/
var JobPromise = /** @class */ (function () {
/**
* Default constructor
* @param job Job to be wrapped with promise
*/
function JobPromise(job) {
var _this = this;
this.job = job;
/**
* Method to attach job status event handlers.
* @param eventHanlder Attaches callback which is invoked on job status change.
*/
this.onStatus = function (eventHanlder) {
_this.job.on(constants_1.Constants.STATUS, eventHanlder);
return _this;
};
/**
* Method to attach job workflow event handlers.
* @param eventHandler Attaches callback which is invoked on job workflow event.
*/
this.onWorkflowEvent = function (eventHandler) {
_this.job.on(constants_1.Constants.WORKFLOW_EVENT, eventHandler);
return _this;
};
this.promise = uipathRobot_1.UiPathRobot.startJob(this.job);
}
JobPromise.prototype.then = function (onfulfilled, onrejected) {
return this.promise.then(onfulfilled, onrejected);
};
JobPromise.prototype.catch = function (onrejected) {
return this.promise.catch(onrejected);
};
JobPromise.prototype.finally = function (onfinally) {
return this.promise.finally(onfinally);
};
return JobPromise;
}());
exports.JobPromise = JobPromise;
/**
* Job result model containing all output arguments from the process.
* Empty if there are no out arguments.
*/
export declare class JobResult {
[Key: string]: any;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobResult = void 0;
/**
* Job result model containing all output arguments from the process.
* Empty if there are no out arguments.
*/
var JobResult = /** @class */ (function () {
function JobResult() {
}
return JobResult;
}());
exports.JobResult = JobResult;
import { WorkflowEventData } from './workflowEventData';
/**
* Job status model containing details of the executing job.
*/
export declare class JobStatus {
state: string;
status: string[];
events: WorkflowEventData[];
output: any;
exception: any;
/**
*
* @param state Current state of the job
* @param status Current status of the job
* @param events Workflow events sent by the job
* @param output Output of the job if any
* @param exception Exception from the job if any
*/
constructor(state: string, status: string[], events: WorkflowEventData[], output: any, exception: any);
get isExecuting(): boolean;
get isClosed(): boolean;
get errorResponse(): any;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobStatus = void 0;
/**
* Job status model containing details of the executing job.
*/
var JobStatus = /** @class */ (function () {
/**
*
* @param state Current state of the job
* @param status Current status of the job
* @param events Workflow events sent by the job
* @param output Output of the job if any
* @param exception Exception from the job if any
*/
function JobStatus(state, status, events, output, exception) {
this.state = state;
this.status = status;
this.events = events;
this.output = output;
this.exception = exception;
this.events = events || [];
this.output = output || undefined;
this.exception = exception || undefined;
}
Object.defineProperty(JobStatus.prototype, "isExecuting", {
get: function () { return this.state === 'Executing'; },
enumerable: false,
configurable: true
});
Object.defineProperty(JobStatus.prototype, "isClosed", {
get: function () { return this.state === 'Closed'; },
enumerable: false,
configurable: true
});
Object.defineProperty(JobStatus.prototype, "errorResponse", {
get: function () {
if (this.exception) {
this.exception.state = this.state;
}
else {
this.exception = { 'state': this.state };
}
return this.exception;
},
enumerable: false,
configurable: true
});
return JobStatus;
}());
exports.JobStatus = JobStatus;
/**
* PortResponse returned by the getPort Request.
*/
export declare class PortResponse {
port: number;
serverFeatures: string[];
constructor();
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PortResponse = void 0;
/**
* PortResponse returned by the getPort Request.
*/
var PortResponse = /** @class */ (function () {
function PortResponse() {
this.port = 0;
this.serverFeatures = [];
}
return PortResponse;
}());
exports.PortResponse = PortResponse;
import { Deferred } from '../utils';
/**
* Generic response model
*/
export declare class Response<T> {
private httpStatus;
statusText: string;
isDomainAllowed: boolean;
data?: T | undefined;
error?: string | undefined;
/**
*
* @param httpStatus Http status of the response
* @param statusText Http status text of the response
* @param isDomainAllowed Flag returned by the Server, saying if the domain is allowed by configuration
* @param data Response data if any
* @param error Handled error response if any
*/
constructor(httpStatus: number, statusText: string, isDomainAllowed: boolean, data?: T | undefined, error?: string | undefined);
get isSuccess(): boolean;
get isUnauthorized(): boolean;
get isForbidden(): boolean;
get isEmpty(): boolean;
get isNotFound(): boolean;
/**
* Resolve promise if its a successful response. Throws error if response was unsuccessful.
* @param promise promise which will be resolved if response was successful.
*/
resolve: (promise: Deferred<T>) => void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Response = void 0;
/**
* Generic response model
*/
var Response = /** @class */ (function () {
/**
*
* @param httpStatus Http status of the response
* @param statusText Http status text of the response
* @param isDomainAllowed Flag returned by the Server, saying if the domain is allowed by configuration
* @param data Response data if any
* @param error Handled error response if any
*/
function Response(httpStatus, statusText, isDomainAllowed, data, error) {
var _this = this;
this.httpStatus = httpStatus;
this.statusText = statusText;
this.isDomainAllowed = isDomainAllowed;
this.data = data;
this.error = error;
/**
* Resolve promise if its a successful response. Throws error if response was unsuccessful.
* @param promise promise which will be resolved if response was successful.
*/
this.resolve = function (promise) {
if (_this.isSuccess) {
promise.resolve(_this.data);
}
else {
promise.reject(new Error(_this.httpStatus + " - " + _this.error));
}
};
this.data = data || undefined;
}
Object.defineProperty(Response.prototype, "isSuccess", {
get: function () { return this.httpStatus >= 200 && this.httpStatus < 300; },
enumerable: false,
configurable: true
});
Object.defineProperty(Response.prototype, "isUnauthorized", {
get: function () { return this.httpStatus === 401; },
enumerable: false,
configurable: true
});
Object.defineProperty(Response.prototype, "isForbidden", {
get: function () { return this.httpStatus === 403; },
enumerable: false,
configurable: true
});
Object.defineProperty(Response.prototype, "isEmpty", {
get: function () { return this.httpStatus === 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(Response.prototype, "isNotFound", {
get: function () { return this.httpStatus === 404; },
enumerable: false,
configurable: true
});
return Response;
}());
exports.Response = Response;
import { JobPromise } from '../models';
import { InstallProcessResult } from './installProcessResult';
/**
* Robot process model containing details of the robot process available in current system
*/
export declare class RobotProcess {
id: string;
name: string;
description: string | undefined;
/**
* Default constructor
* @param id Unique id of the robot process
* @param name Robot Process name
* @param description Process Description
*/
constructor(id: string, name: string, description?: string | undefined);
/**
* Start the robot process
* @param inArguments JSON object. In arguments to be passed to the robot if any.
*/
start: (inArguments?: any) => JobPromise;
/**
* Install the robot process
*/
install: () => Promise<InstallProcessResult>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RobotProcess = void 0;
var uipathRobot_1 = require("../uipathRobot");
var models_1 = require("../models");
/**
* Robot process model containing details of the robot process available in current system
*/
var RobotProcess = /** @class */ (function () {
/**
* Default constructor
* @param id Unique id of the robot process
* @param name Robot Process name
* @param description Process Description
*/
function RobotProcess(id, name, description) {
var _this = this;
if (description === void 0) { description = undefined; }
this.id = id;
this.name = name;
this.description = description;
/**
* Start the robot process
* @param inArguments JSON object. In arguments to be passed to the robot if any.
*/
this.start = function (inArguments) { return new models_1.JobPromise(new models_1.Job(_this.id, inArguments)); };
/**
* Install the robot process
*/
this.install = function () { return uipathRobot_1.UiPathRobot.installProcess(_this.id); };
}
return RobotProcess;
}());
exports.RobotProcess = RobotProcess;
/**
* ServerFeatures class used to maintain compatibility between different versions of client and server
*/
export declare class ServerFeatures {
private serverFeatures;
jobStatusUsesLongPolling: boolean;
installProcess: boolean;
useGivenJobId: boolean;
internalArguments: boolean;
clientMessage: boolean;
/**
* Default constructor
*/
constructor(serverFeatures: string[]);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerFeatures = void 0;
/**
* ServerFeatures class used to maintain compatibility between different versions of client and server
*/
var ServerFeatures = /** @class */ (function () {
/**
* Default constructor
*/
function ServerFeatures(serverFeatures) {
this.serverFeatures = serverFeatures;
this.jobStatusUsesLongPolling = this.serverFeatures.includes('JobStatus_LongPolling');
this.installProcess = this.serverFeatures.includes('InstallProcess');
this.useGivenJobId = this.serverFeatures.includes('UseGivenJobId');
this.internalArguments = this.serverFeatures.includes('InternalArguments');
this.clientMessage = this.serverFeatures.includes('ClientMessage');
}
return ServerFeatures;
}());
exports.ServerFeatures = ServerFeatures;
import { JobSource } from "../Enums/jobSource";
/**
* Settings class used to change default settings of Js SDK
*/
export declare class Settings {
portNumber: number;
pollTimeInterval: number;
disableTelemetry: boolean;
jobSource: JobSource;
appOrigin: string;
/**
* Default constructor
* @param portNumber Port number of the Http listener
* @param pollTimeInterval Poll interval time.
* @param disableTelemetry Flag to disable sending telemetry events
* @param jobSource JobSource for Telemetry; default value is RobotAPI; added in SDK version 1.2.10.
*/
constructor(portNumber: number, pollTimeInterval: number, disableTelemetry: boolean, jobSource: JobSource);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Settings = void 0;
/**
* Settings class used to change default settings of Js SDK
*/
var Settings = /** @class */ (function () {
/**
* Default constructor
* @param portNumber Port number of the Http listener
* @param pollTimeInterval Poll interval time.
* @param disableTelemetry Flag to disable sending telemetry events
* @param jobSource JobSource for Telemetry; default value is RobotAPI; added in SDK version 1.2.10.
*/
function Settings(portNumber, pollTimeInterval, disableTelemetry, jobSource) {
this.portNumber = portNumber;
this.pollTimeInterval = pollTimeInterval;
this.disableTelemetry = disableTelemetry;
this.jobSource = jobSource;
this.appOrigin = window.location.origin;
}
return Settings;
}());
exports.Settings = Settings;
/**
* Workflow event data model.
*/
export declare class WorkflowEventData {
name: string;
payload: string;
/**
* Default constructor
* @param name Workflow event name
* @param payload Workflow event payload
*/
constructor(name: string, payload: string);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkflowEventData = void 0;
/**
* Workflow event data model.
*/
var WorkflowEventData = /** @class */ (function () {
/**
* Default constructor
* @param name Workflow event name
* @param payload Workflow event payload
*/
function WorkflowEventData(name, payload) {
this.name = name;
this.payload = payload;
}
return WorkflowEventData;
}());
exports.WorkflowEventData = WorkflowEventData;
import { Response, ClientMessageData, ServerFeatures } from '../../models/index';
import { IRequest } from '../iRequest';
/**
* Request class to send a message to a running job.
*/
export declare class ClientMessageRequest implements IRequest<void> {
jobId: string;
data: ClientMessageData;
url: string;
/**
* Default constructor.
* @param jobId Id of the running job to which send the message.
* @param data Data to be sent to the running job
*/
constructor(jobId: string, data: ClientMessageData);
/**
* Method that sends the request to send a message to the running job.
* @returns Promise of Response model type.
*/
send: (serverFeatures: ServerFeatures) => Promise<Response<void>>;
/**
* Set the port to which the request should be sent along with the consent code.
* @param robotInvocationPort Port on which local listener is running.
* @param consentCode User consented code.
*/
set(robotInvocationPort: number, consentCode: number): this;
private convert;
/**
* Method that returns the request endpoint to which request will be sent.
* @param robotInvocationPort Port of local listener to which request should be sent.
* @param consentCode User approved consent code if any.
*/
private getURL;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientMessageRequest = void 0;
var language_1 = require("../../locale/language");
var constants_1 = require("../../utils/constants");
var httpUtil_1 = require("../../utils/httpUtil");
var urlUtil_1 = require("../../utils/urlUtil");
/**
* Request class to send a message to a running job.
*/
var ClientMessageRequest = /** @class */ (function () {
/**
* Default constructor.
* @param jobId Id of the running job to which send the message.
* @param data Data to be sent to the running job
*/
function ClientMessageRequest(jobId, data) {
var _this = this;
this.jobId = jobId;
this.data = data;
/**
* Method that sends the request to send a message to the running job.
* @returns Promise of Response model type.
*/
this.send = function (serverFeatures) {
if (!serverFeatures.clientMessage) {
throw new Error("" + language_1.Language.GetResource().api_not_found);
}
return httpUtil_1.HttpUtil.post(_this.url, _this.convert, JSON.stringify(_this.data));
};
this.convert = function (_) { return ''; };
/**
* Method that returns the request endpoint to which request will be sent.
* @param robotInvocationPort Port of local listener to which request should be sent.
* @param consentCode User approved consent code if any.
*/
this.getURL = function (robotInvocationPort, consentCode) {
var url = constants_1.Constants.DEFAULT_ROBOT_INVOKE_DOMAIN + ":" + robotInvocationPort + "/" + constants_1.Constants.SEND_CLIENT_MESSAGE + "?jobId=" + _this.jobId;
return urlUtil_1.UrlUtil.appendConsentCode(url, consentCode);
};
this.url = '';
}
/**
* Set the port to which the request should be sent along with the consent code.
* @param robotInvocationPort Port on which local listener is running.
* @param consentCode User consented code.
*/
ClientMessageRequest.prototype.set = function (robotInvocationPort, consentCode) {
this.url = this.getURL(robotInvocationPort, consentCode);
return this;
};
return ClientMessageRequest;
}());
exports.ClientMessageRequest = ClientMessageRequest;
+1
-0

@@ -7,1 +7,2 @@ export * from './invokeRobotRequest';

export * from './installProcessRequest';
export * from './clientMessageRequest';

@@ -19,1 +19,2 @@ "use strict";

__exportStar(require("./installProcessRequest"), exports);
__exportStar(require("./clientMessageRequest"), exports);
+2
-3

@@ -1,3 +0,2 @@

import { Response } from '../../models/index';
import { InstallProcessResult } from '../../models/installProcessResult';
import { Response, ServerFeatures, InstallProcessResult } from '../../models/index';
import { IRequest } from '../iRequest';

@@ -19,3 +18,3 @@ /**

*/
send: () => Promise<Response<InstallProcessResult>>;
send: (serverFeatures: ServerFeatures) => Promise<Response<InstallProcessResult>>;
/**

@@ -22,0 +21,0 @@ * Set the port to which the request should be sent along with the consent code.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstallProcessRequest = void 0;
var inputArgumentSchema_1 = require("../../models/inputArgumentSchema");
var installProcessResult_1 = require("../../models/installProcessResult");
var language_1 = require("../../locale/language");
var index_1 = require("../../models/index");
var utils_1 = require("../../utils");

@@ -23,3 +23,8 @@ var constants_1 = require("../../utils/constants");

*/
this.send = function () { return utils_1.HttpUtil.get(_this.url, _this.convertToResult); };
this.send = function (serverFeatures) {
if (!serverFeatures.installProcess) {
throw new Error("" + language_1.Language.GetResource().api_not_found);
}
return utils_1.HttpUtil.get(_this.url, _this.convertToResult);
};
this.url = '';

@@ -45,4 +50,4 @@ }

if (jsonResponse && jsonResponse.InputArgumentsSchema) {
var result = new installProcessResult_1.InstallProcessResult(jsonResponse.InputArgumentsSchema.map(function (a) {
return new inputArgumentSchema_1.InputArgumentSchema(a.Name, a.Type, a.IsRequired, a.HasDefault);
var result = new index_1.InstallProcessResult(jsonResponse.InputArgumentsSchema.map(function (a) {
return new index_1.InputArgumentSchema(a.Name, a.Type, a.IsRequired, a.HasDefault);
}));

@@ -52,3 +57,3 @@ return result;

}
return new installProcessResult_1.InstallProcessResult([]);
return new index_1.InstallProcessResult([]);
};

@@ -55,0 +60,0 @@ /**

@@ -0,1 +1,2 @@

import { JobSource } from '../../Enums/jobSource';
import { Job, Response, ServerFeatures } from '../../models/index';

@@ -9,2 +10,3 @@ import { IRequest } from '../iRequest';

job: Job;
private jobSource;
/**

@@ -14,3 +16,3 @@ * Default constructor.

*/
constructor(job: Job);
constructor(job: Job, jobSource: JobSource);
/**

@@ -17,0 +19,0 @@ * Method that sends the request to invoke a robot.

@@ -16,3 +16,3 @@ "use strict";

*/
function InvokeRobotRequest(job) {
function InvokeRobotRequest(job, jobSource) {
var _this = this;

@@ -28,3 +28,3 @@ /**

url = _this.url + "&features=internalArguments"; // Added in version 1.2.9
jsonData = JSON.stringify(new jobArguments_1.JobArguments(_this.job.argument, _this.job.internalArguments));
jsonData = JSON.stringify(new jobArguments_1.JobArguments(_this.job.argument, _this.job.internalArguments, _this.jobSource));
}

@@ -41,2 +41,3 @@ else {

this.job = job;
this.jobSource = jobSource;
}

@@ -43,0 +44,0 @@ /**

@@ -11,3 +11,3 @@ import { Response, RobotProcess } from '../../models/index';

* Default constructor.
* @param job Job object whose status we want to request
* @param process Running process object that we want to cancel.
*/

@@ -14,0 +14,0 @@ constructor(process: RobotProcess);

@@ -13,3 +13,3 @@ "use strict";

* Default constructor.
* @param job Job object whose status we want to request
* @param process Running process object that we want to cancel.
*/

@@ -16,0 +16,0 @@ function StopProcessRequest(process) {

@@ -44,2 +44,3 @@ import { IRobotSDK } from '../iRobotSDK';

installProcess: (processId: string) => Promise<InstallProcessResult>;
sendClientMessage: (job: Job, channelName: string, payload: string) => Promise<void>;
}

@@ -48,2 +48,3 @@ "use strict";

var async_mutex_1 = require("async-mutex");
var jobSource_1 = require("../Enums/jobSource");
/**

@@ -80,5 +81,3 @@ * Robot SDK class

*/
this.init = function () {
return _this;
};
this.init = function () { return _this; };
/**

@@ -106,3 +105,3 @@ * Method to retrieve all published robot processes on users local machine.

this.startJob = function (job) { return __awaiter(_this, void 0, void 0, function () {
var deferredPromise, jobResponse;
var jobResponsePromise, jobResponse, deferredPromise;
return __generator(this, function (_a) {

@@ -117,7 +116,9 @@ switch (_a.label) {

}
deferredPromise = new utils_1.Deferred();
return [4 /*yield*/, this.startRobot(job)];
jobResponsePromise = this.startRobot(job);
job.startPromise = jobResponsePromise;
return [4 /*yield*/, jobResponsePromise];
case 1:
jobResponse = _a.sent();
job.jobId = jobResponse.jobId;
deferredPromise = new utils_1.Deferred();
this.jobStatusPoll(job, deferredPromise);

@@ -170,4 +171,2 @@ return [2 /*return*/, deferredPromise.promise];

this.trace(traceEvent_1.TraceEvent.Install_Process, { ProcessKey: processId });
if (!this.serverFeatures.installProcess)
throw new Error("" + language_1.Language.GetResource().api_not_found);
deferredPromise = new utils_1.Deferred();

@@ -185,2 +184,27 @@ try {

/**
* Method to send a message to a running job.
* @param job
* @param channelName
* @param payload
*/
this.sendClientMessage = function (job, channelName, payload) { return __awaiter(_this, void 0, void 0, function () {
var deferredPromise;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, job.startPromise];
case 1:
_a.sent(); // ensure the job exists
deferredPromise = new utils_1.Deferred();
try {
this.sendRequest(new implementation_1.ClientMessageRequest(job.jobId, new models_1.ClientMessageData(channelName, payload)), deferredPromise);
}
catch (error) {
deferredPromise.reject(error);
this.traceError(traceEvent_1.TraceEvent.Send_Client_Message, error);
}
return [2 /*return*/, deferredPromise.promise];
}
});
}); };
/**
* Method to invoke a robot on the local user machine.

@@ -195,3 +219,3 @@ * @param job The robot job to be run.

try {
this.sendRequest(new implementation_1.InvokeRobotRequest(job), deferredPromise);
this.sendRequest(new implementation_1.InvokeRobotRequest(job, this.settings.jobSource), deferredPromise);
}

@@ -457,3 +481,3 @@ catch (error) {

this.consentCode = 0;
this.settings = new models_1.Settings(constants_1.Constants.DEFAULT_PORT, constants_1.Constants.POLL_TIMEINTERVAL, false);
this.settings = new models_1.Settings(constants_1.Constants.DEFAULT_PORT, constants_1.Constants.POLL_TIMEINTERVAL, false, jobSource_1.JobSource.RobotAPI);
this.eventHandlers = new utils_1.Dispatcher();

@@ -477,3 +501,3 @@ this.logger = new appinsightsLogger_1.AppInsightsLogger(this.settings);

*/
this.init = function () { return _this; };
this.init = function () { return robotSDK.init(); };
/**

@@ -511,2 +535,5 @@ * Method to retrieve all published robot processes on users local machine.

}); }); };
this.sendClientMessage = function (job, channelName, payload) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/, robotSDK.sendClientMessage(job, channelName, payload)];
}); }); };
}

@@ -513,0 +540,0 @@ Object.defineProperty(SDK.prototype, "settings", {

@@ -52,2 +52,10 @@ import { IRobotSDK } from './iRobotSDK';

const installProcess: (processId: string) => Promise<InstallProcessResult>;
/**
* Method to send a message to a running job.
* @param job
* @param channelName
* @param payload
* @returns
*/
const sendClientMessage: (job: Job, channelName: string, payload: string) => Promise<void>;
}

@@ -57,3 +57,11 @@ "use strict";

UiPathRobot.installProcess = function (processId) { return robotSDK.installProcess(processId); };
/**
* Method to send a message to a running job.
* @param job
* @param channelName
* @param payload
* @returns
*/
UiPathRobot.sendClientMessage = function (job, channelName, payload) { return robotSDK.sendClientMessage(job, channelName, payload); };
})(UiPathRobot = exports.UiPathRobot || (exports.UiPathRobot = {}));
window.UiPathRobot = UiPathRobot;

@@ -22,3 +22,4 @@ export declare class Constants {

static readonly STOP_PROCESS = "StopProcess";
static readonly SEND_CLIENT_MESSAGE = "SendClientMessage";
static readonly DOMAIN_ALLOWED = "X-UIPATH-DOMAIN-ALLOWED";
}

@@ -27,2 +27,3 @@ "use strict";

Constants.STOP_PROCESS = 'StopProcess';
Constants.SEND_CLIENT_MESSAGE = 'SendClientMessage';
Constants.DOMAIN_ALLOWED = 'X-UIPATH-DOMAIN-ALLOWED';

@@ -29,0 +30,0 @@ return Constants;

@@ -1,1 +0,1 @@

export declare const ROBOTJS_VERSION = "1.2.9";
export declare const ROBOTJS_VERSION = "1.3.0";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ROBOTJS_VERSION = void 0;
exports.ROBOTJS_VERSION = '1.2.9';
exports.ROBOTJS_VERSION = '1.3.0';

@@ -1,3 +0,6 @@

var fs = require('file-system');
const version = JSON.parse(fs.readFileSync('package.json')).version;
fs.writeFile('./src/version.ts', `export const ROBOTJS_VERSION = '${version}';`);
const fs = require('fs');
const version = JSON.parse(fs.readFileSync('package.json', 'utf-8')).version;
fs.writeFileSync(
'./src/version.ts',
`export const ROBOTJS_VERSION = '${version}';`
);
{
"name": "@uipath/robot",
"version": "1.2.9",
"version": "1.3.0",
"description": "UiPath Robot javascript SDK enabling web pages to interact with UiPath Robots",
"scripts": {
"prebuild": "node genversion.js",
"build": "tsc && webpack --mode production -p --config webpack.config.js",
"build": "tsc && webpack --mode production --config webpack.config.js",
"clean": "tsc --build --clean",

@@ -14,11 +14,10 @@ "pack": "npm pack"

"@types/uuid": "^8.3.4",
"copy-webpack-plugin": "^5.1.1",
"file-system": "^2.2.2",
"copy-webpack-plugin": "^11.0.0",
"style-loader": "^0.23.1",
"ts-loader": "^6.0.4",
"ts-loader": "^9.4.1",
"tslint": "^5.20.0",
"tslint-jasmine-rules": "^1.6.0",
"typescript": "^3.6.4",
"webpack": "^4.35.3",
"webpack-cli": "^3.3.5"
"webpack": "^5.75.0",
"webpack-cli": "^5.0.0"
},

@@ -25,0 +24,0 @@ "dependencies": {

@@ -50,3 +50,3 @@ {

// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

@@ -62,2 +62,3 @@ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */

// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"stripInternal": true
},

@@ -64,0 +65,0 @@ "exclude": [

@@ -0,5 +1,6 @@

const fs = require('fs');
const path = require('path');
var fs = require('file-system');
var webpack = require("webpack");
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {

@@ -25,7 +26,3 @@ entry: {

new webpack.BannerPlugin(fs.readFileSync('./LICENSE', 'utf8')),
new CopyPlugin([{
context: './src/',
from: '**/*resource.json',
to: ''
}, ])
new CopyPlugin({patterns: [{ context: './src/', from: '**/*resource.json', to: ''}]})
],

@@ -32,0 +29,0 @@ optimization: {

/**
* Job state enum
*/
export declare enum JobState {
Executing = 0,
Closed = 1,
Canceled = 2,
Faulted = 3
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobState = void 0;
/**
* Job state enum
*/
var JobState;
(function (JobState) {
JobState[JobState["Executing"] = 0] = "Executing";
JobState[JobState["Closed"] = 1] = "Closed";
JobState[JobState["Canceled"] = 2] = "Canceled";
JobState[JobState["Faulted"] = 3] = "Faulted";
})(JobState = exports.JobState || (exports.JobState = {}));
export declare enum TraceEvent {
Invalid_Event = "InvalidEvent",
Get_Port = "GetPort",
Get_Processes = "GetProcesses",
Init = "Init",
Run_Robot = "RunRobot",
Job_Status_Poll = "JobStatusPoll",
User_Consent_Raised = "UserConsentRaised",
Missing_Components = "MissingComponents",
Consent_Timeout = "ConsentTimeout",
Stop_Process = "StopProcess",
Install_Process = "InstallProcess"
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraceEvent = void 0;
var TraceEvent;
(function (TraceEvent) {
TraceEvent["Invalid_Event"] = "InvalidEvent";
TraceEvent["Get_Port"] = "GetPort";
TraceEvent["Get_Processes"] = "GetProcesses";
TraceEvent["Init"] = "Init";
TraceEvent["Run_Robot"] = "RunRobot";
TraceEvent["Job_Status_Poll"] = "JobStatusPoll";
TraceEvent["User_Consent_Raised"] = "UserConsentRaised";
TraceEvent["Missing_Components"] = "MissingComponents";
TraceEvent["Consent_Timeout"] = "ConsentTimeout";
TraceEvent["Stop_Process"] = "StopProcess";
TraceEvent["Install_Process"] = "InstallProcess";
})(TraceEvent = exports.TraceEvent || (exports.TraceEvent = {}));
export * from './job';
export * from './jobPromise';
export * from './jobResult';
export * from './jobStatus';
export * from './response';
export * from './robotProcess';
export * from './settings';
export * from './serverFeatures';
export * from './portResponse';
export * from './workflowEventData';
export * from './inputArgumentSchema';
export * from './installProcessResult';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./job"), exports);
__exportStar(require("./jobPromise"), exports);
__exportStar(require("./jobResult"), exports);
__exportStar(require("./jobStatus"), exports);
__exportStar(require("./response"), exports);
__exportStar(require("./robotProcess"), exports);
__exportStar(require("./settings"), exports);
__exportStar(require("./serverFeatures"), exports);
__exportStar(require("./portResponse"), exports);
__exportStar(require("./workflowEventData"), exports);
__exportStar(require("./inputArgumentSchema"), exports);
__exportStar(require("./installProcessResult"), exports);
/**
* InputArgumentSchema returned by the installProcess request.
*/
export declare class InputArgumentSchema {
name: string;
type: string;
isRequired: boolean;
hasDefault: boolean;
/**
* @param name Input argument name
* @param type Input argument type
* @param isRequired Input argument is required
* @param hasDefault Input argument has default
*/
constructor(name: string, type: string, isRequired: boolean, hasDefault: boolean);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InputArgumentSchema = void 0;
/**
* InputArgumentSchema returned by the installProcess request.
*/
var InputArgumentSchema = /** @class */ (function () {
/**
* @param name Input argument name
* @param type Input argument type
* @param isRequired Input argument is required
* @param hasDefault Input argument has default
*/
function InputArgumentSchema(name, type, isRequired, hasDefault) {
this.name = name;
this.type = type;
this.isRequired = isRequired;
this.hasDefault = hasDefault;
this.name = name;
this.type = type;
this.isRequired = isRequired;
this.hasDefault = hasDefault;
}
return InputArgumentSchema;
}());
exports.InputArgumentSchema = InputArgumentSchema;
import { InputArgumentSchema } from ".";
/**
* InstallProcessResult returned by the installProcess request.
*/
export declare class InstallProcessResult {
inputArgumentsSchema: InputArgumentSchema[];
/**
* @param inputArgumentsSchema Input arguments schema
*/
constructor(inputArgumentsSchema: InputArgumentSchema[]);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstallProcessResult = void 0;
/**
* InstallProcessResult returned by the installProcess request.
*/
var InstallProcessResult = /** @class */ (function () {
/**
* @param inputArgumentsSchema Input arguments schema
*/
function InstallProcessResult(inputArgumentsSchema) {
this.inputArgumentsSchema = inputArgumentsSchema;
this.inputArgumentsSchema = inputArgumentsSchema || [];
}
return InstallProcessResult;
}());
exports.InstallProcessResult = InstallProcessResult;
import { WorkflowEventData } from '.';
/**
* Job model used to identify a running/completed Robot process
*/
export declare class Job {
processId: string;
argument?: any;
jobId: string;
internalArguments?: string;
private eventHandlers;
/**
* Default constructor
* @param processId Unique GUID of the robot process to run.
* @param argument In arguments to be passed to the robot process on execution.
*/
constructor(processId: string, argument?: any);
/**
* Method to attach event handler on the job.
* @param eventName Available job events are: 'status', 'workflow-event'.
* @param eventHanlder Event handler callback function called when event occurs.
*/
on(eventName: string, eventHanlder: (argument?: any) => void): void;
/**
* Dispatch method to trigger events.
* @param status argument to pass along while event is dispatched.
*/
dispatch: (status: string) => void;
/**
* Dispatch method to trigger events.
* @param event argument to pass along while event is dispatched.
*/
dispatchEvent: (eventData: WorkflowEventData) => void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Job = void 0;
var utils_1 = require("../utils");
var constants_1 = require("../utils/constants");
var uuid_1 = require("uuid");
/**
* Job model used to identify a running/completed Robot process
*/
var Job = /** @class */ (function () {
/**
* Default constructor
* @param processId Unique GUID of the robot process to run.
* @param argument In arguments to be passed to the robot process on execution.
*/
function Job(processId, argument) {
var _this = this;
this.processId = processId;
this.argument = argument;
/**
* Dispatch method to trigger events.
* @param status argument to pass along while event is dispatched.
*/
this.dispatch = function (status) { return _this.eventHandlers.dispatch(constants_1.Constants.STATUS, status); };
/**
* Dispatch method to trigger events.
* @param event argument to pass along while event is dispatched.
*/
this.dispatchEvent = function (eventData) { return _this.eventHandlers.dispatch(constants_1.Constants.WORKFLOW_EVENT, eventData); };
this.jobId = uuid_1.v4();
this.processId = processId;
this.argument = argument;
this.eventHandlers = new utils_1.Dispatcher();
}
/**
* Method to attach event handler on the job.
* @param eventName Available job events are: 'status', 'workflow-event'.
* @param eventHanlder Event handler callback function called when event occurs.
*/
Job.prototype.on = function (eventName, eventHanlder) {
switch (eventName) {
case constants_1.Constants.STATUS: {
this.eventHandlers.on(constants_1.Constants.STATUS, eventHanlder);
break;
}
case constants_1.Constants.WORKFLOW_EVENT: {
this.eventHandlers.on(constants_1.Constants.WORKFLOW_EVENT, eventHanlder);
break;
}
default: {
break;
}
}
};
return Job;
}());
exports.Job = Job;
/**
* JobArguments sent with the InvokeRobot Request.
*/
export declare class JobArguments {
inputArgs: any;
internalArgs?: string | undefined;
constructor(inputArgs: any, internalArgs?: string | undefined);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobArguments = void 0;
/**
* JobArguments sent with the InvokeRobot Request.
*/
var JobArguments = /** @class */ (function () {
function JobArguments(inputArgs, internalArgs) {
this.inputArgs = inputArgs;
this.internalArgs = internalArgs;
}
return JobArguments;
}());
exports.JobArguments = JobArguments;
import { Job, JobResult } from './index';
import { WorkflowEventData } from './workflowEventData';
/**
* Job promise model used for resolution and/or rejection of Promise<JobResult>
*/
export declare class JobPromise implements Promise<JobResult> {
job: Job;
[Symbol.toStringTag]: string;
private promise;
/**
* Default constructor
* @param job Job to be wrapped with promise
*/
constructor(job: Job);
then<TResult1 = JobResult, TResult2 = never>(onfulfilled?: ((value: JobResult) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<JobResult | TResult>;
finally(onfinally?: (() => void) | null | undefined): Promise<JobResult>;
/**
* Method to attach job status event handlers.
* @param eventHanlder Attaches callback which is invoked on job status change.
*/
onStatus: (eventHanlder: (argument?: any) => void) => this;
/**
* Method to attach job workflow event handlers.
* @param eventHandler Attaches callback which is invoked on job workflow event.
*/
onWorkflowEvent: (eventHandler: (argument: WorkflowEventData) => void) => this;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobPromise = void 0;
var uipathRobot_1 = require("../uipathRobot");
var constants_1 = require("../utils/constants");
/**
* Job promise model used for resolution and/or rejection of Promise<JobResult>
*/
var JobPromise = /** @class */ (function () {
/**
* Default constructor
* @param job Job to be wrapped with promise
*/
function JobPromise(job) {
var _this = this;
this.job = job;
/**
* Method to attach job status event handlers.
* @param eventHanlder Attaches callback which is invoked on job status change.
*/
this.onStatus = function (eventHanlder) {
_this.job.on(constants_1.Constants.STATUS, eventHanlder);
return _this;
};
/**
* Method to attach job workflow event handlers.
* @param eventHandler Attaches callback which is invoked on job workflow event.
*/
this.onWorkflowEvent = function (eventHandler) {
_this.job.on(constants_1.Constants.WORKFLOW_EVENT, eventHandler);
return _this;
};
this.promise = uipathRobot_1.UiPathRobot.startJob(this.job);
}
JobPromise.prototype.then = function (onfulfilled, onrejected) {
return this.promise.then(onfulfilled, onrejected);
};
JobPromise.prototype.catch = function (onrejected) {
return this.promise.catch(onrejected);
};
JobPromise.prototype.finally = function (onfinally) {
return this.promise.finally(onfinally);
};
return JobPromise;
}());
exports.JobPromise = JobPromise;
/**
* Job result model containing all output arguments from the process.
* Empty if there are no out arguments.
*/
export declare class JobResult {
[Key: string]: any;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobResult = void 0;
/**
* Job result model containing all output arguments from the process.
* Empty if there are no out arguments.
*/
var JobResult = /** @class */ (function () {
function JobResult() {
}
return JobResult;
}());
exports.JobResult = JobResult;
import { WorkflowEventData } from './workflowEventData';
/**
* Job status model containing details of the executing job.
*/
export declare class JobStatus {
state: string;
status: string[];
events: WorkflowEventData[];
output: any;
exception: any;
/**
*
* @param state Current state of the job
* @param status Current status of the job
* @param events Workflow events sent by the job
* @param output Output of the job if any
* @param exception Exception from the job if any
*/
constructor(state: string, status: string[], events: WorkflowEventData[], output: any, exception: any);
get isExecuting(): boolean;
get isClosed(): boolean;
get errorResponse(): any;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobStatus = void 0;
/**
* Job status model containing details of the executing job.
*/
var JobStatus = /** @class */ (function () {
/**
*
* @param state Current state of the job
* @param status Current status of the job
* @param events Workflow events sent by the job
* @param output Output of the job if any
* @param exception Exception from the job if any
*/
function JobStatus(state, status, events, output, exception) {
this.state = state;
this.status = status;
this.events = events;
this.output = output;
this.exception = exception;
this.events = events || [];
this.output = output || undefined;
this.exception = exception || undefined;
}
Object.defineProperty(JobStatus.prototype, "isExecuting", {
get: function () { return this.state === 'Executing'; },
enumerable: false,
configurable: true
});
Object.defineProperty(JobStatus.prototype, "isClosed", {
get: function () { return this.state === 'Closed'; },
enumerable: false,
configurable: true
});
Object.defineProperty(JobStatus.prototype, "errorResponse", {
get: function () {
if (this.exception) {
this.exception.state = this.state;
}
else {
this.exception = { 'state': this.state };
}
return this.exception;
},
enumerable: false,
configurable: true
});
return JobStatus;
}());
exports.JobStatus = JobStatus;
/**
* PortResponse returned by the getPort Request.
*/
export declare class PortResponse {
port: number;
serverFeatures: string[];
constructor();
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PortResponse = void 0;
/**
* PortResponse returned by the getPort Request.
*/
var PortResponse = /** @class */ (function () {
function PortResponse() {
this.port = 0;
this.serverFeatures = [];
}
return PortResponse;
}());
exports.PortResponse = PortResponse;
import { Deferred } from '../utils';
/**
* Generic response model
*/
export declare class Response<T> {
private httpStatus;
statusText: string;
isDomainAllowed: boolean;
data?: T | undefined;
error?: string | undefined;
/**
*
* @param httpStatus Http status of the response
* @param statusText Http status text of the response
* @param isDomainAllowed Flag returned by the Server, saying if the domain is allowed by configuration
* @param data Response data if any
* @param error Handled error response if any
*/
constructor(httpStatus: number, statusText: string, isDomainAllowed: boolean, data?: T | undefined, error?: string | undefined);
get isSuccess(): boolean;
get isUnauthorized(): boolean;
get isForbidden(): boolean;
get isEmpty(): boolean;
get isNotFound(): boolean;
/**
* Resolve promise if its a successful response. Throws error if response was unsuccessful.
* @param promise promise which will be resolved if response was successful.
*/
resolve: (promise: Deferred<T>) => void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Response = void 0;
/**
* Generic response model
*/
var Response = /** @class */ (function () {
/**
*
* @param httpStatus Http status of the response
* @param statusText Http status text of the response
* @param isDomainAllowed Flag returned by the Server, saying if the domain is allowed by configuration
* @param data Response data if any
* @param error Handled error response if any
*/
function Response(httpStatus, statusText, isDomainAllowed, data, error) {
var _this = this;
this.httpStatus = httpStatus;
this.statusText = statusText;
this.isDomainAllowed = isDomainAllowed;
this.data = data;
this.error = error;
/**
* Resolve promise if its a successful response. Throws error if response was unsuccessful.
* @param promise promise which will be resolved if response was successful.
*/
this.resolve = function (promise) {
if (_this.isSuccess) {
promise.resolve(_this.data);
}
else {
promise.reject(new Error(_this.httpStatus + " - " + _this.error));
}
};
this.data = data || undefined;
}
Object.defineProperty(Response.prototype, "isSuccess", {
get: function () { return this.httpStatus >= 200 && this.httpStatus < 300; },
enumerable: false,
configurable: true
});
Object.defineProperty(Response.prototype, "isUnauthorized", {
get: function () { return this.httpStatus === 401; },
enumerable: false,
configurable: true
});
Object.defineProperty(Response.prototype, "isForbidden", {
get: function () { return this.httpStatus === 403; },
enumerable: false,
configurable: true
});
Object.defineProperty(Response.prototype, "isEmpty", {
get: function () { return this.httpStatus === 0; },
enumerable: false,
configurable: true
});
Object.defineProperty(Response.prototype, "isNotFound", {
get: function () { return this.httpStatus === 404; },
enumerable: false,
configurable: true
});
return Response;
}());
exports.Response = Response;
import { JobPromise } from '../models';
import { InstallProcessResult } from './installProcessResult';
/**
* Robot process model containing details of the robot process available in current system
*/
export declare class RobotProcess {
id: string;
name: string;
description: string | undefined;
/**
* Default constructor
* @param id Unique id of the robot process
* @param name Robot Process name
* @param description Process Description
*/
constructor(id: string, name: string, description?: string | undefined);
/**
* Start the robot process
* @param inArguments JSON object. In arguments to be passed to the robot if any.
*/
start: (inArguments?: any) => JobPromise;
/**
* Install the robot process
*/
install: () => Promise<InstallProcessResult>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RobotProcess = void 0;
var uipathRobot_1 = require("../uipathRobot");
var models_1 = require("../models");
/**
* Robot process model containing details of the robot process available in current system
*/
var RobotProcess = /** @class */ (function () {
/**
* Default constructor
* @param id Unique id of the robot process
* @param name Robot Process name
* @param description Process Description
*/
function RobotProcess(id, name, description) {
var _this = this;
if (description === void 0) { description = undefined; }
this.id = id;
this.name = name;
this.description = description;
/**
* Start the robot process
* @param inArguments JSON object. In arguments to be passed to the robot if any.
*/
this.start = function (inArguments) { return new models_1.JobPromise(new models_1.Job(_this.id, inArguments)); };
/**
* Install the robot process
*/
this.install = function () { return uipathRobot_1.UiPathRobot.installProcess(_this.id); };
}
return RobotProcess;
}());
exports.RobotProcess = RobotProcess;
/**
* ServerFeatures class used to maintain compatibility between different versions of client and server
*/
export declare class ServerFeatures {
private serverFeatures;
jobStatusUsesLongPolling: boolean;
installProcess: boolean;
useGivenJobId: boolean;
internalArguments: boolean;
/**
* Default constructor
*/
constructor(serverFeatures: string[]);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerFeatures = void 0;
/**
* ServerFeatures class used to maintain compatibility between different versions of client and server
*/
var ServerFeatures = /** @class */ (function () {
/**
* Default constructor
*/
function ServerFeatures(serverFeatures) {
this.serverFeatures = serverFeatures;
this.jobStatusUsesLongPolling = this.serverFeatures.includes('JobStatus_LongPolling');
this.installProcess = this.serverFeatures.includes('InstallProcess');
this.useGivenJobId = this.serverFeatures.includes('UseGivenJobId');
this.internalArguments = this.serverFeatures.includes('InternalArguments');
}
return ServerFeatures;
}());
exports.ServerFeatures = ServerFeatures;
/**
* Settings class used to change default settings of Js SDK
*/
export declare class Settings {
portNumber: number;
pollTimeInterval: number;
disableTelemetry: boolean;
appOrigin: string;
/**
* Default constructor
* @param portNumber Port number of the Http listener
* @param pollTimeInterval Poll interval time.
*/
constructor(portNumber: number, pollTimeInterval: number, disableTelemetry: boolean);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Settings = void 0;
/**
* Settings class used to change default settings of Js SDK
*/
var Settings = /** @class */ (function () {
/**
* Default constructor
* @param portNumber Port number of the Http listener
* @param pollTimeInterval Poll interval time.
*/
function Settings(portNumber, pollTimeInterval, disableTelemetry) {
this.portNumber = portNumber;
this.pollTimeInterval = pollTimeInterval;
this.disableTelemetry = disableTelemetry;
this.appOrigin = window.location.origin;
}
return Settings;
}());
exports.Settings = Settings;
/**
* Workflow event data model.
*/
export declare class WorkflowEventData {
name: string;
payload: string;
/**
* Default constructor
* @param name Workflow event name
* @param payload Workflow event payload
*/
constructor(name: string, payload: string);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkflowEventData = void 0;
/**
* Workflow event data model.
*/
var WorkflowEventData = /** @class */ (function () {
/**
* Default constructor
* @param name Workflow event name
* @param payload Workflow event payload
*/
function WorkflowEventData(name, payload) {
this.name = name;
this.payload = payload;
}
return WorkflowEventData;
}());
exports.WorkflowEventData = WorkflowEventData;

Sorry, the diff of this file is too big to display