MCPcopy Create free account
hub / github.com/Botloader/botloader / countAll

Function countAll

integration-tests/tasks_get.ts:36–52  ·  view source on GitHub ↗
(namespace?: string)

Source from the content-addressed store, hash-verified

34}
35
36async function countAll(namespace?: string): Promise<number> {
37 let last = 0;
38 let n = 0;
39 while (true) {
40 const batch = await Tasks.getMany({
41 namespace: namespace, afterId: last
42 });
43 if (batch && batch.length > 0) {
44 last = batch[batch.length - 1].id;
45 n += batch.length;
46 } else {
47 break;
48 }
49 }
50
51 return n
52}
53
54runOnce(script.name, async () => {
55 await testGetKey();

Callers 1

testGetAllFunction · 0.70

Calls 1

getManyMethod · 0.80

Tested by

no test coverage detected