MCPcopy Index your code
hub / github.com/outerbase/studio / updateDoc

Method updateDoc

src/outerbase-cloud/query-driver.ts:122–152  ·  view source on GitHub ↗
(id: string, data: SavedDocInput)

Source from the content-addressed store, hash-verified

120 }
121
122 async updateDoc(id: string, data: SavedDocInput): Promise<SavedDocData> {
123 await this.getNamespaces();
124
125 const r = await updateOuterbaseQuery(this.workspaceId, id, {
126 name: data.name,
127 query: data.content,
128 });
129
130 const doc: SavedDocData = {
131 id: r.id,
132 namespace: {
133 id: "default",
134 name: "Workspace",
135 },
136 name: r.name,
137 content: r.query,
138 type: "sql",
139 createdAt: Date.now(),
140 updatedAt: Date.now(),
141 };
142
143 if (this.cacheDocs["default"]) {
144 this.cacheDocs["default"] = this.cacheDocs["default"].map((d) => {
145 if (d.id === r.id) return doc;
146 return d;
147 });
148 }
149
150 this.triggerChange();
151 return doc;
152 }
153
154 async removeDoc(id: string): Promise<void> {
155 await this.getNamespaces();

Callers 1

SaveDocButtonFunction · 0.45

Calls 3

getNamespacesMethod · 0.95
triggerChangeMethod · 0.95
updateOuterbaseQueryFunction · 0.90

Tested by

no test coverage detected