bruce-models 2.4.6 → 2.4.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.
Files changed (129) hide show
  1. package/dist/bruce-models.es5.js +963 -405
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +945 -388
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account-invite.js +17 -4
  6. package/dist/lib/account/account-invite.js.map +1 -1
  7. package/dist/lib/account/account.js +20 -4
  8. package/dist/lib/account/account.js.map +1 -1
  9. package/dist/lib/ann-document/ann-document.js +8 -1
  10. package/dist/lib/ann-document/ann-document.js.map +1 -1
  11. package/dist/lib/api/api-getters.js +19 -0
  12. package/dist/lib/api/api-getters.js.map +1 -1
  13. package/dist/lib/api/bruce-api.js.map +1 -1
  14. package/dist/lib/bruce-models.js +1 -0
  15. package/dist/lib/bruce-models.js.map +1 -1
  16. package/dist/lib/client-file/client-file.js +34 -6
  17. package/dist/lib/client-file/client-file.js.map +1 -1
  18. package/dist/lib/custom-form/custom-form.js +17 -4
  19. package/dist/lib/custom-form/custom-form.js.map +1 -1
  20. package/dist/lib/data-lab/data-lab.js +4 -0
  21. package/dist/lib/data-lab/data-lab.js.map +1 -1
  22. package/dist/lib/entity/entity-attachment-type.js +13 -3
  23. package/dist/lib/entity/entity-attachment-type.js.map +1 -1
  24. package/dist/lib/entity/entity-attachment.js +21 -5
  25. package/dist/lib/entity/entity-attachment.js.map +1 -1
  26. package/dist/lib/entity/entity-comment.js +13 -3
  27. package/dist/lib/entity/entity-comment.js.map +1 -1
  28. package/dist/lib/entity/entity-coords.js +21 -5
  29. package/dist/lib/entity/entity-coords.js.map +1 -1
  30. package/dist/lib/entity/entity-link.js +13 -3
  31. package/dist/lib/entity/entity-link.js.map +1 -1
  32. package/dist/lib/entity/entity-lod-category.js +17 -4
  33. package/dist/lib/entity/entity-lod-category.js.map +1 -1
  34. package/dist/lib/entity/entity-lod.js +26 -4
  35. package/dist/lib/entity/entity-lod.js.map +1 -1
  36. package/dist/lib/entity/entity-relation-type.js +17 -4
  37. package/dist/lib/entity/entity-relation-type.js.map +1 -1
  38. package/dist/lib/entity/entity-relation.js +20 -4
  39. package/dist/lib/entity/entity-relation.js.map +1 -1
  40. package/dist/lib/entity/entity-source.js +19 -6
  41. package/dist/lib/entity/entity-source.js.map +1 -1
  42. package/dist/lib/entity/entity-tag.js +21 -5
  43. package/dist/lib/entity/entity-tag.js.map +1 -1
  44. package/dist/lib/entity/entity-type.js +16 -3
  45. package/dist/lib/entity/entity-type.js.map +1 -1
  46. package/dist/lib/entity/entity.js +25 -6
  47. package/dist/lib/entity/entity.js.map +1 -1
  48. package/dist/lib/environment.js +55 -0
  49. package/dist/lib/environment.js.map +1 -0
  50. package/dist/lib/import/import-cad.js +9 -2
  51. package/dist/lib/import/import-cad.js.map +1 -1
  52. package/dist/lib/import/import-csv.js +5 -1
  53. package/dist/lib/import/import-csv.js.map +1 -1
  54. package/dist/lib/import/import-json.js +5 -1
  55. package/dist/lib/import/import-json.js.map +1 -1
  56. package/dist/lib/import/import-kml.js +5 -1
  57. package/dist/lib/import/import-kml.js.map +1 -1
  58. package/dist/lib/import/imported-file.js +12 -2
  59. package/dist/lib/import/imported-file.js.map +1 -1
  60. package/dist/lib/internal/uploader.js +5 -1
  61. package/dist/lib/internal/uploader.js.map +1 -1
  62. package/dist/lib/plugin/plugin.js +12 -2
  63. package/dist/lib/plugin/plugin.js.map +1 -1
  64. package/dist/lib/program-key/program-key.js +17 -4
  65. package/dist/lib/program-key/program-key.js.map +1 -1
  66. package/dist/lib/project/project-view-bookmark.js +21 -5
  67. package/dist/lib/project/project-view-bookmark.js.map +1 -1
  68. package/dist/lib/project/project-view-legacy-tile.js +9 -2
  69. package/dist/lib/project/project-view-legacy-tile.js.map +1 -1
  70. package/dist/lib/project/project-view.js +16 -3
  71. package/dist/lib/project/project-view.js.map +1 -1
  72. package/dist/lib/server/hosting-location.js +22 -5
  73. package/dist/lib/server/hosting-location.js.map +1 -1
  74. package/dist/lib/server/pending-action.js +12 -2
  75. package/dist/lib/server/pending-action.js.map +1 -1
  76. package/dist/lib/server/task.js +9 -2
  77. package/dist/lib/server/task.js.map +1 -1
  78. package/dist/lib/style/style.js +17 -4
  79. package/dist/lib/style/style.js.map +1 -1
  80. package/dist/lib/tileset/tileset.js +61 -10
  81. package/dist/lib/tileset/tileset.js.map +1 -1
  82. package/dist/lib/user/session.js +13 -3
  83. package/dist/lib/user/session.js.map +1 -1
  84. package/dist/lib/user/user-group.js +25 -6
  85. package/dist/lib/user/user-group.js.map +1 -1
  86. package/dist/lib/user/user.js +58 -12
  87. package/dist/lib/user/user.js.map +1 -1
  88. package/dist/types/account/account-invite.d.ts +5 -4
  89. package/dist/types/account/account.d.ts +5 -5
  90. package/dist/types/ann-document/ann-document.d.ts +3 -3
  91. package/dist/types/api/api-getters.d.ts +1 -0
  92. package/dist/types/bruce-models.d.ts +1 -0
  93. package/dist/types/client-file/client-file.d.ts +10 -10
  94. package/dist/types/custom-form/custom-form.d.ts +4 -4
  95. package/dist/types/data-lab/data-lab.d.ts +1 -1
  96. package/dist/types/entity/entity-attachment-type.d.ts +3 -3
  97. package/dist/types/entity/entity-attachment.d.ts +6 -6
  98. package/dist/types/entity/entity-comment.d.ts +5 -4
  99. package/dist/types/entity/entity-coords.d.ts +5 -5
  100. package/dist/types/entity/entity-link.d.ts +4 -4
  101. package/dist/types/entity/entity-lod-category.d.ts +4 -4
  102. package/dist/types/entity/entity-lod.d.ts +7 -7
  103. package/dist/types/entity/entity-relation-type.d.ts +4 -4
  104. package/dist/types/entity/entity-relation.d.ts +5 -5
  105. package/dist/types/entity/entity-source.d.ts +6 -5
  106. package/dist/types/entity/entity-tag.d.ts +5 -5
  107. package/dist/types/entity/entity-type.d.ts +4 -4
  108. package/dist/types/entity/entity.d.ts +6 -6
  109. package/dist/types/environment.d.ts +16 -0
  110. package/dist/types/import/import-cad.d.ts +2 -2
  111. package/dist/types/import/import-csv.d.ts +1 -1
  112. package/dist/types/import/import-json.d.ts +1 -1
  113. package/dist/types/import/import-kml.d.ts +1 -1
  114. package/dist/types/import/imported-file.d.ts +3 -3
  115. package/dist/types/internal/uploader.d.ts +1 -1
  116. package/dist/types/plugin/plugin.d.ts +3 -3
  117. package/dist/types/program-key/program-key.d.ts +4 -4
  118. package/dist/types/project/project-view-bookmark.d.ts +7 -6
  119. package/dist/types/project/project-view-legacy-tile.d.ts +2 -2
  120. package/dist/types/project/project-view.d.ts +4 -4
  121. package/dist/types/server/hosting-location.d.ts +5 -5
  122. package/dist/types/server/pending-action.d.ts +5 -4
  123. package/dist/types/server/task.d.ts +4 -3
  124. package/dist/types/style/style.d.ts +6 -5
  125. package/dist/types/tileset/tileset.d.ts +18 -17
  126. package/dist/types/user/session.d.ts +4 -3
  127. package/dist/types/user/user-group.d.ts +10 -7
  128. package/dist/types/user/user.d.ts +16 -15
  129. package/package.json +1 -1
@@ -113,214 +113,6 @@ var Api;
113
113
  Api.PrepReqParams = PrepReqParams;
114
114
  })(Api || (Api = {}));
115
115
 
116
- /**
117
- * Describes communication with the "Annotated Document" concept in Bruce.
118
- * Annotated documents are files with hotspots that can link to Entity records.
119
- */
120
- var AnnDocument;
121
- (function (AnnDocument) {
122
- function GetCacheKey(id) {
123
- return `${Api.ECacheKey.AnnDocument}${Api.ECacheKey.Id}${id}`;
124
- }
125
- AnnDocument.GetCacheKey = GetCacheKey;
126
- function GetListCacheKey(type) {
127
- return Api.ECacheKey.AnnDocument + type;
128
- }
129
- AnnDocument.GetListCacheKey = GetListCacheKey;
130
- let EType;
131
- (function (EType) {
132
- EType["SVG"] = "SVG";
133
- })(EType = AnnDocument.EType || (AnnDocument.EType = {}));
134
- function Get(params) {
135
- return __awaiter(this, void 0, void 0, function* () {
136
- const { api, docId, req: reqParams } = params;
137
- if (!docId) {
138
- throw ("Doc ID is required.");
139
- }
140
- const key = GetCacheKey(docId);
141
- const cache = yield api.GetCacheItem(key, reqParams);
142
- if (cache === null || cache === void 0 ? void 0 : cache.found) {
143
- return cache.data;
144
- }
145
- const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
146
- try {
147
- const data = yield api.GET(`documentView/${docId}`, Api.PrepReqParams(reqParams));
148
- res({
149
- document: data
150
- });
151
- }
152
- catch (e) {
153
- rej(e);
154
- }
155
- }));
156
- yield api.SetCacheItem({
157
- key,
158
- value: prom,
159
- req: reqParams
160
- });
161
- return prom;
162
- });
163
- }
164
- AnnDocument.Get = Get;
165
- function GetList(params) {
166
- return __awaiter(this, void 0, void 0, function* () {
167
- let { api, docType: type, req: reqParams } = params;
168
- if (!type) {
169
- type = "";
170
- }
171
- const cache = yield api.GetCacheItem(GetListCacheKey(type), reqParams);
172
- if (cache === null || cache === void 0 ? void 0 : cache.found) {
173
- return cache.data;
174
- }
175
- const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
176
- try {
177
- const url = "documentViews" + (type ? "?type=" + type : "");
178
- const data = yield api.GET(url, Api.PrepReqParams(reqParams));
179
- res({
180
- documents: data.Items
181
- });
182
- }
183
- catch (e) {
184
- rej(e);
185
- }
186
- }));
187
- yield api.SetCacheItem({
188
- key: GetListCacheKey(type),
189
- value: req,
190
- req: reqParams
191
- });
192
- return req;
193
- });
194
- }
195
- AnnDocument.GetList = GetList;
196
- })(AnnDocument || (AnnDocument = {}));
197
-
198
- /**
199
- * Describes the "Custom Form" concept within Bruce.
200
- * Custom forms are dynamic dialogs that get populated with Entity data.
201
- */
202
- var CustomForm;
203
- (function (CustomForm) {
204
- function GetCacheKey(id) {
205
- return Api.ECacheKey.CustomForm + Api.ECacheKey.Id + id;
206
- }
207
- CustomForm.GetCacheKey = GetCacheKey;
208
- function GetListCacheKey(typeId) {
209
- if (typeId) {
210
- return Api.ECacheKey.CustomForm + Api.ECacheKey.EntityType + Api.ECacheKey.Id + typeId;
211
- }
212
- return Api.ECacheKey.CustomForm;
213
- }
214
- CustomForm.GetListCacheKey = GetListCacheKey;
215
- let EType;
216
- (function (EType) {
217
- EType["Form"] = "GENERIC";
218
- EType["Markup"] = "MARKUP";
219
- })(EType = CustomForm.EType || (CustomForm.EType = {}));
220
- function Get(params) {
221
- return __awaiter(this, void 0, void 0, function* () {
222
- const { api, formId: id, req: reqParams } = params;
223
- if (!id) {
224
- throw ("Id is required.");
225
- }
226
- const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
227
- if (cache === null || cache === void 0 ? void 0 : cache.found) {
228
- return cache.data;
229
- }
230
- const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
231
- try {
232
- const data = yield api.GET(`customForm/${id}`, Api.PrepReqParams(reqParams));
233
- res({
234
- form: data
235
- });
236
- }
237
- catch (err) {
238
- rej(err);
239
- }
240
- }));
241
- yield api.SetCacheItem({
242
- key: GetCacheKey(id),
243
- value: prom,
244
- req: reqParams
245
- });
246
- return prom;
247
- });
248
- }
249
- CustomForm.Get = Get;
250
- function Delete(params) {
251
- return __awaiter(this, void 0, void 0, function* () {
252
- const { api, formId: id, req: reqParams } = params;
253
- if (!id) {
254
- throw ("Id is required.");
255
- }
256
- yield api.DELETE(`customForm/${id}`, Api.PrepReqParams(reqParams));
257
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
258
- });
259
- }
260
- CustomForm.Delete = Delete;
261
- function GetList(params) {
262
- return __awaiter(this, void 0, void 0, function* () {
263
- const { api, entityTypeId: typeId, req: reqParams } = params;
264
- const url = typeId ? `entityType/${typeId}/customForms` : "customForms";
265
- const cache = yield api.GetCacheItem(GetListCacheKey(typeId), reqParams);
266
- if (cache === null || cache === void 0 ? void 0 : cache.found) {
267
- return cache.data;
268
- }
269
- const req = api.GET(url, Api.PrepReqParams(reqParams));
270
- const prom = req.then((data) => {
271
- return {
272
- forms: data.Items
273
- };
274
- });
275
- yield api.SetCacheItem({
276
- key: GetListCacheKey(typeId),
277
- value: prom,
278
- req: reqParams
279
- });
280
- return prom;
281
- });
282
- }
283
- CustomForm.GetList = GetList;
284
- function Update(params) {
285
- return __awaiter(this, void 0, void 0, function* () {
286
- const { api, form: data, reqParams } = params;
287
- if (!data.ID) {
288
- data.ID = 0;
289
- }
290
- const res = yield api.POST(`customForm/${data.ID}`, data, Api.PrepReqParams(reqParams));
291
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
292
- return {
293
- form: res
294
- };
295
- });
296
- }
297
- CustomForm.Update = Update;
298
- })(CustomForm || (CustomForm = {}));
299
-
300
- /**
301
- * Describes content of a GENERIC type custom form.
302
- * The alternative type is MARKUP (Markup.IMarkup).
303
- */
304
- var CustomFormContent;
305
- (function (CustomFormContent) {
306
- let ECellType;
307
- (function (ECellType) {
308
- ECellType[ECellType["StaticText"] = 0] = "StaticText";
309
- ECellType[ECellType["DataValue"] = 1] = "DataValue";
310
- ECellType[ECellType["StaticPicture"] = 2] = "StaticPicture";
311
- ECellType[ECellType["SubSection"] = 3] = "SubSection";
312
- ECellType[ECellType["ButtonMore"] = 4] = "ButtonMore";
313
- ECellType[ECellType["EntityPhoto"] = 5] = "EntityPhoto";
314
- ECellType[ECellType["EmbeddedMedia"] = 6] = "EmbeddedMedia";
315
- ECellType[ECellType["Chart"] = 7] = "Chart";
316
- })(ECellType = CustomFormContent.ECellType || (CustomFormContent.ECellType = {}));
317
- let EFlowDirection;
318
- (function (EFlowDirection) {
319
- EFlowDirection["Vertically"] = "v";
320
- EFlowDirection["Horizontally"] = "h";
321
- })(EFlowDirection = CustomFormContent.EFlowDirection || (CustomFormContent.EFlowDirection = {}));
322
- })(CustomFormContent || (CustomFormContent = {}));
323
-
324
116
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
325
117
 
