bruce-models 7.1.37 → 7.1.39

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 (36) hide show
  1. package/dist/bruce-models.es5.js +246 -5
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +244 -4
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account-concept.js +196 -0
  6. package/dist/lib/account/account-concept.js.map +1 -0
  7. package/dist/lib/ann-document/ann-document.js +58 -0
  8. package/dist/lib/ann-document/ann-document.js.map +1 -1
  9. package/dist/lib/bruce-models.js +2 -1
  10. package/dist/lib/bruce-models.js.map +1 -1
  11. package/dist/lib/dashboard/dashboard-view.js.map +1 -1
  12. package/dist/lib/entity/entity-lod.js.map +1 -1
  13. package/dist/lib/entity/entity-table-view.js.map +1 -1
  14. package/dist/lib/entity/entity-type.js.map +1 -1
  15. package/dist/lib/entity/entity.js +3 -3
  16. package/dist/lib/entity/entity.js.map +1 -1
  17. package/dist/lib/program-key/program-key.js.map +1 -1
  18. package/dist/lib/project/project-view-bookmark-group.js.map +1 -1
  19. package/dist/lib/project/project-view-bookmark.js.map +1 -1
  20. package/dist/lib/project/project-view.js.map +1 -1
  21. package/dist/lib/tileset/tileset.js +1 -0
  22. package/dist/lib/tileset/tileset.js.map +1 -1
  23. package/dist/types/account/account-concept.d.ts +90 -0
  24. package/dist/types/ann-document/ann-document.d.ts +30 -0
  25. package/dist/types/bruce-models.d.ts +2 -1
  26. package/dist/types/dashboard/dashboard-view.d.ts +2 -0
  27. package/dist/types/entity/entity-lod.d.ts +2 -0
  28. package/dist/types/entity/entity-table-view.d.ts +2 -0
  29. package/dist/types/entity/entity-type.d.ts +2 -0
  30. package/dist/types/entity/entity.d.ts +2 -0
  31. package/dist/types/program-key/program-key.d.ts +2 -0
  32. package/dist/types/project/project-view-bookmark-group.d.ts +2 -0
  33. package/dist/types/project/project-view-bookmark.d.ts +2 -0
  34. package/dist/types/project/project-view.d.ts +2 -0
  35. package/dist/types/tileset/tileset.d.ts +2 -0
  36. package/package.json +1 -2
@@ -2255,6 +2255,31 @@ var AnnDocument;
2255
2255
  EHotspotSource["OCR"] = "OCR";
2256
2256
  EHotspotSource["AIImage"] = "AIImage";
2257
2257
  })(EHotspotSource = AnnDocument.EHotspotSource || (AnnDocument.EHotspotSource = {}));
2258
+ /**
2259
+ * Uploads a PDF and creates a new annotated document.
2260
+ * Hotspot detection is opt-in and only runs when detectHotspots is true.
2261
+ */
2262
+ function UploadPDF(params) {
2263
+ return __awaiter(this, void 0, void 0, function* () {
2264
+ let { api, file, detectHotspots, req } = params;
2265
+ if (!api) {
2266
+ api = ENVIRONMENT.Api().GetBruceApi();
2267
+ }
2268
+ if (!file) {
2269
+ throw ("File is required.");
2270
+ }
2271
+ req = Api.PrepReqParams(req);
2272
+ if (detectHotspots) {
2273
+ req.formData = AddDetectHotspotsFormParam(req.formData);
2274
+ }
2275
+ const data = yield api.UPLOAD("documentView/new/uploadPDF", file, req);
2276
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.AnnDocument);
2277
+ return {
2278
+ document: data
2279
+ };
2280
+ });
2281
+ }
2282
+ AnnDocument.UploadPDF = UploadPDF;
2258
2283
  /**
2259
2284
  * Returns an annotated document by ID.
2260
2285
  * @param params
@@ -2350,6 +2375,32 @@ var AnnDocument;
2350
2375
  });
2351
2376
  }
2352
2377
  AnnDocument.GetList = GetList;
2378
+ /**
2379
+ * Creates or updates an annotated document.
2380
+ * Hotspot detection is opt-in and only runs when detectHotspots is true.
2381
+ */
2382
+ function Update(params) {
2383
+ return __awaiter(this, void 0, void 0, function* () {
2384
+ let { api, document, detectHotspots, req: reqParams } = params;
2385
+ if (!api) {
2386
+ api = ENVIRONMENT.Api().GetBruceApi();
2387
+ }
2388
+ if (!document) {
2389
+ throw ("Document is required.");
2390
+ }
2391
+ const docId = document.ID || 0;
2392
+ let url = `documentView/${docId}`;
2393
+ if (detectHotspots) {
2394
+ url += "?DetectHotspots=true";
2395
+ }
2396
+ const data = yield api.POST(url, document, Api.PrepReqParams(reqParams));
2397
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.AnnDocument);
2398
+ return {
2399
+ document: data
2400
+ };
2401
+ });
2402
+ }
2403
+ AnnDocument.Update = Update;
2353
2404
  /**
2354
2405
  * Suggests hotspots by scraping pages in a document view and matching by pattern.
2355
2406
  */
