bruce-models 4.7.9 → 4.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10758,6 +10758,70 @@ var PendingAction;
10758
10758
  });
10759
10759
  }
10760
10760
  PendingAction.Cancel = Cancel;
10761
+ /**
10762
+ * Resolves when the Pending Action is no longer running.
10763
+ * @param params
10764
+ *
10765
+ * @example
10766
+ * try {
10767
+ * const { action } = await PendingAction.OnCompletion({ actionId: 123 });
10768
+ * }
10769
+ * catch (e) {
10770
+ * // Threw because the action failed to be found.
10771
+ * // Most likely scenarios are invalid actionId or server connection issues.
10772
+ * // If it's related to server connection issues then wait a bit and relaunch.
10773
+ * }
10774
+ *
10775
+ * // Here is how you can stop the loop on early disposal.
10776
+ * let disposed = false;
10777
+ * const { action } = await PendingAction.OnCompletion({
10778
+ * actionId: 123,
10779
+ * isDisposed: () => {
10780
+ * return disposed;
10781
+ * }
10782
+ * });
10783
+ * // Action will resolve as null if it was disposed early.
10784
+ */
10785
+ function OnCompletion(params) {
10786
+ return __awaiter(this, void 0, void 0, function* () {
10787
+ let { api, actionId, req: reqParams, interval: intMs, isDisposed } = params;
10788
+ if (!actionId) {
10789
+ throw ("Action ID is required.");
10790
+ }
10791
+ if (!api) {
10792
+ api = ENVIRONMENT.Api().GetBruceApi();
10793
+ }
10794
+ if (!intMs || intMs <= 0) {
10795
+ intMs = 3000;
10796
+ }
10797
+ const res = yield new Promise((res, rej) => {
10798
+ let interval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
10799
+ if (isDisposed && isDisposed()) {
10800
+ clearInterval(interval);
10801
+ res(null);
10802
+ }
10803
+ try {
10804
+ const { action } = yield Get({
10805
+ api,
10806
+ actionId,
10807
+ req: reqParams
10808
+ });
10809
+ if (action.Status !== EStatus.InProgress) {
10810
+ clearInterval(interval);
10811
+ res(action);
10812
+ }
10813
+ }
10814
+ catch (e) {
10815
+ rej(e);
10816
+ }
10817
+ }), intMs);
10818
+ });
10819
+ return {
10820
+ action: res
10821
+ };
10822
+ });
10823
+ }
10824
+ PendingAction.OnCompletion = OnCompletion;
10761
10825
  })(PendingAction || (PendingAction = {}));
10762
10826
 
10763
10827
  // Some dead accounts that we don't want to show in the UI.
@@ -13199,9 +13263,49 @@ var DataLab;
13199
13263
  DataLab.Run = Run;
13200
13264
  })(DataLab || (DataLab = {}));
13201
13265
 
13266
+ var ImportAssembly;
13267
+ (function (ImportAssembly) {
13268
+ function Analyze(params) {
13269
+ return __awaiter(this, void 0, void 0, function* () {
13270
+ let { api, fileAnalyze, req: reqParams } = params;
13271
+ if (!api) {
13272
+ api = ENVIRONMENT.Api().GetBruceApi();
13273
+ }
13274
+ return api.POST("import/analyze/assembly", fileAnalyze, Api.PrepReqParams(reqParams));
13275
+ });
13276
+ }
13277
+ ImportAssembly.Analyze = Analyze;
13278
+ function ImportEntities(params) {
13279
+ return __awaiter(this, void 0, void 0, function* () {
13280
+ let { api, fileImport, req: reqParams } = params;
13281
+ if (!api) {
13282
+ api = ENVIRONMENT.Api().GetBruceApi();
13283
+ }
13284
+ return api.POST("import/assembly", fileImport, Api.PrepReqParams(reqParams));
13285
+ });
13286
+ }
13287
+ ImportAssembly.ImportEntities = ImportEntities;
13288
+ /**
13289
+ * Parses the completed pending action result from running "ImportEntities".
13290
+ * This will return the root entity's id if any is present.
13291
+ * @param paResult
13292
+ */
13293
+ function ParseAnalysisResult(paResult) {
13294
+ try {
13295
+ return typeof paResult == "string" ? JSON.parse(paResult) : paResult;
13296
+ }
13297
+ catch (_a) {
13298
+ // Failed to parse json.
13299
+ }
13300
+ return null;
13301
+ }
13302
+ ImportAssembly.ParseAnalysisResult = ParseAnalysisResult;
13303
+ })(ImportAssembly || (ImportAssembly = {}));
13304
+
13202
13305
  /**
13203
13306
  * TODO: The analysis result is currently a mix of multiple layers of legacy.
13204
13307
  * We will first decide what we want it to do and then describe just the needed portions of the existing implementation.
13308
+ * @deprecated use import-assembly, this will be removed next update.
13205
13309
  */
