@jsm-mit/chat-motoko-package 0.3.0 → 0.5.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 CHANGED
@@ -10,13 +10,16 @@ import { RoomsActor, ChatsActor, MessagesActor, ChatPoller } from "@jsm-mit/chat
10
10
  // A canister admin creates the project with its accounts canister — the one asked
11
11
  // `isUser(principal)` before a non-admin opens a chat (Sultana: sultana-core-motoko).
12
12
  // A project admin defines a room: who receives the customer's messages.
13
+ // One room per thing the app wants a conversation about (Sultana: per salon), closed to
14
+ // the people who may open it — an empty allowedCustomers means everybody with an account.
13
15
  await new RoomsActor(canisterId, adminIdentity).createRoomAsyncUnsafe({
14
- projectId: "sultana-stage", id: "assistant", name: "Asystent",
16
+ projectId: "sultana-stage", id: `salon-${salonId}`, name: "Asystent salonu",
15
17
  recipients: [{ principal: villagePrincipal, role: "agent", displayName: "Asystentka Ola" }],
18
+ allowedCustomers: [ownerPrincipal],
16
19
  });
17
20
 
18
- // A customer opens the room the same call returns the same chat next time.
19
- const chat = await new ChatsActor(canisterId, identity).openChatAsyncUnsafe({ projectId: "sultana-stage", roomId: "assistant", customerName: "Michał" });
21
+ // The customer opens the room; the same call returns the same chat next time.
22
+ const chat = await new ChatsActor(canisterId, identity).openChatAsyncUnsafe({ projectId: "sultana-stage", roomId: `salon-${salonId}`, customerName: "Michał" });
20
23
 
21
24
  const messages = new MessagesActor(canisterId, identity);
22
25
  await messages.postAsyncUnsafe({ chatId: chat.id, text: "dodaj usługę strzyżenie" });
@@ -1,5 +1,6 @@
1
1
  type UpdateRoomArgs =
