bruce-models 2.7.5 → 2.7.7
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 +74 -3
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +74 -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/custom-form/custom-form-content.js +12 -0
- package/dist/lib/custom-form/custom-form-content.js.map +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/custom-form/custom-form-content.d.ts +18 -4
- package/dist/types/tileset/tileset.d.ts +12 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
ECacheKey["LodCategory"] = "lodcategory";
|
|
60
60
|
ECacheKey["Style"] = "style";
|
|
61
61
|
ECacheKey["PublishTileset"] = "publishtileset";
|
|
62
|
+
ECacheKey["TilesetAccess"] = "tilesetaccess";
|
|
62
63
|
ECacheKey["User"] = "user";
|
|
63
64
|
ECacheKey["UserSettings"] = "usersettings";
|
|
64
65
|
ECacheKey["UserEmail"] = "useremail";
|
|
@@ -4761,14 +4762,26 @@
|
|
|
4761
4762
|
(function (CustomFormContent) {
|
|
4762
4763
|
let ECellType;
|
|
4763
4764
|
(function (ECellType) {
|
|
4765
|
+
// Description-like text box that the user types in.
|
|
4764
4766
|
ECellType[ECellType["StaticText"] = 0] = "StaticText";
|
|
4767
|
+
// Label + Value pair of an entity attribute.
|
|
4765
4768
|
ECellType[ECellType["DataValue"] = 1] = "DataValue";
|
|
4769
|
+
// Static picture.
|
|
4766
4770
|
ECellType[ECellType["StaticPicture"] = 2] = "StaticPicture";
|
|
4771
|
+
// Sub-section of the form. Contains other sections.
|
|
4767
4772
|
ECellType[ECellType["SubSection"] = 3] = "SubSection";
|
|
4773
|
+
// Button that opens another form (or info view).
|
|
4768
4774
|
ECellType[ECellType["ButtonMore"] = 4] = "ButtonMore";
|
|
4775
|
+
// Entity gallery.
|
|
4769
4776
|
ECellType[ECellType["EntityPhoto"] = 5] = "EntityPhoto";
|
|
4777
|
+
// Embedded media frame. Eg: youtube video.
|
|
4770
4778
|
ECellType[ECellType["EmbeddedMedia"] = 6] = "EmbeddedMedia";
|
|
4779
|
+
// Deprecated
|
|
4771
4780
|
ECellType[ECellType["Chart"] = 7] = "Chart";
|
|
4781
|
+
// Similar to DataValue, except it populates a description-like text-box.
|
|
4782
|
+
ECellType[ECellType["EntityText"] = 8] = "EntityText";
|
|
4783
|
+
// Icon and optional action associated with it.
|
|
4784
|
+
ECellType[ECellType["Icon"] = 9] = "Icon";
|
|
4772
4785
|
})(ECellType = CustomFormContent.ECellType || (CustomFormContent.ECellType = {}));
|
|
4773
4786
|
let EFlowDirection;
|
|
4774
4787
|
(function (EFlowDirection) {
|
|
@@ -9094,6 +9107,10 @@
|
|
|
9094
9107
|
return exports.Api.ECacheKey.PublishTileset + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Id + tilesetId;
|
|
9095
9108
|
}
|
|
9096
9109
|
Publish.GetCacheKey = GetCacheKey;
|
|
9110
|
+
function GetAccessAllowedCacheKey(tilesetId, sourceAccountId, forAccountId) {
|
|
9111
|
+
return exports.Api.ECacheKey.PublishTileset + exports.Api.ECacheKey.TilesetAccess + exports.Api.ECacheKey.Id + tilesetId + exports.Api.ECacheKey.Id + sourceAccountId + exports.Api.ECacheKey.Id + forAccountId;
|
|
9112
|
+
}
|
|
9113
|
+
Publish.GetAccessAllowedCacheKey = GetAccessAllowedCacheKey;
|
|
9097
9114
|
function Update(params) {
|
|
9098
9115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9099
9116
|
let { api, published: data, req: reqParams } = params;
|
|
@@ -9112,8 +9129,9 @@
|
|
|
9112
9129
|
};
|
|
9113
9130
|
data.ID = res.ID;
|
|
9114
9131
|
yield api.POST(`tileset/${data.ID}/enableForAccounts`, req, reqParams);
|
|
9115
|
-
api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"], data["Tileset.ID"]));
|
|
9116
|
-
api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"]));
|
|
9132
|
+
yield api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"], data["Tileset.ID"]));
|
|
9133
|
+
yield api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"]));
|
|
9134
|
+
yield api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.PublishTileset + exports.Api.ECacheKey.TilesetAccess);
|
|
9117
9135
|
return {
|
|
9118
9136
|
published: data
|
|
9119
9137
|
};
|
|
@@ -9186,6 +9204,59 @@
|
|
|
9186
9204
|
});
|
|
9187
9205
|
}
|
|
9188
9206
|
Publish.GetList = GetList;
|
|
9207
|
+
/**
|
|
9208
|
+
* Returns if a given tileset is allowed to be loaded for a given account.
|
|
9209
|
+
* @param params
|
|
9210
|
+
*/
|
|
9211
|
+
function IsAccessAllowed(params) {
|
|
9212
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9213
|
+
let { tilesetId, sourceAccountId, api, forAccountId, req } = params;
|
|
9214
|
+
if (!forAccountId) {
|
|
9215
|
+
forAccountId = exports.ENVIRONMENT.PARAMS.accountId;
|
|
9216
|
+
}
|
|
9217
|
+
// Null source account id means it's a tileset from within the same account.
|
|
9218
|
+
// We also don't want to bother looking for records if we're loading in our own account.
|
|
9219
|
+
if (forAccountId == sourceAccountId || !sourceAccountId) {
|
|
9220
|
+
return true;
|
|
9221
|
+
}
|
|
9222
|
+
if (!api) {
|
|
9223
|
+
api = exports.ENVIRONMENT.Api().GetGlobalApi();
|
|
9224
|
+
}
|
|
9225
|
+
req = exports.Api.PrepReqParams(req);
|
|
9226
|
+
const key = GetAccessAllowedCacheKey(tilesetId, sourceAccountId, forAccountId);
|
|
9227
|
+
const cacheData = yield api.GetCacheItem(key, req);
|
|
9228
|
+
if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.found) {
|
|
9229
|
+
return cacheData.data;
|
|
9230
|
+
}
|
|
9231
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
9232
|
+
var _a;
|
|
9233
|
+
try {
|
|
9234
|
+
// We try find the published record for the tileset.
|
|
9235
|
+
// If it doesn't exist, then it's not published.
|
|
9236
|
+
const { published } = yield GetList({
|
|
9237
|
+
accountId: sourceAccountId,
|
|
9238
|
+
api: api,
|
|
9239
|
+
});
|
|
9240
|
+
const tileset = published.find(x => x["Tileset.ID"] == tilesetId && x["PublishedBy.ClientAccount.ID"] == sourceAccountId);
|
|
9241
|
+
if (!tileset) {
|
|
9242
|
+
res(false);
|
|
9243
|
+
return;
|
|
9244
|
+
}
|
|
9245
|
+
res(tileset.IsPublic || (((_a = tileset["EnabledFor.ClientAccount.ID"]) === null || _a === void 0 ? void 0 : _a.length) && tileset["EnabledFor.ClientAccount.ID"].includes(forAccountId)));
|
|
9246
|
+
}
|
|
9247
|
+
catch (e) {
|
|
9248
|
+
rej(e);
|
|
9249
|
+
}
|
|
9250
|
+
}));
|
|
9251
|
+
yield api.SetCacheItem({
|
|
9252
|
+
key: key,
|
|
9253
|
+
value: prom,
|
|
9254
|
+
req: req
|
|
9255
|
+
});
|
|
9256
|
+
return prom;
|
|
9257
|
+
});
|
|
9258
|
+
}
|
|
9259
|
+
Publish.IsAccessAllowed = IsAccessAllowed;
|
|
9189
9260
|
})(Publish = Tileset.Publish || (Tileset.Publish = {}));
|
|
9190
9261
|
let Settings;
|
|
9191
9262
|
(function (Settings) {
|
|
@@ -11705,7 +11776,7 @@
|
|
|
11705
11776
|
DataSource.GetList = GetList;
|
|
11706
11777
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
11707
11778
|
|
|
11708
|
-
const VERSION$1 = "2.7.
|
|
11779
|
+
const VERSION$1 = "2.7.7";
|
|
11709
11780
|
|
|
11710
11781
|
exports.VERSION = VERSION$1;
|
|
11711
11782
|
exports.AbstractApi = AbstractApi;
|