@meshagent/meshagent-ts-auth 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.
@@ -27016,10 +27016,18 @@ return true;`);
27016
27016
  action: "update project settings"
27017
27017
  });
27018
27018
  }
27019
- async getUsersInProject(projectId) {
27020
- return await this.request(`/accounts/projects/${projectId}/users`, {
27019
+ async getUsersInProjectPage(projectId, options = {}) {
27020
+ const { count = 100, offset = 0, filter } = options;
27021
+ const data = await this.request(`/accounts/projects/${projectId}/users`, {
27022
+ query: { count, offset, filter },
27021
27023
  action: "fetch project users"
27022
27024
  });
27025
+ const users = Array.isArray(data?.users) ? data.users : [];
27026
+ return { users, total: typeof data?.total === "number" ? data.total : users.length };
27027
+ }
27028
+ async getUsersInProject(projectId) {
27029
+ const page = await this.getUsersInProjectPage(projectId);
27030
+ return { users: page.users, total: page.total };
27023
27031
  }
27024
27032
  async getUserProfile(userId) {
27025
27033
  return await this.request(`/accounts/profiles/${userId}`, {
@@ -27244,24 +27252,32 @@ return true;`);
27244
27252
  responseType: "void"
27245
27253
  });
27246
27254
  }
27247
- async listMailboxes(projectId) {
27255
+ parseMailbox(item) {
27256
+ if (!item || typeof item !== "object") {
27257
+ throw new RoomException("Invalid mailbox payload");
27258
+ }
27259
+ const { address, room, room_id, queue } = item;
27260
+ if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
27261
+ throw new RoomException("Invalid mailbox payload: missing fields");
27262
+ }
27263
+ if (room_id !== void 0 && typeof room_id !== "string") {
27264
+ throw new RoomException("Invalid mailbox payload: invalid room_id");
27265
+ }
27266
+ return { address, room, roomId: room_id, queue };
27267
+ }
27268
+ async listMailboxesPage(projectId, options = {}) {
27269
+ const { count = 100, offset = 0, filter } = options;
27248
27270
  const data = await this.request(`/accounts/projects/${projectId}/mailboxes`, {
27271
+ query: { count, offset, filter },
27249
27272
  action: "list mailboxes"
27250
27273
  });
27251
27274
  const mailboxes = Array.isArray(data?.mailboxes) ? data.mailboxes : [];
27252
- return mailboxes.map((item) => {
27253
- if (!item || typeof item !== "object") {
27254
- throw new RoomException("Invalid mailbox payload");
27255
- }
27256
- const { address, room, room_id, queue } = item;
27257
- if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
27258
- throw new RoomException("Invalid mailbox payload: missing fields");
27259
- }
27260
- if (room_id !== void 0 && typeof room_id !== "string") {
27261
- throw new RoomException("Invalid mailbox payload: invalid room_id");
27262
- }
27263
- return { address, room, roomId: room_id, queue };
27264
- });
27275
+ const parsed = mailboxes.map((item) => this.parseMailbox(item));
27276
+ return { mailboxes: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
27277
+ }
27278
+ async listMailboxes(projectId, options = {}) {
27279
+ const page = await this.listMailboxesPage(projectId, options);
27280
+ return page.mailboxes;
27265
27281
  }
