bruce-models 7.1.20 → 7.1.21

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.
@@ -40,6 +40,7 @@ var Api;
40
40
  ECacheKey["Entity"] = "entity";
41
41
  ECacheKey["EntityType"] = "entitytype";
42
42
  ECacheKey["EntityTypeTrigger"] = "entitytypetrigger";
43
+ ECacheKey["DataFeed"] = "datafeed";
43
44
  ECacheKey["ProjectView"] = "projectview";
44
45
  ECacheKey["ProjectViewBookmark"] = "pvbookmark";
45
46
  ECacheKey["Tileset"] = "tileset";
@@ -15746,6 +15747,208 @@ var DataLabGroup;
15746
15747
  DataLabGroup.Delete = Delete;
15747
15748
  })(DataLabGroup || (DataLabGroup = {}));
15748
15749
 
15750
+ /**
15751
+ * Describes the "Data Feed" concept within Nextspace.
15752
+ * Each record represents one configured Data Feed endpoint.
15753
+ */
15754
+ var DataFeed;
15755
+ (function (DataFeed) {
15756
+ /**
15757
+ * Known data feed types.
15758
+ */
15759
+ let EType;
15760
+ (function (EType) {
15761
+ EType["WFS"] = "WFS";
15762
+ })(EType = DataFeed.EType || (DataFeed.EType = {}));
15763
+ /**
15764
+ * Returns details of a data feed by ID or Key.
15765
+ * @param params
15766
+ */
15767
+ function Get(params) {
15768
+ return __awaiter(this, void 0, void 0, function* () {
15769
+ let { api, dataFeedId, req: reqParams } = params;
15770
+ if (dataFeedId == null || dataFeedId === "") {
15771
+ throw ("Data Feed ID or Key is required.");
15772
+ }
15773
+ if (!api) {
15774
+ api = ENVIRONMENT.Api().GetBruceApi();
15775
+ }
15776
+ const key = GetCacheKey(dataFeedId);
15777
+ const cache = api.GetCacheItem(key, reqParams);
15778
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
15779
+ return cache.data;
15780
+ }
15781
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
15782
+ try {
15783
+ const data = yield api.GET(`dataFeed/${dataFeedId}`, Api.PrepReqParams(reqParams));
15784
+ res({
15785
+ dataFeed: ParseResponse(data)
15786
+ });
15787
+ }
15788
+ catch (e) {
15789
+ rej(e);
15790
+ }
15791
+ }));
15792
+ api.SetCacheItem({
15793
+ key,
15794
+ value: req,
15795
+ req: reqParams
15796
+ });
15797
+ return req;
15798
+ });
15799
+ }
15800
+ DataFeed.Get = Get;
15801
+ /**
15802
+ * Returns a list of all data feed records.
15803
+ * @param params
15804
+ */
15805
+ function GetList(params) {
15806
+ return __awaiter(this, void 0, void 0, function* () {
15807
+ if (!params) {
15808
+ params = {};
15809
+ }
15810
+ let { api, req: reqParams } = params;
15811
+ if (!api) {
15812
+ api = ENVIRONMENT.Api().GetBruceApi();
15813
+ }
15814
+ const key = GetListCacheKey();
15815
+ const cache = api.GetCacheItem(key, reqParams);
15816
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
15817
+ return cache.data;
15818
+ }
15819
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
15820
+ try {
15821
+ const data = yield api.GET("dataFeeds", Api.PrepReqParams(reqParams));
15822
+ res({
15823
+ dataFeeds: ParseListResponse(data)
15824
+ });
15825
+ }
15826
+ catch (e) {
15827
+ rej(e);
15828
+ }
15829
+ }));
15830
+ api.SetCacheItem({
15831
+ key,
15832
+ value: req,
15833
+ req: reqParams
15834
+ });
15835
+ return req;
15836
+ });
15837
+ }
15838
+ DataFeed.GetList = GetList;
15839
+ /**
15840
+ * Creates or updates a data feed record.
15841
+ * This calls: POST dataFeed/{data_feed_id} where 0 creates new.
15842
+ * @param params
15843
+ */
15844
+ function Update(params) {
15845
+ return __awaiter(this, void 0, void 0, function* () {
15846
+ let { api, dataFeed: data, req: reqParams } = params;
15847
+ if (!api) {
15848
+ api = ENVIRONMENT.Api().GetBruceApi();
15849
+ }
15850
+ if (!data) {
15851
+ data = {};
15852
+ }
15853
+ const id = data.ID && data.ID > 0 ? data.ID : 0;
15854
+ const res = yield api.POST(`dataFeed/${id}`, data, Api.PrepReqParams(reqParams));
15855
+ // Invalidate list and likely keys.
15856
+ api.Cache.Remove(GetListCacheKey());
15857
+ if (id > 0) {
15858
+ api.Cache.Remove(GetCacheKey(id));
15859
+ }
15860
+ if (data.Key) {
15861
+ api.Cache.Remove(GetCacheKey(data.Key));
15862
+ }
15863
+ const parsed = ParseResponse(res);
15864
+ if (parsed === null || parsed === void 0 ? void 0 : parsed.ID) {
15865
+ api.Cache.Remove(GetCacheKey(parsed.ID));
15866
+ }
15867
+ if (parsed === null || parsed === void 0 ? void 0 : parsed.Key) {
15868
+ api.Cache.Remove(GetCacheKey(parsed.Key));
15869
+ }
15870
+ return {
15871
+ dataFeed: parsed
15872
+ };
15873
+ });
15874
+ }
15875
+ DataFeed.Update = Update;
15876
+ /**
15877
+ * Deletes a data feed by numeric ID.
15878
+ * @param params
15879
+ */
15880
+ function Delete(params) {
15881
+ return __awaiter(this, void 0, void 0, function* () {
15882
+ let { api, dataFeedId, req: reqParams } = params;
15883
+ if (!dataFeedId || dataFeedId <= 0) {
15884
+ throw ("Data Feed ID is required.");
15885
+ }
15886
+ if (!api) {
15887
+ api = ENVIRONMENT.Api().GetBruceApi();
15888
+ }
15889
+ yield api.DELETE(`dataFeed/${dataFeedId}`, Api.PrepReqParams(reqParams));
15890
+ api.Cache.Remove(GetCacheKey(dataFeedId));
15891
+ api.Cache.Remove(GetListCacheKey());
15892
+ });
15893
+ }
15894
+ DataFeed.Delete = Delete;
15895
+ /**
15896
+ * Normalizes response from data feed get/update endpoints.
15897
+ */
15898
+ function ParseResponse(response) {
15899
+ var _a, _b, _c, _d, _e, _f;
15900
+ const parsed = parseObject$2(response);
15901
+ const parsedResult = (_a = parseObject$2(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
15902
+ return (_f = (_e = (_d = (_c = (_b = parsed === null || parsed === void 0 ? void 0 : parsed.DataFeed) !== null && _b !== void 0 ? _b : parsed === null || parsed === void 0 ? void 0 : parsed.BruceDataFeed) !== null && _c !== void 0 ? _c : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.DataFeed) !== null && _d !== void 0 ? _d : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.BruceDataFeed) !== null && _e !== void 0 ? _e : parsedResult) !== null && _f !== void 0 ? _f : parsed;
15903
+ }
15904
+ DataFeed.ParseResponse = ParseResponse;
15905
+ /**
15906
+ * Normalizes response from data feed list endpoint.
15907
+ */
15908
+ function ParseListResponse(response) {
15909
+ var _a, _b, _c, _d, _e, _f, _g, _h;
15910
+ const parsed = parseObject$2(response);
15911
+ const parsedResult = (_a = parseObject$2(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
15912
+ const list = (_h = (_g = (_f = (_e = (_d = (_c = (_b = parsed === null || parsed === void 0 ? void 0 : parsed.Items) !== null && _b !== void 0 ? _b : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.Items) !== null && _c !== void 0 ? _c : parsed === null || parsed === void 0 ? void 0 : parsed.DataFeeds) !== null && _d !== void 0 ? _d : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.DataFeeds) !== null && _e !== void 0 ? _e : parsed === null || parsed === void 0 ? void 0 : parsed.BruceDataFeeds) !== null && _f !== void 0 ? _f : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.BruceDataFeeds) !== null && _g !== void 0 ? _g : parsedResult) !== null && _h !== void 0 ? _h : parsed;
15913
+ if (Array.isArray(list)) {
15914
+ return list;
15915
+ }
15916
+ return [];
15917
+ }
15918
+ DataFeed.ParseListResponse = ParseListResponse;
15919
+ /**
15920
+ * Returns cache identifier for a data feed by ID/Key.
15921
+ * @param idOrKey
15922
+ * @returns
15923
+ */
15924
+ function GetCacheKey(idOrKey) {
15925
+ return `${Api.ECacheKey.DataFeed}${Api.ECacheKey.Id}${idOrKey}`;
15926
+ }
15927
+ DataFeed.GetCacheKey = GetCacheKey;
15928
+ /**
15929
+ * Returns cache identifier for the list of data feeds.
15930
+ * @returns
15931
+ */
15932
+ function GetListCacheKey() {
15933
+ return Api.ECacheKey.DataFeed;
15934
+ }
15935
+ DataFeed.GetListCacheKey = GetListCacheKey;
15936
+ })(DataFeed || (DataFeed = {}));
15937
+ function parseObject$2(data) {
15938
+ if (data == null || data == undefined) {
15939
+ return null;
15940
+ }
15941
+ if (typeof data == "string") {
15942
+ try {
15943
+ return JSON.parse(data);
15944
+ }
15945
+ catch (_a) {
15946
+ return null;
15947
+ }
15948
+ }
15949
+ return data;
15950
+ }
15951
+
15749
15952
  var ImportAssembly;
15750
15953
  (function (ImportAssembly) {
15751
15954
  function Analyze(params) {
@@ -17491,7 +17694,7 @@ var ChangeSet;
17491
17694
  })(ChangeSet || (ChangeSet = {}));
17492
17695
 
17493
17696
  // This is updated with the package.json version on build.
17494
- const VERSION = "7.1.20";
17697
+ const VERSION = "7.1.21";
17495
17698
 
17496
- export { VERSION, Assembly, 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, EntityTypeTrigger, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, UserMfaMethod, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking, NavigatorChatClient, NavigatorMcpWebSocketClient, ChangeSet };
17699
+ export { VERSION, Assembly, 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, EntityTypeTrigger, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, UserMfaMethod, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, DataFeed, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking, NavigatorChatClient, NavigatorMcpWebSocketClient, ChangeSet };
17497
17700
  //# sourceMappingURL=bruce-models.es5.js.map