@jsm-mit/chat-motoko-package 0.1.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 +50 -0
- package/declarations/chat-motoko-backend/chat-motoko-backend.did +275 -0
- package/declarations/chat-motoko-backend/chat-motoko-backend.did.d.ts +197 -0
- package/declarations/chat-motoko-backend/chat-motoko-backend.did.js +198 -0
- package/declarations/chat-motoko-backend/index.d.ts +50 -0
- package/declarations/chat-motoko-backend/index.js +42 -0
- package/dist/actor-base.d.ts +47 -0
- package/dist/actor-base.d.ts.map +1 -0
- package/dist/actor-base.js +130 -0
- package/dist/actors/admin-actor.d.ts +61 -0
- package/dist/actors/admin-actor.d.ts.map +1 -0
- package/dist/actors/admin-actor.js +82 -0
- package/dist/actors/chats-actor.d.ts +77 -0
- package/dist/actors/chats-actor.d.ts.map +1 -0
- package/dist/actors/chats-actor.js +120 -0
- package/dist/actors/messages-actor.d.ts +43 -0
- package/dist/actors/messages-actor.d.ts.map +1 -0
- package/dist/actors/messages-actor.js +80 -0
- package/dist/actors/projects-actor.d.ts +38 -0
- package/dist/actors/projects-actor.d.ts.map +1 -0
- package/dist/actors/projects-actor.js +64 -0
- package/dist/chat-poller.d.ts +36 -0
- package/dist/chat-poller.d.ts.map +1 -0
- package/dist/chat-poller.js +82 -0
- package/dist/globals.d.ts +2 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/globals.js +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/interfaces.d.ts +149 -0
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/interfaces.js +6 -0
- package/dist/mappers.d.ts +17 -0
- package/dist/mappers.d.ts.map +1 -0
- package/dist/mappers.js +109 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @jsm-mit/chat-motoko-package
|
|
2
|
+
|
|
3
|
+
TypeScript wrapper for the [`chat-motoko`](../chat-motoko) canister — a generic,
|
|
4
|
+
multi-project, multi-party chat on the Internet Computer — plus the integration tests
|
|
5
|
+
that prove it.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { ChatsActor, MessagesActor, ChatPoller } from "@jsm-mit/chat-motoko-package";
|
|
9
|
+
|
|
10
|
+
const chats = new ChatsActor(canisterId, identity);
|
|
11
|
+
const chat = await chats.createChatAsyncUnsafe({ projectId: "sultana-dev", subject: salonId, firstMessage: "cześć" });
|
|
12
|
+
|
|
13
|
+
const messages = new MessagesActor(canisterId, identity);
|
|
14
|
+
await messages.postAsyncUnsafe({ chatId: chat.id, text: "dodaj usługę strzyżenie" });
|
|
15
|
+
const page = await messages.getMessagesAsyncUnsafe({ chatId: chat.id, sinceSeq: 0 });
|
|
16
|
+
|
|
17
|
+
// An agent host: every new message in every chat this identity belongs to.
|
|
18
|
+
const poller = new ChatPoller(messages, 1000, { onError: console.error });
|
|
19
|
+
poller.messages$.subscribe((m) => console.log(m.chatId, m.kind, m.text));
|
|
20
|
+
poller.run();
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
One class per canister controller (`AdminActor`, `ProjectsActor`, `ChatsActor`,
|
|
24
|
+
`MessagesActor`), every method `…AsyncUnsafe` (throws one of `CanisterError`,
|
|
25
|
+
`CriticalCanisterError`, `CallRefusedAtInspectionStage`) or `…AsyncSafe` (never
|
|
26
|
+
throws). Views translate `Principal` → text, `opt` → optional, variants → string
|
|
27
|
+
unions; sequence numbers are plain `number`s, timestamps `bigint` nanoseconds.
|
|
28
|
+
|
|
29
|
+
`src/` is browser-safe — the same package serves the agent host and a web panel.
|
|
30
|
+
|
|
31
|
+
Scripts: `build`, `typecheck`, `sync-declarations`, `test-suite`,
|
|
32
|
+
`test-access-restrictions`, `sandbox` (an interactive admin/chat console:
|
|
33
|
+
`npm run sandbox -- <canister-id>`). See `CLAUDE.md` for who runs what.
|
|
34
|
+
|
|
35
|
+
## Publishing
|
|
36
|
+
|
|
37
|
+
Bump the version in `package.json` by hand, then:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
npm run publish-public
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`scripts/publish-public.sh` refuses unless this repo is on `master` equal to
|
|
44
|
+
`origin/master` with nothing uncommitted but the bump, and the version is not on the
|
|
45
|
+
registry yet. It then runs `scripts/stamp-canister-commit.sh`, which refuses unless
|
|
46
|
+
`../chat-motoko` is on `master`, clean and equal to its `origin/master`, rebuilds the
|
|
47
|
+
canister, regenerates the declarations and refuses if that changes what is committed
|
|
48
|
+
here. Only then it writes `chatMotoko.{repo, repoUrl, commit}` into `package.json` — the
|
|
49
|
+
canister commit this version was generated from — publishes, and commits and pushes
|
|
50
|
+
`Version bump to <version>`. A failed publish takes the stamp back out.
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
type UpdateProjectArgs =
|
|
2
|
+
record {
|
|
3
|
+
admins: opt vec principal;
|
|
4
|
+
agents: opt vec principal;
|
|
5
|
+
agentsMayInvite: opt bool;
|
|
6
|
+
defaultPolicy: opt Policy;
|
|
7
|
+
projectId: ProjectId;
|
|
8
|
+
};
|
|
9
|
+
type SystemEvent =
|
|
10
|
+
variant {
|
|
11
|
+
chatClosed;
|
|
12
|
+
chatCreated;
|
|
13
|
+
memberInvited: record {
|
|
14
|
+
by: principal;
|
|
15
|
+
"principal": principal;
|
|
16
|
+
role: Role;
|
|
17
|
+
};
|
|
18
|
+
memberJoined: record {
|
|
19
|
+
"principal": principal;
|
|
20
|
+
role: Role;
|
|
21
|
+
};
|
|
22
|
+
memberLeft: record {"principal": principal;};
|
|
23
|
+
memberRemoved: record {
|
|
24
|
+
by: principal;
|
|
25
|
+
"principal": principal;
|
|
26
|
+
};
|
|
27
|
+
policyChanged: Policy;
|
|
28
|
+
};
|
|
29
|
+
type SetPolicyArgs =
|
|
30
|
+
record {
|
|
31
|
+
chatId: ChatId;
|
|
32
|
+
policy: Policy;
|
|
33
|
+
};
|
|
34
|
+
type SetLoggingEnabledArgs = record {enabled: bool;};
|
|
35
|
+
type Role =
|
|
36
|
+
variant {
|
|
37
|
+
admin;
|
|
38
|
+
agent;
|
|
39
|
+
member;
|
|
40
|
+
owner;
|
|
41
|
+
};
|
|
42
|
+
type Result_9 =
|
|
43
|
+
variant {
|
|
44
|
+
err: Error;
|
|
45
|
+
ok: vec principal;
|
|
46
|
+
};
|
|
47
|
+
type Result_8 =
|
|
48
|
+
variant {
|
|
49
|
+
err: Error;
|
|
50
|
+
ok: MessagesPage;
|
|
51
|
+
};
|
|
52
|
+
type Result_7 =
|
|
53
|
+
variant {
|
|
54
|
+
err: Error;
|
|
55
|
+
ok: vec Chat;
|
|
56
|
+
};
|
|
57
|
+
type Result_6 =
|
|
58
|
+
variant {
|
|
59
|
+
err: Error;
|
|
60
|
+
ok: vec Project;
|
|
61
|
+
};
|
|
62
|
+
type Result_5 =
|
|
63
|
+
variant {
|
|
64
|
+
err: Error;
|
|
65
|
+
ok: PollResult;
|
|
66
|
+
};
|
|
67
|
+
type Result_4 =
|
|
68
|
+
variant {
|
|
69
|
+
err: Error;
|
|
70
|
+
ok: Message;
|
|
71
|
+
};
|
|
72
|
+
type Result_3 =
|
|
73
|
+
variant {
|
|
74
|
+
err: Error;
|
|
75
|
+
ok: principal;
|
|
76
|
+
};
|
|
77
|
+
type Result_2 =
|
|
78
|
+
variant {
|
|
79
|
+
err: Error;
|
|
80
|
+
ok: bool;
|
|
81
|
+
};
|
|
82
|
+
type Result_1 =
|
|
83
|
+
variant {
|
|
84
|
+
err: Error;
|
|
85
|
+
ok: Chat;
|
|
86
|
+
};
|
|
87
|
+
type Result =
|
|
88
|
+
variant {
|
|
89
|
+
err: Error;
|
|
90
|
+
ok: Project;
|
|
91
|
+
};
|
|
92
|
+
type RemoveMemberArgs =
|
|
93
|
+
record {
|
|
94
|
+
chatId: ChatId;
|
|
95
|
+
"principal": principal;
|
|
96
|
+
};
|
|
97
|
+
type RemoveAdminArgs = record {"principal": principal;};
|
|
98
|
+
type PurgeChatArgs = record {chatId: ChatId;};
|
|
99
|
+
type ProjectId = text;
|
|
100
|
+
type Project =
|
|
101
|
+
record {
|
|
102
|
+
admins: vec principal;
|
|
103
|
+
agents: vec principal;
|
|
104
|
+
agentsMayInvite: bool;
|
|
105
|
+
createdAt: int;
|
|
106
|
+
createdBy: principal;
|
|
107
|
+
defaultPolicy: Policy;
|
|
108
|
+
id: ProjectId;
|
|
109
|
+
};
|
|
110
|
+
type PostKind =
|
|
111
|
+
variant {
|
|
112
|
+
"text";
|
|
113
|
+
toolTrace;
|
|
114
|
+
};
|
|
115
|
+
type PostArgs =
|
|
116
|
+
record {
|
|
117
|
+
chatId: ChatId;
|
|
118
|
+
kind: PostKind;
|
|
119
|
+
"text": text;
|
|
120
|
+
};
|
|
121
|
+
type PollResult =
|
|
122
|
+
record {
|
|
123
|
+
headGlobalSeq: nat;
|
|
124
|
+
messages: vec Message;
|
|
125
|
+
nextSinceGlobalSeq: nat;
|
|
126
|
+
};
|
|
127
|
+
type PollNewMessagesArgs =
|
|
128
|
+
record {
|
|
129
|
+
limit: opt nat;
|
|
130
|
+
sinceGlobalSeq: nat;
|
|
131
|
+
};
|
|
132
|
+
type Policy = record {agentsReply: bool;};
|
|
133
|
+
type MessagesPage =
|
|
134
|
+
record {
|
|
135
|
+
lastSeq: nat;
|
|
136
|
+
messages: vec Message;
|
|
137
|
+
};
|
|
138
|
+
type MessageKind =
|
|
139
|
+
variant {
|
|
140
|
+
event: SystemEvent;
|
|
141
|
+
"text";
|
|
142
|
+
toolTrace;
|
|
143
|
+
};
|
|
144
|
+
type Message =
|
|
145
|
+
record {
|
|
146
|
+
author: principal;
|
|
147
|
+
chatId: ChatId;
|
|
148
|
+
createdAt: int;
|
|
149
|
+
globalSeq: nat;
|
|
150
|
+
kind: MessageKind;
|
|
151
|
+
projectId: ProjectId;
|
|
152
|
+
seq: nat;
|
|
153
|
+
"text": text;
|
|
154
|
+
};
|
|
155
|
+
type MemberInput =
|
|
156
|
+
record {
|
|
157
|
+
"principal": principal;
|
|
158
|
+
role: Role;
|
|
159
|
+
};
|
|
160
|
+
type Member =
|
|
161
|
+
record {
|
|
162
|
+
joinedAt: int;
|
|
163
|
+
lastReadSeq: nat;
|
|
164
|
+
"principal": principal;
|
|
165
|
+
role: Role;
|
|
166
|
+
};
|
|
167
|
+
type MarkReadArgs =
|
|
168
|
+
record {
|
|
169
|
+
chatId: ChatId;
|
|
170
|
+
seq: nat;
|
|
171
|
+
};
|
|
172
|
+
type ListProjectsArgs = record {limit: opt nat;};
|
|
173
|
+
type LeaveChatArgs = record {chatId: ChatId;};
|
|
174
|
+
type InviteMemberArgs =
|
|
175
|
+
record {
|
|
176
|
+
chatId: ChatId;
|
|
177
|
+
"principal": principal;
|
|
178
|
+
role: Role;
|
|
179
|
+
};
|
|
180
|
+
type GetProjectArgs = record {projectId: ProjectId;};
|
|
181
|
+
type GetMyChatsArgs =
|
|
182
|
+
record {
|
|
183
|
+
includeClosed: bool;
|
|
184
|
+
limit: opt nat;
|
|
185
|
+
projectId: ProjectId;
|
|
186
|
+
subject: opt text;
|
|
187
|
+
};
|
|
188
|
+
type GetMessagesArgs =
|
|
189
|
+
record {
|
|
190
|
+
chatId: ChatId;
|
|
191
|
+
limit: opt nat;
|
|
192
|
+
sinceSeq: nat;
|
|
193
|
+
};
|
|
194
|
+
type GetChatArgs = record {chatId: ChatId;};
|
|
195
|
+
type ErrorDetails =
|
|
196
|
+
variant {
|
|
197
|
+
AlreadyExists;
|
|
198
|
+
InterCanisterConnectionError;
|
|
199
|
+
InvalidData: text;
|
|
200
|
+
NotAuthorized: text;
|
|
201
|
+
NotFound;
|
|
202
|
+
RemoteCanisterError: text;
|
|
203
|
+
ReturnsNull;
|
|
204
|
+
};
|
|
205
|
+
type Error =
|
|
206
|
+
record {
|
|
207
|
+
details: ErrorDetails;
|
|
208
|
+
logsJson: text;
|
|
209
|
+
};
|
|
210
|
+
type CreateProjectArgs =
|
|
211
|
+
record {
|
|
212
|
+
admins: vec principal;
|
|
213
|
+
agents: vec principal;
|
|
214
|
+
agentsMayInvite: bool;
|
|
215
|
+
defaultPolicy: Policy;
|
|
216
|
+
id: ProjectId;
|
|
217
|
+
};
|
|
218
|
+
type CreateChatArgs =
|
|
219
|
+
record {
|
|
220
|
+
firstMessage: opt text;
|
|
221
|
+
members: vec MemberInput;
|
|
222
|
+
policy: opt Policy;
|
|
223
|
+
projectId: ProjectId;
|
|
224
|
+
subject: opt text;
|
|
225
|
+
title: opt text;
|
|
226
|
+
};
|
|
227
|
+
type CloseChatArgs = record {chatId: ChatId;};
|
|
228
|
+
type ChatStatus =
|
|
229
|
+
variant {
|
|
230
|
+
closed;
|
|
231
|
+
open;
|
|
232
|
+
};
|
|
233
|
+
type ChatId = text;
|
|
234
|
+
type Chat =
|
|
235
|
+
record {
|
|
236
|
+
createdAt: int;
|
|
237
|
+
createdBy: principal;
|
|
238
|
+
id: ChatId;
|
|
239
|
+
lastMessageAt: int;
|
|
240
|
+
lastSeq: nat;
|
|
241
|
+
members: vec Member;
|
|
242
|
+
policy: Policy;
|
|
243
|
+
projectId: ProjectId;
|
|
244
|
+
status: ChatStatus;
|
|
245
|
+
subject: opt text;
|
|
246
|
+
title: opt text;
|
|
247
|
+
};
|
|
248
|
+
type AddAdminArgs = record {"principal": principal;};
|
|
249
|
+
service : {
|
|
250
|
+
addAdmin: (args: AddAdminArgs) -> (Result_2);
|
|
251
|
+
clearLogs: () -> ();
|
|
252
|
+
closeChat: (args: CloseChatArgs) -> (Result_1);
|
|
253
|
+
createChat: (args: CreateChatArgs) -> (Result_1);
|
|
254
|
+
createProject: (args: CreateProjectArgs) -> (Result);
|
|
255
|
+
getAdmins: () -> (Result_9) query;
|
|
256
|
+
getChat: (args: GetChatArgs) -> (Result_1) query;
|
|
257
|
+
getLogs: () -> (text) query;
|
|
258
|
+
getMessages: (args: GetMessagesArgs) -> (Result_8) query;
|
|
259
|
+
getMyChats: (args: GetMyChatsArgs) -> (Result_7) query;
|
|
260
|
+
getProject: (args: GetProjectArgs) -> (Result) query;
|
|
261
|
+
inviteMember: (args: InviteMemberArgs) -> (Result_1);
|
|
262
|
+
leaveChat: (args: LeaveChatArgs) -> (Result_2);
|
|
263
|
+
listProjects: (args: ListProjectsArgs) -> (Result_6) query;
|
|
264
|
+
markRead: (args: MarkReadArgs) -> (Result_2);
|
|
265
|
+
pollNewMessages: (args: PollNewMessagesArgs) -> (Result_5) query;
|
|
266
|
+
post: (args: PostArgs) -> (Result_4);
|
|
267
|
+
purgeChat: (args: PurgeChatArgs) -> (Result_2);
|
|
268
|
+
registerAsAdmin: () -> (Result_3);
|
|
269
|
+
removeAdmin: (args: RemoveAdminArgs) -> (Result_2);
|
|
270
|
+
removeMember: (args: RemoveMemberArgs) -> (Result_1);
|
|
271
|
+
setLoggingEnabled: (args: SetLoggingEnabledArgs) -> (Result_2);
|
|
272
|
+
setPolicy: (args: SetPolicyArgs) -> (Result_1);
|
|
273
|
+
updateProject: (args: UpdateProjectArgs) -> (Result);
|
|
274
|
+
whoAmI: () -> (principal) query;
|
|
275
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import type { Principal } from '@icp-sdk/core/principal';
|
|
2
|
+
import type { ActorMethod } from '@icp-sdk/core/agent';
|
|
3
|
+
import type { IDL } from '@icp-sdk/core/candid';
|
|
4
|
+
|
|
5
|
+
export interface AddAdminArgs { 'principal' : Principal }
|
|
6
|
+
export interface Chat {
|
|
7
|
+
'id' : ChatId,
|
|
8
|
+
'status' : ChatStatus,
|
|
9
|
+
'title' : [] | [string],
|
|
10
|
+
'members' : Array<Member>,
|
|
11
|
+
'lastMessageAt' : bigint,
|
|
12
|
+
'subject' : [] | [string],
|
|
13
|
+
'createdAt' : bigint,
|
|
14
|
+
'createdBy' : Principal,
|
|
15
|
+
'projectId' : ProjectId,
|
|
16
|
+
'lastSeq' : bigint,
|
|
17
|
+
'policy' : Policy,
|
|
18
|
+
}
|
|
19
|
+
export type ChatId = string;
|
|
20
|
+
export type ChatStatus = { 'closed' : null } |
|
|
21
|
+
{ 'open' : null };
|
|
22
|
+
export interface CloseChatArgs { 'chatId' : ChatId }
|
|
23
|
+
export interface CreateChatArgs {
|
|
24
|
+
'title' : [] | [string],
|
|
25
|
+
'members' : Array<MemberInput>,
|
|
26
|
+
'subject' : [] | [string],
|
|
27
|
+
'projectId' : ProjectId,
|
|
28
|
+
'firstMessage' : [] | [string],
|
|
29
|
+
'policy' : [] | [Policy],
|
|
30
|
+
}
|
|
31
|
+
export interface CreateProjectArgs {
|
|
32
|
+
'id' : ProjectId,
|
|
33
|
+
'agents' : Array<Principal>,
|
|
34
|
+
'admins' : Array<Principal>,
|
|
35
|
+
'agentsMayInvite' : boolean,
|
|
36
|
+
'defaultPolicy' : Policy,
|
|
37
|
+
}
|
|
38
|
+
export interface Error { 'details' : ErrorDetails, 'logsJson' : string }
|
|
39
|
+
export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
|
|
40
|
+
{ 'RemoteCanisterError' : string } |
|
|
41
|
+
{ 'NotFound' : null } |
|
|
42
|
+
{ 'NotAuthorized' : string } |
|
|
43
|
+
{ 'InvalidData' : string } |
|
|
44
|
+
{ 'AlreadyExists' : null } |
|
|
45
|
+
{ 'ReturnsNull' : null };
|
|
46
|
+
export interface GetChatArgs { 'chatId' : ChatId }
|
|
47
|
+
export interface GetMessagesArgs {
|
|
48
|
+
'limit' : [] | [bigint],
|
|
49
|
+
'chatId' : ChatId,
|
|
50
|
+
'sinceSeq' : bigint,
|
|
51
|
+
}
|
|
52
|
+
export interface GetMyChatsArgs {
|
|
53
|
+
'subject' : [] | [string],
|
|
54
|
+
'includeClosed' : boolean,
|
|
55
|
+
'limit' : [] | [bigint],
|
|
56
|
+
'projectId' : ProjectId,
|
|
57
|
+
}
|
|
58
|
+
export interface GetProjectArgs { 'projectId' : ProjectId }
|
|
59
|
+
export interface InviteMemberArgs {
|
|
60
|
+
'principal' : Principal,
|
|
61
|
+
'role' : Role,
|
|
62
|
+
'chatId' : ChatId,
|
|
63
|
+
}
|
|
64
|
+
export interface LeaveChatArgs { 'chatId' : ChatId }
|
|
65
|
+
export interface ListProjectsArgs { 'limit' : [] | [bigint] }
|
|
66
|
+
export interface MarkReadArgs { 'seq' : bigint, 'chatId' : ChatId }
|
|
67
|
+
export interface Member {
|
|
68
|
+
'principal' : Principal,
|
|
69
|
+
'joinedAt' : bigint,
|
|
70
|
+
'role' : Role,
|
|
71
|
+
'lastReadSeq' : bigint,
|
|
72
|
+
}
|
|
73
|
+
export interface MemberInput { 'principal' : Principal, 'role' : Role }
|
|
74
|
+
export interface Message {
|
|
75
|
+
'seq' : bigint,
|
|
76
|
+
'kind' : MessageKind,
|
|
77
|
+
'createdAt' : bigint,
|
|
78
|
+
'text' : string,
|
|
79
|
+
'globalSeq' : bigint,
|
|
80
|
+
'author' : Principal,
|
|
81
|
+
'projectId' : ProjectId,
|
|
82
|
+
'chatId' : ChatId,
|
|
83
|
+
}
|
|
84
|
+
export type MessageKind = { 'toolTrace' : null } |
|
|
85
|
+
{ 'text' : null } |
|
|
86
|
+
{ 'event' : SystemEvent };
|
|
87
|
+
export interface MessagesPage {
|
|
88
|
+
'messages' : Array<Message>,
|
|
89
|
+
'lastSeq' : bigint,
|
|
90
|
+
}
|
|
91
|
+
export interface Policy { 'agentsReply' : boolean }
|
|
92
|
+
export interface PollNewMessagesArgs {
|
|
93
|
+
'limit' : [] | [bigint],
|
|
94
|
+
'sinceGlobalSeq' : bigint,
|
|
95
|
+
}
|
|
96
|
+
export interface PollResult {
|
|
97
|
+
'nextSinceGlobalSeq' : bigint,
|
|
98
|
+
'headGlobalSeq' : bigint,
|
|
99
|
+
'messages' : Array<Message>,
|
|
100
|
+
}
|
|
101
|
+
export interface PostArgs {
|
|
102
|
+
'kind' : PostKind,
|
|
103
|
+
'text' : string,
|
|
104
|
+
'chatId' : ChatId,
|
|
105
|
+
}
|
|
106
|
+
export type PostKind = { 'toolTrace' : null } |
|
|
107
|
+
{ 'text' : null };
|
|
108
|
+
export interface Project {
|
|
109
|
+
'id' : ProjectId,
|
|
110
|
+
'createdAt' : bigint,
|
|
111
|
+
'createdBy' : Principal,
|
|
112
|
+
'agents' : Array<Principal>,
|
|
113
|
+
'admins' : Array<Principal>,
|
|
114
|
+
'agentsMayInvite' : boolean,
|
|
115
|
+
'defaultPolicy' : Policy,
|
|
116
|
+
}
|
|
117
|
+
export type ProjectId = string;
|
|
118
|
+
export interface PurgeChatArgs { 'chatId' : ChatId }
|
|
119
|
+
export interface RemoveAdminArgs { 'principal' : Principal }
|
|
120
|
+
export interface RemoveMemberArgs { 'principal' : Principal, 'chatId' : ChatId }
|
|
121
|
+
export type Result = { 'ok' : Project } |
|
|
122
|
+
{ 'err' : Error };
|
|
123
|
+
export type Result_1 = { 'ok' : Chat } |
|
|
124
|
+
{ 'err' : Error };
|
|
125
|
+
export type Result_2 = { 'ok' : boolean } |
|
|
126
|
+
{ 'err' : Error };
|
|
127
|
+
export type Result_3 = { 'ok' : Principal } |
|
|
128
|
+
{ 'err' : Error };
|
|
129
|
+
export type Result_4 = { 'ok' : Message } |
|
|
130
|
+
{ 'err' : Error };
|
|
131
|
+
export type Result_5 = { 'ok' : PollResult } |
|
|
132
|
+
{ 'err' : Error };
|
|
133
|
+
export type Result_6 = { 'ok' : Array<Project> } |
|
|
134
|
+
{ 'err' : Error };
|
|
135
|
+
export type Result_7 = { 'ok' : Array<Chat> } |
|
|
136
|
+
{ 'err' : Error };
|
|
137
|
+
export type Result_8 = { 'ok' : MessagesPage } |
|
|
138
|
+
{ 'err' : Error };
|
|
139
|
+
export type Result_9 = { 'ok' : Array<Principal> } |
|
|
140
|
+
{ 'err' : Error };
|
|
141
|
+
export type Role = { 'member' : null } |
|
|
142
|
+
{ 'admin' : null } |
|
|
143
|
+
{ 'agent' : null } |
|
|
144
|
+
{ 'owner' : null };
|
|
145
|
+
export interface SetLoggingEnabledArgs { 'enabled' : boolean }
|
|
146
|
+
export interface SetPolicyArgs { 'chatId' : ChatId, 'policy' : Policy }
|
|
147
|
+
export type SystemEvent = {
|
|
148
|
+
'memberJoined' : { 'principal' : Principal, 'role' : Role }
|
|
149
|
+
} |
|
|
150
|
+
{ 'policyChanged' : Policy } |
|
|
151
|
+
{ 'memberRemoved' : { 'by' : Principal, 'principal' : Principal } } |
|
|
152
|
+
{ 'memberLeft' : { 'principal' : Principal } } |
|
|
153
|
+
{ 'chatCreated' : null } |
|
|
154
|
+
{ 'chatClosed' : null } |
|
|
155
|
+
{
|
|
156
|
+
'memberInvited' : {
|
|
157
|
+
'by' : Principal,
|
|
158
|
+
'principal' : Principal,
|
|
159
|
+
'role' : Role,
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
export interface UpdateProjectArgs {
|
|
163
|
+
'agents' : [] | [Array<Principal>],
|
|
164
|
+
'projectId' : ProjectId,
|
|
165
|
+
'admins' : [] | [Array<Principal>],
|
|
166
|
+
'agentsMayInvite' : [] | [boolean],
|
|
167
|
+
'defaultPolicy' : [] | [Policy],
|
|
168
|
+
}
|
|
169
|
+
export interface _SERVICE {
|
|
170
|
+
'addAdmin' : ActorMethod<[AddAdminArgs], Result_2>,
|
|
171
|
+
'clearLogs' : ActorMethod<[], undefined>,
|
|
172
|
+
'closeChat' : ActorMethod<[CloseChatArgs], Result_1>,
|
|
173
|
+
'createChat' : ActorMethod<[CreateChatArgs], Result_1>,
|
|
174
|
+
'createProject' : ActorMethod<[CreateProjectArgs], Result>,
|
|
175
|
+
'getAdmins' : ActorMethod<[], Result_9>,
|
|
176
|
+
'getChat' : ActorMethod<[GetChatArgs], Result_1>,
|
|
177
|
+
'getLogs' : ActorMethod<[], string>,
|
|
178
|
+
'getMessages' : ActorMethod<[GetMessagesArgs], Result_8>,
|
|
179
|
+
'getMyChats' : ActorMethod<[GetMyChatsArgs], Result_7>,
|
|
180
|
+
'getProject' : ActorMethod<[GetProjectArgs], Result>,
|
|
181
|
+
'inviteMember' : ActorMethod<[InviteMemberArgs], Result_1>,
|
|
182
|
+
'leaveChat' : ActorMethod<[LeaveChatArgs], Result_2>,
|
|
183
|
+
'listProjects' : ActorMethod<[ListProjectsArgs], Result_6>,
|
|
184
|
+
'markRead' : ActorMethod<[MarkReadArgs], Result_2>,
|
|
185
|
+
'pollNewMessages' : ActorMethod<[PollNewMessagesArgs], Result_5>,
|
|
186
|
+
'post' : ActorMethod<[PostArgs], Result_4>,
|
|
187
|
+
'purgeChat' : ActorMethod<[PurgeChatArgs], Result_2>,
|
|
188
|
+
'registerAsAdmin' : ActorMethod<[], Result_3>,
|
|
189
|
+
'removeAdmin' : ActorMethod<[RemoveAdminArgs], Result_2>,
|
|
190
|
+
'removeMember' : ActorMethod<[RemoveMemberArgs], Result_1>,
|
|
191
|
+
'setLoggingEnabled' : ActorMethod<[SetLoggingEnabledArgs], Result_2>,
|
|
192
|
+
'setPolicy' : ActorMethod<[SetPolicyArgs], Result_1>,
|
|
193
|
+
'updateProject' : ActorMethod<[UpdateProjectArgs], Result>,
|
|
194
|
+
'whoAmI' : ActorMethod<[], Principal>,
|
|
195
|
+
}
|
|
196
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
197
|
+
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|