Skip to content

Commit

Permalink
fix metas
Browse files Browse the repository at this point in the history
  • Loading branch information
esimkowitz committed Nov 22, 2024
1 parent a833dae commit 808b2cf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
22 changes: 11 additions & 11 deletions frontend/app/store/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BlockServiceType {
}

// save the terminal state to a blockfile
SaveTerminalState(ctx: string, blockId: string, state: string, stateType: number, ptyOffset: TermSize): Promise<void> {
SaveTerminalState(blockId: string, state: string, stateType: string, ptyOffset: number, termSize: TermSize): Promise<void> {
return WOS.callBackendService("block", "SaveTerminalState", Array.from(arguments))
}
SaveWaveAiData(arg2: string, arg3: OpenAIPromptMessageType[]): Promise<void> {
Expand Down Expand Up @@ -81,12 +81,12 @@ export const FileService = new FileServiceType();
// objectservice.ObjectService (object)
class ObjectServiceType {
// @returns blockId (and object updates)
CreateBlock(uiContext: BlockDef, blockDef: RuntimeOpts): Promise<string> {
CreateBlock(blockDef: BlockDef, rtOpts: RuntimeOpts): Promise<string> {
return WOS.callBackendService("object", "CreateBlock", Array.from(arguments))
}

// @returns object updates
DeleteBlock(uiContext: string): Promise<void> {
DeleteBlock(blockId: string): Promise<void> {
return WOS.callBackendService("object", "DeleteBlock", Array.from(arguments))
}

Expand All @@ -101,17 +101,17 @@ class ObjectServiceType {
}

// @returns object updates
UpdateObject(uiContext: WaveObj, waveObj: boolean): Promise<void> {
UpdateObject(waveObj: WaveObj, returnUpdates: boolean): Promise<void> {
return WOS.callBackendService("object", "UpdateObject", Array.from(arguments))
}

// @returns object updates
UpdateObjectMeta(uiContext: string, oref: MetaType): Promise<void> {
UpdateObjectMeta(oref: string, meta: MetaType): Promise<void> {
return WOS.callBackendService("object", "UpdateObjectMeta", Array.from(arguments))
}

// @returns object updates
UpdateTabName(uiContext: string, tabId: string): Promise<void> {
UpdateTabName(tabId: string, name: string): Promise<void> {
return WOS.callBackendService("object", "UpdateTabName", Array.from(arguments))
}
}
Expand All @@ -132,7 +132,7 @@ class WindowServiceType {
CloseWindow(windowId: string, fromElectron: boolean): Promise<void> {
return WOS.callBackendService("window", "CloseWindow", Array.from(arguments))
}
CreateWindow(winSize: WinSize, workspaceId: string): Promise<WaveWindow>Promise<Workspace> {
CreateWindow(winSize: WinSize, workspaceId: string): Promise<[WaveWindow, Workspace]> {
return WOS.callBackendService("window", "CreateWindow", Array.from(arguments))
}
GetWindow(windowId: string): Promise<WaveWindow> {
Expand All @@ -141,7 +141,7 @@ class WindowServiceType {

// move block to new window
// @returns object updates
MoveBlockToNewWindow(ctx: string, currentTabId: string): Promise<void> {
MoveBlockToNewWindow(currentTabId: string, blockId: string): Promise<void> {
return WOS.callBackendService("window", "MoveBlockToNewWindow", Array.from(arguments))
}

Expand All @@ -165,7 +165,7 @@ class WorkspaceServiceType {
}

// @returns tabId (and object updates)
CreateTab(windowId: string, tabName: string, activateTab: boolean): Promise<string> {
CreateTab(workspaceId: string, tabName: string, activateTab: boolean): Promise<string> {
return WOS.callBackendService("workspace", "CreateTab", Array.from(arguments))
}

Expand All @@ -181,12 +181,12 @@ class WorkspaceServiceType {
}

// @returns object updates
SetActiveTab(uiContext: string, tabId: string): Promise<void> {
SetActiveTab(workspaceId: string, tabId: string): Promise<void> {
return WOS.callBackendService("workspace", "SetActiveTab", Array.from(arguments))
}

// @returns object updates
UpdateTabIds(uiContext: string, workspaceId: string[]): Promise<void> {
UpdateTabIds(workspaceId: string, tabIds: string[]): Promise<void> {
return WOS.callBackendService("workspace", "UpdateTabIds", Array.from(arguments))
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/service/windowservice/windowservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (svc *WindowService) GetWindow(windowId string) (*waveobj.Window, error) {

func (svc *WindowService) CreateWindow_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
ArgNames: []string{"winSize", "workspaceId"},
ArgNames: []string{"ctx", "winSize", "workspaceId"},
}
}

Expand Down Expand Up @@ -70,7 +70,7 @@ func (svc *WindowService) CreateWindow(ctx context.Context, winSize *waveobj.Win
func (svc *WindowService) SetWindowPosAndSize_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
Desc: "set window position and size",
ArgNames: []string{"windowId", "pos", "size"},
ArgNames: []string{"ctx", "windowId", "pos", "size"},
}
}

Expand Down Expand Up @@ -156,7 +156,7 @@ func (svc *WindowService) MoveBlockToNewWindow(ctx context.Context, currentTabId

func (svc *WindowService) SwitchWorkspace_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
ArgNames: []string{"windowId", "workspaceId"},
ArgNames: []string{"ctx", "windowId", "workspaceId"},
}
}

Expand All @@ -174,7 +174,7 @@ func (svc *WindowService) SwitchWorkspace(ctx context.Context, windowId string,

func (svc *WindowService) CloseWindow_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
ArgNames: []string{"windowId", "fromElectron"},
ArgNames: []string{"ctx", "windowId", "fromElectron"},
}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/service/workspaceservice/workspaceservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (svg *WorkspaceService) ListWorkspaces() (waveobj.WorkspaceList, error) {

func (svc *WorkspaceService) CreateTab_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
ArgNames: []string{"windowId", "tabName", "activateTab"},
ArgNames: []string{"workspaceId", "tabName", "activateTab"},
ReturnDesc: "tabId",
}
}
Expand Down Expand Up @@ -109,7 +109,7 @@ func (svc *WorkspaceService) UpdateTabIds(uiContext waveobj.UIContext, workspace

func (svc *WorkspaceService) SetActiveTab_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
ArgNames: []string{"uiContext", "tabId"},
ArgNames: []string{"workspaceId", "tabId"},
}
}

Expand Down Expand Up @@ -150,7 +150,7 @@ type CloseTabRtnType struct {

func (svc *WorkspaceService) CloseTab_Meta() tsgenmeta.MethodMeta {
return tsgenmeta.MethodMeta{
ArgNames: []string{"workspaceId", "tabId", "fromElectron"},
ArgNames: []string{"ctx", "workspaceId", "tabId", "fromElectron"},
}
}

Expand Down
11 changes: 7 additions & 4 deletions pkg/tsgen/tsgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func GenerateMethodSignature(serviceName string, method reflect.Method, meta tsg
wroteArg = true
}
sb.WriteString("): ")
wroteRtn := false
rtnTypes := []string{}
for idx := 0; idx < method.Type.NumOut(); idx++ {
outType := method.Type.Out(idx)
if outType == errorRType {
Expand All @@ -372,11 +372,14 @@ func GenerateMethodSignature(serviceName string, method reflect.Method, meta tsg
continue
}
tsTypeName, _ := TypeToTSType(outType, tsTypesMap)
sb.WriteString(fmt.Sprintf("Promise<%s>", tsTypeName))
wroteRtn = true
rtnTypes = append(rtnTypes, tsTypeName)
}
if !wroteRtn {
if len(rtnTypes) == 0 {
sb.WriteString("Promise<void>")
} else if len(rtnTypes) == 1 {
sb.WriteString(fmt.Sprintf("Promise<%s>", rtnTypes[0]))
} else {
sb.WriteString(fmt.Sprintf("Promise<[%s]>", strings.Join(rtnTypes, ", ")))
}
sb.WriteString(" {\n")
return sb.String()
Expand Down

0 comments on commit 808b2cf

Please sign in to comment.