@jsm-mit/chat-motoko-package 0.6.0 → 0.8.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
@@ -29,6 +29,16 @@ await messages.postAsyncUnsafe({ chatId: chat.id, text: "dodaj usługę strzyże
29
29
  // own post clears it), `presence[].lastReadSeq` for "read up to here".
30
30
  const page = await messages.getMessagesAsyncUnsafe({ chatId: chat.id, sinceSeq: 0 });
31
31
 
32
+ // A host that sends receipts and typing as a courtesy skips the proof: the call is taken
33
+ // in by the IC, the certified reply is never verified (that check is the expensive part
34
+ // on a small CPU), and a refusal goes unnoticed.
35
+ await messages.markReadUnverifiedAsyncUnsafe(chat.id, page.lastSeq);
36
+ await messages.setTypingUnverifiedAsyncUnsafe(chat.id);
37
+
38
+ // Every actor takes `{ blsVerify }` as a third argument: a faster check of the certified
39
+ // replies than agent-js's pure-JS one, for a host that makes many update calls.
40
+ const fast = new MessagesActor(canisterId, identity, { blsVerify: myVerifier });
41
+
32
42
  // An agent host: every new message in every chat this identity is a recipient of, with
33
43
  // the room and the customer on each message — route by (projectId, roomId).
34
44
  const poller = new ChatPoller(messages, 1000, { onError: console.error });
@@ -42,14 +52,39 @@ One class per canister controller (`AdminActor`, `ProjectsActor`, `RoomsActor`,
42
52
  throws). Views translate `Principal` → text, `opt` → optional, variants → string
43
53
  unions; sequence numbers are plain `number`s, timestamps `bigint` nanoseconds.
44
54
 
55
+ Deleting: `RoomsActor.deleteRoomAsyncUnsafe` (project admins) takes a room with every chat
56
+ and message in it; `ProjectsActor.deleteProjectAsyncUnsafe` (canister admins only) takes a
57
+ project with all its rooms. The canister deletes in bounded calls (500 chats or 50 000
58
+ messages each), and these methods repeat the call until it is done — pass `onStep` to see
59
+ the progress, or call `deleteRoomStepAsyncUnsafe` / `deleteProjectStepAsyncUnsafe` for one
60
+ call at a time.
61
+
45
62
  `src/` is browser-safe — the same package serves the agent host and a web panel.
46
63
 
47
64
  Scripts: `build`, `typecheck`, `sync-declarations`, `test-suite`,
48
- `test-access-restrictions`, `user1` / `user2` (an interactive admin/chat console, one
65
+ `test-access-restrictions`, `test-smoke`, `user1` / `user2` (an interactive admin/chat console, one
49
66
  person per terminal: the key comes from `USER1_PEM` / `USER2_PEM` in `.env`; another
50
- canister: `npm run user2 -- <canister-id>`), `redeploy` (build `../chat-motoko` and install it
51
- on `CANISTER_ID` without tests; `npm run redeploy -- reinstall` or `-- upgrade`; after a
52
- reinstall claim the admin role yourself in the sandbox). See `CLAUDE.md` for who runs what.
67
+ canister: `npm run user2 -- <canister-id>`), `redeploy`. See `CLAUDE.md` for who runs what.
68
+
69
+ ## Integration tests and redeploys
70
+
71
+ The tests always run on the crafting-table slot `short-living`, the short-lived test canister the
72
+ wrapper packages share. `npm run test-suite` (or `test-access-restrictions`, or `test-smoke` —
73
+ the quick check publishing runs) reinstalls the
74
+ current `../chat-motoko` build into `short-living` with a 3-minute lease
75
+ (`npm run craft:deploy -- short-living --lease 3` there), then runs the suite with `CANISTER_ID` set to `short-living`'s id from
76
+ `~/motoko-crafting-table/canister_ids.json`. No prompt. The crafting table refuses while
77
+ another deploy's lease on `short-living` is active; `npm run test-suite -- --force` takes it anyway.
78
+ No `.env`: every identity is generated per run; setup claims the admin role on the fresh canister.
79
+
80
+ ```
81
+ npm run redeploy -- [slot] [reinstall|upgrade] [--force]
82
+ ```
83
+
84
+ deploys the current `../chat-motoko` build for sandbox play, without tests and without
85
+ `.env`: `craft:deploy` (reinstall) or `craft:upgrade` in `../chat-motoko`. The slot defaults
86
+ to `backend6`; the mode to `upgrade` where the slot allows it and to `reinstall` on `short-living`.
87
+ After a reinstall claim the admin role yourself in the sandbox — the script prints the command.
53
88
 
54
89
  ## Publishing
55
90
 
@@ -60,10 +95,16 @@ npm run publish-public
60
95
  ```
61
96
 
62
97
  `scripts/publish-public.sh` refuses unless this repo is on `master` equal to
63
- `origin/master` with nothing uncommitted but the bump, and the version is not on the
64
- registry yet. It then runs `scripts/stamp-canister-commit.sh`, which refuses unless
65
- `../chat-motoko` is on `master`, clean and equal to its `origin/master`, rebuilds the
66
- canister, regenerates the declarations and refuses if that changes what is committed
98
+ `origin/master` with nothing uncommitted but the bump, the version is not on the registry
99
+ yet, and `../chat-motoko` is on `master`, clean and equal to its `origin/master`. It then
100
+ reinstalls that master into `short-living` (`craft:deploy -- short-living --lease 2`), reads the live
101
+ interface (`dfx canister metadata <short-living> candid:service --ic --identity anonymous`) and
102
+ refuses if it differs from the committed `declarations/chat-motoko-backend/chat-motoko-backend.did`
103
+ (trailing whitespace and newlines aside) — sync the declarations, commit, push, publish
104
+ again. On the same deploy it runs the smoke test (`tests/test-smoke.ts`: setup, one write
105
+ and one read per domain) and refuses if it fails. Next `scripts/stamp-canister-commit.sh` repeats the canister-repo checks, rebuilds
106
+ the canister, regenerates the declarations and refuses if that changes what is committed
67
107
  here. Only then it writes `chatMotoko.{repo, repoUrl, commit}` into `package.json` — the
68
108
  canister commit this version was generated from — publishes, and commits and pushes
69
- `Version bump to <version>`. A failed publish takes the stamp back out.
109
+ `Version bump to <version>` (when there is nothing to commit, it stops there without an
110
+ error). A failed publish takes the stamp back out.
@@ -73,6 +73,11 @@ type Result_2 =
73
73
  err: Error;
74
74
  ok: bool;
75
75
  };
76
+ type Result_14 =
77
+ variant {
78
+ err: Error;
79
+ ok: DeletionProgress;
80
+ };
76
81
  type Result_13 =
77
82
  variant {
78
83
  err: Error;
@@ -250,6 +255,19 @@ type Error =
250
255
  details: ErrorDetails;
251
256
  logsJson: text;
252
257
  };
258
+ type DeletionProgress =
259
+ record {
260
+ chatsPurged: nat;
261
+ finished: bool;
262
+ messagesPurged: nat;
263
+ roomsDeleted: nat;
264
+ };
265
+ type DeleteRoomArgs =
266
+ record {
267
+ projectId: ProjectId;
268
+ roomId: RoomId;
269
+ };
270
+ type DeleteProjectArgs = record {projectId: ProjectId;};
253
271
  type CreateRoomArgs =
254
272
  record {
255
273
  allowedCustomers: vec principal;
@@ -293,6 +311,12 @@ service : {
293
311
  clearLogs: () -> ();
294
312
  createProject: (args: CreateProjectArgs) -> (Result_1);
295
313
  createRoom: (args: CreateRoomArgs) -> (Result);
314
+ /// Canister admins. Takes every room, chat and message of the project with it; a big
315
+ /// project needs the call repeated until `finished`.
316
+ deleteProject: (args: DeleteProjectArgs) -> (Result_14);
317
+ /// Project admins. Takes every chat and message of the room with it; a big room needs the
318
+ /// call repeated until `finished`.
319
+ deleteRoom: (args: DeleteRoomArgs) -> (Result_14);
296
320
  getAdmins: () -> (Result_13) query;
297
321
  getChat: (args: GetChatArgs) -> (Result_7) query;
298
322
  getLogs: () -> (text) query;
@@ -36,6 +36,14 @@ export interface CreateRoomArgs {
36
36
  'projectId' : ProjectId,
37
37
  'allowedCustomers' : Array<Principal>,
38
38
  }
39
+ export interface DeleteProjectArgs { 'projectId' : ProjectId }
40
+ export interface DeleteRoomArgs { 'projectId' : ProjectId, 'roomId' : RoomId }
41
+ export interface DeletionProgress {
42
+ 'chatsPurged' : bigint,
43
+ 'messagesPurged' : bigint,
44
+ 'finished' : boolean,
45
+ 'roomsDeleted' : bigint,
46
+ }
39
47
  export interface Error { 'details' : ErrorDetails, 'logsJson' : string }
40
48
  export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
41
49
  { 'RemoteCanisterError' : string } |
@@ -153,6 +161,8 @@ export type Result_12 = { 'ok' : MessagesPage } |
153
161
  { 'err' : Error };
154
162
  export type Result_13 = { 'ok' : Array<Principal> } |
155
163
  { 'err' : Error };
164
+ export type Result_14 = { 'ok' : DeletionProgress } |
165
+ { 'err' : Error };
156
166
  export type Result_2 = { 'ok' : boolean } |
157
167
  { 'err' : Error };
158
168
  export type Result_3 = { 'ok' : QuotaLimits } |
@@ -203,6 +213,16 @@ export interface _SERVICE {
203
213
  'clearLogs' : ActorMethod<[], undefined>,
204
214
  'createProject' : ActorMethod<[CreateProjectArgs], Result_1>,
205
215
  'createRoom' : ActorMethod<[CreateRoomArgs], Result>,
216
+ /**
217
+ * / Canister admins. Takes every room, chat and message of the project with it; a big
218
+ * / project needs the call repeated until `finished`.
219
+ */
220
+ 'deleteProject' : ActorMethod<[DeleteProjectArgs], Result_14>,
221
+ /**
222
+ * / Project admins. Takes every chat and message of the room with it; a big room needs the
223
+ * / call repeated until `finished`.
224
+ */
225
+ 'deleteRoom' : ActorMethod<[DeleteRoomArgs], Result_14>,
206
226
  'getAdmins' : ActorMethod<[], Result_13>,
207
227
  'getChat' : ActorMethod<[GetChatArgs], Result_7>,
208
228
  'getLogs' : ActorMethod<[], string>,
@@ -52,6 +52,18 @@ export const idlFactory = ({ IDL }) => {
52
52
  'allowedCustomers' : IDL.Vec(IDL.Principal),
53
53
  });
54
54
  const Result = IDL.Variant({ 'ok' : Room, 'err' : Error });
55
+ const DeleteProjectArgs = IDL.Record({ 'projectId' : ProjectId });
56
+ const DeletionProgress = IDL.Record({
57
+ 'chatsPurged' : IDL.Nat,
58
+ 'messagesPurged' : IDL.Nat,
59
+ 'finished' : IDL.Bool,
60
+ 'roomsDeleted' : IDL.Nat,
61
+ });
62
+ const Result_14 = IDL.Variant({ 'ok' : DeletionProgress, 'err' : Error });
63
+ const DeleteRoomArgs = IDL.Record({
64
+ 'projectId' : ProjectId,
65
+ 'roomId' : RoomId,
66
+ });
55
67
  const Result_13 = IDL.Variant({
56
68
  'ok' : IDL.Vec(IDL.Principal),
57
69
  'err' : Error,
@@ -199,6 +211,8 @@ export const idlFactory = ({ IDL }) => {
199
211
  'clearLogs' : IDL.Func([], [], []),
200
212
  'createProject' : IDL.Func([CreateProjectArgs], [Result_1], []),
201
213
  'createRoom' : IDL.Func([CreateRoomArgs], [Result], []),
214
+ 'deleteProject' : IDL.Func([DeleteProjectArgs], [Result_14], []),
215
+ 'deleteRoom' : IDL.Func([DeleteRoomArgs], [Result_14], []),
202
216
  'getAdmins' : IDL.Func([], [Result_13], ['query']),
203
217
  'getChat' : IDL.Func([GetChatArgs], [Result_7], ['query']),
204
218
  'getLogs' : IDL.Func([], [IDL.Text], ['query']),
@@ -13,12 +13,23 @@ export interface LogEntry {
13
13
  * - An `inspect()`-stage rejection is thrown as `Error("CallRefusedAtInspectionStage")`.
14
14
  * - Any other transport failure is thrown as `Error("CriticalCanisterError")`.
15
15
  */
16
+ /** How a certified reply's BLS signature is checked: (publicKey, signature, message). */
17
+ export type BlsVerifyFunction = (pk: Uint8Array, sig: Uint8Array, msg: Uint8Array) => Promise<boolean> | boolean;
18
+ export interface ActorOptions {
19
+ /**
20
+ * Replaces agent-js's own BLS check (pure JavaScript, tens to hundreds of ms per update
21
+ * reply). A host that makes many update calls may hand in a faster one; it carries the
22
+ * whole proof that a reply came from the IC, so it must be exactly as strict.
23
+ */
24
+ blsVerify?: BlsVerifyFunction;
25
+ }
16
26
  export declare class ActorBase {
17
27
  protected canisterId: string;
18
28
  protected identity?: Identity | undefined;
29
+ protected options: ActorOptions;
19
30
  protected actor: ActorSubclass<_SERVICE>;
20
31
  protected agent: HttpAgent;
21
- constructor(canisterId: string, identity?: Identity | undefined);
32
+ constructor(canisterId: string, identity?: Identity | undefined, options?: ActorOptions);
22
33
  private initAgentAndActor;
23
34
  /**
24
35
  * Rebuilds the HttpAgent and the actor from scratch. Long-lived consumers (e.g.
@@ -36,6 +47,17 @@ export declare class ActorBase {
36
47
  * getLogs, clearLogs) — only the transport-level error translation applies.
37
48
  */
38
49
  protected executeRawAsyncUnsafe<T>(fnAsync: () => Promise<T>): Promise<T>;
50
+ /**
51
+ * Sends an update call and waits until the IC has taken it in — executed it, as a rule —
52
+ * but never reads or verifies the certified reply. For best-effort signals only (read
53
+ * receipts, typing): the caller learns neither the canister's answer nor a business
54
+ * error, and an unverified "done" must never be shown to anyone as a fact.
55
+ *
56
+ * Why it exists: verifying a reply's BLS certificate is pure-JS curve arithmetic —
57
+ * some 30 ms on a desktop core, some 300 ms on a small shared vCPU — and a host that
58
+ * sends two signals per answer spends most of its CPU on proofs nobody reads.
59
+ */
60
+ protected sendUnverifiedAsyncUnsafe(methodName: keyof _SERVICE & string, args: unknown[]): Promise<void>;
39
61
  protected handleResultErrors(errorFromCanister: ErrorFromCanister): {
40
62
  errorKey: string;
41
63
  errorMessage: any;
@@ -1 +1 @@
1
- {"version":3,"file":"actor-base.d.ts","sourceRoot":"","sources":["../src/actor-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAS,MAAM,qBAAqB,CAAC;AAE1F,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,gEAAgE,CAAC;AAG3H,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,qBAAa,SAAS;IAIN,SAAS,CAAC,UAAU,EAAE,MAAM;IAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,QAAQ;IAHvE,SAAS,CAAC,KAAK,EAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC1C,SAAS,CAAC,KAAK,EAAG,SAAS,CAAC;gBAEN,UAAU,EAAE,MAAM,EAAY,QAAQ,CAAC,EAAE,QAAQ,YAAA;IAIvE,OAAO,CAAC,iBAAiB;IAWzB;;;;OAIG;IACI,iBAAiB,IAAI,IAAI;cAIhB,0BAA0B,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;QAAE,EAAE,EAAE,CAAC,CAAA;KAAE,GAAG;QAAE,GAAG,EAAE,iBAAiB,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAmCzH;;;OAGG;cACa,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAW/E,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,iBAAiB;;;;;IAkBjE,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,GAAG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AAE,iBAAiB,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAmCzH;;;OAGG;cACa,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAW/E;;;;;;;;;OASG;cACa,yBAAyB,CAAC,UAAU,EAAE,MAAM,QAAQ,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB9G,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,iBAAiB;;;;;IAkBjE,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAWpD,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,QAAQ,EAAE,GAAG,IAAI;CAwBhE"}
@@ -1,23 +1,17 @@
1
1
  import { HttpAgent, Actor } from "@icp-sdk/core/agent";
2
+ import { IDL } from "@icp-sdk/core/candid";
2
3
  import { idlFactory } from "../declarations/chat-motoko-backend/index.js";
3
4
  import { BetterJSON } from "@jsm-mit/utils-package";
4
- /**
5
- * Base class for every per-domain actor wrapper (ChatsActor, MessagesActor, …). Builds the
6
- * HttpAgent + raw candid actor and owns the single choke point that turns the canister's
7
- * Framework.Result<T> into idiomatic TS:
8
- * - `{ok: T}` resolves with `T` directly.
9
- * - `{err: ...}` is thrown as `Error("CanisterError", { cause: {errorKey, errorMessage, logs} })`.
10
- * - An `inspect()`-stage rejection is thrown as `Error("CallRefusedAtInspectionStage")`.
11
- * - Any other transport failure is thrown as `Error("CriticalCanisterError")`.
12
- */
13
5
  export class ActorBase {
14
6
  canisterId;
15
7
  identity;
8
+ options;
16
9
  actor;
17
10
  agent;
18
- constructor(canisterId, identity) {
11
+ constructor(canisterId, identity, options = {}) {
19
12
  this.canisterId = canisterId;
20
13
  this.identity = identity;
14
+ this.options = options;
21
15
  this.initAgentAndActor();
22
16
  }
23
17
  initAgentAndActor() {
@@ -28,6 +22,7 @@ export class ActorBase {
28
22
  this.actor = Actor.createActor(idlFactory, {
29
23
  agent: this.agent,
30
24
  canisterId: this.canisterId,
25
+ blsVerify: this.options.blsVerify,
31
26
  });
32
27
  }
33
28
  /**
@@ -84,6 +79,39 @@ export class ActorBase {
84
79
  throw new Error("CriticalCanisterError", { cause: { logs: null, rawError: err } });
85
80
  }
86
81
  }
82
+ /**
83
+ * Sends an update call and waits until the IC has taken it in — executed it, as a rule —
84
+ * but never reads or verifies the certified reply. For best-effort signals only (read
85
+ * receipts, typing): the caller learns neither the canister's answer nor a business
86
+ * error, and an unverified "done" must never be shown to anyone as a fact.
87
+ *
88
+ * Why it exists: verifying a reply's BLS certificate is pure-JS curve arithmetic —
89
+ * some 30 ms on a desktop core, some 300 ms on a small shared vCPU — and a host that
90
+ * sends two signals per answer spends most of its CPU on proofs nobody reads.
91
+ */
92
+ async sendUnverifiedAsyncUnsafe(methodName, args) {
93
+ try {
94
+ const method = idlFactory({ IDL })._fields.find(([name]) => name === methodName);
95
+ if (!method)
96
+ throw new Error(`Unknown canister method "${methodName}"`);
97
+ const { response } = await this.agent.call(this.canisterId, {
98
+ methodName,
99
+ arg: IDL.encode(method[1].argTypes, args),
100
+ });
101
+ // A replica that refuses a call without running it (inspect, a stopped canister)
102
+ // says so in the body of an otherwise fine HTTP answer.
103
+ const body = response.body;
104
+ if (body && typeof body === "object" && "reject_message" in body) {
105
+ throw new Error(String(body.reject_message));
106
+ }
107
+ }
108
+ catch (err) {
109
+ if (this.isInspectionRejection(err)) {
110
+ throw new Error("CallRefusedAtInspectionStage", { cause: err });
111
+ }
112
+ throw new Error("CriticalCanisterError", { cause: { logs: null, rawError: err } });
113
+ }
114
+ }
87
115
  handleResultErrors(errorFromCanister) {
88
116
  const logs = BetterJSON.parse(errorFromCanister.logsJson, false);
89
117
  const error = errorFromCanister.details;
@@ -1,9 +1,9 @@
1
1
  import { type Identity } from "@icp-sdk/core/agent";
2
- import { ActorBase } from "../actor-base.js";
2
+ import { ActorBase, type ActorOptions } from "../actor-base.js";
3
3
  import type { QuotaLimitsView } from "../interfaces.js";
4
4
  /** 1:1 wrapper for the canister's AdminController plus the three diagnostics. */
5
5
  export declare class AdminActor extends ActorBase {
6
- constructor(canisterId: string, identity?: Identity);
6
+ constructor(canisterId: string, identity?: Identity, options?: ActorOptions);
7
7
  /**
8
8
  * Bootstrap: succeeds only while the canister has NO admin at all — the first caller
9
9
  * claims the admin role. Once any admin exists this always refuses.
@@ -1 +1 @@
1
- {"version":3,"file":"admin-actor.d.ts","sourceRoot":"","sources":["../../src/actors/admin-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,MAAM,kBAAkB,CAAC;AAGxD,iFAAiF;AACjF,qBAAa,UAAW,SAAQ,SAAS;gBAEzB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;;OAOG;IACU,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC;IAK1D;;;;;OAKG;IACU,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrE;;;;;OAKG;IACU,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxE;;;;;OAKG;IACU,oBAAoB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKtD;;;;;OAKG;IACH;;;;;OAKG;IACU,yBAAyB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAKzF;;;;;OAKG;IACU,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC;IAKrD,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7E;;;;OAIG;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;;;;OAIG;IACU,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;CAGrD"}
@@ -4,8 +4,8 @@ import { ActorBase } from "../actor-base.js";
4
4
  import { mapQuotaLimitsView, toCandidQuotaLimits } from "../mappers.js";
5
5
  /** 1:1 wrapper for the canister's AdminController plus the three diagnostics. */
6
6
  export class AdminActor extends ActorBase {
7
- constructor(canisterId, identity) {
8
- super(canisterId, identity);
7
+ constructor(canisterId, identity, options) {
8
+ super(canisterId, identity, options);
9
9
  }
10
10
  /**
11
11
  * Bootstrap: succeeds only while the canister has NO admin at all — the first caller
@@ -1,9 +1,9 @@
1
1
  import { type Identity } from "@icp-sdk/core/agent";
2
- import { ActorBase } from "../actor-base.js";
2
+ import { ActorBase, type ActorOptions } from "../actor-base.js";
3
3
  import type { ChatSummaryView, ChatView, GetMyChatsInput, ListProjectChatsInput, OpenChatInput } from "../interfaces.js";
4
4
  /** 1:1 wrapper for the canister's ChatsController — chats opened from rooms. */
5
5
  export declare class ChatsActor extends ActorBase {
6
- constructor(canisterId: string, identity?: Identity);
6
+ constructor(canisterId: string, identity?: Identity, options?: ActorOptions);
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
@@ -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;;;;;;;;;;OAU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,OAAO,CAAC,eAAe,EAAE,CAAC;IAWlG;;;;;;;OAOG;IACU,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGtE"}
@@ -3,8 +3,8 @@ import { ActorBase } from "../actor-base.js";
3
3
  import { mapChatSummaryView, mapChatView, toOpt, toOptBigInt } from "../mappers.js";
4
4
  /** 1:1 wrapper for the canister's ChatsController — chats opened from rooms. */
5
5
  export class ChatsActor extends ActorBase {
6
- constructor(canisterId, identity) {
7
- super(canisterId, identity);
6
+ constructor(canisterId, identity, options) {
7
+ super(canisterId, identity, options);
8
8
  }
9
9
  /**
10
10
  * Opens the caller's chat in a room: the caller becomes the `customer`, the room's
@@ -1,9 +1,9 @@
1
1
  import { type Identity } from "@icp-sdk/core/agent";
2
- import { ActorBase } from "../actor-base.js";
2
+ import { ActorBase, type ActorOptions } from "../actor-base.js";
3
3
  import type { GetMessagesInput, MessageView, MessagesPageView, PollNewMessagesInput, PollResultView, PostInput } from "../interfaces.js";
4
4
  /** 1:1 wrapper for the canister's MessagesController. */
5
5
  export declare class MessagesActor extends ActorBase {
6
- constructor(canisterId: string, identity?: Identity);
6
+ constructor(canisterId: string, identity?: Identity, options?: ActorOptions);
7
7
  /**
8
8
  * Posts a message as the caller. `text` for any participant; `toolTrace` only for the
9
9
  * `agent` role.
@@ -31,6 +31,23 @@ export declare class MessagesActor extends ActorBase {
31
31
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
32
32
  */
33
33
  setTypingAsyncUnsafe(chatId: string): Promise<boolean>;
34
+ /**
35
+ * markReadAsyncUnsafe without the proof: resolves once the IC has taken the call in,
36
+ * and never reads or verifies the canister's answer — so a refusal (not a participant,
37
+ * a seq beyond the newest message) goes unnoticed. For a host that sends receipts as a
38
+ * courtesy and would only log a failure anyway; verifying every reply is what costs
39
+ * such a host its CPU.
40
+ * @throws Error with message `CriticalCanisterError` when the call could not be handed to the IC.
41
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
42
+ */
43
+ markReadUnverifiedAsyncUnsafe(chatId: string, seq: number): Promise<void>;
44
+ /**
45
+ * setTypingAsyncUnsafe without the proof — see markReadUnverifiedAsyncUnsafe. Resolves
46
+ * once the IC has taken the call in, so a post sent after it still lands after it.
47
+ * @throws Error with message `CriticalCanisterError` when the call could not be handed to the IC.
48
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
49
+ */
50
+ setTypingUnverifiedAsyncUnsafe(chatId: string): Promise<void>;
34
51
  /**
35
52
  * A chat's messages with seq > sinceSeq, oldest first (max 200 per call), together
36
53
  * with `presence`: who is typing and how far each other participant has read.
@@ -1 +1 @@
1
- {"version":3,"file":"messages-actor.d.ts","sourceRoot":"","sources":["../../src/actors/messages-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,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGzI,yDAAyD;AACzD,qBAAa,aAAc,SAAQ,SAAS;gBAE5B,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;OAMG;IACU,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAWpE,2EAA2E;IAC9D,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAQzE;;;;;OAKG;IACU,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/E;;;;;;;;OAQG;IACU,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,O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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItF;;;;;OAKG;IACU,8BAA8B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1E;;;;;;;OAOG;IACU,sBAAsB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAWvF;;;;;;;OAOG;IACU,0BAA0B,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAU7F,sFAAsF;IACzE,wBAAwB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAOrG"}
@@ -3,8 +3,8 @@ import { ActorBase } from "../actor-base.js";
3
3
  import { mapMessageView, mapMessagesPageView, mapPollResultView, toOptBigInt } from "../mappers.js";
4
4
  /** 1:1 wrapper for the canister's MessagesController. */
5
5
  export class MessagesActor extends ActorBase {
6
- constructor(canisterId, identity) {
7
- super(canisterId, identity);
6
+ constructor(canisterId, identity, options) {
7
+ super(canisterId, identity, options);
8
8
  }
9
9
  /**
10
10
  * Posts a message as the caller. `text` for any participant; `toolTrace` only for the
@@ -51,6 +51,27 @@ export class MessagesActor extends ActorBase {
51
51
  async setTypingAsyncUnsafe(chatId) {
52
52
  return this.executeFunctionAsyncUnsafe(() => this.actor.setTyping({ chatId }));
53
53
  }
54
+ /**
55
+ * markReadAsyncUnsafe without the proof: resolves once the IC has taken the call in,
56
+ * and never reads or verifies the canister's answer — so a refusal (not a participant,
57
+ * a seq beyond the newest message) goes unnoticed. For a host that sends receipts as a
58
+ * courtesy and would only log a failure anyway; verifying every reply is what costs
59
+ * such a host its CPU.
60
+ * @throws Error with message `CriticalCanisterError` when the call could not be handed to the IC.
61
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
62
+ */
63
+ async markReadUnverifiedAsyncUnsafe(chatId, seq) {
64
+ return this.sendUnverifiedAsyncUnsafe("markRead", [{ chatId, seq: BigInt(seq) }]);
65
+ }
66
+ /**
67
+ * setTypingAsyncUnsafe without the proof — see markReadUnverifiedAsyncUnsafe. Resolves
68
+ * once the IC has taken the call in, so a post sent after it still lands after it.
69
+ * @throws Error with message `CriticalCanisterError` when the call could not be handed to the IC.
70
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
71
+ */
72
+ async setTypingUnverifiedAsyncUnsafe(chatId) {
73
+ return this.sendUnverifiedAsyncUnsafe("setTyping", [{ chatId }]);
74
+ }
54
75
  /**
55
76
  * A chat's messages with seq > sinceSeq, oldest first (max 200 per call), together
56
77
  * with `presence`: who is typing and how far each other participant has read.
@@ -1,10 +1,10 @@
1
1
  import { type Identity } from "@icp-sdk/core/agent";
2
- import { ActorBase } from "../actor-base.js";
3
- import type { CreateProjectInput, ProjectView, UpdateProjectInput } from "../interfaces.js";
2
+ import { ActorBase, type ActorOptions } from "../actor-base.js";
3
+ import type { CreateProjectInput, DeletionProgressView, ProjectView, UpdateProjectInput } from "../interfaces.js";
4
4
  /** 1:1 wrapper for the canister's ProjectsController — a project is the space of one site
5
5
  * or company; its admins define the rooms. */
6
6
  export declare class ProjectsActor extends ActorBase {
7
- constructor(canisterId: string, identity?: Identity);
7
+ constructor(canisterId: string, identity?: Identity, options?: ActorOptions);
8
8
  /**
9
9
  * Creates a project. Canister admin only.
10
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.
@@ -21,6 +21,28 @@ export declare class ProjectsActor extends ActorBase {
21
21
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
22
22
  */
23
23
  updateProjectAsyncUnsafe(input: UpdateProjectInput): Promise<ProjectView>;
24
+ /**
25
+ * Deletes a project with every room, every chat and every message in it, repeating the
26
+ * bounded canister call until the project is gone. Canister admins only — a project
27
+ * admin may not delete the project it works in. Irreversible. A failure half-way leaves
28
+ * the project partly emptied — call again to finish.
29
+ * @param onStep - Called after every canister call with what that call removed, e.g. to show progress on a big project.
30
+ * @returns The totals of all calls; `finished` is always true.
31
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized — canister admins only, `NotFound` for the project). Examine "cause" for {errorKey, errorMessage, logs}.
32
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
33
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
34
+ */
35
+ deleteProjectAsyncUnsafe(projectId: string, onStep?: (progress: DeletionProgressView) => void): Promise<DeletionProgressView>;
36
+ /**
37
+ * One bounded call of deleting a project — the canister method 1:1. It removes up to 500
38
+ * chats or 50 000 messages (always at least one chat) and, once no chat is left, every
39
+ * room and the project. Canister admins only. Most callers want `deleteProjectAsyncUnsafe`.
40
+ * @returns What this call removed; `finished` = the project is gone.
41
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized — canister admins only, `NotFound` for the project). Examine "cause" for {errorKey, errorMessage, logs}.
42
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
43
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
44
+ */
45
+ deleteProjectStepAsyncUnsafe(projectId: string): Promise<DeletionProgressView>;
24
46
  /**
25
47
  * One project. Canister admins and the project's admins.
26
48
  * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound`). Examine "cause" for {errorKey, errorMessage, logs}.
@@ -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,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1I;;;;;;;;OAQG;IACU,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAK3F;;;;;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"}
@@ -1,12 +1,13 @@
1
1
  import {} from "@icp-sdk/core/agent";
2
2
  import { Principal } from "@icp-sdk/core/principal";
3
3
  import { ActorBase } from "../actor-base.js";
4
- import { mapProjectView, toOpt, toOptBigInt } from "../mappers.js";
4
+ import { mapDeletionProgressView, mapProjectView, toOpt, toOptBigInt } from "../mappers.js";
5
+ import { deleteUntilFinishedAsyncUnsafe } from "../deletion.js";
5
6
  /** 1:1 wrapper for the canister's ProjectsController — a project is the space of one site
6
7
  * or company; its admins define the rooms. */
7
8
  export class ProjectsActor extends ActorBase {
8
- constructor(canisterId, identity) {
9
- super(canisterId, identity);
9
+ constructor(canisterId, identity, options) {
10
+ super(canisterId, identity, options);
10
11
  }
11
12
  /**
12
13
  * Creates a project. Canister admin only.
@@ -38,6 +39,33 @@ export class ProjectsActor extends ActorBase {
38
39
  }));
39
40
  return mapProjectView(project);
40
41
  }
42
+ /**
43
+ * Deletes a project with every room, every chat and every message in it, repeating the
44
+ * bounded canister call until the project is gone. Canister admins only — a project
45
+ * admin may not delete the project it works in. Irreversible. A failure half-way leaves
46
+ * the project partly emptied — call again to finish.
47
+ * @param onStep - Called after every canister call with what that call removed, e.g. to show progress on a big project.
48
+ * @returns The totals of all calls; `finished` is always true.
49
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized — canister admins only, `NotFound` for the project). Examine "cause" for {errorKey, errorMessage, logs}.
50
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
51
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
52
+ */
53
+ async deleteProjectAsyncUnsafe(projectId, onStep) {
54
+ return deleteUntilFinishedAsyncUnsafe(() => this.deleteProjectStepAsyncUnsafe(projectId), onStep);
55
+ }
56
+ /**
57
+ * One bounded call of deleting a project — the canister method 1:1. It removes up to 500
58
+ * chats or 50 000 messages (always at least one chat) and, once no chat is left, every
59
+ * room and the project. Canister admins only. Most callers want `deleteProjectAsyncUnsafe`.
60
+ * @returns What this call removed; `finished` = the project is gone.
61
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized — canister admins only, `NotFound` for the project). Examine "cause" for {errorKey, errorMessage, logs}.
62
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
63
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
64
+ */
65
+ async deleteProjectStepAsyncUnsafe(projectId) {
66
+ const progress = await this.executeFunctionAsyncUnsafe(() => this.actor.deleteProject({ projectId }));
67
+ return mapDeletionProgressView(progress);
68
+ }
41
69
  /**
42
70
  * One project. Canister admins and the project's admins.
43
71
  * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound`). Examine "cause" for {errorKey, errorMessage, logs}.
@@ -1,10 +1,10 @@
1
1
  import { type Identity } from "@icp-sdk/core/agent";
2
- import { ActorBase } from "../actor-base.js";
3
- import type { CreateRoomInput, ListRoomsInput, RoomRefInput, RoomView, UpdateRoomInput } from "../interfaces.js";
2
+ import { ActorBase, type ActorOptions } from "../actor-base.js";
3
+ import type { CreateRoomInput, DeletionProgressView, ListRoomsInput, RoomRefInput, RoomView, UpdateRoomInput } from "../interfaces.js";
4
4
  /** 1:1 wrapper for the canister's RoomsController — a room is the template a chat is
5
5
  * opened from: it names who receives the customer's messages. */
6
6
  export declare class RoomsActor extends ActorBase {
7
- constructor(canisterId: string, identity?: Identity);
7
+ constructor(canisterId: string, identity?: Identity, options?: ActorOptions);
8
8
  /**
9
9
  * Creates a room. Project admins and canister admins.
10
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).
@@ -20,6 +20,27 @@ export declare class RoomsActor extends ActorBase {
20
20
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
21
21
  */
22
22
  updateRoomAsyncUnsafe(input: UpdateRoomInput): Promise<RoomView>;
23
+ /**
24
+ * Deletes a room with every chat opened from it and their messages, repeating the
25
+ * bounded canister call until the room is gone. Project admins and canister admins.
26
+ * Irreversible. A failure half-way leaves the room partly emptied — call again to finish.
27
+ * @param onStep - Called after every canister call with what that call removed, e.g. to show progress on a big room.
28
+ * @returns The totals of all calls; `finished` is always true.
29
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound` for the room). Examine "cause" for {errorKey, errorMessage, logs}.
30
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
31
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
32
+ */
33
+ deleteRoomAsyncUnsafe(input: RoomRefInput, onStep?: (progress: DeletionProgressView) => void): Promise<DeletionProgressView>;
34
+ /**
35
+ * One bounded call of deleting a room — the canister method 1:1. It removes up to 500
36
+ * chats or 50 000 messages (always at least one chat) and, once no chat is left, the
37
+ * room. Project admins and canister admins. Most callers want `deleteRoomAsyncUnsafe`.
38
+ * @returns What this call removed; `finished` = the room is gone.
39
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound` for the room). Examine "cause" for {errorKey, errorMessage, logs}.
40
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
41
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
42
+ */
43
+ deleteRoomStepAsyncUnsafe(input: RoomRefInput): Promise<DeletionProgressView>;
23
44
  /**
24
45
  * One room with its recipients. Any signed-in caller — a site shows the names before
25
46
  * the customer opens the chat.
@@ -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;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
+ {"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,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIvI;iEACiE;AACjE,qBAAa,UAAW,SAAQ,SAAS;gBAEzB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY;IAI3E;;;;;;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;;;;;;;;;OASG;IACU,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIzI;;;;;;;;OAQG;IACU,yBAAyB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAK1F;;;;;;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,12 +1,13 @@
1
1
  import {} from "@icp-sdk/core/agent";
2
2
  import { Principal } from "@icp-sdk/core/principal";
3
3
  import { ActorBase } from "../actor-base.js";
4
- import { mapRoomView, toCandidRecipient, toOpt, toOptBigInt } from "../mappers.js";
4
+ import { mapDeletionProgressView, mapRoomView, toCandidRecipient, toOpt, toOptBigInt } from "../mappers.js";
5
+ import { deleteUntilFinishedAsyncUnsafe } from "../deletion.js";
5
6
  /** 1:1 wrapper for the canister's RoomsController — a room is the template a chat is
6
7
  * opened from: it names who receives the customer's messages. */
7
8
  export class RoomsActor extends ActorBase {
8
- constructor(canisterId, identity) {
9
- super(canisterId, identity);
9
+ constructor(canisterId, identity, options) {
10
+ super(canisterId, identity, options);
10
11
  }
11
12
  /**
12
13
  * Creates a room. Project admins and canister admins.
@@ -41,6 +42,32 @@ export class RoomsActor extends ActorBase {
41
42
  }));
42
43
  return mapRoomView(room);
43
44
  }
45
+ /**
46
+ * Deletes a room with every chat opened from it and their messages, repeating the
47
+ * bounded canister call until the room is gone. Project admins and canister admins.
48
+ * Irreversible. A failure half-way leaves the room partly emptied — call again to finish.
49
+ * @param onStep - Called after every canister call with what that call removed, e.g. to show progress on a big room.
50
+ * @returns The totals of all calls; `finished` is always true.
51
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound` for the room). Examine "cause" for {errorKey, errorMessage, logs}.
52
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
53
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
54
+ */
55
+ async deleteRoomAsyncUnsafe(input, onStep) {
56
+ return deleteUntilFinishedAsyncUnsafe(() => this.deleteRoomStepAsyncUnsafe(input), onStep);
57
+ }
58
+ /**
59
+ * One bounded call of deleting a room — the canister method 1:1. It removes up to 500
60
+ * chats or 50 000 messages (always at least one chat) and, once no chat is left, the
61
+ * room. Project admins and canister admins. Most callers want `deleteRoomAsyncUnsafe`.
62
+ * @returns What this call removed; `finished` = the room is gone.
63
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `NotFound` for the room). Examine "cause" for {errorKey, errorMessage, logs}.
64
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
65
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
66
+ */
67
+ async deleteRoomStepAsyncUnsafe(input) {
68
+ const progress = await this.executeFunctionAsyncUnsafe(() => this.actor.deleteRoom({ projectId: input.projectId, roomId: input.roomId }));
69
+ return mapDeletionProgressView(progress);
70
+ }
44
71
  /**
45
72
  * One room with its recipients. Any signed-in caller — a site shows the names before
46
73
  * the customer opens the chat.
@@ -0,0 +1,8 @@
1
+ import type { DeletionProgressView } from "./interfaces.js";
2
+ /**
3
+ * Repeats one bounded delete call until the canister reports the room or project gone,
4
+ * adding up what every call removed. Every call removes at least one chat, so the loop
5
+ * ends unless chats are opened faster than they are deleted.
6
+ */
7
+ export declare function deleteUntilFinishedAsyncUnsafe(step: () => Promise<DeletionProgressView>, onStep?: (progress: DeletionProgressView) => void): Promise<DeletionProgressView>;
8
+ //# sourceMappingURL=deletion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deletion.d.ts","sourceRoot":"","sources":["../src/deletion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;GAIG;AACH,wBAAsB,8BAA8B,CAChD,IAAI,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,EACzC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,GAClD,OAAO,CAAC,oBAAoB,CAAC,CAc/B"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Repeats one bounded delete call until the canister reports the room or project gone,
3
+ * adding up what every call removed. Every call removes at least one chat, so the loop
4
+ * ends unless chats are opened faster than they are deleted.
5
+ */
6
+ export async function deleteUntilFinishedAsyncUnsafe(step, onStep) {
7
+ const total = { finished: false, roomsDeleted: 0, chatsPurged: 0, messagesPurged: 0 };
8
+ while (!total.finished) {
9
+ const progress = await step();
10
+ onStep?.(progress);
11
+ total.finished = progress.finished;
12
+ total.roomsDeleted += progress.roomsDeleted;
13
+ total.chatsPurged += progress.chatsPurged;
14
+ total.messagesPurged += progress.messagesPurged;
15
+ }
16
+ return total;
17
+ }
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { ActorBase, type LogEntry } from "./actor-base.js";
1
+ export { ActorBase, type LogEntry, type ActorOptions, type BlsVerifyFunction } from "./actor-base.js";
2
2
  export { AdminActor } from "./actors/admin-actor.js";
3
3
  export { ProjectsActor } from "./actors/projects-actor.js";
4
4
  export { RoomsActor } from "./actors/rooms-actor.js";
5
5
  export { ChatsActor } from "./actors/chats-actor.js";
6
6
  export { MessagesActor } from "./actors/messages-actor.js";
7
7
  export { ChatPoller, type ChatPollerOptions } from "./chat-poller.js";
8
- export type { RoleView, RecipientRoleView, ProjectView, RecipientView, RoomView, ParticipantView, ChatView, ChatSummaryView, SystemEventView, MessageKindView, MessageView, MessagesPageView, PresenceView, PollResultView, QuotaLimitsView, CreateProjectInput, UpdateProjectInput, CreateRoomInput, UpdateRoomInput, RoomRefInput, ListRoomsInput, OpenChatInput, GetMyChatsInput, ListProjectChatsInput, PostInput, GetMessagesInput, PollNewMessagesInput, } from "./interfaces.js";
9
- export { mapProjectView, mapRoomView, mapRecipientView, mapChatView, mapChatSummaryView, mapParticipantView, mapMessageView, mapMessagesPageView, mapPollResultView, mapSystemEventView, mapQuotaLimitsView, mapRoleView, mapRecipientRoleView, toCandidRecipient, toCandidRecipientRole, } from "./mappers.js";
10
- export type { Chat, ChatId, ChatSummary, Message, MessageKind, MessagesPage, Participant, PollResult, Project, ProjectId, QuotaLimits, Recipient, RecipientRole, Role, Room, RoomId, SystemEvent, Error as CanisterErrorShape, ErrorDetails, } from "../declarations/chat-motoko-backend/chat-motoko-backend.did.js";
8
+ export type { RoleView, RecipientRoleView, ProjectView, RecipientView, RoomView, ParticipantView, ChatView, ChatSummaryView, SystemEventView, MessageKindView, MessageView, MessagesPageView, PresenceView, PollResultView, QuotaLimitsView, DeletionProgressView, CreateProjectInput, UpdateProjectInput, CreateRoomInput, UpdateRoomInput, RoomRefInput, ListRoomsInput, OpenChatInput, GetMyChatsInput, ListProjectChatsInput, PostInput, GetMessagesInput, PollNewMessagesInput, } from "./interfaces.js";
9
+ export { mapProjectView, mapRoomView, mapRecipientView, mapChatView, mapChatSummaryView, mapParticipantView, mapMessageView, mapMessagesPageView, mapPollResultView, mapSystemEventView, mapQuotaLimitsView, mapDeletionProgressView, mapRoleView, mapRecipientRoleView, toCandidRecipient, toCandidRecipientRole, } from "./mappers.js";
10
+ export type { Chat, ChatId, ChatSummary, DeletionProgress, Message, MessageKind, MessagesPage, Participant, PollResult, Project, ProjectId, QuotaLimits, Recipient, RecipientRole, Role, Room, RoomId, SystemEvent, Error as CanisterErrorShape, ErrorDetails, } from "../declarations/chat-motoko-backend/chat-motoko-backend.did.js";
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,EACR,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,eAAe,EACf,eAAe,EACf,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EAChB,oBAAoB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACxB,MAAM,cAAc,CAAC;AACtB,YAAY,EACR,IAAI,EACJ,MAAM,EACN,WAAW,EACX,OAAO,EACP,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,SAAS,EACT,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,WAAW,EACX,KAAK,IAAI,kBAAkB,EAC3B,YAAY,GACf,MAAM,gEAAgE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,EACR,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,eAAe,EACf,eAAe,EACf,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EAChB,oBAAoB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACxB,MAAM,cAAc,CAAC;AACtB,YAAY,EACR,IAAI,EACJ,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,SAAS,EACT,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,WAAW,EACX,KAAK,IAAI,kBAAkB,EAC3B,YAAY,GACf,MAAM,gEAAgE,CAAC"}
package/dist/index.js CHANGED
@@ -5,4 +5,4 @@ export { RoomsActor } from "./actors/rooms-actor.js";
5
5
  export { ChatsActor } from "./actors/chats-actor.js";
6
6
  export { MessagesActor } from "./actors/messages-actor.js";
7
7
  export { ChatPoller } from "./chat-poller.js";
8
- export { mapProjectView, mapRoomView, mapRecipientView, mapChatView, mapChatSummaryView, mapParticipantView, mapMessageView, mapMessagesPageView, mapPollResultView, mapSystemEventView, mapQuotaLimitsView, mapRoleView, mapRecipientRoleView, toCandidRecipient, toCandidRecipientRole, } from "./mappers.js";
8
+ export { mapProjectView, mapRoomView, mapRecipientView, mapChatView, mapChatSummaryView, mapParticipantView, mapMessageView, mapMessagesPageView, mapPollResultView, mapSystemEventView, mapQuotaLimitsView, mapDeletionProgressView, mapRoleView, mapRecipientRoleView, toCandidRecipient, toCandidRecipientRole, } from "./mappers.js";
@@ -108,6 +108,17 @@ export interface PollResultView {
108
108
  nextSinceGlobalSeq: number;
109
109
  headGlobalSeq: number;
110
110
  }
111
+ /**
112
+ * What one delete call removed. The canister deletes a big room or project over several
113
+ * bounded calls (500 chats or 50 000 messages each); `finished` = the room, or the project
114
+ * with all its rooms, is gone.
115
+ */
116
+ export interface DeletionProgressView {
117
+ finished: boolean;
118
+ roomsDeleted: number;
119
+ chatsPurged: number;
120
+ messagesPurged: number;
121
+ }
111
122
  export interface QuotaLimitsView {
112
123
  /** Messages one principal may post per UTC day. */
113
124
  posts: number;
@@ -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;IACxB,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,kFAAkF;IAClF,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EA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AAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,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 CHANGED
@@ -1,5 +1,5 @@
1
- import type { Chat, ChatSummary, Message, MessagesPage, Participant, PollResult, Project, QuotaLimits, Recipient, RecipientRole, Role, Room, SystemEvent } from "../declarations/chat-motoko-backend/chat-motoko-backend.did.js";
2
- import type { ChatSummaryView, ChatView, MessageView, MessagesPageView, ParticipantView, PollResultView, ProjectView, QuotaLimitsView, RecipientRoleView, RecipientView, RoleView, RoomView, SystemEventView } from "./interfaces.js";
1
+ import type { Chat, ChatSummary, DeletionProgress, Message, MessagesPage, Participant, PollResult, Project, QuotaLimits, Recipient, RecipientRole, Role, Room, SystemEvent } from "../declarations/chat-motoko-backend/chat-motoko-backend.did.js";
2
+ import type { ChatSummaryView, ChatView, DeletionProgressView, MessageView, MessagesPageView, ParticipantView, PollResultView, ProjectView, QuotaLimitsView, RecipientRoleView, RecipientView, RoleView, RoomView, SystemEventView } from "./interfaces.js";
3
3
  export declare function fromOpt<T>(opt: [] | [T]): T | undefined;
4
4
  export declare function toOpt<T>(value: T | undefined): [] | [T];
5
5
  export declare function toOptBigInt(value: number | undefined): [] | [bigint];
@@ -17,6 +17,7 @@ export declare function mapSystemEventView(_event: SystemEvent): SystemEventView
17
17
  export declare function mapMessageView(message: Message): MessageView;
18
18
  export declare function mapMessagesPageView(page: MessagesPage): MessagesPageView;
19
19
  export declare function mapPollResultView(result: PollResult): PollResultView;
20
+ export declare function mapDeletionProgressView(progress: DeletionProgress): DeletionProgressView;
20
21
  export declare function mapQuotaLimitsView(limits: QuotaLimits): QuotaLimitsView;
21
22
  export declare function toCandidQuotaLimits(limits: QuotaLimitsView): QuotaLimits;
22
23
  //# sourceMappingURL=mappers.d.ts.map
@@ -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,IAAI,EACJ,IAAI,EACJ,WAAW,EACd,MAAM,gEAAgE,CAAC;AACxE,OAAO,KAAK,EACR,eAAe,EACf,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,eAAe,EAClB,MAAM,iBAAiB,CAAC;A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,EAAE,SAAS,GAAG,aAAa,CAMpE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAQ5D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,CAUhD;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,CAcxE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,cAAc,CAMpE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB,CAOxF;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
@@ -131,6 +131,14 @@ export function mapPollResultView(result) {
131
131
  headGlobalSeq: Number(result.headGlobalSeq),
132
132
  };
133
133
  }
134
+ export function mapDeletionProgressView(progress) {
135
+ return {
136
+ finished: progress.finished,
137
+ roomsDeleted: Number(progress.roomsDeleted),
138
+ chatsPurged: Number(progress.chatsPurged),
139
+ messagesPurged: Number(progress.messagesPurged),
140
+ };
141
+ }
134
142
  export function mapQuotaLimitsView(limits) {
135
143
  return { posts: Number(limits.posts), chats: Number(limits.chats) };
136
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsm-mit/chat-motoko-package",
3
- "version": "0.6.0",
3
+ "version": "0.8.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": "",
@@ -25,8 +25,9 @@
25
25
  "publish-public": "bash scripts/publish-public.sh",
26
26
  "typecheck": "tsc --noEmit -p tsconfig.tests.json",
27
27
  "sync-declarations": "bash scripts/sync-declarations.sh",
28
- "test-suite": "bash scripts/run-tests.sh tests/test-suite.ts",
29
- "test-access-restrictions": "bash scripts/run-tests.sh tests/test-access-restrictions.ts",
28
+ "test-suite": "bash scripts/run-tests.sh tests/test-suite.ts --lease 3",
29
+ "test-access-restrictions": "bash scripts/run-tests.sh tests/test-access-restrictions.ts --lease 3",
30
+ "test-smoke": "bash scripts/run-tests.sh tests/test-smoke.ts --lease 3",
30
31
  "redeploy": "bash scripts/redeploy.sh",
31
32
  "user1": "npx tsx sandbox/main.ts USER1",
32
33
  "user2": "npx tsx sandbox/main.ts USER2",
@@ -58,6 +59,6 @@
58
59
  "chatMotoko": {
59
60
  "repo": "chat-motoko",
60
61
  "repoUrl": "https://github.com/JSM-Chat-Platform/chat-motoko",
61
- "commit": "a5184ccd2c42aefd0b21dc0419cd24530e10de5b"
62
+ "commit": "3eb9151a19246ce208faea2ac90832d8d2281950"
62
63
  }
63
64
  }