bruce-models 0.7.9 → 0.8.1

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.
Files changed (85) hide show
  1. package/dist/bruce-models.es5.js +107 -21
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +107 -21
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account.js +244 -244
  6. package/dist/lib/ann-document/ann-document.js +116 -116
  7. package/dist/lib/api/abstract-api.js +269 -269
  8. package/dist/lib/api/api.js +85 -85
  9. package/dist/lib/api/bruce-api.js +243 -243
  10. package/dist/lib/api/cam-api.js +132 -132
  11. package/dist/lib/api/global-api.js +131 -131
  12. package/dist/lib/api/idm-api.js +132 -132
  13. package/dist/lib/bruce-models.js +85 -85
  14. package/dist/lib/calculator/calculator.js +159 -159
  15. package/dist/lib/client-file/client-file.js +188 -188
  16. package/dist/lib/common/bounds.js +2 -2
  17. package/dist/lib/common/bruce-event.js +48 -48
  18. package/dist/lib/common/bruce-variable.js +54 -54
  19. package/dist/lib/common/cache.js +86 -86
  20. package/dist/lib/common/camera.js +11 -11
  21. package/dist/lib/common/cartes.js +55 -55
  22. package/dist/lib/common/carto.js +60 -60
  23. package/dist/lib/common/color.js +86 -86
  24. package/dist/lib/common/delay-queue.js +60 -60
  25. package/dist/lib/common/dictionary.js +2 -2
  26. package/dist/lib/common/geometry.js +120 -120
  27. package/dist/lib/common/transform.js +2 -2
  28. package/dist/lib/common/utc.js +39 -39
  29. package/dist/lib/custom-form/custom-form.js +136 -136
  30. package/dist/lib/data-lab/data-lab.js +90 -90
  31. package/dist/lib/entity/entity-attachment-type.js +132 -132
  32. package/dist/lib/entity/entity-attachment.js +208 -208
  33. package/dist/lib/entity/entity-comment.js +132 -132
  34. package/dist/lib/entity/entity-coords.js +181 -181
  35. package/dist/lib/entity/entity-link.js +132 -132
  36. package/dist/lib/entity/entity-lod.js +189 -189
  37. package/dist/lib/entity/entity-relation-type.js +150 -150
  38. package/dist/lib/entity/entity-relation.js +189 -189
  39. package/dist/lib/entity/entity-source.js +176 -176
  40. package/dist/lib/entity/entity-tag.js +229 -229
  41. package/dist/lib/entity/entity-type.js +163 -163
  42. package/dist/lib/entity/entity.js +358 -358
  43. package/dist/lib/entity/getters/batched-data-getter.js +91 -91
  44. package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
  45. package/dist/lib/entity/getters/entity-globe.js +221 -135
  46. package/dist/lib/entity/getters/entity-globe.js.map +1 -1
  47. package/dist/lib/entity/getters/view-monitor.js +2 -2
  48. package/dist/lib/import/import-cad.js +82 -82
  49. package/dist/lib/import/import-csv.js +51 -51
  50. package/dist/lib/import/import-json.js +51 -51
  51. package/dist/lib/import/import-kml.js +51 -51
  52. package/dist/lib/import/imported-file.js +121 -121
  53. package/dist/lib/import/imported-file.js.map +1 -1
  54. package/dist/lib/markup/markup.js +40 -40
  55. package/dist/lib/program-key/program-key.js +152 -152
  56. package/dist/lib/project/menu-item.js +115 -115
  57. package/dist/lib/project/project-view-bookmark.js +183 -183
  58. package/dist/lib/project/project-view-legacy-tile.js +115 -115
  59. package/dist/lib/project/project-view-tile.js +119 -119
  60. package/dist/lib/project/project-view.js +177 -177
  61. package/dist/lib/project/zoom-control.js +17 -17
  62. package/dist/lib/server/message-broker.js +158 -158
  63. package/dist/lib/server/pending-action.js +106 -106
  64. package/dist/lib/server/task.js +113 -113
  65. package/dist/lib/style/style.js +152 -152
  66. package/dist/lib/tileset/tileset-cad.js +2 -2
  67. package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
  68. package/dist/lib/tileset/tileset-entities.js +2 -2
  69. package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
  70. package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
  71. package/dist/lib/tileset/tileset-map-tiles.js +2 -2
  72. package/dist/lib/tileset/tileset-pointcloud.js +2 -2
  73. package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
  74. package/dist/lib/tileset/tileset.js +403 -403
  75. package/dist/lib/user/permission.js +20 -20
  76. package/dist/lib/user/session.js +160 -160
  77. package/dist/lib/user/user-group.js +139 -139
  78. package/dist/lib/user/user.js +451 -451
  79. package/dist/lib/util/encrypt-utils.js +20 -20
  80. package/dist/lib/util/math-utils.js +41 -41
  81. package/dist/lib/util/object-utils.js +17 -17
  82. package/dist/lib/util/path-utils.js +61 -61
  83. package/dist/lib/util/url-utils.js +107 -107
  84. package/dist/types/entity/getters/entity-globe.d.ts +2 -0
  85. package/package.json +1 -1
