MCPcopy Index your code
hub / github.com/coder/mux / listAllWorkspaceTurns

Method listAllWorkspaceTurns

src/node/services/taskHandleStore.ts:193–210  ·  view source on GitHub ↗
(
    options: { statuses?: readonly WorkspaceTurnTaskStatus[] } = {}
  )

Source from the content-addressed store, hash-verified

191 }
192
193 async listAllWorkspaceTurns(
194 options: { statuses?: readonly WorkspaceTurnTaskStatus[] } = {}
195 ): Promise<WorkspaceTurnTaskHandleRecord[]> {
196 let entries: Array<{ isDirectory: () => boolean; name: string }>;
197 try {
198 entries = await fsPromises.readdir(this.config.sessionsDir, { withFileTypes: true });
199 } catch (error) {
200 if (isErrnoWithCode(error, "ENOENT")) return [];
201 throw error;
202 }
203
204 const recordsByOwner = await Promise.all(
205 entries
206 .filter((entry) => entry.isDirectory())
207 .map((entry) => this.listWorkspaceTurns(entry.name, options))
208 );
209 return recordsByOwner.flat().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
210 }
211
212 async isWorkspaceOwnedBy(ownerWorkspaceId: string, workspaceId: string): Promise<boolean> {
213 assert(ownerWorkspaceId.trim().length > 0, "isWorkspaceOwnedBy requires ownerWorkspaceId");

Calls 2

listWorkspaceTurnsMethod · 0.95
isErrnoWithCodeFunction · 0.90

Tested by

no test coverage detected