bruce-models 1.4.9 → 1.5.1
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/bruce-models.es5.js +44 -24
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +44 -24
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/abstract-api.js +16 -3
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/api/bruce-api.js +13 -9
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/api/cam-api.js +5 -4
- package/dist/lib/api/cam-api.js.map +1 -1
- package/dist/lib/api/global-api.js +5 -4
- package/dist/lib/api/global-api.js.map +1 -1
- package/dist/lib/api/idm-api.js +5 -4
- package/dist/lib/api/idm-api.js.map +1 -1
- package/dist/types/api/abstract-api.d.ts +6 -1
- package/dist/types/api/bruce-api.d.ts +8 -5
- package/dist/types/api/cam-api.d.ts +3 -2
- package/dist/types/api/global-api.d.ts +3 -2
- package/dist/types/api/idm-api.d.ts +3 -2
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -470,11 +470,14 @@
|
|
|
470
470
|
encoding = charset.split("=")[1];
|
|
471
471
|
encoding = encoding.toLowerCase();
|
|
472
472
|
}
|
|
473
|
+
if (!encoding) {
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
473
476
|
// Our API has a very specific utf-16 encoding.
|
|
474
477
|
if (encoding == "utf-16") {
|
|
475
478
|
encoding = exports.Api.EEncoding.UTF16;
|
|
476
479
|
}
|
|
477
|
-
if (
|
|
480
|
+
if (encoding == "utf-8") {
|
|
478
481
|
return data.json();
|
|
479
482
|
}
|
|
480
483
|
else {
|
|
@@ -492,10 +495,20 @@
|
|
|
492
495
|
* This is a base class for communication with an arbitrary Bruce Api.
|
|
493
496
|
*/
|
|
494
497
|
class AbstractApi {
|
|
495
|
-
constructor(
|
|
498
|
+
constructor(params) {
|
|
496
499
|
this.ssid = "";
|
|
500
|
+
this.baseUrl = "";
|
|
497
501
|
this.Cache = new CacheControl();
|
|
498
|
-
this.ssidHeader = ssidHeader;
|
|
502
|
+
this.ssidHeader = params === null || params === void 0 ? void 0 : params.ssidHeader;
|
|
503
|
+
}
|
|
504
|
+
GetBaseUrl() {
|
|
505
|
+
return this.baseUrl;
|
|
506
|
+
}
|
|
507
|
+
SetBaseUrl(url) {
|
|
508
|
+
this.baseUrl = url;
|
|
509
|
+
if (!this.baseUrl.endsWith("/")) {
|
|
510
|
+
this.baseUrl += "/";
|
|
511
|
+
}
|
|
499
512
|
}
|
|
500
513
|
GetCacheItem(key, reqParams) {
|
|
501
514
|
let noCache = reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache;
|
|
@@ -962,17 +975,17 @@
|
|
|
962
975
|
*/
|
|
963
976
|
class Api$$1 extends AbstractApi {
|
|
964
977
|
/**
|
|
965
|
-
* @param
|
|
966
|
-
* @param env (Optional) environment to use, this will default to PROD.
|
|
967
|
-
* @param cam (Optional) cam instance to use for loading the regional base url.
|
|
978
|
+
* @param params
|
|
968
979
|
*/
|
|
969
|
-
constructor(
|
|
970
|
-
super(
|
|
971
|
-
|
|
980
|
+
constructor(params) {
|
|
981
|
+
super({
|
|
982
|
+
ssidHeader: "x-sessionid"
|
|
983
|
+
});
|
|
972
984
|
this.loadCancelled = false;
|
|
985
|
+
const { accountId, env, cam, loadRegionalBaseUrl } = params;
|
|
973
986
|
this.accountId = accountId;
|
|
974
987
|
this.env = env !== null && env !== void 0 ? env : exports.Api.EEnv.PROD;
|
|
975
|
-
this.loadProm = this.init(cam);
|
|
988
|
+
this.loadProm = this.init(cam, loadRegionalBaseUrl);
|
|
976
989
|
}
|
|
977
990
|
get MessageBroker() {
|
|
978
991
|
return this.messageBroker;
|
|
@@ -985,11 +998,15 @@
|
|
|
985
998
|
/**
|
|
986
999
|
* Loads regional base url and sets up message broker.
|
|
987
1000
|
* @param cam Required for loading regional base url.
|
|
1001
|
+
* @param loadRegionalUrl
|
|
988
1002
|
* @returns
|
|
989
1003
|
*/
|
|
990
|
-
init(cam) {
|
|
1004
|
+
init(cam, loadRegionalUrl) {
|
|
991
1005
|
var _a;
|
|
992
1006
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1007
|
+
if (!this.accountId) {
|
|
1008
|
+
throw ("accountId is required.");
|
|
1009
|
+
}
|
|
993
1010
|
// Set using a stable default.
|
|
994
1011
|
const prefix = `https://${this.accountId}.api.nextspace`;
|
|
995
1012
|
let url;
|
|
@@ -1011,7 +1028,7 @@
|
|
|
1011
1028
|
throw ("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1012
1029
|
}
|
|
1013
1030
|
this.baseUrl = url;
|
|
1014
|
-
if (cam) {
|
|
1031
|
+
if (cam && loadRegionalUrl) {
|
|
1015
1032
|
// Attempt to load an account specific base url.
|
|
1016
1033
|
// This could be one with a region specific endpoint.
|
|
1017
1034
|
try {
|
|
@@ -1118,10 +1135,11 @@
|
|
|
1118
1135
|
|
|
1119
1136
|
(function (CamApi) {
|
|
1120
1137
|
class Api$$1 extends AbstractApi {
|
|
1121
|
-
constructor(
|
|
1122
|
-
super(
|
|
1123
|
-
|
|
1124
|
-
|
|
1138
|
+
constructor(params) {
|
|
1139
|
+
super({
|
|
1140
|
+
ssidHeader: "SSID"
|
|
1141
|
+
});
|
|
1142
|
+
this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
|
|
1125
1143
|
this.setBaseUrl();
|
|
1126
1144
|
}
|
|
1127
1145
|
setBaseUrl() {
|
|
@@ -1185,10 +1203,11 @@
|
|
|
1185
1203
|
* it should be passed to any method that wants to communicate with this particular api.
|
|
1186
1204
|
*/
|
|
1187
1205
|
class Api$$1 extends AbstractApi {
|
|
1188
|
-
constructor(
|
|
1189
|
-
super(
|
|
1190
|
-
|
|
1191
|
-
|
|
1206
|
+
constructor(params) {
|
|
1207
|
+
super({
|
|
1208
|
+
ssidHeader: "SSID"
|
|
1209
|
+
});
|
|
1210
|
+
this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
|
|
1192
1211
|
this.setBaseUrl();
|
|
1193
1212
|
}
|
|
1194
1213
|
setBaseUrl() {
|
|
@@ -1252,10 +1271,11 @@
|
|
|
1252
1271
|
* it should be passed to any method that wants to communicate with this particular api.
|
|
1253
1272
|
*/
|
|
1254
1273
|
class Api$$1 extends AbstractApi {
|
|
1255
|
-
constructor(
|
|
1256
|
-
super(
|
|
1257
|
-
|
|
1258
|
-
|
|
1274
|
+
constructor(params) {
|
|
1275
|
+
super({
|
|
1276
|
+
ssidHeader: "x-sessionid"
|
|
1277
|
+
});
|
|
1278
|
+
this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
|
|
1259
1279
|
this.setBaseUrl();
|
|
1260
1280
|
}
|
|
1261
1281
|
setBaseUrl() {
|