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
@@ -2228,6 +2228,31 @@
2228
2228
  EHotspotSource["OCR"] = "OCR";
2229
2229
  EHotspotSource["AIImage"] = "AIImage";
2230
2230
  })(EHotspotSource = AnnDocument.EHotspotSource || (AnnDocument.EHotspotSource = {}));
2231
+ /**
2232
+ * Uploads a PDF and creates a new annotated document.
2233
+ * Hotspot detection is opt-in and only runs when detectHotspots is true.
2234
+ */
2235
+ function UploadPDF(params) {
2236
+ return __awaiter(this, void 0, void 0, function* () {
2237
+ let { api, file, detectHotspots, req } = params;
2238
+ if (!api) {
2239
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
2240
+ }
2241
+ if (!file) {
2242
+ throw ("File is required.");
2243
+ }
2244
+ req = exports.Api.PrepReqParams(req);
2245
+ if (detectHotspots) {
2246
+ req.formData = AddDetectHotspotsFormParam(req.formData);
2247
+ }
2248
+ const data = yield api.UPLOAD("documentView/new/uploadPDF", file, req);
2249
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.AnnDocument);
2250
+ return {
2251
+ document: data
2252
+ };
2253
+ });
2254
+ }
2255
+ AnnDocument.UploadPDF = UploadPDF;
2231
2256
  /**
2232
2257
  * Returns an annotated document by ID.
2233
2258
  * @param params
@@ -2323,6 +2348,32 @@
2323
2348
  });
2324
2349
  }
2325
2350
  AnnDocument.GetList = GetList;
2351
+ /**
2352
+ * Creates or updates an annotated document.
2353
+ * Hotspot detection is opt-in and only runs when detectHotspots is true.
2354
+ */
2355
+ function Update(params) {
2356
+ return __awaiter(this, void 0, void 0, function* () {
2357
+ let { api, document, detectHotspots, req: reqParams } = params;
2358
+ if (!api) {
2359
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
2360
+ }
2361
+ if (!document) {
2362
+ throw ("Document is required.");
2363
+ }
2364
+ const docId = document.ID || 0;
2365
+ let url = `documentView/${docId}`;
2366
+ if (detectHotspots) {
2367
+ url += "?DetectHotspots=true";
2368
+ }
2369
+ const data = yield api.POST(url, document, exports.Api.PrepReqParams(reqParams));
2370
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.AnnDocument);
2371
+ return {
2372
+ document: data
2373
+ };
2374
+ });
2375
+ }
2376
+ AnnDocument.Update = Update;
2326
2377
  /**
2327
2378
  * Suggests hotspots by scraping pages in a document view and matching by pattern.
2328
2379
  */
@@ -2408,6 +2459,13 @@
2408
2459
  return exports.Api.ECacheKey.AnnDocument + type + entityId + expandSettings + pageIndex + "_" + pageSize + "_" + search;
2409
2460
  }
2410
2461
  AnnDocument.GetListCacheKey = GetListCacheKey;
2462
+ function AddDetectHotspotsFormParam(formData) {
2463
+ if (typeof FormData !== "undefined" && formData instanceof FormData) {
2464
+ formData.set("DetectHotspots", "true");
2465
+ return formData;
2466
+ }
2467
+ return Object.assign(Object.assign({}, formData), { DetectHotspots: "true" });
2468
+ }
2411
2469
  })(exports.AnnDocument || (exports.AnnDocument = {}));
2412
2470
 
2413
2471
  (function (CustomForm) {
@@ -5006,7 +5064,7 @@
5006
5064
  if (!analysis) {
5007
5065
  entities = data.Items;
5008
5066
  }
5009
- totalCount = data.TotalCount;
5067
+ totalCount = data.Count ? data.Count : data.TotalCount;
5010
5068
  imports = data.Imports;
5011
5069
  sources = data.Source;
5012
5070
  entityTypeSources = data["EntityType.Source"];
@@ -5083,7 +5141,7 @@
5083
5141
  });
5084
5142
  }
5085
5143
  }
5086
- totalCount = data.TotalCount;
5144
+ totalCount = data.Count ? data.Count : data.TotalCount;
5087
5145
  imports = data.Imports;
5088
5146
  nextPage = data.NextPage;
5089
5147
  nextPageUrl = data.NextPageURL;
