bruce-models 4.8.0 → 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.
@@ -14194,7 +14258,7 @@ var DataSource;
14194
14258
  })(DataSource || (DataSource = {}));
14195
14259
 
14196
14260
  // This is updated with the package.json version on build.
14197
- const VERSION = "4.8.0";
14261
+ const VERSION = "4.8.1";
14198
14262
 
14199
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 };
14200
14264
  //# sourceMappingURL=bruce-models.es5.js.map