326
118
  function commonjsRequire () {
@@ -3818,7 +3610,10 @@ var Account;
3818
3610
  })(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
3819
3611
  function Get(params) {
3820
3612
  return __awaiter(this, void 0, void 0, function* () {
3821
- const { api, accountId: id, req: reqParams } = params;
3613
+ let { api, accountId: id, req: reqParams } = params;
3614
+ if (!api) {
3615
+ api = ENVIRONMENT.Api().GetGuardianApi();
3616
+ }
3822
3617
  const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
3823
3618
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
3824
3619
  return cache.data;
@@ -3838,7 +3633,10 @@ var Account;
3838
3633
  Account.Get = Get;
3839
3634
  function GetRelatedList(params) {
3840
3635
  return __awaiter(this, void 0, void 0, function* () {
3841
- const { api, req: reqParams } = params;
3636
+ let { api, req: reqParams } = params;
3637
+ if (!api) {
3638
+ api = ENVIRONMENT.Api().GetGuardianApi();
3639
+ }
3842
3640
  const cache = yield api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
3843
3641
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
3844
3642
  return cache.data;
@@ -3867,7 +3665,10 @@ var Account;
3867
3665
  Account.GetRelatedList = GetRelatedList;
3868
3666
  function GetAppSettings(params) {
3869
3667
  return __awaiter(this, void 0, void 0, function* () {
3870
- const { api, accountId: id, appId, req: reqParams } = params;
3668
+ let { api, accountId: id, appId, req: reqParams } = params;
3669
+ if (!api) {
3670
+ api = ENVIRONMENT.Api().GetGuardianApi();
3671
+ }
3871
3672
  const cache = yield api.GetCacheItem(GetCacheKey(id, appId), reqParams);
3872
3673
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
3873
3674
  return cache.data;
@@ -3902,7 +3703,10 @@ var Account;
3902
3703
  */
3903
3704
  function UpdateAppSettings(params) {
3904
3705
  return __awaiter(this, void 0, void 0, function* () {
3905
- const { api, accountId: id, appId, settings: data, req: reqParams } = params;
3706
+ let { api, accountId: id, appId, settings: data, req: reqParams } = params;
3707
+ if (!api) {
3708
+ api = ENVIRONMENT.Api().GetGuardianApi();
3709
+ }
3906
3710
  const res = yield api.POST(`account/${id}/applicationSettings/${appId}`, data, reqParams);
3907
3711
  yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Account + Api.ECacheKey.Id + id);
3908
3712
  return {
@@ -3919,6 +3723,9 @@ var Account;
3919
3723
  function Create(params) {
3920
3724
  return __awaiter(this, void 0, void 0, function* () {
3921
3725
  let { api, accountId: id, name, hostingLocationKey, starterContent, req: reqParams } = params;
3726
+ if (!api) {
3727
+ api = ENVIRONMENT.Api().GetBruceApi();
3728
+ }
3922
3729
  if (!id || !name || !hostingLocationKey) {
3923
3730
  throw new Error("Id, Name and hostingLocationKey are required.");
3924
3731
  }
@@ -3954,7 +3761,11 @@ var HostingLocation;
3954
3761
  */
3955
3762
  function GetList(params) {
3956
3763
  return __awaiter(this, void 0, void 0, function* () {
3957
- const res = yield params.api.GET("hostinglocations", Api.PrepReqParams(params.req));
3764
+ let { api, req } = params;
3765
+ if (!api) {
3766
+ api = ENVIRONMENT.Api().GetGuardianApi();
3767
+ }
3768
+ const res = yield api.GET("hostinglocations", Api.PrepReqParams(req));
3958
3769
  return {
3959
3770
  locations: res.Items
3960
3771
  };
@@ -3963,7 +3774,10 @@ var HostingLocation;
3963
3774
  HostingLocation.GetList = GetList;
3964
3775
  function GetById(params) {
3965
3776
  return __awaiter(this, void 0, void 0, function* () {
3966
- const { id, api, req } = params;
3777
+ let { id, api, req } = params;
3778
+ if (!api) {
3779
+ api = ENVIRONMENT.Api().GetGuardianApi();
3780
+ }
3967
3781
  if (!id) {
3968
3782
  throw ("Invalid id");
3969
3783
  }
@@ -3976,7 +3790,10 @@ var HostingLocation;
3976
3790
  HostingLocation.GetById = GetById;
3977
3791
  function GetByKey(params) {
3978
3792
  return __awaiter(this, void 0, void 0, function* () {
3979
- const { key, api, req } = params;
3793
+ let { key, api, req } = params;
3794
+ if (!api) {
3795
+ api = ENVIRONMENT.Api().GetGuardianApi();
3796
+ }
3980
3797
  if (!key) {
3981
3798
  throw ("Invalid key");
3982
3799
  }
@@ -4033,7 +3850,10 @@ var HostingLocation;
4033
3850
  HostingLocation.GuessKey = GuessKey;
4034
3851
  function GetKeyByAccountId(params) {
4035
3852
  return __awaiter(this, void 0, void 0, function* () {
4036
- const { accountId, apiSettings, api, req } = params;
3853
+ let { accountId, apiSettings, api, req } = params;
3854
+ if (!api) {
3855
+ api = ENVIRONMENT.Api().GetGuardianApi();
3856
+ }
4037
3857
  if (!accountId && !apiSettings) {
4038
3858
  throw ("Invalid accountId or apiSettings");
4039
3859
  }
@@ -4063,7 +3883,10 @@ var HostingLocation;
4063
3883
  HostingLocation.GetKeyByAccountId = GetKeyByAccountId;
4064
3884
  function GetByAccountId(params) {
4065
3885
  return __awaiter(this, void 0, void 0, function* () {
4066
- const { accountId, apiSettings, api, req } = params;
3886
+ let { accountId, apiSettings, api, req } = params;
3887
+ if (!api) {
3888
+ api = ENVIRONMENT.Api().GetGuardianApi();
3889
+ }
4067
3890
  const data = yield GetKeyByAccountId({
4068
3891
  accountId,
4069
3892
  apiSettings,
@@ -4369,48 +4192,40 @@ var CamApi;
4369
4192
  CamApi.Api = Api$$1;
4370
4193
  })(CamApi || (CamApi = {}));
4371
4194
 
4372
- /**
4373
- * * @deprecated Please use GuardianApi instead.
4374
- */
4375
- var IdmApi;
4376
- (function (IdmApi) {
4195
+ var GlobalApi;
4196
+ (function (GlobalApi) {
4377
4197
  /**
4378
- * This is the request handler for Idm Api,
4198
+ * This is the request handler for Global Api,
4379
4199
  * it should be passed to any method that wants to communicate with this particular api.
4380
4200
  */
4381
4201
  class Api$$1 extends AbstractApi {
4382
4202
  constructor(params) {
4383
4203
  super({
4384
- ssidHeader: "SSID",
4385
- cacheId: `IDM_API_${params === null || params === void 0 ? void 0 : params.env}_`
4204
+ ssidHeader: "x-sessionid",
4205
+ cacheId: `GLOBAL_API_${params === null || params === void 0 ? void 0 : params.env}_`
4386
4206
  });
4387
4207
  this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : Api.EEnv.PROD;
4388
4208
  this.setBaseUrl();
4389
4209
  }
4390
4210
  setBaseUrl() {
4391
- let codeWord = "idm";
4392
- let url = "https://<CODEWORD>.nextspace";
4211
+ let url;
4393
4212
  const env = this.env.toUpperCase();
4394
4213
  switch (env) {
4395
4214
  case Api.EEnv.DEV:
4396
- codeWord = "guardian";
4397
- url += "-dev.net/";
4215
+ url = "https://bruceglobal.nextspace-dev.net/";
4398
4216
  break;
4399
4217
  case Api.EEnv.STG:
4400
- codeWord = "guardian";
4401
- url += "-stg.net/";
4218
+ url = "https://bruceglobal.nextspace-stg.net/";
4402
4219
  break;
4403
4220
  case Api.EEnv.UAT:
4404
- codeWord = "guardian";
4405
- url += "-uat.net/";
4221
+ url = "https://bruceglobal.api.nextspace-uat.net/";
4406
4222
  break;
4407
4223
  case Api.EEnv.PROD:
4408
- url += ".host/";
4224
+ url = "https://bruceglobal.api.nextspace.host/";
4409
4225
  break;
4410
4226
  default:
4411
4227
  throw ("Specified Environment is not valid. SuppliedEnv=" + env);
4412
4228
  }
4413
- url = url.replace("<CODEWORD>", codeWord);
4414
4229
  this.baseUrl = url;
4415
4230
  }
4416
4231
  GetBaseUrl() {
@@ -4443,43 +4258,51 @@ var IdmApi;
4443
4258
  });
4444
4259
  }
4445
4260
  }
4446
- IdmApi.Api = Api$$1;
4447
- })(IdmApi || (IdmApi = {}));
4261
+ GlobalApi.Api = Api$$1;
4262
+ })(GlobalApi || (GlobalApi = {}));
4448
4263
 
4449
- var GlobalApi;
4450
- (function (GlobalApi) {
4264
+ /**
4265
+ * * @deprecated Please use GuardianApi instead.
4266
+ */
4267
+ var IdmApi;
4268
+ (function (IdmApi) {
4451
4269
  /**
4452
- * This is the request handler for Global Api,
4270
+ * This is the request handler for Idm Api,
4453
4271
  * it should be passed to any method that wants to communicate with this particular api.
4454
4272
  */
4455
4273
  class Api$$1 extends AbstractApi {
4456
4274
  constructor(params) {
4457
4275
  super({
4458
- ssidHeader: "x-sessionid",
4459
- cacheId: `GLOBAL_API_${params === null || params === void 0 ? void 0 : params.env}_`
4276
+ ssidHeader: "SSID",
4277
+ cacheId: `IDM_API_${params === null || params === void 0 ? void 0 : params.env}_`
4460
4278
  });
4461
4279
  this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : Api.EEnv.PROD;
4462
4280
  this.setBaseUrl();
4463
4281
  }
4464
4282
  setBaseUrl() {
4465
- let url;
4283
+ let codeWord = "idm";
4284
+ let url = "https://<CODEWORD>.nextspace";
4466
4285
  const env = this.env.toUpperCase();
4467
4286
  switch (env) {
4468
4287
  case Api.EEnv.DEV:
4469
- url = "https://bruceglobal.nextspace-dev.net/";
4288
+ codeWord = "guardian";
4289
+ url += "-dev.net/";
4470
4290
  break;
4471
4291
  case Api.EEnv.STG:
4472
- url = "https://bruceglobal.nextspace-stg.net/";
4292
+ codeWord = "guardian";
4293
+ url += "-stg.net/";
4473
4294
  break;
4474
4295
  case Api.EEnv.UAT:
4475
- url = "https://bruceglobal.api.nextspace-uat.net/";
4296
+ codeWord = "guardian";
4297
+ url += "-uat.net/";
4476
4298
  break;
4477
4299
  case Api.EEnv.PROD:
4478
- url = "https://bruceglobal.api.nextspace.host/";
4300
+ url += ".host/";
4479
4301
  break;
4480
4302
  default:
4481
4303
  throw ("Specified Environment is not valid. SuppliedEnv=" + env);
4482
4304
  }
4305
+ url = url.replace("<CODEWORD>", codeWord);
4483
4306
  this.baseUrl = url;
4484
4307
  }
4485
4308
  GetBaseUrl() {
@@ -4512,8 +4335,8 @@ var GlobalApi;
4512
4335
  });
4513
4336
  }
4514
4337
  }
4515
- GlobalApi.Api = Api$$1;
4516
- })(GlobalApi || (GlobalApi = {}));
4338
+ IdmApi.Api = Api$$1;
4339
+ })(IdmApi || (IdmApi = {}));
4517
4340
 
4518
4341
  class ApiGetters {
4519
4342
  constructor(params) {
@@ -4526,6 +4349,24 @@ class ApiGetters {
4526
4349
  this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : Api.EEnv.PROD;
4527
4350
  this.sessionId = params === null || params === void 0 ? void 0 : params.sessionId;
4528
4351
  }
4352
+ ClearCache() {
4353
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
4354
+ for (const key in this.bruce) {
4355
+ (_b = (_a = this.bruce[key]) === null || _a === void 0 ? void 0 : _a.Cache) === null || _b === void 0 ? void 0 : _b.Clear();
4356
+ }
4357
+ for (const key in this.idm) {
4358
+ (_d = (_c = this.idm[key]) === null || _c === void 0 ? void 0 : _c.Cache) === null || _d === void 0 ? void 0 : _d.Clear();
4359
+ }
4360
+ for (const key in this.cam) {
4361
+ (_f = (_e = this.cam[key]) === null || _e === void 0 ? void 0 : _e.Cache) === null || _f === void 0 ? void 0 : _f.Clear();
4362
+ }
4363
+ for (const key in this.guardian) {
4364
+ (_h = (_g = this.guardian[key]) === null || _g === void 0 ? void 0 : _g.Cache) === null || _h === void 0 ? void 0 : _h.Clear();
4365
+ }
4366
+ for (const key in this.global) {
4367
+ (_k = (_j = this.global[key]) === null || _j === void 0 ? void 0 : _j.Cache) === null || _k === void 0 ? void 0 : _k.Clear();
4368
+ }
4369
+ }
4529
4370
  SetAccountId(accountId) {
4530
4371
  this.accountId = accountId;
4531
4372
  }
@@ -4552,6 +4393,7 @@ class ApiGetters {
4552
4393
  for (const key in this.global) {
4553
4394
  this.global[key].SetSessionId(sessionId);
4554
4395
  }
4396
+ this.ClearCache();
4555
4397
  }
4556
4398
  GetSessionId() {
4557
4399
  return this.sessionId;
@@ -4656,42 +4498,318 @@ class ApiGetters {
4656
4498
  this.global[key] = new GlobalApi.Api({
4657
4499
  env
4658
4500
  });
4659
- this.global[key].SetSessionId(this.sessionId);
4660
- }
4661
- return this.global[key];
4501
+ this.global[key].SetSessionId(this.sessionId);
4502
+ }
4503
+ return this.global[key];
4504
+ }
4505
+ GetGlobalGetter() {
4506
+ return {
4507
+ env: this.env,
4508
+ getApi: (env) => {
4509
+ return this.GetGlobalApi({ env });
4510
+ }
4511
+ };
4512
+ }
4513
+ GetGuardianApi(params) {
4514
+ if (!params) {
4515
+ params = {};
4516
+ }
4517
+ let { env } = params;
4518
+ env = env ? env : this.env;
4519
+ const key = `${env}`;
4520
+ if (!this.guardian[key]) {
4521
+ this.guardian[key] = new GuardianApi.Api({
4522
+ env
4523
+ });
4524
+ this.guardian[key].SetSessionId(this.sessionId);
4525
+ }
4526
+ return this.guardian[key];
4527
+ }
4528
+ GetGuardianGetter() {
4529
+ return {
4530
+ env: this.env,
4531
+ getApi: (env) => {
4532
+ return this.GetGuardianApi({ env });
4533
+ }
4534
+ };
4535
+ }
4536
+ }
4537
+
4538
+ // Global instance for smaller use-cases where you don't want to manage the getters yourself.
4539
+ let _getters;
4540
+ var ENVIRONMENT;
4541
+ (function (ENVIRONMENT) {
4542
+ // If true, then defaults are not touched and it's assumed this is being managed.
4543
+ ENVIRONMENT.IS_SELF_MANAGED = false;
4544
+ // Unused if IS_SELF_MANAGED is false.
4545
+ ENVIRONMENT.PARAMS = {
4546
+ accountId: "",
4547
+ env: Api.EEnv.PROD,
4548
+ sessionId: ""
4549
+ };
4550
+ function Api$$1() {
4551
+ if (ENVIRONMENT.IS_SELF_MANAGED) {
4552
+ throw ("Self managed mode ON. You are getting this error because you didn't pass an Api instance to a function.");
4553
+ }
4554
+ if (!ENVIRONMENT.PARAMS.accountId) {
4555
+ console.warn("No accountId set. This is required for the getters to work properly.");
4556
+ }
4557
+ if (!_getters) {
4558
+ _getters = new ApiGetters({
4559
+ accountId: ENVIRONMENT.PARAMS.accountId,
4560
+ env: ENVIRONMENT.PARAMS.env,
4561
+ sessionId: ENVIRONMENT.PARAMS.sessionId
4562
+ });
4563
+ }
4564
+ return _getters;
4565
+ }
4566
+ ENVIRONMENT.Api = Api$$1;
4567
+ function Reset(params) {
4568
+ if (ENVIRONMENT.IS_SELF_MANAGED) {
4569
+ throw ("Self managed mode ON. You are getting this error because you didn't pass an Api instance to a function.");
4570
+ }
4571
+ if (_getters) {
4572
+ _getters.ClearCache();
4573
+ if (params.accountId) {
4574
+ _getters.SetAccountId(params.accountId);
4575
+ }
4576
+ if (params.sessionId) {
4577
+ _getters.SetSessionId(params.sessionId);
4578
+ }
4579
+ if (params.env) {
4580
+ _getters.SetEnv(params.env);
4581
+ }
4582
+ }
4583
+ ENVIRONMENT.PARAMS = Object.assign(Object.assign({}, ENVIRONMENT.PARAMS), params);
4584
+ }
4585
+ ENVIRONMENT.Reset = Reset;
4586
+ })(ENVIRONMENT || (ENVIRONMENT = {}));
4587
+
4588
+ /**
4589
+ * Describes communication with the "Annotated Document" concept in Bruce.
4590
+ * Annotated documents are files with hotspots that can link to Entity records.
4591
+ */
4592
+ var AnnDocument;
4593
+ (function (AnnDocument) {
4594
+ function GetCacheKey(id) {
4595
+ return `${Api.ECacheKey.AnnDocument}${Api.ECacheKey.Id}${id}`;
4596
+ }
4597
+ AnnDocument.GetCacheKey = GetCacheKey;
4598
+ function GetListCacheKey(type) {
4599
+ return Api.ECacheKey.AnnDocument + type;
4600
+ }
4601
+ AnnDocument.GetListCacheKey = GetListCacheKey;
4602
+ let EType;
4603
+ (function (EType) {
4604
+ EType["SVG"] = "SVG";
4605
+ })(EType = AnnDocument.EType || (AnnDocument.EType = {}));
4606
+ function Get(params) {
4607
+ return __awaiter(this, void 0, void 0, function* () {
4608
+ let { api, docId, req: reqParams } = params;
4609
+ if (!api) {
4610
+ api = ENVIRONMENT.Api().GetBruceApi();
4611
+ }
4612
+ if (!docId) {
4613
+ throw ("Doc ID is required.");
4614
+ }
4615
+ const key = GetCacheKey(docId);
4616
+ const cache = yield api.GetCacheItem(key, reqParams);
4617
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
4618
+ return cache.data;
4619
+ }
4620
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4621
+ try {
4622
+ const data = yield api.GET(`documentView/${docId}`, Api.PrepReqParams(reqParams));
4623
+ res({
4624
+ document: data
4625
+ });
4626
+ }
4627
+ catch (e) {
4628
+ rej(e);
4629
+ }
4630
+ }));
4631
+ yield api.SetCacheItem({
4632
+ key,
4633
+ value: prom,
4634
+ req: reqParams
4635
+ });
4636
+ return prom;
4637
+ });
4638
+ }
4639
+ AnnDocument.Get = Get;
4640
+ function GetList(params) {
4641
+ return __awaiter(this, void 0, void 0, function* () {
4642
+ let { api, docType: type, req: reqParams } = params;
4643
+ if (!api) {
4644
+ api = ENVIRONMENT.Api().GetBruceApi();
4645
+ }
4646
+ if (!type) {
4647
+ type = "";
4648
+ }
4649
+ const cache = yield api.GetCacheItem(GetListCacheKey(type), reqParams);
4650
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
4651
+ return cache.data;
4652
+ }
4653
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4654
+ try {
4655
+ const url = "documentViews" + (type ? "?type=" + type : "");
4656
+ const data = yield api.GET(url, Api.PrepReqParams(reqParams));
4657
+ res({
4658
+ documents: data.Items
4659
+ });
4660
+ }
4661
+ catch (e) {
4662
+ rej(e);
4663
+ }
4664
+ }));
4665
+ yield api.SetCacheItem({
4666
+ key: GetListCacheKey(type),
4667
+ value: req,
4668
+ req: reqParams
4669
+ });
4670
+ return req;
4671
+ });
4672
+ }
4673
+ AnnDocument.GetList = GetList;
4674
+ })(AnnDocument || (AnnDocument = {}));
4675
+
4676
+ /**
4677
+ * Describes the "Custom Form" concept within Bruce.
4678
+ * Custom forms are dynamic dialogs that get populated with Entity data.
4679
+ */
4680
+ var CustomForm;
4681
+ (function (CustomForm) {
4682
+ function GetCacheKey(id) {
4683
+ return Api.ECacheKey.CustomForm + Api.ECacheKey.Id + id;
4684
+ }
4685
+ CustomForm.GetCacheKey = GetCacheKey;
4686
+ function GetListCacheKey(typeId) {
4687
+ if (typeId) {
4688
+ return Api.ECacheKey.CustomForm + Api.ECacheKey.EntityType + Api.ECacheKey.Id + typeId;
4689
+ }
4690
+ return Api.ECacheKey.CustomForm;
4691
+ }
4692
+ CustomForm.GetListCacheKey = GetListCacheKey;
4693
+ let EType;
4694
+ (function (EType) {
4695
+ EType["Form"] = "GENERIC";
4696
+ EType["Markup"] = "MARKUP";
4697
+ })(EType = CustomForm.EType || (CustomForm.EType = {}));
4698
+ function Get(params) {
4699
+ return __awaiter(this, void 0, void 0, function* () {
4700
+ let { api, formId: id, req: reqParams } = params;
4701
+ if (!api) {
4702
+ api = ENVIRONMENT.Api().GetBruceApi();
4703
+ }
4704
+ if (!id) {
4705
+ throw ("Id is required.");
4706
+ }
4707
+ const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
4708
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
4709
+ return cache.data;
4710
+ }
4711
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4712
+ try {
4713
+ const data = yield api.GET(`customForm/${id}`, Api.PrepReqParams(reqParams));
4714
+ res({
4715
+ form: data
4716
+ });
4717
+ }
4718
+ catch (err) {
4719
+ rej(err);
4720
+ }
4721
+ }));
4722
+ yield api.SetCacheItem({
4723
+ key: GetCacheKey(id),
4724
+ value: prom,
4725
+ req: reqParams
4726
+ });
4727
+ return prom;
4728
+ });
4662
4729
  }
4663
- GetGlobalGetter() {
4664
- return {
4665
- env: this.env,
4666
- getApi: (env) => {
4667
- return this.GetGlobalApi({ env });
4730
+ CustomForm.Get = Get;
4731
+ function Delete(params) {
4732
+ return __awaiter(this, void 0, void 0, function* () {
4733
+ let { api, formId: id, req: reqParams } = params;
4734
+ if (!api) {
4735
+ api = ENVIRONMENT.Api().GetBruceApi();
4668
4736
  }
4669
- };
4737
+ if (!id) {
4738
+ throw ("Id is required.");
4739
+ }
4740
+ yield api.DELETE(`customForm/${id}`, Api.PrepReqParams(reqParams));
4741
+ yield api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
4742
+ });
4670
4743
  }
4671
- GetGuardianApi(params) {
4672
- if (!params) {
4673
- params = {};
4674
- }
4675
- let { env } = params;
4676
- env = env ? env : this.env;
4677
- const key = `${env}`;
4678
- if (!this.guardian[key]) {
4679
- this.guardian[key] = new GuardianApi.Api({
4680
- env
4744
+ CustomForm.Delete = Delete;
4745
+ function GetList(params) {
4746
+ return __awaiter(this, void 0, void 0, function* () {
4747
+ let { api, entityTypeId: typeId, req: reqParams } = params;
4748
+ if (!api) {
4749
+ api = ENVIRONMENT.Api().GetBruceApi();
4750
+ }
4751
+ const url = typeId ? `entityType/${typeId}/customForms` : "customForms";
4752
+ const cache = yield api.GetCacheItem(GetListCacheKey(typeId), reqParams);
4753
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
4754
+ return cache.data;
4755
+ }
4756
+ const req = api.GET(url, Api.PrepReqParams(reqParams));
4757
+ const prom = req.then((data) => {
4758
+ return {
4759
+ forms: data.Items
4760
+ };
4681
4761
  });
4682
- this.guardian[key].SetSessionId(this.sessionId);
4683
- }
4684
- return this.guardian[key];
4762
+ yield api.SetCacheItem({
4763
+ key: GetListCacheKey(typeId),
4764
+ value: prom,
4765
+ req: reqParams
4766
+ });
4767
+ return prom;
4768
+ });
4685
4769
  }
4686
- GetGuardianGetter() {
4687
- return {
4688
- env: this.env,
4689
- getApi: (env) => {
4690
- return this.GetGuardianApi({ env });
4770
+ CustomForm.GetList = GetList;
4771
+ function Update(params) {
4772
+ return __awaiter(this, void 0, void 0, function* () {
4773
+ let { api, form: data, reqParams } = params;
4774
+ if (!api) {
4775
+ api = ENVIRONMENT.Api().GetBruceApi();
4691
4776
  }
4692
- };
4777
+ if (!data.ID) {
4778
+ data.ID = 0;
4779
+ }
4780
+ const res = yield api.POST(`customForm/${data.ID}`, data, Api.PrepReqParams(reqParams));
4781
+ yield api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
4782
+ return {
4783
+ form: res
4784
+ };
4785
+ });
4693
4786
  }
4694
- }
4787
+ CustomForm.Update = Update;
4788
+ })(CustomForm || (CustomForm = {}));
4789
+
4790
+ /**
4791
+ * Describes content of a GENERIC type custom form.
4792
+ * The alternative type is MARKUP (Markup.IMarkup).
4793
+ */
4794
+ var CustomFormContent;
4795
+ (function (CustomFormContent) {
4796
+ let ECellType;
4797
+ (function (ECellType) {
4798
+ ECellType[ECellType["StaticText"] = 0] = "StaticText";
4799
+ ECellType[ECellType["DataValue"] = 1] = "DataValue";
4800
+ ECellType[ECellType["StaticPicture"] = 2] = "StaticPicture";
4801
+ ECellType[ECellType["SubSection"] = 3] = "SubSection";
4802
+ ECellType[ECellType["ButtonMore"] = 4] = "ButtonMore";
4803
+ ECellType[ECellType["EntityPhoto"] = 5] = "EntityPhoto";
4804
+ ECellType[ECellType["EmbeddedMedia"] = 6] = "EmbeddedMedia";
4805
+ ECellType[ECellType["Chart"] = 7] = "Chart";
4806
+ })(ECellType = CustomFormContent.ECellType || (CustomFormContent.ECellType = {}));
4807
+ let EFlowDirection;
4808
+ (function (EFlowDirection) {
4809
+ EFlowDirection["Vertically"] = "v";
4810
+ EFlowDirection["Horizontally"] = "h";
4811
+ })(EFlowDirection = CustomFormContent.EFlowDirection || (CustomFormContent.EFlowDirection = {}));
4812
+ })(CustomFormContent || (CustomFormContent = {}));
4695
4813
 
4696
4814
  var Color;
4697
4815
  (function (Color) {
@@ -4867,7 +4985,10 @@ var Entity;
4867
4985
  Entity.GetCacheKey = GetCacheKey;
4868
4986
  function Get(params) {
4869
4987
  return __awaiter(this, void 0, void 0, function* () {
4870
- const { api, entityId, req: reqParams, expandLocation, entityTypeId } = params;
4988
+ let { api, entityId, req: reqParams, expandLocation, entityTypeId } = params;
4989
+ if (!api) {
4990
+ api = ENVIRONMENT.Api().GetBruceApi();
4991
+ }
4871
4992
  if (!entityId) {
4872
4993
  throw ("Entity ID is required.");
4873
4994
  }
@@ -4905,7 +5026,10 @@ var Entity;
4905
5026
  Entity.Get = Get;
4906
5027
  function GetListByIds(params) {
4907
5028
  return __awaiter(this, void 0, void 0, function* () {
4908
- const { api, entityIds, req: reqParams } = params;
5029
+ let { api, entityIds, req: reqParams } = params;
5030
+ if (!api) {
5031
+ api = ENVIRONMENT.Api().GetBruceApi();
5032
+ }
4909
5033
  if (!entityIds.length) {
4910
5034
  throw ("Entity IDs are required.");
4911
5035
  }
@@ -4964,7 +5088,10 @@ var Entity;
4964
5088
  Entity.GetListByIds = GetListByIds;
4965
5089
  function Delete(params) {
4966
5090
  return __awaiter(this, void 0, void 0, function* () {
4967
- const { api, entityId, req: reqParams } = params;
5091
+ let { api, entityId, req: reqParams } = params;
5092
+ if (!api) {
5093
+ api = ENVIRONMENT.Api().GetBruceApi();
5094
+ }
4968
5095
  if (!entityId) {
4969
5096
  throw ("Entity ID is required.");
4970
5097
  }
@@ -4975,7 +5102,10 @@ var Entity;
4975
5102
  Entity.Delete = Delete;
4976
5103
  function DeleteList(params) {
4977
5104
  return __awaiter(this, void 0, void 0, function* () {
4978
- const { api, entityIds, req: reqParams } = params;
5105
+ let { api, entityIds, req: reqParams } = params;
5106
+ if (!api) {
5107
+ api = ENVIRONMENT.Api().GetBruceApi();
5108
+ }
4979
5109
  if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
4980
5110
  throw ("Entity IDs are required.");
4981
5111
  }
@@ -4992,7 +5122,10 @@ var Entity;
4992
5122
  function Update(params) {
4993
5123
  var _a, _b;
4994
5124
  return __awaiter(this, void 0, void 0, function* () {
4995
- const { api, entity: data, override, req: reqParams } = params;
5125
+ let { api, entity: data, override, req: reqParams } = params;
5126
+ if (!api) {
5127
+ api = ENVIRONMENT.Api().GetBruceApi();
5128
+ }
4996
5129
  if (!((_a = data === null || data === void 0 ? void 0 : data.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"])) {
4997
5130
  throw ("Entity Type ID is required.");
4998
5131
  }
@@ -5095,7 +5228,10 @@ var Entity;
5095
5228
  Entity.CalculateName = CalculateName;
5096
5229
  function GetList(params) {
5097
5230
  return __awaiter(this, void 0, void 0, function* () {
5098
- const { api, filter, req: reqParams, viaCdn, viaCdnCacheToken } = params;
5231
+ let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken } = params;
5232
+ if (!api) {
5233
+ api = ENVIRONMENT.Api().GetBruceApi();
5234
+ }
5099
5235
  let requestFilter = {};
5100
5236
  if (filter.entityTypeConditions) {
5101
5237
  requestFilter = Object.assign({}, filter.entityTypeConditions);
@@ -6109,7 +6245,10 @@ var EntityAttachmentType;
6109
6245
  })(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
6110
6246
  function Delete(params) {
6111
6247
  return __awaiter(this, void 0, void 0, function* () {
6112
- const { api, attachmentTypeId: id, req: reqParams } = params;
6248
+ let { api, attachmentTypeId: id, req: reqParams } = params;
6249
+ if (!api) {
6250
+ api = ENVIRONMENT.Api().GetBruceApi();
6251
+ }
6113
6252
  if (!id) {
6114
6253
  throw ("Type ID is required.");
6115
6254
  }
@@ -6121,7 +6260,10 @@ var EntityAttachmentType;
6121
6260
  EntityAttachmentType.Delete = Delete;
6122
6261
  function Update(params) {
6123
6262
  return __awaiter(this, void 0, void 0, function* () {
6124
- const { api, attachmentType: data, req: reqParams } = params;
6263
+ let { api, attachmentType: data, req: reqParams } = params;
6264
+ if (!api) {
6265
+ api = ENVIRONMENT.Api().GetBruceApi();
6266
+ }
6125
6267
  if (!(data === null || data === void 0 ? void 0 : data.ID)) {
6126
6268
  throw ("Type ID is required.");
6127
6269
  }
@@ -6136,7 +6278,10 @@ var EntityAttachmentType;
6136
6278
  EntityAttachmentType.Update = Update;
6137
6279
  function GetList(params) {
6138
6280
  return __awaiter(this, void 0, void 0, function* () {
6139
- const { api, reqParams } = params;
6281
+ let { api, reqParams } = params;
6282
+ if (!api) {
6283
+ api = ENVIRONMENT.Api().GetBruceApi();
6284
+ }
6140
6285
  const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
6141
6286
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6142
6287
  return cache.data;
@@ -6180,7 +6325,10 @@ var EntityAttachment;
6180
6325
  EntityAttachment.GetListCacheKey = GetListCacheKey;
6181
6326
  function Update(params) {
6182
6327
  return __awaiter(this, void 0, void 0, function* () {
6183
- const { api, attachments, req, entityId } = params;
6328
+ let { api, attachments, req, entityId } = params;
6329
+ if (!api) {
6330
+ api = ENVIRONMENT.Api().GetBruceApi();
6331
+ }
6184
6332
  if (!(attachments === null || attachments === void 0 ? void 0 : attachments.length)) {
6185
6333
  return {
6186
6334
  attachments: []
@@ -6203,7 +6351,10 @@ var EntityAttachment;
6203
6351
  EntityAttachment.Update = Update;
6204
6352
  function UpdateOrder(params) {
6205
6353
  return __awaiter(this, void 0, void 0, function* () {
6206
- const { api, entityId, attachmentTypeId: typeId, attachments, req: reqParams } = params;
6354
+ let { api, entityId, attachmentTypeId: typeId, attachments, req: reqParams } = params;
6355
+ if (!api) {
6356
+ api = ENVIRONMENT.Api().GetBruceApi();
6357
+ }
6207
6358
  if (!entityId || !typeId || !(attachments === null || attachments === void 0 ? void 0 : attachments.length)) {
6208
6359
  throw ("Entity ID, Type ID, and Attachments are required.");
6209
6360
  }
@@ -6221,7 +6372,10 @@ var EntityAttachment;
6221
6372
  EntityAttachment.UpdateOrder = UpdateOrder;
6222
6373
  function Delete(params) {
6223
6374
  return __awaiter(this, void 0, void 0, function* () {
6224
- const { api, attachmentId, entityId, req } = params;
6375
+ let { api, attachmentId, entityId, req } = params;
6376
+ if (!api) {
6377
+ api = ENVIRONMENT.Api().GetBruceApi();
6378
+ }
6225
6379
  if (!attachmentId || !entityId) {
6226
6380
  throw ("Entity id and attachment id.");
6227
6381
  }
@@ -6232,7 +6386,10 @@ var EntityAttachment;
6232
6386
  EntityAttachment.Delete = Delete;
6233
6387
  function GetListByEntityId(params) {
6234
6388
  return __awaiter(this, void 0, void 0, function* () {
6235
- const { api, entityId, req: reqParams } = params;
6389
+ let { api, entityId, req: reqParams } = params;
6390
+ if (!api) {
6391
+ api = ENVIRONMENT.Api().GetBruceApi();
6392
+ }
6236
6393
  if (!entityId) {
6237
6394
  throw ("Entity ID is required.");
6238
6395
  }
@@ -6262,7 +6419,10 @@ var EntityAttachment;
6262
6419
  EntityAttachment.GetListByEntityId = GetListByEntityId;
6263
6420
  function Upload(params) {
6264
6421
  return __awaiter(this, void 0, void 0, function* () {
6265
- const { api, file, entityId, attachmentTypeId: typeId, req: reqParams } = params;
6422
+ let { api, file, entityId, attachmentTypeId: typeId, req: reqParams } = params;
6423
+ if (!api) {
6424
+ api = ENVIRONMENT.Api().GetBruceApi();
6425
+ }
6266
6426
  if (!entityId || !typeId || !file) {
6267
6427
  throw ("Entity ID, Type ID, and File are required.");
6268
6428
  }
@@ -6293,7 +6453,10 @@ var EntityComment;
6293
6453
  EntityComment.GetListCacheKey = GetListCacheKey;
6294
6454
  function Update(params) {
6295
6455
  return __awaiter(this, void 0, void 0, function* () {
6296
- const { api, comment: data, req: reqParams } = params;
6456
+ let { api, comment: data, req: reqParams } = params;
6457
+ if (!api) {
6458
+ api = ENVIRONMENT.Api().GetBruceApi();
6459
+ }
6297
6460
  if (!(data === null || data === void 0 ? void 0 : data["TargetObject.ID"])) {
6298
6461
  throw ("TargetObject.ID (entity id) is required.");
6299
6462
  }
@@ -6309,7 +6472,10 @@ var EntityComment;
6309
6472
  EntityComment.Update = Update;
6310
6473
  function Delete(params) {
6311
6474
  return __awaiter(this, void 0, void 0, function* () {
6312
- const { api, entityId, commentId, req: reqParams } = params;
6475
+ let { api, entityId, commentId, req: reqParams } = params;
6476
+ if (!api) {
6477
+ api = ENVIRONMENT.Api().GetBruceApi();
6478
+ }
6313
6479
  if (!commentId) {
6314
6480
  throw ("Comment ID is required.");
6315
6481
  }
@@ -6321,7 +6487,10 @@ var EntityComment;
6321
6487
  EntityComment.Delete = Delete;
6322
6488
  function GetListByEntityId(params) {
6323
6489
  return __awaiter(this, void 0, void 0, function* () {
6324
- const { api, entityId, req: reqParams } = params;
6490
+ let { api, entityId, req: reqParams } = params;
6491
+ if (!api) {
6492
+ api = ENVIRONMENT.Api().GetBruceApi();
6493
+ }
6325
6494
  if (!entityId) {
6326
6495
  throw ("Entity ID is required.");
6327
6496
  }
@@ -6367,7 +6536,10 @@ var EntityLink;
6367
6536
  EntityLink.GetListCacheKey = GetListCacheKey;
6368
6537
  function Update(params) {
6369
6538
  return __awaiter(this, void 0, void 0, function* () {
6370
- const { api, link: data, req: reqParams } = params;
6539
+ let { api, link: data, req: reqParams } = params;
6540
+ if (!api) {
6541
+ api = ENVIRONMENT.Api().GetBruceApi();
6542
+ }
6371
6543
  if (!(data === null || data === void 0 ? void 0 : data["Entity.ID"])) {
6372
6544
  throw ("Entity ID is required.");
6373
6545
  }
@@ -6383,7 +6555,10 @@ var EntityLink;
6383
6555
  EntityLink.Update = Update;
6384
6556
  function Delete(params) {
6385
6557
  return __awaiter(this, void 0, void 0, function* () {
6386
- const { api, entityId, linkId, req: reqParams } = params;
6558
+ let { api, entityId, linkId, req: reqParams } = params;
6559
+ if (!api) {
6560
+ api = ENVIRONMENT.Api().GetBruceApi();
6561
+ }
6387
6562
  if (!linkId) {
6388
6563
  throw ("Link ID is required.");
6389
6564
  }
@@ -6395,7 +6570,10 @@ var EntityLink;
6395
6570
  EntityLink.Delete = Delete;
6396
6571
  function GetListByEntityId(params) {
6397
6572
  return __awaiter(this, void 0, void 0, function* () {
6398
- const { api, entityId, req: reqParams } = params;
6573
+ let { api, entityId, req: reqParams } = params;
6574
+ if (!api) {
6575
+ api = ENVIRONMENT.Api().GetBruceApi();
6576
+ }
6399
6577
  if (!entityId) {
6400
6578
  throw ("Entity ID is required.");
6401
6579
  }
@@ -6447,6 +6625,9 @@ var EntityLod;
6447
6625
  EntityLod.GetEntityListKey = GetEntityListKey;
6448
6626
  function GetUrl(params) {
6449
6627
  let { api, entityId, categoryId, level, strict } = params;
6628
+ if (!api) {
6629
+ api = ENVIRONMENT.Api().GetBruceApi();
6630
+ }
6450
6631
  if (!entityId) {
6451
6632
  throw ("Entity ID is required.");
6452
6633
  }
@@ -6467,7 +6648,10 @@ var EntityLod;
6467
6648
  EntityLod.GetUrl = GetUrl;
6468
6649
  function GetUrlFileId(params) {
6469
6650
  return __awaiter(this, void 0, void 0, function* () {
6470
- const { api, url, req: reqParams } = params;
6651
+ let { api, url, req: reqParams } = params;
6652
+ if (!api) {
6653
+ api = ENVIRONMENT.Api().GetBruceApi();
6654
+ }
6471
6655
  if (!url) {
6472
6656
  throw ("Url is required.");
6473
6657
  }
@@ -6498,7 +6682,10 @@ var EntityLod;
6498
6682
  function GetLods(params) {
6499
6683
  var _a;
6500
6684
  return __awaiter(this, void 0, void 0, function* () {
6501
- const { api, filter, req: reqParams } = params;
6685
+ let { api, filter, req: reqParams } = params;
6686
+ if (!api) {
6687
+ api = ENVIRONMENT.Api().GetBruceApi();
6688
+ }
6502
6689
  if (!((_a = filter === null || filter === void 0 ? void 0 : filter.Items) === null || _a === void 0 ? void 0 : _a.length)) {
6503
6690
  throw ("Items are required.");
6504
6691
  }
@@ -6511,7 +6698,10 @@ var EntityLod;
6511
6698
  EntityLod.GetLods = GetLods;
6512
6699
  function GetEntityLods(params) {
6513
6700
  return __awaiter(this, void 0, void 0, function* () {
6514
- const { api, entityId, req: reqParams } = params;
6701
+ let { api, entityId, req: reqParams } = params;
6702
+ if (!api) {
6703
+ api = ENVIRONMENT.Api().GetBruceApi();
6704
+ }
6515
6705
  if (!entityId) {
6516
6706
  throw ("Entity id is required.");
6517
6707
  }
@@ -6547,6 +6737,9 @@ var EntityLod;
6547
6737
  function GetTypeLods(params) {
6548
6738
  return __awaiter(this, void 0, void 0, function* () {
6549
6739
  let { api, entityTypeId: typeId, group, req: reqParams } = params;
6740
+ if (!api) {
6741
+ api = ENVIRONMENT.Api().GetBruceApi();
6742
+ }
6550
6743
  if (!group) {
6551
6744
  group = "DEFAULT";
6552
6745
  }
@@ -6578,7 +6771,10 @@ var EntityLod;
6578
6771
  EntityLod.GetTypeLods = GetTypeLods;
6579
6772
  function Update(params) {
6580
6773
  return __awaiter(this, void 0, void 0, function* () {
6581
- const { api, entityId, req: reqParams } = params;
6774
+ let { api, entityId, req: reqParams } = params;
6775
+ if (!api) {
6776
+ api = ENVIRONMENT.Api().GetBruceApi();
6777
+ }
6582
6778
  if (!params["ClientFile.ID"] || !params["LODCategory.Key"] || (!params.Level && params.Level !== 0)) {
6583
6779
  throw ("ClientFile.ID, LODCategory.Key and Level are required.");
6584
6780
  }
@@ -6594,6 +6790,9 @@ var EntityLod;
6594
6790
  function Delete(params) {
6595
6791
  return __awaiter(this, void 0, void 0, function* () {
6596
6792
  let { api, entityId, lodCategoryId, level, req: reqParams } = params;
6793
+ if (!api) {
6794
+ api = ENVIRONMENT.Api().GetBruceApi();
6795
+ }
6597
6796
  if (!entityId || !lodCategoryId) {
6598
6797
  throw ("Entity ID and LOD Category ID are required.");
6599
6798
  }
@@ -6622,7 +6821,10 @@ var EntityLodCategory;
6622
6821
  EntityLodCategory.GetListCacheKey = GetListCacheKey;
6623
6822
  function GetList(params) {
6624
6823
  return __awaiter(this, void 0, void 0, function* () {
6625
- const { api, req: reqParams } = params;
6824
+ let { api, req: reqParams } = params;
6825
+ if (!api) {
6826
+ api = ENVIRONMENT.Api().GetBruceApi();
6827
+ }
6626
6828
  const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
6627
6829
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6628
6830
  return cache.data;
@@ -6649,7 +6851,10 @@ var EntityLodCategory;
6649
6851
  EntityLodCategory.GetList = GetList;
6650
6852
  function Get(params) {
6651
6853
  return __awaiter(this, void 0, void 0, function* () {
6652
- const { api, categoryId: id, req: reqParams } = params;
6854
+ let { api, categoryId: id, req: reqParams } = params;
6855
+ if (!api) {
6856
+ api = ENVIRONMENT.Api().GetBruceApi();
6857
+ }
6653
6858
  if (!id) {
6654
6859
  throw ("Lod category id is required.");
6655
6860
  }
@@ -6679,7 +6884,10 @@ var EntityLodCategory;
6679
6884
  EntityLodCategory.Get = Get;
6680
6885
  function Delete(params) {
6681
6886
  return __awaiter(this, void 0, void 0, function* () {
6682
- const { api, categoryId: id, req: reqParams } = params;
6887
+ let { api, categoryId: id, req: reqParams } = params;
6888
+ if (!api) {
6889
+ api = ENVIRONMENT.Api().GetBruceApi();
6890
+ }
6683
6891
  if (!id) {
6684
6892
  throw ("Lod category id is required.");
6685
6893
  }
@@ -6691,7 +6899,10 @@ var EntityLodCategory;
6691
6899
  EntityLodCategory.Delete = Delete;
6692
6900
  function Update(params) {
6693
6901
  return __awaiter(this, void 0, void 0, function* () {
6694
- const { api, category: data, req: reqParams } = params;
6902
+ let { api, category: data, req: reqParams } = params;
6903
+ if (!api) {
6904
+ api = ENVIRONMENT.Api().GetBruceApi();
6905
+ }
6695
6906
  if (!data.Key || !data.Name) {
6696
6907
  throw ("Lod category key and name are required.");
6697
6908
  }
@@ -6722,7 +6933,10 @@ var EntityRelationType;
6722
6933
  EntityRelationType.GetListCacheKey = GetListCacheKey;
6723
6934
  function Get(params) {
6724
6935
  return __awaiter(this, void 0, void 0, function* () {
6725
- const { api, relationTypeId: typeId, req: reqParams } = params;
6936
+ let { api, relationTypeId: typeId, req: reqParams } = params;
6937
+ if (!api) {
6938
+ api = ENVIRONMENT.Api().GetBruceApi();
6939
+ }
6726
6940
  if (!typeId) {
6727
6941
  throw ("Type ID is required.");
6728
6942
  }
@@ -6753,7 +6967,10 @@ var EntityRelationType;
6753
6967
  EntityRelationType.Get = Get;
6754
6968
  function Delete(params) {
6755
6969
  return __awaiter(this, void 0, void 0, function* () {
6756
- const { api, relationTypeId: typeId, req: reqParams } = params;
6970
+ let { api, relationTypeId: typeId, req: reqParams } = params;
6971
+ if (!api) {
6972
+ api = ENVIRONMENT.Api().GetBruceApi();
6973
+ }
6757
6974
  if (!typeId) {
6758
6975
  throw ("Type ID is required.");
6759
6976
  }
@@ -6765,7 +6982,10 @@ var EntityRelationType;
6765
6982
  EntityRelationType.Delete = Delete;
6766
6983
  function GetList(params) {
6767
6984
  return __awaiter(this, void 0, void 0, function* () {
6768
- const { api, req: reqParams } = params;
6985
+ let { api, req: reqParams } = params;
6986
+ if (!api) {
6987
+ api = ENVIRONMENT.Api().GetBruceApi();
6988
+ }
6769
6989
  const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
6770
6990
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6771
6991
  return cache.data;
@@ -6792,7 +7012,10 @@ var EntityRelationType;
6792
7012
  EntityRelationType.GetList = GetList;
6793
7013
  function Update(params) {
6794
7014
  return __awaiter(this, void 0, void 0, function* () {
6795
- const { api, relationType: data, req: reqParams } = params;
7015
+ let { api, relationType: data, req: reqParams } = params;
7016
+ if (!api) {
7017
+ api = ENVIRONMENT.Api().GetBruceApi();
7018
+ }
6796
7019
  if (!(data === null || data === void 0 ? void 0 : data.ForwardName) || !(data === null || data === void 0 ? void 0 : data.ReverseName)) {
6797
7020
  throw ("Forward and reverse names are required.");
6798
7021
  }
@@ -6835,7 +7058,10 @@ var EntityRelation;
6835
7058
  EntityRelation.GetListCacheKey = GetListCacheKey;
6836
7059
  function Create(params) {
6837
7060
  return __awaiter(this, void 0, void 0, function* () {
6838
- const { api, relation: data, req: reqParams } = params;
7061
+ let { api, relation: data, req: reqParams } = params;
7062
+ if (!api) {
7063
+ api = ENVIRONMENT.Api().GetBruceApi();
7064
+ }
6839
7065
  if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
6840
7066
  throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
6841
7067
  }
@@ -6855,7 +7081,10 @@ var EntityRelation;
6855
7081
  EntityRelation.Create = Create;
6856
7082
  function Delete(params) {
6857
7083
  return __awaiter(this, void 0, void 0, function* () {
6858
- const { api, principalEntityId, relatedEntityId, relationTypeId, req: reqParams } = params;
7084
+ let { api, principalEntityId, relatedEntityId, relationTypeId, req: reqParams } = params;
7085
+ if (!api) {
7086
+ api = ENVIRONMENT.Api().GetBruceApi();
7087
+ }
6859
7088
  if (!principalEntityId || !relatedEntityId || !relationTypeId) {
6860
7089
  throw new Error("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
6861
7090
  }
@@ -6872,7 +7101,10 @@ var EntityRelation;
6872
7101
  EntityRelation.Delete = Delete;
6873
7102
  function Update(params) {
6874
7103
  return __awaiter(this, void 0, void 0, function* () {
6875
- const { api, relation: data, req: reqParams } = params;
7104
+ let { api, relation: data, req: reqParams } = params;
7105
+ if (!api) {
7106
+ api = ENVIRONMENT.Api().GetBruceApi();
7107
+ }
6876
7108
  if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
6877
7109
  throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
6878
7110
  }
@@ -6890,6 +7122,9 @@ var EntityRelation;
6890
7122
  function GetList(params) {
6891
7123
  return __awaiter(this, void 0, void 0, function* () {
6892
7124
  let { api, entityId, filter, req: reqParams } = params;
7125
+ if (!api) {
7126
+ api = ENVIRONMENT.Api().GetBruceApi();
7127
+ }
6893
7128
  if (!entityId) {
6894
7129
  throw ("Entity ID is required.");
6895
7130
  }
@@ -6925,7 +7160,10 @@ var EntityRelation;
6925
7160
  EntityRelation.GetList = GetList;
6926
7161
  function GetByDataEntityId(params) {
6927
7162
  return __awaiter(this, void 0, void 0, function* () {
6928
- const { api, entityId, req: reqParams } = params;
7163
+ let { api, entityId, req: reqParams } = params;
7164
+ if (!api) {
7165
+ api = ENVIRONMENT.Api().GetBruceApi();
7166
+ }
6929
7167
  if (!entityId) {
6930
7168
  throw ("Entity ID is required.");
6931
7169
  }
@@ -6969,7 +7207,10 @@ var EntitySource;
6969
7207
  function Get(params) {
6970
7208
  var _a;
6971
7209
  return __awaiter(this, void 0, void 0, function* () {
6972
- const { api, sourceId, sourceKey, req: reqParams } = params;
7210
+ let { api, sourceId, sourceKey, req: reqParams } = params;
7211
+ if (!api) {
7212
+ api = ENVIRONMENT.Api().GetBruceApi();
7213
+ }
6973
7214
  if (!sourceId || !sourceKey) {
6974
7215
  throw ("Source ID and Source Key are required.");
6975
7216
  }
@@ -6987,7 +7228,10 @@ var EntitySource;
6987
7228
  EntitySource.Get = Get;
6988
7229
  function GetListByKeys(params) {
6989
7230
  return __awaiter(this, void 0, void 0, function* () {
6990
- const { api, sourceId, sourceKeys, req: reqParams } = params;
7231
+ let { api, sourceId, sourceKeys, req: reqParams } = params;
7232
+ if (!api) {
7233
+ api = ENVIRONMENT.Api().GetBruceApi();
7234
+ }
6991
7235
  if (!sourceId || !sourceKeys.length) {
6992
7236
  throw ("Source ID and Source Keys are required.");
6993
7237
  }
@@ -7034,7 +7278,10 @@ var EntitySource;
7034
7278
  EntitySource.GetListByKeys = GetListByKeys;
7035
7279
  function GetEntityIdsBySourceKeys(params) {
7036
7280
  return __awaiter(this, void 0, void 0, function* () {
7037
- const { api, sourceId, sourceKeys, req: reqParams } = params;
7281
+ let { api, sourceId, sourceKeys, req: reqParams } = params;
7282
+ if (!api) {
7283
+ api = ENVIRONMENT.Api().GetBruceApi();
7284
+ }
7038
7285
  if (!sourceId || !sourceKeys.length) {
7039
7286
  throw ("Source ID and Source Keys are required.");
7040
7287
  }
@@ -7064,13 +7311,16 @@ var EntitySource;
7064
7311
  EntitySource.GetEntityIdsBySourceKeys = GetEntityIdsBySourceKeys;
7065
7312
  function CreateLink(params) {
7066
7313
  return __awaiter(this, void 0, void 0, function* () {
7067
- const { source } = params;
7314
+ let { source, api } = params;
7315
+ if (!api) {
7316
+ api = ENVIRONMENT.Api().GetBruceApi();
7317
+ }
7068
7318
  if (!source["Entity.ID"] || !source["Source.ID"] || !source["SourceRecord.Key"]) {
7069
7319
  throw ("Entity ID, Source ID and Source Key are required.");
7070
7320
  }
7071
- const res = yield params.api.POST("entitysource", source);
7321
+ const res = yield api.POST("entitysource", source);
7072
7322
  const cacheKey = GetCacheKey(source["Source.ID"], source["SourceRecord.Key"]);
7073
- yield params.api.Cache.Remove(cacheKey);
7323
+ yield api.Cache.Remove(cacheKey);
7074
7324
  return {
7075
7325
  source: res
7076
7326
  };
@@ -7099,7 +7349,10 @@ var EntityTag;
7099
7349
  EntityTag.GetListCacheKey = GetListCacheKey;
7100
7350
  function Get(params) {
7101
7351
  return __awaiter(this, void 0, void 0, function* () {
7102
- const { api, tagId, req: reqParams } = params;
7352
+ let { api, tagId, req: reqParams } = params;
7353
+ if (!api) {
7354
+ api = ENVIRONMENT.Api().GetBruceApi();
7355
+ }
7103
7356
  if (!tagId) {
7104
7357
  throw ("Tag ID is required.");
7105
7358
  }
@@ -7116,7 +7369,10 @@ var EntityTag;
7116
7369
  EntityTag.Get = Get;
7117
7370
  function GetListByIds(params) {
7118
7371
  return __awaiter(this, void 0, void 0, function* () {
7119
- const { api, tagIds, req: reqParams } = params;
7372
+ let { api, tagIds, req: reqParams } = params;
7373
+ if (!api) {
7374
+ api = ENVIRONMENT.Api().GetBruceApi();
7375
+ }
7120
7376
  if (!tagIds.length) {
7121
7377
  throw ("Tag Ids are empty.");
7122
7378
  }
@@ -7172,7 +7428,10 @@ var EntityTag;
7172
7428
  EntityTag.GetListByIds = GetListByIds;
7173
7429
  function GetList(params) {
7174
7430
  return __awaiter(this, void 0, void 0, function* () {
7175
- const { api, entityTypeId, req: reqParams } = params;
7431
+ let { api, entityTypeId, req: reqParams } = params;
7432
+ if (!api) {
7433
+ api = ENVIRONMENT.Api().GetBruceApi();
7434
+ }
7176
7435
  const cache = yield api.GetCacheItem(GetListCacheKey(entityTypeId), reqParams);
7177
7436
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
7178
7437
  return cache.data;
@@ -7199,7 +7458,10 @@ var EntityTag;
7199
7458
  EntityTag.GetList = GetList;
7200
7459
  function Delete(params) {
7201
7460
  return __awaiter(this, void 0, void 0, function* () {
7202
- const { api, tagId, req: reqParams } = params;
7461
+ let { api, tagId, req: reqParams } = params;
7462
+ if (!api) {
7463
+ api = ENVIRONMENT.Api().GetBruceApi();
7464
+ }
7203
7465
  if (!tagId) {
7204
7466
  throw ("Tag ID is required.");
7205
7467
  }
@@ -7211,7 +7473,10 @@ var EntityTag;
7211
7473
  EntityTag.Delete = Delete;
7212
7474
  function Update(params) {
7213
7475
  return __awaiter(this, void 0, void 0, function* () {
7214
- const { api, tag: data, req: reqParams } = params;
7476
+ let { api, tag: data, req: reqParams } = params;
7477
+ if (!api) {
7478
+ api = ENVIRONMENT.Api().GetBruceApi();
7479
+ }
7215
7480
  const url = data.ID ? `layer/${data.ID}` : "layer";
7216
7481
  const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
7217
7482
  api.Cache.Remove(GetCacheKey(data.ID));
@@ -7241,7 +7506,10 @@ var EntityType;
7241
7506
  EntityType.GetListCacheKey = GetListCacheKey;
7242
7507
  function Get(params) {
7243
7508
  return __awaiter(this, void 0, void 0, function* () {
7244
- const { api, entityTypeId: typeId, req: reqParams } = params;
7509
+ let { api, entityTypeId: typeId, req: reqParams } = params;
7510
+ if (!api) {
7511
+ api = ENVIRONMENT.Api().GetBruceApi();
7512
+ }
7245
7513
  if (!typeId) {
7246
7514
  throw ("Type ID is required.");
7247
7515
  }
@@ -7272,7 +7540,10 @@ var EntityType;
7272
7540
  EntityType.Get = Get;
7273
7541
  function Delete(params) {
7274
7542
  return __awaiter(this, void 0, void 0, function* () {
7275
- const { api, entityTypeId: typeId, req: reqParams } = params;
7543
+ let { api, entityTypeId: typeId, req: reqParams } = params;
7544
+ if (!api) {
7545
+ api = ENVIRONMENT.Api().GetBruceApi();
7546
+ }
7276
7547
  if (!typeId) {
7277
7548
  throw ("Type ID is required.");
7278
7549
  }
@@ -7284,7 +7555,10 @@ var EntityType;
7284
7555
  EntityType.Delete = Delete;
7285
7556
  function GetList(params) {
7286
7557
  return __awaiter(this, void 0, void 0, function* () {
7287
- const { api, req: reqParams } = params;
7558
+ let { api, req: reqParams } = params;
7559
+ if (!api) {
7560
+ api = ENVIRONMENT.Api().GetBruceApi();
7561
+ }
7288
7562
  const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
7289
7563
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
7290
7564
  return cache.data;
@@ -7313,6 +7587,9 @@ var EntityType;
7313
7587
  function Update(params) {
7314
7588
  return __awaiter(this, void 0, void 0, function* () {
7315
7589
  let { api, entityType: data, req: reqParams } = params;
7590
+ if (!api) {
7591
+ api = ENVIRONMENT.Api().GetBruceApi();
7592
+ }
7316
7593
  if (!data) {
7317
7594
  data = {};
7318
7595
  }
@@ -7905,7 +8182,10 @@ var EntityCoords;
7905
8182
  EntityCoords.GetCacheKey = GetCacheKey;
7906
8183
  function GetEntityCoords(params) {
7907
8184
  return __awaiter(this, void 0, void 0, function* () {
7908
- const { api, rootEntityId: entityId, req: reqParams } = params;
8185
+ let { api, rootEntityId: entityId, req: reqParams } = params;
8186
+ if (!api) {
8187
+ api = ENVIRONMENT.Api().GetBruceApi();
8188
+ }
7909
8189
  const cache = yield api.GetCacheItem(GetCacheKey(entityId), reqParams);
7910
8190
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
7911
8191
  return cache.data;
@@ -7932,7 +8212,10 @@ var EntityCoords;
7932
8212
  EntityCoords.GetEntityCoords = GetEntityCoords;
7933
8213
  function EntityRelativeToPoint(params) {
7934
8214
  return __awaiter(this, void 0, void 0, function* () {
7935
- const { api, rootEntityId: entityId, req: reqParams } = params;
8215
+ let { api, rootEntityId: entityId, req: reqParams } = params;
8216
+ if (!api) {
8217
+ api = ENVIRONMENT.Api().GetBruceApi();
8218
+ }
7936
8219
  if (!params.test) {
7937
8220
  yield UnlinkCoords({
7938
8221
  api,
@@ -7969,7 +8252,10 @@ var EntityCoords;
7969
8252
  function EntityRelativeToEpsg(params) {
7970
8253
  var _a;
7971
8254
  return __awaiter(this, void 0, void 0, function* () {
7972
- const { api, rootEntityId: entityId, req: reqParams } = params;
8255
+ let { api, rootEntityId: entityId, req: reqParams } = params;
8256
+ if (!api) {
8257
+ api = ENVIRONMENT.Api().GetBruceApi();
8258
+ }
7973
8259
  if (!params.test) {
7974
8260
  yield UnlinkCoords({
7975
8261
  api,
@@ -8003,7 +8289,10 @@ var EntityCoords;
8003
8289
  EntityCoords.EntityRelativeToEpsg = EntityRelativeToEpsg;
8004
8290
  function EntityRelativeToUcs(params) {
8005
8291
  return __awaiter(this, void 0, void 0, function* () {
8006
- const { api, rootEntityId: entityId, req: reqParams } = params;
8292
+ let { api, rootEntityId: entityId, req: reqParams } = params;
8293
+ if (!api) {
8294
+ api = ENVIRONMENT.Api().GetBruceApi();
8295
+ }
8007
8296
  if (!params.test) {
8008
8297
  yield UnlinkCoords({
8009
8298
  api,
@@ -8029,7 +8318,10 @@ var EntityCoords;
8029
8318
  EntityCoords.EntityRelativeToUcs = EntityRelativeToUcs;
8030
8319
  function UnlinkCoords(params) {
8031
8320
  return __awaiter(this, void 0, void 0, function* () {
8032
- const { api, rootEntityId: entityId, req: reqParams } = params;
8321
+ let { api, rootEntityId: entityId, req: reqParams } = params;
8322
+ if (!api) {
8323
+ api = ENVIRONMENT.Api().GetBruceApi();
8324
+ }
8033
8325
  return api.DELETE(`entity/${entityId}/ucs`, reqParams);
8034
8326
  });
8035
8327
  }
@@ -8079,7 +8371,10 @@ var Uploader;
8079
8371
  Uploader.MIN_LARGE_FILE_SIZE = 100000000; // 100MB.
8080
8372
  function DoMultiPartUpload(params) {
8081
8373
  return __awaiter(this, void 0, void 0, function* () {
8082
- const { file, api, urlSuffix: url, req, onProgress } = params;
8374
+ let { file, api, urlSuffix: url, req, onProgress } = params;
8375
+ if (!api) {
8376
+ api = ENVIRONMENT.Api().GetBruceApi();
8377
+ }
8083
8378
  const FILE_PORTION_SIZE = 100000000; // 100MB.
8084
8379
  let fileSize = file.size;
8085
8380
  let fileOffset = 0;
@@ -8148,18 +8443,27 @@ var ClientFile;
8148
8443
  }
8149
8444
  ClientFile.GetCacheKey = GetCacheKey;
8150
8445
  function GetUrl(params) {
8151
- const { api, fileId } = params;
8446
+ let { api, fileId } = params;
8447
+ if (!api) {
8448
+ api = ENVIRONMENT.Api().GetBruceApi();
8449
+ }
8152
8450
  return `${api.GetBaseUrl()}file/${fileId}`;
8153
8451
  }
8154
8452
  ClientFile.GetUrl = GetUrl;
8155
8453
  function GetUrlWithExt(params) {
8156
- const { api, file } = params;
8454
+ let { api, file } = params;
8455
+ if (!api) {
8456
+ api = ENVIRONMENT.Api().GetBruceApi();
8457
+ }
8157
8458
  return `${api.GetBaseUrl()}file/${file.ID}${file.FileExt ? file.FileExt : ""}`;
8158
8459
  }
8159
8460
  ClientFile.GetUrlWithExt = GetUrlWithExt;
8160
8461
  function Get(params) {
8161
8462
  return __awaiter(this, void 0, void 0, function* () {
8162
- const { api, fileId, req: reqParams } = params;
8463
+ let { api, fileId, req: reqParams } = params;
8464
+ if (!api) {
8465
+ api = ENVIRONMENT.Api().GetBruceApi();
8466
+ }
8163
8467
  if (!fileId) {
8164
8468
  throw ("File ID is required.");
8165
8469
  }
@@ -8190,7 +8494,10 @@ var ClientFile;
8190
8494
  ClientFile.Get = Get;
8191
8495
  function Delete(params) {
8192
8496
  return __awaiter(this, void 0, void 0, function* () {
8193
- const { api, fileIds, req: reqParams } = params;
8497
+ let { api, fileIds, req: reqParams } = params;
8498
+ if (!api) {
8499
+ api = ENVIRONMENT.Api().GetBruceApi();
8500
+ }
8194
8501
  if (!fileIds.length) {
8195
8502
  throw ("File IDs are required.");
8196
8503
  }
@@ -8208,6 +8515,9 @@ var ClientFile;
8208
8515
  function Upload(params) {
8209
8516
  return __awaiter(this, void 0, void 0, function* () {
8210
8517
  let { api, file, purpose, req, onProgress } = params;
8518
+ if (!api) {
8519
+ api = ENVIRONMENT.Api().GetBruceApi();
8520
+ }
8211
8521
  if (!file) {
8212
8522
  throw ("File is required.");
8213
8523
  }
@@ -8263,6 +8573,9 @@ var ClientFile;
8263
8573
  function UpdatePurpose(params) {
8264
8574
  return __awaiter(this, void 0, void 0, function* () {
8265
8575
  let { api, fileId, purpose, req: reqParams } = params;
8576
+ if (!api) {
8577
+ api = ENVIRONMENT.Api().GetBruceApi();
8578
+ }
8266
8579
  if (!purpose) {
8267
8580
  purpose = "";
8268
8581
  }
@@ -8283,6 +8596,9 @@ var ClientFile;
8283
8596
  function UploadTemp(params) {
8284
8597
  return __awaiter(this, void 0, void 0, function* () {
8285
8598
  let { api, file, req, onProgress } = params;
8599
+ if (!api) {
8600
+ api = ENVIRONMENT.Api().GetBruceApi();
8601
+ }
8286
8602
  if (!file) {
8287
8603
  throw ("File is required.");
8288
8604
  }
@@ -8346,7 +8662,10 @@ var ClientFile;
8346
8662
  })(Filter = ClientFile.Filter || (ClientFile.Filter = {}));
8347
8663
  function GetList(params) {
8348
8664
  return __awaiter(this, void 0, void 0, function* () {
8349
- const { api, filter, req: reqParams } = params;
8665
+ let { api, filter, req: reqParams } = params;
8666
+ if (!api) {
8667
+ api = ENVIRONMENT.Api().GetBruceApi();
8668
+ }
8350
8669
  const data = yield api.POST("files/filtered", filter, Api.PrepReqParams(reqParams));
8351
8670
  return {
8352
8671
  clientFiles: data.Items,
@@ -8364,7 +8683,10 @@ var ClientFile;
8364
8683
  })(EConvertExt = Processor.EConvertExt || (Processor.EConvertExt = {}));
8365
8684
  function ConvertFormat(params) {
8366
8685
  return __awaiter(this, void 0, void 0, function* () {
8367
- const { api, fileId: clientFileId, ext, req: reqParams } = params;
8686
+ let { api, fileId: clientFileId, ext, req: reqParams } = params;
8687
+ if (!api) {
8688
+ api = ENVIRONMENT.Api().GetBruceApi();
8689
+ }
8368
8690
  if (!clientFileId || !ext) {
8369
8691
  throw ("Client File ID and extension are required.");
8370
8692
  }
@@ -8402,7 +8724,10 @@ var ProgramKey;
8402
8724
  })(EProgramId = ProgramKey.EProgramId || (ProgramKey.EProgramId = {}));
8403
8725
  function Get(params) {
8404
8726
  return __awaiter(this, void 0, void 0, function* () {
8405
- const { api, programId, req: reqParams } = params;
8727
+ let { api, programId, req: reqParams } = params;
8728
+ if (!api) {
8729
+ api = ENVIRONMENT.Api().GetBruceApi();
8730
+ }
8406
8731
  if (!programId) {
8407
8732
  throw ("Program ID is required.");
8408
8733
  }
@@ -8433,7 +8758,10 @@ var ProgramKey;
8433
8758
  ProgramKey.Get = Get;
8434
8759
  function GetList(params) {
8435
8760
  return __awaiter(this, void 0, void 0, function* () {
8436
- const { api, req: reqParams } = params;
8761
+ let { api, req: reqParams } = params;
8762
+ if (!api) {
8763
+ api = ENVIRONMENT.Api().GetBruceApi();
8764
+ }
8437
8765
  const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
8438
8766
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
8439
8767
  return cache.data;
@@ -8460,7 +8788,10 @@ var ProgramKey;
8460
8788
  ProgramKey.GetList = GetList;
8461
8789
  function Delete(params) {
8462
8790
  return __awaiter(this, void 0, void 0, function* () {
8463
- const { api, programId, req: reqParams } = params;
8791
+ let { api, programId, req: reqParams } = params;
8792
+ if (!api) {
8793
+ api = ENVIRONMENT.Api().GetBruceApi();
8794
+ }
8464
8795
  if (!programId) {
8465
8796
  throw ("Program ID is required.");
8466
8797
  }
@@ -8472,7 +8803,10 @@ var ProgramKey;
8472
8803
  ProgramKey.Delete = Delete;
8473
8804
  function Update(params) {
8474
8805
  return __awaiter(this, void 0, void 0, function* () {
8475
- const { api, programKey: data, req: reqParams } = params;
8806
+ let { api, programKey: data, req: reqParams } = params;
8807
+ if (!api) {
8808
+ api = ENVIRONMENT.Api().GetBruceApi();
8809
+ }
8476
8810
  if (!(data === null || data === void 0 ? void 0 : data.ProgramId)) {
8477
8811
  throw ("Program ID is required.");
8478
8812
  }
@@ -8545,7 +8879,10 @@ var Tileset;
8545
8879
  })(EPivot = Tileset.EPivot || (Tileset.EPivot = {}));
8546
8880
  function Get(params) {
8547
8881
  return __awaiter(this, void 0, void 0, function* () {
8548
- const { api, tilesetId, loadFiles, req: reqParams } = params;
8882
+ let { api, tilesetId, loadFiles, req: reqParams } = params;
8883
+ if (!api) {
8884
+ api = ENVIRONMENT.Api().GetBruceApi();
8885
+ }
8549
8886
  if (!tilesetId) {
8550
8887
  throw ("Tileset ID is required.");
8551
8888
  }
@@ -8576,13 +8913,18 @@ var Tileset;
8576
8913
  /**
8577
8914
  * Returns tileset types for given tileset ids.
8578
8915
  * @param params
8916
+ * @deprecated Just use GetList and Get to find the type from the tileset record.
8579
8917
  * @returns
8580
8918
  */
8581
8919
  function GetTypes(params) {
8582
8920
  return __awaiter(this, void 0, void 0, function* () {
8921
+ // UPDATE: This was corrected, this will be removed.
8583
8922
  // Our api is auto-converting legacy types right now which makes it impossible to know what they are.
8584
8923
  // This uses the legacy end-point which doesn't do that...
8585
- const { api, tilesetIds, req: reqParams } = params;
8924
+ let { api, tilesetIds, req: reqParams } = params;
8925
+ if (!api) {
8926
+ api = ENVIRONMENT.Api().GetBruceApi();
8927
+ }
8586
8928
  const mapping = {};
8587
8929
  if (tilesetIds.length == 1) {
8588
8930
  const tileset = yield api.GET("ui.tileset/" + tilesetIds[0], Api.PrepReqParams(reqParams));
@@ -8606,7 +8948,10 @@ var Tileset;
8606
8948
  Tileset.GetTypes = GetTypes;
8607
8949
  function GetList(params) {
8608
8950
  return __awaiter(this, void 0, void 0, function* () {
8609
- const { api, req: reqParams } = params;
8951
+ let { api, req: reqParams } = params;
8952
+ if (!api) {
8953
+ api = ENVIRONMENT.Api().GetBruceApi();
8954
+ }
8610
8955
  const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
8611
8956
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
8612
8957
  return cache.data;
@@ -8633,7 +8978,10 @@ var Tileset;
8633
8978
  Tileset.GetList = GetList;
8634
8979
  function Delete(params) {
8635
8980
  return __awaiter(this, void 0, void 0, function* () {
8636
- const { api, tilesetId, req: reqParams } = params;
8981
+ let { api, tilesetId, req: reqParams } = params;
8982
+ if (!api) {
8983
+ api = ENVIRONMENT.Api().GetBruceApi();
8984
+ }
8637
8985
  if (!tilesetId) {
8638
8986
  throw ("Tileset ID is required.");
8639
8987
  }
@@ -8646,6 +8994,9 @@ var Tileset;
8646
8994
  function Update(params) {
8647
8995
  return __awaiter(this, void 0, void 0, function* () {
8648
8996
  let { api, tileset: data, req: reqParams } = params;
8997
+ if (!api) {
8998
+ api = ENVIRONMENT.Api().GetBruceApi();
8999
+ }
8649
9000
  if (!(data === null || data === void 0 ? void 0 : data.name) || !(data === null || data === void 0 ? void 0 : data.type)) {
8650
9001
  throw ("Tileset name and type are required.");
8651
9002
  }
@@ -8666,6 +9017,9 @@ var Tileset;
8666
9017
  function UploadFile(params) {
8667
9018
  return __awaiter(this, void 0, void 0, function* () {
8668
9019
  let { api, file, req, tilesetId, onProgress } = params;
9020
+ if (!api) {
9021
+ api = ENVIRONMENT.Api().GetBruceApi();
9022
+ }
8669
9023
  if (!tilesetId || !file) {
8670
9024
  throw ("Tileset ID and file are required.");
8671
9025
  }
@@ -8703,7 +9057,10 @@ var Tileset;
8703
9057
  Tileset.UploadFile = UploadFile;
8704
9058
  function DeleteFile(params) {
8705
9059
  return __awaiter(this, void 0, void 0, function* () {
8706
- const { api, tilesetId, file, req: reqParams } = params;
9060
+ let { api, tilesetId, file, req: reqParams } = params;
9061
+ if (!api) {
9062
+ api = ENVIRONMENT.Api().GetBruceApi();
9063
+ }
8707
9064
  if (!tilesetId || !file) {
8708
9065
  throw ("Tileset ID and file are required.");
8709
9066
  }
@@ -8715,6 +9072,9 @@ var Tileset;
8715
9072
  function UploadSrcFile(params) {
8716
9073
  return __awaiter(this, void 0, void 0, function* () {
8717
9074
  let { api, file, req, tilesetId, onProgress } = params;
9075
+ if (!api) {
9076
+ api = ENVIRONMENT.Api().GetBruceApi();
9077
+ }
8718
9078
  if (!tilesetId || !file) {
8719
9079
  throw ("Tileset ID and file are required.");
8720
9080
  }
@@ -8753,7 +9113,10 @@ var Tileset;
8753
9113
  Tileset.UploadSrcFile = UploadSrcFile;
8754
9114
  function DeleteSrcFile(params) {
8755
9115
  return __awaiter(this, void 0, void 0, function* () {
8756
- const { api, tilesetId, file, req: reqParams } = params;
9116
+ let { api, tilesetId, file, req: reqParams } = params;
9117
+ if (!api) {
9118
+ api = ENVIRONMENT.Api().GetBruceApi();
9119
+ }
8757
9120
  if (!tilesetId || !file) {
8758
9121
  throw ("Tileset ID and file are required.");
8759
9122
  }
@@ -8764,6 +9127,9 @@ var Tileset;
8764
9127
  Tileset.DeleteSrcFile = DeleteSrcFile;
8765
9128
  function GetFileUrl(params) {
8766
9129
  let { api, tilesetId, file } = params;
9130
+ if (!api) {
9131
+ api = ENVIRONMENT.Api().GetBruceApi();
9132
+ }
8767
9133
  if (!tilesetId) {
8768
9134
  throw ("Tileset ID is required.");
8769
9135
  }
@@ -8775,6 +9141,9 @@ var Tileset;
8775
9141
  Tileset.GetFileUrl = GetFileUrl;
8776
9142
  function GetSrcFileUrl(params) {
8777
9143
  let { api, tilesetId, file } = params;
9144
+ if (!api) {
9145
+ api = ENVIRONMENT.Api().GetBruceApi();
9146
+ }
8778
9147
  if (!tilesetId) {
8779
9148
  throw ("Tileset ID is required.");
8780
9149
  }
@@ -8786,6 +9155,9 @@ var Tileset;
8786
9155
  Tileset.GetSrcFileUrl = GetSrcFileUrl;
8787
9156
  function GetPublicFileUrl(params) {
8788
9157
  let { api, tilesetId, file } = params;
9158
+ if (!api) {
9159
+ api = ENVIRONMENT.Api().GetBruceApi();
9160
+ }
8789
9161
  if (!tilesetId) {
8790
9162
  throw ("Tileset ID is required.");
8791
9163
  }
@@ -8797,7 +9169,10 @@ var Tileset;
8797
9169
  Tileset.GetPublicFileUrl = GetPublicFileUrl;
8798
9170
  function Generate(params) {
8799
9171
  return __awaiter(this, void 0, void 0, function* () {
8800
- const { api, tilesetId, req: reqParams } = params;
9172
+ let { api, tilesetId, req: reqParams } = params;
9173
+ if (!api) {
9174
+ api = ENVIRONMENT.Api().GetBruceApi();
9175
+ }
8801
9176
  if (!tilesetId) {
8802
9177
  throw ("Tileset ID is required.");
8803
9178
  }
@@ -8819,7 +9194,10 @@ var Tileset;
8819
9194
  Publish.GetCacheKey = GetCacheKey;
8820
9195
  function Update(params) {
8821
9196
  return __awaiter(this, void 0, void 0, function* () {
8822
- const { api, published: data, req: reqParams } = params;
9197
+ let { api, published: data, req: reqParams } = params;
9198
+ if (!api) {
9199
+ api = ENVIRONMENT.Api().GetGlobalApi();
9200
+ }
8823
9201
  if (!(data === null || data === void 0 ? void 0 : data["Tileset.ID"]) || !(data === null || data === void 0 ? void 0 : data["PublishedBy.ClientAccount.ID"]) || !(data === null || data === void 0 ? void 0 : data["PublishedBy.User.ID"])) {
8824
9202
  throw ("Tileset ID, client account ID, and user ID are required.");
8825
9203
  }
@@ -8842,7 +9220,10 @@ var Tileset;
8842
9220
  Publish.Update = Update;
8843
9221
  function Get(params) {
8844
9222
  return __awaiter(this, void 0, void 0, function* () {
8845
- const { api, accountId, tilesetId, req: reqParams } = params;
9223
+ let { api, accountId, tilesetId, req: reqParams } = params;
9224
+ if (!api) {
9225
+ api = ENVIRONMENT.Api().GetGlobalApi();
9226
+ }
8846
9227
  if (!accountId || !tilesetId) {
8847
9228
  throw ("Client account ID and tileset ID are required.");
8848
9229
  }
@@ -8872,7 +9253,10 @@ var Tileset;
8872
9253
  Publish.Get = Get;
8873
9254
  function GetList(params) {
8874
9255
  return __awaiter(this, void 0, void 0, function* () {
8875
- const { api, accountId, req: reqParams } = params;
9256
+ let { api, accountId, req: reqParams } = params;
9257
+ if (!api) {
9258
+ api = ENVIRONMENT.Api().GetGlobalApi();
9259
+ }
8876
9260
  if (!accountId) {
8877
9261
  throw ("Client account ID is required.");
8878
9262
  }
@@ -9065,7 +9449,10 @@ var ProjectViewBookmark;
9065
9449
  })(Navigator = ProjectViewBookmark.Navigator || (ProjectViewBookmark.Navigator = {}));
9066
9450
  function Get(params) {
9067
9451
  return __awaiter(this, void 0, void 0, function* () {
9068
- const { api, viewId, bookmarkId, req: reqParams } = params;
9452
+ let { api, viewId, bookmarkId, req: reqParams } = params;
9453
+ if (!api) {
9454
+ api = ENVIRONMENT.Api().GetBruceApi();
9455
+ }
9069
9456
  if (!viewId || !bookmarkId) {
9070
9457
  throw ("View ID and Bookmark ID are required.");
9071
9458
  }
@@ -9096,7 +9483,10 @@ var ProjectViewBookmark;
9096
9483
  ProjectViewBookmark.Get = Get;
9097
9484
  function Delete(params) {
9098
9485
  return __awaiter(this, void 0, void 0, function* () {
9099
- const { api, viewId, bookmarkId, req: reqParams } = params;
9486
+ let { api, viewId, bookmarkId, req: reqParams } = params;
9487
+ if (!api) {
9488
+ api = ENVIRONMENT.Api().GetBruceApi();
9489
+ }
9100
9490
  if (!viewId || !bookmarkId) {
9101
9491
  throw ("View ID and Bookmark ID are required.");
9102
9492
  }
@@ -9108,7 +9498,10 @@ var ProjectViewBookmark;
9108
9498
  ProjectViewBookmark.Delete = Delete;
9109
9499
  function GetList(params) {
9110
9500
  return __awaiter(this, void 0, void 0, function* () {
9111
- const { api, viewId, req: reqParams } = params;
9501
+ let { api, viewId, req: reqParams } = params;
9502
+ if (!api) {
9503
+ api = ENVIRONMENT.Api().GetBruceApi();
9504
+ }
9112
9505
  if (!viewId) {
9113
9506
  throw ("View ID is required.");
9114
9507
  }
@@ -9155,7 +9548,10 @@ var ProjectViewBookmark;
9155
9548
  ProjectViewBookmark.GetList = GetList;
9156
9549
  function Update(params) {
9157
9550
  return __awaiter(this, void 0, void 0, function* () {
9158
- const { api, viewId, bookmark: data, req: reqParams } = params;
9551
+ let { api, viewId, bookmark: data, req: reqParams } = params;
9552
+ if (!api) {
9553
+ api = ENVIRONMENT.Api().GetBruceApi();
9554
+ }
9159
9555
  if (!(data === null || data === void 0 ? void 0 : data.Title)) {
9160
9556
  data.Title = data.ID;
9161
9557
  }
@@ -9170,7 +9566,10 @@ var ProjectViewBookmark;
9170
9566
  ProjectViewBookmark.Update = Update;
9171
9567
  function SetOrder(params) {
9172
9568
  return __awaiter(this, void 0, void 0, function* () {
9173
- const { api, viewId, bookmarkIds, req: reqParams } = params;
9569
+ let { api, viewId, bookmarkIds, req: reqParams } = params;
9570
+ if (!api) {
9571
+ api = ENVIRONMENT.Api().GetBruceApi();
9572
+ }
9174
9573
  const reqData = {
9175
9574
  "UISlide.ID": bookmarkIds,
9176
9575
  "DisplayOrder.Start": 0
@@ -9210,7 +9609,10 @@ var ProjectView;
9210
9609
  })(Navigator = ProjectView.Navigator || (ProjectView.Navigator = {}));
9211
9610
  function Get(params) {
9212
9611
  return __awaiter(this, void 0, void 0, function* () {
9213
- const { api, viewId, req: reqParams } = params;
9612
+ let { api, viewId, req: reqParams } = params;
9613
+ if (!api) {
9614
+ api = ENVIRONMENT.Api().GetBruceApi();
9615
+ }
9214
9616
  if (!viewId) {
9215
9617
  throw ("View ID is required.");
9216
9618
  }
@@ -9241,7 +9643,10 @@ var ProjectView;
9241
9643
  ProjectView.Get = Get;
9242
9644
  function GetList(params) {
9243
9645
  return __awaiter(this, void 0, void 0, function* () {
9244
- const { api, req: reqParams } = params;
9646
+ let { api, req: reqParams } = params;
9647
+ if (!api) {
9648
+ api = ENVIRONMENT.Api().GetBruceApi();
9649
+ }
9245
9650
  const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
9246
9651
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9247
9652
  return cache.data;
@@ -9268,7 +9673,10 @@ var ProjectView;
9268
9673
  ProjectView.GetList = GetList;
9269
9674
  function Delete(params) {
9270
9675
  return __awaiter(this, void 0, void 0, function* () {
9271
- const { api, viewId, req: reqParams } = params;
9676
+ let { api, viewId, req: reqParams } = params;
9677
+ if (!api) {
9678
+ api = ENVIRONMENT.Api().GetBruceApi();
9679
+ }
9272
9680
  if (!viewId) {
9273
9681
  throw ("View ID is required.");
9274
9682
  }
@@ -9281,6 +9689,9 @@ var ProjectView;
9281
9689
  function Update(params) {
9282
9690
  return __awaiter(this, void 0, void 0, function* () {
9283
9691
  let { api, view: data, req: reqParams } = params;
9692
+ if (!api) {
9693
+ api = ENVIRONMENT.Api().GetBruceApi();
9694
+ }
9284
9695
  if (!data) {
9285
9696
  data = {};
9286
9697
  }
@@ -9343,7 +9754,10 @@ var ProjectViewLegacyTile;
9343
9754
  function MergeMapTemplateData(params) {
9344
9755
  var _a;
9345
9756
  return __awaiter(this, void 0, void 0, function* () {
9346
- const { getter, sources: items, addIfMissing, req: reqParams } = params;
9757
+ let { getter, sources: items, addIfMissing, req: reqParams } = params;
9758
+ if (!getter) {
9759
+ getter = ENVIRONMENT.Api().GetBruceGetter();
9760
+ }
9347
9761
  const settings = yield getTemplateSettings(getter, reqParams);
9348
9762
  const maps = (_a = settings.CesiumMapSources) !== null && _a !== void 0 ? _a : [];
9349
9763
  for (let i = 0; i < maps.length; i++) {
@@ -9359,7 +9773,10 @@ var ProjectViewLegacyTile;
9359
9773
  function MergeTerrainTemplateData(params) {
9360
9774
  var _a;
9361
9775
  return __awaiter(this, void 0, void 0, function* () {
9362
- const { getter, sources: items, addIfMissing, req: reqParams } = params;
9776
+ let { getter, sources: items, addIfMissing, req: reqParams } = params;
9777
+ if (!getter) {
9778
+ getter = ENVIRONMENT.Api().GetBruceGetter();
9779
+ }
9363
9780
  const settings = yield getTemplateSettings(getter, reqParams);
9364
9781
  const terrains = (_a = settings.CesiumTerrainSources) !== null && _a !== void 0 ? _a : [];
9365
9782
  for (let i = 0; i < terrains.length; i++) {
@@ -9520,7 +9937,10 @@ var PendingAction;
9520
9937
  })(EMessageType = PendingAction.EMessageType || (PendingAction.EMessageType = {}));
9521
9938
  function Get(params) {
9522
9939
  return __awaiter(this, void 0, void 0, function* () {
9523
- const { api, actionId, req: reqParams } = params;
9940
+ let { api, actionId, req: reqParams } = params;
9941
+ if (!api) {
9942
+ api = ENVIRONMENT.Api().GetBruceApi();
9943
+ }
9524
9944
  if (!actionId) {
9525
9945
  throw ("Action ID is required.");
9526
9946
  }
@@ -9533,7 +9953,10 @@ var PendingAction;
9533
9953
  PendingAction.Get = Get;
9534
9954
  function GetRelevantList(params) {
9535
9955
  return __awaiter(this, void 0, void 0, function* () {
9536
- const { api, stricter, reqParams } = params;
9956
+ let { api, stricter, reqParams } = params;
9957
+ if (!api) {
9958
+ api = ENVIRONMENT.Api().GetBruceApi();
9959
+ }
9537
9960
  const data = yield api.GET(`pendingActions/important?Update=${Boolean(stricter)}`, Api.PrepReqParams(reqParams));
9538
9961
  return {
9539
9962
  actions: data.Items
@@ -9544,6 +9967,9 @@ var PendingAction;
9544
9967
  function GetMessages(params) {
9545
9968
  return __awaiter(this, void 0, void 0, function* () {
9546
9969
  let { api, actionId, order, startIndex, amount, req: reqParams, types } = params;
9970
+ if (!api) {
9971
+ api = ENVIRONMENT.Api().GetBruceApi();
9972
+ }
9547
9973
  if (amount == null) {
9548
9974
  amount = 500;
9549
9975
  }
@@ -9598,7 +10024,10 @@ var Style;
9598
10024
  })(EPointType = Style.EPointType || (Style.EPointType = {}));
9599
10025
  function GetList(params) {
9600
10026
  return __awaiter(this, void 0, void 0, function* () {
9601
- const { api, req: reqParams } = params;
10027
+ let { api, req: reqParams } = params;
10028
+ if (!api) {
10029
+ api = ENVIRONMENT.Api().GetBruceApi();
10030
+ }
9602
10031
  const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
9603
10032
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9604
10033
  return cache.data;
@@ -9625,7 +10054,10 @@ var Style;
9625
10054
  Style.GetList = GetList;
9626
10055
  function Get(params) {
9627
10056
  return __awaiter(this, void 0, void 0, function* () {
9628
- const { api, styleId: id, req: reqParams } = params;
10057
+ let { api, styleId: id, req: reqParams } = params;
10058
+ if (!api) {
10059
+ api = ENVIRONMENT.Api().GetBruceApi();
10060
+ }
9629
10061
  if (!id) {
9630
10062
  throw ("Style ID is required.");
9631
10063
  }
@@ -9655,7 +10087,10 @@ var Style;
9655
10087
  Style.Get = Get;
9656
10088
  function Update(params) {
9657
10089
  return __awaiter(this, void 0, void 0, function* () {
9658
- const { api, style: data, req: reqParams } = params;
10090
+ let { api, style: data, req: reqParams } = params;
10091
+ if (!api) {
10092
+ api = ENVIRONMENT.Api().GetBruceApi();
10093
+ }
9659
10094
  if (!(data === null || data === void 0 ? void 0 : data.Name)) {
9660
10095
  throw ("Style name is required.");
9661
10096
  }
@@ -9673,7 +10108,10 @@ var Style;
9673
10108
  Style.Update = Update;
9674
10109
  function Delete(params) {
9675
10110
  return __awaiter(this, void 0, void 0, function* () {
9676
- const { api, styleId: id, req: reqParams } = params;
10111
+ let { api, styleId: id, req: reqParams } = params;
10112
+ if (!api) {
10113
+ api = ENVIRONMENT.Api().GetBruceApi();
10114
+ }
9677
10115
  if (!id) {
9678
10116
  throw ("Style ID is required.");
9679
10117
  }
@@ -9715,7 +10153,10 @@ var Session;
9715
10153
  }
9716
10154
  function Get(params) {
9717
10155
  return __awaiter(this, void 0, void 0, function* () {
9718
- const { api, sessionId, req: reqParams } = params;
10156
+ let { api, sessionId, req: reqParams } = params;
10157
+ if (!api) {
10158
+ api = ENVIRONMENT.Api().GetGuardianApi();
10159
+ }
9719
10160
  if (!sessionId) {
9720
10161
  throw ("Session ID is required.");
9721
10162
  }
@@ -9753,7 +10194,10 @@ var Session;
9753
10194
  */
9754
10195
  function Login(params) {
9755
10196
  return __awaiter(this, void 0, void 0, function* () {
9756
- const { api, username, password, accountId, req: reqParams } = params;
10197
+ let { api, username, password, accountId, req: reqParams } = params;
10198
+ if (!api) {
10199
+ api = ENVIRONMENT.Api().GetGuardianApi();
10200
+ }
9757
10201
  const data = yield api.POST("login", {
9758
10202
  account: accountId ? accountId : "",
9759
10203
  login: username,
@@ -9771,7 +10215,10 @@ var Session;
9771
10215
  Session.Login = Login;
9772
10216
  function Logout(params) {
9773
10217
  return __awaiter(this, void 0, void 0, function* () {
9774
- const { api, req: reqParams } = params;
10218
+ let { api, req: reqParams } = params;
10219
+ if (!api) {
10220
+ api = ENVIRONMENT.Api().GetGuardianApi();
10221
+ }
9775
10222
  const ssid = api.GetSessionId();
9776
10223
  if (ssid) {
9777
10224
  yield api.POST("logout", null, reqParams);
@@ -9843,7 +10290,10 @@ var UserGroup;
9843
10290
  (function (UserGroup) {
9844
10291
  function GetByName(params) {
9845
10292
  return __awaiter(this, void 0, void 0, function* () {
9846
- const { api, accountId, name, req: reqParams } = params;
10293
+ let { api, accountId, name, req: reqParams } = params;
10294
+ if (!api) {
10295
+ api = ENVIRONMENT.Api().GetGuardianApi();
10296
+ }
9847
10297
  if (!name || !accountId) {
9848
10298
  throw ("Name and AccountID are required.");
9849
10299
  }
@@ -9856,7 +10306,10 @@ var UserGroup;
9856
10306
  UserGroup.GetByName = GetByName;
9857
10307
  function GetUsers(params) {
9858
10308
  return __awaiter(this, void 0, void 0, function* () {
9859
- const { api, accountId, groupId: id, req: reqParams } = params;
10309
+ let { api, accountId, groupId: id, req: reqParams } = params;
10310
+ if (!api) {
10311
+ api = ENVIRONMENT.Api().GetGuardianApi();
10312
+ }
9860
10313
  if (!accountId || !id) {
9861
10314
  throw ("AccountID and ID are required.");
9862
10315
  }
@@ -9869,7 +10322,10 @@ var UserGroup;
9869
10322
  UserGroup.GetUsers = GetUsers;
9870
10323
  function GetListByPerm(params) {
9871
10324
  return __awaiter(this, void 0, void 0, function* () {
9872
- const { api, accountId, perm, req: reqParams } = params;
10325
+ let { api, accountId, perm, req: reqParams } = params;
10326
+ if (!api) {
10327
+ api = ENVIRONMENT.Api().GetGuardianApi();
10328
+ }
9873
10329
  if (!accountId || !perm) {
9874
10330
  throw ("AccountID and Perm are required.");
9875
10331
  }
@@ -9882,7 +10338,10 @@ var UserGroup;
9882
10338
  UserGroup.GetListByPerm = GetListByPerm;
9883
10339
  function GetList(params) {
9884
10340
  return __awaiter(this, void 0, void 0, function* () {
9885
- const { api, accountId, req: reqParams } = params;
10341
+ let { api, accountId, req: reqParams } = params;
10342
+ if (!api) {
10343
+ api = ENVIRONMENT.Api().GetGuardianApi();
10344
+ }
9886
10345
  if (!accountId) {
9887
10346
  throw ("AccountID is required.");
9888
10347
  }
@@ -9895,7 +10354,10 @@ var UserGroup;
9895
10354
  UserGroup.GetList = GetList;
9896
10355
  function Delete(params) {
9897
10356
  return __awaiter(this, void 0, void 0, function* () {
9898
- const { api, accountId, groupId: id, req: reqParams } = params;
10357
+ let { api, accountId, groupId: id, req: reqParams } = params;
10358
+ if (!api) {
10359
+ api = ENVIRONMENT.Api().GetGuardianApi();
10360
+ }
9899
10361
  if (!accountId || !id) {
9900
10362
  throw ("AccountID and ID are required.");
9901
10363
  }
@@ -9905,7 +10367,10 @@ var UserGroup;
9905
10367
  UserGroup.Delete = Delete;
9906
10368
  function Update(params) {
9907
10369
  return __awaiter(this, void 0, void 0, function* () {
9908
- const { api, group: data, reqParams } = params;
10370
+ let { api, group: data, reqParams } = params;
10371
+ if (!api) {
10372
+ api = ENVIRONMENT.Api().GetGuardianApi();
10373
+ }
9909
10374
  if (!data.Name || !data["ClientAccount.ID"]) {
9910
10375
  throw ("User group name and client account ID are required.");
9911
10376
  }
@@ -9952,7 +10417,10 @@ var User;
9952
10417
  })(EType = User.EType || (User.EType = {}));
9953
10418
  function Get(params) {
9954
10419
  return __awaiter(this, void 0, void 0, function* () {
9955
- const { api, userId: id, accountId, req: reqParams } = params;
10420
+ let { api, userId: id, accountId, req: reqParams } = params;
10421
+ if (!api) {
10422
+ api = ENVIRONMENT.Api().GetGuardianApi();
10423
+ }
9956
10424
  if (!id) {
9957
10425
  throw ("ID is required.");
9958
10426
  }
@@ -9983,7 +10451,10 @@ var User;
9983
10451
  function Update(params) {
9984
10452
  var _a;
9985
10453
  return __awaiter(this, void 0, void 0, function* () {
9986
- const { api, user: data, req: reqParams } = params;
10454
+ let { api, user: data, req: reqParams } = params;
10455
+ if (!api) {
10456
+ api = ENVIRONMENT.Api().GetGuardianApi();
10457
+ }
9987
10458
  if (!(data === null || data === void 0 ? void 0 : data.ID) || !(data === null || data === void 0 ? void 0 : data.Type)) {
9988
10459
  throw ("ID and Type are required.");
9989
10460
  }
@@ -10021,7 +10492,10 @@ var User;
10021
10492
  */
10022
10493
  function GetSettings(params) {
10023
10494
  return __awaiter(this, void 0, void 0, function* () {
10024
- const { api, userId, appId, req } = params;
10495
+ let { api, userId, appId, req } = params;
10496
+ if (!api) {
10497
+ api = ENVIRONMENT.Api().GetGuardianApi();
10498
+ }
10025
10499
  if (!userId || !appId) {
10026
10500
  throw ("UserId and appId are required.");
10027
10501
  }
@@ -10068,7 +10542,10 @@ var User;
10068
10542
  */
10069
10543
  function UpdateSettings(params) {
10070
10544
  return __awaiter(this, void 0, void 0, function* () {
10071
- const { api, accId, userId, appId, settings, req } = params;
10545
+ let { api, accId, userId, appId, settings, req } = params;
10546
+ if (!api) {
10547
+ api = ENVIRONMENT.Api().GetGuardianApi();
10548
+ }
10072
10549
  if (!userId || !appId) {
10073
10550
  throw ("UserId and appId are required.");
10074
10551
  }
@@ -10086,7 +10563,10 @@ var User;
10086
10563
  User.UpdateSettings = UpdateSettings;
10087
10564
  function GetUsernameAvailable(params) {
10088
10565
  return __awaiter(this, void 0, void 0, function* () {
10089
- const { api, username, excludeUserId, req: reqParams } = params;
10566
+ let { api, username, excludeUserId, req: reqParams } = params;
10567
+ if (!api) {
10568
+ api = ENVIRONMENT.Api().GetGuardianApi();
10569
+ }
10090
10570
  if (!username) {
10091
10571
  throw ("Username is required.");
10092
10572
  }
@@ -10114,7 +10594,10 @@ var User;
10114
10594
  LoginUser.GetListCacheKey = GetListCacheKey;
10115
10595
  function GetByEmail(params) {
10116
10596
  return __awaiter(this, void 0, void 0, function* () {
10117
- const { api, email, accountId, req: reqParams } = params;
10597
+ let { api, email, accountId, req: reqParams } = params;
10598
+ if (!api) {
10599
+ api = ENVIRONMENT.Api().GetGuardianApi();
10600
+ }
10118
10601
  if (!email) {
10119
10602
  throw ("Email is required.");
10120
10603
  }
@@ -10145,6 +10628,9 @@ var User;
10145
10628
  function GetList(params) {
10146
10629
  return __awaiter(this, void 0, void 0, function* () {
10147
10630
  let { api, accountId, exclusive, req: reqParams } = params;
10631
+ if (!api) {
10632
+ api = ENVIRONMENT.Api().GetGuardianApi();
10633
+ }
10148
10634
  if (!accountId) {
10149
10635
  throw ("Client account ID is required.");
10150
10636
  }
@@ -10196,7 +10682,10 @@ var User;
10196
10682
  */
10197
10683
  function Signup(params) {
10198
10684
  return __awaiter(this, void 0, void 0, function* () {
10199
- const { api, email, req: reqParams } = params;
10685
+ let { api, email, req: reqParams } = params;
10686
+ if (!api) {
10687
+ api = ENVIRONMENT.Api().GetGuardianApi();
10688
+ }
10200
10689
  if (!email) {
10201
10690
  throw ("Email is required.");
10202
10691
  }
@@ -10213,7 +10702,10 @@ var User;
10213
10702
  */
10214
10703
  function SignupResend(params) {
10215
10704
  return __awaiter(this, void 0, void 0, function* () {
10216
- const { api, expiredCode, req: reqParams } = params;
10705
+ let { api, expiredCode, req: reqParams } = params;
10706
+ if (!api) {
10707
+ api = ENVIRONMENT.Api().GetGuardianApi();
10708
+ }
10217
10709
  if (!expiredCode) {
10218
10710
  throw ("Expired activation code is required.");
10219
10711
  }
@@ -10229,6 +10721,9 @@ var User;
10229
10721
  function SignupComplete(params) {
10230
10722
  return __awaiter(this, void 0, void 0, function* () {
10231
10723
  let { api, code, user: data, accountId, req: reqParams } = params;
10724
+ if (!api) {
10725
+ api = ENVIRONMENT.Api().GetGuardianApi();
10726
+ }
10232
10727
  if (!code || !(data === null || data === void 0 ? void 0 : data.Login) || !(data === null || data === void 0 ? void 0 : data.Password)) {
10233
10728
  throw ("Login, password, and activation code are required.");
10234
10729
  }
@@ -10254,7 +10749,10 @@ var User;
10254
10749
  */
10255
10750
  function ForgotPassword(params) {
10256
10751
  return __awaiter(this, void 0, void 0, function* () {
10257
- const { api, accountId, email, req: reqParams } = params;
10752
+ let { api, accountId, email, req: reqParams } = params;
10753
+ if (!api) {
10754
+ api = ENVIRONMENT.Api().GetGuardianApi();
10755
+ }
10258
10756
  if (!accountId || !email) {
10259
10757
  throw ("Account ID and email are required.");
10260
10758
  }
@@ -10283,7 +10781,10 @@ var User;
10283
10781
  */
10284
10782
  function ForgotPasswordComplete(params) {
10285
10783
  return __awaiter(this, void 0, void 0, function* () {
10286
- const { api, code, userId, password, req: reqParams } = params;
10784
+ let { api, code, userId, password, req: reqParams } = params;
10785
+ if (!api) {
10786
+ api = ENVIRONMENT.Api().GetGuardianApi();
10787
+ }
10287
10788
  const { user } = yield Get({
10288
10789
  api: api,
10289
10790
  userId: userId,
@@ -10312,7 +10813,10 @@ var User;
10312
10813
  AccessToken.GetListCacheKey = GetListCacheKey;
10313
10814
  function GetList(params) {
10314
10815
  return __awaiter(this, void 0, void 0, function* () {
10315
- const { api, accountId, req: reqParams } = params;
10816
+ let { api, accountId, req: reqParams } = params;
10817
+ if (!api) {
10818
+ api = ENVIRONMENT.Api().GetGuardianApi();
10819
+ }
10316
10820
  const cache = yield api.GetCacheItem(GetListCacheKey(accountId), reqParams);
10317
10821
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10318
10822
  return cache.data;
@@ -10351,7 +10855,10 @@ var User;
10351
10855
  AccessToken.GetList = GetList;
10352
10856
  function Delete(params) {
10353
10857
  return __awaiter(this, void 0, void 0, function* () {
10354
- const { api, tokenId: id, req: reqParams } = params;
10858
+ let { api, tokenId: id, req: reqParams } = params;
10859
+ if (!api) {
10860
+ api = ENVIRONMENT.Api().GetGuardianApi();
10861
+ }
10355
10862
  yield api.DELETE(`accessToken/${id}`, reqParams);
10356
10863
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + id);
10357
10864
  yield api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
@@ -10361,6 +10868,9 @@ var User;
10361
10868
  function Create(params) {
10362
10869
  return __awaiter(this, void 0, void 0, function* () {
10363
10870
  let { api, token: data, req: reqParams } = params;
10871
+ if (!api) {
10872
+ api = ENVIRONMENT.Api().GetGuardianApi();
10873
+ }
10364
10874
  if (!data) {
10365
10875
  data = {};
10366
10876
  }
@@ -10399,7 +10909,10 @@ var AccountInvite;
10399
10909
  })(EInviteMethod = AccountInvite.EInviteMethod || (AccountInvite.EInviteMethod = {}));
10400
10910
  function GetByCode(params) {
10401
10911
  return __awaiter(this, void 0, void 0, function* () {
10402
- const { api, code, req } = params;
10912
+ let { api, code, req } = params;
10913
+ if (!api) {
10914
+ api = ENVIRONMENT.Api().GetGuardianApi();
10915
+ }
10403
10916
  const res = yield api.GET(`invite/code?inviteCode=${code}`, Api.PrepReqParams(req));
10404
10917
  return res;
10405
10918
  });
@@ -10407,7 +10920,10 @@ var AccountInvite;
10407
10920
  AccountInvite.GetByCode = GetByCode;
10408
10921
  function GetList(params) {
10409
10922
  return __awaiter(this, void 0, void 0, function* () {
10410
- const { api, accountId, userId, req } = params;
10923
+ let { api, accountId, userId, req } = params;
10924
+ if (!api) {
10925
+ api = ENVIRONMENT.Api().GetGuardianApi();
10926
+ }
10411
10927
  const urlParams = new URLSearchParams();
10412
10928
  if (accountId) {
10413
10929
  urlParams.append("accountId", accountId);
@@ -10422,7 +10938,10 @@ var AccountInvite;
10422
10938
  AccountInvite.GetList = GetList;
10423
10939
  function Update(params) {
10424
10940
  return __awaiter(this, void 0, void 0, function* () {
10425
- const { api, code, status, user, req } = params;
10941
+ let { api, code, status, user, req } = params;
10942
+ if (!api) {
10943
+ api = ENVIRONMENT.Api().GetGuardianApi();
10944
+ }
10426
10945
  const res = yield api.POST("invite/update", {
10427
10946
  InviteCode: code,
10428
10947
  Status: status,
@@ -10434,7 +10953,10 @@ var AccountInvite;
10434
10953
  AccountInvite.Update = Update;
10435
10954
  function Create(params) {
10436
10955
  return __awaiter(this, void 0, void 0, function* () {
10437
- const { api, accountId, login, userId, email, mobile, emailTemplateKey, groupIds, req } = params;
10956
+ let { api, accountId, login, userId, email, mobile, emailTemplateKey, groupIds, req } = params;
10957
+ if (!api) {
10958
+ api = ENVIRONMENT.Api().GetGuardianApi();
10959
+ }
10438
10960
  const res = yield api.POST("invite/new", {
10439
10961
  accountId,
10440
10962
  login,
@@ -10569,6 +11091,9 @@ var DataLab;
10569
11091
  function Run(params) {
10570
11092
  return __awaiter(this, void 0, void 0, function* () {
10571
11093
  let { api, query, key, skip, load, req: reqParams } = params;
11094
+ if (!api) {
11095
+ api = ENVIRONMENT.Api().GetBruceApi();
11096
+ }
10572
11097
  if (!key) {
10573
11098
  key = EReqKey.Primary;
10574
11099
  }
@@ -10604,14 +11129,20 @@ var ImportCad;
10604
11129
  (function (ImportCad) {
10605
11130
  function Analyze(params) {
10606
11131
  return __awaiter(this, void 0, void 0, function* () {
10607
- const { api, fileAnalyze, req: reqParams } = params;
11132
+ let { api, fileAnalyze, req: reqParams } = params;
11133
+ if (!api) {
11134
+ api = ENVIRONMENT.Api().GetBruceApi();
11135
+ }
10608
11136
  return api.POST("entities/PrepareIFCForImport", fileAnalyze, Api.PrepReqParams(reqParams));
10609
11137
  });
10610
11138
  }
10611
11139
  ImportCad.Analyze = Analyze;
10612
11140
  function ImportEntities(params) {
10613
11141
  return __awaiter(this, void 0, void 0, function* () {
10614
- const { api, fileImport, req: reqParams } = params;
11142
+ let { api, fileImport, req: reqParams } = params;
11143
+ if (!api) {
11144
+ api = ENVIRONMENT.Api().GetBruceApi();
11145
+ }
10615
11146
  return api.POST("entities/importIFCWithProgress", fileImport, Api.PrepReqParams(reqParams));
10616
11147
  });
10617
11148
  }
@@ -10641,7 +11172,10 @@ var ImportCsv;
10641
11172
  (function (ImportCsv) {
10642
11173
  function ImportEntities(params) {
10643
11174
  return __awaiter(this, void 0, void 0, function* () {
10644
- const { api, fileImport, req: reqParams } = params;
11175
+ let { api, fileImport, req: reqParams } = params;
11176
+ if (!api) {
11177
+ api = ENVIRONMENT.Api().GetBruceApi();
11178
+ }
10645
11179
  return api.POST("entities/importCSVWithProgress2", fileImport, Api.PrepReqParams(reqParams));
10646
11180
  });
10647
11181
  }
@@ -10652,7 +11186,10 @@ var ImportJson;
10652
11186
  (function (ImportJson) {
10653
11187
  function ImportEntities(params) {
10654
11188
  return __awaiter(this, void 0, void 0, function* () {
10655
- const { api, fileImport, req: reqParams } = params;
11189
+ let { api, fileImport, req: reqParams } = params;
11190
+ if (!api) {
11191
+ api = ENVIRONMENT.Api().GetBruceApi();
11192
+ }
10656
11193
  return api.POST("entities/importJsonWithProgress", fileImport, Api.PrepReqParams(reqParams));
10657
11194
  });
10658
11195
  }
@@ -10663,7 +11200,10 @@ var ImportKml;
10663
11200
  (function (ImportKml) {
10664
11201
  function ImportEntities(params) {
10665
11202
  return __awaiter(this, void 0, void 0, function* () {
10666
- const { api, fileImport, req: reqParams } = params;
11203
+ let { api, fileImport, req: reqParams } = params;
11204
+ if (!api) {
11205
+ api = ENVIRONMENT.Api().GetBruceApi();
11206
+ }
10667
11207
  return api.POST("entities/importKMLWithProgress2", fileImport, Api.PrepReqParams(reqParams));
10668
11208
  });
10669
11209
  }
@@ -10692,6 +11232,9 @@ var ImportedFile;
10692
11232
  function GetList(params) {
10693
11233
  return __awaiter(this, void 0, void 0, function* () {
10694
11234
  let { api, fileType: type, pageIndex, req: reqParams } = params;
11235
+ if (!api) {
11236
+ api = ENVIRONMENT.Api().GetBruceApi();
11237
+ }
10695
11238
  if (!type) {
10696
11239
  type = EFileType.All;
10697
11240
  }
@@ -10734,7 +11277,10 @@ var ImportedFile;
10734
11277
  ImportedFile.GetList = GetList;
10735
11278
  function GetListByRootId(params) {
10736
11279
  return __awaiter(this, void 0, void 0, function* () {
10737
- const { api, rootId, req: reqParams } = params;
11280
+ let { api, rootId, req: reqParams } = params;
11281
+ if (!api) {
11282
+ api = ENVIRONMENT.Api().GetBruceApi();
11283
+ }
10738
11284
  const cache = yield api.GetCacheItem(GetCacheKeyByRootId(rootId), reqParams);
10739
11285
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10740
11286
  return cache.data;
@@ -10761,7 +11307,10 @@ var ImportedFile;
10761
11307
  ImportedFile.GetListByRootId = GetListByRootId;
10762
11308
  function Get(params) {
10763
11309
  return __awaiter(this, void 0, void 0, function* () {
10764
- const { api, importedFileId: fileId, req: reqParams } = params;
11310
+ let { api, importedFileId: fileId, req: reqParams } = params;
11311
+ if (!api) {
11312
+ api = ENVIRONMENT.Api().GetBruceApi();
11313
+ }
10765
11314
  const cache = yield api.GetCacheItem(GetCacheKey(fileId), reqParams);
10766
11315
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10767
11316
  return cache.data;
@@ -10983,7 +11532,10 @@ var Plugin;
10983
11532
  Plugin.GetListCacheKey = GetListCacheKey;
10984
11533
  function Get(params) {
10985
11534
  return __awaiter(this, void 0, void 0, function* () {
10986
- const { api, pluginId, req } = params;
11535
+ let { api, pluginId, req } = params;
11536
+ if (!api) {
11537
+ api = ENVIRONMENT.Api().GetBruceApi();
11538
+ }
10987
11539
  if (!pluginId) {
10988
11540
  throw ("Plugin ID is required.");
10989
11541
  }
@@ -11013,7 +11565,10 @@ var Plugin;
11013
11565
  Plugin.Get = Get;
11014
11566
  function GetList(params) {
11015
11567
  return __awaiter(this, void 0, void 0, function* () {
11016
- const { api, req } = params;
11568
+ let { api, req } = params;
11569
+ if (!api) {
11570
+ api = ENVIRONMENT.Api().GetBruceApi();
11571
+ }
11017
11572
  const cache = yield api.GetCacheItem(GetListCacheKey(), req);
11018
11573
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
11019
11574
  return cache.data;
@@ -11040,6 +11595,9 @@ var Plugin;
11040
11595
  Plugin.GetList = GetList;
11041
11596
  function GetLoadUrl(params) {
11042
11597
  let { api, pluginId, req, cacheKey } = params;
11598
+ if (!api) {
11599
+ api = ENVIRONMENT.Api().GetBruceApi();
11600
+ }
11043
11601
  if (!cacheKey) {
11044
11602
  cacheKey = 0;
11045
11603
  }
@@ -11050,5 +11608,5 @@ var Plugin;
11050
11608
  Plugin.GetLoadUrl = GetLoadUrl;
11051
11609
  })(Plugin || (Plugin = {}));
11052
11610
 
11053
- export { 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 };
11611
+ export { 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 };
11054
11612
  //# sourceMappingURL=bruce-models.es5.js.map