@opentap/runner-client 1.0.0-beta.56 → 1.0.0-beta.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/BaseClient.d.ts +5 -5
- package/lib/BaseClient.js +15 -15
- package/lib/RunnerClient.d.ts +2 -1
- package/lib/RunnerClient.js +2 -2
- package/lib/SessionClient.d.ts +2 -1
- package/lib/SessionClient.js +2 -2
- package/package.json +1 -1
package/lib/BaseClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequestOptions } from 'nats.ws';
|
|
1
|
+
import { ConnectionOptions, RequestOptions } from 'nats.ws';
|
|
2
2
|
import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsListItem, DataGridControl, ErrorResponse, FileParameter, FileResponse, ListItemType, ProfileGroup, RepositoryPackageReference, RepositorySettingsPackageDefinition, SettingsTapPackage } from './DTOs';
|
|
3
3
|
export declare class BaseClient {
|
|
4
4
|
private _accessToken;
|
|
@@ -11,15 +11,15 @@ export declare class BaseClient {
|
|
|
11
11
|
get timeout(): number;
|
|
12
12
|
/** Set timeout */
|
|
13
13
|
set timeout(value: number);
|
|
14
|
-
private _natsServer;
|
|
15
|
-
/** Get nats server */
|
|
16
|
-
get natsServer(): string;
|
|
17
14
|
private _baseSubject;
|
|
18
15
|
/** Get subject */
|
|
19
16
|
get baseSubject(): string;
|
|
17
|
+
private _connectionOptions;
|
|
18
|
+
/** Get connection options */
|
|
19
|
+
get connectionOptions(): ConnectionOptions;
|
|
20
20
|
private domainAccess;
|
|
21
21
|
private natsConnection;
|
|
22
|
-
constructor(baseSubject: string,
|
|
22
|
+
constructor(baseSubject: string, options: ConnectionOptions);
|
|
23
23
|
/**
|
|
24
24
|
* Send a request to the nats server.
|
|
25
25
|
* @param subject The subject to request
|
package/lib/BaseClient.js
CHANGED
|
@@ -36,13 +36,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import { connect, Empty, JSONCodec, StringCodec } from 'nats.ws';
|
|
38
38
|
var BaseClient = /** @class */ (function () {
|
|
39
|
-
function BaseClient(baseSubject,
|
|
40
|
-
if (natsServer === void 0) { natsServer = 'ws://localhost:443'; }
|
|
39
|
+
function BaseClient(baseSubject, options) {
|
|
41
40
|
this.domainAccess = new Map();
|
|
42
41
|
this._baseSubject = baseSubject;
|
|
43
|
-
this.
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
this._connectionOptions = options || { servers: 'ws://localhost:443' };
|
|
43
|
+
var undefinedSubject = function () {
|
|
44
|
+
throw new Error('A base subject must be specified');
|
|
45
|
+
};
|
|
46
|
+
baseSubject ? this.connect(this._connectionOptions) : undefinedSubject();
|
|
46
47
|
}
|
|
47
48
|
Object.defineProperty(BaseClient.prototype, "accessToken", {
|
|
48
49
|
/** Get access token */
|
|
@@ -68,18 +69,18 @@ var BaseClient = /** @class */ (function () {
|
|
|
68
69
|
enumerable: false,
|
|
69
70
|
configurable: true
|
|
70
71
|
});
|
|
71
|
-
Object.defineProperty(BaseClient.prototype, "
|
|
72
|
-
/** Get
|
|
72
|
+
Object.defineProperty(BaseClient.prototype, "baseSubject", {
|
|
73
|
+
/** Get subject */
|
|
73
74
|
get: function () {
|
|
74
|
-
return this.
|
|
75
|
+
return this._baseSubject;
|
|
75
76
|
},
|
|
76
77
|
enumerable: false,
|
|
77
78
|
configurable: true
|
|
78
79
|
});
|
|
79
|
-
Object.defineProperty(BaseClient.prototype, "
|
|
80
|
-
/** Get
|
|
80
|
+
Object.defineProperty(BaseClient.prototype, "connectionOptions", {
|
|
81
|
+
/** Get connection options */
|
|
81
82
|
get: function () {
|
|
82
|
-
return this.
|
|
83
|
+
return this._connectionOptions;
|
|
83
84
|
},
|
|
84
85
|
enumerable: false,
|
|
85
86
|
configurable: true
|
|
@@ -122,15 +123,14 @@ var BaseClient = /** @class */ (function () {
|
|
|
122
123
|
/**
|
|
123
124
|
* Create a connection to the nats server.
|
|
124
125
|
*/
|
|
125
|
-
BaseClient.prototype.connect = function () {
|
|
126
|
+
BaseClient.prototype.connect = function (options) {
|
|
126
127
|
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
-
var
|
|
128
|
+
var error_1;
|
|
128
129
|
var _this = this;
|
|
129
130
|
return __generator(this, function (_a) {
|
|
130
131
|
switch (_a.label) {
|
|
131
132
|
case 0:
|
|
132
133
|
_a.trys.push([0, 2, , 3]);
|
|
133
|
-
options = { servers: this._natsServer };
|
|
134
134
|
return [4 /*yield*/, connect(options).then(function (connection) {
|
|
135
135
|
_this.natsConnection = connection;
|
|
136
136
|
})];
|
|
@@ -139,7 +139,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
139
139
|
return [3 /*break*/, 3];
|
|
140
140
|
case 2:
|
|
141
141
|
error_1 = _a.sent();
|
|
142
|
-
throw new Error("
|
|
142
|
+
throw new Error("connection to ".concat(options.servers, " failed due to ").concat(error_1));
|
|
143
143
|
case 3: return [2 /*return*/];
|
|
144
144
|
}
|
|
145
145
|
});
|
package/lib/RunnerClient.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { ConnectionOptions } from 'nats.ws';
|
|
1
2
|
import { BaseClient } from './BaseClient';
|
|
2
3
|
import { Image, Links, Session } from './DTOs';
|
|
3
4
|
export declare class RunnerClient extends BaseClient {
|
|
4
5
|
private http;
|
|
5
6
|
private baseUrl;
|
|
6
7
|
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
|
|
7
|
-
constructor(baseSubject: string,
|
|
8
|
+
constructor(baseSubject: string, options: ConnectionOptions);
|
|
8
9
|
/**
|
|
9
10
|
* Get the created image with the specified ID.
|
|
10
11
|
* @param imageId
|
package/lib/RunnerClient.js
CHANGED
|
@@ -17,8 +17,8 @@ import { BaseClient } from './BaseClient';
|
|
|
17
17
|
import { ApiException, ErrorResponse, Links, Session } from './DTOs';
|
|
18
18
|
var RunnerClient = /** @class */ (function (_super) {
|
|
19
19
|
__extends(RunnerClient, _super);
|
|
20
|
-
function RunnerClient(baseSubject,
|
|
21
|
-
var _this = _super.call(this, baseSubject,
|
|
20
|
+
function RunnerClient(baseSubject, options) {
|
|
21
|
+
var _this = _super.call(this, baseSubject, options) || this;
|
|
22
22
|
_this.jsonParseReviver = undefined;
|
|
23
23
|
return _this;
|
|
24
24
|
}
|
package/lib/SessionClient.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, Links, ListItemType, LogList, Parameter, RepositoryPackageDefinition, RepositoryPackageReference, RunStatus, Setting, TestPlan, TestStepType, TestStepValidationError, WatchDog } from './DTOs';
|
|
2
2
|
import { BaseClient } from './BaseClient';
|
|
3
|
+
import { ConnectionOptions } from 'nats.ws';
|
|
3
4
|
export declare class SessionClient extends BaseClient {
|
|
4
5
|
private http;
|
|
5
6
|
private baseUrl;
|
|
6
7
|
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
|
|
7
|
-
constructor(baseSubject: string,
|
|
8
|
+
constructor(baseSubject: string, options: ConnectionOptions);
|
|
8
9
|
/**
|
|
9
10
|
* Retrieve session logs
|
|
10
11
|
* @param id (optional)
|
package/lib/SessionClient.js
CHANGED
|
@@ -17,8 +17,8 @@ import { ApiException, ErrorResponse, Links, MissingLicenseResponse, } from './D
|
|
|
17
17
|
import { BaseClient } from './BaseClient';
|
|
18
18
|
var SessionClient = /** @class */ (function (_super) {
|
|
19
19
|
__extends(SessionClient, _super);
|
|
20
|
-
function SessionClient(baseSubject,
|
|
21
|
-
var _this = _super.call(this, baseSubject,
|
|
20
|
+
function SessionClient(baseSubject, options) {
|
|
21
|
+
var _this = _super.call(this, baseSubject, options) || this;
|
|
22
22
|
_this.jsonParseReviver = undefined;
|
|
23
23
|
return _this;
|
|
24
24
|
}
|