@hailer/app-sdk 2.0.0-beta-2 → 2.0.0-beta-4
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/app-sdk.js +2 -2
- package/lib/app-sdk.js.map +3 -3
- package/lib/modules/app.d.ts +8 -4
- package/lib/modules/product-installed.d.ts +40 -0
- package/lib/modules/product-version.d.ts +38 -0
- package/lib/modules/product.d.ts +4 -4
- package/lib/modules/public/product-version.d.ts +16 -0
- package/lib/modules/public/product.d.ts +2 -2
- package/lib/modules/public/version.d.ts +16 -0
- package/lib/modules/version.d.ts +16 -0
- package/lib/modules/workspace.d.ts +4 -2
- package/lib/src/constants.d.ts +7 -0
- package/lib/src/hailer-api.d.ts +92 -0
- package/lib/{index.js → src/index.d.ts} +0 -1
- package/lib/src/modules/activity/kanban.d.ts +36 -0
- package/lib/src/modules/activity.d.ts +83 -0
- package/lib/src/modules/app.d.ts +12 -0
- package/lib/src/modules/insight.d.ts +36 -0
- package/lib/src/modules/network.d.ts +14 -0
- package/lib/src/modules/permission.d.ts +9 -0
- package/lib/src/modules/process.d.ts +38 -0
- package/lib/src/modules/product-installed.d.ts +40 -0
- package/lib/src/modules/product-version.d.ts +16 -0
- package/lib/src/modules/product.d.ts +104 -0
- package/lib/src/modules/public/app.d.ts +17 -0
- package/lib/src/modules/public/form.d.ts +31 -0
- package/lib/src/modules/public/insight.d.ts +30 -0
- package/lib/src/modules/public/product-version.d.ts +16 -0
- package/lib/src/modules/public/product.d.ts +27 -0
- package/lib/src/modules/public.d.ts +22 -0
- package/lib/src/modules/ui/activity.d.ts +30 -0
- package/lib/src/modules/ui/files.d.ts +18 -0
- package/lib/src/modules/ui/snackbar.d.ts +18 -0
- package/lib/src/modules/ui.d.ts +17 -0
- package/lib/src/modules/user.d.ts +36 -0
- package/lib/src/modules/workflow.d.ts +24 -0
- package/lib/src/types.d.ts +381 -0
- package/lib/tools/publish.cjs +219 -183
- package/lib/tools/publish.cjs.map +7 -0
- package/lib/types.d.ts +9 -3
- package/lib/version.d.ts +0 -0
- package/package.json +2 -2
- package/lib/constants.js +0 -3
- package/lib/hailer-api.js +0 -147
- package/lib/modules/activity/kanban.js +0 -88
- package/lib/modules/activity.js +0 -170
- package/lib/modules/insight.js +0 -73
- package/lib/modules/network.js +0 -74
- package/lib/modules/process.js +0 -104
- package/lib/modules/public/form.js +0 -117
- package/lib/modules/public/insight.js +0 -114
- package/lib/modules/team.d.ts +0 -17
- package/lib/modules/ui/activity.js +0 -72
- package/lib/modules/ui.js +0 -10
- package/lib/modules/user.js +0 -133
- package/lib/public-api.d.ts +0 -16
- package/lib/public-api.js +0 -13
- package/lib/tools/minimal-password-prompt.d.ts +0 -1
- package/lib/tools/minimal-password-prompt.js +0 -50
- package/lib/types.js +0 -28
package/lib/hailer-api.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { Client } from '@wishcore/wish-rpc';
|
|
38
|
-
import { User } from './modules/user';
|
|
39
|
-
import { Activity } from './modules/activity';
|
|
40
|
-
import { Network } from './modules/network';
|
|
41
|
-
import { Ui } from './modules/ui';
|
|
42
|
-
import { Insight } from './modules/insight';
|
|
43
|
-
import { Process } from './modules/process';
|
|
44
|
-
import { DEFAULT_ALLOWED_URLS, DEFAULT_API_VERSION } from './constants';
|
|
45
|
-
var HailerApi = /** @class */ (function () {
|
|
46
|
-
/**
|
|
47
|
-
* Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.
|
|
48
|
-
*
|
|
49
|
-
* This should be run after window is initialized for example in ***onMount*** in Svelte or in ***useEffect*** in React
|
|
50
|
-
*/
|
|
51
|
-
function HailerApi(options) {
|
|
52
|
-
if (options === void 0) { options = {}; }
|
|
53
|
-
var _this = this;
|
|
54
|
-
var _a, _b, _c, _d;
|
|
55
|
-
this.options = options;
|
|
56
|
-
var allowedUrls = (_a = options.allowedUrls) !== null && _a !== void 0 ? _a : DEFAULT_ALLOWED_URLS;
|
|
57
|
-
this.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : DEFAULT_API_VERSION;
|
|
58
|
-
this.subscribedSignals = options.subscribedSignals;
|
|
59
|
-
this.client = new Client(function (msg) {
|
|
60
|
-
if (_this.hostUrl) {
|
|
61
|
-
parent.postMessage(JSON.stringify(msg), _this.hostUrl);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
this.user = new User(this.client, this.apiVersion);
|
|
65
|
-
this.activity = new Activity(this.client, this.apiVersion);
|
|
66
|
-
this.insight = new Insight(this.client, this.apiVersion);
|
|
67
|
-
this.network = new Network(this.client, this.apiVersion);
|
|
68
|
-
this.process = new Process(this.client, this.apiVersion);
|
|
69
|
-
this.ui = new Ui(this.client, this.apiVersion);
|
|
70
|
-
var registerMessage = JSON.stringify({ op: 'register', args: [] });
|
|
71
|
-
// If we are not in Iframe set location to outside, else wait 100ms for response to register to check if we are in Hailer
|
|
72
|
-
if (window.location === window.parent.location) {
|
|
73
|
-
(_d = (_c = this.options).outside) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
// if in a frame, try register to Hailer by sending register to all allowed urls
|
|
77
|
-
allowedUrls.forEach(function (url) { return parent.postMessage(registerMessage, url); });
|
|
78
|
-
this.timer = setTimeout(function () { var _a, _b; return (_b = (_a = _this.options).outside) === null || _b === void 0 ? void 0 : _b.call(_a); }, 100);
|
|
79
|
-
}
|
|
80
|
-
this.createEventListener();
|
|
81
|
-
}
|
|
82
|
-
HailerApi.prototype.createEventListener = function () {
|
|
83
|
-
var _this = this;
|
|
84
|
-
window.addEventListener('message', function (event) {
|
|
85
|
-
var _a, _b;
|
|
86
|
-
var data = event.data;
|
|
87
|
-
try {
|
|
88
|
-
var msg = JSON.parse(data);
|
|
89
|
-
if (msg.op === 'register') {
|
|
90
|
-
clearTimeout(_this.timer);
|
|
91
|
-
_this.appId = msg.data.appId;
|
|
92
|
-
// Set host url now that we have a response
|
|
93
|
-
_this.hostUrl = event.origin;
|
|
94
|
-
// Register listeners for config and settings
|
|
95
|
-
_this.client.request("v".concat(_this.apiVersion, ".ui.settings"), [], function (error, data, end) {
|
|
96
|
-
var _a, _b;
|
|
97
|
-
if (error) {
|
|
98
|
-
console.log('ui.settings error:', error, data);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
(_b = (_a = _this.options).settings) === null || _b === void 0 ? void 0 : _b.call(_a, data);
|
|
102
|
-
});
|
|
103
|
-
_this.client.request("v".concat(_this.apiVersion, ".config"), [], function (error, data, end) {
|
|
104
|
-
var _a, _b;
|
|
105
|
-
if (error) {
|
|
106
|
-
console.log('config error:', error, data);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
(_b = (_a = _this.options).config) === null || _b === void 0 ? void 0 : _b.call(_a, data);
|
|
110
|
-
});
|
|
111
|
-
// Register subscribed signals
|
|
112
|
-
if (_this.subscribedSignals) {
|
|
113
|
-
_this.client.request("v".concat(_this.apiVersion, ".signals"), [_this.subscribedSignals], function (error, data, end) {
|
|
114
|
-
var _a, _b;
|
|
115
|
-
if (error) {
|
|
116
|
-
console.log('signals error:', error, data);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (data) {
|
|
120
|
-
(_b = (_a = _this.options).signals) === null || _b === void 0 ? void 0 : _b.call(_a, data);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
// Call connected callback
|
|
125
|
-
(_b = (_a = _this.options).connected) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
126
|
-
}
|
|
127
|
-
_this.client.messageReceived(msg);
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
console.error(error);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
// TODO: This is here for development and debugging, might be removed later
|
|
135
|
-
HailerApi.prototype.request = function (op, args) {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
return __generator(this, function (_a) {
|
|
138
|
-
switch (_a.label) {
|
|
139
|
-
case 0: return [4 /*yield*/, this.client.requestAsync(op, args)];
|
|
140
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
return HailerApi;
|
|
146
|
-
}());
|
|
147
|
-
export { HailerApi };
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var Kanban = /** @class */ (function () {
|
|
38
|
-
function Kanban(client, apiVersion) {
|
|
39
|
-
this.client = client;
|
|
40
|
-
this.apiVersion = apiVersion;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Lists all activities in a kanban grouped by phases
|
|
44
|
-
*
|
|
45
|
-
* @param processId the id of the process the kanban relates to
|
|
46
|
-
* @param options object containing apiVersion option and requestOptions to be passed to the backend endpoint
|
|
47
|
-
*
|
|
48
|
-
* @returns activities in kanban list format
|
|
49
|
-
*/
|
|
50
|
-
Kanban.prototype.list = function (processId, options) {
|
|
51
|
-
var _a;
|
|
52
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
var res;
|
|
54
|
-
return __generator(this, function (_b) {
|
|
55
|
-
switch (_b.label) {
|
|
56
|
-
case 0: return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options === null || options === void 0 ? void 0 : options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".activity.kanban.list"), [processId, options === null || options === void 0 ? void 0 : options.requestOptions])];
|
|
57
|
-
case 1:
|
|
58
|
-
res = _b.sent();
|
|
59
|
-
return [2 /*return*/, res];
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Loads a single activity in kanban format
|
|
66
|
-
*
|
|
67
|
-
* @param activityId activityId of the wanted activity
|
|
68
|
-
* @param options object containing apiVersion option
|
|
69
|
-
*
|
|
70
|
-
* @returns activity in kanban format
|
|
71
|
-
*/
|
|
72
|
-
Kanban.prototype.load = function (activityId, options) {
|
|
73
|
-
var _a;
|
|
74
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
-
var res;
|
|
76
|
-
return __generator(this, function (_b) {
|
|
77
|
-
switch (_b.label) {
|
|
78
|
-
case 0: return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".activity.kanban.load"), [activityId])];
|
|
79
|
-
case 1:
|
|
80
|
-
res = _b.sent();
|
|
81
|
-
return [2 /*return*/, res];
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
return Kanban;
|
|
87
|
-
}());
|
|
88
|
-
export { Kanban };
|
package/lib/modules/activity.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { HailerError } from '../types';
|
|
38
|
-
var Activity = /** @class */ (function () {
|
|
39
|
-
function Activity(client, apiVersion) {
|
|
40
|
-
this.client = client;
|
|
41
|
-
this.apiVersion = apiVersion;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Lists all activities from the specified process and phase
|
|
45
|
-
*
|
|
46
|
-
* @param processId process from current network
|
|
47
|
-
* @param phaseId phase in the process specified in processId
|
|
48
|
-
* @param options options with apiVersion and requestOptions, default values can be found in api.hailer.com/docs v3.activity.list
|
|
49
|
-
*
|
|
50
|
-
* @returns List of Hailer activities from process and phase filtered with supplied options
|
|
51
|
-
*
|
|
52
|
-
* @throws {HailerError} if request is incorrect
|
|
53
|
-
*/
|
|
54
|
-
Activity.prototype.list = function (processId, phaseId, options) {
|
|
55
|
-
var _a;
|
|
56
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var res, error_1;
|
|
58
|
-
return __generator(this, function (_b) {
|
|
59
|
-
switch (_b.label) {
|
|
60
|
-
case 0:
|
|
61
|
-
_b.trys.push([0, 2, , 3]);
|
|
62
|
-
return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options === null || options === void 0 ? void 0 : options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".activity.list"), [processId, phaseId, options === null || options === void 0 ? void 0 : options.requestOptions])];
|
|
63
|
-
case 1:
|
|
64
|
-
res = _b.sent();
|
|
65
|
-
return [2 /*return*/, res.activities];
|
|
66
|
-
case 2:
|
|
67
|
-
error_1 = _b.sent();
|
|
68
|
-
throw new HailerError(error_1);
|
|
69
|
-
case 3: return [2 /*return*/];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Gets single activity
|
|
76
|
-
*
|
|
77
|
-
* @param activityId activity Id of the process specified in processId
|
|
78
|
-
* @param processId Process where the activityId is
|
|
79
|
-
* @param phaseId Phase where the activityId is in process specified by processId
|
|
80
|
-
* @param options options containing apiVersion
|
|
81
|
-
*
|
|
82
|
-
* @returns Hailer activity information
|
|
83
|
-
*
|
|
84
|
-
* @throws {HailerError} if request is incorrect
|
|
85
|
-
*/
|
|
86
|
-
Activity.prototype.get = function (activityId, processId, phaseId, options) {
|
|
87
|
-
var _a;
|
|
88
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
-
var res, error_2;
|
|
90
|
-
return __generator(this, function (_b) {
|
|
91
|
-
switch (_b.label) {
|
|
92
|
-
case 0:
|
|
93
|
-
_b.trys.push([0, 2, , 3]);
|
|
94
|
-
return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options === null || options === void 0 ? void 0 : options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".activity.list"), [processId, phaseId])];
|
|
95
|
-
case 1:
|
|
96
|
-
res = _b.sent();
|
|
97
|
-
return [2 /*return*/, res.activities.find(function (activity) { return activity._id === activityId; })];
|
|
98
|
-
case 2:
|
|
99
|
-
error_2 = _b.sent();
|
|
100
|
-
throw new HailerError(error_2);
|
|
101
|
-
case 3: return [2 /*return*/];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Creates an activity
|
|
108
|
-
*
|
|
109
|
-
* @param processId The process where the activity is created
|
|
110
|
-
* @param activity Attributes of the new activity
|
|
111
|
-
* @param options optional options with apiVersion and requestOptions to be passed to the backend endpoint
|
|
112
|
-
*
|
|
113
|
-
* @throws {HailerError} if request is incorrect
|
|
114
|
-
*/
|
|
115
|
-
Activity.prototype.create = function (processId, activities, options) {
|
|
116
|
-
var _a;
|
|
117
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
var res, error_3;
|
|
119
|
-
return __generator(this, function (_b) {
|
|
120
|
-
switch (_b.label) {
|
|
121
|
-
case 0:
|
|
122
|
-
_b.trys.push([0, 2, , 3]);
|
|
123
|
-
return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options === null || options === void 0 ? void 0 : options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".activity.create"), [processId, activities])];
|
|
124
|
-
case 1:
|
|
125
|
-
res = _b.sent();
|
|
126
|
-
return [2 /*return*/, res];
|
|
127
|
-
case 2:
|
|
128
|
-
error_3 = _b.sent();
|
|
129
|
-
throw new HailerError(error_3);
|
|
130
|
-
case 3: return [2 /*return*/];
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Updates an activity
|
|
137
|
-
*
|
|
138
|
-
* @param _id Id of an activity to edit
|
|
139
|
-
* @param name New name of the activity
|
|
140
|
-
* @param fields change values of fields, null removes current value
|
|
141
|
-
* @param phaseId New phase of the activity
|
|
142
|
-
* @param options options containing apiVersion
|
|
143
|
-
*
|
|
144
|
-
* @returns The number of updated activities
|
|
145
|
-
*
|
|
146
|
-
* @throws {HailerError} if request is incorrect
|
|
147
|
-
*/
|
|
148
|
-
Activity.prototype.update = function (activity, options) {
|
|
149
|
-
var _a;
|
|
150
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
-
var res, error_4;
|
|
152
|
-
return __generator(this, function (_b) {
|
|
153
|
-
switch (_b.label) {
|
|
154
|
-
case 0:
|
|
155
|
-
_b.trys.push([0, 2, , 3]);
|
|
156
|
-
return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options === null || options === void 0 ? void 0 : options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".activity.update"), [activity])];
|
|
157
|
-
case 1:
|
|
158
|
-
res = _b.sent();
|
|
159
|
-
return [2 /*return*/, res];
|
|
160
|
-
case 2:
|
|
161
|
-
error_4 = _b.sent();
|
|
162
|
-
throw new HailerError(error_4);
|
|
163
|
-
case 3: return [2 /*return*/];
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
return Activity;
|
|
169
|
-
}());
|
|
170
|
-
export { Activity };
|
package/lib/modules/insight.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { HailerError } from '../types';
|
|
38
|
-
var Insight = /** @class */ (function () {
|
|
39
|
-
function Insight(client, apiVersion) {
|
|
40
|
-
this.client = client;
|
|
41
|
-
this.apiVersion = apiVersion;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Get Insight data
|
|
45
|
-
*
|
|
46
|
-
* @param insightId the id of the Insight the data is fetched from
|
|
47
|
-
* @param options object containing apiVersion option
|
|
48
|
-
*
|
|
49
|
-
* @returns data from the Insight
|
|
50
|
-
*
|
|
51
|
-
* @throws {HailerError} if request is incorrect
|
|
52
|
-
*/
|
|
53
|
-
Insight.prototype.data = function (insightId, options) {
|
|
54
|
-
var _a;
|
|
55
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
-
var error_1;
|
|
57
|
-
return __generator(this, function (_b) {
|
|
58
|
-
switch (_b.label) {
|
|
59
|
-
case 0:
|
|
60
|
-
_b.trys.push([0, 2, , 3]);
|
|
61
|
-
return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options === null || options === void 0 ? void 0 : options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".insight.data"), [insightId])];
|
|
62
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
63
|
-
case 2:
|
|
64
|
-
error_1 = _b.sent();
|
|
65
|
-
throw new HailerError(error_1);
|
|
66
|
-
case 3: return [2 /*return*/];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
return Insight;
|
|
72
|
-
}());
|
|
73
|
-
export { Insight };
|
package/lib/modules/network.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { HailerError } from '../types';
|
|
38
|
-
var Network = /** @class */ (function () {
|
|
39
|
-
function Network(client, apiVersion) {
|
|
40
|
-
this.client = client;
|
|
41
|
-
this.apiVersion = apiVersion;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Returns the current network
|
|
45
|
-
*
|
|
46
|
-
* @param options object containing apiVersion option
|
|
47
|
-
*
|
|
48
|
-
* @returns the Hailer Workspace information the user is currently in
|
|
49
|
-
*
|
|
50
|
-
* @throws {HailerError} if request is incorrect
|
|
51
|
-
*/
|
|
52
|
-
Network.prototype.current = function (options) {
|
|
53
|
-
var _a;
|
|
54
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
-
var res, error_1;
|
|
56
|
-
return __generator(this, function (_b) {
|
|
57
|
-
switch (_b.label) {
|
|
58
|
-
case 0:
|
|
59
|
-
_b.trys.push([0, 2, , 3]);
|
|
60
|
-
return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options === null || options === void 0 ? void 0 : options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".network.current"), [])];
|
|
61
|
-
case 1:
|
|
62
|
-
res = _b.sent();
|
|
63
|
-
return [2 /*return*/, res];
|
|
64
|
-
case 2:
|
|
65
|
-
error_1 = _b.sent();
|
|
66
|
-
throw new HailerError(error_1);
|
|
67
|
-
case 3: return [2 /*return*/];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
return Network;
|
|
73
|
-
}());
|
|
74
|
-
export { Network };
|
package/lib/modules/process.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { HailerError } from '../types';
|
|
38
|
-
var Process = /** @class */ (function () {
|
|
39
|
-
function Process(client, apiVersion) {
|
|
40
|
-
this.client = client;
|
|
41
|
-
this.apiVersion = apiVersion;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Lists all processes from a workspace
|
|
45
|
-
*
|
|
46
|
-
* @param options object containing apiVersion option
|
|
47
|
-
*
|
|
48
|
-
* @returns all Hailer processes in the workspace the app user is currently in
|
|
49
|
-
*
|
|
50
|
-
* @throws {HailerError} if request is incorrect
|
|
51
|
-
*/
|
|
52
|
-
Process.prototype.list = function (options) {
|
|
53
|
-
var _a;
|
|
54
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
-
var processes, error_1;
|
|
56
|
-
return __generator(this, function (_b) {
|
|
57
|
-
switch (_b.label) {
|
|
58
|
-
case 0:
|
|
59
|
-
_b.trys.push([0, 2, , 3]);
|
|
60
|
-
return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options === null || options === void 0 ? void 0 : options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".process.list"), [])];
|
|
61
|
-
case 1:
|
|
62
|
-
processes = _b.sent();
|
|
63
|
-
return [2 /*return*/, processes];
|
|
64
|
-
case 2:
|
|
65
|
-
error_1 = _b.sent();
|
|
66
|
-
throw new HailerError(error_1);
|
|
67
|
-
case 3: return [2 /*return*/];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Gets a single process from a workspace
|
|
74
|
-
*
|
|
75
|
-
* @param processId the id of the process in question
|
|
76
|
-
* @param options object containing apiVersion option
|
|
77
|
-
*
|
|
78
|
-
* @returns the specified Hailer process
|
|
79
|
-
*
|
|
80
|
-
* @throws {HailerError} if request is incorrect
|
|
81
|
-
*/
|
|
82
|
-
Process.prototype.get = function (processId, options) {
|
|
83
|
-
var _a;
|
|
84
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
-
var process_1, error_2;
|
|
86
|
-
return __generator(this, function (_b) {
|
|
87
|
-
switch (_b.label) {
|
|
88
|
-
case 0:
|
|
89
|
-
_b.trys.push([0, 2, , 3]);
|
|
90
|
-
return [4 /*yield*/, this.client.requestAsync("v".concat((_a = options === null || options === void 0 ? void 0 : options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion, ".process.get"), [processId])];
|
|
91
|
-
case 1:
|
|
92
|
-
process_1 = _b.sent();
|
|
93
|
-
return [2 /*return*/, process_1];
|
|
94
|
-
case 2:
|
|
95
|
-
error_2 = _b.sent();
|
|
96
|
-
throw new HailerError(error_2);
|
|
97
|
-
case 3: return [2 /*return*/];
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
return Process;
|
|
103
|
-
}());
|
|
104
|
-
export { Process };
|