@meshagent/meshagent 0.39.0 → 0.39.1

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,8 @@
1
+ ## [0.39.1]
2
+ - Added `*Page` interfaces and new `Meshagent` TypeScript methods for paged listing (e.g., `getUsersInProjectPage`, `listMailboxesPage`, `listFeedsPage`, `listRoutesPage`, `listUniqueUsersWithGrantsPage`, `listOAuthClientsPage`, etc.) returning `{ items, total }`-style page payloads.
3
+ - Updated existing list methods to accept `count`/`offset`/`filter` options and to default to paged fetching (default page-size behavior updated).
4
+ - Improved payload parsing/validation for mailboxes (including mapping `room_id` into the Dart/JS-facing `roomId` shape).
5
+
1
6
  ## [0.39.0]
2
7
  - Expanded TypeScript datasets client support for dataset index management (index configuration/remapping and index metadata).
3
8
  - Added TypeScript datasets SQL cancellation API with typed cancel status/results.
@@ -41,6 +41,14 @@ export interface ProjectUserGrantCount {
41
41
  lastName?: string | null;
42
42
  email: string;
43
43
  }
44
+ export interface ProjectMembersPage {
45
+ users: Record<string, unknown>[];
46
+ total: number;
47
+ }
48
+ export interface ProjectUserGrantCountsPage {
49
+ users: ProjectUserGrantCount[];
50
+ total: number;
51
+ }
44
52
  export interface EnvironmentVariable {
45
53
  name: string;
46
54
  value: string;
@@ -202,6 +210,10 @@ export interface Mailbox {
202
210
  roomId?: string;
203
211
  queue: string;
204
212
  }
213
+ export interface MailboxesPage {
214
+ mailboxes: Mailbox[];
215
+ total: number;
216
+ }
205
217
  export type FeedVisibility = "public" | "project" | "private";
206
218
  export interface Feed {
207
219
  id: string;
@@ -214,6 +226,10 @@ export interface Feed {
214
226
  annotations: Record<string, string>;
215
227
  messageSchema?: Record<string, unknown> | boolean | null;
216
228
  }
229
+ export interface FeedsPage {
230
+ feeds: Feed[];
231
+ total: number;
232
+ }
217
233
  export interface FeedSubscription {
218
234
  id: string;
219
235
  feedId: string;
@@ -268,6 +284,10 @@ export interface OAuthClient {
268
284
  projectId: string;
269
285
  metadata: Record<string, string>;
270
286
  }
287
+ export interface OAuthClientsPage {
288
+ clients: OAuthClient[];
289
+ total: number;
290
+ }
271
291
  export interface BaseSecret {
272
292
  id?: string;
273
293
  name: string;
@@ -365,6 +385,11 @@ export declare class Meshagent {
365
385
  }): Promise<Record<string, unknown>>;
366
386
  removeUserFromProject(projectId: string, userId: string): Promise<Record<string, unknown>>;
367
387
  updateProjectSettings(projectId: string, settings: Record<string, unknown>): Promise<Record<string, unknown>>;
388
+ getUsersInProjectPage(projectId: string, options?: {
389
+ count?: number;
390
+ offset?: number;
391
+ filter?: string;
392
+ }): Promise<ProjectMembersPage>;
368
393
  getUsersInProject(projectId: string): Promise<Record<string, unknown>>;
369
394
  getUserProfile(userId: string): Promise<Record<string, unknown>>;
370
395
  updateUserProfile(userId: string, firstName: string, lastName: string): Promise<Record<string, unknown>>;
@@ -446,7 +471,17 @@ export declare class Meshagent {
446
471
  queue: string;
447
472
  isPublic: boolean;
448
473
  }): Promise<void>;
449
- listMailboxes(projectId: string): Promise<Mailbox[]>;
474
+ private parseMailbox;
475
+ listMailboxesPage(projectId: string, options?: {
476
+ count?: number;
477
+ offset?: number;
478
+ filter?: string;
479
+ }): Promise<MailboxesPage>;
480
+ listMailboxes(projectId: string, options?: {
481
+ count?: number;
482
+ offset?: number;
483
+ filter?: string;
484
+ }): Promise<Mailbox[]>;
450
485
  deleteMailbox(projectId: string, address: string): Promise<void>;
451
486
  createFeed(params: {
452
487
  projectId: string;
@@ -467,8 +502,26 @@ export declare class Meshagent {
467
502
  messageSchema?: Record<string, unknown> | boolean | null;
468
503
  }): Promise<void>;
469
504
  getFeed(projectId: string, feedId: string): Promise<Feed>;
470
- listFeeds(projectId: string): Promise<Feed[]>;
471
- listRoomFeeds(projectId: string, roomName: string): Promise<Feed[]>;
505
+ listFeedsPage(projectId: string, options?: {
506
+ count?: number;
507
+ offset?: number;
508
+ filter?: string;
509
+ }): Promise<FeedsPage>;
510
+ listFeeds(projectId: string, options?: {
511
+ count?: number;
512
+ offset?: number;
513
+ filter?: string;
514
+ }): Promise<Feed[]>;
515
+ listRoomFeedsPage(projectId: string, roomName: string, options?: {
516
+ count?: number;
517
+ offset?: number;
518
+ filter?: string;
519
+ }): Promise<FeedsPage>;
520
+ listRoomFeeds(projectId: string, roomName: string, options?: {
521
+ count?: number;
522
+ offset?: number;
523
+ filter?: string;
524
+ }): Promise<Feed[]>;
472
525
  deleteFeed(projectId: string, feedId: string): Promise<void>;
473
526
  publishFeedMessage(params: {
474
527
  projectId: string;
@@ -713,9 +766,15 @@ export declare class Meshagent {
713
766
  limit?: number;
714
767
  offset?: number;
715
768
  }): Promise<ProjectRoomGrantCount[]>;
769
+ listUniqueUsersWithGrantsPage(projectId: string, options?: {
770
+ limit?: number;
771
+ offset?: number;
772
+ filter?: string;
773
+ }): Promise<ProjectUserGrantCountsPage>;
716
774
  listUniqueUsersWithGrants(projectId: string, options?: {
717
775
  limit?: number;
718
776
  offset?: number;
777
+ filter?: string;
719
778
  }): Promise<ProjectUserGrantCount[]>;
720
779
  createOAuthClient(projectId: string, params: {
721
780
  grantTypes: string[];
@@ -731,7 +790,16 @@ export declare class Meshagent {
731
790
  scope?: string;
732
791
  metadata?: Record<string, any>;
733
792
  }): Promise<Record<string, unknown>>;
734
- listOAuthClients(projectId: string): Promise<OAuthClient[]>;
793
+ listOAuthClientsPage(projectId: string, options?: {
794
+ count?: number;
795
+ offset?: number;
796
+ filter?: string;
797
+ }): Promise<OAuthClientsPage>;
798
+ listOAuthClients(projectId: string, options?: {
799
+ count?: number;
800
+ offset?: number;
801
+ filter?: string;
802
+ }): Promise<OAuthClient[]>;
735
803
  getOAuthClient(projectId: string, clientId: string): Promise<OAuthClient>;
736
804
  deleteOAuthClient(projectId: string, clientId: string): Promise<void>;
737
805
  }
@@ -774,10 +774,18 @@ class Meshagent {
774
774
  action: "update project settings",
775
775
  });
776
776
  }
777
- async getUsersInProject(projectId) {
778
- return await this.request(`/accounts/projects/${projectId}/users`, {
777
+ async getUsersInProjectPage(projectId, options = {}) {
778
+ const { count = 100, offset = 0, filter } = options;
779
+ const data = await this.request(`/accounts/projects/${projectId}/users`, {
780
+ query: { count, offset, filter },
779
781
  action: "fetch project users",
780
782
  });
783
+ const users = Array.isArray(data?.users) ? data.users : [];
784
+ return { users, total: typeof data?.total === "number" ? data.total : users.length };
785
+ }
786
+ async getUsersInProject(projectId) {
787
+ const page = await this.getUsersInProjectPage(projectId);
788
+ return { users: page.users, total: page.total };
781
789
  }
782
790
  async getUserProfile(userId) {
783
791
  return await this.request(`/accounts/profiles/${userId}`, {
@@ -1002,24 +1010,32 @@ class Meshagent {
1002
1010
  responseType: "void",
1003
1011
  });
1004
1012
  }
1005
- async listMailboxes(projectId) {
1013
+ parseMailbox(item) {
1014
+ if (!item || typeof item !== "object") {
1015
+ throw new requirement_1.RoomException("Invalid mailbox payload");
1016
+ }
1017
+ const { address, room, room_id, queue } = item;
1018
+ if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
1019
+ throw new requirement_1.RoomException("Invalid mailbox payload: missing fields");
1020
+ }
1021
+ if (room_id !== undefined && typeof room_id !== "string") {
1022
+ throw new requirement_1.RoomException("Invalid mailbox payload: invalid room_id");
1023
+ }
1024
+ return { address, room, roomId: room_id, queue };
1025
+ }
1026
+ async listMailboxesPage(projectId, options = {}) {
1027
+ const { count = 100, offset = 0, filter } = options;
1006
1028
  const data = await this.request(`/accounts/projects/${projectId}/mailboxes`, {
1029
+ query: { count, offset, filter },
1007
1030
  action: "list mailboxes",
1008
1031
  });
1009
1032
  const mailboxes = Array.isArray(data?.mailboxes) ? data.mailboxes : [];
1010
- return mailboxes.map((item) => {
1011
- if (!item || typeof item !== "object") {
1012
- throw new requirement_1.RoomException("Invalid mailbox payload");
1013
- }
1014
- const { address, room, room_id, queue } = item;
1015
- if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
1016
- throw new requirement_1.RoomException("Invalid mailbox payload: missing fields");
1017
- }
1018
- if (room_id !== undefined && typeof room_id !== "string") {
1019
- throw new requirement_1.RoomException("Invalid mailbox payload: invalid room_id");
1020
- }
1021
- return { address, room, roomId: room_id, queue };
1022
- });
1033
+ const parsed = mailboxes.map((item) => this.parseMailbox(item));
1034
+ return { mailboxes: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1035
+ }
1036
+ async listMailboxes(projectId, options = {}) {
1037
+ const page = await this.listMailboxesPage(projectId, options);
1038
+ return page.mailboxes;
1023
1039
  }
1024
1040
  async deleteMailbox(projectId, address) {
1025
1041
  await this.request(`/accounts/projects/${projectId}/mailboxes/${address}`, {
@@ -1065,19 +1081,33 @@ class Meshagent {
1065
1081
  });
1066
1082
  return this.parseFeed(data.feed);
1067
1083
  }
1068
- async listFeeds(projectId) {
1084
+ async listFeedsPage(projectId, options = {}) {
1085
+ const { count = 100, offset = 0, filter } = options;
1069
1086
  const data = await this.request(`/accounts/projects/${projectId}/feeds`, {
1087
+ query: { count, offset, filter },
1070
1088
  action: "list feeds",
1071
1089
  });
1072
1090
  const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
1073
- return feeds.map((item) => this.parseFeed(item));
1091
+ const parsed = feeds.map((item) => this.parseFeed(item));
1092
+ return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1074
1093
  }
1075
- async listRoomFeeds(projectId, roomName) {
1094
+ async listFeeds(projectId, options = {}) {
1095
+ const page = await this.listFeedsPage(projectId, options);
1096
+ return page.feeds;
1097
+ }
1098
+ async listRoomFeedsPage(projectId, roomName, options = {}) {
1099
+ const { count = 100, offset = 0, filter } = options;
1076
1100
  const data = await this.request(`/accounts/projects/${projectId}/rooms/${roomName}/feeds`, {
1101
+ query: { count, offset, filter },
1077
1102
  action: "list room feeds",
1078
1103
  });
1079
1104
  const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
1080
- return feeds.map((item) => this.parseFeed(item));
1105
+ const parsed = feeds.map((item) => this.parseFeed(item));
1106
+ return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1107
+ }
1108
+ async listRoomFeeds(projectId, roomName, options = {}) {
1109
+ const page = await this.listRoomFeedsPage(projectId, roomName, options);
1110
+ return page.feeds;
1081
1111
  }
1082
1112
  async deleteFeed(projectId, feedId) {
1083
1113
  await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
@@ -1729,14 +1759,19 @@ class Meshagent {
1729
1759
  const rooms = Array.isArray(data?.rooms) ? data.rooms : [];
1730
1760
  return rooms.map((item) => this.parseProjectRoomGrantCount(item));
1731
1761
  }
1732
- async listUniqueUsersWithGrants(projectId, options = {}) {
1733
- const { limit = 50, offset = 0 } = options;
1762
+ async listUniqueUsersWithGrantsPage(projectId, options = {}) {
1763
+ const { limit = 100, offset = 0, filter } = options;
1734
1764
  const data = await this.request(`/accounts/projects/${projectId}/room-grants/by-user`, {
1735
- query: { limit, offset },
1765
+ query: { limit, offset, filter },
1736
1766
  action: "list unique users with grants",
1737
1767
  });
1738
1768
  const users = Array.isArray(data?.users) ? data.users : [];
1739
- return users.map((item) => this.parseProjectUserGrantCount(item));
1769
+ const parsed = users.map((item) => this.parseProjectUserGrantCount(item));
1770
+ return { users: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1771
+ }
1772
+ async listUniqueUsersWithGrants(projectId, options = {}) {
1773
+ const page = await this.listUniqueUsersWithGrantsPage(projectId, options);
1774
+ return page.users;
1740
1775
  }
1741
1776
  async createOAuthClient(projectId, params) {
1742
1777
  const { grantTypes, responseTypes, redirectUris, scope, metadata = {} } = params;
@@ -1765,12 +1800,19 @@ class Meshagent {
1765
1800
  action: "update oauth client",
1766
1801
  });
1767
1802
  }
1768
- async listOAuthClients(projectId) {
1803
+ async listOAuthClientsPage(projectId, options = {}) {
1804
+ const { count = 100, offset = 0, filter } = options;
1769
1805
  const data = await this.request(`/accounts/projects/${projectId}/oauth/clients`, {
1806
+ query: { count, offset, filter },
1770
1807
  action: "list oauth clients",
1771
1808
  });
1772
1809
  const clients = Array.isArray(data?.clients) ? data.clients : [];
1773
- return clients.map((item) => this.parseOAuthClient(item));
1810
+ const parsed = clients.map((item) => this.parseOAuthClient(item));
1811
+ return { clients: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1812
+ }
1813
+ async listOAuthClients(projectId, options = {}) {
1814
+ const page = await this.listOAuthClientsPage(projectId, options);
1815
+ return page.clients;
1774
1816
  }
1775
1817
  async getOAuthClient(projectId, clientId) {
1776
1818
  const data = await this.request(`/accounts/projects/${projectId}/oauth/clients/${clientId}`, {
@@ -41,6 +41,14 @@ export interface ProjectUserGrantCount {
41
41
  lastName?: string | null;
42
42
  email: string;
43
43
  }
44
+ export interface ProjectMembersPage {
45
+ users: Record<string, unknown>[];
46
+ total: number;
47
+ }
48
+ export interface ProjectUserGrantCountsPage {
49
+ users: ProjectUserGrantCount[];
50
+ total: number;
51
+ }
44
52
  export interface EnvironmentVariable {
45
53
  name: string;
46
54
  value: string;
@@ -202,6 +210,10 @@ export interface Mailbox {
202
210
  roomId?: string;
203
211
  queue: string;
204
212
  }
213
+ export interface MailboxesPage {
214
+ mailboxes: Mailbox[];
215
+ total: number;
216
+ }
205
217
  export type FeedVisibility = "public" | "project" | "private";
206
218
  export interface Feed {
207
219
  id: string;
@@ -214,6 +226,10 @@ export interface Feed {
214
226
  annotations: Record<string, string>;
215
227
  messageSchema?: Record<string, unknown> | boolean | null;
216
228
  }
229
+ export interface FeedsPage {
230
+ feeds: Feed[];
231
+ total: number;
232
+ }
217
233
  export interface FeedSubscription {
218
234
  id: string;
219
235
  feedId: string;
@@ -268,6 +284,10 @@ export interface OAuthClient {
268
284
  projectId: string;
269
285
  metadata: Record<string, string>;
270
286
  }
287
+ export interface OAuthClientsPage {
288
+ clients: OAuthClient[];
289
+ total: number;
290
+ }
271
291
  export interface BaseSecret {
272
292
  id?: string;
273
293
  name: string;
@@ -365,6 +385,11 @@ export declare class Meshagent {
365
385
  }): Promise<Record<string, unknown>>;
366
386
  removeUserFromProject(projectId: string, userId: string): Promise<Record<string, unknown>>;
367
387
  updateProjectSettings(projectId: string, settings: Record<string, unknown>): Promise<Record<string, unknown>>;
388
+ getUsersInProjectPage(projectId: string, options?: {
389
+ count?: number;
390
+ offset?: number;
391
+ filter?: string;
392
+ }): Promise<ProjectMembersPage>;
368
393
  getUsersInProject(projectId: string): Promise<Record<string, unknown>>;
369
394
  getUserProfile(userId: string): Promise<Record<string, unknown>>;
370
395
  updateUserProfile(userId: string, firstName: string, lastName: string): Promise<Record<string, unknown>>;
@@ -446,7 +471,17 @@ export declare class Meshagent {
446
471
  queue: string;
447
472
  isPublic: boolean;
448
473
  }): Promise<void>;
449
- listMailboxes(projectId: string): Promise<Mailbox[]>;
474
+ private parseMailbox;
475
+ listMailboxesPage(projectId: string, options?: {
476
+ count?: number;
477
+ offset?: number;
478
+ filter?: string;
479
+ }): Promise<MailboxesPage>;
480
+ listMailboxes(projectId: string, options?: {
481
+ count?: number;
482
+ offset?: number;
483
+ filter?: string;
484
+ }): Promise<Mailbox[]>;
450
485
  deleteMailbox(projectId: string, address: string): Promise<void>;
451
486
  createFeed(params: {
452
487
  projectId: string;
@@ -467,8 +502,26 @@ export declare class Meshagent {
467
502
  messageSchema?: Record<string, unknown> | boolean | null;
468
503
  }): Promise<void>;
469
504
  getFeed(projectId: string, feedId: string): Promise<Feed>;
470
- listFeeds(projectId: string): Promise<Feed[]>;
471
- listRoomFeeds(projectId: string, roomName: string): Promise<Feed[]>;
505
+ listFeedsPage(projectId: string, options?: {
506
+ count?: number;
507
+ offset?: number;
508
+ filter?: string;
509
+ }): Promise<FeedsPage>;
510
+ listFeeds(projectId: string, options?: {
511
+ count?: number;
512
+ offset?: number;
513
+ filter?: string;
514
+ }): Promise<Feed[]>;
515
+ listRoomFeedsPage(projectId: string, roomName: string, options?: {
516
+ count?: number;
517
+ offset?: number;
518
+ filter?: string;
519
+ }): Promise<FeedsPage>;
520
+ listRoomFeeds(projectId: string, roomName: string, options?: {
521
+ count?: number;
522
+ offset?: number;
523
+ filter?: string;
524
+ }): Promise<Feed[]>;
472
525
  deleteFeed(projectId: string, feedId: string): Promise<void>;
473
526
  publishFeedMessage(params: {
474
527
  projectId: string;
@@ -713,9 +766,15 @@ export declare class Meshagent {
713
766
  limit?: number;
714
767
  offset?: number;
715
768
  }): Promise<ProjectRoomGrantCount[]>;
769
+ listUniqueUsersWithGrantsPage(projectId: string, options?: {
770
+ limit?: number;
771
+ offset?: number;
772
+ filter?: string;
773
+ }): Promise<ProjectUserGrantCountsPage>;
716
774
  listUniqueUsersWithGrants(projectId: string, options?: {
717
775
  limit?: number;
718
776
  offset?: number;
777
+ filter?: string;
719
778
  }): Promise<ProjectUserGrantCount[]>;
720
779
  createOAuthClient(projectId: string, params: {
721
780
  grantTypes: string[];
@@ -731,7 +790,16 @@ export declare class Meshagent {
731
790
  scope?: string;
732
791
  metadata?: Record<string, any>;
733
792
  }): Promise<Record<string, unknown>>;
734
- listOAuthClients(projectId: string): Promise<OAuthClient[]>;
793
+ listOAuthClientsPage(projectId: string, options?: {
794
+ count?: number;
795
+ offset?: number;
796
+ filter?: string;
797
+ }): Promise<OAuthClientsPage>;
798
+ listOAuthClients(projectId: string, options?: {
799
+ count?: number;
800
+ offset?: number;
801
+ filter?: string;
802
+ }): Promise<OAuthClient[]>;
735
803
  getOAuthClient(projectId: string, clientId: string): Promise<OAuthClient>;
736
804
  deleteOAuthClient(projectId: string, clientId: string): Promise<void>;
737
805
  }
@@ -771,10 +771,18 @@ export class Meshagent {
771
771
  action: "update project settings",
772
772
  });
773
773
  }
774
- async getUsersInProject(projectId) {
775
- return await this.request(`/accounts/projects/${projectId}/users`, {
774
+ async getUsersInProjectPage(projectId, options = {}) {
775
+ const { count = 100, offset = 0, filter } = options;
776
+ const data = await this.request(`/accounts/projects/${projectId}/users`, {
777
+ query: { count, offset, filter },
776
778
  action: "fetch project users",
777
779
  });
780
+ const users = Array.isArray(data?.users) ? data.users : [];
781
+ return { users, total: typeof data?.total === "number" ? data.total : users.length };
782
+ }
783
+ async getUsersInProject(projectId) {
784
+ const page = await this.getUsersInProjectPage(projectId);
785
+ return { users: page.users, total: page.total };
778
786
  }
779
787
  async getUserProfile(userId) {
780
788
  return await this.request(`/accounts/profiles/${userId}`, {
@@ -999,24 +1007,32 @@ export class Meshagent {
999
1007
  responseType: "void",
1000
1008
  });
1001
1009
  }
1002
- async listMailboxes(projectId) {
1010
+ parseMailbox(item) {
1011
+ if (!item || typeof item !== "object") {
1012
+ throw new RoomException("Invalid mailbox payload");
1013
+ }
1014
+ const { address, room, room_id, queue } = item;
1015
+ if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
1016
+ throw new RoomException("Invalid mailbox payload: missing fields");
1017
+ }
1018
+ if (room_id !== undefined && typeof room_id !== "string") {
1019
+ throw new RoomException("Invalid mailbox payload: invalid room_id");
1020
+ }
1021
+ return { address, room, roomId: room_id, queue };
1022
+ }
1023
+ async listMailboxesPage(projectId, options = {}) {
1024
+ const { count = 100, offset = 0, filter } = options;
1003
1025
  const data = await this.request(`/accounts/projects/${projectId}/mailboxes`, {
1026
+ query: { count, offset, filter },
1004
1027
  action: "list mailboxes",
1005
1028
  });
1006
1029
  const mailboxes = Array.isArray(data?.mailboxes) ? data.mailboxes : [];
1007
- return mailboxes.map((item) => {
1008
- if (!item || typeof item !== "object") {
1009
- throw new RoomException("Invalid mailbox payload");
1010
- }
1011
- const { address, room, room_id, queue } = item;
1012
- if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
1013
- throw new RoomException("Invalid mailbox payload: missing fields");
1014
- }
1015
- if (room_id !== undefined && typeof room_id !== "string") {
1016
- throw new RoomException("Invalid mailbox payload: invalid room_id");
1017
- }
1018
- return { address, room, roomId: room_id, queue };
1019
- });
1030
+ const parsed = mailboxes.map((item) => this.parseMailbox(item));
1031
+ return { mailboxes: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1032
+ }
1033
+ async listMailboxes(projectId, options = {}) {
1034
+ const page = await this.listMailboxesPage(projectId, options);
1035
+ return page.mailboxes;
1020
1036
  }
1021
1037
  async deleteMailbox(projectId, address) {
1022
1038
  await this.request(`/accounts/projects/${projectId}/mailboxes/${address}`, {
@@ -1062,19 +1078,33 @@ export class Meshagent {
1062
1078
  });
1063
1079
  return this.parseFeed(data.feed);
1064
1080
  }
1065
- async listFeeds(projectId) {
1081
+ async listFeedsPage(projectId, options = {}) {
1082
+ const { count = 100, offset = 0, filter } = options;
1066
1083
  const data = await this.request(`/accounts/projects/${projectId}/feeds`, {
1084
+ query: { count, offset, filter },
1067
1085
  action: "list feeds",
1068
1086
  });
1069
1087
  const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
1070
- return feeds.map((item) => this.parseFeed(item));
1088
+ const parsed = feeds.map((item) => this.parseFeed(item));
1089
+ return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1071
1090
  }
1072
- async listRoomFeeds(projectId, roomName) {
1091
+ async listFeeds(projectId, options = {}) {
1092
+ const page = await this.listFeedsPage(projectId, options);
1093
+ return page.feeds;
1094
+ }
1095
+ async listRoomFeedsPage(projectId, roomName, options = {}) {
1096
+ const { count = 100, offset = 0, filter } = options;
1073
1097
  const data = await this.request(`/accounts/projects/${projectId}/rooms/${roomName}/feeds`, {
1098
+ query: { count, offset, filter },
1074
1099
  action: "list room feeds",
1075
1100
  });
1076
1101
  const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
1077
- return feeds.map((item) => this.parseFeed(item));
1102
+ const parsed = feeds.map((item) => this.parseFeed(item));
1103
+ return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1104
+ }
1105
+ async listRoomFeeds(projectId, roomName, options = {}) {
1106
+ const page = await this.listRoomFeedsPage(projectId, roomName, options);
1107
+ return page.feeds;
1078
1108
  }
1079
1109
  async deleteFeed(projectId, feedId) {
1080
1110
  await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
@@ -1726,14 +1756,19 @@ export class Meshagent {
1726
1756
  const rooms = Array.isArray(data?.rooms) ? data.rooms : [];
1727
1757
  return rooms.map((item) => this.parseProjectRoomGrantCount(item));
1728
1758
  }
1729
- async listUniqueUsersWithGrants(projectId, options = {}) {
1730
- const { limit = 50, offset = 0 } = options;
1759
+ async listUniqueUsersWithGrantsPage(projectId, options = {}) {
1760
+ const { limit = 100, offset = 0, filter } = options;
1731
1761
  const data = await this.request(`/accounts/projects/${projectId}/room-grants/by-user`, {
1732
- query: { limit, offset },
1762
+ query: { limit, offset, filter },
1733
1763
  action: "list unique users with grants",
1734
1764
  });
1735
1765
  const users = Array.isArray(data?.users) ? data.users : [];
1736
- return users.map((item) => this.parseProjectUserGrantCount(item));
1766
+ const parsed = users.map((item) => this.parseProjectUserGrantCount(item));
1767
+ return { users: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1768
+ }
1769
+ async listUniqueUsersWithGrants(projectId, options = {}) {
1770
+ const page = await this.listUniqueUsersWithGrantsPage(projectId, options);
1771
+ return page.users;
1737
1772
  }
1738
1773
  async createOAuthClient(projectId, params) {
1739
1774
  const { grantTypes, responseTypes, redirectUris, scope, metadata = {} } = params;
@@ -1762,12 +1797,19 @@ export class Meshagent {
1762
1797
  action: "update oauth client",
1763
1798
  });
1764
1799
  }
1765
- async listOAuthClients(projectId) {
1800
+ async listOAuthClientsPage(projectId, options = {}) {
1801
+ const { count = 100, offset = 0, filter } = options;
1766
1802
  const data = await this.request(`/accounts/projects/${projectId}/oauth/clients`, {
1803
+ query: { count, offset, filter },
1767
1804
  action: "list oauth clients",
1768
1805
  });
1769
1806
  const clients = Array.isArray(data?.clients) ? data.clients : [];
1770
- return clients.map((item) => this.parseOAuthClient(item));
1807
+ const parsed = clients.map((item) => this.parseOAuthClient(item));
1808
+ return { clients: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1809
+ }
1810
+ async listOAuthClients(projectId, options = {}) {
1811
+ const page = await this.listOAuthClientsPage(projectId, options);
1812
+ return page.clients;
1771
1813
  }
1772
1814
  async getOAuthClient(projectId, clientId) {
1773
1815
  const data = await this.request(`/accounts/projects/${projectId}/oauth/clients/${clientId}`, {
@@ -41,6 +41,14 @@ export interface ProjectUserGrantCount {
41
41
  lastName?: string | null;
42
42
  email: string;
43
43
  }
44
+ export interface ProjectMembersPage {
45
+ users: Record<string, unknown>[];
46
+ total: number;
47
+ }
48
+ export interface ProjectUserGrantCountsPage {
49
+ users: ProjectUserGrantCount[];
50
+ total: number;
51
+ }
44
52
  export interface EnvironmentVariable {
45
53
  name: string;
46
54
  value: string;
@@ -202,6 +210,10 @@ export interface Mailbox {
202
210
  roomId?: string;
203
211
  queue: string;
204
212
  }
213
+ export interface MailboxesPage {
214
+ mailboxes: Mailbox[];
215
+ total: number;
216
+ }
205
217
  export type FeedVisibility = "public" | "project" | "private";
206
218
  export interface Feed {
207
219
  id: string;
@@ -214,6 +226,10 @@ export interface Feed {
214
226
  annotations: Record<string, string>;
215
227
  messageSchema?: Record<string, unknown> | boolean | null;
216
228
  }
229
+ export interface FeedsPage {
230
+ feeds: Feed[];
231
+ total: number;
232
+ }
217
233
  export interface FeedSubscription {
218
234
  id: string;
219
235
  feedId: string;
@@ -268,6 +284,10 @@ export interface OAuthClient {
268
284
  projectId: string;
269
285
  metadata: Record<string, string>;
270
286
  }
287
+ export interface OAuthClientsPage {
288
+ clients: OAuthClient[];
289
+ total: number;
290
+ }
271
291
  export interface BaseSecret {
272
292
  id?: string;
273
293
  name: string;
@@ -365,6 +385,11 @@ export declare class Meshagent {
365
385
  }): Promise<Record<string, unknown>>;
366
386
  removeUserFromProject(projectId: string, userId: string): Promise<Record<string, unknown>>;
367
387
  updateProjectSettings(projectId: string, settings: Record<string, unknown>): Promise<Record<string, unknown>>;
388
+ getUsersInProjectPage(projectId: string, options?: {
389
+ count?: number;
390
+ offset?: number;
391
+ filter?: string;
392
+ }): Promise<ProjectMembersPage>;
368
393
  getUsersInProject(projectId: string): Promise<Record<string, unknown>>;
369
394
  getUserProfile(userId: string): Promise<Record<string, unknown>>;
370
395
  updateUserProfile(userId: string, firstName: string, lastName: string): Promise<Record<string, unknown>>;
@@ -446,7 +471,17 @@ export declare class Meshagent {
446
471
  queue: string;
447
472
  isPublic: boolean;
448
473
  }): Promise<void>;
449
- listMailboxes(projectId: string): Promise<Mailbox[]>;
474
+ private parseMailbox;
475
+ listMailboxesPage(projectId: string, options?: {
476
+ count?: number;
477
+ offset?: number;
478
+ filter?: string;
479
+ }): Promise<MailboxesPage>;
480
+ listMailboxes(projectId: string, options?: {
481
+ count?: number;
482
+ offset?: number;
483
+ filter?: string;
484
+ }): Promise<Mailbox[]>;
450
485
  deleteMailbox(projectId: string, address: string): Promise<void>;
451
486
  createFeed(params: {
452
487
  projectId: string;
@@ -467,8 +502,26 @@ export declare class Meshagent {
467
502
  messageSchema?: Record<string, unknown> | boolean | null;
468
503
  }): Promise<void>;
469
504
  getFeed(projectId: string, feedId: string): Promise<Feed>;
470
- listFeeds(projectId: string): Promise<Feed[]>;
471
- listRoomFeeds(projectId: string, roomName: string): Promise<Feed[]>;
505
+ listFeedsPage(projectId: string, options?: {
506
+ count?: number;
507
+ offset?: number;
508
+ filter?: string;
509
+ }): Promise<FeedsPage>;
510
+ listFeeds(projectId: string, options?: {
511
+ count?: number;
512
+ offset?: number;
513
+ filter?: string;
514
+ }): Promise<Feed[]>;
515
+ listRoomFeedsPage(projectId: string, roomName: string, options?: {
516
+ count?: number;
517
+ offset?: number;
518
+ filter?: string;
519
+ }): Promise<FeedsPage>;
520
+ listRoomFeeds(projectId: string, roomName: string, options?: {
521
+ count?: number;
522
+ offset?: number;
523
+ filter?: string;
524
+ }): Promise<Feed[]>;
472
525
  deleteFeed(projectId: string, feedId: string): Promise<void>;
473
526
  publishFeedMessage(params: {
474
527
  projectId: string;
@@ -713,9 +766,15 @@ export declare class Meshagent {
713
766
  limit?: number;
714
767
  offset?: number;
715
768
  }): Promise<ProjectRoomGrantCount[]>;
769
+ listUniqueUsersWithGrantsPage(projectId: string, options?: {
770
+ limit?: number;
771
+ offset?: number;
772
+ filter?: string;
773
+ }): Promise<ProjectUserGrantCountsPage>;
716
774
  listUniqueUsersWithGrants(projectId: string, options?: {
717
775
  limit?: number;
718
776
  offset?: number;
777
+ filter?: string;
719
778
  }): Promise<ProjectUserGrantCount[]>;
720
779
  createOAuthClient(projectId: string, params: {
721
780
  grantTypes: string[];
@@ -731,7 +790,16 @@ export declare class Meshagent {
731
790
  scope?: string;
732
791
  metadata?: Record<string, any>;
733
792
  }): Promise<Record<string, unknown>>;
734
- listOAuthClients(projectId: string): Promise<OAuthClient[]>;
793
+ listOAuthClientsPage(projectId: string, options?: {
794
+ count?: number;
795
+ offset?: number;
796
+ filter?: string;
797
+ }): Promise<OAuthClientsPage>;
798
+ listOAuthClients(projectId: string, options?: {
799
+ count?: number;
800
+ offset?: number;
801
+ filter?: string;
802
+ }): Promise<OAuthClient[]>;
735
803
  getOAuthClient(projectId: string, clientId: string): Promise<OAuthClient>;
736
804
  deleteOAuthClient(projectId: string, clientId: string): Promise<void>;
737
805
  }
@@ -774,10 +774,18 @@ class Meshagent {
774
774
  action: "update project settings",
775
775
  });
776
776
  }
777
- async getUsersInProject(projectId) {
778
- return await this.request(`/accounts/projects/${projectId}/users`, {
777
+ async getUsersInProjectPage(projectId, options = {}) {
778
+ const { count = 100, offset = 0, filter } = options;
779
+ const data = await this.request(`/accounts/projects/${projectId}/users`, {
780
+ query: { count, offset, filter },
779
781
  action: "fetch project users",
780
782
  });
783
+ const users = Array.isArray(data?.users) ? data.users : [];
784
+ return { users, total: typeof data?.total === "number" ? data.total : users.length };
785
+ }
786
+ async getUsersInProject(projectId) {
787
+ const page = await this.getUsersInProjectPage(projectId);
788
+ return { users: page.users, total: page.total };
781
789
  }
782
790
  async getUserProfile(userId) {
783
791
  return await this.request(`/accounts/profiles/${userId}`, {
@@ -1002,24 +1010,32 @@ class Meshagent {
1002
1010
  responseType: "void",
1003
1011
  });
1004
1012
  }
1005
- async listMailboxes(projectId) {
1013
+ parseMailbox(item) {
1014
+ if (!item || typeof item !== "object") {
1015
+ throw new requirement_1.RoomException("Invalid mailbox payload");
1016
+ }
1017
+ const { address, room, room_id, queue } = item;
1018
+ if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
1019
+ throw new requirement_1.RoomException("Invalid mailbox payload: missing fields");
1020
+ }
1021
+ if (room_id !== undefined && typeof room_id !== "string") {
1022
+ throw new requirement_1.RoomException("Invalid mailbox payload: invalid room_id");
1023
+ }
1024
+ return { address, room, roomId: room_id, queue };
1025
+ }
1026
+ async listMailboxesPage(projectId, options = {}) {
1027
+ const { count = 100, offset = 0, filter } = options;
1006
1028
  const data = await this.request(`/accounts/projects/${projectId}/mailboxes`, {
1029
+ query: { count, offset, filter },
1007
1030
  action: "list mailboxes",
1008
1031
  });
1009
1032
  const mailboxes = Array.isArray(data?.mailboxes) ? data.mailboxes : [];
1010
- return mailboxes.map((item) => {
1011
- if (!item || typeof item !== "object") {
1012
- throw new requirement_1.RoomException("Invalid mailbox payload");
1013
- }
1014
- const { address, room, room_id, queue } = item;
1015
- if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
1016
- throw new requirement_1.RoomException("Invalid mailbox payload: missing fields");
1017
- }
1018
- if (room_id !== undefined && typeof room_id !== "string") {
1019
- throw new requirement_1.RoomException("Invalid mailbox payload: invalid room_id");
1020
- }
1021
- return { address, room, roomId: room_id, queue };
1022
- });
1033
+ const parsed = mailboxes.map((item) => this.parseMailbox(item));
1034
+ return { mailboxes: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1035
+ }
1036
+ async listMailboxes(projectId, options = {}) {
1037
+ const page = await this.listMailboxesPage(projectId, options);
1038
+ return page.mailboxes;
1023
1039
  }
1024
1040
  async deleteMailbox(projectId, address) {
1025
1041
  await this.request(`/accounts/projects/${projectId}/mailboxes/${address}`, {
@@ -1065,19 +1081,33 @@ class Meshagent {
1065
1081
  });
1066
1082
  return this.parseFeed(data.feed);
1067
1083
  }
1068
- async listFeeds(projectId) {
1084
+ async listFeedsPage(projectId, options = {}) {
1085
+ const { count = 100, offset = 0, filter } = options;
1069
1086
  const data = await this.request(`/accounts/projects/${projectId}/feeds`, {
1087
+ query: { count, offset, filter },
1070
1088
  action: "list feeds",
1071
1089
  });
1072
1090
  const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
1073
- return feeds.map((item) => this.parseFeed(item));
1091
+ const parsed = feeds.map((item) => this.parseFeed(item));
1092
+ return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1074
1093
  }
1075
- async listRoomFeeds(projectId, roomName) {
1094
+ async listFeeds(projectId, options = {}) {
1095
+ const page = await this.listFeedsPage(projectId, options);
1096
+ return page.feeds;
1097
+ }
1098
+ async listRoomFeedsPage(projectId, roomName, options = {}) {
1099
+ const { count = 100, offset = 0, filter } = options;
1076
1100
  const data = await this.request(`/accounts/projects/${projectId}/rooms/${roomName}/feeds`, {
1101
+ query: { count, offset, filter },
1077
1102
  action: "list room feeds",
1078
1103
  });
1079
1104
  const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
1080
- return feeds.map((item) => this.parseFeed(item));
1105
+ const parsed = feeds.map((item) => this.parseFeed(item));
1106
+ return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1107
+ }
1108
+ async listRoomFeeds(projectId, roomName, options = {}) {
1109
+ const page = await this.listRoomFeedsPage(projectId, roomName, options);
1110
+ return page.feeds;
1081
1111
  }
1082
1112
  async deleteFeed(projectId, feedId) {
1083
1113
  await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
@@ -1729,14 +1759,19 @@ class Meshagent {
1729
1759
  const rooms = Array.isArray(data?.rooms) ? data.rooms : [];
1730
1760
  return rooms.map((item) => this.parseProjectRoomGrantCount(item));
1731
1761
  }
1732
- async listUniqueUsersWithGrants(projectId, options = {}) {
1733
- const { limit = 50, offset = 0 } = options;
1762
+ async listUniqueUsersWithGrantsPage(projectId, options = {}) {
1763
+ const { limit = 100, offset = 0, filter } = options;
1734
1764
  const data = await this.request(`/accounts/projects/${projectId}/room-grants/by-user`, {
1735
- query: { limit, offset },
1765
+ query: { limit, offset, filter },
1736
1766
  action: "list unique users with grants",
1737
1767
  });
1738
1768
  const users = Array.isArray(data?.users) ? data.users : [];
1739
- return users.map((item) => this.parseProjectUserGrantCount(item));
1769
+ const parsed = users.map((item) => this.parseProjectUserGrantCount(item));
1770
+ return { users: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1771
+ }
1772
+ async listUniqueUsersWithGrants(projectId, options = {}) {
1773
+ const page = await this.listUniqueUsersWithGrantsPage(projectId, options);
1774
+ return page.users;
1740
1775
  }
1741
1776
  async createOAuthClient(projectId, params) {
1742
1777
  const { grantTypes, responseTypes, redirectUris, scope, metadata = {} } = params;
@@ -1765,12 +1800,19 @@ class Meshagent {
1765
1800
  action: "update oauth client",
1766
1801
  });
1767
1802
  }
1768
- async listOAuthClients(projectId) {
1803
+ async listOAuthClientsPage(projectId, options = {}) {
1804
+ const { count = 100, offset = 0, filter } = options;
1769
1805
  const data = await this.request(`/accounts/projects/${projectId}/oauth/clients`, {
1806
+ query: { count, offset, filter },
1770
1807
  action: "list oauth clients",
1771
1808
  });
1772
1809
  const clients = Array.isArray(data?.clients) ? data.clients : [];
1773
- return clients.map((item) => this.parseOAuthClient(item));
1810
+ const parsed = clients.map((item) => this.parseOAuthClient(item));
1811
+ return { clients: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
1812
+ }
1813
+ async listOAuthClients(projectId, options = {}) {
1814
+ const page = await this.listOAuthClientsPage(projectId, options);
1815
+ return page.clients;
1774
1816
  }
1775
1817
  async getOAuthClient(projectId, clientId) {
1776
1818
  const data = await this.request(`/accounts/projects/${projectId}/oauth/clients/${clientId}`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent",
3
- "version": "0.39.0",
3
+ "version": "0.39.1",
4
4
  "description": "Meshagent Client",
5
5
  "homepage": "https://github.com/meshagent/meshagent-ts",
6
6
  "scripts": {