merged jsvm migrations and hooks and updated the ambient TS types location

This commit is contained in:
Gani Georgiev
2023-06-27 14:45:04 +03:00
parent 1571ebe4eb
commit a672ab959f
11 changed files with 6336 additions and 6280 deletions
+6 -3
View File
@@ -48,7 +48,7 @@
new: apis.Serve(app core.App, config apis.ServeConfig)
old: jsvm.MustRegisterMigrations(app core.App, options *jsvm.MigrationsOptions)
new: jsvm.MustRegisterMigrations(app core.App, config jsvm.MigrationsConfig)
new: jsvm.MustRegister(app core.App, config jsvm.Config)
old: ghupdate.MustRegister(app core.App, rootCmd *cobra.Command, options *ghupdate.Options)
new: ghupdate.MustRegister(app core.App, rootCmd *cobra.Command, config ghupdate.Config)
@@ -59,15 +59,18 @@
- (@todo docs) Added new experimental JavaScript app hooks binding via [goja](https://github.com/dop251/goja).
They are available by default with the prebuilt executable if you add a `*.pb.js` file in `pb_hooks` directory.
To enable them as part of a custom Go build:
To enable them as part of a custom Go build, you need to register the `jsvm` plugin:
```go
jsvm.MustRegisterHooks(app core.App, config jsvm.HooksConfig{})
jsvm.MustRegister(app core.App, config jsvm.Config{})
```
(@todo add note about autogenerated hooks and migrations types...)
- Refactored `apis.ApiError` validation errors serialization to allow `map[string]error` and `map[string]any` when generating the public safe formatted `ApiError.Data`.
- Added `types.JsonMap.Get(k)` and `types.JsonMap.Set(k, v)` helpers for the cases where the type aliased direct map access is not allowed (eg. in [goja](https://pkg.go.dev/github.com/dop251/goja#hdr-Maps_with_methods)).
- Fixed `migrate down` not returning the correct `lastAppliedMigrations()` when the stored migration applied time is in seconds.
## v0.16.6