@okostream/mcp 0.12.0 → 0.12.1

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.
@@ -10,7 +10,7 @@ import { z } from "zod";
10
10
  import { requireConfirm, safeString, serialize, textResult } from "../utils.js";
11
11
  import { authed, inviteUrl } from "./context.js";
12
12
  import { destructiveTool, idempotentWriteTool, MAX_WORKSPACE_INVITE_CODE_LENGTH, MAX_WORKSPACE_NAME_LENGTH, readOnlyTool, toolDescription, unknownRecordSchema, updateOutputSchema, workspaceAccessOutputSchema, workspacePermissionsSchema, workspacesOutputSchema, writeTool } from "./schemas.js";
13
- import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, limit, query, serverTimestamp, setDoc, updateDoc, where } from "firebase/firestore";
13
+ import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, query, serverTimestamp, setDoc, updateDoc, where } from "firebase/firestore";
14
14
  import { firestore, functions } from "../firebase.js";
15
15
  import { httpsCallable } from "firebase/functions";
16
16
  import { listVisibleWorkspaces, normalizeWorkspacePermissions, randomInviteCode, readWorkspaceForOwner } from "./workspaceAccess.js";
@@ -99,11 +99,15 @@ export function registerWorkspaceTools(server) {
99
99
  // доступа не имеет, проверка не увидит — но владелец пространства
100
100
  // получает grant на все его события через CF18, так что для владельца,
101
101
  // а только он сюда и доходит (`readWorkspaceForOwner` выше), совпадает.
102
- const eventsSnap = await getDocs(query(collection(firestore, "eventAccess", uid, "grants"), where("workspaceId", "==", workspaceId), limit(1)));
103
- if (!eventsSnap.empty)
104
- throw new Error("Workspace still has events. Move or delete its events before deleting the workspace.");
105
- await deleteDoc(doc(firestore, "workspaces", workspaceId));
106
- return textResult({ workspaceId, deleted: true });
102
+ // 🔴 Удаление идёт через CF57, а не `deleteDoc`: голое удаление корневого
103
+ // документа оставляло живыми подколлекцию shares, зеркала
104
+ // workspaceMembers и grants — участники сохраняли доступ, а убрать это
105
+ // было уже нельзя, потому что правило shares проверяет владельца через
106
+ // get() исчезнувшего родителя. Проверку «в пространстве нет событий»
107
+ // функция делает сама, полным запросом, а не по индексу этого ключа.
108
+ const removeWorkspace = httpsCallable(functions, "deleteWorkspaceCompletely");
109
+ const removed = await removeWorkspace({ workspaceId });
110
+ return textResult({ ...removed.data, workspaceId, deleted: true });
107
111
  });
108
112
  server.registerTool("oko_list_workspace_access", {
109
113
  title: "List workspace access",
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/generateMcpVersion.mjs from mcp/package.json. Do not edit.
2
- export const OKO_MCP_VERSION = "0.12.0";
2
+ export const OKO_MCP_VERSION = "0.12.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okostream/mcp",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Control OKO Stream webinars from Claude, Codex, and other MCP clients.",
5
5
  "license": "UNLICENSED",
6
6
  "author": {