@@ -1,190 +1,190 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.EntityRelation = void 0;
51
- var api_1 = require("../api/api");
52
- /**
53
- * Describes the "Entity Relationship" concept within Bruce.
54
- * An entity relationship is an arbitrary link between two entity records.
55
- * The relationship can have a "data entity" linked to it as well for the relationship to store arbitrary data about itself.
56
- */
57
- var EntityRelation;
58
- (function (EntityRelation) {
59
- function GetCacheKey(entityA, entityB, typeId) {
60
- return "" + api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + entityA + api_1.Api.ECacheKey.Id + entityB + api_1.Api.ECacheKey.Id + typeId;
61
- }
62
- EntityRelation.GetCacheKey = GetCacheKey;
63
- function GetEntityCacheKey(entityId) {
64
- return api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
65
- }
66
- EntityRelation.GetEntityCacheKey = GetEntityCacheKey;
67
- function GetListCacheKey(entityId, params) {
68
- return api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.RelationType +
69
- api_1.Api.ECacheKey.Id + params.typeId +
70
- api_1.Api.ECacheKey.Id + params.oneWayOnly +
71
- api_1.Api.ECacheKey.Id + params.loadEntityData +
72
- api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
73
- }
74
- EntityRelation.GetListCacheKey = GetListCacheKey;
75
- function Create(api, data) {
76
- return __awaiter(this, void 0, void 0, function () {
77
- var reqData, url;
78
- return __generator(this, function (_a) {
79
- switch (_a.label) {
80
- case 0:
81
- if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
82
- throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
83
- }
84
- reqData = {
85
- "Related.Entity.ID": [data["Related.Entity.ID"]]
86
- };
87
- url = "entity/" + data["Principal.Entity.ID"] + "/relation/" + data["Relation.Type.ID"] + "/add";
88
- return [4 /*yield*/, api.POST(url, reqData, api_1.Api.PrepReqParams())];
89
- case 1:
90
- _a.sent();
91
- api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + data["Principal.Entity.ID"]);
92
- api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + data["Related.Entity.ID"]);
93
- api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.RelationType + api_1.Api.ECacheKey.Id + data["Relation.Type.ID"]);
94
- if (data["Data.Entity.ID"]) {
95
- api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + data["Data.Entity.ID"]);
96
- }
97
- return [2 /*return*/];
98
- }
99
- });
100
- });
101
- }
102
- EntityRelation.Create = Create;
103
- function Update(api, data) {
104
- return __awaiter(this, void 0, void 0, function () {
105
- var url;
106
- return __generator(this, function (_a) {
107
- switch (_a.label) {
108
- case 0:
109
- if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
110
- throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
111
- }
112
- url = "entity/" + data["Principal.Entity.ID"] + "/otherEntityID/" + data["Related.Entity.ID"] + "/relation/" + data["Relation.Type.ID"] + "/update";
113
- return [4 /*yield*/, api.POST(url, data, api_1.Api.PrepReqParams())];
114
- case 1:
115
- data = _a.sent();
116
- api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + data["Principal.Entity.ID"]);
117
- api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + data["Related.Entity.ID"]);
118
- api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.RelationType + api_1.Api.ECacheKey.Id + data["Relation.Type.ID"]);
119
- if (data["Data.Entity.ID"]) {
120
- api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + data["Data.Entity.ID"]);
121
- }
122
- return [2 /*return*/, data];
123
- }
124
- });
125
- });
126
- }
127
- EntityRelation.Update = Update;
128
- function GetList(api, entityId, params) {
129
- return __awaiter(this, void 0, void 0, function () {
130
- var cacheData, req;
131
- var _this = this;
132
- return __generator(this, function (_a) {
133
- if (!entityId) {
134
- throw ("Entity ID is required.");
135
- }
136
- params = __assign({ typeId: "", oneWayOnly: false, loadEntityData: false }, params);
137
- cacheData = api.Cache.Get(GetListCacheKey(entityId, params));
138
- if (cacheData) {
139
- return [2 /*return*/, cacheData];
140
- }
141
- req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
142
- var url, data, e_1;
143
- return __generator(this, function (_a) {
144
- switch (_a.label) {
145
- case 0:
146
- _a.trys.push([0, 2, , 3]);
147
- url = "entity/" + entityId + "/relations";
148
- if (params.typeId) {
149
- url += "/" + params.typeId;
150
- }
151
- url += "?Oneway=" + params.oneWayOnly + "&LoadInfo=" + params.loadEntityData;
152
- return [4 /*yield*/, api.GET(url, api_1.Api.PrepReqParams())];
153
- case 1:
154
- data = _a.sent();
155
- res(data.Items);
156
- return [3 /*break*/, 3];
157
- case 2:
158
- e_1 = _a.sent();
159
- rej(e_1);
160
- return [3 /*break*/, 3];
161
- case 3: return [2 /*return*/];
162
- }
163
- });
164
- }); });
165
- api.Cache.Set(GetListCacheKey(entityId, params), req);
166
- return [2 /*return*/, req];
167
- });
168
- });
169
- }
170
- EntityRelation.GetList = GetList;
171
- function GetByDataEntityId(api, entityId) {
172
- return __awaiter(this, void 0, void 0, function () {
173
- var cacheData, req;
174
- return __generator(this, function (_a) {
175
- if (!entityId) {
176
- throw ("Entity ID is required.");
177
- }
178
- cacheData = api.Cache.Get(GetEntityCacheKey(entityId));
179
- if (cacheData) {
180
- return [2 /*return*/, cacheData];
181
- }
182
- req = api.GET("entity/relation/" + entityId + "/dataentity", api_1.Api.PrepReqParams());
183
- api.Cache.Set(GetEntityCacheKey(entityId), req);
184
- return [2 /*return*/, req];
185
- });
186
- });
187
- }
188
- EntityRelation.GetByDataEntityId = GetByDataEntityId;
189
- })(EntityRelation = exports.EntityRelation || (exports.EntityRelation = {}));
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.EntityRelation = void 0;
51
+ var api_1 = require("../api/api");
52
+ /**
53
+ * Describes the "Entity Relationship" concept within Bruce.
54
+ * An entity relationship is an arbitrary link between two entity records.
55
+ * The relationship can have a "data entity" linked to it as well for the relationship to store arbitrary data about itself.
56
+ */
57
+ var EntityRelation;
58
+ (function (EntityRelation) {
59
+ function GetCacheKey(entityA, entityB, typeId) {
60
+ return "" + api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + entityA + api_1.Api.ECacheKey.Id + entityB + api_1.Api.ECacheKey.Id + typeId;
61
+ }
62
+ EntityRelation.GetCacheKey = GetCacheKey;
63
+ function GetEntityCacheKey(entityId) {
64
+ return api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
65
+ }
66
+ EntityRelation.GetEntityCacheKey = GetEntityCacheKey;
67
+ function GetListCacheKey(entityId, params) {
68
+ return api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.RelationType +
69
+ api_1.Api.ECacheKey.Id + params.typeId +
70
+ api_1.Api.ECacheKey.Id + params.oneWayOnly +
71
+ api_1.Api.ECacheKey.Id + params.loadEntityData +
72
+ api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + entityId;
73
+ }
74
+ EntityRelation.GetListCacheKey = GetListCacheKey;
75
+ function Create(api, data) {
76
+ return __awaiter(this, void 0, void 0, function () {
77
+ var reqData, url;
78
+ return __generator(this, function (_a) {
79
+ switch (_a.label) {
80
+ case 0:
81
+ if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
82
+ throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
83
+ }
84
+ reqData = {
85
+ "Related.Entity.ID": [data["Related.Entity.ID"]]
86
+ };
87
+ url = "entity/" + data["Principal.Entity.ID"] + "/relation/" + data["Relation.Type.ID"] + "/add";
88
+ return [4 /*yield*/, api.POST(url, reqData, api_1.Api.PrepReqParams())];
89
+ case 1:
90
+ _a.sent();
91
+ api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + data["Principal.Entity.ID"]);
92
+ api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + data["Related.Entity.ID"]);
93
+ api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.RelationType + api_1.Api.ECacheKey.Id + data["Relation.Type.ID"]);
94
+ if (data["Data.Entity.ID"]) {
95
+ api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + data["Data.Entity.ID"]);
96
+ }
97
+ return [2 /*return*/];
98
+ }
99
+ });
100
+ });
101
+ }
102
+ EntityRelation.Create = Create;
103
+ function Update(api, data) {
104
+ return __awaiter(this, void 0, void 0, function () {
105
+ var url;
106
+ return __generator(this, function (_a) {
107
+ switch (_a.label) {
108
+ case 0:
109
+ if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
110
+ throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
111
+ }
112
+ url = "entity/" + data["Principal.Entity.ID"] + "/otherEntityID/" + data["Related.Entity.ID"] + "/relation/" + data["Relation.Type.ID"] + "/update";
113
+ return [4 /*yield*/, api.POST(url, data, api_1.Api.PrepReqParams())];
114
+ case 1:
115
+ data = _a.sent();
116
+ api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + data["Principal.Entity.ID"]);
117
+ api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Id + data["Related.Entity.ID"]);
118
+ api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.RelationType + api_1.Api.ECacheKey.Id + data["Relation.Type.ID"]);
119
+ if (data["Data.Entity.ID"]) {
120
+ api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.Relation + api_1.Api.ECacheKey.Entity + api_1.Api.ECacheKey.Id + data["Data.Entity.ID"]);
121
+ }
122
+ return [2 /*return*/, data];
123
+ }
124
+ });
125
+ });
126
+ }
127
+ EntityRelation.Update = Update;
128
+ function GetList(api, entityId, params) {
129
+ return __awaiter(this, void 0, void 0, function () {
130
+ var cacheData, req;
131
+ var _this = this;
132
+ return __generator(this, function (_a) {
133
+ if (!entityId) {
134
+ throw ("Entity ID is required.");
135
+ }
136
+ params = __assign({ typeId: "", oneWayOnly: false, loadEntityData: false }, params);
137
+ cacheData = api.Cache.Get(GetListCacheKey(entityId, params));
138
+ if (cacheData) {
139
+ return [2 /*return*/, cacheData];
140
+ }
141
+ req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
142
+ var url, data, e_1;
143
+ return __generator(this, function (_a) {
144
+ switch (_a.label) {
145
+ case 0:
146
+ _a.trys.push([0, 2, , 3]);
147
+ url = "entity/" + entityId + "/relations";
148
+ if (params.typeId) {
149
+ url += "/" + params.typeId;
150
+ }
151
+ url += "?Oneway=" + params.oneWayOnly + "&LoadInfo=" + params.loadEntityData;
152
+ return [4 /*yield*/, api.GET(url, api_1.Api.PrepReqParams())];
153
+ case 1:
154
+ data = _a.sent();
155
+ res(data.Items);
156
+ return [3 /*break*/, 3];
157
+ case 2:
158
+ e_1 = _a.sent();
159
+ rej(e_1);
160
+ return [3 /*break*/, 3];
161
+ case 3: return [2 /*return*/];
162
+ }
163
+ });
164
+ }); });
165
+ api.Cache.Set(GetListCacheKey(entityId, params), req);
166
+ return [2 /*return*/, req];
167
+ });
168
+ });
169
+ }
170
+ EntityRelation.GetList = GetList;
171
+ function GetByDataEntityId(api, entityId) {
172
+ return __awaiter(this, void 0, void 0, function () {
173
+ var cacheData, req;
174
+ return __generator(this, function (_a) {
175
+ if (!entityId) {
176
+ throw ("Entity ID is required.");
177
+ }
178
+ cacheData = api.Cache.Get(GetEntityCacheKey(entityId));
179
+ if (cacheData) {
180
+ return [2 /*return*/, cacheData];
181
+ }
182
+ req = api.GET("entity/relation/" + entityId + "/dataentity", api_1.Api.PrepReqParams());
183
+ api.Cache.Set(GetEntityCacheKey(entityId), req);
184
+ return [2 /*return*/, req];
185
+ });
186
+ });
187
+ }
188
+ EntityRelation.GetByDataEntityId = GetByDataEntityId;
189
+ })(EntityRelation = exports.EntityRelation || (exports.EntityRelation = {}));
190
190
  //# sourceMappingURL=entity-relation.js.map