@agility/management-sdk 0.1.11 → 0.1.13
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/README.md +522 -522
- package/dist/apiClient.d.ts +19 -19
- package/dist/apiClient.js +24 -24
- package/dist/apiMethods/apiClient.d.ts +19 -0
- package/dist/apiMethods/apiClient.js +24 -0
- package/dist/apiMethods/assetMethods.d.ts +24 -24
- package/dist/apiMethods/assetMethods.js +315 -315
- package/dist/apiMethods/batchMethods.d.ts +11 -11
- package/dist/apiMethods/batchMethods.js +117 -117
- package/dist/apiMethods/clientInstance.d.ts +18 -18
- package/dist/apiMethods/clientInstance.js +168 -168
- package/dist/apiMethods/containerMethods.d.ts +16 -16
- package/dist/apiMethods/containerMethods.js +189 -189
- package/dist/apiMethods/contentMethods.d.ts +20 -20
- package/dist/apiMethods/contentMethods.js +359 -359
- package/dist/apiMethods/instanceUserMethods.d.ts +13 -13
- package/dist/apiMethods/instanceUserMethods.js +111 -111
- package/dist/apiMethods/modelMethods.d.ts +14 -14
- package/dist/apiMethods/modelMethods.js +170 -170
- package/dist/apiMethods/pageMethods.d.ts +28 -20
- package/dist/apiMethods/pageMethods.js +446 -323
- package/dist/enums/assetGroupingType.d.ts +3 -3
- package/dist/enums/assetGroupingType.js +7 -7
- package/dist/enums/batchOperationType.d.ts +19 -19
- package/dist/enums/batchOperationType.js +23 -23
- package/dist/enums/batchState..d.ts +7 -7
- package/dist/enums/batchState..js +11 -11
- package/dist/enums/pageItemTemplateType.d.ts +4 -0
- package/dist/enums/pageItemTemplateType.js +8 -0
- package/dist/index.d.ts +23 -19
- package/dist/index.js +39 -31
- package/dist/models/assetContainer.d.ts +7 -7
- package/dist/models/assetContainer.js +9 -9
- package/dist/models/assetGalleries.d.ts +5 -5
- package/dist/models/assetGalleries.js +9 -9
- package/dist/models/assetMediaGrouping.d.ts +17 -17
- package/dist/models/assetMediaGrouping.js +9 -9
- package/dist/models/assetMediaGroupingMetaData.d.ts +4 -4
- package/dist/models/assetMediaGroupingMetaData.js +9 -9
- package/dist/models/batch.d.ts +29 -29
- package/dist/models/batch.js +9 -9
- package/dist/models/batchItem.d.ts +13 -13
- package/dist/models/batchItem.js +9 -9
- package/dist/models/container.d.ts +47 -47
- package/dist/models/container.js +9 -9
- package/dist/models/contentItem.d.ts +37 -37
- package/dist/models/contentItem.js +33 -33
- package/dist/models/contentSectionDefaultModule.d.ts +7 -0
- package/dist/models/contentSectionDefaultModule.js +9 -0
- package/dist/models/contentSectionDefinition.d.ts +35 -0
- package/dist/models/contentSectionDefinition.js +9 -0
- package/dist/models/contentViewColumn.d.ts +8 -8
- package/dist/models/contentViewColumn.js +9 -9
- package/dist/models/exception.d.ts +4 -4
- package/dist/models/exception.js +28 -26
- package/dist/models/instanceRole.d.ts +7 -7
- package/dist/models/instanceRole.js +9 -9
- package/dist/models/instanceUser.d.ts +14 -14
- package/dist/models/instanceUser.js +9 -9
- package/dist/models/media.d.ts +30 -30
- package/dist/models/media.js +15 -15
- package/dist/models/model.d.ts +30 -30
- package/dist/models/model.js +15 -15
- package/dist/models/notification.d.ts +13 -13
- package/dist/models/notification.js +9 -9
- package/dist/models/options.d.ts +7 -7
- package/dist/models/options.js +9 -9
- package/dist/models/pageItem.d.ts +56 -56
- package/dist/models/pageItem.js +39 -39
- package/dist/models/pageModel.d.ts +14 -0
- package/dist/models/pageModel.js +9 -0
- package/dist/models/sharedModule.d.ts +7 -0
- package/dist/models/sharedModule.js +9 -0
- package/dist/models/sitemap.d.ts +20 -20
- package/dist/models/sitemap.js +15 -15
- package/dist/models/websiteUser.d.ts +22 -22
- package/dist/models/websiteUser.js +15 -15
- package/dist/src/apiMethods/assetMethods.d.ts +14 -0
- package/dist/src/apiMethods/assetMethods.js +172 -0
- package/dist/src/apiMethods/batchMethods.d.ts +11 -0
- package/dist/src/apiMethods/batchMethods.js +117 -0
- package/dist/src/apiMethods/clientInstance.d.ts +8 -0
- package/dist/src/apiMethods/clientInstance.js +156 -0
- package/dist/src/apiMethods/containerMethods.d.ts +16 -0
- package/dist/src/apiMethods/containerMethods.js +189 -0
- package/dist/src/apiMethods/contentMethods.d.ts +20 -0
- package/dist/src/apiMethods/contentMethods.js +359 -0
- package/dist/src/apiMethods/instanceUserMethods.d.ts +13 -0
- package/dist/src/apiMethods/instanceUserMethods.js +111 -0
- package/dist/src/apiMethods/modelMethods.d.ts +13 -0
- package/dist/src/apiMethods/modelMethods.js +150 -0
- package/dist/src/apiMethods/pageMethods.d.ts +20 -0
- package/dist/src/apiMethods/pageMethods.js +323 -0
- package/dist/src/enums/batchOperationType.d.ts +19 -0
- package/dist/src/enums/batchOperationType.js +23 -0
- package/dist/src/enums/batchState..d.ts +7 -0
- package/dist/src/enums/batchState..js +11 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.js +30 -0
- package/dist/src/models/batch.d.ts +29 -0
- package/dist/src/models/batch.js +9 -0
- package/dist/src/models/batchItem.d.ts +13 -0
- package/dist/src/models/batchItem.js +9 -0
- package/dist/src/models/container.d.ts +47 -0
- package/dist/src/models/container.js +9 -0
- package/dist/src/models/contentItem.d.ts +37 -0
- package/dist/src/models/contentItem.js +33 -0
- package/dist/src/models/contentViewColumn.d.ts +8 -0
- package/dist/src/models/contentViewColumn.js +9 -0
- package/dist/src/models/exception.d.ts +4 -0
- package/dist/src/models/exception.js +28 -0
- package/dist/src/models/instanceRole.d.ts +7 -0
- package/dist/src/models/instanceRole.js +9 -0
- package/dist/src/models/instanceUser.d.ts +14 -0
- package/dist/src/models/instanceUser.js +9 -0
- package/dist/src/models/media.d.ts +30 -0
- package/dist/src/models/media.js +15 -0
- package/dist/src/models/model.d.ts +30 -0
- package/dist/src/models/model.js +15 -0
- package/dist/src/models/notification.d.ts +13 -0
- package/dist/src/models/notification.js +9 -0
- package/dist/src/models/options.d.ts +7 -0
- package/dist/src/models/options.js +9 -0
- package/dist/src/models/pageItem.d.ts +56 -0
- package/dist/src/models/pageItem.js +39 -0
- package/dist/src/models/sitemap.d.ts +20 -0
- package/dist/src/models/sitemap.js +15 -0
- package/dist/src/models/websiteUser.d.ts +22 -0
- package/dist/src/models/websiteUser.js +15 -0
- package/license.txt +20 -20
- package/package.json +39 -39
- package/tsconfig.json +14 -14
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Options } from "../models/options";
|
|
2
|
-
import { ClientInstance } from "./clientInstance";
|
|
3
|
-
import { Batch } from "../models/batch";
|
|
4
|
-
export declare class BatchMethods {
|
|
5
|
-
_options: Options;
|
|
6
|
-
_clientInstance: ClientInstance;
|
|
7
|
-
constructor(options: Options);
|
|
8
|
-
getBatch(batchID: number, guid: string): Promise<Batch>;
|
|
9
|
-
Retry(method: Function): Promise<Batch>;
|
|
10
|
-
delay(ms: number): Promise<unknown>;
|
|
11
|
-
}
|
|
1
|
+
import { Options } from "../models/options";
|
|
2
|
+
import { ClientInstance } from "./clientInstance";
|
|
3
|
+
import { Batch } from "../models/batch";
|
|
4
|
+
export declare class BatchMethods {
|
|
5
|
+
_options: Options;
|
|
6
|
+
_clientInstance: ClientInstance;
|
|
7
|
+
constructor(options: Options);
|
|
8
|
+
getBatch(batchID: number, guid: string): Promise<Batch>;
|
|
9
|
+
Retry(method: Function): Promise<Batch>;
|
|
10
|
+
delay(ms: number): Promise<unknown>;
|
|
11
|
+
}
|
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
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
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.BatchMethods = void 0;
|
|
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) {
|
|
45
|
-
this._options = options;
|
|
46
|
-
this._clientInstance = new clientInstance_1.ClientInstance(
|
|
47
|
-
}
|
|
48
|
-
BatchMethods.prototype.getBatch = function (batchID, guid) {
|
|
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/"
|
|
56
|
-
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
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: "
|
|
63
|
-
case 3: return [2 /*return*/];
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
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:
|
|
90
|
-
--retryCount;
|
|
91
|
-
if (--retryCount <= 0) {
|
|
92
|
-
throw new Error('Timeout exceeded but operation still in progress. Please check the Batches page in the Agility Content Manager app.');
|
|
93
|
-
}
|
|
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*/];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
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
|
-
});
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
return BatchMethods;
|
|
116
|
-
}());
|
|
117
|
-
exports.BatchMethods = BatchMethods;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
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
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.BatchMethods = void 0;
|
|
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) {
|
|
45
|
+
this._options = options;
|
|
46
|
+
this._clientInstance = new clientInstance_1.ClientInstance(this._options);
|
|
47
|
+
}
|
|
48
|
+
BatchMethods.prototype.getBatch = function (batchID, guid) {
|
|
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/".concat(batchID);
|
|
56
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
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: ".concat(batchID), err_1);
|
|
63
|
+
case 3: return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
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:
|
|
90
|
+
--retryCount;
|
|
91
|
+
if (--retryCount <= 0) {
|
|
92
|
+
throw new Error('Timeout exceeded but operation still in progress. Please check the Batches page in the Agility Content Manager app.');
|
|
93
|
+
}
|
|
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*/];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
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
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
return BatchMethods;
|
|
116
|
+
}());
|
|
117
|
+
exports.BatchMethods = BatchMethods;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { Options } from "../models/options";
|
|
3
|
-
export declare class ClientInstance {
|
|
4
|
-
_options: Options;
|
|
5
|
-
constructor(options: Options);
|
|
6
|
-
/**
|
|
7
|
-
* Figure out the Base Url, which can be overriden using options.baseUrl
|
|
8
|
-
*
|
|
9
|
-
* @param {string} guid
|
|
10
|
-
* @returns {string}
|
|
11
|
-
* @memberof ClientInstance
|
|
12
|
-
*/
|
|
13
|
-
determineBaseUrl(guid: string): string;
|
|
14
|
-
getInstance(guid: string): AxiosInstance;
|
|
15
|
-
executeGet(apiPath: string, guid: string, token: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
16
|
-
executeDelete(apiPath: string, guid: string, token: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
17
|
-
executePost(apiPath: string, guid: string, token: string, data: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
18
|
-
}
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { Options } from "../models/options";
|
|
3
|
+
export declare class ClientInstance {
|
|
4
|
+
_options: Options;
|
|
5
|
+
constructor(options: Options);
|
|
6
|
+
/**
|
|
7
|
+
* Figure out the Base Url, which can be overriden using options.baseUrl
|
|
8
|
+
*
|
|
9
|
+
* @param {string} guid
|
|
10
|
+
* @returns {string}
|
|
11
|
+
* @memberof ClientInstance
|
|
12
|
+
*/
|
|
13
|
+
determineBaseUrl(guid: string): string;
|
|
14
|
+
getInstance(guid: string): AxiosInstance;
|
|
15
|
+
executeGet(apiPath: string, guid: string, token: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
16
|
+
executeDelete(apiPath: string, guid: string, token: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
17
|
+
executePost(apiPath: string, guid: string, token: string, data: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
18
|
+
}
|
|
@@ -1,168 +1,168 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
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
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.ClientInstance = void 0;
|
|
43
|
-
var axios_1 = __importDefault(require("axios"));
|
|
44
|
-
var ClientInstance = /** @class */ (function () {
|
|
45
|
-
function ClientInstance(options) {
|
|
46
|
-
this._options = options;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Figure out the Base Url, which can be overriden using options.baseUrl
|
|
50
|
-
*
|
|
51
|
-
* @param {string} guid
|
|
52
|
-
* @returns {string}
|
|
53
|
-
* @memberof ClientInstance
|
|
54
|
-
*/
|
|
55
|
-
ClientInstance.prototype.determineBaseUrl = function (guid) {
|
|
56
|
-
//if we have a baseUrl overridden, use it
|
|
57
|
-
if (this._options.baseUrl)
|
|
58
|
-
return this._options.baseUrl;
|
|
59
|
-
var seperator = guid.split('-');
|
|
60
|
-
//determine the base url based on the GUID
|
|
61
|
-
if (seperator[1] === 'd') {
|
|
62
|
-
return "https://mgmt-dev.aglty.io";
|
|
63
|
-
}
|
|
64
|
-
else if (seperator[1] === 'u') {
|
|
65
|
-
return "https://mgmt.aglty.io";
|
|
66
|
-
}
|
|
67
|
-
else if (seperator[1] === 'c') {
|
|
68
|
-
return "https://mgmt-ca.aglty.io";
|
|
69
|
-
}
|
|
70
|
-
else if (seperator[1] === 'e') {
|
|
71
|
-
return "https://mgmt-eu.aglty.io";
|
|
72
|
-
}
|
|
73
|
-
else if (seperator[1] === 'a') {
|
|
74
|
-
return "https://mgmt-aus.aglty.io";
|
|
75
|
-
}
|
|
76
|
-
return "https://mgmt.aglty.io";
|
|
77
|
-
};
|
|
78
|
-
ClientInstance.prototype.getInstance = function (guid) {
|
|
79
|
-
var baseUrl = this.determineBaseUrl(guid);
|
|
80
|
-
var instance = axios_1.default.create({
|
|
81
|
-
baseURL: baseUrl
|
|
82
|
-
});
|
|
83
|
-
return instance;
|
|
84
|
-
};
|
|
85
|
-
ClientInstance.prototype.executeGet = function (apiPath, guid, token) {
|
|
86
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
var instance, resp, err_1;
|
|
88
|
-
return __generator(this, function (_a) {
|
|
89
|
-
switch (_a.label) {
|
|
90
|
-
case 0:
|
|
91
|
-
instance = this.getInstance(guid);
|
|
92
|
-
_a.label = 1;
|
|
93
|
-
case 1:
|
|
94
|
-
_a.trys.push([1, 3, , 4]);
|
|
95
|
-
return [4 /*yield*/, instance.get(apiPath, {
|
|
96
|
-
headers: {
|
|
97
|
-
'Authorization': "Bearer "
|
|
98
|
-
'Cache-Control': 'no-cache'
|
|
99
|
-
}
|
|
100
|
-
})];
|
|
101
|
-
case 2:
|
|
102
|
-
resp = _a.sent();
|
|
103
|
-
return [2 /*return*/, resp];
|
|
104
|
-
case 3:
|
|
105
|
-
err_1 = _a.sent();
|
|
106
|
-
throw err_1;
|
|
107
|
-
case 4: return [2 /*return*/];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
ClientInstance.prototype.executeDelete = function (apiPath, guid, token) {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
-
var instance, resp, err_2;
|
|
115
|
-
return __generator(this, function (_a) {
|
|
116
|
-
switch (_a.label) {
|
|
117
|
-
case 0:
|
|
118
|
-
instance = this.getInstance(guid);
|
|
119
|
-
_a.label = 1;
|
|
120
|
-
case 1:
|
|
121
|
-
_a.trys.push([1, 3, , 4]);
|
|
122
|
-
return [4 /*yield*/, instance.delete(apiPath, {
|
|
123
|
-
headers: {
|
|
124
|
-
'Authorization': "Bearer "
|
|
125
|
-
'Cache-Control': 'no-cache'
|
|
126
|
-
}
|
|
127
|
-
})];
|
|
128
|
-
case 2:
|
|
129
|
-
resp = _a.sent();
|
|
130
|
-
return [2 /*return*/, resp];
|
|
131
|
-
case 3:
|
|
132
|
-
err_2 = _a.sent();
|
|
133
|
-
throw err_2;
|
|
134
|
-
case 4: return [2 /*return*/];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
ClientInstance.prototype.executePost = function (apiPath, guid, token, data) {
|
|
140
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
-
var instance, resp, err_3;
|
|
142
|
-
return __generator(this, function (_a) {
|
|
143
|
-
switch (_a.label) {
|
|
144
|
-
case 0:
|
|
145
|
-
instance = this.getInstance(guid);
|
|
146
|
-
_a.label = 1;
|
|
147
|
-
case 1:
|
|
148
|
-
_a.trys.push([1, 3, , 4]);
|
|
149
|
-
return [4 /*yield*/, instance.post(apiPath, data, {
|
|
150
|
-
headers: {
|
|
151
|
-
'Authorization': "Bearer "
|
|
152
|
-
'Cache-Control': 'no-cache'
|
|
153
|
-
}
|
|
154
|
-
})];
|
|
155
|
-
case 2:
|
|
156
|
-
resp = _a.sent();
|
|
157
|
-
return [2 /*return*/, resp];
|
|
158
|
-
case 3:
|
|
159
|
-
err_3 = _a.sent();
|
|
160
|
-
throw err_3;
|
|
161
|
-
case 4: return [2 /*return*/];
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
return ClientInstance;
|
|
167
|
-
}());
|
|
168
|
-
exports.ClientInstance = ClientInstance;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
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
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.ClientInstance = void 0;
|
|
43
|
+
var axios_1 = __importDefault(require("axios"));
|
|
44
|
+
var ClientInstance = /** @class */ (function () {
|
|
45
|
+
function ClientInstance(options) {
|
|
46
|
+
this._options = options;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Figure out the Base Url, which can be overriden using options.baseUrl
|
|
50
|
+
*
|
|
51
|
+
* @param {string} guid
|
|
52
|
+
* @returns {string}
|
|
53
|
+
* @memberof ClientInstance
|
|
54
|
+
*/
|
|
55
|
+
ClientInstance.prototype.determineBaseUrl = function (guid) {
|
|
56
|
+
//if we have a baseUrl overridden, use it
|
|
57
|
+
if (this._options.baseUrl)
|
|
58
|
+
return this._options.baseUrl;
|
|
59
|
+
var seperator = guid.split('-');
|
|
60
|
+
//determine the base url based on the GUID
|
|
61
|
+
if (seperator[1] === 'd') {
|
|
62
|
+
return "https://mgmt-dev.aglty.io";
|
|
63
|
+
}
|
|
64
|
+
else if (seperator[1] === 'u') {
|
|
65
|
+
return "https://mgmt.aglty.io";
|
|
66
|
+
}
|
|
67
|
+
else if (seperator[1] === 'c') {
|
|
68
|
+
return "https://mgmt-ca.aglty.io";
|
|
69
|
+
}
|
|
70
|
+
else if (seperator[1] === 'e') {
|
|
71
|
+
return "https://mgmt-eu.aglty.io";
|
|
72
|
+
}
|
|
73
|
+
else if (seperator[1] === 'a') {
|
|
74
|
+
return "https://mgmt-aus.aglty.io";
|
|
75
|
+
}
|
|
76
|
+
return "https://mgmt.aglty.io";
|
|
77
|
+
};
|
|
78
|
+
ClientInstance.prototype.getInstance = function (guid) {
|
|
79
|
+
var baseUrl = this.determineBaseUrl(guid);
|
|
80
|
+
var instance = axios_1.default.create({
|
|
81
|
+
baseURL: "".concat(baseUrl, "/api/v1/instance/").concat(guid)
|
|
82
|
+
});
|
|
83
|
+
return instance;
|
|
84
|
+
};
|
|
85
|
+
ClientInstance.prototype.executeGet = function (apiPath, guid, token) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
var instance, resp, err_1;
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
switch (_a.label) {
|
|
90
|
+
case 0:
|
|
91
|
+
instance = this.getInstance(guid);
|
|
92
|
+
_a.label = 1;
|
|
93
|
+
case 1:
|
|
94
|
+
_a.trys.push([1, 3, , 4]);
|
|
95
|
+
return [4 /*yield*/, instance.get(apiPath, {
|
|
96
|
+
headers: {
|
|
97
|
+
'Authorization': "Bearer ".concat(token),
|
|
98
|
+
'Cache-Control': 'no-cache'
|
|
99
|
+
}
|
|
100
|
+
})];
|
|
101
|
+
case 2:
|
|
102
|
+
resp = _a.sent();
|
|
103
|
+
return [2 /*return*/, resp];
|
|
104
|
+
case 3:
|
|
105
|
+
err_1 = _a.sent();
|
|
106
|
+
throw err_1;
|
|
107
|
+
case 4: return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
ClientInstance.prototype.executeDelete = function (apiPath, guid, token) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
var instance, resp, err_2;
|
|
115
|
+
return __generator(this, function (_a) {
|
|
116
|
+
switch (_a.label) {
|
|
117
|
+
case 0:
|
|
118
|
+
instance = this.getInstance(guid);
|
|
119
|
+
_a.label = 1;
|
|
120
|
+
case 1:
|
|
121
|
+
_a.trys.push([1, 3, , 4]);
|
|
122
|
+
return [4 /*yield*/, instance.delete(apiPath, {
|
|
123
|
+
headers: {
|
|
124
|
+
'Authorization': "Bearer ".concat(token),
|
|
125
|
+
'Cache-Control': 'no-cache'
|
|
126
|
+
}
|
|
127
|
+
})];
|
|
128
|
+
case 2:
|
|
129
|
+
resp = _a.sent();
|
|
130
|
+
return [2 /*return*/, resp];
|
|
131
|
+
case 3:
|
|
132
|
+
err_2 = _a.sent();
|
|
133
|
+
throw err_2;
|
|
134
|
+
case 4: return [2 /*return*/];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
ClientInstance.prototype.executePost = function (apiPath, guid, token, data) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
+
var instance, resp, err_3;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
instance = this.getInstance(guid);
|
|
146
|
+
_a.label = 1;
|
|
147
|
+
case 1:
|
|
148
|
+
_a.trys.push([1, 3, , 4]);
|
|
149
|
+
return [4 /*yield*/, instance.post(apiPath, data, {
|
|
150
|
+
headers: {
|
|
151
|
+
'Authorization': "Bearer ".concat(token),
|
|
152
|
+
'Cache-Control': 'no-cache'
|
|
153
|
+
}
|
|
154
|
+
})];
|
|
155
|
+
case 2:
|
|
156
|
+
resp = _a.sent();
|
|
157
|
+
return [2 /*return*/, resp];
|
|
158
|
+
case 3:
|
|
159
|
+
err_3 = _a.sent();
|
|
160
|
+
throw err_3;
|
|
161
|
+
case 4: return [2 /*return*/];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
return ClientInstance;
|
|
167
|
+
}());
|
|
168
|
+
exports.ClientInstance = ClientInstance;
|