@@ -5110,7 +5168,7 @@
5110
5168
  nextPageUrl = data.NextPageURL;
5111
5169
  return {
5112
5170
  entities: data.Items,
5113
- totalCount: data.TotalCount,
5171
+ totalCount: data.Count ? data.Count : data.TotalCount,
5114
5172
  imports: data.Imports,
5115
5173
  nextPage: data.NextPage,
5116
5174
  nextPageUrl: data.NextPageURL,
@@ -10696,6 +10754,7 @@
10696
10754
  ExternalTilesetURL: (_l = (_k = record.Settings) === null || _k === void 0 ? void 0 : _k.etc) === null || _l === void 0 ? void 0 : _l.ExternalTilesetURL,
10697
10755
  showAdvancedSettings: (_o = (_m = record.Settings) === null || _m === void 0 ? void 0 : _m.etc) === null || _o === void 0 ? void 0 : _o.showAdvancedSettings
10698
10756
  },
10757
+ permission: record.Permission,
10699
10758
  // Not returned in legacy data.
10700
10759
  creationTime: newer === null || newer === void 0 ? void 0 : newer.creationTime,
10701
10760
  // Not returned in legacy data.
@@ -14490,6 +14549,187 @@
14490
14549
  UserMfaMethod.Verify = Verify;
14491
14550
  })(exports.UserMfaMethod || (exports.UserMfaMethod = {}));
14492
14551
 
