bruce-models 0.3.2 → 0.3.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/bruce-models.es5.js +224 -173
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +209 -159
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +9 -9
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -0
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/data-lab/data-lab.js +91 -0
- package/dist/lib/data-lab/data-lab.js.map +1 -0
- package/dist/types/account/account.d.ts +3 -1
- package/dist/types/bruce-models.d.ts +1 -0
- package/dist/types/data-lab/data-lab.d.ts +20 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -5326,165 +5326,6 @@
|
|
|
5326
5326
|
})(AccessToken = User.AccessToken || (User.AccessToken = {}));
|
|
5327
5327
|
})(exports.User || (exports.User = {}));
|
|
5328
5328
|
|
|
5329
|
-
(function (EncryptUtils) {
|
|
5330
|
-
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
5331
|
-
function Cyrb53Hash(str, seed) {
|
|
5332
|
-
if (seed === void 0) { seed = 0; }
|
|
5333
|
-
var h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
5334
|
-
for (var i = 0, ch = void 0; i < str.length; i++) {
|
|
5335
|
-
ch = str.charCodeAt(i);
|
|
5336
|
-
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
5337
|
-
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
5338
|
-
}
|
|
5339
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
5340
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
5341
|
-
return (4294967296 * (2097151 & h2) + (h1 >>> 0));
|
|
5342
|
-
}
|
|
5343
|
-
EncryptUtils.Cyrb53Hash = Cyrb53Hash;
|
|
5344
|
-
})(exports.EncryptUtils || (exports.EncryptUtils = {}));
|
|
5345
|
-
|
|
5346
|
-
(function (MathUtils) {
|
|
5347
|
-
/**
|
|
5348
|
-
* Rounds a number to a given number of decimal places.
|
|
5349
|
-
* @param num
|
|
5350
|
-
* @param decimals
|
|
5351
|
-
* @returns
|
|
5352
|
-
*/
|
|
5353
|
-
function Round(num, decimals) {
|
|
5354
|
-
if (decimals === void 0) { decimals = 0; }
|
|
5355
|
-
if (decimals <= 0) {
|
|
5356
|
-
return Math.round(num);
|
|
5357
|
-
}
|
|
5358
|
-
var tmp = "1";
|
|
5359
|
-
for (var i = 0; i < decimals; i++) {
|
|
5360
|
-
tmp += "0";
|
|
5361
|
-
}
|
|
5362
|
-
var d = parseFloat(tmp);
|
|
5363
|
-
return Math.round((num + Number.EPSILON) * d) / d;
|
|
5364
|
-
}
|
|
5365
|
-
MathUtils.Round = Round;
|
|
5366
|
-
/**
|
|
5367
|
-
* Returns a random integer between min (inclusive) and max (inclusive).
|
|
5368
|
-
* @param min
|
|
5369
|
-
* @param max
|
|
5370
|
-
* @returns
|
|
5371
|
-
*/
|
|
5372
|
-
function RandInt(min, max) {
|
|
5373
|
-
if (min == max) {
|
|
5374
|
-
return min;
|
|
5375
|
-
}
|
|
5376
|
-
else if (min > max) {
|
|
5377
|
-
throw ("Min is greater than max.");
|
|
5378
|
-
}
|
|
5379
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
5380
|
-
}
|
|
5381
|
-
MathUtils.RandInt = RandInt;
|
|
5382
|
-
})(exports.MathUtils || (exports.MathUtils = {}));
|
|
5383
|
-
|
|
5384
|
-
/**
|
|
5385
|
-
* Utility to help with url manipulation.
|
|
5386
|
-
*/
|
|
5387
|
-
(function (UrlUtils) {
|
|
5388
|
-
function GetQueryString(doc) {
|
|
5389
|
-
var qs = {};
|
|
5390
|
-
var p0 = doc.location.href.indexOf("?");
|
|
5391
|
-
if (p0 >= 0) {
|
|
5392
|
-
var str = doc.location.href.substring(p0 + 1);
|
|
5393
|
-
var tokens = str.split("&");
|
|
5394
|
-
tokens.forEach(function (token) {
|
|
5395
|
-
var p = token.split("=");
|
|
5396
|
-
if (p.length == 2) {
|
|
5397
|
-
qs[p[0]] = p[1];
|
|
5398
|
-
}
|
|
5399
|
-
});
|
|
5400
|
-
}
|
|
5401
|
-
return qs;
|
|
5402
|
-
}
|
|
5403
|
-
UrlUtils.GetQueryString = GetQueryString;
|
|
5404
|
-
/**
|
|
5405
|
-
* Helper to get and set url params for a given window.
|
|
5406
|
-
*/
|
|
5407
|
-
var Handler = /** @class */ (function () {
|
|
5408
|
-
function Handler(window, allowedKeys) {
|
|
5409
|
-
this._allowedKeys = null;
|
|
5410
|
-
this._window = window;
|
|
5411
|
-
this._allowedKeys = allowedKeys;
|
|
5412
|
-
}
|
|
5413
|
-
Object.defineProperty(Handler.prototype, "window", {
|
|
5414
|
-
get: function () {
|
|
5415
|
-
return this._window;
|
|
5416
|
-
},
|
|
5417
|
-
enumerable: false,
|
|
5418
|
-
configurable: true
|
|
5419
|
-
});
|
|
5420
|
-
Object.defineProperty(Handler.prototype, "document", {
|
|
5421
|
-
get: function () {
|
|
5422
|
-
var _a;
|
|
5423
|
-
return (_a = this.window) === null || _a === void 0 ? void 0 : _a.document;
|
|
5424
|
-
},
|
|
5425
|
-
enumerable: false,
|
|
5426
|
-
configurable: true
|
|
5427
|
-
});
|
|
5428
|
-
Object.defineProperty(Handler.prototype, "allowedKeys", {
|
|
5429
|
-
get: function () {
|
|
5430
|
-
return this._allowedKeys;
|
|
5431
|
-
},
|
|
5432
|
-
enumerable: false,
|
|
5433
|
-
configurable: true
|
|
5434
|
-
});
|
|
5435
|
-
Handler.prototype.UpdateAllowedKeys = function (allowedKeys) {
|
|
5436
|
-
this._allowedKeys = allowedKeys;
|
|
5437
|
-
var params = this.GetParams();
|
|
5438
|
-
this.refresh(params);
|
|
5439
|
-
};
|
|
5440
|
-
Handler.prototype.UpdateParam = function (key, value) {
|
|
5441
|
-
var params = this.GetParams();
|
|
5442
|
-
params[key + ""] = value + "";
|
|
5443
|
-
this.refresh(params);
|
|
5444
|
-
};
|
|
5445
|
-
Handler.prototype.RemoveParam = function (key) {
|
|
5446
|
-
var params = this.GetParams();
|
|
5447
|
-
params[key + ""] = null;
|
|
5448
|
-
this.refresh(params);
|
|
5449
|
-
};
|
|
5450
|
-
Handler.prototype.GetParamKeys = function () {
|
|
5451
|
-
var params = GetQueryString(this.document);
|
|
5452
|
-
return Object.keys(params);
|
|
5453
|
-
};
|
|
5454
|
-
Handler.prototype.GetParams = function () {
|
|
5455
|
-
return GetQueryString(this.document);
|
|
5456
|
-
};
|
|
5457
|
-
Handler.prototype.GetParam = function (key) {
|
|
5458
|
-
var params = this.GetParams();
|
|
5459
|
-
return params[key + ""];
|
|
5460
|
-
};
|
|
5461
|
-
Handler.prototype.Clear = function () {
|
|
5462
|
-
this.refresh({});
|
|
5463
|
-
};
|
|
5464
|
-
Handler.prototype.refresh = function (data) {
|
|
5465
|
-
var params = [];
|
|
5466
|
-
var keys = Object.keys(data);
|
|
5467
|
-
for (var i = 0; i < keys.length; i++) {
|
|
5468
|
-
var key = keys[i];
|
|
5469
|
-
if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
|
|
5470
|
-
var val = data[key];
|
|
5471
|
-
if (!!val || val == 0) {
|
|
5472
|
-
params.push(key + "=" + val);
|
|
5473
|
-
}
|
|
5474
|
-
}
|
|
5475
|
-
}
|
|
5476
|
-
if (params.length > 0) {
|
|
5477
|
-
this.window.history.replaceState({}, null, "?" + params.join("&"));
|
|
5478
|
-
}
|
|
5479
|
-
else {
|
|
5480
|
-
this.window.history.replaceState({}, null, "");
|
|
5481
|
-
}
|
|
5482
|
-
};
|
|
5483
|
-
return Handler;
|
|
5484
|
-
}());
|
|
5485
|
-
UrlUtils.Handler = Handler;
|
|
5486
|
-
})(exports.UrlUtils || (exports.UrlUtils = {}));
|
|
5487
|
-
|
|
5488
5329
|
var ACCOUNT_EXCLUSIONS = ["hyperportal", "hypeportal", "bviewer"];
|
|
5489
5330
|
(function (Account) {
|
|
5490
5331
|
function GetCacheKey(accountId, appSettingsId) {
|
|
@@ -5671,6 +5512,215 @@
|
|
|
5671
5512
|
Account.Create = Create;
|
|
5672
5513
|
})(exports.Account || (exports.Account = {}));
|
|
5673
5514
|
|
|
5515
|
+
(function (EncryptUtils) {
|
|
5516
|
+
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
5517
|
+
function Cyrb53Hash(str, seed) {
|
|
5518
|
+
if (seed === void 0) { seed = 0; }
|
|
5519
|
+
var h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
5520
|
+
for (var i = 0, ch = void 0; i < str.length; i++) {
|
|
5521
|
+
ch = str.charCodeAt(i);
|
|
5522
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
5523
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
5524
|
+
}
|
|
5525
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
5526
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
5527
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0));
|
|
5528
|
+
}
|
|
5529
|
+
EncryptUtils.Cyrb53Hash = Cyrb53Hash;
|
|
5530
|
+
})(exports.EncryptUtils || (exports.EncryptUtils = {}));
|
|
5531
|
+
|
|
5532
|
+
(function (MathUtils) {
|
|
5533
|
+
/**
|
|
5534
|
+
* Rounds a number to a given number of decimal places.
|
|
5535
|
+
* @param num
|
|
5536
|
+
* @param decimals
|
|
5537
|
+
* @returns
|
|
5538
|
+
*/
|
|
5539
|
+
function Round(num, decimals) {
|
|
5540
|
+
if (decimals === void 0) { decimals = 0; }
|
|
5541
|
+
if (decimals <= 0) {
|
|
5542
|
+
return Math.round(num);
|
|
5543
|
+
}
|
|
5544
|
+
var tmp = "1";
|
|
5545
|
+
for (var i = 0; i < decimals; i++) {
|
|
5546
|
+
tmp += "0";
|
|
5547
|
+
}
|
|
5548
|
+
var d = parseFloat(tmp);
|
|
5549
|
+
return Math.round((num + Number.EPSILON) * d) / d;
|
|
5550
|
+
}
|
|
5551
|
+
MathUtils.Round = Round;
|
|
5552
|
+
/**
|
|
5553
|
+
* Returns a random integer between min (inclusive) and max (inclusive).
|
|
5554
|
+
* @param min
|
|
5555
|
+
* @param max
|
|
5556
|
+
* @returns
|
|
5557
|
+
*/
|
|
5558
|
+
function RandInt(min, max) {
|
|
5559
|
+
if (min == max) {
|
|
5560
|
+
return min;
|
|
5561
|
+
}
|
|
5562
|
+
else if (min > max) {
|
|
5563
|
+
throw ("Min is greater than max.");
|
|
5564
|
+
}
|
|
5565
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
5566
|
+
}
|
|
5567
|
+
MathUtils.RandInt = RandInt;
|
|
5568
|
+
})(exports.MathUtils || (exports.MathUtils = {}));
|
|
5569
|
+
|
|
5570
|
+
/**
|
|
5571
|
+
* Utility to help with url manipulation.
|
|
5572
|
+
*/
|
|
5573
|
+
(function (UrlUtils) {
|
|
5574
|
+
function GetQueryString(doc) {
|
|
5575
|
+
var qs = {};
|
|
5576
|
+
var p0 = doc.location.href.indexOf("?");
|
|
5577
|
+
if (p0 >= 0) {
|
|
5578
|
+
var str = doc.location.href.substring(p0 + 1);
|
|
5579
|
+
var tokens = str.split("&");
|
|
5580
|
+
tokens.forEach(function (token) {
|
|
5581
|
+
var p = token.split("=");
|
|
5582
|
+
if (p.length == 2) {
|
|
5583
|
+
qs[p[0]] = p[1];
|
|
5584
|
+
}
|
|
5585
|
+
});
|
|
5586
|
+
}
|
|
5587
|
+
return qs;
|
|
5588
|
+
}
|
|
5589
|
+
UrlUtils.GetQueryString = GetQueryString;
|
|
5590
|
+
/**
|
|
5591
|
+
* Helper to get and set url params for a given window.
|
|
5592
|
+
*/
|
|
5593
|
+
var Handler = /** @class */ (function () {
|
|
5594
|
+
function Handler(window, allowedKeys) {
|
|
5595
|
+
this._allowedKeys = null;
|
|
5596
|
+
this._window = window;
|
|
5597
|
+
this._allowedKeys = allowedKeys;
|
|
5598
|
+
}
|
|
5599
|
+
Object.defineProperty(Handler.prototype, "window", {
|
|
5600
|
+
get: function () {
|
|
5601
|
+
return this._window;
|
|
5602
|
+
},
|
|
5603
|
+
enumerable: false,
|
|
5604
|
+
configurable: true
|
|
5605
|
+
});
|
|
5606
|
+
Object.defineProperty(Handler.prototype, "document", {
|
|
5607
|
+
get: function () {
|
|
5608
|
+
var _a;
|
|
5609
|
+
return (_a = this.window) === null || _a === void 0 ? void 0 : _a.document;
|
|
5610
|
+
},
|
|
5611
|
+
enumerable: false,
|
|
5612
|
+
configurable: true
|
|
5613
|
+
});
|
|
5614
|
+
Object.defineProperty(Handler.prototype, "allowedKeys", {
|
|
5615
|
+
get: function () {
|
|
5616
|
+
return this._allowedKeys;
|
|
5617
|
+
},
|
|
5618
|
+
enumerable: false,
|
|
5619
|
+
configurable: true
|
|
5620
|
+
});
|
|
5621
|
+
Handler.prototype.UpdateAllowedKeys = function (allowedKeys) {
|
|
5622
|
+
this._allowedKeys = allowedKeys;
|
|
5623
|
+
var params = this.GetParams();
|
|
5624
|
+
this.refresh(params);
|
|
5625
|
+
};
|
|
5626
|
+
Handler.prototype.UpdateParam = function (key, value) {
|
|
5627
|
+
var params = this.GetParams();
|
|
5628
|
+
params[key + ""] = value + "";
|
|
5629
|
+
this.refresh(params);
|
|
5630
|
+
};
|
|
5631
|
+
Handler.prototype.RemoveParam = function (key) {
|
|
5632
|
+
var params = this.GetParams();
|
|
5633
|
+
params[key + ""] = null;
|
|
5634
|
+
this.refresh(params);
|
|
5635
|
+
};
|
|
5636
|
+
Handler.prototype.GetParamKeys = function () {
|
|
5637
|
+
var params = GetQueryString(this.document);
|
|
5638
|
+
return Object.keys(params);
|
|
5639
|
+
};
|
|
5640
|
+
Handler.prototype.GetParams = function () {
|
|
5641
|
+
return GetQueryString(this.document);
|
|
5642
|
+
};
|
|
5643
|
+
Handler.prototype.GetParam = function (key) {
|
|
5644
|
+
var params = this.GetParams();
|
|
5645
|
+
return params[key + ""];
|
|
5646
|
+
};
|
|
5647
|
+
Handler.prototype.Clear = function () {
|
|
5648
|
+
this.refresh({});
|
|
5649
|
+
};
|
|
5650
|
+
Handler.prototype.refresh = function (data) {
|
|
5651
|
+
var params = [];
|
|
5652
|
+
var keys = Object.keys(data);
|
|
5653
|
+
for (var i = 0; i < keys.length; i++) {
|
|
5654
|
+
var key = keys[i];
|
|
5655
|
+
if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
|
|
5656
|
+
var val = data[key];
|
|
5657
|
+
if (!!val || val == 0) {
|
|
5658
|
+
params.push(key + "=" + val);
|
|
5659
|
+
}
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
if (params.length > 0) {
|
|
5663
|
+
this.window.history.replaceState({}, null, "?" + params.join("&"));
|
|
5664
|
+
}
|
|
5665
|
+
else {
|
|
5666
|
+
this.window.history.replaceState({}, null, "");
|
|
5667
|
+
}
|
|
5668
|
+
};
|
|
5669
|
+
return Handler;
|
|
5670
|
+
}());
|
|
5671
|
+
UrlUtils.Handler = Handler;
|
|
5672
|
+
})(exports.UrlUtils || (exports.UrlUtils = {}));
|
|
5673
|
+
|
|
5674
|
+
(function (DataLab) {
|
|
5675
|
+
var EReqKey;
|
|
5676
|
+
(function (EReqKey) {
|
|
5677
|
+
EReqKey["Primary"] = "PrimarySelection";
|
|
5678
|
+
EReqKey["Secondary"] = "SecondarySelection";
|
|
5679
|
+
})(EReqKey = DataLab.EReqKey || (DataLab.EReqKey = {}));
|
|
5680
|
+
var Entity;
|
|
5681
|
+
(function (Entity) {
|
|
5682
|
+
function GetList(api, query, key, skip, load) {
|
|
5683
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5684
|
+
var req, prom;
|
|
5685
|
+
var _this = this;
|
|
5686
|
+
return __generator(this, function (_a) {
|
|
5687
|
+
if (!key) {
|
|
5688
|
+
key = EReqKey.Primary;
|
|
5689
|
+
}
|
|
5690
|
+
if (!skip) {
|
|
5691
|
+
skip = 0;
|
|
5692
|
+
}
|
|
5693
|
+
if (!load) {
|
|
5694
|
+
load = 50;
|
|
5695
|
+
}
|
|
5696
|
+
req = api.POST("entities/datalab/getMatchingEntities/" + key + "?skip=" + skip + "&load=" + load, query, exports.Api.PrepReqParams());
|
|
5697
|
+
prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
5698
|
+
var data, e_1;
|
|
5699
|
+
return __generator(this, function (_a) {
|
|
5700
|
+
switch (_a.label) {
|
|
5701
|
+
case 0:
|
|
5702
|
+
_a.trys.push([0, 2, , 3]);
|
|
5703
|
+
return [4 /*yield*/, req];
|
|
5704
|
+
case 1:
|
|
5705
|
+
data = _a.sent();
|
|
5706
|
+
res(data.Items);
|
|
5707
|
+
return [3 /*break*/, 3];
|
|
5708
|
+
case 2:
|
|
5709
|
+
e_1 = _a.sent();
|
|
5710
|
+
rej(e_1);
|
|
5711
|
+
return [3 /*break*/, 3];
|
|
5712
|
+
case 3: return [2 /*return*/];
|
|
5713
|
+
}
|
|
5714
|
+
});
|
|
5715
|
+
}); });
|
|
5716
|
+
return [2 /*return*/, prom];
|
|
5717
|
+
});
|
|
5718
|
+
});
|
|
5719
|
+
}
|
|
5720
|
+
Entity.GetList = GetList;
|
|
5721
|
+
})(Entity = DataLab.Entity || (DataLab.Entity = {}));
|
|
5722
|
+
})(exports.DataLab || (exports.DataLab = {}));
|
|
5723
|
+
|
|
5674
5724
|
exports.AbstractApi = AbstractApi;
|
|
5675
5725
|
exports.BruceApi = BruceApi;
|
|
5676
5726
|
exports.CamApi = CamApi;
|