bruce-models 4.0.3 → 4.0.5
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 +55 -11
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +55 -11
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity-attachment-type.js +34 -5
- package/dist/lib/entity/entity-attachment-type.js.map +1 -1
- package/dist/lib/tileset/tileset.js +20 -5
- package/dist/lib/tileset/tileset.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/entity/entity-attachment-type.d.ts +14 -2
- package/dist/types/tileset/tileset.d.ts +4 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -4905,21 +4905,50 @@
|
|
|
4905
4905
|
EType["Photo"] = "photo";
|
|
4906
4906
|
EType["Document"] = "document";
|
|
4907
4907
|
})(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
|
|
4908
|
+
/**
|
|
4909
|
+
* Gets an attachment type record by ID.
|
|
4910
|
+
* @param params
|
|
4911
|
+
* @returns
|
|
4912
|
+
*/
|
|
4913
|
+
function Get(params) {
|
|
4914
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4915
|
+
let { api, attachmentTypeId, req: reqParams } = params;
|
|
4916
|
+
if (!api) {
|
|
4917
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
4918
|
+
}
|
|
4919
|
+
if (!attachmentTypeId) {
|
|
4920
|
+
throw ("Type ID is required.");
|
|
4921
|
+
}
|
|
4922
|
+
reqParams = exports.Api.PrepReqParams(reqParams);
|
|
4923
|
+
const cacheData = api.GetCacheItem(GetCacheKey(attachmentTypeId), reqParams);
|
|
4924
|
+
if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.found) {
|
|
4925
|
+
return cacheData.data;
|
|
4926
|
+
}
|
|
4927
|
+
const prom = api.GET(`entityAttachmentType/${attachmentTypeId}`, exports.Api.PrepReqParams(reqParams));
|
|
4928
|
+
api.SetCacheItem({
|
|
4929
|
+
key: GetCacheKey(attachmentTypeId),
|
|
4930
|
+
value: prom,
|
|
4931
|
+
req: reqParams
|
|
4932
|
+
});
|
|
4933
|
+
return prom;
|
|
4934
|
+
});
|
|
4935
|
+
}
|
|
4936
|
+
EntityAttachmentType.Get = Get;
|
|
4908
4937
|
/**
|
|
4909
4938
|
* Deletes an attachment type.
|
|
4910
4939
|
* @param params
|
|
4911
4940
|
*/
|
|
4912
4941
|
function Delete(params) {
|
|
4913
4942
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4914
|
-
let { api, attachmentTypeId
|
|
4943
|
+
let { api, attachmentTypeId, req: reqParams } = params;
|
|
4915
4944
|
if (!api) {
|
|
4916
4945
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
4917
4946
|
}
|
|
4918
|
-
if (!
|
|
4947
|
+
if (!attachmentTypeId) {
|
|
4919
4948
|
throw ("Type ID is required.");
|
|
4920
4949
|
}
|
|
4921
|
-
yield api.DELETE(`entityAttachmentType/${
|
|
4922
|
-
api.Cache.Remove(GetCacheKey(
|
|
4950
|
+
yield api.DELETE(`entityAttachmentType/${attachmentTypeId}`, exports.Api.PrepReqParams(reqParams));
|
|
4951
|
+
api.Cache.Remove(GetCacheKey(attachmentTypeId));
|
|
4923
4952
|
api.Cache.Remove(GetListCacheKey());
|
|
4924
4953
|
});
|
|
4925
4954
|
}
|
|
@@ -4954,7 +4983,7 @@
|
|
|
4954
4983
|
*/
|
|
4955
4984
|
function GetList(params) {
|
|
4956
4985
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4957
|
-
let { api, reqParams } = params;
|
|
4986
|
+
let { api, req: reqParams } = params;
|
|
4958
4987
|
if (!api) {
|
|
4959
4988
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
4960
4989
|
}
|
|
@@ -7928,7 +7957,7 @@
|
|
|
7928
7957
|
* @returns
|
|
7929
7958
|
*/
|
|
7930
7959
|
function GetFileUrl(params) {
|
|
7931
|
-
let { api, tilesetId, file } = params;
|
|
7960
|
+
let { api, tilesetId, file, cacheToken, legacy, viaCdn } = params;
|
|
7932
7961
|
if (!tilesetId) {
|
|
7933
7962
|
throw ("Tileset ID is required.");
|
|
7934
7963
|
}
|
|
@@ -7938,7 +7967,23 @@
|
|
|
7938
7967
|
if (!file) {
|
|
7939
7968
|
file = "";
|
|
7940
7969
|
}
|
|
7941
|
-
|
|
7970
|
+
let url = null;
|
|
7971
|
+
const cdnBaseUrl = viaCdn ? api.GetCdnBaseUrl() : null;
|
|
7972
|
+
if (cdnBaseUrl) {
|
|
7973
|
+
url = `v3/tilesets/${tilesetId}/files/${legacy ? "" : "files/"}${file}`;
|
|
7974
|
+
const urlParams = new URLSearchParams();
|
|
7975
|
+
if (cacheToken != null) {
|
|
7976
|
+
urlParams.append("cacheToken", String(cacheToken));
|
|
7977
|
+
}
|
|
7978
|
+
url = api.ConstructCdnUrl(url, urlParams);
|
|
7979
|
+
}
|
|
7980
|
+
else {
|
|
7981
|
+
url = api.GetBaseUrl() + `v3/tilesets/${tilesetId}/files/${legacy ? "" : "files/"}${file}`;
|
|
7982
|
+
if (cacheToken != null) {
|
|
7983
|
+
url += `?cacheToken=${cacheToken}`;
|
|
7984
|
+
}
|
|
7985
|
+
}
|
|
7986
|
+
return url;
|
|
7942
7987
|
}
|
|
7943
7988
|
Tileset.GetFileUrl = GetFileUrl;
|
|
7944
7989
|
/**
|
|
@@ -7963,6 +8008,7 @@
|
|
|
7963
8008
|
/**
|
|
7964
8009
|
* Returns file url for a file + tileset.
|
|
7965
8010
|
* @param params
|
|
8011
|
+
* @deprecated Use GetFileUrl instead.
|
|
7966
8012
|
* @returns
|
|
7967
8013
|
*/
|
|
7968
8014
|
function GetPublicFileUrl(params) {
|
|
@@ -7983,9 +8029,7 @@
|
|
|
7983
8029
|
}
|
|
7984
8030
|
return cdnBaseUrl + `tileset/file/${tilesetId}/${file}?accountId=${api.AccountId}&cacheToken=${viaCdnCacheToken}`;
|
|
7985
8031
|
}
|
|
7986
|
-
|
|
7987
|
-
return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
|
|
7988
|
-
}
|
|
8032
|
+
return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
|
|
7989
8033
|
}
|
|
7990
8034
|
Tileset.GetPublicFileUrl = GetPublicFileUrl;
|
|
7991
8035
|
/**
|
|
@@ -11388,7 +11432,7 @@
|
|
|
11388
11432
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
11389
11433
|
|
|
11390
11434
|
// This is updated with the package.json version on build.
|
|
11391
|
-
const VERSION = "4.0.
|
|
11435
|
+
const VERSION = "4.0.5";
|
|
11392
11436
|
|
|
11393
11437
|
exports.VERSION = VERSION;
|
|
11394
11438
|
exports.AbstractApi = AbstractApi;
|