14552
+ (function (AccountConcept) {
14553
+ let EConcept;
14554
+ (function (EConcept) {
14555
+ EConcept["ASSEMBLY"] = "a";
14556
+ EConcept["ATTACHMENT_TYPE"] = "at";
14557
+ EConcept["CHANGE_SET"] = "cs";
14558
+ EConcept["CLIENT_FILE"] = "clf";
14559
+ EConcept["CUSTOM_FORM"] = "csf";
14560
+ EConcept["DATA_FEED"] = "df";
14561
+ EConcept["DATA_LAB_QUERY"] = "q";
14562
+ EConcept["DATA_LAB_QUERY_GROUP"] = "qg";
14563
+ EConcept["DATA_SOURCE"] = "ds";
14564
+ EConcept["DATA_TRANSFORM"] = "dt";
14565
+ EConcept["DATA_VALIDATION"] = "dval";
14566
+ EConcept["DOCUMENT_VIEW"] = "dv";
14567
+ EConcept["ENTITY"] = "e";
14568
+ EConcept["ENTITY_LOD"] = "el";
14569
+ EConcept["ENTITY_RELATION"] = "er";
14570
+ EConcept["ENTITY_TYPE"] = "et";
14571
+ EConcept["ENTITY_TYPE_LOD"] = "etl";
14572
+ EConcept["LAYER"] = "l";
14573
+ EConcept["LOD_CATEGORY"] = "lc";
14574
+ EConcept["PROGRAM_KEY"] = "pk";
14575
+ EConcept["PROJECT_VIEW"] = "pv";
14576
+ EConcept["RELATION_TYPE"] = "rt";
14577
+ EConcept["SCENARIO"] = "sc";
14578
+ EConcept["TILESET"] = "ts";
14579
+ EConcept["UI_DASHBOARD_VIEW"] = "dbv";
14580
+ EConcept["UI_ENTITY_DISPLAY_SETTING"] = "s";
14581
+ EConcept["UI_PLUGIN"] = "pg";
14582
+ EConcept["UI_SLIDE"] = "pvs";
14583
+ EConcept["UI_SLIDE_GROUP"] = "sg";
14584
+ EConcept["UI_TABLE_VIEW"] = "tv";
14585
+ })(EConcept = AccountConcept.EConcept || (AccountConcept.EConcept = {}));
14586
+ let EAction;
14587
+ (function (EAction) {
14588
+ // Manage is a squashed version of all CRUD perms.
14589
+ // Helps avoid specifying all 4 CRUD perms as separate permission strings in a User Group.
14590
+ EAction["MANAGE"] = "MANAGE";
14591
+ // Manage own records only (eg: own draft bookmarks within a Project View).
14592
+ // Only implemented for Bookmarks at the moment.
14593
+ EAction["MANAGE_OWN"] = "MANAGE_OWN";
14594
+ EAction["VIEW"] = "VIEW";
14595
+ EAction["CREATE"] = "CREATE";
14596
+ EAction["EDIT"] = "EDIT";
14597
+ EAction["DELETE"] = "DELETE";
14598
+ })(EAction = AccountConcept.EAction || (AccountConcept.EAction = {}));
14599
+ function canCreate(perm) {
14600
+ var _a;
14601
+ return (_a = perm === null || perm === void 0 ? void 0 : perm.includes("C")) !== null && _a !== void 0 ? _a : false;
14602
+ }
14603
+ AccountConcept.canCreate = canCreate;
14604
+ function canRead(perm) {
14605
+ var _a;
14606
+ return (_a = perm === null || perm === void 0 ? void 0 : perm.includes("R")) !== null && _a !== void 0 ? _a : false;
14607
+ }
14608
+ AccountConcept.canRead = canRead;
14609
+ function canUpdate(perm) {
14610
+ var _a;
14611
+ return (_a = perm === null || perm === void 0 ? void 0 : perm.includes("U")) !== null && _a !== void 0 ? _a : false;
14612
+ }
14613
+ AccountConcept.canUpdate = canUpdate;
14614
+ function canDelete(perm) {
14615
+ var _a;
14616
+ return (_a = perm === null || perm === void 0 ? void 0 : perm.includes("D")) !== null && _a !== void 0 ? _a : false;
14617
+ }
14618
+ AccountConcept.canDelete = canDelete;
14619
+ AccountConcept.CONCEPTS = [
14620
+ { concept: EConcept.ASSEMBLY, label: "Assembly", description: undefined },
14621
+ { concept: EConcept.ATTACHMENT_TYPE, label: "Attachment Type", description: undefined },
14622
+ { concept: EConcept.CHANGE_SET, label: "Change Set", description: undefined },
14623
+ { concept: EConcept.CLIENT_FILE, label: "Client File", description: undefined },
14624
+ { concept: EConcept.CUSTOM_FORM, label: "Custom Form", description: undefined },
14625
+ { concept: EConcept.DATA_FEED, label: "Data Feed", description: undefined },
14626
+ { concept: EConcept.DATA_LAB_QUERY, label: "DataLab Query", description: undefined },
14627
+ { concept: EConcept.DATA_LAB_QUERY_GROUP, label: "DataLab Query Group", description: undefined },
14628
+ { concept: EConcept.DATA_SOURCE, label: "Data Source", description: undefined },
14629
+ { concept: EConcept.DATA_TRANSFORM, label: "Data Transform", description: undefined },
14630
+ { concept: EConcept.DATA_VALIDATION, label: "Data Validation", description: undefined },
14631
+ { concept: EConcept.DOCUMENT_VIEW, label: "Document View", description: undefined },
14632
+ { concept: EConcept.ENTITY, label: "Entity", description: "Entities and their owned records (Attachments, Links, LODs, Relationships)" },
14633
+ { concept: EConcept.ENTITY_LOD, label: "Entity LOD", description: undefined },
14634
+ { concept: EConcept.ENTITY_RELATION, label: "Entity Relation", description: undefined },
14635
+ { concept: EConcept.ENTITY_TYPE, label: "Entity Type", description: "Entity Types and their owned records (Entities, Relationships, LODs)" },
14636
+ { concept: EConcept.ENTITY_TYPE_LOD, label: "Entity Type LOD", description: undefined },
14637
+ { concept: EConcept.LAYER, label: "Tag", description: undefined },
14638
+ { concept: EConcept.LOD_CATEGORY, label: "LOD Category", description: undefined },
14639
+ { concept: EConcept.PROGRAM_KEY, label: "Third Party Key", description: undefined },
14640
+ { concept: EConcept.RELATION_TYPE, label: "Relation Type", description: undefined },
14641
+ { concept: EConcept.SCENARIO, label: "Scenario", description: undefined },
14642
+ { concept: EConcept.PROJECT_VIEW, label: "Project View", description: undefined },
14643
+ { concept: EConcept.TILESET, label: "Tileset", description: undefined },
14644
+ { concept: EConcept.UI_DASHBOARD_VIEW, label: "Dashboard View", description: undefined },
14645
+ { concept: EConcept.UI_ENTITY_DISPLAY_SETTING, label: "Style", description: undefined },
14646
+ { concept: EConcept.UI_PLUGIN, label: "Plugin", description: undefined },
14647
+ { concept: EConcept.UI_SLIDE, label: "Bookmark", description: undefined },
14648
+ { concept: EConcept.UI_SLIDE_GROUP, label: "Bookmark Group", description: undefined },
14649
+ { concept: EConcept.UI_TABLE_VIEW, label: "Tabular View", description: undefined },
14650
+ ];
14651
+ /**
14652
+ * Builds a concept permission string.
14653
+ * Omit recordId for an account-wide permission, eg: "view:pv".
14654
+ * Pass recordId for a record-specific permission, eg: "view:pv:abc123".
14655
+ */
14656
+ function buildPermission(action, concept, recordId) {
14657
+ const base = `${action.toLowerCase()}:${concept}`;
14658
+ return recordId ? `${base}:${recordId}` : base;
14659
+ }
14660
+ AccountConcept.buildPermission = buildPermission;
14661
+ /**
14662
+ * Parses a concept permission string back to its components.
14663
+ * Returns null for legacy permissions (no ':') or unrecognised strings.
14664
+ */
14665
+ function parsePermission(perm) {
14666
+ if (!perm || !perm.includes(":")) {
14667
+ return null;
14668
+ }
14669
+ const lower = perm.toLowerCase().trim();
14670
+ const firstColon = lower.indexOf(":");
14671
+ const actionStr = lower.substring(0, firstColon);
14672
+ let matchedAction;
14673
+ for (const a of Object.values(EAction)) {
14674
+ if (a.toLowerCase() === actionStr) {
14675
+ matchedAction = a;
14676
+ break;
14677
+ }
14678
+ }
14679
+ if (!matchedAction) {
14680
+ return null;
14681
+ }
14682
+ const rest = lower.substring(firstColon + 1);
14683
+ // Longest-match prevents "e" matching the start of "el:abc".
14684
+ let matchedConcept;
14685
+ let matchedLen = 0;
14686
+ for (const token of Object.values(EConcept)) {
14687
+ if (token.length > matchedLen && (rest === token || rest.startsWith(token + ":"))) {
14688
+ matchedConcept = token;
14689
+ matchedLen = token.length;
14690
+ }
14691
+ }
14692
+ if (!matchedConcept) {
14693
+ return null;
14694
+ }
14695
+ const recordId = rest.length > matchedLen ? rest.substring(matchedLen + 1) : undefined;
14696
+ return {
14697
+ action: matchedAction,
14698
+ concept: matchedConcept,
14699
+ recordId
14700
+ };
14701
+ }
14702
+ AccountConcept.parsePermission = parsePermission;
14703
+ /**
14704
+ * Returns the concept-level CRUD permission rubric for the current session.
14705
+ * Only concepts where the user has at least one permission are included.
14706
+ */
14707
+ function GetPermissions(params) {
14708
+ return __awaiter(this, void 0, void 0, function* () {
14709
+ if (!params)
14710
+ params = {};
14711
+ let { api, req } = params;
14712
+ if (!api) {
14713
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
14714
+ }
14715
+ req = exports.Api.PrepReqParams(req);
14716
+ const rubric = {};
14717
+ const data = yield api.GET("permissions", req);
14718
+ if (data) {
14719
+ for (const [token, permStr] of Object.entries(data)) {
14720
+ if (typeof permStr === "string") {
14721
+ rubric[token] = permStr;
14722
+ }
14723
+ }
14724
+ }
14725
+ return {
14726
+ rubric
14727
+ };
14728
+ });
14729
+ }
14730
+ AccountConcept.GetPermissions = GetPermissions;
14731
+ })(exports.AccountConcept || (exports.AccountConcept = {}));
14732
+
14493
14733
  (function (AccountInvite) {
14494
14734
  /**
14495
14735
  * Possible invite statuses.
@@ -17916,7 +18156,7 @@
17916
18156
  })(exports.ChangeSet || (exports.ChangeSet = {}));
17917
18157
 
17918
18158
  // This is updated with the package.json version on build.
17919
- const VERSION = "7.1.37";
18159
+ const VERSION = "7.1.39";
17920
18160
 
17921
18161
  exports.VERSION = VERSION;
17922
18162
  exports.AbstractApi = AbstractApi;