mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 22:02:01 +08:00
[v3] Fix binding generator bugs (#4001)
* Add some clarifying comments * Remove special handling of window parameters * Improve internal method exclusion * Add test for internal method exclusion * Remove useless blank field from app options This is a leftover from an older version of the static analyser. It should have been removed long ago. * Remove redundant godebug setting gotypesalias=1 is the default starting with go1.23 * Use new range for syntax to simplify code * Remove generator dependency on github.com/samber/lo * Ensure generator testing tasks do not use the test cache * Rename cyclic types test * Test for cyclic imports * Fix import cycle between model files * Sort class aliases after their aliased class * Test class aliases * Fix length of default value for array types * Test array initialization * Add changelog * Update changelog * Fix contrived marking technique in model sorting algorithm * Update binding example * Update test data --------- Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
parent
e668c81806
commit
f01b4b9a21
@ -26,9 +26,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [Unreleased]
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- Renamed Service methods: `Name` -> `ServiceName`, `OnStartup` -> `ServiceStartup`, `OnShutdown` -> `ServiceShutdown` by [@leaanthony](https://github.com/leaanthony)
|
||||
|
||||
### Added
|
||||
|
||||
- Support aarch64 AppImage builds by [@AkshayKalose](https://github.com/AkshayKalose) in [#3981](https://github.com/wailsapp/wails/pull/3981)
|
||||
- Add diagnostics section to `wails doctor` by [@leaanthony](https://github.com/leaanthony)
|
||||
- Add window to context when calling a service method by [@leaanthony](https://github.com/leaanthony)
|
||||
@ -36,13 +38,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Better panic handling by [@leaanthony](https://github.com/leaanthony)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Windows+Linux Edit Menu issues by [@leaanthony](https://github.com/leaanthony) in [#3f78a3a](https://github.com/wailsapp/wails/commit/3f78a3a8ce7837e8b32242c8edbbed431c68c062)
|
||||
- Updated the minimum system version in macOS .plist files from 10.13.0 to 10.15.0 by [@AkshayKalose](https://github.com/AkshayKalose) in [#3981](https://github.com/wailsapp/wails/pull/3981)
|
||||
- Window ID skip issue by [@leaanthony](https://github.com/leaanthony)
|
||||
- Fix nil menu issue when calling RegisterContextMenu by [@leaanthony](https://github.com/leaanthony)
|
||||
- Fixed dependency cycles in binding generator output by [@fbbdev](https://github.com/fbbdev) in [#4001](https://github.com/wailsapp/wails/pull/4001)
|
||||
- Fixed use-before-define errors in binding generator output by [@fbbdev](https://github.com/fbbdev) in [#4001](https://github.com/wailsapp/wails/pull/4001)
|
||||
|
||||
### Changed
|
||||
|
||||
- Removed `application.WindowIDKey` and `application.WindowNameKey` (replaced by `application.WindowKey`) by [@leaanthony](https://github.com/leaanthony)
|
||||
- In JS/TS bindings, class fields of fixed-length array types are now initialized with their expected length instead of being empty by [@fbbdev](https://github.com/fbbdev) in [#4001](https://github.com/wailsapp/wails/pull/4001)
|
||||
|
||||
## v3.0.0-alpha.9 - 2025-01-13
|
||||
|
||||
|
@ -0,0 +1,55 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = $Create.Array($Create.Any);
|
@ -2,54 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = $Create.Array($Create.Any);
|
||||
export {
|
||||
Person
|
||||
} from "./internal.js";
|
||||
|
@ -11,26 +11,26 @@ tasks:
|
||||
|
||||
test:
|
||||
cmds:
|
||||
- go test -v .
|
||||
- go test -count=1 -v .
|
||||
- task: test:check
|
||||
|
||||
test:analyse:
|
||||
cmds:
|
||||
- go test -v -run ^TestAnalyser .
|
||||
- go test -count=1 -v -run ^TestAnalyser .
|
||||
|
||||
test:constants:
|
||||
cmds:
|
||||
- go test -v -run ^TestGenerateConstants .
|
||||
- go test -v -count=1 -run ^TestGenerateConstants .
|
||||
|
||||
test:generate:
|
||||
cmds:
|
||||
- go test -v -run ^TestGenerator .
|
||||
- go test -v -count=1 -run ^TestGenerator .
|
||||
- task: test:check
|
||||
|
||||
test:regenerate:
|
||||
cmds:
|
||||
- cmd: rm -rf ./testdata/output/*
|
||||
- cmd: go test -v -run ^TestGenerator .
|
||||
- cmd: go test -v -count=1 -run ^TestGenerator .
|
||||
ignore_error: true
|
||||
- task: test:generate
|
||||
|
||||
@ -40,6 +40,7 @@ tasks:
|
||||
- install-deps
|
||||
cmds:
|
||||
- npx tsc
|
||||
- npx madge --circular output/
|
||||
|
||||
install-deps:
|
||||
internal: true
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"go/token"
|
||||
"go/types"
|
||||
"iter"
|
||||
|
||||
"github.com/wailsapp/wails/v3/internal/generator/config"
|
||||
"golang.org/x/tools/go/packages"
|
||||
@ -19,7 +20,7 @@ import (
|
||||
// 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 {
|
||||
func FindServices(pkgs []*packages.Package, systemPaths *config.SystemPaths, logger config.Logger) (iter.Seq[*types.TypeName], error) {
|
||||
type instanceInfo struct {
|
||||
args *types.TypeList
|
||||
pos token.Position
|
||||
@ -122,7 +123,7 @@ func FindServices(pkgs []*packages.Package, systemPaths *config.SystemPaths, log
|
||||
signature := fn.Type().(*types.Signature)
|
||||
if signature.Params().Len() > 2 || signature.Results().Len() != 1 || tp.Len() != 1 || tp.At(0).Obj() == nil {
|
||||
logger.Warningf("Param Len: %d, Results Len: %d, tp.Len: %d, tp.At(0).Obj(): %v", signature.Params().Len(), signature.Results().Len(), tp.Len(), tp.At(0).Obj())
|
||||
return ErrBadApplicationPackage
|
||||
return nil, ErrBadApplicationPackage
|
||||
}
|
||||
|
||||
// Schedule unique type param for analysis.
|
||||
@ -136,71 +137,71 @@ func FindServices(pkgs []*packages.Package, systemPaths *config.SystemPaths, log
|
||||
// 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]
|
||||
return func(yield func(*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)
|
||||
}
|
||||
// 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))
|
||||
for _, instance := range instances[tgt.obj] {
|
||||
// Retrieve type argument.
|
||||
serviceType := types.Unalias(instance.args.At(tgt.param))
|
||||
|
||||
var named *types.Named
|
||||
var named *types.Named
|
||||
|
||||
switch t := serviceType.(type) {
|
||||
case *types.Named:
|
||||
// Process named type.
|
||||
named = t.Origin()
|
||||
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
|
||||
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
|
||||
// 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
|
||||
|
||||
// Push on next list.
|
||||
next = append(next, targetInfo{newtgt, cause})
|
||||
default:
|
||||
logger.Warningf("%s: ignoring anonymous service type %s%s", instance.pos, serviceType, indirectMsg)
|
||||
continue
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
// 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
|
||||
// Record and yield type object.
|
||||
if !found[named.Obj()] {
|
||||
found[named.Obj()] = true
|
||||
if !yield(named.Obj()) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}, nil
|
||||
}
|
||||
|
@ -97,14 +97,15 @@ func TestAnalyser(t *testing.T) {
|
||||
|
||||
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
|
||||
})
|
||||
services, err := FindServices(pkgs, systemPaths, config.DefaultPtermLogger(nil))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
for obj := range services {
|
||||
got = append(got, types.TypeString(obj.Type(), nil))
|
||||
}
|
||||
|
||||
slices.Sort(got)
|
||||
|
||||
if diff := cmp.Diff(test.want, got); diff != "" {
|
||||
|
@ -15,8 +15,6 @@ type (
|
||||
|
||||
// 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.
|
||||
@ -68,9 +66,6 @@ func (imports *ImportMap) Merge(other *ImportMap) {
|
||||
if other.ImportModels {
|
||||
imports.ImportModels = true
|
||||
}
|
||||
if other.ImportInternal {
|
||||
imports.ImportInternal = true
|
||||
}
|
||||
|
||||
for path, info := range other.External {
|
||||
if _, ok := imports.External[path]; ok {
|
||||
@ -151,12 +146,7 @@ func (imports *ImportMap) addTypeImpl(typ types.Type, visited map[*types.TypeNam
|
||||
}
|
||||
|
||||
if obj.Pkg().Path() == imports.Self {
|
||||
// Record self import.
|
||||
if obj.Exported() {
|
||||
imports.ImportModels = true
|
||||
} else {
|
||||
imports.ImportInternal = true
|
||||
}
|
||||
imports.ImportModels = true
|
||||
}
|
||||
|
||||
// Record model.
|
||||
|
@ -5,24 +5,30 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// PackageIndex lists all bindings, models and unexported models
|
||||
// generated from a package.
|
||||
// PackageIndex lists all services, models and unexported models
|
||||
// to be generated from a single package.
|
||||
//
|
||||
// When obtained through a call to [PackageInfo.Index],
|
||||
// each binding and model name appears at most once.
|
||||
// each service and model appears at most once;
|
||||
// services are sorted by name;
|
||||
// exported models precede all unexported ones
|
||||
// and both ranges are sorted by name.
|
||||
type PackageIndex struct {
|
||||
Package *PackageInfo
|
||||
|
||||
Services []*ServiceInfo
|
||||
Models []*ModelInfo
|
||||
Internal []*ModelInfo
|
||||
|
||||
Models []*ModelInfo
|
||||
HasExportedModels bool // If true, there is at least one exported model.
|
||||
}
|
||||
|
||||
// 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.
|
||||
// Services and models appear at most once in the returned slices;
|
||||
// services are sorted by name;
|
||||
// exported models precede all unexported ones
|
||||
// and both ranges are sorted by name.
|
||||
//
|
||||
// Index calls info.Collect, and therefore provides the same guarantees.
|
||||
// It is safe for concurrent use.
|
||||
@ -38,7 +44,7 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) {
|
||||
}
|
||||
|
||||
// Gather services.
|
||||
info.services.Range(func(key, value any) bool {
|
||||
for _, value := range info.services.Range {
|
||||
service := value.(*ServiceInfo)
|
||||
if !service.IsEmpty() {
|
||||
if service.Object().Exported() {
|
||||
@ -49,8 +55,7 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) {
|
||||
stats.NumServices++
|
||||
stats.NumMethods += len(service.Methods)
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
// Sort services by name.
|
||||
slices.SortFunc(index.Services, func(b1 *ServiceInfo, b2 *ServiceInfo) int {
|
||||
@ -61,19 +66,22 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) {
|
||||
})
|
||||
|
||||
// Gather models.
|
||||
info.models.Range(func(key, value any) bool {
|
||||
for _, value := range info.models.Range {
|
||||
model := value.(*ModelInfo)
|
||||
index.Models = append(index.Models, model)
|
||||
// Mark presence of exported models
|
||||
if model.Object().Exported() {
|
||||
index.HasExportedModels = true
|
||||
}
|
||||
// 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.
|
||||
// Sort models by exported property (exported first), then by name.
|
||||
slices.SortFunc(index.Models, func(m1 *ModelInfo, m2 *ModelInfo) int {
|
||||
if m1 == m2 {
|
||||
return 0
|
||||
@ -91,19 +99,6 @@ func (info *PackageInfo) Index(TS bool) (index *PackageIndex) {
|
||||
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)
|
||||
|
||||
|
@ -117,11 +117,11 @@ func IsClass(typ types.Type) bool {
|
||||
typ = types.Unalias(typ)
|
||||
|
||||
if _, isNamed := typ.(*types.Named); !isNamed {
|
||||
// Not a model type.
|
||||
// Unnamed types are never rendered as classes.
|
||||
return false
|
||||
}
|
||||
|
||||
// Struct types without custom marshaling are rendered as classes.
|
||||
// Struct named types without custom marshaling are rendered as classes.
|
||||
_, isStruct := typ.Underlying().(*types.Struct)
|
||||
return isStruct && !MaybeJSONMarshaler(typ) && !MaybeTextMarshaler(typ)
|
||||
}
|
||||
|
@ -54,23 +54,6 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func isInternalServiceMethod(method *types.Func) bool {
|
||||
internalServiceMethods := []string{
|
||||
"ServiceName",
|
||||
"ServiceStartup",
|
||||
"ServiceShutdown",
|
||||
"ServeHTTP",
|
||||
}
|
||||
methodName := method.Name()
|
||||
for _, name := range internalServiceMethods {
|
||||
if name == methodName {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func newServiceInfo(collector *Collector, obj *types.TypeName) *ServiceInfo {
|
||||
return &ServiceInfo{
|
||||
TypeInfo: collector.Type(obj),
|
||||
@ -136,8 +119,8 @@ func (info *ServiceInfo) Collect() *ServiceInfo {
|
||||
// Collect method information.
|
||||
info.Methods = make([]*ServiceMethodInfo, 0, len(mset))
|
||||
for _, sel := range mset {
|
||||
if !sel.Obj().Exported() {
|
||||
// Ignore unexported methods.
|
||||
if !sel.Obj().Exported() || internalServiceMethods[sel.Obj().Name()] {
|
||||
// Ignore unexported and internal methods.
|
||||
continue
|
||||
}
|
||||
|
||||
@ -179,6 +162,16 @@ func (info *ServiceInfo) Collect() *ServiceInfo {
|
||||
return info
|
||||
}
|
||||
|
||||
// internalServiceMethod is a set of methods
|
||||
// that are handled specially by the binding engine
|
||||
// and must not be exposed to the frontend.
|
||||
var internalServiceMethods = map[string]bool{
|
||||
"ServiceName": true,
|
||||
"ServiceStartup": true,
|
||||
"ServiceShutdown": true,
|
||||
"ServeHTTP": true,
|
||||
}
|
||||
|
||||
// typeError caches the type-checker type for the Go error interface.
|
||||
var typeError = types.Universe.Lookup("error").Type()
|
||||
|
||||
@ -188,10 +181,6 @@ 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 {
|
||||
if isInternalServiceMethod(method) {
|
||||
// Ignore internal methods.
|
||||
return nil
|
||||
}
|
||||
collector := info.collector
|
||||
obj := info.Object().(*types.TypeName)
|
||||
|
||||
@ -258,8 +247,6 @@ func (info *ServiceInfo) collectMethod(method *types.Func) *ServiceMethodInfo {
|
||||
}
|
||||
}
|
||||
|
||||
var needsContext bool
|
||||
|
||||
// Collect parameters.
|
||||
for i := range signature.Params().Len() {
|
||||
param := signature.Params().At(i)
|
||||
@ -268,16 +255,6 @@ func (info *ServiceInfo) collectMethod(method *types.Func) *ServiceMethodInfo {
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,10 @@ package generator
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"slices"
|
||||
"sync"
|
||||
|
||||
"github.com/samber/lo"
|
||||
"github.com/wailsapp/wails/v3/internal/generator/config"
|
||||
)
|
||||
|
||||
@ -118,7 +119,7 @@ func (report *ErrorReport) Errors() []string {
|
||||
report.mu.Lock()
|
||||
defer report.mu.Unlock()
|
||||
|
||||
return lo.Keys(report.errors)
|
||||
return slices.Collect(maps.Keys(report.errors))
|
||||
}
|
||||
|
||||
// Warnings returns the list of warning messages
|
||||
@ -128,7 +129,7 @@ func (report *ErrorReport) Warnings() []string {
|
||||
report.mu.Lock()
|
||||
defer report.mu.Unlock()
|
||||
|
||||
return lo.Keys(report.warnings)
|
||||
return slices.Collect(maps.Keys(report.warnings))
|
||||
}
|
||||
|
||||
// Errorf formats an error message and adds it to the report.
|
||||
|
@ -2,10 +2,7 @@ package generator
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go/types"
|
||||
"io"
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@ -80,16 +77,6 @@ func (generator *Generator) Generate(patterns ...string) (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 {
|
||||
@ -153,26 +140,28 @@ func (generator *Generator) Generate(patterns ...string) (stats *collect.Stats,
|
||||
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()
|
||||
// Run static analysis.
|
||||
services, err := FindServices(pkgs, systemPaths, generator.logger)
|
||||
|
||||
// Check for analyser errors.
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Discard unneeded data.
|
||||
pkgs = nil
|
||||
|
||||
// Schedule code generation for each found service.
|
||||
for obj := range services {
|
||||
serviceFound()
|
||||
generator.scheduler.Schedule(func() {
|
||||
generator.generateService(obj)
|
||||
})
|
||||
}
|
||||
|
||||
// Wait until all services have been generated and all models collected.
|
||||
generator.scheduler.Wait()
|
||||
|
||||
// Invariants:
|
||||
// - Service files have been generated for all discovered services;
|
||||
// - ModelInfo.Collect has been called on all discovered models, and therefore
|
||||
@ -186,22 +175,20 @@ func (generator *Generator) Generate(patterns ...string) (stats *collect.Stats,
|
||||
}
|
||||
|
||||
// Schedule models, index and included files generation for each package.
|
||||
generator.collector.Iterate(func(info *collect.PackageInfo) bool {
|
||||
for info := range generator.collector.Iterate {
|
||||
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 {
|
||||
for info := range generator.collector.Iterate {
|
||||
stats.Add(info.Stats())
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
// Return non-empty error report.
|
||||
if generator.logger.HasErrors() || generator.logger.HasWarnings() {
|
||||
@ -222,13 +209,13 @@ func (generator *Generator) generateModelsIndexIncludes(info *collect.PackageInf
|
||||
|
||||
if len(index.Models) > 0 {
|
||||
generator.scheduler.Schedule(func() {
|
||||
generator.generateModels(info, index.Models, false)
|
||||
generator.generateTypedefs(info, index.Models)
|
||||
})
|
||||
}
|
||||
|
||||
if len(index.Internal) > 0 {
|
||||
if index.HasExportedModels {
|
||||
generator.scheduler.Schedule(func() {
|
||||
generator.generateModels(info, index.Internal, true)
|
||||
generator.generateModels(index)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ func (generator *Generator) generateIncludes(index *collect.PackageIndex) {
|
||||
// Validate filename.
|
||||
switch name {
|
||||
case generator.renderer.ModelsFile():
|
||||
if len(index.Models) > 0 {
|
||||
if index.HasExportedModels {
|
||||
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,
|
||||
@ -27,7 +27,7 @@ func (generator *Generator) generateIncludes(index *collect.PackageIndex) {
|
||||
}
|
||||
|
||||
case generator.renderer.InternalFile():
|
||||
if len(index.Internal) > 0 {
|
||||
if len(index.Models) > 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,
|
||||
|
@ -6,55 +6,19 @@ import (
|
||||
"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))
|
||||
// generateModels generates a file for exported models from the given index information.
|
||||
func (generator *Generator) generateModels(index *collect.PackageIndex) {
|
||||
file, err := generator.creator.Create(filepath.Join(index.Package.Path, generator.renderer.ModelsFile()))
|
||||
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)
|
||||
generator.logger.Errorf("package %s: exported models generation failed", index.Package.Path)
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
err = generator.renderer.Models(file, imports, models)
|
||||
err = generator.renderer.Models(file, index)
|
||||
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)
|
||||
generator.logger.Errorf("package %s: exported models generation failed", index.Package.Path)
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ func (m *module) PostponedCreates() []string {
|
||||
|
||||
case *types.Named:
|
||||
if !collect.IsClass(key) {
|
||||
// Creation function for non-struct named types
|
||||
// Creation functions for non-struct named types
|
||||
// require an indirect assignment to break cycles.
|
||||
|
||||
// Typescript cannot infer the return type on its own: add hints.
|
||||
@ -254,10 +254,8 @@ func (m *module) PostponedCreates() []string {
|
||||
builder.WriteString(pre)
|
||||
|
||||
if t.Obj().Pkg().Path() == m.Imports.Self {
|
||||
if t.Obj().Exported() && m.Imports.ImportModels {
|
||||
if 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()]))
|
||||
|
@ -23,7 +23,15 @@ func (m *module) JSDefault(typ types.Type, quoted bool) (result string) {
|
||||
return result
|
||||
}
|
||||
|
||||
case *types.Array, *types.Slice:
|
||||
case *types.Array:
|
||||
if t.Len() == 0 {
|
||||
return "[]"
|
||||
} else {
|
||||
// Initialise array with expected number of elements
|
||||
return fmt.Sprintf("Array.from({ length: %d }, () => %s)", t.Len(), m.JSDefault(t.Elem(), false))
|
||||
}
|
||||
|
||||
case *types.Slice:
|
||||
if types.Identical(typ, typeByteSlice) {
|
||||
return `""`
|
||||
} else {
|
||||
@ -105,10 +113,8 @@ func (m *module) renderNamedDefault(typ aliasOrNamed, quoted bool) (result strin
|
||||
}
|
||||
|
||||
prefix := ""
|
||||
if typ.Obj().Exported() && m.Imports.ImportModels {
|
||||
if m.Imports.ImportModels {
|
||||
prefix = "$models."
|
||||
} else if !typ.Obj().Exported() && m.Imports.ImportInternal {
|
||||
prefix = "$internal."
|
||||
}
|
||||
|
||||
if collect.IsAny(typ) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package render
|
||||
|
||||
import (
|
||||
"go/types"
|
||||
"io"
|
||||
"slices"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
@ -17,8 +19,8 @@ type Renderer struct {
|
||||
|
||||
ext string
|
||||
|
||||
service *template.Template
|
||||
models *template.Template
|
||||
service *template.Template
|
||||
typedefs *template.Template
|
||||
}
|
||||
|
||||
// NewRenderer initialises a code renderer
|
||||
@ -35,8 +37,8 @@ func NewRenderer(options *flags.GenerateBindingsOptions, collector *collect.Coll
|
||||
|
||||
ext: ext,
|
||||
|
||||
service: tmplService[tmplLanguage(options.TS)],
|
||||
models: tmplModels[tmplLanguage(options.TS)],
|
||||
service: tmplService[tmplLanguage(options.TS)],
|
||||
typedefs: tmplTypedefs[tmplLanguage(options.TS)],
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,9 +81,46 @@ func (renderer *Renderer) Service(w io.Writer, info *collect.ServiceInfo) error
|
||||
})
|
||||
}
|
||||
|
||||
// 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 {
|
||||
// Typedefs renders type definitions for the given list of models.
|
||||
func (renderer *Renderer) Typedefs(w io.Writer, imports *collect.ImportMap, models []*collect.ModelInfo) error {
|
||||
if !renderer.options.UseInterfaces {
|
||||
// Sort class aliases after the class they alias.
|
||||
// Works in amortized linear time thanks to an auxiliary map.
|
||||
|
||||
// Track postponed class aliases and their dependencies.
|
||||
aliases := make(map[types.Object][]*collect.ModelInfo, len(models))
|
||||
|
||||
models = slices.Clone(models)
|
||||
for i, j := 0, 0; i < len(models); i++ {
|
||||
if models[i].Type != nil && collect.IsClass(models[i].Type) {
|
||||
// models[i] is a class alias:
|
||||
// models[i].Type is guaranteed to be
|
||||
// either an alias or a named type
|
||||
obj := models[i].Type.(interface{ Obj() *types.TypeName }).Obj()
|
||||
if obj.Pkg().Path() == imports.Self {
|
||||
// models[i] aliases a type from the current module.
|
||||
if a, ok := aliases[obj]; !ok || len(a) > 0 {
|
||||
// The aliased type has not been visited already, postpone.
|
||||
aliases[obj] = append(a, models[i])
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Append models[i].
|
||||
models[j] = models[i]
|
||||
j++
|
||||
|
||||
// Keep appending aliases whose aliased type has been just appended.
|
||||
for k := j - 1; k < j; k++ {
|
||||
a := aliases[models[k].Object()]
|
||||
aliases[models[k].Object()] = nil // Mark aliased model as visited
|
||||
j += copy(models[j:], a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return renderer.typedefs.Execute(w, &struct {
|
||||
module
|
||||
Models []*collect.ModelInfo
|
||||
}{
|
||||
@ -94,6 +133,19 @@ func (renderer *Renderer) Models(w io.Writer, imports *collect.ImportMap, models
|
||||
})
|
||||
}
|
||||
|
||||
// Models renders exported models for the given package index to w.
|
||||
func (renderer *Renderer) Models(w io.Writer, index *collect.PackageIndex) error {
|
||||
return tmplModels.Execute(w, &struct {
|
||||
*collect.PackageIndex
|
||||
*Renderer
|
||||
*flags.GenerateBindingsOptions
|
||||
}{
|
||||
index,
|
||||
renderer,
|
||||
renderer.options,
|
||||
})
|
||||
}
|
||||
|
||||
// Index renders the given package index to w.
|
||||
func (renderer *Renderer) Index(w io.Writer, index *collect.PackageIndex) error {
|
||||
return tmplIndex.Execute(w, &struct {
|
||||
|
@ -18,11 +18,13 @@ var tmplService = map[tmplLanguage]*template.Template{
|
||||
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 tmplTypedefs = map[tmplLanguage]*template.Template{
|
||||
tmplJS: template.Must(template.New("internal.js.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/internal.js.tmpl")),
|
||||
tmplTS: template.Must(template.New("internal.ts.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/internal.ts.tmpl")),
|
||||
}
|
||||
|
||||
var tmplModels = template.Must(template.New("models.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/models.tmpl"))
|
||||
|
||||
var tmplIndex = template.Must(template.New("index.tmpl").Funcs(tmplFunctions).ParseFS(templates, "templates/index.tmpl"))
|
||||
|
||||
var newline string
|
||||
|
@ -28,7 +28,7 @@ export {
|
||||
{{- end}}
|
||||
};
|
||||
{{end}}
|
||||
{{- if .Models}}
|
||||
{{- if .HasExportedModels}}
|
||||
export * from "./{{js $models}}";
|
||||
{{end}}
|
||||
{{- range .Package.Injections}}
|
||||
|
@ -1,7 +1,6 @@
|
||||
{{$module := .}}
|
||||
{{- $runtime := $module.Runtime}}
|
||||
{{- $models := (fixext $module.ModelsFile)}}
|
||||
{{- $internal := (fixext $module.InternalFile)}}
|
||||
{{- $useInterfaces := .UseInterfaces}}
|
||||
{{- $imports := $module.Imports -}}
|
||||
// @ts-check
|
||||
@ -11,23 +10,13 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "{{js $runtime}}";
|
||||
{{- end}}
|
||||
{{end -}}
|
||||
{{range $imports.External}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}";
|
||||
{{- end}}{{if $imports.External}}
|
||||
{{end}}
|
||||
{{- if or $useInterfaces $imports.ImportModels}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}}
|
||||
{{end}}{{end}}
|
||||
{{- if $imports.ImportInternal}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $internal from "./{{js $internal}}";
|
||||
{{end}}
|
||||
{{- range $model := .Models}}
|
||||
|
||||
{{- $isEnum := $model.Values}}
|
||||
@ -218,4 +207,9 @@ export class {{jsid $model.Name}} {
|
||||
{{if and (ge (len $create) 54) (eq (slice $create 39 54) "function $$init")}}var {{else}}const {{end -}}
|
||||
$$createType{{$i}} = {{$create}};
|
||||
{{- end}}
|
||||
{{end}}
|
||||
{{- if $useInterfaces}}
|
||||
// In interface mode, this file is likely to contain just comments.
|
||||
// We add a dummy export statement to ensure it is recognised as an ES module.
|
||||
export {};
|
||||
{{end -}}
|
@ -1,7 +1,6 @@
|
||||
{{$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
|
||||
@ -10,23 +9,13 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "{{js $runtime}}";
|
||||
{{- end}}
|
||||
{{end -}}
|
||||
{{range $imports.External}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}";
|
||||
{{- end}}{{if $imports.External}}
|
||||
{{end}}
|
||||
{{- if $imports.ImportModels}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}}
|
||||
{{end}}{{end}}
|
||||
{{- if $imports.ImportInternal}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $internal from "./{{js $internal}}";
|
||||
{{end}}
|
||||
{{- range $model := .Models}}
|
||||
|
||||
{{- $isEnum := $model.Values}}
|
94
v3/internal/generator/render/templates/models.tmpl
Normal file
94
v3/internal/generator/render/templates/models.tmpl
Normal file
@ -0,0 +1,94 @@
|
||||
{{$renderer := .}}
|
||||
{{- $useInterfaces := .UseInterfaces}}
|
||||
{{- $internal := (fixext .InternalFile)}}
|
||||
{{- if not .TS -}}
|
||||
// @ts-check
|
||||
{{end -}}
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
{{- $hasObjects := false}}
|
||||
{{- $hasTypes := false}}
|
||||
|
||||
{{- range $model := .Models}}
|
||||
{{- if not $model.Object.Exported}}{{break}}{{end}}
|
||||
|
||||
{{- $isEnum := $model.Values}}
|
||||
{{- $isClassAlias := and $model.Type (not $useInterfaces) (isclass $model.Type)}}
|
||||
{{- $isClass := and (not $model.Type) (not $model.Values) (not $useInterfaces) (not $model.Alias)}}
|
||||
|
||||
{{- if or $isEnum $isClassAlias $isClass}}
|
||||
{{- if not $hasObjects}}
|
||||
{{- $hasObjects = true}}
|
||||
|
||||
export {
|
||||
{{- else}},{{end}}
|
||||
{{jsid $model.Name}}
|
||||
{{- else}}
|
||||
{{- $hasTypes = true}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{- if $hasObjects}}
|
||||
} from "./{{js $internal}}";
|
||||
{{- end}}
|
||||
|
||||
{{- if $hasTypes}}
|
||||
{{- $hasTypes = false}}
|
||||
|
||||
{{if .TS -}}
|
||||
export type {
|
||||
{{- else -}}
|
||||
import * as $models from "./{{js $internal}}";
|
||||
{{- end}}
|
||||
{{- range $model := .Models}}
|
||||
{{- if not $model.Object.Exported}}{{break}}{{end}}
|
||||
|
||||
{{- $isEnum := $model.Values}}
|
||||
{{- $isClassAlias := and $model.Type (not $useInterfaces) (isclass $model.Type)}}
|
||||
{{- $isClass := and (not $model.Type) (not $model.Values) (not $useInterfaces) (not $model.Alias)}}
|
||||
{{- if or $isEnum $isClassAlias $isClass}}{{continue}}{{end}}
|
||||
|
||||
{{- /* Build type parameter list */}}
|
||||
{{- $typeParams := ""}}
|
||||
{{- $typeParamList := ""}}
|
||||
{{- range $i, $param := $model.TypeParams}}
|
||||
{{- $param = (typeparam $i $param)}}
|
||||
{{- if eq $i 0}}
|
||||
{{- $typeParams = $param}}
|
||||
{{- $typeParamList = (printf "<%s" $param)}}
|
||||
{{- else}}
|
||||
{{- $typeParams = (printf "%s,%s" $typeParams $param)}}
|
||||
{{- $typeParamList = (printf "%s, %s" $typeParamList $param)}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{- if $typeParamList}}
|
||||
{{- $typeParamList = (printf "%s>" $typeParamList)}}
|
||||
{{- end}}
|
||||
{{- if $renderer.TS}}
|
||||
{{- if $hasTypes}},{{end}}
|
||||
{{jsid $model.Name}}
|
||||
{{- else}}
|
||||
|
||||
/**
|
||||
{{- 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 {$models.{{jsid $model.Name}}{{$typeParamList -}} } {{jsid $model.Name}}
|
||||
*/
|
||||
{{- end}}
|
||||
|
||||
{{- $hasTypes = true}}
|
||||
{{- end}}
|
||||
|
||||
{{- if .TS}}
|
||||
} from "./{{js $internal}}";
|
||||
{{- end}}
|
||||
|
||||
{{- end}}
|
@ -33,12 +33,7 @@ import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}";
|
||||
{{- if $imports.ImportModels}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}}
|
||||
{{end}}{{end}}
|
||||
{{- if $imports.ImportInternal}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $internal from "./{{js $internal}}";
|
||||
import * as $models from "./{{js $internal}}";
|
||||
{{end}}
|
||||
{{- range .Injections}}
|
||||
{{.}}
|
||||
|
@ -32,12 +32,7 @@ import * as {{jsimport .}} from "{{js .RelPath}}/{{js $models}}";
|
||||
{{- if $imports.ImportModels}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./{{js $models}}";{{if not $imports.ImportInternal}}
|
||||
{{end}}{{end}}
|
||||
{{- if $imports.ImportInternal}}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $internal from "./{{js $internal}}";
|
||||
import * as $models from "./{{js $internal}}";
|
||||
{{end}}
|
||||
{{- range .Injections}}
|
||||
{{.}}
|
||||
|
@ -54,7 +54,7 @@ func (m *module) renderType(typ types.Type, quoted bool) (result string, nullabl
|
||||
}
|
||||
|
||||
if types.Identical(typ, typeByteSlice) {
|
||||
// encoding/json marshals byte arrays/slices as base64 strings
|
||||
// encoding/json marshals byte slices as base64 strings
|
||||
return "string" + null, null != ""
|
||||
}
|
||||
|
||||
@ -211,10 +211,8 @@ func (m *module) renderNamedType(typ aliasOrNamed, quoted bool) (result string,
|
||||
var builder strings.Builder
|
||||
|
||||
if typ.Obj().Pkg().Path() == m.Imports.Self {
|
||||
if typ.Obj().Exported() && m.Imports.ImportModels {
|
||||
if 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()]))
|
||||
|
@ -10,9 +10,12 @@ import (
|
||||
// GreetService is great
|
||||
type GreetService int
|
||||
|
||||
// A nice type Alias
|
||||
// A nice type Alias.
|
||||
type Alias = int
|
||||
|
||||
// A class alias.
|
||||
type AliasedPerson = Person
|
||||
|
||||
// An empty struct alias.
|
||||
type EmptyAliasStruct = struct{}
|
||||
|
||||
@ -40,22 +43,30 @@ type Person struct {
|
||||
AliasedField Alias // A random alias field.
|
||||
}
|
||||
|
||||
// A generic struct containing an alias
|
||||
// A generic struct containing an alias.
|
||||
type GenericPerson[T any] struct {
|
||||
Name T
|
||||
AliasedField Alias
|
||||
}
|
||||
|
||||
// Get someone
|
||||
// Another class alias, but ordered after its aliased class.
|
||||
type StrangelyAliasedPerson = Person
|
||||
|
||||
// Get someone.
|
||||
func (GreetService) Get(aliasValue Alias) Person {
|
||||
return Person{"hello", aliasValue}
|
||||
}
|
||||
|
||||
// Get someone quite different
|
||||
// Get someone quite different.
|
||||
func (GreetService) GetButDifferent() GenericPerson[bool] {
|
||||
return GenericPerson[bool]{true, 13}
|
||||
}
|
||||
|
||||
// Apparently, aliases are all the rage right now.
|
||||
func (GreetService) GetButAliased(p AliasedPerson) StrangelyAliasedPerson {
|
||||
return p
|
||||
}
|
||||
|
||||
// Greet a lot of unusual things.
|
||||
func (GreetService) Greet(EmptyAliasStruct, EmptyStruct) AliasStruct {
|
||||
return AliasStruct{}
|
||||
|
55
v3/internal/generator/testcases/cyclic_imports/main.go
Normal file
55
v3/internal/generator/testcases/cyclic_imports/main.go
Normal file
@ -0,0 +1,55 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
// GreetService is great
|
||||
type GreetService int
|
||||
|
||||
type StructA struct {
|
||||
B *structB
|
||||
}
|
||||
|
||||
type structB struct {
|
||||
A *StructA
|
||||
}
|
||||
|
||||
type StructC struct {
|
||||
D structD
|
||||
}
|
||||
|
||||
type structD struct {
|
||||
E StructE
|
||||
}
|
||||
|
||||
type StructE struct{}
|
||||
|
||||
// Make a cycle.
|
||||
func (GreetService) MakeCycles() (_ StructA, _ StructC) {
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
[
|
||||
".GreetService"
|
||||
]
|
@ -0,0 +1,3 @@
|
||||
[
|
||||
".GreetService"
|
||||
]
|
@ -0,0 +1,61 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
// GreetService is great
|
||||
type GreetService struct {
|
||||
SomeVariable int
|
||||
lowerCase string
|
||||
}
|
||||
|
||||
// Greet someone
|
||||
func (*GreetService) Greet(name string) string {
|
||||
return "Hello " + name
|
||||
}
|
||||
|
||||
// Debugging name
|
||||
func (*GreetService) ServiceName() string {
|
||||
return "GreetService"
|
||||
}
|
||||
|
||||
// Lifecycle
|
||||
func (*GreetService) ServiceStartup(context.Context, application.ServiceOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Lifecycle
|
||||
func (*GreetService) ServiceShutdown() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Serve some routes
|
||||
func (*GreetService) ServeHTTP(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
|
||||
func NewGreetService() application.Service {
|
||||
return application.NewService(&GreetService{})
|
||||
}
|
||||
|
||||
func main() {
|
||||
app := application.New(application.Options{
|
||||
Services: []application.Service{
|
||||
NewGreetService(),
|
||||
},
|
||||
})
|
||||
|
||||
app.NewWebviewWindow()
|
||||
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,8 @@ import "github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_he
|
||||
// Person is not a number.
|
||||
type Person struct {
|
||||
// They have a name.
|
||||
Name string
|
||||
Name string
|
||||
Friends [4]Impersonator // Exactly 4 sketchy friends.
|
||||
}
|
||||
|
||||
// Impersonator gets their fields from other people.
|
||||
|
@ -8,6 +8,6 @@ type SomeMethods struct {
|
||||
}
|
||||
|
||||
// LikeThisOne is an example method that does nothing.
|
||||
func (SomeMethods) LikeThisOne() (_ Person, _ Impersonator, _ HowDifferent[bool], _ PrivatePerson) {
|
||||
func (SomeMethods) LikeThisOne() (_ Person, _ HowDifferent[bool], _ PrivatePerson) {
|
||||
return
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Get someone
|
||||
* Get someone.
|
||||
* @param {$models.Alias} aliasValue
|
||||
* @returns {Promise<$models.Person> & { cancel(): void }}
|
||||
*/
|
||||
@ -30,7 +30,21 @@ export function Get(aliasValue) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get someone quite different
|
||||
* Apparently, aliases are all the rage right now.
|
||||
* @param {$models.AliasedPerson} p
|
||||
* @returns {Promise<$models.StrangelyAliasedPerson> & { cancel(): void }}
|
||||
*/
|
||||
export function GetButAliased(p) {
|
||||
let $resultPromise = /** @type {any} */($Call.ByID(1896499664, p));
|
||||
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<boolean>> & { cancel(): void }}
|
||||
*/
|
||||
export function GetButDifferent() {
|
||||
|
@ -0,0 +1,166 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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<EmptyStruct>} [$$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<EmptyStruct>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic struct containing an alias.
|
||||
* @template T
|
||||
*/
|
||||
export class GenericPerson {
|
||||
/**
|
||||
* Creates a new GenericPerson instance.
|
||||
* @param {Partial<GenericPerson<T>>} [$$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 {(source: any) => T} $$createParamT
|
||||
* @returns {($$source?: any) => GenericPerson<T>}
|
||||
*/
|
||||
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<GenericPerson<T>>} */($$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<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class alias.
|
||||
*/
|
||||
export const AliasedPerson = Person;
|
||||
|
||||
/**
|
||||
* A class alias.
|
||||
* @typedef {Person} AliasedPerson
|
||||
*/
|
||||
|
||||
/**
|
||||
* Another class alias, but ordered after its aliased class.
|
||||
*/
|
||||
export const StrangelyAliasedPerson = Person;
|
||||
|
||||
/**
|
||||
* Another class alias, but ordered after its aliased class.
|
||||
* @typedef {Person} StrangelyAliasedPerson
|
||||
*/
|
@ -2,145 +2,33 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
export {
|
||||
AliasedPerson,
|
||||
EmptyStruct,
|
||||
GenericPerson,
|
||||
Person,
|
||||
StrangelyAliasedPerson
|
||||
} from "./internal.js";
|
||||
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* A nice type Alias
|
||||
* @typedef {number} Alias
|
||||
* A nice type Alias.
|
||||
* @typedef {$models.Alias} 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.
|
||||
* @typedef {$models.AliasStruct} AliasStruct
|
||||
*/
|
||||
|
||||
/**
|
||||
* An empty struct alias.
|
||||
* @typedef { {
|
||||
* } } EmptyAliasStruct
|
||||
* @typedef {$models.EmptyAliasStruct} EmptyAliasStruct
|
||||
*/
|
||||
|
||||
/**
|
||||
* An empty struct.
|
||||
*/
|
||||
export class EmptyStruct {
|
||||
/**
|
||||
* Creates a new EmptyStruct instance.
|
||||
* @param {Partial<EmptyStruct>} [$$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<EmptyStruct>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic struct containing an alias
|
||||
* @template T
|
||||
*/
|
||||
export class GenericPerson {
|
||||
/**
|
||||
* Creates a new GenericPerson instance.
|
||||
* @param {Partial<GenericPerson<T>>} [$$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 {(source: any) => T} $$createParamT
|
||||
* @returns {($$source?: any) => GenericPerson<T>}
|
||||
*/
|
||||
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<GenericPerson<T>>} */($$parsedSource));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Another struct alias.
|
||||
* @typedef {Object} OtherAliasStruct
|
||||
* @property {number[]} NoMoreIdeas
|
||||
* @typedef {$models.OtherAliasStruct} OtherAliasStruct
|
||||
*/
|
||||
|
||||
/**
|
||||
* A non-generic struct containing an alias.
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
|
@ -6,6 +6,224 @@
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Embedded1 {
|
||||
/**
|
||||
* Creates a new Embedded1 instance.
|
||||
* @param {Partial<Embedded1>} [$$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<Embedded1>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {string} Embedded3
|
||||
*/
|
||||
|
||||
/**
|
||||
* Person represents a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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 {embedded4 | undefined}
|
||||
*/
|
||||
this["emb4"] = (new 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<Person>} */($$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",
|
||||
};
|
||||
|
||||
export class embedded4 {
|
||||
/**
|
||||
* Creates a new embedded4 instance.
|
||||
@ -44,3 +262,11 @@ export class embedded4 {
|
||||
return new embedded4(/** @type {Partial<embedded4>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// 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 = embedded4.createFrom;
|
||||
|
@ -2,236 +2,14 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
export {
|
||||
Embedded1,
|
||||
Person,
|
||||
Title
|
||||
} from "./internal.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $internal from "./internal.js";
|
||||
|
||||
export class Embedded1 {
|
||||
/**
|
||||
* Creates a new Embedded1 instance.
|
||||
* @param {Partial<Embedded1>} [$$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<Embedded1>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* @typedef {string} Embedded3
|
||||
* @typedef {$models.Embedded3} Embedded3
|
||||
*/
|
||||
|
||||
/**
|
||||
* Person represents a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$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;
|
||||
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
|
@ -0,0 +1,38 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
/**
|
||||
* Person represents a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
@ -2,37 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
/**
|
||||
* Person represents a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
export {
|
||||
Person
|
||||
} from "./internal.js";
|
||||
|
@ -0,0 +1,35 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* GreetService is great
|
||||
* @module
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Make a cycle.
|
||||
* @returns {Promise<[$models.StructA, $models.StructC]> & { 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] = $$createType1($result[1]);
|
||||
return $result;
|
||||
}));
|
||||
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
||||
return $typingPromise;
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = $models.StructA.createFrom;
|
||||
const $$createType1 = $models.StructC.createFrom;
|
@ -0,0 +1,164 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class StructA {
|
||||
/**
|
||||
* Creates a new StructA instance.
|
||||
* @param {Partial<StructA>} [$$source = {}] - The source object to create the StructA.
|
||||
*/
|
||||
constructor($$source = {}) {
|
||||
if (!("B" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {structB | null}
|
||||
*/
|
||||
this["B"] = null;
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new StructA instance from a string or object.
|
||||
* @param {any} [$$source = {}]
|
||||
* @returns {StructA}
|
||||
*/
|
||||
static createFrom($$source = {}) {
|
||||
const $$createField0_0 = $$createType1;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("B" in $$parsedSource) {
|
||||
$$parsedSource["B"] = $$createField0_0($$parsedSource["B"]);
|
||||
}
|
||||
return new StructA(/** @type {Partial<StructA>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
export class StructC {
|
||||
/**
|
||||
* Creates a new StructC instance.
|
||||
* @param {Partial<StructC>} [$$source = {}] - The source object to create the StructC.
|
||||
*/
|
||||
constructor($$source = {}) {
|
||||
if (!("D" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {structD}
|
||||
*/
|
||||
this["D"] = (new structD());
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new StructC instance from a string or object.
|
||||
* @param {any} [$$source = {}]
|
||||
* @returns {StructC}
|
||||
*/
|
||||
static createFrom($$source = {}) {
|
||||
const $$createField0_0 = $$createType2;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("D" in $$parsedSource) {
|
||||
$$parsedSource["D"] = $$createField0_0($$parsedSource["D"]);
|
||||
}
|
||||
return new StructC(/** @type {Partial<StructC>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
export class StructE {
|
||||
/**
|
||||
* Creates a new StructE instance.
|
||||
* @param {Partial<StructE>} [$$source = {}] - The source object to create the StructE.
|
||||
*/
|
||||
constructor($$source = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new StructE instance from a string or object.
|
||||
* @param {any} [$$source = {}]
|
||||
* @returns {StructE}
|
||||
*/
|
||||
static createFrom($$source = {}) {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new StructE(/** @type {Partial<StructE>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
export class structB {
|
||||
/**
|
||||
* Creates a new structB instance.
|
||||
* @param {Partial<structB>} [$$source = {}] - The source object to create the structB.
|
||||
*/
|
||||
constructor($$source = {}) {
|
||||
if (!("A" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {StructA | null}
|
||||
*/
|
||||
this["A"] = null;
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new structB instance from a string or object.
|
||||
* @param {any} [$$source = {}]
|
||||
* @returns {structB}
|
||||
*/
|
||||
static createFrom($$source = {}) {
|
||||
const $$createField0_0 = $$createType4;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("A" in $$parsedSource) {
|
||||
$$parsedSource["A"] = $$createField0_0($$parsedSource["A"]);
|
||||
}
|
||||
return new structB(/** @type {Partial<structB>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
export class structD {
|
||||
/**
|
||||
* Creates a new structD instance.
|
||||
* @param {Partial<structD>} [$$source = {}] - The source object to create the structD.
|
||||
*/
|
||||
constructor($$source = {}) {
|
||||
if (!("E" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {StructE}
|
||||
*/
|
||||
this["E"] = (new StructE());
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new structD instance from a string or object.
|
||||
* @param {any} [$$source = {}]
|
||||
* @returns {structD}
|
||||
*/
|
||||
static createFrom($$source = {}) {
|
||||
const $$createField0_0 = $$createType5;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("E" in $$parsedSource) {
|
||||
$$parsedSource["E"] = $$createField0_0($$parsedSource["E"]);
|
||||
}
|
||||
return new structD(/** @type {Partial<structD>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = structB.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
const $$createType2 = structD.createFrom;
|
||||
const $$createType3 = StructA.createFrom;
|
||||
const $$createType4 = $Create.Nullable($$createType3);
|
||||
const $$createType5 = StructE.createFrom;
|
@ -0,0 +1,9 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export {
|
||||
StructA,
|
||||
StructC,
|
||||
StructE
|
||||
} from "./internal.js";
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Make a cycle.
|
@ -0,0 +1,18 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* @typedef {$models.Alias} Alias
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {$models.Cyclic} Cyclic
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {$models.GenericCyclic<T>} GenericCyclic
|
||||
*/
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
|
@ -0,0 +1,66 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
/**
|
||||
* Person represents a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$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",
|
||||
};
|
@ -2,65 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
/**
|
||||
* Person represents a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$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",
|
||||
};
|
||||
export {
|
||||
Person,
|
||||
Title
|
||||
} from "./internal.js";
|
||||
|
@ -0,0 +1,27 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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",
|
||||
};
|
@ -2,26 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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",
|
||||
};
|
||||
export {
|
||||
Title
|
||||
} from "./internal.js";
|
||||
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
|
@ -0,0 +1,57 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as services$0 from "./services/models.js";
|
||||
|
||||
/**
|
||||
* Person is a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = services$0.Address.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
@ -2,56 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as services$0 from "./services/models.js";
|
||||
|
||||
/**
|
||||
* Person is a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = services$0.Address.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
export {
|
||||
Person
|
||||
} from "./internal.js";
|
||||
|
@ -0,0 +1,49 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Address {
|
||||
/**
|
||||
* Creates a new Address instance.
|
||||
* @param {Partial<Address>} [$$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<Address>} */($$parsedSource));
|
||||
}
|
||||
}
|
@ -2,48 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Address {
|
||||
/**
|
||||
* Creates a new Address instance.
|
||||
* @param {Partial<Address>} [$$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<Address>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
export {
|
||||
Address
|
||||
} from "./internal.js";
|
||||
|
@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Yay does this and that
|
||||
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
|
@ -0,0 +1,54 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as other$0 from "./services/other/models.js";
|
||||
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = other$0.Address.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
@ -2,53 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as other$0 from "./services/other/models.js";
|
||||
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = other$0.Address.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
export {
|
||||
Person
|
||||
} from "./internal.js";
|
||||
|
@ -0,0 +1,49 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Address {
|
||||
/**
|
||||
* Creates a new Address instance.
|
||||
* @param {Partial<Address>} [$$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<Address>} */($$parsedSource));
|
||||
}
|
||||
}
|
@ -2,48 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Address {
|
||||
/**
|
||||
* Creates a new Address instance.
|
||||
* @param {Partial<Address>} [$$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<Address>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
export {
|
||||
Address
|
||||
} from "./internal.js";
|
||||
|
@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Yay does this and that
|
||||
|
@ -0,0 +1,22 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* GreetService is great
|
||||
* @module
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
/**
|
||||
* Greet someone
|
||||
* @param {string} name
|
||||
* @returns {Promise<string> & { cancel(): void }}
|
||||
*/
|
||||
export function Greet(name) {
|
||||
let $resultPromise = /** @type {any} */($Call.ByID(1411160069, name));
|
||||
return $resultPromise;
|
||||
}
|
@ -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
|
||||
};
|
@ -6,6 +6,115 @@
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as other$0 from "./other/models.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<HowDifferent<How>>} [$$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 {(source: any) => How} $$createParamHow
|
||||
* @returns {($$source?: any) => HowDifferent<How>}
|
||||
*/
|
||||
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<HowDifferent<How>>} */($$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<number>} Impersonator
|
||||
*/
|
||||
|
||||
/**
|
||||
* Person is not a number.
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$source = {}] - The source object to create the Person.
|
||||
*/
|
||||
constructor($$source = {}) {
|
||||
if (!("Name" in $$source)) {
|
||||
/**
|
||||
* They have a name.
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["Name"] = "";
|
||||
}
|
||||
if (!("Friends" in $$source)) {
|
||||
/**
|
||||
* Exactly 4 sketchy friends.
|
||||
* @member
|
||||
* @type {Impersonator[]}
|
||||
*/
|
||||
this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator()));
|
||||
}
|
||||
|
||||
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 = $$createType3;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("Friends" in $$parsedSource) {
|
||||
$$parsedSource["Friends"] = $$createField1_0($$parsedSource["Friends"]);
|
||||
}
|
||||
return new Person(/** @type {Partial<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
export class personImpl {
|
||||
/**
|
||||
* Creates a new personImpl instance.
|
||||
@ -28,6 +137,14 @@ export class personImpl {
|
||||
*/
|
||||
this["Name"] = "";
|
||||
}
|
||||
if (!("Friends" in $$source)) {
|
||||
/**
|
||||
* Exactly 4 sketchy friends.
|
||||
* @member
|
||||
* @type {Impersonator[]}
|
||||
*/
|
||||
this["Friends"] = Array.from({ length: 4 }, () => (new Impersonator()));
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
@ -38,7 +155,27 @@ export class personImpl {
|
||||
* @returns {personImpl}
|
||||
*/
|
||||
static createFrom($$source = {}) {
|
||||
const $$createField2_0 = $$createType3;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("Friends" in $$parsedSource) {
|
||||
$$parsedSource["Friends"] = $$createField2_0($$parsedSource["Friends"]);
|
||||
}
|
||||
return new personImpl(/** @type {Partial<personImpl>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PrivatePerson gets their fields from hidden sources.
|
||||
*/
|
||||
export const PrivatePerson = personImpl;
|
||||
|
||||
/**
|
||||
* PrivatePerson gets their fields from hidden sources.
|
||||
* @typedef {personImpl} PrivatePerson
|
||||
*/
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = ($$createParamHow) => $Create.Map($Create.Any, $$createParamHow);
|
||||
const $$createType1 = ($$createParamHow) => $Create.Array($$createType0($$createParamHow));
|
||||
const $$createType2 = Impersonator.createFrom;
|
||||
const $$createType3 = $Create.Array($$createType2);
|
||||
|
@ -2,121 +2,9 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as other$0 from "./other/models.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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<HowDifferent<How>>} [$$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 {(source: any) => How} $$createParamHow
|
||||
* @returns {($$source?: any) => HowDifferent<How>}
|
||||
*/
|
||||
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<HowDifferent<How>>} */($$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<number>} Impersonator
|
||||
*/
|
||||
|
||||
/**
|
||||
* Person is not a number.
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$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));
|
||||
export {
|
||||
HowDifferent,
|
||||
Impersonator,
|
||||
Person,
|
||||
PrivatePerson
|
||||
} from "./internal.js";
|
||||
|
@ -0,0 +1,60 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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<OtherPerson<T>>} [$$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 {(source: any) => T} $$createParamT
|
||||
* @returns {($$source?: any) => OtherPerson<T>}
|
||||
*/
|
||||
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<OtherPerson<T>>} */($$parsedSource));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = ($$createParamT) => $Create.Array($$createParamT);
|
@ -2,59 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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<OtherPerson<T>>} [$$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 {(source: any) => T} $$createParamT
|
||||
* @returns {($$source?: any) => OtherPerson<T>}
|
||||
*/
|
||||
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<OtherPerson<T>>} */($$parsedSource));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = ($$createParamT) => $Create.Array($$createParamT);
|
||||
export {
|
||||
OtherPerson
|
||||
} from "./internal.js";
|
||||
|
@ -13,11 +13,11 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* LikeThisOne is an example method that does nothing.
|
||||
* @returns {Promise<[$models.Person, $models.Impersonator, $models.HowDifferent<boolean>, $models.PrivatePerson]> & { cancel(): void }}
|
||||
* @returns {Promise<[$models.Person, $models.HowDifferent<boolean>, $models.PrivatePerson]> & { cancel(): void }}
|
||||
*/
|
||||
export function LikeThisOne() {
|
||||
let $resultPromise = /** @type {any} */($Call.ByID(2124352079));
|
||||
@ -25,7 +25,6 @@ export function LikeThisOne() {
|
||||
$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);
|
||||
@ -43,6 +42,5 @@ export function LikeThisOtherOne() {
|
||||
|
||||
// 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;
|
||||
const $$createType1 = $models.HowDifferent.createFrom($Create.Any);
|
||||
const $$createType2 = $models.PrivatePerson.createFrom;
|
||||
|
@ -17,7 +17,7 @@ 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<boolean>, nobindingshere$0.PrivatePerson]> & { cancel(): void }}
|
||||
* @returns {Promise<[nobindingshere$0.Person, nobindingshere$0.HowDifferent<boolean>, nobindingshere$0.PrivatePerson]> & { cancel(): void }}
|
||||
*/
|
||||
export function LikeThisOne() {
|
||||
let $resultPromise = /** @type {any} */($Call.ByID(2590614085));
|
||||
@ -25,7 +25,6 @@ export function LikeThisOne() {
|
||||
$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);
|
||||
@ -43,6 +42,5 @@ export function LikeThisOtherOne() {
|
||||
|
||||
// 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;
|
||||
const $$createType1 = nobindingshere$0.HowDifferent.createFrom($Create.Any);
|
||||
const $$createType2 = nobindingshere$0.PrivatePerson.createFrom;
|
||||
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
|
@ -0,0 +1,54 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as services$0 from "./services/models.js";
|
||||
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = services$0.Address.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
@ -2,53 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as services$0 from "./services/models.js";
|
||||
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = services$0.Address.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
export {
|
||||
Person
|
||||
} from "./internal.js";
|
||||
|
@ -0,0 +1,49 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Address {
|
||||
/**
|
||||
* Creates a new Address instance.
|
||||
* @param {Partial<Address>} [$$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<Address>} */($$parsedSource));
|
||||
}
|
||||
}
|
@ -2,48 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Address {
|
||||
/**
|
||||
* Creates a new Address instance.
|
||||
* @param {Partial<Address>} [$$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<Address>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
export {
|
||||
Address
|
||||
} from "./internal.js";
|
||||
|
@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Yay does this and that
|
||||
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* @param {number[]} $in
|
||||
|
@ -0,0 +1,57 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = Person.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
@ -2,56 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = Person.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
export {
|
||||
Person
|
||||
} from "./internal.js";
|
||||
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* @param {number[]} $in
|
||||
|
@ -0,0 +1,57 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = Person.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
@ -2,56 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = Person.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
export {
|
||||
Person
|
||||
} from "./internal.js";
|
||||
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
|
@ -0,0 +1,58 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = services$0.Address.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
@ -2,57 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = services$0.Address.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
export {
|
||||
Person
|
||||
} from "./internal.js";
|
||||
|
@ -0,0 +1,49 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Address {
|
||||
/**
|
||||
* Creates a new Address instance.
|
||||
* @param {Partial<Address>} [$$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<Address>} */($$parsedSource));
|
||||
}
|
||||
}
|
@ -2,48 +2,6 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Address {
|
||||
/**
|
||||
* Creates a new Address instance.
|
||||
* @param {Partial<Address>} [$$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<Address>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
export {
|
||||
Address
|
||||
} from "./internal.js";
|
||||
|
@ -14,7 +14,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Yay does this and that
|
||||
|
@ -13,10 +13,10 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Get someone
|
||||
* Get someone.
|
||||
* @param {$models.Alias} aliasValue
|
||||
* @returns {Promise<$models.Person> & { cancel(): void }}
|
||||
*/
|
||||
@ -30,7 +30,21 @@ export function Get(aliasValue) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get someone quite different
|
||||
* Apparently, aliases are all the rage right now.
|
||||
* @param {$models.AliasedPerson} p
|
||||
* @returns {Promise<$models.StrangelyAliasedPerson> & { cancel(): void }}
|
||||
*/
|
||||
export function GetButAliased(p) {
|
||||
let $resultPromise = /** @type {any} */($Call.ByName("main.GreetService.GetButAliased", p));
|
||||
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<boolean>> & { cancel(): void }}
|
||||
*/
|
||||
export function GetButDifferent() {
|
||||
|
@ -0,0 +1,166 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
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<EmptyStruct>} [$$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<EmptyStruct>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic struct containing an alias.
|
||||
* @template T
|
||||
*/
|
||||
export class GenericPerson {
|
||||
/**
|
||||
* Creates a new GenericPerson instance.
|
||||
* @param {Partial<GenericPerson<T>>} [$$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 {(source: any) => T} $$createParamT
|
||||
* @returns {($$source?: any) => GenericPerson<T>}
|
||||
*/
|
||||
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<GenericPerson<T>>} */($$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<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class alias.
|
||||
*/
|
||||
export const AliasedPerson = Person;
|
||||
|
||||
/**
|
||||
* A class alias.
|
||||
* @typedef {Person} AliasedPerson
|
||||
*/
|
||||
|
||||
/**
|
||||
* Another class alias, but ordered after its aliased class.
|
||||
*/
|
||||
export const StrangelyAliasedPerson = Person;
|
||||
|
||||
/**
|
||||
* Another class alias, but ordered after its aliased class.
|
||||
* @typedef {Person} StrangelyAliasedPerson
|
||||
*/
|
@ -2,145 +2,33 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
export {
|
||||
AliasedPerson,
|
||||
EmptyStruct,
|
||||
GenericPerson,
|
||||
Person,
|
||||
StrangelyAliasedPerson
|
||||
} from "./internal.js";
|
||||
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* A nice type Alias
|
||||
* @typedef {number} Alias
|
||||
* A nice type Alias.
|
||||
* @typedef {$models.Alias} 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.
|
||||
* @typedef {$models.AliasStruct} AliasStruct
|
||||
*/
|
||||
|
||||
/**
|
||||
* An empty struct alias.
|
||||
* @typedef { {
|
||||
* } } EmptyAliasStruct
|
||||
* @typedef {$models.EmptyAliasStruct} EmptyAliasStruct
|
||||
*/
|
||||
|
||||
/**
|
||||
* An empty struct.
|
||||
*/
|
||||
export class EmptyStruct {
|
||||
/**
|
||||
* Creates a new EmptyStruct instance.
|
||||
* @param {Partial<EmptyStruct>} [$$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<EmptyStruct>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic struct containing an alias
|
||||
* @template T
|
||||
*/
|
||||
export class GenericPerson {
|
||||
/**
|
||||
* Creates a new GenericPerson instance.
|
||||
* @param {Partial<GenericPerson<T>>} [$$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 {(source: any) => T} $$createParamT
|
||||
* @returns {($$source?: any) => GenericPerson<T>}
|
||||
*/
|
||||
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<GenericPerson<T>>} */($$parsedSource));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Another struct alias.
|
||||
* @typedef {Object} OtherAliasStruct
|
||||
* @property {number[]} NoMoreIdeas
|
||||
* @typedef {$models.OtherAliasStruct} OtherAliasStruct
|
||||
*/
|
||||
|
||||
/**
|
||||
* A non-generic struct containing an alias.
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import {Call as $Call, Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
|
@ -6,6 +6,224 @@
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
|
||||
export class Embedded1 {
|
||||
/**
|
||||
* Creates a new Embedded1 instance.
|
||||
* @param {Partial<Embedded1>} [$$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<Embedded1>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {string} Embedded3
|
||||
*/
|
||||
|
||||
/**
|
||||
* Person represents a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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 {embedded4 | undefined}
|
||||
*/
|
||||
this["emb4"] = (new 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<Person>} */($$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",
|
||||
};
|
||||
|
||||
export class embedded4 {
|
||||
/**
|
||||
* Creates a new embedded4 instance.
|
||||
@ -44,3 +262,11 @@ export class embedded4 {
|
||||
return new embedded4(/** @type {Partial<embedded4>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// 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 = embedded4.createFrom;
|
||||
|
@ -2,236 +2,14 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "/wails/runtime.js";
|
||||
export {
|
||||
Embedded1,
|
||||
Person,
|
||||
Title
|
||||
} from "./internal.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $internal from "./internal.js";
|
||||
|
||||
export class Embedded1 {
|
||||
/**
|
||||
* Creates a new Embedded1 instance.
|
||||
* @param {Partial<Embedded1>} [$$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<Embedded1>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
import * as $models from "./internal.js";
|
||||
|
||||
/**
|
||||
* @typedef {string} Embedded3
|
||||
* @typedef {$models.Embedded3} Embedded3
|
||||
*/
|
||||
|
||||
/**
|
||||
* Person represents a person
|
||||
*/
|
||||
export class Person {
|
||||
/**
|
||||
* Creates a new Person instance.
|
||||
* @param {Partial<Person>} [$$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<Person>} */($$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;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user