bruce-models 7.1.38 → 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 (34) hide show
  1. package/dist/bruce-models.es5.js +185 -2
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +183 -1
  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.map +1 -1
  8. package/dist/lib/bruce-models.js +2 -1
  9. package/dist/lib/bruce-models.js.map +1 -1
  10. package/dist/lib/dashboard/dashboard-view.js.map +1 -1
  11. package/dist/lib/entity/entity-lod.js.map +1 -1
  12. package/dist/lib/entity/entity-table-view.js.map +1 -1
  13. package/dist/lib/entity/entity-type.js.map +1 -1
  14. package/dist/lib/entity/entity.js.map +1 -1
  15. package/dist/lib/program-key/program-key.js.map +1 -1
  16. package/dist/lib/project/project-view-bookmark-group.js.map +1 -1
  17. package/dist/lib/project/project-view-bookmark.js.map +1 -1
  18. package/dist/lib/project/project-view.js.map +1 -1
  19. package/dist/lib/tileset/tileset.js +1 -0
  20. package/dist/lib/tileset/tileset.js.map +1 -1
  21. package/dist/types/account/account-concept.d.ts +90 -0
  22. package/dist/types/ann-document/ann-document.d.ts +2 -0
  23. package/dist/types/bruce-models.d.ts +2 -1
  24. package/dist/types/dashboard/dashboard-view.d.ts +2 -0
  25. package/dist/types/entity/entity-lod.d.ts +2 -0
  26. package/dist/types/entity/entity-table-view.d.ts +2 -0
  27. package/dist/types/entity/entity-type.d.ts +2 -0
  28. package/dist/types/entity/entity.d.ts +2 -0
  29. package/dist/types/program-key/program-key.d.ts +2 -0
  30. package/dist/types/project/project-view-bookmark-group.d.ts +2 -0
  31. package/dist/types/project/project-view-bookmark.d.ts +2 -0
  32. package/dist/types/project/project-view.d.ts +2 -0
  33. package/dist/types/tileset/tileset.d.ts +2 -0
  34. package/package.json +1 -2
@@ -10754,6 +10754,7 @@
10754
10754
  ExternalTilesetURL: (_l = (_k = record.Settings) === null || _k === void 0 ? void 0 : _k.etc) === null || _l === void 0 ? void 0 : _l.ExternalTilesetURL,
10755
10755
  showAdvancedSettings: (_o = (_m = record.Settings) === null || _m === void 0 ? void 0 : _m.etc) === null || _o === void 0 ? void 0 : _o.showAdvancedSettings
10756
10756
  },
10757
+ permission: record.Permission,
10757
10758
  // Not returned in legacy data.
10758
10759
  creationTime: newer === null || newer === void 0 ? void 0 : newer.creationTime,
10759
10760
  // Not returned in legacy data.
@@ -14548,6 +14549,187 @@
14548
14549
  UserMfaMethod.Verify = Verify;
14549
14550
  })(exports.UserMfaMethod || (exports.UserMfaMethod = {}));
14550
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
+
14551
14733
  (function (AccountInvite) {
14552
14734
  /**
14553
14735
  * Possible invite statuses.
@@ -17974,7 +18156,7 @@
17974
18156
  })(exports.ChangeSet || (exports.ChangeSet = {}));
17975
18157
 
17976
18158
  // This is updated with the package.json version on build.
17977
- const VERSION = "7.1.38";
18159
+ const VERSION = "7.1.39";
17978
18160
 
17979
18161
  exports.VERSION = VERSION;
17980
18162
  exports.AbstractApi = AbstractApi;