2
2
  record {
3
+ allowedCustomers: opt vec principal;
3
4
  name: opt text;
4
5
  projectId: ProjectId;
5
6
  recipients: opt vec Recipient;
@@ -17,6 +18,7 @@ type SetLoggingEnabledArgs = record {enabled: bool;};
17
18
  type RoomId = text;
18
19
  type Room =
19
20
  record {
21
+ allowedCustomers: vec principal;
20
22
  createdAt: int;
21
23
  createdBy: principal;
22
24
  id: RoomId;
@@ -196,6 +198,7 @@ type MarkReadArgs =
196
198
  type ListRoomsArgs =
197
199
  record {
198
200
  limit: opt nat;
201
+ offset: opt nat;
199
202
  projectId: ProjectId;
200
203
  };
201
204
  type ListProjectsArgs = record {limit: opt nat;};
@@ -241,6 +244,7 @@ type Error =
241
244
  };
242
245
  type CreateRoomArgs =
243
246
  record {
247
+ allowedCustomers: vec principal;
244
248
  id: RoomId;
245
249
  name: text;
246
250
  projectId: ProjectId;
@@ -34,6 +34,7 @@ export interface CreateRoomArgs {
34
34
  'name' : string,
35
35
  'recipients' : Array<Recipient>,
36
36
  'projectId' : ProjectId,
37
+ 'allowedCustomers' : Array<Principal>,
37
38
  }
38
39
  export interface Error { 'details' : ErrorDetails, 'logsJson' : string }
39
40
  export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
@@ -63,6 +64,7 @@ export interface ListProjectChatsArgs {
63
64
  }
64
65
  export interface ListProjectsArgs { 'limit' : [] | [bigint] }
65
66
  export interface ListRoomsArgs {
67
+ 'offset' : [] | [bigint],
66
68
  'limit' : [] | [bigint],
67
69
  'projectId' : ProjectId,
68
70
  }
@@ -171,6 +173,7 @@ export interface Room {
171
173
  'createdBy' : Principal,
172
174
  'recipients' : Array<Recipient>,
173
175
  'projectId' : ProjectId,
176
+ 'allowedCustomers' : Array<Principal>,
174
177
  }
175
178
  export type RoomId = string;
176
179
  export interface SetLoggingEnabledArgs { 'enabled' : boolean }
@@ -186,6 +189,7 @@ export interface UpdateRoomArgs {
186
189
  'recipients' : [] | [Array<Recipient>],
187
190
  'projectId' : ProjectId,
188
191
  'roomId' : RoomId,
192
+ 'allowedCustomers' : [] | [Array<Principal>],
189
193
  }
190
194
  export interface _SERVICE {
191
195
  'addAdmin' : ActorMethod<[AddAdminArgs], Result_3>,
@@ -40,6 +40,7 @@ export const idlFactory = ({ IDL }) => {
40
40
  'name' : IDL.Text,
41
41
  'recipients' : IDL.Vec(Recipient),
42
42
  'projectId' : ProjectId,
43
+ 'allowedCustomers' : IDL.Vec(IDL.Principal),
43
44
  });
44
45
  const Room = IDL.Record({
45
46
  'id' : RoomId,
@@ -48,6 +49,7 @@ export const idlFactory = ({ IDL }) => {
48
49
  'createdBy' : IDL.Principal,
49
50
  'recipients' : IDL.Vec(Recipient),
50
51
  'projectId' : ProjectId,
52
+ 'allowedCustomers' : IDL.Vec(IDL.Principal),
51
53
  });
52
54
  const Result = IDL.Variant({ 'ok' : Room, 'err' : Error });
53
55
  const Result_13 = IDL.Variant({
@@ -140,6 +142,7 @@ export const idlFactory = ({ IDL }) => {
140
142
  const ListProjectsArgs = IDL.Record({ 'limit' : IDL.Opt(IDL.Nat) });
141
143
  const Result_9 = IDL.Variant({ 'ok' : IDL.Vec(Project), 'err' : Error });
142
144
  const ListRoomsArgs = IDL.Record({
145
+ 'offset' : IDL.Opt(IDL.Nat),
143
146
  'limit' : IDL.Opt(IDL.Nat),
144
147
  'projectId' : ProjectId,
145
148
  });
@@ -182,6 +185,7 @@ export const idlFactory = ({ IDL }) => {
182
185
  'recipients' : IDL.Opt(IDL.Vec(Recipient)),
183
186
  'projectId' : ProjectId,
184
187
  'roomId' : RoomId,
188
+ 'allowedCustomers' : IDL.Opt(IDL.Vec(IDL.Principal)),
185
189
  });
186
190
  return IDL.Service({
187
191
  'addAdmin' : IDL.Func([AddAdminArgs], [Result_3], []),
@@ -8,9 +8,10 @@ export declare class ChatsActor extends ActorBase {
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
10
  * (room, customer, recipients) — 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}.
11
+ * chat needs the room to allow the caller (its allowed-customer list, when it has one)
12
+ * and the project's accounts canister to confirm the caller (`isUser`); admins of the
13
+ * canister and of the project skip the accounts call but not the allowed list.
14
+ * @throws Error with message `CanisterError` when the canister returns a business error (`NotAuthorized` when the room's allowed-customer list does not name the caller or the accounts canister does not know them, `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
15
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
15
16
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution (anonymous, or today's chat quota used up).
16
17
  */
@@ -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;;;;;;;;;OASG;IACU,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;IAWzE;;;;;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;IAW/E;;;;;;OAMG;IACU,2BAA2B,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAWlG;;;;;;;OAOG;IACU,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGtE"}
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;;;;;;;;;;OAUG;IACU,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;IAWzE;;;;;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;IAW/E;;;;;;OAMG;IACU,2BAA2B,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAWlG;;;;;;;OAOG;IACU,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGtE"}
@@ -10,9 +10,10 @@ export class ChatsActor extends ActorBase {
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
12
  * (room, customer, recipients) — 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}.
13
+ * chat needs the room to allow the caller (its allowed-customer list, when it has one)
14
+ * and the project's accounts canister to confirm the caller (`isUser`); admins of the
15
+ * canister and of the project skip the accounts call but not the allowed list.
16
+ * @throws Error with message `CanisterError` when the canister returns a business error (`NotAuthorized` when the room's allowed-customer list does not name the caller or the accounts canister does not know them, `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}.
16
17
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
17
18
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution (anonymous, or today's chat quota used up).
18
19
  */
@@ -7,7 +7,7 @@ export declare class RoomsActor extends ActorBase {
7
7
  constructor(canisterId: string, identity?: Identity);
8
8
  /**
9
9
  * Creates a room. Project admins and canister admins.
10
- * @param input - id (max 50 chars, unique in the project, no '/' or '|'), name (max 100), 1–10 recipients (no anonymous, no duplicates, display names present).
10
+ * @param input - id (max 50 chars, unique in the project, no '/' or '|'), name (max 100), 1–10 recipients (no anonymous, no duplicates, display names present), and optionally the allowed customers (max 50; empty = every account of the project may open a chat here).
11
11
  * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound` for the project, `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.
@@ -29,7 +29,8 @@ export declare class RoomsActor extends ActorBase {
29
29
  */
30
30
  getRoomAsyncUnsafe(input: RoomRefInput): Promise<RoomView>;
31
31
  /**
32
- * A project's rooms in creation order. Project admins and canister admins.
32
+ * A project's rooms in creation order, one page at a time (max 100). Project admins
33
+ * and canister admins.
33
34
  * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound`). Examine "cause" for {errorKey, errorMessage, logs}.
34
35
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
35
36
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
@@ -1 +1 @@
1
- {"version":3,"file":"rooms-actor.d.ts","sourceRoot":"","sources":["../../src/actors/rooms-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,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGjH;iEACiE;AACjE,qBAAa,UAAW,SAAQ,SAAS;gBAEzB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;OAMG;IACU,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAY7E;;;;;OAKG;IACU,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAY7E;;;;;;OAMG;IACU,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKvE;;;;;OAKG;IACU,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAIhF"}
1
+ {"version":3,"file":"rooms-actor.d.ts","sourceRoot":"","sources":["../../src/actors/rooms-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,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGjH;iEACiE;AACjE,qBAAa,UAAW,SAAQ,SAAS;gBAEzB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;OAMG;IACU,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAa7E;;;;;OAKG;IACU,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAa7E;;;;;;OAMG;IACU,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKvE;;;;;;OAMG;IACU,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAIhF"}
@@ -1,4 +1,5 @@
1
1
  import {} from "@icp-sdk/core/agent";
2
+ import { Principal } from "@icp-sdk/core/principal";
2
3
  import { ActorBase } from "../actor-base.js";
3
4
  import { mapRoomView, toCandidRecipient, toOpt, toOptBigInt } from "../mappers.js";
4
5
  /** 1:1 wrapper for the canister's RoomsController — a room is the template a chat is
@@ -9,7 +10,7 @@ export class RoomsActor extends ActorBase {
9
10
  }
10
11
  /**
11
12
  * Creates a room. Project admins and canister admins.
12
- * @param input - id (max 50 chars, unique in the project, no '/' or '|'), name (max 100), 1–10 recipients (no anonymous, no duplicates, display names present).
13
+ * @param input - id (max 50 chars, unique in the project, no '/' or '|'), name (max 100), 1–10 recipients (no anonymous, no duplicates, display names present), and optionally the allowed customers (max 50; empty = every account of the project may open a chat here).
13
14
  * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound` for the project, `AlreadyExists`, `InvalidData`). Examine "cause" for {errorKey, errorMessage, logs}.
14
15
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
15
16
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
@@ -20,6 +21,7 @@ export class RoomsActor extends ActorBase {
20
21
  id: input.id,
21
22
  name: input.name,
22
23
  recipients: input.recipients.map(toCandidRecipient),
24
+ allowedCustomers: (input.allowedCustomers ?? []).map((principal) => Principal.fromText(principal)),
23
25
  }));
24
26
  return mapRoomView(room);
25
27
  }
@@ -35,6 +37,7 @@ export class RoomsActor extends ActorBase {
35
37
  roomId: input.roomId,
36
38
  name: toOpt(input.name),
37
39
  recipients: toOpt(input.recipients?.map(toCandidRecipient)),
40
+ allowedCustomers: toOpt(input.allowedCustomers?.map((principal) => Principal.fromText(principal))),
38
41
  }));
39
42
  return mapRoomView(room);
40
43
  }
@@ -50,13 +53,14 @@ export class RoomsActor extends ActorBase {
50
53
  return mapRoomView(room);
51
54
  }
52
55
  /**
53
- * A project's rooms in creation order. Project admins and canister admins.
56
+ * A project's rooms in creation order, one page at a time (max 100). Project admins
57
+ * and canister admins.
54
58
  * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound`). Examine "cause" for {errorKey, errorMessage, logs}.
55
59
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
56
60
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
57
61
  */
58
62
  async listRoomsAsyncUnsafe(input) {
59
- const rooms = await this.executeFunctionAsyncUnsafe(() => this.actor.listRooms({ projectId: input.projectId, limit: toOptBigInt(input.limit) }));
63
+ const rooms = await this.executeFunctionAsyncUnsafe(() => this.actor.listRooms({ projectId: input.projectId, offset: toOptBigInt(input.offset), limit: toOptBigInt(input.limit) }));
60
64
  return rooms.map(mapRoomView);
61
65
  }
62
66
  }
@@ -29,6 +29,8 @@ export interface RoomView {
29
29
  createdBy: string;
30
30
  createdAt: bigint;
31
31
  recipients: RecipientView[];
32
+ /** Who may open a chat here. Empty = everybody with an account in the project. */
33
+ allowedCustomers: string[];
32
34
  }
33
35
  export interface ParticipantView {
34
36
  principal: string;
@@ -113,6 +115,8 @@ export interface CreateRoomInput {
113
115
  id: string;
114
116
  name: string;
115
117
  recipients: RecipientView[];
118
+ /** Who may open a chat here; omitted or empty = everybody with an account (max 50). */
119
+ allowedCustomers?: string[];
116
120
  }
117
121
  export interface UpdateRoomInput {
118
122
  projectId: string;
@@ -120,6 +124,8 @@ export interface UpdateRoomInput {
120
124
  name?: string;
121
125
  /** Replaces the whole list; chats already opened keep their recipients. */
122
126
  recipients?: RecipientView[];
127
+ /** Replaces the whole list; chats already opened stay open. Empty = open to everybody. */
128
+ allowedCustomers?: string[];
123
129
  }
124
130
  export interface RoomRefInput {
125
131
  projectId: string;
@@ -127,6 +133,9 @@ export interface RoomRefInput {
127
133
  }
128
134
  export interface ListRoomsInput {
129
135
  projectId: string;
136
+ /** Skip this many rooms of the project's creation order; defaults to 0. */
137
+ offset?: number;
138
+ /** Max 100 per page. */
130
139
  limit?: number;
131
140
  }
132
141
  export interface OpenChatInput {
@@ -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;AACvD,iFAAiF;AACjF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,wFAAwF;IACxF,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,iBAAiB,CAAC;I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D;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,eAAe,CAU5E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,CAWhD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,eAAe,CAWxE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CAEvE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAiB5D;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
@@ -51,6 +51,7 @@ export function mapRoomView(room) {
51
51
  createdBy: room.createdBy.toText(),
52
52
  createdAt: room.createdAt,
53
53
  recipients: room.recipients.map(mapRecipientView),
54
+ allowedCustomers: room.allowedCustomers.map((principal) => principal.toText()),
54
55
  };
55
56
  }
56
57
  export function mapParticipantView(participant) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsm-mit/chat-motoko-package",
3
- "version": "0.3.0",
3
+ "version": "0.5.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": "caf02c560d1c988bb79f26d6221a173a0ba8b7c2"
61
+ "commit": "1a505b79dfe4e90997143abe4d17607e9a5083f1"
62
62
  }
63
63
  }