@@ -2435,6 +2486,13 @@ var AnnDocument;
2435
2486
  return Api.ECacheKey.AnnDocument + type + entityId + expandSettings + pageIndex + "_" + pageSize + "_" + search;
2436
2487
  }
2437
2488
  AnnDocument.GetListCacheKey = GetListCacheKey;
2489
+ function AddDetectHotspotsFormParam(formData) {
2490
+ if (typeof FormData !== "undefined" && formData instanceof FormData) {
2491
+ formData.set("DetectHotspots", "true");
2492
+ return formData;
2493
+ }
2494
+ return Object.assign(Object.assign({}, formData), { DetectHotspots: "true" });
2495
+ }
2438
2496
  })(AnnDocument || (AnnDocument = {}));
2439
2497
 
2440
2498
  /**
@@ -5055,7 +5113,7 @@ var Entity;
5055
5113
  if (!analysis) {
5056
5114
  entities = data.Items;
5057
5115
  }
5058
- totalCount = data.TotalCount;
5116
+ totalCount = data.Count ? data.Count : data.TotalCount;
5059
5117
  imports = data.Imports;
5060
5118
  sources = data.Source;
5061
5119
  entityTypeSources = data["EntityType.Source"];
@@ -5132,7 +5190,7 @@ var Entity;
5132
5190
  });
5133
5191
  }
5134
5192
  }
5135
- totalCount = data.TotalCount;
5193
+ totalCount = data.Count ? data.Count : data.TotalCount;
5136
5194
  imports = data.Imports;
5137
5195
  nextPage = data.NextPage;
5138
5196
  nextPageUrl = data.NextPageURL;
@@ -5159,7 +5217,7 @@ var Entity;
5159
5217
  nextPageUrl = data.NextPageURL;
5160
5218
  return {
5161
5219
  entities: data.Items,
5162
- totalCount: data.TotalCount,
5220
+ totalCount: data.Count ? data.Count : data.TotalCount,
5163
5221
  imports: data.Imports,
5164
5222
  nextPage: data.NextPage,
5165
5223
  nextPageUrl: data.NextPageURL,
@@ -10875,6 +10933,7 @@ function convertLegacyRec(record, newer) {
10875
10933
  ExternalTilesetURL: (_l = (_k = record.Settings) === null || _k === void 0 ? void 0 : _k.etc) === null || _l === void 0 ? void 0 : _l.ExternalTilesetURL,
10876
10934
  showAdvancedSettings: (_o = (_m = record.Settings) === null || _m === void 0 ? void 0 : _m.etc) === null || _o === void 0 ? void 0 : _o.showAdvancedSettings
10877
10935
  },
10936
+ permission: record.Permission,
10878
10937
  // Not returned in legacy data.
10879
10938
  creationTime: newer === null || newer === void 0 ? void 0 : newer.creationTime,
10880
10939
  // Not returned in legacy data.
@@ -14751,6 +14810,188 @@ var UserMfaMethod;
14751
14810
  UserMfaMethod.Verify = Verify;
14752
14811
  })(UserMfaMethod || (UserMfaMethod = {}));
14753
14812
 
14813
+ var AccountConcept;
14814
+ (function (AccountConcept) {
14815
+ let EConcept;
14816
+ (function (EConcept) {
14817
+ EConcept["ASSEMBLY"] = "a";
14818
+ EConcept["ATTACHMENT_TYPE"] = "at";
14819
+ EConcept["CHANGE_SET"] = "cs";
14820
+ EConcept["CLIENT_FILE"] = "clf";
14821
+ EConcept["CUSTOM_FORM"] = "csf";
14822
+ EConcept["DATA_FEED"] = "df";
14823
+ EConcept["DATA_LAB_QUERY"] = "q";
14824
+ EConcept["DATA_LAB_QUERY_GROUP"] = "qg";
14825
+ EConcept["DATA_SOURCE"] = "ds";
14826
+ EConcept["DATA_TRANSFORM"] = "dt";
14827
+ EConcept["DATA_VALIDATION"] = "dval";
14828
+ EConcept["DOCUMENT_VIEW"] = "dv";
14829
+ EConcept["ENTITY"] = "e";
14830
+ EConcept["ENTITY_LOD"] = "el";
14831
+ EConcept["ENTITY_RELATION"] = "er";
14832
+ EConcept["ENTITY_TYPE"] = "et";
14833
+ EConcept["ENTITY_TYPE_LOD"] = "etl";
14834
+ EConcept["LAYER"] = "l";
14835
+ EConcept["LOD_CATEGORY"] = "lc";
14836
+ EConcept["PROGRAM_KEY"] = "pk";
14837
+ EConcept["PROJECT_VIEW"] = "pv";
14838
+ EConcept["RELATION_TYPE"] = "rt";
14839
+ EConcept["SCENARIO"] = "sc";
14840
+ EConcept["TILESET"] = "ts";
14841
+ EConcept["UI_DASHBOARD_VIEW"] = "dbv";
14842
+ EConcept["UI_ENTITY_DISPLAY_SETTING"] = "s";
14843
+ EConcept["UI_PLUGIN"] = "pg";
14844
+ EConcept["UI_SLIDE"] = "pvs";
14845
+ EConcept["UI_SLIDE_GROUP"] = "sg";
14846
+ EConcept["UI_TABLE_VIEW"] = "tv";
14847
+ })(EConcept = AccountConcept.EConcept || (AccountConcept.EConcept = {}));
14848
+ let EAction;
14849
+ (function (EAction) {
14850
+ // Manage is a squashed version of all CRUD perms.
14851
+ // Helps avoid specifying all 4 CRUD perms as separate permission strings in a User Group.
14852
+ EAction["MANAGE"] = "MANAGE";
14853
+ // Manage own records only (eg: own draft bookmarks within a Project View).
14854
+ // Only implemented for Bookmarks at the moment.
14855
+ EAction["MANAGE_OWN"] = "MANAGE_OWN";
14856
+ EAction["VIEW"] = "VIEW";
14857
+ EAction["CREATE"] = "CREATE";
14858
+ EAction["EDIT"] = "EDIT";
14859
+ EAction["DELETE"] = "DELETE";
14860
+ })(EAction = AccountConcept.EAction || (AccountConcept.EAction = {}));
14861
+ function canCreate(perm) {
14862
+ var _a;
14863
+ return (_a = perm === null || perm === void 0 ? void 0 : perm.includes("C")) !== null && _a !== void 0 ? _a : false;
14864
+ }
14865
+ AccountConcept.canCreate = canCreate;
14866
+ function canRead(perm) {
14867
+ var _a;
14868
+ return (_a = perm === null || perm === void 0 ? void 0 : perm.includes("R")) !== null && _a !== void 0 ? _a : false;
14869
+ }
14870
+ AccountConcept.canRead = canRead;
14871
+ function canUpdate(perm) {
14872
+ var _a;
14873
+ return (_a = perm === null || perm === void 0 ? void 0 : perm.includes("U")) !== null && _a !== void 0 ? _a : false;
14874
+ }
14875
+ AccountConcept.canUpdate = canUpdate;
14876
+ function canDelete(perm) {
14877
+ var _a;
14878
+ return (_a = perm === null || perm === void 0 ? void 0 : perm.includes("D")) !== null && _a !== void 0 ? _a : false;
14879
+ }
14880
+ AccountConcept.canDelete = canDelete;
14881
+ AccountConcept.CONCEPTS = [
14882
+ { concept: EConcept.ASSEMBLY, label: "Assembly", description: undefined },
14883
+ { concept: EConcept.ATTACHMENT_TYPE, label: "Attachment Type", description: undefined },
14884
+ { concept: EConcept.CHANGE_SET, label: "Change Set", description: undefined },
14885
+ { concept: EConcept.CLIENT_FILE, label: "Client File", description: undefined },
14886
+ { concept: EConcept.CUSTOM_FORM, label: "Custom Form", description: undefined },
14887
+ { concept: EConcept.DATA_FEED, label: "Data Feed", description: undefined },
14888
+ { concept: EConcept.DATA_LAB_QUERY, label: "DataLab Query", description: undefined },
14889
+ { concept: EConcept.DATA_LAB_QUERY_GROUP, label: "DataLab Query Group", description: undefined },
14890
+ { concept: EConcept.DATA_SOURCE, label: "Data Source", description: undefined },
14891
+ { concept: EConcept.DATA_TRANSFORM, label: "Data Transform", description: undefined },
14892
+ { concept: EConcept.DATA_VALIDATION, label: "Data Validation", description: undefined },
14893
+ { concept: EConcept.DOCUMENT_VIEW, label: "Document View", description: undefined },
14894
+ { concept: EConcept.ENTITY, label: "Entity", description: "Entities and their owned records (Attachments, Links, LODs, Relationships)" },
14895
+ { concept: EConcept.ENTITY_LOD, label: "Entity LOD", description: undefined },
14896
+ { concept: EConcept.ENTITY_RELATION, label: "Entity Relation", description: undefined },
14897
+ { concept: EConcept.ENTITY_TYPE, label: "Entity Type", description: "Entity Types and their owned records (Entities, Relationships, LODs)" },
14898
+ { concept: EConcept.ENTITY_TYPE_LOD, label: "Entity Type LOD", description: undefined },
14899
+ { concept: EConcept.LAYER, label: "Tag", description: undefined },
14900
+ { concept: EConcept.LOD_CATEGORY, label: "LOD Category", description: undefined },
14901
+ { concept: EConcept.PROGRAM_KEY, label: "Third Party Key", description: undefined },
14902
+ { concept: EConcept.RELATION_TYPE, label: "Relation Type", description: undefined },
14903
+ { concept: EConcept.SCENARIO, label: "Scenario", description: undefined },
14904
+ { concept: EConcept.PROJECT_VIEW, label: "Project View", description: undefined },
14905
+ { concept: EConcept.TILESET, label: "Tileset", description: undefined },
14906
+ { concept: EConcept.UI_DASHBOARD_VIEW, label: "Dashboard View", description: undefined },
14907
+ { concept: EConcept.UI_ENTITY_DISPLAY_SETTING, label: "Style", description: undefined },
14908
+ { concept: EConcept.UI_PLUGIN, label: "Plugin", description: undefined },
14909
+ { concept: EConcept.UI_SLIDE, label: "Bookmark", description: undefined },
14910
+ { concept: EConcept.UI_SLIDE_GROUP, label: "Bookmark Group", description: undefined },
14911
+ { concept: EConcept.UI_TABLE_VIEW, label: "Tabular View", description: undefined },
14912
+ ];
14913
+ /**
14914
+ * Builds a concept permission string.
14915
+ * Omit recordId for an account-wide permission, eg: "view:pv".
14916
+ * Pass recordId for a record-specific permission, eg: "view:pv:abc123".
14917
+ */
14918
+ function buildPermission(action, concept, recordId) {
14919
+ const base = `${action.toLowerCase()}:${concept}`;
14920
+ return recordId ? `${base}:${recordId}` : base;
14921
+ }
14922
+ AccountConcept.buildPermission = buildPermission;
14923
+ /**
14924
+ * Parses a concept permission string back to its components.
14925
+ * Returns null for legacy permissions (no ':') or unrecognised strings.
14926
+ */
14927
+ function parsePermission(perm) {
14928
+ if (!perm || !perm.includes(":")) {
14929
+ return null;
14930
+ }
14931
+ const lower = perm.toLowerCase().trim();
14932
+ const firstColon = lower.indexOf(":");
14933
+ const actionStr = lower.substring(0, firstColon);
14934
+ let matchedAction;
14935
+ for (const a of Object.values(EAction)) {
14936
+ if (a.toLowerCase() === actionStr) {
14937
+ matchedAction = a;
14938
+ break;
14939
+ }
14940
+ }
14941
+ if (!matchedAction) {
14942
+ return null;
14943
+ }
14944
+ const rest = lower.substring(firstColon + 1);
14945
+ // Longest-match prevents "e" matching the start of "el:abc".
14946
+ let matchedConcept;
14947
+ let matchedLen = 0;
14948
+ for (const token of Object.values(EConcept)) {
14949
+ if (token.length > matchedLen && (rest === token || rest.startsWith(token + ":"))) {
14950
+ matchedConcept = token;
14951
+ matchedLen = token.length;
14952
+ }
14953
+ }
14954
+ if (!matchedConcept) {
14955
+ return null;
14956
+ }
14957
+ const recordId = rest.length > matchedLen ? rest.substring(matchedLen + 1) : undefined;
14958
+ return {
14959
+ action: matchedAction,
14960
+ concept: matchedConcept,
14961
+ recordId
14962
+ };
14963
+ }
14964
+ AccountConcept.parsePermission = parsePermission;
14965
+ /**
14966
+ * Returns the concept-level CRUD permission rubric for the current session.
14967
+ * Only concepts where the user has at least one permission are included.
14968
+ */
14969
+ function GetPermissions(params) {
14970
+ return __awaiter(this, void 0, void 0, function* () {
14971
+ if (!params)
14972
+ params = {};
14973
+ let { api, req } = params;
14974
+ if (!api) {
14975
+ api = ENVIRONMENT.Api().GetBruceApi();
14976
+ }
14977
+ req = Api.PrepReqParams(req);
14978
+ const rubric = {};
14979
+ const data = yield api.GET("permissions", req);
14980
+ if (data) {
14981
+ for (const [token, permStr] of Object.entries(data)) {
14982
+ if (typeof permStr === "string") {
14983
+ rubric[token] = permStr;
14984
+ }
14985
+ }
14986
+ }
14987
+ return {
14988
+ rubric
14989
+ };
14990
+ });
14991
+ }
14992
+ AccountConcept.GetPermissions = GetPermissions;
14993
+ })(AccountConcept || (AccountConcept = {}));
14994
+
14754
14995
  /**
14755
14996
  * An account-invite is an invitation to a user to join a client account.
14756
14997
  * New users to Nextspace will setup their user account within the invitation process.
@@ -18251,7 +18492,7 @@ var ChangeSet;
18251
18492
  })(ChangeSet || (ChangeSet = {}));
18252
18493
 
18253
18494
  // This is updated with the package.json version on build.
18254
- const VERSION = "7.1.37";
18495
+ const VERSION = "7.1.39";
18255
18496
 
18256
- 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, DashboardView, 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, DataTransform, DataLabGroup, DataFeed, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportLcc, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, ChangeSet };
18497
+ 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, DashboardView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, UserMfaMethod, Account, AccountConcept, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataTransform, DataLabGroup, DataFeed, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportLcc, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, ChangeSet };
18257
18498
  //# sourceMappingURL=bruce-models.es5.js.map