added jsvm bindings and updateing the workflow to generate the jsvm types

This commit is contained in:
Gani Georgiev
2023-07-11 18:09:55 +03:00
parent 3d3fe5c614
commit ede67dbc20
9 changed files with 5322 additions and 4985 deletions
+34 -1
View File
@@ -3,7 +3,9 @@ package main
import (
"log"
"os"
"path/filepath"
"reflect"
"runtime"
"strings"
"github.com/pocketbase/pocketbase/core"
@@ -646,6 +648,29 @@ declare namespace $apis {
let enrichRecords: apis.enrichRecords
}
// -------------------------------------------------------------------
// httpClientBinds
// -------------------------------------------------------------------
declare namespace $http {
/**
* Sends a single HTTP request (_currently only json and plain text requests_).
*
* @group PocketBase
*/
function send(params: {
url: string,
method?: string, // default to "GET"
data?: { [key:string]: any },
headers?: { [key:string]: string },
timeout?: number // default to 120
}): {
statusCode: number
raw: string
json: any
};
}
// -------------------------------------------------------------------
// migrate only
// -------------------------------------------------------------------
@@ -695,7 +720,15 @@ func main() {
log.Fatal(err)
}
if err := os.WriteFile("./generated/types.d.ts", []byte(result), 0644); err != nil {
_, filename, _, ok := runtime.Caller(0)
if !ok {
log.Fatal("Failed to get the current docs directory")
}
parentDir := filepath.Dir(filename)
typesFile := filepath.Join(parentDir, "generated", "types.d.ts")
if err := os.WriteFile(typesFile, []byte(result), 0644); err != nil {
log.Fatal(err)
}
}
File diff suppressed because it is too large Load Diff