v0.17.0
版本发布时间: 2023-07-30 19:49:55
pocketbase/pocketbase最新发布版本:v0.23.5(2024-12-08 20:25:38)
⚠️ Make sure to have a backup of your
pb_data
before updating if you are not using theupdate
command with the prebuilt executable.
-
New more detailed guides for using PocketBase as framework (both Go and JS). If you find any typos or issues with the docs please report them in https://github.com/pocketbase/site.
-
Added new experimental JavaScript app hooks binding via goja. They are available by default with the prebuilt executable if you create
*.pb.js
file(s) in thepb_hooks
directory. Lower your expectations because the integration comes with some limitations. For more details please check the Extend with JavaScript guide. Optionally, you can also enable the JS app hooks as part of a custom Go build for dynamic scripting but you need to register thejsvm
plugin manually:jsvm.MustRegister(app core.App, config jsvm.Config{})
-
Added Instagram OAuth2 provider (#2534; thanks @pnmcosta).
-
Added VK OAuth2 provider (#2533; thanks @imperatrona).
-
Added Yandex OAuth2 provider (#2762; thanks @imperatrona).
-
Added new fields to
core.ServeEvent
:type ServeEvent struct { App App Router *echo.Echo // new fields Server *http.Server // allows adjusting the HTTP server config (global timeouts, TLS options, etc.) CertManager *autocert.Manager // allows adjusting the autocert options (cache dir, host policy, etc.) }
-
Added
record.ExpandedOne(rel)
andrecord.ExpandedAll(rel)
helpers to retrieve casted single or multiple expand relations from the already loaded "expand" Record data. -
Added rule and filter record
Dao
helpers:app.Dao().FindRecordsByFilter("posts", "title ~ 'lorem ipsum' && visible = true", "-created", 10) app.Dao().FindFirstRecordByFilter("posts", "slug='test' && active=true") app.Dao().CanAccessRecord(record, requestInfo, rule)
-
Added
Dao.WithoutHooks()
helper to create a newDao
from the current one but without the create/update/delete hooks. -
Use a default fetch function that will return all relations in case the
fetchFunc
argument ofDao.ExpandRecord(record, expands, fetchFunc)
andDao.ExpandRecords(records, expands, fetchFunc)
isnil
. -
For convenience it is now possible to call
Dao.RecordQuery(collectionModelOrIdentifier)
with just the collection id or name. In case an invalid collection id/name string is passed the query will be resolved with cancelled context error. -
Refactored
apis.ApiError
validation errors serialization to allowmap[string]error
andmap[string]any
when generating the public safe formattedApiError.Data
. -
Added support for wrapped API errors (in case Go 1.20+ is used with multiple wrapped errors, the first
apis.ApiError
takes precedence). -
Added
?download=1
file query parameter to the file serving endpoint to force the browser to always download the file and not show its preview. -
Added new utility
github.com/pocketbase/pocketbase/tools/template
subpackage to assist with rendering HTML templates using the standard Gohtml/template
andtext/template
syntax. -
Added
types.JsonMap.Get(k)
andtypes.JsonMap.Set(k, v)
helpers for the cases where the type aliased direct map access is not allowed (eg. in goja). -
Soft-deprecated
security.NewToken()
in favor ofsecurity.NewJWT()
. -
Hook.Add()
andHook.PreAdd
now returns a unique string identifier that could be used to remove the registered hook handler viaHook.Remove(handlerId)
. -
Changed the after* hooks to be called right before writing the user response, allowing users to return response errors from the after hooks. There is also no longer need for returning explicitly
hook.StopPropagtion
when writing custom response body in a hook because we will skip the finalizer response body write if a response was already "committed". -
⚠️ Renamed
*Options{}
toConfig{}
for consistency and replaced the unnecessary pointers with their value equivalent to keep the applied configuration defaults isolated within their function calls:old: pocketbase.NewWithConfig(config *pocketbase.Config) *pocketbase.PocketBase new: pocketbase.NewWithConfig(config pocketbase.Config) *pocketbase.PocketBase old: core.NewBaseApp(config *core.BaseAppConfig) *core.BaseApp new: core.NewBaseApp(config core.BaseAppConfig) *core.BaseApp old: apis.Serve(app core.App, options *apis.ServeOptions) error new: apis.Serve(app core.App, config apis.ServeConfig) (*http.Server, error) old: jsvm.MustRegisterMigrations(app core.App, options *jsvm.MigrationsOptions) 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) old: migratecmd.MustRegister(app core.App, rootCmd *cobra.Command, options *migratecmd.Options) new: migratecmd.MustRegister(app core.App, rootCmd *cobra.Command, config migratecmd.Config)
-
⚠️ Changed the type of
subscriptions.Message.Data
fromstring
to[]byte
becauseData
usually is a json bytes slice anyway. -
⚠️ Renamed
models.RequestData
tomodels.RequestInfo
and soft-deprecatedapis.RequestData(c)
in favor ofapis.RequestInfo(c)
to avoid the stuttering with theData
field. The oldapis.RequestData()
method still works to minimize the breaking changes but it is recommended to replace it withapis.RequestInfo(c)
. -
⚠️ Changes to the List/Search APIs
-
Added new query parameter
?skipTotal=1
to skip theCOUNT
query performed with the list/search actions (#2965). If?skipTotal=1
is set, the response fieldstotalItems
andtotalPages
will have-1
value (this is to avoid having different JSON responses and to differentiate from the zero default). With the latest JS SDK 0.16+ and Dart SDK v0.11+ versionsskipTotal=1
is set by default for thegetFirstListItem()
andgetFullList()
requests. -
The count and regular select statements also now executes concurrently, meaning that we no longer perform normalization over the
page
parameter and in case the user request a page that doesn't exist (eg.?page=99999999
) we'll return emptyitems
array. -
Reverted the default
COUNT
column toid
as there are some common situations where it can negatively impact the query performance. Additionally, from this version we also setPRAGMA temp_store = MEMORY
so that also helps with the temp B-TREE creation whenid
is used. There are still scenarios whereCOUNT
queries withrowid
executes faster, but the majority of the time when nested relations lookups are used it seems to have the opposite effect (at least based on the benchmarks dataset).
-
-
⚠️ Disallowed relations to views from non-view collections (#3000). The change was necessary because I wasn't able to find an efficient way to track view changes and the previous behavior could have too many unexpected side-effects (eg. view with computed ids). There is a system migration that will convert the existing view
relation
fields tojson
(multiple) andtext
(single) fields. This could be a breaking change if you haverelation
to view and useexpand
or some of therelation
view fields as part of a collection rule. -
⚠️ Added an extra
action
argument to theDao
hooks to allow skipping the default persist behavior. In preparation for the logs generalization, theDao.After*Func
methods now also allow returning an error. -
Allowed
0
asRelationOptions.MinSelect
value to avoid the ambiguity between 0 and non-filled input value (#2817). -
Fixed zero-default value not being used if the field is not explicitly set when manually creating records (#2992). Additionally,
record.Get(field)
will now always return normalized value (the same as in the json serialization) for consistency and to avoid ambiguities with what is stored in the related DB table. The schema fields columnsDEFAULT
definition was also updated for new collections to ensure thatNULL
values can't be accidentally inserted. -
Fixed
migrate down
not returning the correctlastAppliedMigrations()
when the stored migration applied time is in seconds. -
Fixed realtime delete event to be called after the record was deleted from the DB (including transactions and cascade delete operations).
-
Other minor fixes and improvements (typos and grammar fixes, updated dependencies, removed unnecessary 404 error check in the Admin UI, etc.).
1、 checksums.txt 810B
2、 pocketbase_0.17.0_darwin_amd64.zip 15.79MB
3、 pocketbase_0.17.0_darwin_arm64.zip 15.49MB
4、 pocketbase_0.17.0_linux_amd64.zip 15.23MB
5、 pocketbase_0.17.0_linux_amd64_cgo.zip 14.41MB
6、 pocketbase_0.17.0_linux_arm64.zip 14.22MB
7、 pocketbase_0.17.0_linux_armv7.zip 14.6MB
8、 pocketbase_0.17.0_windows_amd64.zip 15.38MB
9、 pocketbase_0.17.0_windows_arm64.zip 14.35MB