@jsm-mit/chat-motoko-package 0.2.0 → 0.4.0
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/README.md +6 -3
- package/declarations/chat-motoko-backend/chat-motoko-backend.did +9 -0
- package/declarations/chat-motoko-backend/chat-motoko-backend.did.d.ts +9 -0
- package/declarations/chat-motoko-backend/chat-motoko-backend.did.js +9 -0
- package/dist/actors/chats-actor.d.ts +4 -2
- package/dist/actors/chats-actor.d.ts.map +1 -1
- package/dist/actors/chats-actor.js +7 -2
- package/dist/actors/projects-actor.d.ts +3 -2
- package/dist/actors/projects-actor.d.ts.map +1 -1
- package/dist/actors/projects-actor.js +5 -2
- package/dist/interfaces.d.ts +14 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/mappers.d.ts.map +1 -1
- package/dist/mappers.js +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,14 +7,17 @@ that prove it.
|
|
|
7
7
|
```ts
|
|
8
8
|
import { RoomsActor, ChatsActor, MessagesActor, ChatPoller } from "@jsm-mit/chat-motoko-package";
|
|
9
9
|
|
|
10
|
+
// A canister admin creates the project with its accounts canister — the one asked
|
|
11
|
+
// `isUser(principal)` before a non-admin opens a chat (Sultana: sultana-core-motoko).
|
|
10
12
|
// A project admin defines a room: who receives the customer's messages.
|
|
11
13
|
await new RoomsActor(canisterId, adminIdentity).createRoomAsyncUnsafe({
|
|
12
14
|
projectId: "sultana-stage", id: "assistant", name: "Asystent",
|
|
13
15
|
recipients: [{ principal: villagePrincipal, role: "agent", displayName: "Asystentka Ola" }],
|
|
14
16
|
});
|
|
15
17
|
|
|
16
|
-
// A customer opens the room
|
|
17
|
-
|
|
18
|
+
// A customer opens the room at a desk (what the chat is about — here a salon); the same
|
|
19
|
+
// call returns the same chat next time, another desk opens another chat.
|
|
20
|
+
const chat = await new ChatsActor(canisterId, identity).openChatAsyncUnsafe({ projectId: "sultana-stage", roomId: "assistant", desk: salonId, customerName: "Michał" });
|
|
18
21
|
|
|
19
22
|
const messages = new MessagesActor(canisterId, identity);
|
|
20
23
|
await messages.postAsyncUnsafe({ chatId: chat.id, text: "dodaj usługę strzyżenie" });
|
|
@@ -23,7 +26,7 @@ const page = await messages.getMessagesAsyncUnsafe({ chatId: chat.id, sinceSeq:
|
|
|
23
26
|
// An agent host: every new message in every chat this identity is a recipient of, with
|
|
24
27
|
// the room and the customer on each message — route by (projectId, roomId).
|
|
25
28
|
const poller = new ChatPoller(messages, 1000, { onError: console.error });
|
|
26
|
-
poller.messages$.subscribe((m) => console.log(m.roomId, m.customer, m.kind, m.text));
|
|
29
|
+
poller.messages$.subscribe((m) => console.log(m.roomId, m.desk, m.customer, m.kind, m.text));
|
|
27
30
|
poller.run();
|
|
28
31
|
```
|
|
29
32
|
|
|
@@ -7,6 +7,7 @@ type UpdateRoomArgs =
|
|
|
7
7
|
};
|
|
8
8
|
type UpdateProjectArgs =
|
|
9
9
|
record {
|
|
10
|
+
accountsCanister: opt principal;
|
|
10
11
|
admins: opt vec principal;
|
|
11
12
|
projectId: ProjectId;
|
|
12
13
|
};
|
|
@@ -120,6 +121,7 @@ type PurgeChatArgs = record {chatId: ChatId;};
|
|
|
120
121
|
type ProjectId = text;
|
|
121
122
|
type Project =
|
|
122
123
|
record {
|
|
124
|
+
accountsCanister: principal;
|
|
123
125
|
admins: vec principal;
|
|
124
126
|
createdAt: int;
|
|
125
127
|
createdBy: principal;
|
|
@@ -159,6 +161,7 @@ type Participant =
|
|
|
159
161
|
type OpenChatArgs =
|
|
160
162
|
record {
|
|
161
163
|
customerName: opt text;
|
|
164
|
+
desk: opt text;
|
|
162
165
|
projectId: ProjectId;
|
|
163
166
|
roomId: RoomId;
|
|
164
167
|
};
|
|
@@ -179,6 +182,7 @@ type Message =
|
|
|
179
182
|
chatId: ChatId;
|
|
180
183
|
createdAt: int;
|
|
181
184
|
customer: principal;
|
|
185
|
+
desk: opt text;
|
|
182
186
|
globalSeq: nat;
|
|
183
187
|
kind: MessageKind;
|
|
184
188
|
projectId: ProjectId;
|
|
@@ -199,6 +203,7 @@ type ListRoomsArgs =
|
|
|
199
203
|
type ListProjectsArgs = record {limit: opt nat;};
|
|
200
204
|
type ListProjectChatsArgs =
|
|
201
205
|
record {
|
|
206
|
+
desk: opt text;
|
|
202
207
|
limit: opt nat;
|
|
203
208
|
projectId: ProjectId;
|
|
204
209
|
roomId: opt RoomId;
|
|
@@ -211,6 +216,7 @@ type GetRoomArgs =
|
|
|
211
216
|
type GetProjectArgs = record {projectId: ProjectId;};
|
|
212
217
|
type GetMyChatsArgs =
|
|
213
218
|
record {
|
|
219
|
+
desk: opt text;
|
|
214
220
|
limit: opt nat;
|
|
215
221
|
projectId: ProjectId;
|
|
216
222
|
roomId: opt RoomId;
|
|
@@ -246,6 +252,7 @@ type CreateRoomArgs =
|
|
|
246
252
|
};
|
|
247
253
|
type CreateProjectArgs =
|
|
248
254
|
record {
|
|
255
|
+
accountsCanister: principal;
|
|
249
256
|
admins: vec principal;
|
|
250
257
|
id: ProjectId;
|
|
251
258
|
};
|
|
@@ -253,6 +260,7 @@ type ChatSummary =
|
|
|
253
260
|
record {
|
|
254
261
|
createdAt: int;
|
|
255
262
|
customer: principal;
|
|
263
|
+
desk: opt text;
|
|
256
264
|
id: ChatId;
|
|
257
265
|
lastMessageAt: int;
|
|
258
266
|
messageCount: nat;
|
|
@@ -265,6 +273,7 @@ type Chat =
|
|
|
265
273
|
record {
|
|
266
274
|
createdAt: int;
|
|
267
275
|
customer: principal;
|
|
276
|
+
desk: opt text;
|
|
268
277
|
id: ChatId;
|
|
269
278
|
lastMessageAt: int;
|
|
270
279
|
lastSeq: nat;
|
|
@@ -8,6 +8,7 @@ export interface Chat {
|
|
|
8
8
|
'participants' : Array<Participant>,
|
|
9
9
|
'lastMessageAt' : bigint,
|
|
10
10
|
'customer' : Principal,
|
|
11
|
+
'desk' : [] | [string],
|
|
11
12
|
'createdAt' : bigint,
|
|
12
13
|
'projectId' : ProjectId,
|
|
13
14
|
'roomId' : RoomId,
|
|
@@ -18,6 +19,7 @@ export interface ChatSummary {
|
|
|
18
19
|
'id' : ChatId,
|
|
19
20
|
'lastMessageAt' : bigint,
|
|
20
21
|
'customer' : Principal,
|
|
22
|
+
'desk' : [] | [string],
|
|
21
23
|
'createdAt' : bigint,
|
|
22
24
|
'projectId' : ProjectId,
|
|
23
25
|
'messageCount' : bigint,
|
|
@@ -26,6 +28,7 @@ export interface ChatSummary {
|
|
|
26
28
|
}
|
|
27
29
|
export interface CreateProjectArgs {
|
|
28
30
|
'id' : ProjectId,
|
|
31
|
+
'accountsCanister' : Principal,
|
|
29
32
|
'admins' : Array<Principal>,
|
|
30
33
|
}
|
|
31
34
|
export interface CreateRoomArgs {
|
|
@@ -49,6 +52,7 @@ export interface GetMessagesArgs {
|
|
|
49
52
|
'sinceSeq' : bigint,
|
|
50
53
|
}
|
|
51
54
|
export interface GetMyChatsArgs {
|
|
55
|
+
'desk' : [] | [string],
|
|
52
56
|
'limit' : [] | [bigint],
|
|
53
57
|
'projectId' : ProjectId,
|
|
54
58
|
'roomId' : [] | [RoomId],
|
|
@@ -56,6 +60,7 @@ export interface GetMyChatsArgs {
|
|
|
56
60
|
export interface GetProjectArgs { 'projectId' : ProjectId }
|
|
57
61
|
export interface GetRoomArgs { 'projectId' : ProjectId, 'roomId' : RoomId }
|
|
58
62
|
export interface ListProjectChatsArgs {
|
|
63
|
+
'desk' : [] | [string],
|
|
59
64
|
'limit' : [] | [bigint],
|
|
60
65
|
'projectId' : ProjectId,
|
|
61
66
|
'roomId' : [] | [RoomId],
|
|
@@ -69,6 +74,7 @@ export interface MarkReadArgs { 'seq' : bigint, 'chatId' : ChatId }
|
|
|
69
74
|
export interface Message {
|
|
70
75
|
'seq' : bigint,
|
|
71
76
|
'customer' : Principal,
|
|
77
|
+
'desk' : [] | [string],
|
|
72
78
|
'kind' : MessageKind,
|
|
73
79
|
'createdAt' : bigint,
|
|
74
80
|
'text' : string,
|
|
@@ -87,6 +93,7 @@ export interface MessagesPage {
|
|
|
87
93
|
}
|
|
88
94
|
export interface OpenChatArgs {
|
|
89
95
|
'customerName' : [] | [string],
|
|
96
|
+
'desk' : [] | [string],
|
|
90
97
|
'projectId' : ProjectId,
|
|
91
98
|
'roomId' : RoomId,
|
|
92
99
|
}
|
|
@@ -118,6 +125,7 @@ export interface Project {
|
|
|
118
125
|
'id' : ProjectId,
|
|
119
126
|
'createdAt' : bigint,
|
|
120
127
|
'createdBy' : Principal,
|
|
128
|
+
'accountsCanister' : Principal,
|
|
121
129
|
'admins' : Array<Principal>,
|
|
122
130
|
}
|
|
123
131
|
export type ProjectId = string;
|
|
@@ -175,6 +183,7 @@ export interface SetLoggingEnabledArgs { 'enabled' : boolean }
|
|
|
175
183
|
export interface SetQuotaLimitsArgs { 'limits' : QuotaLimits }
|
|
176
184
|
export type SystemEvent = { 'chatCreated' : null };
|
|
177
185
|
export interface UpdateProjectArgs {
|
|
186
|
+
'accountsCanister' : [] | [Principal],
|
|
178
187
|
'projectId' : ProjectId,
|
|
179
188
|
'admins' : [] | [Array<Principal>],
|
|
180
189
|
}
|
|
@@ -14,12 +14,14 @@ export const idlFactory = ({ IDL }) => {
|
|
|
14
14
|
const ProjectId = IDL.Text;
|
|
15
15
|
const CreateProjectArgs = IDL.Record({
|
|
16
16
|
'id' : ProjectId,
|
|
17
|
+
'accountsCanister' : IDL.Principal,
|
|
17
18
|
'admins' : IDL.Vec(IDL.Principal),
|
|
18
19
|
});
|
|
19
20
|
const Project = IDL.Record({
|
|
20
21
|
'id' : ProjectId,
|
|
21
22
|
'createdAt' : IDL.Int,
|
|
22
23
|
'createdBy' : IDL.Principal,
|
|
24
|
+
'accountsCanister' : IDL.Principal,
|
|
23
25
|
'admins' : IDL.Vec(IDL.Principal),
|
|
24
26
|
});
|
|
25
27
|
const Result_1 = IDL.Variant({ 'ok' : Project, 'err' : Error });
|
|
@@ -72,6 +74,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
72
74
|
'participants' : IDL.Vec(Participant),
|
|
73
75
|
'lastMessageAt' : IDL.Int,
|
|
74
76
|
'customer' : IDL.Principal,
|
|
77
|
+
'desk' : IDL.Opt(IDL.Text),
|
|
75
78
|
'createdAt' : IDL.Int,
|
|
76
79
|
'projectId' : ProjectId,
|
|
77
80
|
'roomId' : RoomId,
|
|
@@ -92,6 +95,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
92
95
|
const Message = IDL.Record({
|
|
93
96
|
'seq' : IDL.Nat,
|
|
94
97
|
'customer' : IDL.Principal,
|
|
98
|
+
'desk' : IDL.Opt(IDL.Text),
|
|
95
99
|
'kind' : MessageKind,
|
|
96
100
|
'createdAt' : IDL.Int,
|
|
97
101
|
'text' : IDL.Text,
|
|
@@ -107,6 +111,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
107
111
|
});
|
|
108
112
|
const Result_12 = IDL.Variant({ 'ok' : MessagesPage, 'err' : Error });
|
|
109
113
|
const GetMyChatsArgs = IDL.Record({
|
|
114
|
+
'desk' : IDL.Opt(IDL.Text),
|
|
110
115
|
'limit' : IDL.Opt(IDL.Nat),
|
|
111
116
|
'projectId' : ProjectId,
|
|
112
117
|
'roomId' : IDL.Opt(RoomId),
|
|
@@ -120,6 +125,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
120
125
|
'roomId' : RoomId,
|
|
121
126
|
});
|
|
122
127
|
const ListProjectChatsArgs = IDL.Record({
|
|
128
|
+
'desk' : IDL.Opt(IDL.Text),
|
|
123
129
|
'limit' : IDL.Opt(IDL.Nat),
|
|
124
130
|
'projectId' : ProjectId,
|
|
125
131
|
'roomId' : IDL.Opt(RoomId),
|
|
@@ -128,6 +134,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
128
134
|
'id' : ChatId,
|
|
129
135
|
'lastMessageAt' : IDL.Int,
|
|
130
136
|
'customer' : IDL.Principal,
|
|
137
|
+
'desk' : IDL.Opt(IDL.Text),
|
|
131
138
|
'createdAt' : IDL.Int,
|
|
132
139
|
'projectId' : ProjectId,
|
|
133
140
|
'messageCount' : IDL.Nat,
|
|
@@ -145,6 +152,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
145
152
|
const MarkReadArgs = IDL.Record({ 'seq' : IDL.Nat, 'chatId' : ChatId });
|
|
146
153
|
const OpenChatArgs = IDL.Record({
|
|
147
154
|
'customerName' : IDL.Opt(IDL.Text),
|
|
155
|
+
'desk' : IDL.Opt(IDL.Text),
|
|
148
156
|
'projectId' : ProjectId,
|
|
149
157
|
'roomId' : RoomId,
|
|
150
158
|
});
|
|
@@ -171,6 +179,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
171
179
|
const SetLoggingEnabledArgs = IDL.Record({ 'enabled' : IDL.Bool });
|
|
172
180
|
const SetQuotaLimitsArgs = IDL.Record({ 'limits' : QuotaLimits });
|
|
173
181
|
const UpdateProjectArgs = IDL.Record({
|
|
182
|
+
'accountsCanister' : IDL.Opt(IDL.Principal),
|
|
174
183
|
'projectId' : ProjectId,
|
|
175
184
|
'admins' : IDL.Opt(IDL.Vec(IDL.Principal)),
|
|
176
185
|
});
|
|
@@ -7,8 +7,10 @@ export declare class ChatsActor extends ActorBase {
|
|
|
7
7
|
/**
|
|
8
8
|
* Opens the caller's chat in a room: the caller becomes the `customer`, the room's
|
|
9
9
|
* recipients are copied in, the canister writes the `chatCreated` event. One chat per
|
|
10
|
-
* (room, customer, recipients) — calling again returns the same chat unchanged.
|
|
11
|
-
*
|
|
10
|
+
* (room, customer, recipients, desk) — calling again returns the same chat unchanged. A NEW
|
|
11
|
+
* chat is created only once the project's accounts canister confirms the caller
|
|
12
|
+
* (`isUser`); admins of the canister and of the project skip that.
|
|
13
|
+
* @throws Error with message `CanisterError` when the canister returns a business error (`NotAuthorized` also when the accounts canister does not know the caller, `NotFound` for the room, `InvalidData` when the caller is a recipient of the room, the name is too long or the daily chat limit is reached, `InterCanisterConnectionError` when the accounts canister cannot be asked). Examine "cause" for {errorKey, errorMessage, logs}.
|
|
12
14
|
* @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
|
|
13
15
|
* @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution (anonymous, or today's chat quota used up).
|
|
14
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chats-actor.d.ts","sourceRoot":"","sources":["../../src/actors/chats-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGzH,gFAAgF;AAChF,qBAAa,UAAW,SAAQ,SAAS;gBAEzB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD
|
|
1
|
+
{"version":3,"file":"chats-actor.d.ts","sourceRoot":"","sources":["../../src/actors/chats-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGzH,gFAAgF;AAChF,qBAAa,UAAW,SAAQ,SAAS;gBAEzB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;;;;OASG;IACU,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;IAYzE;;;;;OAKG;IACU,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKlE;;;;;;OAMG;IACU,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAY/E;;;;;;OAMG;IACU,2BAA2B,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAYlG;;;;;;;OAOG;IACU,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGtE"}
|
|
@@ -9,8 +9,10 @@ export class ChatsActor extends ActorBase {
|
|
|
9
9
|
/**
|
|
10
10
|
* Opens the caller's chat in a room: the caller becomes the `customer`, the room's
|
|
11
11
|
* recipients are copied in, the canister writes the `chatCreated` event. One chat per
|
|
12
|
-
* (room, customer, recipients) — calling again returns the same chat unchanged.
|
|
13
|
-
*
|
|
12
|
+
* (room, customer, recipients, desk) — calling again returns the same chat unchanged. A NEW
|
|
13
|
+
* chat is created only once the project's accounts canister confirms the caller
|
|
14
|
+
* (`isUser`); admins of the canister and of the project skip that.
|
|
15
|
+
* @throws Error with message `CanisterError` when the canister returns a business error (`NotAuthorized` also when the accounts canister does not know the caller, `NotFound` for the room, `InvalidData` when the caller is a recipient of the room, the name is too long or the daily chat limit is reached, `InterCanisterConnectionError` when the accounts canister cannot be asked). Examine "cause" for {errorKey, errorMessage, logs}.
|
|
14
16
|
* @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
|
|
15
17
|
* @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution (anonymous, or today's chat quota used up).
|
|
16
18
|
*/
|
|
@@ -18,6 +20,7 @@ export class ChatsActor extends ActorBase {
|
|
|
18
20
|
const chat = await this.executeFunctionAsyncUnsafe(() => this.actor.openChat({
|
|
19
21
|
projectId: input.projectId,
|
|
20
22
|
roomId: input.roomId,
|
|
23
|
+
desk: toOpt(input.desk),
|
|
21
24
|
customerName: toOpt(input.customerName),
|
|
22
25
|
}));
|
|
23
26
|
return mapChatView(chat);
|
|
@@ -43,6 +46,7 @@ export class ChatsActor extends ActorBase {
|
|
|
43
46
|
const chats = await this.executeFunctionAsyncUnsafe(() => this.actor.getMyChats({
|
|
44
47
|
projectId: input.projectId,
|
|
45
48
|
roomId: toOpt(input.roomId),
|
|
49
|
+
desk: toOpt(input.desk),
|
|
46
50
|
limit: toOptBigInt(input.limit),
|
|
47
51
|
}));
|
|
48
52
|
return chats.map(mapChatView);
|
|
@@ -58,6 +62,7 @@ export class ChatsActor extends ActorBase {
|
|
|
58
62
|
const summaries = await this.executeFunctionAsyncUnsafe(() => this.actor.listProjectChats({
|
|
59
63
|
projectId: input.projectId,
|
|
60
64
|
roomId: toOpt(input.roomId),
|
|
65
|
+
desk: toOpt(input.desk),
|
|
61
66
|
limit: toOptBigInt(input.limit),
|
|
62
67
|
}));
|
|
63
68
|
return summaries.map(mapChatSummaryView);
|
|
@@ -7,14 +7,15 @@ export declare class ProjectsActor extends ActorBase {
|
|
|
7
7
|
constructor(canisterId: string, identity?: Identity);
|
|
8
8
|
/**
|
|
9
9
|
* Creates a project. Canister admin only.
|
|
10
|
-
* @param input - id (max 50 chars, no '/' or '|')
|
|
10
|
+
* @param input - id (max 50 chars, no '/' or '|'), admins (max 10, no anonymous) and the accounts canister the chat asks `isUser` before a non-admin opens a chat.
|
|
11
11
|
* @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `AlreadyExists`, `InvalidData`). Examine "cause" for {errorKey, errorMessage, logs}.
|
|
12
12
|
* @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
|
|
13
13
|
* @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
|
|
14
14
|
*/
|
|
15
15
|
createProjectAsyncUnsafe(input: CreateProjectInput): Promise<ProjectView>;
|
|
16
16
|
/**
|
|
17
|
-
* Replaces the admin list when given. Canister admins and
|
|
17
|
+
* Replaces the admin list and/or the accounts canister when given. Canister admins and
|
|
18
|
+
* the project's admins.
|
|
18
19
|
* @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound`, `InvalidData`). Examine "cause" for {errorKey, errorMessage, logs}.
|
|
19
20
|
* @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
|
|
20
21
|
* @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects-actor.d.ts","sourceRoot":"","sources":["../../src/actors/projects-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG5F;8CAC8C;AAC9C,qBAAa,aAAc,SAAQ,SAAS;gBAE5B,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;OAMG;IACU,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"projects-actor.d.ts","sourceRoot":"","sources":["../../src/actors/projects-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG5F;8CAC8C;AAC9C,qBAAa,aAAc,SAAQ,SAAS;gBAE5B,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;OAMG;IACU,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;IAWtF;;;;;;OAMG;IACU,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;IAWtF;;;;;OAKG;IACU,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAK3E;;;;;OAKG;IACU,uBAAuB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAI/E"}
|
|
@@ -10,7 +10,7 @@ export class ProjectsActor extends ActorBase {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Creates a project. Canister admin only.
|
|
13
|
-
* @param input - id (max 50 chars, no '/' or '|')
|
|
13
|
+
* @param input - id (max 50 chars, no '/' or '|'), admins (max 10, no anonymous) and the accounts canister the chat asks `isUser` before a non-admin opens a chat.
|
|
14
14
|
* @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `AlreadyExists`, `InvalidData`). Examine "cause" for {errorKey, errorMessage, logs}.
|
|
15
15
|
* @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
|
|
16
16
|
* @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
|
|
@@ -19,11 +19,13 @@ export class ProjectsActor extends ActorBase {
|
|
|
19
19
|
const project = await this.executeFunctionAsyncUnsafe(() => this.actor.createProject({
|
|
20
20
|
id: input.id,
|
|
21
21
|
admins: input.admins.map((p) => Principal.fromText(p)),
|
|
22
|
+
accountsCanister: Principal.fromText(input.accountsCanisterId),
|
|
22
23
|
}));
|
|
23
24
|
return mapProjectView(project);
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
* Replaces the admin list when given. Canister admins and
|
|
27
|
+
* Replaces the admin list and/or the accounts canister when given. Canister admins and
|
|
28
|
+
* the project's admins.
|
|
27
29
|
* @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound`, `InvalidData`). Examine "cause" for {errorKey, errorMessage, logs}.
|
|
28
30
|
* @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
|
|
29
31
|
* @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
|
|
@@ -32,6 +34,7 @@ export class ProjectsActor extends ActorBase {
|
|
|
32
34
|
const project = await this.executeFunctionAsyncUnsafe(() => this.actor.updateProject({
|
|
33
35
|
projectId: input.projectId,
|
|
34
36
|
admins: toOpt(input.admins?.map((p) => Principal.fromText(p))),
|
|
37
|
+
accountsCanister: toOpt(input.accountsCanisterId === undefined ? undefined : Principal.fromText(input.accountsCanisterId)),
|
|
35
38
|
}));
|
|
36
39
|
return mapProjectView(project);
|
|
37
40
|
}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface ProjectView {
|
|
|
13
13
|
createdAt: bigint;
|
|
14
14
|
/** Define the rooms, see the project's chats as metadata, may purge them. */
|
|
15
15
|
admins: string[];
|
|
16
|
+
/** Asked (`isUser`) before somebody who is not an admin opens a chat in the project. */
|
|
17
|
+
accountsCanisterId: string;
|
|
16
18
|
}
|
|
17
19
|
export interface RecipientView {
|
|
18
20
|
principal: string;
|
|
@@ -42,6 +44,8 @@ export interface ChatView {
|
|
|
42
44
|
projectId: string;
|
|
43
45
|
roomId: string;
|
|
44
46
|
customer: string;
|
|
47
|
+
/** The desk of the room the customer walked up to — the consumer's id of what the chat is about. */
|
|
48
|
+
desk?: string;
|
|
45
49
|
createdAt: bigint;
|
|
46
50
|
participants: ParticipantView[];
|
|
47
51
|
lastSeq: number;
|
|
@@ -53,6 +57,7 @@ export interface ChatSummaryView {
|
|
|
53
57
|
projectId: string;
|
|
54
58
|
roomId: string;
|
|
55
59
|
customer: string;
|
|
60
|
+
desk?: string;
|
|
56
61
|
createdAt: bigint;
|
|
57
62
|
participantCount: number;
|
|
58
63
|
messageCount: number;
|
|
@@ -68,6 +73,8 @@ export interface MessageView {
|
|
|
68
73
|
roomId: string;
|
|
69
74
|
/** Whom the chat belongs to — so a recipient's poll routes without a lookup. */
|
|
70
75
|
customer: string;
|
|
76
|
+
/** The chat's desk, when it has one (Sultana: the salon). */
|
|
77
|
+
desk?: string;
|
|
71
78
|
/** Dense per-chat sequence starting at 1. */
|
|
72
79
|
seq: number;
|
|
73
80
|
/** Canister-wide sequence — the poll cursor. */
|
|
@@ -98,10 +105,13 @@ export interface QuotaLimitsView {
|
|
|
98
105
|
export interface CreateProjectInput {
|
|
99
106
|
id: string;
|
|
100
107
|
admins: string[];
|
|
108
|
+
/** The canister that answers `isUser(principal)` for this project — mandatory. */
|
|
109
|
+
accountsCanisterId: string;
|
|
101
110
|
}
|
|
102
111
|
export interface UpdateProjectInput {
|
|
103
112
|
projectId: string;
|
|
104
113
|
admins?: string[];
|
|
114
|
+
accountsCanisterId?: string;
|
|
105
115
|
}
|
|
106
116
|
export interface CreateRoomInput {
|
|
107
117
|
projectId: string;
|
|
@@ -127,17 +137,21 @@ export interface ListRoomsInput {
|
|
|
127
137
|
export interface OpenChatInput {
|
|
128
138
|
projectId: string;
|
|
129
139
|
roomId: string;
|
|
140
|
+
/** Which desk of the room (max 200 chars) — another desk is another chat. */
|
|
141
|
+
desk?: string;
|
|
130
142
|
/** How the recipients see the caller; omitted = the principal. */
|
|
131
143
|
customerName?: string;
|
|
132
144
|
}
|
|
133
145
|
export interface GetMyChatsInput {
|
|
134
146
|
projectId: string;
|
|
135
147
|
roomId?: string;
|
|
148
|
+
desk?: string;
|
|
136
149
|
limit?: number;
|
|
137
150
|
}
|
|
138
151
|
export interface ListProjectChatsInput {
|
|
139
152
|
projectId: string;
|
|
140
153
|
roomId?: string;
|
|
154
|
+
desk?: string;
|
|
141
155
|
limit?: number;
|
|
142
156
|
}
|
|
143
157
|
export interface PostInput {
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mGAAmG;AACnG,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AACv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AAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/mappers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,IAAI,EACJ,WAAW,EACX,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,EACV,OAAO,EACP,WAAW,EACX,SAAS,EACT,aAAa,EACb,IAA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,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAkB5D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAExE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,cAAc,CAMpE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CAEvE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW,CAExE"}
|
package/dist/mappers.js
CHANGED
|
@@ -40,6 +40,7 @@ export function mapProjectView(project) {
|
|
|
40
40
|
createdBy: project.createdBy.toText(),
|
|
41
41
|
createdAt: project.createdAt,
|
|
42
42
|
admins: project.admins.map((p) => p.toText()),
|
|
43
|
+
accountsCanisterId: project.accountsCanister.toText(),
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
export function mapRoomView(room) {
|
|
@@ -69,6 +70,7 @@ export function mapChatView(chat) {
|
|
|
69
70
|
projectId: chat.projectId,
|
|
70
71
|
roomId: chat.roomId,
|
|
71
72
|
customer: chat.customer.toText(),
|
|
73
|
+
desk: fromOpt(chat.desk),
|
|
72
74
|
createdAt: chat.createdAt,
|
|
73
75
|
participants: chat.participants.map(mapParticipantView),
|
|
74
76
|
lastSeq: Number(chat.lastSeq),
|
|
@@ -81,6 +83,7 @@ export function mapChatSummaryView(summary) {
|
|
|
81
83
|
projectId: summary.projectId,
|
|
82
84
|
roomId: summary.roomId,
|
|
83
85
|
customer: summary.customer.toText(),
|
|
86
|
+
desk: fromOpt(summary.desk),
|
|
84
87
|
createdAt: summary.createdAt,
|
|
85
88
|
participantCount: Number(summary.participantCount),
|
|
86
89
|
messageCount: Number(summary.messageCount),
|
|
@@ -96,6 +99,7 @@ export function mapMessageView(message) {
|
|
|
96
99
|
projectId: message.projectId,
|
|
97
100
|
roomId: message.roomId,
|
|
98
101
|
customer: message.customer.toText(),
|
|
102
|
+
desk: fromOpt(message.desk),
|
|
99
103
|
seq: Number(message.seq),
|
|
100
104
|
globalSeq: Number(message.globalSeq),
|
|
101
105
|
author: message.author.toText(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsm-mit/chat-motoko-package",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Wrapper TypeScript package for the chat-motoko canister: projects, multi-party chats, messages and a poller for agent hosts.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
"chatMotoko": {
|
|
59
59
|
"repo": "chat-motoko",
|
|
60
60
|
"repoUrl": "https://github.com/JSM-Chat-Platform/chat-motoko",
|
|
61
|
-
"commit": "
|
|
61
|
+
"commit": "e9c8a68daef59e8d4c9ceb1dd5089a7c008fa103"
|
|
62
62
|
}
|
|
63
63
|
}
|