bruce-models 1.9.8 → 1.9.9
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 +20 -14
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +20 -14
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account-settings.js +2 -2
- package/dist/lib/account/account.js +185 -185
- package/dist/lib/ann-document/ann-document.js +86 -86
- package/dist/lib/api/abstract-api.js +246 -246
- package/dist/lib/api/api-getters.js +134 -134
- package/dist/lib/api/api.js +93 -93
- package/dist/lib/api/bruce-api.js +216 -216
- package/dist/lib/api/cam-api.js +85 -82
- package/dist/lib/api/cam-api.js.map +1 -1
- package/dist/lib/api/global-api.js +81 -81
- package/dist/lib/api/idm-api.js +85 -82
- package/dist/lib/api/idm-api.js.map +1 -1
- package/dist/lib/bruce-models.js +86 -86
- package/dist/lib/calculator/calculator.js +341 -341
- package/dist/lib/client-file/client-file.js +245 -245
- package/dist/lib/common/bounds.js +61 -61
- package/dist/lib/common/bruce-event.js +46 -46
- package/dist/lib/common/bruce-variable.js +60 -60
- package/dist/lib/common/cache.js +165 -165
- package/dist/lib/common/camera.js +11 -11
- package/dist/lib/common/cartes.js +123 -123
- package/dist/lib/common/carto.js +60 -60
- package/dist/lib/common/color.js +86 -86
- package/dist/lib/common/delay-queue.js +56 -56
- package/dist/lib/common/dictionary.js +2 -2
- package/dist/lib/common/geometry.js +120 -120
- package/dist/lib/common/transform.js +2 -2
- package/dist/lib/common/utc.js +39 -39
- package/dist/lib/custom-form/custom-form-content.js +26 -26
- package/dist/lib/custom-form/custom-form.js +106 -106
- package/dist/lib/data-lab/data-lab.js +49 -49
- package/dist/lib/entity/entity-attachment-type.js +83 -83
- package/dist/lib/entity/entity-attachment.js +122 -122
- package/dist/lib/entity/entity-attribute.js +29 -29
- package/dist/lib/entity/entity-comment.js +82 -82
- package/dist/lib/entity/entity-coords.js +149 -149
- package/dist/lib/entity/entity-link.js +82 -82
- package/dist/lib/entity/entity-lod-category.js +100 -100
- package/dist/lib/entity/entity-lod.js +185 -185
- package/dist/lib/entity/entity-relation-type.js +109 -109
- package/dist/lib/entity/entity-relation.js +132 -132
- package/dist/lib/entity/entity-source.js +136 -136
- package/dist/lib/entity/entity-tag.js +149 -149
- package/dist/lib/entity/entity-type-visual-settings.js +13 -13
- package/dist/lib/entity/entity-type.js +113 -113
- package/dist/lib/entity/entity.js +319 -319
- package/dist/lib/entity/getters/batched-data-getter.js +84 -84
- package/dist/lib/entity/getters/entity-filter-getter.js +303 -303
- package/dist/lib/entity/getters/entity-globe.js +211 -211
- package/dist/lib/entity/getters/view-monitor.js +2 -2
- package/dist/lib/import/import-cad.js +53 -53
- package/dist/lib/import/import-csv.js +23 -23
- package/dist/lib/import/import-json.js +23 -23
- package/dist/lib/import/import-kml.js +23 -23
- package/dist/lib/import/imported-file.js +91 -91
- package/dist/lib/internal/uploader.js +76 -76
- package/dist/lib/markup/markup.js +185 -185
- package/dist/lib/plugin/plugin.js +83 -83
- package/dist/lib/program-key/program-key.js +111 -111
- package/dist/lib/project/menu-item.js +121 -121
- package/dist/lib/project/project-view-bookmark.js +147 -147
- package/dist/lib/project/project-view-legacy-tile.js +77 -77
- package/dist/lib/project/project-view-tile.js +125 -125
- package/dist/lib/project/project-view.js +133 -133
- package/dist/lib/project/zoom-control.js +17 -17
- package/dist/lib/server/message-broker.js +142 -142
- package/dist/lib/server/pending-action.js +71 -71
- package/dist/lib/server/task.js +63 -63
- package/dist/lib/style/style.js +117 -117
- package/dist/lib/tileset/tileset.js +415 -415
- package/dist/lib/user/permission.js +20 -20
- package/dist/lib/user/session.js +137 -137
- package/dist/lib/user/user-group.js +94 -94
- package/dist/lib/user/user.js +446 -446
- package/dist/lib/util/encrypt-utils.js +19 -19
- package/dist/lib/util/math-utils.js +40 -40
- package/dist/lib/util/object-utils.js +17 -17
- package/dist/lib/util/path-utils.js +61 -61
- package/dist/lib/util/url-utils.js +94 -94
- package/package.json +3 -2
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.EntityComment = void 0;
|
|
13
|
-
const api_1 = require("../api/api");
|
|
14
|
-
/**
|
|
15
|
-
* Describes the "Entity Comment" concept within Bruce.
|
|
16
|
-
* An entity comment is a user written message that is linked to an entity record.
|
|
17
|
-
*/
|
|
18
|
-
var EntityComment;
|
|
19
|
-
(function (EntityComment) {
|
|
20
|
-
function GetCacheKey(id) {
|
|
21
|
-
return api_1.Api.ECacheKey.Comment + api_1.Api.ECacheKey.Id + id;
|
|
22
|
-
}
|
|
23
|
-
EntityComment.GetCacheKey = GetCacheKey;
|
|
24
|
-
function GetListCacheKey(entityId) {
|
|
25
|
-
return api_1.Api.ECacheKey.Comment + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
|
|
26
|
-
}
|
|
27
|
-
EntityComment.GetListCacheKey = GetListCacheKey;
|
|
28
|
-
function Update(params) {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const { api, comment: data, req: reqParams } = params;
|
|
31
|
-
if (!(data === null || data === void 0 ? void 0 : data["TargetObject.ID"])) {
|
|
32
|
-
throw ("TargetObject.ID (entity id) is required.");
|
|
33
|
-
}
|
|
34
|
-
const url = `entity/${data["TargetObject.ID"]}/comment` + (data.ID == null ? "" : "/" + data.ID);
|
|
35
|
-
const res = yield api.POST(url, data, api_1.Api.PrepReqParams(reqParams));
|
|
36
|
-
api.Cache.Remove(GetCacheKey(data.ID));
|
|
37
|
-
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Comment + api_1.Api.ECacheKey.Entity);
|
|
38
|
-
return {
|
|
39
|
-
comment: res
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
EntityComment.Update = Update;
|
|
44
|
-
function Delete(params) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const { api, entityId, commentId, req: reqParams } = params;
|
|
47
|
-
if (!commentId) {
|
|
48
|
-
throw ("Comment ID is required.");
|
|
49
|
-
}
|
|
50
|
-
yield api.DELETE(`entity/${entityId}/comment/${commentId}`, api_1.Api.PrepReqParams(reqParams));
|
|
51
|
-
api.Cache.Remove(GetCacheKey(commentId));
|
|
52
|
-
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Comment + api_1.Api.ECacheKey.Entity);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
EntityComment.Delete = Delete;
|
|
56
|
-
function GetListByEntityId(params) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const { api, entityId, req: reqParams } = params;
|
|
59
|
-
if (!entityId) {
|
|
60
|
-
throw ("Entity ID is required.");
|
|
61
|
-
}
|
|
62
|
-
const cacheData = api.GetCacheItem(GetListCacheKey(entityId), reqParams);
|
|
63
|
-
if (cacheData) {
|
|
64
|
-
return cacheData;
|
|
65
|
-
}
|
|
66
|
-
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
try {
|
|
68
|
-
const data = yield api.GET(`entity/${entityId}/comments`, api_1.Api.PrepReqParams(reqParams));
|
|
69
|
-
res({
|
|
70
|
-
comments: data.Items
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
rej(e);
|
|
75
|
-
}
|
|
76
|
-
}));
|
|
77
|
-
api.Cache.Set(GetListCacheKey(entityId), req);
|
|
78
|
-
return req;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
EntityComment.GetListByEntityId = GetListByEntityId;
|
|
82
|
-
})(EntityComment = exports.EntityComment || (exports.EntityComment = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EntityComment = void 0;
|
|
13
|
+
const api_1 = require("../api/api");
|
|
14
|
+
/**
|
|
15
|
+
* Describes the "Entity Comment" concept within Bruce.
|
|
16
|
+
* An entity comment is a user written message that is linked to an entity record.
|
|
17
|
+
*/
|
|
18
|
+
var EntityComment;
|
|
19
|
+
(function (EntityComment) {
|
|
20
|
+
function GetCacheKey(id) {
|
|
21
|
+
return api_1.Api.ECacheKey.Comment + api_1.Api.ECacheKey.Id + id;
|
|
22
|
+
}
|
|
23
|
+
EntityComment.GetCacheKey = GetCacheKey;
|
|
24
|
+
function GetListCacheKey(entityId) {
|
|
25
|
+
return api_1.Api.ECacheKey.Comment + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
|
|
26
|
+
}
|
|
27
|
+
EntityComment.GetListCacheKey = GetListCacheKey;
|
|
28
|
+
function Update(params) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const { api, comment: data, req: reqParams } = params;
|
|
31
|
+
if (!(data === null || data === void 0 ? void 0 : data["TargetObject.ID"])) {
|
|
32
|
+
throw ("TargetObject.ID (entity id) is required.");
|
|
33
|
+
}
|
|
34
|
+
const url = `entity/${data["TargetObject.ID"]}/comment` + (data.ID == null ? "" : "/" + data.ID);
|
|
35
|
+
const res = yield api.POST(url, data, api_1.Api.PrepReqParams(reqParams));
|
|
36
|
+
api.Cache.Remove(GetCacheKey(data.ID));
|
|
37
|
+
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Comment + api_1.Api.ECacheKey.Entity);
|
|
38
|
+
return {
|
|
39
|
+
comment: res
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
EntityComment.Update = Update;
|
|
44
|
+
function Delete(params) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const { api, entityId, commentId, req: reqParams } = params;
|
|
47
|
+
if (!commentId) {
|
|
48
|
+
throw ("Comment ID is required.");
|
|
49
|
+
}
|
|
50
|
+
yield api.DELETE(`entity/${entityId}/comment/${commentId}`, api_1.Api.PrepReqParams(reqParams));
|
|
51
|
+
api.Cache.Remove(GetCacheKey(commentId));
|
|
52
|
+
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Comment + api_1.Api.ECacheKey.Entity);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
EntityComment.Delete = Delete;
|
|
56
|
+
function GetListByEntityId(params) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const { api, entityId, req: reqParams } = params;
|
|
59
|
+
if (!entityId) {
|
|
60
|
+
throw ("Entity ID is required.");
|
|
61
|
+
}
|
|
62
|
+
const cacheData = api.GetCacheItem(GetListCacheKey(entityId), reqParams);
|
|
63
|
+
if (cacheData) {
|
|
64
|
+
return cacheData;
|
|
65
|
+
}
|
|
66
|
+
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
try {
|
|
68
|
+
const data = yield api.GET(`entity/${entityId}/comments`, api_1.Api.PrepReqParams(reqParams));
|
|
69
|
+
res({
|
|
70
|
+
comments: data.Items
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
rej(e);
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
api.Cache.Set(GetListCacheKey(entityId), req);
|
|
78
|
+
return req;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
EntityComment.GetListByEntityId = GetListByEntityId;
|
|
82
|
+
})(EntityComment = exports.EntityComment || (exports.EntityComment = {}));
|
|
83
83
|
//# sourceMappingURL=entity-comment.js.map
|
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.EntityCoords = void 0;
|
|
13
|
-
const api_1 = require("../api/api");
|
|
14
|
-
const math_utils_1 = require("../util/math-utils");
|
|
15
|
-
var EntityCoords;
|
|
16
|
-
(function (EntityCoords) {
|
|
17
|
-
EntityCoords.UCS_ENTITY_TYPE_ID = "Bruce_UCS_Type";
|
|
18
|
-
function GetCacheKey(entityId) {
|
|
19
|
-
return api_1.Api.ECacheKey.EntityCoords + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
|
|
20
|
-
}
|
|
21
|
-
EntityCoords.GetCacheKey = GetCacheKey;
|
|
22
|
-
function GetEntityCoords(params) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
25
|
-
const cacheData = api.GetCacheItem(GetCacheKey(entityId), reqParams);
|
|
26
|
-
if (cacheData) {
|
|
27
|
-
return cacheData;
|
|
28
|
-
}
|
|
29
|
-
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
try {
|
|
31
|
-
const data = yield api.GET(`entity/${entityId}/ucs`, reqParams);
|
|
32
|
-
res({
|
|
33
|
-
coords: data
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
catch (e) {
|
|
37
|
-
rej(e);
|
|
38
|
-
}
|
|
39
|
-
}));
|
|
40
|
-
api.Cache.Set(GetCacheKey(entityId), prom, api_1.Api.DEFAULT_CACHE_DURATION);
|
|
41
|
-
return prom;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
EntityCoords.GetEntityCoords = GetEntityCoords;
|
|
45
|
-
function EntityRelativeToPoint(params) {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
48
|
-
if (!params.test) {
|
|
49
|
-
yield UnlinkCoords({
|
|
50
|
-
api,
|
|
51
|
-
rootEntityId: entityId,
|
|
52
|
-
req: reqParams
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
const point = params.point;
|
|
56
|
-
const name = params.name || `${math_utils_1.MathUtils.Round(point.latitude, 4)}, ${math_utils_1.MathUtils.Round(point.longitude, 4)}`;
|
|
57
|
-
const res = yield api.POST(`entity/${entityId}/ucs`, {
|
|
58
|
-
"ucs": {
|
|
59
|
-
"Entity.ID": null,
|
|
60
|
-
"name": name,
|
|
61
|
-
"location": {
|
|
62
|
-
"latitude": point.latitude,
|
|
63
|
-
"longitude": point.longitude,
|
|
64
|
-
"altitude": point.altitude,
|
|
65
|
-
"coordinates": {
|
|
66
|
-
"Entity.ID": entityId
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
"test": params.test
|
|
71
|
-
}, reqParams);
|
|
72
|
-
if (!params.test) {
|
|
73
|
-
api.Cache.Remove(GetCacheKey(entityId));
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
coords: res
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
EntityCoords.EntityRelativeToPoint = EntityRelativeToPoint;
|
|
81
|
-
function EntityRelativeToEpsg(params) {
|
|
82
|
-
var _a;
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
85
|
-
if (!params.test) {
|
|
86
|
-
yield UnlinkCoords({
|
|
87
|
-
api,
|
|
88
|
-
rootEntityId: entityId,
|
|
89
|
-
req: reqParams
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
const epsg = params.epsg;
|
|
93
|
-
const name = (_a = params.name) !== null && _a !== void 0 ? _a : "EPSG: " + epsg;
|
|
94
|
-
const res = yield api.POST(`entity/${entityId}/ucs`, {
|
|
95
|
-
"ucs": {
|
|
96
|
-
"Entity.ID": null,
|
|
97
|
-
"name": name,
|
|
98
|
-
"location": {
|
|
99
|
-
"coordinates": {
|
|
100
|
-
"SRID": "EPSG:" + epsg,
|
|
101
|
-
"Entity.ID": entityId
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"test": params.test
|
|
106
|
-
}, reqParams);
|
|
107
|
-
if (!params.test) {
|
|
108
|
-
api.Cache.Remove(GetCacheKey(entityId));
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
coords: res
|
|
112
|
-
};
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
EntityCoords.EntityRelativeToEpsg = EntityRelativeToEpsg;
|
|
116
|
-
function EntityRelativeToUcs(params) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
119
|
-
if (!params.test) {
|
|
120
|
-
yield UnlinkCoords({
|
|
121
|
-
api,
|
|
122
|
-
rootEntityId: entityId,
|
|
123
|
-
req: reqParams
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
const ucsId = params.ucsId;
|
|
127
|
-
const res = yield api.POST(`entity/${entityId}/ucs`, {
|
|
128
|
-
"ucs": {
|
|
129
|
-
"Entity.ID": ucsId
|
|
130
|
-
},
|
|
131
|
-
"test": params.test
|
|
132
|
-
}, reqParams);
|
|
133
|
-
if (!params.test) {
|
|
134
|
-
api.Cache.Remove(GetCacheKey(entityId));
|
|
135
|
-
}
|
|
136
|
-
return {
|
|
137
|
-
coords: res
|
|
138
|
-
};
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
EntityCoords.EntityRelativeToUcs = EntityRelativeToUcs;
|
|
142
|
-
function UnlinkCoords(params) {
|
|
143
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
145
|
-
return api.DELETE(`entity/${entityId}/ucs`, reqParams);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
EntityCoords.UnlinkCoords = UnlinkCoords;
|
|
149
|
-
})(EntityCoords = exports.EntityCoords || (exports.EntityCoords = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EntityCoords = void 0;
|
|
13
|
+
const api_1 = require("../api/api");
|
|
14
|
+
const math_utils_1 = require("../util/math-utils");
|
|
15
|
+
var EntityCoords;
|
|
16
|
+
(function (EntityCoords) {
|
|
17
|
+
EntityCoords.UCS_ENTITY_TYPE_ID = "Bruce_UCS_Type";
|
|
18
|
+
function GetCacheKey(entityId) {
|
|
19
|
+
return api_1.Api.ECacheKey.EntityCoords + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
|
|
20
|
+
}
|
|
21
|
+
EntityCoords.GetCacheKey = GetCacheKey;
|
|
22
|
+
function GetEntityCoords(params) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
25
|
+
const cacheData = api.GetCacheItem(GetCacheKey(entityId), reqParams);
|
|
26
|
+
if (cacheData) {
|
|
27
|
+
return cacheData;
|
|
28
|
+
}
|
|
29
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
try {
|
|
31
|
+
const data = yield api.GET(`entity/${entityId}/ucs`, reqParams);
|
|
32
|
+
res({
|
|
33
|
+
coords: data
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
rej(e);
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
api.Cache.Set(GetCacheKey(entityId), prom, api_1.Api.DEFAULT_CACHE_DURATION);
|
|
41
|
+
return prom;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
EntityCoords.GetEntityCoords = GetEntityCoords;
|
|
45
|
+
function EntityRelativeToPoint(params) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
48
|
+
if (!params.test) {
|
|
49
|
+
yield UnlinkCoords({
|
|
50
|
+
api,
|
|
51
|
+
rootEntityId: entityId,
|
|
52
|
+
req: reqParams
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const point = params.point;
|
|
56
|
+
const name = params.name || `${math_utils_1.MathUtils.Round(point.latitude, 4)}, ${math_utils_1.MathUtils.Round(point.longitude, 4)}`;
|
|
57
|
+
const res = yield api.POST(`entity/${entityId}/ucs`, {
|
|
58
|
+
"ucs": {
|
|
59
|
+
"Entity.ID": null,
|
|
60
|
+
"name": name,
|
|
61
|
+
"location": {
|
|
62
|
+
"latitude": point.latitude,
|
|
63
|
+
"longitude": point.longitude,
|
|
64
|
+
"altitude": point.altitude,
|
|
65
|
+
"coordinates": {
|
|
66
|
+
"Entity.ID": entityId
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"test": params.test
|
|
71
|
+
}, reqParams);
|
|
72
|
+
if (!params.test) {
|
|
73
|
+
api.Cache.Remove(GetCacheKey(entityId));
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
coords: res
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
EntityCoords.EntityRelativeToPoint = EntityRelativeToPoint;
|
|
81
|
+
function EntityRelativeToEpsg(params) {
|
|
82
|
+
var _a;
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
85
|
+
if (!params.test) {
|
|
86
|
+
yield UnlinkCoords({
|
|
87
|
+
api,
|
|
88
|
+
rootEntityId: entityId,
|
|
89
|
+
req: reqParams
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const epsg = params.epsg;
|
|
93
|
+
const name = (_a = params.name) !== null && _a !== void 0 ? _a : "EPSG: " + epsg;
|
|
94
|
+
const res = yield api.POST(`entity/${entityId}/ucs`, {
|
|
95
|
+
"ucs": {
|
|
96
|
+
"Entity.ID": null,
|
|
97
|
+
"name": name,
|
|
98
|
+
"location": {
|
|
99
|
+
"coordinates": {
|
|
100
|
+
"SRID": "EPSG:" + epsg,
|
|
101
|
+
"Entity.ID": entityId
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"test": params.test
|
|
106
|
+
}, reqParams);
|
|
107
|
+
if (!params.test) {
|
|
108
|
+
api.Cache.Remove(GetCacheKey(entityId));
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
coords: res
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
EntityCoords.EntityRelativeToEpsg = EntityRelativeToEpsg;
|
|
116
|
+
function EntityRelativeToUcs(params) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
119
|
+
if (!params.test) {
|
|
120
|
+
yield UnlinkCoords({
|
|
121
|
+
api,
|
|
122
|
+
rootEntityId: entityId,
|
|
123
|
+
req: reqParams
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const ucsId = params.ucsId;
|
|
127
|
+
const res = yield api.POST(`entity/${entityId}/ucs`, {
|
|
128
|
+
"ucs": {
|
|
129
|
+
"Entity.ID": ucsId
|
|
130
|
+
},
|
|
131
|
+
"test": params.test
|
|
132
|
+
}, reqParams);
|
|
133
|
+
if (!params.test) {
|
|
134
|
+
api.Cache.Remove(GetCacheKey(entityId));
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
coords: res
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
EntityCoords.EntityRelativeToUcs = EntityRelativeToUcs;
|
|
142
|
+
function UnlinkCoords(params) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
145
|
+
return api.DELETE(`entity/${entityId}/ucs`, reqParams);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
EntityCoords.UnlinkCoords = UnlinkCoords;
|
|
149
|
+
})(EntityCoords = exports.EntityCoords || (exports.EntityCoords = {}));
|
|
150
150
|
//# sourceMappingURL=entity-coords.js.map
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.EntityLink = void 0;
|
|
13
|
-
const api_1 = require("../api/api");
|
|
14
|
-
/**
|
|
15
|
-
* Describes the "Entity Link" concept within Bruce.
|
|
16
|
-
* An entity link is a URL linked to an entity record.
|
|
17
|
-
*/
|
|
18
|
-
var EntityLink;
|
|
19
|
-
(function (EntityLink) {
|
|
20
|
-
function GetCacheKey(id) {
|
|
21
|
-
return api_1.Api.ECacheKey.Link + api_1.Api.ECacheKey.Id + id;
|
|
22
|
-
}
|
|
23
|
-
EntityLink.GetCacheKey = GetCacheKey;
|
|
24
|
-
function GetListCacheKey(entityId) {
|
|
25
|
-
return api_1.Api.ECacheKey.Link + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
|
|
26
|
-
}
|
|
27
|
-
EntityLink.GetListCacheKey = GetListCacheKey;
|
|
28
|
-
function Update(params) {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const { api, link: data, req: reqParams } = params;
|
|
31
|
-
if (!(data === null || data === void 0 ? void 0 : data["Entity.ID"])) {
|
|
32
|
-
throw ("Entity ID is required.");
|
|
33
|
-
}
|
|
34
|
-
const url = `entity/${data["Entity.ID"]}/link` + (data.ID == null ? "" : "/" + data.ID);
|
|
35
|
-
const res = yield api.POST(url, data, api_1.Api.PrepReqParams(reqParams));
|
|
36
|
-
api.Cache.Remove(GetCacheKey(data.ID));
|
|
37
|
-
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Link + api_1.Api.ECacheKey.Entity);
|
|
38
|
-
return {
|
|
39
|
-
link: res
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
EntityLink.Update = Update;
|
|
44
|
-
function Delete(params) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const { api, entityId, linkId, req: reqParams } = params;
|
|
47
|
-
if (!linkId) {
|
|
48
|
-
throw ("Link ID is required.");
|
|
49
|
-
}
|
|
50
|
-
yield api.DELETE(`entity/${entityId}/link/${linkId}`, api_1.Api.PrepReqParams(reqParams));
|
|
51
|
-
api.Cache.Remove(GetCacheKey(linkId));
|
|
52
|
-
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Link + api_1.Api.ECacheKey.Entity);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
EntityLink.Delete = Delete;
|
|
56
|
-
function GetListByEntityId(params) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const { api, entityId, req: reqParams } = params;
|
|
59
|
-
if (!entityId) {
|
|
60
|
-
throw ("Entity ID is required.");
|
|
61
|
-
}
|
|
62
|
-
const cacheData = api.GetCacheItem(GetListCacheKey(entityId), reqParams);
|
|
63
|
-
if (cacheData) {
|
|
64
|
-
return cacheData;
|
|
65
|
-
}
|
|
66
|
-
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
try {
|
|
68
|
-
const data = yield api.GET(`entity/${entityId}/links`, api_1.Api.PrepReqParams(reqParams));
|
|
69
|
-
res({
|
|
70
|
-
links: data.Items
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
rej(e);
|
|
75
|
-
}
|
|
76
|
-
}));
|
|
77
|
-
api.Cache.Set(GetListCacheKey(entityId), req);
|
|
78
|
-
return req;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
EntityLink.GetListByEntityId = GetListByEntityId;
|
|
82
|
-
})(EntityLink = exports.EntityLink || (exports.EntityLink = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EntityLink = void 0;
|
|
13
|
+
const api_1 = require("../api/api");
|
|
14
|
+
/**
|
|
15
|
+
* Describes the "Entity Link" concept within Bruce.
|
|
16
|
+
* An entity link is a URL linked to an entity record.
|
|
17
|
+
*/
|
|
18
|
+
var EntityLink;
|
|
19
|
+
(function (EntityLink) {
|
|
20
|
+
function GetCacheKey(id) {
|
|
21
|
+
return api_1.Api.ECacheKey.Link + api_1.Api.ECacheKey.Id + id;
|
|
22
|
+
}
|
|
23
|
+
EntityLink.GetCacheKey = GetCacheKey;
|
|
24
|
+
function GetListCacheKey(entityId) {
|
|
25
|
+
return api_1.Api.ECacheKey.Link + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
|
|
26
|
+
}
|
|
27
|
+
EntityLink.GetListCacheKey = GetListCacheKey;
|
|
28
|
+
function Update(params) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const { api, link: data, req: reqParams } = params;
|
|
31
|
+
if (!(data === null || data === void 0 ? void 0 : data["Entity.ID"])) {
|
|
32
|
+
throw ("Entity ID is required.");
|
|
33
|
+
}
|
|
34
|
+
const url = `entity/${data["Entity.ID"]}/link` + (data.ID == null ? "" : "/" + data.ID);
|
|
35
|
+
const res = yield api.POST(url, data, api_1.Api.PrepReqParams(reqParams));
|
|
36
|
+
api.Cache.Remove(GetCacheKey(data.ID));
|
|
37
|
+
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Link + api_1.Api.ECacheKey.Entity);
|
|
38
|
+
return {
|
|
39
|
+
link: res
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
EntityLink.Update = Update;
|
|
44
|
+
function Delete(params) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const { api, entityId, linkId, req: reqParams } = params;
|
|
47
|
+
if (!linkId) {
|
|
48
|
+
throw ("Link ID is required.");
|
|
49
|
+
}
|
|
50
|
+
yield api.DELETE(`entity/${entityId}/link/${linkId}`, api_1.Api.PrepReqParams(reqParams));
|
|
51
|
+
api.Cache.Remove(GetCacheKey(linkId));
|
|
52
|
+
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Link + api_1.Api.ECacheKey.Entity);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
EntityLink.Delete = Delete;
|
|
56
|
+
function GetListByEntityId(params) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const { api, entityId, req: reqParams } = params;
|
|
59
|
+
if (!entityId) {
|
|
60
|
+
throw ("Entity ID is required.");
|
|
61
|
+
}
|
|
62
|
+
const cacheData = api.GetCacheItem(GetListCacheKey(entityId), reqParams);
|
|
63
|
+
if (cacheData) {
|
|
64
|
+
return cacheData;
|
|
65
|
+
}
|
|
66
|
+
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
try {
|
|
68
|
+
const data = yield api.GET(`entity/${entityId}/links`, api_1.Api.PrepReqParams(reqParams));
|
|
69
|
+
res({
|
|
70
|
+
links: data.Items
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
rej(e);
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
api.Cache.Set(GetListCacheKey(entityId), req);
|
|
78
|
+
return req;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
EntityLink.GetListByEntityId = GetListByEntityId;
|
|
82
|
+
})(EntityLink = exports.EntityLink || (exports.EntityLink = {}));
|
|
83
83
|
//# sourceMappingURL=entity-link.js.map
|