diff --git a/mkdocs-website/docs/en/changelog.md b/mkdocs-website/docs/en/changelog.md index b8db3c29012..b219d807253 100644 --- a/mkdocs-website/docs/en/changelog.md +++ b/mkdocs-website/docs/en/changelog.md @@ -73,6 +73,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The `@wailsio/runtime` package does not publish its API on the `window.wails` object, and does not start the WML system. This has been done to improve encapsulation. The WML system can be started manually if desired by calling the new `WML.Enable` method. The bundled JS runtime script still performs both operations automatically. By [@fbbdev](https://github.com/fbbdev) in [#3295](https://github.com/wailsapp/wails/pull/3295) - The Window API module `@wailsio/runtime/src/window` now exposes the containing window object as a default export. It is not possible anymore to import individual methods through ESM named or namespace import syntax. - The JS window API has been updated to match the current Go `WebviewWindow` API. Some methods have changed name or prototype, specifically: `Screen` becomes `GetScreen`; `GetZoomLevel`/`SetZoomLevel` become `GetZoom`/`SetZoom`; `GetZoom`, `Width` and `Height` now return values directly instead of wrapping them within objects. By [@fbbdev](https://github.com/fbbdev) in [#3295](https://github.com/wailsapp/wails/pull/3295) +- The binding generator now uses calls by ID by default. The `-id` CLI option has been removed. Use the `-names` CLI option to switch back to calls by name. By [@fbbdev](https://github.com/fbbdev) in [#3468](https://github.com/wailsapp/wails/pull/3468) +- New binding code layout: output files were previously organised in folders named after their containing package; now full Go import paths are used, including the module path. By [@fbbdev](https://github.com/fbbdev) in [#3468](https://github.com/wailsapp/wails/pull/3468) +- The struct field `application.Options.Bind` has been renamed to `application.Options.Services`. By [@fbbdev](https://github.com/fbbdev) in [#3468](https://github.com/wailsapp/wails/pull/3468) +- New syntax for binding services: service instances must now be wrapped in a call to `application.NewService`. By [@fbbdev](https://github.com/fbbdev) in [#3468](https://github.com/wailsapp/wails/pull/3468) ### Removed diff --git a/v3/Taskfile.yaml b/v3/Taskfile.yaml index 4c0d4e28d6f..14e35a504c0 100644 --- a/v3/Taskfile.yaml +++ b/v3/Taskfile.yaml @@ -3,6 +3,10 @@ version: "3" includes: + generator: + taskfile: ./internal/generator + dir: ./internal/generator + runtime: taskfile: ./internal/runtime dir: ./internal/runtime diff --git a/v3/cmd/wails3/main.go b/v3/cmd/wails3/main.go index 34920ae11fc..2dd96e49985 100644 --- a/v3/cmd/wails3/main.go +++ b/v3/cmd/wails3/main.go @@ -1,13 +1,15 @@ package main import ( - "github.com/pterm/pterm" - "github.com/samber/lo" "os" "runtime/debug" + "github.com/pterm/pterm" + "github.com/samber/lo" + "github.com/leaanthony/clir" "github.com/wailsapp/wails/v3/internal/commands" + "github.com/wailsapp/wails/v3/internal/flags" ) func init() { @@ -42,7 +44,13 @@ func main() { generate.NewSubCommandFunction("build-assets", "Generate build assets", commands.GenerateBuildAssets) generate.NewSubCommandFunction("icons", "Generate icons", commands.GenerateIcons) generate.NewSubCommandFunction("syso", "Generate Windows .syso file", commands.GenerateSyso) - generate.NewSubCommandFunction("bindings", "Generate bindings + models", commands.GenerateBindings) + bindgen := generate.NewSubCommand("bindings", "Generate bindings + models") + var bindgenFlags flags.GenerateBindingsOptions + bindgen.AddFlags(&bindgenFlags) + bindgen.Action(func() error { + return commands.GenerateBindings(&bindgenFlags, bindgen.OtherArgs()) + }) + bindgen.LongDescription("\nUsage: wails3 generate bindings [flags] [patterns...]\n\nPatterns match packages to scan for bound types.\nPattern format is analogous to that of the Go build tool,\ne.g. './...' matches packages in the current directory and all descendants.\nIf no pattern is given, the tool will fall back to the current directory.") generate.NewSubCommandFunction("constants", "Generate JS constants from Go", commands.GenerateConstants) generate.NewSubCommandFunction(".desktop", "Generate .desktop file", commands.GenerateDotDesktop) generate.NewSubCommandFunction("appimage", "Generate Linux AppImage", commands.GenerateAppImage) diff --git a/v3/examples/binding/GreetService.go b/v3/examples/binding/GreetService.go index 5913c3e525f..262fea72278 100644 --- a/v3/examples/binding/GreetService.go +++ b/v3/examples/binding/GreetService.go @@ -1,17 +1,39 @@ package main -import "github.com/wailsapp/wails/v3/examples/binding/data" +import ( + "strconv" + + "github.com/wailsapp/wails/v3/examples/binding/data" +) // GreetService is a service that greets people type GreetService struct { } // Greet greets a person -func (*GreetService) Greet(name string) string { - return "Hello " + name +func (*GreetService) Greet(name string, counts ...int) string { + times := " " + + for index, count := range counts { + if index > 0 { + times += ", " + } + times += strconv.Itoa(count) + } + + if len(counts) > 0 { + times += " times " + } + + return "Hello" + times + name } // GreetPerson greets a person -func (*GreetService) GreetPerson(person data.Person) string { - return "Hello " + person.Name +func (srv *GreetService) GreetPerson(person data.Person) string { + return srv.Greet(person.Name, person.Counts...) +} + +// GetPerson returns a person with the given name. +func (srv *GreetService) GetPerson(name string) data.Person { + return data.Person{Name: name} } diff --git a/v3/examples/binding/assets/bindings/data/models.js b/v3/examples/binding/assets/bindings/data/models.js deleted file mode 100644 index 0820a3947a3..00000000000 --- a/v3/examples/binding/assets/bindings/data/models.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -// Person holds someone's most important attributes -export const Person = class { - /** - * Creates a new Person instance. - * @constructor - * @param {Object} source - The source object to create the Person. - * @param {string} source.Name - */ - constructor(source = {}) { - const { name = "" } = source; - this.name = name; - } - - /** - * Creates a new Person instance from a string or object. - * @param {string|object} source - The source data to create a Person instance from. - * @returns {Person} A new Person instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/models.interfaces.ts b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/index.js similarity index 58% rename from v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/models.interfaces.ts rename to v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/index.js index 9470a494510..580fb67af27 100644 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/models.interfaces.ts +++ b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/index.js @@ -2,9 +2,4 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - street: string; - state: string; - country: string; -} +export * from "./models.js"; diff --git a/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/models.js b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/models.js new file mode 100644 index 00000000000..096e22d4f46 --- /dev/null +++ b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/data/models.js @@ -0,0 +1,53 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person holds someone's most important attributes + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("name" in $$source)) { + /** + * Name is the person's name + * @member + * @type {string} + */ + this["name"] = ""; + } + if (!("counts" in $$source)) { + /** + * Counts tracks the number of time the person + * has been greeted in various ways + * @member + * @type {number[]} + */ + this["counts"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType0; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("counts" in $$parsedSource) { + $$parsedSource["counts"] = $$createField1_0($$parsedSource["counts"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); diff --git a/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/greetservice.js b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/greetservice.js new file mode 100644 index 00000000000..f0a546781ca --- /dev/null +++ b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/greetservice.js @@ -0,0 +1,50 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is a service that greets people + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as data$0 from "./data/models.js"; + +/** + * GetPerson returns a person with the given name. + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function GetPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(2952413357, name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Greet greets a person + * @param {string} name + * @param {number[]} counts + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name, ...counts) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name, counts)); + return $resultPromise; +} + +/** + * GreetPerson greets a person + * @param {data$0.Person} person + * @returns {Promise & { cancel(): void }} + */ +export function GreetPerson(person) { + let $resultPromise = /** @type {any} */($Call.ByID(4021313248, person)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = data$0.Person.createFrom; diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/models.interfaces.ts b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/index.js similarity index 58% rename from v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/models.interfaces.ts rename to v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/index.js index 9470a494510..fdf1ff435a9 100644 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/models.interfaces.ts +++ b/v3/examples/binding/assets/bindings/github.com/wailsapp/wails/v3/examples/binding/index.js @@ -2,9 +2,7 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - street: string; - state: string; - country: string; -} +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/examples/binding/assets/bindings/main/GreetService.js b/v3/examples/binding/assets/bindings/main/GreetService.js deleted file mode 100644 index 468aca7c852..00000000000 --- a/v3/examples/binding/assets/bindings/main/GreetService.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '/wails/runtime.js'; -/** - * @typedef {import('../data/models').Person} dataPerson - */ - -/** - * Greet greets a person - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * GreetPerson greets a person - * @function GreetPerson - * @param person {dataPerson} - * @returns {Promise} - **/ -export async function GreetPerson(person) { - return Call.ByName("main.GreetService.GreetPerson", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/examples/binding/assets/index.html b/v3/examples/binding/assets/index.html index 53699e37f32..c86c7b7afe8 100644 --- a/v3/examples/binding/assets/index.html +++ b/v3/examples/binding/assets/index.html @@ -79,16 +79,52 @@
+
diff --git a/v3/examples/binding/data/person.go b/v3/examples/binding/data/person.go index b57dd5c1e55..114dfdf4c6f 100644 --- a/v3/examples/binding/data/person.go +++ b/v3/examples/binding/data/person.go @@ -4,4 +4,8 @@ package data type Person struct { // Name is the person's name Name string `json:"name"` + + // Counts tracks the number of time the person + // has been greeted in various ways + Counts []int `json:"counts"` } diff --git a/v3/examples/binding/main.go b/v3/examples/binding/main.go index fcb516ce28b..29666a703ac 100644 --- a/v3/examples/binding/main.go +++ b/v3/examples/binding/main.go @@ -2,7 +2,6 @@ package main import ( "embed" - _ "embed" "log" "github.com/wailsapp/wails/v3/pkg/application" @@ -13,8 +12,8 @@ var assets embed.FS func main() { app := application.New(application.Options{ - Bind: []any{ - &GreetService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), }, Assets: application.AssetOptions{ Handler: application.BundledAssetFileServer(assets), diff --git a/v3/go.mod b/v3/go.mod index fe490577d89..2c78bdc48ba 100644 --- a/v3/go.mod +++ b/v3/go.mod @@ -31,7 +31,8 @@ require ( github.com/tc-hib/winres v0.1.6 github.com/wailsapp/go-webview2 v1.0.9 github.com/wailsapp/mimetype v1.4.1 - golang.org/x/sys v0.19.0 + golang.org/x/sys v0.20.0 + golang.org/x/tools v0.21.0 modernc.org/sqlite v1.21.0 ) @@ -80,15 +81,14 @@ require ( github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect - golang.org/x/crypto v0.21.0 // indirect + golang.org/x/crypto v0.23.0 // indirect golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect golang.org/x/image v0.15.0 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/term v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/v3/go.sum b/v3/go.sum index e2b1eb14c63..600a933309c 100644 --- a/v3/go.sum +++ b/v3/go.sum @@ -241,8 +241,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -251,8 +251,8 @@ golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -262,8 +262,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -293,8 +293,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -302,8 +302,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -311,14 +311,14 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= +golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/v3/internal/assetserver/bundledassets/runtime.debug.js b/v3/internal/assetserver/bundledassets/runtime.debug.js index 8ebb355cbea..cb114e8ec9f 100644 --- a/v3/internal/assetserver/bundledassets/runtime.debug.js +++ b/v3/internal/assetserver/bundledassets/runtime.debug.js @@ -11,6 +11,7 @@ __export(src_exports, { Browser: () => browser_exports, Call: () => calls_exports, Clipboard: () => clipboard_exports, + Create: () => create_exports, Dialogs: () => dialogs_exports, Events: () => events_exports, Flags: () => flags_exports, @@ -379,8 +380,7 @@ var Listener = class { this.maxCallbacks = maxCallbacks || -1; this.Callback = (data) => { callback(data); - if (this.maxCallbacks === -1) - return false; + if (this.maxCallbacks === -1) return false; this.maxCallbacks -= 1; return this.maxCallbacks === 0; }; @@ -399,15 +399,12 @@ function dispatchWailsEvent(event) { if (listeners) { let toRemove = listeners.filter((listener) => { let remove = listener.Callback(event); - if (remove) - return true; + if (remove) return true; }); if (toRemove.length > 0) { listeners = listeners.filter((l) => !toRemove.includes(l)); - if (listeners.length === 0) - eventListeners.delete(event.name); - else - eventListeners.set(event.name, listeners); + if (listeners.length === 0) eventListeners.delete(event.name); + else eventListeners.set(event.name, listeners); } } } @@ -427,10 +424,8 @@ function Once(eventName, callback) { function listenerOff(listener) { const eventName = listener.eventName; let listeners = eventListeners.get(eventName).filter((l) => l !== listener); - if (listeners.length === 0) - eventListeners.delete(eventName); - else - eventListeners.set(eventName, listeners); + if (listeners.length === 0) eventListeners.delete(eventName); + else eventListeners.set(eventName, listeners); } function Off(eventName, ...additionalEventNames) { let eventsToRemove = [eventName, ...additionalEventNames]; @@ -859,8 +854,8 @@ var Window = class _Window { * @param {boolean} resizable - Whether the window should be resizable * @return {Promise} */ - SetResizable(resizable) { - return this[caller](SetResizableMethod, { resizable: resizable }); + SetResizable(resizable2) { + return this[caller](SetResizableMethod, { resizable: resizable2 }); } /** * Sets the size of the window. @@ -1347,22 +1342,14 @@ function onMouseMove(e) { let bottomCorner = window.outerHeight - e.clientY < resizeHandleHeight + cornerExtra; if (!leftBorder && !rightBorder && !topBorder && !bottomBorder && resizeEdge !== void 0) { setResize(); - } else if (rightCorner && bottomCorner) - setResize("se-resize"); - else if (leftCorner && bottomCorner) - setResize("sw-resize"); - else if (leftCorner && topCorner) - setResize("nw-resize"); - else if (topCorner && rightCorner) - setResize("ne-resize"); - else if (leftBorder) - setResize("w-resize"); - else if (topBorder) - setResize("n-resize"); - else if (bottomBorder) - setResize("s-resize"); - else if (rightBorder) - setResize("e-resize"); + } else if (rightCorner && bottomCorner) setResize("se-resize"); + else if (leftCorner && bottomCorner) setResize("sw-resize"); + else if (leftCorner && topCorner) setResize("nw-resize"); + else if (topCorner && rightCorner) setResize("ne-resize"); + else if (leftBorder) setResize("w-resize"); + else if (topBorder) setResize("n-resize"); + else if (bottomBorder) setResize("s-resize"); + else if (rightBorder) setResize("e-resize"); } // desktop/@wailsio/runtime/src/application.js @@ -1456,14 +1443,8 @@ function callBinding(type, options = {}) { function Call(options) { return callBinding(CallBinding, options); } -function ByName(name, ...args) { - if (typeof name !== "string" || name.split(".").length !== 3) { - throw new Error("CallByName requires a string in the format 'package.struct.method'"); - } - let [packageName, structName, methodName] = name.split("."); +function ByName(methodName, ...args) { return callBinding(CallBinding, { - packageName, - structName, methodName, args }); @@ -1499,6 +1480,83 @@ function Text() { return call8(ClipboardText); } +// desktop/@wailsio/runtime/src/create.js +var create_exports = {}; +__export(create_exports, { + Any: () => Any, + Array: () => Array, + ByteSlice: () => ByteSlice, + Map: () => Map2, + Nullable: () => Nullable, + Struct: () => Struct +}); +function Any(source) { + return ( + /** @type {T} */ + source + ); +} +function ByteSlice(source) { + return ( + /** @type {any} */ + source == null ? "" : source + ); +} +function Array(element) { + if (element === Any) { + return (source) => source === null ? [] : source; + } + return (source) => { + if (source === null) { + return []; + } + for (let i = 0; i < source.length; i++) { + source[i] = element(source[i]); + } + return source; + }; +} +function Map2(key, value) { + if (value === Any) { + return (source) => source === null ? {} : source; + } + return (source) => { + if (source === null) { + return {}; + } + for (const key2 in source) { + source[key2] = value(source[key2]); + } + return source; + }; +} +function Nullable(element) { + if (element === Any) { + return Any; + } + return (source) => source === null ? null : element(source); +} +function Struct(createField) { + let allAny = true; + for (const name in createField) { + if (createField[name] !== Any) { + allAny = false; + break; + } + } + if (allAny) { + return Any; + } + return (source) => { + for (const name in createField) { + if (name in source) { + source[name] = createField[name](source[name]); + } + } + return source; + }; +} + // desktop/@wailsio/runtime/src/screens.js var screens_exports = {}; __export(screens_exports, { @@ -1529,6 +1587,7 @@ export { browser_exports as Browser, calls_exports as Call, clipboard_exports as Clipboard, + create_exports as Create, dialogs_exports as Dialogs, events_exports as Events, flags_exports as Flags, @@ -1537,4 +1596,4 @@ export { wml_exports as WML, window_default as Window }; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vcnVudGltZS9kZXNrdG9wL0B3YWlsc2lvL3J1bnRpbWUvc3JjL2luZGV4LmpzIiwgIi4uLy4uL3J1bnRpbWUvZGVza3RvcC9Ad2FpbHNpby9ydW50aW1lL3NyYy93bWwuanMiLCAiLi4vLi4vcnVudGltZS9kZXNrdG9wL0B3YWlsc2lvL3J1bnRpbWUvc3JjL2Jyb3dzZXIuanMiLCAiLi4vLi4vcnVudGltZS9kZXNrdG9wL0B3YWlsc2lvL3J1bnRpbWUvbm9kZV9tb2R1bGVzL25hbm9pZC9ub24tc2VjdXJlL2luZGV4LmpzIiwgIi4uLy4uL3J1bnRpbWUvZGVza3RvcC9Ad2FpbHNpby9ydW50aW1lL3NyYy9ydW50aW1lLmpzIiwgIi4uLy4uL3J1bnRpbWUvZGVza3RvcC9Ad2FpbHNpby9ydW50aW1lL3NyYy9kaWFsb2dzLmpzIiwgIi4uLy4uL3J1bnRpbWUvZGVza3RvcC9Ad2FpbHNpby9ydW50aW1lL3NyYy9ldmVudHMuanMiLCAiLi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QsIHdpbmRvd05hbWUsIGFyZ3MpO1xuICAgIH07XG59XG5cblxuZnVuY3Rpb24gcnVudGltZUNhbGwobWV0aG9kLCB3aW5kb3dOYW1lLCBhcmdzKSB7XG4gICAgbGV0IHVybCA9IG5ldyBVUkwocnVudGltZVVSTCk7XG4gICAgaWYoIG1ldGhvZCApIHtcbiAgICAgICAgdXJsLnNlYXJjaFBhcmFtcy5hcHBlbmQoXCJtZXRob2RcIiwgbWV0aG9kKTtcbiAgICB9XG4gICAgbGV0IGZldGNoT3B0aW9ucyA9IHtcbiAgICAgICAgaGVhZGVyczoge30sXG4gICAgfTtcbiAgICBpZiAod2luZG93TmFtZSkge1xuICAgICAgICBmZXRjaE9wdGlvbnMuaGVhZGVyc1tcIngtd2FpbHMtd2luZG93LW5hbWVcIl0gPSB3aW5kb3dOYW1lO1xuICAgIH1cbiAgICBpZiAoYXJncykge1xuICAgICAgICB1cmwuc2VhcmNoUGFyYW1zLmFwcGVuZChcImFyZ3NcIiwgSlNPTi5zdHJpbmdpZnkoYXJncykpO1xuICAgIH1cbiAgICBmZXRjaE9wdGlvbnMuaGVhZGVyc1tcIngtd2FpbHMtY2xpZW50LWlkXCJdID0gY2xpZW50SWQ7XG5cbiAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICBmZXRjaCh1cmwsIGZldGNoT3B0aW9ucylcbiAgICAgICAgICAgIC50aGVuKHJlc3BvbnNlID0+IHtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2Uub2spIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gY2hlY2sgY29udGVudCB0eXBlXG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS5oZWFkZXJzLmdldChcIkNvbnRlbnQtVHlwZVwiKSAmJiByZXNwb25zZS5oZWFkZXJzLmdldChcIkNvbnRlbnQtVHlwZVwiKS5pbmRleE9mKFwiYXBwbGljYXRpb24vanNvblwiKSAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXNwb25zZS5qc29uKCk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2UudGV4dCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlamVjdChFcnJvcihyZXNwb25zZS5zdGF0dXNUZXh0KSk7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgLnRoZW4oZGF0YSA9PiByZXNvbHZlKGRhdGEpKVxuICAgICAgICAgICAgLmNhdGNoKGVycm9yID0+IHJlamVjdChlcnJvcikpO1xuICAgIH0pO1xufVxuXG5mdW5jdGlvbiBydW50aW1lQ2FsbFdpdGhJRChvYmplY3RJRCwgbWV0aG9kLCB3aW5kb3dOYW1lLCBhcmdzKSB7XG4gICAgbGV0IHVybCA9IG5ldyBVUkwocnVudGltZVVSTCk7XG4gICAgdXJsLnNlYXJjaFBhcmFtcy5hcHBlbmQoXCJvYmplY3RcIiwgb2JqZWN0SUQpO1xuICAgIHVybC5zZWFyY2hQYXJhbXMuYXBwZW5kKFwibWV0aG9kXCIsIG1ldGhvZCk7XG4gICAgbGV0IGZldGNoT3B0aW9ucyA9IHtcbiAgICAgICAgaGVhZGVyczoge30sXG4gICAgfTtcbiAgICBpZiAod2luZG93TmFtZSkge1xuICAgICAgICBmZXRjaE9wdGlvbnMuaGVhZGVyc1tcIngtd2FpbHMtd2luZG93LW5hbWVcIl0gPSB3aW5kb3dOYW1lO1xuICAgIH1cbiAgICBpZiAoYXJncykge1xuICAgICAgICB1cmwuc2VhcmNoUGFyYW1zLmFwcGVuZChcImFyZ3NcIiwgSlNPTi5zdHJpbmdpZnkoYXJncykpO1xuICAgIH1cbiAgICBmZXRjaE9wdGlvbnMuaGVhZGVyc1tcIngtd2FpbHMtY2xpZW50LWlkXCJdID0gY2xpZW50SWQ7XG4gICAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+IHtcbiAgICAgICAgZmV0Y2godXJsLCBmZXRjaE9wdGlvbnMpXG4gICAgICAgICAgICAudGhlbihyZXNwb25zZSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlLm9rKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIGNvbnRlbnQgdHlwZVxuICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UuaGVhZGVycy5nZXQoXCJDb250ZW50LVR5cGVcIikgJiYgcmVzcG9uc2UuaGVhZGVycy5nZXQoXCJDb250ZW50LVR5cGVcIikuaW5kZXhPZihcImFwcGxpY2F0aW9uL2pzb25cIikgIT09IC0xKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2UuanNvbigpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlLnRleHQoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZWplY3QoRXJyb3IocmVzcG9uc2Uuc3RhdHVzVGV4dCkpO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIC50aGVuKGRhdGEgPT4gcmVzb2x2ZShkYXRhKSlcbiAgICAgICAgICAgIC5jYXRjaChlcnJvciA9PiByZWplY3QoZXJyb3IpKTtcbiAgICB9KTtcbn1cbiIsICIvKlxuIF9cdCAgIF9fXHQgIF8gX19cbnwgfFx0IC8gL19fXyBfKF8pIC9fX19fXG58IHwgL3wgLyAvIF9fIGAvIC8gLyBfX18vXG58IHwvIHwvIC8gL18vIC8gLyAoX18gIClcbnxfXy98X18vXFxfXyxfL18vXy9fX19fL1xuVGhlIGVsZWN0cm9uIGFsdGVybmF0aXZlIGZvciBHb1xuKGMpIExlYSBBbnRob255IDIwMTktcHJlc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ZXRob2QgICAgICAgICAgICAgICAgICAgICAgID0gMjtcbmNvbnN0IERpc2FibGVTaXplQ29uc3RyYWludHNNZXRob2QgICAgICA9IDM7XG5jb25zdCBFbmFibGVTaXplQ29uc3RyYWludHNNZXRob2QgICAgICAgPSA0O1xuY29uc3QgRm9jdXNNZXRob2QgICAgICAgICAgICAgICAgICAgICAgID0gNTtcbmNvbnN0IEZvcmNlUmVsb2FkTWV0aG9kICAgICAgICAgICAgICAgICA9IDY7XG5jb25zdCBGdWxsc2NyZWVuTWV0aG9kICAgICAgICAgICAgICAgICAgPSA3O1xuY29uc3QgR2V0U2NyZWVuTWV0aG9kICAgICAgICAgICAgICAgICAgID0gODtcbmNvbnN0IEdldFpvb21NZXRob2QgICAgICAgICAgICAgICAgICAgICA9IDk7XG5jb25zdCBIZWlnaHRNZXRob2QgICAgICAgICAgICAgICAgICAgICAgPSAxMDtcbmNvbnN0IEhpZGVNZXRob2QgICAgICAgICAgICAgICAgICAgICAgICA9IDExO1xuY29uc3QgSXNGb2N1c2VkTWV0aG9kICAgICAgICAgICAgICAgICAgID0gMTI7XG5jb25zdCBJc0Z1bGxzY3JlZW5NZXRob2QgICAgICAgICAgICAgICAgPSAxMztcbmNvbnN0IElzTWF4aW1pc2VkTWV0aG9kICAgICAgICAgICAgICAgICA9IDE0O1xuY29uc3QgSXNNaW5pbWlzZWRNZXRob2QgICAgICAgICAgICAgICAgID0gMTU7XG5jb25zdCBNYXhpbWlzZU1ldGhvZCAgICAgICAgICAgICAgICAgICAgPSAxNjtcbmNvbnN0IE1pbmltaXNlTWV0aG9kICAgICAgICAgICAgICAgICAgICA9IDE3O1xuY29uc3QgTmFtZU1ldGhvZCAgICAgICAgICAgICAgICAgICAgICAgID0gMTg7XG5jb25zdCBPcGVuRGV2VG9vbHNNZXRob2QgICAgICAgICAgICAgICAgPSAxOTtcbmNvbnN0IFJlbGF0aXZlUG9zaXRpb25NZXRob2QgICAgICAgICAgICA9IDIwO1xuY29uc3QgUmVsb2FkTWV0aG9kICAgICAgICAgICAgICAgICAgICAgID0gMjE7XG5jb25zdCBSZXNpemFibGVNZXRob2QgICAgICAgICAgICAgICAgICAgPSAyMjtcbmNvbnN0IFJlc3RvcmVNZXRob2QgICAgICAgICAgICAgICAgICAgICA9IDIzO1xuY29uc3QgU2V0QWJzb2x1dGVQb3NpdGlvbk1ldGhvZCAgICAgICAgID0gMjQ7XG5jb25zdCBTZXRBbHdheXNPblRvcE1ldGhvZCAgICAgICAgICAgICAgPSAyNTtcbmNvbnN0IFNldEJhY2tncm91bmRDb2xvdXJNZXRob2QgICAgICAgICA9IDI2O1xuY29uc3QgU2V0RnJhbWVsZXNzTWV0aG9kICAgICAgICAgICAgICAgID0gMjc7XG5jb25zdCBTZXRGdWxsc2NyZWVuQnV0dG9uRW5hYmxlZE1ldGhvZCAgPSAyODtcbmNvbnN0IFNldE1heFNpemVNZXRob2QgICAgICAgICAgICAgICAgICA9IDI5O1xuY29uc3QgU2V0TWluU2l6ZU1ldGhvZCAgICAgICAgICAgICAgICAgID0gMzA7XG5jb25zdCBTZXRSZWxhdGl2ZVBvc2l0aW9uTWV0aG9kICAgICAgICAgPSAzMTtcbmNvbnN0IFNldFJlc2l6YWJsZU1ldGhvZCAgICAgICAgICAgICAgICA9IDMyO1xuY29uc3QgU2V0U2l6ZU1ldGhvZCAgICAgICAgICAgICAgICAgICAgID0gMzM7XG5jb25zdCBTZXRUaXRsZU1ldGhvZCAgICAgICAgICAgICAgICAgICAgPSAzNDtcbmNvbnN0IFNldFpvb21NZXRob2QgICAgICAgICAgICAgICAgICAgICA9IDM1O1xuY29uc3QgU2hvd01ldGhvZCAgICAgICAgICAgICAgICAgICAgICAgID0gMzY7XG5jb25zdCBTaXplTWV0aG9kICAgICAgICAgICAgICAgICAgICAgICAgPSAzNztcbmNvbnN0IFRvZ2dsZUZ1bGxzY3JlZW5NZXRob2QgICAgICAgICAgICA9IDM4O1xuY29uc3QgVG9nZ2xlTWF4aW1pc2VNZXRob2QgICAgICAgICAgICAgID0gMzk7XG5jb25zdCBVbkZ1bGxzY3JlZW5NZXRob2QgICAgICAgICAgICAgICAgPSA0MDtcbmNvbnN0IFVuTWF4aW1pc2VNZXRob2QgICAgICAgICAgICAgICAgICA9IDQxO1xuY29uc3QgVW5NaW5pbWlzZU1ldGhvZCAgICAgICAgICAgICAgICAgID0gNDI7XG5jb25zdCBXaWR0aE1ldGhvZCAgICAgICAgICAgICAgICAgICAgICAgPSA0MztcbmNvbnN0IFpvb21NZXRob2QgICAgICAgICAgICAgICAgICAgICAgICA9IDQ0O1xuY29uc3QgWm9vbUluTWV0aG9kICAgICAgICAgICAgICAgICAgICAgID0gNDU7XG5jb25zdCBab29tT3V0TWV0aG9kICAgICAgICAgICAgICAgICAgICAgPSA0NjtcbmNvbnN0IFpvb21SZXNldE1ldGhvZCAgICAgICAgICAgICAgICAgICA9IDQ3O1xuXG4vKipcbiAqIEB0eXBlIHtzeW1ib2x9XG4gKi9cbmNvbnN0IGNhbGxlciA9IFN5bWJvbCgpO1xuXG5jbGFzcyBXaW5kb3cge1xuICAgIC8qKlxuICAgICAqIEluaXRpYWxpc2VzIGEgd2luZG93IG9iamVjdCB3aXRoIHRoZSBzcGVjaWZpZWQgbmFtZS5cbiAgICAgKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IG5hbWUgLSBUaGUgbmFtZSBvZiB0aGUgdGFyZ2V0IHdpbmRvdy5cbiAgICAgKi9cbiAgICBjb25zdHJ1Y3RvcihuYW1lID0gJycpIHtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBwcml2YXRlXG4gICAgICAgICAqIEBuYW1lIHtAbGluayBjYWxsZXJ9XG4gICAgICAgICAqIEB0eXBlIHsoLi4uYXJnczogYW55W10pID0+IGFueX1cbiAgICAgICAgICovXG4gICAgICAgIHRoaXNbY2FsbGVyXSA9IG5ld1J1bnRpbWVDYWxsZXJXaXRoSUQob2JqZWN0TmFtZXMuV2luZG93LCB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xuICAgICAqL1xuICAgIEFic29sdXRlUG9zaXRpb24oKSB7XG4gICAgICAgIHJldHVybiB0aGlzW2NhbGxlcl0oQWJzb2x1dGVQb3NpdGlvbk1ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ2VudGVycyB0aGUgd2luZG93IG9uIHRoZSBzY3JlZW4uXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTx2b2lkPn1cbiAgICAgKi9cbiAgICBDZW50ZXIoKSB7XG4gICAgICAgIHJldHVybiB0aGlzW2NhbGxlcl0oQ2VudGVyTWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDbG9zZXMgdGhlIHdpbmRvdy5cbiAgICAgKlxuICAgICAqIEBwdWJsaWNcbiAgICAgKiBAcmV0dXJuIHtQcm9taXNlPHZvaWQ+fVxuICAgICAqL1xuICAgIENsb3NlKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKENsb3NlTWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBEaXNhYmxlcyBtaW4vbWF4IHNpemUgY29uc3RyYWludHMuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTx2b2lkPn1cbiAgICAgKi9cbiAgICBEaXNhYmxlU2l6ZUNvbnN0cmFpbnRzKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKERpc2FibGVTaXplQ29uc3RyYWludHNNZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEVuYWJsZXMgbWluL21heCBzaXplIGNvbnN0cmFpbnRzLlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgRW5hYmxlU2l6ZUNvbnN0cmFpbnRzKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKEVuYWJsZVNpemVDb25zdHJhaW50c01ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogRm9jdXNlcyB0aGUgd2luZG93LlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgRm9jdXMoKSB7XG4gICAgICAgIHJldHVybiB0aGlzW2NhbGxlcl0oRm9jdXNNZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEZvcmNlcyB0aGUgd2luZG93IHRvIHJlbG9hZCB0aGUgcGFnZSBhc3NldHMuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTx2b2lkPn1cbiAgICAgKi9cbiAgICBGb3JjZVJlbG9hZCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShGb3JjZVJlbG9hZE1ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogRG9jLlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgRnVsbHNjcmVlbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShGdWxsc2NyZWVuTWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRoZSBzY3JlZW4gdGhhdCB0aGUgd2luZG93IGlzIG9uLlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8U2NyZWVuPn0gLSBUaGUgc2NyZWVuIHRoZSB3aW5kb3cgaXMgY3VycmVudGx5IG9uXG4gICAgICovXG4gICAgR2V0U2NyZWVuKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKEdldFNjcmVlbk1ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyB0aGUgY3VycmVudCB6b29tIGxldmVsIG9mIHRoZSB3aW5kb3cuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTxudW1iZXI+fSAtIFRoZSBjdXJyZW50IHpvb20gbGV2ZWxcbiAgICAgKi9cbiAgICBHZXRab29tKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKEdldFpvb21NZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIGhlaWdodCBvZiB0aGUgd2luZG93LlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8bnVtYmVyPn0gLSBUaGUgY3VycmVudCBoZWlnaHQgb2YgdGhlIHdpbmRvd1xuICAgICAqL1xuICAgIEhlaWdodCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShIZWlnaHRNZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEhpZGVzIHRoZSB3aW5kb3cuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTx2b2lkPn1cbiAgICAgKi9cbiAgICBIaWRlKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKEhpZGVNZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdHJ1ZSBpZiB0aGUgd2luZG93IGlzIGZvY3VzZWQuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTxib29sZWFuPn0gLSBXaGV0aGVyIHRoZSB3aW5kb3cgaXMgY3VycmVudGx5IGZvY3VzZWRcbiAgICAgKi9cbiAgICBJc0ZvY3VzZWQoKSB7XG4gICAgICAgIHJldHVybiB0aGlzW2NhbGxlcl0oSXNGb2N1c2VkTWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRydWUgaWYgdGhlIHdpbmRvdyBpcyBmdWxsc2NyZWVuLlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8Ym9vbGVhbj59IC0gV2hldGhlciB0aGUgd2luZG93IGlzIGN1cnJlbnRseSBmdWxsc2NyZWVuXG4gICAgICovXG4gICAgSXNGdWxsc2NyZWVuKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKElzRnVsbHNjcmVlbk1ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyB0cnVlIGlmIHRoZSB3aW5kb3cgaXMgbWF4aW1pc2VkLlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8Ym9vbGVhbj59IC0gV2hldGhlciB0aGUgd2luZG93IGlzIGN1cnJlbnRseSBtYXhpbWlzZWRcbiAgICAgKi9cbiAgICBJc01heGltaXNlZCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShJc01heGltaXNlZE1ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyB0cnVlIGlmIHRoZSB3aW5kb3cgaXMgbWluaW1pc2VkLlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8Ym9vbGVhbj59IC0gV2hldGhlciB0aGUgd2luZG93IGlzIGN1cnJlbnRseSBtaW5pbWlzZWRcbiAgICAgKi9cbiAgICBJc01pbmltaXNlZCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShJc01pbmltaXNlZE1ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogTWF4aW1pc2VzIHRoZSB3aW5kb3cuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTx2b2lkPn1cbiAgICAgKi9cbiAgICBNYXhpbWlzZSgpIHtcbiAgIC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AgKiBab29tcyB0aGUgd2luZG93LlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgWm9vbSgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShab29tTWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBJbmNyZWFzZXMgdGhlIHpvb20gbGV2ZWwgb2YgdGhlIHdlYnZpZXcgY29udGVudC5cbiAgICAgKlxuICAgICAqIEBwdWJsaWNcbiAgICAgKiBAcmV0dXJuIHtQcm9taXNlPHZvaWQ+fVxuICAgICAqL1xuICAgIFpvb21JbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShab29tSW5NZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIERlY3JlYXNlcyB0aGUgem9vbSBsZXZlbCBvZiB0aGUgd2VidmlldyBjb250ZW50LlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgWm9vbU91dCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShab29tT3V0TWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXNldHMgdGhlIHpvb20gbGV2ZWwgb2YgdGhlIHdlYnZpZXcgY29udGVudC5cbiAgICAgKlxuICAgICAqIEBwdWJsaWNcbiAgICAgKiBAcmV0dXJuIHtQcm9taXNlPHZvaWQ+fVxuICAgICAqL1xuICAgIFpvb21SZXNldCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShab29tUmVzZXRNZXRob2QpO1xuICAgIH1cbn1cblxuLyoqXG4gKiBUaGUgd2luZG93IHdpdGhpbiB3aGljaCB0aGUgc2NyaXB0IGlzIHJ1bm5pbmcuXG4gKlxuICogQHR5cGUge1dpbmRvd31cbiAqL1xuY29uc3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ZhdWx0OlxuICAgICAgICAgICAgLy8gQ2hlY2sgaWYgY29udGVudEVkaXRhYmxlIGlzIHRydWVcbiAgICAgICAgICAgIGlmIChlbGVtZW50LmlzQ29udGVudEVkaXRhYmxlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBDaGVjayBpZiB0ZXh0IGhhcyBiZWVuIHNlbGVjdGVkXG4gICAgICAgICAgICBjb25zdCBzZWxlY3Rpb24gPSB3aW5kb3cuZ2V0U2VsZWN0aW9uKCk7XG4gICAgICAgICAgICBjb25zdCBoYXNTZWxlY3Rpb24gPSAoc2VsZWN0aW9uLnRvU3RyaW5nKCkubGVuZ3RoID4gMClcbiAgICAgICAgICAgIGlmIChoYXNTZWxlY3Rpb24pIHtcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHNlbGVjdGlvbi5yYW5nZUNvdW50OyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcmFuZ2UgPSBzZWxlY3Rpb24uZ2V0UmFuZ2VBdChpKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcmVjdHMgPSByYW5nZS5nZXRDbGllbnRSZWN0cygpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IHJlY3RzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCByZWN0ID0gcmVjdHNbal07XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQuZWxlbWVudEZyb21Qb2ludChyZWN0LmxlZnQsIHJlY3QudG9wKSA9PT0gZWxlbWVudCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIENo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tcIngtd2FpbHMtY2xpZW50LWlkXCJdID0gY2xpZW50SWQ7XG5cbiAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICBmZXRjaCh1cmwsIGZldGNoT3B0aW9ucylcbiAgICAgICAgICAgIC50aGVuKHJlc3BvbnNlID0+IHtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2Uub2spIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gY2hlY2sgY29udGVudCB0eXBlXG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS5oZWFkZXJzLmdldChcIkNvbnRlbnQtVHlwZVwiKSAmJiByZXNwb25zZS5oZWFkZXJzLmdldChcIkNvbnRlbnQtVHlwZVwiKS5pbmRleE9mKFwiYXBwbGljYXRpb24vanNvblwiKSAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXNwb25zZS5qc29uKCk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2UudGV4dCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlamVjdChFcnJvcihyZXNwb25zZS5zdGF0dXNUZXh0KSk7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgLnRoZW4oZGF0YSA9PiByZXNvbHZlKGRhdGEpKVxuICAgICAgICAgICAgLmNhdGNoKGVycm9yID0+IHJlamVjdChlcnJvcikpO1xuICAgIH0pO1xufVxuXG5mdW5jdGlvbiBydW50aW1lQ2FsbFdpdGhJRChvYmplY3RJRCwgbWV0aG9kLCB3aW5kb3dOYW1lLCBhcmdzKSB7XG4gICAgbGV0IHVybCA9IG5ldyBVUkwocnVudGltZVVSTCk7XG4gICAgdXJsLnNlYXJjaFBhcmFtcy5hcHBlbmQoXCJvYmplY3RcIiwgb2JqZWN0SUQpO1xuICAgIHVybC5zZWFyY2hQYXJhbXMuYXBwZW5kKFwibWV0aG9kXCIsIG1ldGhvZCk7XG4gICAgbGV0IGZldGNoT3B0aW9ucyA9IHtcbiAgICAgICAgaGVhZGVyczoge30sXG4gICAgfTtcbiAgICBpZiAod2luZG93TmFtZSkge1xuICAgICAgICBmZXRjaE9wdGlvbnMuaGVhZGVyc1tcIngtd2FpbHMtd2luZG93LW5hbWVcIl0gPSB3aW5kb3dOYW1lO1xuICAgIH1cbiAgICBpZiAoYXJncykge1xuICAgICAgICB1cmwuc2VhcmNoUGFyYW1zLmFwcGVuZChcImFyZ3NcIiwgSlNPTi5zdHJpbmdpZnkoYXJncykpO1xuICAgIH1cbiAgICBmZXRjaE9wdGlvbnMuaGVhZGVyc1tcIngtd2FpbHMtY2xpZW50LWlkXCJdID0gY2xpZW50SWQ7XG4gICAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+IHtcbiAgICAgICAgZmV0Y2godXJsLCBmZXRjaE9wdGlvbnMpXG4gICAgICAgICAgICAudGhlbihyZXNwb25zZSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlLm9rKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIGNvbnRlbnQgdHlwZVxuICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UuaGVhZGVycy5nZXQoXCJDb250ZW50LVR5cGVcIikgJiYgcmVzcG9uc2UuaGVhZGVycy5nZXQoXCJDb250ZW50LVR5cGVcIikuaW5kZXhPZihcImFwcGxpY2F0aW9uL2pzb25cIikgIT09IC0xKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2UuanNvbigpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlLnRleHQoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgIC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BkZXNjcmliaW5nIHRoZSBzaXplIG9mIGEgd2luZG93LlxuICpcbiAqIEB0eXBlZGVmIHtPYmplY3R9IFNpemVcbiAqIEBwcm9wZXJ0eSB7bnVtYmVyfSB3aWR0aCAtIFRoZSB3aWR0aCBvZiB0aGUgd2luZG93XG4gKiBAcHJvcGVydHkge251bWJlcn0gaGVpZ2h0IC0gVGhlIGhlaWdodCBvZiB0aGUgd2luZG93XG4gKi9cblxuXG5pbXBvcnQge25ld1J1bnRpbWVDYWxsZXJXaXRoSUQsIG9iamVjdE5hbWVzfSBmcm9tIFwiLi9ydW50aW1lXCI7XG5cbmNvbnN0IEFic29sdXRlUG9zaXRpb25NZXRob2QgICAgICAgICAgICA9IDA7XG5jb25zdCBDZW50ZXJNZXRob2QgICAgICAgICAgICAgICAgICAgICAgPSAxO1xuY29uc3QgQ2xvc2VNZXRob2QgICAgICAgICAgICAgICAgICAgICAgID0gMjtcbmNvbnN0IERpc2FibGVTaXplQ29uc3RyYWludHNNZXRob2QgICAgICA9IDM7XG5jb25zdCBFbmFibGVTaXplQ29uc3RyYWludHNNZXRob2QgICAgICAgPSA0O1xuY29uc3QgRm9jdXNNZXRob2QgICAgICAgICAgICAgICAgICAgICAgID0gNTtcbmNvbnN0IEZvcmNlUmVsb2FkTWV0aG9kICAgICAgICAgICAgICAgICA9IDY7XG5jb25zdCBGdWxsc2NyZWVuTWV0aG9kICAgICAgICAgICAgICAgICAgPSA3O1xuY29uc3QgR2V0U2NyZWVuTWV0aG9kICAgICAgICAgICAgICAgICAgID0gODtcbmNvbnN0IEdldFpvb21NZXRob2QgICAgICAgICAgICAgICAgICAgICA9IDk7XG5jb25zdCBIZWlnaHRNZXRob2QgICAgICAgICAgICAgICAgICAgICAgPSAxMDtcbmNvbnN0IEhpZGVNZXRob2QgICAgICAgICAgICAgICAgICAgICAgICA9IDExO1xuY29uc3QgSXNGb2N1c2VkTWV0aG9kICAgICAgICAgICAgICAgICAgID0gMTI7XG5jb25zdCBJc0Z1bGxzY3JlZW5NZXRob2QgICAgICAgICAgICAgICAgPSAxMztcbmNvbnN0IElzTWF4aW1pc2VkTWV0aG9kICAgICAgICAgICAgICAgICA9IDE0O1xuY29uc3QgSXNNaW5pbWlzZWRNZXRob2QgICAgICAgICAgICAgICAgID0gMTU7XG5jb25zdCBNYXhpbWlzZU1ldGhvZCAgICAgICAgICAgICAgICAgICAgPSAxNjtcbmNvbnN0IE1pbmltaXNlTWV0aG9kICAgICAgICAgICAgICAgICAgICA9IDE3O1xuY29uc3QgTmFtZU1ldGhvZCAgICAgICAgICAgICAgICAgICAgICAgID0gMTg7XG5jb25zdCBPcGVuRGV2VG9vbHNNZXRob2QgICAgICAgICAgICAgICAgPSAxOTtcbmNvbnN0IFJlbGF0aXZlUG9zaXRpb25NZXRob2QgICAgICAgICAgICA9IDIwO1xuY29uc3QgUmVsb2FkTWV0aG9kICAgICAgICAgICAgICAgICAgICAgID0gMjE7XG5jb25zdCBSZXNpemFibGVNZXRob2QgICAgICAgICAgICAgICAgICAgPSAyMjtcbmNvbnN0IFJlc3RvcmVNZXRob2QgICAgICAgICAgICAgICAgICAgICA9IDIzO1xuY29uc3QgU2V0QWJzb2x1dGVQb3NpdGlvbk1ldGhvZCAgICAgICAgID0gMjQ7XG5jb25zdCBTZXRBbHdheXNPblRvcE1ldGhvZCAgICAgICAgICAgICAgPSAyNTtcbmNvbnN0IFNldEJhY2tncm91bmRDb2xvdXJNZXRob2QgICAgICAgICA9IDI2O1xuY29uc3QgU2V0RnJhbWVsZXNzTWV0aG9kICAgICAgICAgICAgICAgID0gMjc7XG5jb25zdCBTZXRGdWxsc2NyZWVuQnV0dG9uRW5hYmxlZE1ldGhvZCAgPSAyODtcbmNvbnN0IFNldE1heFNpemVNZXRob2QgICAgICAgICAgICAgICAgICA9IDI5O1xuY29uc3QgU2V0TWluU2l6ZU1ldGhvZCAgICAgICAgICAgICAgICAgID0gMzA7XG5jb25zdCBTZXRSZWxhdGl2ZVBvc2l0aW9uTWV0aG9kICAgICAgICAgPSAzMTtcbmNvbnN0IFNldFJlc2l6YWJsZU1ldGhvZCAgICAgICAgICAgICAgICA9IDMyO1xuY29uc3QgU2V0U2l6ZU1ldGhvZCAgICAgICAgICAgICAgICAgICAgID0gMzM7XG5jb25zdCBTZXRUaXRsZU1ldGhvZCAgICAgICAgICAgICAgICAgICAgPSAzNDtcbmNvbnN0IFNldFpvb21NZXRob2QgICAgICAgICAgICAgICAgICAgICA9IDM1O1xuY29uc3QgU2hvd01ldGhvZCAgICAgICAgICAgICAgICAgICAgICAgID0gMzY7XG5jb25zdCBTaXplTWV0aG9kICAgICAgICAgICAgICAgICAgICAgICAgPSAzNztcbmNvbnN0IFRvZ2dsZUZ1bGxzY3JlZW5NZXRob2QgICAgICAgICAgICA9IDM4O1xuY29uc3QgVG9nZ2xlTWF4aW1pc2VNZXRob2QgICAgICAgICAgICAgID0gMzk7XG5jb25zdCBVbkZ1bGxzY3JlZW5NZXRob2QgICAgICAgICAgICAgICAgPSA0MDtcbmNvbnN0IFVuTWF4aW1pc2VNZXRob2QgICAgICAgICAgICAgICAgICA9IDQxO1xuY29uc3QgVW5NaW5pbWlzZU1ldGhvZCAgICAgICAgICAgICAgICAgID0gNDI7XG5jb25zdCBXaWR0aE1ldGhvZCAgICAgICAgICAgICAgICAgICAgICAgPSA0MztcbmNvbnN0IFpvb21NZXRob2QgICAgICAgICAgICAgICAgICAgICAgICA9IDQ0O1xuY29uc3QgWm9vbUluTWV0aG9kICAgICAgICAgICAgICAgICAgICAgID0gNDU7XG5jb25zdCBab29tT3V0TWV0aG9kICAgICAgICAgICAgICAgICAgICAgPSA0NjtcbmNvbnN0IFpvb21SZXNldE1ldGhvZCAgICAgICAgICAgICAgICAgICA9IDQ3O1xuXG4vKipcbiAqIEB0eXBlIHtzeW1ib2x9XG4gKi9cbmNvbnN0IGNhbGxlciA9IFN5bWJvbCgpO1xuXG5jbGFzcyBXaW5kb3cge1xuICAgIC8qKlxuICAgICAqIEluaXRpYWxp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aW4vbWF4IHNpemUgY29uc3RyYWludHMuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTx2b2lkPn1cbiAgICAgKi9cbiAgICBEaXNhYmxlU2l6ZUNvbnN0cmFpbnRzKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKERpc2FibGVTaXplQ29uc3RyYWludHNNZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEVuYWJsZXMgbWluL21heCBzaXplIGNvbnN0cmFpbnRzLlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgRW5hYmxlU2l6ZUNvbnN0cmFpbnRzKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKEVuYWJsZVNpemVDb25zdHJhaW50c01ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogRm9jdXNlcyB0aGUgd2luZG93LlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgRm9jdXMoKSB7XG4gICAgICAgIHJldHVybiB0aGlzW2NhbGxlcl0oRm9jdXNNZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEZvcmNlcyB0aGUgd2luZG93IHRvIHJlbG9hZCB0aGUgcGFnZSBhc3NldHMuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTx2b2lkPn1cbiAgICAgKi9cbiAgICBGb3JjZVJlbG9hZCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShGb3JjZVJlbG9hZE1ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogRG9jLlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgRnVsbHNjcmVlbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShGdWxsc2NyZWVuTWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRoZSBzY3JlZW4gdGhhdCB0aGUgd2luZG93IGlzIG9uLlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8U2NyZWVuPn0gLSBUaGUgc2NyZWVuIHRoZSB3aW5kb3cgaXMgY3VycmVudGx5IG9uXG4gICAgICovXG4gICAgR2V0U2NyZWVuKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKEdldFNjcmVlbk1ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyB0aGUgY3VycmVudCB6b29tIGxldmVsIG9mIHRoZSB3aW5kb3cuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTxudW1iZXI+fSAtIFRoZSBjdXJyZW50IHpvb20gbGV2ZWxcbiAgICAgKi9cbiAgICBHZXRab29tKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKEdldFpvb21NZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIGhlaWdodCBvZiB0aGUgd2luZG93LlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8bnVtYmVyPn0gLSBUaGUgY3VycmVudCBoZWlnaHQgb2YgdGhlIHdpbmRvd1xuICAgICAqL1xuICAgIEhlaWdodCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShIZWlnaHRNZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEhpZGVzIHRoZSB3aW5kb3cuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UH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Z30gdGl0bGUgLSBUaGUgZGVzaXJlZCB0aXRsZSBvZiB0aGUgd2luZG93XG4gICAgICogQHJldHVybiB7UHJvbWlzZTx2b2lkPn1cbiAgICAgKi9cbiAgICBTZXRUaXRsZSh0aXRsZSkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKFNldFRpdGxlTWV0aG9kLCB7IHRpdGxlIH0pO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFNldHMgdGhlIHpvb20gbGV2ZWwgb2YgdGhlIHdpbmRvdy5cbiAgICAgKlxuICAgICAqIEBwdWJsaWNcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gem9vbSAtIFRoZSBkZXNpcmVkIHpvb20gbGV2ZWxcbiAgICAgKiBAcmV0dXJuIHtQcm9taXNlPHZvaWQ+fVxuICAgICAqL1xuICAgIFNldFpvb20oem9vbSkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKFNldFpvb21NZXRob2QsIHsgem9vbSB9KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBTaG93cyB0aGUgd2luZG93LlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgU2hvdygpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShTaG93TWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRoZSBzaXplIG9mIHRoZSB3aW5kb3cuXG4gICAgICpcbiAgICAgKiBAcHVibGljXG4gICAgICogQHJldHVybiB7UHJvbWlzZTxTaXplPn0gLSBUaGUgY3VycmVudCBzaXplIG9mIHRoZSB3aW5kb3dcbiAgICAgKi9cbiAgICBTaXplKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKFNpemVNZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRvZ2dsZXMgdGhlIHdpbmRvdyBiZXR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IEBwdWJsaWNcbiAgICAgKiBAcmV0dXJuIHtQcm9taXNlPHZvaWQ+fVxuICAgICAqL1xuICAgIFVuTWluaW1pc2UoKSB7XG4gICAgICAgIHJldHVybiB0aGlzW2NhbGxlcl0oVW5NaW5pbWlzZU1ldGhvZCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyB0aGUgd2lkdGggb2YgdGhlIHdpbmRvdy5cbiAgICAgKlxuICAgICAqIEBwdWJsaWNcbiAgICAgKiBAcmV0dXJuIHtQcm9taXNlPG51bWJlcj59IC0gVGhlIGN1cnJlbnQgd2lkdGggb2YgdGhlIHdpbmRvd1xuICAgICAqL1xuICAgIFdpZHRoKCkge1xuICAgICAgICByZXR1cm4gdGhpc1tjYWxsZXJdKFdpZHRoTWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBab29tcyB0aGUgd2luZG93LlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgWm9vbSgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShab29tTWV0aG9kKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBJbmNyZWFzZXMgdGhlIHpvb20gbGV2ZWwgb2YgdGhlIHdlYnZpZXcgY29udGVudC5cbiAgICAgKlxuICAgICAqIEBwdWJsaWNcbiAgICAgKiBAcmV0dXJuIHtQcm9taXNlPHZvaWQ+fVxuICAgICAqL1xuICAgIFpvb21JbigpIHtcbiAgICAgICAgcmV0dXJuIHRoaXNbY2FsbGVyXShab29tSW5NZXRob2QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIERlY3JlYXNlcyB0aGUgem9vbSBsZXZlbCBvZiB0aGUgd2VidmlldyBjb250ZW50LlxuICAgICAqXG4gICAgICogQHB1YmxpY1xuICAgICAqIEByZXR1cm4ge1Byb21pc2U8dm9pZD59XG4gICAgICovXG4gICAgWm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AgICAgICAgICAgICAgY29uc3QgcmVjdHMgPSByYW5nZS5nZXRDbGllbnRSZWN0cygpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IHJlY3RzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCByZWN0ID0gcmVjdHNbal07XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQuZWxlbWVudEZyb21Qb2ludChyZWN0LmxlZnQsIHJlY3QudG9wKSA9PT0gZWxlbWVudCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIENoZWNrIGlmIHRhZ25hbWUgaXMgaW5wdXQgb3IgdGV4dGFyZWFcbiAgICAgICAgICAgIGlmIChlbGVtZW50LnRhZ05hbWUgPT09IFwiSU5QVVRcIiB8fCBlbGVtZW50LnRhZ05hbWUgPT09IFwiVEVYVEFSRUFcIikge1xuICAgICAgICAgICAgICAgIGlmIChoYXNTZWxlY3Rpb24gfHwgKCFlbGVtZW50LnJlYWRPbmx5ICYmICFlbGVtZW50LmRpc2FibGVkKSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBoaWRlIGRlZmF1bHQgY29udGV4dCBtZW51XG4gICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgIH1cbn1cbiIsICIvKlxuIF9cdCAgIF9fXHQgIF8gX19cbnwgfFx0IC8gL19fXyBfKF8pIC9fX19fXG58IHwgL3wgLyAvIF9fIGAvIC8gLyBfX18vXG58IHwvIHwvIC8gL18vIC8gLyAoX18gIClcbnxfXy98X18vXFxfXyxfL18vXy9fX19fL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SB0cnVlO1xuICAgIGZvciAoY29uc3QgbmFtZSBpbiBjcmVhdGVGaWVsZCkge1xuICAgICAgICBpZiAoY3JlYXRlRmllbGRbbmFtZV0gIT09IEFueSkge1xuICAgICAgICAgICAgYWxsQW55ID0gZmFsc2U7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgIH1cbiAgICBpZiAoYWxsQW55KSB7XG4gICAgICAgIHJldHVybiBBbnk7XG4gICAgfVxuXG4gICAgcmV0dXJuIChzb3VyY2UpID0+IHtcbiAgICAgICAgZm9yIChjb25zdCBuYW1lIGluIGNyZWF0ZUZpZWxkKSB7XG4gICAgICAgICAgICBpZiAobmFtZSBpbiBzb3VyY2UpIHtcbiAgICAgICAgICAgICAgICBzb3VyY2VbbmFtZV0gPSBjcmVhdGVGaWVsZFtuYW1lXShzb3VyY2VbbmFtZV0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBzb3VyY2U7XG4gICAgfTtcbn1cbiIsICIvKlxuIF9cdCAgIF9fXHQgIF8gX19cbnwgfFx0IC8gL19fXyBfKF8pIC9fX19fXG58IHwgL3wgLyAvIF9fIGAvIC8gLyBfX18vXG58IHwvIHwvIC8gL18vIC8gLyAoX18gIClcbnxfXy98X18vXFxfXyxfL18vXy9fX19fL1xuVGhlIGVsZWN0cm9uIGFsdGVybmF0aXZlIGZvciBHb1xuKGMpIExlYSBBbnRob255IDIwMTktcHJlc2VudFxuKi9cblxuLyoganNoaW50IGVzdmVyc2lvbjogOSAqL1xuXG4vKipcbiAqIEB0eXBlZGVmIHtPYmplY3R9IFBvc2l0aW9uXG4gKiBAcHJvcGVydHkge251bWJlcn0gWCAtIFRoZSBYIGNvb3JkaW5hdGUuXG4gKiBAcHJvcGVydHkge251bWJlcn0gWSAtIFRoZSBZIGNvb3JkaW5hdGUuXG4gKi9cblxuLyoqXG4gKiBAdHlwZWRlZiB7T2JqZWN0fSBTaXplXG4gKiBAcHJvcGVydHkge251bW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mLGVBQVcsUUFBUSxhQUFhO0FBQzVCLFVBQUksUUFBUSxRQUFRO0FBQ2hCLGVBQU8sSUFBSSxJQUFJLFlBQVksSUFBSSxFQUFFLE9BQU8sSUFBSSxDQUFDO0FBQUEsTUFDakQ7QUFBQSxJQUNKO0FBQ0EsV0FBTztBQUFBLEVBQ1g7QUFDSjs7O0FDNUhBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQWlEQSxJQUFNQyxRQUFPLHVCQUF1QixZQUFZLFNBQVMsRUFBRTtBQUUzRCxJQUFNLFNBQVM7QUFDZixJQUFNLGFBQWE7QUFDbkIsSUFBTSxhQUFhO0FBTVosU0FBUyxTQUFTO0FBQ3JCLFNBQU9BLE1BQUssTUFBTTtBQUN0QjtBQUtPLFNBQVMsYUFBYTtBQUN6QixTQUFPQSxNQUFLLFVBQVU7QUFDMUI7QUFNTyxTQUFTLGFBQWE7QUFDekIsU0FBT0EsTUFBSyxVQUFVO0FBQzFCOzs7QW5CakVBLE9BQU8sU0FBUyxPQUFPLFVBQVUsQ0FBQztBQW1DbEMsT0FBTyxPQUFPLFNBQWdCO0FBQ3ZCLE9BQU8scUJBQXFCOyIsCiAgIm5hbWVzIjogWyJFcnJvciIsICJjYWxsIiwgIkVycm9yIiwgImNhbGwiLCAiZXZlbnROYW1lIiwgImNvbnRyb2xsZXIiLCAicmVzaXphYmxlIiwgImNhbGwiLCAiY2FsbCIsICJjYWxsIiwgIkhpZGVNZXRob2QiLCAiU2hvd01ldGhvZCIsICJjYWxsIiwgImdlbmVyYXRlSUQiLCAiY2FsbCIsICJNYXAiLCAiTWFwIiwgImtleSIsICJjYWxsIl0KfQo= diff --git a/v3/internal/assetserver/bundledassets/runtime.js b/v3/internal/assetserver/bundledassets/runtime.js index dd016cb8347..497e9d46556 100644 --- a/v3/internal/assetserver/bundledassets/runtime.js +++ b/v3/internal/assetserver/bundledassets/runtime.js @@ -1 +1 @@ -var he=Object.defineProperty;var u=(e,i)=>{for(var n in i)he(e,n,{get:i[n],enumerable:!0})};var j={};u(j,{Application:()=>J,Browser:()=>P,Call:()=>$,Clipboard:()=>ee,Dialogs:()=>T,Events:()=>k,Flags:()=>X,Screens:()=>ne,System:()=>K,WML:()=>Z,Window:()=>R});var Z={};u(Z,{Enable:()=>_,Reload:()=>ce});var P={};u(P,{OpenURL:()=>O});var We="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var f=(e=21)=>{let i="",n=e;for(;n--;)i+=We[Math.random()*64|0];return i};var ge=window.location.origin+"/wails/runtime",l={Call:0,Clipboard:1,Application:2,Events:3,ContextMenu:4,Dialog:5,Window:6,Screens:7,System:8,Browser:9,CancelCall:10},fe=f();function d(e,i){return function(n,t=null){return De(e,n,i,t)}}function De(e,i,n,t){let r=new URL(ge);r.searchParams.append("object",e),r.searchParams.append("method",i);let s={headers:{}};return n&&(s.headers["x-wails-window-name"]=n),t&&r.searchParams.append("args",JSON.stringify(t)),s.headers["x-wails-client-id"]=fe,new Promise((c,m)=>{fetch(r,s).then(a=>{if(a.ok)return a.headers.get("Content-Type")&&a.headers.get("Content-Type").indexOf("application/json")!==-1?a.json():a.text();m(Error(a.statusText))}).then(a=>c(a)).catch(a=>m(a))})}var Me=d(l.Browser,""),Ce=0;function O(e){return Me(Ce,{url:e})}var T={};u(T,{Error:()=>Ie,Info:()=>Oe,OpenFile:()=>Te,Question:()=>I,SaveFile:()=>Be,Warning:()=>Pe});window._wails=window._wails||{};window._wails.dialogErrorCallback=Fe;window._wails.dialogResultCallback=Ue;var Se=0,xe=1,Ae=2,be=3,ve=4,Re=5,Ee=d(l.Dialog,""),W=new Map;function ye(){let e;do e=f();while(W.has(e));return e}function D(e,i={}){let n=ye();return i["dialog-id"]=n,new Promise((t,r)=>{W.set(n,{resolve:t,reject:r}),Ee(e,i).catch(s=>{r(s),W.delete(n)})})}function Ue(e,i,n){let t=W.get(e);t&&(n?t.resolve(JSON.parse(i)):t.resolve(i),W.delete(e))}function Fe(e,i){let n=W.get(e);n&&(n.reject(i),W.delete(e))}var Oe=e=>D(Se,e),Pe=e=>D(xe,e),Ie=e=>D(Ae,e),I=e=>D(be,e),Te=e=>D(ve,e),Be=e=>D(Re,e);var k={};u(k,{Emit:()=>L,Off:()=>je,OffAll:()=>Ge,On:()=>Ve,OnMultiple:()=>z,Once:()=>_e,Types:()=>ze,WailsEvent:()=>x,setup:()=>Ne});var oe={Windows:{SystemThemeChanged:"windows:SystemThemeChanged",APMPowerStatusChange:"windows:APMPowerStatusChange",APMSuspend:"windows:APMSuspend",APMResumeAutomatic:"windows:APMResumeAutomatic",APMResumeSuspend:"windows:APMResumeSuspend",APMPowerSettingChange:"windows:APMPowerSettingChange",ApplicationStarted:"windows:ApplicationStarted",WebViewNavigationCompleted:"windows:WebViewNavigationCompleted",WindowInactive:"windows:WindowInactive",WindowActive:"windows:WindowActive",WindowClickActive:"windows:WindowClickActive",WindowMaximise:"windows:WindowMaximise",WindowUnMaximise:"windows:WindowUnMaximise",WindowFullscreen:"windows:WindowFullscreen",WindowUnFullscreen:"windows:WindowUnFullscreen",WindowRestore:"windows:WindowRestore",WindowMinimise:"windows:WindowMinimise",WindowUnMinimise:"windows:WindowUnMinimise",WindowClose:"windows:WindowClose",WindowSetFocus:"windows:WindowSetFocus",WindowKillFocus:"windows:WindowKillFocus",WindowDragDrop:"windows:WindowDragDrop",WindowDragEnter:"windows:WindowDragEnter",WindowDragLeave:"windows:WindowDragLeave",WindowDragOver:"windows:WindowDragOver"},Mac:{ApplicationDidBecomeActive:"mac:ApplicationDidBecomeActive",ApplicationDidChangeBackingProperties:"mac:ApplicationDidChangeBackingProperties",ApplicationDidChangeEffectiveAppearance:"mac:ApplicationDidChangeEffectiveAppearance",ApplicationDidChangeIcon:"mac:ApplicationDidChangeIcon",ApplicationDidChangeOcclusionState:"mac:ApplicationDidChangeOcclusionState",ApplicationDidChangeScreenParameters:"mac:ApplicationDidChangeScreenParameters",ApplicationDidChangeStatusBarFrame:"mac:ApplicationDidChangeStatusBarFrame",ApplicationDidChangeStatusBarOrientation:"mac:ApplicationDidChangeStatusBarOrientation",ApplicationDidFinishLaunching:"mac:ApplicationDidFinishLaunching",ApplicationDidHide:"mac:ApplicationDidHide",ApplicationDidResignActiveNotification:"mac:ApplicationDidResignActiveNotification",ApplicationDidUnhide:"mac:ApplicationDidUnhide",ApplicationDidUpdate:"mac:ApplicationDidUpdate",ApplicationWillBecomeActive:"mac:ApplicationWillBecomeActive",ApplicationWillFinishLaunching:"mac:ApplicationWillFinishLaunching",ApplicationWillHide:"mac:ApplicationWillHide",ApplicationWillResignActive:"mac:ApplicationWillResignActive",ApplicationWillTerminate:"mac:ApplicationWillTerminate",ApplicationWillUnhide:"mac:ApplicationWillUnhide",ApplicationWillUpdate:"mac:ApplicationWillUpdate",ApplicationDidChangeTheme:"mac:ApplicationDidChangeTheme!",ApplicationShouldHandleReopen:"mac:ApplicationShouldHandleReopen!",WindowDidBecomeKey:"mac:WindowDidBecomeKey",WindowDidBecomeMain:"mac:WindowDidBecomeMain",WindowDidBeginSheet:"mac:WindowDidBeginSheet",WindowDidChangeAlpha:"mac:WindowDidChangeAlpha",WindowDidChangeBackingLocation:"mac:WindowDidChangeBackingLocation",WindowDidChangeBackingProperties:"mac:WindowDidChangeBackingProperties",WindowDidChangeCollectionBehavior:"mac:WindowDidChangeCollectionBehavior",WindowDidChangeEffectiveAppearance:"mac:WindowDidChangeEffectiveAppearance",WindowDidChangeOcclusionState:"mac:WindowDidChangeOcclusionState",WindowDidChangeOrderingMode:"mac:WindowDidChangeOrderingMode",WindowDidChangeScreen:"mac:WindowDidChangeScreen",WindowDidChangeScreenParameters:"mac:WindowDidChangeScreenParameters",WindowDidChangeScreenProfile:"mac:WindowDidChangeScreenProfile",WindowDidChangeScreenSpace:"mac:WindowDidChangeScreenSpace",WindowDidChangeScreenSpaceProperties:"mac:WindowDidChangeScreenSpaceProperties",WindowDidChangeSharingType:"mac:WindowDidChangeSharingType",WindowDidChangeSpace:"mac:WindowDidChangeSpace",WindowDidChangeSpaceOrderingMode:"mac:WindowDidChangeSpaceOrderingMode",WindowDidChangeTitle:"mac:WindowDidChangeTitle",WindowDidChangeToolbar:"mac:WindowDidChangeToolbar",WindowDidChangeVisibility:"mac:WindowDidChangeVisibility",WindowDidDeminiaturize:"mac:WindowDidDeminiaturize",WindowDidEndSheet:"mac:WindowDidEndSheet",WindowDidEnterFullScreen:"mac:WindowDidEnterFullScreen",WindowDidEnterVersionBrowser:"mac:WindowDidEnterVersionBrowser",WindowDidExitFullScreen:"mac:WindowDidExitFullScreen",WindowDidExitVersionBrowser:"mac:WindowDidExitVersionBrowser",WindowDidExpose:"mac:WindowDidExpose",WindowDidFocus:"mac:WindowDidFocus",WindowDidMiniaturize:"mac:WindowDidMiniaturize",WindowDidMove:"mac:WindowDidMove",WindowDidOrderOffScreen:"mac:WindowDidOrderOffScreen",WindowDidOrderOnScreen:"mac:WindowDidOrderOnScreen",WindowDidResignKey:"mac:WindowDidResignKey",WindowDidResignMain:"mac:WindowDidResignMain",WindowDidResize:"mac:WindowDidResize",WindowDidUpdate:"mac:WindowDidUpdate",WindowDidUpdateAlpha:"mac:WindowDidUpdateAlpha",WindowDidUpdateCollectionBehavior:"mac:WindowDidUpdateCollectionBehavior",WindowDidUpdateCollectionProperties:"mac:WindowDidUpdateCollectionProperties",WindowDidUpdateShadow:"mac:WindowDidUpdateShadow",WindowDidUpdateTitle:"mac:WindowDidUpdateTitle",WindowDidUpdateToolbar:"mac:WindowDidUpdateToolbar",WindowDidUpdateVisibility:"mac:WindowDidUpdateVisibility",WindowShouldClose:"mac:WindowShouldClose!",WindowWillBecomeKey:"mac:WindowWillBecomeKey",WindowWillBecomeMain:"mac:WindowWillBecomeMain",WindowWillBeginSheet:"mac:WindowWillBeginSheet",WindowWillChangeOrderingMode:"mac:WindowWillChangeOrderingMode",WindowWillClose:"mac:WindowWillClose",WindowWillDeminiaturize:"mac:WindowWillDeminiaturize",WindowWillEnterFullScreen:"mac:WindowWillEnterFullScreen",WindowWillEnterVersionBrowser:"mac:WindowWillEnterVersionBrowser",WindowWillExitFullScreen:"mac:WindowWillExitFullScreen",WindowWillExitVersionBrowser:"mac:WindowWillExitVersionBrowser",WindowWillFocus:"mac:WindowWillFocus",WindowWillMiniaturize:"mac:WindowWillMiniaturize",WindowWillMove:"mac:WindowWillMove",WindowWillOrderOffScreen:"mac:WindowWillOrderOffScreen",WindowWillOrderOnScreen:"mac:WindowWillOrderOnScreen",WindowWillResignMain:"mac:WindowWillResignMain",WindowWillResize:"mac:WindowWillResize",WindowWillUnfocus:"mac:WindowWillUnfocus",WindowWillUpdate:"mac:WindowWillUpdate",WindowWillUpdateAlpha:"mac:WindowWillUpdateAlpha",WindowWillUpdateCollectionBehavior:"mac:WindowWillUpdateCollectionBehavior",WindowWillUpdateCollectionProperties:"mac:WindowWillUpdateCollectionProperties",WindowWillUpdateShadow:"mac:WindowWillUpdateShadow",WindowWillUpdateTitle:"mac:WindowWillUpdateTitle",WindowWillUpdateToolbar:"mac:WindowWillUpdateToolbar",WindowWillUpdateVisibility:"mac:WindowWillUpdateVisibility",WindowWillUseStandardFrame:"mac:WindowWillUseStandardFrame",MenuWillOpen:"mac:MenuWillOpen",MenuDidOpen:"mac:MenuDidOpen",MenuDidClose:"mac:MenuDidClose",MenuWillSendAction:"mac:MenuWillSendAction",MenuDidSendAction:"mac:MenuDidSendAction",MenuWillHighlightItem:"mac:MenuWillHighlightItem",MenuDidHighlightItem:"mac:MenuDidHighlightItem",MenuWillDisplayItem:"mac:MenuWillDisplayItem",MenuDidDisplayItem:"mac:MenuDidDisplayItem",MenuWillAddItem:"mac:MenuWillAddItem",MenuDidAddItem:"mac:MenuDidAddItem",MenuWillRemoveItem:"mac:MenuWillRemoveItem",MenuDidRemoveItem:"mac:MenuDidRemoveItem",MenuWillBeginTracking:"mac:MenuWillBeginTracking",MenuDidBeginTracking:"mac:MenuDidBeginTracking",MenuWillEndTracking:"mac:MenuWillEndTracking",MenuDidEndTracking:"mac:MenuDidEndTracking",MenuWillUpdate:"mac:MenuWillUpdate",MenuDidUpdate:"mac:MenuDidUpdate",MenuWillPopUp:"mac:MenuWillPopUp",MenuDidPopUp:"mac:MenuDidPopUp",MenuWillSendActionToItem:"mac:MenuWillSendActionToItem",MenuDidSendActionToItem:"mac:MenuDidSendActionToItem",WebViewDidStartProvisionalNavigation:"mac:WebViewDidStartProvisionalNavigation",WebViewDidReceiveServerRedirectForProvisionalNavigation:"mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",WebViewDidFinishNavigation:"mac:WebViewDidFinishNavigation",WebViewDidCommitNavigation:"mac:WebViewDidCommitNavigation",WindowFileDraggingEntered:"mac:WindowFileDraggingEntered",WindowFileDraggingPerformed:"mac:WindowFileDraggingPerformed",WindowFileDraggingExited:"mac:WindowFileDraggingExited"},Linux:{SystemThemeChanged:"linux:SystemThemeChanged",WindowLoadChanged:"linux:WindowLoadChanged",WindowDeleteEvent:"linux:WindowDeleteEvent",WindowFocusIn:"linux:WindowFocusIn",WindowFocusOut:"linux:WindowFocusOut",ApplicationStartup:"linux:ApplicationStartup"},Common:{ApplicationStarted:"common:ApplicationStarted",WindowMaximise:"common:WindowMaximise",WindowUnMaximise:"common:WindowUnMaximise",WindowFullscreen:"common:WindowFullscreen",WindowUnFullscreen:"common:WindowUnFullscreen",WindowRestore:"common:WindowRestore",WindowMinimise:"common:WindowMinimise",WindowUnMinimise:"common:WindowUnMinimise",WindowClosing:"common:WindowClosing",WindowZoom:"common:WindowZoom",WindowZoomIn:"common:WindowZoomIn",WindowZoomOut:"common:WindowZoomOut",WindowZoomReset:"common:WindowZoomReset",WindowFocus:"common:WindowFocus",WindowLostFocus:"common:WindowLostFocus",WindowShow:"common:WindowShow",WindowHide:"common:WindowHide",WindowDPIChanged:"common:WindowDPIChanged",WindowFilesDropped:"common:WindowFilesDropped",WindowRuntimeReady:"common:WindowRuntimeReady",ThemeChanged:"common:ThemeChanged"}};var ze=oe;window._wails=window._wails||{};window._wails.dispatchWailsEvent=He;var Le=d(l.Events,""),ke=0,w=new Map,B=class{constructor(i,n,t){this.eventName=i,this.maxCallbacks=t||-1,this.Callback=r=>(n(r),this.maxCallbacks===-1?!1:(this.maxCallbacks-=1,this.maxCallbacks===0))}},x=class{constructor(i,n=null){this.name=i,this.data=n}};function Ne(){}function He(e){let i=w.get(e.name);if(i){let n=i.filter(t=>{if(t.Callback(e))return!0});n.length>0&&(i=i.filter(t=>!n.includes(t)),i.length===0?w.delete(e.name):w.set(e.name,i))}}function z(e,i,n){let t=w.get(e)||[],r=new B(e,i,n);return t.push(r),w.set(e,t),()=>Ze(r)}function Ve(e,i){return z(e,i,-1)}function _e(e,i){return z(e,i,1)}function Ze(e){let i=e.eventName,n=w.get(i).filter(t=>t!==e);n.length===0?w.delete(i):w.set(i,n)}function je(e,...i){[e,...i].forEach(t=>w.delete(t))}function Ge(){w.clear()}function L(e){return Le(ke,e)}function re(){if(!EventTarget||!AbortSignal||!AbortController)return!1;let e=!0,i=new EventTarget,n=new AbortController;return i.addEventListener("test",()=>{e=!1},{signal:n.signal}),n.abort(),i.dispatchEvent(new CustomEvent("test")),e}var ae=!1;document.addEventListener("DOMContentLoaded",()=>ae=!0);function le(e){ae||document.readyState==="complete"?e():document.addEventListener("DOMContentLoaded",e)}var Ye=0,Ke=1,Xe=2,Qe=3,qe=4,Je=5,$e=6,ei=7,ii=8,ni=9,ti=10,oi=11,ri=12,ai=13,li=14,di=15,si=16,ci=17,mi=18,ui=19,wi=20,pi=21,hi=22,Wi=23,gi=24,fi=25,Di=26,Mi=27,Ci=28,Si=29,xi=30,Ai=31,bi=32,vi=33,Ri=34,Ei=35,yi=36,Ui=37,Fi=38,Oi=39,Pi=40,Ii=41,Ti=42,Bi=43,zi=44,Li=45,ki=46,Ni=47,o=Symbol(),N=class e{constructor(i=""){this[o]=d(l.Window,i);for(let n of Object.getOwnPropertyNames(e.prototype))n!=="constructor"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}Get(i){return new e(i)}AbsolutePosition(){return this[o](Ye)}Center(){return this[o](Ke)}Close(){return this[o](Xe)}DisableSizeConstraints(){return this[o](Qe)}EnableSizeConstraints(){return this[o](qe)}Focus(){return this[o](Je)}ForceReload(){return this[o]($e)}Fullscreen(){return this[o](ei)}GetScreen(){return this[o](ii)}GetZoom(){return this[o](ni)}Height(){return this[o](ti)}Hide(){return this[o](oi)}IsFocused(){return this[o](ri)}IsFullscreen(){return this[o](ai)}IsMaximised(){return this[o](li)}IsMinimised(){return this[o](di)}Maximise(){return this[o](si)}Minimise(){return this[o](ci)}Name(){return this[o](mi)}OpenDevTools(){return this[o](ui)}RelativePosition(){return this[o](wi)}Reload(){return this[o](pi)}Resizable(){return this[o](hi)}Restore(){return this[o](Wi)}SetAbsolutePosition(i,n){return this[o](gi,{x:i,y:n})}SetAlwaysOnTop(i){return this[o](fi,{alwaysOnTop:i})}SetBackgroundColour(i,n,t,r){return this[o](Di,{r:i,g:n,b:t,a:r})}SetFrameless(i){return this[o](Mi,{frameless:i})}SetFullscreenButtonEnabled(i){return this[o](Ci,{enabled:i})}SetMaxSize(i,n){return this[o](Si,{width:i,height:n})}SetMinSize(i,n){return this[o](xi,{width:i,height:n})}SetRelativePosition(i,n){return this[o](Ai,{x:i,y:n})}SetResizable(i){return this[o](bi,{resizable:i})}SetSize(i,n){return this[o](vi,{width:i,height:n})}SetTitle(i){return this[o](Ri,{title:i})}SetZoom(i){return this[o](Ei,{zoom:i})}Show(){return this[o](yi)}Size(){return this[o](Ui)}ToggleFullscreen(){return this[o](Fi)}ToggleMaximise(){return this[o](Oi)}UnFullscreen(){return this[o](Pi)}UnMaximise(){return this[o](Ii)}UnMinimise(){return this[o](Ti)}Width(){return this[o](Bi)}Zoom(){return this[o](zi)}ZoomIn(){return this[o](Li)}ZoomOut(){return this[o](ki)}ZoomReset(){return this[o](Ni)}},Hi=new N(""),R=Hi;function Vi(e,i=null){L(new x(e,i))}function _i(e,i){let n=R.Get(e),t=n[i];if(typeof t=="function")try{t.call(n)}catch{}}function de(e){let i=e.currentTarget;function n(r="Yes"){if(r!=="Yes")return;let s=i.getAttribute("wml-event"),c=i.getAttribute("wml-target-window")||"",m=i.getAttribute("wml-window"),a=i.getAttribute("wml-openurl");s!==null&&Vi(s),m!==null&&_i(c,m),a!==null&&O(a)}let t=i.getAttribute("wml-confirm");t?I({Title:"Confirm",Message:t,Detached:!1,Buttons:[{Label:"Yes"},{Label:"No",IsDefault:!0}]}).then(n):n()}var E=Symbol(),H=class{constructor(){this[E]=new AbortController}set(i,n){return{signal:this[E].signal}}reset(){this[E].abort(),this[E]=new AbortController}},A=Symbol(),M=Symbol(),V=class{constructor(){this[A]=new WeakMap,this[M]=0}set(i,n){return this[M]+=!this[A].has(i),this[A].set(i,n),{}}reset(){if(!(this[M]<=0)){for(let i of document.body.querySelectorAll("*")){if(this[M]<=0)break;let n=this[A].get(i);this[M]-=typeof n<"u";for(let t of n||[])i.removeEventListener(t,de)}this[A]=new WeakMap,this[M]=0}}},se=re()?new H:new V;function Zi(e){let i=/\S+/g,n=e.getAttribute("wml-trigger")||"click",t=[],r;for(;(r=i.exec(n))!==null;)t.push(r[0]);let s=se.set(e,t);for(let c of t)e.addEventListener(c,de,s)}function _(){le(ce)}function ce(){se.reset(),document.body.querySelectorAll("[wml-event], [wml-window], [wml-openurl]").forEach(Zi)}window.wails=j;_();var K={};u(K,{Capabilities:()=>Ki,Environment:()=>Xi,IsAMD64:()=>Ji,IsARM:()=>$i,IsARM64:()=>en,IsDarkMode:()=>Yi,IsDebug:()=>Y,IsLinux:()=>Qi,IsMac:()=>qi,IsWindows:()=>G,invoke:()=>g});var me=d(l.System,""),ji=0,Gi=1;function g(e){return window.chrome?window.chrome.webview.postMessage(e):window.webkit.messageHandlers.external.postMessage(e)}function Yi(){return me(ji)}function Ki(){return fetch("/wails/capabilities").json()}function Xi(){return me(Gi)}function G(){return window._wails.environment.OS==="windows"}function Qi(){return window._wails.environment.OS==="linux"}function qi(){return window._wails.environment.OS==="darwin"}function Ji(){return window._wails.environment.Arch==="amd64"}function $i(){return window._wails.environment.Arch==="arm"}function en(){return window._wails.environment.Arch==="arm64"}function Y(){return window._wails.environment.Debug===!0}window.addEventListener("contextmenu",rn);var nn=d(l.ContextMenu,""),tn=0;function on(e,i,n,t){nn(tn,{id:e,x:i,y:n,data:t})}function rn(e){let i=e.target,n=window.getComputedStyle(i).getPropertyValue("--custom-contextmenu");if(n=n?n.trim():"",n){e.preventDefault();let t=window.getComputedStyle(i).getPropertyValue("--custom-contextmenu-data");on(n,e.clientX,e.clientY,t);return}an(e)}function an(e){if(Y())return;let i=e.target;switch(window.getComputedStyle(i).getPropertyValue("--default-contextmenu").trim()){case"show":return;case"hide":e.preventDefault();return;default:if(i.isContentEditable)return;let r=window.getSelection(),s=r.toString().length>0;if(s)for(let c=0;cb});function b(e){try{return window._wails.flags[e]}catch(i){throw new Error("Unable to retrieve flag '"+e+"': "+i)}}var C=!1,ue=!1,y=null,Q="auto";window._wails=window._wails||{};window._wails.setResizable=function(e){ue=e};window._wails.endDrag=function(){document.body.style.cursor="default",C=!1};window.addEventListener("mousedown",dn);window.addEventListener("mousemove",cn);window.addEventListener("mouseup",sn);function ln(e){let i=window.getComputedStyle(e.target).getPropertyValue("--wails-draggable"),n=e.buttons!==void 0?e.buttons:e.which;return!i||i===""||i.trim()!=="drag"||n===0?!1:e.detail===1}function dn(e){if(y){g("resize:"+y),e.preventDefault();return}if(ln(e)){if(e.offsetX>e.target.clientWidth||e.offsetY>e.target.clientHeight)return;C=!0}else C=!1}function sn(){C=!1}function h(e){document.documentElement.style.cursor=e||Q,y=e}function cn(e){if(C&&(C=!1,(e.buttons!==void 0?e.buttons:e.which)>0)){g("drag");return}if(!ue||!G())return;Q==null&&(Q=document.documentElement.style.cursor);let i=b("system.resizeHandleHeight")||5,n=b("system.resizeHandleWidth")||5,t=b("resizeCornerExtra")||10,r=window.outerWidth-e.clientXpn,Quit:()=>Wn,Show:()=>hn});var q=d(l.Application,""),mn=0,un=1,wn=2;function pn(){return q(mn)}function hn(){return q(un)}function Wn(){return q(wn)}var $={};u($,{ByID:()=>An,ByName:()=>xn,Call:()=>Sn,Plugin:()=>bn});window._wails=window._wails||{};window._wails.callResultHandler=Mn;window._wails.callErrorHandler=Cn;var U=0,gn=d(l.Call,""),fn=d(l.CancelCall,""),v=new Map;function Dn(){let e;do e=f();while(v.has(e));return e}function Mn(e,i,n){let t=we(e);t&&t.resolve(n?JSON.parse(i):i)}function Cn(e,i){let n=we(e);n&&n.reject(i)}function we(e){let i=v.get(e);return v.delete(e),i}function F(e,i={}){let n=Dn(),t=()=>fn(e,{"call-id":n}),r=!1,s=!1,c=new Promise((m,a)=>{i["call-id"]=n,v.set(n,{resolve:m,reject:a}),gn(e,i).then(p=>{if(s=!0,r)return t()}).catch(p=>{a(p),v.delete(n)})});return c.cancel=()=>{if(s)return t();r=!0},c}function Sn(e){return F(U,e)}function xn(e,...i){if(typeof e!="string"||e.split(".").length!==3)throw new Error("CallByName requires a string in the format 'package.struct.method'");let[n,t,r]=e.split(".");return F(U,{packageName:n,structName:t,methodName:r,args:i})}function An(e,...i){return F(U,{methodID:e,args:i})}function bn(e,i,...n){return F(U,{packageName:"wails-plugins",structName:e,methodName:i,args:n})}var ee={};u(ee,{SetText:()=>En,Text:()=>yn});var pe=d(l.Clipboard,""),vn=0,Rn=1;function En(e){return pe(vn,{text:e})}function yn(){return pe(Rn)}var ne={};u(ne,{GetAll:()=>Pn,GetCurrent:()=>Tn,GetPrimary:()=>In});var ie=d(l.Screens,""),Un=0,Fn=1,On=2;function Pn(){return ie(Un)}function In(){return ie(Fn)}function Tn(){return ie(On)}window._wails=window._wails||{};window._wails.invoke=g;g("wails:runtime:ready");export{J as Application,P as Browser,$ as Call,ee as Clipboard,T as Dialogs,k as Events,X as Flags,ne as Screens,K as System,Z as WML,R as Window}; +var ge=Object.defineProperty;var u=(e,i)=>{for(var n in i)ge(e,n,{get:i[n],enumerable:!0})};var G={};u(G,{Application:()=>$,Browser:()=>I,Call:()=>ee,Clipboard:()=>ie,Create:()=>ne,Dialogs:()=>B,Events:()=>N,Flags:()=>Q,Screens:()=>oe,System:()=>X,WML:()=>j,Window:()=>E});var j={};u(j,{Enable:()=>Z,Reload:()=>me});var I={};u(I,{OpenURL:()=>P});var fe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var D=(e=21)=>{let i="",n=e;for(;n--;)i+=fe[Math.random()*64|0];return i};var De=window.location.origin+"/wails/runtime",a={Call:0,Clipboard:1,Application:2,Events:3,ContextMenu:4,Dialog:5,Window:6,Screens:7,System:8,Browser:9,CancelCall:10},Me=D();function d(e,i){return function(n,t=null){return Ce(e,n,i,t)}}function Ce(e,i,n,t){let r=new URL(De);r.searchParams.append("object",e),r.searchParams.append("method",i);let s={headers:{}};return n&&(s.headers["x-wails-window-name"]=n),t&&r.searchParams.append("args",JSON.stringify(t)),s.headers["x-wails-client-id"]=Me,new Promise((c,m)=>{fetch(r,s).then(l=>{if(l.ok)return l.headers.get("Content-Type")&&l.headers.get("Content-Type").indexOf("application/json")!==-1?l.json():l.text();m(Error(l.statusText))}).then(l=>c(l)).catch(l=>m(l))})}var Se=d(a.Browser,""),xe=0;function P(e){return Se(xe,{url:e})}var B={};u(B,{Error:()=>Be,Info:()=>Ie,OpenFile:()=>ze,Question:()=>T,SaveFile:()=>ke,Warning:()=>Te});window._wails=window._wails||{};window._wails.dialogErrorCallback=Pe;window._wails.dialogResultCallback=Oe;var Ae=0,be=1,ve=2,Re=3,Ee=4,ye=5,Ue=d(a.Dialog,""),W=new Map;function Fe(){let e;do e=D();while(W.has(e));return e}function M(e,i={}){let n=Fe();return i["dialog-id"]=n,new Promise((t,r)=>{W.set(n,{resolve:t,reject:r}),Ue(e,i).catch(s=>{r(s),W.delete(n)})})}function Oe(e,i,n){let t=W.get(e);t&&(n?t.resolve(JSON.parse(i)):t.resolve(i),W.delete(e))}function Pe(e,i){let n=W.get(e);n&&(n.reject(i),W.delete(e))}var Ie=e=>M(Ae,e),Te=e=>M(be,e),Be=e=>M(ve,e),T=e=>M(Re,e),ze=e=>M(Ee,e),ke=e=>M(ye,e);var N={};u(N,{Emit:()=>L,Off:()=>Ye,OffAll:()=>Ke,On:()=>Ze,OnMultiple:()=>k,Once:()=>je,Types:()=>Le,WailsEvent:()=>A,setup:()=>Ve});var le={Windows:{SystemThemeChanged:"windows:SystemThemeChanged",APMPowerStatusChange:"windows:APMPowerStatusChange",APMSuspend:"windows:APMSuspend",APMResumeAutomatic:"windows:APMResumeAutomatic",APMResumeSuspend:"windows:APMResumeSuspend",APMPowerSettingChange:"windows:APMPowerSettingChange",ApplicationStarted:"windows:ApplicationStarted",WebViewNavigationCompleted:"windows:WebViewNavigationCompleted",WindowInactive:"windows:WindowInactive",WindowActive:"windows:WindowActive",WindowClickActive:"windows:WindowClickActive",WindowMaximise:"windows:WindowMaximise",WindowUnMaximise:"windows:WindowUnMaximise",WindowFullscreen:"windows:WindowFullscreen",WindowUnFullscreen:"windows:WindowUnFullscreen",WindowRestore:"windows:WindowRestore",WindowMinimise:"windows:WindowMinimise",WindowUnMinimise:"windows:WindowUnMinimise",WindowClose:"windows:WindowClose",WindowSetFocus:"windows:WindowSetFocus",WindowKillFocus:"windows:WindowKillFocus",WindowDragDrop:"windows:WindowDragDrop",WindowDragEnter:"windows:WindowDragEnter",WindowDragLeave:"windows:WindowDragLeave",WindowDragOver:"windows:WindowDragOver"},Mac:{ApplicationDidBecomeActive:"mac:ApplicationDidBecomeActive",ApplicationDidChangeBackingProperties:"mac:ApplicationDidChangeBackingProperties",ApplicationDidChangeEffectiveAppearance:"mac:ApplicationDidChangeEffectiveAppearance",ApplicationDidChangeIcon:"mac:ApplicationDidChangeIcon",ApplicationDidChangeOcclusionState:"mac:ApplicationDidChangeOcclusionState",ApplicationDidChangeScreenParameters:"mac:ApplicationDidChangeScreenParameters",ApplicationDidChangeStatusBarFrame:"mac:ApplicationDidChangeStatusBarFrame",ApplicationDidChangeStatusBarOrientation:"mac:ApplicationDidChangeStatusBarOrientation",ApplicationDidFinishLaunching:"mac:ApplicationDidFinishLaunching",ApplicationDidHide:"mac:ApplicationDidHide",ApplicationDidResignActiveNotification:"mac:ApplicationDidResignActiveNotification",ApplicationDidUnhide:"mac:ApplicationDidUnhide",ApplicationDidUpdate:"mac:ApplicationDidUpdate",ApplicationWillBecomeActive:"mac:ApplicationWillBecomeActive",ApplicationWillFinishLaunching:"mac:ApplicationWillFinishLaunching",ApplicationWillHide:"mac:ApplicationWillHide",ApplicationWillResignActive:"mac:ApplicationWillResignActive",ApplicationWillTerminate:"mac:ApplicationWillTerminate",ApplicationWillUnhide:"mac:ApplicationWillUnhide",ApplicationWillUpdate:"mac:ApplicationWillUpdate",ApplicationDidChangeTheme:"mac:ApplicationDidChangeTheme!",ApplicationShouldHandleReopen:"mac:ApplicationShouldHandleReopen!",WindowDidBecomeKey:"mac:WindowDidBecomeKey",WindowDidBecomeMain:"mac:WindowDidBecomeMain",WindowDidBeginSheet:"mac:WindowDidBeginSheet",WindowDidChangeAlpha:"mac:WindowDidChangeAlpha",WindowDidChangeBackingLocation:"mac:WindowDidChangeBackingLocation",WindowDidChangeBackingProperties:"mac:WindowDidChangeBackingProperties",WindowDidChangeCollectionBehavior:"mac:WindowDidChangeCollectionBehavior",WindowDidChangeEffectiveAppearance:"mac:WindowDidChangeEffectiveAppearance",WindowDidChangeOcclusionState:"mac:WindowDidChangeOcclusionState",WindowDidChangeOrderingMode:"mac:WindowDidChangeOrderingMode",WindowDidChangeScreen:"mac:WindowDidChangeScreen",WindowDidChangeScreenParameters:"mac:WindowDidChangeScreenParameters",WindowDidChangeScreenProfile:"mac:WindowDidChangeScreenProfile",WindowDidChangeScreenSpace:"mac:WindowDidChangeScreenSpace",WindowDidChangeScreenSpaceProperties:"mac:WindowDidChangeScreenSpaceProperties",WindowDidChangeSharingType:"mac:WindowDidChangeSharingType",WindowDidChangeSpace:"mac:WindowDidChangeSpace",WindowDidChangeSpaceOrderingMode:"mac:WindowDidChangeSpaceOrderingMode",WindowDidChangeTitle:"mac:WindowDidChangeTitle",WindowDidChangeToolbar:"mac:WindowDidChangeToolbar",WindowDidChangeVisibility:"mac:WindowDidChangeVisibility",WindowDidDeminiaturize:"mac:WindowDidDeminiaturize",WindowDidEndSheet:"mac:WindowDidEndSheet",WindowDidEnterFullScreen:"mac:WindowDidEnterFullScreen",WindowDidEnterVersionBrowser:"mac:WindowDidEnterVersionBrowser",WindowDidExitFullScreen:"mac:WindowDidExitFullScreen",WindowDidExitVersionBrowser:"mac:WindowDidExitVersionBrowser",WindowDidExpose:"mac:WindowDidExpose",WindowDidFocus:"mac:WindowDidFocus",WindowDidMiniaturize:"mac:WindowDidMiniaturize",WindowDidMove:"mac:WindowDidMove",WindowDidOrderOffScreen:"mac:WindowDidOrderOffScreen",WindowDidOrderOnScreen:"mac:WindowDidOrderOnScreen",WindowDidResignKey:"mac:WindowDidResignKey",WindowDidResignMain:"mac:WindowDidResignMain",WindowDidResize:"mac:WindowDidResize",WindowDidUpdate:"mac:WindowDidUpdate",WindowDidUpdateAlpha:"mac:WindowDidUpdateAlpha",WindowDidUpdateCollectionBehavior:"mac:WindowDidUpdateCollectionBehavior",WindowDidUpdateCollectionProperties:"mac:WindowDidUpdateCollectionProperties",WindowDidUpdateShadow:"mac:WindowDidUpdateShadow",WindowDidUpdateTitle:"mac:WindowDidUpdateTitle",WindowDidUpdateToolbar:"mac:WindowDidUpdateToolbar",WindowDidUpdateVisibility:"mac:WindowDidUpdateVisibility",WindowShouldClose:"mac:WindowShouldClose!",WindowWillBecomeKey:"mac:WindowWillBecomeKey",WindowWillBecomeMain:"mac:WindowWillBecomeMain",WindowWillBeginSheet:"mac:WindowWillBeginSheet",WindowWillChangeOrderingMode:"mac:WindowWillChangeOrderingMode",WindowWillClose:"mac:WindowWillClose",WindowWillDeminiaturize:"mac:WindowWillDeminiaturize",WindowWillEnterFullScreen:"mac:WindowWillEnterFullScreen",WindowWillEnterVersionBrowser:"mac:WindowWillEnterVersionBrowser",WindowWillExitFullScreen:"mac:WindowWillExitFullScreen",WindowWillExitVersionBrowser:"mac:WindowWillExitVersionBrowser",WindowWillFocus:"mac:WindowWillFocus",WindowWillMiniaturize:"mac:WindowWillMiniaturize",WindowWillMove:"mac:WindowWillMove",WindowWillOrderOffScreen:"mac:WindowWillOrderOffScreen",WindowWillOrderOnScreen:"mac:WindowWillOrderOnScreen",WindowWillResignMain:"mac:WindowWillResignMain",WindowWillResize:"mac:WindowWillResize",WindowWillUnfocus:"mac:WindowWillUnfocus",WindowWillUpdate:"mac:WindowWillUpdate",WindowWillUpdateAlpha:"mac:WindowWillUpdateAlpha",WindowWillUpdateCollectionBehavior:"mac:WindowWillUpdateCollectionBehavior",WindowWillUpdateCollectionProperties:"mac:WindowWillUpdateCollectionProperties",WindowWillUpdateShadow:"mac:WindowWillUpdateShadow",WindowWillUpdateTitle:"mac:WindowWillUpdateTitle",WindowWillUpdateToolbar:"mac:WindowWillUpdateToolbar",WindowWillUpdateVisibility:"mac:WindowWillUpdateVisibility",WindowWillUseStandardFrame:"mac:WindowWillUseStandardFrame",MenuWillOpen:"mac:MenuWillOpen",MenuDidOpen:"mac:MenuDidOpen",MenuDidClose:"mac:MenuDidClose",MenuWillSendAction:"mac:MenuWillSendAction",MenuDidSendAction:"mac:MenuDidSendAction",MenuWillHighlightItem:"mac:MenuWillHighlightItem",MenuDidHighlightItem:"mac:MenuDidHighlightItem",MenuWillDisplayItem:"mac:MenuWillDisplayItem",MenuDidDisplayItem:"mac:MenuDidDisplayItem",MenuWillAddItem:"mac:MenuWillAddItem",MenuDidAddItem:"mac:MenuDidAddItem",MenuWillRemoveItem:"mac:MenuWillRemoveItem",MenuDidRemoveItem:"mac:MenuDidRemoveItem",MenuWillBeginTracking:"mac:MenuWillBeginTracking",MenuDidBeginTracking:"mac:MenuDidBeginTracking",MenuWillEndTracking:"mac:MenuWillEndTracking",MenuDidEndTracking:"mac:MenuDidEndTracking",MenuWillUpdate:"mac:MenuWillUpdate",MenuDidUpdate:"mac:MenuDidUpdate",MenuWillPopUp:"mac:MenuWillPopUp",MenuDidPopUp:"mac:MenuDidPopUp",MenuWillSendActionToItem:"mac:MenuWillSendActionToItem",MenuDidSendActionToItem:"mac:MenuDidSendActionToItem",WebViewDidStartProvisionalNavigation:"mac:WebViewDidStartProvisionalNavigation",WebViewDidReceiveServerRedirectForProvisionalNavigation:"mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",WebViewDidFinishNavigation:"mac:WebViewDidFinishNavigation",WebViewDidCommitNavigation:"mac:WebViewDidCommitNavigation",WindowFileDraggingEntered:"mac:WindowFileDraggingEntered",WindowFileDraggingPerformed:"mac:WindowFileDraggingPerformed",WindowFileDraggingExited:"mac:WindowFileDraggingExited"},Linux:{SystemThemeChanged:"linux:SystemThemeChanged",WindowLoadChanged:"linux:WindowLoadChanged",WindowDeleteEvent:"linux:WindowDeleteEvent",WindowFocusIn:"linux:WindowFocusIn",WindowFocusOut:"linux:WindowFocusOut",ApplicationStartup:"linux:ApplicationStartup"},Common:{ApplicationStarted:"common:ApplicationStarted",WindowMaximise:"common:WindowMaximise",WindowUnMaximise:"common:WindowUnMaximise",WindowFullscreen:"common:WindowFullscreen",WindowUnFullscreen:"common:WindowUnFullscreen",WindowRestore:"common:WindowRestore",WindowMinimise:"common:WindowMinimise",WindowUnMinimise:"common:WindowUnMinimise",WindowClosing:"common:WindowClosing",WindowZoom:"common:WindowZoom",WindowZoomIn:"common:WindowZoomIn",WindowZoomOut:"common:WindowZoomOut",WindowZoomReset:"common:WindowZoomReset",WindowFocus:"common:WindowFocus",WindowLostFocus:"common:WindowLostFocus",WindowShow:"common:WindowShow",WindowHide:"common:WindowHide",WindowDPIChanged:"common:WindowDPIChanged",WindowFilesDropped:"common:WindowFilesDropped",WindowRuntimeReady:"common:WindowRuntimeReady",ThemeChanged:"common:ThemeChanged"}};var Le=le;window._wails=window._wails||{};window._wails.dispatchWailsEvent=_e;var Ne=d(a.Events,""),He=0,w=new Map,z=class{constructor(i,n,t){this.eventName=i,this.maxCallbacks=t||-1,this.Callback=r=>(n(r),this.maxCallbacks===-1?!1:(this.maxCallbacks-=1,this.maxCallbacks===0))}},A=class{constructor(i,n=null){this.name=i,this.data=n}};function Ve(){}function _e(e){let i=w.get(e.name);if(i){let n=i.filter(t=>{if(t.Callback(e))return!0});n.length>0&&(i=i.filter(t=>!n.includes(t)),i.length===0?w.delete(e.name):w.set(e.name,i))}}function k(e,i,n){let t=w.get(e)||[],r=new z(e,i,n);return t.push(r),w.set(e,t),()=>Ge(r)}function Ze(e,i){return k(e,i,-1)}function je(e,i){return k(e,i,1)}function Ge(e){let i=e.eventName,n=w.get(i).filter(t=>t!==e);n.length===0?w.delete(i):w.set(i,n)}function Ye(e,...i){[e,...i].forEach(t=>w.delete(t))}function Ke(){w.clear()}function L(e){return Ne(He,e)}function ae(){if(!EventTarget||!AbortSignal||!AbortController)return!1;let e=!0,i=new EventTarget,n=new AbortController;return i.addEventListener("test",()=>{e=!1},{signal:n.signal}),n.abort(),i.dispatchEvent(new CustomEvent("test")),e}var de=!1;document.addEventListener("DOMContentLoaded",()=>de=!0);function se(e){de||document.readyState==="complete"?e():document.addEventListener("DOMContentLoaded",e)}var Xe=0,Qe=1,Je=2,qe=3,$e=4,ei=5,ii=6,ni=7,ti=8,oi=9,ri=10,li=11,ai=12,di=13,si=14,ci=15,ui=16,mi=17,wi=18,pi=19,hi=20,Wi=21,gi=22,fi=23,Di=24,Mi=25,Ci=26,Si=27,xi=28,Ai=29,bi=30,vi=31,Ri=32,Ei=33,yi=34,Ui=35,Fi=36,Oi=37,Pi=38,Ii=39,Ti=40,Bi=41,zi=42,ki=43,Li=44,Ni=45,Hi=46,Vi=47,o=Symbol(),H=class e{constructor(i=""){this[o]=d(a.Window,i);for(let n of Object.getOwnPropertyNames(e.prototype))n!=="constructor"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}Get(i){return new e(i)}AbsolutePosition(){return this[o](Xe)}Center(){return this[o](Qe)}Close(){return this[o](Je)}DisableSizeConstraints(){return this[o](qe)}EnableSizeConstraints(){return this[o]($e)}Focus(){return this[o](ei)}ForceReload(){return this[o](ii)}Fullscreen(){return this[o](ni)}GetScreen(){return this[o](ti)}GetZoom(){return this[o](oi)}Height(){return this[o](ri)}Hide(){return this[o](li)}IsFocused(){return this[o](ai)}IsFullscreen(){return this[o](di)}IsMaximised(){return this[o](si)}IsMinimised(){return this[o](ci)}Maximise(){return this[o](ui)}Minimise(){return this[o](mi)}Name(){return this[o](wi)}OpenDevTools(){return this[o](pi)}RelativePosition(){return this[o](hi)}Reload(){return this[o](Wi)}Resizable(){return this[o](gi)}Restore(){return this[o](fi)}SetAbsolutePosition(i,n){return this[o](Di,{x:i,y:n})}SetAlwaysOnTop(i){return this[o](Mi,{alwaysOnTop:i})}SetBackgroundColour(i,n,t,r){return this[o](Ci,{r:i,g:n,b:t,a:r})}SetFrameless(i){return this[o](Si,{frameless:i})}SetFullscreenButtonEnabled(i){return this[o](xi,{enabled:i})}SetMaxSize(i,n){return this[o](Ai,{width:i,height:n})}SetMinSize(i,n){return this[o](bi,{width:i,height:n})}SetRelativePosition(i,n){return this[o](vi,{x:i,y:n})}SetResizable(i){return this[o](Ri,{resizable:i})}SetSize(i,n){return this[o](Ei,{width:i,height:n})}SetTitle(i){return this[o](yi,{title:i})}SetZoom(i){return this[o](Ui,{zoom:i})}Show(){return this[o](Fi)}Size(){return this[o](Oi)}ToggleFullscreen(){return this[o](Pi)}ToggleMaximise(){return this[o](Ii)}UnFullscreen(){return this[o](Ti)}UnMaximise(){return this[o](Bi)}UnMinimise(){return this[o](zi)}Width(){return this[o](ki)}Zoom(){return this[o](Li)}ZoomIn(){return this[o](Ni)}ZoomOut(){return this[o](Hi)}ZoomReset(){return this[o](Vi)}},_i=new H(""),E=_i;function Zi(e,i=null){L(new A(e,i))}function ji(e,i){let n=E.Get(e),t=n[i];if(typeof t=="function")try{t.call(n)}catch{}}function ce(e){let i=e.currentTarget;function n(r="Yes"){if(r!=="Yes")return;let s=i.getAttribute("wml-event"),c=i.getAttribute("wml-target-window")||"",m=i.getAttribute("wml-window"),l=i.getAttribute("wml-openurl");s!==null&&Zi(s),m!==null&&ji(c,m),l!==null&&P(l)}let t=i.getAttribute("wml-confirm");t?T({Title:"Confirm",Message:t,Detached:!1,Buttons:[{Label:"Yes"},{Label:"No",IsDefault:!0}]}).then(n):n()}var y=Symbol(),V=class{constructor(){this[y]=new AbortController}set(i,n){return{signal:this[y].signal}}reset(){this[y].abort(),this[y]=new AbortController}},b=Symbol(),C=Symbol(),_=class{constructor(){this[b]=new WeakMap,this[C]=0}set(i,n){return this[C]+=!this[b].has(i),this[b].set(i,n),{}}reset(){if(!(this[C]<=0)){for(let i of document.body.querySelectorAll("*")){if(this[C]<=0)break;let n=this[b].get(i);this[C]-=typeof n<"u";for(let t of n||[])i.removeEventListener(t,ce)}this[b]=new WeakMap,this[C]=0}}},ue=ae()?new V:new _;function Gi(e){let i=/\S+/g,n=e.getAttribute("wml-trigger")||"click",t=[],r;for(;(r=i.exec(n))!==null;)t.push(r[0]);let s=ue.set(e,t);for(let c of t)e.addEventListener(c,ce,s)}function Z(){se(me)}function me(){ue.reset(),document.body.querySelectorAll("[wml-event], [wml-window], [wml-openurl]").forEach(Gi)}window.wails=G;Z();var X={};u(X,{Capabilities:()=>Qi,Environment:()=>Ji,IsAMD64:()=>en,IsARM:()=>nn,IsARM64:()=>tn,IsDarkMode:()=>Xi,IsDebug:()=>K,IsLinux:()=>qi,IsMac:()=>$i,IsWindows:()=>Y,invoke:()=>g});var we=d(a.System,""),Yi=0,Ki=1;function g(e){return window.chrome?window.chrome.webview.postMessage(e):window.webkit.messageHandlers.external.postMessage(e)}function Xi(){return we(Yi)}function Qi(){return fetch("/wails/capabilities").json()}function Ji(){return we(Ki)}function Y(){return window._wails.environment.OS==="windows"}function qi(){return window._wails.environment.OS==="linux"}function $i(){return window._wails.environment.OS==="darwin"}function en(){return window._wails.environment.Arch==="amd64"}function nn(){return window._wails.environment.Arch==="arm"}function tn(){return window._wails.environment.Arch==="arm64"}function K(){return window._wails.environment.Debug===!0}window.addEventListener("contextmenu",an);var on=d(a.ContextMenu,""),rn=0;function ln(e,i,n,t){on(rn,{id:e,x:i,y:n,data:t})}function an(e){let i=e.target,n=window.getComputedStyle(i).getPropertyValue("--custom-contextmenu");if(n=n?n.trim():"",n){e.preventDefault();let t=window.getComputedStyle(i).getPropertyValue("--custom-contextmenu-data");ln(n,e.clientX,e.clientY,t);return}dn(e)}function dn(e){if(K())return;let i=e.target;switch(window.getComputedStyle(i).getPropertyValue("--default-contextmenu").trim()){case"show":return;case"hide":e.preventDefault();return;default:if(i.isContentEditable)return;let r=window.getSelection(),s=r.toString().length>0;if(s)for(let c=0;cv});function v(e){try{return window._wails.flags[e]}catch(i){throw new Error("Unable to retrieve flag '"+e+"': "+i)}}var S=!1,pe=!1,U=null,J="auto";window._wails=window._wails||{};window._wails.setResizable=function(e){pe=e};window._wails.endDrag=function(){document.body.style.cursor="default",S=!1};window.addEventListener("mousedown",cn);window.addEventListener("mousemove",mn);window.addEventListener("mouseup",un);function sn(e){let i=window.getComputedStyle(e.target).getPropertyValue("--wails-draggable"),n=e.buttons!==void 0?e.buttons:e.which;return!i||i===""||i.trim()!=="drag"||n===0?!1:e.detail===1}function cn(e){if(U){g("resize:"+U),e.preventDefault();return}if(sn(e)){if(e.offsetX>e.target.clientWidth||e.offsetY>e.target.clientHeight)return;S=!0}else S=!1}function un(){S=!1}function h(e){document.documentElement.style.cursor=e||J,U=e}function mn(e){if(S&&(S=!1,(e.buttons!==void 0?e.buttons:e.which)>0)){g("drag");return}if(!pe||!Y())return;J==null&&(J=document.documentElement.style.cursor);let i=v("system.resizeHandleHeight")||5,n=v("system.resizeHandleWidth")||5,t=v("resizeCornerExtra")||10,r=window.outerWidth-e.clientXWn,Quit:()=>fn,Show:()=>gn});var q=d(a.Application,""),wn=0,pn=1,hn=2;function Wn(){return q(wn)}function gn(){return q(pn)}function fn(){return q(hn)}var ee={};u(ee,{ByID:()=>vn,ByName:()=>bn,Call:()=>An,Plugin:()=>Rn});window._wails=window._wails||{};window._wails.callResultHandler=Sn;window._wails.callErrorHandler=xn;var F=0,Dn=d(a.Call,""),Mn=d(a.CancelCall,""),R=new Map;function Cn(){let e;do e=D();while(R.has(e));return e}function Sn(e,i,n){let t=he(e);t&&t.resolve(n?JSON.parse(i):i)}function xn(e,i){let n=he(e);n&&n.reject(i)}function he(e){let i=R.get(e);return R.delete(e),i}function O(e,i={}){let n=Cn(),t=()=>Mn(e,{"call-id":n}),r=!1,s=!1,c=new Promise((m,l)=>{i["call-id"]=n,R.set(n,{resolve:m,reject:l}),Dn(e,i).then(p=>{if(s=!0,r)return t()}).catch(p=>{l(p),R.delete(n)})});return c.cancel=()=>{if(s)return t();r=!0},c}function An(e){return O(F,e)}function bn(e,...i){return O(F,{methodName:e,args:i})}function vn(e,...i){return O(F,{methodID:e,args:i})}function Rn(e,i,...n){return O(F,{packageName:"wails-plugins",structName:e,methodName:i,args:n})}var ie={};u(ie,{SetText:()=>Un,Text:()=>Fn});var We=d(a.Clipboard,""),En=0,yn=1;function Un(e){return We(En,{text:e})}function Fn(){return We(yn)}var ne={};u(ne,{Any:()=>f,Array:()=>Pn,ByteSlice:()=>On,Map:()=>In,Nullable:()=>Tn,Struct:()=>Bn});function f(e){return e}function On(e){return e??""}function Pn(e){return e===f?i=>i===null?[]:i:i=>{if(i===null)return[];for(let n=0;nn===null?{}:n:n=>{if(n===null)return{};for(let t in n)n[t]=i(n[t]);return n}}function Tn(e){return e===f?f:i=>i===null?null:e(i)}function Bn(e){let i=!0;for(let n in e)if(e[n]!==f){i=!1;break}return i?f:n=>{for(let t in e)t in n&&(n[t]=e[t](n[t]));return n}}var oe={};u(oe,{GetAll:()=>Nn,GetCurrent:()=>Vn,GetPrimary:()=>Hn});var te=d(a.Screens,""),zn=0,kn=1,Ln=2;function Nn(){return te(zn)}function Hn(){return te(kn)}function Vn(){return te(Ln)}window._wails=window._wails||{};window._wails.invoke=g;g("wails:runtime:ready");export{$ as Application,I as Browser,ee as Call,ie as Clipboard,ne as Create,B as Dialogs,N as Events,Q as Flags,oe as Screens,X as System,j as WML,E as Window}; diff --git a/v3/internal/commands/bindings.go b/v3/internal/commands/bindings.go index 34650b15ee8..8398576ebfc 100644 --- a/v3/internal/commands/bindings.go +++ b/v3/internal/commands/bindings.go @@ -3,43 +3,84 @@ package commands import ( "errors" "fmt" + "path/filepath" + "github.com/pterm/pterm" "github.com/wailsapp/wails/v3/internal/flags" - "github.com/wailsapp/wails/v3/internal/parser" - "path/filepath" + "github.com/wailsapp/wails/v3/internal/generator" + "github.com/wailsapp/wails/v3/internal/generator/config" ) -func GenerateBindings(options *flags.GenerateBindingsOptions) error { - +func GenerateBindings(options *flags.GenerateBindingsOptions, patterns []string) error { if options.Silent { pterm.DisableOutput() defer pterm.EnableOutput() + } else if options.Verbose { + pterm.EnableDebugMessages() + defer pterm.DisableDebugMessages() } - project, err := parser.GenerateBindingsAndModels(options) - if err != nil { - if errors.Is(err, parser.ErrNoBindingsFound) { - pterm.Info.Println("No bindings found") - return nil - } else { - return err - } + if len(patterns) == 0 { + // No input pattern, load package from current directory. + patterns = []string{"."} } + // Compute absolute path of output directory. absPath, err := filepath.Abs(options.OutputDirectory) if err != nil { return err } - pterm.Info.Printf("Processed: %s, %s, %s, %s, %s in %s.\n", - pluralise(project.Stats.NumPackages, "Package"), - pluralise(project.Stats.NumStructs, "Struct"), - pluralise(project.Stats.NumMethods, "Method"), - pluralise(project.Stats.NumEnums, "Enum"), - pluralise(project.Stats.NumModels, "Model"), - project.Stats.EndTime.Sub(project.Stats.StartTime).String()) + // Initialise file creator. + var creator config.FileCreator + if !options.DryRun { + creator = config.DirCreator(absPath) + } + + // Start a spinner for progress messages. + spinner, _ := pterm.DefaultSpinner.Start("Initialising...") + + // Initialise and run generator. + stats, err := generator.NewGenerator( + options, + creator, + config.DefaultPtermLogger(spinner), + ).Generate(patterns...) + + // Resolve spinner. + spinner.Info(fmt.Sprintf( + "Processed: %s, %s, %s, %s, %s in %s.", + pluralise(stats.NumPackages, "Package"), + pluralise(stats.NumServices, "Service"), + pluralise(stats.NumMethods, "Method"), + pluralise(stats.NumEnums, "Enum"), + pluralise(stats.NumModels, "Model"), + stats.Elapsed().String(), + )) + + // Report output directory. + pterm.Info.Printfln("Output directory: %s", absPath) - pterm.Info.Printf("Output directory: %s\n", absPath) + // Process generator error. + if err != nil { + var report *generator.ErrorReport + switch { + case errors.Is(err, generator.ErrNoPackages): + // Convert to warning message. + pterm.Warning.Println(err) + case errors.As(err, &report): + if report.HasErrors() { + // Report error count. + return err + } else if report.HasWarnings() { + // Report warning count. + pterm.Warning.Println(report) + } + default: + // Report error. + return err + } + } return nil } diff --git a/v3/internal/commands/constants.go b/v3/internal/commands/constants.go index d44e5258b20..f2004d0f67b 100644 --- a/v3/internal/commands/constants.go +++ b/v3/internal/commands/constants.go @@ -1,8 +1,9 @@ package commands import ( - "github.com/wailsapp/wails/v3/internal/parser" "os" + + "github.com/wailsapp/wails/v3/internal/generator" ) type GenerateConstantsOptions struct { @@ -16,7 +17,7 @@ func GenerateConstants(options *GenerateConstantsOptions) error { return err } - result, err := parser.GenerateConstants(goData) + result, err := generator.GenerateConstants(goData) if err != nil { return err } diff --git a/v3/internal/flags/bindings.go b/v3/internal/flags/bindings.go index fbc100ee6aa..88d90182d94 100644 --- a/v3/internal/flags/bindings.go +++ b/v3/internal/flags/bindings.go @@ -1,14 +1,96 @@ package flags +import ( + "errors" + "slices" + "strings" + "unicode/utf8" +) + type GenerateBindingsOptions struct { - Silent bool `name:"silent" description:"Silent mode"` - ModelsFilename string `name:"m" description:"The filename for the models file, excluding the extension" default:"models"` + BuildFlagsString string `name:"f" description:"A list of additional space-separated Go build flags. Flags (or parts of them) can be wrapped in single or double quotes to include spaces"` + OutputDirectory string `name:"d" description:"The output directory" default:"frontend/bindings"` + ModelsFilename string `name:"models" description:"File name for exported JS/TS models (excluding the extension)" default:"models"` + InternalFilename string `name:"internal" description:"File name for unexported JS/TS models (excluding the extension)" default:"internal"` + IndexFilename string `name:"index" description:"File name for JS/TS package indexes (excluding the extension)" default:"index"` TS bool `name:"ts" description:"Generate Typescript bindings"` - TSPrefix string `description:"The prefix for the typescript names" default:""` - TSSuffix string `description:"The postfix for the typescript names" default:""` - UseInterfaces bool `name:"i" description:"Use interfaces instead of classes"` + UseInterfaces bool `name:"i" description:"Generate Typescript interfaces instead of classes"` UseBundledRuntime bool `name:"b" description:"Use the bundled runtime instead of importing the npm package"` - ProjectDirectory string `name:"p" description:"The project directory" default:"."` - UseIDs bool `name:"ids" description:"Use IDs instead of names in the binding calls"` - OutputDirectory string `name:"d" description:"The output directory" default:"frontend/bindings"` + UseNames bool `name:"names" description:"Use names instead of IDs for the binding calls"` + NoIndex bool `name:"noindex" description:"Do not generate JS/TS index files"` + DryRun bool `name:"dry" description:"Do not write output files"` + Silent bool `name:"silent" description:"Silent mode"` + Verbose bool `name:"v" description:"Enable debug output"` +} + +var ErrUnmatchedQuote = errors.New("build flags contain an unmatched quote") + +func isWhitespace(r rune) bool { + // We use Go's definition of whitespace instead of the Unicode ones + return r == ' ' || r == '\t' || r == '\r' || r == '\n' +} + +func isNonWhitespace(r rune) bool { + return !isWhitespace(r) +} + +func isQuote(r rune) bool { + return r == '\'' || r == '"' +} + +func isQuoteOrWhitespace(r rune) bool { + return isQuote(r) || isWhitespace(r) +} + +func (options *GenerateBindingsOptions) BuildFlags() (flags []string, err error) { + str := options.BuildFlagsString + + // temporary buffer for flag assembly + flag := make([]byte, 0, 32) + + for start := strings.IndexFunc(str, isNonWhitespace); start >= 0; start = strings.IndexFunc(str, isNonWhitespace) { + // each iteration starts at the beginning of a flag + // skip initial whitespace + str = str[start:] + + // iterate over all quoted and unquoted parts of the flag and join them + for { + breakpoint := strings.IndexFunc(str, isQuoteOrWhitespace) + if breakpoint < 0 { + breakpoint = len(str) + } + + // append everything up to the breakpoint + flag = append(flag, str[:breakpoint]...) + str = str[breakpoint:] + + quote, quoteSize := utf8.DecodeRuneInString(str) + if !isQuote(quote) { + // if the breakpoint is not a quote, we reached the end of the flag + break + } + + // otherwise, look for the closing quote + str = str[quoteSize:] + closingQuote := strings.IndexRune(str, quote) + + // closing quote not found, append everything to the last flag and raise an error + if closingQuote < 0 { + flag = append(flag, str...) + str = "" + err = ErrUnmatchedQuote + break + } + + // closing quote found, append quoted content to the flag and restart after the quote + flag = append(flag, str[:closingQuote]...) + str = str[closingQuote+quoteSize:] + } + + // append a clone of the flag to the result, then reuse buffer space + flags = append(flags, string(slices.Clone(flag))) + flag = flag[:0] + } + + return } diff --git a/v3/internal/flags/bindings_test.go b/v3/internal/flags/bindings_test.go new file mode 100644 index 00000000000..506ca1b00f2 --- /dev/null +++ b/v3/internal/flags/bindings_test.go @@ -0,0 +1,125 @@ +package flags + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" +) + +func TestBuildFlags(t *testing.T) { + tests := []struct { + name string + input string + wantFlags []string + wantErr bool + }{ + { + name: "empty string", + input: "", + wantFlags: nil, + }, + { + name: "single flag, multiple spaces", + input: " -v ", + wantFlags: []string{"-v"}, + }, + { + name: "multiple flags, complex spaces", + input: " \t-v\r\n-x", + wantFlags: []string{"-v", "-x"}, + }, + { + name: "empty flag (single quotes)", + input: `''`, + wantFlags: []string{""}, + }, + { + name: "empty flag (double quotes)", + input: `""`, + wantFlags: []string{""}, + }, + { + name: "flag with spaces (single quotes)", + input: `'a b'`, + wantFlags: []string{"a \tb"}, + }, + { + name: "flag with spaces (double quotes)", + input: `'a b'`, + wantFlags: []string{"a \tb"}, + }, + { + name: "mixed quoted and non-quoted flags (single quotes)", + input: `-v 'a b ' -x`, + wantFlags: []string{"-v", "a b ", "-x"}, + }, + { + name: "mixed quoted and non-quoted flags (double quotes)", + input: `-v "a b " -x`, + wantFlags: []string{"-v", "a b ", "-x"}, + }, + { + name: "mixed quoted and non-quoted flags (mixed quotes)", + input: `-v "a b " '-x'`, + wantFlags: []string{"-v", "a b ", "-x"}, + }, + { + name: "double quote within single quotes", + input: `' " '`, + wantFlags: []string{" \" "}, + }, + { + name: "single quote within double quotes", + input: `" ' "`, + wantFlags: []string{" ' "}, + }, + { + name: "unmatched single quote", + input: `-v "a b " '-x -y`, + wantFlags: []string{"-v", "a b ", "-x -y"}, + wantErr: true, + }, + { + name: "unmatched double quote", + input: `-v "a b " "-x -y`, + wantFlags: []string{"-v", "a b ", "-x -y"}, + wantErr: true, + }, + { + name: "mismatched single quote", + input: `-v "a b " '-x" -y`, + wantFlags: []string{"-v", "a b ", "-x\" -y"}, + wantErr: true, + }, + { + name: "mismatched double quote", + input: `-v "a b " "-x' -y`, + wantFlags: []string{"-v", "a b ", "-x' -y"}, + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + options := GenerateBindingsOptions{ + BuildFlagsString: tt.input, + } + + var wantErr error = nil + if tt.wantErr { + wantErr = ErrUnmatchedQuote + } + + gotFlags, gotErr := options.BuildFlags() + + if diff := cmp.Diff(tt.wantFlags, gotFlags); diff != "" { + t.Errorf("BuildFlags() unexpected result: %s\n", diff) + } + + if diff := cmp.Diff(wantErr, gotErr, cmpopts.EquateErrors()); diff != "" { + t.Errorf("BuildFlags() unexpected error: %s\n", diff) + } + }) + } +} diff --git a/v3/internal/generator/.gitignore b/v3/internal/generator/.gitignore new file mode 100644 index 00000000000..f4adb56d410 --- /dev/null +++ b/v3/internal/generator/.gitignore @@ -0,0 +1,3 @@ +.task +node_modules +testdata/output/**/*.got.[jt]s diff --git a/v3/internal/generator/README.md b/v3/internal/generator/README.md new file mode 100644 index 00000000000..20b879245cc --- /dev/null +++ b/v3/internal/generator/README.md @@ -0,0 +1,6 @@ +# Generator + +This package contains the static analyser used for parsing Wails projects so that we may: + +- Generate the bindings for the frontend +- Generate Typescript definitions for the structs used by the bindings diff --git a/v3/internal/generator/Taskfile.yaml b/v3/internal/generator/Taskfile.yaml new file mode 100644 index 00000000000..c4950ec50e5 --- /dev/null +++ b/v3/internal/generator/Taskfile.yaml @@ -0,0 +1,55 @@ +# https://taskfile.dev + +version: "3" + +shopt: [globstar] + +tasks: + clean: + cmds: + - rm -rf ./testdata/output/**/*.got.[jt]s + + test: + cmds: + - go test -v . + - task: test:check + + test:analyse: + cmds: + - go test -v -run ^TestAnalyser . + + test:constants: + cmds: + - go test -v -run ^TestGenerateConstants . + + test:generate: + cmds: + - go test -v -run ^TestGenerator . + - task: test:check + + test:regenerate: + cmds: + - cmd: rm -rf ./testdata/output/* + - cmd: go test -v -run ^TestGenerator . + ignore_error: true + - task: test:generate + + test:check: + dir: ./testdata + deps: + - install-deps + cmds: + - npx tsc + + install-deps: + internal: true + dir: ./testdata + sources: + - package.json + cmds: + - npm install + + update: + dir: ./testdata + cmds: + - npx npm-check-updates -u diff --git a/v3/internal/generator/analyse.go b/v3/internal/generator/analyse.go new file mode 100644 index 00000000000..a0a56bca16d --- /dev/null +++ b/v3/internal/generator/analyse.go @@ -0,0 +1,205 @@ +package generator + +import ( + "fmt" + "go/token" + "go/types" + + "github.com/wailsapp/wails/v3/internal/generator/config" + "golang.org/x/tools/go/packages" +) + +// FindServices scans the given packages for invocations +// of the NewService function from the Wails application package. +// +// Whenever one is found and the type of its unique argument +// is a valid service type, the corresponding named type object +// is passed to yield. +// +// Results are deduplicated, i.e. yield is called at most once per object. +// +// If yield returns false, FindBoundTypes returns immediately. +func FindServices(pkgs []*packages.Package, systemPaths *config.SystemPaths, logger config.Logger, yield func(*types.TypeName) bool) error { + type instanceInfo struct { + args *types.TypeList + pos token.Position + } + + type target struct { + obj types.Object + param int + } + + type targetInfo struct { + target + cause token.Position + } + + // instances maps objects (TypeName or Func) to their instance list. + instances := make(map[types.Object][]instanceInfo) + + // owner maps type parameter objects to their parent object (TypeName or Func) + owner := make(map[*types.TypeName]types.Object) + + // scheduled holds the set of type parameters + // that have been already scheduled for analysis, + // for deduplication. + scheduled := make(map[target]bool) + + // next lists type parameter objects that have yet to be analysed. + var next []targetInfo + + // Initialise instance/owner maps and detect application.NewService. + for _, pkg := range pkgs { + for ident, instance := range pkg.TypesInfo.Instances { + obj := pkg.TypesInfo.Uses[ident] + + // Add to instance map. + objInstances, seen := instances[obj] + instances[obj] = append(objInstances, instanceInfo{ + instance.TypeArgs, + pkg.Fset.Position(ident.Pos()), + }) + + if seen { + continue + } + + // Object seen for the first time: + // add type params to owner map. + // If applicable, process methods too. + var tp *types.TypeParamList + var recv *types.Named + switch t := obj.Type().(type) { + case *types.Named: + tp = t.TypeParams() + recv = t + case *types.Signature: + tp = t.TypeParams() + default: + // Instantiated object has unexpected kind: + // the spec might have changed. + logger.Warningf( + "unexpected instantiation for %s: please report this to Wails maintainers", + types.ObjectString(obj, nil), + ) + continue + } + + // Add type params to owner map. + for i := range tp.Len() { + if param := tp.At(i).Obj(); param != nil { + owner[param] = obj + } + } + + // Process methods. + if recv != nil && recv.NumMethods() > 0 { + // Register receiver type params. + for i := range recv.NumMethods() { + tp := recv.Method(i).Type().(*types.Signature).RecvTypeParams() + for j := range tp.Len() { + if param := tp.At(j).Obj(); param != nil { + owner[param] = obj + } + } + } + } + + if len(next) > 0 { + // application.NewService has been found already. + continue + } + + fn, ok := obj.(*types.Func) + if !ok { + continue + } + + // Detect application.NewService + if fn.Name() == "NewService" && fn.Pkg().Path() == systemPaths.ApplicationPackage { + // Check signature. + signature := fn.Type().(*types.Signature) + if signature.Params().Len() != 1 || signature.Results().Len() != 1 || tp.Len() != 1 || tp.At(0).Obj() == nil { + return ErrBadApplicationPackage + } + + // Schedule unique type param for analysis. + tgt := target{obj, 0} + scheduled[tgt] = true + next = append(next, targetInfo{target: tgt}) + } + } + } + + // found tracks service types that have been found so far, for deduplication. + found := make(map[*types.TypeName]bool) + + // Process targets. + for len(next) > 0 { + // Pop one target off the next list. + tgt := next[len(next)-1] + next = next[:len(next)-1] + + // Prepare indirect binding message. + indirectMsg := "" + if tgt.cause.IsValid() { + indirectMsg = fmt.Sprintf(" (indirectly bound at %s)", tgt.cause) + } + + for _, instance := range instances[tgt.obj] { + // Retrieve type argument. + serviceType := types.Unalias(instance.args.At(tgt.param)) + + var named *types.Named + + switch t := serviceType.(type) { + case *types.Named: + // Process named type. + named = t.Origin() + + case *types.TypeParam: + // Schedule type parameter for analysis. + newtgt := target{owner[t.Obj()], t.Index()} + if !scheduled[newtgt] { + scheduled[newtgt] = true + + // Retrieve position of call to application.NewService + // that caused this target to be scheduled. + cause := tgt.cause + if !tgt.cause.IsValid() { + // This _is_ a call to application.NewService. + cause = instance.pos + } + + // Push on next list. + next = append(next, targetInfo{newtgt, cause}) + } + continue + + default: + logger.Warningf("%s: ignoring anonymous service type %s%s", instance.pos, serviceType, indirectMsg) + continue + } + + // Reject interfaces and generic types. + if types.IsInterface(named.Underlying()) { + logger.Warningf("%s: ignoring interface service type %s%s", instance.pos, named, indirectMsg) + continue + } else if named.TypeParams() != nil { + logger.Warningf("%s: ignoring generic service type %s", instance.pos, named, indirectMsg) + continue + } + + // Record and yield type object. + if !found[named.Obj()] { + found[named.Obj()] = true + if !yield(named.Obj()) { + return nil + } + } + } + } + + return nil +} diff --git a/v3/internal/generator/analyse_test.go b/v3/internal/generator/analyse_test.go new file mode 100644 index 00000000000..1e659a86f40 --- /dev/null +++ b/v3/internal/generator/analyse_test.go @@ -0,0 +1,115 @@ +package generator + +import ( + "encoding/json" + "errors" + "go/types" + "os" + "path" + "path/filepath" + "slices" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/pterm/pterm" + "github.com/wailsapp/wails/v3/internal/generator/config" +) + +func TestAnalyser(t *testing.T) { + type testParams struct { + name string + want []string + } + + // Gather tests from cases directory. + entries, err := os.ReadDir("testcases") + if err != nil { + t.Fatal(err) + } + + tests := make([]testParams, 0, len(entries)+1) + + for _, entry := range entries { + if !entry.IsDir() { + continue + } + + test := testParams{ + name: entry.Name(), + want: make([]string, 0), + } + + want, err := os.Open(filepath.Join("testcases", entry.Name(), "bound_types.json")) + if err != nil { + if !errors.Is(err, os.ErrNotExist) { + t.Fatal(err) + } + } else { + err = json.NewDecoder(want).Decode(&test.want) + want.Close() + if err != nil { + t.Fatal(err) + } + } + + for i := range test.want { + test.want[i] = path.Clean("github.com/wailsapp/wails/v3/internal/generator/testcases/" + test.name + test.want[i]) + } + slices.Sort(test.want) + + tests = append(tests, test) + } + + // Add global test. + { + all := testParams{ + name: "...", + } + + for _, test := range tests { + all.want = append(all.want, test.want...) + } + slices.Sort(all.want) + + tests = append(tests, all) + } + + // Resolve system package paths. + systemPaths, err := ResolveSystemPaths(nil) + if err != nil { + t.Fatal(err) + } + + for _, test := range tests { + pkgPattern := "github.com/wailsapp/wails/v3/internal/generator/testcases/" + test.name + + t.Run("pkg="+test.name, func(t *testing.T) { + pkgs, err := LoadPackages(nil, pkgPattern) + if err != nil { + t.Fatal(err) + } + + for _, pkg := range pkgs { + for _, err := range pkg.Errors { + pterm.Warning.Println(err) + } + } + + got := make([]string, 0) + + err = FindServices(pkgs, systemPaths, config.DefaultPtermLogger(nil), func(tn *types.TypeName) bool { + got = append(got, types.TypeString(tn.Type(), nil)) + return true + }) + if err != nil { + t.Error(err) + } + + slices.Sort(got) + + if diff := cmp.Diff(test.want, got); diff != "" { + t.Errorf("Found services mismatch (-want +got):\n%s", diff) + } + }) + } +} diff --git a/v3/internal/generator/collect/_reference/json_marshaler_behaviour.go b/v3/internal/generator/collect/_reference/json_marshaler_behaviour.go new file mode 100644 index 00000000000..bc2c995244e --- /dev/null +++ b/v3/internal/generator/collect/_reference/json_marshaler_behaviour.go @@ -0,0 +1,166 @@ +// This example explores exhaustively the behaviour of encoding/json +// when handling types that implement marshaler interfaces. +// +// When encoding values, encoding/json makes no distinction +// between pointer and base types: +// if the base type implements a marshaler interface, +// be it with plain receiver or pointer receiver, +// json.Marshal picks it up. +// +// json.Marshaler is always preferred to encoding.TextMarshaler, +// without any consideration for the receiver type. +// +// When encoding map keys, on the other hand, +// the map key type must implement encoding.TextMarshaler strictly, +// i.e. if the interface is implemented only for plain receivers, +// pointer keys will not be accepted. +// +// json.Marshaler is ignored in this case, i.e. it makes no difference +// whether the key type implements it or not. +// +// Decoding behaviour w.r.t. unmarshaler types mirrors encoding behaviour. +package main + +import ( + "encoding/json" + "fmt" +) + +type A struct{} +type B struct{} +type C struct{} +type D struct{} +type E struct{} +type F struct{} +type G struct{} +type H struct{} + +type T struct { + A A + Ap *A + B B + Bp *B + C C + Cp *C + D D + Dp *D + E E + Ep *E + F F + Fp *F + G G + Gp *G + H H + Hp *H +} + +type MT struct { + //A map[A]bool // error + //Ap map[*A]bool // error + //B map[B]bool // error + //Bp map[*B]bool // error + C map[C]bool + Cp map[*C]bool + //D map[D]bool // error + Dp map[*D]bool + E map[E]bool + Ep map[*E]bool + //F map[F]bool // error + Fp map[*F]bool + G map[G]bool + Gp map[*G]bool + //H map[H]bool // error + Hp map[*H]bool +} + +func (A) MarshalJSON() ([]byte, error) { + return []byte(`"This is j A"`), nil +} + +func (*B) MarshalJSON() ([]byte, error) { + return []byte(`"This is j *B"`), nil +} + +func (C) MarshalText() ([]byte, error) { + return []byte(`This is t C`), nil +} + +func (*D) MarshalText() ([]byte, error) { + return []byte(`This is t *D`), nil +} + +func (E) MarshalJSON() ([]byte, error) { + return []byte(`"This is j E"`), nil +} + +func (E) MarshalText() ([]byte, error) { + return []byte(`This is t E`), nil +} + +func (F) MarshalJSON() ([]byte, error) { + return []byte(`"This is j F"`), nil +} + +func (*F) MarshalText() ([]byte, error) { + return []byte(`This is t *F`), nil +} + +func (*G) MarshalJSON() ([]byte, error) { + return []byte(`"This is j *G"`), nil +} + +func (G) MarshalText() ([]byte, error) { + return []byte(`This is t G`), nil +} + +func (*H) MarshalJSON() ([]byte, error) { + return []byte(`"This is j *H"`), nil +} + +func (*H) MarshalText() ([]byte, error) { + return []byte(`This is t *H`), nil +} + +func main() { + t := &T{ + A{}, + &A{}, + B{}, + &B{}, + C{}, + &C{}, + D{}, + &D{}, + E{}, + &E{}, + F{}, + &F{}, + G{}, + &G{}, + H{}, + &H{}, + } + enc, err := json.Marshal(t) + fmt.Println(string(enc), err) + + mt := &MT{ + //map[A]bool{A{}: true}, // error + //map[*A]bool{&A{}: true}, // error + //map[B]bool{B{}: true}, // error + //map[*B]bool{&B{}: true}, // error + map[C]bool{C{}: true}, + map[*C]bool{&C{}: true}, + //map[D]bool{D{}: true}, // error + map[*D]bool{&D{}: true}, + map[E]bool{E{}: true}, + map[*E]bool{&E{}: true}, + //map[F]bool{F{}: true}, // error + map[*F]bool{&F{}: true}, + map[G]bool{G{}: true}, + map[*G]bool{&G{}: true}, + //map[H]bool{H{}: true}, // error + map[*H]bool{&H{}: true}, + } + enc, err = json.Marshal(mt) + fmt.Println(string(enc), err) +} diff --git a/v3/internal/generator/collect/collector.go b/v3/internal/generator/collect/collector.go new file mode 100644 index 00000000000..e4acd53e875 --- /dev/null +++ b/v3/internal/generator/collect/collector.go @@ -0,0 +1,108 @@ +package collect + +import ( + "go/ast" + "go/types" + "sync" + + "github.com/wailsapp/wails/v3/internal/flags" + "github.com/wailsapp/wails/v3/internal/generator/config" + "golang.org/x/tools/go/packages" +) + +// Scheduler instances provide task scheduling +// for collection activities. +type Scheduler interface { + // Schedule should run the given function according + // to the implementation's preferred strategy. + // + // Scheduled tasks may call Schedule again; + // therefore, if tasks run concurrently, + // the implementation must support concurrent calls. + Schedule(task func()) +} + +// Info instances provide information about either +// a type-checker object, a struct type or a group of declarations. +type Info interface { + Object() types.Object + Type() types.Type + Node() ast.Node +} + +// Collector wraps all bookkeeping data structures that are needed +// to collect data about a set of packages, bindings and models. +type Collector struct { + // pkgs caches packages that have been registered for collection. + pkgs map[*types.Package]*PackageInfo + + // cache caches collected information about type-checker objects + // and declaration groups. Elements are [Info] instances. + cache sync.Map + + systemPaths *config.SystemPaths + options *flags.GenerateBindingsOptions + scheduler Scheduler + logger config.Logger +} + +// NewCollector initialises a new Collector instance for the given package set. +func NewCollector(pkgs []*packages.Package, systemPaths *config.SystemPaths, options *flags.GenerateBindingsOptions, scheduler Scheduler, logger config.Logger) *Collector { + collector := &Collector{ + pkgs: make(map[*types.Package]*PackageInfo, len(pkgs)), + + systemPaths: systemPaths, + options: options, + scheduler: scheduler, + logger: logger, + } + + // Register packages. + for _, pkg := range pkgs { + collector.pkgs[pkg.Types] = newPackageInfo(pkg, collector) + } + + return collector +} + +// fromCache returns the cached Info instance associated +// to the given type-checker object or declaration group. +// If none exists, a new one is created. +func (collector *Collector) fromCache(objectOrGroup any) Info { + entry, ok := collector.cache.Load(objectOrGroup) + info, _ := entry.(Info) + + if !ok { + switch x := objectOrGroup.(type) { + case *ast.GenDecl, *ast.ValueSpec, *ast.Field: + info = newGroupInfo(x.(ast.Node)) + + case *types.Const: + info = newConstInfo(collector, x) + + case *types.Func: + info = newMethodInfo(collector, x.Origin()) + + case *types.TypeName: + info = newTypeInfo(collector, x) + + case *types.Var: + if !x.IsField() { + panic("cache lookup for invalid object kind") + } + + info = newFieldInfo(collector, x.Origin()) + + case *types.Struct: + info = newStructInfo(collector, x) + + default: + panic("cache lookup for invalid object kind") + } + + entry, _ = collector.cache.LoadOrStore(objectOrGroup, info) + info, _ = entry.(Info) + } + + return info +} diff --git a/v3/internal/generator/collect/const.go b/v3/internal/generator/collect/const.go new file mode 100644 index 00000000000..ad624bdad5f --- /dev/null +++ b/v3/internal/generator/collect/const.go @@ -0,0 +1,104 @@ +package collect + +import ( + "go/ast" + "go/constant" + "go/token" + "go/types" + "sync" +) + +// ConstInfo records information about a constant declaration. +// +// Read accesses to any public field are only safe +// if a call to [ConstInfo.Collect] has completed before the access, +// for example by calling it in the accessing goroutine +// or before spawning the accessing goroutine. +type ConstInfo struct { + Name string + Value any + + Pos token.Pos + Spec *GroupInfo + Decl *GroupInfo + + obj *types.Const + node ast.Node + + collector *Collector + once sync.Once +} + +func newConstInfo(collector *Collector, obj *types.Const) *ConstInfo { + return &ConstInfo{ + obj: obj, + collector: collector, + } +} + +// Const returns the unique ConstInfo instance +// associated to the given object within a collector. +// +// Const is safe for concurrent use. +func (collector *Collector) Const(obj *types.Const) *ConstInfo { + return collector.fromCache(obj).(*ConstInfo) +} + +func (info *ConstInfo) Object() types.Object { + return info.obj +} + +func (info *ConstInfo) Type() types.Type { + return info.obj.Type() +} + +func (info *ConstInfo) Node() ast.Node { + return info.Collect().node +} + +// Collect gathers information about the constant described by its receiver. +// It can be called concurrently by multiple goroutines; +// the computation will be performed just once. +// +// Collect returns the receiver for chaining. +// It is safe to call Collect with nil receiver. +// +// After Collect returns, the calling goroutine and all goroutines +// it might spawn afterwards are free to access +// the receiver's fields indefinitely. +func (info *ConstInfo) Collect() *ConstInfo { + if info == nil { + return nil + } + + info.once.Do(func() { + collector := info.collector + + info.Name = info.obj.Name() + info.Value = constant.Val(info.obj.Val()) + + info.Pos = info.obj.Pos() + + path := collector.findDeclaration(info.obj) + if path == nil { + collector.logger.Warningf( + "package %s: const %s: could not find declaration for constant object", + info.obj.Pkg().Path(), + info.Name, + ) + + // Provide dummy groups. + dummyGroup := newGroupInfo(nil).Collect() + info.Spec = dummyGroup + info.Decl = dummyGroup + return + } + + // path shape: *ast.ValueSpec, *ast.GenDecl, *ast.File + info.Spec = collector.fromCache(path[0]).(*GroupInfo).Collect() + info.Decl = collector.fromCache(path[1]).(*GroupInfo).Collect() + info.node = path[0] + }) + + return info +} diff --git a/v3/internal/generator/collect/declaration.go b/v3/internal/generator/collect/declaration.go new file mode 100644 index 00000000000..e592b5b1aa4 --- /dev/null +++ b/v3/internal/generator/collect/declaration.go @@ -0,0 +1,238 @@ +package collect + +import ( + "cmp" + "go/ast" + "go/token" + "go/types" + "slices" +) + +// findDeclaration returns the AST spec or declaration +// that defines the given _global_ type-checker object. +// +// Specifically, the first element in the returned slice +// is the relevant spec or declaration, followed by its chain +// of parent nodes up to the declaring [ast.File]. +// +// If no corresponding declaration can be found within +// the set of registered packages, the returned slice is nil. +// +// Resulting node types are as follows: +// - global functions and concrete methods (*types.Func) +// map to *ast.FuncDecl nodes; +// - interface methods from global interfaces (*types.Func) +// map to *ast.Field nodes within their interface expression; +// - struct fields from global structs (*types.Var) +// map to *ast.Field nodes within their struct expression; +// - global constants and variables map to *ast.ValueSpec nodes; +// - global named types map to *ast.TypeSpec nodes; +// - for type parameters, the result is always nil; +// - for local objects defined within functions, +// field types, variable types or field values, +// the result is always nil; +// +// findDeclaration supports unsynchronised concurrent calls. +func (collector *Collector) findDeclaration(obj types.Object) (path []ast.Node) { + pkg := collector.Package(obj.Pkg()).Collect() + if pkg == nil { + return nil + } + + // Perform a binary search to find the file enclosing the node. + // We can't use findEnclosingNode here because it is less accurate and less efficient with files. + fileIndex, exact := slices.BinarySearchFunc(pkg.Files, obj.Pos(), func(f *ast.File, p token.Pos) int { + return cmp.Compare(f.FileStart, p) + }) + + // If exact is true, pkg.Files[fileIndex] is the file we are looking for; + // otherwise, it is the first file whose start position is _after_ obj.Pos(). + if !exact { + fileIndex-- + } + + // When exact is false, the position might lie within an empty segment in between two files. + if fileIndex < 0 || pkg.Files[fileIndex].FileEnd <= obj.Pos() { + return nil + } + + file := pkg.Files[fileIndex] + + // Find enclosing declaration. + decl := findEnclosingNode(file.Decls, obj.Pos()) + if decl == nil { + // Invalid position. + return nil + } + + var gen *ast.GenDecl + + switch d := decl.(type) { + case *ast.FuncDecl: + if obj.Pos() == d.Name.Pos() { + // Object is function. + return []ast.Node{decl, file} + } + + // Ignore local objects defined within function bodies. + return nil + + case *ast.BadDecl: + // What's up?? + return nil + + case *ast.GenDecl: + gen = d + } + + // Handle *ast.GenDecl + + // Find enclosing ast.Spec + spec := findEnclosingNode(gen.Specs, obj.Pos()) + if spec == nil { + // Invalid position. + return nil + } + + var def ast.Expr + + switch s := spec.(type) { + case *ast.ValueSpec: + if s.Names[0].Pos() <= obj.Pos() && obj.Pos() < s.Names[len(s.Names)-1].End() { + // Object is variable or constant. + return []ast.Node{spec, decl, file} + } + + // Ignore local objects defined within variable types/values. + return nil + + case *ast.TypeSpec: + if obj.Pos() == s.Name.Pos() { + // Object is named type. + return []ast.Node{spec, decl, file} + } + + if obj.Pos() < s.Type.Pos() || s.Type.End() <= obj.Pos() { + // Type param or invalid position. + return nil + } + + // Struct or interface field? + def = s.Type + } + + // Handle struct or interface field. + + var iface *ast.InterfaceType + + switch d := def.(type) { + case *ast.StructType: + // Find enclosing field + field := findEnclosingNode(d.Fields.List, obj.Pos()) + if field == nil { + // Invalid position. + return nil + } + + if len(field.Names) == 0 { + // Handle embedded field. + ftype := ast.Unparen(field.Type) + + // Unwrap pointer. + if ptr, ok := ftype.(*ast.StarExpr); ok { + ftype = ast.Unparen(ptr.X) + } + + // Unwrap generic instantiation. + switch t := field.Type.(type) { + case *ast.IndexExpr: + ftype = ast.Unparen(t.X) + case *ast.IndexListExpr: + ftype = ast.Unparen(t.X) + } + + // Unwrap selector. + if sel, ok := ftype.(*ast.SelectorExpr); ok { + ftype = sel.Sel + } + + // ftype must now be an identifier. + if obj.Pos() == ftype.Pos() { + // Object is this embedded field. + return []ast.Node{field, d.Fields, def, spec, decl, file} + } + } else if field.Names[0].Pos() <= obj.Pos() && obj.Pos() < field.Names[len(field.Names)-1].End() { + // Object is one of these fields. + return []ast.Node{field, d.Fields, def, spec, decl, file} + } + + // Ignore local objects defined within field types. + return nil + + case *ast.InterfaceType: + iface = d + + default: + // Other local object or invalid position. + return nil + } + + path = []ast.Node{file, decl, spec, def, iface.Methods} + + // Handle interface method. + for { + field := findEnclosingNode(iface.Methods.List, obj.Pos()) + if field == nil { + // Invalid position. + return nil + } + + path = append(path, field) + + if len(field.Names) == 0 { + // Handle embedded interface. + var ok bool + iface, ok = ast.Unparen(field.Type).(*ast.InterfaceType) + if !ok { + // Not embedded interface, ignore. + return nil + } + + path = append(path, iface, iface.Methods) + // Explore embedded interface. + + } else if field.Names[0].Pos() <= obj.Pos() && obj.Pos() < field.Names[len(field.Names)-1].End() { + // Object is one of these fields. + slices.Reverse(path) + return path + } else { + // Ignore local objects defined within interface method signatures. + return nil + } + } +} + +// findEnclosingNode finds the unique node in nodes, if any, +// that encloses the given position. +// +// It uses binary search and therefore expects +// the nodes slice to be sorted in source order. +func findEnclosingNode[S ~[]E, E ast.Node](nodes S, pos token.Pos) (node E) { + // Perform a binary search to find the nearest node. + index, exact := slices.BinarySearchFunc(nodes, pos, func(n E, p token.Pos) int { + return cmp.Compare(n.Pos(), p) + }) + + // If exact is true, nodes[index] is the node we are looking for; + // otherwise, it is the first node whose start position is _after_ pos. + if !exact { + index-- + } + + // When exact is false, the position might lie within an empty segment in between two nodes. + if index < 0 || nodes[index].End() <= pos { + return // zero value, nil in practice. + } + + return nodes[index] +} diff --git a/v3/internal/generator/collect/directive.go b/v3/internal/generator/collect/directive.go new file mode 100644 index 00000000000..05293a6404e --- /dev/null +++ b/v3/internal/generator/collect/directive.go @@ -0,0 +1,101 @@ +package collect + +import ( + "fmt" + "strings" + "unicode" + "unicode/utf8" + + "github.com/wailsapp/wails/v3/internal/flags" +) + +// IsDirective returns true if the given comment +// is a directive of the form //wails: + directive. +func IsDirective(comment string, directive string) bool { + if strings.HasPrefix(comment, "//wails:"+directive) { + length := len("//wails:") + len(directive) + if len(comment) == length { + return true + } + + next, _ := utf8.DecodeRuneInString(comment[length:]) + return unicode.IsSpace(next) + } + + return false +} + +// ParseDirective extracts the argument portion of a //wails: + directive comment. +func ParseDirective(comment string, directive string) string { + rawArg := comment[len("//wails:")+len(directive):] + + if directive != "inject" { + return strings.TrimSpace(rawArg) + } + + // wails:inject requires special parsing: + // do not trim all surrounding space, just the one space + // immediately after the directive name. + _, wsize := utf8.DecodeRuneInString(rawArg) + return rawArg[wsize:] +} + +// ParseCondition parses an optional two-character condition prefix +// for include or inject directives. +// It returns the argument stripped of the prefix and the resulting condition. +// If the condition is malformed, ParseCondition returns a non-nil error. +func ParseCondition(argument string) (string, Condition, error) { + cond, arg, present := strings.Cut(argument, ":") + if !present { + return cond, Condition{true, true, true, true}, nil + } + + if len(cond) != 2 || !strings.ContainsRune("*jt", rune(cond[0])) || !strings.ContainsRune("*ci", rune(cond[1])) { + return argument, + Condition{true, true, true, true}, + fmt.Errorf("invalid condition code '%s': expected format is '(*|j|t)(*|c|i)'", cond) + } + + condition := Condition{true, true, true, true} + + switch cond[0] { + case 'j': + condition.TS = false + case 't': + condition.JS = false + } + + switch cond[1] { + case 'c': + condition.Interfaces = false + case 'i': + condition.Classes = false + } + + return arg, condition, nil +} + +type Condition struct { + JS bool + TS bool + Classes bool + Interfaces bool +} + +// Satisfied returns true when the condition described by the receiver +// is satisfied by the given configuration. +func (cond Condition) Satisfied(options *flags.GenerateBindingsOptions) bool { + if options.TS { + if options.UseInterfaces { + return cond.TS && cond.Interfaces + } else { + return cond.TS && cond.Classes + } + } else { + if options.UseInterfaces { + return cond.JS && cond.Interfaces + } else { + return cond.JS && cond.Classes + } + } +} diff --git a/v3/internal/generator/collect/field.go b/v3/internal/generator/collect/field.go new file mode 100644 index 00000000000..eed80811478 --- /dev/null +++ b/v3/internal/generator/collect/field.go @@ -0,0 +1,102 @@ +package collect + +import ( + "go/ast" + "go/token" + "go/types" + "sync" +) + +// FieldInfo records information about a struct field declaration. +// +// Read accesses to any public field are only safe +// if a call to [FieldInfo.Collect] has completed before the access, +// for example by calling it in the accessing goroutine +// or before spawning the accessing goroutine. +type FieldInfo struct { + Name string + Blank bool + Embedded bool + + Pos token.Pos + Decl *GroupInfo + + obj *types.Var + node ast.Node + + collector *Collector + once sync.Once +} + +// newFieldInfo initialises a descriptor for the given field object. +func newFieldInfo(collector *Collector, obj *types.Var) *FieldInfo { + return &FieldInfo{ + obj: obj, + collector: collector, + } +} + +// Field returns the unique FieldInfo instance +// associated to the given object within a collector. +// +// Field is safe for concurrent use. +func (collector *Collector) Field(obj *types.Var) *FieldInfo { + if !obj.IsField() { + return nil + } + + return collector.fromCache(obj).(*FieldInfo) +} + +func (info *FieldInfo) Object() types.Object { + return info.obj +} + +func (info *FieldInfo) Type() types.Type { + return info.obj.Type() +} + +func (info *FieldInfo) Node() ast.Node { + return info.Collect().node +} + +// Collect gathers information about the struct field +// described by its receiver. +// It can be called concurrently by multiple goroutines; +// the computation will be performed just once. +// +// Collect returns the receiver for chaining. +// It is safe to call Collect with nil receiver. +// +// After Collect returns, the calling goroutine and all goroutines +// it might spawn afterwards are free to access +// the receiver's fields indefinitely. +func (info *FieldInfo) Collect() *FieldInfo { + if info == nil { + return nil + } + + info.once.Do(func() { + collector := info.collector + + info.Name = info.obj.Name() + info.Blank = (info.Name == "" || info.Name == "_") + info.Embedded = info.obj.Embedded() + + info.Pos = info.obj.Pos() + + path := collector.findDeclaration(info.obj) + if path == nil { + // Do not report failure: it is expected for anonymous struct fields. + // Provide dummy group. + info.Decl = newGroupInfo(nil).Collect() + return + } + + // path shape: *ast.Field, *ast.FieldList, ... + info.Decl = collector.fromCache(path[0]).(*GroupInfo).Collect() + info.node = path[0] + }) + + return info +} diff --git a/v3/internal/generator/collect/group.go b/v3/internal/generator/collect/group.go new file mode 100644 index 00000000000..62d83304c63 --- /dev/null +++ b/v3/internal/generator/collect/group.go @@ -0,0 +1,95 @@ +package collect + +import ( + "go/ast" + "go/token" + "go/types" + "slices" + "sync" +) + +// GroupInfo records information about a group +// of type, field or constant declarations. +// This may be either a list of distinct specifications +// wrapped in parentheses, or a single specification +// declaring multiple fields or constants. +// +// Read accesses to any public field are only safe +// if a call to [GroupInfo.Collect] has completed before the access, +// for example by calling it in the accessing goroutine +// or before spawning the accessing goroutine. +type GroupInfo struct { + Pos token.Pos + Doc *ast.CommentGroup + + node ast.Node + + once sync.Once +} + +func newGroupInfo(node ast.Node) *GroupInfo { + return &GroupInfo{ + node: node, + } +} + +func (*GroupInfo) Object() types.Object { + return nil +} + +func (*GroupInfo) Type() types.Type { + return nil +} + +func (info *GroupInfo) Node() ast.Node { + return info.node +} + +// Collect gathers information about the declaration group +// described by its receiver. +// It can be called concurrently by multiple goroutines; +// the computation will be performed just once. +// +// Collect returns the receiver for chaining. +// It is safe to call Collect with nil receiver. +// +// After Collect returns, the calling goroutine and all goroutines +// it might spawn afterwards are free to access +// the receiver's fields indefinitely. +func (info *GroupInfo) Collect() *GroupInfo { + if info == nil { + return nil + } + + info.once.Do(func() { + switch n := info.node.(type) { + case *ast.GenDecl: + info.Pos = n.Pos() + info.Doc = n.Doc + + case *ast.ValueSpec: + info.Pos = n.Pos() + info.Doc = n.Doc + if info.Doc == nil { + info.Doc = n.Comment + } else if n.Comment != nil { + info.Doc = &ast.CommentGroup{ + List: slices.Concat(n.Doc.List, n.Comment.List), + } + } + + case *ast.Field: + info.Pos = n.Pos() + info.Doc = n.Doc + if info.Doc == nil { + info.Doc = n.Comment + } else if n.Comment != nil { + info.Doc = &ast.CommentGroup{ + List: slices.Concat(n.Doc.List, n.Comment.List), + } + } + } + }) + + return info +} diff --git a/v3/internal/generator/collect/imports.go b/v3/internal/generator/collect/imports.go new file mode 100644 index 00000000000..0c5f445d1d7 --- /dev/null +++ b/v3/internal/generator/collect/imports.go @@ -0,0 +1,279 @@ +package collect + +import ( + "go/types" + "path/filepath" +) + +type ( + // ImportMap records deduplicated imports by a binding or models module. + // It computes relative import paths and assigns import names, + // taking care to avoid collisions. + ImportMap struct { + // Self records the path of the importing package. + Self string + + // ImportModels records whether models from the current package may be needed. + ImportModels bool + // ImportInternal records whether internal models from the current package may be needed. + ImportInternal bool + + // External records information about each imported package, + // keyed by package path. + External map[string]ImportInfo + + // counters holds the occurence count for each package name in External. + counters map[string]int + collector *Collector + } + + // ImportInfo records information about a single import. + ImportInfo struct { + Name string + Index int // Progressive number for identically named imports, starting from 0 for each distinct name. + RelPath string + } +) + +// NewImportMap initialises an import map for the given importer package. +// The argument may be nil, in which case import paths will be relative +// to the root output directory. +func NewImportMap(importer *PackageInfo) *ImportMap { + var ( + self string + collector *Collector + ) + if importer != nil { + self = importer.Path + collector = importer.collector + } + + return &ImportMap{ + Self: self, + + External: make(map[string]ImportInfo), + + counters: make(map[string]int), + collector: collector, + } +} + +// Merge merges the given import map into the receiver. +// The importing package must be the same. +func (imports *ImportMap) Merge(other *ImportMap) { + if other.Self != imports.Self { + panic("cannot merge import maps with different importing package") + } + + if other.ImportModels { + imports.ImportModels = true + } + if other.ImportInternal { + imports.ImportInternal = true + } + + for path, info := range other.External { + if _, ok := imports.External[path]; ok { + continue + } + + counter := imports.counters[info.Name] + imports.counters[info.Name] = counter + 1 + + imports.External[path] = ImportInfo{ + Name: info.Name, + Index: counter, + RelPath: info.RelPath, + } + } +} + +// Add adds the given package to the import map if not already present, +// choosing import names so as to avoid collisions. +// +// Add does not support unsynchronised concurrent calls +// on the same receiver. +func (imports *ImportMap) Add(pkg *PackageInfo) { + if pkg.Path == imports.Self { + // Do not import self. + return + } + + if imports.External[pkg.Path].Name != "" { + // Package already imported. + return + } + + // Fetch and update counter for name. + counter := imports.counters[pkg.Name] + imports.counters[pkg.Name] = counter + 1 + + // Always add counters to + imports.External[pkg.Path] = ImportInfo{ + Name: pkg.Name, + Index: counter, + RelPath: computeImportPath(imports.Self, pkg.Path), + } +} + +// AddType adds all dependencies of the given type to the import map +// and marks all referenced named types as models. +// +// It is a runtime error to call AddType on an ImportMap +// created with nil importing package. +// +// AddType does not support unsynchronised concurrent calls +// on the same receiver. +func (imports *ImportMap) AddType(typ types.Type) { + imports.addTypeImpl(typ, make(map[*types.TypeName]bool)) +} + +// addTypeImpl provides the actual implementation of AddType. +// The visited parameter is used to break cycles. +func (imports *ImportMap) addTypeImpl(typ types.Type, visited map[*types.TypeName]bool) { + collector := imports.collector + if collector == nil { + panic("AddType called on ImportMap with nil importing package") + } + + for { // Avoid recursion where possible. + switch t := typ.(type) { + case *types.Alias, *types.Named: + obj := typ.(interface{ Obj() *types.TypeName }).Obj() + if visited[obj] { + return + } + visited[obj] = true + + if obj.Pkg() == nil { + // Ignore universe type. + return + } + + if obj.Pkg().Path() == imports.Self { + // Record self import. + if obj.Exported() { + imports.ImportModels = true + } else { + imports.ImportInternal = true + } + } + + // Record model. + imports.collector.Model(obj) + + // Import parent package. + imports.Add(collector.Package(obj.Pkg())) + + instance, _ := t.(interface{ TypeArgs() *types.TypeList }) + if instance != nil { + // Record type argument dependencies. + if targs := instance.TypeArgs(); targs != nil { + for i := range targs.Len() { + imports.addTypeImpl(targs.At(i), visited) + } + } + } + + if collector.options.UseInterfaces { + // No creation/initialisation code required. + return + } + + if _, isAlias := t.(*types.Alias); isAlias { + // Aliased type might be needed during + // JS value creation and initialisation. + typ = types.Unalias(typ) + break + } + + if IsClass(typ) || IsString(typ) || IsAny(typ) { + return + } + + // If named type does not map to a class, string or unknown type, + // its underlying type may be needed during JS value creation. + typ = typ.Underlying() + + case *types.Basic: + if t.Info()&types.IsComplex != 0 { + // Complex types are not supported by encoding/json + collector.logger.Warningf("complex types are not supported by encoding/json") + } + return + + case *types.Array, *types.Pointer, *types.Slice: + typ = typ.(interface{ Elem() types.Type }).Elem() + + case *types.Chan: + collector.logger.Warningf("channel types are not supported by encoding/json") + return + + case *types.Map: + if IsMapKey(t.Key()) { + if IsString(t.Key()) { + // This model type is always rendered as a string alias, + // hence we can generate it and use it as a type for JS object keys. + imports.addTypeImpl(t.Key(), visited) + } + } else { + collector.logger.Warningf( + "%s is used as a map key, but does not implement encoding.TextMarshaler: this will likely result in runtime errors", + types.TypeString(t.Key(), nil), + ) + } + + typ = t.Elem() + + case *types.Signature: + collector.logger.Warningf("function types are not supported by encoding/json") + return + + case *types.Struct: + if t.NumFields() == 0 { + // Empty struct. + return + } + + // Retrieve struct info and ensure it is complete. + info := collector.Struct(t).Collect() + + if len(info.Fields) == 0 { + // No visible fields. + return + } + + // Add field dependencies. + for i := range len(info.Fields) - 1 { + imports.addTypeImpl(info.Fields[i].Type, visited) + } + + // Process last field without recursion. + typ = info.Fields[len(info.Fields)-1].Type + + case *types.Interface, *types.TypeParam: + // No dependencies. + return + + default: + collector.logger.Warningf("unknown type %s: please report this to Wails maintainers", typ) + return + } + } +} + +// computeImportPath returns the shortest relative import path +// through which the importer package can reference the imported one. +func computeImportPath(importer string, imported string) string { + rel, err := filepath.Rel(importer, imported) + if err != nil { + panic(err) + } + + rel = filepath.ToSlash(rel) + if rel[0] == '.' { + return rel + } else { + return "./" + rel + } +} diff --git a/v3/internal/generator/collect/index.go b/v3/internal/generator/collect/index.go new file mode 100644 index 00000000000..05c65c1502f --- /dev/null +++ b/v3/internal/generator/collect/index.go @@ -0,0 +1,117 @@ +package collect + +import ( + "slices" + "strings" +) + +// PackageIndex lists all bindings, models and unexported models +// generated from a package. +// +// When obtained through a call to [PackageInfo.Index], +// each binding and model name appears at most once. +type PackageIndex struct { + Package *PackageInfo + + Services []*ServiceInfo + Models []*ModelInfo + Internal []*ModelInfo +} + +// Index computes a [PackageIndex] for the selected language from the list +// of generated services and models and regenerates cached stats. +// +// Services and models appear at most once in the returned slices, +// which are sorted by name. +// +// Index calls info.Collect, and therefore provides the same guarantees. +// It is safe for concurrent use. +func (info *PackageInfo) Index(TS bool) (index *PackageIndex) { + // Init index. + index = &PackageIndex{ + Package: info.Collect(), + } + + // Init stats + stats := &Stats{ + NumPackages: 1, + } + + // Gather services. + info.services.Range(func(key, value any) bool { + service := value.(*ServiceInfo) + if !service.IsEmpty() { + if service.Object().Exported() { + // Publish non-internal service on the local index. + index.Services = append(index.Services, service) + } + // Update service stats. + stats.NumServices++ + stats.NumMethods += len(service.Methods) + } + return true + }) + + // Sort services by name. + slices.SortFunc(index.Services, func(b1 *ServiceInfo, b2 *ServiceInfo) int { + if b1 == b2 { + return 0 + } + return strings.Compare(b1.Name, b2.Name) + }) + + // Gather models. + info.models.Range(func(key, value any) bool { + model := value.(*ModelInfo) + index.Models = append(index.Models, model) + // Update model stats. + if len(model.Values) > 0 { + stats.NumEnums++ + } else { + stats.NumModels++ + } + return true + }) + + // Sort models by internal property (non-internal first), then by name. + slices.SortFunc(index.Models, func(m1 *ModelInfo, m2 *ModelInfo) int { + if m1 == m2 { + return 0 + } + + m1e, m2e := m1.Object().Exported(), m2.Object().Exported() + if m1e != m2e { + if m1e { + return -1 + } else { + return 1 + } + } + + return strings.Compare(m1.Name, m2.Name) + }) + + // Find first internal model. + split, _ := slices.BinarySearchFunc(index.Models, struct{}{}, func(m *ModelInfo, _ struct{}) int { + if m.Object().Exported() { + return -1 + } else { + return 1 + } + }) + + // Separate internal and non-internal models. + index.Internal = index.Models[split:] + index.Models = index.Models[:split] + + // Cache stats + info.stats.Store(stats) + + return +} + +// IsEmpty returns true if the given index +// contains no data for the selected language. +func (index *PackageIndex) IsEmpty() bool { + return len(index.Package.Injections) == 0 && len(index.Services) == 0 && len(index.Models) == 0 +} diff --git a/v3/internal/generator/collect/method.go b/v3/internal/generator/collect/method.go new file mode 100644 index 00000000000..adff7aaaaa0 --- /dev/null +++ b/v3/internal/generator/collect/method.go @@ -0,0 +1,115 @@ +package collect + +import ( + "go/ast" + "go/types" + "sync" +) + +// MethodInfo records information about a method declaration. +// +// Read accesses to any public field are only safe +// if a call to [MethodInfo.Collect] has completed before the access, +// for example by calling it in the accessing goroutine +// or before spawning the accessing goroutine. +type MethodInfo struct { + Name string + + // Abstract is true when the described method belongs to an interface. + Abstract bool + + Doc *ast.CommentGroup + Decl *GroupInfo + + obj *types.Func + node ast.Node + + collector *Collector + once sync.Once +} + +func newMethodInfo(collector *Collector, obj *types.Func) *MethodInfo { + return &MethodInfo{ + obj: obj, + collector: collector, + } +} + +// Method returns the unique MethodInfo instance +// associated to the given object within a collector. +// +// Method is safe for concurrent use. +func (collector *Collector) Method(obj *types.Func) *MethodInfo { + return collector.fromCache(obj).(*MethodInfo) +} + +func (info *MethodInfo) Object() types.Object { + return info.obj +} + +func (info *MethodInfo) Type() types.Type { + return info.obj.Type() +} + +func (info *MethodInfo) Node() ast.Node { + return info.Collect().node +} + +// Collect gathers information about the method described by its receiver. +// It can be called concurrently by multiple goroutines; +// the computation will be performed just once. +// +// Collect returns the receiver for chaining. +// It is safe to call Collect with nil receiver. +// +// After Collect returns, the calling goroutine and all goroutines +// it might spawn afterwards are free to access +// the receiver's fields indefinitely. +func (info *MethodInfo) Collect() *MethodInfo { + if info == nil { + return nil + } + + info.once.Do(func() { + collector := info.collector + + info.Name = info.obj.Name() + + path := collector.findDeclaration(info.obj) + if path == nil { + recv := "" + if info.obj.Type() != nil { + recv = info.obj.Type().(*types.Signature).Recv().Type().String() + "." + } + + collector.logger.Warningf( + "package %s: method %s%s: could not find declaration for method object", + info.obj.Pkg().Path(), + recv, + info.obj.Name(), + ) + + // Provide dummy group. + info.Decl = newGroupInfo(nil).Collect() + return + } + + // path shape: *ast.FuncDecl/*ast.Field, ... + info.node = path[0] + + // Retrieve doc comments. + switch n := info.node.(type) { + case *ast.FuncDecl: + // Concrete method. + info.Doc = n.Doc + info.Decl = newGroupInfo(nil).Collect() // Provide dummy group. + + case *ast.Field: + // Abstract method. + info.Abstract = true + info.Decl = newGroupInfo(path[0]).Collect() + } + }) + + return info +} diff --git a/v3/internal/generator/collect/model.go b/v3/internal/generator/collect/model.go new file mode 100644 index 00000000000..a28c16a9676 --- /dev/null +++ b/v3/internal/generator/collect/model.go @@ -0,0 +1,287 @@ +package collect + +import ( + "cmp" + "go/constant" + "go/types" + "slices" + "strings" + "sync" +) + +type ( + // ModelInfo records all information that is required + // to render JS/TS code for a model type. + // + // Read accesses to exported fields are only safe + // if a call to [ModelInfo.Collect] has completed before the access, + // for example by calling it in the accessing goroutine + // or before spawning the accessing goroutine. + ModelInfo struct { + *TypeInfo + + // Imports records dependencies for this model. + Imports *ImportMap + + // Type records the target type for an alias or derived model, + // the underlying type for an enum. + Type types.Type + + // Fields records the property list for a class or struct alias model, + // in order of declaration and grouped by their declaring [ast.Field]. + Fields [][]*ModelFieldInfo + + // Values records the value list for an enum model, + // in order of declaration and grouped + // by their declaring [ast.GenDecl] and [ast.ValueSpec]. + Values [][][]*ConstInfo + + // TypeParams records type parameter names for generic models. + TypeParams []string + + collector *Collector + once sync.Once + } + + // ModelFieldInfo holds extended information + // about a struct field in a model type. + ModelFieldInfo struct { + *StructField + *FieldInfo + } +) + +func newModelInfo(collector *Collector, obj *types.TypeName) *ModelInfo { + return &ModelInfo{ + TypeInfo: collector.Type(obj), + collector: collector, + } +} + +// Model retrieves the the unique [ModelInfo] instance +// associated to the given type object within a Collector. +// If none is present, Model initialises a new one +// registers it for code generation +// and schedules background collection activity. +// +// Model is safe for concurrent use. +func (collector *Collector) Model(obj *types.TypeName) *ModelInfo { + pkg := collector.Package(obj.Pkg()) + if pkg == nil { + return nil + } + + model, present := pkg.recordModel(obj) + if !present { + collector.scheduler.Schedule(func() { model.Collect() }) + } + + return model +} + +// Collect gathers information for the model described by its receiver. +// It can be called concurrently by multiple goroutines; +// the computation will be performed just once. +// +// Collect returns the receiver for chaining. +// It is safe to call Collect with nil receiver. +// +// After Collect returns, the calling goroutine and all goroutines +// it might spawn afterwards are free to access +// the receiver's fields indefinitely. +func (info *ModelInfo) Collect() *ModelInfo { + if info == nil { + return nil + } + + // Changes in the following logic must be reflected adequately + // by the predicates in properties.go, by ImportMap.AddType + // and by all render.Module methods. + + info.once.Do(func() { + collector := info.collector + obj := info.Object().(*types.TypeName) + + typ := obj.Type() + + // Collect type information. + info.TypeInfo.Collect() + + // Initialise import map. + info.Imports = NewImportMap(collector.Package(obj.Pkg())) + + // Setup fallback type. + info.Type = types.Universe.Lookup("any").Type() + + // Retrieve type denotation and skip alias chains. + def := info.TypeInfo.Def + + // Check marshalers and detect enums. + var constants []*types.Const + + var isGeneric bool + if generic, ok := obj.Type().(interface{ TypeParams() *types.TypeParamList }); ok { + // Record type parameter names. + tparams := generic.TypeParams() + isGeneric = tparams != nil + + if isGeneric && tparams.Len() > 0 { + info.TypeParams = make([]string, tparams.Len()) + for i := range tparams.Len() { + info.TypeParams[i] = tparams.At(i).Obj().Name() + } + } + } + + if _, isNamed := obj.Type().(*types.Named); isNamed { + // Model is a named type. + // Check whether it implements marshaler interfaces + // or has defined constants. + + if IsAny(typ) { + // Type marshals to a custom value of unknown shape. + return + } else if MaybeTextMarshaler(typ) { + // Type marshals to a custom string of unknown shape. + info.Type = types.Typ[types.String] + return + } else if isGeneric && !collector.options.UseInterfaces && IsClass(typ) { + // Generic classes cannot be defined in terms of other generic classes. + // That would break class creation code, + // and I (@fbbdev) couldn't find any other satisfying workaround. + def = typ.Underlying() + } + + // Test for enums (excluding generic types). + basic, ok := typ.Underlying().(*types.Basic) + if ok && !isGeneric && basic.Info()&types.IsConstType != 0 && basic.Info()&types.IsComplex == 0 { + // Named type is defined as a representable constant type: + // look for defined constants of that named type. + for _, name := range obj.Pkg().Scope().Names() { + if cnst, ok := obj.Pkg().Scope().Lookup(name).(*types.Const); ok { + if cnst.Val().Kind() != constant.Unknown && types.Identical(cnst.Type(), typ) { + constants = append(constants, cnst) + } + } + } + } + } + + // Record required imports. + info.Imports.AddType(def) + + // Handle enum types. + // constants slice is always empty for aliases. + if len(constants) > 0 { + // Collect information about enum values. + info.collectEnum(constants) + info.Type = def + return + } + + // Handle struct types. + strct, isStruct := def.(*types.Struct) + if isStruct { + // Collect information about struct fields. + info.collectStruct(strct) + info.Type = nil + return + } + + // That's all, folks. Render as a TS alias. + info.Type = def + }) + + return info +} + +// collectEnum collects information about enum values and their declarations. +func (info *ModelInfo) collectEnum(constants []*types.Const) { + // Collect information about each constant object. + values := make([]*ConstInfo, len(constants)) + for i, cnst := range constants { + values[i] = info.collector.Const(cnst).Collect() + } + + // Sort values by grouping and source order. + slices.SortFunc(values, func(v1 *ConstInfo, v2 *ConstInfo) int { + // Skip comparisons for identical pointers. + if v1 == v2 { + return 0 + } + + // Sort first by source order of declaration group. + if v1.Decl != v2.Decl { + return cmp.Compare(v1.Decl.Pos, v2.Decl.Pos) + } + + // Then by source order of spec. + if v1.Spec != v2.Spec { + return cmp.Compare(v1.Spec.Pos, v2.Spec.Pos) + } + + // Then by source order of identifiers. + if v1.Pos != v2.Pos { + return cmp.Compare(v1.Pos, v2.Pos) + } + + // Finally by name (for constants whose source position is unknown). + return strings.Compare(v1.Name, v2.Name) + }) + + // Split value list into groups and subgroups. + var decl, spec *GroupInfo + decli, speci := -1, -1 + + for _, value := range values { + if value.Spec != spec { + spec = value.Spec + + if value.Decl == decl { + speci++ + } else { + decl = value.Decl + decli++ + speci = 0 + info.Values = append(info.Values, nil) + } + + info.Values[decli] = append(info.Values[decli], nil) + } + + info.Values[decli][speci] = append(info.Values[decli][speci], value) + } +} + +// collectStruct collects information about struct fields and their declarations. +func (info *ModelInfo) collectStruct(strct *types.Struct) { + collector := info.collector + + // Retrieve struct info. + structInfo := collector.Struct(strct).Collect() + + // Allocate result slice. + fields := make([]*ModelFieldInfo, len(structInfo.Fields)) + + // Collect fields. + for i, field := range structInfo.Fields { + fields[i] = &ModelFieldInfo{ + StructField: field, + FieldInfo: collector.Field(field.Object).Collect(), + } + } + + // Split field list into groups, preserving the original order. + var decl *GroupInfo + decli := -1 + + for _, field := range fields { + if field.Decl != decl { + decl = field.Decl + decli++ + info.Fields = append(info.Fields, nil) + } + + info.Fields[decli] = append(info.Fields[decli], field) + } +} diff --git a/v3/internal/generator/collect/package.go b/v3/internal/generator/collect/package.go new file mode 100644 index 00000000000..b03d5e57762 --- /dev/null +++ b/v3/internal/generator/collect/package.go @@ -0,0 +1,293 @@ +package collect + +import ( + "cmp" + "go/ast" + "go/token" + "go/types" + "path/filepath" + "slices" + "strings" + "sync" + "sync/atomic" + + "golang.org/x/tools/go/packages" +) + +// PackageInfo records information about a package. +// +// Read accesses to fields Path, Name, Types, TypesInfo, Fset +// are safe at any time without any synchronisation. +// +// Read accesses to all other fields are only safe +// if a call to [PackageInfo.Collect] has completed before the access, +// for example by calling it in the accessing goroutine +// or before spawning the accessing goroutine. +// +// Concurrent write accesses are only allowed through the provided methods. +type PackageInfo struct { + // Path holds the canonical path of the described package. + Path string + + // Name holds the import name of the described package. + Name string + + // Types and TypesInfo hold type information for this package. + Types *types.Package + TypesInfo *types.Info + + // Fset holds the FileSet that was used to parse this package. + Fset *token.FileSet + + // Files holds parsed files for this package, + // ordered by start position to support binary search. + Files []*ast.File + + // Docs holds package doc comments. + Docs []*ast.CommentGroup + + // Includes holds a list of additional files to include + // with the generated bindings. + // It maps file names to their paths on disk. + Includes map[string]string + + // Injections holds a list of code lines to be injected + // into the package index file. + Injections []string + + // services records service types that have to be generated for this package. + // We rely upon [sync.Map] for atomic swapping support. + // Keys are *types.TypeName, values are *ServiceInfo. + services sync.Map + + // models records model types that have to be generated for this package. + // We rely upon [sync.Map] for atomic swapping support. + // Keys are *types.TypeName, values are *ModelInfo. + models sync.Map + + // stats caches statistics about this package. + stats atomic.Pointer[Stats] + + collector *Collector + once sync.Once +} + +func newPackageInfo(pkg *packages.Package, collector *Collector) *PackageInfo { + return &PackageInfo{ + Path: pkg.PkgPath, + Name: pkg.Name, + + Types: pkg.Types, + TypesInfo: pkg.TypesInfo, + + Fset: pkg.Fset, + Files: pkg.Syntax, + + collector: collector, + } +} + +// Package retrieves the the unique [PackageInfo] instance, if any, +// associated to the given package object within a Collector. +// +// Package is safe for concurrent use. +func (collector *Collector) Package(pkg *types.Package) *PackageInfo { + return collector.pkgs[pkg] +} + +// Iterate calls yield sequentially for each [PackageInfo] instance +// registered with the collector. If yield returns false, +// Iterate stops the iteration. +// +// Iterate is safe for concurrent use. +func (collector *Collector) Iterate(yield func(pkg *PackageInfo) bool) { + for _, pkg := range collector.pkgs { + if !yield(pkg) { + return + } + } +} + +// Stats returns cached statistics for this package. +// If [PackageInfo.Index] has not been called yet, it returns nil. +// +// Stats is safe for unsynchronised concurrent calls. +func (info *PackageInfo) Stats() *Stats { + return info.stats.Load() +} + +// Collect gathers information about the package described by its receiver. +// It can be called concurrently by multiple goroutines; +// the computation will be performed just once. +// +// Collect returns the receiver for chaining. +// It is safe to call Collect with nil receiver. +// +// After Collect returns, the calling goroutine and all goroutines +// it might spawn afterwards are free to access +// the receiver's fields indefinitely. +func (info *PackageInfo) Collect() *PackageInfo { + if info == nil { + return nil + } + + info.once.Do(func() { + collector := info.collector + + // Sort files by source position. + if !slices.IsSortedFunc(info.Files, compareAstFiles) { + info.Files = slices.Clone(info.Files) + slices.SortFunc(info.Files, compareAstFiles) + } + + // Collect docs and parse directives. + for _, file := range info.Files { + if file.Doc == nil { + continue + } + + info.Docs = append(info.Docs, file.Doc) + + // Retrieve file directory. + pos := info.Fset.Position(file.Pos()) + if !pos.IsValid() { + collector.logger.Errorf( + "package %s: found AST file with unknown path: `wails:include` directives from that file will be ignored", + info.Path, + ) + } + dir := filepath.Dir(pos.Filename) + + // Parse directives. + if info.Includes == nil { + info.Includes = make(map[string]string) + } + for _, comment := range file.Doc.List { + switch { + case IsDirective(comment.Text, "inject"): + // Check condition. + line, cond, err := ParseCondition(ParseDirective(comment.Text, "inject")) + if err != nil { + collector.logger.Errorf( + "%s: in `wails:inject` directive: %v", + info.Fset.Position(comment.Pos()), + err, + ) + continue + } + + if !cond.Satisfied(collector.options) { + continue + } + + // Record injected line. + info.Injections = append(info.Injections, line) + + case pos.IsValid() && IsDirective(comment.Text, "include"): + // Check condition. + pattern, cond, err := ParseCondition(ParseDirective(comment.Text, "include")) + if err != nil { + collector.logger.Errorf( + "%s: in `wails:include` directive: %v", + info.Fset.Position(comment.Pos()), + err, + ) + continue + } + + if !cond.Satisfied(collector.options) { + continue + } + + // Collect matching files. + paths, err := filepath.Glob(filepath.Join(dir, pattern)) + if err != nil { + collector.logger.Errorf( + "%s: invalid pattern '%s' in `wails:include` directive: %v", + info.Fset.Position(comment.Pos()), + pattern, + err, + ) + continue + } else if len(paths) == 0 { + collector.logger.Warningf( + "%s: pattern '%s' in `wails:include` directive matched no files", + info.Fset.Position(comment.Pos()), + pattern, + ) + continue + } + + // Announce and record matching files. + for _, path := range paths { + name := strings.ToLower(filepath.Base(path)) + if old, ok := info.Includes[name]; ok { + collector.logger.Errorf( + "%s: duplicate included file name '%s' in package %s; old path: '%s'; new path: '%s'", + info.Fset.Position(comment.Pos()), + name, + info.Path, + old, + path, + ) + continue + } + + collector.logger.Debugf( + "including file '%s' as '%s' in package %s", + path, + name, + info.Path, + ) + + info.Includes[name] = path + } + } + } + } + }) + + return info +} + +// recordService adds the given service type object +// to the set of bindings generated for this package. +// It returns the unique [ServiceInfo] instance associated +// with the given type object. +// +// It is an error to pass in here a type whose parent package +// is not the one described by the receiver. +// +// recordService is safe for unsynchronised concurrent calls. +func (info *PackageInfo) recordService(obj *types.TypeName) *ServiceInfo { + // Fetch current value, then add if not already present. + service, _ := info.services.Load(obj) + if service == nil { + service, _ = info.services.LoadOrStore(obj, newServiceInfo(info.collector, obj)) + } + return service.(*ServiceInfo) +} + +// recordModel adds the given model type object +// to the set of models generated for this package. +// It returns the unique [ModelInfo] instance associated +// with the given type object. The present result is true +// if the model was already registered. +// +// It is an error to pass in here a type whose parent package +// is not the one described by the receiver. +// +// recordModel is safe for unsynchronised concurrent calls. +func (info *PackageInfo) recordModel(obj *types.TypeName) (model *ModelInfo, present bool) { + // Fetch current value, then add if not already present. + imodel, present := info.models.Load(obj) + if imodel == nil { + imodel, present = info.models.LoadOrStore(obj, newModelInfo(info.collector, obj)) + } + return imodel.(*ModelInfo), present +} + +// compareAstFiles compares two AST files by starting position. +func compareAstFiles(f1 *ast.File, f2 *ast.File) int { + return cmp.Compare(f1.FileStart, f2.FileStart) +} diff --git a/v3/internal/generator/collect/properties.go b/v3/internal/generator/collect/properties.go new file mode 100644 index 00000000000..194d06dff5f --- /dev/null +++ b/v3/internal/generator/collect/properties.go @@ -0,0 +1,152 @@ +package collect + +// This file gathers functions that test useful properties of model types. +// The rationale for the way things are handled here +// is given in the example file found at ./_reference/json_marshaler_behaviour.go + +import ( + "go/token" + "go/types" +) + +// Cached interface types. +var ( + ifaceTextMarshaler = types.NewInterfaceType([]*types.Func{ + types.NewFunc(token.NoPos, nil, "MarshalText", + types.NewSignatureType(nil, nil, nil, types.NewTuple(), types.NewTuple( + types.NewParam(token.NoPos, nil, "", types.NewSlice(types.Universe.Lookup("byte").Type())), + types.NewParam(token.NoPos, nil, "", types.Universe.Lookup("error").Type()), + ), false)), + }, nil).Complete() + + ifaceJSONMarshaler = types.NewInterfaceType([]*types.Func{ + types.NewFunc(token.NoPos, nil, "MarshalJSON", + types.NewSignatureType(nil, nil, nil, types.NewTuple(), types.NewTuple( + types.NewParam(token.NoPos, nil, "", types.NewSlice(types.Universe.Lookup("byte").Type())), + types.NewParam(token.NoPos, nil, "", types.Universe.Lookup("error").Type()), + ), false)), + }, nil).Complete() +) + +// IsTextMarshaler tests whether the given type implements +// the encoding.TextMarshaler interface. +func IsTextMarshaler(typ types.Type) bool { + return types.Implements(typ, ifaceTextMarshaler) +} + +// MaybeTextMarshaler tests whether the given type implements +// the encoding.TextMarshaler interface for at least one receiver form. +func MaybeTextMarshaler(typ types.Type) bool { + if _, ok := types.Unalias(typ).(*types.Pointer); !ok { + typ = types.NewPointer(typ) + } + return IsTextMarshaler(typ) +} + +// IsJSONMarshaler tests whether the given type implements +// the json.Marshaler interface. +func IsJSONMarshaler(typ types.Type) bool { + return types.Implements(typ, ifaceJSONMarshaler) +} + +// MaybeJSONMarshaler tests whether the given type implements +// the json.Marshaler interface for at least one receiver form. +func MaybeJSONMarshaler(typ types.Type) bool { + if _, ok := types.Unalias(typ).(*types.Pointer); !ok { + typ = types.NewPointer(typ) + } + return IsJSONMarshaler(typ) +} + +// IsMapKey returns true if the given type +// is accepted as a map key by encoding/json. +func IsMapKey(typ types.Type) bool { + if basic, ok := typ.Underlying().(*types.Basic); ok { + return basic.Info()&(types.IsInteger|types.IsString) != 0 + } + + // Other types are only accepted + // if they implement encoding.TextMarshaler strictly as they are. + return IsTextMarshaler(typ) +} + +// IsString returns true if the given type (or element type for pointers) +// will be rendered as an alias for the TS string type. +func IsString(typ types.Type) bool { + // Unwrap at most one pointer. + // NOTE: do not unalias typ before testing: + // aliases whose underlying type is a pointer + // are _never_ rendered as strings. + if ptr, ok := typ.(*types.Pointer); ok { + typ = ptr.Elem() + } + + switch typ.(type) { + case *types.Alias, *types.Named: + // Aliases and named types might be rendered as string aliases. + default: + // Not a model type. + return false + } + + // Follow alias chain. + typ = types.Unalias(typ) + + if basic, ok := typ.(*types.Basic); ok { + // Test whether basic type is a string. + return basic.Info()&types.IsString != 0 + } + + // JSONMarshalers can only be rendered as any. + // TextMarshalers that aren't JSONMarshalers render as strings. + if MaybeJSONMarshaler(typ) { + return false + } else if MaybeTextMarshaler(typ) { + return true + } + + // Named types whose underlying type is a string are rendered as strings. + basic, ok := typ.Underlying().(*types.Basic) + return ok && basic.Info()&types.IsString != 0 +} + +// IsClass returns true if the given type will be rendered +// as a JS/TS model class (or interface). +func IsClass(typ types.Type) bool { + // Follow alias chain. + typ = types.Unalias(typ) + + if _, isNamed := typ.(*types.Named); !isNamed { + // Not a model type. + return false + } + + // Struct types without custom marshaling are rendered as classes. + _, isStruct := typ.Underlying().(*types.Struct) + return isStruct && !MaybeJSONMarshaler(typ) && !MaybeTextMarshaler(typ) +} + +// IsAny returns true if the given type will be rendered as a TS any type. +func IsAny(typ types.Type) bool { + // Follow alias chain. + typ = types.Unalias(typ) + + if MaybeJSONMarshaler(typ) { + return true + } + + if MaybeTextMarshaler(typ) { + return false + } + + // Retrieve underlying type + switch t := typ.Underlying().(type) { + case *types.Basic: + // Complex types are not supported. + return t.Info()&types.IsComplex != 0 + case *types.Chan, *types.Signature, *types.Interface: + return true + } + + return false +} diff --git a/v3/internal/generator/collect/service.go b/v3/internal/generator/collect/service.go new file mode 100644 index 00000000000..fc0d30a8c6b --- /dev/null +++ b/v3/internal/generator/collect/service.go @@ -0,0 +1,311 @@ +package collect + +import ( + "fmt" + "go/ast" + "go/types" + "strconv" + "sync" + + "github.com/wailsapp/wails/v3/internal/hash" + "golang.org/x/tools/go/types/typeutil" +) + +type ( + // ServiceInfo records all information that is required + // to render JS/TS code for a service type. + // + // Read accesses to any public field are only safe + // if a call to [ServiceInfo.Collect] has completed before the access, + // for example by calling it in the accessing goroutine + // or before spawning the accessing goroutine. + ServiceInfo struct { + *TypeInfo + + Imports *ImportMap + Methods []*ServiceMethodInfo + + // Injections stores a list of JS code lines + // that should be injected into the generated file. + Injections []string + + collector *Collector + once sync.Once + } + + // ServiceMethodInfo records all information that is required + // to render JS/TS code for a service method. + ServiceMethodInfo struct { + *MethodInfo + FQN string + ID string + Internal bool + Params []*ParamInfo + Results []types.Type + } + + // ParamInfo records all information that is required + // to render JS/TS code for a service method parameter. + ParamInfo struct { + Name string + Type types.Type + Blank bool + Variadic bool + } +) + +func newServiceInfo(collector *Collector, obj *types.TypeName) *ServiceInfo { + return &ServiceInfo{ + TypeInfo: collector.Type(obj), + collector: collector, + } +} + +// Service returns the unique ServiceInfo instance +// associated to the given object within a collector +// and registers it for code generation. +// +// Service is safe for concurrent use. +func (collector *Collector) Service(obj *types.TypeName) *ServiceInfo { + pkg := collector.Package(obj.Pkg()) + if pkg == nil { + return nil + } + + return pkg.recordService(obj) +} + +// IsEmpty returns true if no methods or code injections +// are present for this service, for the selected language. +func (info *ServiceInfo) IsEmpty() bool { + // Ensure information has been collected. + info.Collect() + return len(info.Injections) == 0 && len(info.Methods) == 0 +} + +// Collect gathers information about the service described by its receiver. +// It can be called concurrently by multiple goroutines; +// the computation will be performed just once. +// +// Collect returns the receiver for chaining. +// It is safe to call Collect with nil receiver. +// +// After Collect returns, the calling goroutine and all goroutines +// it might spawn afterwards are free to access +// the receiver's fields indefinitely. +func (info *ServiceInfo) Collect() *ServiceInfo { + if info == nil { + return nil + } + + info.once.Do(func() { + collector := info.collector + obj := info.Object().(*types.TypeName) + + // Collect type information. + info.TypeInfo.Collect() + + // Initialise import map. + info.Imports = NewImportMap(collector.Package(obj.Pkg())) + + // Compute intuitive method set (i.e. both pointer and non-pointer receiver). + // Do not use a method set cache because + // - it would hurt concurrency (requires mutual exclusion), + // - it is only useful when the same type is queried many times; + // this may only happen here if some embedded types appear frequently, + // which should be far from average. + mset := typeutil.IntuitiveMethodSet(obj.Type(), nil) + + // Collect method information. + info.Methods = make([]*ServiceMethodInfo, 0, len(mset)) + for _, sel := range mset { + if !sel.Obj().Exported() { + // Ignore unexported methods. + continue + } + + methodInfo := info.collectMethod(sel.Obj().(*types.Func)) + if methodInfo != nil { + info.Methods = append(info.Methods, methodInfo) + } + } + + // Parse directives. + for _, doc := range []*ast.CommentGroup{info.Doc, info.Decl.Doc} { + if doc == nil { + continue + } + for _, comment := range doc.List { + if IsDirective(comment.Text, "inject") { + // Check condition. + line, cond, err := ParseCondition(ParseDirective(comment.Text, "inject")) + if err != nil { + collector.logger.Errorf( + "%s: in `wails:inject` directive: %v", + collector.Package(obj.Pkg()).Fset.Position(comment.Pos()), + err, + ) + continue + } + + if !cond.Satisfied(collector.options) { + continue + } + + // Record injected line. + info.Injections = append(info.Injections, line) + } + } + } + }) + + return info +} + +// typeError caches the type-checker type for the Go error interface. +var typeError = types.Universe.Lookup("error").Type() + +// typeAny caches the empty interface type. +var typeAny = types.Universe.Lookup("any").Type().Underlying() + +// collectMethod collects and returns information about a service method. +// It is intended to be called only by ServiceInfo.Collect. +func (info *ServiceInfo) collectMethod(method *types.Func) *ServiceMethodInfo { + collector := info.collector + obj := info.Object().(*types.TypeName) + + signature, _ := method.Type().(*types.Signature) + if signature == nil { + // Skip invalid interface method. + // TODO: is this actually necessary? + return nil + } + + // Compute fully qualified name. + path := obj.Pkg().Path() + if obj.Pkg().Name() == "main" { + // reflect.Method.PkgPath is always "main" for the main package. + // This should not cause collisions because + // other main packages are not importable. + path = "main" + } + + fqn := path + "." + obj.Name() + "." + method.Name() + id, _ := hash.Fnv(fqn) + + methodInfo := &ServiceMethodInfo{ + MethodInfo: collector.Method(method).Collect(), + FQN: fqn, + ID: strconv.FormatUint(uint64(id), 10), + Params: make([]*ParamInfo, 0, signature.Params().Len()), + Results: make([]types.Type, 0, signature.Results().Len()), + } + + // Parse directives. + if methodInfo.Doc != nil { + var methodIdFound bool + + for _, comment := range methodInfo.Doc.List { + switch { + case IsDirective(comment.Text, "internal"): + methodInfo.Internal = true + + case !methodIdFound && IsDirective(comment.Text, "id"): + idString := ParseDirective(comment.Text, "id") + idValue, err := strconv.ParseUint(idString, 10, 32) + + if err != nil { + collector.logger.Errorf( + "%s: invalid value '%s' in `wails:id` directive: expected a valid uint32 value", + collector.Package(method.Pkg()).Fset.Position(comment.Pos()), + idString, + ) + continue + } + + // Announce and record alias. + collector.logger.Infof( + "package %s: method %s.%s: default ID %s replaced by %d", + path, + obj.Name(), + method.Name(), + methodInfo.ID, + idValue, + ) + methodInfo.ID = strconv.FormatUint(idValue, 10) + } + } + } + + var needsContext bool + + // Collect parameters. + for i := range signature.Params().Len() { + param := signature.Params().At(i) + + if i == 0 { + // Skip first parameter if it has context type. + named, ok := types.Unalias(param.Type()).(*types.Named) + if ok && named.Obj().Pkg().Path() == collector.systemPaths.ContextPackage && named.Obj().Name() == "Context" { + needsContext = true + continue + } + } + + if i == 0 || (i == 1 && needsContext) { + // Skip first parameter if it has window type, + // or second parameter if it has window type and first is context. + named, ok := types.Unalias(param.Type()).(*types.Named) + if ok && named.Obj().Pkg().Path() == collector.systemPaths.ApplicationPackage && named.Obj().Name() == "Window" { + continue + } + } + + if types.IsInterface(param.Type()) && !types.Identical(param.Type(), typeAny) { + paramName := param.Name() + if paramName == "" || paramName == "_" { + paramName = fmt.Sprintf("#%d", i+1) + } + + collector.logger.Warningf( + "%s: parameter %s has non-empty interface type %s: this is not supported by encoding/json and will likely result in runtime errors", + collector.Package(method.Pkg()).Fset.Position(param.Pos()), + paramName, + param.Type(), + ) + } + + // Record type dependencies. + info.Imports.AddType(param.Type()) + + // Record parameter. + methodInfo.Params = append(methodInfo.Params, &ParamInfo{ + Name: param.Name(), + Type: param.Type(), + Blank: param.Name() == "" || param.Name() == "_", + }) + } + + if signature.Variadic() { + methodInfo.Params[len(methodInfo.Params)-1].Type = methodInfo.Params[len(methodInfo.Params)-1].Type.(*types.Slice).Elem() + methodInfo.Params[len(methodInfo.Params)-1].Variadic = true + } + + // Collect results. + for i := range signature.Results().Len() { + result := signature.Results().At(i) + + if types.Identical(result.Type(), typeError) { + // Skip error results, they are thrown as exceptions + continue + } + + // Record type dependencies. + info.Imports.AddType(result.Type()) + + // Record result. + methodInfo.Results = append(methodInfo.Results, result.Type()) + } + + return methodInfo +} diff --git a/v3/internal/generator/collect/stats.go b/v3/internal/generator/collect/stats.go new file mode 100644 index 00000000000..984c7e5043a --- /dev/null +++ b/v3/internal/generator/collect/stats.go @@ -0,0 +1,34 @@ +package collect + +import "time" + +type Stats struct { + NumPackages int + NumServices int + NumMethods int + NumEnums int + NumModels int + StartTime time.Time + EndTime time.Time +} + +func (stats *Stats) Start() { + stats.StartTime = time.Now() + stats.EndTime = stats.StartTime +} + +func (stats *Stats) Stop() { + stats.EndTime = time.Now() +} + +func (stats *Stats) Elapsed() time.Duration { + return stats.EndTime.Sub(stats.StartTime) +} + +func (stats *Stats) Add(other *Stats) { + stats.NumPackages += other.NumPackages + stats.NumServices += other.NumServices + stats.NumMethods += other.NumMethods + stats.NumEnums += other.NumEnums + stats.NumModels += other.NumModels +} diff --git a/v3/internal/generator/collect/struct.go b/v3/internal/generator/collect/struct.go new file mode 100644 index 00000000000..86c3bd8c617 --- /dev/null +++ b/v3/internal/generator/collect/struct.go @@ -0,0 +1,344 @@ +package collect + +import ( + "cmp" + "go/ast" + "go/types" + "reflect" + "slices" + "strings" + "sync" + "unicode" +) + +type ( + // StructInfo records the flattened field list for a struct type, + // taking into account JSON tags. + // + // The field list is initially empty. It will be populated + // upon calling [StructInfo.Collect] for the first time. + // + // Read accesses to the field list are only safe + // if a call to [StructInfo.Collect] has been completed before the access, + // for example by calling it in the accessing goroutine + // or before spawning the accessing goroutine. + StructInfo struct { + Fields []*StructField + + typ *types.Struct + + collector *Collector + once sync.Once + } + + // FieldInfo represents a single field in a struct. + StructField struct { + JsonName string // Avoid collisions with [FieldInfo.Name]. + Type types.Type + Optional bool + Quoted bool + + // Object holds the described type-checker object. + Object *types.Var + } +) + +func newStructInfo(collector *Collector, typ *types.Struct) *StructInfo { + return &StructInfo{ + typ: typ, + collector: collector, + } +} + +// Struct retrieves the unique [StructInfo] instance +// associated to the given type within a Collector. +// If none is present, a new one is initialised. +// +// Struct is safe for concurrent use. +func (collector *Collector) Struct(typ *types.Struct) *StructInfo { + // Cache by type pointer, do not use a typeutil.Map: + // - for models, it may result in incorrect comments; + // - for anonymous structs, it would probably bring little benefit + // because the probability of repetitions is much lower. + + return collector.fromCache(typ).(*StructInfo) +} + +func (*StructInfo) Object() types.Object { + return nil +} + +func (info *StructInfo) Type() types.Type { + return info.typ +} + +func (*StructInfo) Node() ast.Node { + return nil +} + +// Collect gathers information for the structure described by its receiver. +// It can be called concurrently by multiple goroutines; +// the computation will be performed just once. +// +// The field list of the receiver is populated +// by the same flattening algorithm employed by encoding/json. +// JSON struct tags are accounted for. +// +// Collect returns the receiver for chaining. +// It is safe to call Collect with nil receiver. +// +// After Collect returns, the calling goroutine and all goroutines +// it might spawn afterwards are free to access +// the receiver's fields indefinitely. +func (info *StructInfo) Collect() *StructInfo { + if info == nil { + return nil + } + + type fieldData struct { + *StructField + + // Data for the encoding/json flattening algorithm. + nameFromTag bool + index []int + } + + info.once.Do(func() { + // Flattened list of fields with additional information. + fields := make([]fieldData, 0, info.typ.NumFields()) + + // Queued embedded types for current and next level. + current := make([]fieldData, 0, info.typ.NumFields()) + next := make([]fieldData, 1, max(1, info.typ.NumFields())) + + // Count of queued embedded types for current and next level. + count := make(map[*types.Struct]int) + nextCount := make(map[*types.Struct]int) + + // Set of visited types to avoid duplicating work. + visited := make(map[*types.Struct]bool) + + next[0] = fieldData{ + StructField: &StructField{ + Type: info.typ, + }, + } + + for len(next) > 0 { + current, next = next, current[:0] + count, nextCount = nextCount, count + clear(nextCount) + + for _, embedded := range current { + // Scan embedded type for fields to include. + estruct := embedded.Type.Underlying().(*types.Struct) + + // Skip previously visited structs + if visited[estruct] { + continue + } + visited[estruct] = true + + // WARNING: do not reuse cached info for embedded structs. + // It may lead to incorrect results for subtle reasons. + + for i := range estruct.NumFields() { + field := estruct.Field(i) + + // Retrieve type of field, following aliases conservatively + // and unwrapping exactly one pointer. + ftype := field.Type() + if ptr, ok := types.Unalias(ftype).(*types.Pointer); ok { + ftype = ptr.Elem() + } + + // Detect struct alias and keep it. + fstruct, _ := types.Unalias(ftype).(*types.Struct) + if fstruct == nil { + // Not a struct alias, follow alias chain. + ftype = types.Unalias(ftype) + fstruct, _ = ftype.Underlying().(*types.Struct) + } + + if field.Embedded() { + if !field.Exported() && fstruct == nil { + // Ignore embedded fields of unexported non-struct types. + continue + } + } else if !field.Exported() { + // Ignore unexported non-embedded fields. + continue + } + + // Retrieve and parse json tag. + tag := reflect.StructTag(estruct.Tag(i)).Get("json") + name, optional, quoted, visible := parseTag(tag) + if !visible { + // Ignored by encoding/json. + continue + } + + if !isValidFieldName(name) { + // Ignore alternative name if invalid. + name = "" + } + + index := make([]int, len(embedded.index)+1) + copy(index, embedded.index) + index[len(embedded.index)] = i + + if name != "" || !field.Embedded() || fstruct == nil { + // Tag name is non-empty, + // or field is not embedded, + // or field is not structure: + // add to field list. + + finfo := fieldData{ + StructField: &StructField{ + JsonName: name, + Type: field.Type(), + Optional: optional, + Quoted: quoted, + + Object: field, + }, + nameFromTag: name != "", + index: index, + } + + if name == "" { + finfo.JsonName = field.Name() + } + + fields = append(fields, finfo) + if count[estruct] > 1 { + // The struct we are scanning + // appears multiple times at the current level. + // This means that all its fields are ambiguous + // and must disappear. + // Duplicate them so that the field selection phase + // below will erase them. + fields = append(fields, finfo) + } + + continue + } + + // Queue embedded field for next level. + // If it has been queued already, do not duplicate it. + nextCount[fstruct]++ + if nextCount[fstruct] == 1 { + next = append(next, fieldData{ + StructField: &StructField{ + Type: ftype, + }, + index: index, + }) + } + } + } + } + + // Prepare for field selection phase. + slices.SortFunc(fields, func(f1 fieldData, f2 fieldData) int { + // Sort by name first. + if diff := strings.Compare(f1.JsonName, f2.JsonName); diff != 0 { + return diff + } + + // Break ties by depth of occurrence. + if diff := cmp.Compare(len(f1.index), len(f2.index)); diff != 0 { + return diff + } + + // Break ties by presence of json tag (prioritize presence). + if f1.nameFromTag != f2.nameFromTag { + if f1.nameFromTag { + return -1 + } else { + return 1 + } + } + + // Break ties by order of occurrence. + return slices.Compare(f1.index, f2.index) + }) + + fieldCount := 0 + + // Keep for each name the dominant field, drop those for which ties + // still exist (ignoring order of occurrence). + for i, j := 0, 1; j <= len(fields); j++ { + if j < len(fields) && fields[i].JsonName == fields[j].JsonName { + continue + } + + // If there is only one field with the current name, + // or there is a dominant one, keep it. + if i+1 == j || len(fields[i].index) != len(fields[i+1].index) || fields[i].nameFromTag != fields[i+1].nameFromTag { + fields[fieldCount] = fields[i] + fieldCount++ + } + + i = j + } + + fields = fields[:fieldCount] + + // Sort by order of occurrence. + slices.SortFunc(fields, func(f1 fieldData, f2 fieldData) int { + return slices.Compare(f1.index, f2.index) + }) + + // Copy selected fields to receiver. + info.Fields = make([]*StructField, len(fields)) + for i, field := range fields { + info.Fields[i] = field.StructField + } + + info.typ = nil + }) + + return info +} + +// parseTag parses a json field tag and extracts +// all options recognised by encoding/json. +func parseTag(tag string) (name string, optional bool, quoted bool, visible bool) { + if tag == "-" { + return "", false, false, false + } else { + visible = true + } + + parts := strings.Split(tag, ",") + + name = parts[0] + + for _, option := range parts[1:] { + switch option { + case "omitempty": + optional = true + case "string": + quoted = true + } + } + + return +} + +// isValidFieldName determines whether a field name is valid +// according to encoding/json. +func isValidFieldName(name string) bool { + if name == "" { + return false + } + + for _, c := range name { + if !strings.ContainsRune("!#$%&()*+-./:;<=>?@[]^_{|}~ ", c) && !unicode.IsLetter(c) && !unicode.IsDigit(c) { + return false + } + } + + return true +} diff --git a/v3/internal/generator/collect/type.go b/v3/internal/generator/collect/type.go new file mode 100644 index 00000000000..27ffca2bca6 --- /dev/null +++ b/v3/internal/generator/collect/type.go @@ -0,0 +1,126 @@ +package collect + +import ( + "go/ast" + "go/types" + "slices" + "sync" +) + +// TypeInfo records information about a type declaration. +// +// Read accesses to any public field are only safe +// if a call to [TypeInfo.Collect] has completed before the access, +// for example by calling it in the accessing goroutine +// or before spawning the accessing goroutine. +type TypeInfo struct { + Name string + + // Alias is true for type aliases. + Alias bool + + Doc *ast.CommentGroup + Decl *GroupInfo + + // Def holds the actual denotation of the type expression + // that defines the described type. + // This is not the same as the underlying type, + // which skips all intermediate aliases and named types. + Def types.Type + + obj *types.TypeName + node ast.Node + + collector *Collector + once sync.Once +} + +// newTypeInfo initialises a descriptor for the given named type object. +func newTypeInfo(collector *Collector, obj *types.TypeName) *TypeInfo { + return &TypeInfo{ + obj: obj, + collector: collector, + } +} + +// Type returns the unique TypeInfo instance +// associated to the given object within a collector. +// +// Type is safe for concurrent use. +func (collector *Collector) Type(obj *types.TypeName) *TypeInfo { + return collector.fromCache(obj).(*TypeInfo) +} + +func (info *TypeInfo) Object() types.Object { + return info.obj +} + +func (info *TypeInfo) Type() types.Type { + return info.obj.Type() +} + +func (info *TypeInfo) Node() ast.Node { + return info.Collect().node +} + +// Collect gathers information about the type described by its receiver. +// It can be called concurrently by multiple goroutines; +// the computation will be performed just once. +// +// Collect returns the receiver for chaining. +// It is safe to call Collect with nil receiver. +// +// After Collect returns, the calling goroutine and all goroutines +// it might spawn afterwards are free to access +// the receiver's fields indefinitely. +func (info *TypeInfo) Collect() *TypeInfo { + if info == nil { + return nil + } + + info.once.Do(func() { + collector := info.collector + + info.Name = info.obj.Name() + info.Alias = info.obj.IsAlias() + + path := collector.findDeclaration(info.obj) + if path == nil { + collector.logger.Warningf( + "package %s: type %s: could not find declaration for type object", + info.obj.Pkg().Path(), + info.Name, + ) + + // Provide dummy group and def. + info.Decl = newGroupInfo(nil).Collect() + if _, isAlias := info.obj.Type().(*types.Alias); isAlias { + info.Def = types.Unalias(info.obj.Type()) + } else { + info.Def = info.obj.Type().Underlying() + } + return + } + + // path shape: *ast.TypeSpec, *ast.GenDecl, *ast.File + tspec := path[0].(*ast.TypeSpec) + + // Retrieve doc comments. + info.Doc = tspec.Doc + if info.Doc == nil { + info.Doc = tspec.Comment + } else if tspec.Comment != nil { + info.Doc = &ast.CommentGroup{ + List: slices.Concat(tspec.Doc.List, tspec.Comment.List), + } + } + + info.Decl = collector.fromCache(path[1]).(*GroupInfo).Collect() + + info.Def = collector.Package(info.obj.Pkg()).TypesInfo.TypeOf(tspec.Type) + + info.node = path[0] + }) + + return info +} diff --git a/v3/internal/generator/config/file.go b/v3/internal/generator/config/file.go new file mode 100644 index 00000000000..1e3bc74774e --- /dev/null +++ b/v3/internal/generator/config/file.go @@ -0,0 +1,64 @@ +package config + +import ( + "io" + "os" + "path/filepath" +) + +// FileCreator abstracts away file and directory creation. +// We use this to implement tests cleanly. +// +// Paths are always relative to the output directory. +// +// A FileCreator must allow concurrent calls to Create transparently. +// Each [io.WriteCloser] instance returned by a call to Create +// will be used by one goroutine at a time; but distinct instances +// must support concurrent use by distinct goroutines. +type FileCreator interface { + Create(path string) (io.WriteCloser, error) +} + +// FileCreatorFunc is an adapter to allow +// the use of ordinary functions as file creators. +type FileCreatorFunc func(path string) (io.WriteCloser, error) + +// Create calls f(path). +func (f FileCreatorFunc) Create(path string) (io.WriteCloser, error) { + return f(path) +} + +// NullCreator is a dummy file creator implementation. +// Calls to Create never fail and return +// a writer that discards all incoming data. +var NullCreator FileCreator = FileCreatorFunc(func(path string) (io.WriteCloser, error) { + return nullWriteCloser{}, nil +}) + +// DirCreator returns a file creator that creates files +// relative to the given output directory. +// +// It joins the output directory and the file path, +// calls [os.MkdirAll] on the directory part of the result, +// then [os.Create] on the full file path. +func DirCreator(outputDir string) FileCreator { + return FileCreatorFunc(func(path string) (io.WriteCloser, error) { + path = filepath.Join(outputDir, path) + + if err := os.MkdirAll(filepath.Dir(path), 0o777); err != nil { + return nil, err + } + + return os.Create(path) + }) +} + +type nullWriteCloser struct{} + +func (nullWriteCloser) Write(data []byte) (int, error) { + return len(data), nil +} + +func (nullWriteCloser) Close() error { + return nil +} diff --git a/v3/internal/generator/config/log.go b/v3/internal/generator/config/log.go new file mode 100644 index 00000000000..bbbd6c0dbd1 --- /dev/null +++ b/v3/internal/generator/config/log.go @@ -0,0 +1,100 @@ +package config + +import ( + "fmt" + + "github.com/pterm/pterm" +) + +// A Logger instance provides methods to format and report messages +// intended for the end user. +// +// All Logger methods may be called concurrently by its consumers. +type Logger interface { + // Errorf should process its arguments as if they were passed to fmt.Sprintf + // and report the resulting string to the user as an error message. + Errorf(format string, a ...any) + + // Warningf should process its arguments as if they were passed to fmt.Sprintf + // and report the resulting string to the user as a warning message. + Warningf(format string, a ...any) + + // Infof should process its arguments as if they were passed to fmt.Sprintf + // and report the resulting string to the user as an informational message. + Infof(format string, a ...any) + + // Debugf should process its arguments as if they were passed to fmt.Sprintf + // and report the resulting string to the user as a debug message. + Debugf(format string, a ...any) + + // Statusf should process its arguments as if they were passed to fmt.Sprintf + // and report the resulting string to the user as a status message. + Statusf(format string, a ...any) +} + +// NullLogger is a dummy Logger implementation +// that discards all incoming messages. +var NullLogger Logger = nullLogger{} + +type nullLogger struct{} + +func (nullLogger) Errorf(format string, a ...any) {} +func (nullLogger) Warningf(format string, a ...any) {} +func (nullLogger) Infof(format string, a ...any) {} +func (nullLogger) Debugf(format string, a ...any) {} +func (nullLogger) Statusf(format string, a ...any) {} + +// DefaultPtermLogger returns a Logger implementation that writes +// to the default pterm printers for each logging level. +// +// If spinner is not nil, it is used to log status updates. +// The spinner must have been started already. +func DefaultPtermLogger(spinner *pterm.SpinnerPrinter) Logger { + return &PtermLogger{ + &pterm.Error, + &pterm.Warning, + &pterm.Info, + &pterm.Debug, + spinner, + } +} + +// PtermLogger is a Logger implementation that writes to pterm printers. +// If any field is nil, PtermLogger discards all messages of that level. +type PtermLogger struct { + Error pterm.TextPrinter + Warning pterm.TextPrinter + Info pterm.TextPrinter + Debug pterm.TextPrinter + Spinner *pterm.SpinnerPrinter +} + +func (logger *PtermLogger) Errorf(format string, a ...any) { + if logger.Error != nil { + logger.Error.Printfln(format, a...) + } +} + +func (logger *PtermLogger) Warningf(format string, a ...any) { + if logger.Warning != nil { + logger.Warning.Printfln(format, a...) + } +} + +func (logger *PtermLogger) Infof(format string, a ...any) { + if logger.Info != nil { + logger.Info.Printfln(format, a...) + } +} + +func (logger *PtermLogger) Debugf(format string, a ...any) { + if logger.Debug != nil { + logger.Debug.Printfln(format, a...) + } +} + +func (logger *PtermLogger) Statusf(format string, a ...any) { + if logger.Spinner != nil { + logger.Spinner.UpdateText(fmt.Sprintf(format, a...)) + } +} diff --git a/v3/internal/generator/config/paths.go b/v3/internal/generator/config/paths.go new file mode 100644 index 00000000000..84d18214c15 --- /dev/null +++ b/v3/internal/generator/config/paths.go @@ -0,0 +1,10 @@ +package config + +// WailsAppPkgPath is the official import path of Wails v3's application package. +const WailsAppPkgPath = "github.com/wailsapp/wails/v3/pkg/application" + +// SystemPaths holds resolved paths of required system packages. +type SystemPaths struct { + ContextPackage string + ApplicationPackage string +} diff --git a/v3/internal/parser/constants.go b/v3/internal/generator/constants.go similarity index 98% rename from v3/internal/parser/constants.go rename to v3/internal/generator/constants.go index cfd5c4ab8a6..3c0c85873a5 100644 --- a/v3/internal/parser/constants.go +++ b/v3/internal/generator/constants.go @@ -1,4 +1,4 @@ -package parser +package generator import ( "fmt" diff --git a/v3/internal/parser/constants_test.go b/v3/internal/generator/constants_test.go similarity index 98% rename from v3/internal/parser/constants_test.go rename to v3/internal/generator/constants_test.go index 870ca4ecf60..9e056dcac80 100644 --- a/v3/internal/parser/constants_test.go +++ b/v3/internal/generator/constants_test.go @@ -1,4 +1,4 @@ -package parser +package generator import "testing" diff --git a/v3/internal/generator/errors.go b/v3/internal/generator/errors.go new file mode 100644 index 00000000000..966d698f2f1 --- /dev/null +++ b/v3/internal/generator/errors.go @@ -0,0 +1,190 @@ +package generator + +import ( + "errors" + "fmt" + "sync" + + "github.com/samber/lo" + "github.com/wailsapp/wails/v3/internal/generator/config" +) + +// ErrNoContextPackage indicates that +// the canonical path for the standard context package +// did not match any actual package. +var ErrNoContextPackage = errors.New("standard context package not found at canonical import path ('context'): is the Wails v3 module properly installed?") + +// ErrNoApplicationPackage indicates that +// the canonical path for the Wails application package +// did not match any actual package. +var ErrNoApplicationPackage = errors.New("Wails application package not found at canonical import path ('" + config.WailsAppPkgPath + "'): is the Wails v3 module properly installed?") + +// ErrBadApplicationPackage indicates that +// the Wails application package has invalid content. +var ErrBadApplicationPackage = errors.New("package " + config.WailsAppPkgPath + ": function NewService has wrong signature: is the Wails v3 module properly installed?") + +// ErrNoPackages is returned by [Generator.Generate] +// when [LoadPackages] returns no error and no packages. +var ErrNoPackages = errors.New("the given patterns matched no packages") + +// ErrorReport accumulates and logs error +// and warning messages, with deduplication. +// +// It implements the error interface; the Error method +// returns a report counting messages emitted so far. +// +// It also implements the interface [config.Logger] for convenience. +type ErrorReport struct { + logger config.Logger + + mu sync.Mutex + warnings map[string]bool + errors map[string]bool +} + +// NewError report initialises an ErrorReport instance +// with the provided Logger implementation. +// +// If logger is nil, messages will be accumulated but not logged. +func NewErrorReport(logger config.Logger) *ErrorReport { + if logger == nil { + logger = config.NullLogger + } + + return &ErrorReport{ + logger: logger, + warnings: make(map[string]bool), + errors: make(map[string]bool), + } +} + +// Error returns a string reporting the number +// of errors and warnings emitted so far. +func (report *ErrorReport) Error() string { + report.mu.Lock() + defer report.mu.Unlock() + + if len(report.errors) > 0 && len(report.warnings) == 0 { + var plural string + if len(report.errors) > 1 { + plural = "s" + } + return fmt.Sprintf("%d error%s emitted", len(report.errors), plural) + + } else if len(report.errors) == 0 && len(report.warnings) > 0 { + var plural string + if len(report.warnings) > 1 { + plural = "s" + } + + return fmt.Sprintf("%d warning%s emitted", len(report.warnings), plural) + + } else if len(report.errors) > 0 && len(report.warnings) > 0 { + var eplural, wplural string + if len(report.errors) > 1 { + eplural = "s" + } + if len(report.warnings) > 1 { + wplural = "s" + } + + return fmt.Sprintf("%d error%s and %d warning%s emitted", len(report.errors), eplural, len(report.warnings), wplural) + + } else { + return "no errors or warnings emitted" + } +} + +// HasErrors returns true if at least one error has been added to the report. +func (report *ErrorReport) HasErrors() bool { + report.mu.Lock() + result := len(report.errors) > 0 + report.mu.Unlock() + return result +} + +// HasWarnings returns true if at least one warning has been added to the report. +func (report *ErrorReport) HasWarnings() bool { + report.mu.Lock() + result := len(report.warnings) > 0 + report.mu.Unlock() + return result +} + +// Errors returns the list of error messages +// that have been added to the report. +// The order is randomised. +func (report *ErrorReport) Errors() []string { + report.mu.Lock() + defer report.mu.Unlock() + + return lo.Keys(report.errors) +} + +// Warnings returns the list of warning messages +// that have been added to the report. +// The order is randomised. +func (report *ErrorReport) Warnings() []string { + report.mu.Lock() + defer report.mu.Unlock() + + return lo.Keys(report.warnings) +} + +// Errorf formats an error message and adds it to the report. +// If not already present, the message is forwarded +// to the logger instance provided during initialisation. +func (report *ErrorReport) Errorf(format string, a ...any) { + msg := fmt.Sprintf(format, a...) + + report.mu.Lock() + defer report.mu.Unlock() + + present := report.errors[msg] + report.errors[msg] = true + + if !present { + report.logger.Errorf(format, a...) + } +} + +// Warningf formats an error message and adds it to the report. +// If not already present, the message is forwarded +// to the logger instance provided during initialisation. +func (report *ErrorReport) Warningf(format string, a ...any) { + msg := fmt.Sprintf(format, a...) + + report.mu.Lock() + defer report.mu.Unlock() + + present := report.warnings[msg] + report.warnings[msg] = true + + if !present { + report.logger.Warningf(format, a...) + } +} + +// Infof forwards the given informational message +// to the logger instance provided during initialisation. +// +// This method is here just for convenience and performs no deduplication. +func (report *ErrorReport) Infof(format string, a ...any) { + report.logger.Infof(format, a...) +} + +// Debugf forwards the given informational message +// to the logger instance provided during initialisation. +// +// This method is here just for convenience and performs no deduplication. +func (report *ErrorReport) Debugf(format string, a ...any) { + report.logger.Debugf(format, a...) +} + +// Statusf forwards the given status message +// to the logger instance provided during initialisation. +// +// This method is here just for convenience and performs no deduplication. +func (report *ErrorReport) Statusf(format string, a ...any) { + report.logger.Statusf(format, a...) +} diff --git a/v3/internal/generator/generate.go b/v3/internal/generator/generate.go new file mode 100644 index 00000000000..44efe3d6da4 --- /dev/null +++ b/v3/internal/generator/generate.go @@ -0,0 +1,293 @@ +package generator + +import ( + "fmt" + "go/types" + "io" + "os" + "slices" + "strings" + "sync" + "time" + + "github.com/wailsapp/wails/v3/internal/flags" + "github.com/wailsapp/wails/v3/internal/generator/collect" + "github.com/wailsapp/wails/v3/internal/generator/config" + "github.com/wailsapp/wails/v3/internal/generator/render" +) + +// Generator wraps all bookkeeping data structures that are needed +// to generate bindings for a set of packages. +type Generator struct { + options *flags.GenerateBindingsOptions + creator config.FileCreator + + // serviceFiles maps service file paths to their type object. + // It is used for lower/upper-case collision detection. + // Keys are strings, values are *types.TypeName. + serviceFiles sync.Map + + collector *collect.Collector + renderer *render.Renderer + + logger *ErrorReport + scheduler scheduler +} + +// NewGenerator configures a new generator instance. +// The options argument must not be nil. +// If creator is nil, no output file will be created. +// If logger is not nil, it is used to report messages interactively. +func NewGenerator(options *flags.GenerateBindingsOptions, creator config.FileCreator, logger config.Logger) *Generator { + if creator == nil { + creator = config.NullCreator + } + + report := NewErrorReport(logger) + + return &Generator{ + options: options, + creator: config.FileCreatorFunc(func(path string) (io.WriteCloser, error) { + report.Debugf("writing output file %s", path) + return creator.Create(path) + }), + + logger: report, + } +} + +// Generate runs the binding generation process +// for the packages specified by the given patterns. +// +// Concurrent or repeated calls to Generate with the same receiver +// are not allowed. +// +// The stats result field is never nil. +// +// The error result field is nil in case of complete success (no warning). +// Otherwise, it may either report errors that occured while loading +// the initial set of packages, or errors returned by the static analyser, +// or be an [ErrorReport] instance. +// +// If error is an ErrorReport, it may have accumulated no errors, just warnings. +// When this is the case, all bindings have been generated successfully. +// +// Parsing/type-checking errors or errors encountered while writing +// individual files will be printed directly to the [config.Logger] instance +// provided during initialisation. +func (generator *Generator) Generate(patterns ...string) (stats *collect.Stats, err error) { + stats = &collect.Stats{} + stats.Start() + defer stats.Stop() + + // Enable type aliases. + // This should become unnecessary from Go 1.23 onwards. + goDebug := os.Getenv("GODEBUG") + defer os.Setenv("GODEBUG", goDebug) + settings := slices.DeleteFunc(strings.Split(goDebug, ","), func(setting string) bool { + return strings.HasPrefix(setting, "gotypesalias=") + }) + settings = append(settings, "gotypesalias=1") + os.Setenv("GODEBUG", strings.Join(settings, ",")) + + // Validate file names. + err = generator.validateFileNames() + if err != nil { + return + } + + // Parse build flags. + buildFlags, err := generator.options.BuildFlags() + if err != nil { + return + } + + // Start package loading feedback. + var lpkgMutex sync.Mutex + generator.logger.Statusf("Loading packages...") + go func() { + time.Sleep(5 * time.Second) + if lpkgMutex.TryLock() { + generator.logger.Statusf("Loading packages... (this may take a long time)") + lpkgMutex.Unlock() + } + }() + + systemPaths, err := ResolveSystemPaths(buildFlags) + if err != nil { + return + } + + // Load initial packages. + pkgs, err := LoadPackages(buildFlags, patterns...) + + // Suppress package loading feedback. + lpkgMutex.Lock() + + // Check for loading errors. + if err != nil { + return + } + if len(patterns) > 0 && len(pkgs) == 0 { + err = ErrNoPackages + return + } + + // Report parsing/type-checking errors. + for _, pkg := range pkgs { + for _, err := range pkg.Errors { + generator.logger.Warningf("%v", err) + } + } + + // Panic on repeated calls. + if generator.collector != nil { + panic("Generate() must not be called more than once on the same receiver") + } + + // Initialise subcomponents. + generator.collector = collect.NewCollector(pkgs, systemPaths, generator.options, &generator.scheduler, generator.logger) + generator.renderer = render.NewRenderer(generator.options, generator.collector) + + // Update status. + generator.logger.Statusf("Looking for services...") + serviceFound := sync.OnceFunc(func() { generator.logger.Statusf("Generating service bindings...") }) + + // Run static analysis and schedule service code generation for each result. + err = FindServices(pkgs, systemPaths, generator.logger, func(obj *types.TypeName) bool { + serviceFound() + generator.scheduler.Schedule(func() { + generator.generateService(obj) + }) + return true + }) + + // Discard unneeded data. + pkgs = nil + + // Wait until all services have been generated and all models collected. + generator.scheduler.Wait() + + // Check for analyser errors. + if err != nil { + return + } + + // Invariants: + // - Service files have been generated for all discovered services; + // - ModelInfo.Collect has been called on all discovered models, and therefore + // - all required models have been discovered. + + // Update status. + if generator.options.NoIndex { + generator.logger.Statusf("Generating models...") + } else { + generator.logger.Statusf("Generating models and index files...") + } + + // Schedule models, index and included files generation for each package. + generator.collector.Iterate(func(info *collect.PackageInfo) bool { + generator.scheduler.Schedule(func() { + generator.generateModelsIndexIncludes(info) + }) + return true + }) + + // Wait until all models and indices have been generated. + generator.scheduler.Wait() + + // Populate stats. + generator.logger.Statusf("Collecting stats...") + generator.collector.Iterate(func(info *collect.PackageInfo) bool { + stats.Add(info.Stats()) + return true + }) + + // Return non-empty error report. + if generator.logger.HasErrors() || generator.logger.HasWarnings() { + err = generator.logger + } + + return +} + +// generateModelsIndexIncludes schedules generation of public/private model files, +// included files and, if allowed by the options, +// of an index file for the given package. +func (generator *Generator) generateModelsIndexIncludes(info *collect.PackageInfo) { + index := info.Index(generator.options.TS) + + // info.Index implies info.Collect: goroutines spawned below + // can access package information freely. + + if len(index.Models) > 0 { + generator.scheduler.Schedule(func() { + generator.generateModels(info, index.Models, false) + }) + } + + if len(index.Internal) > 0 { + generator.scheduler.Schedule(func() { + generator.generateModels(info, index.Internal, true) + }) + } + + if len(index.Package.Includes) > 0 { + generator.scheduler.Schedule(func() { + generator.generateIncludes(index) + }) + } + + if !generator.options.NoIndex && !index.IsEmpty() { + generator.generateIndex(index) + } +} + +// validateFileNames validates user-provided filenames. +func (generator *Generator) validateFileNames() error { + switch { + case generator.options.ModelsFilename == "": + return fmt.Errorf("models filename must not be empty") + + case generator.options.InternalFilename == "": + return fmt.Errorf("internal models filename must not be empty") + + case !generator.options.NoIndex && generator.options.IndexFilename == "": + return fmt.Errorf("package index filename must not be empty") + + case generator.options.ModelsFilename != strings.ToLower(generator.options.ModelsFilename): + return fmt.Errorf("models filename must not contain uppercase characters") + + case generator.options.InternalFilename != strings.ToLower(generator.options.InternalFilename): + return fmt.Errorf("internal models filename must not contain uppercase characters") + + case generator.options.IndexFilename != strings.ToLower(generator.options.IndexFilename): + return fmt.Errorf("package index filename must not contain uppercase characters") + + case generator.options.ModelsFilename == generator.options.InternalFilename: + return fmt.Errorf("models and internal models cannot share the same filename") + + case !generator.options.NoIndex && generator.options.ModelsFilename == generator.options.IndexFilename: + return fmt.Errorf("models and package indexes cannot share the same filename") + + case !generator.options.NoIndex && generator.options.InternalFilename == generator.options.IndexFilename: + return fmt.Errorf("internal models and package indexes cannot share the same filename") + } + + return nil +} + +// scheduler provides an implementation of the [collect.Scheduler] interface. +type scheduler struct { + sync.WaitGroup +} + +// Schedule runs the given function concurrently, +// registering it on the scheduler's wait group. +func (sched *scheduler) Schedule(task func()) { + sched.Add(1) + go func() { + defer sched.Done() + task() + }() +} diff --git a/v3/internal/generator/generate_test.go b/v3/internal/generator/generate_test.go new file mode 100644 index 00000000000..91be877eae6 --- /dev/null +++ b/v3/internal/generator/generate_test.go @@ -0,0 +1,222 @@ +package generator + +import ( + "errors" + "fmt" + "io" + "io/fs" + "os" + "path/filepath" + "strings" + "sync" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/pterm/pterm" + "github.com/wailsapp/wails/v3/internal/flags" + "github.com/wailsapp/wails/v3/internal/generator/config" +) + +const testcases = "github.com/wailsapp/wails/v3/internal/generator/testcases/..." + +type testParams struct { + name string + options *flags.GenerateBindingsOptions + outputDir string + want map[string]bool +} + +func TestGenerator(t *testing.T) { + const ( + useNamesBit = 1 << iota + useInterfacesBit + tsBit + ) + + // Generate configuration matrix. + tests := make([]*testParams, 1<<3) + for i := range tests { + options := &flags.GenerateBindingsOptions{ + ModelsFilename: "models", + InternalFilename: "internal", + IndexFilename: "index", + + UseBundledRuntime: true, + + TS: i&tsBit != 0, + UseInterfaces: i&useInterfacesBit != 0, + UseNames: i&useNamesBit != 0, + } + + name := configString(options) + + tests[i] = &testParams{ + name: name, + options: options, + outputDir: filepath.Join("testdata/output", name), + want: make(map[string]bool), + } + } + + for _, test := range tests { + // Create output dir. + if err := os.MkdirAll(test.outputDir, 0777); err != nil { + t.Fatal(err) + } + + // Walk output dir. + err := filepath.WalkDir(test.outputDir, func(path string, d fs.DirEntry, err error) error { + // Skip directories. + if d.IsDir() { + return nil + } + + // Skip got files. + if strings.HasSuffix(d.Name(), ".got.js") || strings.HasSuffix(d.Name(), ".got.ts") { + return nil + } + + // Record file. + test.want[filepath.Clean("."+path[len(test.outputDir):])] = false + return nil + }) + + if err != nil { + t.Fatal(err) + } + } + + // Run tests. + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + generator := NewGenerator( + test.options, + outputCreator(t, test), + config.DefaultPtermLogger(nil), + ) + + _, err := generator.Generate(testcases) + if report := (*ErrorReport)(nil); errors.As(err, &report) { + if report.HasErrors() { + t.Error(report) + } else if report.HasWarnings() { + pterm.Warning.Println(report) + } + } else if err != nil { + t.Error(err) + } + + for path, present := range test.want { + if !present { + t.Errorf("Missing output file '%s'", path) + } + } + }) + } +} + +// configString computes a subtest name from the given configuration. +func configString(options *flags.GenerateBindingsOptions) string { + lang := "JS" + if options.TS { + lang = "TS" + } + return fmt.Sprintf("lang=%s/UseInterfaces=%v/UseNames=%v", lang, options.UseInterfaces, options.UseNames) +} + +// outputCreator returns a FileCreator that detects want/got pairs +// and schedules them for comparison. +// +// If no corresponding want file exists, it is created and reported. +func outputCreator(t *testing.T, params *testParams) config.FileCreator { + var mu sync.Mutex + return config.FileCreatorFunc(func(path string) (io.WriteCloser, error) { + path = filepath.Clean(path) + prefixedPath := filepath.Join(params.outputDir, path) + + // Protect want map accesses. + mu.Lock() + defer mu.Unlock() + + if seen, ok := params.want[path]; ok { + // File exists: mark as seen and compare. + if seen { + t.Errorf("Duplicate output file '%s'", path) + } + params.want[path] = true + + // Open want file. + wf, err := os.Open(prefixedPath) + if err != nil { + return nil, err + } + + // Create or truncate got file. + ext := filepath.Ext(prefixedPath) + gf, err := os.Create(fmt.Sprintf("%s.got%s", prefixedPath[:len(prefixedPath)-len(ext)], ext)) + if err != nil { + return nil, err + } + + // Initialise comparer. + return &outputComparer{t, path, wf, gf}, nil + } else { + // File does not exist: create it. + t.Errorf("Unexpected output file '%s'", path) + params.want[path] = true + + if err := os.MkdirAll(filepath.Dir(prefixedPath), 0777); err != nil { + return nil, err + } + + return os.Create(prefixedPath) + } + }) +} + +// outputComparer is a io.WriteCloser that writes to got. +// +// When Close is called, it compares want to got; if they are identical, +// it deletes got; otherwise it reports a testing error. +type outputComparer struct { + t *testing.T + path string + want *os.File + got *os.File +} + +func (comparer *outputComparer) Write(data []byte) (int, error) { + return comparer.got.Write(data) +} + +func (comparer *outputComparer) Close() error { + defer comparer.want.Close() + defer comparer.got.Close() + + comparer.got.Seek(0, io.SeekStart) + + // Read want data. + want, err := io.ReadAll(comparer.want) + if err != nil { + comparer.t.Error(err) + return nil + } + + got, err := io.ReadAll(comparer.got) + if err != nil { + comparer.t.Error(err) + return nil + } + + if diff := cmp.Diff(want, got); diff != "" { + comparer.t.Errorf("Output file '%s' mismatch (-want +got):\n%s", comparer.path, diff) + } else { + // On success, delete got file. + comparer.got.Close() + if err := os.Remove(comparer.got.Name()); err != nil { + comparer.t.Error(err) + } + } + + return nil +} diff --git a/v3/internal/generator/includes.go b/v3/internal/generator/includes.go new file mode 100644 index 00000000000..b9b2ab7e9d5 --- /dev/null +++ b/v3/internal/generator/includes.go @@ -0,0 +1,105 @@ +package generator + +import ( + "io" + "os" + "path/filepath" + "slices" + "strings" + + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// generateIncludes copies included files to the package directory +// for the package summarised by the given index. +func (generator *Generator) generateIncludes(index *collect.PackageIndex) { + for name, path := range index.Package.Includes { + // Validate filename. + switch name { + case generator.renderer.ModelsFile(): + if len(index.Models) > 0 { + generator.logger.Errorf( + "package %s: included file '%s' collides with models filename; please rename the file or choose a different filename for models", + index.Package.Path, + path, + ) + return + } + + case generator.renderer.InternalFile(): + if len(index.Internal) > 0 { + generator.logger.Errorf( + "package %s: included file '%s' collides with internal models filename; please rename the file or choose a different filename for internal models", + index.Package.Path, + path, + ) + return + } + + case generator.renderer.IndexFile(): + if !generator.options.NoIndex && !index.IsEmpty() { + generator.logger.Errorf( + "package %s: included file '%s' collides with JS/TS index filename; please rename the file or choose a different filename for JS/TS indexes", + index.Package.Path, + path, + ) + return + } + } + + // Validate against services. + service, ok := slices.BinarySearchFunc(index.Services, name, func(service *collect.ServiceInfo, name string) int { + return strings.Compare(generator.renderer.ServiceFile(service.Name), name) + }) + if ok { + generator.logger.Errorf( + "package %s: included file '%s' collides with filename for service %s; please rename either the file or the service", + index.Package.Path, + path, + index.Services[service].Name, + ) + return + } + + // Copy file to destination in separate goroutine. + generator.scheduler.Schedule(func() { + src, err := os.Open(path) + if err != nil { + generator.logger.Errorf("%v", err) + generator.logger.Errorf("package %s: could not read included file '%s'", index.Package.Path, path) + return + } + defer src.Close() + + stat, err := src.Stat() + if err != nil { + generator.logger.Errorf("%v", err) + generator.logger.Errorf("package %s: could not read included file '%s'", index.Package.Path, path) + return + } + + if stat.IsDir() { + generator.logger.Errorf( + "package %s: included file '%s' is a directory; please glob or list all descendants explicitly", + index.Package.Path, + path, + ) + return + } + + dst, err := generator.creator.Create(filepath.Join(index.Package.Path, name)) + if err != nil { + generator.logger.Errorf("%v", err) + generator.logger.Errorf("package %s: could not write included file '%s'", index.Package.Path, name) + return + } + defer dst.Close() + + _, err = io.Copy(dst, src) + if err != nil { + generator.logger.Errorf("%v", err) + generator.logger.Errorf("package %s: could not copy included file '%s'", index.Package.Path, name) + } + }) + } +} diff --git a/v3/internal/generator/index.go b/v3/internal/generator/index.go new file mode 100644 index 00000000000..3ce596e3291 --- /dev/null +++ b/v3/internal/generator/index.go @@ -0,0 +1,48 @@ +package generator + +import ( + "path/filepath" + + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// generateIndex generates an index file from the given index information. +func (generator *Generator) generateIndex(index *collect.PackageIndex) { + defer generator.reportDualRoles(index) + + file, err := generator.creator.Create(filepath.Join(index.Package.Path, generator.renderer.IndexFile())) + if err != nil { + generator.logger.Errorf("%v", err) + generator.logger.Errorf("package %s: index generation failed", index.Package.Path) + return + } + defer file.Close() + + err = generator.renderer.Index(file, index) + if err != nil { + generator.logger.Errorf("%v", err) + generator.logger.Errorf("package %s: index generation failed", index.Package.Path) + } +} + +// reportDualRoles checks for models types that are also service types +// and emits a warning. +func (generator *Generator) reportDualRoles(index *collect.PackageIndex) { + services, models := index.Services, index.Models + for len(services) > 0 && len(models) > 0 { + if services[0].Name < models[0].Name { + services = services[1:] + } else if services[0].Name > models[0].Name { + models = models[1:] + } else { + generator.logger.Warningf( + "package %s: type %s has been marked both as a service and as a model; shadowing between the two may take place when importing generated JS indexes", + index.Package.Path, + services[0].Name, + ) + + services = services[1:] + models = models[1:] + } + } +} diff --git a/v3/internal/generator/load.go b/v3/internal/generator/load.go new file mode 100644 index 00000000000..a0d6f5f6bf5 --- /dev/null +++ b/v3/internal/generator/load.go @@ -0,0 +1,110 @@ +package generator + +import ( + "go/ast" + "go/parser" + "go/token" + + "github.com/wailsapp/wails/v3/internal/generator/config" + "golang.org/x/tools/go/packages" +) + +// ResolveSystemPaths resolves paths for the Wails system +func ResolveSystemPaths(buildFlags []string) (paths *config.SystemPaths, err error) { + // Resolve context pkg path. + contextPkgPaths, err := ResolvePatterns(buildFlags, "context") + if err != nil { + return + } else if len(contextPkgPaths) < 1 { + err = ErrNoContextPackage + return + } else if len(contextPkgPaths) > 1 { + // This should never happen... + panic("context package path matched multiple packages") + } + + // Resolve wails app pkg path. + wailsAppPkgPaths, err := ResolvePatterns(buildFlags, config.WailsAppPkgPath) + if err != nil { + return + } else if len(wailsAppPkgPaths) < 1 { + err = ErrNoApplicationPackage + return + } else if len(wailsAppPkgPaths) > 1 { + // This should never happen... + panic("wails application package path matched multiple packages") + } + + paths = &config.SystemPaths{ + ContextPackage: contextPkgPaths[0], + ApplicationPackage: wailsAppPkgPaths[0], + } + return +} + +// ResolvePatterns returns a slice containing all package paths +// that match the given patterns, according to the underlying build tool +// and within the context of the current working directory. +func ResolvePatterns(buildFlags []string, patterns ...string) (paths []string, err error) { + rewrittenPatterns := make([]string, len(patterns)) + for i, pattern := range patterns { + rewrittenPatterns[i] = "pattern=" + pattern + } + + pkgs, err := packages.Load(&packages.Config{ + Mode: packages.NeedName, + BuildFlags: buildFlags, + }, rewrittenPatterns...) + + for _, pkg := range pkgs { + paths = append(paths, pkg.PkgPath) + } + + return +} + +// LoadPackages loads the packages specified by the given patterns +// and their whole dependency tree. It returns a slice containing +// all packages that match the given patterns and all of their direct +// and indirect dependencies. +// +// The returned slice is in post-order w.r.t. the dependency relation, +// i.e. if package A depends on package B, then package B precedes package A. +// +// All returned package instances include syntax trees and full type information. +// +// Syntax is loaded in the context of a global [token.FileSet], +// which is available through the field [packages.Package.Fset] +// on each returned package. Therefore, source positions +// are canonical across all loaded packages. +func LoadPackages(buildFlags []string, patterns ...string) (pkgs []*packages.Package, err error) { + rewrittenPatterns := make([]string, len(patterns)) + for i, pattern := range patterns { + rewrittenPatterns[i] = "pattern=" + pattern + } + + // Global file set. + fset := token.NewFileSet() + + roots, err := packages.Load(&packages.Config{ + // NOTE: some Go maintainers now believe deprecation was an error and recommend using Load* modes + // (see e.g. https://github.com/golang/go/issues/48226#issuecomment-1948792315). + Mode: packages.LoadAllSyntax, + BuildFlags: buildFlags, + Fset: fset, + ParseFile: func(fset *token.FileSet, filename string, src []byte) (file *ast.File, err error) { + file, err = parser.ParseFile(fset, filename, src, parser.ParseComments|parser.SkipObjectResolution) + return + }, + }, rewrittenPatterns...) + + // Flatten dependency tree. + packages.Visit(roots, nil, func(pkg *packages.Package) { + if pkg.Fset != fset { + panic("fileset missing or not the global one") + } + pkgs = append(pkgs, pkg) + }) + + return +} diff --git a/v3/internal/generator/models.go b/v3/internal/generator/models.go new file mode 100644 index 00000000000..9532593eccf --- /dev/null +++ b/v3/internal/generator/models.go @@ -0,0 +1,60 @@ +package generator + +import ( + "path/filepath" + + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// generateModels generates a JS/TS model file for the given list of models. +// +// If internal is true, the generated file is named by Renderer.InternalFile +// and the types declared therein are not exported by the package index file. +// +// A call to info.Collect must complete before entering generateModels. +func (generator *Generator) generateModels(info *collect.PackageInfo, models []*collect.ModelInfo, internal bool) { + // Merge all import maps. + imports := collect.NewImportMap(info) + for _, model := range models { + imports.Merge(model.Imports) + } + + // Clear irrelevant imports. + if internal { + imports.ImportInternal = false + } else { + imports.ImportModels = false + } + + // Retrieve appropriate file name. + var filename string + if internal { + filename = generator.renderer.InternalFile() + } else { + filename = generator.renderer.ModelsFile() + } + + file, err := generator.creator.Create(filepath.Join(info.Path, filename)) + if err != nil { + generator.logger.Errorf("%v", err) + + var prefix string + if internal { + prefix = "internal " + } + generator.logger.Errorf("package %s: %smodels generation failed", info.Path, prefix) + return + } + defer file.Close() + + err = generator.renderer.Models(file, imports, models) + if err != nil { + generator.logger.Errorf("%v", err) + + var prefix string + if internal { + prefix = "internal " + } + generator.logger.Errorf("package %s: %smodels generation failed", info.Path, prefix) + } +} diff --git a/v3/internal/generator/render/create.go b/v3/internal/generator/render/create.go new file mode 100644 index 00000000000..b7b83383c16 --- /dev/null +++ b/v3/internal/generator/render/create.go @@ -0,0 +1,379 @@ +package render + +import ( + "fmt" + "go/types" + "strings" + "text/template" + + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// SkipCreate returns true if the given array of types needs no creation code. +func (m *module) SkipCreate(ts []types.Type) bool { + for _, typ := range ts { + if m.NeedsCreate(typ) { + return false + } + } + return true +} + +// NeedsCreate returns true if the given type needs some creation code. +func (m *module) NeedsCreate(typ types.Type) bool { + return m.needsCreateImpl(typ, make(map[*types.TypeName]bool)) +} + +// needsCreateImpl provides the actual implementation of NeedsCreate. +// The visited parameter is used to break cycles. +func (m *module) needsCreateImpl(typ types.Type, visited map[*types.TypeName]bool) bool { + switch t := typ.(type) { + case *types.Alias, *types.Named: + obj := typ.(interface{ Obj() *types.TypeName }).Obj() + if visited[obj] { + return false + } + visited[obj] = true + + if obj.Pkg() == nil { + // Builtin alias or named type: render underlying type. + return m.needsCreateImpl(t.Underlying(), visited) + } + + if collect.IsAny(t) || collect.IsString(t) { + break + } else if collect.IsClass(t) { + return true + } else if _, isAlias := typ.(*types.Alias); isAlias { + return m.needsCreateImpl(types.Unalias(t), visited) + } else { + return m.needsCreateImpl(t.Underlying(), visited) + } + + case *types.Array, *types.Pointer: + return m.needsCreateImpl(typ.(interface{ Elem() types.Type }).Elem(), visited) + + case *types.Map, *types.Slice: + return true + + case *types.Struct: + info := m.collector.Struct(t) + info.Collect() + + for _, field := range info.Fields { + if m.needsCreateImpl(field.Type, visited) { + return true + } + } + + case *types.TypeParam: + return true + } + + return false +} + +// JSCreate renders JS/TS code that creates an instance +// of the given type from JSON data. +// +// JSCreate's output may be incorrect +// if m.Imports.AddType has not been called for the given type. +func (m *module) JSCreate(typ types.Type) string { + return m.JSCreateWithParams(typ, "") +} + +// JSCreateWithParams renders JS/TS code that creates an instance +// of the given type from JSON data. For generic types, +// it renders parameterised code. +// +// JSCreateWithParams's output may be incorrect +// if m.Imports.AddType has not been called for the given type. +func (m *module) JSCreateWithParams(typ types.Type, params string) string { + if len(params) > 0 && !m.hasTypeParams(typ) { + // Forget params for non-generic types. + params = "" + } + + switch t := typ.(type) { + case *types.Alias: + return m.JSCreateWithParams(types.Unalias(typ), params) + + case *types.Array, *types.Pointer: + pp, ok := m.postponedCreates.At(typ).(*postponed) + if ok { + return fmt.Sprintf("$$createType%d%s", pp.index, params) + } + + createElement := m.JSCreateWithParams(typ.(interface{ Elem() types.Type }).Elem(), params) + if createElement != "$Create.Any" { + pp = &postponed{m.postponedCreates.Len(), params} + m.postponedCreates.Set(typ, pp) + return fmt.Sprintf("$$createType%d%s", pp.index, params) + } + + case *types.Map: + pp, ok := m.postponedCreates.At(typ).(*postponed) + if !ok { + m.JSCreateWithParams(t.Key(), params) + m.JSCreateWithParams(t.Elem(), params) + pp = &postponed{m.postponedCreates.Len(), params} + m.postponedCreates.Set(typ, pp) + } + + return fmt.Sprintf("$$createType%d%s", pp.index, params) + + case *types.Named: + if t.Obj().Pkg() == nil { + // Builtin named type: render underlying type. + return m.JSCreateWithParams(t.Underlying(), params) + } + + if collect.IsAny(typ) || collect.IsString(typ) || !m.NeedsCreate(typ) { + break + } + + pp, ok := m.postponedCreates.At(typ).(*postponed) + if !ok { + if t.TypeArgs() != nil && t.TypeArgs().Len() > 0 { + // Postpone type args. + for i := range t.TypeArgs().Len() { + m.JSCreateWithParams(t.TypeArgs().At(i), params) + } + } + + pp = &postponed{m.postponedCreates.Len(), params} + m.postponedCreates.Set(typ, pp) + + if !collect.IsClass(typ) { + m.JSCreateWithParams(t.Underlying(), params) + } + } + + return fmt.Sprintf("$$createType%d%s", pp.index, params) + + case *types.Slice: + if types.Identical(typ, typeByteSlice) { + return "$Create.ByteSlice" + } + + pp, ok := m.postponedCreates.At(typ).(*postponed) + if !ok { + m.JSCreateWithParams(t.Elem(), params) + pp = &postponed{m.postponedCreates.Len(), params} + m.postponedCreates.Set(typ, pp) + } + + return fmt.Sprintf("$$createType%d%s", pp.index, params) + + case *types.Struct: + pp, ok := m.postponedCreates.At(typ).(*postponed) + if ok { + return fmt.Sprintf("$$createType%d%s", pp.index, params) + } + + info := m.collector.Struct(t) + info.Collect() + + postpone := false + for _, field := range info.Fields { + if m.JSCreateWithParams(field.Type, params) != "$Create.Any" { + postpone = true + } + } + + if postpone { + pp = &postponed{m.postponedCreates.Len(), params} + m.postponedCreates.Set(typ, pp) + return fmt.Sprintf("$$createType%d%s", pp.index, params) + } + + case *types.TypeParam: + return fmt.Sprintf("$$createParam%s", typeparam(t.Index(), t.Obj().Name())) + } + + return "$Create.Any" +} + +// PostponedCreates returns the list of postponed create functions +// for the given module. +func (m *module) PostponedCreates() []string { + result := make([]string, m.postponedCreates.Len()) + + m.postponedCreates.Iterate(func(key types.Type, value any) { + pp := value.(*postponed) + + pre := "" + if pp.params != "" { + pre = pp.params + " => " + } + + switch t := key.(type) { + case *types.Array, *types.Slice: + result[pp.index] = fmt.Sprintf("%s$Create.Array(%s)", pre, m.JSCreateWithParams(t.(interface{ Elem() types.Type }).Elem(), pp.params)) + + case *types.Map: + result[pp.index] = fmt.Sprintf( + "%s$Create.Map(%s, %s)", + pre, + m.JSCreateWithParams(t.Key(), pp.params), + m.JSCreateWithParams(t.Elem(), pp.params), + ) + + case *types.Named: + if !collect.IsClass(key) { + // Creation function for non-struct named types + // require an indirect assignment to break cycles. + + // Typescript cannot infer the return type on its own: add hints. + cast, returnType := "", "" + if m.TS { + returnType = ": any" + } else { + cast = "/** @type {(...args: any[]) => any} */" + } + + result[pp.index] = fmt.Sprintf(` +%s(function $$initCreateType%d(...args)%s { + if ($$createType%d === $$initCreateType%d) { + $$createType%d = %s%s; + } + return $$createType%d(...args); +})`, + cast, pp.index, returnType, + pp.index, pp.index, + pp.index, pre, m.JSCreateWithParams(t.Underlying(), pp.params), + pp.index, + )[1:] // Remove initial newline. + + // We're done. + break + } + + var builder strings.Builder + + builder.WriteString(pre) + + if t.Obj().Pkg().Path() == m.Imports.Self { + if t.Obj().Exported() && m.Imports.ImportModels { + builder.WriteString("$models.") + } else if !t.Obj().Exported() && m.Imports.ImportInternal { + builder.WriteString("$internal.") + } + } else { + builder.WriteString(jsimport(m.Imports.External[t.Obj().Pkg().Path()])) + builder.WriteRune('.') + } + builder.WriteString(jsid(t.Obj().Name())) + builder.WriteString(".createFrom") + + if t.TypeArgs() != nil && t.TypeArgs().Len() > 0 { + builder.WriteString("(") + for i := range t.TypeArgs().Len() { + if i > 0 { + builder.WriteString(", ") + } + builder.WriteString(m.JSCreateWithParams(t.TypeArgs().At(i), pp.params)) + } + builder.WriteString(")") + } + + result[pp.index] = builder.String() + + case *types.Pointer: + result[pp.index] = fmt.Sprintf("%s$Create.Nullable(%s)", pre, m.JSCreateWithParams(t.Elem(), pp.params)) + + case *types.Struct: + info := m.collector.Struct(t) + info.Collect() + + var builder strings.Builder + builder.WriteString(pre) + builder.WriteString("$Create.Struct({") + + for _, field := range info.Fields { + createField := m.JSCreateWithParams(field.Type, pp.params) + if createField == "$Create.Any" { + continue + } + + builder.WriteString("\n \"") + template.JSEscape(&builder, []byte(field.JsonName)) + builder.WriteString("\": ") + builder.WriteString(createField) + builder.WriteRune(',') + } + + if len(info.Fields) > 0 { + builder.WriteRune('\n') + } + builder.WriteString("})") + + result[pp.index] = builder.String() + + default: + result[pp.index] = pre + "$Create.Any" + } + }) + + if newline != "\n" { + // Replace newlines according to local git config. + for i := range result { + result[i] = strings.ReplaceAll(result[i], "\n", newline) + } + } + + return result +} + +type postponed struct { + index int + params string +} + +// hasTypeParams returns true if the given type depends upon type parameters. +func (m *module) hasTypeParams(typ types.Type) bool { + switch t := typ.(type) { + case *types.Alias: + if t.Obj().Pkg() == nil { + // Builtin alias: these are never rendered as templates. + return false + } + + return m.hasTypeParams(types.Unalias(typ)) + + case *types.Array, *types.Pointer, *types.Slice: + return m.hasTypeParams(typ.(interface{ Elem() types.Type }).Elem()) + + case *types.Map: + return m.hasTypeParams(t.Key()) || m.hasTypeParams(t.Elem()) + + case *types.Named: + if t.Obj().Pkg() == nil { + // Builtin named type: these are never rendered as templates. + return false + } + + if targs := t.TypeArgs(); targs != nil { + for i := range targs.Len() { + if m.hasTypeParams(targs.At(i)) { + return true + } + } + } + + case *types.Struct: + info := m.collector.Struct(t) + info.Collect() + + for _, field := range info.Fields { + if m.hasTypeParams(field.Type) { + return true + } + } + + case *types.TypeParam: + return true + } + + return false +} diff --git a/v3/internal/generator/render/default.go b/v3/internal/generator/render/default.go new file mode 100644 index 00000000000..a30b3cd9575 --- /dev/null +++ b/v3/internal/generator/render/default.go @@ -0,0 +1,175 @@ +package render + +import ( + "fmt" + "go/types" + "strings" + "text/template" + + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// JSDefault renders the Javascript representation +// of the zero value of the given type, +// using the receiver's import map to resolve dependencies. +// +// JSDefault's output may be incorrect +// if imports.AddType has not been called for the given type. +func (m *module) JSDefault(typ types.Type, quoted bool) (result string) { + switch t := typ.(type) { + case *types.Alias, *types.Named: + result, ok := m.renderNamedDefault(t.(aliasOrNamed), quoted) + if ok { + return result + } + + case *types.Array, *types.Slice: + if types.Identical(typ, typeByteSlice) { + return `""` + } else { + return "[]" + } + + case *types.Basic: + return m.renderBasicDefault(t, quoted) + + case *types.Map: + return "{}" + + case *types.Pointer: + return "null" + + case *types.Struct: + return m.renderStructDefault(t) + } + + // Fall back to null. + // encoding/json ignores null values so this is safe. + return "null" +} + +// renderBasicDefault outputs the Javascript representation +// of the zero value for the given basic type. +func (*module) renderBasicDefault(typ *types.Basic, quoted bool) string { + switch { + case typ.Info()&types.IsBoolean != 0: + if quoted { + return `"false"` + } else { + return "false" + } + + case typ.Info()&types.IsNumeric != 0 && typ.Info()&types.IsComplex == 0: + if quoted { + return `"0"` + } else { + return "0" + } + + case typ.Info()&types.IsString != 0: + if quoted { + return `'""'` + } else { + return `""` + } + } + + // Fall back to untyped mode. + if quoted { + return `""` + } else { + // encoding/json ignores null values so this is safe. + return "null" + } +} + +// renderNamedDefault outputs the Javascript representation +// of the zero value for the given alias or named type. +// The result field named 'ok' is true when the resulting code is valid. +// If false, it must be discarded. +func (m *module) renderNamedDefault(typ aliasOrNamed, quoted bool) (result string, ok bool) { + if typ.Obj().Pkg() == nil { + // Builtin alias or named type: render underlying type. + return m.JSDefault(typ.Underlying(), quoted), true + } + + if quoted { + // WARN: Do not test with IsString here!! We only want to catch marshalers. + if !collect.IsAny(typ) && !collect.MaybeTextMarshaler(typ) { + if basic, ok := typ.Underlying().(*types.Basic); ok { + // Quoted mode for basic alias/named type that is not a marshaler: delegate. + return m.renderBasicDefault(basic, quoted), true + } + // No need to handle typeparams: they are initialised to null anyways. + } + } + + prefix := "" + if typ.Obj().Exported() && m.Imports.ImportModels { + prefix = "$models." + } else if !typ.Obj().Exported() && m.Imports.ImportInternal { + prefix = "$internal." + } + + if collect.IsAny(typ) { + return "", false + } else if collect.MaybeTextMarshaler(typ) { + return `""`, true + } else if collect.IsClass(typ) { + if typ.Obj().Pkg().Path() == m.Imports.Self { + return fmt.Sprintf("(new %s%s())", prefix, jsid(typ.Obj().Name())), true + } else { + return fmt.Sprintf("(new %s.%s())", jsimport(m.Imports.External[typ.Obj().Pkg().Path()]), jsid(typ.Obj().Name())), true + } + } else if _, isAlias := typ.(*types.Alias); isAlias { + return m.JSDefault(types.Unalias(typ), quoted), true + } else { + // Inject a type assertion in case we are breaking an enum. + // Using the true Go zero value is preferrable to selecting an arbitrary enum value. + value := m.JSDefault(typ.Underlying(), quoted) + if typ.Obj().Pkg().Path() == m.Imports.Self { + if m.TS { + return fmt.Sprintf("(%s as %s%s)", value, prefix, jsid(typ.Obj().Name())), true + } else { + return fmt.Sprintf("(/** @type {%s%s} */(%s))", prefix, jsid(typ.Obj().Name()), value), true + } + } else { + if m.TS { + return fmt.Sprintf("(%s as %s.%s)", value, jsimport(m.Imports.External[typ.Obj().Pkg().Path()]), jsid(typ.Obj().Name())), true + } else { + return fmt.Sprintf("(/** @type {%s.%s} */(%s))", jsimport(m.Imports.External[typ.Obj().Pkg().Path()]), jsid(typ.Obj().Name()), value), true + } + } + } +} + +// renderStructDefault outputs the Javascript representation +// of the zero value for the given struct type. +func (m *module) renderStructDefault(typ *types.Struct) string { + info := m.collector.Struct(typ) + info.Collect() + + var builder strings.Builder + + builder.WriteRune('{') + for i, field := range info.Fields { + if field.Optional { + continue + } + + if i > 0 { + builder.WriteString(", ") + } + + builder.WriteRune('"') + template.JSEscape(&builder, []byte(field.JsonName)) + builder.WriteRune('"') + + builder.WriteString(": ") + + builder.WriteString(m.JSDefault(field.Type, field.Quoted)) + } + builder.WriteRune('}') + + return builder.String() +} diff --git a/v3/internal/generator/render/doc.go b/v3/internal/generator/render/doc.go new file mode 100644 index 00000000000..586d095aae3 --- /dev/null +++ b/v3/internal/generator/render/doc.go @@ -0,0 +1,136 @@ +package render + +import ( + "bufio" + "bytes" + "go/ast" + "strings" + "unicode" + + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// hasdoc checks whether the given comment group contains actual doc comments. +func hasdoc(group *ast.CommentGroup) bool { + if group == nil { + return false + } + + // TODO: this is horrible, make it more efficient? + return strings.ContainsFunc(group.Text(), func(r rune) bool { return !unicode.IsSpace(r) }) +} + +var commentTerminator = []byte("*/") + +// jsdoc splits the given comment into lines and rewrites it as follows: +// - first, line terminators are stripped; +// - then a line terminator, the indent string and ' * ' +// are prepended to each line; +// - occurrences of the comment terminator '*/' are replaced with '* /' +// to avoid accidentally terminating the surrounding comment. +// +// All lines thus modified are joined back together. +// +// The returned string can be inserted in a multiline JSDoc comment +// with the given indentation. +func jsdoc(comment string, indent string) string { + var builder strings.Builder + prefix := []byte(newline + indent + " * ") + + scanner := bufio.NewScanner(bytes.NewReader([]byte(comment))) + for scanner.Scan() { + line := scanner.Bytes() + + // Prepend prefix. + builder.Write(prefix) + + // Escape comment terminators. + for t := bytes.Index(line, commentTerminator); t >= 0; t = bytes.Index(line, commentTerminator) { + builder.Write(line[:t+1]) + builder.WriteRune(' ') + line = line[t+1:] + } + + builder.Write(line) + } + + return builder.String() +} + +// jsdocline removes all newlines in the given comment +// and escapes comment terminators using the same strategy as jsdoc. +func jsdocline(comment string) string { + var builder strings.Builder + + scanner := bufio.NewScanner(bytes.NewReader([]byte(comment))) + for scanner.Scan() { + line := bytes.TrimSpace(scanner.Bytes()) + if len(line) == 0 { + // Skip empty lines. + continue + } + + // Prepend space to separate lines. + builder.WriteRune(' ') + + // Escape comment terminators. + for t := bytes.Index(line, commentTerminator); t >= 0; t = bytes.Index(line, commentTerminator) { + builder.Write(line[:t+1]) + builder.WriteRune(' ') + line = line[t+1:] + } + + builder.Write(line) + } + + // Return resulting string, but skip initial space. + return builder.String()[1:] +} + +// isjsdocid returns true if the given string is a valid ECMAScript identifier, +// excluding unicode escape sequences. This is the property name format supported by JSDoc. +func isjsdocid(name string) bool { + for i, r := range name { + if i == 0 && !id_start(r) && r != '$' && r != '_' { + return false + } else if i > 0 && !id_continue(r) && r != '$' { + return false + } + } + return true +} + +// isjsdocobj returns true if all field names in the given model +// are valid jsdoc property names. +func isjsdocobj(model *collect.ModelInfo) bool { + if len(model.Fields) == 0 { + return false + } + for _, decl := range model.Fields { + for _, field := range decl { + if !isjsdocid(field.JsonName) { + return false + } + } + } + return true +} + +// id_start returns true if the given rune is in the ID_Start category +// according to UAX#31 (https://unicode.org/reports/tr31/). +func id_start(r rune) bool { + return (unicode.IsLetter(r) || + unicode.Is(unicode.Nl, r) || + unicode.Is(unicode.Other_ID_Start, r)) && !unicode.Is(unicode.Pattern_Syntax, r) && !unicode.Is(unicode.Pattern_White_Space, r) +} + +// id_continue returns true if the given rune is in the ID_Continue category +// according to UAX#31 (https://unicode.org/reports/tr31/). +func id_continue(r rune) bool { + return (id_start(r) || + unicode.Is(unicode.Mn, r) || + unicode.Is(unicode.Mc, r) || + unicode.Is(unicode.Nd, r) || + unicode.Is(unicode.Pc, r) || + unicode.Is(unicode.Other_ID_Continue, r)) && !unicode.Is(unicode.Pattern_Syntax, r) && !unicode.Is(unicode.Pattern_White_Space, r) +} diff --git a/v3/internal/generator/render/functions.go b/v3/internal/generator/render/functions.go new file mode 100644 index 00000000000..c5c71bc13c7 --- /dev/null +++ b/v3/internal/generator/render/functions.go @@ -0,0 +1,94 @@ +package render + +import ( + "fmt" + "math/big" + "strconv" + "strings" + "text/template" + + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// tmplFunctions holds a map of utility functions +// that should be available in every template. +var tmplFunctions = template.FuncMap{ + "fixext": fixext, + "hasdoc": hasdoc, + "isclass": collect.IsClass, + "isjsdocid": isjsdocid, + "isjsdocobj": isjsdocobj, + "jsdoc": jsdoc, + "jsdocline": jsdocline, + "jsid": jsid, + "jsimport": jsimport, + "jsparam": jsparam, + "jsvalue": jsvalue, + "typeparam": typeparam, +} + +// fixext replaces a *.ts extension with *.js in the given string. +// This is necessary to allow emitting javascript with the Typescript compiler. +func fixext(path string) string { + if strings.HasSuffix(path, ".ts") { + return path[:len(path)-3] + ".js" + } else { + return path + } +} + +// jsimport formats an external import name +// by joining the name with its occurrence index. +// Names are modified even when the index is 0 +// to avoid collisions with Go identifiers. +func jsimport(info collect.ImportInfo) string { + return fmt.Sprintf("%s$%d", info.Name, info.Index) +} + +// jsparam renders the JS name of a parameter. +// Blank parameters are replaced with a dollar sign followed by the given index. +// Non-blank parameters are escaped by [jsid]. +func jsparam(index int, param *collect.ParamInfo) string { + if param.Blank { + return "$" + strconv.Itoa(index) + } else { + return jsid(param.Name) + } +} + +// typeparam renders the TS name of a type parameter. +// Blank parameters are replaced with a double dollar sign +// followed by the given index. +// Non-blank parameters are escaped with jsid. +func typeparam(index int, param string) string { + if param == "" || param == "_" { + return "$$" + strconv.Itoa(index) + } else { + return jsid(param) + } +} + +// jsvalue renders a Go constant value to its Javascript representation. +func jsvalue(value any) string { + switch v := value.(type) { + case bool: + if v { + return "true" + } else { + return "false" + } + case string: + return fmt.Sprintf(`"%s"`, template.JSEscapeString(v)) + case int64: + return strconv.FormatInt(v, 10) + case *big.Int: + return v.String() + case *big.Float: + return v.Text('e', -1) + case *big.Rat: + return v.RatString() + } + + // Fall back to undefined. + return "(void(0))" +} diff --git a/v3/internal/generator/render/identifier.go b/v3/internal/generator/render/identifier.go new file mode 100644 index 00000000000..7a7b89f9d1f --- /dev/null +++ b/v3/internal/generator/render/identifier.go @@ -0,0 +1,92 @@ +package render + +import ( + "slices" +) + +// jsid escapes identifiers that match JS/TS reserved words +// by prepending a dollar sign. +func jsid(ident string) string { + if _, reserved := slices.BinarySearch(protectedWords, ident); reserved { + return "$" + ident + } + return ident +} + +func init() { + // Ensure reserved words are sorted in ascending lexicographical order. + slices.Sort(protectedWords) +} + +// protectedWords is a list of JS + TS words that are either reserved +// or have special meaning. Keep in ascending lexicographical order +// for best startup performance. +var protectedWords = []string{ + "JSON", + "Object", + "any", + "arguments", + "as", + "async", + "await", + "boolean", + "break", + "case", + "catch", + "class", + "const", + "constructor", + "continue", + "debugger", + "declare", + "default", + "delete", + "do", + "else", + "enum", + "export", + "extends", + "false", + "finally", + "for", + "from", + "function", + "get", + "if", + "implements", + "import", + "in", + "instanceof", + "interface", + "let", + "module", + "namespace", + "new", + "null", + "number", + "of", + "package", + "private", + "protected", + "public", + "require", + "return", + "set", + "static", + "string", + "super", + "switch", + "symbol", + "this", + "throw", + "true", + "try", + "type", + "typeof", + "undefined", + "var", + "void", + "while", + "with", + "yield", +} diff --git a/v3/internal/generator/render/module.go b/v3/internal/generator/render/module.go new file mode 100644 index 00000000000..3611c939a57 --- /dev/null +++ b/v3/internal/generator/render/module.go @@ -0,0 +1,26 @@ +package render + +import ( + "github.com/wailsapp/wails/v3/internal/flags" + "github.com/wailsapp/wails/v3/internal/generator/collect" + "golang.org/x/tools/go/types/typeutil" +) + +// module gathers data that is used when rendering a single JS/TS module. +type module struct { + *Renderer + *flags.GenerateBindingsOptions + + Imports *collect.ImportMap + + postponedCreates typeutil.Map +} + +// Runtime returns the import path for the Wails JS runtime module. +func (m *module) Runtime() string { + if m.UseBundledRuntime { + return "/wails/runtime.js" + } else { + return "@wailsio/runtime" + } +} diff --git a/v3/internal/generator/render/renderer.go b/v3/internal/generator/render/renderer.go new file mode 100644 index 00000000000..2ebf248852c --- /dev/null +++ b/v3/internal/generator/render/renderer.go @@ -0,0 +1,108 @@ +package render + +import ( + "io" + "strings" + "text/template" + + "github.com/wailsapp/wails/v3/internal/flags" + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// Renderer holds the template set for a given configuration. +// It provides methods for rendering various output modules. +type Renderer struct { + options *flags.GenerateBindingsOptions + collector *collect.Collector + + ext string + + service *template.Template + models *template.Template +} + +// NewRenderer initialises a code renderer +// for the given configuration and data collector. +func NewRenderer(options *flags.GenerateBindingsOptions, collector *collect.Collector) *Renderer { + ext := ".js" + if options.TS { + ext = ".ts" + } + + return &Renderer{ + options: options, + collector: collector, + + ext: ext, + + service: tmplService[tmplLanguage(options.TS)], + models: tmplModels[tmplLanguage(options.TS)], + } +} + +// ServiceFile returns the standard name of a service file +// for the given struct name, with the appropriate extension. +func (renderer *Renderer) ServiceFile(name string) string { + return strings.ToLower(name) + renderer.ext +} + +// ModelsFile returns the standard name of a models file +// with the appropriate extension. +func (renderer *Renderer) ModelsFile() string { + return renderer.options.ModelsFilename + renderer.ext +} + +// InternalFile returns the standard name of an internal model file +// with the appropriate extension. +func (renderer *Renderer) InternalFile() string { + return renderer.options.InternalFilename + renderer.ext +} + +// IndexFile returns the standard name of a package index file +// with the appropriate extension. +func (renderer *Renderer) IndexFile() string { + return renderer.options.IndexFilename + renderer.ext +} + +// Service renders binding code for the given service type to w. +func (renderer *Renderer) Service(w io.Writer, info *collect.ServiceInfo) error { + return renderer.service.Execute(w, &struct { + module + Service *collect.ServiceInfo + }{ + module{ + Renderer: renderer, + GenerateBindingsOptions: renderer.options, + Imports: info.Imports, + }, + info, + }) +} + +// Models renders models code for the given list of models. +func (renderer *Renderer) Models(w io.Writer, imports *collect.ImportMap, models []*collect.ModelInfo) error { + return renderer.models.Execute(w, &struct { + module + Models []*collect.ModelInfo + }{ + module{ + Renderer: renderer, + GenerateBindingsOptions: renderer.options, + Imports: imports, + }, + models, + }) +} + +// Index renders the given package index to w. +func (renderer *Renderer) Index(w io.Writer, index *collect.PackageIndex) error { + return tmplIndex.Execute(w, &struct { + *collect.PackageIndex + *Renderer + *flags.GenerateBindingsOptions + }{ + index, + renderer, + renderer.options, + }) +} diff --git a/v3/internal/generator/render/templates.go b/v3/internal/generator/render/templates.go new file mode 100644 index 00000000000..13ff40f60b7 --- /dev/null +++ b/v3/internal/generator/render/templates.go @@ -0,0 +1,39 @@ +package render + +import ( + "embed" + "strings" + "text/template" +) + +//go:embed templates/*.tmpl +var templates embed.FS + +type tmplLanguage bool + +const tmplJS, tmplTS tmplLanguage = false, true + +var tmplService = map[tmplLanguage]*template.Template{ + tmplJS: template.Must(template.New("service.js.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/service.js.tmpl")), + tmplTS: template.Must(template.New("service.ts.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/service.ts.tmpl")), +} + +var tmplModels = map[tmplLanguage]*template.Template{ + tmplJS: template.Must(template.New("models.js.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/models.js.tmpl")), + tmplTS: template.Must(template.New("models.ts.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/models.ts.tmpl")), +} + +var tmplIndex = template.Must(template.New("index.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/index.tmpl")) + +var newline string + +func init() { + var builder strings.Builder + + err := template.Must(template.New("newline.tmpl").ParseFS(templates, "templates/newline.tmpl")).Execute(&builder, nil) + if err != nil { + panic(err) + } + + newline = builder.String() +} diff --git a/v3/internal/generator/render/templates/index.tmpl b/v3/internal/generator/render/templates/index.tmpl new file mode 100644 index 00000000000..369c1e939b0 --- /dev/null +++ b/v3/internal/generator/render/templates/index.tmpl @@ -0,0 +1,37 @@ +{{$renderer := .}} +{{- $models := (fixext .ModelsFile)}} +{{- if not .TS -}} +// @ts-check +{{end -}} +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT +{{$hasDocs := false}} +{{- range .Package.Docs}} +{{- if hasdoc .}}{{$hasDocs := true}}{{break}}{{end}} +{{- end}} +{{- if $hasDocs}} +/** +{{- range .Package.Docs}} +{{- jsdoc .Text ""}} +{{- end}} + * @module + */ +{{end}} +{{- if .Services}} +{{- range .Services}} +import * as {{jsid .Name}} from "./{{js (fixext ($renderer.ServiceFile .Name))}}"; +{{- end}} +export { +{{- range $i, $service := .Services}} + {{- if gt $i 0}},{{end}} + {{jsid .Name}} +{{- end}} +}; +{{end}} +{{- if .Models}} +export * from "./{{js $models}}"; +{{end}} +{{- range .Package.Injections}} +{{.}} +{{- end}}{{if .Package.Injections}} +{{end -}} diff --git a/v3/internal/generator/render/templates/models.js.tmpl b/v3/internal/generator/render/templates/models.js.tmpl new file mode 100644 index 00000000000..da00e41d216 --- /dev/null +++ b/v3/internal/generator/render/templates/models.js.tmpl @@ -0,0 +1,212 @@ +{{$module := .}} +{{- $runtime := $module.Runtime}} +{{- $models := (fixext $module.ModelsFile)}} +{{- $internal := (fixext $module.InternalFile)}} +{{- $useInterfaces := .UseInterfaces}} +{{- $imports := $module.Imports -}} +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "{{js $runtime}}"; +{{range $imports.External}} +import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}"; +{{- end}}{{if $imports.External}} +{{end}} +{{- if $imports.ImportModels}} +import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}} +{{end}}{{end}} +{{- if $imports.ImportInternal}} +import * as $internal from "./{{js $internal}}"; +{{end}} +{{- range $model := .Models}} + +{{- $isEnum := $model.Values}} +{{- $isClassAlias := and $model.Type (not $useInterfaces) (isclass $model.Type)}} +{{- $isTypeAlias := and $model.Type (or $useInterfaces (not (isclass $model.Type)))}} +{{- $isClassOrInterface := and (not $model.Type) (not $model.Values)}} +{{- $isInterface := and $isClassOrInterface (or $useInterfaces $model.Alias)}} + +{{- /* Build type parameter list */}} +{{- $typeParams := ""}} +{{- $typeParamList := ""}} +{{- $createParamList := ""}} +{{- range $i, $param := $model.TypeParams}} + {{- $param = (typeparam $i $param)}} + {{- if eq $i 0}} + {{- $typeParams = $param}} + {{- $typeParamList = (printf "<%s" $param)}} + {{- $createParamList = (printf "($$createParam%s" $param)}} + {{- else}} + {{- $typeParams = (printf "%s,%s" $typeParams $param)}} + {{- $typeParamList = (printf "%s, %s" $typeParamList $param)}} + {{- $createParamList = (printf "%s, $$createParam%s" $createParamList $param)}} + {{- end}} +{{- end}} +{{- if $typeParamList}} + {{- $typeParamList = (printf "%s>" $typeParamList)}} + {{- $createParamList = (printf "%s)" $createParamList)}} +{{- end}} + +{{- if or $typeParamList (hasdoc $model.Decl.Doc) (hasdoc $model.Doc) $isEnum $isTypeAlias $isInterface}} +/** +{{- if hasdoc $model.Decl.Doc}} +{{- jsdoc $model.Decl.Doc.Text ""}}{{if hasdoc $model.Doc}} + *{{end}} +{{- end}} +{{- if hasdoc $model.Doc}} +{{- jsdoc $model.Doc.Text ""}} +{{- end}} +{{- if and $typeParamList (not $isClassAlias)}} + * @template {{$typeParams}} +{{- end}} +{{- if $isEnum}} + * @readonly + * @enum { {{- $module.JSType $model.Type -}} } +{{- else if $isTypeAlias}} + * @typedef { {{- $module.JSType $model.Type -}} } {{jsid $model.Name}} +{{- else if $isInterface}} +{{- if isjsdocobj $model}} + * @typedef {Object} {{jsid $model.Name}} +{{- range $i, $decl := $model.Fields}}{{range $j, $field := $decl}} + * @property { {{- $module.JSFieldType $field.StructField -}} } + {{- if $field.Optional}} [{{else}} {{end}}{{$field.JsonName}}{{if $field.Optional}}]{{end}} + {{- if hasdoc $field.Decl.Doc}} - {{jsdocline $field.Decl.Doc.Text}}{{end}} +{{- end}}{{end}} +{{- else}} + * @typedef { { +{{- range $i, $decl := $model.Fields}}{{range $j, $field := $decl}} + * "{{js $field.JsonName}}"{{if $field.Optional}}?{{end}}: {{$module.JSFieldType $field.StructField}}, +{{- end}}{{end}} + * } } {{jsid $model.Name}} +{{- end}} +{{- end}} + */ +{{- end}} +{{- if $isEnum}} +export const {{jsid $model.Name}} = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: {{$module.JSDefault $model.Type false}}, +{{range $i, $decl := $model.Values}}{{range $j, $spec := $decl}}{{range $k, $value := $spec}} + {{- if and (ne $i 0) (eq $j 0) (eq $k 0)}} +{{end}} + {{- if or (and (eq $j 0) (eq $k 0) (hasdoc $value.Decl.Doc)) (and (eq $k 0) (hasdoc $value.Spec.Doc))}} + {{- if gt $j 0}} +{{end}} + /** + {{- if and (eq $j 0) (eq $k 0) (hasdoc $value.Decl.Doc)}} + {{- jsdoc $value.Decl.Doc.Text " "}}{{if and (eq $k 0) (hasdoc $value.Spec.Doc)}} + *{{end}} + {{- end}} + {{- if and (eq $k 0) (hasdoc $value.Spec.Doc)}} + {{- jsdoc $value.Spec.Doc.Text " "}} + {{- end}} + */ + {{- end}} + {{jsid $value.Name}}: {{jsvalue $value.Value}}, +{{- end}}{{end}}{{end}} +}; +{{else if $isClassAlias}} +export const {{jsid $model.Name}} = {{$module.JSType $model.Type.Origin}}; + +/** +{{- if hasdoc $model.Decl.Doc}} +{{- jsdoc $model.Decl.Doc.Text ""}}{{if hasdoc $model.Doc}} + *{{end}} +{{- end}} +{{- if hasdoc $model.Doc}} +{{- jsdoc $model.Doc.Text ""}} +{{- end}} +{{- if $typeParamList}} + * @template {{$typeParams}} +{{- end}} + * @typedef { {{- $module.JSType $model.Type -}} } {{jsid $model.Name}} + */ +{{else if and $isClassOrInterface (not $isInterface)}} +export class {{jsid $model.Name}} { + /** + * Creates a new {{jsid $model.Name}} instance. + * @param {Partial<{{jsid $model.Name}}{{$typeParamList}}>} [$$source = {}] - The source object to create the {{jsid $model.Name}}. + */ + constructor($$source = {}) { + {{- range $decl := $model.Fields}}{{range $j, $field := $decl}} + {{- /* + In JS we need to set all properties explicitly + because JSDoc has no support for arbitrary property names yet. + See https://github.com/jsdoc/jsdoc/issues/1468 + + For optional fields we make the initialization code unreachable + and cast the false condition to any to prevent any complaint from Typescript. + */}} + if ({{if $field.Optional}}/** @type {any} */(false){{else}}!("{{js $field.JsonName}}" in $$source){{end}}) { + /** + {{- if and (eq $j 0) (hasdoc $field.Decl.Doc)}} + {{- jsdoc $field.Decl.Doc.Text " "}} + {{- end}} + * @member + * @type { {{- $module.JSFieldType $field.StructField}}{{if .Optional}} | undefined{{end -}} } + */ + this["{{js $field.JsonName}}"] = {{$module.JSDefault $field.Type $field.Quoted}}; + } + {{- end}}{{end}} + + Object.assign(this, $$source); + } + + /** + {{- if $typeParamList}} + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class {{jsid $model.Name}}. + * @template {{$typeParams}} + {{- range $i, $param := $model.TypeParams}} + {{- $param = (typeparam $i $param)}} + * @param {(any) => {{$param -}} } $$createParam{{$param}} + {{- end}} + * @returns {($$source?: any) => {{jsid $model.Name}}{{$typeParamList -}} } + {{- else}} + * Creates a new {{jsid $model.Name}} instance from a string or object. + * @param {any} [$$source = {}] + * @returns { {{- jsid $model.Name -}} } + {{- end}} + */ + static createFrom{{if $typeParamList}}{{$createParamList}}{{else}}($$source = {}){{end}} { + {{- range $i, $spec := $model.Fields}}{{range $j, $field := $spec}} + {{- $create := ($module.JSCreateWithParams $field.Type $createParamList)}} + {{- if ne $create "$Create.Any"}} + const $$createField{{$i}}_{{$j}} = {{$create}}; + {{- end}} + {{- end}}{{end}} + {{- $indent := ""}} + {{- if $typeParamList}} + {{- $indent = " "}} + return ($$source = {}) => { + {{- end}} + {{$indent}}let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + {{- range $i, $spec := $model.Fields}}{{range $j, $field := $spec}} + {{- if $module.NeedsCreate $field.Type}} + {{$indent}}if ("{{js $field.JsonName}}" in $$parsedSource) { + {{$indent}} $$parsedSource["{{js $field.JsonName}}"] = $$createField{{$i}}_{{$j}}($$parsedSource["{{js $field.JsonName}}"]); + {{$indent -}} } + {{- end}} + {{- end}}{{end}} + {{$indent}}return new {{jsid $model.Name}}(/** @type {Partial<{{jsid $model.Name}}{{$typeParamList}}>} */($$parsedSource)); + {{- if $typeParamList}} + }; + {{- end}} + } +} +{{else}} +{{- /* Rendered as a @typedef */}} +{{end}} +{{- end}} +{{- $postponed := $module.PostponedCreates}} +{{- if $postponed}} +// Private type creation functions +{{- range $i, $create := $postponed}} +{{if and (ge (len $create) 54) (eq (slice $create 39 54) "function $$init")}}var {{else}}const {{end -}} +$$createType{{$i}} = {{$create}}; +{{- end}} +{{end -}} diff --git a/v3/internal/generator/render/templates/models.ts.tmpl b/v3/internal/generator/render/templates/models.ts.tmpl new file mode 100644 index 00000000000..c7eb20a72d8 --- /dev/null +++ b/v3/internal/generator/render/templates/models.ts.tmpl @@ -0,0 +1,176 @@ +{{$module := .}} +{{- $runtime := $module.Runtime}} +{{- $models := (fixext $module.ModelsFile)}} +{{- $internal := (fixext $module.InternalFile)}} +{{- $useInterfaces := .UseInterfaces}} +{{- $imports := $module.Imports -}} +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "{{js $runtime}}"; +{{range $imports.External}} +import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}"; +{{- end}}{{if $imports.External}} +{{end}} +{{- if $imports.ImportModels}} +import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}} +{{end}}{{end}} +{{- if $imports.ImportInternal}} +import * as $internal from "./{{js $internal}}"; +{{end}} +{{- range $model := .Models}} + +{{- $isEnum := $model.Values}} +{{- $isClassAlias := and $model.Type (not $useInterfaces) (isclass $model.Type)}} +{{- $isTypeAlias := and $model.Type (or $useInterfaces (not (isclass $model.Type)))}} +{{- $isClassOrInterface := and (not $model.Type) (not $model.Values)}} +{{- $isInterface := or $useInterfaces $model.Alias}} + +{{- /* Build type parameter list */}} +{{- $typeParamList := ""}} +{{- $createParamList := ""}} +{{- range $i, $param := $model.TypeParams}} + {{- $param = (typeparam $i $param)}} + {{- if eq $i 0}} + {{- $typeParamList = (printf "<%s" $param)}} + {{- $createParamList = (printf "($$createParam%s" $param)}} + {{- else}} + {{- $typeParamList = (printf "%s, %s" $typeParamList $param)}} + {{- $createParamList = (printf "%s, $$createParam%s" $createParamList $param)}} + {{- end}} +{{- end}} +{{- if $typeParamList}} + {{- $typeParamList = (printf "%s>" $typeParamList)}} + {{- $createParamList = (printf "%s)" $createParamList)}} +{{- end}} + +{{- if or (hasdoc $model.Decl.Doc) (hasdoc $model.Doc)}} +/** +{{- if hasdoc $model.Decl.Doc}} +{{- jsdoc $model.Decl.Doc.Text ""}}{{if hasdoc $model.Doc}} + *{{end}} +{{- end}} +{{- if hasdoc $model.Doc}} +{{- jsdoc $model.Doc.Text ""}} +{{- end}} + */ +{{- end}} +{{- if $isEnum}} +export enum {{jsid $model.Name}} { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = {{$module.JSDefault $model.Type false}}, +{{range $i, $decl := $model.Values}}{{range $j, $spec := $decl}}{{range $k, $value := $spec}} + {{- if and (ne $i 0) (eq $j 0) (eq $k 0)}} +{{end}} + {{- if or (and (eq $j 0) (eq $k 0) (hasdoc $value.Decl.Doc)) (and (eq $k 0) (hasdoc $value.Spec.Doc))}} + {{- if gt $j 0}} +{{end}} + /** + {{- if and (eq $j 0) (eq $k 0) (hasdoc $value.Decl.Doc)}} + {{- jsdoc $value.Decl.Doc.Text " "}}{{if and (eq $k 0) (hasdoc $value.Spec.Doc)}} + *{{end}} + {{- end}} + {{- if and (eq $k 0) (hasdoc $value.Spec.Doc)}} + {{- jsdoc $value.Spec.Doc.Text " "}} + {{- end}} + */ + {{- end}} + {{jsid $value.Name}} = {{jsvalue $value.Value}}, + {{- end}}{{end}}{{end}} +}; +{{else if $isClassAlias}} +export const {{jsid $model.Name}} = {{$module.JSType $model.Type.Origin}}; +{{- if or (hasdoc $model.Decl.Doc) (hasdoc $model.Doc)}} + +/** +{{- if hasdoc $model.Decl.Doc}} +{{- jsdoc $model.Decl.Doc.Text ""}}{{if hasdoc $model.Doc}} + *{{end}} +{{- end}} +{{- if hasdoc $model.Doc}} +{{- jsdoc $model.Doc.Text ""}} +{{- end}} + */ +{{- end}} +export type {{jsid $model.Name}}{{$typeParamList}} = {{$module.JSType $model.Type}}; +{{else if $isTypeAlias}} +export type {{jsid $model.Name}}{{$typeParamList}} = {{$module.JSType $model.Type}}; +{{else if $isClassOrInterface}} +export {{if $isInterface}}interface{{else}}class{{end}} {{jsid $model.Name}}{{$typeParamList}} { + {{- range $i, $decl := $model.Fields}}{{range $j, $field := $decl}} + {{- if and (eq $j 0) (hasdoc $field.Decl.Doc)}} + {{- if gt $i 0}} +{{end}} + /** + {{- jsdoc $field.Decl.Doc.Text " "}} + */ + {{- end}} + "{{js $field.JsonName}}"{{if $field.Optional}}?{{end}}: {{$module.JSFieldType $field.StructField}}; + {{- end}}{{end}} +{{- if not $isInterface}} + + /** Creates a new {{jsid $model.Name}} instance. */ + constructor($$source: Partial<{{jsid $model.Name}}{{$typeParamList}}> = {}) { + {{- range $spec := $model.Fields}}{{range $i, $field := $spec}}{{if not .Optional}} + if (!("{{js $field.JsonName}}" in $$source)) { + this["{{js $field.JsonName}}"] = {{$module.JSDefault $field.Type $field.Quoted}}; + } + {{- end}}{{end}}{{end}} + + Object.assign(this, $$source); + } + + /** + {{- if $typeParamList}} + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class {{jsid $model.Name}}. + {{- else}} + * Creates a new {{jsid $model.Name}} instance from a string or object. + {{- end}} + */ + static createFrom{{$typeParamList}}({{if $typeParamList}} + {{- range $i, $param := $model.TypeParams}} + {{- $param = (typeparam $i $param)}} + {{- if gt $i 0}}, {{end -}} + $$createParam{{$param}}: (any) => {{$param}}{{end -}} + {{else}}$$source: any = {}{{end}}): + {{- if $typeParamList}} ($$source?: any) =>{{end}} {{jsid $model.Name}}{{$typeParamList}} { + {{- range $i, $spec := $model.Fields}}{{range $j, $field := $spec}} + {{- $create := ($module.JSCreateWithParams $field.Type $createParamList)}} + {{- if ne $create "$Create.Any"}} + const $$createField{{$i}}_{{$j}} = {{$create}}; + {{- end}} + {{- end}}{{end}} + {{- $indent := ""}} + {{- if $typeParamList}} + {{- $indent = " "}} + return ($$source: any = {}) => { + {{- end}} + {{$indent}}let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + {{- range $i, $spec := $model.Fields}}{{range $j, $field := $spec}} + {{- if $module.NeedsCreate $field.Type}} + {{$indent}}if ("{{js $field.JsonName}}" in $$parsedSource) { + {{$indent}} $$parsedSource["{{js $field.JsonName}}"] = $$createField{{$i}}_{{$j}}($$parsedSource["{{js $field.JsonName}}"]); + {{$indent -}} } + {{- end}} + {{- end}}{{end}} + {{$indent}}return new {{jsid $model.Name}}{{$typeParamList}}($$parsedSource as Partial<{{jsid $model.Name}}{{$typeParamList}}>); + {{- if $typeParamList}} + }; + {{- end}} + } +{{- end}} +} +{{end}} +{{- end}} +{{- $postponed := $module.PostponedCreates}} +{{- if $postponed}} +// Private type creation functions +{{- range $i, $create := $postponed}} +{{if and (ge (len $create) 16) (eq (slice $create 1 16) "function $$init")}}var {{else}}const {{end -}} +$$createType{{$i}} = {{$create}}; +{{- end}} +{{end -}} diff --git a/v3/internal/generator/render/templates/newline.tmpl b/v3/internal/generator/render/templates/newline.tmpl new file mode 100644 index 00000000000..d28790668f7 --- /dev/null +++ b/v3/internal/generator/render/templates/newline.tmpl @@ -0,0 +1,6 @@ +{{/* This template should render to a single newline (either LF or CRLF). */}} +{{/* + Git might be configured to rewrite LF newlines to CRLF + in templates, test cases and data, especially on Windows. + Having a newline template enables detection of the current newline mode. +*/ -}} diff --git a/v3/internal/generator/render/templates/service.js.tmpl b/v3/internal/generator/render/templates/service.js.tmpl new file mode 100644 index 00000000000..7857aece6c5 --- /dev/null +++ b/v3/internal/generator/render/templates/service.js.tmpl @@ -0,0 +1,100 @@ +{{$module := .}} +{{- $runtime := $module.Runtime}} +{{- $models := (fixext $module.ModelsFile)}} +{{- $internal := (fixext $module.InternalFile)}} +{{- $useNames := $module.UseNames}} +{{- $useInterfaces := $module.UseInterfaces}} +{{- $imports := $module.Imports}} +{{- with .Service -}} +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT +{{if or (hasdoc .Decl.Doc) (hasdoc .Doc)}} +/** +{{- if hasdoc .Decl.Doc}} +{{- jsdoc .Decl.Doc.Text ""}}{{if hasdoc .Doc}} + *{{end}} +{{- end}} +{{- if hasdoc .Doc}} +{{- jsdoc .Doc.Text ""}} +{{- end}} + * @module + */ +{{end}} +import {Call as $Call, Create as $Create} from "{{js $runtime}}"; +{{range $imports.External}} +import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}"; +{{- end}}{{if $imports.External}} +{{end}} +{{- if $imports.ImportModels}} +import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}} +{{end}}{{end}} +{{- if $imports.ImportInternal}} +import * as $internal from "./{{js $internal}}"; +{{end}} +{{- range .Injections}} +{{.}} +{{- end}}{{if .Injections}} +{{end}} +{{- range .Methods}} +/** +{{- if hasdoc .Decl.Doc}} +{{- jsdoc .Decl.Doc.Text ""}}{{if hasdoc .Doc}} + *{{end}} +{{- end}} +{{- if hasdoc .Doc}} +{{- jsdoc .Doc.Text ""}} +{{- end}} +{{- range $i, $param := .Params}} + * @param { {{- $module.JSType .Type}}{{if .Variadic}}[]{{end -}} } {{jsparam $i .}} +{{- end}} + * @returns {Promise< + {{- if eq 0 (len .Results) -}} + void + {{- else if eq 1 (len .Results)}} + {{- $module.JSType (index .Results 0)}} + {{- else -}} + [{{range $i, $result := .Results}} + {{- if gt $i 0}}, {{end}} + {{- $module.JSType $result}} + {{- end}}] + {{- end}}> & { cancel(): void }} + */ +{{if not .Internal}}export {{end}}function {{.Name}}({{range $i, $param := .Params -}} + {{- if gt $i 0}}, {{end}} + {{- if .Variadic}}...{{end}} + {{- jsparam $i .}} +{{- end}}) { + {{- if $useNames}} + let $resultPromise = /** @type {any} */($Call.ByName("{{js .FQN}}" + {{- else}} + let $resultPromise = /** @type {any} */($Call.ByID({{.ID}} + {{- end}}{{range $i, $param := .Params}}, {{jsparam $i .}}{{end}})); + {{- if or $useInterfaces (not .Results) ($module.SkipCreate .Results)}} + return $resultPromise; + {{- else}} + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + {{- if eq 1 (len .Results)}} + return {{$module.JSCreate (index .Results 0)}}($result); + {{- else}} + {{- range $i, $type := .Results}} + {{- $create := ($module.JSCreate $type)}} + {{- if ne $create "$Create.Any"}} + $result[{{$i}}] = {{$create}}($result[{{$i}}]); + {{- end}}{{end}} + return $result; + {{- end}} + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; + {{- end}} +} +{{end}} +{{- $postponed := $module.PostponedCreates}} +{{- if $postponed}} +// Private type creation functions +{{- range $i, $create := $postponed}} +{{if and (ge (len $create) 54) (eq (slice $create 39 54) "function $$init")}}var {{else}}const {{end -}} +$$createType{{$i}} = {{$create}}; +{{- end}} +{{end}}{{end -}} diff --git a/v3/internal/generator/render/templates/service.ts.tmpl b/v3/internal/generator/render/templates/service.ts.tmpl new file mode 100644 index 00000000000..4b4e807a6ab --- /dev/null +++ b/v3/internal/generator/render/templates/service.ts.tmpl @@ -0,0 +1,97 @@ +{{$module := .}} +{{- $runtime := $module.Runtime}} +{{- $models := (fixext $module.ModelsFile)}} +{{- $internal := (fixext $module.InternalFile)}} +{{- $useNames := $module.UseNames}} +{{- $useInterfaces := $module.UseInterfaces}} +{{- $imports := $module.Imports}} +{{- with .Service -}} +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT +{{if or (hasdoc .Decl.Doc) (hasdoc .Doc)}} +/** +{{- if hasdoc .Decl.Doc}} +{{- jsdoc .Decl.Doc.Text ""}}{{if hasdoc .Doc}} + *{{end}} +{{- end}} +{{- if hasdoc .Doc}} +{{- jsdoc .Doc.Text ""}} +{{- end}} + * @module + */ +{{end}} +import {Call as $Call, Create as $Create} from "{{js $runtime}}"; +{{range $imports.External}} +import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}"; +{{- end}}{{if $imports.External}} +{{end}} +{{- if $imports.ImportModels}} +import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}} +{{end}}{{end}} +{{- if $imports.ImportInternal}} +import * as $internal from "./{{js $internal}}"; +{{end}} +{{- range .Injections}} +{{.}} +{{- end}}{{if .Injections}} +{{end}} +{{- range .Methods}} +{{- if or (hasdoc .Decl.Doc) (hasdoc .Doc)}} +/** +{{- if hasdoc .Decl.Doc}} +{{- jsdoc .Decl.Doc.Text ""}}{{if hasdoc .Doc}} + *{{end}} +{{- end}} +{{- if .Doc}} +{{- jsdoc .Doc.Text ""}} +{{- end}} + */ +{{- end}} +{{if not .Internal}}export {{end}}function {{.Name}}({{range $i, $param := .Params -}} + {{- if gt $i 0}}, {{end}} + {{- if .Variadic}}...{{end}} + {{- jsparam $i .}}: {{$module.JSType .Type}}{{if .Variadic}}[]{{end}} +{{- end}}): Promise< + {{- if eq 0 (len .Results) -}} + void + {{- else if eq 1 (len .Results)}} + {{- $module.JSType (index .Results 0)}} + {{- else -}} + [{{range $i, $result := .Results}} + {{- if gt $i 0}}, {{end}} + {{- $module.JSType $result}} + {{- end}}] + {{- end}}> & { cancel(): void } { + {{- if $useNames}} + let $resultPromise = $Call.ByName("{{js .FQN}}" + {{- else}} + let $resultPromise = $Call.ByID({{.ID}} + {{- end}}{{range $i, $param := .Params}}, {{jsparam $i .}}{{end}}) as any; + {{- if or $useInterfaces (not .Results) ($module.SkipCreate .Results)}} + return $resultPromise; + {{- else}} + let $typingPromise = $resultPromise.then(($result) => { + {{- if eq 1 (len .Results)}} + return {{$module.JSCreate (index .Results 0)}}($result); + {{- else}} + {{- range $i, $type := .Results}} + {{- $create := ($module.JSCreate $type)}} + {{- if ne $create "$Create.Any"}} + $result[{{$i}}] = {{$create}}($result[{{$i}}]); + {{- end}}{{end}} + return $result; + {{- end}} + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; + {{- end}} +} +{{end}} +{{- $postponed := $module.PostponedCreates}} +{{- if $postponed}} +// Private type creation functions +{{- range $i, $create := $postponed}} +{{if and (ge (len $create) 16) (eq (slice $create 1 16) "function $$init")}}var {{else}}const {{end -}} +$$createType{{$i}} = {{$create}}; +{{- end}} +{{end}}{{end -}} diff --git a/v3/internal/generator/render/type.go b/v3/internal/generator/render/type.go new file mode 100644 index 00000000000..dcb4f8e1bef --- /dev/null +++ b/v3/internal/generator/render/type.go @@ -0,0 +1,272 @@ +package render + +import ( + "fmt" + "go/types" + "strings" + "text/template" + + "github.com/wailsapp/wails/v3/internal/generator/collect" +) + +// aliasOrNamed is a common interface for *types.Alias and *types.Named. +type aliasOrNamed interface { + types.Type + Obj() *types.TypeName +} + +// typeByteSlice caches the type-checker type for a slice of bytes. +var typeByteSlice = types.NewSlice(types.Universe.Lookup("byte").Type()) + +// JSType renders a Go type to its TypeScript representation, +// using the receiver's import map to resolve dependencies. +// +// JSType's output may be incorrect if m.Imports.AddType +// has not been called for the given type. +func (m *module) JSType(typ types.Type) string { + result, _ := m.renderType(typ, false) + return result +} + +// JSFieldType renders a struct field type to its TypeScript representation, +// using the receiver's import map to resolve dependencies. +// +// JSFieldType's output may be incorrect if m.Imports.AddType +// has not been called for the given type. +func (m *module) JSFieldType(field *collect.StructField) string { + result, _ := m.renderType(field.Type, field.Quoted) + return result +} + +// renderType provides the actual implementation of [module.Type]. +// It returns the rendered type and a boolean indicating whether +// the resulting expression describes a nullable type. +func (m *module) renderType(typ types.Type, quoted bool) (result string, nullable bool) { + switch t := typ.(type) { + case *types.Alias, *types.Named: + return m.renderNamedType(typ.(aliasOrNamed), quoted) + + case *types.Array, *types.Slice: + null := "" + if _, isSlice := typ.(*types.Slice); isSlice && m.UseInterfaces { + // In interface mode, record the fact that encoding/json marshals nil slices as null. + null = " | null" + } + + if types.Identical(typ, typeByteSlice) { + // encoding/json marshals byte arrays/slices as base64 strings + return "string" + null, null != "" + } + + elem, ptr := m.renderType(typ.(interface{ Elem() types.Type }).Elem(), false) + if ptr { + return fmt.Sprintf("(%s)[]%s", elem, null), null != "" + } else { + return fmt.Sprintf("%s[]%s", elem, null), null != "" + } + + case *types.Basic: + return m.renderBasicType(t, quoted), false + + case *types.Map: + return m.renderMapType(t) + + case *types.Pointer: + elem, ptr := m.renderType(t.Elem(), false) + if ptr { + return elem, true + } else { + return fmt.Sprintf("%s | null", elem), true + } + + case *types.Struct: + return m.renderStructType(t), false + + case *types.TypeParam: + str := "" + if quoted { + str = "| string " + } + return fmt.Sprintf("%s %s| null", typeparam(t.Index(), t.Obj().Name()), str), true + } + + // Fall back to untyped mode. + return "any", false +} + +// renderBasicType outputs the TypeScript representation +// of the given basic type. +func (*module) renderBasicType(typ *types.Basic, quoted bool) string { + switch { + case typ.Info()&types.IsBoolean != 0: + if quoted { + return "`${boolean}`" + } else { + return "boolean" + } + + case typ.Info()&types.IsNumeric != 0 && typ.Info()&types.IsComplex == 0: + if quoted { + return "`${number}`" + } else { + return "number" + } + + case typ.Info()&types.IsString != 0: + if quoted { + return "`\"${string}\"`" + } else { + return "string" + } + } + + // Fall back to untyped mode. + if quoted { + return "string" + } else { + return "any" + } +} + +// renderMapType outputs the TypeScript representation of the given map type. +func (m *module) renderMapType(typ *types.Map) (result string, nullable bool) { + null := "" + if m.UseInterfaces { + // In interface mode, record the fact that encoding/json marshals nil slices as null. + null = " | null" + } + + key := "string" + elem, _ := m.renderType(typ.Elem(), false) + + // Test whether we can upgrade key rendering. + switch k := typ.Key().(type) { + case *types.Basic: + if k.Info()&types.IsString == 0 && collect.IsMapKey(k) { + // Render non-string basic type in quoted mode. + key = m.renderBasicType(k, true) + } + + case *types.Alias, *types.Named: + if collect.IsMapKey(typ) { + if collect.IsString(typ) { + // Alias or named type is a string and therefore + // safe to use as a JS object key. + if ptr, ok := k.(*types.Pointer); ok { + // Unwrap pointer to named string type, but not pointer aliases. + key, _ = m.renderType(ptr.Elem(), false) + } else { + key, _ = m.renderType(k, false) + } + } else if basic, ok := typ.Underlying().(*types.Basic); ok && basic.Info()&types.IsString == 0 { + // Render non-string basic type in quoted mode. + key = m.renderBasicType(basic, true) + } + } + + case *types.Pointer: + if collect.IsMapKey(typ) && collect.IsString(typ.Elem()) { + // Base type is a string alias and therefore + // safe to use as a JS object key. + key, _ = m.renderType(k.Elem(), false) + } + } + + return fmt.Sprintf("{ [_: %s]: %s }%s", key, elem, null), m.UseInterfaces +} + +// renderNamedType outputs the TS representation +// of the given named or alias type. +func (m *module) renderNamedType(typ aliasOrNamed, quoted bool) (result string, nullable bool) { + if typ.Obj().Pkg() == nil { + // Builtin alias or named type: render underlying type. + return m.renderType(typ.Underlying(), quoted) + } + + if quoted { + switch a := types.Unalias(typ).(type) { + case *types.Basic: + // Quoted mode for (alias of?) basic type: delegate. + return m.renderBasicType(a, quoted), false + case *types.TypeParam: + // Quoted mode for (alias of?) typeparam: delegate. + return m.renderType(a, quoted) + case *types.Named: + // Quoted mode for (alias of?) named type. + // WARN: Do not test with IsString here!! We only want to catch marshalers. + if !collect.IsAny(typ) && !collect.MaybeTextMarshaler(typ) { + // No custom marshaling for this type. + switch u := a.Underlying().(type) { + case *types.Basic: + // Quoted mode for basic named type that is not a marshaler: delegate. + return m.renderBasicType(u, quoted), false + case *types.TypeParam: + // Quoted mode for generic type that maps to typeparam: delegate. + return m.renderType(u, quoted) + } + } + } + } + + var builder strings.Builder + + if typ.Obj().Pkg().Path() == m.Imports.Self { + if typ.Obj().Exported() && m.Imports.ImportModels { + builder.WriteString("$models.") + } else if !typ.Obj().Exported() && m.Imports.ImportInternal { + builder.WriteString("$internal.") + } + } else { + builder.WriteString(jsimport(m.Imports.External[typ.Obj().Pkg().Path()])) + builder.WriteRune('.') + } + builder.WriteString(jsid(typ.Obj().Name())) + + instance, _ := typ.(interface{ TypeArgs() *types.TypeList }) + if instance != nil { + // Render type arguments. + if targs := instance.TypeArgs(); targs != nil && targs.Len() > 0 { + builder.WriteRune('<') + for i := range targs.Len() { + if i > 0 { + builder.WriteString(", ") + } + arg, _ := m.renderType(targs.At(i), false) + builder.WriteString(arg) + } + builder.WriteRune('>') + } + } + + return builder.String(), false +} + +// renderStructType outputs the TS representation +// of the given anonymous struct type. +func (m *module) renderStructType(typ *types.Struct) string { + info := m.collector.Struct(typ) + info.Collect() + + var builder strings.Builder + + builder.WriteRune('{') + for i, field := range info.Fields { + if i > 0 { + builder.WriteString(", ") + } + + builder.WriteRune('"') + template.JSEscape(&builder, []byte(field.JsonName)) + builder.WriteRune('"') + + if field.Optional { + builder.WriteRune('?') + } + + builder.WriteString(": ") + builder.WriteString(m.JSFieldType(field)) + } + builder.WriteRune('}') + + return builder.String() +} diff --git a/v3/internal/generator/service.go b/v3/internal/generator/service.go new file mode 100644 index 00000000000..8d6323a2136 --- /dev/null +++ b/v3/internal/generator/service.go @@ -0,0 +1,103 @@ +package generator + +import ( + "go/types" + "path/filepath" +) + +// generateService collects information +// and generates JS/TS binding code +// for the given service type object. +func (generator *Generator) generateService(obj *types.TypeName) { + generator.logger.Debugf( + "discovered service type %s from package %s", + obj.Name(), + obj.Pkg().Path(), + ) + + success := false + defer func() { + if !success { + generator.logger.Errorf( + "package %s: type %s: service code generation failed", + obj.Pkg().Path(), + obj.Name(), + ) + } + }() + + // Collect service information. + info := generator.collector.Service(obj).Collect() + if info == nil { + return + } + + if info.IsEmpty() { + generator.logger.Infof( + "package %s: type %s: service has no valid exported methods, skipping", + obj.Pkg().Path(), + obj.Name(), + ) + success = true + return + } + + // Check for standard filename collisions. + filename := generator.renderer.ServiceFile(info.Name) + switch filename { + case generator.renderer.ModelsFile(): + generator.logger.Errorf( + "package %s: type %s: service filename collides with models filename; please rename the type or choose a different filename for models", + obj.Pkg().Path(), + obj.Name(), + ) + return + + case generator.renderer.InternalFile(): + generator.logger.Errorf( + "package %s: type %s: service filename collides with internal models filename; please rename the type or choose a different filename for internal models", + obj.Pkg().Path(), + obj.Name(), + ) + return + + case generator.renderer.IndexFile(): + if !generator.options.NoIndex { + generator.logger.Errorf( + "package %s: type %s: service filename collides with JS/TS index filename; please rename the type or choose a different filename for JS/TS indexes", + obj.Pkg().Path(), + obj.Name(), + ) + return + } + } + + // Check for upper/lower-case filename collisions. + path := filepath.Join(info.Imports.Self, filename) + if other, present := generator.serviceFiles.LoadOrStore(path, obj); present { + generator.logger.Errorf( + "package %s: type %s: service filename collides with filename for service %s; please avoid multiple services whose names differ only in case", + obj.Pkg().Path(), + obj.Name(), + other.(*types.TypeName).Name(), + ) + return + } + + // Create service file. + file, err := generator.creator.Create(path) + if err != nil { + generator.logger.Errorf("%v", err) + return + } + defer file.Close() + + // Render service code. + err = generator.renderer.Service(file, info) + if err != nil { + generator.logger.Errorf("%v", err) + return + } + + success = true +} diff --git a/v3/internal/generator/testcases/aliases/bound_types.json b/v3/internal/generator/testcases/aliases/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/aliases/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/generator/testcases/aliases/main.go b/v3/internal/generator/testcases/aliases/main.go new file mode 100644 index 00000000000..b77422b77ff --- /dev/null +++ b/v3/internal/generator/testcases/aliases/main.go @@ -0,0 +1,83 @@ +package main + +import ( + _ "embed" + "log" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +// GreetService is great +type GreetService int + +// A nice type Alias +type Alias = int + +// An empty struct alias. +type EmptyAliasStruct = struct{} + +// A struct alias. +// This should be rendered as a typedef or interface in every mode. +type AliasStruct = struct { + // A field with a comment. + Foo []int + Bar, Baz string `json:",omitempty"` // Definitely not Foo. + + Other OtherAliasStruct // A nested alias struct. +} + +// Another struct alias. +type OtherAliasStruct = struct { + NoMoreIdeas []rune +} + +// An empty struct. +type EmptyStruct struct{} + +// A non-generic struct containing an alias. +type Person struct { + Name string // The Person's name. + AliasedField Alias // A random alias field. +} + +// A generic struct containing an alias +type GenericPerson[T any] struct { + Name T + AliasedField Alias +} + +// Get someone +func (GreetService) Get(aliasValue Alias) Person { + return Person{"hello", aliasValue} +} + +// Get someone quite different +func (GreetService) GetButDifferent() GenericPerson[bool] { + return GenericPerson[bool]{true, 13} +} + +// Greet a lot of unusual things. +func (GreetService) Greet(EmptyAliasStruct, EmptyStruct) AliasStruct { + return AliasStruct{} +} + +func NewGreetService() application.Service { + return application.NewService(new(GreetService)) +} + +func main() { + app := application.New(application.Options{ + Services: []application.Service{ + NewGreetService(), + }, + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/internal/generator/testcases/complex_expressions/bound_types.json b/v3/internal/generator/testcases/complex_expressions/bound_types.json new file mode 100644 index 00000000000..b00766ba094 --- /dev/null +++ b/v3/internal/generator/testcases/complex_expressions/bound_types.json @@ -0,0 +1,14 @@ +[ + ".Service1", + ".Service2", + ".Service3", + ".Service4", + ".Service5", + ".Service6", + "/config.Service7", + "/config.Service8", + "/config.Service9", + "/config.Service10", + "/config.Service11", + "/config.Service12" +] diff --git a/v3/internal/generator/testcases/complex_expressions/config/config.go b/v3/internal/generator/testcases/complex_expressions/config/config.go new file mode 100644 index 00000000000..f5f40dd8664 --- /dev/null +++ b/v3/internal/generator/testcases/complex_expressions/config/config.go @@ -0,0 +1,82 @@ +package config + +import "github.com/wailsapp/wails/v3/pkg/application" + +type Service7 struct{} +type Service8 struct{} +type Service9 struct{} +type Service10 struct{} +type Service11 struct{} +type Service12 struct{} + +func (*Service7) TestMethod() {} + +func (*Service9) TestMethod2() {} + +func NewService7() application.Service { + return application.NewService(new(Service7)) +} + +func NewService8() (result application.Service) { + result = application.NewService(&Service8{}) + return +} + +type ServiceProvider struct { + AService application.Service + *ProviderWithMethod + HeresAnotherOne application.Service +} + +type ProviderWithMethod struct { + OtherService any +} + +func (pm *ProviderWithMethod) Init() { + pm.OtherService = application.NewService(&Service10{}) +} + +var Services []application.Service + +func init() { + var ourServices = []application.Service{ + NewService7(), + NewService8(), + } + + Services = make([]application.Service, len(ourServices)) + + for i, el := range ourServices { + Services[len(ourServices)-i] = el + } +} + +func MoreServices() ServiceProvider { + var provider ServiceProvider + + provider.AService = application.NewService(&Service9{}) + provider.ProviderWithMethod = new(ProviderWithMethod) + + return provider +} + +type ProviderInitialiser interface { + InitProvider(provider any) +} + +type internalProviderInitialiser struct{} + +func NewProviderInitialiser() ProviderInitialiser { + return internalProviderInitialiser{} +} + +func (internalProviderInitialiser) InitProvider(provider any) { + switch p := provider.(type) { + case *ServiceProvider: + p.HeresAnotherOne = application.NewService(&Service11{}) + default: + if anyp, ok := p.(*any); ok { + *anyp = application.NewService(&Service12{}) + } + } +} diff --git a/v3/internal/generator/testcases/complex_expressions/main.go b/v3/internal/generator/testcases/complex_expressions/main.go new file mode 100644 index 00000000000..6dcbafd35d8 --- /dev/null +++ b/v3/internal/generator/testcases/complex_expressions/main.go @@ -0,0 +1,66 @@ +package main + +import ( + _ "embed" + "log" + "slices" + + "github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config" + "github.com/wailsapp/wails/v3/pkg/application" +) + +type Service1 struct{} +type Service2 struct{} +type Service3 struct{} +type Service4 struct{} +type Service5 struct{} +type Service6 struct{} + +var GlobalServices []application.Service + +func main() { + services := []application.Service{ + application.NewService(&Service1{}), + } + + services = append(services, application.NewService(&Service2{}), application.Service{}, application.Service{}) + services[2] = application.NewService(&Service3{}) + + var options = application.Options{ + Services: config.Services, + } + + provider := config.MoreServices() + provider.Init() + + pinit := config.NewProviderInitialiser() + pinit.InitProvider(&provider) + // Method resolution should work here just like above. + config.NewProviderInitialiser().InitProvider(&services[3]) + + copy(options.Services, []application.Service{application.NewService(&Service4{}), provider.HeresAnotherOne, provider.OtherService.(application.Service)}) + (options.Services) = append(options.Services, slices.Insert(services, 1, GlobalServices[2:]...)...) + + app := application.New(options) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} + +func init() { + var global = make([]application.Service, 4) + + global[0] = application.NewService(&Service5{}) + global = slices.Replace(global, 1, 4, + application.NewService(&Service6{}), + config.MoreServices().AService, + ) + + GlobalServices = slices.Clip(global) +} diff --git a/v3/internal/generator/testcases/complex_instantiations/bound_types.json b/v3/internal/generator/testcases/complex_instantiations/bound_types.json new file mode 100644 index 00000000000..eeb776de377 --- /dev/null +++ b/v3/internal/generator/testcases/complex_instantiations/bound_types.json @@ -0,0 +1,15 @@ +[ + ".Service1", + ".Service2", + ".Service3", + ".Service4", + ".Service5", + ".Service6", + ".Service7", + ".Service8", + ".Service9", + ".Service10", + ".Service11", + ".Service12", + "/other.Service13" +] diff --git a/v3/internal/generator/testcases/complex_instantiations/factory.go b/v3/internal/generator/testcases/complex_instantiations/factory.go new file mode 100644 index 00000000000..854af696727 --- /dev/null +++ b/v3/internal/generator/testcases/complex_instantiations/factory.go @@ -0,0 +1,21 @@ +package main + +import "github.com/wailsapp/wails/v3/pkg/application" + +type Factory[T any, U any] struct { + simpleFactory[T] +} + +func NewFactory[T any, U any]() *Factory[T, U] { + return &Factory[T, U]{} +} + +func (*Factory[T, U]) GetU() application.Service { + return application.NewService(new(U)) +} + +type simpleFactory[T any] struct{} + +func (simpleFactory[U]) Get() application.Service { + return application.NewService(new(U)) +} diff --git a/v3/internal/generator/testcases/complex_instantiations/funcs.go b/v3/internal/generator/testcases/complex_instantiations/funcs.go new file mode 100644 index 00000000000..7aea0e7e0c6 --- /dev/null +++ b/v3/internal/generator/testcases/complex_instantiations/funcs.go @@ -0,0 +1,14 @@ +package main + +import "github.com/wailsapp/wails/v3/pkg/application" + +func ServiceInitialiser[T any]() func(*T) application.Service { + return application.NewService[T] +} + +func CustomNewServices[T any, U any]() []application.Service { + return []application.Service{ + application.NewService(new(T)), + application.NewService(new(U)), + } +} diff --git a/v3/internal/generator/testcases/complex_instantiations/main.go b/v3/internal/generator/testcases/complex_instantiations/main.go new file mode 100644 index 00000000000..872a029d0bb --- /dev/null +++ b/v3/internal/generator/testcases/complex_instantiations/main.go @@ -0,0 +1,52 @@ +package main + +import ( + _ "embed" + "log" + + "github.com/wailsapp/wails/v3/internal/generator/testcases/complex_instantiations/other" + "github.com/wailsapp/wails/v3/pkg/application" +) + +type Service1 struct{} +type Service2 struct{} +type Service3 struct{} +type Service4 struct{} +type Service5 struct{} +type Service6 struct{} +type Service7 struct{} +type Service8 struct{} +type Service9 struct{} +type Service10 struct{} +type Service11 struct{} +type Service12 struct{} + +func main() { + factory := NewFactory[Service1, Service2]() + otherFactory := other.NewFactory[Service3, Service4]() + + app := application.New(application.Options{ + Services: append(append( + []application.Service{ + factory.Get(), + factory.GetU(), + otherFactory.Get(), + otherFactory.GetU(), + application.NewService(&Service5{}), + ServiceInitialiser[Service6]()(&Service6{}), + other.CustomNewService(Service7{}), + other.ServiceInitialiser[Service8]()(&Service8{}), + other.LocalService, + }, + CustomNewServices[Service9, Service10]()...), + other.CustomNewServices[Service11, Service12]()...), + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } +} diff --git a/v3/internal/generator/testcases/complex_instantiations/other/factory.go b/v3/internal/generator/testcases/complex_instantiations/other/factory.go new file mode 100644 index 00000000000..d8e3aadb781 --- /dev/null +++ b/v3/internal/generator/testcases/complex_instantiations/other/factory.go @@ -0,0 +1,21 @@ +package other + +import "github.com/wailsapp/wails/v3/pkg/application" + +type Factory[T any, U any] struct { + simpleFactory[T] +} + +func NewFactory[T any, U any]() *Factory[T, U] { + return &Factory[T, U]{} +} + +func (*Factory[T, U]) GetU() application.Service { + return application.NewService(new(U)) +} + +type simpleFactory[T any] struct{} + +func (simpleFactory[U]) Get() application.Service { + return application.NewService(new(U)) +} diff --git a/v3/internal/generator/testcases/complex_instantiations/other/funcs.go b/v3/internal/generator/testcases/complex_instantiations/other/funcs.go new file mode 100644 index 00000000000..daf1ad066f1 --- /dev/null +++ b/v3/internal/generator/testcases/complex_instantiations/other/funcs.go @@ -0,0 +1,18 @@ +package other + +import "github.com/wailsapp/wails/v3/pkg/application" + +func CustomNewService[T any](srv T) application.Service { + return application.NewService(&srv) +} + +func ServiceInitialiser[T any]() func(*T) application.Service { + return application.NewService[T] +} + +func CustomNewServices[T any, U any]() []application.Service { + return []application.Service{ + application.NewService(new(T)), + application.NewService(new(U)), + } +} diff --git a/v3/internal/generator/testcases/complex_instantiations/other/local.go b/v3/internal/generator/testcases/complex_instantiations/other/local.go new file mode 100644 index 00000000000..dea5d0561bd --- /dev/null +++ b/v3/internal/generator/testcases/complex_instantiations/other/local.go @@ -0,0 +1,7 @@ +package other + +import "github.com/wailsapp/wails/v3/pkg/application" + +type Service13 int + +var LocalService = application.NewService(new(Service13)) diff --git a/v3/internal/generator/testcases/complex_json/bound_types.json b/v3/internal/generator/testcases/complex_json/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/complex_json/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/generator/testcases/complex_json/main.go b/v3/internal/generator/testcases/complex_json/main.go new file mode 100644 index 00000000000..18ee6720f9f --- /dev/null +++ b/v3/internal/generator/testcases/complex_json/main.go @@ -0,0 +1,124 @@ +package main + +import ( + _ "embed" + "log" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +// Title is a title +type Title string + +const ( + // Mister is a title + Mister Title = "Mr" + Miss Title = "Miss" + Ms Title = "Ms" + Mrs Title = "Mrs" + Dr Title = "Dr" +) + +// GreetService is great +type GreetService struct{} + +type Embedded1 struct { + // Friends should be shadowed in Person by a field of lesser depth + Friends int + + // Vanish should be omitted from Person because there is another field with same depth and no tag + Vanish float32 + + // StillThere should be shadowed in Person by other field with same depth and a json tag + StillThere string + + // embedded4 should effectively appear as an embedded field + embedded4 + + // unexported should be invisible + unexported bool +} + +type Embedded2 struct { + // Vanish should be omitted from Person because there is another field with same depth and no tag + Vanish bool + + // StillThereButRenamed should shadow in Person the other field with same depth and no json tag + StillThereButRenamed *Embedded3 `json:"StillThere"` +} + +type Embedded3 string + +// Person represents a person +type Person struct { + // Titles is optional in JSON + Titles []Title `json:",omitempty"` + + // Names has a + // multiline comment + Names []string + + // Partner has a custom and complex JSON key + Partner *Person `json:"the person's partner ❤️"` + Friends []*Person + + Embedded1 + Embedded2 + + // UselessMap is invisible to JSON + UselessMap map[int]bool `json:"-"` + + // StrangeNumber maps to "-" + StrangeNumber float32 `json:"-,"` + + // Embedded3 should appear with key "Embedded3" + Embedded3 + + // StrangerNumber is serialized as a string + StrangerNumber int `json:",string"` + // StrangestString is optional and serialized as a JSON string + StrangestString string `json:",omitempty,string"` + // StringStrangest is serialized as a JSON string and optional + StringStrangest string `json:",string,omitempty"` + + // unexportedToo should be invisible even with a json tag + unexportedToo bool `json:"Unexported"` + + // embedded4 should be optional and appear with key "emb4" + embedded4 `json:"emb4,omitempty"` +} + +type embedded4 struct { + // NamingThingsIsHard is a law of programming + NamingThingsIsHard bool `json:",string"` + + // Friends should not be shadowed in Person as embedded4 is not embedded + // from encoding/json's point of view; + // however, it should be shadowed in Embedded1 + Friends bool + + // Embedded string should be invisible because it's unexported + string +} + +// Greet does XYZ +func (*GreetService) Greet(person Person, emb Embedded1) string { + return "" +} + +func main() { + app := application.New(application.Options{ + Services: []application.Service{ + application.NewService(&GreetService{}), + }, + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/internal/generator/testcases/complex_method/bound_types.json b/v3/internal/generator/testcases/complex_method/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/complex_method/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/generator/testcases/complex_method/main.go b/v3/internal/generator/testcases/complex_method/main.go new file mode 100644 index 00000000000..86588e0c42d --- /dev/null +++ b/v3/internal/generator/testcases/complex_method/main.go @@ -0,0 +1,43 @@ +package main + +import ( + _ "embed" + "log" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +// GreetService is great +type GreetService struct{} + +// Person represents a person +type Person struct { + Name string +} + +// Greet does XYZ +// It has a multiline doc comment +// The comment has even some */ traps!! +func (*GreetService) Greet(str string, people []Person, _ struct { + AnotherCount int + AnotherOne *Person +}, assoc map[int]*bool, _ []*float32, other ...string) (person Person, _ any, err1 error, _ []int, err error) { + return +} + +func main() { + app := application.New(application.Options{ + Services: []application.Service{ + application.NewService(&GreetService{}), + }, + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/internal/generator/testcases/cycles/bound_types.json b/v3/internal/generator/testcases/cycles/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/cycles/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/generator/testcases/cycles/main.go b/v3/internal/generator/testcases/cycles/main.go new file mode 100644 index 00000000000..0575ce07345 --- /dev/null +++ b/v3/internal/generator/testcases/cycles/main.go @@ -0,0 +1,46 @@ +package main + +import ( + _ "embed" + "log" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +// GreetService is great +type GreetService int + +type Cyclic []map[string]Alias + +type Alias = *Cyclic + +type GenericCyclic[T any] []struct { + X *GenericCyclic[T] + Y []T +} + +// Make a cycle. +func (GreetService) MakeCycles() (_ Cyclic, _ GenericCyclic[GenericCyclic[int]]) { + return +} + +func NewGreetService() application.Service { + return application.NewService(new(GreetService)) +} + +func main() { + app := application.New(application.Options{ + Services: []application.Service{ + NewGreetService(), + }, + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/internal/generator/testcases/embedded_interface/bound_types.json b/v3/internal/generator/testcases/embedded_interface/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/embedded_interface/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/generator/testcases/embedded_interface/main.go b/v3/internal/generator/testcases/embedded_interface/main.go new file mode 100644 index 00000000000..c49f8b7c93c --- /dev/null +++ b/v3/internal/generator/testcases/embedded_interface/main.go @@ -0,0 +1,51 @@ +package main + +import ( + "log" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +// GreetService is great +type GreetService struct { + AnInterface +} + +type AnInterface interface { + // Comment 1. + Method1() + + Method2() // Comment 2. + + // Comment 3a. + Method3() // Comment 3b. + + interface { + // Comment 4. + Method4() + } + + InterfaceAlias +} + +type InterfaceAlias = interface { + // Comment 5. + Method5() +} + +func main() { + app := application.New(application.Options{ + Services: []application.Service{ + application.NewService(&GreetService{}), + }, + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/internal/generator/testcases/enum/bound_types.json b/v3/internal/generator/testcases/enum/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/enum/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/parser/testdata/enum/main.go b/v3/internal/generator/testcases/enum/main.go similarity index 91% rename from v3/internal/parser/testdata/enum/main.go rename to v3/internal/generator/testcases/enum/main.go index a5228476365..a0329e7db74 100644 --- a/v3/internal/parser/testdata/enum/main.go +++ b/v3/internal/generator/testcases/enum/main.go @@ -44,8 +44,8 @@ func (*GreetService) NewPerson(name string) *Person { func main() { app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), }, }) diff --git a/v3/internal/generator/testcases/enum_from_imported_package/bound_types.json b/v3/internal/generator/testcases/enum_from_imported_package/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/enum_from_imported_package/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/parser/testdata/enum_from_imported_package/main.go b/v3/internal/generator/testcases/enum_from_imported_package/main.go similarity index 73% rename from v3/internal/parser/testdata/enum_from_imported_package/main.go rename to v3/internal/generator/testcases/enum_from_imported_package/main.go index f0d1865ef2d..9aae6cca659 100644 --- a/v3/internal/parser/testdata/enum_from_imported_package/main.go +++ b/v3/internal/generator/testcases/enum_from_imported_package/main.go @@ -2,9 +2,10 @@ package main import ( _ "embed" - "github.com/wailsapp/wails/v3/internal/parser/testdata/enum_from_imported_package/services" "log" + "github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services" + "github.com/wailsapp/wails/v3/pkg/application" ) @@ -21,8 +22,8 @@ func (*GreetService) Greet(name string, title services.Title) string { func main() { app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), }, }) diff --git a/v3/internal/parser/testdata/enum_from_imported_package/services/other.go b/v3/internal/generator/testcases/enum_from_imported_package/services/other.go similarity index 100% rename from v3/internal/parser/testdata/enum_from_imported_package/services/other.go rename to v3/internal/generator/testcases/enum_from_imported_package/services/other.go diff --git a/v3/internal/generator/testcases/function_from_imported_package/bound_types.json b/v3/internal/generator/testcases/function_from_imported_package/bound_types.json new file mode 100644 index 00000000000..86a0a881209 --- /dev/null +++ b/v3/internal/generator/testcases/function_from_imported_package/bound_types.json @@ -0,0 +1,4 @@ +[ + ".GreetService", + "/services.OtherService" +] diff --git a/v3/internal/parser/testdata/function_from_imported_package/main.go b/v3/internal/generator/testcases/function_from_imported_package/main.go similarity index 79% rename from v3/internal/parser/testdata/function_from_imported_package/main.go rename to v3/internal/generator/testcases/function_from_imported_package/main.go index d696456b1c8..a1d752d1d84 100644 --- a/v3/internal/parser/testdata/function_from_imported_package/main.go +++ b/v3/internal/generator/testcases/function_from_imported_package/main.go @@ -2,9 +2,10 @@ package main import ( _ "embed" - "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services" "log" + "github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services" + "github.com/wailsapp/wails/v3/pkg/application" ) @@ -33,8 +34,8 @@ func (*GreetService) NewPerson(name string) *Person { func main() { app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), services.NewOtherService(), }, }) diff --git a/v3/internal/parser/testdata/function_from_imported_package/services/other.go b/v3/internal/generator/testcases/function_from_imported_package/services/other.go similarity index 70% rename from v3/internal/parser/testdata/function_from_imported_package/services/other.go rename to v3/internal/generator/testcases/function_from_imported_package/services/other.go index 2daa9df17a2..4ac6e6efde1 100644 --- a/v3/internal/parser/testdata/function_from_imported_package/services/other.go +++ b/v3/internal/generator/testcases/function_from_imported_package/services/other.go @@ -1,5 +1,7 @@ package services +import "github.com/wailsapp/wails/v3/pkg/application" + // OtherService is a struct // that does things type OtherService struct { @@ -21,6 +23,6 @@ func (o *OtherService) Yay() *Address { } } -func NewOtherService() *OtherService { - return &OtherService{} +func NewOtherService() application.Service { + return application.NewService(&OtherService{}) } diff --git a/v3/internal/generator/testcases/function_from_nested_imported_package/bound_types.json b/v3/internal/generator/testcases/function_from_nested_imported_package/bound_types.json new file mode 100644 index 00000000000..7f9f0ea613b --- /dev/null +++ b/v3/internal/generator/testcases/function_from_nested_imported_package/bound_types.json @@ -0,0 +1,4 @@ +[ + ".GreetService", + "/services/other.OtherService" +] diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/main.go b/v3/internal/generator/testcases/function_from_nested_imported_package/main.go similarity index 77% rename from v3/internal/parser/testdata/function_from_nested_imported_package/main.go rename to v3/internal/generator/testcases/function_from_nested_imported_package/main.go index 105386f0f74..4f47c239154 100644 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/main.go +++ b/v3/internal/generator/testcases/function_from_nested_imported_package/main.go @@ -2,9 +2,10 @@ package main import ( _ "embed" - "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_nested_imported_package/services/other" "log" + "github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other" + "github.com/wailsapp/wails/v3/pkg/application" ) @@ -32,8 +33,8 @@ func (*GreetService) NewPerson(name string) *Person { func main() { app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), other.NewOtherService(), }, }) diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/services/other/other.go b/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/other.go similarity index 70% rename from v3/internal/parser/testdata/function_from_nested_imported_package/services/other/other.go rename to v3/internal/generator/testcases/function_from_nested_imported_package/services/other/other.go index f44b3548af8..fa12f63ce6c 100644 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/services/other/other.go +++ b/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/other.go @@ -1,5 +1,7 @@ package other +import "github.com/wailsapp/wails/v3/pkg/application" + // OtherService is a struct // that does things type OtherService struct { @@ -21,6 +23,6 @@ func (o *OtherService) Yay() *Address { } } -func NewOtherService() *OtherService { - return &OtherService{} +func NewOtherService() application.Service { + return application.NewService(&OtherService{}) } diff --git a/v3/internal/generator/testcases/function_multiple_files/bound_types.json b/v3/internal/generator/testcases/function_multiple_files/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/function_multiple_files/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/generator/testcases/function_multiple_files/greet.go b/v3/internal/generator/testcases/function_multiple_files/greet.go new file mode 100644 index 00000000000..b0153f22fc6 --- /dev/null +++ b/v3/internal/generator/testcases/function_multiple_files/greet.go @@ -0,0 +1,20 @@ +package main + +import ( + _ "embed" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +type GreetService struct { + SomeVariable int + lowerCase string +} + +func (*GreetService) Greet(name string) string { + return "Hello " + name +} + +func NewGreetService() application.Service { + return application.NewService(&GreetService{}) +} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/main.go b/v3/internal/generator/testcases/function_multiple_files/main.go similarity index 79% rename from v3/internal/parser/testdata/struct_literal_multiple_files/main.go rename to v3/internal/generator/testcases/function_multiple_files/main.go index a75d4d7bd23..dff57250631 100644 --- a/v3/internal/parser/testdata/struct_literal_multiple_files/main.go +++ b/v3/internal/generator/testcases/function_multiple_files/main.go @@ -9,9 +9,8 @@ import ( func main() { app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, - &OtherService{}, + Services: []application.Service{ + NewGreetService(), }, }) diff --git a/v3/internal/generator/testcases/function_single/bound_types.json b/v3/internal/generator/testcases/function_single/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/function_single/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/parser/testdata/function_single/main.go b/v3/internal/generator/testcases/function_single/main.go similarity index 78% rename from v3/internal/parser/testdata/function_single/main.go rename to v3/internal/generator/testcases/function_single/main.go index 8bb48f4e281..cf70cc2be91 100644 --- a/v3/internal/parser/testdata/function_single/main.go +++ b/v3/internal/generator/testcases/function_single/main.go @@ -18,13 +18,13 @@ func (*GreetService) Greet(name string) string { return "Hello " + name } -func NewGreetService() *GreetService { - return &GreetService{} +func NewGreetService() application.Service { + return application.NewService(&GreetService{}) } func main() { app := application.New(application.Options{ - Bind: []interface{}{ + Services: []application.Service{ NewGreetService(), }, }) diff --git a/v3/internal/generator/testcases/function_single_context/bound_types.json b/v3/internal/generator/testcases/function_single_context/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/function_single_context/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/parser/testdata/function_single_context/main.go b/v3/internal/generator/testcases/function_single_context/main.go similarity index 82% rename from v3/internal/parser/testdata/function_single_context/main.go rename to v3/internal/generator/testcases/function_single_context/main.go index c42e1c871a7..3b26c9ae7a0 100644 --- a/v3/internal/parser/testdata/function_single_context/main.go +++ b/v3/internal/generator/testcases/function_single_context/main.go @@ -24,13 +24,13 @@ func (*GreetService) GreetWithContext(ctx context.Context, name string) string { return "Hello " + name } -func NewGreetService() *GreetService { - return &GreetService{} +func NewGreetService() application.Service { + return application.NewService(&GreetService{}) } func main() { app := application.New(application.Options{ - Bind: []interface{}{ + Services: []application.Service{ NewGreetService(), }, }) diff --git a/v3/internal/generator/testcases/no_bindings_here/other/othermethods.go b/v3/internal/generator/testcases/no_bindings_here/other/othermethods.go new file mode 100644 index 00000000000..8d4ec6ba82e --- /dev/null +++ b/v3/internal/generator/testcases/no_bindings_here/other/othermethods.go @@ -0,0 +1,11 @@ +package other + +// OtherMethods has another method, but through a private embedded type. +type OtherMethods struct { + otherMethodsImpl +} + +type otherMethodsImpl int + +// LikeThisOtherOne does nothing as well, but is different. +func (*otherMethodsImpl) LikeThisOtherOne() {} diff --git a/v3/internal/generator/testcases/no_bindings_here/other/otherperson.go b/v3/internal/generator/testcases/no_bindings_here/other/otherperson.go new file mode 100644 index 00000000000..516c965b5a4 --- /dev/null +++ b/v3/internal/generator/testcases/no_bindings_here/other/otherperson.go @@ -0,0 +1,10 @@ +package other + +// OtherPerson is like a person, but different. +type OtherPerson[T any] struct { + // They have a name as well. + Name string + + // But they may have many differences. + Differences []T +} diff --git a/v3/internal/generator/testcases/no_bindings_here/person.go b/v3/internal/generator/testcases/no_bindings_here/person.go new file mode 100644 index 00000000000..2da81745daf --- /dev/null +++ b/v3/internal/generator/testcases/no_bindings_here/person.go @@ -0,0 +1,25 @@ +package nobindingshere + +import "github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other" + +// Person is not a number. +type Person struct { + // They have a name. + Name string +} + +// Impersonator gets their fields from other people. +type Impersonator other.OtherPerson[int] + +// HowDifferent is a curious kind of person +// that lets other people decide how they are different. +type HowDifferent[How any] other.OtherPerson[map[string]How] + +// PrivatePerson gets their fields from hidden sources. +type PrivatePerson personImpl + +type personImpl struct { + // Nickname conceals a person's identity. + Nickname string + Person +} diff --git a/v3/internal/generator/testcases/no_bindings_here/somemethods.go b/v3/internal/generator/testcases/no_bindings_here/somemethods.go new file mode 100644 index 00000000000..5fcc66d4588 --- /dev/null +++ b/v3/internal/generator/testcases/no_bindings_here/somemethods.go @@ -0,0 +1,13 @@ +package nobindingshere + +import "github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other" + +// SomeMethods exports some methods. +type SomeMethods struct { + other.OtherMethods +} + +// LikeThisOne is an example method that does nothing. +func (SomeMethods) LikeThisOne() (_ Person, _ Impersonator, _ HowDifferent[bool], _ PrivatePerson) { + return +} diff --git a/v3/internal/generator/testcases/out_of_tree/bound_types.json b/v3/internal/generator/testcases/out_of_tree/bound_types.json new file mode 100644 index 00000000000..c0714f177f9 --- /dev/null +++ b/v3/internal/generator/testcases/out_of_tree/bound_types.json @@ -0,0 +1,7 @@ +[ + ".GreetService", + ".EmbedService", + ".EmbedOther", + "/../no_bindings_here.SomeMethods", + "/../no_bindings_here/other.OtherMethods" +] diff --git a/v3/internal/generator/testcases/out_of_tree/main.go b/v3/internal/generator/testcases/out_of_tree/main.go new file mode 100644 index 00000000000..25e9f4cce28 --- /dev/null +++ b/v3/internal/generator/testcases/out_of_tree/main.go @@ -0,0 +1,47 @@ +package main + +import ( + _ "embed" + "log" + + nobindingshere "github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here" + "github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other" + "github.com/wailsapp/wails/v3/pkg/application" +) + +// GreetService is great +type GreetService int + +// EmbedService is tricky. +type EmbedService struct { + nobindingshere.SomeMethods +} + +// EmbedOther is even trickier. +type EmbedOther struct { + other.OtherMethods +} + +// Greet someone +func (*GreetService) Greet(string) {} + +func main() { + app := application.New(application.Options{ + Services: []application.Service{ + application.NewService(new(GreetService)), + application.NewService(&EmbedService{}), + application.NewService(&EmbedOther{}), + application.NewService(&nobindingshere.SomeMethods{}), + application.NewService(&other.OtherMethods{}), + }, + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/internal/generator/testcases/struct_literal_multiple/bound_types.json b/v3/internal/generator/testcases/struct_literal_multiple/bound_types.json new file mode 100644 index 00000000000..be815a97ec6 --- /dev/null +++ b/v3/internal/generator/testcases/struct_literal_multiple/bound_types.json @@ -0,0 +1,4 @@ +[ + ".GreetService", + ".OtherService" +] diff --git a/v3/internal/parser/testdata/struct_literal_multiple/main.go b/v3/internal/generator/testcases/struct_literal_multiple/main.go similarity index 79% rename from v3/internal/parser/testdata/struct_literal_multiple/main.go rename to v3/internal/generator/testcases/struct_literal_multiple/main.go index fb555d79ff7..e07c8b6c851 100644 --- a/v3/internal/parser/testdata/struct_literal_multiple/main.go +++ b/v3/internal/generator/testcases/struct_literal_multiple/main.go @@ -24,9 +24,9 @@ func (o *OtherService) Hello() {} func main() { app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, - &OtherService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), + application.NewService(&OtherService{}), }, }) diff --git a/v3/internal/generator/testcases/struct_literal_multiple_files/bound_types.json b/v3/internal/generator/testcases/struct_literal_multiple_files/bound_types.json new file mode 100644 index 00000000000..be815a97ec6 --- /dev/null +++ b/v3/internal/generator/testcases/struct_literal_multiple_files/bound_types.json @@ -0,0 +1,4 @@ +[ + ".GreetService", + ".OtherService" +] diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/greet.go b/v3/internal/generator/testcases/struct_literal_multiple_files/greet.go similarity index 100% rename from v3/internal/parser/testdata/struct_literal_multiple_files/greet.go rename to v3/internal/generator/testcases/struct_literal_multiple_files/greet.go diff --git a/v3/internal/generator/testcases/struct_literal_multiple_files/main.go b/v3/internal/generator/testcases/struct_literal_multiple_files/main.go new file mode 100644 index 00000000000..5c5a8c4fb17 --- /dev/null +++ b/v3/internal/generator/testcases/struct_literal_multiple_files/main.go @@ -0,0 +1,26 @@ +package main + +import ( + _ "embed" + "log" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +func main() { + app := application.New(application.Options{ + Services: []application.Service{ + application.NewService(&GreetService{}), + application.NewService(&OtherService{}), + }, + }) + + app.NewWebviewWindow() + + err := app.Run() + + if err != nil { + log.Fatal(err) + } + +} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/other.go b/v3/internal/generator/testcases/struct_literal_multiple_files/other.go similarity index 100% rename from v3/internal/parser/testdata/struct_literal_multiple_files/other.go rename to v3/internal/generator/testcases/struct_literal_multiple_files/other.go diff --git a/v3/internal/generator/testcases/struct_literal_multiple_other/bound_types.json b/v3/internal/generator/testcases/struct_literal_multiple_other/bound_types.json new file mode 100644 index 00000000000..86a0a881209 --- /dev/null +++ b/v3/internal/generator/testcases/struct_literal_multiple_other/bound_types.json @@ -0,0 +1,4 @@ +[ + ".GreetService", + "/services.OtherService" +] diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/main.go b/v3/internal/generator/testcases/struct_literal_multiple_other/main.go similarity index 73% rename from v3/internal/parser/testdata/struct_literal_multiple_other/main.go rename to v3/internal/generator/testcases/struct_literal_multiple_other/main.go index 8c6953dbb66..c791f357d6e 100644 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/main.go +++ b/v3/internal/generator/testcases/struct_literal_multiple_other/main.go @@ -4,7 +4,7 @@ import ( _ "embed" "log" - "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services" + "github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services" "github.com/wailsapp/wails/v3/pkg/application" ) @@ -32,9 +32,9 @@ func (*GreetService) NewPerson(name string) *Person { func main() { app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, - &services.OtherService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), + application.NewService(&services.OtherService{}), }, }) diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/services/other.go b/v3/internal/generator/testcases/struct_literal_multiple_other/services/other.go similarity index 100% rename from v3/internal/parser/testdata/struct_literal_multiple_other/services/other.go rename to v3/internal/generator/testcases/struct_literal_multiple_other/services/other.go diff --git a/v3/internal/generator/testcases/struct_literal_non_pointer_single/bound_types.json b/v3/internal/generator/testcases/struct_literal_non_pointer_single/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/struct_literal_non_pointer_single/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/parser/testdata/struct_literal_non_pointer_single/main.go b/v3/internal/generator/testcases/struct_literal_non_pointer_single/main.go similarity index 97% rename from v3/internal/parser/testdata/struct_literal_non_pointer_single/main.go rename to v3/internal/generator/testcases/struct_literal_non_pointer_single/main.go index e417a7b6f87..0f73b897680 100644 --- a/v3/internal/parser/testdata/struct_literal_non_pointer_single/main.go +++ b/v3/internal/generator/testcases/struct_literal_non_pointer_single/main.go @@ -189,8 +189,8 @@ func (GreetService) ArrayInt(in [4]int) { func main() { app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), }, }) diff --git a/v3/internal/generator/testcases/struct_literal_single/bound_types.json b/v3/internal/generator/testcases/struct_literal_single/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/struct_literal_single/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/parser/testdata/struct_literal_single/main.go b/v3/internal/generator/testcases/struct_literal_single/main.go similarity index 97% rename from v3/internal/parser/testdata/struct_literal_single/main.go rename to v3/internal/generator/testcases/struct_literal_single/main.go index 2438a69cb25..2a8c75aa9c5 100644 --- a/v3/internal/parser/testdata/struct_literal_single/main.go +++ b/v3/internal/generator/testcases/struct_literal_single/main.go @@ -189,8 +189,8 @@ func (*GreetService) ArrayInt(in [4]int) { func main() { app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), }, }) diff --git a/v3/internal/generator/testcases/variable_single/bound_types.json b/v3/internal/generator/testcases/variable_single/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/variable_single/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/parser/testdata/variable_single/main.go b/v3/internal/generator/testcases/variable_single/main.go similarity index 82% rename from v3/internal/parser/testdata/variable_single/main.go rename to v3/internal/generator/testcases/variable_single/main.go index baffd783cff..893e4d1c019 100644 --- a/v3/internal/parser/testdata/variable_single/main.go +++ b/v3/internal/generator/testcases/variable_single/main.go @@ -2,8 +2,9 @@ package main import ( _ "embed" - "github.com/wailsapp/wails/v3/pkg/application" "log" + + "github.com/wailsapp/wails/v3/pkg/application" ) // GreetService is great @@ -18,9 +19,9 @@ func (*GreetService) Greet(name string) string { } func main() { - greetService := &GreetService{} + greetService := application.NewService(&GreetService{}) app := application.New(application.Options{ - Bind: []interface{}{ + Services: []application.Service{ greetService, }, }) diff --git a/v3/internal/generator/testcases/variable_single_from_function/bound_types.json b/v3/internal/generator/testcases/variable_single_from_function/bound_types.json new file mode 100644 index 00000000000..a8b95e32197 --- /dev/null +++ b/v3/internal/generator/testcases/variable_single_from_function/bound_types.json @@ -0,0 +1,3 @@ +[ + ".GreetService" +] diff --git a/v3/internal/parser/testdata/variable_single_from_function/main.go b/v3/internal/generator/testcases/variable_single_from_function/main.go similarity index 79% rename from v3/internal/parser/testdata/variable_single_from_function/main.go rename to v3/internal/generator/testcases/variable_single_from_function/main.go index 0d7121ca943..383117f8a3c 100644 --- a/v3/internal/parser/testdata/variable_single_from_function/main.go +++ b/v3/internal/generator/testcases/variable_single_from_function/main.go @@ -2,8 +2,9 @@ package main import ( _ "embed" - "github.com/wailsapp/wails/v3/pkg/application" "log" + + "github.com/wailsapp/wails/v3/pkg/application" ) // GreetService is great @@ -17,14 +18,14 @@ func (*GreetService) Greet(name string) string { return "Hello " + name } -func NewGreetService() *GreetService { - return &GreetService{} +func NewGreetService() application.Service { + return application.NewService(&GreetService{}) } func main() { greetService := NewGreetService() app := application.New(application.Options{ - Bind: []interface{}{ + Services: []application.Service{ greetService, }, }) diff --git a/v3/internal/generator/testcases/variable_single_from_other_function/bound_types.json b/v3/internal/generator/testcases/variable_single_from_other_function/bound_types.json new file mode 100644 index 00000000000..86a0a881209 --- /dev/null +++ b/v3/internal/generator/testcases/variable_single_from_other_function/bound_types.json @@ -0,0 +1,4 @@ +[ + ".GreetService", + "/services.OtherService" +] diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/main.go b/v3/internal/generator/testcases/variable_single_from_other_function/main.go similarity index 80% rename from v3/internal/parser/testdata/variable_single_from_other_function/main.go rename to v3/internal/generator/testcases/variable_single_from_other_function/main.go index b7b19a16341..1bc484fee09 100644 --- a/v3/internal/parser/testdata/variable_single_from_other_function/main.go +++ b/v3/internal/generator/testcases/variable_single_from_other_function/main.go @@ -2,9 +2,10 @@ package main import ( _ "embed" - "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services" "log" + "github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services" + "github.com/wailsapp/wails/v3/pkg/application" ) @@ -35,8 +36,8 @@ func (*GreetService) NewPerson(name string) *Person { func main() { otherService := services.NewOtherService() app := application.New(application.Options{ - Bind: []interface{}{ - &GreetService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), otherService, }, }) diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/services/other.go b/v3/internal/generator/testcases/variable_single_from_other_function/services/other.go similarity index 70% rename from v3/internal/parser/testdata/variable_single_from_other_function/services/other.go rename to v3/internal/generator/testcases/variable_single_from_other_function/services/other.go index 2daa9df17a2..4ac6e6efde1 100644 --- a/v3/internal/parser/testdata/variable_single_from_other_function/services/other.go +++ b/v3/internal/generator/testcases/variable_single_from_other_function/services/other.go @@ -1,5 +1,7 @@ package services +import "github.com/wailsapp/wails/v3/pkg/application" + // OtherService is a struct // that does things type OtherService struct { @@ -21,6 +23,6 @@ func (o *OtherService) Yay() *Address { } } -func NewOtherService() *OtherService { - return &OtherService{} +func NewOtherService() application.Service { + return application.NewService(&OtherService{}) } diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js new file mode 100644 index 00000000000..d61e96ee7e4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js @@ -0,0 +1,67 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Get someone + * @param {$models.Alias} aliasValue + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function Get(aliasValue) { + let $resultPromise = /** @type {any} */($Call.ByID(1928502664, aliasValue)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Get someone quite different + * @returns {Promise<$models.GenericPerson> & { cancel(): void }} + */ +export function GetButDifferent() { + let $resultPromise = /** @type {any} */($Call.ByID(2240931744)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Greet a lot of unusual things. + * @param {$models.EmptyAliasStruct} $0 + * @param {$models.EmptyStruct} $1 + * @returns {Promise<$models.AliasStruct> & { cancel(): void }} + */ +export function Greet($0, $1) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, $0, $1)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType5($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $models.GenericPerson.createFrom($Create.Any); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $Create.Array($Create.Any); +const $$createType4 = $Create.Struct({ + "NoMoreIdeas": $$createType3, +}); +const $$createType5 = $Create.Struct({ + "Foo": $$createType2, + "Other": $$createType4, +}); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js new file mode 100644 index 00000000000..edb390818cb --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js @@ -0,0 +1,144 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias + * @typedef {number} Alias + */ + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + * @typedef {Object} AliasStruct + * @property {number[]} Foo - A field with a comment. + * @property {string} [Bar] - Definitely not Foo. + * @property {string} [Baz] - Definitely not Foo. + * @property {OtherAliasStruct} Other - A nested alias struct. + */ + +/** + * An empty struct alias. + * @typedef { { + * } } EmptyAliasStruct + */ + +/** + * An empty struct. + */ +export class EmptyStruct { + /** + * Creates a new EmptyStruct instance. + * @param {Partial} [$$source = {}] - The source object to create the EmptyStruct. + */ + constructor($$source = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new EmptyStruct instance from a string or object. + * @param {any} [$$source = {}] + * @returns {EmptyStruct} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new EmptyStruct(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * A generic struct containing an alias + * @template T + */ +export class GenericPerson { + /** + * Creates a new GenericPerson instance. + * @param {Partial>} [$$source = {}] - The source object to create the GenericPerson. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {T | null} + */ + this["Name"] = null; + } + if (!("AliasedField" in $$source)) { + /** + * @member + * @type {Alias} + */ + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class GenericPerson. + * @template T + * @param {(any) => T} $$createParamT + * @returns {($$source?: any) => GenericPerson} + */ + static createFrom($$createParamT) { + const $$createField0_0 = $$createParamT; + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Name" in $$parsedSource) { + $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); + } + return new GenericPerson(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +/** + * Another struct alias. + * @typedef {Object} OtherAliasStruct + * @property {number[]} NoMoreIdeas + */ + +/** + * A non-generic struct containing an alias. + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * The Person's name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("AliasedField" in $$source)) { + /** + * A random alias field. + * @member + * @type {Alias} + */ + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js new file mode 100644 index 00000000000..f6c8397200f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as Service7 from "./service7.js"; +import * as Service9 from "./service9.js"; +export { + Service7, + Service9 +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js new file mode 100644 index 00000000000..5b3af714918 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function TestMethod() { + let $resultPromise = /** @type {any} */($Call.ByID(2241101727)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js new file mode 100644 index 00000000000..7a9188d23ba --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function TestMethod2() { + let $resultPromise = /** @type {any} */($Call.ByID(1556848345)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js new file mode 100644 index 00000000000..c62355d5d1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js @@ -0,0 +1,23 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {$models.Person} person + * @param {$models.Embedded1} emb + * @returns {Promise & { cancel(): void }} + */ +export function Greet(person, emb) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, person, emb)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js new file mode 100644 index 00000000000..ebfb64568fe --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js @@ -0,0 +1,44 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class embedded4 { + /** + * Creates a new embedded4 instance. + * @param {Partial} [$$source = {}] - The source object to create the embedded4. + */ + constructor($$source = {}) { + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + if (!("Friends" in $$source)) { + /** + * Friends should not be shadowed in Person as embedded4 is not embedded + * from encoding/json's point of view; + * however, it should be shadowed in Embedded1 + * @member + * @type {boolean} + */ + this["Friends"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new embedded4 instance from a string or object. + * @param {any} [$$source = {}] + * @returns {embedded4} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new embedded4(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js new file mode 100644 index 00000000000..1be36eb15c0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js @@ -0,0 +1,233 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as $internal from "./internal.js"; + +export class Embedded1 { + /** + * Creates a new Embedded1 instance. + * @param {Partial} [$$source = {}] - The source object to create the Embedded1. + */ + constructor($$source = {}) { + if (!("Friends" in $$source)) { + /** + * Friends should be shadowed in Person by a field of lesser depth + * @member + * @type {number} + */ + this["Friends"] = 0; + } + if (!("Vanish" in $$source)) { + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + * @member + * @type {number} + */ + this["Vanish"] = 0; + } + if (!("StillThere" in $$source)) { + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + * @member + * @type {string} + */ + this["StillThere"] = ""; + } + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Embedded1 instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Embedded1} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Embedded1(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * @typedef {string} Embedded3 + */ + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (/** @type {any} */(false)) { + /** + * Titles is optional in JSON + * @member + * @type {Title[] | undefined} + */ + this["Titles"] = []; + } + if (!("Names" in $$source)) { + /** + * Names has a + * multiline comment + * @member + * @type {string[]} + */ + this["Names"] = []; + } + if (!("Partner" in $$source)) { + /** + * Partner has a custom and complex JSON key + * @member + * @type {Person | null} + */ + this["Partner"] = null; + } + if (!("Friends" in $$source)) { + /** + * @member + * @type {(Person | null)[]} + */ + this["Friends"] = []; + } + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + if (!("StillThere" in $$source)) { + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + * @member + * @type {Embedded3 | null} + */ + this["StillThere"] = null; + } + if (!("-" in $$source)) { + /** + * StrangeNumber maps to "-" + * @member + * @type {number} + */ + this["-"] = 0; + } + if (!("Embedded3" in $$source)) { + /** + * Embedded3 should appear with key "Embedded3" + * @member + * @type {Embedded3} + */ + this["Embedded3"] = (/** @type {Embedded3} */("")); + } + if (!("StrangerNumber" in $$source)) { + /** + * StrangerNumber is serialized as a string + * @member + * @type {`${number}`} + */ + this["StrangerNumber"] = "0"; + } + if (/** @type {any} */(false)) { + /** + * StrangestString is optional and serialized as a JSON string + * @member + * @type {`"${string}"` | undefined} + */ + this["StrangestString"] = '""'; + } + if (/** @type {any} */(false)) { + /** + * StringStrangest is serialized as a JSON string and optional + * @member + * @type {`"${string}"` | undefined} + */ + this["StringStrangest"] = '""'; + } + if (/** @type {any} */(false)) { + /** + * embedded4 should be optional and appear with key "emb4" + * @member + * @type {$internal.embedded4 | undefined} + */ + this["emb4"] = (new $internal.embedded4()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType1; + const $$createField2_0 = $$createType3; + const $$createField3_0 = $$createType4; + const $$createField11_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Titles" in $$parsedSource) { + $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); + } + if ("Names" in $$parsedSource) { + $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); + } + if ("Partner" in $$parsedSource) { + $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); + } + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); + } + if ("emb4" in $$parsedSource) { + $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = Person.createFrom; +const $$createType3 = $Create.Nullable($$createType2); +const $$createType4 = $Create.Array($$createType3); +const $$createType5 = $internal.embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js new file mode 100644 index 00000000000..11554b9953e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js @@ -0,0 +1,39 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * It has a multiline doc comment + * The comment has even some * / traps!! + * @param {string} str + * @param {$models.Person[]} people + * @param {{"AnotherCount": number, "AnotherOne": $models.Person | null}} $2 + * @param {{ [_: `${number}`]: boolean | null }} assoc + * @param {(number | null)[]} $4 + * @param {string[]} other + * @returns {Promise<[$models.Person, any, number[]]> & { cancel(): void }} + */ +export function Greet(str, people, $2, assoc, $4, ...other) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, str, people, $2, assoc, $4, other)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[2] = $$createType1($result[2]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Array($Create.Any); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js new file mode 100644 index 00000000000..68f0749aa7a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js @@ -0,0 +1,36 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js new file mode 100644 index 00000000000..334ab83b5e0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js @@ -0,0 +1,64 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Make a cycle. + * @returns {Promise<[$models.Cyclic, $models.GenericCyclic<$models.GenericCyclic>]> & { cancel(): void }} + */ +export function MakeCycles() { + let $resultPromise = /** @type {any} */($Call.ByID(440020721)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType9($result[1]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +var $$createType0 = /** @type {(...args: any[]) => any} */(function $$initCreateType0(...args) { + if ($$createType0 === $$initCreateType0) { + $$createType0 = $$createType3; + } + return $$createType0(...args); +}); +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = $Create.Map($Create.Any, $$createType1); +const $$createType3 = $Create.Array($$createType2); +var $$createType4 = /** @type {(...args: any[]) => any} */(function $$initCreateType4(...args) { + if ($$createType4 === $$initCreateType4) { + $$createType4 = $$createType8; + } + return $$createType4(...args); +}); +const $$createType5 = $Create.Nullable($$createType4); +const $$createType6 = $Create.Array($Create.Any); +const $$createType7 = $Create.Struct({ + "X": $$createType5, + "Y": $$createType6, +}); +const $$createType8 = $Create.Array($$createType7); +var $$createType9 = /** @type {(...args: any[]) => any} */(function $$initCreateType9(...args) { + if ($$createType9 === $$initCreateType9) { + $$createType9 = $$createType13; + } + return $$createType9(...args); +}); +const $$createType10 = $Create.Nullable($$createType9); +const $$createType11 = $Create.Array($$createType4); +const $$createType12 = $Create.Struct({ + "X": $$createType10, + "Y": $$createType11, +}); +const $$createType13 = $Create.Array($$createType12); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js new file mode 100644 index 00000000000..3f2a23bc69b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Cyclic | null} Alias + */ + +/** + * @typedef {{ [_: string]: Alias }[]} Cyclic + */ + +/** + * @template T + * @typedef {{"X": GenericCyclic | null, "Y": (T | null)[]}[]} GenericCyclic + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js new file mode 100644 index 00000000000..250f4098d87 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js @@ -0,0 +1,56 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Comment 1. + * @returns {Promise & { cancel(): void }} + */ +export function Method1() { + let $resultPromise = /** @type {any} */($Call.ByID(841558284)); + return $resultPromise; +} + +/** + * Comment 2. + * @returns {Promise & { cancel(): void }} + */ +export function Method2() { + let $resultPromise = /** @type {any} */($Call.ByID(891891141)); + return $resultPromise; +} + +/** + * Comment 3a. + * Comment 3b. + * @returns {Promise & { cancel(): void }} + */ +export function Method3() { + let $resultPromise = /** @type {any} */($Call.ByID(875113522)); + return $resultPromise; +} + +/** + * Comment 4. + * @returns {Promise & { cancel(): void }} + */ +export function Method4() { + let $resultPromise = /** @type {any} */($Call.ByID(791225427)); + return $resultPromise; +} + +/** + * Comment 5. + * @returns {Promise & { cancel(): void }} + */ +export function Method5() { + let $resultPromise = /** @type {any} */($Call.ByID(774447808)); + return $resultPromise; +} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/models.interfaces.ts b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js similarity index 58% rename from v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/models.interfaces.ts rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js index 9470a494510..fdf1ff435a9 100644 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/models.interfaces.ts +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js @@ -2,9 +2,7 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT - -export interface Address { - street: string; - state: string; - country: string; -} +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js new file mode 100644 index 00000000000..09c29dad436 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js @@ -0,0 +1,41 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @param {$models.Title} title + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name, title) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name, title)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js new file mode 100644 index 00000000000..055407e4bdc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js @@ -0,0 +1,64 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Title" in $$source)) { + /** + * @member + * @type {Title} + */ + this["Title"] = (/** @type {Title} */("")); + } + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js new file mode 100644 index 00000000000..2b4acb7a722 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js @@ -0,0 +1,23 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @param {services$0.Title} title + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name, title) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name, title)); + return $resultPromise; +} diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/models.ts b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js similarity index 58% rename from v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/models.ts rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js index aa3f01c822b..fdf1ff435a9 100644 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/models.ts +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js @@ -2,8 +2,7 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -export interface Address { - Street: string; - State: string; - Country: string; -} \ No newline at end of file +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js new file mode 100644 index 00000000000..580fb67af27 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js @@ -0,0 +1,5 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js similarity index 50% rename from v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/services/models.js rename to v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js index 2ea24de75a8..1a275a050d1 100644 --- a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/services/models.js +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js @@ -2,12 +2,24 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @readonly + * @enum {string} + */ export const Title = { - // Mister is a title + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ Mister: "Mr", Miss: "Miss", Ms: "Ms", Mrs: "Mrs", Dr: "Dr", }; - diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js new file mode 100644 index 00000000000..20e3a977f28 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js @@ -0,0 +1,40 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js new file mode 100644 index 00000000000..0e8ebeb4104 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js @@ -0,0 +1,53 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js new file mode 100644 index 00000000000..102490a3d35 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js @@ -0,0 +1,47 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js new file mode 100644 index 00000000000..04c68c386bd --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByID(2007737399)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js new file mode 100644 index 00000000000..20e3a977f28 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js @@ -0,0 +1,40 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js new file mode 100644 index 00000000000..e898aa0640c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js @@ -0,0 +1,50 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./services/other/models.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {other$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = other$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js new file mode 100644 index 00000000000..102490a3d35 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js @@ -0,0 +1,47 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js new file mode 100644 index 00000000000..ccc945f1209 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByID(2447353446)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js new file mode 100644 index 00000000000..9bc43bc880c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js new file mode 100644 index 00000000000..d354f042390 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js new file mode 100644 index 00000000000..39724a0f4ce --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function GreetWithContext(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1310150960, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js new file mode 100644 index 00000000000..79394cd22b5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as SomeMethods from "./somemethods.js"; +export { + SomeMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js new file mode 100644 index 00000000000..7d18f43cc23 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js @@ -0,0 +1,42 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class personImpl { + /** + * Creates a new personImpl instance. + * @param {Partial} [$$source = {}] - The source object to create the personImpl. + */ + constructor($$source = {}) { + if (!("Nickname" in $$source)) { + /** + * Nickname conceals a person's identity. + * @member + * @type {string} + */ + this["Nickname"] = ""; + } + if (!("Name" in $$source)) { + /** + * They have a name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new personImpl instance from a string or object. + * @param {any} [$$source = {}] + * @returns {personImpl} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new personImpl(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js new file mode 100644 index 00000000000..dbe9775e66c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js @@ -0,0 +1,116 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./other/models.js"; + +import * as $internal from "./internal.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + * @template How + */ +export class HowDifferent { + /** + * Creates a new HowDifferent instance. + * @param {Partial>} [$$source = {}] - The source object to create the HowDifferent. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name as well. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + /** + * But they may have many differences. + * @member + * @type {{ [_: string]: How | null }[]} + */ + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class HowDifferent. + * @template How + * @param {(any) => How} $$createParamHow + * @returns {($$source?: any) => HowDifferent} + */ + static createFrom($$createParamHow) { + const $$createField1_0 = $$createType1($$createParamHow); + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new HowDifferent(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +/** + * Impersonator gets their fields from other people. + */ +export const Impersonator = other$0.OtherPerson; + +/** + * Impersonator gets their fields from other people. + * @typedef {other$0.OtherPerson} Impersonator + */ + +/** + * Person is not a number. + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export const PrivatePerson = $internal.personImpl; + +/** + * PrivatePerson gets their fields from hidden sources. + * @typedef {$internal.personImpl} PrivatePerson + */ + +// Private type creation functions +const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); +const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js new file mode 100644 index 00000000000..9ac8ae8c2d3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherMethods from "./othermethods.js"; +export { + OtherMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js new file mode 100644 index 00000000000..dbc8898230d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js @@ -0,0 +1,58 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + * @template T + */ +export class OtherPerson { + /** + * Creates a new OtherPerson instance. + * @param {Partial>} [$$source = {}] - The source object to create the OtherPerson. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name as well. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + /** + * But they may have many differences. + * @member + * @type {(T | null)[]} + */ + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class OtherPerson. + * @template T + * @param {(any) => T} $$createParamT + * @returns {($$source?: any) => OtherPerson} + */ + static createFrom($$createParamT) { + const $$createField1_0 = $$createType0($$createParamT); + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new OtherPerson(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +// Private type creation functions +const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js new file mode 100644 index 00000000000..1ac368ea5af --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherMethods has another method, but through a private embedded type. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByID(3606939272)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js new file mode 100644 index 00000000000..2c852896aa4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js @@ -0,0 +1,44 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * SomeMethods exports some methods. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * LikeThisOne is an example method that does nothing. + * @returns {Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} + */ +export function LikeThisOne() { + let $resultPromise = /** @type {any} */($Call.ByID(2124352079)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + $result[2] = $$createType2($result[2]); + $result[3] = $$createType3($result[3]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByID(4281222271)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $models.Impersonator.createFrom; +const $$createType2 = $models.HowDifferent.createFrom($Create.Any); +const $$createType3 = $models.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js new file mode 100644 index 00000000000..a80c7cb62a0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedOther is even trickier. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByID(3566862802)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js new file mode 100644 index 00000000000..6172edd705d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js @@ -0,0 +1,44 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedService is tricky. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as nobindingshere$0 from "../no_bindings_here/models.js"; + +/** + * LikeThisOne is an example method that does nothing. + * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} + */ +export function LikeThisOne() { + let $resultPromise = /** @type {any} */($Call.ByID(2590614085)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + $result[2] = $$createType2($result[2]); + $result[3] = $$createType3($result[3]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByID(773650321)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = nobindingshere$0.Person.createFrom; +const $$createType1 = nobindingshere$0.Impersonator.createFrom; +const $$createType2 = nobindingshere$0.HowDifferent.createFrom($Create.Any); +const $$createType3 = nobindingshere$0.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js new file mode 100644 index 00000000000..afce2e64bb3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} $0 + * @returns {Promise & { cancel(): void }} + */ +export function Greet($0) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, $0)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js new file mode 100644 index 00000000000..734fb02e7b1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as EmbedOther from "./embedother.js"; +import * as EmbedService from "./embedservice.js"; +import * as GreetService from "./greetservice.js"; +export { + EmbedOther, + EmbedService, + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js new file mode 100644 index 00000000000..9bc43bc880c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js new file mode 100644 index 00000000000..62ddbc1667b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js new file mode 100644 index 00000000000..ce3cfc168ab --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function Hello() { + let $resultPromise = /** @type {any} */($Call.ByID(4249972365)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js new file mode 100644 index 00000000000..9bc43bc880c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js new file mode 100644 index 00000000000..62ddbc1667b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js new file mode 100644 index 00000000000..ce3cfc168ab --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function Hello() { + let $resultPromise = /** @type {any} */($Call.ByID(4249972365)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js new file mode 100644 index 00000000000..20e3a977f28 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js @@ -0,0 +1,40 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js new file mode 100644 index 00000000000..18e4b6054d3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js @@ -0,0 +1,50 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js new file mode 100644 index 00000000000..102490a3d35 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js @@ -0,0 +1,47 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js new file mode 100644 index 00000000000..9c30fa925b5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByID(3568225479)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js new file mode 100644 index 00000000000..5118309cb12 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js @@ -0,0 +1,430 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * @param {number[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function ArrayInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3862002418, $in)); + return $resultPromise; +} + +/** + * @param {boolean} $in + * @returns {Promise & { cancel(): void }} + */ +export function BoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2424639793, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3132595881, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2182412247, $in)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3306292566, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1754277916, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1909469092, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(4251088558, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1343888303, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2205561041, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(572240879, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2189402897, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntInIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(642881729, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1066151743, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2718999663, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2386486356, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: string]: number }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntPointerInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(550413585, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntSliceInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2900172572, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] }} $in + * @returns {Promise<{ [_: `${number}`]: number[] }> & { cancel(): void }} + */ +export function MapIntSliceIntInMapIntSliceIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(881980169, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function NoInputsStringOut() { + let $resultPromise = /** @type {any} */($Call.ByID(1075577233)); + return $resultPromise; +} + +/** + * @param {boolean | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerBoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3589606958, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(224675106, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2124953624, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerMapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3516977899, $in)); + return $resultPromise; +} + +/** + * @param {string | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerStringInStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(229603958, $in)); + return $resultPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3678582682, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByID(319259595, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringArrayOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(383995060, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1091960237, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person} $in + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function StructInputStructOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3835643147, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType3($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StructPointerInputErrorOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2447692557, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function StructPointerInputStructPointerOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2943477349, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType4($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3401034892, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1236957573, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1160383782, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1739300671, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(793803239, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1403757716, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2988345717, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(518250834, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntInUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2836661285, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1367187362, $in)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Map($Create.Any, $$createType0); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $models.Person.createFrom; +const $$createType4 = $Create.Nullable($$createType3); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js new file mode 100644 index 00000000000..369ddb2546d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js @@ -0,0 +1,55 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + /** + * @member + * @type {Person | null} + */ + this["Parent"] = null; + } + if (!("Details" in $$source)) { + /** + * @member + * @type {{"Age": number, "Address": {"Street": string}}} + */ + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js new file mode 100644 index 00000000000..5118309cb12 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js @@ -0,0 +1,430 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * @param {number[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function ArrayInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3862002418, $in)); + return $resultPromise; +} + +/** + * @param {boolean} $in + * @returns {Promise & { cancel(): void }} + */ +export function BoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2424639793, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3132595881, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2182412247, $in)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3306292566, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1754277916, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1909469092, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(4251088558, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1343888303, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2205561041, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(572240879, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2189402897, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntInIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(642881729, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1066151743, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2718999663, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2386486356, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: string]: number }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntPointerInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(550413585, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntSliceInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2900172572, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] }} $in + * @returns {Promise<{ [_: `${number}`]: number[] }> & { cancel(): void }} + */ +export function MapIntSliceIntInMapIntSliceIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(881980169, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function NoInputsStringOut() { + let $resultPromise = /** @type {any} */($Call.ByID(1075577233)); + return $resultPromise; +} + +/** + * @param {boolean | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerBoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3589606958, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(224675106, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2124953624, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerMapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3516977899, $in)); + return $resultPromise; +} + +/** + * @param {string | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerStringInStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(229603958, $in)); + return $resultPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3678582682, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByID(319259595, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringArrayOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(383995060, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1091960237, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person} $in + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function StructInputStructOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3835643147, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType3($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StructPointerInputErrorOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2447692557, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function StructPointerInputStructPointerOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2943477349, $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType4($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3401034892, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1236957573, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1160383782, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1739300671, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(793803239, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1403757716, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2988345717, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(518250834, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntInUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2836661285, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1367187362, $in)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Map($Create.Any, $$createType0); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $models.Person.createFrom; +const $$createType4 = $Create.Nullable($$createType3); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js new file mode 100644 index 00000000000..369ddb2546d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js @@ -0,0 +1,55 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + /** + * @member + * @type {Person | null} + */ + this["Parent"] = null; + } + if (!("Details" in $$source)) { + /** + * @member + * @type {{"Age": number, "Address": {"Street": string}}} + */ + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js new file mode 100644 index 00000000000..d354f042390 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js new file mode 100644 index 00000000000..d354f042390 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js new file mode 100644 index 00000000000..20e3a977f28 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js @@ -0,0 +1,40 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js new file mode 100644 index 00000000000..ce09b1d9ffd --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js @@ -0,0 +1,54 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js new file mode 100644 index 00000000000..102490a3d35 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js @@ -0,0 +1,47 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js new file mode 100644 index 00000000000..733d2b31e50 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByID(1491748400)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js new file mode 100644 index 00000000000..e4e24aaf1b4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js @@ -0,0 +1,67 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Get someone + * @param {$models.Alias} aliasValue + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function Get(aliasValue) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Get", aliasValue)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Get someone quite different + * @returns {Promise<$models.GenericPerson> & { cancel(): void }} + */ +export function GetButDifferent() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.GetButDifferent")); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Greet a lot of unusual things. + * @param {$models.EmptyAliasStruct} $0 + * @param {$models.EmptyStruct} $1 + * @returns {Promise<$models.AliasStruct> & { cancel(): void }} + */ +export function Greet($0, $1) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", $0, $1)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType5($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $models.GenericPerson.createFrom($Create.Any); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $Create.Array($Create.Any); +const $$createType4 = $Create.Struct({ + "NoMoreIdeas": $$createType3, +}); +const $$createType5 = $Create.Struct({ + "Foo": $$createType2, + "Other": $$createType4, +}); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js new file mode 100644 index 00000000000..edb390818cb --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js @@ -0,0 +1,144 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias + * @typedef {number} Alias + */ + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + * @typedef {Object} AliasStruct + * @property {number[]} Foo - A field with a comment. + * @property {string} [Bar] - Definitely not Foo. + * @property {string} [Baz] - Definitely not Foo. + * @property {OtherAliasStruct} Other - A nested alias struct. + */ + +/** + * An empty struct alias. + * @typedef { { + * } } EmptyAliasStruct + */ + +/** + * An empty struct. + */ +export class EmptyStruct { + /** + * Creates a new EmptyStruct instance. + * @param {Partial} [$$source = {}] - The source object to create the EmptyStruct. + */ + constructor($$source = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new EmptyStruct instance from a string or object. + * @param {any} [$$source = {}] + * @returns {EmptyStruct} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new EmptyStruct(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * A generic struct containing an alias + * @template T + */ +export class GenericPerson { + /** + * Creates a new GenericPerson instance. + * @param {Partial>} [$$source = {}] - The source object to create the GenericPerson. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {T | null} + */ + this["Name"] = null; + } + if (!("AliasedField" in $$source)) { + /** + * @member + * @type {Alias} + */ + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class GenericPerson. + * @template T + * @param {(any) => T} $$createParamT + * @returns {($$source?: any) => GenericPerson} + */ + static createFrom($$createParamT) { + const $$createField0_0 = $$createParamT; + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Name" in $$parsedSource) { + $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); + } + return new GenericPerson(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +/** + * Another struct alias. + * @typedef {Object} OtherAliasStruct + * @property {number[]} NoMoreIdeas + */ + +/** + * A non-generic struct containing an alias. + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * The Person's name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("AliasedField" in $$source)) { + /** + * A random alias field. + * @member + * @type {Alias} + */ + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js new file mode 100644 index 00000000000..f6c8397200f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as Service7 from "./service7.js"; +import * as Service9 from "./service9.js"; +export { + Service7, + Service9 +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js new file mode 100644 index 00000000000..9c1c7dc05c9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function TestMethod() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config.Service7.TestMethod")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js new file mode 100644 index 00000000000..5785a595430 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function TestMethod2() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config.Service9.TestMethod2")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js new file mode 100644 index 00000000000..30ff2137e62 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js @@ -0,0 +1,23 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {$models.Person} person + * @param {$models.Embedded1} emb + * @returns {Promise & { cancel(): void }} + */ +export function Greet(person, emb) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", person, emb)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js new file mode 100644 index 00000000000..ebfb64568fe --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js @@ -0,0 +1,44 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class embedded4 { + /** + * Creates a new embedded4 instance. + * @param {Partial} [$$source = {}] - The source object to create the embedded4. + */ + constructor($$source = {}) { + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + if (!("Friends" in $$source)) { + /** + * Friends should not be shadowed in Person as embedded4 is not embedded + * from encoding/json's point of view; + * however, it should be shadowed in Embedded1 + * @member + * @type {boolean} + */ + this["Friends"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new embedded4 instance from a string or object. + * @param {any} [$$source = {}] + * @returns {embedded4} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new embedded4(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js new file mode 100644 index 00000000000..1be36eb15c0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js @@ -0,0 +1,233 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as $internal from "./internal.js"; + +export class Embedded1 { + /** + * Creates a new Embedded1 instance. + * @param {Partial} [$$source = {}] - The source object to create the Embedded1. + */ + constructor($$source = {}) { + if (!("Friends" in $$source)) { + /** + * Friends should be shadowed in Person by a field of lesser depth + * @member + * @type {number} + */ + this["Friends"] = 0; + } + if (!("Vanish" in $$source)) { + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + * @member + * @type {number} + */ + this["Vanish"] = 0; + } + if (!("StillThere" in $$source)) { + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + * @member + * @type {string} + */ + this["StillThere"] = ""; + } + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Embedded1 instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Embedded1} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Embedded1(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * @typedef {string} Embedded3 + */ + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (/** @type {any} */(false)) { + /** + * Titles is optional in JSON + * @member + * @type {Title[] | undefined} + */ + this["Titles"] = []; + } + if (!("Names" in $$source)) { + /** + * Names has a + * multiline comment + * @member + * @type {string[]} + */ + this["Names"] = []; + } + if (!("Partner" in $$source)) { + /** + * Partner has a custom and complex JSON key + * @member + * @type {Person | null} + */ + this["Partner"] = null; + } + if (!("Friends" in $$source)) { + /** + * @member + * @type {(Person | null)[]} + */ + this["Friends"] = []; + } + if (!("NamingThingsIsHard" in $$source)) { + /** + * NamingThingsIsHard is a law of programming + * @member + * @type {`${boolean}`} + */ + this["NamingThingsIsHard"] = "false"; + } + if (!("StillThere" in $$source)) { + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + * @member + * @type {Embedded3 | null} + */ + this["StillThere"] = null; + } + if (!("-" in $$source)) { + /** + * StrangeNumber maps to "-" + * @member + * @type {number} + */ + this["-"] = 0; + } + if (!("Embedded3" in $$source)) { + /** + * Embedded3 should appear with key "Embedded3" + * @member + * @type {Embedded3} + */ + this["Embedded3"] = (/** @type {Embedded3} */("")); + } + if (!("StrangerNumber" in $$source)) { + /** + * StrangerNumber is serialized as a string + * @member + * @type {`${number}`} + */ + this["StrangerNumber"] = "0"; + } + if (/** @type {any} */(false)) { + /** + * StrangestString is optional and serialized as a JSON string + * @member + * @type {`"${string}"` | undefined} + */ + this["StrangestString"] = '""'; + } + if (/** @type {any} */(false)) { + /** + * StringStrangest is serialized as a JSON string and optional + * @member + * @type {`"${string}"` | undefined} + */ + this["StringStrangest"] = '""'; + } + if (/** @type {any} */(false)) { + /** + * embedded4 should be optional and appear with key "emb4" + * @member + * @type {$internal.embedded4 | undefined} + */ + this["emb4"] = (new $internal.embedded4()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType1; + const $$createField2_0 = $$createType3; + const $$createField3_0 = $$createType4; + const $$createField11_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Titles" in $$parsedSource) { + $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); + } + if ("Names" in $$parsedSource) { + $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); + } + if ("Partner" in $$parsedSource) { + $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); + } + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); + } + if ("emb4" in $$parsedSource) { + $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = Person.createFrom; +const $$createType3 = $Create.Nullable($$createType2); +const $$createType4 = $Create.Array($$createType3); +const $$createType5 = $internal.embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js new file mode 100644 index 00000000000..19d87a8e666 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js @@ -0,0 +1,39 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * It has a multiline doc comment + * The comment has even some * / traps!! + * @param {string} str + * @param {$models.Person[]} people + * @param {{"AnotherCount": number, "AnotherOne": $models.Person | null}} $2 + * @param {{ [_: `${number}`]: boolean | null }} assoc + * @param {(number | null)[]} $4 + * @param {string[]} other + * @returns {Promise<[$models.Person, any, number[]]> & { cancel(): void }} + */ +export function Greet(str, people, $2, assoc, $4, ...other) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", str, people, $2, assoc, $4, other)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[2] = $$createType1($result[2]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Array($Create.Any); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js new file mode 100644 index 00000000000..68f0749aa7a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js @@ -0,0 +1,36 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js new file mode 100644 index 00000000000..6f3287af075 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js @@ -0,0 +1,64 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Make a cycle. + * @returns {Promise<[$models.Cyclic, $models.GenericCyclic<$models.GenericCyclic>]> & { cancel(): void }} + */ +export function MakeCycles() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MakeCycles")); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType9($result[1]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +var $$createType0 = /** @type {(...args: any[]) => any} */(function $$initCreateType0(...args) { + if ($$createType0 === $$initCreateType0) { + $$createType0 = $$createType3; + } + return $$createType0(...args); +}); +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = $Create.Map($Create.Any, $$createType1); +const $$createType3 = $Create.Array($$createType2); +var $$createType4 = /** @type {(...args: any[]) => any} */(function $$initCreateType4(...args) { + if ($$createType4 === $$initCreateType4) { + $$createType4 = $$createType8; + } + return $$createType4(...args); +}); +const $$createType5 = $Create.Nullable($$createType4); +const $$createType6 = $Create.Array($Create.Any); +const $$createType7 = $Create.Struct({ + "X": $$createType5, + "Y": $$createType6, +}); +const $$createType8 = $Create.Array($$createType7); +var $$createType9 = /** @type {(...args: any[]) => any} */(function $$initCreateType9(...args) { + if ($$createType9 === $$initCreateType9) { + $$createType9 = $$createType13; + } + return $$createType9(...args); +}); +const $$createType10 = $Create.Nullable($$createType9); +const $$createType11 = $Create.Array($$createType4); +const $$createType12 = $Create.Struct({ + "X": $$createType10, + "Y": $$createType11, +}); +const $$createType13 = $Create.Array($$createType12); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js new file mode 100644 index 00000000000..3f2a23bc69b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Cyclic | null} Alias + */ + +/** + * @typedef {{ [_: string]: Alias }[]} Cyclic + */ + +/** + * @template T + * @typedef {{"X": GenericCyclic | null, "Y": (T | null)[]}[]} GenericCyclic + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js new file mode 100644 index 00000000000..3f27bff5a76 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js @@ -0,0 +1,56 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Comment 1. + * @returns {Promise & { cancel(): void }} + */ +export function Method1() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method1")); + return $resultPromise; +} + +/** + * Comment 2. + * @returns {Promise & { cancel(): void }} + */ +export function Method2() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method2")); + return $resultPromise; +} + +/** + * Comment 3a. + * Comment 3b. + * @returns {Promise & { cancel(): void }} + */ +export function Method3() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method3")); + return $resultPromise; +} + +/** + * Comment 4. + * @returns {Promise & { cancel(): void }} + */ +export function Method4() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method4")); + return $resultPromise; +} + +/** + * Comment 5. + * @returns {Promise & { cancel(): void }} + */ +export function Method5() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method5")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js new file mode 100644 index 00000000000..23de85a210f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js @@ -0,0 +1,41 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @param {$models.Title} title + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name, title) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name, title)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js new file mode 100644 index 00000000000..055407e4bdc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js @@ -0,0 +1,64 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Title" in $$source)) { + /** + * @member + * @type {Title} + */ + this["Title"] = (/** @type {Title} */("")); + } + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js new file mode 100644 index 00000000000..a5aca00897f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js @@ -0,0 +1,23 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @param {services$0.Title} title + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name, title) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name, title)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js new file mode 100644 index 00000000000..580fb67af27 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js @@ -0,0 +1,5 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js new file mode 100644 index 00000000000..1a275a050d1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js @@ -0,0 +1,25 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js new file mode 100644 index 00000000000..0b280f75748 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js @@ -0,0 +1,40 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js new file mode 100644 index 00000000000..0e8ebeb4104 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js @@ -0,0 +1,53 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js new file mode 100644 index 00000000000..102490a3d35 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js @@ -0,0 +1,47 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js new file mode 100644 index 00000000000..1e29fd7a3a4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services.OtherService.Yay")); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js new file mode 100644 index 00000000000..0b280f75748 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js @@ -0,0 +1,40 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js new file mode 100644 index 00000000000..e898aa0640c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js @@ -0,0 +1,50 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./services/other/models.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {other$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = other$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js new file mode 100644 index 00000000000..102490a3d35 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js @@ -0,0 +1,47 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js new file mode 100644 index 00000000000..02030ea869c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other.OtherService.Yay")); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js new file mode 100644 index 00000000000..8defb387a72 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js new file mode 100644 index 00000000000..00a428bf422 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js new file mode 100644 index 00000000000..d4189a66fc1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function GreetWithContext(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.GreetWithContext", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js new file mode 100644 index 00000000000..79394cd22b5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as SomeMethods from "./somemethods.js"; +export { + SomeMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js new file mode 100644 index 00000000000..7d18f43cc23 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js @@ -0,0 +1,42 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class personImpl { + /** + * Creates a new personImpl instance. + * @param {Partial} [$$source = {}] - The source object to create the personImpl. + */ + constructor($$source = {}) { + if (!("Nickname" in $$source)) { + /** + * Nickname conceals a person's identity. + * @member + * @type {string} + */ + this["Nickname"] = ""; + } + if (!("Name" in $$source)) { + /** + * They have a name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new personImpl instance from a string or object. + * @param {any} [$$source = {}] + * @returns {personImpl} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new personImpl(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js new file mode 100644 index 00000000000..dbe9775e66c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js @@ -0,0 +1,116 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./other/models.js"; + +import * as $internal from "./internal.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + * @template How + */ +export class HowDifferent { + /** + * Creates a new HowDifferent instance. + * @param {Partial>} [$$source = {}] - The source object to create the HowDifferent. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name as well. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + /** + * But they may have many differences. + * @member + * @type {{ [_: string]: How | null }[]} + */ + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class HowDifferent. + * @template How + * @param {(any) => How} $$createParamHow + * @returns {($$source?: any) => HowDifferent} + */ + static createFrom($$createParamHow) { + const $$createField1_0 = $$createType1($$createParamHow); + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new HowDifferent(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +/** + * Impersonator gets their fields from other people. + */ +export const Impersonator = other$0.OtherPerson; + +/** + * Impersonator gets their fields from other people. + * @typedef {other$0.OtherPerson} Impersonator + */ + +/** + * Person is not a number. + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name. + * @member + * @type {string} + */ + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export const PrivatePerson = $internal.personImpl; + +/** + * PrivatePerson gets their fields from hidden sources. + * @typedef {$internal.personImpl} PrivatePerson + */ + +// Private type creation functions +const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); +const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js new file mode 100644 index 00000000000..9ac8ae8c2d3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherMethods from "./othermethods.js"; +export { + OtherMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js new file mode 100644 index 00000000000..dbc8898230d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js @@ -0,0 +1,58 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + * @template T + */ +export class OtherPerson { + /** + * Creates a new OtherPerson instance. + * @param {Partial>} [$$source = {}] - The source object to create the OtherPerson. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * They have a name as well. + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + /** + * But they may have many differences. + * @member + * @type {(T | null)[]} + */ + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class OtherPerson. + * @template T + * @param {(any) => T} $$createParamT + * @returns {($$source?: any) => OtherPerson} + */ + static createFrom($$createParamT) { + const $$createField1_0 = $$createType0($$createParamT); + return ($$source = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new OtherPerson(/** @type {Partial>} */($$parsedSource)); + }; + } +} + +// Private type creation functions +const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js new file mode 100644 index 00000000000..5795949a4d6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherMethods has another method, but through a private embedded type. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other.OtherMethods.LikeThisOtherOne")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js new file mode 100644 index 00000000000..056b6e2e98b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js @@ -0,0 +1,44 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * SomeMethods exports some methods. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * LikeThisOne is an example method that does nothing. + * @returns {Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} + */ +export function LikeThisOne() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOne")); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + $result[2] = $$createType2($result[2]); + $result[3] = $$createType3($result[3]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOtherOne")); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $models.Impersonator.createFrom; +const $$createType2 = $models.HowDifferent.createFrom($Create.Any); +const $$createType3 = $models.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js new file mode 100644 index 00000000000..3c0e397d5e8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedOther is even trickier. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByName("main.EmbedOther.LikeThisOtherOne")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js new file mode 100644 index 00000000000..d2237524b78 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js @@ -0,0 +1,44 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedService is tricky. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as nobindingshere$0 from "../no_bindings_here/models.js"; + +/** + * LikeThisOne is an example method that does nothing. + * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} + */ +export function LikeThisOne() { + let $resultPromise = /** @type {any} */($Call.ByName("main.EmbedService.LikeThisOne")); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + $result[2] = $$createType2($result[2]); + $result[3] = $$createType3($result[3]); + return $result; + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByName("main.EmbedService.LikeThisOtherOne")); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = nobindingshere$0.Person.createFrom; +const $$createType1 = nobindingshere$0.Impersonator.createFrom; +const $$createType2 = nobindingshere$0.HowDifferent.createFrom($Create.Any); +const $$createType3 = nobindingshere$0.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js new file mode 100644 index 00000000000..c8762377f63 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} $0 + * @returns {Promise & { cancel(): void }} + */ +export function Greet($0) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", $0)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js new file mode 100644 index 00000000000..734fb02e7b1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as EmbedOther from "./embedother.js"; +import * as EmbedService from "./embedservice.js"; +import * as GreetService from "./greetservice.js"; +export { + EmbedOther, + EmbedService, + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js new file mode 100644 index 00000000000..8defb387a72 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js new file mode 100644 index 00000000000..62ddbc1667b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js new file mode 100644 index 00000000000..14046c16a4d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function Hello() { + let $resultPromise = /** @type {any} */($Call.ByName("main.OtherService.Hello")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js new file mode 100644 index 00000000000..8defb387a72 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js new file mode 100644 index 00000000000..62ddbc1667b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js new file mode 100644 index 00000000000..14046c16a4d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function Hello() { + let $resultPromise = /** @type {any} */($Call.ByName("main.OtherService.Hello")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js new file mode 100644 index 00000000000..0b280f75748 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js @@ -0,0 +1,40 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js new file mode 100644 index 00000000000..18e4b6054d3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js @@ -0,0 +1,50 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js new file mode 100644 index 00000000000..102490a3d35 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js @@ -0,0 +1,47 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js new file mode 100644 index 00000000000..7b6d38f25f1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services.OtherService.Yay")); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js new file mode 100644 index 00000000000..643d1e589b4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js @@ -0,0 +1,430 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * @param {number[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function ArrayInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.ArrayInt", $in)); + return $resultPromise; +} + +/** + * @param {boolean} $in + * @returns {Promise & { cancel(): void }} + */ +export function BoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.BoolInBoolOut", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Float32InFloat32Out", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Float64InFloat64Out", $in)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int16InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int16PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int32InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int32PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int64InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int64PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int8InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int8PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntInIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntInIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntPointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntPointerInputNamedOutputs", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: string]: number }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntPointerInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntPointerInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntSliceInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntSliceInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] }} $in + * @returns {Promise<{ [_: `${number}`]: number[] }> & { cancel(): void }} + */ +export function MapIntSliceIntInMapIntSliceIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function NoInputsStringOut() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NoInputsStringOut")); + return $resultPromise; +} + +/** + * @param {boolean | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerBoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerBoolInBoolOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerFloat32InFloat32Out", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerFloat64InFloat64Out", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerMapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerMapIntInt", $in)); + return $resultPromise; +} + +/** + * @param {string | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerStringInStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerStringInStringOut", $in)); + return $resultPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputNamedOutput", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputNamedOutputs", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringArrayOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputStringArrayOut", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputStringOut", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person} $in + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function StructInputStructOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructInputStructOutput", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType3($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StructPointerInputErrorOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructPointerInputErrorOutput", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function StructPointerInputStructPointerOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType4($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt16InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt16PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt32InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt32PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt64InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt64PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt8InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt8PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntInUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UIntInUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UIntPointerInAndOutput", $in)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Map($Create.Any, $$createType0); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $models.Person.createFrom; +const $$createType4 = $Create.Nullable($$createType3); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js new file mode 100644 index 00000000000..369ddb2546d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js @@ -0,0 +1,55 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + /** + * @member + * @type {Person | null} + */ + this["Parent"] = null; + } + if (!("Details" in $$source)) { + /** + * @member + * @type {{"Age": number, "Address": {"Street": string}}} + */ + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js new file mode 100644 index 00000000000..643d1e589b4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js @@ -0,0 +1,430 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * @param {number[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function ArrayInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.ArrayInt", $in)); + return $resultPromise; +} + +/** + * @param {boolean} $in + * @returns {Promise & { cancel(): void }} + */ +export function BoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.BoolInBoolOut", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Float32InFloat32Out", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Float64InFloat64Out", $in)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int16InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int16PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int32InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int32PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int64InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int64PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int8InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int8PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntInIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntInIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntPointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntPointerInputNamedOutputs", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: string]: number }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntPointerInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntPointerInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] }} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntSliceInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntSliceInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] }} $in + * @returns {Promise<{ [_: `${number}`]: number[] }> & { cancel(): void }} + */ +export function MapIntSliceIntInMapIntSliceIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function NoInputsStringOut() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NoInputsStringOut")); + return $resultPromise; +} + +/** + * @param {boolean | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerBoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerBoolInBoolOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerFloat32InFloat32Out", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerFloat64InFloat64Out", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerMapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerMapIntInt", $in)); + return $resultPromise; +} + +/** + * @param {string | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerStringInStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerStringInStringOut", $in)); + return $resultPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputNamedOutput", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputNamedOutputs", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringArrayOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputStringArrayOut", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputStringOut", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person} $in + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function StructInputStructOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructInputStructOutput", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType3($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StructPointerInputErrorOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructPointerInputErrorOutput", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function StructPointerInputStructPointerOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", $in)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType4($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt16InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt16PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt32InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt32PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt64InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt64PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt8InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt8PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntInUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UIntInUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UIntPointerInAndOutput", $in)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Map($Create.Any, $$createType0); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $models.Person.createFrom; +const $$createType4 = $Create.Nullable($$createType3); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js new file mode 100644 index 00000000000..369ddb2546d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js @@ -0,0 +1,55 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + /** + * @member + * @type {Person | null} + */ + this["Parent"] = null; + } + if (!("Details" in $$source)) { + /** + * @member + * @type {{"Age": number, "Address": {"Street": string}}} + */ + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js new file mode 100644 index 00000000000..00a428bf422 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js new file mode 100644 index 00000000000..00a428bf422 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js new file mode 100644 index 00000000000..0b280f75748 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js @@ -0,0 +1,40 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js new file mode 100644 index 00000000000..ce09b1d9ffd --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js @@ -0,0 +1,54 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export class Person { + /** + * Creates a new Person instance. + * @param {Partial} [$$source = {}] - The source object to create the Person. + */ + constructor($$source = {}) { + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Address" in $$source)) { + /** + * @member + * @type {services$0.Address | null} + */ + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Person} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js new file mode 100644 index 00000000000..102490a3d35 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js @@ -0,0 +1,47 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + /** + * Creates a new Address instance. + * @param {Partial
} [$$source = {}] - The source object to create the Address. + */ + constructor($$source = {}) { + if (!("Street" in $$source)) { + /** + * @member + * @type {string} + */ + this["Street"] = ""; + } + if (!("State" in $$source)) { + /** + * @member + * @type {string} + */ + this["State"] = ""; + } + if (!("Country" in $$source)) { + /** + * @member + * @type {string} + */ + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Address} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address(/** @type {Partial
} */($$parsedSource)); + } +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js new file mode 100644 index 00000000000..e21f6b0c28b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services.OtherService.Yay")); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js new file mode 100644 index 00000000000..75cefd192a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js @@ -0,0 +1,42 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Get someone + * @param {$models.Alias} aliasValue + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function Get(aliasValue) { + let $resultPromise = /** @type {any} */($Call.ByID(1928502664, aliasValue)); + return $resultPromise; +} + +/** + * Get someone quite different + * @returns {Promise<$models.GenericPerson> & { cancel(): void }} + */ +export function GetButDifferent() { + let $resultPromise = /** @type {any} */($Call.ByID(2240931744)); + return $resultPromise; +} + +/** + * Greet a lot of unusual things. + * @param {$models.EmptyAliasStruct} $0 + * @param {$models.EmptyStruct} $1 + * @returns {Promise<$models.AliasStruct> & { cancel(): void }} + */ +export function Greet($0, $1) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, $0, $1)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js new file mode 100644 index 00000000000..a721363ebd2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js @@ -0,0 +1,53 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias + * @typedef {number} Alias + */ + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + * @typedef {Object} AliasStruct + * @property {number[] | null} Foo - A field with a comment. + * @property {string} [Bar] - Definitely not Foo. + * @property {string} [Baz] - Definitely not Foo. + * @property {OtherAliasStruct} Other - A nested alias struct. + */ + +/** + * An empty struct alias. + * @typedef { { + * } } EmptyAliasStruct + */ + +/** + * An empty struct. + * @typedef { { + * } } EmptyStruct + */ + +/** + * A generic struct containing an alias + * @template T + * @typedef {Object} GenericPerson + * @property {T | null} Name + * @property {Alias} AliasedField + */ + +/** + * Another struct alias. + * @typedef {Object} OtherAliasStruct + * @property {number[] | null} NoMoreIdeas + */ + +/** + * A non-generic struct containing an alias. + * @typedef {Object} Person + * @property {string} Name - The Person's name. + * @property {Alias} AliasedField - A random alias field. + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js new file mode 100644 index 00000000000..f6c8397200f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as Service7 from "./service7.js"; +import * as Service9 from "./service9.js"; +export { + Service7, + Service9 +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js new file mode 100644 index 00000000000..5b3af714918 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function TestMethod() { + let $resultPromise = /** @type {any} */($Call.ByID(2241101727)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js new file mode 100644 index 00000000000..7a9188d23ba --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function TestMethod2() { + let $resultPromise = /** @type {any} */($Call.ByID(1556848345)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js new file mode 100644 index 00000000000..c62355d5d1a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js @@ -0,0 +1,23 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {$models.Person} person + * @param {$models.Embedded1} emb + * @returns {Promise & { cancel(): void }} + */ +export function Greet(person, emb) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, person, emb)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js new file mode 100644 index 00000000000..6c54ff4baac --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js @@ -0,0 +1,11 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} embedded4 + * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming + * @property {boolean} Friends - Friends should not be shadowed in Person as embedded4 is not embedded from encoding/json's point of view; however, it should be shadowed in Embedded1 + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js new file mode 100644 index 00000000000..3697372ee65 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js @@ -0,0 +1,58 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as $internal from "./internal.js"; + +/** + * @typedef {Object} Embedded1 + * @property {number} Friends - Friends should be shadowed in Person by a field of lesser depth + * @property {number} Vanish - Vanish should be omitted from Person because there is another field with same depth and no tag + * @property {string} StillThere - StillThere should be shadowed in Person by other field with same depth and a json tag + * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming + */ + +/** + * @typedef {string} Embedded3 + */ + +/** + * Person represents a person + * @typedef { { + * "Titles"?: Title[] | null, + * "Names": string[] | null, + * "Partner": Person | null, + * "Friends": (Person | null)[] | null, + * "NamingThingsIsHard": `${boolean}`, + * "StillThere": Embedded3 | null, + * "-": number, + * "Embedded3": Embedded3, + * "StrangerNumber": `${number}`, + * "StrangestString"?: `"${string}"`, + * "StringStrangest"?: `"${string}"`, + * "emb4"?: $internal.embedded4, + * } } Person + */ + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js new file mode 100644 index 00000000000..47f8187d272 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js @@ -0,0 +1,29 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * It has a multiline doc comment + * The comment has even some * / traps!! + * @param {string} str + * @param {$models.Person[] | null} people + * @param {{"AnotherCount": number, "AnotherOne": $models.Person | null}} $2 + * @param {{ [_: `${number}`]: boolean | null } | null} assoc + * @param {(number | null)[] | null} $4 + * @param {string[]} other + * @returns {Promise<[$models.Person, any, number[] | null]> & { cancel(): void }} + */ +export function Greet(str, people, $2, assoc, $4, ...other) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, str, people, $2, assoc, $4, other)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js new file mode 100644 index 00000000000..cd1ad5f3179 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js @@ -0,0 +1,11 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + * @typedef {Object} Person + * @property {string} Name + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js new file mode 100644 index 00000000000..1818924c4e0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js @@ -0,0 +1,21 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Make a cycle. + * @returns {Promise<[$models.Cyclic, $models.GenericCyclic<$models.GenericCyclic>]> & { cancel(): void }} + */ +export function MakeCycles() { + let $resultPromise = /** @type {any} */($Call.ByID(440020721)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js new file mode 100644 index 00000000000..0d4922b0c9b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Cyclic | null} Alias + */ + +/** + * @typedef {({ [_: string]: Alias } | null)[] | null} Cyclic + */ + +/** + * @template T + * @typedef {{"X": GenericCyclic | null, "Y": (T | null)[] | null}[] | null} GenericCyclic + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js new file mode 100644 index 00000000000..250f4098d87 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js @@ -0,0 +1,56 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Comment 1. + * @returns {Promise & { cancel(): void }} + */ +export function Method1() { + let $resultPromise = /** @type {any} */($Call.ByID(841558284)); + return $resultPromise; +} + +/** + * Comment 2. + * @returns {Promise & { cancel(): void }} + */ +export function Method2() { + let $resultPromise = /** @type {any} */($Call.ByID(891891141)); + return $resultPromise; +} + +/** + * Comment 3a. + * Comment 3b. + * @returns {Promise & { cancel(): void }} + */ +export function Method3() { + let $resultPromise = /** @type {any} */($Call.ByID(875113522)); + return $resultPromise; +} + +/** + * Comment 4. + * @returns {Promise & { cancel(): void }} + */ +export function Method4() { + let $resultPromise = /** @type {any} */($Call.ByID(791225427)); + return $resultPromise; +} + +/** + * Comment 5. + * @returns {Promise & { cancel(): void }} + */ +export function Method5() { + let $resultPromise = /** @type {any} */($Call.ByID(774447808)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js new file mode 100644 index 00000000000..803ccb79881 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js @@ -0,0 +1,33 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @param {$models.Title} title + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name, title) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name, title)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js new file mode 100644 index 00000000000..0eb6e561e1d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js @@ -0,0 +1,33 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + * @typedef {Object} Person + * @property {Title} Title + * @property {string} Name + */ + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js new file mode 100644 index 00000000000..2b4acb7a722 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js @@ -0,0 +1,23 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @param {services$0.Title} title + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name, title) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name, title)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js new file mode 100644 index 00000000000..580fb67af27 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js @@ -0,0 +1,5 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js new file mode 100644 index 00000000000..1a275a050d1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js @@ -0,0 +1,25 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js new file mode 100644 index 00000000000..2d3f4308d02 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js new file mode 100644 index 00000000000..c8554abd8d8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js new file mode 100644 index 00000000000..70aaa06089e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js new file mode 100644 index 00000000000..5839417f634 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByID(2007737399)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js new file mode 100644 index 00000000000..2d3f4308d02 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js new file mode 100644 index 00000000000..99030507ad4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./services/other/models.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {other$0.Address | null} Address + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js new file mode 100644 index 00000000000..70aaa06089e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js new file mode 100644 index 00000000000..e3dcf8f690e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByID(2447353446)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js new file mode 100644 index 00000000000..9bc43bc880c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js new file mode 100644 index 00000000000..d354f042390 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js new file mode 100644 index 00000000000..39724a0f4ce --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function GreetWithContext(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1310150960, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js new file mode 100644 index 00000000000..79394cd22b5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as SomeMethods from "./somemethods.js"; +export { + SomeMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js new file mode 100644 index 00000000000..0548aa083ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js @@ -0,0 +1,11 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} personImpl + * @property {string} Nickname - Nickname conceals a person's identity. + * @property {string} Name - They have a name. + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js new file mode 100644 index 00000000000..7e4d66c4224 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./other/models.js"; + +import * as $internal from "./internal.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + * @template How + * @typedef {other$0.OtherPerson<{ [_: string]: How | null } | null>} HowDifferent + */ + +/** + * Impersonator gets their fields from other people. + * @typedef {other$0.OtherPerson} Impersonator + */ + +/** + * Person is not a number. + * @typedef {Object} Person + * @property {string} Name - They have a name. + */ + +/** + * PrivatePerson gets their fields from hidden sources. + * @typedef {$internal.personImpl} PrivatePerson + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js new file mode 100644 index 00000000000..9ac8ae8c2d3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherMethods from "./othermethods.js"; +export { + OtherMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js new file mode 100644 index 00000000000..d66bbe0c6d7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + * @template T + * @typedef {Object} OtherPerson + * @property {string} Name - They have a name as well. + * @property {(T | null)[] | null} Differences - But they may have many differences. + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js new file mode 100644 index 00000000000..1ac368ea5af --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherMethods has another method, but through a private embedded type. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByID(3606939272)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js new file mode 100644 index 00000000000..f36a51d6520 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * SomeMethods exports some methods. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * LikeThisOne is an example method that does nothing. + * @returns {Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} + */ +export function LikeThisOne() { + let $resultPromise = /** @type {any} */($Call.ByID(2124352079)); + return $resultPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByID(4281222271)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js new file mode 100644 index 00000000000..a80c7cb62a0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedOther is even trickier. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByID(3566862802)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js new file mode 100644 index 00000000000..d2b807fc697 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedService is tricky. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as nobindingshere$0 from "../no_bindings_here/models.js"; + +/** + * LikeThisOne is an example method that does nothing. + * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} + */ +export function LikeThisOne() { + let $resultPromise = /** @type {any} */($Call.ByID(2590614085)); + return $resultPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByID(773650321)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js new file mode 100644 index 00000000000..afce2e64bb3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} $0 + * @returns {Promise & { cancel(): void }} + */ +export function Greet($0) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, $0)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js new file mode 100644 index 00000000000..734fb02e7b1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as EmbedOther from "./embedother.js"; +import * as EmbedService from "./embedservice.js"; +import * as GreetService from "./greetservice.js"; +export { + EmbedOther, + EmbedService, + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js new file mode 100644 index 00000000000..9bc43bc880c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js new file mode 100644 index 00000000000..62ddbc1667b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js new file mode 100644 index 00000000000..ce3cfc168ab --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function Hello() { + let $resultPromise = /** @type {any} */($Call.ByID(4249972365)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js new file mode 100644 index 00000000000..9bc43bc880c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js new file mode 100644 index 00000000000..62ddbc1667b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js new file mode 100644 index 00000000000..ce3cfc168ab --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function Hello() { + let $resultPromise = /** @type {any} */($Call.ByID(4249972365)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js new file mode 100644 index 00000000000..2d3f4308d02 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js new file mode 100644 index 00000000000..e70551997ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js new file mode 100644 index 00000000000..70aaa06089e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js new file mode 100644 index 00000000000..cf6ea0ac638 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByID(3568225479)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js new file mode 100644 index 00000000000..2262fd5a83b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js @@ -0,0 +1,399 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * @param {number[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function ArrayInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3862002418, $in)); + return $resultPromise; +} + +/** + * @param {boolean} $in + * @returns {Promise & { cancel(): void }} + */ +export function BoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2424639793, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3132595881, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2182412247, $in)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3306292566, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1754277916, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1909469092, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(4251088558, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1343888303, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2205561041, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(572240879, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2189402897, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntInIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(642881729, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1066151743, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2718999663, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2386486356, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: string]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntPointerInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(550413585, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] | null } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntSliceInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2900172572, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] | null } | null} $in + * @returns {Promise<{ [_: `${number}`]: number[] | null } | null> & { cancel(): void }} + */ +export function MapIntSliceIntInMapIntSliceIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(881980169, $in)); + return $resultPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function NoInputsStringOut() { + let $resultPromise = /** @type {any} */($Call.ByID(1075577233)); + return $resultPromise; +} + +/** + * @param {boolean | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerBoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3589606958, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(224675106, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2124953624, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerMapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3516977899, $in)); + return $resultPromise; +} + +/** + * @param {string | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerStringInStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(229603958, $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3678582682, $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByID(319259595, $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringArrayOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(383995060, $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1091960237, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person} $in + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function StructInputStructOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3835643147, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StructPointerInputErrorOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2447692557, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function StructPointerInputStructPointerOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2943477349, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3401034892, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1236957573, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1160383782, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1739300671, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(793803239, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1403757716, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2988345717, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(518250834, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntInUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2836661285, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1367187362, $in)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js new file mode 100644 index 00000000000..ae39e4df048 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {Person | null} Parent + * @property {{"Age": number, "Address": {"Street": string}}} Details + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js new file mode 100644 index 00000000000..2262fd5a83b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js @@ -0,0 +1,399 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * @param {number[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function ArrayInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3862002418, $in)); + return $resultPromise; +} + +/** + * @param {boolean} $in + * @returns {Promise & { cancel(): void }} + */ +export function BoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2424639793, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3132595881, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2182412247, $in)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3306292566, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1754277916, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1909469092, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(4251088558, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1343888303, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2205561041, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(572240879, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2189402897, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntInIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(642881729, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1066151743, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2718999663, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2386486356, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: string]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntPointerInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(550413585, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] | null } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntSliceInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2900172572, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] | null } | null} $in + * @returns {Promise<{ [_: `${number}`]: number[] | null } | null> & { cancel(): void }} + */ +export function MapIntSliceIntInMapIntSliceIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(881980169, $in)); + return $resultPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function NoInputsStringOut() { + let $resultPromise = /** @type {any} */($Call.ByID(1075577233)); + return $resultPromise; +} + +/** + * @param {boolean | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerBoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3589606958, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(224675106, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2124953624, $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerMapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3516977899, $in)); + return $resultPromise; +} + +/** + * @param {string | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerStringInStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(229603958, $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3678582682, $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByID(319259595, $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringArrayOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(383995060, $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1091960237, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person} $in + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function StructInputStructOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3835643147, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StructPointerInputErrorOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2447692557, $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function StructPointerInputStructPointerOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2943477349, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(3401034892, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1236957573, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1160383782, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1739300671, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(793803239, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1403757716, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2988345717, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(518250834, $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntInUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByID(2836661285, $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByID(1367187362, $in)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js new file mode 100644 index 00000000000..ae39e4df048 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {Person | null} Parent + * @property {{"Age": number, "Address": {"Street": string}}} Details + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js new file mode 100644 index 00000000000..d354f042390 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js new file mode 100644 index 00000000000..d354f042390 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js new file mode 100644 index 00000000000..2d3f4308d02 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1661412647, name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js new file mode 100644 index 00000000000..91ce79789cc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js @@ -0,0 +1,15 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js new file mode 100644 index 00000000000..70aaa06089e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js new file mode 100644 index 00000000000..564a5e139cd --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByID(1491748400)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js new file mode 100644 index 00000000000..dd7f8d3b4b7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.js @@ -0,0 +1,42 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Get someone + * @param {$models.Alias} aliasValue + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function Get(aliasValue) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Get", aliasValue)); + return $resultPromise; +} + +/** + * Get someone quite different + * @returns {Promise<$models.GenericPerson> & { cancel(): void }} + */ +export function GetButDifferent() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.GetButDifferent")); + return $resultPromise; +} + +/** + * Greet a lot of unusual things. + * @param {$models.EmptyAliasStruct} $0 + * @param {$models.EmptyStruct} $1 + * @returns {Promise<$models.AliasStruct> & { cancel(): void }} + */ +export function Greet($0, $1) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", $0, $1)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js new file mode 100644 index 00000000000..a721363ebd2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.js @@ -0,0 +1,53 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias + * @typedef {number} Alias + */ + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + * @typedef {Object} AliasStruct + * @property {number[] | null} Foo - A field with a comment. + * @property {string} [Bar] - Definitely not Foo. + * @property {string} [Baz] - Definitely not Foo. + * @property {OtherAliasStruct} Other - A nested alias struct. + */ + +/** + * An empty struct alias. + * @typedef { { + * } } EmptyAliasStruct + */ + +/** + * An empty struct. + * @typedef { { + * } } EmptyStruct + */ + +/** + * A generic struct containing an alias + * @template T + * @typedef {Object} GenericPerson + * @property {T | null} Name + * @property {Alias} AliasedField + */ + +/** + * Another struct alias. + * @typedef {Object} OtherAliasStruct + * @property {number[] | null} NoMoreIdeas + */ + +/** + * A non-generic struct containing an alias. + * @typedef {Object} Person + * @property {string} Name - The Person's name. + * @property {Alias} AliasedField - A random alias field. + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js new file mode 100644 index 00000000000..f6c8397200f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as Service7 from "./service7.js"; +import * as Service9 from "./service9.js"; +export { + Service7, + Service9 +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js new file mode 100644 index 00000000000..9c1c7dc05c9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function TestMethod() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config.Service7.TestMethod")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js new file mode 100644 index 00000000000..5785a595430 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function TestMethod2() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config.Service9.TestMethod2")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js new file mode 100644 index 00000000000..30ff2137e62 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.js @@ -0,0 +1,23 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {$models.Person} person + * @param {$models.Embedded1} emb + * @returns {Promise & { cancel(): void }} + */ +export function Greet(person, emb) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", person, emb)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js new file mode 100644 index 00000000000..6c54ff4baac --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.js @@ -0,0 +1,11 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} embedded4 + * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming + * @property {boolean} Friends - Friends should not be shadowed in Person as embedded4 is not embedded from encoding/json's point of view; however, it should be shadowed in Embedded1 + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js new file mode 100644 index 00000000000..3697372ee65 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.js @@ -0,0 +1,58 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as $internal from "./internal.js"; + +/** + * @typedef {Object} Embedded1 + * @property {number} Friends - Friends should be shadowed in Person by a field of lesser depth + * @property {number} Vanish - Vanish should be omitted from Person because there is another field with same depth and no tag + * @property {string} StillThere - StillThere should be shadowed in Person by other field with same depth and a json tag + * @property {`${boolean}`} NamingThingsIsHard - NamingThingsIsHard is a law of programming + */ + +/** + * @typedef {string} Embedded3 + */ + +/** + * Person represents a person + * @typedef { { + * "Titles"?: Title[] | null, + * "Names": string[] | null, + * "Partner": Person | null, + * "Friends": (Person | null)[] | null, + * "NamingThingsIsHard": `${boolean}`, + * "StillThere": Embedded3 | null, + * "-": number, + * "Embedded3": Embedded3, + * "StrangerNumber": `${number}`, + * "StrangestString"?: `"${string}"`, + * "StringStrangest"?: `"${string}"`, + * "emb4"?: $internal.embedded4, + * } } Person + */ + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js new file mode 100644 index 00000000000..3c88ddb2bc1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.js @@ -0,0 +1,29 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * It has a multiline doc comment + * The comment has even some * / traps!! + * @param {string} str + * @param {$models.Person[] | null} people + * @param {{"AnotherCount": number, "AnotherOne": $models.Person | null}} $2 + * @param {{ [_: `${number}`]: boolean | null } | null} assoc + * @param {(number | null)[] | null} $4 + * @param {string[]} other + * @returns {Promise<[$models.Person, any, number[] | null]> & { cancel(): void }} + */ +export function Greet(str, people, $2, assoc, $4, ...other) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", str, people, $2, assoc, $4, other)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js new file mode 100644 index 00000000000..cd1ad5f3179 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.js @@ -0,0 +1,11 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + * @typedef {Object} Person + * @property {string} Name + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js new file mode 100644 index 00000000000..0fa9bb54a02 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.js @@ -0,0 +1,21 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Make a cycle. + * @returns {Promise<[$models.Cyclic, $models.GenericCyclic<$models.GenericCyclic>]> & { cancel(): void }} + */ +export function MakeCycles() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MakeCycles")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js new file mode 100644 index 00000000000..0d4922b0c9b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.js @@ -0,0 +1,18 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Cyclic | null} Alias + */ + +/** + * @typedef {({ [_: string]: Alias } | null)[] | null} Cyclic + */ + +/** + * @template T + * @typedef {{"X": GenericCyclic | null, "Y": (T | null)[] | null}[] | null} GenericCyclic + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js new file mode 100644 index 00000000000..3f27bff5a76 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.js @@ -0,0 +1,56 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Comment 1. + * @returns {Promise & { cancel(): void }} + */ +export function Method1() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method1")); + return $resultPromise; +} + +/** + * Comment 2. + * @returns {Promise & { cancel(): void }} + */ +export function Method2() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method2")); + return $resultPromise; +} + +/** + * Comment 3a. + * Comment 3b. + * @returns {Promise & { cancel(): void }} + */ +export function Method3() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method3")); + return $resultPromise; +} + +/** + * Comment 4. + * @returns {Promise & { cancel(): void }} + */ +export function Method4() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method4")); + return $resultPromise; +} + +/** + * Comment 5. + * @returns {Promise & { cancel(): void }} + */ +export function Method5() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Method5")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js new file mode 100644 index 00000000000..2513e802d8e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.js @@ -0,0 +1,33 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @param {$models.Title} title + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name, title) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name, title)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js new file mode 100644 index 00000000000..0eb6e561e1d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.js @@ -0,0 +1,33 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + * @typedef {Object} Person + * @property {Title} Title + * @property {string} Name + */ + +/** + * Title is a title + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js new file mode 100644 index 00000000000..a5aca00897f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.js @@ -0,0 +1,23 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @param {services$0.Title} title + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name, title) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name, title)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js new file mode 100644 index 00000000000..580fb67af27 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.js @@ -0,0 +1,5 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js new file mode 100644 index 00000000000..1a275a050d1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.js @@ -0,0 +1,25 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @readonly + * @enum {string} + */ +export const Title = { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero: "", + + /** + * Mister is a title + */ + Mister: "Mr", + Miss: "Miss", + Ms: "Ms", + Mrs: "Mrs", + Dr: "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js new file mode 100644 index 00000000000..a9082be9385 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js new file mode 100644 index 00000000000..c8554abd8d8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js new file mode 100644 index 00000000000..70aaa06089e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js new file mode 100644 index 00000000000..52c43908716 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services.OtherService.Yay")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js new file mode 100644 index 00000000000..a9082be9385 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js new file mode 100644 index 00000000000..99030507ad4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./services/other/models.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {other$0.Address | null} Address + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js new file mode 100644 index 00000000000..70aaa06089e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js new file mode 100644 index 00000000000..1c4f105b648 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other.OtherService.Yay")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js new file mode 100644 index 00000000000..8defb387a72 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js new file mode 100644 index 00000000000..00a428bf422 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js new file mode 100644 index 00000000000..d4189a66fc1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function GreetWithContext(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.GreetWithContext", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js new file mode 100644 index 00000000000..79394cd22b5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as SomeMethods from "./somemethods.js"; +export { + SomeMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js new file mode 100644 index 00000000000..0548aa083ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.js @@ -0,0 +1,11 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} personImpl + * @property {string} Nickname - Nickname conceals a person's identity. + * @property {string} Name - They have a name. + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js new file mode 100644 index 00000000000..7e4d66c4224 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./other/models.js"; + +import * as $internal from "./internal.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + * @template How + * @typedef {other$0.OtherPerson<{ [_: string]: How | null } | null>} HowDifferent + */ + +/** + * Impersonator gets their fields from other people. + * @typedef {other$0.OtherPerson} Impersonator + */ + +/** + * Person is not a number. + * @typedef {Object} Person + * @property {string} Name - They have a name. + */ + +/** + * PrivatePerson gets their fields from hidden sources. + * @typedef {$internal.personImpl} PrivatePerson + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js new file mode 100644 index 00000000000..9ac8ae8c2d3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherMethods from "./othermethods.js"; +export { + OtherMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js new file mode 100644 index 00000000000..d66bbe0c6d7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + * @template T + * @typedef {Object} OtherPerson + * @property {string} Name - They have a name as well. + * @property {(T | null)[] | null} Differences - But they may have many differences. + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js new file mode 100644 index 00000000000..5795949a4d6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherMethods has another method, but through a private embedded type. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other.OtherMethods.LikeThisOtherOne")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js new file mode 100644 index 00000000000..94cbd993eca --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * SomeMethods exports some methods. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * LikeThisOne is an example method that does nothing. + * @returns {Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void }} + */ +export function LikeThisOne() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOne")); + return $resultPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOtherOne")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js new file mode 100644 index 00000000000..3c0e397d5e8 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.js @@ -0,0 +1,19 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedOther is even trickier. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByName("main.EmbedOther.LikeThisOtherOne")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js new file mode 100644 index 00000000000..1ab4bc71737 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.js @@ -0,0 +1,30 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedService is tricky. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as nobindingshere$0 from "../no_bindings_here/models.js"; + +/** + * LikeThisOne is an example method that does nothing. + * @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void }} + */ +export function LikeThisOne() { + let $resultPromise = /** @type {any} */($Call.ByName("main.EmbedService.LikeThisOne")); + return $resultPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + * @returns {Promise & { cancel(): void }} + */ +export function LikeThisOtherOne() { + let $resultPromise = /** @type {any} */($Call.ByName("main.EmbedService.LikeThisOtherOne")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js new file mode 100644 index 00000000000..c8762377f63 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} $0 + * @returns {Promise & { cancel(): void }} + */ +export function Greet($0) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", $0)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js new file mode 100644 index 00000000000..734fb02e7b1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as EmbedOther from "./embedother.js"; +import * as EmbedService from "./embedservice.js"; +import * as GreetService from "./greetservice.js"; +export { + EmbedOther, + EmbedService, + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js new file mode 100644 index 00000000000..8defb387a72 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js new file mode 100644 index 00000000000..62ddbc1667b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js new file mode 100644 index 00000000000..14046c16a4d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function Hello() { + let $resultPromise = /** @type {any} */($Call.ByName("main.OtherService.Hello")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js new file mode 100644 index 00000000000..8defb387a72 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.js @@ -0,0 +1,14 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js new file mode 100644 index 00000000000..62ddbc1667b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js new file mode 100644 index 00000000000..14046c16a4d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * @returns {Promise & { cancel(): void }} + */ +export function Hello() { + let $resultPromise = /** @type {any} */($Call.ByName("main.OtherService.Hello")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js new file mode 100644 index 00000000000..a9082be9385 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js new file mode 100644 index 00000000000..e70551997ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.js @@ -0,0 +1,13 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js new file mode 100644 index 00000000000..70aaa06089e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js new file mode 100644 index 00000000000..0758f236668 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services.OtherService.Yay")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js new file mode 100644 index 00000000000..64cb8685be0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.js @@ -0,0 +1,399 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * @param {number[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function ArrayInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.ArrayInt", $in)); + return $resultPromise; +} + +/** + * @param {boolean} $in + * @returns {Promise & { cancel(): void }} + */ +export function BoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.BoolInBoolOut", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Float32InFloat32Out", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Float64InFloat64Out", $in)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int16InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int16PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int32InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int32PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int64InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int64PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int8InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int8PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntInIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntInIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntPointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntPointerInputNamedOutputs", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: string]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntPointerInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntPointerInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] | null } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntSliceInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntSliceInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] | null } | null} $in + * @returns {Promise<{ [_: `${number}`]: number[] | null } | null> & { cancel(): void }} + */ +export function MapIntSliceIntInMapIntSliceIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", $in)); + return $resultPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function NoInputsStringOut() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NoInputsStringOut")); + return $resultPromise; +} + +/** + * @param {boolean | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerBoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerBoolInBoolOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerFloat32InFloat32Out", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerFloat64InFloat64Out", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerMapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerMapIntInt", $in)); + return $resultPromise; +} + +/** + * @param {string | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerStringInStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerStringInStringOut", $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputNamedOutput", $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputNamedOutputs", $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringArrayOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputStringArrayOut", $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputStringOut", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person} $in + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function StructInputStructOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructInputStructOutput", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StructPointerInputErrorOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructPointerInputErrorOutput", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function StructPointerInputStructPointerOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt16InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt16PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt32InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt32PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt64InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt64PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt8InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt8PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntInUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UIntInUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UIntPointerInAndOutput", $in)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js new file mode 100644 index 00000000000..ae39e4df048 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {Person | null} Parent + * @property {{"Age": number, "Address": {"Street": string}}} Details + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js new file mode 100644 index 00000000000..64cb8685be0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.js @@ -0,0 +1,399 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * @param {number[]} $in + * @returns {Promise & { cancel(): void }} + */ +export function ArrayInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.ArrayInt", $in)); + return $resultPromise; +} + +/** + * @param {boolean} $in + * @returns {Promise & { cancel(): void }} + */ +export function BoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.BoolInBoolOut", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Float32InFloat32Out", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Float64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Float64InFloat64Out", $in)); + return $resultPromise; +} + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int16InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int16PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int32InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int32PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int64InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int64PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8InIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int8InIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function Int8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Int8PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntInIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntInIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntPointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function IntPointerInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.IntPointerInputNamedOutputs", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: string]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntPointerInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntPointerInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] | null } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function MapIntSliceInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntSliceInt", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number[] | null } | null} $in + * @returns {Promise<{ [_: `${number}`]: number[] | null } | null> & { cancel(): void }} + */ +export function MapIntSliceIntInMapIntSliceIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", $in)); + return $resultPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function NoInputsStringOut() { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NoInputsStringOut")); + return $resultPromise; +} + +/** + * @param {boolean | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerBoolInBoolOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerBoolInBoolOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat32InFloat32Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerFloat32InFloat32Out", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerFloat64InFloat64Out($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerFloat64InFloat64Out", $in)); + return $resultPromise; +} + +/** + * @param {{ [_: `${number}`]: number } | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerMapIntInt($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerMapIntInt", $in)); + return $resultPromise; +} + +/** + * @param {string | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function PointerStringInStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.PointerStringInStringOut", $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputNamedOutput", $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputNamedOutputs($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputNamedOutputs", $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringArrayOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputStringArrayOut", $in)); + return $resultPromise; +} + +/** + * @param {string[] | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StringArrayInputStringOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StringArrayInputStringOut", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person} $in + * @returns {Promise<$models.Person> & { cancel(): void }} + */ +export function StructInputStructOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructInputStructOutput", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function StructPointerInputErrorOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructPointerInputErrorOutput", $in)); + return $resultPromise; +} + +/** + * @param {$models.Person | null} $in + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function StructPointerInputStructPointerOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt16InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt16PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt16PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt32InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt32PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt32PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt64InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt64PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt64PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8InUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt8InUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UInt8PointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UInt8PointerInAndOutput", $in)); + return $resultPromise; +} + +/** + * @param {number} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntInUIntOut($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UIntInUIntOut", $in)); + return $resultPromise; +} + +/** + * @param {number | null} $in + * @returns {Promise & { cancel(): void }} + */ +export function UIntPointerInAndOutput($in) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.UIntPointerInAndOutput", $in)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js new file mode 100644 index 00000000000..ae39e4df048 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Person + * @property {string} Name + * @property {Person | null} Parent + * @property {{"Age": number, "Address": {"Street": string}}} Details + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js new file mode 100644 index 00000000000..00a428bf422 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js new file mode 100644 index 00000000000..00a428bf422 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.js @@ -0,0 +1,20 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js new file mode 100644 index 00000000000..fdf1ff435a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.js @@ -0,0 +1,8 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js new file mode 100644 index 00000000000..a9082be9385 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.js @@ -0,0 +1,32 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function Greet(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.Greet", name)); + return $resultPromise; +} + +/** + * NewPerson creates a new person + * @param {string} name + * @returns {Promise<$models.Person | null> & { cancel(): void }} + */ +export function NewPerson(name) { + let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.NewPerson", name)); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js new file mode 100644 index 00000000000..130c30a09ea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js new file mode 100644 index 00000000000..91ce79789cc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.js @@ -0,0 +1,15 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + * @typedef {Object} Person + * @property {string} Name + * @property {services$0.Address | null} Address + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js new file mode 100644 index 00000000000..bac48bb4976 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.js @@ -0,0 +1,10 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js new file mode 100644 index 00000000000..70aaa06089e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.js @@ -0,0 +1,12 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * @typedef {Object} Address + * @property {string} Street + * @property {string} State + * @property {string} Country + */ diff --git a/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js new file mode 100644 index 00000000000..cdd18da9a96 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=JS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + * @returns {Promise<$models.Address | null> & { cancel(): void }} + */ +export function Yay() { + let $resultPromise = /** @type {any} */($Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services.OtherService.Yay")); + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts new file mode 100644 index 00000000000..c9161885738 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts @@ -0,0 +1,60 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Get someone + */ +export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByID(1928502664, aliasValue) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType0($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Get someone quite different + */ +export function GetButDifferent(): Promise<$models.GenericPerson> & { cancel(): void } { + let $resultPromise = $Call.ByID(2240931744) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Greet a lot of unusual things. + */ +export function Greet($0: $models.EmptyAliasStruct, $1: $models.EmptyStruct): Promise<$models.AliasStruct> & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, $0, $1) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType5($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $models.GenericPerson.createFrom($Create.Any); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $Create.Array($Create.Any); +const $$createType4 = $Create.Struct({ + "NoMoreIdeas": $$createType3, +}); +const $$createType5 = $Create.Struct({ + "Foo": $$createType2, + "Other": $$createType4, +}); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts new file mode 100644 index 00000000000..e3befd52d7b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts @@ -0,0 +1,135 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias + */ +export type Alias = number; + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + */ +export interface AliasStruct { + /** + * A field with a comment. + */ + "Foo": number[]; + + /** + * Definitely not Foo. + */ + "Bar"?: string; + "Baz"?: string; + + /** + * A nested alias struct. + */ + "Other": OtherAliasStruct; +} + +/** + * An empty struct alias. + */ +export interface EmptyAliasStruct { +} + +/** + * An empty struct. + */ +export class EmptyStruct { + + /** Creates a new EmptyStruct instance. */ + constructor($$source: Partial = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new EmptyStruct instance from a string or object. + */ + static createFrom($$source: any = {}): EmptyStruct { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new EmptyStruct($$parsedSource as Partial); + } +} + +/** + * A generic struct containing an alias + */ +export class GenericPerson { + "Name": T | null; + "AliasedField": Alias; + + /** Creates a new GenericPerson instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = null; + } + if (!("AliasedField" in $$source)) { + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class GenericPerson. + */ + static createFrom($$createParamT: (any) => T): ($$source?: any) => GenericPerson { + const $$createField0_0 = $$createParamT; + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Name" in $$parsedSource) { + $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); + } + return new GenericPerson($$parsedSource as Partial>); + }; + } +} + +/** + * Another struct alias. + */ +export interface OtherAliasStruct { + "NoMoreIdeas": number[]; +} + +/** + * A non-generic struct containing an alias. + */ +export class Person { + /** + * The Person's name. + */ + "Name": string; + + /** + * A random alias field. + */ + "AliasedField": Alias; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("AliasedField" in $$source)) { + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts new file mode 100644 index 00000000000..bdcf43c67f9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as Service7 from "./service7.js"; +import * as Service9 from "./service9.js"; +export { + Service7, + Service9 +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts new file mode 100644 index 00000000000..7cb45a8f91f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function TestMethod(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2241101727) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts new file mode 100644 index 00000000000..63b6c861d1b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function TestMethod2(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1556848345) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts new file mode 100644 index 00000000000..0cda8fb0cff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(person: $models.Person, emb: $models.Embedded1): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, person, emb) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts new file mode 100644 index 00000000000..56a71ecef91 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts @@ -0,0 +1,38 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class embedded4 { + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * Friends should not be shadowed in Person as embedded4 is not embedded + * from encoding/json's point of view; + * however, it should be shadowed in Embedded1 + */ + "Friends": boolean; + + /** Creates a new embedded4 instance. */ + constructor($$source: Partial = {}) { + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + if (!("Friends" in $$source)) { + this["Friends"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new embedded4 instance from a string or object. + */ + static createFrom($$source: any = {}): embedded4 { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new embedded4($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts new file mode 100644 index 00000000000..3c10011486d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts @@ -0,0 +1,203 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as $internal from "./internal.js"; + +export class Embedded1 { + /** + * Friends should be shadowed in Person by a field of lesser depth + */ + "Friends": number; + + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + */ + "Vanish": number; + + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + */ + "StillThere": string; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** Creates a new Embedded1 instance. */ + constructor($$source: Partial = {}) { + if (!("Friends" in $$source)) { + this["Friends"] = 0; + } + if (!("Vanish" in $$source)) { + this["Vanish"] = 0; + } + if (!("StillThere" in $$source)) { + this["StillThere"] = ""; + } + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Embedded1 instance from a string or object. + */ + static createFrom($$source: any = {}): Embedded1 { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Embedded1($$parsedSource as Partial); + } +} + +export type Embedded3 = string; + +/** + * Person represents a person + */ +export class Person { + /** + * Titles is optional in JSON + */ + "Titles"?: Title[]; + + /** + * Names has a + * multiline comment + */ + "Names": string[]; + + /** + * Partner has a custom and complex JSON key + */ + "Partner": Person | null; + "Friends": (Person | null)[]; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + */ + "StillThere": Embedded3 | null; + + /** + * StrangeNumber maps to "-" + */ + "-": number; + + /** + * Embedded3 should appear with key "Embedded3" + */ + "Embedded3": Embedded3; + + /** + * StrangerNumber is serialized as a string + */ + "StrangerNumber": `${number}`; + + /** + * StrangestString is optional and serialized as a JSON string + */ + "StrangestString"?: `"${string}"`; + + /** + * StringStrangest is serialized as a JSON string and optional + */ + "StringStrangest"?: `"${string}"`; + + /** + * embedded4 should be optional and appear with key "emb4" + */ + "emb4"?: $internal.embedded4; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Names" in $$source)) { + this["Names"] = []; + } + if (!("Partner" in $$source)) { + this["Partner"] = null; + } + if (!("Friends" in $$source)) { + this["Friends"] = []; + } + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + if (!("StillThere" in $$source)) { + this["StillThere"] = null; + } + if (!("-" in $$source)) { + this["-"] = 0; + } + if (!("Embedded3" in $$source)) { + this["Embedded3"] = ("" as Embedded3); + } + if (!("StrangerNumber" in $$source)) { + this["StrangerNumber"] = "0"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType1; + const $$createField2_0 = $$createType3; + const $$createField3_0 = $$createType4; + const $$createField11_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Titles" in $$parsedSource) { + $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); + } + if ("Names" in $$parsedSource) { + $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); + } + if ("Partner" in $$parsedSource) { + $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); + } + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); + } + if ("emb4" in $$parsedSource) { + $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); + } + return new Person($$parsedSource as Partial); + } +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = Person.createFrom; +const $$createType3 = $Create.Nullable($$createType2); +const $$createType4 = $Create.Array($$createType3); +const $$createType5 = $internal.embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts new file mode 100644 index 00000000000..d60116a340a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts @@ -0,0 +1,31 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * It has a multiline doc comment + * The comment has even some * / traps!! + */ +export function Greet(str: string, people: $models.Person[], $2: {"AnotherCount": number, "AnotherOne": $models.Person | null}, assoc: { [_: `${number}`]: boolean | null }, $4: (number | null)[], ...other: string[]): Promise<[$models.Person, any, number[]]> & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, str, people, $2, assoc, $4, other) as any; + let $typingPromise = $resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[2] = $$createType1($result[2]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Array($Create.Any); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts new file mode 100644 index 00000000000..76d1e60b28c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts new file mode 100644 index 00000000000..84c7a07c58b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts @@ -0,0 +1,62 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Make a cycle. + */ +export function MakeCycles(): Promise<[$models.Cyclic, $models.GenericCyclic<$models.GenericCyclic>]> & { cancel(): void } { + let $resultPromise = $Call.ByID(440020721) as any; + let $typingPromise = $resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType9($result[1]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +var $$createType0 = (function $$initCreateType0(...args): any { + if ($$createType0 === $$initCreateType0) { + $$createType0 = $$createType3; + } + return $$createType0(...args); +}); +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = $Create.Map($Create.Any, $$createType1); +const $$createType3 = $Create.Array($$createType2); +var $$createType4 = (function $$initCreateType4(...args): any { + if ($$createType4 === $$initCreateType4) { + $$createType4 = $$createType8; + } + return $$createType4(...args); +}); +const $$createType5 = $Create.Nullable($$createType4); +const $$createType6 = $Create.Array($Create.Any); +const $$createType7 = $Create.Struct({ + "X": $$createType5, + "Y": $$createType6, +}); +const $$createType8 = $Create.Array($$createType7); +var $$createType9 = (function $$initCreateType9(...args): any { + if ($$createType9 === $$initCreateType9) { + $$createType9 = $$createType13; + } + return $$createType9(...args); +}); +const $$createType10 = $Create.Nullable($$createType9); +const $$createType11 = $Create.Array($$createType4); +const $$createType12 = $Create.Struct({ + "X": $$createType10, + "Y": $$createType11, +}); +const $$createType13 = $Create.Array($$createType12); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts new file mode 100644 index 00000000000..b2b94f97df0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export type Alias = Cyclic | null; + +export type Cyclic = { [_: string]: Alias }[]; + +export type GenericCyclic = {"X": GenericCyclic | null, "Y": (T | null)[]}[]; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts new file mode 100644 index 00000000000..81ed73ff7e6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts @@ -0,0 +1,50 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Comment 1. + */ +export function Method1(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(841558284) as any; + return $resultPromise; +} + +/** + * Comment 2. + */ +export function Method2(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(891891141) as any; + return $resultPromise; +} + +/** + * Comment 3a. + * Comment 3b. + */ +export function Method3(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(875113522) as any; + return $resultPromise; +} + +/** + * Comment 4. + */ +export function Method4(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(791225427) as any; + return $resultPromise; +} + +/** + * Comment 5. + */ +export function Method5(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(774447808) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts new file mode 100644 index 00000000000..7942d948211 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string, title: $models.Title): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name, title) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts new file mode 100644 index 00000000000..b58750ea7e0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts @@ -0,0 +1,51 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + "Title": Title; + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Title" in $$source)) { + this["Title"] = ("" as Title); + } + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts new file mode 100644 index 00000000000..41ca9b98e65 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string, title: services$0.Title): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name, title) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts new file mode 100644 index 00000000000..c9d993ab756 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts @@ -0,0 +1,4 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts similarity index 53% rename from v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/models.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts index f584b37a454..f7a68a98d81 100644 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts @@ -1,17 +1,20 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +import {Create as $Create} from "/wails/runtime.js"; + export enum Title { - // Mister is a title + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ Mister = "Mr", Miss = "Miss", Ms = "Ms", Mrs = "Mrs", Dr = "Dr", -} - -export interface Person { - title: Title; - name: string; -} \ No newline at end of file +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts new file mode 100644 index 00000000000..e7d00d45931 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts new file mode 100644 index 00000000000..56ae1b7821f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts @@ -0,0 +1,42 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts new file mode 100644 index 00000000000..14324bde5ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts new file mode 100644 index 00000000000..d63c5c3e7da --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(2007737399) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts new file mode 100644 index 00000000000..e7d00d45931 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts new file mode 100644 index 00000000000..ea08f0f6633 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts @@ -0,0 +1,39 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./services/other/models.js"; + +export class Person { + "Name": string; + "Address": other$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = other$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts new file mode 100644 index 00000000000..14324bde5ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts new file mode 100644 index 00000000000..bb2cacbb057 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(2447353446) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts new file mode 100644 index 00000000000..d1d012ca6d6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts new file mode 100644 index 00000000000..60f87929dc4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts new file mode 100644 index 00000000000..3ca71aa32a0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts @@ -0,0 +1,25 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function GreetWithContext(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1310150960, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts new file mode 100644 index 00000000000..6bd662438dc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as SomeMethods from "./somemethods.js"; +export { + SomeMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts new file mode 100644 index 00000000000..c90bb2519a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts @@ -0,0 +1,36 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class personImpl { + /** + * Nickname conceals a person's identity. + */ + "Nickname": string; + + /** + * They have a name. + */ + "Name": string; + + /** Creates a new personImpl instance. */ + constructor($$source: Partial = {}) { + if (!("Nickname" in $$source)) { + this["Nickname"] = ""; + } + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new personImpl instance from a string or object. + */ + static createFrom($$source: any = {}): personImpl { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new personImpl($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts new file mode 100644 index 00000000000..0378dfc3187 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts @@ -0,0 +1,103 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./other/models.js"; + +import * as $internal from "./internal.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + */ +export class HowDifferent { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": { [_: string]: How | null }[]; + + /** Creates a new HowDifferent instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class HowDifferent. + */ + static createFrom($$createParamHow: (any) => How): ($$source?: any) => HowDifferent { + const $$createField1_0 = $$createType1($$createParamHow); + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new HowDifferent($$parsedSource as Partial>); + }; + } +} + +/** + * Impersonator gets their fields from other people. + */ +export const Impersonator = other$0.OtherPerson; + +/** + * Impersonator gets their fields from other people. + */ +export type Impersonator = other$0.OtherPerson; + +/** + * Person is not a number. + */ +export class Person { + /** + * They have a name. + */ + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export const PrivatePerson = $internal.personImpl; + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export type PrivatePerson = $internal.personImpl; + +// Private type creation functions +const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); +const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts new file mode 100644 index 00000000000..9e85cc3c871 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherMethods from "./othermethods.js"; +export { + OtherMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts new file mode 100644 index 00000000000..73392af9c27 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts @@ -0,0 +1,50 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + */ +export class OtherPerson { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": (T | null)[]; + + /** Creates a new OtherPerson instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class OtherPerson. + */ + static createFrom($$createParamT: (any) => T): ($$source?: any) => OtherPerson { + const $$createField1_0 = $$createType0($$createParamT); + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new OtherPerson($$parsedSource as Partial>); + }; + } +} + +// Private type creation functions +const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts new file mode 100644 index 00000000000..c441633f85e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherMethods has another method, but through a private embedded type. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3606939272) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts new file mode 100644 index 00000000000..875337efafe --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts @@ -0,0 +1,41 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * SomeMethods exports some methods. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * LikeThisOne is an example method that does nothing. + */ +export function LikeThisOne(): Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { + let $resultPromise = $Call.ByID(2124352079) as any; + let $typingPromise = $resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + $result[2] = $$createType2($result[2]); + $result[3] = $$createType3($result[3]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4281222271) as any; + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $models.Impersonator.createFrom; +const $$createType2 = $models.HowDifferent.createFrom($Create.Any); +const $$createType3 = $models.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts new file mode 100644 index 00000000000..d024fcb1d72 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedOther is even trickier. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3566862802) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts new file mode 100644 index 00000000000..56ca3cbf762 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts @@ -0,0 +1,41 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedService is tricky. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as nobindingshere$0 from "../no_bindings_here/models.js"; + +/** + * LikeThisOne is an example method that does nothing. + */ +export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { + let $resultPromise = $Call.ByID(2590614085) as any; + let $typingPromise = $resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + $result[2] = $$createType2($result[2]); + $result[3] = $$createType3($result[3]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(773650321) as any; + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = nobindingshere$0.Person.createFrom; +const $$createType1 = nobindingshere$0.Impersonator.createFrom; +const $$createType2 = nobindingshere$0.HowDifferent.createFrom($Create.Any); +const $$createType3 = nobindingshere$0.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts new file mode 100644 index 00000000000..bc41b196900 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet($0: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, $0) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts new file mode 100644 index 00000000000..e69bebf3b18 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as EmbedOther from "./embedother.js"; +import * as EmbedService from "./embedservice.js"; +import * as GreetService from "./greetservice.js"; +export { + EmbedOther, + EmbedService, + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts new file mode 100644 index 00000000000..d1d012ca6d6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts new file mode 100644 index 00000000000..5c4ebea4fb9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts new file mode 100644 index 00000000000..440643194cb --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Hello(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4249972365) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts new file mode 100644 index 00000000000..d1d012ca6d6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts new file mode 100644 index 00000000000..5c4ebea4fb9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts new file mode 100644 index 00000000000..440643194cb --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Hello(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4249972365) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts new file mode 100644 index 00000000000..e7d00d45931 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts new file mode 100644 index 00000000000..dc2b13dc557 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts @@ -0,0 +1,39 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts new file mode 100644 index 00000000000..14324bde5ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts new file mode 100644 index 00000000000..94277382646 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(3568225479) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts new file mode 100644 index 00000000000..4e806917bb7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts @@ -0,0 +1,260 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +export function ArrayInt($in: number[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3862002418, $in) as any; + return $resultPromise; +} + +export function BoolInBoolOut($in: boolean): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2424639793, $in) as any; + return $resultPromise; +} + +export function Float32InFloat32Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3132595881, $in) as any; + return $resultPromise; +} + +export function Float64InFloat64Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2182412247, $in) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +export function Int16InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3306292566, $in) as any; + return $resultPromise; +} + +export function Int16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1754277916, $in) as any; + return $resultPromise; +} + +export function Int32InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1909469092, $in) as any; + return $resultPromise; +} + +export function Int32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4251088558, $in) as any; + return $resultPromise; +} + +export function Int64InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1343888303, $in) as any; + return $resultPromise; +} + +export function Int64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2205561041, $in) as any; + return $resultPromise; +} + +export function Int8InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(572240879, $in) as any; + return $resultPromise; +} + +export function Int8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2189402897, $in) as any; + return $resultPromise; +} + +export function IntInIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(642881729, $in) as any; + return $resultPromise; +} + +export function IntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1066151743, $in) as any; + return $resultPromise; +} + +export function IntPointerInputNamedOutputs($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2718999663, $in) as any; + return $resultPromise; +} + +export function MapIntInt($in: { [_: `${number}`]: number }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2386486356, $in) as any; + return $resultPromise; +} + +export function MapIntPointerInt($in: { [_: string]: number }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(550413585, $in) as any; + return $resultPromise; +} + +export function MapIntSliceInt($in: { [_: `${number}`]: number[] }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2900172572, $in) as any; + return $resultPromise; +} + +export function MapIntSliceIntInMapIntSliceIntOut($in: { [_: `${number}`]: number[] }): Promise<{ [_: `${number}`]: number[] }> & { cancel(): void } { + let $resultPromise = $Call.ByID(881980169, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function NoInputsStringOut(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1075577233) as any; + return $resultPromise; +} + +export function PointerBoolInBoolOut($in: boolean | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3589606958, $in) as any; + return $resultPromise; +} + +export function PointerFloat32InFloat32Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(224675106, $in) as any; + return $resultPromise; +} + +export function PointerFloat64InFloat64Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2124953624, $in) as any; + return $resultPromise; +} + +export function PointerMapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3516977899, $in) as any; + return $resultPromise; +} + +export function PointerStringInStringOut($in: string | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(229603958, $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutput($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3678582682, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputNamedOutputs($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(319259595, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputStringArrayOut($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(383995060, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputStringOut($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1091960237, $in) as any; + return $resultPromise; +} + +export function StructInputStructOutput($in: $models.Person): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByID(3835643147, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType3($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StructPointerInputErrorOutput($in: $models.Person | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2447692557, $in) as any; + return $resultPromise; +} + +export function StructPointerInputStructPointerOutput($in: $models.Person | null): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(2943477349, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType4($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function UInt16InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3401034892, $in) as any; + return $resultPromise; +} + +export function UInt16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1236957573, $in) as any; + return $resultPromise; +} + +export function UInt32InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1160383782, $in) as any; + return $resultPromise; +} + +export function UInt32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1739300671, $in) as any; + return $resultPromise; +} + +export function UInt64InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(793803239, $in) as any; + return $resultPromise; +} + +export function UInt64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1403757716, $in) as any; + return $resultPromise; +} + +export function UInt8InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2988345717, $in) as any; + return $resultPromise; +} + +export function UInt8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(518250834, $in) as any; + return $resultPromise; +} + +export function UIntInUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2836661285, $in) as any; + return $resultPromise; +} + +export function UIntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1367187362, $in) as any; + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Map($Create.Any, $$createType0); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $models.Person.createFrom; +const $$createType4 = $Create.Nullable($$createType3); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts new file mode 100644 index 00000000000..d9cb7b58cb3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts @@ -0,0 +1,41 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + this["Parent"] = null; + } + if (!("Details" in $$source)) { + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts new file mode 100644 index 00000000000..4e806917bb7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts @@ -0,0 +1,260 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +export function ArrayInt($in: number[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3862002418, $in) as any; + return $resultPromise; +} + +export function BoolInBoolOut($in: boolean): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2424639793, $in) as any; + return $resultPromise; +} + +export function Float32InFloat32Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3132595881, $in) as any; + return $resultPromise; +} + +export function Float64InFloat64Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2182412247, $in) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +export function Int16InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3306292566, $in) as any; + return $resultPromise; +} + +export function Int16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1754277916, $in) as any; + return $resultPromise; +} + +export function Int32InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1909469092, $in) as any; + return $resultPromise; +} + +export function Int32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4251088558, $in) as any; + return $resultPromise; +} + +export function Int64InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1343888303, $in) as any; + return $resultPromise; +} + +export function Int64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2205561041, $in) as any; + return $resultPromise; +} + +export function Int8InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(572240879, $in) as any; + return $resultPromise; +} + +export function Int8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2189402897, $in) as any; + return $resultPromise; +} + +export function IntInIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(642881729, $in) as any; + return $resultPromise; +} + +export function IntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1066151743, $in) as any; + return $resultPromise; +} + +export function IntPointerInputNamedOutputs($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2718999663, $in) as any; + return $resultPromise; +} + +export function MapIntInt($in: { [_: `${number}`]: number }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2386486356, $in) as any; + return $resultPromise; +} + +export function MapIntPointerInt($in: { [_: string]: number }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(550413585, $in) as any; + return $resultPromise; +} + +export function MapIntSliceInt($in: { [_: `${number}`]: number[] }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2900172572, $in) as any; + return $resultPromise; +} + +export function MapIntSliceIntInMapIntSliceIntOut($in: { [_: `${number}`]: number[] }): Promise<{ [_: `${number}`]: number[] }> & { cancel(): void } { + let $resultPromise = $Call.ByID(881980169, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function NoInputsStringOut(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1075577233) as any; + return $resultPromise; +} + +export function PointerBoolInBoolOut($in: boolean | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3589606958, $in) as any; + return $resultPromise; +} + +export function PointerFloat32InFloat32Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(224675106, $in) as any; + return $resultPromise; +} + +export function PointerFloat64InFloat64Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2124953624, $in) as any; + return $resultPromise; +} + +export function PointerMapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3516977899, $in) as any; + return $resultPromise; +} + +export function PointerStringInStringOut($in: string | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(229603958, $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutput($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3678582682, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputNamedOutputs($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(319259595, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputStringArrayOut($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(383995060, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputStringOut($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1091960237, $in) as any; + return $resultPromise; +} + +export function StructInputStructOutput($in: $models.Person): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByID(3835643147, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType3($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StructPointerInputErrorOutput($in: $models.Person | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2447692557, $in) as any; + return $resultPromise; +} + +export function StructPointerInputStructPointerOutput($in: $models.Person | null): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(2943477349, $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType4($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function UInt16InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3401034892, $in) as any; + return $resultPromise; +} + +export function UInt16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1236957573, $in) as any; + return $resultPromise; +} + +export function UInt32InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1160383782, $in) as any; + return $resultPromise; +} + +export function UInt32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1739300671, $in) as any; + return $resultPromise; +} + +export function UInt64InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(793803239, $in) as any; + return $resultPromise; +} + +export function UInt64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1403757716, $in) as any; + return $resultPromise; +} + +export function UInt8InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2988345717, $in) as any; + return $resultPromise; +} + +export function UInt8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(518250834, $in) as any; + return $resultPromise; +} + +export function UIntInUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2836661285, $in) as any; + return $resultPromise; +} + +export function UIntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1367187362, $in) as any; + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Map($Create.Any, $$createType0); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $models.Person.createFrom; +const $$createType4 = $Create.Nullable($$createType3); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts new file mode 100644 index 00000000000..d9cb7b58cb3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts @@ -0,0 +1,41 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + this["Parent"] = null; + } + if (!("Details" in $$source)) { + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts new file mode 100644 index 00000000000..60f87929dc4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts new file mode 100644 index 00000000000..60f87929dc4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts new file mode 100644 index 00000000000..e7d00d45931 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts new file mode 100644 index 00000000000..6e6a9fb7f31 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts new file mode 100644 index 00000000000..14324bde5ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts new file mode 100644 index 00000000000..cbdf9faf913 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1491748400) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts new file mode 100644 index 00000000000..90b3dc0ea0e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts @@ -0,0 +1,60 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Get someone + */ +export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Get", aliasValue) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType0($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Get someone quite different + */ +export function GetButDifferent(): Promise<$models.GenericPerson> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.GetButDifferent") as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * Greet a lot of unusual things. + */ +export function Greet($0: $models.EmptyAliasStruct, $1: $models.EmptyStruct): Promise<$models.AliasStruct> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", $0, $1) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType5($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $models.GenericPerson.createFrom($Create.Any); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $Create.Array($Create.Any); +const $$createType4 = $Create.Struct({ + "NoMoreIdeas": $$createType3, +}); +const $$createType5 = $Create.Struct({ + "Foo": $$createType2, + "Other": $$createType4, +}); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts new file mode 100644 index 00000000000..e3befd52d7b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts @@ -0,0 +1,135 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias + */ +export type Alias = number; + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + */ +export interface AliasStruct { + /** + * A field with a comment. + */ + "Foo": number[]; + + /** + * Definitely not Foo. + */ + "Bar"?: string; + "Baz"?: string; + + /** + * A nested alias struct. + */ + "Other": OtherAliasStruct; +} + +/** + * An empty struct alias. + */ +export interface EmptyAliasStruct { +} + +/** + * An empty struct. + */ +export class EmptyStruct { + + /** Creates a new EmptyStruct instance. */ + constructor($$source: Partial = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new EmptyStruct instance from a string or object. + */ + static createFrom($$source: any = {}): EmptyStruct { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new EmptyStruct($$parsedSource as Partial); + } +} + +/** + * A generic struct containing an alias + */ +export class GenericPerson { + "Name": T | null; + "AliasedField": Alias; + + /** Creates a new GenericPerson instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = null; + } + if (!("AliasedField" in $$source)) { + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class GenericPerson. + */ + static createFrom($$createParamT: (any) => T): ($$source?: any) => GenericPerson { + const $$createField0_0 = $$createParamT; + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Name" in $$parsedSource) { + $$parsedSource["Name"] = $$createField0_0($$parsedSource["Name"]); + } + return new GenericPerson($$parsedSource as Partial>); + }; + } +} + +/** + * Another struct alias. + */ +export interface OtherAliasStruct { + "NoMoreIdeas": number[]; +} + +/** + * A non-generic struct containing an alias. + */ +export class Person { + /** + * The Person's name. + */ + "Name": string; + + /** + * A random alias field. + */ + "AliasedField": Alias; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("AliasedField" in $$source)) { + this["AliasedField"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts new file mode 100644 index 00000000000..bdcf43c67f9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as Service7 from "./service7.js"; +import * as Service9 from "./service9.js"; +export { + Service7, + Service9 +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts new file mode 100644 index 00000000000..f0b146d44b0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function TestMethod(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config.Service7.TestMethod") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts new file mode 100644 index 00000000000..cd49d6458f4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function TestMethod2(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config.Service9.TestMethod2") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts new file mode 100644 index 00000000000..ce433f40e03 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(person: $models.Person, emb: $models.Embedded1): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", person, emb) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts new file mode 100644 index 00000000000..56a71ecef91 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts @@ -0,0 +1,38 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class embedded4 { + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * Friends should not be shadowed in Person as embedded4 is not embedded + * from encoding/json's point of view; + * however, it should be shadowed in Embedded1 + */ + "Friends": boolean; + + /** Creates a new embedded4 instance. */ + constructor($$source: Partial = {}) { + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + if (!("Friends" in $$source)) { + this["Friends"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new embedded4 instance from a string or object. + */ + static createFrom($$source: any = {}): embedded4 { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new embedded4($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts new file mode 100644 index 00000000000..3c10011486d --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts @@ -0,0 +1,203 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as $internal from "./internal.js"; + +export class Embedded1 { + /** + * Friends should be shadowed in Person by a field of lesser depth + */ + "Friends": number; + + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + */ + "Vanish": number; + + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + */ + "StillThere": string; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** Creates a new Embedded1 instance. */ + constructor($$source: Partial = {}) { + if (!("Friends" in $$source)) { + this["Friends"] = 0; + } + if (!("Vanish" in $$source)) { + this["Vanish"] = 0; + } + if (!("StillThere" in $$source)) { + this["StillThere"] = ""; + } + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Embedded1 instance from a string or object. + */ + static createFrom($$source: any = {}): Embedded1 { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Embedded1($$parsedSource as Partial); + } +} + +export type Embedded3 = string; + +/** + * Person represents a person + */ +export class Person { + /** + * Titles is optional in JSON + */ + "Titles"?: Title[]; + + /** + * Names has a + * multiline comment + */ + "Names": string[]; + + /** + * Partner has a custom and complex JSON key + */ + "Partner": Person | null; + "Friends": (Person | null)[]; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + */ + "StillThere": Embedded3 | null; + + /** + * StrangeNumber maps to "-" + */ + "-": number; + + /** + * Embedded3 should appear with key "Embedded3" + */ + "Embedded3": Embedded3; + + /** + * StrangerNumber is serialized as a string + */ + "StrangerNumber": `${number}`; + + /** + * StrangestString is optional and serialized as a JSON string + */ + "StrangestString"?: `"${string}"`; + + /** + * StringStrangest is serialized as a JSON string and optional + */ + "StringStrangest"?: `"${string}"`; + + /** + * embedded4 should be optional and appear with key "emb4" + */ + "emb4"?: $internal.embedded4; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Names" in $$source)) { + this["Names"] = []; + } + if (!("Partner" in $$source)) { + this["Partner"] = null; + } + if (!("Friends" in $$source)) { + this["Friends"] = []; + } + if (!("NamingThingsIsHard" in $$source)) { + this["NamingThingsIsHard"] = "false"; + } + if (!("StillThere" in $$source)) { + this["StillThere"] = null; + } + if (!("-" in $$source)) { + this["-"] = 0; + } + if (!("Embedded3" in $$source)) { + this["Embedded3"] = ("" as Embedded3); + } + if (!("StrangerNumber" in $$source)) { + this["StrangerNumber"] = "0"; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType1; + const $$createField2_0 = $$createType3; + const $$createField3_0 = $$createType4; + const $$createField11_0 = $$createType5; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Titles" in $$parsedSource) { + $$parsedSource["Titles"] = $$createField0_0($$parsedSource["Titles"]); + } + if ("Names" in $$parsedSource) { + $$parsedSource["Names"] = $$createField1_0($$parsedSource["Names"]); + } + if ("Partner" in $$parsedSource) { + $$parsedSource["Partner"] = $$createField2_0($$parsedSource["Partner"]); + } + if ("Friends" in $$parsedSource) { + $$parsedSource["Friends"] = $$createField3_0($$parsedSource["Friends"]); + } + if ("emb4" in $$parsedSource) { + $$parsedSource["emb4"] = $$createField11_0($$parsedSource["emb4"]); + } + return new Person($$parsedSource as Partial); + } +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = Person.createFrom; +const $$createType3 = $Create.Nullable($$createType2); +const $$createType4 = $Create.Array($$createType3); +const $$createType5 = $internal.embedded4.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts new file mode 100644 index 00000000000..38133fbcbaa --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts @@ -0,0 +1,31 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * It has a multiline doc comment + * The comment has even some * / traps!! + */ +export function Greet(str: string, people: $models.Person[], $2: {"AnotherCount": number, "AnotherOne": $models.Person | null}, assoc: { [_: `${number}`]: boolean | null }, $4: (number | null)[], ...other: string[]): Promise<[$models.Person, any, number[]]> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", str, people, $2, assoc, $4, other) as any; + let $typingPromise = $resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[2] = $$createType1($result[2]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Array($Create.Any); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts new file mode 100644 index 00000000000..76d1e60b28c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts new file mode 100644 index 00000000000..d9c863ce0a1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts @@ -0,0 +1,62 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Make a cycle. + */ +export function MakeCycles(): Promise<[$models.Cyclic, $models.GenericCyclic<$models.GenericCyclic>]> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MakeCycles") as any; + let $typingPromise = $resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType9($result[1]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +var $$createType0 = (function $$initCreateType0(...args): any { + if ($$createType0 === $$initCreateType0) { + $$createType0 = $$createType3; + } + return $$createType0(...args); +}); +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = $Create.Map($Create.Any, $$createType1); +const $$createType3 = $Create.Array($$createType2); +var $$createType4 = (function $$initCreateType4(...args): any { + if ($$createType4 === $$initCreateType4) { + $$createType4 = $$createType8; + } + return $$createType4(...args); +}); +const $$createType5 = $Create.Nullable($$createType4); +const $$createType6 = $Create.Array($Create.Any); +const $$createType7 = $Create.Struct({ + "X": $$createType5, + "Y": $$createType6, +}); +const $$createType8 = $Create.Array($$createType7); +var $$createType9 = (function $$initCreateType9(...args): any { + if ($$createType9 === $$initCreateType9) { + $$createType9 = $$createType13; + } + return $$createType9(...args); +}); +const $$createType10 = $Create.Nullable($$createType9); +const $$createType11 = $Create.Array($$createType4); +const $$createType12 = $Create.Struct({ + "X": $$createType10, + "Y": $$createType11, +}); +const $$createType13 = $Create.Array($$createType12); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts new file mode 100644 index 00000000000..b2b94f97df0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export type Alias = Cyclic | null; + +export type Cyclic = { [_: string]: Alias }[]; + +export type GenericCyclic = {"X": GenericCyclic | null, "Y": (T | null)[]}[]; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts new file mode 100644 index 00000000000..50e515b25e6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts @@ -0,0 +1,50 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Comment 1. + */ +export function Method1(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method1") as any; + return $resultPromise; +} + +/** + * Comment 2. + */ +export function Method2(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method2") as any; + return $resultPromise; +} + +/** + * Comment 3a. + * Comment 3b. + */ +export function Method3(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method3") as any; + return $resultPromise; +} + +/** + * Comment 4. + */ +export function Method4(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method4") as any; + return $resultPromise; +} + +/** + * Comment 5. + */ +export function Method5(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method5") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts new file mode 100644 index 00000000000..68e09a546d5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string, title: $models.Title): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name, title) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts new file mode 100644 index 00000000000..b58750ea7e0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts @@ -0,0 +1,51 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export class Person { + "Title": Title; + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Title" in $$source)) { + this["Title"] = ("" as Title); + } + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts new file mode 100644 index 00000000000..a51bd126abf --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string, title: services$0.Title): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name, title) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts new file mode 100644 index 00000000000..c9d993ab756 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts @@ -0,0 +1,4 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/v3/internal/parser/testdata/enum/frontend/bindings/main/models.interfaces.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts similarity index 53% rename from v3/internal/parser/testdata/enum/frontend/bindings/main/models.interfaces.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts index 85955ba5b1c..f7a68a98d81 100644 --- a/v3/internal/parser/testdata/enum/frontend/bindings/main/models.interfaces.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts @@ -1,19 +1,20 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -// Title is a title +import {Create as $Create} from "/wails/runtime.js"; + export enum Title { - // Mister is a title + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ Mister = "Mr", Miss = "Miss", Ms = "Ms", Mrs = "Mrs", Dr = "Dr", -} - -// Person represents a person -export interface Person { - title: Title; - name: string; -} +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts new file mode 100644 index 00000000000..b50aa339c4f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts new file mode 100644 index 00000000000..56ae1b7821f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts @@ -0,0 +1,42 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts new file mode 100644 index 00000000000..14324bde5ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts new file mode 100644 index 00000000000..9e4a1217c31 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services.OtherService.Yay") as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts new file mode 100644 index 00000000000..b50aa339c4f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts new file mode 100644 index 00000000000..ea08f0f6633 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts @@ -0,0 +1,39 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./services/other/models.js"; + +export class Person { + "Name": string; + "Address": other$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = other$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts new file mode 100644 index 00000000000..14324bde5ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts new file mode 100644 index 00000000000..ff12324294b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other.OtherService.Yay") as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts new file mode 100644 index 00000000000..f9fb9fb2a81 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts new file mode 100644 index 00000000000..bb1bf7f89a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts new file mode 100644 index 00000000000..8dcfdefcb50 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts @@ -0,0 +1,25 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function GreetWithContext(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.GreetWithContext", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts new file mode 100644 index 00000000000..6bd662438dc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as SomeMethods from "./somemethods.js"; +export { + SomeMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts new file mode 100644 index 00000000000..c90bb2519a9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts @@ -0,0 +1,36 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class personImpl { + /** + * Nickname conceals a person's identity. + */ + "Nickname": string; + + /** + * They have a name. + */ + "Name": string; + + /** Creates a new personImpl instance. */ + constructor($$source: Partial = {}) { + if (!("Nickname" in $$source)) { + this["Nickname"] = ""; + } + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new personImpl instance from a string or object. + */ + static createFrom($$source: any = {}): personImpl { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new personImpl($$parsedSource as Partial); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts new file mode 100644 index 00000000000..0378dfc3187 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts @@ -0,0 +1,103 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./other/models.js"; + +import * as $internal from "./internal.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + */ +export class HowDifferent { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": { [_: string]: How | null }[]; + + /** Creates a new HowDifferent instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class HowDifferent. + */ + static createFrom($$createParamHow: (any) => How): ($$source?: any) => HowDifferent { + const $$createField1_0 = $$createType1($$createParamHow); + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new HowDifferent($$parsedSource as Partial>); + }; + } +} + +/** + * Impersonator gets their fields from other people. + */ +export const Impersonator = other$0.OtherPerson; + +/** + * Impersonator gets their fields from other people. + */ +export type Impersonator = other$0.OtherPerson; + +/** + * Person is not a number. + */ +export class Person { + /** + * They have a name. + */ + "Name": string; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Person($$parsedSource as Partial); + } +} + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export const PrivatePerson = $internal.personImpl; + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export type PrivatePerson = $internal.personImpl; + +// Private type creation functions +const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow); +const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow)); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts new file mode 100644 index 00000000000..9e85cc3c871 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherMethods from "./othermethods.js"; +export { + OtherMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts new file mode 100644 index 00000000000..73392af9c27 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts @@ -0,0 +1,50 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + */ +export class OtherPerson { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": (T | null)[]; + + /** Creates a new OtherPerson instance. */ + constructor($$source: Partial> = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Differences" in $$source)) { + this["Differences"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Given creation functions for each type parameter, + * returns a creation function for a concrete instance + * of the generic class OtherPerson. + */ + static createFrom($$createParamT: (any) => T): ($$source?: any) => OtherPerson { + const $$createField1_0 = $$createType0($$createParamT); + return ($$source: any = {}) => { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Differences" in $$parsedSource) { + $$parsedSource["Differences"] = $$createField1_0($$parsedSource["Differences"]); + } + return new OtherPerson($$parsedSource as Partial>); + }; + } +} + +// Private type creation functions +const $$createType0 = ($$createParamT) => $Create.Array($$createParamT); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts new file mode 100644 index 00000000000..4f22e87c6e5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherMethods has another method, but through a private embedded type. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other.OtherMethods.LikeThisOtherOne") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts new file mode 100644 index 00000000000..835e3cec109 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts @@ -0,0 +1,41 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * SomeMethods exports some methods. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * LikeThisOne is an example method that does nothing. + */ +export function LikeThisOne(): Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOne") as any; + let $typingPromise = $resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + $result[2] = $$createType2($result[2]); + $result[3] = $$createType3($result[3]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOtherOne") as any; + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $models.Impersonator.createFrom; +const $$createType2 = $models.HowDifferent.createFrom($Create.Any); +const $$createType3 = $models.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts new file mode 100644 index 00000000000..b0f953ecbed --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedOther is even trickier. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.EmbedOther.LikeThisOtherOne") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts new file mode 100644 index 00000000000..3f39aa33e46 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts @@ -0,0 +1,41 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedService is tricky. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as nobindingshere$0 from "../no_bindings_here/models.js"; + +/** + * LikeThisOne is an example method that does nothing. + */ +export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.EmbedService.LikeThisOne") as any; + let $typingPromise = $resultPromise.then(($result) => { + $result[0] = $$createType0($result[0]); + $result[1] = $$createType1($result[1]); + $result[2] = $$createType2($result[2]); + $result[3] = $$createType3($result[3]); + return $result; + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.EmbedService.LikeThisOtherOne") as any; + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = nobindingshere$0.Person.createFrom; +const $$createType1 = nobindingshere$0.Impersonator.createFrom; +const $$createType2 = nobindingshere$0.HowDifferent.createFrom($Create.Any); +const $$createType3 = nobindingshere$0.PrivatePerson.createFrom; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts new file mode 100644 index 00000000000..bd147ce2bc6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet($0: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", $0) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts new file mode 100644 index 00000000000..e69bebf3b18 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as EmbedOther from "./embedother.js"; +import * as EmbedService from "./embedservice.js"; +import * as GreetService from "./greetservice.js"; +export { + EmbedOther, + EmbedService, + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts new file mode 100644 index 00000000000..f9fb9fb2a81 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts new file mode 100644 index 00000000000..5c4ebea4fb9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts new file mode 100644 index 00000000000..53f0f71cdbc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Hello(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.OtherService.Hello") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts new file mode 100644 index 00000000000..f9fb9fb2a81 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts new file mode 100644 index 00000000000..5c4ebea4fb9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts new file mode 100644 index 00000000000..53f0f71cdbc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Hello(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.OtherService.Hello") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts new file mode 100644 index 00000000000..b50aa339c4f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts new file mode 100644 index 00000000000..dc2b13dc557 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts @@ -0,0 +1,39 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts new file mode 100644 index 00000000000..14324bde5ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts new file mode 100644 index 00000000000..2f44d1c9e85 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services.OtherService.Yay") as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts new file mode 100644 index 00000000000..26043dc306f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts @@ -0,0 +1,260 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +export function ArrayInt($in: number[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.ArrayInt", $in) as any; + return $resultPromise; +} + +export function BoolInBoolOut($in: boolean): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.BoolInBoolOut", $in) as any; + return $resultPromise; +} + +export function Float32InFloat32Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Float32InFloat32Out", $in) as any; + return $resultPromise; +} + +export function Float64InFloat64Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Float64InFloat64Out", $in) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +export function Int16InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int16InIntOut", $in) as any; + return $resultPromise; +} + +export function Int16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int16PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int32InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int32InIntOut", $in) as any; + return $resultPromise; +} + +export function Int32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int32PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int64InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int64InIntOut", $in) as any; + return $resultPromise; +} + +export function Int64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int64PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int8InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int8InIntOut", $in) as any; + return $resultPromise; +} + +export function Int8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int8PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function IntInIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntInIntOut", $in) as any; + return $resultPromise; +} + +export function IntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntPointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function IntPointerInputNamedOutputs($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntPointerInputNamedOutputs", $in) as any; + return $resultPromise; +} + +export function MapIntInt($in: { [_: `${number}`]: number }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntInt", $in) as any; + return $resultPromise; +} + +export function MapIntPointerInt($in: { [_: string]: number }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntPointerInt", $in) as any; + return $resultPromise; +} + +export function MapIntSliceInt($in: { [_: `${number}`]: number[] }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntSliceInt", $in) as any; + return $resultPromise; +} + +export function MapIntSliceIntInMapIntSliceIntOut($in: { [_: `${number}`]: number[] }): Promise<{ [_: `${number}`]: number[] }> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function NoInputsStringOut(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NoInputsStringOut") as any; + return $resultPromise; +} + +export function PointerBoolInBoolOut($in: boolean | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerBoolInBoolOut", $in) as any; + return $resultPromise; +} + +export function PointerFloat32InFloat32Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerFloat32InFloat32Out", $in) as any; + return $resultPromise; +} + +export function PointerFloat64InFloat64Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerFloat64InFloat64Out", $in) as any; + return $resultPromise; +} + +export function PointerMapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerMapIntInt", $in) as any; + return $resultPromise; +} + +export function PointerStringInStringOut($in: string | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerStringInStringOut", $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutput($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputNamedOutput", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputNamedOutputs($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputNamedOutputs", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputStringArrayOut($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputStringArrayOut", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputStringOut($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputStringOut", $in) as any; + return $resultPromise; +} + +export function StructInputStructOutput($in: $models.Person): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructInputStructOutput", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType3($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StructPointerInputErrorOutput($in: $models.Person | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructPointerInputErrorOutput", $in) as any; + return $resultPromise; +} + +export function StructPointerInputStructPointerOutput($in: $models.Person | null): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType4($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function UInt16InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt16InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt16PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt32InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt32InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt32PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt64InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt64InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt64PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt8InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt8InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt8PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UIntInUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UIntInUIntOut", $in) as any; + return $resultPromise; +} + +export function UIntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UIntPointerInAndOutput", $in) as any; + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Map($Create.Any, $$createType0); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $models.Person.createFrom; +const $$createType4 = $Create.Nullable($$createType3); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts new file mode 100644 index 00000000000..d9cb7b58cb3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts @@ -0,0 +1,41 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + this["Parent"] = null; + } + if (!("Details" in $$source)) { + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts new file mode 100644 index 00000000000..26043dc306f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts @@ -0,0 +1,260 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +export function ArrayInt($in: number[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.ArrayInt", $in) as any; + return $resultPromise; +} + +export function BoolInBoolOut($in: boolean): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.BoolInBoolOut", $in) as any; + return $resultPromise; +} + +export function Float32InFloat32Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Float32InFloat32Out", $in) as any; + return $resultPromise; +} + +export function Float64InFloat64Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Float64InFloat64Out", $in) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +export function Int16InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int16InIntOut", $in) as any; + return $resultPromise; +} + +export function Int16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int16PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int32InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int32InIntOut", $in) as any; + return $resultPromise; +} + +export function Int32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int32PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int64InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int64InIntOut", $in) as any; + return $resultPromise; +} + +export function Int64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int64PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int8InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int8InIntOut", $in) as any; + return $resultPromise; +} + +export function Int8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int8PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function IntInIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntInIntOut", $in) as any; + return $resultPromise; +} + +export function IntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntPointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function IntPointerInputNamedOutputs($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntPointerInputNamedOutputs", $in) as any; + return $resultPromise; +} + +export function MapIntInt($in: { [_: `${number}`]: number }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntInt", $in) as any; + return $resultPromise; +} + +export function MapIntPointerInt($in: { [_: string]: number }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntPointerInt", $in) as any; + return $resultPromise; +} + +export function MapIntSliceInt($in: { [_: `${number}`]: number[] }): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntSliceInt", $in) as any; + return $resultPromise; +} + +export function MapIntSliceIntInMapIntSliceIntOut($in: { [_: `${number}`]: number[] }): Promise<{ [_: `${number}`]: number[] }> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function NoInputsStringOut(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NoInputsStringOut") as any; + return $resultPromise; +} + +export function PointerBoolInBoolOut($in: boolean | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerBoolInBoolOut", $in) as any; + return $resultPromise; +} + +export function PointerFloat32InFloat32Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerFloat32InFloat32Out", $in) as any; + return $resultPromise; +} + +export function PointerFloat64InFloat64Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerFloat64InFloat64Out", $in) as any; + return $resultPromise; +} + +export function PointerMapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerMapIntInt", $in) as any; + return $resultPromise; +} + +export function PointerStringInStringOut($in: string | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerStringInStringOut", $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutput($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputNamedOutput", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputNamedOutputs($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputNamedOutputs", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputStringArrayOut($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputStringArrayOut", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StringArrayInputStringOut($in: string[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputStringOut", $in) as any; + return $resultPromise; +} + +export function StructInputStructOutput($in: $models.Person): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructInputStructOutput", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType3($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function StructPointerInputErrorOutput($in: $models.Person | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructPointerInputErrorOutput", $in) as any; + return $resultPromise; +} + +export function StructPointerInputStructPointerOutput($in: $models.Person | null): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", $in) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType4($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +export function UInt16InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt16InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt16PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt32InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt32InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt32PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt64InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt64InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt64PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt8InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt8InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt8PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UIntInUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UIntInUIntOut", $in) as any; + return $resultPromise; +} + +export function UIntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UIntPointerInAndOutput", $in) as any; + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $Create.Array($Create.Any); +const $$createType1 = $Create.Map($Create.Any, $$createType0); +const $$createType2 = $Create.Array($Create.Any); +const $$createType3 = $models.Person.createFrom; +const $$createType4 = $Create.Nullable($$createType3); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts new file mode 100644 index 00000000000..d9cb7b58cb3 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts @@ -0,0 +1,41 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Parent" in $$source)) { + this["Parent"] = null; + } + if (!("Details" in $$source)) { + this["Details"] = {"Age": 0, "Address": {"Street": ""}}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Parent" in $$parsedSource) { + $$parsedSource["Parent"] = $$createField1_0($$parsedSource["Parent"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts new file mode 100644 index 00000000000..bb1bf7f89a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts new file mode 100644 index 00000000000..bb1bf7f89a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts new file mode 100644 index 00000000000..b50aa339c4f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Person.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts new file mode 100644 index 00000000000..6e6a9fb7f31 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts @@ -0,0 +1,43 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export class Person { + "Name": string; + "Address": services$0.Address | null; + + /** Creates a new Person instance. */ + constructor($$source: Partial = {}) { + if (!("Name" in $$source)) { + this["Name"] = ""; + } + if (!("Address" in $$source)) { + this["Address"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Person instance from a string or object. + */ + static createFrom($$source: any = {}): Person { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Address" in $$parsedSource) { + $$parsedSource["Address"] = $$createField1_0($$parsedSource["Address"]); + } + return new Person($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = services$0.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts new file mode 100644 index 00000000000..14324bde5ff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts @@ -0,0 +1,33 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export class Address { + "Street": string; + "State": string; + "Country": string; + + /** Creates a new Address instance. */ + constructor($$source: Partial
= {}) { + if (!("Street" in $$source)) { + this["Street"] = ""; + } + if (!("State" in $$source)) { + this["State"] = ""; + } + if (!("Country" in $$source)) { + this["Country"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Address instance from a string or object. + */ + static createFrom($$source: any = {}): Address { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Address($$parsedSource as Partial
); + } +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts new file mode 100644 index 00000000000..023381f92c7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=false/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts @@ -0,0 +1,28 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services.OtherService.Yay") as any; + let $typingPromise = $resultPromise.then(($result) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +// Private type creation functions +const $$createType0 = $models.Address.createFrom; +const $$createType1 = $Create.Nullable($$createType0); diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts new file mode 100644 index 00000000000..9d5ab2994d4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Get someone + */ +export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByID(1928502664, aliasValue) as any; + return $resultPromise; +} + +/** + * Get someone quite different + */ +export function GetButDifferent(): Promise<$models.GenericPerson> & { cancel(): void } { + let $resultPromise = $Call.ByID(2240931744) as any; + return $resultPromise; +} + +/** + * Greet a lot of unusual things. + */ +export function Greet($0: $models.EmptyAliasStruct, $1: $models.EmptyStruct): Promise<$models.AliasStruct> & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, $0, $1) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts new file mode 100644 index 00000000000..d718d9c2095 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts @@ -0,0 +1,73 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias + */ +export type Alias = number; + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + */ +export interface AliasStruct { + /** + * A field with a comment. + */ + "Foo": number[] | null; + + /** + * Definitely not Foo. + */ + "Bar"?: string; + "Baz"?: string; + + /** + * A nested alias struct. + */ + "Other": OtherAliasStruct; +} + +/** + * An empty struct alias. + */ +export interface EmptyAliasStruct { +} + +/** + * An empty struct. + */ +export interface EmptyStruct { +} + +/** + * A generic struct containing an alias + */ +export interface GenericPerson { + "Name": T | null; + "AliasedField": Alias; +} + +/** + * Another struct alias. + */ +export interface OtherAliasStruct { + "NoMoreIdeas": number[] | null; +} + +/** + * A non-generic struct containing an alias. + */ +export interface Person { + /** + * The Person's name. + */ + "Name": string; + + /** + * A random alias field. + */ + "AliasedField": Alias; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts new file mode 100644 index 00000000000..bdcf43c67f9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as Service7 from "./service7.js"; +import * as Service9 from "./service9.js"; +export { + Service7, + Service9 +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts new file mode 100644 index 00000000000..7cb45a8f91f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function TestMethod(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2241101727) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts new file mode 100644 index 00000000000..63b6c861d1b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function TestMethod2(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1556848345) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts new file mode 100644 index 00000000000..0cda8fb0cff --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(person: $models.Person, emb: $models.Embedded1): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, person, emb) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts new file mode 100644 index 00000000000..1a2a6e32bae --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts @@ -0,0 +1,18 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface embedded4 { + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * Friends should not be shadowed in Person as embedded4 is not embedded + * from encoding/json's point of view; + * however, it should be shadowed in Embedded1 + */ + "Friends": boolean; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts new file mode 100644 index 00000000000..b81d48d2f75 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts @@ -0,0 +1,111 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as $internal from "./internal.js"; + +export interface Embedded1 { + /** + * Friends should be shadowed in Person by a field of lesser depth + */ + "Friends": number; + + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + */ + "Vanish": number; + + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + */ + "StillThere": string; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; +} + +export type Embedded3 = string; + +/** + * Person represents a person + */ +export interface Person { + /** + * Titles is optional in JSON + */ + "Titles"?: Title[] | null; + + /** + * Names has a + * multiline comment + */ + "Names": string[] | null; + + /** + * Partner has a custom and complex JSON key + */ + "Partner": Person | null; + "Friends": (Person | null)[] | null; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + */ + "StillThere": Embedded3 | null; + + /** + * StrangeNumber maps to "-" + */ + "-": number; + + /** + * Embedded3 should appear with key "Embedded3" + */ + "Embedded3": Embedded3; + + /** + * StrangerNumber is serialized as a string + */ + "StrangerNumber": `${number}`; + + /** + * StrangestString is optional and serialized as a JSON string + */ + "StrangestString"?: `"${string}"`; + + /** + * StringStrangest is serialized as a JSON string and optional + */ + "StringStrangest"?: `"${string}"`; + + /** + * embedded4 should be optional and appear with key "emb4" + */ + "emb4"?: $internal.embedded4; +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts new file mode 100644 index 00000000000..b4cb1734fd6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts @@ -0,0 +1,21 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * It has a multiline doc comment + * The comment has even some * / traps!! + */ +export function Greet(str: string, people: $models.Person[] | null, $2: {"AnotherCount": number, "AnotherOne": $models.Person | null}, assoc: { [_: `${number}`]: boolean | null } | null, $4: (number | null)[] | null, ...other: string[]): Promise<[$models.Person, any, number[] | null]> & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, str, people, $2, assoc, $4, other) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/models.interfaces.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts similarity index 56% rename from v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/models.interfaces.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts index ec779d0cf74..d3089cbb069 100644 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/models.interfaces.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts @@ -1,10 +1,11 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -import * as services from "../services/models"; +import {Create as $Create} from "/wails/runtime.js"; +/** + * Person represents a person + */ export interface Person { - name: string; - address: services.Address; + "Name": string; } diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts new file mode 100644 index 00000000000..2849c70189c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Make a cycle. + */ +export function MakeCycles(): Promise<[$models.Cyclic, $models.GenericCyclic<$models.GenericCyclic>]> & { cancel(): void } { + let $resultPromise = $Call.ByID(440020721) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts new file mode 100644 index 00000000000..a3edc152171 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export type Alias = Cyclic | null; + +export type Cyclic = ({ [_: string]: Alias } | null)[] | null; + +export type GenericCyclic = {"X": GenericCyclic | null, "Y": (T | null)[] | null}[] | null; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts new file mode 100644 index 00000000000..81ed73ff7e6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts @@ -0,0 +1,50 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Comment 1. + */ +export function Method1(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(841558284) as any; + return $resultPromise; +} + +/** + * Comment 2. + */ +export function Method2(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(891891141) as any; + return $resultPromise; +} + +/** + * Comment 3a. + * Comment 3b. + */ +export function Method3(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(875113522) as any; + return $resultPromise; +} + +/** + * Comment 4. + */ +export function Method4(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(791225427) as any; + return $resultPromise; +} + +/** + * Comment 5. + */ +export function Method5(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(774447808) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts new file mode 100644 index 00000000000..1e3955d0bd1 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string, title: $models.Title): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name, title) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts new file mode 100644 index 00000000000..dabe6255472 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts @@ -0,0 +1,31 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export interface Person { + "Title": Title; + "Name": string; +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts new file mode 100644 index 00000000000..41ca9b98e65 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string, title: services$0.Title): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name, title) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts new file mode 100644 index 00000000000..c9d993ab756 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts @@ -0,0 +1,4 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts similarity index 53% rename from v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/services/models.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts index 29320703441..f7a68a98d81 100644 --- a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/services/models.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts @@ -1,12 +1,20 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +import {Create as $Create} from "/wails/runtime.js"; + export enum Title { - // Mister is a title + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ Mister = "Mr", Miss = "Miss", Ms = "Ms", Mrs = "Mrs", Dr = "Dr", -} +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts new file mode 100644 index 00000000000..43aeebed8de --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts new file mode 100644 index 00000000000..81f8d798243 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts @@ -0,0 +1,14 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts new file mode 100644 index 00000000000..dedcc9f08a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts new file mode 100644 index 00000000000..84c2fa398be --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts @@ -0,0 +1,20 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(2007737399) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts new file mode 100644 index 00000000000..43aeebed8de --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts new file mode 100644 index 00000000000..cf3f275b1ae --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./services/other/models.js"; + +export interface Person { + "Name": string; + "Address": other$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts new file mode 100644 index 00000000000..dedcc9f08a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts new file mode 100644 index 00000000000..23a26012ba7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts @@ -0,0 +1,20 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(2447353446) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts new file mode 100644 index 00000000000..d1d012ca6d6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts new file mode 100644 index 00000000000..60f87929dc4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts new file mode 100644 index 00000000000..3ca71aa32a0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts @@ -0,0 +1,25 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function GreetWithContext(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1310150960, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts new file mode 100644 index 00000000000..6bd662438dc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as SomeMethods from "./somemethods.js"; +export { + SomeMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts new file mode 100644 index 00000000000..44fdff84dc9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts @@ -0,0 +1,16 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface personImpl { + /** + * Nickname conceals a person's identity. + */ + "Nickname": string; + + /** + * They have a name. + */ + "Name": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts new file mode 100644 index 00000000000..5a11757a756 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts @@ -0,0 +1,34 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./other/models.js"; + +import * as $internal from "./internal.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + */ +export type HowDifferent = other$0.OtherPerson<{ [_: string]: How | null } | null>; + +/** + * Impersonator gets their fields from other people. + */ +export type Impersonator = other$0.OtherPerson; + +/** + * Person is not a number. + */ +export interface Person { + /** + * They have a name. + */ + "Name": string; +} + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export type PrivatePerson = $internal.personImpl; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts new file mode 100644 index 00000000000..9e85cc3c871 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherMethods from "./othermethods.js"; +export { + OtherMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts new file mode 100644 index 00000000000..f4c394c3ff2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + */ +export interface OtherPerson { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": (T | null)[] | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts new file mode 100644 index 00000000000..c441633f85e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherMethods has another method, but through a private embedded type. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3606939272) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts new file mode 100644 index 00000000000..b76bd15f8cc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * SomeMethods exports some methods. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * LikeThisOne is an example method that does nothing. + */ +export function LikeThisOne(): Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { + let $resultPromise = $Call.ByID(2124352079) as any; + return $resultPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4281222271) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts new file mode 100644 index 00000000000..d024fcb1d72 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedOther is even trickier. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3566862802) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts new file mode 100644 index 00000000000..7d1f0940377 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedService is tricky. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as nobindingshere$0 from "../no_bindings_here/models.js"; + +/** + * LikeThisOne is an example method that does nothing. + */ +export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { + let $resultPromise = $Call.ByID(2590614085) as any; + return $resultPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(773650321) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts new file mode 100644 index 00000000000..bc41b196900 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet($0: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, $0) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts new file mode 100644 index 00000000000..e69bebf3b18 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as EmbedOther from "./embedother.js"; +import * as EmbedService from "./embedservice.js"; +import * as GreetService from "./greetservice.js"; +export { + EmbedOther, + EmbedService, + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts new file mode 100644 index 00000000000..d1d012ca6d6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts new file mode 100644 index 00000000000..5c4ebea4fb9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts new file mode 100644 index 00000000000..440643194cb --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Hello(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4249972365) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts new file mode 100644 index 00000000000..d1d012ca6d6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts new file mode 100644 index 00000000000..5c4ebea4fb9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts new file mode 100644 index 00000000000..440643194cb --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Hello(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4249972365) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts new file mode 100644 index 00000000000..43aeebed8de --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts new file mode 100644 index 00000000000..62d3af2d2e6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts new file mode 100644 index 00000000000..dedcc9f08a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts new file mode 100644 index 00000000000..3399b255b34 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts @@ -0,0 +1,20 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(3568225479) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts new file mode 100644 index 00000000000..4e077af4a6c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts @@ -0,0 +1,229 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +export function ArrayInt($in: number[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3862002418, $in) as any; + return $resultPromise; +} + +export function BoolInBoolOut($in: boolean): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2424639793, $in) as any; + return $resultPromise; +} + +export function Float32InFloat32Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3132595881, $in) as any; + return $resultPromise; +} + +export function Float64InFloat64Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2182412247, $in) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +export function Int16InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3306292566, $in) as any; + return $resultPromise; +} + +export function Int16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1754277916, $in) as any; + return $resultPromise; +} + +export function Int32InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1909469092, $in) as any; + return $resultPromise; +} + +export function Int32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4251088558, $in) as any; + return $resultPromise; +} + +export function Int64InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1343888303, $in) as any; + return $resultPromise; +} + +export function Int64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2205561041, $in) as any; + return $resultPromise; +} + +export function Int8InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(572240879, $in) as any; + return $resultPromise; +} + +export function Int8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2189402897, $in) as any; + return $resultPromise; +} + +export function IntInIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(642881729, $in) as any; + return $resultPromise; +} + +export function IntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1066151743, $in) as any; + return $resultPromise; +} + +export function IntPointerInputNamedOutputs($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2718999663, $in) as any; + return $resultPromise; +} + +export function MapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2386486356, $in) as any; + return $resultPromise; +} + +export function MapIntPointerInt($in: { [_: string]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(550413585, $in) as any; + return $resultPromise; +} + +export function MapIntSliceInt($in: { [_: `${number}`]: number[] | null } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2900172572, $in) as any; + return $resultPromise; +} + +export function MapIntSliceIntInMapIntSliceIntOut($in: { [_: `${number}`]: number[] | null } | null): Promise<{ [_: `${number}`]: number[] | null } | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(881980169, $in) as any; + return $resultPromise; +} + +export function NoInputsStringOut(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1075577233) as any; + return $resultPromise; +} + +export function PointerBoolInBoolOut($in: boolean | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3589606958, $in) as any; + return $resultPromise; +} + +export function PointerFloat32InFloat32Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(224675106, $in) as any; + return $resultPromise; +} + +export function PointerFloat64InFloat64Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2124953624, $in) as any; + return $resultPromise; +} + +export function PointerMapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3516977899, $in) as any; + return $resultPromise; +} + +export function PointerStringInStringOut($in: string | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(229603958, $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutput($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3678582682, $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutputs($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(319259595, $in) as any; + return $resultPromise; +} + +export function StringArrayInputStringArrayOut($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(383995060, $in) as any; + return $resultPromise; +} + +export function StringArrayInputStringOut($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1091960237, $in) as any; + return $resultPromise; +} + +export function StructInputStructOutput($in: $models.Person): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByID(3835643147, $in) as any; + return $resultPromise; +} + +export function StructPointerInputErrorOutput($in: $models.Person | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2447692557, $in) as any; + return $resultPromise; +} + +export function StructPointerInputStructPointerOutput($in: $models.Person | null): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(2943477349, $in) as any; + return $resultPromise; +} + +export function UInt16InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3401034892, $in) as any; + return $resultPromise; +} + +export function UInt16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1236957573, $in) as any; + return $resultPromise; +} + +export function UInt32InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1160383782, $in) as any; + return $resultPromise; +} + +export function UInt32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1739300671, $in) as any; + return $resultPromise; +} + +export function UInt64InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(793803239, $in) as any; + return $resultPromise; +} + +export function UInt64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1403757716, $in) as any; + return $resultPromise; +} + +export function UInt8InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2988345717, $in) as any; + return $resultPromise; +} + +export function UInt8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(518250834, $in) as any; + return $resultPromise; +} + +export function UIntInUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2836661285, $in) as any; + return $resultPromise; +} + +export function UIntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1367187362, $in) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts new file mode 100644 index 00000000000..d2560dd147e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts new file mode 100644 index 00000000000..4e077af4a6c --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts @@ -0,0 +1,229 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +export function ArrayInt($in: number[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3862002418, $in) as any; + return $resultPromise; +} + +export function BoolInBoolOut($in: boolean): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2424639793, $in) as any; + return $resultPromise; +} + +export function Float32InFloat32Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3132595881, $in) as any; + return $resultPromise; +} + +export function Float64InFloat64Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2182412247, $in) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +export function Int16InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3306292566, $in) as any; + return $resultPromise; +} + +export function Int16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1754277916, $in) as any; + return $resultPromise; +} + +export function Int32InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1909469092, $in) as any; + return $resultPromise; +} + +export function Int32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4251088558, $in) as any; + return $resultPromise; +} + +export function Int64InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1343888303, $in) as any; + return $resultPromise; +} + +export function Int64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2205561041, $in) as any; + return $resultPromise; +} + +export function Int8InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(572240879, $in) as any; + return $resultPromise; +} + +export function Int8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2189402897, $in) as any; + return $resultPromise; +} + +export function IntInIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(642881729, $in) as any; + return $resultPromise; +} + +export function IntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1066151743, $in) as any; + return $resultPromise; +} + +export function IntPointerInputNamedOutputs($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2718999663, $in) as any; + return $resultPromise; +} + +export function MapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2386486356, $in) as any; + return $resultPromise; +} + +export function MapIntPointerInt($in: { [_: string]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(550413585, $in) as any; + return $resultPromise; +} + +export function MapIntSliceInt($in: { [_: `${number}`]: number[] | null } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2900172572, $in) as any; + return $resultPromise; +} + +export function MapIntSliceIntInMapIntSliceIntOut($in: { [_: `${number}`]: number[] | null } | null): Promise<{ [_: `${number}`]: number[] | null } | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(881980169, $in) as any; + return $resultPromise; +} + +export function NoInputsStringOut(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1075577233) as any; + return $resultPromise; +} + +export function PointerBoolInBoolOut($in: boolean | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3589606958, $in) as any; + return $resultPromise; +} + +export function PointerFloat32InFloat32Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(224675106, $in) as any; + return $resultPromise; +} + +export function PointerFloat64InFloat64Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2124953624, $in) as any; + return $resultPromise; +} + +export function PointerMapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3516977899, $in) as any; + return $resultPromise; +} + +export function PointerStringInStringOut($in: string | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(229603958, $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutput($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3678582682, $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutputs($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(319259595, $in) as any; + return $resultPromise; +} + +export function StringArrayInputStringArrayOut($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(383995060, $in) as any; + return $resultPromise; +} + +export function StringArrayInputStringOut($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1091960237, $in) as any; + return $resultPromise; +} + +export function StructInputStructOutput($in: $models.Person): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByID(3835643147, $in) as any; + return $resultPromise; +} + +export function StructPointerInputErrorOutput($in: $models.Person | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2447692557, $in) as any; + return $resultPromise; +} + +export function StructPointerInputStructPointerOutput($in: $models.Person | null): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(2943477349, $in) as any; + return $resultPromise; +} + +export function UInt16InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3401034892, $in) as any; + return $resultPromise; +} + +export function UInt16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1236957573, $in) as any; + return $resultPromise; +} + +export function UInt32InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1160383782, $in) as any; + return $resultPromise; +} + +export function UInt32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1739300671, $in) as any; + return $resultPromise; +} + +export function UInt64InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(793803239, $in) as any; + return $resultPromise; +} + +export function UInt64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1403757716, $in) as any; + return $resultPromise; +} + +export function UInt8InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2988345717, $in) as any; + return $resultPromise; +} + +export function UInt8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(518250834, $in) as any; + return $resultPromise; +} + +export function UIntInUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2836661285, $in) as any; + return $resultPromise; +} + +export function UIntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1367187362, $in) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts new file mode 100644 index 00000000000..d2560dd147e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts new file mode 100644 index 00000000000..60f87929dc4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts new file mode 100644 index 00000000000..60f87929dc4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts new file mode 100644 index 00000000000..43aeebed8de --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1411160069, name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1661412647, name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts new file mode 100644 index 00000000000..8d9e27aae27 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts @@ -0,0 +1,15 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts new file mode 100644 index 00000000000..dedcc9f08a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts new file mode 100644 index 00000000000..7035b4d074a --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=false/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts @@ -0,0 +1,20 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByID(1491748400) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts new file mode 100644 index 00000000000..99a9b3fa9e4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/greetservice.ts @@ -0,0 +1,35 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Get someone + */ +export function Get(aliasValue: $models.Alias): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Get", aliasValue) as any; + return $resultPromise; +} + +/** + * Get someone quite different + */ +export function GetButDifferent(): Promise<$models.GenericPerson> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.GetButDifferent") as any; + return $resultPromise; +} + +/** + * Greet a lot of unusual things. + */ +export function Greet($0: $models.EmptyAliasStruct, $1: $models.EmptyStruct): Promise<$models.AliasStruct> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", $0, $1) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts new file mode 100644 index 00000000000..d718d9c2095 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/models.ts @@ -0,0 +1,73 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * A nice type Alias + */ +export type Alias = number; + +/** + * A struct alias. + * This should be rendered as a typedef or interface in every mode. + */ +export interface AliasStruct { + /** + * A field with a comment. + */ + "Foo": number[] | null; + + /** + * Definitely not Foo. + */ + "Bar"?: string; + "Baz"?: string; + + /** + * A nested alias struct. + */ + "Other": OtherAliasStruct; +} + +/** + * An empty struct alias. + */ +export interface EmptyAliasStruct { +} + +/** + * An empty struct. + */ +export interface EmptyStruct { +} + +/** + * A generic struct containing an alias + */ +export interface GenericPerson { + "Name": T | null; + "AliasedField": Alias; +} + +/** + * Another struct alias. + */ +export interface OtherAliasStruct { + "NoMoreIdeas": number[] | null; +} + +/** + * A non-generic struct containing an alias. + */ +export interface Person { + /** + * The Person's name. + */ + "Name": string; + + /** + * A random alias field. + */ + "AliasedField": Alias; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts new file mode 100644 index 00000000000..bdcf43c67f9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as Service7 from "./service7.js"; +import * as Service9 from "./service9.js"; +export { + Service7, + Service9 +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts new file mode 100644 index 00000000000..f0b146d44b0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service7.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function TestMethod(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config.Service7.TestMethod") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts new file mode 100644 index 00000000000..cd49d6458f4 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config/service9.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function TestMethod2(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/complex_expressions/config.Service9.TestMethod2") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts new file mode 100644 index 00000000000..ce433f40e03 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(person: $models.Person, emb: $models.Embedded1): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", person, emb) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts new file mode 100644 index 00000000000..1a2a6e32bae --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/internal.ts @@ -0,0 +1,18 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface embedded4 { + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * Friends should not be shadowed in Person as embedded4 is not embedded + * from encoding/json's point of view; + * however, it should be shadowed in Embedded1 + */ + "Friends": boolean; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts new file mode 100644 index 00000000000..b81d48d2f75 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_json/models.ts @@ -0,0 +1,111 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as $internal from "./internal.js"; + +export interface Embedded1 { + /** + * Friends should be shadowed in Person by a field of lesser depth + */ + "Friends": number; + + /** + * Vanish should be omitted from Person because there is another field with same depth and no tag + */ + "Vanish": number; + + /** + * StillThere should be shadowed in Person by other field with same depth and a json tag + */ + "StillThere": string; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; +} + +export type Embedded3 = string; + +/** + * Person represents a person + */ +export interface Person { + /** + * Titles is optional in JSON + */ + "Titles"?: Title[] | null; + + /** + * Names has a + * multiline comment + */ + "Names": string[] | null; + + /** + * Partner has a custom and complex JSON key + */ + "Partner": Person | null; + "Friends": (Person | null)[] | null; + + /** + * NamingThingsIsHard is a law of programming + */ + "NamingThingsIsHard": `${boolean}`; + + /** + * StillThereButRenamed should shadow in Person the other field with same depth and no json tag + */ + "StillThere": Embedded3 | null; + + /** + * StrangeNumber maps to "-" + */ + "-": number; + + /** + * Embedded3 should appear with key "Embedded3" + */ + "Embedded3": Embedded3; + + /** + * StrangerNumber is serialized as a string + */ + "StrangerNumber": `${number}`; + + /** + * StrangestString is optional and serialized as a JSON string + */ + "StrangestString"?: `"${string}"`; + + /** + * StringStrangest is serialized as a JSON string and optional + */ + "StringStrangest"?: `"${string}"`; + + /** + * embedded4 should be optional and appear with key "emb4" + */ + "emb4"?: $internal.embedded4; +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts new file mode 100644 index 00000000000..d5f438da622 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/greetservice.ts @@ -0,0 +1,21 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + * It has a multiline doc comment + * The comment has even some * / traps!! + */ +export function Greet(str: string, people: $models.Person[] | null, $2: {"AnotherCount": number, "AnotherOne": $models.Person | null}, assoc: { [_: `${number}`]: boolean | null } | null, $4: (number | null)[] | null, ...other: string[]): Promise<[$models.Person, any, number[] | null]> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", str, people, $2, assoc, $4, other) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/models.interfaces.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts similarity index 52% rename from v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/models.interfaces.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts index 93bfa75ccbb..d3089cbb069 100644 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/models.interfaces.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/complex_method/models.ts @@ -1,11 +1,11 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT -import * as services from "../services/models"; +import {Create as $Create} from "/wails/runtime.js"; -// Person is a person +/** + * Person represents a person + */ export interface Person { - name: string; - address: services.Address; + "Name": string; } diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts new file mode 100644 index 00000000000..c9eb0646258 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Make a cycle. + */ +export function MakeCycles(): Promise<[$models.Cyclic, $models.GenericCyclic<$models.GenericCyclic>]> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MakeCycles") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts new file mode 100644 index 00000000000..a3edc152171 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/cycles/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export type Alias = Cyclic | null; + +export type Cyclic = ({ [_: string]: Alias } | null)[] | null; + +export type GenericCyclic = {"X": GenericCyclic | null, "Y": (T | null)[] | null}[] | null; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts new file mode 100644 index 00000000000..50e515b25e6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/greetservice.ts @@ -0,0 +1,50 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Comment 1. + */ +export function Method1(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method1") as any; + return $resultPromise; +} + +/** + * Comment 2. + */ +export function Method2(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method2") as any; + return $resultPromise; +} + +/** + * Comment 3a. + * Comment 3b. + */ +export function Method3(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method3") as any; + return $resultPromise; +} + +/** + * Comment 4. + */ +export function Method4(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method4") as any; + return $resultPromise; +} + +/** + * Comment 5. + */ +export function Method5(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Method5") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/embedded_interface/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts new file mode 100644 index 00000000000..268f6ae066f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string, title: $models.Title): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name, title) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts new file mode 100644 index 00000000000..dabe6255472 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum/models.ts @@ -0,0 +1,31 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * Person represents a person + */ +export interface Person { + "Title": Title; + "Name": string; +} + +/** + * Title is a title + */ +export enum Title { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ + Mister = "Mr", + Miss = "Miss", + Ms = "Ms", + Mrs = "Mrs", + Dr = "Dr", +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts new file mode 100644 index 00000000000..a51bd126abf --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/greetservice.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string, title: services$0.Title): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name, title) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts new file mode 100644 index 00000000000..c9d993ab756 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/index.ts @@ -0,0 +1,4 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/services/models.interfaces.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts similarity index 53% rename from v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/services/models.interfaces.ts rename to v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts index 29320703441..f7a68a98d81 100644 --- a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/services/models.interfaces.ts +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services/models.ts @@ -1,12 +1,20 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +import {Create as $Create} from "/wails/runtime.js"; + export enum Title { - // Mister is a title + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * Mister is a title + */ Mister = "Mr", Miss = "Miss", Ms = "Ms", Mrs = "Mrs", Dr = "Dr", -} +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts new file mode 100644 index 00000000000..90570941a5b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts new file mode 100644 index 00000000000..81f8d798243 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/models.ts @@ -0,0 +1,14 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person + */ +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts new file mode 100644 index 00000000000..dedcc9f08a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts new file mode 100644 index 00000000000..b1a6b930222 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services/otherservice.ts @@ -0,0 +1,20 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services.OtherService.Yay") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts new file mode 100644 index 00000000000..90570941a5b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts new file mode 100644 index 00000000000..cf3f275b1ae --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/models.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./services/other/models.js"; + +export interface Person { + "Name": string; + "Address": other$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts new file mode 100644 index 00000000000..dedcc9f08a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts new file mode 100644 index 00000000000..d602b2c725e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other/otherservice.ts @@ -0,0 +1,20 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_nested_imported_package/services/other.OtherService.Yay") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts new file mode 100644 index 00000000000..f9fb9fb2a81 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_multiple_files/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts new file mode 100644 index 00000000000..bb1bf7f89a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts new file mode 100644 index 00000000000..8dcfdefcb50 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/greetservice.ts @@ -0,0 +1,25 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function GreetWithContext(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.GreetWithContext", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/function_single_context/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts new file mode 100644 index 00000000000..6bd662438dc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as SomeMethods from "./somemethods.js"; +export { + SomeMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts new file mode 100644 index 00000000000..44fdff84dc9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/internal.ts @@ -0,0 +1,16 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface personImpl { + /** + * Nickname conceals a person's identity. + */ + "Nickname": string; + + /** + * They have a name. + */ + "Name": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts new file mode 100644 index 00000000000..5a11757a756 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/models.ts @@ -0,0 +1,34 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as other$0 from "./other/models.js"; + +import * as $internal from "./internal.js"; + +/** + * HowDifferent is a curious kind of person + * that lets other people decide how they are different. + */ +export type HowDifferent = other$0.OtherPerson<{ [_: string]: How | null } | null>; + +/** + * Impersonator gets their fields from other people. + */ +export type Impersonator = other$0.OtherPerson; + +/** + * Person is not a number. + */ +export interface Person { + /** + * They have a name. + */ + "Name": string; +} + +/** + * PrivatePerson gets their fields from hidden sources. + */ +export type PrivatePerson = $internal.personImpl; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts new file mode 100644 index 00000000000..9e85cc3c871 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherMethods from "./othermethods.js"; +export { + OtherMethods +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts new file mode 100644 index 00000000000..f4c394c3ff2 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/models.ts @@ -0,0 +1,19 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +/** + * OtherPerson is like a person, but different. + */ +export interface OtherPerson { + /** + * They have a name as well. + */ + "Name": string; + + /** + * But they may have many differences. + */ + "Differences": (T | null)[] | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts new file mode 100644 index 00000000000..4f22e87c6e5 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other/othermethods.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherMethods has another method, but through a private embedded type. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other.OtherMethods.LikeThisOtherOne") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts new file mode 100644 index 00000000000..6a5ae3cb9e0 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/somemethods.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * SomeMethods exports some methods. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * LikeThisOne is an example method that does nothing. + */ +export function LikeThisOne(): Promise<[$models.Person, $models.Impersonator, $models.HowDifferent, $models.PrivatePerson]> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOne") as any; + return $resultPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here.SomeMethods.LikeThisOtherOne") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts new file mode 100644 index 00000000000..b0f953ecbed --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedother.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedOther is even trickier. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.EmbedOther.LikeThisOtherOne") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts new file mode 100644 index 00000000000..5f0d496f399 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/embedservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * EmbedService is tricky. + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as nobindingshere$0 from "../no_bindings_here/models.js"; + +/** + * LikeThisOne is an example method that does nothing. + */ +export function LikeThisOne(): Promise<[nobindingshere$0.Person, nobindingshere$0.Impersonator, nobindingshere$0.HowDifferent, nobindingshere$0.PrivatePerson]> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.EmbedService.LikeThisOne") as any; + return $resultPromise; +} + +/** + * LikeThisOtherOne does nothing as well, but is different. + */ +export function LikeThisOtherOne(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.EmbedService.LikeThisOtherOne") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts new file mode 100644 index 00000000000..bd147ce2bc6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet($0: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", $0) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts new file mode 100644 index 00000000000..e69bebf3b18 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/out_of_tree/index.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as EmbedOther from "./embedother.js"; +import * as EmbedService from "./embedservice.js"; +import * as GreetService from "./greetservice.js"; +export { + EmbedOther, + EmbedService, + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts new file mode 100644 index 00000000000..f9fb9fb2a81 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts new file mode 100644 index 00000000000..5c4ebea4fb9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts new file mode 100644 index 00000000000..53f0f71cdbc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple/otherservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Hello(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.OtherService.Hello") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts new file mode 100644 index 00000000000..f9fb9fb2a81 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/greetservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts new file mode 100644 index 00000000000..5c4ebea4fb9 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +import * as OtherService from "./otherservice.js"; +export { + GreetService, + OtherService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts new file mode 100644 index 00000000000..53f0f71cdbc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_files/otherservice.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +export function Hello(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.OtherService.Hello") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts new file mode 100644 index 00000000000..90570941a5b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts new file mode 100644 index 00000000000..62d3af2d2e6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/models.ts @@ -0,0 +1,11 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts new file mode 100644 index 00000000000..dedcc9f08a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts new file mode 100644 index 00000000000..26fad7777b6 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services/otherservice.ts @@ -0,0 +1,20 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services.OtherService.Yay") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts new file mode 100644 index 00000000000..8f103a9faea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/greetservice.ts @@ -0,0 +1,229 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +export function ArrayInt($in: number[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.ArrayInt", $in) as any; + return $resultPromise; +} + +export function BoolInBoolOut($in: boolean): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.BoolInBoolOut", $in) as any; + return $resultPromise; +} + +export function Float32InFloat32Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Float32InFloat32Out", $in) as any; + return $resultPromise; +} + +export function Float64InFloat64Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Float64InFloat64Out", $in) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +export function Int16InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int16InIntOut", $in) as any; + return $resultPromise; +} + +export function Int16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int16PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int32InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int32InIntOut", $in) as any; + return $resultPromise; +} + +export function Int32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int32PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int64InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int64InIntOut", $in) as any; + return $resultPromise; +} + +export function Int64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int64PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int8InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int8InIntOut", $in) as any; + return $resultPromise; +} + +export function Int8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int8PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function IntInIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntInIntOut", $in) as any; + return $resultPromise; +} + +export function IntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntPointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function IntPointerInputNamedOutputs($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntPointerInputNamedOutputs", $in) as any; + return $resultPromise; +} + +export function MapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntInt", $in) as any; + return $resultPromise; +} + +export function MapIntPointerInt($in: { [_: string]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntPointerInt", $in) as any; + return $resultPromise; +} + +export function MapIntSliceInt($in: { [_: `${number}`]: number[] | null } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntSliceInt", $in) as any; + return $resultPromise; +} + +export function MapIntSliceIntInMapIntSliceIntOut($in: { [_: `${number}`]: number[] | null } | null): Promise<{ [_: `${number}`]: number[] | null } | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", $in) as any; + return $resultPromise; +} + +export function NoInputsStringOut(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NoInputsStringOut") as any; + return $resultPromise; +} + +export function PointerBoolInBoolOut($in: boolean | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerBoolInBoolOut", $in) as any; + return $resultPromise; +} + +export function PointerFloat32InFloat32Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerFloat32InFloat32Out", $in) as any; + return $resultPromise; +} + +export function PointerFloat64InFloat64Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerFloat64InFloat64Out", $in) as any; + return $resultPromise; +} + +export function PointerMapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerMapIntInt", $in) as any; + return $resultPromise; +} + +export function PointerStringInStringOut($in: string | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerStringInStringOut", $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutput($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputNamedOutput", $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutputs($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputNamedOutputs", $in) as any; + return $resultPromise; +} + +export function StringArrayInputStringArrayOut($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputStringArrayOut", $in) as any; + return $resultPromise; +} + +export function StringArrayInputStringOut($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputStringOut", $in) as any; + return $resultPromise; +} + +export function StructInputStructOutput($in: $models.Person): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructInputStructOutput", $in) as any; + return $resultPromise; +} + +export function StructPointerInputErrorOutput($in: $models.Person | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructPointerInputErrorOutput", $in) as any; + return $resultPromise; +} + +export function StructPointerInputStructPointerOutput($in: $models.Person | null): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", $in) as any; + return $resultPromise; +} + +export function UInt16InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt16InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt16PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt32InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt32InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt32PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt64InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt64InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt64PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt8InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt8InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt8PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UIntInUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UIntInUIntOut", $in) as any; + return $resultPromise; +} + +export function UIntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UIntPointerInAndOutput", $in) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts new file mode 100644 index 00000000000..d2560dd147e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_non_pointer_single/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts new file mode 100644 index 00000000000..8f103a9faea --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/greetservice.ts @@ -0,0 +1,229 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +export function ArrayInt($in: number[]): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.ArrayInt", $in) as any; + return $resultPromise; +} + +export function BoolInBoolOut($in: boolean): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.BoolInBoolOut", $in) as any; + return $resultPromise; +} + +export function Float32InFloat32Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Float32InFloat32Out", $in) as any; + return $resultPromise; +} + +export function Float64InFloat64Out($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Float64InFloat64Out", $in) as any; + return $resultPromise; +} + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +export function Int16InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int16InIntOut", $in) as any; + return $resultPromise; +} + +export function Int16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int16PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int32InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int32InIntOut", $in) as any; + return $resultPromise; +} + +export function Int32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int32PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int64InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int64InIntOut", $in) as any; + return $resultPromise; +} + +export function Int64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int64PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function Int8InIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int8InIntOut", $in) as any; + return $resultPromise; +} + +export function Int8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Int8PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function IntInIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntInIntOut", $in) as any; + return $resultPromise; +} + +export function IntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntPointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function IntPointerInputNamedOutputs($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.IntPointerInputNamedOutputs", $in) as any; + return $resultPromise; +} + +export function MapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntInt", $in) as any; + return $resultPromise; +} + +export function MapIntPointerInt($in: { [_: string]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntPointerInt", $in) as any; + return $resultPromise; +} + +export function MapIntSliceInt($in: { [_: `${number}`]: number[] | null } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntSliceInt", $in) as any; + return $resultPromise; +} + +export function MapIntSliceIntInMapIntSliceIntOut($in: { [_: `${number}`]: number[] | null } | null): Promise<{ [_: `${number}`]: number[] | null } | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", $in) as any; + return $resultPromise; +} + +export function NoInputsStringOut(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NoInputsStringOut") as any; + return $resultPromise; +} + +export function PointerBoolInBoolOut($in: boolean | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerBoolInBoolOut", $in) as any; + return $resultPromise; +} + +export function PointerFloat32InFloat32Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerFloat32InFloat32Out", $in) as any; + return $resultPromise; +} + +export function PointerFloat64InFloat64Out($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerFloat64InFloat64Out", $in) as any; + return $resultPromise; +} + +export function PointerMapIntInt($in: { [_: `${number}`]: number } | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerMapIntInt", $in) as any; + return $resultPromise; +} + +export function PointerStringInStringOut($in: string | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.PointerStringInStringOut", $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutput($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputNamedOutput", $in) as any; + return $resultPromise; +} + +export function StringArrayInputNamedOutputs($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputNamedOutputs", $in) as any; + return $resultPromise; +} + +export function StringArrayInputStringArrayOut($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputStringArrayOut", $in) as any; + return $resultPromise; +} + +export function StringArrayInputStringOut($in: string[] | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StringArrayInputStringOut", $in) as any; + return $resultPromise; +} + +export function StructInputStructOutput($in: $models.Person): Promise<$models.Person> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructInputStructOutput", $in) as any; + return $resultPromise; +} + +export function StructPointerInputErrorOutput($in: $models.Person | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructPointerInputErrorOutput", $in) as any; + return $resultPromise; +} + +export function StructPointerInputStructPointerOutput($in: $models.Person | null): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", $in) as any; + return $resultPromise; +} + +export function UInt16InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt16InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt16PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt16PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt32InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt32InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt32PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt32PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt64InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt64InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt64PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt64PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UInt8InUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt8InUIntOut", $in) as any; + return $resultPromise; +} + +export function UInt8PointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UInt8PointerInAndOutput", $in) as any; + return $resultPromise; +} + +export function UIntInUIntOut($in: number): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UIntInUIntOut", $in) as any; + return $resultPromise; +} + +export function UIntPointerInAndOutput($in: number | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.UIntPointerInAndOutput", $in) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts new file mode 100644 index 00000000000..d2560dd147e --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_single/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Person { + "Name": string; + "Parent": Person | null; + "Details": {"Age": number, "Address": {"Street": string}}; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts new file mode 100644 index 00000000000..bb1bf7f89a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts new file mode 100644 index 00000000000..bb1bf7f89a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/greetservice.ts @@ -0,0 +1,17 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +/** + * Greet someone + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts new file mode 100644 index 00000000000..50e3f043598 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_function/index.ts @@ -0,0 +1,7 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts new file mode 100644 index 00000000000..90570941a5b --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/greetservice.ts @@ -0,0 +1,27 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GreetService is great + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Greet does XYZ + */ +export function Greet(name: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.Greet", name) as any; + return $resultPromise; +} + +/** + * NewPerson creates a new person + */ +export function NewPerson(name: string): Promise<$models.Person | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("main.GreetService.NewPerson", name) as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts new file mode 100644 index 00000000000..8e624c8260f --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as GreetService from "./greetservice.js"; +export { + GreetService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts new file mode 100644 index 00000000000..8d9e27aae27 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/models.ts @@ -0,0 +1,15 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +import * as services$0 from "./services/models.js"; + +/** + * Person is a person! + * They have a name and an address + */ +export interface Person { + "Name": string; + "Address": services$0.Address | null; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts new file mode 100644 index 00000000000..1a5bd5ebf89 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as OtherService from "./otherservice.js"; +export { + OtherService +}; + +export * from "./models.js"; diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts new file mode 100644 index 00000000000..dedcc9f08a7 --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/models.ts @@ -0,0 +1,10 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import {Create as $Create} from "/wails/runtime.js"; + +export interface Address { + "Street": string; + "State": string; + "Country": string; +} diff --git a/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts new file mode 100644 index 00000000000..3e90da1d4bc --- /dev/null +++ b/v3/internal/generator/testdata/output/lang=TS/UseInterfaces=true/UseNames=true/github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services/otherservice.ts @@ -0,0 +1,20 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * OtherService is a struct + * that does things + * @module + */ + +import {Call as $Call, Create as $Create} from "/wails/runtime.js"; + +import * as $models from "./models.js"; + +/** + * Yay does this and that + */ +export function Yay(): Promise<$models.Address | null> & { cancel(): void } { + let $resultPromise = $Call.ByName("github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_other_function/services.OtherService.Yay") as any; + return $resultPromise; +} diff --git a/v3/internal/generator/testdata/package-lock.json b/v3/internal/generator/testdata/package-lock.json new file mode 100644 index 00000000000..642c0555b78 --- /dev/null +++ b/v3/internal/generator/testdata/package-lock.json @@ -0,0 +1,28 @@ +{ + "name": "testdata", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "testdata", + "version": "0.0.0", + "devDependencies": { + "typescript": "^5.4.5" + } + }, + "node_modules/typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + } +} diff --git a/v3/internal/generator/testdata/package.json b/v3/internal/generator/testdata/package.json new file mode 100644 index 00000000000..5e9459b4206 --- /dev/null +++ b/v3/internal/generator/testdata/package.json @@ -0,0 +1,8 @@ +{ + "name": "testdata", + "version": "0.0.0", + "description": "Output from generator testcases. This package.json is here only to pull in the Typescript compiler as a dependency.", + "devDependencies": { + "typescript": "^5.4.5" + } +} diff --git a/v3/internal/generator/testdata/tsconfig.json b/v3/internal/generator/testdata/tsconfig.json new file mode 100644 index 00000000000..b643dcc156e --- /dev/null +++ b/v3/internal/generator/testdata/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "allowJs": true, + "esModuleInterop": true, + "lib": ["ES6"], + "noEmit": true, + "paths": { + "/wails/runtime.js": ["../../runtime/desktop/@wailsio/runtime/types/index.d.ts"] + } + }, + "include": ["output/**/*"], + "exclude": ["output/**/*.got.?s"] +} diff --git a/v3/internal/parser/README.md b/v3/internal/parser/README.md deleted file mode 100644 index a9a67ad480a..00000000000 --- a/v3/internal/parser/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# Parser - -This package contains the static analyser used for parsing Wails projects so that we may: - -- Generate the bindings for the frontend -- Generate Typescript definitions for the structs used by the bindings - -## Implemented - -- [ ] Bound types - - [x] Struct Literal Pointer - - [ ] Variable - - [ ] Assignment - - [x] Struct Literal Pointer - - [ ] Function - - [ ] Same package - - [ ] Different package - - [ ] Function - -- [x] Parsing of bound methods - - [x] Method names - - [x] Method parameters - - [x] Zero parameters - - [x] Single input parameter - - [x] Single output parameter - - [x] Multiple input parameters - - [x] Multiple output parameters - - [x] Named output parameters - - [x] int/8/16/32/64 - - [x] Pointer - - [x] uint/8/16/32/64 - - [x] Pointer - - [x] float - - [x] Pointer - - [x] string - - [x] Pointer - - [x] bool - - [x] Pointer - - [x] Struct - - [x] Pointer - - [x] Slices - - [x] Pointer - - [x] Maps - - [x] Pointer -- [x] Model Parsing - - [x] In same package - - [x] In different package - - [x] Multiple named fields, e.g. one,two,three string - - [x] Scalars - - [x] Arrays - - [x] Maps - - [x] Structs - - [x] Recursive - - [x] Anonymous -- [ ] Generation of models - - [x] Scalars - - [ ] Arrays - - [ ] Maps - - [x] Structs -- [ ] Generation of bindings - - [ ] Classes - - [ ] Interfaces - - [ ] Enums - -## Limitations - -There are many ways to write a Go program so there are many program structures that we would need to support. This is a work in progress and will be improved over time. The current limitations are: - -- The call to `application.New()` must be in the `main` package -- Bound structs must be declared as struct literals - diff --git a/v3/internal/parser/bindings.go b/v3/internal/parser/bindings.go deleted file mode 100644 index 2296ca8b2af..00000000000 --- a/v3/internal/parser/bindings.go +++ /dev/null @@ -1,468 +0,0 @@ -package parser - -import ( - "fmt" - "sort" - "strings" - - "github.com/samber/lo" -) - -const header = `// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -` - -const headerTypescript = `// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -` - -const bindingTemplate = ` -/**Comments - * @function {{methodName}}* @param names {string} - * @returns {Promise} - **/ -` -const bindingTemplateTypescript = `Comments` - -const callByIDTypescript = `export async function {{methodName}}({{inputs}}) : {{ReturnType}} { - return Call.ByID({{ID}}{{params}}); -} - -` - -const callByNameTypescript = `export async function {{methodName}}({{inputs}}) : {{ReturnType}} { - return Call.ByName("{{Name}}"{{params}}); -} - -` - -const callByID = `export async function {{methodName}}({{inputs}}) { - return Call.ByID({{ID}}, ...Array.prototype.slice.call(arguments, 0)); -} -` - -const callByName = `export async function {{methodName}}({{inputs}}) { - return Call.ByName("{{Name}}", ...Array.prototype.slice.call(arguments, 0)); -} -` - -var reservedWords = []string{ - "abstract", - "arguments", - "await", - "boolean", - "break", - "byte", - "case", - "catch", - "char", - "class", - "const", - "continue", - "debugger", - "default", - "delete", - "do", - "double", - "else", - "enum", - "eval", - "export", - "extends", - "false", - "final", - "finally", - "float", - "for", - "function", - "goto", - "if", - "implements", - "import", - "in", - "instanceof", - "int", - "interface", - "let", - "long", - "native", - "new", - "null", - "package", - "private", - "protected", - "public", - "return", - "short", - "static", - "super", - "switch", - "synchronized", - "this", - "throw", - "throws", - "transient", - "true", - "try", - "typeof", - "var", - "void", - "volatile", - "while", - "with", - "yield", - "object", -} - -func sanitiseJSVarName(name string) string { - // if the name is a reserved word, prefix with an - // underscore - if lo.Contains(reservedWords, name) { - return "_" + name - } - return name -} - -type ExternalStruct struct { - Package string - Name string -} - -func (p *Project) GenerateBinding(thisStructName string, method *BoundMethod, useIDs bool) (string, []string, map[packagePath]map[string]*ExternalStruct) { - var externalStructs = make(map[packagePath]map[string]*ExternalStruct) - var models []string - template := bindingTemplate - if useIDs { - template += callByID - } else { - template += callByName - } - result := strings.ReplaceAll(template, "{{structName}}", thisStructName) - result = strings.ReplaceAll(result, "{{methodName}}", method.Name) - result = strings.ReplaceAll(result, "{{ID}}", fmt.Sprintf("%v", method.ID)) - - // get last part of method.Package path - parts := strings.Split(method.Package, "/") - packageName := parts[len(parts)-1] - - result = strings.ReplaceAll(result, "{{Name}}", fmt.Sprintf("%v.%v.%v", packageName, thisStructName, method.Name)) - comments := strings.TrimSpace(method.DocComment) - if comments != "" { - comments = "\n * " + comments - } - result = strings.ReplaceAll(result, "Comments", comments) - var params string - for _, input := range method.JSInputs() { - input.project = p - inputName := sanitiseJSVarName(input.Name) - pkgName := getPackageName(input) - if pkgName != "" { - models = append(models, pkgName) - } - if input.Type.IsStruct || input.Type.IsEnum { - if _, ok := externalStructs[input.Type.Package]; !ok { - externalStructs[input.Type.Package] = make(map[string]*ExternalStruct) - } - externalStructs[input.Type.Package][input.Type.Name] = &ExternalStruct{ - Package: input.Type.Package, - Name: input.Type.Name, - } - } - - inputType := input.JSType(packageName) - params += "\n * @param " + inputName + " {" + inputType + "}" - } - params = strings.TrimSuffix(params, "\n") - //if len(params) > 0 { - // params = "\n" + params - //} - result = strings.ReplaceAll(result, "* @param names {string}", params) - var inputs string - for _, input := range method.JSInputs() { - pkgName := getPackageName(input) - if pkgName != "" { - models = append(models, pkgName) - } - inputs += sanitiseJSVarName(input.Name) + ", " - } - inputs = strings.TrimSuffix(inputs, ", ") - args := inputs - if len(args) > 0 { - args = ", " + args - } - result = strings.ReplaceAll(result, "{{inputs}}", inputs) - result = strings.ReplaceAll(result, "{{args}}", args) - - // outputs - var returns string - if len(method.Outputs) == 0 { - returns = " * @returns {Promise}" - } else { - returns = " * @returns {Promise<" - for _, output := range method.Outputs { - output.project = p - pkgName := getPackageName(output) - if pkgName != "" { - models = append(models, pkgName) - } - jsType := output.JSType(pkgName) - if jsType == "error" { - jsType = "void" - } - if output.Type.IsStruct { - if _, ok := externalStructs[output.Type.Package]; !ok { - externalStructs[output.Type.Package] = make(map[string]*ExternalStruct) - } - externalStructs[output.Type.Package][output.Type.Name] = &ExternalStruct{ - Package: output.Type.Package, - Name: output.Type.Name, - } - jsType = output.NamespacedStructVariable(output.Type.Package) - } - returns += jsType + ", " - } - returns = strings.TrimSuffix(returns, ", ") - returns += ">}" - } - result = strings.ReplaceAll(result, " * @returns {Promise}", returns) - - return result, lo.Uniq(models), externalStructs -} - -func (p *Project) GenerateBindingTypescript(thisStructName string, method *BoundMethod, useIDs bool) (string, []string, map[packagePath]map[string]*ExternalStruct) { - var externalStructs = make(map[packagePath]map[string]*ExternalStruct) - var models []string - template := bindingTemplateTypescript - if useIDs { - template += callByIDTypescript - } else { - template += callByNameTypescript - } - result := strings.ReplaceAll(template, "{{structName}}", thisStructName) - result = strings.ReplaceAll(result, "{{methodName}}", method.Name) - result = strings.ReplaceAll(result, "{{ID}}", fmt.Sprintf("%v", method.ID)) - - // get last part of method.Package path - parts := strings.Split(method.Package, "/") - packageName := parts[len(parts)-1] - - result = strings.ReplaceAll(result, "{{Name}}", fmt.Sprintf("%v.%v.%v", packageName, thisStructName, method.Name)) - comments := strings.TrimSpace(method.DocComment) - if comments != "" { - comments = "// " + comments + "\n" - } - result = strings.ReplaceAll(result, "Comments", comments) - var params string - for _, input := range method.JSInputs() { - input.project = p - inputName := sanitiseJSVarName(input.Name) - pkgName := getPackageName(input) - if pkgName != "" { - models = append(models, pkgName) - } - if input.Type.IsStruct || input.Type.IsEnum { - if _, ok := externalStructs[input.Type.Package]; !ok { - externalStructs[input.Type.Package] = make(map[string]*ExternalStruct) - } - externalStructs[input.Type.Package][input.Type.Name] = &ExternalStruct{ - Package: input.Type.Package, - Name: input.Type.Name, - } - } - params += ", " + inputName - } - result = strings.ReplaceAll(result, "{{params}}", params) - //if len(params) > 0 { - // params = "\n" + params - //} - var inputs string - for _, input := range method.JSInputs() { - pkgName := getPackageName(input) - if pkgName != "" { - models = append(models, pkgName) - } - inputs += sanitiseJSVarName(input.Name) + ": " + input.JSType(packageName) + ", " - } - inputs = strings.TrimSuffix(inputs, ", ") - args := inputs - if len(args) > 0 { - args = ", " + args - } - result = strings.ReplaceAll(result, "{{inputs}}", inputs) - result = strings.ReplaceAll(result, "{{args}}", args) - - // outputs - var returns string - if len(method.Outputs) == 0 { - returns = "Promise" - } else { - returns = "Promise<" - for _, output := range method.Outputs { - output.project = p - pkgName := getPackageName(output) - if pkgName != "" { - models = append(models, pkgName) - } - jsType := output.JSType(pkgName) - if jsType == "error" { - jsType = "void" - } - if output.Type.IsStruct { - if _, ok := externalStructs[output.Type.Package]; !ok { - externalStructs[output.Type.Package] = make(map[string]*ExternalStruct) - } - externalStructs[output.Type.Package][output.Type.Name] = &ExternalStruct{ - Package: output.Type.Package, - Name: output.Type.Name, - } - jsType = output.NamespacedStructVariable(output.Type.Package) - } - returns += jsType + ", " - } - returns = strings.TrimSuffix(returns, ", ") - returns += ">" - } - result = strings.ReplaceAll(result, "{{ReturnType}}", returns) - - return result, lo.Uniq(models), externalStructs -} - -func getPackageName(input *Parameter) string { - if !input.Type.IsStruct { - return "" - } - result := input.Type.Package - if result == "" { - result = "main" - } - return result -} - -func isContext(input *Parameter) bool { - return input.Type.Package == "context" && input.Type.Name == "Context" -} - -func (p *Project) GenerateBindings(bindings map[string]map[string][]*BoundMethod, modelsFilename string, useIDs bool, useTypescript bool, useBundledRuntime bool) map[string]map[string]string { - - var result = make(map[string]map[string]string) - - // sort the bindings keys - packageNames := lo.Keys(bindings) - sort.Strings(packageNames) - for _, packageName := range packageNames { - var allModels []string - - packageBindings := bindings[packageName] - structNames := lo.Keys(packageBindings) - relativePackageDir := p.RelativePackageDir(packageName) - _ = relativePackageDir - sort.Strings(structNames) - for _, structName := range structNames { - if _, ok := result[relativePackageDir]; !ok { - result[relativePackageDir] = make(map[string]string) - } - methods := packageBindings[structName] - sort.Slice(methods, func(i, j int) bool { - return methods[i].Name < methods[j].Name - }) - var allNamespacedStructs map[packagePath]map[string]*ExternalStruct - var namespacedStructs map[packagePath]map[string]*ExternalStruct - var thisBinding string - var models []string - var mainImports = "" - if len(methods) > 0 { - if useBundledRuntime { - mainImports = "import {Call} from '/wails/runtime.js';\n" - } else { - mainImports = "import {Call} from '@wailsio/runtime';\n" - } - } - for _, method := range methods { - if useTypescript { - thisBinding, models, namespacedStructs = p.GenerateBindingTypescript(structName, method, useIDs) - } else { - thisBinding, models, namespacedStructs = p.GenerateBinding(structName, method, useIDs) - } - // Merge the namespaced structs - allNamespacedStructs = mergeNamespacedStructs(allNamespacedStructs, namespacedStructs) - allModels = append(allModels, models...) - result[relativePackageDir][structName] += thisBinding - } - - if len(allNamespacedStructs) > 0 { - thisPkg := p.packageCache[packageName] - if !useTypescript { - typedefs := "/**\n" - for externalPackageName, namespacedStruct := range allNamespacedStructs { - pkgInfo := p.packageCache[externalPackageName] - relativePackageDir := p.RelativeBindingsDir(thisPkg, pkgInfo) - namePrefix := "" - if pkgInfo.Name != "" && pkgInfo.Path != thisPkg.Path { - namePrefix = pkgInfo.Name - } - - // Get keys from namespacedStruct and iterate over them in sorted order - namespacedStructNames := lo.Keys(namespacedStruct) - sort.Strings(namespacedStructNames) - for _, thisStructName := range namespacedStructNames { - structInfo := namespacedStruct[thisStructName] - typedefs += " * @typedef {import('" + relativePackageDir + "/" + modelsFilename + "')." + thisStructName + "} " + namePrefix + structInfo.Name + "\n" - } - } - typedefs += " */\n" - result[relativePackageDir][structName] = typedefs + result[relativePackageDir][structName] - } else { - // Generate imports instead of typedefs - imports := "" - for externalPackageName, namespacedStruct := range allNamespacedStructs { - pkgInfo := p.packageCache[externalPackageName] - relativePackageDir := p.RelativeBindingsDir(thisPkg, pkgInfo) - namePrefix := "" - if pkgInfo.Name != "" && pkgInfo.Path != thisPkg.Path { - namePrefix = pkgInfo.Name - } - - // Get keys from namespacedStruct and iterate over them in sorted order - namespacedStructNames := lo.Keys(namespacedStruct) - sort.Strings(namespacedStructNames) - for _, thisStructName := range namespacedStructNames { - structInfo := namespacedStruct[thisStructName] - if namePrefix != "" { - imports += "import {" + thisStructName + " as " + namePrefix + structInfo.Name + "} from '" + relativePackageDir + "/models';\n" - } else { - imports += "import {" + thisStructName + "} from '" + relativePackageDir + "/" + modelsFilename + "';\n" - } - } - } - imports += "\n" - result[relativePackageDir][structName] = imports + result[relativePackageDir][structName] - } - } - if useTypescript { - result[relativePackageDir][structName] = headerTypescript + mainImports + result[relativePackageDir][structName] - } else { - result[relativePackageDir][structName] = header + mainImports + result[relativePackageDir][structName] - } - } - } - - return result -} - -func mergeNamespacedStructs(structs map[packagePath]map[string]*ExternalStruct, structs2 map[packagePath]map[string]*ExternalStruct) map[packagePath]map[string]*ExternalStruct { - if structs == nil { - structs = make(map[packagePath]map[string]*ExternalStruct) - } - for pkg, pkgStructs := range structs2 { - if _, ok := structs[pkg]; !ok { - structs[pkg] = make(map[string]*ExternalStruct) - } - for name, structInfo := range pkgStructs { - structs[pkg][name] = structInfo - } - } - return structs -} diff --git a/v3/internal/parser/bindings_test.go b/v3/internal/parser/bindings_test.go deleted file mode 100644 index 722a6c21890..00000000000 --- a/v3/internal/parser/bindings_test.go +++ /dev/null @@ -1,758 +0,0 @@ -package parser - -import ( - "embed" - "io/fs" - "os" - "path/filepath" - "testing" - - "github.com/google/go-cmp/cmp" -) - -//go:embed testdata -var testdata embed.FS - -func getFile(filename string) string { - // get the file from the testdata FS - file, err := fs.ReadFile(testdata, filename) - if err != nil { - return "" - } - return string(file) -} - -func TestGenerateBindings(t *testing.T) { - - tests := []struct { - name string - dir string - want map[string]map[string]string - useIDs bool - useTypescript bool - }{ - { - name: "enum", - dir: "testdata/enum", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/enum/frontend/bindings/main/GreetService.js"), - }, - }, - useIDs: true, - }, - { - name: "enum - Typescript - CallByID", - dir: "testdata/enum", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/enum/frontend/bindings/main/GreetService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "enum - Typescript - CallByName", - dir: "testdata/enum", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/enum/frontend/bindings/main/GreetService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "enum_from_imported_package", - dir: "testdata/enum_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/enum_from_imported_package/frontend/bindings/main/GreetService.name.js"), - }, - }, - }, - { - name: "enum_from_imported_package", - dir: "testdata/enum_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/enum_from_imported_package/frontend/bindings/main/GreetService.js"), - }, - }, - useIDs: true, - }, - { - name: "enum_from_imported_package - Typescript - CallByID", - dir: "testdata/enum_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/enum_from_imported_package/frontend/bindings/main/GreetService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "enum_from_imported_package - Typescript - CallByName", - dir: "testdata/enum_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/enum_from_imported_package/frontend/bindings/main/GreetService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "function_single", - dir: "testdata/function_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_single/frontend/bindings/main/GreetService.js"), - }, - }, - useIDs: true, - }, - { - name: "function_single", - dir: "testdata/function_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_single/frontend/bindings/main/GreetService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "function single - Typescript - CallByID", - dir: "testdata/function_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_single/frontend/bindings/main/GreetService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "function single - Typescript - CallByName", - dir: "testdata/function_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_single/frontend/bindings/main/GreetService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "function_from_imported_package - CallByName", - dir: "testdata/function_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.js"), - }, - "services": { - "OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "function_from_imported_package - CallById", - dir: "testdata/function_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.js"), - }, - "services": { - "OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.js"), - }, - }, - useIDs: true, - }, - { - name: "function_from_imported_package - Typescript - CallByID", - dir: "testdata/function_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.ts"), - }, - "services": { - "OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "function_from_imported_package - Typescript - CallByName", - dir: "testdata/function_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.ts"), - }, - "services": { - "OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "function_from_nested_imported_package", - dir: "testdata/function_from_nested_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.name.js"), - }, - "services/other": { - "OtherService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "function_from_nested_imported_package", - dir: "testdata/function_from_nested_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.js"), - }, - "services/other": { - "OtherService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.js"), - }, - }, - useIDs: true, - }, - { - name: "function_from_nested_imported_package - Typescript - CallByID", - dir: "testdata/function_from_nested_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.ts"), - }, - "services/other": { - "OtherService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "function_from_nested_imported_package - Typescript - CallByName", - dir: "testdata/function_from_nested_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.name.ts"), - }, - "services/other": { - "OtherService": getFile("testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "struct_literal_multiple", - dir: "testdata/struct_literal_multiple", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple/frontend/bindings/main/GreetService.js"), - "OtherService": getFile("testdata/struct_literal_multiple/frontend/bindings/main/OtherService.js"), - }, - }, - useIDs: true, - }, - { - name: "struct_literal_multiple", - dir: "testdata/struct_literal_multiple", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple/frontend/bindings/main/GreetService.name.js"), - "OtherService": getFile("testdata/struct_literal_multiple/frontend/bindings/main/OtherService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "function_from_imported_package", - dir: "testdata/function_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.js"), - }, - "services": { - "OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.js"), - }, - }, - useIDs: true, - }, - { - name: "function_from_imported_package", - dir: "testdata/function_from_imported_package", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.js"), - }, - "services": { - "OtherService": getFile("testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "variable_single", - dir: "testdata/variable_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single/frontend/bindings/main/GreetService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "variable_single", - dir: "testdata/variable_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single/frontend/bindings/main/GreetService.js"), - }, - }, - useIDs: true, - }, - { - name: "variable_single - Typescript - CallByID", - dir: "testdata/variable_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single/frontend/bindings/main/GreetService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "variable_single - Typescript - CallByName", - dir: "testdata/variable_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single/frontend/bindings/main/GreetService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "variable_single_from_function", - dir: "testdata/variable_single_from_function", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single_from_function/frontend/bindings/main/GreetService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "variable_single_from_function", - dir: "testdata/variable_single_from_function", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single_from_function/frontend/bindings/main/GreetService.js"), - }, - }, - useIDs: true, - }, - { - name: "variable_single_from_function - Typescript - CallByID", - dir: "testdata/variable_single_from_function", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single_from_function/frontend/bindings/main/GreetService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "variable_single_from_function - Typescript - CallByName", - dir: "testdata/variable_single_from_function", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single_from_function/frontend/bindings/main/GreetService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "variable_single_from_other_function", - dir: "testdata/variable_single_from_other_function", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.name.js"), - }, - "services": { - "OtherService": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "variable_single_from_other_function", - dir: "testdata/variable_single_from_other_function", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.js"), - }, - "services": { - "OtherService": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.js"), - }, - }, - useIDs: true, - }, - { - name: "variable_single_from_other_function - Typescript - CallByID", - dir: "testdata/variable_single_from_other_function", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.ts"), - }, - "services": { - "OtherService": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "variable_single_from_other_function - Typescript - CallByName", - dir: "testdata/variable_single_from_other_function", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.name.ts"), - }, - "services": { - "OtherService": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "struct_literal_single", - dir: "testdata/struct_literal_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_single/frontend/bindings/main/GreetService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "struct_literal_single", - dir: "testdata/struct_literal_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_single/frontend/bindings/main/GreetService.js"), - }, - }, - useIDs: true, - }, - { - name: "struct_literal_single - Typescript - CallByID", - dir: "testdata/struct_literal_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_single/frontend/bindings/main/GreetService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "struct_literal_single - Typescript - CallByName", - dir: "testdata/struct_literal_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_single/frontend/bindings/main/GreetService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "struct_literal_multiple_other", - dir: "testdata/struct_literal_multiple_other", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.name.js"), - }, - "services": { - "OtherService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "struct_literal_multiple_other", - dir: "testdata/struct_literal_multiple_other", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.js"), - }, - "services": { - "OtherService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.js"), - }, - }, - useIDs: true, - }, - { - name: "struct_literal_multiple_other - Typescript - CallByID", - dir: "testdata/struct_literal_multiple_other", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.ts"), - }, - "services": { - "OtherService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "struct_literal_multiple_other - Typescript - CallByName", - dir: "testdata/struct_literal_multiple_other", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.name.ts"), - }, - "services": { - "OtherService": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "struct_literal_non_pointer_single", - dir: "testdata/struct_literal_non_pointer_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "struct_literal_non_pointer_single", - dir: "testdata/struct_literal_non_pointer_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.js"), - }, - }, - useIDs: true, - }, - { - name: "struct_literal_non_pointer_single - Typescript - CallByID", - dir: "testdata/struct_literal_non_pointer_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "struct_literal_non_pointer_single - Typescript - CallByName", - dir: "testdata/struct_literal_non_pointer_single", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "struct_literal_multiple_files", - dir: "testdata/struct_literal_multiple_files", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.name.js"), - "OtherService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "struct_literal_multiple_files", - dir: "testdata/struct_literal_multiple_files", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.js"), - "OtherService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.js"), - }, - }, - useIDs: true, - }, - { - name: "struct_literal_multiple_files - Typescript - CallByID", - dir: "testdata/struct_literal_multiple_files", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.ts"), - "OtherService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "struct_literal_multiple_files - Typescript - CallByName", - dir: "testdata/struct_literal_multiple_files", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.name.ts"), - "OtherService": getFile("testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - { - name: "function_single_context", - dir: "testdata/function_single_context", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_single_context/frontend/bindings/main/GreetService.js"), - }, - }, - useIDs: true, - }, - { - name: "function_single_context", - dir: "testdata/function_single_context", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_single_context/frontend/bindings/main/GreetService.name.js"), - }, - }, - useIDs: false, - }, - { - name: "function single - Typescript - CallByID", - dir: "testdata/function_single_context", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_single_context/frontend/bindings/main/GreetService.ts"), - }, - }, - useIDs: true, - useTypescript: true, - }, - { - name: "function single - Typescript - CallByName", - dir: "testdata/function_single_context", - want: map[string]map[string]string{ - "main": { - "GreetService": getFile("testdata/function_single_context/frontend/bindings/main/GreetService.name.ts"), - }, - }, - useIDs: false, - useTypescript: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - // Run parser on directory - absDir, err := filepath.Abs(tt.dir) - if err != nil { - t.Errorf("filepath.Abs() error = %v", err) - return - } - project, err := ParseProject(absDir) - if err != nil { - t.Errorf("ParseProject() error = %v", err) - return - } - - project.outputDirectory = "frontend/bindings" - - // Generate Bindings - got := project.GenerateBindings(project.BoundMethods, "models", tt.useIDs, tt.useTypescript, false) - - for dirName, structDetails := range got { - // iterate the struct names in structDetails - for name, binding := range structDetails { - expected, ok := tt.want[dirName][name] - if !ok { - outFileName := name + ".got.js" - originalFilename := name + ".js" - if tt.useTypescript { - if tt.useIDs { - originalFilename = name + ".ts" - } else { - originalFilename = name + ".name.ts" - } - outFileName = name + ".got.ts" - } - originalFile := filepath.Join(tt.dir, project.outputDirectory, dirName, originalFilename) - // Check if file exists - if _, err := os.Stat(originalFile); err != nil { - outFileName = originalFilename - } - - outFile := filepath.Join(tt.dir, project.outputDirectory, dirName, outFileName) - err = os.WriteFile(outFile, []byte(binding), 0644) - if err != nil { - t.Errorf("os.WriteFile() error = %v", err) - continue - } - t.Errorf("GenerateBindings() unexpected binding = %v", name) - continue - } - // compare the binding - - // convert all line endings to \n - binding = convertLineEndings(binding) - expected = convertLineEndings(expected) - - if diff := cmp.Diff(expected, binding); diff != "" { - outFileName := name + ".got.js" - originalFilename := name - if !tt.useIDs { - originalFilename += ".name" - } - outFileName = originalFilename + ".got" - if tt.useTypescript { - originalFilename += ".ts" - outFileName += ".ts" - } else { - originalFilename += ".js" - outFileName += ".js" - } - - originalFile := filepath.Join(tt.dir, project.outputDirectory, dirName, originalFilename) - // Check if file exists - if _, err := os.Stat(originalFile); err != nil { - outFileName = originalFilename - } - - outFile := filepath.Join(tt.dir, project.outputDirectory, dirName, outFileName) - err = os.WriteFile(outFile, []byte(binding), 0644) - if err != nil { - t.Errorf("os.WriteFile() error = %v", err) - continue - } - t.Errorf("GenerateBindings() mismatch (-want +got):\n%s", diff) - } - } - } - }) - } -} diff --git a/v3/internal/parser/models.go b/v3/internal/parser/models.go deleted file mode 100644 index b7941dd2a87..00000000000 --- a/v3/internal/parser/models.go +++ /dev/null @@ -1,104 +0,0 @@ -package parser - -import ( - "bytes" - "embed" - "io" - "sort" - "strings" - "text/template" - - "github.com/wailsapp/wails/v3/internal/flags" -) - -//go:embed templates -var templates embed.FS - -type ModelDefinitions struct { - Package string - Models map[string]*StructDef - Enums map[string]*TypeDef - Imports []*ImportDef -} - -func (p *Project) GenerateModel(wr io.Writer, def *ModelDefinitions, options *flags.GenerateBindingsOptions) error { - templateName := "model.js.tmpl" - if options.TS { - templateName = "model.ts.tmpl" - if options.UseInterfaces { - templateName = "interfaces.ts.tmpl" - } - } - - // Fix up TS names - for _, model := range def.Models { - model.Name = options.TSPrefix + model.Name + options.TSSuffix - } - - tmpl, err := template.New(templateName).ParseFS(templates, "templates/"+templateName) - if err != nil { - println("Unable to initialize model template: " + err.Error()) - return err - } - - err = tmpl.ExecuteTemplate(wr, templateName, def) - if err != nil { - println("Problem executing template: " + err.Error()) - return err - } - return nil -} - -const modelsHeader = `// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT -` - -func pkgAlias(fullPkg string) string { - pkgParts := strings.Split(fullPkg, "/") - return pkgParts[len(pkgParts)-1] -} - -type Model struct { - Package string -} - -func (p *Project) GenerateModels(models map[packagePath]map[structName]*StructDef, enums map[packagePath]map[string]*TypeDef, options *flags.GenerateBindingsOptions) (map[packagePath]string, error) { - if models == nil && enums == nil { - return nil, nil - } - var result = make(map[packagePath]string) - - // sort pkgs by alias (e.g. services) instead of full pkg name (e.g. github.com/wailsapp/wails/somedir/services) - // and then sort resulting list by the alias - var keys []string - for pkg := range models { - keys = append(keys, pkg) - } - for pkg := range enums { - keys = append(keys, pkg) - } - - sort.Slice(keys, func(i, j int) bool { - return pkgAlias(keys[i]) < pkgAlias(keys[j]) - }) - - for _, pkg := range keys { - var buffer bytes.Buffer - buffer.WriteString(modelsHeader) - err := p.GenerateModel(&buffer, &ModelDefinitions{ - Imports: p.calculateImports(pkg, models[pkg]), - Package: pkgAlias(pkg), - Models: models[pkg], - Enums: enums[pkg], - }, options) - if err != nil { - return nil, err - } - - // Get the relative package path - relativePackageDir := p.RelativePackageDir(pkg) - result[relativePackageDir] = buffer.String() - } - return result, nil -} diff --git a/v3/internal/parser/models_test.go b/v3/internal/parser/models_test.go deleted file mode 100644 index bae28947496..00000000000 --- a/v3/internal/parser/models_test.go +++ /dev/null @@ -1,261 +0,0 @@ -package parser - -import ( - "github.com/google/go-cmp/cmp" - "github.com/wailsapp/wails/v3/internal/flags" - "os" - "path/filepath" - "strings" - "testing" -) - -func TestGenerateModels(t *testing.T) { - - tests := []struct { - name string - dir string - want map[string]string - useInterface bool - useTypescript bool - }{ - // enum - { - name: "enum - Typescript", - dir: "testdata/enum", - want: map[string]string{ - "main": getFile("testdata/enum/frontend/bindings/main/models.ts"), - }, - useTypescript: true, - }, - { - name: "enum - Javascript", - dir: "testdata/enum", - want: map[string]string{ - "main": getFile("testdata/enum/frontend/bindings/main/models.js"), - }, - useTypescript: false, - }, - { - name: "enum - Typescript interfaces", - dir: "testdata/enum", - want: map[string]string{ - "main": getFile("testdata/enum/frontend/bindings/main/models.interfaces.ts"), - }, - useTypescript: true, - useInterface: true, - }, - // function from imported package - { - name: "function from imported package - Typescript", - dir: "testdata/function_from_imported_package", - want: map[string]string{ - "main": getFile("testdata/function_from_imported_package/frontend/bindings/main/models.ts"), - "services": getFile("testdata/function_from_imported_package/frontend/bindings/services/models.ts"), - }, - useTypescript: true, - }, - { - name: "function from imported package - Typescript interfaces", - dir: "testdata/function_from_imported_package", - want: map[string]string{ - "main": getFile("testdata/function_from_imported_package/frontend/bindings/main/models.interfaces.ts"), - "services": getFile("testdata/function_from_imported_package/frontend/bindings/services/models.interfaces.ts"), - }, - useTypescript: true, - useInterface: true, - }, - { - name: "function from imported package - Javascript", - dir: "testdata/function_from_imported_package", - want: map[string]string{ - "main": getFile("testdata/function_from_imported_package/frontend/bindings/main/models.js"), - "services": getFile("testdata/function_from_imported_package/frontend/bindings/services/models.js"), - }, - useTypescript: false, - }, - // variable single from other function - { - name: "variable single from other function - Typescript", - dir: "testdata/variable_single_from_other_function", - want: map[string]string{ - "main": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/models.ts"), - "services": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/models.ts"), - }, - useTypescript: true, - }, - { - name: "variable single from other function - Typescript interfaces", - dir: "testdata/variable_single_from_other_function", - want: map[string]string{ - "main": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/models.interfaces.ts"), - "services": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/models.interfaces.ts"), - }, - useTypescript: true, - useInterface: true, - }, - { - name: "variable single from other function - Javascript", - dir: "testdata/variable_single_from_other_function", - want: map[string]string{ - "main": getFile("testdata/variable_single_from_other_function/frontend/bindings/main/models.js"), - "services": getFile("testdata/variable_single_from_other_function/frontend/bindings/services/models.js"), - }, - useTypescript: false, - }, - // struct literal single - { - name: "struct literal single - Typescript", - dir: "testdata/struct_literal_single", - want: map[string]string{ - "main": getFile("testdata/struct_literal_single/frontend/bindings/main/models.ts"), - }, - useTypescript: true, - }, - { - name: "struct literal single - Typescript interfaces", - dir: "testdata/struct_literal_single", - want: map[string]string{ - "main": getFile("testdata/struct_literal_single/frontend/bindings/main/models.interfaces.ts"), - }, - useTypescript: true, - useInterface: true, - }, - { - name: "struct literal single - Javascript", - dir: "testdata/struct_literal_single", - want: map[string]string{ - "main": getFile("testdata/struct_literal_single/frontend/bindings/main/models.js"), - }, - useTypescript: false, - }, - // struct literal multiple other - { - name: "struct literal multiple other - Typescript", - dir: "testdata/struct_literal_multiple_other", - want: map[string]string{ - "main": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/models.ts"), - "services": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/models.ts"), - }, - useTypescript: true, - }, - { - name: "struct literal multiple other - Typescript interfaces", - dir: "testdata/struct_literal_multiple_other", - want: map[string]string{ - "main": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/models.interfaces.ts"), - "services": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/models.interfaces.ts"), - }, - useTypescript: true, - useInterface: true, - }, - { - name: "struct literal multiple other - Javascript", - dir: "testdata/struct_literal_multiple_other", - want: map[string]string{ - "main": getFile("testdata/struct_literal_multiple_other/frontend/bindings/main/models.js"), - "services": getFile("testdata/struct_literal_multiple_other/frontend/bindings/services/models.js"), - }, - useTypescript: false, - }, - // struct literal non pointer single - { - name: "struct literal non pointer single - Typescript", - dir: "testdata/struct_literal_non_pointer_single", - want: map[string]string{ - "main": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.ts"), - }, - useTypescript: true, - }, - { - name: "struct literal non pointer single - Typescript interfaces", - dir: "testdata/struct_literal_non_pointer_single", - want: map[string]string{ - "main": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.interfaces.ts"), - }, - useTypescript: true, - useInterface: true, - }, - { - name: "struct literal non pointer single - Javascript", - dir: "testdata/struct_literal_non_pointer_single", - want: map[string]string{ - "main": getFile("testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.js"), - }, - useTypescript: false, - }, - // enum from imported package - { - name: "enum from imported package - Typescript", - dir: "testdata/enum_from_imported_package", - want: map[string]string{ - "services": getFile("testdata/enum_from_imported_package/frontend/bindings/services/models.ts"), - }, - useTypescript: true, - }, - { - name: "enum from imported package - Typescript interfaces", - dir: "testdata/enum_from_imported_package", - want: map[string]string{ - "services": getFile("testdata/enum_from_imported_package/frontend/bindings/services/models.interfaces.ts"), - }, - useTypescript: true, - }, - { - name: "enum from imported package - Javascript", - dir: "testdata/enum_from_imported_package", - want: map[string]string{ - "services": getFile("testdata/enum_from_imported_package/frontend/bindings/services/models.js"), - }, - useTypescript: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - // Run parser on directory - project, err := ParseProject(tt.dir) - if err != nil { - t.Fatalf("ParseProject() error = %v", err) - } - - project.outputDirectory = "frontend/bindings" - - // Generate Models - allModels, err := project.GenerateModels(project.Models, project.Types, &flags.GenerateBindingsOptions{ - UseInterfaces: tt.useInterface, - TS: tt.useTypescript, - }) - if err != nil { - t.Fatalf("GenerateModels() error = %v", err) - } - for pkgDir, got := range allModels { - // convert all line endings to \n - got = convertLineEndings(got) - want, ok := tt.want[pkgDir] - if !ok { - t.Fatalf("GenerateModels() missing package: %s", pkgDir) - } - want = convertLineEndings(want) - if diff := cmp.Diff(want, got); diff != "" { - gotFilename := "models.got.js" - if tt.useTypescript { - gotFilename = "models.got.ts" - } - // Get relative package path - //relativeBindingsDir := project.RelativeBindingsDir(project.packageCache[pkgDir]) - - err = os.WriteFile(filepath.Join(tt.dir, project.outputDirectory, pkgDir, gotFilename), []byte(got), 0644) - if err != nil { - t.Errorf("os.WriteFile() error = %v", err) - return - } - t.Fatalf("GenerateModels() mismatch (-want +got):\n%s", diff) - } - } - }) - } -} - -func convertLineEndings(str string) string { - // replace all \r\n with \n - return strings.ReplaceAll(str, "\r\n", "\n") -} diff --git a/v3/internal/parser/parser.go b/v3/internal/parser/parser.go deleted file mode 100644 index b01bd2f8cd7..00000000000 --- a/v3/internal/parser/parser.go +++ /dev/null @@ -1,1317 +0,0 @@ -package parser - -import ( - "errors" - "fmt" - "go/ast" - "go/build" - "go/parser" - "go/token" - "log" - "os" - "path/filepath" - "reflect" - "strconv" - "strings" - "time" - - "github.com/wailsapp/wails/v3/internal/flags" - - "github.com/samber/lo" - "github.com/wailsapp/wails/v3/internal/hash" -) - -type packagePath = string -type structName = string - -// ErrNoBindingsFound is returned when no bound structs are found -var ErrNoBindingsFound = errors.New("no bound structs found") - -type StructDef struct { - Name string - DocComments []string - Fields []*Field -} - -func (s *StructDef) DefaultValueList() string { - var allFields []string - for _, field := range s.Fields { - thisFieldWithDefaultValue := fmt.Sprintf("%s = %s", field.JSName(), field.DefaultValue()) - allFields = append(allFields, thisFieldWithDefaultValue) - } - return strings.Join(allFields, ", ") -} - -type ParameterType struct { - Name string - IsStruct bool - IsSlice bool - IsPointer bool - IsEnum bool - MapKey *ParameterType - MapValue *ParameterType - Package string -} - -type EnumDef struct { - Name string - Filename string - DocComments []string - Values []*EnumValue -} - -type EnumValue struct { - Name string - Value string - DocComments []string -} - -type Parameter struct { - Name string - Type *ParameterType - project *Project -} - -func (p *Parameter) NamespacedStructType(pkgName string) string { - var typeName string - thisPkg := p.project.packageCache[pkgName] - pkgInfo := p.project.packageCache[p.Type.Package] - if pkgInfo.Name != "" && pkgInfo.Path != thisPkg.Path { - typeName = pkgInfo.Name - } else { - if p.Type.Package != "" && p.Type.Package != pkgName { - parts := strings.Split(p.Type.Package, "/") - typeName = parts[len(parts)-1] + "." - } - } - return typeName + p.Type.Name -} -func (p *Parameter) NamespacedStructVariable(pkgName string) string { - var typeName string - if p.Type.Package != "" && p.Type.Package != pkgName { - parts := strings.Split(p.Type.Package, "/") - typeName = parts[len(parts)-1] - } - return typeName + p.Type.Name -} - -func (p *Parameter) JSType(pkgName string) string { - // Convert type to javascript equivalent type - var typeName string - switch p.Type.Name { - case "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", "float32", "float64": - typeName = "number" - case "string": - typeName = "string" - case "bool": - typeName = "boolean" - default: - typeName = p.Type.Name - } - - // if the type is a struct, we need to add the package name - if p.Type.IsStruct || p.Type.IsEnum { - typeName = p.NamespacedStructType(pkgName) - typeName = strings.ReplaceAll(typeName, ".", "") - } - - // Add slice suffix - if p.Type.IsSlice { - typeName += "[]" - } - - // Add pointer suffix - if p.Type.IsPointer { - typeName += " | null" - } - - return typeName -} - -type BoundMethod struct { - Package string - PackageDir string - Name string - DocComment string - Inputs []*Parameter - Outputs []*Parameter - ID uint32 - Alias *uint32 -} - -func (m BoundMethod) JSInputs() []*Parameter { - if len(m.Inputs) > 0 { - if firstArg := m.Inputs[0]; isContext(firstArg) { - return m.Inputs[1:] - } - } - - return m.Inputs -} - -func (m BoundMethod) IDAsString() string { - return strconv.Itoa(int(m.ID)) -} - -type Field struct { - Name string - Type *ParameterType - Project *Project -} - -func (f *Field) JSName() string { - return strings.ToLower(f.Name[0:1]) + f.Name[1:] -} - -// TSBuild contains the typescript to build a field for a JS object -// via assignment for simple types or constructors for structs -func (f *Field) TSBuild(pkg string) string { - if !f.Type.IsStruct { - return fmt.Sprintf("safeSource['%s']", f.JSName()) - } - - if f.Type.Package == "" || f.Type.Package == pkg { - return fmt.Sprintf("%s.createFrom(source['%s'])", f.Type.Name, f.JSName()) - } - - return fmt.Sprintf("%s.%s.createFrom(source['%s'])", pkgAlias(f.Type.Package), f.Type.Name, f.JSName()) -} - -func (f *Field) JSDef(pkg string) string { - var jsType string - switch f.Type.Name { - case "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", "float32", "float64": - jsType = "number" - case "string": - jsType = "string" - case "bool": - jsType = "boolean" - default: - jsType = f.Type.Name - } - - var result string - isExternalStruct := f.Type.Package != "" && f.Type.Package != pkg && f.Type.IsStruct - if f.Type.Package == "" || f.Type.Package == pkg || !isExternalStruct { - result += fmt.Sprintf("%s: %s;", f.JSName(), jsType) - } else { - parts := strings.Split(f.Type.Package, "/") - result += fmt.Sprintf("%s: %s.%s;", f.JSName(), parts[len(parts)-1], jsType) - } - - if !ast.IsExported(f.Name) { - result += " // Warning: this is unexported in the Go struct." - } - - return result -} - -func (f *Field) JSDocType(pkg string) string { - var jsType string - switch f.Type.Name { - case "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", "float32", "float64": - jsType = "number" - case "string": - jsType = "string" - case "bool": - jsType = "boolean" - default: - jsType = f.Type.Name - } - - // If we are the same package, just return the type - externalPkgInfo := f.Project.packageCache[f.Type.Package] - if externalPkgInfo.Name == pkg { - return jsType - } - - var result string - isExternalStruct := f.Type.Package != "" && f.Type.Package != pkg && f.Type.IsStruct - if f.Type.Package == "" || !isExternalStruct { - if f.Type.IsStruct || f.Type.IsEnum { - // get the relative package directory - result = fmt.Sprintf("%s%s", externalPkgInfo.Name, f.Type.Name) - } else { - result = jsType - } - } else { - // get the relative package directory - result = fmt.Sprintf("%s%s", externalPkgInfo.Name, f.Type.Name) - } - - if !ast.IsExported(f.Name) { - result += " // Warning: this is unexported in the Go struct." - } - - return result -} - -func (f *Field) DefaultValue() string { - // Return the default value of the typescript version of the type as a string - switch f.Type.Name { - case "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uintptr", "float32", "float64", "uint64": - return "0" - case "string": - return `""` - case "bool": - return "false" - default: - return "null" - } -} - -type ConstDef struct { - Name string - DocComments []string - Value string -} - -type TypeDef struct { - Name string - DocComments []string - Type string - Consts []*ConstDef - ShouldGenerate bool -} - -func (t *TypeDef) GeneratedName() string { - return t.Name + "Enum" -} - -type ParsedPackage struct { - Pkg *ast.Package - Name string - Path string - Dir string - StructCache map[structName]*StructDef - TypeCache map[string]*TypeDef -} - -type Project struct { - packageCache map[string]*ParsedPackage - outputDirectory string - Path string - BoundMethods map[packagePath]map[structName][]*BoundMethod - Models map[packagePath]map[structName]*StructDef - Types map[packagePath]map[structName]*TypeDef - anonymousStructIDCounter int - Stats Stats -} - -type Stats struct { - NumPackages int - NumStructs int - NumMethods int - NumEnums int - NumModels int - StartTime time.Time - EndTime time.Time -} - -func ParseProject(projectPath string) (*Project, error) { - absPath, err := filepath.Abs(projectPath) - if err != nil { - return nil, err - } - result := &Project{ - Path: absPath, - BoundMethods: make(map[packagePath]map[structName][]*BoundMethod), - packageCache: make(map[string]*ParsedPackage), - } - result.Stats.StartTime = time.Now() - pkgs, err := result.parseDirectory(projectPath) - if err != nil { - return nil, err - } - err = result.findApplicationNewCalls(pkgs) - if err != nil { - return nil, err - } - for _, pkg := range result.packageCache { - if len(pkg.StructCache) > 0 { - if result.Models == nil { - result.Models = make(map[packagePath]map[structName]*StructDef) - } - result.Models[pkg.Path] = pkg.StructCache - } - } - return result, nil -} - -func GenerateBindingsAndModels(options *flags.GenerateBindingsOptions) (*Project, error) { - p, err := ParseProject(options.ProjectDirectory) - if err != nil { - return p, err - } - - if p.BoundMethods == nil { - return p, nil - } - err = os.MkdirAll(options.OutputDirectory, 0755) - if err != nil { - return p, err - } - - p.outputDirectory = options.OutputDirectory - - for _, pkg := range p.BoundMethods { - for _, boundMethods := range pkg { - p.Stats.NumMethods += len(boundMethods) - } - } - - generatedMethods := p.GenerateBindings(p.BoundMethods, options.ModelsFilename, options.UseIDs, options.TS, options.UseBundledRuntime) - for pkgDir, structs := range generatedMethods { - // Write the directory - err = os.MkdirAll(filepath.Join(options.OutputDirectory, pkgDir), 0755) - if err != nil && !os.IsExist(err) { - return p, err - } - // Write the files - for structName, text := range structs { - p.Stats.NumStructs++ - var filename string - if options.TS { - filename = structName + ".ts" - } else { - filename = structName + ".js" - } - err = os.WriteFile(filepath.Join(options.OutputDirectory, pkgDir, filename), []byte(text), 0644) - if err != nil { - return p, err - } - } - } - - p.Stats.NumModels = len(p.Models) - p.Stats.NumEnums = len(p.Types) - - // Generate Models - if len(p.Models) > 0 { - generatedModels, err := p.GenerateModels(p.Models, p.Types, options) - if err != nil { - return p, err - } - for pkgDir, text := range generatedModels { - // Write the directory - err = os.MkdirAll(filepath.Join(options.OutputDirectory, pkgDir), 0755) - if err != nil && !os.IsExist(err) { - return p, err - } - // Write the file - var filename string - if options.TS { - filename = options.ModelsFilename + ".ts" - } else { - filename = options.ModelsFilename + ".js" - } - err = os.WriteFile(filepath.Join(options.OutputDirectory, pkgDir, filename), []byte(text), 0644) - } - if err != nil { - return p, err - } - } - - p.Stats.EndTime = time.Now() - - return p, nil -} - -func (p *Project) parseDirectory(dir string) (map[string]*ParsedPackage, error) { - if p.packageCache[dir] != nil { - return map[string]*ParsedPackage{dir: p.packageCache[dir]}, nil - } - // Parse the directory - fset := token.NewFileSet() - if dir == "." || dir == "" { - cwd, err := os.Getwd() - if err != nil { - return nil, err - } - dir = cwd - } - pkgs, err := parser.ParseDir(fset, dir, nil, parser.ParseComments) - if err != nil { - return nil, err - } - var result = make(map[string]*ParsedPackage) - p.Stats.NumPackages = len(pkgs) - for packageName, pkg := range pkgs { - parsedPackage := &ParsedPackage{ - Pkg: pkg, - Name: packageName, - Path: packageName, - Dir: getDirectoryForPackage(pkg), - StructCache: make(map[structName]*StructDef), - TypeCache: make(map[string]*TypeDef), - } - p.parseTypes(map[string]*ParsedPackage{packageName: parsedPackage}) - p.packageCache[packageName] = parsedPackage - result[packageName] = parsedPackage - } - return result, nil -} - -func (p *Project) findApplicationNewCalls(pkgs map[string]*ParsedPackage) (err error) { - - var callFound bool - - p.parseTypes(pkgs) - - for _, pkg := range pkgs { - thisPackage := pkg.Pkg - // Iterate through the package's files - for _, file := range thisPackage.Files { - // Use an ast.Inspector to find the calls to application.New - ast.Inspect(file, func(n ast.Node) bool { - // Check for const declaration - genDecl, ok := n.(*ast.GenDecl) - if ok { - switch genDecl.Tok { - case token.TYPE: - var comments []string - if genDecl.Doc != nil { - comments = CommentGroupToText(genDecl.Doc) - } - for _, spec := range genDecl.Specs { - if typeSpec, ok := spec.(*ast.TypeSpec); ok { - p.parseTypeDeclaration(typeSpec, pkg, comments) - } - } - case token.CONST: - p.parseConstDeclaration(genDecl, pkg) - default: - } - return true - - } - - // Check if the node is a call expression - callExpr, ok := n.(*ast.CallExpr) - if !ok { - return true - } - - // Check if the function being called is "application.New" - selExpr, ok := callExpr.Fun.(*ast.SelectorExpr) - if !ok { - return true - } - if selExpr.Sel.Name != "New" { - return true - } - if id, ok := selExpr.X.(*ast.Ident); !ok || id.Name != "application" { - return true - } - - // Check there is only 1 argument - if len(callExpr.Args) != 1 { - return true - } - - // Check argument 1 is a struct literal - structLit, ok := callExpr.Args[0].(*ast.CompositeLit) - if !ok { - return true - } - - // Check struct literal is of type "application.Options" - selectorExpr, ok := structLit.Type.(*ast.SelectorExpr) - if !ok { - return true - } - if selectorExpr.Sel.Name != "Options" { - return true - } - if id, ok := selectorExpr.X.(*ast.Ident); !ok || id.Name != "application" { - return true - } - - for _, elt := range structLit.Elts { - // Find the "Bind" field - kvExpr, ok := elt.(*ast.KeyValueExpr) - if !ok { - continue - } - if id, ok := kvExpr.Key.(*ast.Ident); !ok || id.Name != "Bind" { - continue - } - // Check the value is a slice of interfaces - sliceExpr, ok := kvExpr.Value.(*ast.CompositeLit) - if !ok { - continue - } - var arrayType *ast.ArrayType - if arrayType, ok = sliceExpr.Type.(*ast.ArrayType); !ok { - continue - } - - // Check array type is of type "interface{}" - _, isInterfaceType := arrayType.Elt.(*ast.InterfaceType) - if !isInterfaceType { - // Check it's an "any" type - ident, isAnyType := arrayType.Elt.(*ast.Ident) - if !isAnyType { - continue - } - if ident.Name != "any" { - continue - } - } - callFound = true - // Iterate through the slice elements - for _, elt := range sliceExpr.Elts { - result, shouldContinue := p.parseBoundExpression(elt, pkg) - if shouldContinue { - continue - } - return result - - } - } - - return true - }) - } - p.addTypes(pkg.Path, pkg.TypeCache) - if !callFound { - return ErrNoBindingsFound - } - } - return nil -} - -func (p *Project) parseBoundUnaryExpression(unaryExpr *ast.UnaryExpr, pkg *ParsedPackage) (bool, bool) { - // Check the unary expression is a composite lit - - switch t := unaryExpr.X.(type) { - case *ast.CompositeLit: - return p.parseBoundCompositeLit(t, pkg) - } - return false, true - -} - -func (p *Project) addBoundMethods(packagePath string, name string, boundMethods []*BoundMethod) { - _, ok := p.BoundMethods[packagePath] - if !ok { - p.BoundMethods[packagePath] = make(map[structName][]*BoundMethod) - } - p.BoundMethods[packagePath][name] = boundMethods -} - -func (p *Project) parseBoundStructMethods(name string, pkg *ParsedPackage) error { - var methods []*BoundMethod - // Iterate over all files in the package - for _, file := range pkg.Pkg.Files { - // Iterate over all declarations in the file - for _, decl := range file.Decls { - // Check if the declaration is a type declaration - if funcDecl, ok := decl.(*ast.FuncDecl); ok && funcDecl.Recv != nil && funcDecl.Name.IsExported() { - var ident *ast.Ident - var ok bool - - switch funcDecl.Recv.List[0].Type.(type) { - case *ast.StarExpr: - recv := funcDecl.Recv.List[0].Type.(*ast.StarExpr) - ident, ok = recv.X.(*ast.Ident) - case *ast.Ident: - ident, ok = funcDecl.Recv.List[0].Type.(*ast.Ident) - } - if ok && ident.Name == name { - fqn := fmt.Sprintf("%s.%s.%s", pkg.Path, name, funcDecl.Name.Name) - - var alias *uint32 - var err error - // Check for the text `wails:methodID ` - if funcDecl.Doc != nil { - for _, docstring := range funcDecl.Doc.List { - if strings.Contains(docstring.Text, "//wails:methodID") { - idString := strings.TrimSpace(strings.TrimPrefix(docstring.Text, "//wails:methodID")) - parsedID, err := strconv.ParseUint(idString, 10, 32) - if err != nil { - return fmt.Errorf("invalid value in `wails:methodID` directive: '%s'. Expected a valid uint32 value", idString) - } - alias = lo.ToPtr(uint32(parsedID)) - break - } - } - } - id, err := hash.Fnv(fqn) - if err != nil { - return err - } - - method := &BoundMethod{ - Package: pkg.Path, - PackageDir: pkg.Dir, - ID: id, - Name: funcDecl.Name.Name, - DocComment: strings.TrimSpace(funcDecl.Doc.Text()), - Alias: alias, - } - - if funcDecl.Type.Params != nil { - method.Inputs = p.parseParameters(funcDecl.Type.Params, pkg) - } - if funcDecl.Type.Results != nil { - method.Outputs = p.parseParameters(funcDecl.Type.Results, pkg) - } - - methods = append(methods, method) - } - - } - } - } - p.addBoundMethods(pkg.Path, name, methods) - return nil -} - -func (p *Project) addTypes(packagePath string, types map[string]*TypeDef) { - if types == nil || len(types) == 0 { - return - } - if p.Types == nil { - p.Types = make(map[string]map[string]*TypeDef) - } - _, ok := p.Types[packagePath] - if !ok { - p.Types[packagePath] = make(map[string]*TypeDef) - } - p.Types[packagePath] = types -} - -func (p *Project) parseParameters(params *ast.FieldList, pkg *ParsedPackage) []*Parameter { - var result []*Parameter - for _, field := range params.List { - var theseFields []*Parameter - if len(field.Names) > 0 { - for _, name := range field.Names { - theseFields = append(theseFields, &Parameter{ - Name: name.Name, - }) - } - } else { - theseFields = append(theseFields, &Parameter{ - Name: "", - }) - } - // loop over fields - for _, thisField := range theseFields { - thisField.Type = p.parseParameterType(field, pkg) - result = append(result, thisField) - } - } - return result -} - -func (p *Project) parseParameterType(field *ast.Field, pkg *ParsedPackage) *ParameterType { - result := &ParameterType{ - Package: pkg.Path, - } - result.Name = getTypeString(field.Type) - switch t := field.Type.(type) { - case *ast.Ident: - result.IsStruct = isStructType(t) - if !result.IsStruct { - // Check if it's a type alias - typeDef, ok := pkg.TypeCache[t.Name] - if ok { - typeDef.ShouldGenerate = true - result.IsEnum = true - } - } - case *ast.StarExpr: - result = p.parseParameterType(&ast.Field{Type: t.X}, pkg) - result.IsPointer = true - case *ast.StructType: - result.IsStruct = true - if result.Name == "" { - // Anonymous struct - result.Name = p.anonymousStructID() - // Create a new struct definition - result := &StructDef{ - Name: result.Name, - DocComments: CommentGroupToText(field.Doc), - } - pkg.StructCache[result.Name] = result - // Parse the fields - result.Fields = p.parseStructFields(&ast.StructType{ - Fields: t.Fields, - }, pkg) - _ = result - } - case *ast.SelectorExpr: - extPackage, err := p.getParsedPackageFromName(t.X.(*ast.Ident).Name, pkg) - if err != nil { - log.Fatal(err) - } - result.IsStruct = p.getStructDef(t.Sel.Name, extPackage) - if !result.IsStruct { - // Check if it's a type alias - typeDef, ok := extPackage.TypeCache[t.Sel.Name] - if ok { - typeDef.ShouldGenerate = true - result.IsEnum = true - } - } - result.Package = extPackage.Path - case *ast.ArrayType: - result.IsSlice = true - result.IsStruct = isStructType(t.Elt) - case *ast.MapType: - tempfield := &ast.Field{Type: t.Key} - result.MapKey = p.parseParameterType(tempfield, pkg) - tempfield.Type = t.Value - result.MapValue = p.parseParameterType(tempfield, pkg) - default: - } - if result.IsStruct { - p.getStructDef(result.Name, pkg) - if result.Package == "" { - result.Package = pkg.Path - } - } - return result -} - -func (p *Project) getStructDef(name string, pkg *ParsedPackage) bool { - _, ok := pkg.StructCache[name] - if ok { - return true - } - // Iterate over all files in the package - for _, file := range pkg.Pkg.Files { - // Iterate over all declarations in the file - for _, decl := range file.Decls { - // Check if the declaration is a type declaration - if typeDecl, ok := decl.(*ast.GenDecl); ok { - // Check if the type declaration is a struct type - if typeDecl.Tok == token.TYPE { - for _, spec := range typeDecl.Specs { - if typeSpec, ok := spec.(*ast.TypeSpec); ok { - if structType, ok := typeSpec.Type.(*ast.StructType); ok { - if typeSpec.Name.Name == name { - result := &StructDef{ - Name: name, - DocComments: CommentGroupToText(typeDecl.Doc), - } - pkg.StructCache[name] = result - result.Fields = p.parseStructFields(structType, pkg) - return true - } - } - } - } - } - } - } - } - return false -} - -func (p *Project) parseStructFields(structType *ast.StructType, pkg *ParsedPackage) []*Field { - var result []*Field - for _, field := range structType.Fields.List { - var theseFields []*Field - if len(field.Names) > 0 { - for _, name := range field.Names { - theseFields = append(theseFields, &Field{ - Project: p, - Name: name.Name, - }) - } - } else { - theseFields = append(theseFields, &Field{ - Project: p, - Name: "", - }) - } - // loop over fields - for _, thisField := range theseFields { - paramType := p.parseParameterType(field, pkg) - if paramType.IsStruct { - _, ok := pkg.StructCache[paramType.Name] - if !ok { - p.getStructDef(paramType.Name, pkg) - } - } - if paramType.Package == "" { - paramType.Package = pkg.Path - } - thisField.Type = paramType - result = append(result, thisField) - } - } - return result -} - -func (p *Project) getParsedPackageFromName(packageName string, currentPackage *ParsedPackage) (*ParsedPackage, error) { - for _, file := range currentPackage.Pkg.Files { - for _, imp := range file.Imports { - path, err := strconv.Unquote(imp.Path.Value) - if err != nil { - return nil, err - } - _, lastPathElement := filepath.Split(path) - if imp.Name != nil && imp.Name.Name == packageName || lastPathElement == packageName { - // Get the directory for the package - dir, err := getPackageDir(path) - if err != nil { - return nil, err - } - pkg, err := p.getPackageFromPath(dir, path) - if err != nil { - return nil, err - } - result := &ParsedPackage{ - Pkg: pkg, - Name: packageName, - Path: path, - Dir: dir, - StructCache: make(map[string]*StructDef), - TypeCache: make(map[string]*TypeDef), - } - p.packageCache[path] = result - - // Parse types - p.parseTypes(map[string]*ParsedPackage{path: result}) - - return result, nil - } - } - } - return nil, fmt.Errorf("package %s not found in %s", packageName, currentPackage.Name) -} - -func getPackageDir(importPath string) (string, error) { - pkg, err := build.Import(importPath, "", build.FindOnly) - if err != nil { - return "", err - } - return pkg.Dir, nil -} - -func (p *Project) getPackageFromPath(packagedir string, packagepath string) (*ast.Package, error) { - impPkg, err := parser.ParseDir(token.NewFileSet(), packagedir, nil, parser.AllErrors|parser.ParseComments) - if err != nil { - return nil, err - } - for impName, impPkg := range impPkg { - if impName == "main" { - continue - } - return impPkg, nil - } - return nil, fmt.Errorf("package not found in imported package %s", packagepath) -} - -func (p *Project) anonymousStructID() string { - p.anonymousStructIDCounter++ - return fmt.Sprintf("anon%d", p.anonymousStructIDCounter) -} - -func (p *Project) parseBoundExpression(elt ast.Expr, pkg *ParsedPackage) (bool, bool) { - - switch t := elt.(type) { - case *ast.UnaryExpr: - return p.parseBoundUnaryExpression(t, pkg) - case *ast.Ident: - return p.parseBoundIdent(t, pkg) - case *ast.CallExpr: - return p.parseBoundCallExpression(t, pkg) - default: - println("unhandled expression type", reflect.TypeOf(t).String()) - } - - return false, false -} - -func (p *Project) parseBoundIdent(ident *ast.Ident, pkg *ParsedPackage) (bool, bool) { - if ident.Obj == nil { - return false, true - } - switch t := ident.Obj.Decl.(type) { - //case *ast.StructType: - // return p.parseBoundStruct(t, pkg) - case *ast.TypeSpec: - return p.parseBoundTypeSpec(t, pkg) - case *ast.AssignStmt: - return p.parseBoundAssignment(t, pkg) - default: - println("unhandled ident type", reflect.TypeOf(t).String()) - } - return false, false -} - -func (p *Project) parseBoundAssignment(assign *ast.AssignStmt, pkg *ParsedPackage) (bool, bool) { - return p.parseBoundExpression(assign.Rhs[0], pkg) -} - -func (p *Project) parseBoundCompositeLit(lit *ast.CompositeLit, pkg *ParsedPackage) (bool, bool) { - - switch t := lit.Type.(type) { - case *ast.StructType: - //return p.parseBoundStructType(t, pkg) - return false, true - case *ast.Ident: - err := p.parseBoundStructMethods(t.Name, pkg) - if err != nil { - return true, false - } - return false, true - case *ast.SelectorExpr: - return p.parseBoundSelectorExpression(t, pkg) - } - - return false, true -} - -func (p *Project) parseBoundSelectorExpression(selector *ast.SelectorExpr, pkg *ParsedPackage) (bool, bool) { - - switch t := selector.X.(type) { - case *ast.Ident: - // Look up the package - var parsedPackage *ParsedPackage - parsedPackage, err := p.getParsedPackageFromName(t.Name, pkg) - if err != nil { - return true, false - } - err = p.parseBoundStructMethods(selector.Sel.Name, parsedPackage) - if err != nil { - return true, false - } - return false, true - default: - println("unhandled selector type", reflect.TypeOf(t).String()) - } - return false, true -} - -func (p *Project) parseBoundCallExpression(callExpr *ast.CallExpr, pkg *ParsedPackage) (bool, bool) { - - // Check if this call returns a struct pointer - switch t := callExpr.Fun.(type) { - case *ast.Ident: - if t.Obj == nil { - return false, true - } - switch t := t.Obj.Decl.(type) { - case *ast.FuncDecl: - return p.parseBoundFuncDecl(t, pkg) - } - - case *ast.SelectorExpr: - // Get package for selector - var parsedPackage *ParsedPackage - parsedPackage, err := p.getParsedPackageFromName(t.X.(*ast.Ident).Name, pkg) - if err != nil { - return true, false - } - // Get function from package - var extFundDecl *ast.FuncDecl - extFundDecl, err = p.getFunctionFromName(t.Sel.Name, parsedPackage) - if err != nil { - return true, false - } - return p.parseBoundFuncDecl(extFundDecl, parsedPackage) - default: - println("unhandled call type", reflect.TypeOf(t).String()) - } - - return false, true -} - -func (p *Project) parseBoundFuncDecl(t *ast.FuncDecl, pkg *ParsedPackage) (bool, bool) { - if t.Type.Results == nil { - return false, true - } - if len(t.Type.Results.List) != 1 { - return false, true - } - switch t := t.Type.Results.List[0].Type.(type) { - case *ast.StarExpr: - return p.parseBoundExpression(t.X, pkg) - default: - println("Unhandled funcdecl type", reflect.TypeOf(t).String()) - } - return false, false -} - -func (p *Project) parseBoundTypeSpec(typeSpec *ast.TypeSpec, pkg *ParsedPackage) (bool, bool) { - switch t := typeSpec.Type.(type) { - case *ast.StructType: - err := p.parseBoundStructMethods(typeSpec.Name.Name, pkg) - if err != nil { - return true, false - } - default: - println("unhandled type spec type", reflect.TypeOf(t).String()) - } - return false, true -} - -func (p *Project) getFunctionFromName(name string, parsedPackage *ParsedPackage) (*ast.FuncDecl, error) { - for _, f := range parsedPackage.Pkg.Files { - for _, decl := range f.Decls { - switch t := decl.(type) { - case *ast.FuncDecl: - if t.Name.Name == name { - return t, nil - } - } - } - } - return nil, fmt.Errorf("function not found") -} - -func (p *Project) parseTypeDeclaration(decl *ast.TypeSpec, pkg *ParsedPackage, comments []string) { - switch t := decl.Type.(type) { - case *ast.Ident: - switch t.Name { - case "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64", - "uintptr", "float32", "float64", "string", "bool": - // Store this in the type cache - pkg.TypeCache[decl.Name.Name] = &TypeDef{ - Name: decl.Name.Name, - Type: t.Name, - DocComments: TrimSlice(comments), - } - } - } -} - -func (p *Project) parseConstDeclaration(decl *ast.GenDecl, pkg *ParsedPackage) { - // Check if the type of the constant is in the type cache and if it doesn't exist, return - var latestValues []ast.Expr - - for _, spec := range decl.Specs { - valueSpec, ok := spec.(*ast.ValueSpec) - if !ok { - continue - } - // Extract the Type - typeString := getTypeString(valueSpec.Type) - if typeString == "" { - continue - } - // Check if the type is in the type cache - typeDecl, ok := pkg.TypeCache[typeString] - if !ok { - continue - } - - // Get the latest values - if len(valueSpec.Values) > 0 { - latestValues = valueSpec.Values - } - - // Iterate over the names - for index, name := range valueSpec.Names { - constDecl := &ConstDef{ - Name: name.Name, - Value: typeString, - } - - // Get the value - if len(latestValues) > 0 { - switch t := latestValues[index].(type) { - case *ast.BasicLit: - constDecl.Value = t.Value - case *ast.Ident: - constDecl.Value = t.Name - } - } - - if valueSpec.Doc != nil { - constDecl.DocComments = CommentGroupToText(valueSpec.Doc) - } - typeDecl.Consts = append(typeDecl.Consts, constDecl) - } - } -} - -func (p *Project) RelativePackageDir(path string) string { - - // Get the package details - pkgInfo, ok := p.packageCache[path] - if !ok { - panic("package not found: " + path) - } - - result := filepath.ToSlash(strings.TrimPrefix(pkgInfo.Dir, p.Path)) - if result == "" { - return "main" - } - // Remove the leading slash - if result[0] == '/' || result[0] == '\\' { - result = result[1:] - } - return result -} - -func (p *Project) parseTypes(pkgs map[string]*ParsedPackage) { - for _, pkg := range pkgs { - thisPackage := pkg.Pkg - // Iterate through the package's files - for _, file := range thisPackage.Files { - // Use an ast.Inspector to find the calls to application.New - ast.Inspect(file, func(n ast.Node) bool { - // Check for const declaration - genDecl, ok := n.(*ast.GenDecl) - if ok { - switch genDecl.Tok { - case token.TYPE: - var comments []string - if genDecl.Doc != nil { - comments = CommentGroupToText(genDecl.Doc) - } - for _, spec := range genDecl.Specs { - if typeSpec, ok := spec.(*ast.TypeSpec); ok { - p.parseTypeDeclaration(typeSpec, pkg, comments) - } - } - case token.CONST: - p.parseConstDeclaration(genDecl, pkg) - default: - } - return true - - } - - return true - }) - } - p.addTypes(pkg.Path, pkg.TypeCache) - } -} - -func (p *Project) RelativeBindingsDir(dir *ParsedPackage, dir2 *ParsedPackage) string { - if dir.Dir == dir2.Dir { - return "." - } - - // Calculate the relative path from the bindings directory of dir to that of dir2 - var ( - absoluteSourceDir string - absoluteTargetDir string - ) - - if dir.Dir == p.Path { - absoluteSourceDir = filepath.Join(p.Path, p.outputDirectory, "main") - } else { - relativeSourceDir := strings.TrimPrefix(dir.Dir, p.Path) - absoluteSourceDir = filepath.Join(p.Path, p.outputDirectory, relativeSourceDir) - } - - if dir2.Dir == p.Path { - absoluteTargetDir = filepath.Join(p.Path, p.outputDirectory, "main") - } else { - relativeTargetDir := strings.TrimPrefix(dir2.Dir, p.Path) - absoluteTargetDir = filepath.Join(p.Path, p.outputDirectory, relativeTargetDir) - } - - relativePath, err := filepath.Rel(absoluteSourceDir, absoluteTargetDir) - if err != nil { - panic(err) - } - - return filepath.ToSlash(relativePath) -} - -type ImportDef struct { - Name string - Path string - VarName string - PackageName string -} - -func (p *Project) calculateImports(pkg string, m map[structName]*StructDef) []*ImportDef { - var result []*ImportDef - for _, structDef := range m { - for _, field := range structDef.Fields { - if field.Type.Package != pkg { - // Find the relative path from the source directory to the target directory - fieldPkgInfo := p.packageCache[field.Type.Package] - relativePath := p.RelativeBindingsDir(p.packageCache[pkg], fieldPkgInfo) - result = append(result, &ImportDef{ - PackageName: fieldPkgInfo.Name, - Name: field.Name, - Path: relativePath, - VarName: fieldPkgInfo.Name + field.Name, - }) - } - } - } - return result -} - -func getTypeString(expr ast.Expr) string { - switch t := expr.(type) { - case *ast.Ident: - return t.Name - case *ast.StarExpr: - return getTypeString(t.X) - case *ast.ArrayType: - return getTypeString(t.Elt) - case *ast.MapType: - return "map" - case *ast.SelectorExpr: - return getTypeString(t.Sel) - default: - return "" - } -} - -func isStructType(expr ast.Expr) bool { - switch e := expr.(type) { - case *ast.StructType: - return true - case *ast.StarExpr: - return isStructType(e.X) - case *ast.SelectorExpr: - return isStructType(e.Sel) - case *ast.ArrayType: - return isStructType(e.Elt) - case *ast.SliceExpr: - return isStructType(e.X) - case *ast.Ident: - if e.Obj != nil && e.Obj.Kind == ast.Typ { - return isStructType(e.Obj.Decl.(*ast.TypeSpec).Type) - } - return false - default: - return false - } -} - -func getDirectoryForPackage(pkg *ast.Package) string { - for filename := range pkg.Files { - path := filepath.Dir(filename) - abs, err := filepath.Abs(path) - if err != nil { - panic(err) - } - return abs - } - return "" -} - -func CommentGroupToText(comments *ast.CommentGroup) []string { - if comments == nil { - return nil - } - var result []string - for _, comment := range comments.List { - result = append(result, strings.TrimSpace(comment.Text)) - } - return result -} - -func TrimSlice(comments []string) []string { - for i, comment := range comments { - comments[i] = strings.TrimSpace(comment) - } - return comments -} diff --git a/v3/internal/parser/parser_enum_test.go b/v3/internal/parser/parser_enum_test.go deleted file mode 100644 index e3a7e5bdffb..00000000000 --- a/v3/internal/parser/parser_enum_test.go +++ /dev/null @@ -1,196 +0,0 @@ -package parser - -import ( - "reflect" - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestParseEnum(t *testing.T) { - tests := []struct { - name string - dir string - wantBoundMethods map[string]map[string][]*BoundMethod - wantEnums map[string]map[string]*EnumDef - wantModels map[string]map[string]*StructDef - wantTypes map[string]map[string]*TypeDef - wantErr bool - }{ - { - name: "should find a bound service with an enum", - dir: "testdata/enum", - wantErr: false, - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "Greet does XYZ", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - { - Name: "title", - Type: &ParameterType{ - Package: "main", - Name: "Title", - IsEnum: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - { - Package: "main", - Name: "NewPerson", - DocComment: "NewPerson creates a new person", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsStruct: true, - IsPointer: true, - }, - }, - }, - ID: 1661412647, - }, - }, - }, - }, - wantTypes: map[string]map[string]*TypeDef{ - "main": { - "Title": { - Name: "Title", - DocComments: []string{"// Title is a title"}, - Type: "string", - Consts: []*ConstDef{ - { - Name: "Mister", - DocComments: []string{"// Mister is a title"}, - Value: `"Mr"`, - }, - { - Name: "Miss", - Value: `"Miss"`, - }, - { - Name: "Ms", - Value: `"Ms"`, - }, - { - Name: "Mrs", - Value: `"Mrs"`, - }, - { - Name: "Dr", - Value: `"Dr"`, - }, - }, - ShouldGenerate: true, - }, - }, - }, - wantModels: map[string]map[string]*StructDef{ - "main": { - "Person": { - Name: "Person", - DocComments: []string{"// Person represents a person"}, - Fields: []*Field{ - { - Name: "Title", - Type: &ParameterType{ - Package: "main", - Name: "Title", - IsEnum: true, - }, - }, - { - Name: "Name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - }, - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := ParseProject(tt.dir) - if (err != nil) != tt.wantErr { - t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) - return - } - - // Patch the PackageDir in the wantBoundMethods - for _, packageData := range got.BoundMethods { - for _, boundMethods := range packageData { - for _, boundMethod := range boundMethods { - boundMethod.PackageDir = "" - } - } - } - - // Loop over the things we want - for packageName, packageData := range tt.wantBoundMethods { - for structName, wantBoundMethods := range packageData { - gotBoundMethods := got.BoundMethods[packageName][structName] - if diff := cmp.Diff(wantBoundMethods, gotBoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - } - } - - // Loop over the models - for _, packageData := range got.Models { - for _, wantModel := range packageData { - // Loop over the Fields - for _, field := range wantModel.Fields { - field.Project = nil - } - } - } - - if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - if !reflect.DeepEqual(tt.wantModels, got.Models) { - t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantModels, got.Models)) - } - if diff := cmp.Diff(tt.wantTypes, got.Types); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - }) - } - -} diff --git a/v3/internal/parser/parser_function_test.go b/v3/internal/parser/parser_function_test.go deleted file mode 100644 index c11d3aa9131..00000000000 --- a/v3/internal/parser/parser_function_test.go +++ /dev/null @@ -1,242 +0,0 @@ -package parser - -import ( - "reflect" - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestParseFunction(t *testing.T) { - tests := []struct { - name string - dir string - wantBoundMethods map[string]map[string][]*BoundMethod - wantEnums map[string]map[string]*EnumDef - wantModels map[string]map[string]*StructDef - wantTypes map[string]map[string]*TypeDef - wantErr bool - }{ - { - name: "should find a bound service returned from a function call", - dir: "testdata/function_single", - wantErr: false, - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "Greet someone", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - }, - }, - }, - }, - { - name: "should find a bound service returned from a function call in another package", - dir: "testdata/function_from_imported_package", - wantErr: false, - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "Greet does XYZ", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - { - Package: "main", - Name: "NewPerson", - DocComment: "NewPerson creates a new person", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsPointer: true, - IsStruct: true, - }, - }, - }, - ID: 1661412647, - }, - }, - }, - "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services": { - "OtherService": { - { - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services", - Name: "Yay", - DocComment: "Yay does this and that", - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Name: "Address", - IsStruct: true, - IsPointer: true, - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services", - }, - }, - }, - ID: 1592414782, - }, - }, - }, - }, - wantModels: map[string]map[string]*StructDef{ - "main": { - "Person": { - Name: "Person", - DocComments: []string{"// Person is a person"}, - Fields: []*Field{ - { - Name: "Name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - { - Name: "Address", - Type: &ParameterType{ - Name: "Address", - IsStruct: true, - IsPointer: true, - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services", - }, - }, - }, - }, - }, - "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services": { - "Address": { - Name: "Address", - Fields: []*Field{ - { - Name: "Street", - Type: &ParameterType{ - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services", - Name: "string", - }, - }, - { - Name: "State", - Type: &ParameterType{ - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services", - Name: "string", - }, - }, - { - Name: "Country", - Type: &ParameterType{ - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services", - Name: "string", - }, - }, - }, - }, - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := ParseProject(tt.dir) - if (err != nil) != tt.wantErr { - t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) - return - } - - // Patch the PackageDir in the wantBoundMethods - for _, packageData := range got.BoundMethods { - for _, boundMethods := range packageData { - for _, boundMethod := range boundMethods { - boundMethod.PackageDir = "" - } - } - } - - // Loop over the things we want - for packageName, packageData := range tt.wantBoundMethods { - for structName, wantBoundMethods := range packageData { - gotBoundMethods := got.BoundMethods[packageName][structName] - if diff := cmp.Diff(wantBoundMethods, gotBoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - } - } - - // Loop over the models - for _, packageData := range got.Models { - for _, wantModel := range packageData { - // Loop over the Fields - for _, field := range wantModel.Fields { - field.Project = nil - } - } - } - - if !reflect.DeepEqual(tt.wantBoundMethods, got.BoundMethods) { - t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantBoundMethods, got.BoundMethods, cmp.AllowUnexported(Parameter{}))) - //spew.Dump(tt.wantBoundMethods) - //spew.Dump(got.BoundMethods) - } - if !reflect.DeepEqual(tt.wantModels, got.Models) { - t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantModels, got.Models)) - } - if diff := cmp.Diff(tt.wantTypes, got.Types); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - }) - } - -} diff --git a/v3/internal/parser/parser_struct_literal_multiple_test.go b/v3/internal/parser/parser_struct_literal_multiple_test.go deleted file mode 100644 index 09d962f3762..00000000000 --- a/v3/internal/parser/parser_struct_literal_multiple_test.go +++ /dev/null @@ -1,288 +0,0 @@ -package parser - -import ( - "reflect" - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestParseStructLiteralMultiple(t *testing.T) { - tests := []struct { - name string - dir string - wantBoundMethods map[string]map[string][]*BoundMethod - wantEnums map[string]map[string]*EnumDef - wantModels map[string]map[string]*StructDef - wantTypes map[string]map[string]*TypeDef - wantErr bool - }{ - { - name: "should find multiple bound services", - dir: "testdata/struct_literal_multiple", - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - }, - "OtherService": { - { - Package: "main", - Name: "Hello", - ID: 4249972365, - }, - }, - }, - }, - wantErr: false, - }, - { - name: "should find multiple bound services over multiple files", - dir: "testdata/struct_literal_multiple_files", - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - }, - "OtherService": { - { - Package: "main", - Name: "Hello", - ID: 4249972365, - }, - }, - }, - }, - wantErr: false, - }, - { - name: "should find multiple bound services over multiple packages", - dir: "testdata/struct_literal_multiple_other", - wantErr: false, - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "Greet does XYZ", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - { - Package: "main", - Name: "NewPerson", - DocComment: "NewPerson creates a new person", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsPointer: true, - IsStruct: true, - }, - }, - }, - ID: 1661412647, - }, - }, - }, - "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services": { - "OtherService": { - { - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services", - Name: "Yay", - DocComment: "Yay does this and that", - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Name: "Address", - IsStruct: true, - IsPointer: true, - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services", - }, - }, - }, - ID: 469445984, - }, - }, - }, - }, - wantModels: map[string]map[string]*StructDef{ - "main": { - "Person": { - Name: "Person", - Fields: []*Field{ - { - Name: "Name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - { - Name: "Address", - Type: &ParameterType{ - Name: "Address", - IsStruct: true, - IsPointer: true, - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services", - }, - }, - }, - }, - }, - "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services": { - "Address": { - Name: "Address", - Fields: []*Field{ - { - Name: "Street", - Type: &ParameterType{ - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services", - Name: "string", - }, - }, - { - Name: "State", - Type: &ParameterType{ - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services", - Name: "string", - }, - }, - { - Name: "Country", - Type: &ParameterType{ - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/struct_literal_multiple_other/services", - Name: "string", - }, - }, - }, - }, - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := ParseProject(tt.dir) - if (err != nil) != tt.wantErr { - t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) - return - } - - // Patch the PackageDir in the wantBoundMethods - for _, packageData := range got.BoundMethods { - for _, boundMethods := range packageData { - for _, boundMethod := range boundMethods { - boundMethod.PackageDir = "" - } - } - } - - // Loop over the things we want - for packageName, packageData := range tt.wantBoundMethods { - for structName, wantBoundMethods := range packageData { - gotBoundMethods := got.BoundMethods[packageName][structName] - if diff := cmp.Diff(wantBoundMethods, gotBoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - } - } - - // Loop over the models - for _, packageData := range got.Models { - for _, wantModel := range packageData { - // Loop over the Fields - for _, field := range wantModel.Fields { - field.Project = nil - } - } - } - - if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - if !reflect.DeepEqual(tt.wantModels, got.Models) { - t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantModels, got.Models)) - } - if diff := cmp.Diff(tt.wantTypes, got.Types); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - }) - } - -} diff --git a/v3/internal/parser/parser_struct_literal_non_pointer_single_test.go b/v3/internal/parser/parser_struct_literal_non_pointer_single_test.go deleted file mode 100644 index ad06666e15a..00000000000 --- a/v3/internal/parser/parser_struct_literal_non_pointer_single_test.go +++ /dev/null @@ -1,1164 +0,0 @@ -package parser - -import ( - "reflect" - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestParseStructLiteralNonPointerSingle(t *testing.T) { - tests := []struct { - name string - dir string - wantBoundMethods map[string]map[string][]*BoundMethod - wantEnums map[string]map[string]*EnumDef - wantModels map[string]map[string]*StructDef - wantTypes map[string]map[string]*TypeDef - wantErr bool - }{ - { - name: "should find single bound service (non-pointer receiver)", - dir: "testdata/struct_literal_non_pointer_single", - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "Greet someone", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - { - Package: "main", - Name: "NoInputsStringOut", - DocComment: "", - Inputs: nil, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1075577233, - }, - { - Package: "main", - Name: "StringArrayInputStringOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1091960237, - }, - { - Package: "main", - Name: "StringArrayInputStringArrayOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - ID: 383995060, - }, - { - Package: "main", - Name: "StringArrayInputNamedOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "output", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - ID: 3678582682, - }, - { - Package: "main", - Name: "StringArrayInputNamedOutputs", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "output", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - { - Name: "err", - Type: &ParameterType{ - Package: "main", - Name: "error", - }, - }, - }, - ID: 319259595, - }, - { - Package: "main", - Name: "IntPointerInputNamedOutputs", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "output", - Type: &ParameterType{ - Package: "main", - Name: "int", - IsPointer: true, - }, - }, - { - Name: "err", - Type: &ParameterType{ - Package: "main", - Name: "error", - }}, - }, - ID: 2718999663, - }, - { - Package: "main", - Name: "UIntPointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint", - IsPointer: true, - }, - }, - }, - ID: 1367187362, - }, - { - Package: "main", - Name: "UInt8PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint8", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint8", - IsPointer: true, - }, - }, - }, - ID: 518250834, - }, - { - Package: "main", - Name: "UInt16PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint16", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint16", - IsPointer: true, - }, - }, - }, - ID: 1236957573, - }, - { - Package: "main", - Name: "UInt32PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint32", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint32", - IsPointer: true, - }, - }, - }, - ID: 1739300671, - }, - { - Package: "main", - Name: "UInt64PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint64", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint64", - IsPointer: true, - }, - }, - }, - ID: 1403757716, - }, - { - Package: "main", - Name: "IntPointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int", - IsPointer: true, - }, - }, - }, - ID: 1066151743, - }, - { - Package: "main", - Name: "Int8PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int8", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int8", - IsPointer: true, - }, - }, - }, - ID: 2189402897, - }, - { - Package: "main", - Name: "Int16PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int16", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int16", - IsPointer: true, - }, - }, - }, - ID: 1754277916, - }, - { - Package: "main", - Name: "Int32PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int32", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int32", - IsPointer: true, - }, - }, - }, - ID: 4251088558, - }, - { - Package: "main", - Name: "Int64PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int64", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int64", - IsPointer: true, - }, - }, - }, - ID: 2205561041, - }, - { - Package: "main", - Name: "IntInIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int", - }, - }, - }, - ID: 642881729, - }, - { - Package: "main", - Name: "Int8InIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int8", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int8", - }, - }, - }, - ID: 572240879, - }, - { - Package: "main", - Name: "Int16InIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int16", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int16", - }, - }, - }, - ID: 3306292566, - }, - { - Package: "main", - Name: "Int32InIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int32", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int32", - }, - }, - }, - ID: 1909469092, - }, - { - Package: "main", - Name: "Int64InIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int64", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int64", - }, - }, - }, - ID: 1343888303, - }, - { - Package: "main", - Name: "UIntInUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint", - }, - }, - }, - ID: 2836661285, - }, - { - Package: "main", - Name: "UInt8InUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint8", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint8", - }, - }, - }, - ID: 2988345717, - }, - { - Package: "main", - Name: "UInt16InUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint16", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint16", - }, - }, - }, - ID: 3401034892, - }, - { - Package: "main", - Name: "UInt32InUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint32", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint32", - }, - }, - }, - ID: 1160383782, - }, - { - Package: "main", - Name: "UInt64InUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint64", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint64", - }, - }, - }, - ID: 793803239, - }, - { - Package: "main", - Name: "Float32InFloat32Out", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "float32", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "float32", - }, - }, - }, - ID: 3132595881, - }, - { - Package: "main", - Name: "Float64InFloat64Out", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "float64", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "float64", - }, - }, - }, - ID: 2182412247, - }, - { - Package: "main", - Name: "PointerFloat32InFloat32Out", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "float32", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "float32", - IsPointer: true, - }, - }, - }, - ID: 224675106, - }, - { - Package: "main", - Name: "PointerFloat64InFloat64Out", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "float64", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "float64", - IsPointer: true, - }, - }, - }, - ID: 2124953624, - }, - { - Package: "main", - Name: "BoolInBoolOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "bool", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "bool", - }, - }, - }, - ID: 2424639793, - }, - { - Package: "main", - Name: "PointerBoolInBoolOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "bool", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "bool", - IsPointer: true, - }, - }, - }, - ID: 3589606958, - }, - { - Package: "main", - Name: "PointerStringInStringOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "string", - IsPointer: true, - }, - }, - }, - ID: 229603958, - }, - { - Package: "main", - Name: "StructPointerInputErrorOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsPointer: true, - IsStruct: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "error", - }, - }, - }, - ID: 2447692557, - }, - { - Package: "main", - Name: "StructInputStructOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsStruct: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsStruct: true, - }, - }, - }, - ID: 3835643147, - }, - { - Package: "main", - Name: "StructPointerInputStructPointerOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsPointer: true, - IsStruct: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsPointer: true, - IsStruct: true, - }, - }, - }, - ID: 2943477349, - }, - { - Package: "main", - Name: "MapIntInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - Package: "main", - }, - }, - }, - }, - ID: 2386486356, - }, - { - Package: "main", - Name: "PointerMapIntInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - IsPointer: true, - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - Package: "main", - }, - }, - }, - }, - ID: 3516977899, - }, - { - Package: "main", - Name: "MapIntPointerInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - IsPointer: true, - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - Package: "main", - }, - }, - }, - }, - ID: 550413585, - }, - { - Package: "main", - Name: "MapIntSliceInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - IsSlice: true, - Package: "main", - }, - }, - }, - }, - ID: 2900172572, - }, - { - Package: "main", - Name: "MapIntSliceIntInMapIntSliceIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - IsSlice: true, - Package: "main", - }, - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "out", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - IsSlice: true, - Package: "main", - }, - }, - }, - }, - ID: 881980169, - }, - { - Package: "main", - Name: "ArrayInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int", - IsSlice: true, - }, - }, - }, - ID: 3862002418, - }, - }, - }, - }, - wantModels: map[string]map[string]*StructDef{ - "main": { - "Person": { - Name: "Person", - Fields: []*Field{ - { - Name: "Name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - { - Name: "Parent", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsStruct: true, - IsPointer: true, - }, - }, - { - Name: "Details", - Type: &ParameterType{ - Package: "main", - Name: "anon1", - IsStruct: true, - }, - }, - }, - }, - "anon1": { - Name: "anon1", - Fields: []*Field{ - { - Name: "Age", - Type: &ParameterType{ - Package: "main", - Name: "int", - }, - }, - { - Name: "Address", - Type: &ParameterType{ - Package: "main", - Name: "anon2", - IsStruct: true, - }, - }, - }, - }, - "anon2": { - Name: "anon2", - Fields: []*Field{ - { - Name: "Street", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - }, - }, - }, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := ParseProject(tt.dir) - if (err != nil) != tt.wantErr { - t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) - return - } - - // Patch the PackageDir in the wantBoundMethods - for _, packageData := range got.BoundMethods { - for _, boundMethods := range packageData { - for _, boundMethod := range boundMethods { - boundMethod.PackageDir = "" - } - } - } - - // Loop over the things we want - for packageName, packageData := range tt.wantBoundMethods { - for structName, wantBoundMethods := range packageData { - gotBoundMethods := got.BoundMethods[packageName][structName] - if diff := cmp.Diff(wantBoundMethods, gotBoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - } - } - - // Loop over the models - for _, packageData := range got.Models { - for _, wantModel := range packageData { - // Loop over the Fields - for _, field := range wantModel.Fields { - field.Project = nil - } - } - } - - if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - if !reflect.DeepEqual(tt.wantModels, got.Models) { - t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantModels, got.Models)) - } - if diff := cmp.Diff(tt.wantTypes, got.Types); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - }) - } - -} diff --git a/v3/internal/parser/parser_struct_literal_single_test.go b/v3/internal/parser/parser_struct_literal_single_test.go deleted file mode 100644 index 4b7b25831e7..00000000000 --- a/v3/internal/parser/parser_struct_literal_single_test.go +++ /dev/null @@ -1,1165 +0,0 @@ -package parser - -import ( - "reflect" - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestParseStructLiteralSingle(t *testing.T) { - tests := []struct { - name string - dir string - wantBoundMethods map[string]map[string][]*BoundMethod - wantEnums map[string]map[string]*EnumDef - wantModels map[string]map[string]*StructDef - wantTypes map[string]map[string]*TypeDef - wantErr bool - }{ - { - name: "should find single bound service", - dir: "testdata/struct_literal_single", - //wantModels: []string{"main.GreetService"}, - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "Greet someone", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - { - Package: "main", - Name: "NoInputsStringOut", - DocComment: "", - Inputs: nil, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1075577233, - }, - { - Package: "main", - Name: "StringArrayInputStringOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1091960237, - }, - { - Package: "main", - Name: "StringArrayInputStringArrayOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - ID: 383995060, - }, - { - Package: "main", - Name: "StringArrayInputNamedOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "output", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - ID: 3678582682, - }, - { - Package: "main", - Name: "StringArrayInputNamedOutputs", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "output", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsSlice: true, - }, - }, - { - Name: "err", - Type: &ParameterType{ - Package: "main", - Name: "error", - }, - }, - }, - ID: 319259595, - }, - { - Package: "main", - Name: "IntPointerInputNamedOutputs", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "output", - Type: &ParameterType{ - Package: "main", - Name: "int", - IsPointer: true, - }, - }, - { - Name: "err", - Type: &ParameterType{ - Package: "main", - Name: "error", - }}, - }, - ID: 2718999663, - }, - { - Package: "main", - Name: "UIntPointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint", - IsPointer: true, - }, - }, - }, - ID: 1367187362, - }, - { - Package: "main", - Name: "UInt8PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint8", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint8", - IsPointer: true, - }, - }, - }, - ID: 518250834, - }, - { - Package: "main", - Name: "UInt16PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint16", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint16", - IsPointer: true, - }, - }, - }, - ID: 1236957573, - }, - { - Package: "main", - Name: "UInt32PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint32", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint32", - IsPointer: true, - }, - }, - }, - ID: 1739300671, - }, - { - Package: "main", - Name: "UInt64PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint64", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint64", - IsPointer: true, - }, - }, - }, - ID: 1403757716, - }, - { - Package: "main", - Name: "IntPointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int", - IsPointer: true, - }, - }, - }, - ID: 1066151743, - }, - { - Package: "main", - Name: "Int8PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int8", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int8", - IsPointer: true, - }, - }, - }, - ID: 2189402897, - }, - { - Package: "main", - Name: "Int16PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int16", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int16", - IsPointer: true, - }, - }, - }, - ID: 1754277916, - }, - { - Package: "main", - Name: "Int32PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int32", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int32", - IsPointer: true, - }, - }, - }, - ID: 4251088558, - }, - { - Package: "main", - Name: "Int64PointerInAndOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int64", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int64", - IsPointer: true, - }, - }, - }, - ID: 2205561041, - }, - { - Package: "main", - Name: "IntInIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int", - }, - }, - }, - ID: 642881729, - }, - { - Package: "main", - Name: "Int8InIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int8", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int8", - }, - }, - }, - ID: 572240879, - }, - { - Package: "main", - Name: "Int16InIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int16", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int16", - }, - }, - }, - ID: 3306292566, - }, - { - Package: "main", - Name: "Int32InIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int32", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int32", - }, - }, - }, - ID: 1909469092, - }, - { - Package: "main", - Name: "Int64InIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int64", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "int64", - }, - }, - }, - ID: 1343888303, - }, - { - Package: "main", - Name: "UIntInUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint", - }, - }, - }, - ID: 2836661285, - }, - { - Package: "main", - Name: "UInt8InUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint8", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint8", - }, - }, - }, - ID: 2988345717, - }, - { - Package: "main", - Name: "UInt16InUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint16", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint16", - }, - }, - }, - ID: 3401034892, - }, - { - Package: "main", - Name: "UInt32InUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint32", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint32", - }, - }, - }, - ID: 1160383782, - }, - { - Package: "main", - Name: "UInt64InUIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "uint64", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "uint64", - }, - }, - }, - ID: 793803239, - }, - { - Package: "main", - Name: "Float32InFloat32Out", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "float32", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "float32", - }, - }, - }, - ID: 3132595881, - }, - { - Package: "main", - Name: "Float64InFloat64Out", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "float64", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "float64", - }, - }, - }, - ID: 2182412247, - }, - { - Package: "main", - Name: "PointerFloat32InFloat32Out", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "float32", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "float32", - IsPointer: true, - }, - }, - }, - ID: 224675106, - }, - { - Package: "main", - Name: "PointerFloat64InFloat64Out", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "float64", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "float64", - IsPointer: true, - }, - }, - }, - ID: 2124953624, - }, - { - Package: "main", - Name: "BoolInBoolOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "bool", - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "bool", - }, - }, - }, - ID: 2424639793, - }, - { - Package: "main", - Name: "PointerBoolInBoolOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "bool", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "bool", - IsPointer: true, - }, - }, - }, - ID: 3589606958, - }, - { - Package: "main", - Name: "PointerStringInStringOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "string", - IsPointer: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "string", - IsPointer: true, - }, - }, - }, - ID: 229603958, - }, - { - Package: "main", - Name: "StructPointerInputErrorOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsPointer: true, - IsStruct: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "error", - }, - }, - }, - ID: 2447692557, - }, - { - Package: "main", - Name: "StructInputStructOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsStruct: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsStruct: true, - }, - }, - }, - ID: 3835643147, - }, - { - Package: "main", - Name: "StructPointerInputStructPointerOutput", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsPointer: true, - IsStruct: true, - }, - }, - }, - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsPointer: true, - IsStruct: true, - }, - }, - }, - ID: 2943477349, - }, - { - Package: "main", - Name: "MapIntInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - Package: "main", - }, - }, - }, - }, - ID: 2386486356, - }, - { - Package: "main", - Name: "PointerMapIntInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - IsPointer: true, - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - Package: "main", - }, - }, - }, - }, - ID: 3516977899, - }, - { - Package: "main", - Name: "MapIntPointerInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - IsPointer: true, - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - Package: "main", - }, - }, - }, - }, - ID: 550413585, - }, - { - Package: "main", - Name: "MapIntSliceInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - IsSlice: true, - Package: "main", - }, - }, - }, - }, - ID: 2900172572, - }, - { - Package: "main", - Name: "MapIntSliceIntInMapIntSliceIntOut", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - IsSlice: true, - Package: "main", - }, - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "out", - Type: &ParameterType{ - Package: "main", - Name: "map", - MapKey: &ParameterType{ - Name: "int", - Package: "main", - }, - MapValue: &ParameterType{ - Name: "int", - IsSlice: true, - Package: "main", - }, - }, - }, - }, - ID: 881980169, - }, - { - Package: "main", - Name: "ArrayInt", - Inputs: []*Parameter{ - { - Name: "in", - Type: &ParameterType{ - Package: "main", - Name: "int", - IsSlice: true, - }, - }, - }, - ID: 3862002418, - }, - }, - }, - }, - wantModels: map[string]map[string]*StructDef{ - "main": { - "Person": { - Name: "Person", - Fields: []*Field{ - { - Name: "Name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - { - Name: "Parent", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsStruct: true, - IsPointer: true, - }, - }, - { - Name: "Details", - Type: &ParameterType{ - Package: "main", - Name: "anon1", - IsStruct: true, - }, - }, - }, - }, - "anon1": { - Name: "anon1", - Fields: []*Field{ - { - Name: "Age", - Type: &ParameterType{ - Package: "main", - Name: "int", - }, - }, - { - Name: "Address", - Type: &ParameterType{ - Package: "main", - Name: "anon2", - IsStruct: true, - }, - }, - }, - }, - "anon2": { - Name: "anon2", - Fields: []*Field{ - { - Name: "Street", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - }, - }, - }, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := ParseProject(tt.dir) - if (err != nil) != tt.wantErr { - t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) - return - } - - // Patch the PackageDir in the wantBoundMethods - for _, packageData := range got.BoundMethods { - for _, boundMethods := range packageData { - for _, boundMethod := range boundMethods { - boundMethod.PackageDir = "" - } - } - } - - // Loop over the things we want - for packageName, packageData := range tt.wantBoundMethods { - for structName, wantBoundMethods := range packageData { - gotBoundMethods := got.BoundMethods[packageName][structName] - if diff := cmp.Diff(wantBoundMethods, gotBoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - } - } - - // Loop over the models - for _, packageData := range got.Models { - for _, wantModel := range packageData { - // Loop over the Fields - for _, field := range wantModel.Fields { - field.Project = nil - } - } - } - - if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - if !reflect.DeepEqual(tt.wantModels, got.Models) { - t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantModels, got.Models)) - } - if diff := cmp.Diff(tt.wantTypes, got.Types); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - }) - } - -} diff --git a/v3/internal/parser/parser_variable_single_test.go b/v3/internal/parser/parser_variable_single_test.go deleted file mode 100644 index aeacf5f9832..00000000000 --- a/v3/internal/parser/parser_variable_single_test.go +++ /dev/null @@ -1,275 +0,0 @@ -package parser - -import ( - "reflect" - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestParseVariableSingle(t *testing.T) { - tests := []struct { - name string - dir string - wantBoundMethods map[string]map[string][]*BoundMethod - wantEnums map[string]map[string]*EnumDef - wantModels map[string]map[string]*StructDef - wantTypes map[string]map[string]*TypeDef - wantErr bool - }{ - { - name: "should find a bound services using a variable", - dir: "testdata/variable_single", - wantErr: false, - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "Greet someone", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - }, - }, - }, - }, - { - name: "should find a bound services using a variable from function call", - dir: "testdata/variable_single_from_function", - wantErr: false, - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "Greet someone", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - }, - }, - }, - }, - { - name: "should find a bound services using a variable from function call in another package", - dir: "testdata/variable_single_from_other_function", - wantErr: false, - wantBoundMethods: map[string]map[string][]*BoundMethod{ - "main": { - "GreetService": { - { - Package: "main", - Name: "Greet", - DocComment: "Greet does XYZ", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - ID: 1411160069, - }, - { - Package: "main", - Name: "NewPerson", - DocComment: "NewPerson creates a new person", - Inputs: []*Parameter{ - { - Name: "name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - }, - Outputs: []*Parameter{ - { - Name: "", - Type: &ParameterType{ - Package: "main", - Name: "Person", - IsPointer: true, - IsStruct: true, - }, - }, - }, - ID: 1661412647, - }, - }, - }, - "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services": { - "OtherService": { - { - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", - Name: "Yay", - DocComment: "Yay does this and that", - Outputs: []*Parameter{ - { - Type: &ParameterType{ - Name: "Address", - IsStruct: true, - IsPointer: true, - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", - }, - }, - }, - ID: 302702907, - }, - }, - }, - }, - wantModels: map[string]map[string]*StructDef{ - "main": { - "Person": { - Name: "Person", - DocComments: []string{"// Person is a person!", "// They have a name and an address"}, - Fields: []*Field{ - { - Name: "Name", - Type: &ParameterType{ - Package: "main", - Name: "string", - }, - }, - { - Name: "Address", - Type: &ParameterType{ - Name: "Address", - IsStruct: true, - IsPointer: true, - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", - }, - }, - }, - }, - }, - "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services": { - "Address": { - Name: "Address", - Fields: []*Field{ - { - Name: "Street", - Type: &ParameterType{ - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", - Name: "string", - }, - }, - { - Name: "State", - Type: &ParameterType{ - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", - Name: "string", - }, - }, - { - Name: "Country", - Type: &ParameterType{ - Package: "github.com/wailsapp/wails/v3/internal/parser/testdata/variable_single_from_other_function/services", - Name: "string", - }, - }, - }, - }, - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := ParseProject(tt.dir) - if (err != nil) != tt.wantErr { - t.Errorf("ParseDirectory() error = %v, wantErr %v", err, tt.wantErr) - return - } - - // Patch the PackageDir in the wantBoundMethods - for _, packageData := range got.BoundMethods { - for _, boundMethods := range packageData { - for _, boundMethod := range boundMethods { - boundMethod.PackageDir = "" - } - } - } - - // Loop over the things we want - for packageName, packageData := range tt.wantBoundMethods { - for structName, wantBoundMethods := range packageData { - gotBoundMethods := got.BoundMethods[packageName][structName] - if diff := cmp.Diff(wantBoundMethods, gotBoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - } - } - - // Loop over the models - for _, packageData := range got.Models { - for _, wantModel := range packageData { - // Loop over the Fields - for _, field := range wantModel.Fields { - field.Project = nil - } - } - } - - if diff := cmp.Diff(tt.wantBoundMethods, got.BoundMethods, cmp.AllowUnexported(Parameter{})); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - if !reflect.DeepEqual(tt.wantModels, got.Models) { - t.Errorf("ParseDirectory() failed:\n" + cmp.Diff(tt.wantModels, got.Models)) - } - if diff := cmp.Diff(tt.wantTypes, got.Types); diff != "" { - t.Errorf("ParseDirectory() failed:\n" + diff) - } - }) - } - -} diff --git a/v3/internal/parser/templates/interfaces.ts.tmpl b/v3/internal/parser/templates/interfaces.ts.tmpl deleted file mode 100644 index 9c433666d76..00000000000 --- a/v3/internal/parser/templates/interfaces.ts.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -{{- $pkg := .Package}}{{- range .Imports}} -import * as {{.PackageName}} from "{{.Path}}/models";{{- end}} -{{- range $enumindex, $enumdef := .Enums}} -{{- range $commentindex, $commentdef := $enumdef.DocComments}} -{{$commentdef -}} -{{- end}} -export enum {{$enumdef.Name}} { - {{- range $constindex, $constdef := .Consts}} - {{- if $constdef.DocComments}} - {{- range $commentindex, $commentdef := $constdef.DocComments}} - {{$commentdef -}} - {{- end }} - {{- end}} - {{$constdef.Name}} = {{$constdef.Value}},{{end}} -} -{{- end}} -{{range $name, $def := .Models}} -{{- if $def.DocComments}} -{{- range $commentindex, $commentdef := $def.DocComments}} -{{$commentdef -}} -{{- end }} -{{- end}} -export interface {{$def.Name}} { {{- range $def.Fields}} - {{.JSDef $pkg}}{{end}} -} -{{end}} \ No newline at end of file diff --git a/v3/internal/parser/templates/model.js.tmpl b/v3/internal/parser/templates/model.js.tmpl deleted file mode 100644 index b03e704c470..00000000000 --- a/v3/internal/parser/templates/model.js.tmpl +++ /dev/null @@ -1,52 +0,0 @@ -{{$pkg := .Package}} -{{- if .Imports }} -/** -{{- range .Imports}} - * @typedef {import('{{.Path}}/models').{{.Name -}} } {{.VarName}} -{{- end}} - */ -{{end}} -{{- range $enumindex, $enumdef := .Enums}} -{{- range $commentindex, $commentdef := $enumdef.DocComments}} -{{$commentdef -}} -{{- end}} -export const {{$enumdef.Name}} = { - {{- range $constindex, $constdef := .Consts}} - {{- if $constdef.DocComments}} - {{- range $commentindex, $commentdef := $constdef.DocComments}} - {{$commentdef -}} - {{- end }} - {{- end}} - {{$constdef.Name}}: {{$constdef.Value}},{{end}} -}; -{{end}} -{{- range $name, $def := .Models}} -{{- if $def.DocComments}} -{{- range $commentindex, $commentdef := $def.DocComments}} -{{$commentdef -}} -{{- end }} -{{- end}} -export const {{$def.Name}} = class { - /** - * Creates a new {{$def.Name}} instance. - * @constructor - * @param {Object} source - The source object to create the {{$def.Name}}. -{{- range $field := $def.Fields}} - * @param { {{- .JSDocType $pkg -}} } source.{{$field.Name}}{{end}} - */ - constructor(source = {}) { - const { {{$def.DefaultValueList}} } = source; {{range $def.Fields}} - this.{{.JSName}} = {{.JSName}};{{end}} - } - - /** - * Creates a new {{$def.Name}} instance from a string or object. - * @param {string|object} source - The source data to create a {{$def.Name}} instance from. - * @returns { {{- $def.Name -}} } A new {{$def.Name}} instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new {{$def.Name}}(parsedSource); - } -}; -{{end}} diff --git a/v3/internal/parser/templates/model.ts.tmpl b/v3/internal/parser/templates/model.ts.tmpl deleted file mode 100644 index 15972a674bd..00000000000 --- a/v3/internal/parser/templates/model.ts.tmpl +++ /dev/null @@ -1,38 +0,0 @@ -{{- $pkg := .Package}}{{- range .Imports}} -import * as {{.PackageName}} from "{{.Path}}/models";{{- end}} -{{- range $enumindex, $enumdef := .Enums}} -{{- range $commentindex, $commentdef := $enumdef.DocComments}} -{{$commentdef -}} -{{- end}} -export enum {{$enumdef.Name}} { - {{- range $constindex, $constdef := .Consts}} - {{- if $constdef.DocComments}} - {{- range $commentindex, $commentdef := $constdef.DocComments}} - {{$commentdef -}} - {{- end }} - {{- end}} - {{$constdef.Name}} = {{$constdef.Value}},{{end}} -} -{{- end}} -{{range $name, $def := .Models}} -{{- if $def.DocComments}} -{{- range $commentindex, $commentdef := $def.DocComments}} -{{$commentdef -}} -{{- end }} -{{- end}} -export class {{$def.Name}} { - {{- range $def.Fields}} - {{.JSDef $pkg}}{{end}} - - constructor(source: Partial<{{$def.Name}}> = {}) { - const { {{- $def.DefaultValueList -}} } = source; -{{- range $def.Fields}} - this.{{.JSName}} = {{.JSName}};{{end}} - } - - static createFrom(source: string | object = {}): {{$def.Name}} { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new {{$def.Name}}(parsedSource as Partial<{{$def.Name}}>); - } -} -{{end}} \ No newline at end of file diff --git a/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.js deleted file mode 100644 index e8ac1aa2e0f..00000000000 --- a/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,30 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - * @typedef {import('./models').Title} Title - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @param title {Title} - * @returns {Promise} - **/ -export async function Greet(name, title) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return Call.ByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index adf9778c3ae..00000000000 --- a/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,29 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -/** - * @typedef {import('./models').Person} Person - * @typedef {import('./models').Title} Title - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @param title {Title} - * @returns {Promise} - **/ -export async function Greet(name, title) { - return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return wails.CallByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index 896096f7846..00000000000 --- a/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; -import {Title} from './models'; - -// Greet does XYZ -export async function Greet(name: string, title: Title) : Promise { - return Call.ByName("main.GreetService.Greet", name, title); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByName("main.GreetService.NewPerson", name); -} - diff --git a/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.ts deleted file mode 100644 index 8d24df2d6f8..00000000000 --- a/v3/internal/parser/testdata/enum/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; -import {Title} from './models'; - -// Greet does XYZ -export async function Greet(name: string, title: Title) : Promise { - return Call.ByID(1411160069, name, title); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByID(1661412647, name); -} - diff --git a/v3/internal/parser/testdata/enum/frontend/bindings/main/models.js b/v3/internal/parser/testdata/enum/frontend/bindings/main/models.js deleted file mode 100644 index 229a5fff0e4..00000000000 --- a/v3/internal/parser/testdata/enum/frontend/bindings/main/models.js +++ /dev/null @@ -1,40 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -// Title is a title -export const Title = { - // Mister is a title - Mister: "Mr", - Miss: "Miss", - Ms: "Ms", - Mrs: "Mrs", - Dr: "Dr", -}; - -// Person represents a person -export const Person = class { - /** - * Creates a new Person instance. - * @constructor - * @param {Object} source - The source object to create the Person. - * @param {Title} source.Title - * @param {string} source.Name - */ - constructor(source = {}) { - const { title = null, name = "" } = source; - this.title = title; - this.name = name; - } - - /** - * Creates a new Person instance from a string or object. - * @param {string|object} source - The source data to create a Person instance from. - * @returns {Person} A new Person instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/enum/frontend/bindings/main/models.ts b/v3/internal/parser/testdata/enum/frontend/bindings/main/models.ts deleted file mode 100644 index 5437401039b..00000000000 --- a/v3/internal/parser/testdata/enum/frontend/bindings/main/models.ts +++ /dev/null @@ -1,30 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -// Title is a title -export enum Title { - // Mister is a title - Mister = "Mr", - Miss = "Miss", - Ms = "Ms", - Mrs = "Mrs", - Dr = "Dr", -} - -// Person represents a person -export class Person { - title: Title; - name: string; - - constructor(source: Partial = {}) { - const {title = null, name = ""} = source; - this.title = title; - this.name = name; - } - - static createFrom(source: string | object = {}): Person { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource as Partial); - } -} diff --git a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.js deleted file mode 100644 index bb0ba551264..00000000000 --- a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,19 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('../services/models').Title} servicesTitle - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @param title {servicesTitle} - * @returns {Promise} - **/ -export async function Greet(name, title) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index c2c41ee6f70..00000000000 --- a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,19 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('../services/models').Title} servicesTitle - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @param title {servicesTitle} - * @returns {Promise} - **/ -export async function Greet(name, title) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index 71846bc5c85..00000000000 --- a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Title as servicesTitle} from '../services/models'; - -// Greet does XYZ -export async function Greet(name: string, title: servicesTitle) : Promise { - return Call.ByName("main.GreetService.Greet", name, title); -} - diff --git a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.ts deleted file mode 100644 index a4e52e9e856..00000000000 --- a/v3/internal/parser/testdata/enum_from_imported_package/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Title as servicesTitle} from '../services/models'; - -// Greet does XYZ -export async function Greet(name: string, title: servicesTitle) : Promise { - return Call.ByID(1411160069, name, title); -} - diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.js deleted file mode 100644 index f1343c2d7b7..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return Call.ByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 30610a58aa1..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return Call.ByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index b5753395d13..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -// Greet does XYZ -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByName("main.GreetService.NewPerson", name); -} - diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.ts deleted file mode 100644 index 0b2c57590b6..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -// Greet does XYZ -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByID(1661412647, name); -} - diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/models.js b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/models.js deleted file mode 100644 index a09491b9a8d..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/models.js +++ /dev/null @@ -1,34 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -/** - * @typedef {import('../services/models').Address} servicesAddress - */ - -// Person is a person -export const Person = class { - /** - * Creates a new Person instance. - * @constructor - * @param {Object} source - The source object to create the Person. - * @param {string} source.Name - * @param {servicesAddress} source.Address - */ - constructor(source = {}) { - const { name = "", address = null } = source; - this.name = name; - this.address = address; - } - - /** - * Creates a new Person instance from a string or object. - * @param {string|object} source - The source data to create a Person instance from. - * @returns {Person} A new Person instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/models.ts b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/models.ts deleted file mode 100644 index ecd1f462ad7..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/main/models.ts +++ /dev/null @@ -1,22 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import * as services from "../services/models"; - -// Person is a person -export class Person { - name: string; - address: services.Address; - - constructor(source: Partial = {}) { - const {name = "", address = null} = source; - this.name = name; - this.address = address; - } - - static createFrom(source: string | object = {}): Person { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource as Partial); - } -} diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.js b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.js deleted file mode 100644 index b114d5a2997..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.js +++ /dev/null @@ -1,17 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Address} Address - */ - -/** - * Yay does this and that - * @function Yay - * @returns {Promise
} - **/ -export async function Yay() { - return Call.ByID(1592414782, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.js b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.js deleted file mode 100644 index 10240b9a676..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.js +++ /dev/null @@ -1,17 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Address} Address - */ - -/** - * Yay does this and that - * @function Yay - * @returns {Promise
} - **/ -export async function Yay() { - return Call.ByName("services.OtherService.Yay", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.ts b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.ts deleted file mode 100644 index 44612231689..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.name.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Address} from './models'; - -// Yay does this and that -export async function Yay() : Promise
{ - return Call.ByName("services.OtherService.Yay"); -} - diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.ts b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.ts deleted file mode 100644 index 0d09f187783..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/OtherService.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Address} from './models'; - -// Yay does this and that -export async function Yay() : Promise
{ - return Call.ByID(1592414782); -} - diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/models.js b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/models.js deleted file mode 100644 index 4c763702090..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/models.js +++ /dev/null @@ -1,31 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -export const Address = class { - /** - * Creates a new Address instance. - * @constructor - * @param {Object} source - The source object to create the Address. - * @param {string} source.Street - * @param {string} source.State - * @param {string} source.Country - */ - constructor(source = {}) { - const { street = "", state = "", country = "" } = source; - this.street = street; - this.state = state; - this.country = country; - } - - /** - * Creates a new Address instance from a string or object. - * @param {string|object} source - The source data to create a Address instance from. - * @returns {Address} A new Address instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Address(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/models.ts b/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/models.ts deleted file mode 100644 index dc2a7446fba..00000000000 --- a/v3/internal/parser/testdata/function_from_imported_package/frontend/bindings/services/models.ts +++ /dev/null @@ -1,22 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - - -export class Address { - street: string; - state: string; - country: string; - - constructor(source: Partial
= {}) { - const {street = "", state = "", country = ""} = source; - this.street = street; - this.state = state; - this.country = country; - } - - static createFrom(source: string | object = {}): Address { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Address(parsedSource as Partial
); - } -} diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.js deleted file mode 100644 index f1343c2d7b7..00000000000 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return Call.ByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 30610a58aa1..00000000000 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return Call.ByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index b5753395d13..00000000000 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -// Greet does XYZ -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByName("main.GreetService.NewPerson", name); -} - diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.ts deleted file mode 100644 index 0b2c57590b6..00000000000 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -// Greet does XYZ -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByID(1661412647, name); -} - diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.js b/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.js deleted file mode 100644 index 7b04f559a4c..00000000000 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.js +++ /dev/null @@ -1,17 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Address} Address - */ - -/** - * Yay does this and that - * @function Yay - * @returns {Promise
} - **/ -export async function Yay() { - return Call.ByID(2189323817, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.name.js b/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.name.js deleted file mode 100644 index b3a66aa5b9f..00000000000 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.name.js +++ /dev/null @@ -1,17 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Address} Address - */ - -/** - * Yay does this and that - * @function Yay - * @returns {Promise
} - **/ -export async function Yay() { - return Call.ByName("other.OtherService.Yay", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.name.ts b/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.name.ts deleted file mode 100644 index 229d58e702c..00000000000 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.name.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Address} from './models'; - -// Yay does this and that -export async function Yay() : Promise
{ - return Call.ByName("other.OtherService.Yay"); -} - diff --git a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.ts b/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.ts deleted file mode 100644 index 6ba459391a4..00000000000 --- a/v3/internal/parser/testdata/function_from_nested_imported_package/frontend/bindings/services/other/OtherService.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Address} from './models'; - -// Yay does this and that -export async function Yay() : Promise
{ - return Call.ByID(2189323817); -} - diff --git a/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.js deleted file mode 100644 index 993cfb9dcc1..00000000000 --- a/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,15 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 66dfb05eebd..00000000000 --- a/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,15 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index e7884a90c3d..00000000000 --- a/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - diff --git a/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.ts deleted file mode 100644 index 497e17d2bf6..00000000000 --- a/v3/internal/parser/testdata/function_single/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - diff --git a/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.js deleted file mode 100644 index 4196491e15c..00000000000 --- a/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,25 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * Greet someone - * @function GreetWithContext - * @param name {string} - * @returns {Promise} - **/ -export async function GreetWithContext(name) { - return Call.ByID(1310150960, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 33a5f9366bf..00000000000 --- a/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,25 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * Greet someone - * @function GreetWithContext - * @param name {string} - * @returns {Promise} - **/ -export async function GreetWithContext(name) { - return Call.ByName("main.GreetService.GreetWithContext", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index 3e3d1aa9e22..00000000000 --- a/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - -// Greet someone -export async function GreetWithContext(name: string) : Promise { - return Call.ByName("main.GreetService.GreetWithContext", name); -} - diff --git a/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.ts deleted file mode 100644 index a252570c554..00000000000 --- a/v3/internal/parser/testdata/function_single_context/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - -// Greet someone -export async function GreetWithContext(name: string) : Promise { - return Call.ByID(1310150960, name); -} - diff --git a/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/GreetService.js deleted file mode 100644 index 4e758c8c320..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,14 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 38e7cac771d..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,14 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/OtherService.js b/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/OtherService.js deleted file mode 100644 index d9bed629063..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/OtherService.js +++ /dev/null @@ -1,13 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * @function Hello - * @returns {Promise} - **/ -export async function Hello() { - return Call.ByID(4249972365, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/OtherService.name.js b/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/OtherService.name.js deleted file mode 100644 index 678d394ffe5..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple/frontend/bindings/main/OtherService.name.js +++ /dev/null @@ -1,13 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * @function Hello - * @returns {Promise} - **/ -export async function Hello() { - return Call.ByName("main.OtherService.Hello", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.js deleted file mode 100644 index 4e758c8c320..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,14 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 38e7cac771d..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,14 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index e4b770fe876..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.ts deleted file mode 100644 index 4622844335f..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.js b/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.js deleted file mode 100644 index d9bed629063..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.js +++ /dev/null @@ -1,13 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * @function Hello - * @returns {Promise} - **/ -export async function Hello() { - return Call.ByID(4249972365, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.name.js b/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.name.js deleted file mode 100644 index 678d394ffe5..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.name.js +++ /dev/null @@ -1,13 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * @function Hello - * @returns {Promise} - **/ -export async function Hello() { - return Call.ByName("main.OtherService.Hello", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.name.ts b/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.name.ts deleted file mode 100644 index c336f0a7fa3..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.name.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -export async function Hello() : Promise { - return Call.ByName("main.OtherService.Hello"); -} - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.ts b/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.ts deleted file mode 100644 index b2edab58af3..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_files/frontend/bindings/main/OtherService.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -export async function Hello() : Promise { - return Call.ByID(4249972365); -} - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.js deleted file mode 100644 index f1343c2d7b7..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return Call.ByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 30610a58aa1..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return Call.ByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index b5753395d13..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -// Greet does XYZ -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByName("main.GreetService.NewPerson", name); -} - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.ts deleted file mode 100644 index 0b2c57590b6..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -// Greet does XYZ -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByID(1661412647, name); -} - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/models.js b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/models.js deleted file mode 100644 index e9e9503c138..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/models.js +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -/** - * @typedef {import('../services/models').Address} servicesAddress - */ - -export const Person = class { - /** - * Creates a new Person instance. - * @constructor - * @param {Object} source - The source object to create the Person. - * @param {string} source.Name - * @param {servicesAddress} source.Address - */ - constructor(source = {}) { - const { name = "", address = null } = source; - this.name = name; - this.address = address; - } - - /** - * Creates a new Person instance from a string or object. - * @param {string|object} source - The source data to create a Person instance from. - * @returns {Person} A new Person instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/models.ts b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/models.ts deleted file mode 100644 index 7f8d7b489cb..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/main/models.ts +++ /dev/null @@ -1,21 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import * as services from "../services/models"; - -export class Person { - name: string; - address: services.Address; - - constructor(source: Partial = {}) { - const {name = "", address = null} = source; - this.name = name; - this.address = address; - } - - static createFrom(source: string | object = {}): Person { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource as Partial); - } -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.js b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.js deleted file mode 100644 index d2793204151..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.js +++ /dev/null @@ -1,17 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Address} Address - */ - -/** - * Yay does this and that - * @function Yay - * @returns {Promise
} - **/ -export async function Yay() { - return Call.ByID(469445984, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.name.js b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.name.js deleted file mode 100644 index 10240b9a676..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.name.js +++ /dev/null @@ -1,17 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Address} Address - */ - -/** - * Yay does this and that - * @function Yay - * @returns {Promise
} - **/ -export async function Yay() { - return Call.ByName("services.OtherService.Yay", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.name.ts b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.name.ts deleted file mode 100644 index 44612231689..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.name.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Address} from './models'; - -// Yay does this and that -export async function Yay() : Promise
{ - return Call.ByName("services.OtherService.Yay"); -} - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.ts b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.ts deleted file mode 100644 index ba53fc1b10a..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/OtherService.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Address} from './models'; - -// Yay does this and that -export async function Yay() : Promise
{ - return Call.ByID(469445984); -} - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/models.js b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/models.js deleted file mode 100644 index 4c763702090..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/models.js +++ /dev/null @@ -1,31 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -export const Address = class { - /** - * Creates a new Address instance. - * @constructor - * @param {Object} source - The source object to create the Address. - * @param {string} source.Street - * @param {string} source.State - * @param {string} source.Country - */ - constructor(source = {}) { - const { street = "", state = "", country = "" } = source; - this.street = street; - this.state = state; - this.country = country; - } - - /** - * Creates a new Address instance from a string or object. - * @param {string|object} source - The source data to create a Address instance from. - * @returns {Address} A new Address instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Address(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/models.ts b/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/models.ts deleted file mode 100644 index dc2a7446fba..00000000000 --- a/v3/internal/parser/testdata/struct_literal_multiple_other/frontend/bindings/services/models.ts +++ /dev/null @@ -1,22 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - - -export class Address { - street: string; - state: string; - country: string; - - constructor(source: Partial
= {}) { - const {street = "", state = "", country = ""} = source; - this.street = street; - this.state = state; - this.country = country; - } - - static createFrom(source: string | object = {}): Address { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Address(parsedSource as Partial
); - } -} diff --git a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.js deleted file mode 100644 index f3d0b247951..00000000000 --- a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,395 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * @function ArrayInt - * @param _in {number[]} - * @returns {Promise} - **/ -export async function ArrayInt(_in) { - return Call.ByID(3862002418, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function BoolInBoolOut - * @param _in {boolean} - * @returns {Promise} - **/ -export async function BoolInBoolOut(_in) { - return Call.ByID(2424639793, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Float32InFloat32Out - * @param _in {number} - * @returns {Promise} - **/ -export async function Float32InFloat32Out(_in) { - return Call.ByID(3132595881, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Float64InFloat64Out - * @param _in {number} - * @returns {Promise} - **/ -export async function Float64InFloat64Out(_in) { - return Call.ByID(2182412247, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int16InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int16InIntOut(_in) { - return Call.ByID(3306292566, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int16PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int16PointerInAndOutput(_in) { - return Call.ByID(1754277916, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int32InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int32InIntOut(_in) { - return Call.ByID(1909469092, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int32PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int32PointerInAndOutput(_in) { - return Call.ByID(4251088558, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int64InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int64InIntOut(_in) { - return Call.ByID(1343888303, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int64PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int64PointerInAndOutput(_in) { - return Call.ByID(2205561041, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int8InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int8InIntOut(_in) { - return Call.ByID(572240879, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int8PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int8PointerInAndOutput(_in) { - return Call.ByID(2189402897, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntInIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function IntInIntOut(_in) { - return Call.ByID(642881729, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntPointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function IntPointerInAndOutput(_in) { - return Call.ByID(1066151743, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntPointerInputNamedOutputs - * @param _in {number | null} - * @returns {Promise} - **/ -export async function IntPointerInputNamedOutputs(_in) { - return Call.ByID(2718999663, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntInt(_in) { - return Call.ByID(2386486356, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntPointerInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntPointerInt(_in) { - return Call.ByID(550413585, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntSliceInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntSliceInt(_in) { - return Call.ByID(2900172572, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntSliceIntInMapIntSliceIntOut - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntSliceIntInMapIntSliceIntOut(_in) { - return Call.ByID(881980169, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function NoInputsStringOut - * @returns {Promise} - **/ -export async function NoInputsStringOut() { - return Call.ByID(1075577233, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerBoolInBoolOut - * @param _in {boolean | null} - * @returns {Promise} - **/ -export async function PointerBoolInBoolOut(_in) { - return Call.ByID(3589606958, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerFloat32InFloat32Out - * @param _in {number | null} - * @returns {Promise} - **/ -export async function PointerFloat32InFloat32Out(_in) { - return Call.ByID(224675106, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerFloat64InFloat64Out - * @param _in {number | null} - * @returns {Promise} - **/ -export async function PointerFloat64InFloat64Out(_in) { - return Call.ByID(2124953624, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerMapIntInt - * @param _in {map | null} - * @returns {Promise} - **/ -export async function PointerMapIntInt(_in) { - return Call.ByID(3516977899, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerStringInStringOut - * @param _in {string | null} - * @returns {Promise} - **/ -export async function PointerStringInStringOut(_in) { - return Call.ByID(229603958, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputNamedOutput - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputNamedOutput(_in) { - return Call.ByID(3678582682, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputNamedOutputs - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputNamedOutputs(_in) { - return Call.ByID(319259595, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputStringArrayOut - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputStringArrayOut(_in) { - return Call.ByID(383995060, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputStringOut - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputStringOut(_in) { - return Call.ByID(1091960237, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructInputStructOutput - * @param _in {Person} - * @returns {Promise} - **/ -export async function StructInputStructOutput(_in) { - return Call.ByID(3835643147, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructPointerInputErrorOutput - * @param _in {Person | null} - * @returns {Promise} - **/ -export async function StructPointerInputErrorOutput(_in) { - return Call.ByID(2447692557, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructPointerInputStructPointerOutput - * @param _in {Person | null} - * @returns {Promise} - **/ -export async function StructPointerInputStructPointerOutput(_in) { - return Call.ByID(2943477349, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt16InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt16InUIntOut(_in) { - return Call.ByID(3401034892, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt16PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt16PointerInAndOutput(_in) { - return Call.ByID(1236957573, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt32InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt32InUIntOut(_in) { - return Call.ByID(1160383782, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt32PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt32PointerInAndOutput(_in) { - return Call.ByID(1739300671, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt64InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt64InUIntOut(_in) { - return Call.ByID(793803239, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt64PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt64PointerInAndOutput(_in) { - return Call.ByID(1403757716, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt8InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt8InUIntOut(_in) { - return Call.ByID(2988345717, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt8PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt8PointerInAndOutput(_in) { - return Call.ByID(518250834, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UIntInUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UIntInUIntOut(_in) { - return Call.ByID(2836661285, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UIntPointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UIntPointerInAndOutput(_in) { - return Call.ByID(1367187362, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 026bc3be501..00000000000 --- a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,395 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * @function ArrayInt - * @param _in {number[]} - * @returns {Promise} - **/ -export async function ArrayInt(_in) { - return Call.ByName("main.GreetService.ArrayInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function BoolInBoolOut - * @param _in {boolean} - * @returns {Promise} - **/ -export async function BoolInBoolOut(_in) { - return Call.ByName("main.GreetService.BoolInBoolOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Float32InFloat32Out - * @param _in {number} - * @returns {Promise} - **/ -export async function Float32InFloat32Out(_in) { - return Call.ByName("main.GreetService.Float32InFloat32Out", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Float64InFloat64Out - * @param _in {number} - * @returns {Promise} - **/ -export async function Float64InFloat64Out(_in) { - return Call.ByName("main.GreetService.Float64InFloat64Out", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int16InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int16InIntOut(_in) { - return Call.ByName("main.GreetService.Int16InIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int16PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int16PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.Int16PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int32InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int32InIntOut(_in) { - return Call.ByName("main.GreetService.Int32InIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int32PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int32PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.Int32PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int64InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int64InIntOut(_in) { - return Call.ByName("main.GreetService.Int64InIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int64PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int64PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.Int64PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int8InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int8InIntOut(_in) { - return Call.ByName("main.GreetService.Int8InIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int8PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int8PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.Int8PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntInIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function IntInIntOut(_in) { - return Call.ByName("main.GreetService.IntInIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntPointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function IntPointerInAndOutput(_in) { - return Call.ByName("main.GreetService.IntPointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntPointerInputNamedOutputs - * @param _in {number | null} - * @returns {Promise} - **/ -export async function IntPointerInputNamedOutputs(_in) { - return Call.ByName("main.GreetService.IntPointerInputNamedOutputs", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntInt(_in) { - return Call.ByName("main.GreetService.MapIntInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntPointerInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntPointerInt(_in) { - return Call.ByName("main.GreetService.MapIntPointerInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntSliceInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntSliceInt(_in) { - return Call.ByName("main.GreetService.MapIntSliceInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntSliceIntInMapIntSliceIntOut - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntSliceIntInMapIntSliceIntOut(_in) { - return Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function NoInputsStringOut - * @returns {Promise} - **/ -export async function NoInputsStringOut() { - return Call.ByName("main.GreetService.NoInputsStringOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerBoolInBoolOut - * @param _in {boolean | null} - * @returns {Promise} - **/ -export async function PointerBoolInBoolOut(_in) { - return Call.ByName("main.GreetService.PointerBoolInBoolOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerFloat32InFloat32Out - * @param _in {number | null} - * @returns {Promise} - **/ -export async function PointerFloat32InFloat32Out(_in) { - return Call.ByName("main.GreetService.PointerFloat32InFloat32Out", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerFloat64InFloat64Out - * @param _in {number | null} - * @returns {Promise} - **/ -export async function PointerFloat64InFloat64Out(_in) { - return Call.ByName("main.GreetService.PointerFloat64InFloat64Out", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerMapIntInt - * @param _in {map | null} - * @returns {Promise} - **/ -export async function PointerMapIntInt(_in) { - return Call.ByName("main.GreetService.PointerMapIntInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerStringInStringOut - * @param _in {string | null} - * @returns {Promise} - **/ -export async function PointerStringInStringOut(_in) { - return Call.ByName("main.GreetService.PointerStringInStringOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputNamedOutput - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputNamedOutput(_in) { - return Call.ByName("main.GreetService.StringArrayInputNamedOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputNamedOutputs - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputNamedOutputs(_in) { - return Call.ByName("main.GreetService.StringArrayInputNamedOutputs", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputStringArrayOut - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputStringArrayOut(_in) { - return Call.ByName("main.GreetService.StringArrayInputStringArrayOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputStringOut - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputStringOut(_in) { - return Call.ByName("main.GreetService.StringArrayInputStringOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructInputStructOutput - * @param _in {Person} - * @returns {Promise} - **/ -export async function StructInputStructOutput(_in) { - return Call.ByName("main.GreetService.StructInputStructOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructPointerInputErrorOutput - * @param _in {Person | null} - * @returns {Promise} - **/ -export async function StructPointerInputErrorOutput(_in) { - return Call.ByName("main.GreetService.StructPointerInputErrorOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructPointerInputStructPointerOutput - * @param _in {Person | null} - * @returns {Promise} - **/ -export async function StructPointerInputStructPointerOutput(_in) { - return Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt16InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt16InUIntOut(_in) { - return Call.ByName("main.GreetService.UInt16InUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt16PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt16PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UInt16PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt32InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt32InUIntOut(_in) { - return Call.ByName("main.GreetService.UInt32InUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt32PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt32PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UInt32PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt64InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt64InUIntOut(_in) { - return Call.ByName("main.GreetService.UInt64InUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt64PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt64PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UInt64PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt8InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt8InUIntOut(_in) { - return Call.ByName("main.GreetService.UInt8InUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt8PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt8PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UInt8PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UIntInUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UIntInUIntOut(_in) { - return Call.ByName("main.GreetService.UIntInUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UIntPointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UIntPointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UIntPointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index b47c462c5a6..00000000000 --- a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,179 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -export async function ArrayInt(_in: number[]) : Promise { - return Call.ByName("main.GreetService.ArrayInt", _in); -} - -export async function BoolInBoolOut(_in: boolean) : Promise { - return Call.ByName("main.GreetService.BoolInBoolOut", _in); -} - -export async function Float32InFloat32Out(_in: number) : Promise { - return Call.ByName("main.GreetService.Float32InFloat32Out", _in); -} - -export async function Float64InFloat64Out(_in: number) : Promise { - return Call.ByName("main.GreetService.Float64InFloat64Out", _in); -} - -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - -export async function Int16InIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.Int16InIntOut", _in); -} - -export async function Int16PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.Int16PointerInAndOutput", _in); -} - -export async function Int32InIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.Int32InIntOut", _in); -} - -export async function Int32PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.Int32PointerInAndOutput", _in); -} - -export async function Int64InIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.Int64InIntOut", _in); -} - -export async function Int64PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.Int64PointerInAndOutput", _in); -} - -export async function Int8InIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.Int8InIntOut", _in); -} - -export async function Int8PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.Int8PointerInAndOutput", _in); -} - -export async function IntInIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.IntInIntOut", _in); -} - -export async function IntPointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.IntPointerInAndOutput", _in); -} - -export async function IntPointerInputNamedOutputs(_in: number | null) : Promise { - return Call.ByName("main.GreetService.IntPointerInputNamedOutputs", _in); -} - -export async function MapIntInt(_in: map) : Promise { - return Call.ByName("main.GreetService.MapIntInt", _in); -} - -export async function MapIntPointerInt(_in: map) : Promise { - return Call.ByName("main.GreetService.MapIntPointerInt", _in); -} - -export async function MapIntSliceInt(_in: map) : Promise { - return Call.ByName("main.GreetService.MapIntSliceInt", _in); -} - -export async function MapIntSliceIntInMapIntSliceIntOut(_in: map) : Promise { - return Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", _in); -} - -export async function NoInputsStringOut() : Promise { - return Call.ByName("main.GreetService.NoInputsStringOut"); -} - -export async function PointerBoolInBoolOut(_in: boolean | null) : Promise { - return Call.ByName("main.GreetService.PointerBoolInBoolOut", _in); -} - -export async function PointerFloat32InFloat32Out(_in: number | null) : Promise { - return Call.ByName("main.GreetService.PointerFloat32InFloat32Out", _in); -} - -export async function PointerFloat64InFloat64Out(_in: number | null) : Promise { - return Call.ByName("main.GreetService.PointerFloat64InFloat64Out", _in); -} - -export async function PointerMapIntInt(_in: map | null) : Promise { - return Call.ByName("main.GreetService.PointerMapIntInt", _in); -} - -export async function PointerStringInStringOut(_in: string | null) : Promise { - return Call.ByName("main.GreetService.PointerStringInStringOut", _in); -} - -export async function StringArrayInputNamedOutput(_in: string[]) : Promise { - return Call.ByName("main.GreetService.StringArrayInputNamedOutput", _in); -} - -export async function StringArrayInputNamedOutputs(_in: string[]) : Promise { - return Call.ByName("main.GreetService.StringArrayInputNamedOutputs", _in); -} - -export async function StringArrayInputStringArrayOut(_in: string[]) : Promise { - return Call.ByName("main.GreetService.StringArrayInputStringArrayOut", _in); -} - -export async function StringArrayInputStringOut(_in: string[]) : Promise { - return Call.ByName("main.GreetService.StringArrayInputStringOut", _in); -} - -export async function StructInputStructOutput(_in: Person) : Promise { - return Call.ByName("main.GreetService.StructInputStructOutput", _in); -} - -export async function StructPointerInputErrorOutput(_in: Person | null) : Promise { - return Call.ByName("main.GreetService.StructPointerInputErrorOutput", _in); -} - -export async function StructPointerInputStructPointerOutput(_in: Person | null) : Promise { - return Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", _in); -} - -export async function UInt16InUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UInt16InUIntOut", _in); -} - -export async function UInt16PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UInt16PointerInAndOutput", _in); -} - -export async function UInt32InUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UInt32InUIntOut", _in); -} - -export async function UInt32PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UInt32PointerInAndOutput", _in); -} - -export async function UInt64InUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UInt64InUIntOut", _in); -} - -export async function UInt64PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UInt64PointerInAndOutput", _in); -} - -export async function UInt8InUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UInt8InUIntOut", _in); -} - -export async function UInt8PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UInt8PointerInAndOutput", _in); -} - -export async function UIntInUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UIntInUIntOut", _in); -} - -export async function UIntPointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UIntPointerInAndOutput", _in); -} - diff --git a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.ts deleted file mode 100644 index acc449f58f3..00000000000 --- a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,179 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -export async function ArrayInt(_in: number[]) : Promise { - return Call.ByID(3862002418, _in); -} - -export async function BoolInBoolOut(_in: boolean) : Promise { - return Call.ByID(2424639793, _in); -} - -export async function Float32InFloat32Out(_in: number) : Promise { - return Call.ByID(3132595881, _in); -} - -export async function Float64InFloat64Out(_in: number) : Promise { - return Call.ByID(2182412247, _in); -} - -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - -export async function Int16InIntOut(_in: number) : Promise { - return Call.ByID(3306292566, _in); -} - -export async function Int16PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1754277916, _in); -} - -export async function Int32InIntOut(_in: number) : Promise { - return Call.ByID(1909469092, _in); -} - -export async function Int32PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(4251088558, _in); -} - -export async function Int64InIntOut(_in: number) : Promise { - return Call.ByID(1343888303, _in); -} - -export async function Int64PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(2205561041, _in); -} - -export async function Int8InIntOut(_in: number) : Promise { - return Call.ByID(572240879, _in); -} - -export async function Int8PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(2189402897, _in); -} - -export async function IntInIntOut(_in: number) : Promise { - return Call.ByID(642881729, _in); -} - -export async function IntPointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1066151743, _in); -} - -export async function IntPointerInputNamedOutputs(_in: number | null) : Promise { - return Call.ByID(2718999663, _in); -} - -export async function MapIntInt(_in: map) : Promise { - return Call.ByID(2386486356, _in); -} - -export async function MapIntPointerInt(_in: map) : Promise { - return Call.ByID(550413585, _in); -} - -export async function MapIntSliceInt(_in: map) : Promise { - return Call.ByID(2900172572, _in); -} - -export async function MapIntSliceIntInMapIntSliceIntOut(_in: map) : Promise { - return Call.ByID(881980169, _in); -} - -export async function NoInputsStringOut() : Promise { - return Call.ByID(1075577233); -} - -export async function PointerBoolInBoolOut(_in: boolean | null) : Promise { - return Call.ByID(3589606958, _in); -} - -export async function PointerFloat32InFloat32Out(_in: number | null) : Promise { - return Call.ByID(224675106, _in); -} - -export async function PointerFloat64InFloat64Out(_in: number | null) : Promise { - return Call.ByID(2124953624, _in); -} - -export async function PointerMapIntInt(_in: map | null) : Promise { - return Call.ByID(3516977899, _in); -} - -export async function PointerStringInStringOut(_in: string | null) : Promise { - return Call.ByID(229603958, _in); -} - -export async function StringArrayInputNamedOutput(_in: string[]) : Promise { - return Call.ByID(3678582682, _in); -} - -export async function StringArrayInputNamedOutputs(_in: string[]) : Promise { - return Call.ByID(319259595, _in); -} - -export async function StringArrayInputStringArrayOut(_in: string[]) : Promise { - return Call.ByID(383995060, _in); -} - -export async function StringArrayInputStringOut(_in: string[]) : Promise { - return Call.ByID(1091960237, _in); -} - -export async function StructInputStructOutput(_in: Person) : Promise { - return Call.ByID(3835643147, _in); -} - -export async function StructPointerInputErrorOutput(_in: Person | null) : Promise { - return Call.ByID(2447692557, _in); -} - -export async function StructPointerInputStructPointerOutput(_in: Person | null) : Promise { - return Call.ByID(2943477349, _in); -} - -export async function UInt16InUIntOut(_in: number) : Promise { - return Call.ByID(3401034892, _in); -} - -export async function UInt16PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1236957573, _in); -} - -export async function UInt32InUIntOut(_in: number) : Promise { - return Call.ByID(1160383782, _in); -} - -export async function UInt32PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1739300671, _in); -} - -export async function UInt64InUIntOut(_in: number) : Promise { - return Call.ByID(793803239, _in); -} - -export async function UInt64PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1403757716, _in); -} - -export async function UInt8InUIntOut(_in: number) : Promise { - return Call.ByID(2988345717, _in); -} - -export async function UInt8PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(518250834, _in); -} - -export async function UIntInUIntOut(_in: number) : Promise { - return Call.ByID(2836661285, _in); -} - -export async function UIntPointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1367187362, _in); -} - diff --git a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.interfaces.ts b/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.interfaces.ts deleted file mode 100644 index 7074f18c9c8..00000000000 --- a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.interfaces.ts +++ /dev/null @@ -1,19 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - - -export interface Person { - name: string; - parent: Person; - details: anon1; -} - -export interface anon1 { - age: number; - address: anon2; -} - -export interface anon2 { - street: string; -} diff --git a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.js b/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.js deleted file mode 100644 index 59f0b93567b..00000000000 --- a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.js +++ /dev/null @@ -1,79 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -export const Person = class { - /** - * Creates a new Person instance. - * @constructor - * @param {Object} source - The source object to create the Person. - * @param {string} source.Name - * @param {Person} source.Parent - * @param {anon1} source.Details - */ - constructor(source = {}) { - const { name = "", parent = null, details = null } = source; - this.name = name; - this.parent = parent; - this.details = details; - } - - /** - * Creates a new Person instance from a string or object. - * @param {string|object} source - The source data to create a Person instance from. - * @returns {Person} A new Person instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource); - } -}; - -export const anon1 = class { - /** - * Creates a new anon1 instance. - * @constructor - * @param {Object} source - The source object to create the anon1. - * @param {number} source.Age - * @param {anon2} source.Address - */ - constructor(source = {}) { - const { age = 0, address = null } = source; - this.age = age; - this.address = address; - } - - /** - * Creates a new anon1 instance from a string or object. - * @param {string|object} source - The source data to create a anon1 instance from. - * @returns {anon1} A new anon1 instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new anon1(parsedSource); - } -}; - -export const anon2 = class { - /** - * Creates a new anon2 instance. - * @constructor - * @param {Object} source - The source object to create the anon2. - * @param {string} source.Street - */ - constructor(source = {}) { - const { street = "" } = source; - this.street = street; - } - - /** - * Creates a new anon2 instance from a string or object. - * @param {string|object} source - The source data to create a anon2 instance from. - * @returns {anon2} A new anon2 instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new anon2(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.ts b/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.ts deleted file mode 100644 index 83431809ba9..00000000000 --- a/v3/internal/parser/testdata/struct_literal_non_pointer_single/frontend/bindings/main/models.ts +++ /dev/null @@ -1,52 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - - -export class Person { - name: string; - parent: Person; - details: anon1; - - constructor(source: Partial = {}) { - const {name = "", parent = null, details = null} = source; - this.name = name; - this.parent = parent; - this.details = details; - } - - static createFrom(source: string | object = {}): Person { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource as Partial); - } -} - -export class anon1 { - age: number; - address: anon2; - - constructor(source: Partial = {}) { - const {age = 0, address = null} = source; - this.age = age; - this.address = address; - } - - static createFrom(source: string | object = {}): anon1 { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new anon1(parsedSource as Partial); - } -} - -export class anon2 { - street: string; - - constructor(source: Partial = {}) { - const {street = ""} = source; - this.street = street; - } - - static createFrom(source: string | object = {}): anon2 { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new anon2(parsedSource as Partial); - } -} diff --git a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.js deleted file mode 100644 index f3d0b247951..00000000000 --- a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,395 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * @function ArrayInt - * @param _in {number[]} - * @returns {Promise} - **/ -export async function ArrayInt(_in) { - return Call.ByID(3862002418, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function BoolInBoolOut - * @param _in {boolean} - * @returns {Promise} - **/ -export async function BoolInBoolOut(_in) { - return Call.ByID(2424639793, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Float32InFloat32Out - * @param _in {number} - * @returns {Promise} - **/ -export async function Float32InFloat32Out(_in) { - return Call.ByID(3132595881, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Float64InFloat64Out - * @param _in {number} - * @returns {Promise} - **/ -export async function Float64InFloat64Out(_in) { - return Call.ByID(2182412247, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int16InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int16InIntOut(_in) { - return Call.ByID(3306292566, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int16PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int16PointerInAndOutput(_in) { - return Call.ByID(1754277916, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int32InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int32InIntOut(_in) { - return Call.ByID(1909469092, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int32PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int32PointerInAndOutput(_in) { - return Call.ByID(4251088558, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int64InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int64InIntOut(_in) { - return Call.ByID(1343888303, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int64PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int64PointerInAndOutput(_in) { - return Call.ByID(2205561041, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int8InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int8InIntOut(_in) { - return Call.ByID(572240879, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int8PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int8PointerInAndOutput(_in) { - return Call.ByID(2189402897, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntInIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function IntInIntOut(_in) { - return Call.ByID(642881729, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntPointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function IntPointerInAndOutput(_in) { - return Call.ByID(1066151743, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntPointerInputNamedOutputs - * @param _in {number | null} - * @returns {Promise} - **/ -export async function IntPointerInputNamedOutputs(_in) { - return Call.ByID(2718999663, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntInt(_in) { - return Call.ByID(2386486356, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntPointerInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntPointerInt(_in) { - return Call.ByID(550413585, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntSliceInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntSliceInt(_in) { - return Call.ByID(2900172572, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntSliceIntInMapIntSliceIntOut - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntSliceIntInMapIntSliceIntOut(_in) { - return Call.ByID(881980169, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function NoInputsStringOut - * @returns {Promise} - **/ -export async function NoInputsStringOut() { - return Call.ByID(1075577233, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerBoolInBoolOut - * @param _in {boolean | null} - * @returns {Promise} - **/ -export async function PointerBoolInBoolOut(_in) { - return Call.ByID(3589606958, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerFloat32InFloat32Out - * @param _in {number | null} - * @returns {Promise} - **/ -export async function PointerFloat32InFloat32Out(_in) { - return Call.ByID(224675106, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerFloat64InFloat64Out - * @param _in {number | null} - * @returns {Promise} - **/ -export async function PointerFloat64InFloat64Out(_in) { - return Call.ByID(2124953624, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerMapIntInt - * @param _in {map | null} - * @returns {Promise} - **/ -export async function PointerMapIntInt(_in) { - return Call.ByID(3516977899, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerStringInStringOut - * @param _in {string | null} - * @returns {Promise} - **/ -export async function PointerStringInStringOut(_in) { - return Call.ByID(229603958, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputNamedOutput - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputNamedOutput(_in) { - return Call.ByID(3678582682, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputNamedOutputs - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputNamedOutputs(_in) { - return Call.ByID(319259595, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputStringArrayOut - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputStringArrayOut(_in) { - return Call.ByID(383995060, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputStringOut - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputStringOut(_in) { - return Call.ByID(1091960237, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructInputStructOutput - * @param _in {Person} - * @returns {Promise} - **/ -export async function StructInputStructOutput(_in) { - return Call.ByID(3835643147, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructPointerInputErrorOutput - * @param _in {Person | null} - * @returns {Promise} - **/ -export async function StructPointerInputErrorOutput(_in) { - return Call.ByID(2447692557, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructPointerInputStructPointerOutput - * @param _in {Person | null} - * @returns {Promise} - **/ -export async function StructPointerInputStructPointerOutput(_in) { - return Call.ByID(2943477349, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt16InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt16InUIntOut(_in) { - return Call.ByID(3401034892, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt16PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt16PointerInAndOutput(_in) { - return Call.ByID(1236957573, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt32InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt32InUIntOut(_in) { - return Call.ByID(1160383782, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt32PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt32PointerInAndOutput(_in) { - return Call.ByID(1739300671, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt64InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt64InUIntOut(_in) { - return Call.ByID(793803239, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt64PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt64PointerInAndOutput(_in) { - return Call.ByID(1403757716, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt8InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt8InUIntOut(_in) { - return Call.ByID(2988345717, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt8PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt8PointerInAndOutput(_in) { - return Call.ByID(518250834, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UIntInUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UIntInUIntOut(_in) { - return Call.ByID(2836661285, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UIntPointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UIntPointerInAndOutput(_in) { - return Call.ByID(1367187362, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 026bc3be501..00000000000 --- a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,395 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * @function ArrayInt - * @param _in {number[]} - * @returns {Promise} - **/ -export async function ArrayInt(_in) { - return Call.ByName("main.GreetService.ArrayInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function BoolInBoolOut - * @param _in {boolean} - * @returns {Promise} - **/ -export async function BoolInBoolOut(_in) { - return Call.ByName("main.GreetService.BoolInBoolOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Float32InFloat32Out - * @param _in {number} - * @returns {Promise} - **/ -export async function Float32InFloat32Out(_in) { - return Call.ByName("main.GreetService.Float32InFloat32Out", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Float64InFloat64Out - * @param _in {number} - * @returns {Promise} - **/ -export async function Float64InFloat64Out(_in) { - return Call.ByName("main.GreetService.Float64InFloat64Out", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int16InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int16InIntOut(_in) { - return Call.ByName("main.GreetService.Int16InIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int16PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int16PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.Int16PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int32InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int32InIntOut(_in) { - return Call.ByName("main.GreetService.Int32InIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int32PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int32PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.Int32PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int64InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int64InIntOut(_in) { - return Call.ByName("main.GreetService.Int64InIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int64PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int64PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.Int64PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int8InIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function Int8InIntOut(_in) { - return Call.ByName("main.GreetService.Int8InIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function Int8PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function Int8PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.Int8PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntInIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function IntInIntOut(_in) { - return Call.ByName("main.GreetService.IntInIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntPointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function IntPointerInAndOutput(_in) { - return Call.ByName("main.GreetService.IntPointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function IntPointerInputNamedOutputs - * @param _in {number | null} - * @returns {Promise} - **/ -export async function IntPointerInputNamedOutputs(_in) { - return Call.ByName("main.GreetService.IntPointerInputNamedOutputs", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntInt(_in) { - return Call.ByName("main.GreetService.MapIntInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntPointerInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntPointerInt(_in) { - return Call.ByName("main.GreetService.MapIntPointerInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntSliceInt - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntSliceInt(_in) { - return Call.ByName("main.GreetService.MapIntSliceInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function MapIntSliceIntInMapIntSliceIntOut - * @param _in {map} - * @returns {Promise} - **/ -export async function MapIntSliceIntInMapIntSliceIntOut(_in) { - return Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function NoInputsStringOut - * @returns {Promise} - **/ -export async function NoInputsStringOut() { - return Call.ByName("main.GreetService.NoInputsStringOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerBoolInBoolOut - * @param _in {boolean | null} - * @returns {Promise} - **/ -export async function PointerBoolInBoolOut(_in) { - return Call.ByName("main.GreetService.PointerBoolInBoolOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerFloat32InFloat32Out - * @param _in {number | null} - * @returns {Promise} - **/ -export async function PointerFloat32InFloat32Out(_in) { - return Call.ByName("main.GreetService.PointerFloat32InFloat32Out", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerFloat64InFloat64Out - * @param _in {number | null} - * @returns {Promise} - **/ -export async function PointerFloat64InFloat64Out(_in) { - return Call.ByName("main.GreetService.PointerFloat64InFloat64Out", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerMapIntInt - * @param _in {map | null} - * @returns {Promise} - **/ -export async function PointerMapIntInt(_in) { - return Call.ByName("main.GreetService.PointerMapIntInt", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function PointerStringInStringOut - * @param _in {string | null} - * @returns {Promise} - **/ -export async function PointerStringInStringOut(_in) { - return Call.ByName("main.GreetService.PointerStringInStringOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputNamedOutput - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputNamedOutput(_in) { - return Call.ByName("main.GreetService.StringArrayInputNamedOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputNamedOutputs - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputNamedOutputs(_in) { - return Call.ByName("main.GreetService.StringArrayInputNamedOutputs", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputStringArrayOut - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputStringArrayOut(_in) { - return Call.ByName("main.GreetService.StringArrayInputStringArrayOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StringArrayInputStringOut - * @param _in {string[]} - * @returns {Promise} - **/ -export async function StringArrayInputStringOut(_in) { - return Call.ByName("main.GreetService.StringArrayInputStringOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructInputStructOutput - * @param _in {Person} - * @returns {Promise} - **/ -export async function StructInputStructOutput(_in) { - return Call.ByName("main.GreetService.StructInputStructOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructPointerInputErrorOutput - * @param _in {Person | null} - * @returns {Promise} - **/ -export async function StructPointerInputErrorOutput(_in) { - return Call.ByName("main.GreetService.StructPointerInputErrorOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function StructPointerInputStructPointerOutput - * @param _in {Person | null} - * @returns {Promise} - **/ -export async function StructPointerInputStructPointerOutput(_in) { - return Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt16InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt16InUIntOut(_in) { - return Call.ByName("main.GreetService.UInt16InUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt16PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt16PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UInt16PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt32InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt32InUIntOut(_in) { - return Call.ByName("main.GreetService.UInt32InUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt32PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt32PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UInt32PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt64InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt64InUIntOut(_in) { - return Call.ByName("main.GreetService.UInt64InUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt64PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt64PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UInt64PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt8InUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UInt8InUIntOut(_in) { - return Call.ByName("main.GreetService.UInt8InUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UInt8PointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UInt8PointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UInt8PointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UIntInUIntOut - * @param _in {number} - * @returns {Promise} - **/ -export async function UIntInUIntOut(_in) { - return Call.ByName("main.GreetService.UIntInUIntOut", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * @function UIntPointerInAndOutput - * @param _in {number | null} - * @returns {Promise} - **/ -export async function UIntPointerInAndOutput(_in) { - return Call.ByName("main.GreetService.UIntPointerInAndOutput", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index b47c462c5a6..00000000000 --- a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,179 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -export async function ArrayInt(_in: number[]) : Promise { - return Call.ByName("main.GreetService.ArrayInt", _in); -} - -export async function BoolInBoolOut(_in: boolean) : Promise { - return Call.ByName("main.GreetService.BoolInBoolOut", _in); -} - -export async function Float32InFloat32Out(_in: number) : Promise { - return Call.ByName("main.GreetService.Float32InFloat32Out", _in); -} - -export async function Float64InFloat64Out(_in: number) : Promise { - return Call.ByName("main.GreetService.Float64InFloat64Out", _in); -} - -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - -export async function Int16InIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.Int16InIntOut", _in); -} - -export async function Int16PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.Int16PointerInAndOutput", _in); -} - -export async function Int32InIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.Int32InIntOut", _in); -} - -export async function Int32PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.Int32PointerInAndOutput", _in); -} - -export async function Int64InIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.Int64InIntOut", _in); -} - -export async function Int64PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.Int64PointerInAndOutput", _in); -} - -export async function Int8InIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.Int8InIntOut", _in); -} - -export async function Int8PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.Int8PointerInAndOutput", _in); -} - -export async function IntInIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.IntInIntOut", _in); -} - -export async function IntPointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.IntPointerInAndOutput", _in); -} - -export async function IntPointerInputNamedOutputs(_in: number | null) : Promise { - return Call.ByName("main.GreetService.IntPointerInputNamedOutputs", _in); -} - -export async function MapIntInt(_in: map) : Promise { - return Call.ByName("main.GreetService.MapIntInt", _in); -} - -export async function MapIntPointerInt(_in: map) : Promise { - return Call.ByName("main.GreetService.MapIntPointerInt", _in); -} - -export async function MapIntSliceInt(_in: map) : Promise { - return Call.ByName("main.GreetService.MapIntSliceInt", _in); -} - -export async function MapIntSliceIntInMapIntSliceIntOut(_in: map) : Promise { - return Call.ByName("main.GreetService.MapIntSliceIntInMapIntSliceIntOut", _in); -} - -export async function NoInputsStringOut() : Promise { - return Call.ByName("main.GreetService.NoInputsStringOut"); -} - -export async function PointerBoolInBoolOut(_in: boolean | null) : Promise { - return Call.ByName("main.GreetService.PointerBoolInBoolOut", _in); -} - -export async function PointerFloat32InFloat32Out(_in: number | null) : Promise { - return Call.ByName("main.GreetService.PointerFloat32InFloat32Out", _in); -} - -export async function PointerFloat64InFloat64Out(_in: number | null) : Promise { - return Call.ByName("main.GreetService.PointerFloat64InFloat64Out", _in); -} - -export async function PointerMapIntInt(_in: map | null) : Promise { - return Call.ByName("main.GreetService.PointerMapIntInt", _in); -} - -export async function PointerStringInStringOut(_in: string | null) : Promise { - return Call.ByName("main.GreetService.PointerStringInStringOut", _in); -} - -export async function StringArrayInputNamedOutput(_in: string[]) : Promise { - return Call.ByName("main.GreetService.StringArrayInputNamedOutput", _in); -} - -export async function StringArrayInputNamedOutputs(_in: string[]) : Promise { - return Call.ByName("main.GreetService.StringArrayInputNamedOutputs", _in); -} - -export async function StringArrayInputStringArrayOut(_in: string[]) : Promise { - return Call.ByName("main.GreetService.StringArrayInputStringArrayOut", _in); -} - -export async function StringArrayInputStringOut(_in: string[]) : Promise { - return Call.ByName("main.GreetService.StringArrayInputStringOut", _in); -} - -export async function StructInputStructOutput(_in: Person) : Promise { - return Call.ByName("main.GreetService.StructInputStructOutput", _in); -} - -export async function StructPointerInputErrorOutput(_in: Person | null) : Promise { - return Call.ByName("main.GreetService.StructPointerInputErrorOutput", _in); -} - -export async function StructPointerInputStructPointerOutput(_in: Person | null) : Promise { - return Call.ByName("main.GreetService.StructPointerInputStructPointerOutput", _in); -} - -export async function UInt16InUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UInt16InUIntOut", _in); -} - -export async function UInt16PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UInt16PointerInAndOutput", _in); -} - -export async function UInt32InUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UInt32InUIntOut", _in); -} - -export async function UInt32PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UInt32PointerInAndOutput", _in); -} - -export async function UInt64InUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UInt64InUIntOut", _in); -} - -export async function UInt64PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UInt64PointerInAndOutput", _in); -} - -export async function UInt8InUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UInt8InUIntOut", _in); -} - -export async function UInt8PointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UInt8PointerInAndOutput", _in); -} - -export async function UIntInUIntOut(_in: number) : Promise { - return Call.ByName("main.GreetService.UIntInUIntOut", _in); -} - -export async function UIntPointerInAndOutput(_in: number | null) : Promise { - return Call.ByName("main.GreetService.UIntPointerInAndOutput", _in); -} - diff --git a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.ts deleted file mode 100644 index acc449f58f3..00000000000 --- a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,179 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -export async function ArrayInt(_in: number[]) : Promise { - return Call.ByID(3862002418, _in); -} - -export async function BoolInBoolOut(_in: boolean) : Promise { - return Call.ByID(2424639793, _in); -} - -export async function Float32InFloat32Out(_in: number) : Promise { - return Call.ByID(3132595881, _in); -} - -export async function Float64InFloat64Out(_in: number) : Promise { - return Call.ByID(2182412247, _in); -} - -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - -export async function Int16InIntOut(_in: number) : Promise { - return Call.ByID(3306292566, _in); -} - -export async function Int16PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1754277916, _in); -} - -export async function Int32InIntOut(_in: number) : Promise { - return Call.ByID(1909469092, _in); -} - -export async function Int32PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(4251088558, _in); -} - -export async function Int64InIntOut(_in: number) : Promise { - return Call.ByID(1343888303, _in); -} - -export async function Int64PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(2205561041, _in); -} - -export async function Int8InIntOut(_in: number) : Promise { - return Call.ByID(572240879, _in); -} - -export async function Int8PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(2189402897, _in); -} - -export async function IntInIntOut(_in: number) : Promise { - return Call.ByID(642881729, _in); -} - -export async function IntPointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1066151743, _in); -} - -export async function IntPointerInputNamedOutputs(_in: number | null) : Promise { - return Call.ByID(2718999663, _in); -} - -export async function MapIntInt(_in: map) : Promise { - return Call.ByID(2386486356, _in); -} - -export async function MapIntPointerInt(_in: map) : Promise { - return Call.ByID(550413585, _in); -} - -export async function MapIntSliceInt(_in: map) : Promise { - return Call.ByID(2900172572, _in); -} - -export async function MapIntSliceIntInMapIntSliceIntOut(_in: map) : Promise { - return Call.ByID(881980169, _in); -} - -export async function NoInputsStringOut() : Promise { - return Call.ByID(1075577233); -} - -export async function PointerBoolInBoolOut(_in: boolean | null) : Promise { - return Call.ByID(3589606958, _in); -} - -export async function PointerFloat32InFloat32Out(_in: number | null) : Promise { - return Call.ByID(224675106, _in); -} - -export async function PointerFloat64InFloat64Out(_in: number | null) : Promise { - return Call.ByID(2124953624, _in); -} - -export async function PointerMapIntInt(_in: map | null) : Promise { - return Call.ByID(3516977899, _in); -} - -export async function PointerStringInStringOut(_in: string | null) : Promise { - return Call.ByID(229603958, _in); -} - -export async function StringArrayInputNamedOutput(_in: string[]) : Promise { - return Call.ByID(3678582682, _in); -} - -export async function StringArrayInputNamedOutputs(_in: string[]) : Promise { - return Call.ByID(319259595, _in); -} - -export async function StringArrayInputStringArrayOut(_in: string[]) : Promise { - return Call.ByID(383995060, _in); -} - -export async function StringArrayInputStringOut(_in: string[]) : Promise { - return Call.ByID(1091960237, _in); -} - -export async function StructInputStructOutput(_in: Person) : Promise { - return Call.ByID(3835643147, _in); -} - -export async function StructPointerInputErrorOutput(_in: Person | null) : Promise { - return Call.ByID(2447692557, _in); -} - -export async function StructPointerInputStructPointerOutput(_in: Person | null) : Promise { - return Call.ByID(2943477349, _in); -} - -export async function UInt16InUIntOut(_in: number) : Promise { - return Call.ByID(3401034892, _in); -} - -export async function UInt16PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1236957573, _in); -} - -export async function UInt32InUIntOut(_in: number) : Promise { - return Call.ByID(1160383782, _in); -} - -export async function UInt32PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1739300671, _in); -} - -export async function UInt64InUIntOut(_in: number) : Promise { - return Call.ByID(793803239, _in); -} - -export async function UInt64PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1403757716, _in); -} - -export async function UInt8InUIntOut(_in: number) : Promise { - return Call.ByID(2988345717, _in); -} - -export async function UInt8PointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(518250834, _in); -} - -export async function UIntInUIntOut(_in: number) : Promise { - return Call.ByID(2836661285, _in); -} - -export async function UIntPointerInAndOutput(_in: number | null) : Promise { - return Call.ByID(1367187362, _in); -} - diff --git a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/models.interfaces.ts b/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/models.interfaces.ts deleted file mode 100644 index 7074f18c9c8..00000000000 --- a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/models.interfaces.ts +++ /dev/null @@ -1,19 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - - -export interface Person { - name: string; - parent: Person; - details: anon1; -} - -export interface anon1 { - age: number; - address: anon2; -} - -export interface anon2 { - street: string; -} diff --git a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/models.js b/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/models.js deleted file mode 100644 index 59f0b93567b..00000000000 --- a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/models.js +++ /dev/null @@ -1,79 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -export const Person = class { - /** - * Creates a new Person instance. - * @constructor - * @param {Object} source - The source object to create the Person. - * @param {string} source.Name - * @param {Person} source.Parent - * @param {anon1} source.Details - */ - constructor(source = {}) { - const { name = "", parent = null, details = null } = source; - this.name = name; - this.parent = parent; - this.details = details; - } - - /** - * Creates a new Person instance from a string or object. - * @param {string|object} source - The source data to create a Person instance from. - * @returns {Person} A new Person instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource); - } -}; - -export const anon1 = class { - /** - * Creates a new anon1 instance. - * @constructor - * @param {Object} source - The source object to create the anon1. - * @param {number} source.Age - * @param {anon2} source.Address - */ - constructor(source = {}) { - const { age = 0, address = null } = source; - this.age = age; - this.address = address; - } - - /** - * Creates a new anon1 instance from a string or object. - * @param {string|object} source - The source data to create a anon1 instance from. - * @returns {anon1} A new anon1 instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new anon1(parsedSource); - } -}; - -export const anon2 = class { - /** - * Creates a new anon2 instance. - * @constructor - * @param {Object} source - The source object to create the anon2. - * @param {string} source.Street - */ - constructor(source = {}) { - const { street = "" } = source; - this.street = street; - } - - /** - * Creates a new anon2 instance from a string or object. - * @param {string|object} source - The source data to create a anon2 instance from. - * @returns {anon2} A new anon2 instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new anon2(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/models.ts b/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/models.ts deleted file mode 100644 index 83431809ba9..00000000000 --- a/v3/internal/parser/testdata/struct_literal_single/frontend/bindings/main/models.ts +++ /dev/null @@ -1,52 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - - -export class Person { - name: string; - parent: Person; - details: anon1; - - constructor(source: Partial = {}) { - const {name = "", parent = null, details = null} = source; - this.name = name; - this.parent = parent; - this.details = details; - } - - static createFrom(source: string | object = {}): Person { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource as Partial); - } -} - -export class anon1 { - age: number; - address: anon2; - - constructor(source: Partial = {}) { - const {age = 0, address = null} = source; - this.age = age; - this.address = address; - } - - static createFrom(source: string | object = {}): anon1 { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new anon1(parsedSource as Partial); - } -} - -export class anon2 { - street: string; - - constructor(source: Partial = {}) { - const {street = ""} = source; - this.street = street; - } - - static createFrom(source: string | object = {}): anon2 { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new anon2(parsedSource as Partial); - } -} diff --git a/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.js deleted file mode 100644 index 993cfb9dcc1..00000000000 --- a/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,15 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 66dfb05eebd..00000000000 --- a/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,15 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index e7884a90c3d..00000000000 --- a/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - diff --git a/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.ts deleted file mode 100644 index 497e17d2bf6..00000000000 --- a/v3/internal/parser/testdata/variable_single/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - diff --git a/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.js deleted file mode 100644 index 993cfb9dcc1..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,15 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 66dfb05eebd..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,15 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; - -/** - * Greet someone - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index e7884a90c3d..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - diff --git a/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.ts deleted file mode 100644 index 497e17d2bf6..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_function/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -// Greet someone -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.js b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.js deleted file mode 100644 index f1343c2d7b7..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return Call.ByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.name.js b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.name.js deleted file mode 100644 index 30610a58aa1..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.name.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Person} Person - */ - -/** - * Greet does XYZ - * @function Greet - * @param name {string} - * @returns {Promise} - **/ -export async function Greet(name) { - return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0)); -} - -/** - * NewPerson creates a new person - * @function NewPerson - * @param name {string} - * @returns {Promise} - **/ -export async function NewPerson(name) { - return Call.ByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.name.ts b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.name.ts deleted file mode 100644 index b5753395d13..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.name.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -// Greet does XYZ -export async function Greet(name: string) : Promise { - return Call.ByName("main.GreetService.Greet", name); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByName("main.GreetService.NewPerson", name); -} - diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.ts b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.ts deleted file mode 100644 index 0b2c57590b6..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/GreetService.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Person} from './models'; - -// Greet does XYZ -export async function Greet(name: string) : Promise { - return Call.ByID(1411160069, name); -} - -// NewPerson creates a new person -export async function NewPerson(name: string) : Promise { - return Call.ByID(1661412647, name); -} - diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/models.interfaces.ts b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/models.interfaces.ts deleted file mode 100644 index 2df3adf6dd5..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/models.interfaces.ts +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import * as services from "../services/models"; - -// Person is a person! -// They have a name and an address -export interface Person { - name: string; - address: services.Address; -} diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/models.js b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/models.js deleted file mode 100644 index 177fff3f35c..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/models.js +++ /dev/null @@ -1,35 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -/** - * @typedef {import('../services/models').Address} servicesAddress - */ - -// Person is a person! -// They have a name and an address -export const Person = class { - /** - * Creates a new Person instance. - * @constructor - * @param {Object} source - The source object to create the Person. - * @param {string} source.Name - * @param {servicesAddress} source.Address - */ - constructor(source = {}) { - const { name = "", address = null } = source; - this.name = name; - this.address = address; - } - - /** - * Creates a new Person instance from a string or object. - * @param {string|object} source - The source data to create a Person instance from. - * @returns {Person} A new Person instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/models.ts b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/models.ts deleted file mode 100644 index a3a61ca3a4c..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/main/models.ts +++ /dev/null @@ -1,23 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import * as services from "../services/models"; - -// Person is a person! -// They have a name and an address -export class Person { - name: string; - address: services.Address; - - constructor(source: Partial = {}) { - const {name = "", address = null} = source; - this.name = name; - this.address = address; - } - - static createFrom(source: string | object = {}): Person { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Person(parsedSource as Partial); - } -} diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.js b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.js deleted file mode 100644 index 53004f53834..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.js +++ /dev/null @@ -1,17 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Address} Address - */ - -/** - * Yay does this and that - * @function Yay - * @returns {Promise
} - **/ -export async function Yay() { - return Call.ByID(302702907, ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.name.js b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.name.js deleted file mode 100644 index 10240b9a676..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.name.js +++ /dev/null @@ -1,17 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -/** - * @typedef {import('./models').Address} Address - */ - -/** - * Yay does this and that - * @function Yay - * @returns {Promise
} - **/ -export async function Yay() { - return Call.ByName("services.OtherService.Yay", ...Array.prototype.slice.call(arguments, 0)); -} diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.name.ts b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.name.ts deleted file mode 100644 index 44612231689..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.name.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Address} from './models'; - -// Yay does this and that -export async function Yay() : Promise
{ - return Call.ByName("services.OtherService.Yay"); -} - diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.ts b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.ts deleted file mode 100644 index c37328f5c21..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/OtherService.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -import {Call} from '@wailsio/runtime'; -import {Address} from './models'; - -// Yay does this and that -export async function Yay() : Promise
{ - return Call.ByID(302702907); -} - diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/models.js b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/models.js deleted file mode 100644 index 4c763702090..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/models.js +++ /dev/null @@ -1,31 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -export const Address = class { - /** - * Creates a new Address instance. - * @constructor - * @param {Object} source - The source object to create the Address. - * @param {string} source.Street - * @param {string} source.State - * @param {string} source.Country - */ - constructor(source = {}) { - const { street = "", state = "", country = "" } = source; - this.street = street; - this.state = state; - this.country = country; - } - - /** - * Creates a new Address instance from a string or object. - * @param {string|object} source - The source data to create a Address instance from. - * @returns {Address} A new Address instance. - */ - static createFrom(source) { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Address(parsedSource); - } -}; - diff --git a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/models.ts b/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/models.ts deleted file mode 100644 index dc2a7446fba..00000000000 --- a/v3/internal/parser/testdata/variable_single_from_other_function/frontend/bindings/services/models.ts +++ /dev/null @@ -1,22 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - - -export class Address { - street: string; - state: string; - country: string; - - constructor(source: Partial
= {}) { - const {street = "", state = "", country = ""} = source; - this.street = street; - this.state = state; - this.country = country; - } - - static createFrom(source: string | object = {}): Address { - let parsedSource = typeof source === 'string' ? JSON.parse(source) : source; - return new Address(parsedSource as Partial
); - } -} diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/package-lock.json b/v3/internal/runtime/desktop/@wailsio/runtime/package-lock.json index 4f7bdb97438..9cd2dfc699c 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/package-lock.json +++ b/v3/internal/runtime/desktop/@wailsio/runtime/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wailsio/runtime", - "version": "3.0.0-alpha.21", + "version": "3.0.0-alpha.22", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wailsio/runtime", - "version": "3.0.0-alpha.21", + "version": "3.0.0-alpha.22", "license": "MIT", "dependencies": { "nanoid": "^5.0.7" diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/package.json b/v3/internal/runtime/desktop/@wailsio/runtime/package.json index 9a176dbd5b0..c0189b00b74 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/package.json +++ b/v3/internal/runtime/desktop/@wailsio/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@wailsio/runtime", - "version": "3.0.0-alpha.22", + "version": "3.0.0-alpha.23", "description": "Wails Runtime", "main": "src/index.js", "types": "types/index.d.ts", diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/src/calls.js b/v3/internal/runtime/desktop/@wailsio/runtime/src/calls.js index c2462a31a96..27a723e80ee 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/src/calls.js +++ b/v3/internal/runtime/desktop/@wailsio/runtime/src/calls.js @@ -113,7 +113,7 @@ function callBinding(type, options = {}) { queuedCancel = true; } }; - + return p; } @@ -130,19 +130,13 @@ export function Call(options) { /** * Executes a method by name. * - * @param {string} name - The name of the method in the format 'package.struct.method'. + * @param {string} methodName - The name of the method in the format 'package.struct.method'. * @param {...*} args - The arguments to pass to the method. * @throws {Error} If the name is not a string or is not in the correct format. * @returns {*} The result of the method execution. */ -export function ByName(name, ...args) { - if (typeof name !== "string" || name.split(".").length !== 3) { - throw new Error("CallByName requires a string in the format 'package.struct.method'"); - } - let [packageName, structName, methodName] = name.split("."); +export function ByName(methodName, ...args) { return callBinding(CallBinding, { - packageName, - structName, methodName, args }); diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/src/create.js b/v3/internal/runtime/desktop/@wailsio/runtime/src/create.js new file mode 100644 index 00000000000..98875fbdab0 --- /dev/null +++ b/v3/internal/runtime/desktop/@wailsio/runtime/src/create.js @@ -0,0 +1,125 @@ +/* + _ __ _ __ +| | / /___ _(_) /____ +| | /| / / __ `/ / / ___/ +| |/ |/ / /_/ / / (__ ) +|__/|__/\__,_/_/_/____/ +The electron alternative for Go +(c) Lea Anthony 2019-present +*/ + +/* jshint esversion: 9 */ + +/** + * Any is a dummy creation function for simple or unknown types. + * @template T + * @param {any} source + * @returns {T} + */ +export function Any(source) { + return /** @type {T} */(source); +} + +/** + * ByteSlice is a creation function that replaces + * null strings with empty strings. + * @param {any} source + * @returns {string} + */ +export function ByteSlice(source) { + return /** @type {any} */((source == null) ? "" : source); +} + +/** + * Array takes a creation function for an arbitrary type + * and returns an in-place creation function for an array + * whose elements are of that type. + * @template T + * @param {(any) => T} element + * @returns {(any) => T[]} + */ +export function Array(element) { + if (element === Any) { + return (source) => (source === null ? [] : source); + } + + return (source) => { + if (source === null) { + return []; + } + for (let i = 0; i < source.length; i++) { + source[i] = element(source[i]); + } + return source; + }; +} + +/** + * Map takes creation functions for two arbitrary types + * and returns an in-place creation function for an object + * whose keys and values are of those types. + * @template K, V + * @param {(any) => K} key + * @param {(any) => V} value + * @returns {(any) => { [_: K]: V }} + */ +export function Map(key, value) { + if (value === Any) { + return (source) => (source === null ? {} : source); + } + + return (source) => { + if (source === null) { + return {}; + } + for (const key in source) { + source[key] = value(source[key]); + } + return source; + }; +} + +/** + * Nullable takes a creation function for an arbitrary type + * and returns a creation function for a nullable value of that type. + * @template T + * @param {(any) => T} element + * @returns {(any) => (T | null)} + */ +export function Nullable(element) { + if (element === Any) { + return Any; + } + + return (source) => (source === null ? null : element(source)); +} + +/** + * Struct takes an object mapping field names to creation functions + * and returns an in-place creation function for a struct. + * @template {{ [_: string]: ((any) => any) }} T + * @template {{ [Key in keyof T]?: ReturnType }} U + * @param {T} createField + * @returns {(any) => U} + */ +export function Struct(createField) { + let allAny = true; + for (const name in createField) { + if (createField[name] !== Any) { + allAny = false; + break; + } + } + if (allAny) { + return Any; + } + + return (source) => { + for (const name in createField) { + if (name in source) { + source[name] = createField[name](source[name]); + } + } + return source; + }; +} diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/src/index.js b/v3/internal/runtime/desktop/@wailsio/runtime/src/index.js index 1509150c845..822546b8a31 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/src/index.js +++ b/v3/internal/runtime/desktop/@wailsio/runtime/src/index.js @@ -19,6 +19,7 @@ import * as Application from "./application"; import * as Browser from "./browser"; import * as Call from "./calls"; import * as Clipboard from "./clipboard"; +import * as Create from "./create"; import * as Dialogs from "./dialogs"; import * as Events from "./events"; import * as Flags from "./flags"; @@ -32,6 +33,7 @@ export { Browser, Call, Clipboard, + Create, Dialogs, Events, Flags, diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/types/create.d.ts b/v3/internal/runtime/desktop/@wailsio/runtime/types/create.d.ts new file mode 100644 index 00000000000..0a1ed52e12a --- /dev/null +++ b/v3/internal/runtime/desktop/@wailsio/runtime/types/create.d.ts @@ -0,0 +1,45 @@ +/** + * Any is a dummy creation function for simple or unknown types. + * @template T + * @param {any} source + * @returns {T} + */ +export function Any(source: any): T; +/** + * Array takes a creation function for an arbitrary type + * and returns an in-place creation function for an array + * whose elements are of that type. + * @template T + * @param {(any) => T} element + * @returns {(any) => T[]} + */ +export function Array(element: (any: any) => T): (any: any) => T[]; +/** + * Map takes creation functions for two arbitrary types + * and returns an in-place creation function for an object + * whose keys and values are of those types. + * @template K, V + * @param {(any) => K} key + * @param {(any) => V} value + * @returns {(any) => { [_: K]: V }} + */ +export function Map(key: (any: any) => K, value: (any: any) => V): (any: any) => {}; +/** + * Nullable takes a creation function for an arbitrary type + * and returns a creation function for a nullable value of that type. + * @template T + * @param {(any) => T} element + * @returns {(any) => (T | null)} + */ +export function Nullable(element: (any: any) => T): (any: any) => T; +/** + * Struct takes an object mapping field names to creation functions + * and returns an in-place creation function for a struct. + * @template {{ [_: string]: ((any) => any) }} T + * @template {{ [Key in keyof T]?: ReturnType }} U + * @param {T} createField + * @returns {(any) => U} + */ +export function Struct any; +}, U extends { [Key in keyof T]?: ReturnType; }>(createField: T): (any: any) => U; diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/types/index.d.ts b/v3/internal/runtime/desktop/@wailsio/runtime/types/index.d.ts index 29387f2c3c0..aad5e76070a 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/types/index.d.ts +++ b/v3/internal/runtime/desktop/@wailsio/runtime/types/index.d.ts @@ -2,6 +2,7 @@ import * as Application from "./application"; import * as Browser from "./browser"; import * as Call from "./calls"; import * as Clipboard from "./clipboard"; +import * as Create from "./create"; import * as Dialogs from "./dialogs"; import * as Events from "./events"; import * as Flags from "./flags"; @@ -9,4 +10,4 @@ import * as Screens from "./screens"; import * as System from "./system"; import Window from "./window"; import * as WML from "./wml"; -export { Application, Browser, Call, Clipboard, Dialogs, Events, Flags, Screens, System, Window, WML }; +export { Application, Browser, Call, Clipboard, Create, Dialogs, Events, Flags, Screens, System, Window, WML }; diff --git a/v3/internal/templates/_common/Taskfile.tmpl.yml b/v3/internal/templates/_common/Taskfile.tmpl.yml index 7be6fd47aa1..d53fd28ed0e 100644 --- a/v3/internal/templates/_common/Taskfile.tmpl.yml +++ b/v3/internal/templates/_common/Taskfile.tmpl.yml @@ -28,6 +28,8 @@ tasks: deps: - task: go:mod:tidy - task: build:frontend + vars: + BUILD_FLAGS: {{ "'{{.BUILD_FLAGS}}'" }} - task: generate:icons - task: generate:syso vars: @@ -79,6 +81,8 @@ tasks: deps: - task: go:mod:tidy - task: build:frontend + vars: + BUILD_FLAGS: {{ "'{{.BUILD_FLAGS}}'" }} - task: generate:icons cmds: - go build {{ "{{.BUILD_FLAGS}}" }} -o {{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }} @@ -131,6 +135,8 @@ tasks: deps: - task: go:mod:tidy - task: build:frontend + vars: + BUILD_FLAGS: {{ "'{{.BUILD_FLAGS}}'" }} - task: generate:icons vars: ARCH: {{ "'{{.ARCH}}'" }} @@ -377,7 +383,9 @@ tasks: - dist/* deps: - install:frontend:deps - - generate:bindings + - task: generate:bindings + vars: + BUILD_FLAGS: {{ "'{{.BUILD_FLAGS}}'" }} cmds: - npm run build -q @@ -385,16 +393,13 @@ tasks: summary: Generates bindings for the frontend sources: - "**/*.go" + - go.mod + - go.sum generates: - "frontend/bindings/**/*" cmds: - {{- if .UseTypescript }} # For a complete list of options, run `wails3 generate bindings -help` - - wails3 generate bindings -silent -ts - {{- else }} - - wails3 generate bindings -silent - {{- end }} - # - wails3 generate bindings -silent + - wails3 generate bindings -f '{{ "{{.BUILD_FLAGS}}" }}'{{if .UseTypescript}} -ts{{end}} go:mod:tidy: summary: Runs `go mod tidy` diff --git a/v3/internal/templates/_common/main.go.tmpl b/v3/internal/templates/_common/main.go.tmpl index e4b1a628d4d..b93e392a9a9 100644 --- a/v3/internal/templates/_common/main.go.tmpl +++ b/v3/internal/templates/_common/main.go.tmpl @@ -30,8 +30,8 @@ func main() { app := application.New(application.Options{ Name: "{{.ProjectName}}", Description: "A demo of using raw HTML & CSS", - Bind: []any{ - &GreetService{}, + Services: []application.Service{ + application.NewService(&GreetService{}), }, Assets: application.AssetOptions{ Handler: application.AssetFileServerFS(assets), diff --git a/v3/internal/templates/lit-ts/frontend/src/my-element.ts b/v3/internal/templates/lit-ts/frontend/src/my-element.ts index b5001919bf9..d4a83d32559 100644 --- a/v3/internal/templates/lit-ts/frontend/src/my-element.ts +++ b/v3/internal/templates/lit-ts/frontend/src/my-element.ts @@ -1,6 +1,6 @@ import {css, html, LitElement} from 'lit' import {customElement, property} from 'lit/decorators.js' -import {Greet} from '../bindings/main/GreetService'; +import {GreetService} from '../bindings/changeme'; import {Events} from "@wailsio/runtime"; /** @@ -34,7 +34,7 @@ export class MyElement extends LitElement { if (!name) { name = 'anonymous'; } - Greet(name).then((resultValue: string) => { + GreetService.Greet(name).then((resultValue: string) => { this.result = resultValue; }).catch((err: Error) => { console.log(err); @@ -77,22 +77,22 @@ export class MyElement extends LitElement { padding: 2rem; text-align: center; } - + h3 { font-size: 3em; line-height: 1.1; } - + a { font-weight: 500; color: #646cff; text-decoration: inherit; } - + a:hover { color: #535bf2; } - + button { width: 60px; height: 30px; @@ -110,40 +110,40 @@ export class MyElement extends LitElement { align-items: center; justify-content: center; } - + .logo { height: 6em; padding: 1.5em; will-change: filter; } - + .logo:hover { filter: drop-shadow(0 0 2em #e80000aa); } - + .logo.lit:hover { filter: drop-shadow(0 0 2em #325cffaa); } - + .result { height: 20px; line-height: 20px; margin: 1.5rem auto; text-align: center; } - + .footer { margin-top: 1rem; align-content: center; text-align: center; color: rgba(255, 255, 255, 0.67); } - + .input-box .btn:hover { background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%); color: #333333; } - + .input-box .input { border: none; border-radius: 3px; @@ -155,12 +155,12 @@ export class MyElement extends LitElement { background-color: rgba(240, 240, 240, 1); -webkit-font-smoothing: antialiased; } - + .input-box .input:hover { border: none; background-color: rgba(255, 255, 255, 1); } - + .input-box .input:focus { border: none; background-color: rgba(255, 255, 255, 1); diff --git a/v3/internal/templates/lit/frontend/src/my-element.js b/v3/internal/templates/lit/frontend/src/my-element.js index ded9d6ad636..c5ad7508fb3 100644 --- a/v3/internal/templates/lit/frontend/src/my-element.js +++ b/v3/internal/templates/lit/frontend/src/my-element.js @@ -1,5 +1,5 @@ import {css, html, LitElement} from 'lit' -import {Greet} from "../bindings/main/GreetService.js"; +import {GreetService} from "../bindings/changeme"; import {Events} from "@wailsio/runtime"; export class MyElement extends LitElement { @@ -24,7 +24,7 @@ export class MyElement extends LitElement { if (!name) { name = 'anonymous'; } - Greet(name).then((resultValue) => { + GreetService.Greet(name).then((resultValue) => { this.result = resultValue; }).catch((err) => { console.log(err); @@ -66,22 +66,22 @@ export class MyElement extends LitElement { padding: 2rem; text-align: center; } - + h3 { font-size: 3em; line-height: 1.1; } - + a { font-weight: 500; color: #646cff; text-decoration: inherit; } - + a:hover { color: #535bf2; } - + button { width: 60px; height: 30px; @@ -99,40 +99,40 @@ export class MyElement extends LitElement { align-items: center; justify-content: center; } - + .logo { height: 6em; padding: 1.5em; will-change: filter; } - + .logo:hover { filter: drop-shadow(0 0 2em #e80000aa); } - + .logo.lit:hover { filter: drop-shadow(0 0 2em #325cffaa); } - + .result { height: 20px; line-height: 20px; margin: 1.5rem auto; text-align: center; } - + .footer { margin-top: 1rem; align-content: center; text-align: center; color: rgba(255, 255, 255, 0.67); } - + .input-box .btn:hover { background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%); color: #333333; } - + .input-box .input { border: none; border-radius: 3px; @@ -144,12 +144,12 @@ export class MyElement extends LitElement { background-color: rgba(240, 240, 240, 1); -webkit-font-smoothing: antialiased; } - + .input-box .input:hover { border: none; background-color: rgba(255, 255, 255, 1); } - + .input-box .input:focus { border: none; background-color: rgba(255, 255, 255, 1); @@ -157,4 +157,4 @@ export class MyElement extends LitElement { `; } -window.customElements.define('my-element', MyElement); \ No newline at end of file +window.customElements.define('my-element', MyElement); diff --git a/v3/internal/templates/preact-ts/frontend/src/app.tsx b/v3/internal/templates/preact-ts/frontend/src/app.tsx index a7859e0c07e..1f192b6c2e8 100644 --- a/v3/internal/templates/preact-ts/frontend/src/app.tsx +++ b/v3/internal/templates/preact-ts/frontend/src/app.tsx @@ -1,5 +1,5 @@ import {useEffect, useState} from 'preact/hooks' -import {Greet} from "../bindings/main/GreetService"; +import {GreetService} from "../bindings/changeme"; import {Events} from "@wailsio/runtime"; export function App() { @@ -12,7 +12,7 @@ export function App() { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue: string) => { + GreetService.Greet(localName).then((resultValue: string) => { setResult(resultValue); }).catch((err: any) => { console.log(err); @@ -52,4 +52,4 @@ export function App() { ) -} \ No newline at end of file +} diff --git a/v3/internal/templates/preact/frontend/src/app.jsx b/v3/internal/templates/preact/frontend/src/app.jsx index 94264394d2e..b6960540723 100644 --- a/v3/internal/templates/preact/frontend/src/app.jsx +++ b/v3/internal/templates/preact/frontend/src/app.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'preact/hooks' -import {Greet} from "../bindings/main/GreetService.js"; +import {GreetService} from "../bindings/changeme"; import {Events} from "@wailsio/runtime"; export function App() { @@ -12,7 +12,7 @@ export function App() { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue) => { + GreetService.Greet(localName).then((resultValue) => { setResult(resultValue); }).catch((err) => { console.log(err); @@ -49,4 +49,4 @@ export function App() { ) -} \ No newline at end of file +} diff --git a/v3/internal/templates/qwik-ts/frontend/src/app.tsx b/v3/internal/templates/qwik-ts/frontend/src/app.tsx index 7b3b42ca311..e255ee0d55a 100644 --- a/v3/internal/templates/qwik-ts/frontend/src/app.tsx +++ b/v3/internal/templates/qwik-ts/frontend/src/app.tsx @@ -1,5 +1,5 @@ import { component$, useSignal, useVisibleTask$ } from '@builder.io/qwik' -import {Greet} from "../bindings/main/GreetService"; +import {GreetService} from "../bindings/changeme"; import {Events, WML} from "@wailsio/runtime"; export const App = component$(() => { @@ -12,7 +12,7 @@ export const App = component$(() => { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue: string) => { + GreetService.Greet(localName).then((resultValue: string) => { result.value = resultValue; }).catch((err: any) => { console.log(err); @@ -51,4 +51,4 @@ export const App = component$(() => { ) -}) \ No newline at end of file +}) diff --git a/v3/internal/templates/qwik/frontend/src/app.jsx b/v3/internal/templates/qwik/frontend/src/app.jsx index eb32ea79aa2..f135d386e06 100644 --- a/v3/internal/templates/qwik/frontend/src/app.jsx +++ b/v3/internal/templates/qwik/frontend/src/app.jsx @@ -1,5 +1,5 @@ import { component$, useSignal, useVisibleTask$ } from '@builder.io/qwik' -import {Greet} from "../bindings/main/GreetService.js"; +import {GreetService} from "../bindings/changeme"; import {Events, WML} from "@wailsio/runtime"; export const App = component$(() => { @@ -12,7 +12,7 @@ export const App = component$(() => { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue) => { + GreetService.Greet(localName).then((resultValue) => { result.value = resultValue; }).catch((err) => { console.log(err); @@ -51,4 +51,4 @@ export const App = component$(() => { ) -}) \ No newline at end of file +}) diff --git a/v3/internal/templates/react-swc-ts/frontend/src/App.tsx b/v3/internal/templates/react-swc-ts/frontend/src/App.tsx index 2a7bf4b9ea7..d7c370dc84c 100644 --- a/v3/internal/templates/react-swc-ts/frontend/src/App.tsx +++ b/v3/internal/templates/react-swc-ts/frontend/src/App.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import {Greet} from "../bindings/main/GreetService.js"; +import {GreetService} from "../bindings/changeme"; import {Events, WML} from "@wailsio/runtime"; function App() { @@ -12,7 +12,7 @@ function App() { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue: string) => { + GreetService.Greet(localName).then((resultValue: string) => { setResult(resultValue); }).catch((err: any) => { console.log(err); @@ -53,4 +53,4 @@ function App() { ) } -export default App \ No newline at end of file +export default App diff --git a/v3/internal/templates/react-swc/frontend/src/App.jsx b/v3/internal/templates/react-swc/frontend/src/App.jsx index 97689f666a2..9f669ec03d1 100644 --- a/v3/internal/templates/react-swc/frontend/src/App.jsx +++ b/v3/internal/templates/react-swc/frontend/src/App.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import {Greet} from "../bindings/main/GreetService.js"; +import {GreetService} from "../bindings/changeme"; import {Events, WML} from "@wailsio/runtime"; function App() { @@ -12,7 +12,7 @@ function App() { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue) => { + GreetService.Greet(localName).then((resultValue) => { setResult(resultValue); }).catch((err) => { console.log(err); @@ -53,4 +53,4 @@ function App() { ) } -export default App \ No newline at end of file +export default App diff --git a/v3/internal/templates/react-ts/frontend/src/App.tsx b/v3/internal/templates/react-ts/frontend/src/App.tsx index 37f01191117..e4f3130f87b 100644 --- a/v3/internal/templates/react-ts/frontend/src/App.tsx +++ b/v3/internal/templates/react-ts/frontend/src/App.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import {Greet} from "../bindings/main/GreetService.js"; +import {GreetService} from "../bindings/changeme"; import {Events, WML} from "@wailsio/runtime"; function App() { @@ -12,7 +12,7 @@ function App() { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue: string) => { + GreetService.Greet(localName).then((resultValue: string) => { setResult(resultValue); }).catch((err: any) => { console.log(err); @@ -53,4 +53,4 @@ function App() { ) } -export default App \ No newline at end of file +export default App diff --git a/v3/internal/templates/react/frontend/src/App.jsx b/v3/internal/templates/react/frontend/src/App.jsx index 97689f666a2..9f669ec03d1 100644 --- a/v3/internal/templates/react/frontend/src/App.jsx +++ b/v3/internal/templates/react/frontend/src/App.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import {Greet} from "../bindings/main/GreetService.js"; +import {GreetService} from "../bindings/changeme"; import {Events, WML} from "@wailsio/runtime"; function App() { @@ -12,7 +12,7 @@ function App() { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue) => { + GreetService.Greet(localName).then((resultValue) => { setResult(resultValue); }).catch((err) => { console.log(err); @@ -53,4 +53,4 @@ function App() { ) } -export default App \ No newline at end of file +export default App diff --git a/v3/internal/templates/solid-ts/frontend/src/App.tsx b/v3/internal/templates/solid-ts/frontend/src/App.tsx index 106f3425e8b..dd60e92ffeb 100644 --- a/v3/internal/templates/solid-ts/frontend/src/App.tsx +++ b/v3/internal/templates/solid-ts/frontend/src/App.tsx @@ -1,5 +1,5 @@ import { createSignal, onMount } from 'solid-js' -import {Greet} from "../bindings/main/GreetService.js"; +import {GreetService} from "../bindings/changeme"; import {Events} from "@wailsio/runtime"; function App() { @@ -12,7 +12,7 @@ function App() { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue: string) => { + GreetService.Greet(localName).then((resultValue: string) => { setResult(resultValue); }).catch((err: any) => { console.log(err); @@ -51,4 +51,4 @@ function App() { ) } -export default App \ No newline at end of file +export default App diff --git a/v3/internal/templates/solid/frontend/src/App.jsx b/v3/internal/templates/solid/frontend/src/App.jsx index 467a8cb6a1b..e38a1b10217 100644 --- a/v3/internal/templates/solid/frontend/src/App.jsx +++ b/v3/internal/templates/solid/frontend/src/App.jsx @@ -1,5 +1,5 @@ import { createSignal, onMount } from 'solid-js' -import {Greet} from "../bindings/main/GreetService.js"; +import {GreetService} from "../bindings/changeme"; import {Events} from "@wailsio/runtime"; function App() { @@ -12,7 +12,7 @@ function App() { if (!localName) { localName = 'anonymous'; } - Greet(localName).then((resultValue) => { + GreetService.Greet(localName).then((resultValue) => { setResult(resultValue); }).catch((err) => { console.log(err); @@ -51,4 +51,4 @@ function App() { ) } -export default App \ No newline at end of file +export default App diff --git a/v3/internal/templates/svelte-ts/frontend/src/App.svelte b/v3/internal/templates/svelte-ts/frontend/src/App.svelte index cee9b5779d3..497f3204f0b 100644 --- a/v3/internal/templates/svelte-ts/frontend/src/App.svelte +++ b/v3/internal/templates/svelte-ts/frontend/src/App.svelte @@ -1,5 +1,5 @@