13206
13310
  var ImportCad;
13207
13311
  (function (ImportCad) {
@@ -13254,7 +13358,7 @@ var ImportCsv;
13254
13358
  if (!api) {
13255
13359
  api = ENVIRONMENT.Api().GetBruceApi();
13256
13360
  }
13257
- return api.POST("entities/importCSVWithProgress2", fileImport, Api.PrepReqParams(reqParams));
13361
+ return api.POST("import/csv", fileImport, Api.PrepReqParams(reqParams));
13258
13362
  });
13259
13363
  }
13260
13364
  ImportCsv.ImportEntities = ImportEntities;
@@ -13268,12 +13372,26 @@ var ImportJson;
13268
13372
  if (!api) {
13269
13373
  api = ENVIRONMENT.Api().GetBruceApi();
13270
13374
  }
13271
- return api.POST("entities/importJsonWithProgress", fileImport, Api.PrepReqParams(reqParams));
13375
+ return api.POST("import/json", fileImport, Api.PrepReqParams(reqParams));
13272
13376
  });
13273
13377
  }
13274
13378
  ImportJson.ImportEntities = ImportEntities;
13275
13379
  })(ImportJson || (ImportJson = {}));
13276
13380
 
13381
+ var ImportGeoJson;
13382
+ (function (ImportGeoJson) {
13383
+ function ImportEntities(params) {
13384
+ return __awaiter(this, void 0, void 0, function* () {
13385
+ let { api, fileImport, req: reqParams } = params;
13386
+ if (!api) {
13387
+ api = ENVIRONMENT.Api().GetBruceApi();
13388
+ }
13389
+ return api.POST("import/geojson", fileImport, Api.PrepReqParams(reqParams));
13390
+ });
13391
+ }
13392
+ ImportGeoJson.ImportEntities = ImportEntities;
13393
+ })(ImportGeoJson || (ImportGeoJson = {}));
13394
+
13277
13395
  var ImportKml;
13278
13396
  (function (ImportKml) {
13279
13397
  function ImportEntities(params) {
@@ -13282,7 +13400,7 @@ var ImportKml;
13282
13400
  if (!api) {
13283
13401
  api = ENVIRONMENT.Api().GetBruceApi();
13284
13402
  }
13285
- return api.POST("entities/importKMLWithProgress2", fileImport, Api.PrepReqParams(reqParams));
13403
+ return api.POST("import/kml", fileImport, Api.PrepReqParams(reqParams));
13286
13404
  });
13287
13405
  }
13288
13406
  ImportKml.ImportEntities = ImportEntities;
@@ -14140,7 +14258,7 @@ var DataSource;
14140
14258
  })(DataSource || (DataSource = {}));
14141
14259
 
14142
14260
  // This is updated with the package.json version on build.
14143
- const VERSION = "4.7.9";
14261
+ const VERSION = "4.8.1";
14144
14262
 
14145
- export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14263
+ export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14146
14264
  //# sourceMappingURL=bruce-models.es5.js.map