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

Method createDoc

src/outerbase-cloud/query-driver.ts:76–109  ·  view source on GitHub ↗
(
    _: SavedDocType,
    __: string,
    data: SavedDocInput
  )

Source from the content-addressed store, hash-verified

74 }
75
76 async createDoc(
77 _: SavedDocType,
78 __: string,
79 data: SavedDocInput
80 ): Promise<SavedDocData> {
81 await this.getNamespaces();
82
83 const r = await createOuterbaseQuery(this.workspaceId, this.baseId, {
84 baseId: this.baseId,
85 name: data.name,
86 query: data.content,
87 source_id: this.sourceId,
88 });
89
90 const doc: SavedDocData = {
91 id: r.id,
92 namespace: {
93 id: "default",
94 name: "Workspace",
95 },
96 name: data.name,
97 content: data.content,
98 type: "sql",
99 createdAt: Date.now(),
100 updatedAt: Date.now(),
101 };
102
103 if (this.cacheDocs["default"]) {
104 this.cacheDocs["default"].unshift(doc);
105 }
106
107 this.triggerChange();
108 return doc;
109 }
110
111 async getDocs(): Promise<SavedDocGroupByNamespace[]> {
112 const ns = await this.getNamespaces();

Callers 1

SaveDocButtonFunction · 0.45

Calls 3

getNamespacesMethod · 0.95
triggerChangeMethod · 0.95
createOuterbaseQueryFunction · 0.90

Tested by

no test coverage detected