@axiom-lattice/client-sdk 4.3.7 → 4.3.9
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/dist/ChunkMessageMerger.d.ts.map +1 -1
- package/dist/ChunkMessageMerger.js +4 -0
- package/dist/ChunkMessageMerger.js.map +1 -1
- package/dist/__tests__/ChunkMessageMerger.test.js +10 -0
- package/dist/__tests__/ChunkMessageMerger.test.js.map +1 -1
- package/dist/__tests__/project-rooms.test.js +15 -0
- package/dist/__tests__/project-rooms.test.js.map +1 -1
- package/dist/__tests__/workspace-members.test.d.ts +2 -0
- package/dist/__tests__/workspace-members.test.d.ts.map +1 -0
- package/dist/__tests__/workspace-members.test.js +58 -0
- package/dist/__tests__/workspace-members.test.js.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -2
- package/dist/index.mjs.map +1 -1
- package/dist/project-room-hydrators.js +2 -2
- package/dist/project-room-hydrators.js.map +1 -1
- package/dist/project-rooms.d.ts +13 -0
- package/dist/project-rooms.d.ts.map +1 -1
- package/dist/project-rooms.js +11 -0
- package/dist/project-rooms.js.map +1 -1
- package/dist/workspace-members.d.ts +18 -0
- package/dist/workspace-members.d.ts.map +1 -0
- package/dist/workspace-members.js +37 -0
- package/dist/workspace-members.js.map +1 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3561,11 +3561,11 @@ var hydrateRoom = (value) => {
|
|
|
3561
3561
|
};
|
|
3562
3562
|
var hydrateMessage = (value) => {
|
|
3563
3563
|
const row = record(value);
|
|
3564
|
-
exactKeys(row, ["id", "roomId", "author", "content", "mentions", "source", "createdAt"], ["replyToMessageId"]);
|
|
3564
|
+
exactKeys(row, ["id", "roomId", "author", "content", "mentions", "source", "createdAt"], ["replyToMessageId", "sourceId"]);
|
|
3565
3565
|
const content = record(row.content);
|
|
3566
3566
|
if (oneOf(content.type, ["text"], "content.type") !== "text")
|
|
3567
3567
|
throw new ProjectRoomClientError("Invalid content", 500, "INVALID_RESPONSE", false);
|
|
3568
|
-
return { id: requiredString(row, "id"), roomId: requiredString(row, "roomId"), author: hydrateAuthor(row.author), content: { type: "text", text: requiredString(content, "text") }, mentions: hydrateMentions(row.mentions), ...row.replyToMessageId === void 0 ? {} : { replyToMessageId: requiredString(row, "replyToMessageId") }, source: oneOf(row.source, messageSources, "source"), createdAt: date(row.createdAt, "createdAt") };
|
|
3568
|
+
return { id: requiredString(row, "id"), roomId: requiredString(row, "roomId"), author: hydrateAuthor(row.author), content: { type: "text", text: requiredString(content, "text") }, mentions: hydrateMentions(row.mentions), ...row.replyToMessageId === void 0 ? {} : { replyToMessageId: requiredString(row, "replyToMessageId") }, ...row.sourceId === void 0 ? {} : { sourceId: requiredString(row, "sourceId") }, source: oneOf(row.source, messageSources, "source"), createdAt: date(row.createdAt, "createdAt") };
|
|
3569
3569
|
};
|
|
3570
3570
|
var hydrateMember = (value) => {
|
|
3571
3571
|
const row = record(value);
|
|
@@ -3643,6 +3643,17 @@ var ProjectRoomsClient = class {
|
|
|
3643
3643
|
resume: async (projectId, membershipId, input) => hydrateBot(await this.request(`/api/projects/${encode(projectId)}/bots/${encode(membershipId)}/resume`, { method: "POST", body: { expectedUpdatedAt: iso(input.expectedUpdatedAt) } })),
|
|
3644
3644
|
remove: async (projectId, membershipId, input) => this.request(`/api/projects/${encode(projectId)}/bots/${encode(membershipId)}?expectedUpdatedAt=${encode(iso(input.expectedUpdatedAt))}`, { method: "DELETE" })
|
|
3645
3645
|
};
|
|
3646
|
+
this.interrupts = {
|
|
3647
|
+
resume: async (projectId, input) => {
|
|
3648
|
+
await this.request(`/api/projects/${encode(projectId)}/room/interrupts/resume`, {
|
|
3649
|
+
method: "POST",
|
|
3650
|
+
body: {
|
|
3651
|
+
membershipId: input.membershipId,
|
|
3652
|
+
...input.answers === void 0 ? {} : { answers: input.answers }
|
|
3653
|
+
}
|
|
3654
|
+
});
|
|
3655
|
+
}
|
|
3656
|
+
};
|
|
3646
3657
|
}
|
|
3647
3658
|
async getRoom(projectId) {
|
|
3648
3659
|
return hydrateRoom(await this.request(`/api/projects/${encode(projectId)}/room`));
|
|
@@ -3737,6 +3748,42 @@ var WorkspaceRoomsClient = class {
|
|
|
3737
3748
|
}
|
|
3738
3749
|
};
|
|
3739
3750
|
|
|
3751
|
+
// src/workspace-members.ts
|
|
3752
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3753
|
+
var hydrateMember2 = (value) => {
|
|
3754
|
+
if (!isRecord3(value))
|
|
3755
|
+
throw new ProjectRoomClientError("Invalid workspace member", 500, "INVALID_RESPONSE", false);
|
|
3756
|
+
if (typeof value.userId !== "string" || typeof value.name !== "string")
|
|
3757
|
+
throw new ProjectRoomClientError("Invalid workspace member", 500, "INVALID_RESPONSE", false);
|
|
3758
|
+
return {
|
|
3759
|
+
userId: value.userId,
|
|
3760
|
+
name: value.name,
|
|
3761
|
+
...typeof value.email === "string" ? { email: value.email } : {},
|
|
3762
|
+
role: typeof value.role === "string" ? value.role : "member",
|
|
3763
|
+
hasDirectRoom: value.hasDirectRoom === true,
|
|
3764
|
+
...typeof value.joinedAt === "string" ? { joinedAt: value.joinedAt } : {}
|
|
3765
|
+
};
|
|
3766
|
+
};
|
|
3767
|
+
var WorkspaceMembersClient = class {
|
|
3768
|
+
constructor(baseURL, getHeaders) {
|
|
3769
|
+
this.baseURL = baseURL;
|
|
3770
|
+
this.getHeaders = getHeaders;
|
|
3771
|
+
}
|
|
3772
|
+
/** Lists the tenant users visible in a workspace, excluding the current user. */
|
|
3773
|
+
async list(workspaceId) {
|
|
3774
|
+
const response = await fetch(`${this.baseURL}/api/workspaces/${encodeURIComponent(workspaceId)}/orgs/members`, { headers: this.getHeaders() });
|
|
3775
|
+
const payload = await response.json().catch(() => void 0);
|
|
3776
|
+
if (!response.ok || !payload?.success) {
|
|
3777
|
+
const error = payload?.error;
|
|
3778
|
+
throw new ProjectRoomClientError(typeof error?.message === "string" ? error.message : "Workspace members request failed", response.status, typeof error?.code === "string" ? error.code : response.ok ? "INVALID_RESPONSE" : "HTTP_ERROR", error?.retryable === true, error?.details);
|
|
3779
|
+
}
|
|
3780
|
+
const members = payload.data?.members;
|
|
3781
|
+
if (!Array.isArray(members))
|
|
3782
|
+
throw new ProjectRoomClientError("Invalid workspace members response", 500, "INVALID_RESPONSE", false);
|
|
3783
|
+
return members.map(hydrateMember2);
|
|
3784
|
+
}
|
|
3785
|
+
};
|
|
3786
|
+
|
|
3740
3787
|
// src/sse-parser.ts
|
|
3741
3788
|
var SseParseError = class extends Error {
|
|
3742
3789
|
constructor(message) {
|
|
@@ -3991,6 +4038,7 @@ var _Client = class extends AbstractClient {
|
|
|
3991
4038
|
this.exportImport = new ExportImportClient(this.config, () => this.getAllHeaders());
|
|
3992
4039
|
this.projectRooms = new ProjectRoomsClient(this.config.baseURL, () => this.getAllHeaders());
|
|
3993
4040
|
this.workspaceRooms = new WorkspaceRoomsClient(this.config.baseURL, () => this.getAllHeaders());
|
|
4041
|
+
this.workspaceMembers = new WorkspaceMembersClient(this.config.baseURL, () => this.getAllHeaders());
|
|
3994
4042
|
this.roomEvents = new RoomEventsClient(this.config.baseURL, () => this.getAllHeaders());
|
|
3995
4043
|
}
|
|
3996
4044
|
/**
|
|
@@ -5079,6 +5127,8 @@ function createSimpleMessageMerger() {
|
|
|
5079
5127
|
});
|
|
5080
5128
|
}
|
|
5081
5129
|
function push(chunk) {
|
|
5130
|
+
if (chunk.type === "error")
|
|
5131
|
+
return;
|
|
5082
5132
|
const role = normalizeRole(chunk.type);
|
|
5083
5133
|
let message = ensureMessage(chunk.data.id, role);
|
|
5084
5134
|
const isInArray = message.role !== "tool";
|
|
@@ -5194,6 +5244,7 @@ export {
|
|
|
5194
5244
|
ScheduledTaskStatus,
|
|
5195
5245
|
WeChatClient,
|
|
5196
5246
|
WorkspaceClient,
|
|
5247
|
+
WorkspaceMembersClient,
|
|
5197
5248
|
WorkspaceRoomsClient,
|
|
5198
5249
|
createSimpleMessageMerger
|
|
5199
5250
|
};
|