From 296c8a079661a5ba1c1bfa2fd6a1b820fa40ceeb Mon Sep 17 00:00:00 2001 From: markmybytes Date: Sun, 11 Oct 2026 12:24:02 +0800 Subject: [PATCH] fix(porter): expose ImportPreview.ExportedAt as RFC3339 string Wails binding generation has no model for time.Time and emitted "Not found: time.Time" when scanning the bound ImportPreview struct. Format the timestamp on the Go boundary instead; the regenerated TS type is now string, and the internal manifest keeps time.Time. --- frontend/package.json.md5 | 2 +- frontend/wailsjs/go/models.ts | 23 ++--------------------- pkg/porter/porter.go | 18 ++++++++++-------- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/frontend/package.json.md5 b/frontend/package.json.md5 index 6a82092..8b7488e 100644 --- a/frontend/package.json.md5 +++ b/frontend/package.json.md5 @@ -1 +1 @@ -29dc76b0e558e2ad19151d1e865006ec \ No newline at end of file +2abbe43834ebb72fc1a2bc635219d8a1 \ No newline at end of file diff --git a/frontend/wailsjs/go/models.ts b/frontend/wailsjs/go/models.ts index f63d508..bb399a1 100644 --- a/frontend/wailsjs/go/models.ts +++ b/frontend/wailsjs/go/models.ts @@ -42,8 +42,7 @@ export namespace porter { } } export class ImportPreview { - // Go type: time - exportedAt: any; + exportedAt: string; hasSettings: boolean; hasData: boolean; hasDatabase: boolean; @@ -57,7 +56,7 @@ export namespace porter { constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); - this.exportedAt = this.convertValues(source["exportedAt"], null); + this.exportedAt = source["exportedAt"]; this.hasSettings = source["hasSettings"]; this.hasData = source["hasData"]; this.hasDatabase = source["hasDatabase"]; @@ -65,24 +64,6 @@ export namespace porter { this.driverCount = source["driverCount"]; this.driverSize = source["driverSize"]; } - - convertValues(a: any, classs: any, asMap: boolean = false): any { - if (!a) { - return a; - } - if (a.slice && a.map) { - return (a as any[]).map(elem => this.convertValues(elem, classs)); - } else if ("object" === typeof a) { - if (asMap) { - for (const key of Object.keys(a)) { - a[key] = new classs(a[key]); - } - return a; - } - return new classs(a); - } - return a; - } } export class JobSnapshot { status: status.Status; diff --git a/pkg/porter/porter.go b/pkg/porter/porter.go index 40b8c92..67c3165 100644 --- a/pkg/porter/porter.go +++ b/pkg/porter/porter.go @@ -13,13 +13,15 @@ import ( // ImportPreview describes what's in a ZIP, returned by ValidateZip and DownloadAndValidate. type ImportPreview struct { - ExportedAt time.Time `json:"exportedAt"` - HasSettings bool `json:"hasSettings"` - HasData bool `json:"hasData"` - HasDatabase bool `json:"hasDatabase"` - HasDrivers bool `json:"hasDrivers"` - DriverCount int `json:"driverCount"` - DriverSize int64 `json:"driverSize"` + // RFC3339 string, not time.Time — Wails binding generator has no model + // for time.Time. Manifest keeps time.Time (internal, never bound). + ExportedAt string `json:"exportedAt"` + HasSettings bool `json:"hasSettings"` + HasData bool `json:"hasData"` + HasDatabase bool `json:"hasDatabase"` + HasDrivers bool `json:"hasDrivers"` + DriverCount int `json:"driverCount"` + DriverSize int64 `json:"driverSize"` } // ImportOptions is the user's category selection for import. @@ -106,7 +108,7 @@ func (p *Porter) ValidateZip(path string) (ImportPreview, error) { } preview := ImportPreview{ - ExportedAt: m.ExportedAt, + ExportedAt: m.ExportedAt.Format(time.RFC3339), } for _, f := range zr.File {