27266
27282
  async deleteMailbox(projectId, address) {
27267
27283
  await this.request(`/accounts/projects/${projectId}/mailboxes/${address}`, {
@@ -27307,19 +27323,33 @@ return true;`);
27307
27323
  });
27308
27324
  return this.parseFeed(data.feed);
27309
27325
  }
27310
- async listFeeds(projectId) {
27326
+ async listFeedsPage(projectId, options = {}) {
27327
+ const { count = 100, offset = 0, filter } = options;
27311
27328
  const data = await this.request(`/accounts/projects/${projectId}/feeds`, {
27329
+ query: { count, offset, filter },
27312
27330
  action: "list feeds"
27313
27331
  });
27314
27332
  const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
27315
- return feeds.map((item) => this.parseFeed(item));
27333
+ const parsed = feeds.map((item) => this.parseFeed(item));
27334
+ return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
27316
27335
  }
27317
- async listRoomFeeds(projectId, roomName) {
27336
+ async listFeeds(projectId, options = {}) {
27337
+ const page = await this.listFeedsPage(projectId, options);
27338
+ return page.feeds;
27339
+ }
27340
+ async listRoomFeedsPage(projectId, roomName, options = {}) {
27341
+ const { count = 100, offset = 0, filter } = options;
27318
27342
  const data = await this.request(`/accounts/projects/${projectId}/rooms/${roomName}/feeds`, {
27343
+ query: { count, offset, filter },
27319
27344
  action: "list room feeds"
27320
27345
  });
27321
27346
  const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
27322
- return feeds.map((item) => this.parseFeed(item));
27347
+ const parsed = feeds.map((item) => this.parseFeed(item));
27348
+ return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
27349
+ }
27350
+ async listRoomFeeds(projectId, roomName, options = {}) {
27351
+ const page = await this.listRoomFeedsPage(projectId, roomName, options);
27352
+ return page.feeds;
27323
27353
  }
27324
27354
  async deleteFeed(projectId, feedId) {
27325
27355
  await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
@@ -27971,14 +28001,19 @@ return true;`);
27971
28001
  const rooms = Array.isArray(data?.rooms) ? data.rooms : [];
27972
28002
  return rooms.map((item) => this.parseProjectRoomGrantCount(item));
27973
28003
  }
27974
- async listUniqueUsersWithGrants(projectId, options = {}) {
27975
- const { limit = 50, offset = 0 } = options;
28004
+ async listUniqueUsersWithGrantsPage(projectId, options = {}) {
28005
+ const { limit = 100, offset = 0, filter } = options;
27976
28006
  const data = await this.request(`/accounts/projects/${projectId}/room-grants/by-user`, {
27977
- query: { limit, offset },
28007
+ query: { limit, offset, filter },
27978
28008
  action: "list unique users with grants"
27979
28009
  });
27980
28010
  const users = Array.isArray(data?.users) ? data.users : [];
27981
- return users.map((item) => this.parseProjectUserGrantCount(item));
28011
+ const parsed = users.map((item) => this.parseProjectUserGrantCount(item));
28012
+ return { users: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
28013
+ }
28014
+ async listUniqueUsersWithGrants(projectId, options = {}) {
28015
+ const page = await this.listUniqueUsersWithGrantsPage(projectId, options);
28016
+ return page.users;
27982
28017
  }
27983
28018
  async createOAuthClient(projectId, params2) {
27984
28019
  const { grantTypes, responseTypes, redirectUris, scope, metadata = {} } = params2;
@@ -28007,12 +28042,19 @@ return true;`);
28007
28042
  action: "update oauth client"
28008
28043
  });
28009
28044
  }
28010
- async listOAuthClients(projectId) {
28045
+ async listOAuthClientsPage(projectId, options = {}) {
28046
+ const { count = 100, offset = 0, filter } = options;
28011
28047
  const data = await this.request(`/accounts/projects/${projectId}/oauth/clients`, {
28048
+ query: { count, offset, filter },
28012
28049
  action: "list oauth clients"
28013
28050
  });
28014
28051
  const clients = Array.isArray(data?.clients) ? data.clients : [];
28015
- return clients.map((item) => this.parseOAuthClient(item));
28052
+ const parsed = clients.map((item) => this.parseOAuthClient(item));
28053
+ return { clients: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
28054
+ }
28055
+ async listOAuthClients(projectId, options = {}) {
28056
+ const page = await this.listOAuthClientsPage(projectId, options);
28057
+ return page.clients;
28016
28058
  }
28017
28059
  async getOAuthClient(projectId, clientId) {
28018
28060
  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-ts-auth",
3
- "version": "0.39.0",
3
+ "version": "0.39.1",
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.39.0",
42
+ "@meshagent/meshagent": "^0.39.1",
43
43
  "typescript": "^5.8.3"
44
44
  },
45
45
  "devDependencies": {