bruce-models 2.7.6 → 2.7.8
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 +62 -3
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +62 -3
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/api.js +1 -0
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/tileset/tileset.js +60 -2
- package/dist/lib/tileset/tileset.js.map +1 -1
- package/dist/types/api/api.d.ts +1 -0
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/tileset/tileset.d.ts +12 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -54,6 +54,7 @@ var Api;
|
|
|
54
54
|
ECacheKey["LodCategory"] = "lodcategory";
|
|
55
55
|
ECacheKey["Style"] = "style";
|
|
56
56
|
ECacheKey["PublishTileset"] = "publishtileset";
|
|
57
|
+
ECacheKey["TilesetAccess"] = "tilesetaccess";
|
|
57
58
|
ECacheKey["User"] = "user";
|
|
58
59
|
ECacheKey["UserSettings"] = "usersettings";
|
|
59
60
|
ECacheKey["UserEmail"] = "useremail";
|
|
@@ -9265,6 +9266,10 @@ var Tileset;
|
|
|
9265
9266
|
return Api.ECacheKey.PublishTileset + Api.ECacheKey.Id + accountId + Api.ECacheKey.Id + tilesetId;
|
|
9266
9267
|
}
|
|
9267
9268
|
Publish.GetCacheKey = GetCacheKey;
|
|
9269
|
+
function GetAccessAllowedCacheKey(tilesetId, sourceAccountId, forAccountId) {
|
|
9270
|
+
return Api.ECacheKey.PublishTileset + Api.ECacheKey.TilesetAccess + Api.ECacheKey.Id + tilesetId + Api.ECacheKey.Id + sourceAccountId + Api.ECacheKey.Id + forAccountId;
|
|
9271
|
+
}
|
|
9272
|
+
Publish.GetAccessAllowedCacheKey = GetAccessAllowedCacheKey;
|
|
9268
9273
|
function Update(params) {
|
|
9269
9274
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9270
9275
|
let { api, published: data, req: reqParams } = params;
|
|
@@ -9283,8 +9288,9 @@ var Tileset;
|
|
|
9283
9288
|
};
|
|
9284
9289
|
data.ID = res.ID;
|
|
9285
9290
|
yield api.POST(`tileset/${data.ID}/enableForAccounts`, req, reqParams);
|
|
9286
|
-
api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"], data["Tileset.ID"]));
|
|
9287
|
-
api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"]));
|
|
9291
|
+
yield api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"], data["Tileset.ID"]));
|
|
9292
|
+
yield api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"]));
|
|
9293
|
+
yield api.Cache.RemoveByStartsWith(Api.ECacheKey.PublishTileset + Api.ECacheKey.TilesetAccess);
|
|
9288
9294
|
return {
|
|
9289
9295
|
published: data
|
|
9290
9296
|
};
|
|
@@ -9357,6 +9363,59 @@ var Tileset;
|
|
|
9357
9363
|
});
|
|
9358
9364
|
}
|
|
9359
9365
|
Publish.GetList = GetList;
|
|
9366
|
+
/**
|
|
9367
|
+
* Returns if a given tileset is allowed to be loaded for a given account.
|
|
9368
|
+
* @param params
|
|
9369
|
+
*/
|
|
9370
|
+
function IsAccessAllowed(params) {
|
|
9371
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9372
|
+
let { tilesetId, sourceAccountId, api, forAccountId, req } = params;
|
|
9373
|
+
if (!forAccountId) {
|
|
9374
|
+
forAccountId = ENVIRONMENT.PARAMS.accountId;
|
|
9375
|
+
}
|
|
9376
|
+
// Null source account id means it's a tileset from within the same account.
|
|
9377
|
+
// We also don't want to bother looking for records if we're loading in our own account.
|
|
9378
|
+
if (forAccountId == sourceAccountId || !sourceAccountId) {
|
|
9379
|
+
return true;
|
|
9380
|
+
}
|
|
9381
|
+
if (!api) {
|
|
9382
|
+
api = ENVIRONMENT.Api().GetGlobalApi();
|
|
9383
|
+
}
|
|
9384
|
+
req = Api.PrepReqParams(req);
|
|
9385
|
+
const key = GetAccessAllowedCacheKey(tilesetId, sourceAccountId, forAccountId);
|
|
9386
|
+
const cacheData = yield api.GetCacheItem(key, req);
|
|
9387
|
+
if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.found) {
|
|
9388
|
+
return cacheData.data;
|
|
9389
|
+
}
|
|
9390
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
9391
|
+
var _a;
|
|
9392
|
+
try {
|
|
9393
|
+
// We try find the published record for the tileset.
|
|
9394
|
+
// If it doesn't exist, then it's not published.
|
|
9395
|
+
const { published } = yield GetList({
|
|
9396
|
+
accountId: forAccountId,
|
|
9397
|
+
api: api,
|
|
9398
|
+
});
|
|
9399
|
+
const tileset = published.find(x => x["Tileset.ID"] == tilesetId && x["PublishedBy.ClientAccount.ID"] == sourceAccountId);
|
|
9400
|
+
if (!tileset) {
|
|
9401
|
+
res(false);
|
|
9402
|
+
return;
|
|
9403
|
+
}
|
|
9404
|
+
res(tileset.IsPublic || (((_a = tileset["EnabledFor.ClientAccount.ID"]) === null || _a === void 0 ? void 0 : _a.length) && tileset["EnabledFor.ClientAccount.ID"].includes(forAccountId)));
|
|
9405
|
+
}
|
|
9406
|
+
catch (e) {
|
|
9407
|
+
rej(e);
|
|
9408
|
+
}
|
|
9409
|
+
}));
|
|
9410
|
+
yield api.SetCacheItem({
|
|
9411
|
+
key: key,
|
|
9412
|
+
value: prom,
|
|
9413
|
+
req: req
|
|
9414
|
+
});
|
|
9415
|
+
return prom;
|
|
9416
|
+
});
|
|
9417
|
+
}
|
|
9418
|
+
Publish.IsAccessAllowed = IsAccessAllowed;
|
|
9360
9419
|
})(Publish = Tileset.Publish || (Tileset.Publish = {}));
|
|
9361
9420
|
let Settings;
|
|
9362
9421
|
(function (Settings) {
|
|
@@ -11952,7 +12011,7 @@ var DataSource;
|
|
|
11952
12011
|
DataSource.GetList = GetList;
|
|
11953
12012
|
})(DataSource || (DataSource = {}));
|
|
11954
12013
|
|
|
11955
|
-
const VERSION$1 = "2.7.
|
|
12014
|
+
const VERSION$1 = "2.7.8";
|
|
11956
12015
|
|
|
11957
12016
|
export { VERSION$1 as VERSION, AnnDocument, CustomForm, CustomFormContent, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
|
|
11958
12017
|
//# sourceMappingURL=bruce-models.es5.js.map
|