@meshagent/meshagent-ts-auth 0.53.0 → 0.53.2

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.53.2]
2
+ - Added project profile views, inheritance updates, typed profile models, and sysadmin global user search and profile administration.
3
+ - Project updates now use project-local overrides and require `user_profile_editor`; global profile access is self-only and global annotations require sysadmin APIs.
4
+
5
+ ## [0.53.1]
6
+ - Stability
7
+
1
8
  ## [0.53.0]
2
9
  - Added user profile metadata and annotations to project-member types and parsing.
3
10
  - Added the `user_profile_editor` project role and support for partial profile updates with metadata, annotations, and project ID options.
@@ -42626,36 +42626,65 @@ ${newlined}
42626
42626
  });
42627
42627
  }
42628
42628
  async getUsersInProjectPage(projectId, options = {}) {
42629
- const { pageSize = 100, continuationToken, filter, email } = options;
42629
+ const { pageSize = 100, continuationToken, filter, email, view = "merged" } = options;
42630
42630
  const data = await this.request(`/accounts/projects/${projectId}/users`, {
42631
- query: { page_size: pageSize, continuation_token: continuationToken, filter, email },
42631
+ query: { page_size: pageSize, continuation_token: continuationToken, filter, email, view },
42632
42632
  action: "fetch project users"
42633
42633
  });
42634
42634
  const users = Array.isArray(data?.users) ? data.users : [];
42635
42635
  return { users: users.map((user) => this.parseProjectMember(user)), continuationToken: data?.continuation_token ?? null };
42636
42636
  }
42637
- async getUsersInProject(projectId) {
42638
- const page = await this.getUsersInProjectPage(projectId);
42637
+ async getUsersInProject(projectId, options = {}) {
42638
+ const page = await this.getUsersInProjectPage(projectId, options);
42639
42639
  return page.users;
42640
42640
  }
42641
- async getUserProfile(userId) {
42642
- return await this.request(`/accounts/profiles/${userId}`, {
42641
+ async getUserProfile(userId, options = {}) {
42642
+ if (options.projectId === void 0 && options.view === "project") {
42643
+ throw new Error("projectId is required for the project view");
42644
+ }
42645
+ const userPath = encodeURIComponent(userId);
42646
+ const path = options.projectId === void 0 ? `/accounts/profiles/${userPath}` : `/accounts/projects/${encodeURIComponent(options.projectId)}/users/${userPath}/profile`;
42647
+ return await this.request(path, {
42648
+ query: options.projectId === void 0 ? void 0 : { view: options.view ?? "merged" },
42643
42649
  action: "fetch user profile"
42644
42650
  });
42645
42651
  }
42646
42652
  async updateUserProfile(userId, firstName, lastName, options = {}) {
42647
- const query = options.projectId === void 0 ? "" : `?project_id=${encodeURIComponent(options.projectId)}`;
42648
- return await this.request(`/accounts/profiles/${encodeURIComponent(userId)}${query}`, {
42653
+ if (options.projectId === void 0 && options.inherit !== void 0) {
42654
+ throw new Error("projectId is required to inherit profile fields");
42655
+ }
42656
+ const userPath = encodeURIComponent(userId);
42657
+ const path = options.projectId === void 0 ? `/accounts/profiles/${userPath}` : `/accounts/projects/${encodeURIComponent(options.projectId)}/users/${userPath}/profile`;
42658
+ return await this.request(path, {
42649
42659
  method: "PUT",
42650
42660
  json: {
42651
42661
  ...firstName !== void 0 ? { first_name: firstName } : {},
42652
42662
  ...lastName !== void 0 ? { last_name: lastName } : {},
42653
42663
  ...options.metadata !== void 0 ? { metadata: options.metadata } : {},
42654
- ...options.annotations !== void 0 ? { annotations: options.annotations } : {}
42664
+ ...options.annotations !== void 0 ? { annotations: options.annotations } : {},
42665
+ ...options.inherit !== void 0 ? { inherit: options.inherit } : {}
42655
42666
  },
42656
42667
  action: "update user profile"
42657
42668
  });
42658
42669
  }
42670
+ async searchSysadminUsers(options = {}) {
42671
+ return await this.request(`/accounts/sysadmin/users`, {
42672
+ query: { filter: options.filter, page_size: options.pageSize ?? 100, continuation_token: options.continuationToken },
42673
+ action: "search global users"
42674
+ });
42675
+ }
42676
+ async getSysadminUserProfile(userId) {
42677
+ return await this.request(`/accounts/sysadmin/users/${encodeURIComponent(userId)}`, {
42678
+ action: "fetch global user profile"
42679
+ });
42680
+ }
42681
+ async updateSysadminUserProfile(userId, fields) {
42682
+ return await this.request(`/accounts/sysadmin/users/${encodeURIComponent(userId)}`, {
42683
+ method: "PUT",
42684
+ json: fields,
42685
+ action: "update global user profile"
42686
+ });
42687
+ }
42659
42688
  async listProjects() {
42660
42689
  return await this.request(`/accounts/projects`, {
42661
42690
  action: "list projects"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent-ts-auth",
3
- "version": "0.53.0",
3
+ "version": "0.53.2",
4
4
  "description": "Meshagent Typescript Auth",
5
5
  "homepage": "https://github.com/meshagent/meshagent-ts-auth",
6
6
  "scripts": {
@@ -39,7 +39,7 @@
39
39
  "CHANGELOG.md"
40
40
  ],
41
41
  "dependencies": {
42
- "@meshagent/meshagent": "^0.53.0",
42
+ "@meshagent/meshagent": "^0.53.2",
43
43
  "typescript": "^5.8.3"
44
44
  },
45
45
  "devDependencies": {