@agility/management-sdk 0.1.2 → 0.1.3
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/dist/apiMethods/assetMethods.js +150 -73
- package/dist/apiMethods/batchMethods.js +93 -41
- package/dist/apiMethods/clientInstance.js +116 -56
- package/dist/apiMethods/containerMethods.js +166 -82
- package/dist/apiMethods/contentMethods.js +332 -148
- package/dist/apiMethods/instanceUserMethods.js +92 -38
- package/dist/apiMethods/modelMethods.js +129 -60
- package/dist/apiMethods/pageMethods.js +297 -133
- package/dist/models/batch.js +5 -2
- package/dist/models/batchItem.js +5 -2
- package/dist/models/container.js +5 -2
- package/dist/models/contentItem.js +25 -10
- package/dist/models/contentViewColumn.js +5 -2
- package/dist/models/exception.js +21 -5
- package/dist/models/instanceRole.js +5 -2
- package/dist/models/instanceUser.js +5 -2
- package/dist/models/media.js +10 -4
- package/dist/models/model.js +10 -4
- package/dist/models/notification.js +5 -2
- package/dist/models/options.js +7 -4
- package/dist/models/pageItem.js +30 -12
- package/dist/models/sitemap.js +10 -4
- package/dist/models/websiteUser.js +10 -4
- package/package.json +1 -1
- package/tsconfig.json +1 -1
|
@@ -8,88 +8,165 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
11
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
39
|
exports.AssetMethods = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
40
|
+
var clientInstance_1 = require("./clientInstance");
|
|
41
|
+
var exception_1 = require("../models/exception");
|
|
42
|
+
var AssetMethods = /** @class */ (function () {
|
|
43
|
+
function AssetMethods(options) {
|
|
17
44
|
this._options = options;
|
|
18
45
|
this._clientInstance = new clientInstance_1.ClientInstance();
|
|
19
46
|
}
|
|
20
|
-
deleteFile(mediaID) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
47
|
+
AssetMethods.prototype.deleteFile = function (mediaID) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
+
var apiPath, resp, err_1;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
_a.trys.push([0, 2, , 3]);
|
|
54
|
+
apiPath = "asset/delete/" + mediaID;
|
|
55
|
+
return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, this._options)];
|
|
56
|
+
case 1:
|
|
57
|
+
resp = _a.sent();
|
|
58
|
+
;
|
|
59
|
+
return [2 /*return*/, resp.data];
|
|
60
|
+
case 2:
|
|
61
|
+
err_1 = _a.sent();
|
|
62
|
+
throw new exception_1.Exception("Unable to delete the media for mediaID: " + mediaID, err_1);
|
|
63
|
+
case 3: return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
31
66
|
});
|
|
32
|
-
}
|
|
33
|
-
moveFile(mediaID, newFolder) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
67
|
+
};
|
|
68
|
+
AssetMethods.prototype.moveFile = function (mediaID, newFolder) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var folder, apiPath, resp, err_2;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
switch (_a.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
_a.trys.push([0, 2, , 3]);
|
|
75
|
+
folder = encodeURIComponent(newFolder);
|
|
76
|
+
apiPath = "asset/move/" + mediaID + "?newFolder=" + folder;
|
|
77
|
+
return [4 /*yield*/, this._clientInstance.executePost(apiPath, this._options, null)];
|
|
78
|
+
case 1:
|
|
79
|
+
resp = _a.sent();
|
|
80
|
+
return [2 /*return*/, resp.data];
|
|
81
|
+
case 2:
|
|
82
|
+
err_2 = _a.sent();
|
|
83
|
+
throw new exception_1.Exception("Unable to move the media for mediaID: " + mediaID, err_2);
|
|
84
|
+
case 3: return [2 /*return*/];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
44
87
|
});
|
|
45
|
-
}
|
|
46
|
-
getMediaList(pageSize, recordOffset) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
88
|
+
};
|
|
89
|
+
AssetMethods.prototype.getMediaList = function (pageSize, recordOffset) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
+
var apiPath, resp, err_3;
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0:
|
|
95
|
+
_a.trys.push([0, 2, , 3]);
|
|
96
|
+
apiPath = "asset/list?pageSize=" + pageSize + "&recordOffset=" + recordOffset;
|
|
97
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, this._options)];
|
|
98
|
+
case 1:
|
|
99
|
+
resp = _a.sent();
|
|
100
|
+
return [2 /*return*/, resp.data];
|
|
101
|
+
case 2:
|
|
102
|
+
err_3 = _a.sent();
|
|
103
|
+
throw new exception_1.Exception("Unable to retrieve assets for the website.", err_3);
|
|
104
|
+
case 3: return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
56
107
|
});
|
|
57
|
-
}
|
|
58
|
-
getAssetByID(mediaID) {
|
|
59
|
-
return __awaiter(this, void 0, void 0, function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
108
|
+
};
|
|
109
|
+
AssetMethods.prototype.getAssetByID = function (mediaID) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
+
var apiPath, resp, err_4;
|
|
112
|
+
return __generator(this, function (_a) {
|
|
113
|
+
switch (_a.label) {
|
|
114
|
+
case 0:
|
|
115
|
+
_a.trys.push([0, 2, , 3]);
|
|
116
|
+
apiPath = "asset/" + mediaID;
|
|
117
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, this._options)];
|
|
118
|
+
case 1:
|
|
119
|
+
resp = _a.sent();
|
|
120
|
+
return [2 /*return*/, resp.data];
|
|
121
|
+
case 2:
|
|
122
|
+
err_4 = _a.sent();
|
|
123
|
+
throw new exception_1.Exception("Unable to retrieve asset for mediaID " + mediaID, err_4);
|
|
124
|
+
case 3: return [2 /*return*/];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
68
127
|
});
|
|
69
|
-
}
|
|
70
|
-
getAssetByUrl(url) {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
128
|
+
};
|
|
129
|
+
AssetMethods.prototype.getAssetByUrl = function (url) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
+
var apiPath, resp, err_5;
|
|
132
|
+
return __generator(this, function (_a) {
|
|
133
|
+
switch (_a.label) {
|
|
134
|
+
case 0:
|
|
135
|
+
_a.trys.push([0, 2, , 3]);
|
|
136
|
+
apiPath = "asset?url=" + url;
|
|
137
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, this._options)];
|
|
138
|
+
case 1:
|
|
139
|
+
resp = _a.sent();
|
|
140
|
+
return [2 /*return*/, resp.data];
|
|
141
|
+
case 2:
|
|
142
|
+
err_5 = _a.sent();
|
|
143
|
+
throw new exception_1.Exception("Unable to retrieve asset for url " + url, err_5);
|
|
144
|
+
case 3: return [2 /*return*/];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
80
147
|
});
|
|
81
|
-
}
|
|
82
|
-
upload(formData, agilityFolderPath, groupingID
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
148
|
+
};
|
|
149
|
+
AssetMethods.prototype.upload = function (formData, agilityFolderPath, groupingID) {
|
|
150
|
+
if (groupingID === void 0) { groupingID = -1; }
|
|
151
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152
|
+
var apiPath, resp, err_6;
|
|
153
|
+
return __generator(this, function (_a) {
|
|
154
|
+
switch (_a.label) {
|
|
155
|
+
case 0:
|
|
156
|
+
_a.trys.push([0, 2, , 3]);
|
|
157
|
+
apiPath = "asset/upload?folderPath=" + agilityFolderPath + "&groupingID=" + groupingID;
|
|
158
|
+
return [4 /*yield*/, this._clientInstance.executePost(apiPath, this._options, formData)];
|
|
159
|
+
case 1:
|
|
160
|
+
resp = _a.sent();
|
|
161
|
+
return [2 /*return*/, resp.data];
|
|
162
|
+
case 2:
|
|
163
|
+
err_6 = _a.sent();
|
|
164
|
+
throw new exception_1.Exception("Unable to upload media.", err_6);
|
|
165
|
+
case 3: return [2 /*return*/];
|
|
166
|
+
}
|
|
167
|
+
});
|
|
92
168
|
});
|
|
93
|
-
}
|
|
94
|
-
|
|
169
|
+
};
|
|
170
|
+
return AssetMethods;
|
|
171
|
+
}());
|
|
95
172
|
exports.AssetMethods = AssetMethods;
|
|
@@ -8,58 +8,110 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
11
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
39
|
exports.BatchMethods = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
40
|
+
var clientInstance_1 = require("./clientInstance");
|
|
41
|
+
var batchState_1 = require("../enums/batchState.");
|
|
42
|
+
var exception_1 = require("../models/exception");
|
|
43
|
+
var BatchMethods = /** @class */ (function () {
|
|
44
|
+
function BatchMethods(options) {
|
|
18
45
|
this._options = options;
|
|
19
46
|
this._clientInstance = new clientInstance_1.ClientInstance();
|
|
20
47
|
}
|
|
21
|
-
getBatch(batchID) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
48
|
+
BatchMethods.prototype.getBatch = function (batchID) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
var apiPath, resp, err_1;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
_a.trys.push([0, 2, , 3]);
|
|
55
|
+
apiPath = "batch/" + batchID;
|
|
56
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, this._options)];
|
|
57
|
+
case 1:
|
|
58
|
+
resp = _a.sent();
|
|
59
|
+
return [2 /*return*/, resp.data];
|
|
60
|
+
case 2:
|
|
61
|
+
err_1 = _a.sent();
|
|
62
|
+
throw new exception_1.Exception("Unable to retreive the batch for id: " + batchID, err_1);
|
|
63
|
+
case 3: return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
31
66
|
});
|
|
32
|
-
}
|
|
33
|
-
Retry(method) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
67
|
+
};
|
|
68
|
+
BatchMethods.prototype.Retry = function (method) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var retryCount, duration, batch, err_2;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
switch (_a.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
retryCount = this._options.retryCount;
|
|
75
|
+
duration = this._options.duration;
|
|
76
|
+
if (retryCount <= 0)
|
|
77
|
+
throw new Error('Number of retries has been exhausted.');
|
|
78
|
+
_a.label = 1;
|
|
79
|
+
case 1:
|
|
80
|
+
if (!true) return [3 /*break*/, 9];
|
|
81
|
+
_a.label = 2;
|
|
82
|
+
case 2:
|
|
83
|
+
_a.trys.push([2, 7, , 8]);
|
|
84
|
+
return [4 /*yield*/, method()];
|
|
85
|
+
case 3:
|
|
86
|
+
batch = _a.sent();
|
|
87
|
+
if (!(batch.batchState === batchState_1.BatchState.Processed)) return [3 /*break*/, 4];
|
|
88
|
+
return [2 /*return*/, batch];
|
|
89
|
+
case 4:
|
|
46
90
|
--retryCount;
|
|
47
91
|
if (--retryCount <= 0) {
|
|
48
92
|
throw new Error('Timeout exceeded but operation still in progress. Please check the Batches page in the Agility Content Manager app.');
|
|
49
93
|
}
|
|
50
|
-
yield this.delay(duration);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
94
|
+
return [4 /*yield*/, this.delay(duration)];
|
|
95
|
+
case 5:
|
|
96
|
+
_a.sent();
|
|
97
|
+
_a.label = 6;
|
|
98
|
+
case 6: return [3 /*break*/, 8];
|
|
99
|
+
case 7:
|
|
100
|
+
err_2 = _a.sent();
|
|
101
|
+
throw new Error('Timeout exceeded but operation still in progress. Please check the Batches page in the Agility Content Manager app.');
|
|
102
|
+
case 8: return [3 /*break*/, 1];
|
|
103
|
+
case 9: return [2 /*return*/];
|
|
55
104
|
}
|
|
56
|
-
}
|
|
105
|
+
});
|
|
57
106
|
});
|
|
58
|
-
}
|
|
59
|
-
delay(ms) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function
|
|
61
|
-
return
|
|
107
|
+
};
|
|
108
|
+
BatchMethods.prototype.delay = function (ms) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
return __generator(this, function (_a) {
|
|
111
|
+
return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, ms); })];
|
|
112
|
+
});
|
|
62
113
|
});
|
|
63
|
-
}
|
|
64
|
-
|
|
114
|
+
};
|
|
115
|
+
return BatchMethods;
|
|
116
|
+
}());
|
|
65
117
|
exports.BatchMethods = BatchMethods;
|
|
@@ -8,70 +8,130 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
11
38
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
40
|
};
|
|
14
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
42
|
exports.ClientInstance = void 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
43
|
+
var axios_1 = __importDefault(require("axios"));
|
|
44
|
+
var ClientInstance = /** @class */ (function () {
|
|
45
|
+
function ClientInstance() {
|
|
46
|
+
}
|
|
47
|
+
ClientInstance.prototype.getInstance = function (options) {
|
|
48
|
+
var baseUrl = options.determineBaseUrl(options.guid);
|
|
49
|
+
var instance = axios_1.default.create({
|
|
50
|
+
baseURL: baseUrl + "/api/v1/instance/" + options.guid
|
|
22
51
|
});
|
|
23
52
|
return instance;
|
|
24
|
-
}
|
|
25
|
-
executeGet(apiPath, options) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
53
|
+
};
|
|
54
|
+
ClientInstance.prototype.executeGet = function (apiPath, options) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var instance, resp, err_1;
|
|
57
|
+
return __generator(this, function (_a) {
|
|
58
|
+
switch (_a.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
instance = this.getInstance(options);
|
|
61
|
+
_a.label = 1;
|
|
62
|
+
case 1:
|
|
63
|
+
_a.trys.push([1, 3, , 4]);
|
|
64
|
+
return [4 /*yield*/, instance.get(apiPath, {
|
|
65
|
+
headers: {
|
|
66
|
+
'Authorization': "Bearer " + options.token,
|
|
67
|
+
'Cache-Control': 'no-cache'
|
|
68
|
+
}
|
|
69
|
+
})];
|
|
70
|
+
case 2:
|
|
71
|
+
resp = _a.sent();
|
|
72
|
+
return [2 /*return*/, resp];
|
|
73
|
+
case 3:
|
|
74
|
+
err_1 = _a.sent();
|
|
75
|
+
throw err_1;
|
|
76
|
+
case 4: return [2 /*return*/];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
40
79
|
});
|
|
41
|
-
}
|
|
42
|
-
executeDelete(apiPath, options) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
80
|
+
};
|
|
81
|
+
ClientInstance.prototype.executeDelete = function (apiPath, options) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
+
var instance, resp, err_2;
|
|
84
|
+
return __generator(this, function (_a) {
|
|
85
|
+
switch (_a.label) {
|
|
86
|
+
case 0:
|
|
87
|
+
instance = this.getInstance(options);
|
|
88
|
+
_a.label = 1;
|
|
89
|
+
case 1:
|
|
90
|
+
_a.trys.push([1, 3, , 4]);
|
|
91
|
+
return [4 /*yield*/, instance.delete(apiPath, {
|
|
92
|
+
headers: {
|
|
93
|
+
'Authorization': "Bearer " + options.token,
|
|
94
|
+
'Cache-Control': 'no-cache'
|
|
95
|
+
}
|
|
96
|
+
})];
|
|
97
|
+
case 2:
|
|
98
|
+
resp = _a.sent();
|
|
99
|
+
return [2 /*return*/, resp];
|
|
100
|
+
case 3:
|
|
101
|
+
err_2 = _a.sent();
|
|
102
|
+
throw err_2;
|
|
103
|
+
case 4: return [2 /*return*/];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
57
106
|
});
|
|
58
|
-
}
|
|
59
|
-
executePost(apiPath, options, data) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
107
|
+
};
|
|
108
|
+
ClientInstance.prototype.executePost = function (apiPath, options, data) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
var instance, resp, err_3;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0:
|
|
114
|
+
instance = this.getInstance(options);
|
|
115
|
+
_a.label = 1;
|
|
116
|
+
case 1:
|
|
117
|
+
_a.trys.push([1, 3, , 4]);
|
|
118
|
+
return [4 /*yield*/, instance.post(apiPath, data, {
|
|
119
|
+
headers: {
|
|
120
|
+
'Authorization': "Bearer " + options.token,
|
|
121
|
+
'Cache-Control': 'no-cache'
|
|
122
|
+
}
|
|
123
|
+
})];
|
|
124
|
+
case 2:
|
|
125
|
+
resp = _a.sent();
|
|
126
|
+
return [2 /*return*/, resp];
|
|
127
|
+
case 3:
|
|
128
|
+
err_3 = _a.sent();
|
|
129
|
+
throw err_3;
|
|
130
|
+
case 4: return [2 /*return*/];
|
|
131
|
+
}
|
|
132
|
+
});
|
|
74
133
|
});
|
|
75
|
-
}
|
|
76
|
-
|
|
134
|
+
};
|
|
135
|
+
return ClientInstance;
|
|
136
|
+
}());
|
|
77
137
|
exports.ClientInstance = ClientInstance;
|