diff --git a/CHANGELOG.md b/CHANGELOG.md
index 87599399..a19b75bc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/examples/base/main.go b/examples/base/main.go
index 7eb4980e..4222c16f 100644
--- a/examples/base/main.go
+++ b/examples/base/main.go
@@ -84,15 +84,11 @@ func main() {
// Plugins and hooks:
// ---------------------------------------------------------------
- // load js pb_hooks
- jsvm.MustRegisterHooks(app, jsvm.HooksConfig{
- Dir: hooksDir,
- Watch: hooksWatch,
- })
-
- // load js pb_migrations
- jsvm.MustRegisterMigrations(app, jsvm.MigrationsConfig{
- Dir: migrationsDir,
+ // load jsvm (hooks and migrations)
+ jsvm.MustRegister(app, jsvm.Config{
+ MigrationsDir: migrationsDir,
+ HooksDir: hooksDir,
+ HooksWatch: hooksWatch,
})
// migrate command (with js templates)
diff --git a/plugins/jsvm/vm.go b/plugins/jsvm/binds.go
similarity index 93%
rename from plugins/jsvm/vm.go
rename to plugins/jsvm/binds.go
index e4cb863d..61f09dc2 100644
--- a/plugins/jsvm/vm.go
+++ b/plugins/jsvm/binds.go
@@ -18,10 +18,7 @@ package jsvm
import (
"encoding/json"
- "os"
- "path/filepath"
"reflect"
- "regexp"
"github.com/dop251/goja"
validation "github.com/go-ozzo/ozzo-validation/v4"
@@ -360,47 +357,6 @@ func structConstructorUnmarshal(vm *goja.Runtime, call goja.ConstructorCall, ins
return instanceValue
}
-// filesContent returns a map with all direct files within the specified dir and their content.
-//
-// If directory with dirPath is missing or no files matching the pattern were found,
-// it returns an empty map and no error.
-//
-// If pattern is empty string it matches all root files.
-func filesContent(dirPath string, pattern string) (map[string][]byte, error) {
- files, err := os.ReadDir(dirPath)
- if err != nil {
- if os.IsNotExist(err) {
- return map[string][]byte{}, nil
- }
- return nil, err
- }
-
- var exp *regexp.Regexp
- if pattern != "" {
- var err error
- if exp, err = regexp.Compile(pattern); err != nil {
- return nil, err
- }
- }
-
- result := map[string][]byte{}
-
- for _, f := range files {
- if f.IsDir() || (exp != nil && !exp.MatchString(f.Name())) {
- continue
- }
-
- raw, err := os.ReadFile(filepath.Join(dirPath, f.Name()))
- if err != nil {
- return nil, err
- }
-
- result[f.Name()] = raw
- }
-
- return result, nil
-}
-
// newDynamicModel creates a new dynamic struct with fields based
// on the specified "shape".
//
diff --git a/plugins/jsvm/vm_test.go b/plugins/jsvm/binds_test.go
similarity index 100%
rename from plugins/jsvm/vm_test.go
rename to plugins/jsvm/binds_test.go
diff --git a/plugins/jsvm/hooks.go b/plugins/jsvm/hooks.go
deleted file mode 100644
index 18a3d814..00000000
--- a/plugins/jsvm/hooks.go
+++ /dev/null
@@ -1,233 +0,0 @@
-package jsvm
-
-import (
- "os"
- "path/filepath"
- "regexp"
- "runtime"
- "strings"
- "time"
-
- "github.com/dop251/goja"
- "github.com/dop251/goja_nodejs/console"
- "github.com/dop251/goja_nodejs/eventloop"
- "github.com/dop251/goja_nodejs/process"
- "github.com/dop251/goja_nodejs/require"
- "github.com/fatih/color"
- "github.com/fsnotify/fsnotify"
- "github.com/pocketbase/pocketbase/core"
- "github.com/pocketbase/pocketbase/plugins/jsvm/internal/docs/generated"
-)
-
-const (
- hooksExtension = ".pb.js"
-
- typesFileName = ".types.d.ts"
-
- typesReferenceDirective = `/// `
-)
-
-// HooksConfig defines the config options of the JS app hooks plugin.
-type HooksConfig struct {
- // Dir specifies the directory with the JS app hooks.
- //
- // If not set it fallbacks to a relative "pb_data/../pb_hooks" directory.
- Dir string
-
- // Watch enables auto app restarts when a JS app hook file changes.
- //
- // Note that currently the application cannot be automatically restarted on Windows
- // because the restart process relies on execve.
- Watch bool
-}
-
-// MustRegisterHooks registers the JS hooks plugin to
-// the provided app instance and panics if it fails.
-//
-// Example usage:
-//
-// jsvm.MustRegisterHooks(app, jsvm.HooksConfig{})
-func MustRegisterHooks(app core.App, config HooksConfig) {
- if err := RegisterHooks(app, config); err != nil {
- panic(err)
- }
-}
-
-// RegisterHooks registers the JS hooks plugin to the provided app instance.
-func RegisterHooks(app core.App, config HooksConfig) error {
- p := &hooks{app: app, config: config}
-
- if p.config.Dir == "" {
- p.config.Dir = filepath.Join(app.DataDir(), "../pb_hooks")
- }
-
- // fetch all js hooks sorted by their filename
- files, err := filesContent(p.config.Dir, `^.*`+regexp.QuoteMeta(hooksExtension)+`$`)
- if err != nil {
- return err
- }
-
- // prepend the types reference directive to empty files
- for name, content := range files {
- if len(content) != 0 {
- continue
- }
- path := filepath.Join(p.config.Dir, name)
- if err := prependToEmptyFile(path, typesReferenceDirective+"\n\n"); err != nil {
- color.Yellow("Unable to prepend the types reference: %v", err)
- }
- }
-
- registry := new(require.Registry) // this can be shared by multiple runtimes
-
- loop := eventloop.NewEventLoop()
-
- loop.Run(func(vm *goja.Runtime) {
- registry.Enable(vm)
- console.Enable(vm)
- process.Enable(vm)
- baseBinds(vm)
- dbxBinds(vm)
- filesystemBinds(vm)
- tokensBinds(vm)
- securityBinds(vm)
- formsBinds(vm)
- apisBinds(vm)
-
- vm.Set("$app", app)
-
- for file, content := range files {
- _, err := vm.RunString(string(content))
- if err != nil {
- if p.config.Watch {
- color.Red("Failed to execute %s: %v", file, err)
- } else {
- panic(err)
- }
- }
- }
- })
-
- loop.Start()
-
- app.OnAfterBootstrap().Add(func(e *core.BootstrapEvent) error {
- // always update the app types on start to ensure that
- // the user has the latest generated declarations
- if len(files) > 0 {
- if err := p.saveTypesFile(); err != nil {
- color.Yellow("Unable to save app types file: %v", err)
- }
- }
-
- return nil
- })
-
- app.OnTerminate().Add(func(e *core.TerminateEvent) error {
- loop.StopNoWait()
-
- return nil
- })
-
- if p.config.Watch {
- return p.watchFiles()
- }
-
- return nil
-}
-
-type hooks struct {
- app core.App
- config HooksConfig
-}
-
-func (p *hooks) watchFiles() error {
- watcher, err := fsnotify.NewWatcher()
- if err != nil {
- return err
- }
-
- var debounceTimer *time.Timer
-
- stopDebounceTimer := func() {
- if debounceTimer != nil {
- debounceTimer.Stop()
- }
- }
-
- p.app.OnTerminate().Add(func(e *core.TerminateEvent) error {
- watcher.Close()
-
- stopDebounceTimer()
-
- return nil
- })
-
- // start listening for events.
- go func() {
- for {
- select {
- case event, ok := <-watcher.Events:
- if !ok {
- stopDebounceTimer()
- return
- }
-
- // skip TS declaration files change
- if strings.HasSuffix(event.Name, ".d.ts") {
- continue
- }
-
- stopDebounceTimer()
- debounceTimer = time.AfterFunc(50*time.Millisecond, func() {
- // app restart is currently not supported on Windows
- if runtime.GOOS == "windows" {
- color.Yellow("File %s changed, please restart the app", event.Name)
- } else {
- color.Yellow("File %s changed, restarting...", event.Name)
- if err := p.app.Restart(); err != nil {
- color.Red("Failed to restart the app:", err)
- }
- }
- })
- case err, ok := <-watcher.Errors:
- if !ok {
- stopDebounceTimer()
- return
- }
- color.Red("Watch error:", err)
- }
- }
- }()
-
- // add the directory to watch
- err = watcher.Add(p.config.Dir)
- if err != nil {
- watcher.Close()
- return err
- }
-
- return nil
-}
-
-func (p *hooks) saveTypesFile() error {
- data, _ := generated.Types.ReadFile("types.d.ts")
-
- if err := os.WriteFile(filepath.Join(p.config.Dir, typesFileName), data, 0644); err != nil {
- return err
- }
-
- return nil
-}
-
-// prependToEmptyFile prepends the specified text to an empty file.
-//
-// If the file is not empty this method does nothing.
-func prependToEmptyFile(path, text string) error {
- info, err := os.Stat(path)
-
- if err == nil && info.Size() == 0 {
- return os.WriteFile(path, []byte(text), 0644)
- }
-
- return err
-}
diff --git a/plugins/jsvm/internal/docs/docs.go b/plugins/jsvm/internal/docs/docs.go
index 712ac07f..5719cc62 100644
--- a/plugins/jsvm/internal/docs/docs.go
+++ b/plugins/jsvm/internal/docs/docs.go
@@ -298,17 +298,31 @@ declare class UnauthorizedError implements apis.ApiError {
}
declare namespace $apis {
- let requireRecordAuth: apis.requireRecordAuth
- let requireAdminAuth: apis.requireAdminAuth
- let requireAdminAuthOnlyIfAny: apis.requireAdminAuthOnlyIfAny
- let requireAdminOrRecordAuth: apis.requireAdminOrRecordAuth
- let requireAdminOrOwnerAuth: apis.requireAdminOrOwnerAuth
- let activityLogger: apis.activityLogger
- let requestData: apis.requestData
- let recordAuthResponse: apis.recordAuthResponse
- let enrichRecord: apis.enrichRecord
- let enrichRecords: apis.enrichRecords
+ let requireRecordAuth: apis.requireRecordAuth
+ let requireAdminAuth: apis.requireAdminAuth
+ let requireAdminAuthOnlyIfAny: apis.requireAdminAuthOnlyIfAny
+ let requireAdminOrRecordAuth: apis.requireAdminOrRecordAuth
+ let requireAdminOrOwnerAuth: apis.requireAdminOrOwnerAuth
+ let activityLogger: apis.activityLogger
+ let requestData: apis.requestData
+ let recordAuthResponse: apis.recordAuthResponse
+ let enrichRecord: apis.enrichRecord
+ let enrichRecords: apis.enrichRecords
}
+
+// -------------------------------------------------------------------
+// migrate only
+// -------------------------------------------------------------------
+
+/**
+ * Migrate defines a single migration upgrade/downgrade action.
+ *
+ * Note that this method is available only in pb_migrations context.
+ */
+declare function migrate(
+ up: (db: dbx.Builder) => void,
+ down?: (db: dbx.Builder) => void
+): void;
`
func main() {
diff --git a/plugins/jsvm/internal/docs/generated/types.d.ts b/plugins/jsvm/internal/docs/generated/types.d.ts
index 0d5147e8..c493f11b 100644
--- a/plugins/jsvm/internal/docs/generated/types.d.ts
+++ b/plugins/jsvm/internal/docs/generated/types.d.ts
@@ -288,17 +288,31 @@ declare class UnauthorizedError implements apis.ApiError {
}
declare namespace $apis {
- let requireRecordAuth: apis.requireRecordAuth
- let requireAdminAuth: apis.requireAdminAuth
- let requireAdminAuthOnlyIfAny: apis.requireAdminAuthOnlyIfAny
- let requireAdminOrRecordAuth: apis.requireAdminOrRecordAuth
- let requireAdminOrOwnerAuth: apis.requireAdminOrOwnerAuth
- let activityLogger: apis.activityLogger
- let requestData: apis.requestData
- let recordAuthResponse: apis.recordAuthResponse
- let enrichRecord: apis.enrichRecord
- let enrichRecords: apis.enrichRecords
+ let requireRecordAuth: apis.requireRecordAuth
+ let requireAdminAuth: apis.requireAdminAuth
+ let requireAdminAuthOnlyIfAny: apis.requireAdminAuthOnlyIfAny
+ let requireAdminOrRecordAuth: apis.requireAdminOrRecordAuth
+ let requireAdminOrOwnerAuth: apis.requireAdminOrOwnerAuth
+ let activityLogger: apis.activityLogger
+ let requestData: apis.requestData
+ let recordAuthResponse: apis.recordAuthResponse
+ let enrichRecord: apis.enrichRecord
+ let enrichRecords: apis.enrichRecords
}
+
+// -------------------------------------------------------------------
+// migrate only
+// -------------------------------------------------------------------
+
+/**
+ * Migrate defines a single migration upgrade/downgrade action.
+ *
+ * Note that this method is available only in pb_migrations context.
+ */
+declare function migrate(
+ up: (db: dbx.Builder) => void,
+ down?: (db: dbx.Builder) => void
+): void;
type _TygojaDict = { [key:string | number | symbol]: any; }
type _TygojaAny = any
@@ -654,14 +668,14 @@ namespace dbx {
/**
* MssqlBuilder is the builder for SQL Server databases.
*/
- type _submFhQB = BaseBuilder
- interface MssqlBuilder extends _submFhQB {
+ type _subGKFZM = BaseBuilder
+ interface MssqlBuilder extends _subGKFZM {
}
/**
* MssqlQueryBuilder is the query builder for SQL Server databases.
*/
- type _subaCWzp = BaseQueryBuilder
- interface MssqlQueryBuilder extends _subaCWzp {
+ type _subOqdIt = BaseQueryBuilder
+ interface MssqlQueryBuilder extends _subOqdIt {
}
interface newMssqlBuilder {
/**
@@ -732,8 +746,8 @@ namespace dbx {
/**
* MysqlBuilder is the builder for MySQL databases.
*/
- type _subdiHAk = BaseBuilder
- interface MysqlBuilder extends _subdiHAk {
+ type _subDzoLw = BaseBuilder
+ interface MysqlBuilder extends _subDzoLw {
}
interface newMysqlBuilder {
/**
@@ -808,14 +822,14 @@ namespace dbx {
/**
* OciBuilder is the builder for Oracle databases.
*/
- type _subhQnOx = BaseBuilder
- interface OciBuilder extends _subhQnOx {
+ type _subOzbLU = BaseBuilder
+ interface OciBuilder extends _subOzbLU {
}
/**
* OciQueryBuilder is the query builder for Oracle databases.
*/
- type _subEXOkV = BaseQueryBuilder
- interface OciQueryBuilder extends _subEXOkV {
+ type _subbbUAo = BaseQueryBuilder
+ interface OciQueryBuilder extends _subbbUAo {
}
interface newOciBuilder {
/**
@@ -878,8 +892,8 @@ namespace dbx {
/**
* PgsqlBuilder is the builder for PostgreSQL databases.
*/
- type _subousyN = BaseBuilder
- interface PgsqlBuilder extends _subousyN {
+ type _subHamlG = BaseBuilder
+ interface PgsqlBuilder extends _subHamlG {
}
interface newPgsqlBuilder {
/**
@@ -946,8 +960,8 @@ namespace dbx {
/**
* SqliteBuilder is the builder for SQLite databases.
*/
- type _subjxxZx = BaseBuilder
- interface SqliteBuilder extends _subjxxZx {
+ type _subzlTOF = BaseBuilder
+ interface SqliteBuilder extends _subzlTOF {
}
interface newSqliteBuilder {
/**
@@ -1046,8 +1060,8 @@ namespace dbx {
/**
* StandardBuilder is the builder that is used by DB for an unknown driver.
*/
- type _subYCUaC = BaseBuilder
- interface StandardBuilder extends _subYCUaC {
+ type _suboCcWx = BaseBuilder
+ interface StandardBuilder extends _suboCcWx {
}
interface newStandardBuilder {
/**
@@ -1113,8 +1127,8 @@ namespace dbx {
* DB enhances sql.DB by providing a set of DB-agnostic query building methods.
* DB allows easier query building and population of data into Go variables.
*/
- type _subpnyJP = Builder
- interface DB extends _subpnyJP {
+ type _subFnVkY = Builder
+ interface DB extends _subFnVkY {
/**
* FieldMapper maps struct fields to DB columns. Defaults to DefaultFieldMapFunc.
*/
@@ -1912,8 +1926,8 @@ namespace dbx {
* Rows enhances sql.Rows by providing additional data query methods.
* Rows can be obtained by calling Query.Rows(). It is mainly used to populate data row by row.
*/
- type _subDgpHQ = sql.Rows
- interface Rows extends _subDgpHQ {
+ type _subSMXve = sql.Rows
+ interface Rows extends _subSMXve {
}
interface Rows {
/**
@@ -2270,8 +2284,8 @@ namespace dbx {
}): string }
interface structInfo {
}
- type _subQPtoc = structInfo
- interface structValue extends _subQPtoc {
+ type _subtWkxy = structInfo
+ interface structValue extends _subtWkxy {
}
interface fieldInfo {
}
@@ -2309,8 +2323,8 @@ namespace dbx {
/**
* Tx enhances sql.Tx with additional querying methods.
*/
- type _subfKAHl = Builder
- interface Tx extends _subfKAHl {
+ type _suboKZXf = Builder
+ interface Tx extends _suboKZXf {
}
interface Tx {
/**
@@ -2485,8 +2499,8 @@ namespace filesystem {
*/
open(): io.ReadSeekCloser
}
- type _subvDXNG = bytes.Reader
- interface bytesReadSeekCloser extends _subvDXNG {
+ type _subAChUK = bytes.Reader
+ interface bytesReadSeekCloser extends _subAChUK {
}
interface bytesReadSeekCloser {
/**
@@ -3541,8 +3555,8 @@ namespace forms {
/**
* SettingsUpsert is a [settings.Settings] upsert (create/update) form.
*/
- type _subfDybK = settings.Settings
- interface SettingsUpsert extends _subfDybK {
+ type _subEnxcs = settings.Settings
+ interface SettingsUpsert extends _subEnxcs {
}
interface newSettingsUpsert {
/**
@@ -3932,8 +3946,8 @@ namespace pocketbase {
/**
* appWrapper serves as a private core.App instance wrapper.
*/
- type _subqIYUU = core.App
- interface appWrapper extends _subqIYUU {
+ type _subHtBFi = core.App
+ interface appWrapper extends _subHtBFi {
}
/**
* PocketBase defines a PocketBase app launcher.
@@ -3941,8 +3955,8 @@ namespace pocketbase {
* It implements [core.App] via embedding and all of the app interface methods
* could be accessed directly through the instance (eg. PocketBase.DataDir()).
*/
- type _subOKUuC = appWrapper
- interface PocketBase extends _subOKUuC {
+ type _suboXAPR = appWrapper
+ interface PocketBase extends _suboXAPR {
/**
* RootCmd is the main console command
*/
@@ -4346,6 +4360,35 @@ namespace io {
}
}
+/**
+ * Package fs defines basic interfaces to a file system.
+ * A file system can be provided by the host operating system
+ * but also by other packages.
+ */
+namespace fs {
+ /**
+ * An FS provides access to a hierarchical file system.
+ *
+ * The FS interface is the minimum implementation required of the file system.
+ * A file system may implement additional interfaces,
+ * such as ReadFileFS, to provide additional or optimized functionality.
+ */
+ interface FS {
+ /**
+ * Open opens the named file.
+ *
+ * When Open returns an error, it should be of type *PathError
+ * with the Op field set to "open", the Path field set to name,
+ * and the Err field describing the problem.
+ *
+ * Open should reject attempts to open names that do not satisfy
+ * ValidPath(name), returning a *PathError with Err set to
+ * ErrInvalid or ErrNotExist.
+ */
+ open(name: string): File
+ }
+}
+
/**
* Package bytes implements functions for the manipulation of byte slices.
* It is analogous to the facilities of the strings package.
@@ -4431,677 +4474,6 @@ namespace bytes {
}
}
-/**
- * Package fs defines basic interfaces to a file system.
- * A file system can be provided by the host operating system
- * but also by other packages.
- */
-namespace fs {
- /**
- * An FS provides access to a hierarchical file system.
- *
- * The FS interface is the minimum implementation required of the file system.
- * A file system may implement additional interfaces,
- * such as ReadFileFS, to provide additional or optimized functionality.
- */
- interface FS {
- /**
- * Open opens the named file.
- *
- * When Open returns an error, it should be of type *PathError
- * with the Op field set to "open", the Path field set to name,
- * and the Err field describing the problem.
- *
- * Open should reject attempts to open names that do not satisfy
- * ValidPath(name), returning a *PathError with Err set to
- * ErrInvalid or ErrNotExist.
- */
- open(name: string): File
- }
-}
-
-/**
- * Package sql provides a generic interface around SQL (or SQL-like)
- * databases.
- *
- * The sql package must be used in conjunction with a database driver.
- * See https://golang.org/s/sqldrivers for a list of drivers.
- *
- * Drivers that do not support context cancellation will not return until
- * after the query is completed.
- *
- * For usage examples, see the wiki page at
- * https://golang.org/s/sqlwiki.
- */
-namespace sql {
- /**
- * TxOptions holds the transaction options to be used in DB.BeginTx.
- */
- interface TxOptions {
- /**
- * Isolation is the transaction isolation level.
- * If zero, the driver or database's default level is used.
- */
- isolation: IsolationLevel
- readOnly: boolean
- }
- /**
- * DB is a database handle representing a pool of zero or more
- * underlying connections. It's safe for concurrent use by multiple
- * goroutines.
- *
- * The sql package creates and frees connections automatically; it
- * also maintains a free pool of idle connections. If the database has
- * a concept of per-connection state, such state can be reliably observed
- * within a transaction (Tx) or connection (Conn). Once DB.Begin is called, the
- * returned Tx is bound to a single connection. Once Commit or
- * Rollback is called on the transaction, that transaction's
- * connection is returned to DB's idle connection pool. The pool size
- * can be controlled with SetMaxIdleConns.
- */
- interface DB {
- }
- interface DB {
- /**
- * PingContext verifies a connection to the database is still alive,
- * establishing a connection if necessary.
- */
- pingContext(ctx: context.Context): void
- }
- interface DB {
- /**
- * Ping verifies a connection to the database is still alive,
- * establishing a connection if necessary.
- *
- * Ping uses context.Background internally; to specify the context, use
- * PingContext.
- */
- ping(): void
- }
- interface DB {
- /**
- * Close closes the database and prevents new queries from starting.
- * Close then waits for all queries that have started processing on the server
- * to finish.
- *
- * It is rare to Close a DB, as the DB handle is meant to be
- * long-lived and shared between many goroutines.
- */
- close(): void
- }
- interface DB {
- /**
- * SetMaxIdleConns sets the maximum number of connections in the idle
- * connection pool.
- *
- * If MaxOpenConns is greater than 0 but less than the new MaxIdleConns,
- * then the new MaxIdleConns will be reduced to match the MaxOpenConns limit.
- *
- * If n <= 0, no idle connections are retained.
- *
- * The default max idle connections is currently 2. This may change in
- * a future release.
- */
- setMaxIdleConns(n: number): void
- }
- interface DB {
- /**
- * SetMaxOpenConns sets the maximum number of open connections to the database.
- *
- * If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than
- * MaxIdleConns, then MaxIdleConns will be reduced to match the new
- * MaxOpenConns limit.
- *
- * If n <= 0, then there is no limit on the number of open connections.
- * The default is 0 (unlimited).
- */
- setMaxOpenConns(n: number): void
- }
- interface DB {
- /**
- * SetConnMaxLifetime sets the maximum amount of time a connection may be reused.
- *
- * Expired connections may be closed lazily before reuse.
- *
- * If d <= 0, connections are not closed due to a connection's age.
- */
- setConnMaxLifetime(d: time.Duration): void
- }
- interface DB {
- /**
- * SetConnMaxIdleTime sets the maximum amount of time a connection may be idle.
- *
- * Expired connections may be closed lazily before reuse.
- *
- * If d <= 0, connections are not closed due to a connection's idle time.
- */
- setConnMaxIdleTime(d: time.Duration): void
- }
- interface DB {
- /**
- * Stats returns database statistics.
- */
- stats(): DBStats
- }
- interface DB {
- /**
- * PrepareContext creates a prepared statement for later queries or executions.
- * Multiple queries or executions may be run concurrently from the
- * returned statement.
- * The caller must call the statement's Close method
- * when the statement is no longer needed.
- *
- * The provided context is used for the preparation of the statement, not for the
- * execution of the statement.
- */
- prepareContext(ctx: context.Context, query: string): (Stmt | undefined)
- }
- interface DB {
- /**
- * Prepare creates a prepared statement for later queries or executions.
- * Multiple queries or executions may be run concurrently from the
- * returned statement.
- * The caller must call the statement's Close method
- * when the statement is no longer needed.
- *
- * Prepare uses context.Background internally; to specify the context, use
- * PrepareContext.
- */
- prepare(query: string): (Stmt | undefined)
- }
- interface DB {
- /**
- * ExecContext executes a query without returning any rows.
- * The args are for any placeholder parameters in the query.
- */
- execContext(ctx: context.Context, query: string, ...args: any[]): Result
- }
- interface DB {
- /**
- * Exec executes a query without returning any rows.
- * The args are for any placeholder parameters in the query.
- *
- * Exec uses context.Background internally; to specify the context, use
- * ExecContext.
- */
- exec(query: string, ...args: any[]): Result
- }
- interface DB {
- /**
- * QueryContext executes a query that returns rows, typically a SELECT.
- * The args are for any placeholder parameters in the query.
- */
- queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined)
- }
- interface DB {
- /**
- * Query executes a query that returns rows, typically a SELECT.
- * The args are for any placeholder parameters in the query.
- *
- * Query uses context.Background internally; to specify the context, use
- * QueryContext.
- */
- query(query: string, ...args: any[]): (Rows | undefined)
- }
- interface DB {
- /**
- * QueryRowContext executes a query that is expected to return at most one row.
- * QueryRowContext always returns a non-nil value. Errors are deferred until
- * Row's Scan method is called.
- * If the query selects no rows, the *Row's Scan will return ErrNoRows.
- * Otherwise, the *Row's Scan scans the first selected row and discards
- * the rest.
- */
- queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined)
- }
- interface DB {
- /**
- * QueryRow executes a query that is expected to return at most one row.
- * QueryRow always returns a non-nil value. Errors are deferred until
- * Row's Scan method is called.
- * If the query selects no rows, the *Row's Scan will return ErrNoRows.
- * Otherwise, the *Row's Scan scans the first selected row and discards
- * the rest.
- *
- * QueryRow uses context.Background internally; to specify the context, use
- * QueryRowContext.
- */
- queryRow(query: string, ...args: any[]): (Row | undefined)
- }
- interface DB {
- /**
- * BeginTx starts a transaction.
- *
- * The provided context is used until the transaction is committed or rolled back.
- * If the context is canceled, the sql package will roll back
- * the transaction. Tx.Commit will return an error if the context provided to
- * BeginTx is canceled.
- *
- * The provided TxOptions is optional and may be nil if defaults should be used.
- * If a non-default isolation level is used that the driver doesn't support,
- * an error will be returned.
- */
- beginTx(ctx: context.Context, opts: TxOptions): (Tx | undefined)
- }
- interface DB {
- /**
- * Begin starts a transaction. The default isolation level is dependent on
- * the driver.
- *
- * Begin uses context.Background internally; to specify the context, use
- * BeginTx.
- */
- begin(): (Tx | undefined)
- }
- interface DB {
- /**
- * Driver returns the database's underlying driver.
- */
- driver(): driver.Driver
- }
- interface DB {
- /**
- * Conn returns a single connection by either opening a new connection
- * or returning an existing connection from the connection pool. Conn will
- * block until either a connection is returned or ctx is canceled.
- * Queries run on the same Conn will be run in the same database session.
- *
- * Every Conn must be returned to the database pool after use by
- * calling Conn.Close.
- */
- conn(ctx: context.Context): (Conn | undefined)
- }
- /**
- * Tx is an in-progress database transaction.
- *
- * A transaction must end with a call to Commit or Rollback.
- *
- * After a call to Commit or Rollback, all operations on the
- * transaction fail with ErrTxDone.
- *
- * The statements prepared for a transaction by calling
- * the transaction's Prepare or Stmt methods are closed
- * by the call to Commit or Rollback.
- */
- interface Tx {
- }
- interface Tx {
- /**
- * Commit commits the transaction.
- */
- commit(): void
- }
- interface Tx {
- /**
- * Rollback aborts the transaction.
- */
- rollback(): void
- }
- interface Tx {
- /**
- * PrepareContext creates a prepared statement for use within a transaction.
- *
- * The returned statement operates within the transaction and will be closed
- * when the transaction has been committed or rolled back.
- *
- * To use an existing prepared statement on this transaction, see Tx.Stmt.
- *
- * The provided context will be used for the preparation of the context, not
- * for the execution of the returned statement. The returned statement
- * will run in the transaction context.
- */
- prepareContext(ctx: context.Context, query: string): (Stmt | undefined)
- }
- interface Tx {
- /**
- * Prepare creates a prepared statement for use within a transaction.
- *
- * The returned statement operates within the transaction and will be closed
- * when the transaction has been committed or rolled back.
- *
- * To use an existing prepared statement on this transaction, see Tx.Stmt.
- *
- * Prepare uses context.Background internally; to specify the context, use
- * PrepareContext.
- */
- prepare(query: string): (Stmt | undefined)
- }
- interface Tx {
- /**
- * StmtContext returns a transaction-specific prepared statement from
- * an existing statement.
- *
- * Example:
- *
- * ```
- * updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?")
- * ...
- * tx, err := db.Begin()
- * ...
- * res, err := tx.StmtContext(ctx, updateMoney).Exec(123.45, 98293203)
- * ```
- *
- * The provided context is used for the preparation of the statement, not for the
- * execution of the statement.
- *
- * The returned statement operates within the transaction and will be closed
- * when the transaction has been committed or rolled back.
- */
- stmtContext(ctx: context.Context, stmt: Stmt): (Stmt | undefined)
- }
- interface Tx {
- /**
- * Stmt returns a transaction-specific prepared statement from
- * an existing statement.
- *
- * Example:
- *
- * ```
- * updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?")
- * ...
- * tx, err := db.Begin()
- * ...
- * res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203)
- * ```
- *
- * The returned statement operates within the transaction and will be closed
- * when the transaction has been committed or rolled back.
- *
- * Stmt uses context.Background internally; to specify the context, use
- * StmtContext.
- */
- stmt(stmt: Stmt): (Stmt | undefined)
- }
- interface Tx {
- /**
- * ExecContext executes a query that doesn't return rows.
- * For example: an INSERT and UPDATE.
- */
- execContext(ctx: context.Context, query: string, ...args: any[]): Result
- }
- interface Tx {
- /**
- * Exec executes a query that doesn't return rows.
- * For example: an INSERT and UPDATE.
- *
- * Exec uses context.Background internally; to specify the context, use
- * ExecContext.
- */
- exec(query: string, ...args: any[]): Result
- }
- interface Tx {
- /**
- * QueryContext executes a query that returns rows, typically a SELECT.
- */
- queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined)
- }
- interface Tx {
- /**
- * Query executes a query that returns rows, typically a SELECT.
- *
- * Query uses context.Background internally; to specify the context, use
- * QueryContext.
- */
- query(query: string, ...args: any[]): (Rows | undefined)
- }
- interface Tx {
- /**
- * QueryRowContext executes a query that is expected to return at most one row.
- * QueryRowContext always returns a non-nil value. Errors are deferred until
- * Row's Scan method is called.
- * If the query selects no rows, the *Row's Scan will return ErrNoRows.
- * Otherwise, the *Row's Scan scans the first selected row and discards
- * the rest.
- */
- queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined)
- }
- interface Tx {
- /**
- * QueryRow executes a query that is expected to return at most one row.
- * QueryRow always returns a non-nil value. Errors are deferred until
- * Row's Scan method is called.
- * If the query selects no rows, the *Row's Scan will return ErrNoRows.
- * Otherwise, the *Row's Scan scans the first selected row and discards
- * the rest.
- *
- * QueryRow uses context.Background internally; to specify the context, use
- * QueryRowContext.
- */
- queryRow(query: string, ...args: any[]): (Row | undefined)
- }
- /**
- * Stmt is a prepared statement.
- * A Stmt is safe for concurrent use by multiple goroutines.
- *
- * If a Stmt is prepared on a Tx or Conn, it will be bound to a single
- * underlying connection forever. If the Tx or Conn closes, the Stmt will
- * become unusable and all operations will return an error.
- * If a Stmt is prepared on a DB, it will remain usable for the lifetime of the
- * DB. When the Stmt needs to execute on a new underlying connection, it will
- * prepare itself on the new connection automatically.
- */
- interface Stmt {
- }
- interface Stmt {
- /**
- * ExecContext executes a prepared statement with the given arguments and
- * returns a Result summarizing the effect of the statement.
- */
- execContext(ctx: context.Context, ...args: any[]): Result
- }
- interface Stmt {
- /**
- * Exec executes a prepared statement with the given arguments and
- * returns a Result summarizing the effect of the statement.
- *
- * Exec uses context.Background internally; to specify the context, use
- * ExecContext.
- */
- exec(...args: any[]): Result
- }
- interface Stmt {
- /**
- * QueryContext executes a prepared query statement with the given arguments
- * and returns the query results as a *Rows.
- */
- queryContext(ctx: context.Context, ...args: any[]): (Rows | undefined)
- }
- interface Stmt {
- /**
- * Query executes a prepared query statement with the given arguments
- * and returns the query results as a *Rows.
- *
- * Query uses context.Background internally; to specify the context, use
- * QueryContext.
- */
- query(...args: any[]): (Rows | undefined)
- }
- interface Stmt {
- /**
- * QueryRowContext executes a prepared query statement with the given arguments.
- * If an error occurs during the execution of the statement, that error will
- * be returned by a call to Scan on the returned *Row, which is always non-nil.
- * If the query selects no rows, the *Row's Scan will return ErrNoRows.
- * Otherwise, the *Row's Scan scans the first selected row and discards
- * the rest.
- */
- queryRowContext(ctx: context.Context, ...args: any[]): (Row | undefined)
- }
- interface Stmt {
- /**
- * QueryRow executes a prepared query statement with the given arguments.
- * If an error occurs during the execution of the statement, that error will
- * be returned by a call to Scan on the returned *Row, which is always non-nil.
- * If the query selects no rows, the *Row's Scan will return ErrNoRows.
- * Otherwise, the *Row's Scan scans the first selected row and discards
- * the rest.
- *
- * Example usage:
- *
- * ```
- * var name string
- * err := nameByUseridStmt.QueryRow(id).Scan(&name)
- * ```
- *
- * QueryRow uses context.Background internally; to specify the context, use
- * QueryRowContext.
- */
- queryRow(...args: any[]): (Row | undefined)
- }
- interface Stmt {
- /**
- * Close closes the statement.
- */
- close(): void
- }
- /**
- * Rows is the result of a query. Its cursor starts before the first row
- * of the result set. Use Next to advance from row to row.
- */
- interface Rows {
- }
- interface Rows {
- /**
- * Next prepares the next result row for reading with the Scan method. It
- * returns true on success, or false if there is no next result row or an error
- * happened while preparing it. Err should be consulted to distinguish between
- * the two cases.
- *
- * Every call to Scan, even the first one, must be preceded by a call to Next.
- */
- next(): boolean
- }
- interface Rows {
- /**
- * NextResultSet prepares the next result set for reading. It reports whether
- * there is further result sets, or false if there is no further result set
- * or if there is an error advancing to it. The Err method should be consulted
- * to distinguish between the two cases.
- *
- * After calling NextResultSet, the Next method should always be called before
- * scanning. If there are further result sets they may not have rows in the result
- * set.
- */
- nextResultSet(): boolean
- }
- interface Rows {
- /**
- * Err returns the error, if any, that was encountered during iteration.
- * Err may be called after an explicit or implicit Close.
- */
- err(): void
- }
- interface Rows {
- /**
- * Columns returns the column names.
- * Columns returns an error if the rows are closed.
- */
- columns(): Array
- }
- interface Rows {
- /**
- * ColumnTypes returns column information such as column type, length,
- * and nullable. Some information may not be available from some drivers.
- */
- columnTypes(): Array<(ColumnType | undefined)>
- }
- interface Rows {
- /**
- * Scan copies the columns in the current row into the values pointed
- * at by dest. The number of values in dest must be the same as the
- * number of columns in Rows.
- *
- * Scan converts columns read from the database into the following
- * common Go types and special types provided by the sql package:
- *
- * ```
- * *string
- * *[]byte
- * *int, *int8, *int16, *int32, *int64
- * *uint, *uint8, *uint16, *uint32, *uint64
- * *bool
- * *float32, *float64
- * *interface{}
- * *RawBytes
- * *Rows (cursor value)
- * any type implementing Scanner (see Scanner docs)
- * ```
- *
- * In the most simple case, if the type of the value from the source
- * column is an integer, bool or string type T and dest is of type *T,
- * Scan simply assigns the value through the pointer.
- *
- * Scan also converts between string and numeric types, as long as no
- * information would be lost. While Scan stringifies all numbers
- * scanned from numeric database columns into *string, scans into
- * numeric types are checked for overflow. For example, a float64 with
- * value 300 or a string with value "300" can scan into a uint16, but
- * not into a uint8, though float64(255) or "255" can scan into a
- * uint8. One exception is that scans of some float64 numbers to
- * strings may lose information when stringifying. In general, scan
- * floating point columns into *float64.
- *
- * If a dest argument has type *[]byte, Scan saves in that argument a
- * copy of the corresponding data. The copy is owned by the caller and
- * can be modified and held indefinitely. The copy can be avoided by
- * using an argument of type *RawBytes instead; see the documentation
- * for RawBytes for restrictions on its use.
- *
- * If an argument has type *interface{}, Scan copies the value
- * provided by the underlying driver without conversion. When scanning
- * from a source value of type []byte to *interface{}, a copy of the
- * slice is made and the caller owns the result.
- *
- * Source values of type time.Time may be scanned into values of type
- * *time.Time, *interface{}, *string, or *[]byte. When converting to
- * the latter two, time.RFC3339Nano is used.
- *
- * Source values of type bool may be scanned into types *bool,
- * *interface{}, *string, *[]byte, or *RawBytes.
- *
- * For scanning into *bool, the source may be true, false, 1, 0, or
- * string inputs parseable by strconv.ParseBool.
- *
- * Scan can also convert a cursor returned from a query, such as
- * "select cursor(select * from my_table) from dual", into a
- * *Rows value that can itself be scanned from. The parent
- * select query will close any cursor *Rows if the parent *Rows is closed.
- *
- * If any of the first arguments implementing Scanner returns an error,
- * that error will be wrapped in the returned error
- */
- scan(...dest: any[]): void
- }
- interface Rows {
- /**
- * Close closes the Rows, preventing further enumeration. If Next is called
- * and returns false and there are no further result sets,
- * the Rows are closed automatically and it will suffice to check the
- * result of Err. Close is idempotent and does not affect the result of Err.
- */
- close(): void
- }
- /**
- * A Result summarizes an executed SQL command.
- */
- interface Result {
- /**
- * LastInsertId returns the integer generated by the database
- * in response to a command. Typically this will be from an
- * "auto increment" column when inserting a new row. Not all
- * databases support this feature, and the syntax of such
- * statements varies.
- */
- lastInsertId(): number
- /**
- * RowsAffected returns the number of rows affected by an
- * update, insert, or delete. Not every database or database
- * driver may support this.
- */
- rowsAffected(): number
- }
-}
-
/**
* Package multipart implements MIME multipart parsing, as defined in RFC
* 2046.
@@ -6261,632 +5633,644 @@ namespace schema {
}
/**
- * Package models implements all PocketBase DB models and DTOs.
+ * Package sql provides a generic interface around SQL (or SQL-like)
+ * databases.
+ *
+ * The sql package must be used in conjunction with a database driver.
+ * See https://golang.org/s/sqldrivers for a list of drivers.
+ *
+ * Drivers that do not support context cancellation will not return until
+ * after the query is completed.
+ *
+ * For usage examples, see the wiki page at
+ * https://golang.org/s/sqlwiki.
*/
-namespace models {
- type _subebvJq = BaseModel
- interface Admin extends _subebvJq {
- avatar: number
- email: string
- tokenKey: string
- passwordHash: string
- lastResetSentAt: types.DateTime
- }
- interface Admin {
+namespace sql {
+ /**
+ * TxOptions holds the transaction options to be used in DB.BeginTx.
+ */
+ interface TxOptions {
/**
- * TableName returns the Admin model SQL table name.
+ * Isolation is the transaction isolation level.
+ * If zero, the driver or database's default level is used.
*/
- tableName(): string
+ isolation: IsolationLevel
+ readOnly: boolean
}
- interface Admin {
+ /**
+ * DB is a database handle representing a pool of zero or more
+ * underlying connections. It's safe for concurrent use by multiple
+ * goroutines.
+ *
+ * The sql package creates and frees connections automatically; it
+ * also maintains a free pool of idle connections. If the database has
+ * a concept of per-connection state, such state can be reliably observed
+ * within a transaction (Tx) or connection (Conn). Once DB.Begin is called, the
+ * returned Tx is bound to a single connection. Once Commit or
+ * Rollback is called on the transaction, that transaction's
+ * connection is returned to DB's idle connection pool. The pool size
+ * can be controlled with SetMaxIdleConns.
+ */
+ interface DB {
+ }
+ interface DB {
/**
- * ValidatePassword validates a plain password against the model's password.
+ * PingContext verifies a connection to the database is still alive,
+ * establishing a connection if necessary.
*/
- validatePassword(password: string): boolean
+ pingContext(ctx: context.Context): void
}
- interface Admin {
+ interface DB {
/**
- * SetPassword sets cryptographically secure string to `model.Password`.
+ * Ping verifies a connection to the database is still alive,
+ * establishing a connection if necessary.
*
- * Additionally this method also resets the LastResetSentAt and the TokenKey fields.
+ * Ping uses context.Background internally; to specify the context, use
+ * PingContext.
*/
- setPassword(password: string): void
+ ping(): void
}
- interface Admin {
+ interface DB {
/**
- * RefreshTokenKey generates and sets new random token key.
- */
- refreshTokenKey(): void
- }
- // @ts-ignore
- import validation = ozzo_validation
- type _subPNErQ = BaseModel
- interface Collection extends _subPNErQ {
- name: string
- type: string
- system: boolean
- schema: schema.Schema
- indexes: types.JsonArray
- /**
- * rules
- */
- listRule?: string
- viewRule?: string
- createRule?: string
- updateRule?: string
- deleteRule?: string
- options: types.JsonMap
- }
- interface Collection {
- /**
- * TableName returns the Collection model SQL table name.
- */
- tableName(): string
- }
- interface Collection {
- /**
- * BaseFilesPath returns the storage dir path used by the collection.
- */
- baseFilesPath(): string
- }
- interface Collection {
- /**
- * IsBase checks if the current collection has "base" type.
- */
- isBase(): boolean
- }
- interface Collection {
- /**
- * IsAuth checks if the current collection has "auth" type.
- */
- isAuth(): boolean
- }
- interface Collection {
- /**
- * IsView checks if the current collection has "view" type.
- */
- isView(): boolean
- }
- interface Collection {
- /**
- * MarshalJSON implements the [json.Marshaler] interface.
- */
- marshalJSON(): string
- }
- interface Collection {
- /**
- * BaseOptions decodes the current collection options and returns them
- * as new [CollectionBaseOptions] instance.
- */
- baseOptions(): CollectionBaseOptions
- }
- interface Collection {
- /**
- * AuthOptions decodes the current collection options and returns them
- * as new [CollectionAuthOptions] instance.
- */
- authOptions(): CollectionAuthOptions
- }
- interface Collection {
- /**
- * ViewOptions decodes the current collection options and returns them
- * as new [CollectionViewOptions] instance.
- */
- viewOptions(): CollectionViewOptions
- }
- interface Collection {
- /**
- * NormalizeOptions updates the current collection options with a
- * new normalized state based on the collection type.
- */
- normalizeOptions(): void
- }
- interface Collection {
- /**
- * DecodeOptions decodes the current collection options into the
- * provided "result" (must be a pointer).
- */
- decodeOptions(result: any): void
- }
- interface Collection {
- /**
- * SetOptions normalizes and unmarshals the specified options into m.Options.
- */
- setOptions(typedOptions: any): void
- }
- type _subhYIob = BaseModel
- interface ExternalAuth extends _subhYIob {
- collectionId: string
- recordId: string
- provider: string
- providerId: string
- }
- interface ExternalAuth {
- tableName(): string
- }
- type _subqNgik = BaseModel
- interface Record extends _subqNgik {
- }
- interface Record {
- /**
- * TableName returns the table name associated to the current Record model.
- */
- tableName(): string
- }
- interface Record {
- /**
- * Collection returns the Collection model associated to the current Record model.
- */
- collection(): (Collection | undefined)
- }
- interface Record {
- /**
- * OriginalCopy returns a copy of the current record model populated
- * with its ORIGINAL data state (aka. the initially loaded) and
- * everything else reset to the defaults.
- */
- originalCopy(): (Record | undefined)
- }
- interface Record {
- /**
- * CleanCopy returns a copy of the current record model populated only
- * with its LATEST data state and everything else reset to the defaults.
- */
- cleanCopy(): (Record | undefined)
- }
- interface Record {
- /**
- * Expand returns a shallow copy of the current Record model expand data.
- */
- expand(): _TygojaDict
- }
- interface Record {
- /**
- * SetExpand shallow copies the provided data to the current Record model's expand.
- */
- setExpand(expand: _TygojaDict): void
- }
- interface Record {
- /**
- * MergeExpand merges recursively the provided expand data into
- * the current model's expand (if any).
+ * Close closes the database and prevents new queries from starting.
+ * Close then waits for all queries that have started processing on the server
+ * to finish.
*
- * Note that if an expanded prop with the same key is a slice (old or new expand)
- * then both old and new records will be merged into a new slice (aka. a :merge: [b,c] => [a,b,c]).
- * Otherwise the "old" expanded record will be replace with the "new" one (aka. a :merge: aNew => aNew).
+ * It is rare to Close a DB, as the DB handle is meant to be
+ * long-lived and shared between many goroutines.
*/
- mergeExpand(expand: _TygojaDict): void
+ close(): void
}
- interface Record {
+ interface DB {
/**
- * SchemaData returns a shallow copy ONLY of the defined record schema fields data.
- */
- schemaData(): _TygojaDict
- }
- interface Record {
- /**
- * UnknownData returns a shallow copy ONLY of the unknown record fields data,
- * aka. fields that are neither one of the base and special system ones,
- * nor defined by the collection schema.
- */
- unknownData(): _TygojaDict
- }
- interface Record {
- /**
- * IgnoreEmailVisibility toggles the flag to ignore the auth record email visibility check.
- */
- ignoreEmailVisibility(state: boolean): void
- }
- interface Record {
- /**
- * WithUnknownData toggles the export/serialization of unknown data fields
- * (false by default).
- */
- withUnknownData(state: boolean): void
- }
- interface Record {
- /**
- * Set sets the provided key-value data pair for the current Record model.
+ * SetMaxIdleConns sets the maximum number of connections in the idle
+ * connection pool.
*
- * If the record collection has field with name matching the provided "key",
- * the value will be further normalized according to the field rules.
- */
- set(key: string, value: any): void
- }
- interface Record {
- /**
- * Get returns a single record model data value for "key".
- */
- get(key: string): any
- }
- interface Record {
- /**
- * GetBool returns the data value for "key" as a bool.
- */
- getBool(key: string): boolean
- }
- interface Record {
- /**
- * GetString returns the data value for "key" as a string.
- */
- getString(key: string): string
- }
- interface Record {
- /**
- * GetInt returns the data value for "key" as an int.
- */
- getInt(key: string): number
- }
- interface Record {
- /**
- * GetFloat returns the data value for "key" as a float64.
- */
- getFloat(key: string): number
- }
- interface Record {
- /**
- * GetTime returns the data value for "key" as a [time.Time] instance.
- */
- getTime(key: string): time.Time
- }
- interface Record {
- /**
- * GetDateTime returns the data value for "key" as a DateTime instance.
- */
- getDateTime(key: string): types.DateTime
- }
- interface Record {
- /**
- * GetStringSlice returns the data value for "key" as a slice of unique strings.
- */
- getStringSlice(key: string): Array
- }
- interface Record {
- /**
- * Retrieves the "key" json field value and unmarshals it into "result".
+ * If MaxOpenConns is greater than 0 but less than the new MaxIdleConns,
+ * then the new MaxIdleConns will be reduced to match the MaxOpenConns limit.
*
- * Example
+ * If n <= 0, no idle connections are retained.
+ *
+ * The default max idle connections is currently 2. This may change in
+ * a future release.
+ */
+ setMaxIdleConns(n: number): void
+ }
+ interface DB {
+ /**
+ * SetMaxOpenConns sets the maximum number of open connections to the database.
+ *
+ * If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than
+ * MaxIdleConns, then MaxIdleConns will be reduced to match the new
+ * MaxOpenConns limit.
+ *
+ * If n <= 0, then there is no limit on the number of open connections.
+ * The default is 0 (unlimited).
+ */
+ setMaxOpenConns(n: number): void
+ }
+ interface DB {
+ /**
+ * SetConnMaxLifetime sets the maximum amount of time a connection may be reused.
+ *
+ * Expired connections may be closed lazily before reuse.
+ *
+ * If d <= 0, connections are not closed due to a connection's age.
+ */
+ setConnMaxLifetime(d: time.Duration): void
+ }
+ interface DB {
+ /**
+ * SetConnMaxIdleTime sets the maximum amount of time a connection may be idle.
+ *
+ * Expired connections may be closed lazily before reuse.
+ *
+ * If d <= 0, connections are not closed due to a connection's idle time.
+ */
+ setConnMaxIdleTime(d: time.Duration): void
+ }
+ interface DB {
+ /**
+ * Stats returns database statistics.
+ */
+ stats(): DBStats
+ }
+ interface DB {
+ /**
+ * PrepareContext creates a prepared statement for later queries or executions.
+ * Multiple queries or executions may be run concurrently from the
+ * returned statement.
+ * The caller must call the statement's Close method
+ * when the statement is no longer needed.
+ *
+ * The provided context is used for the preparation of the statement, not for the
+ * execution of the statement.
+ */
+ prepareContext(ctx: context.Context, query: string): (Stmt | undefined)
+ }
+ interface DB {
+ /**
+ * Prepare creates a prepared statement for later queries or executions.
+ * Multiple queries or executions may be run concurrently from the
+ * returned statement.
+ * The caller must call the statement's Close method
+ * when the statement is no longer needed.
+ *
+ * Prepare uses context.Background internally; to specify the context, use
+ * PrepareContext.
+ */
+ prepare(query: string): (Stmt | undefined)
+ }
+ interface DB {
+ /**
+ * ExecContext executes a query without returning any rows.
+ * The args are for any placeholder parameters in the query.
+ */
+ execContext(ctx: context.Context, query: string, ...args: any[]): Result
+ }
+ interface DB {
+ /**
+ * Exec executes a query without returning any rows.
+ * The args are for any placeholder parameters in the query.
+ *
+ * Exec uses context.Background internally; to specify the context, use
+ * ExecContext.
+ */
+ exec(query: string, ...args: any[]): Result
+ }
+ interface DB {
+ /**
+ * QueryContext executes a query that returns rows, typically a SELECT.
+ * The args are for any placeholder parameters in the query.
+ */
+ queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined)
+ }
+ interface DB {
+ /**
+ * Query executes a query that returns rows, typically a SELECT.
+ * The args are for any placeholder parameters in the query.
+ *
+ * Query uses context.Background internally; to specify the context, use
+ * QueryContext.
+ */
+ query(query: string, ...args: any[]): (Rows | undefined)
+ }
+ interface DB {
+ /**
+ * QueryRowContext executes a query that is expected to return at most one row.
+ * QueryRowContext always returns a non-nil value. Errors are deferred until
+ * Row's Scan method is called.
+ * If the query selects no rows, the *Row's Scan will return ErrNoRows.
+ * Otherwise, the *Row's Scan scans the first selected row and discards
+ * the rest.
+ */
+ queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined)
+ }
+ interface DB {
+ /**
+ * QueryRow executes a query that is expected to return at most one row.
+ * QueryRow always returns a non-nil value. Errors are deferred until
+ * Row's Scan method is called.
+ * If the query selects no rows, the *Row's Scan will return ErrNoRows.
+ * Otherwise, the *Row's Scan scans the first selected row and discards
+ * the rest.
+ *
+ * QueryRow uses context.Background internally; to specify the context, use
+ * QueryRowContext.
+ */
+ queryRow(query: string, ...args: any[]): (Row | undefined)
+ }
+ interface DB {
+ /**
+ * BeginTx starts a transaction.
+ *
+ * The provided context is used until the transaction is committed or rolled back.
+ * If the context is canceled, the sql package will roll back
+ * the transaction. Tx.Commit will return an error if the context provided to
+ * BeginTx is canceled.
+ *
+ * The provided TxOptions is optional and may be nil if defaults should be used.
+ * If a non-default isolation level is used that the driver doesn't support,
+ * an error will be returned.
+ */
+ beginTx(ctx: context.Context, opts: TxOptions): (Tx | undefined)
+ }
+ interface DB {
+ /**
+ * Begin starts a transaction. The default isolation level is dependent on
+ * the driver.
+ *
+ * Begin uses context.Background internally; to specify the context, use
+ * BeginTx.
+ */
+ begin(): (Tx | undefined)
+ }
+ interface DB {
+ /**
+ * Driver returns the database's underlying driver.
+ */
+ driver(): driver.Driver
+ }
+ interface DB {
+ /**
+ * Conn returns a single connection by either opening a new connection
+ * or returning an existing connection from the connection pool. Conn will
+ * block until either a connection is returned or ctx is canceled.
+ * Queries run on the same Conn will be run in the same database session.
+ *
+ * Every Conn must be returned to the database pool after use by
+ * calling Conn.Close.
+ */
+ conn(ctx: context.Context): (Conn | undefined)
+ }
+ /**
+ * Tx is an in-progress database transaction.
+ *
+ * A transaction must end with a call to Commit or Rollback.
+ *
+ * After a call to Commit or Rollback, all operations on the
+ * transaction fail with ErrTxDone.
+ *
+ * The statements prepared for a transaction by calling
+ * the transaction's Prepare or Stmt methods are closed
+ * by the call to Commit or Rollback.
+ */
+ interface Tx {
+ }
+ interface Tx {
+ /**
+ * Commit commits the transaction.
+ */
+ commit(): void
+ }
+ interface Tx {
+ /**
+ * Rollback aborts the transaction.
+ */
+ rollback(): void
+ }
+ interface Tx {
+ /**
+ * PrepareContext creates a prepared statement for use within a transaction.
+ *
+ * The returned statement operates within the transaction and will be closed
+ * when the transaction has been committed or rolled back.
+ *
+ * To use an existing prepared statement on this transaction, see Tx.Stmt.
+ *
+ * The provided context will be used for the preparation of the context, not
+ * for the execution of the returned statement. The returned statement
+ * will run in the transaction context.
+ */
+ prepareContext(ctx: context.Context, query: string): (Stmt | undefined)
+ }
+ interface Tx {
+ /**
+ * Prepare creates a prepared statement for use within a transaction.
+ *
+ * The returned statement operates within the transaction and will be closed
+ * when the transaction has been committed or rolled back.
+ *
+ * To use an existing prepared statement on this transaction, see Tx.Stmt.
+ *
+ * Prepare uses context.Background internally; to specify the context, use
+ * PrepareContext.
+ */
+ prepare(query: string): (Stmt | undefined)
+ }
+ interface Tx {
+ /**
+ * StmtContext returns a transaction-specific prepared statement from
+ * an existing statement.
+ *
+ * Example:
*
* ```
- * result := struct {
- * FirstName string `json:"first_name"`
- * }{}
- * err := m.UnmarshalJSONField("my_field_name", &result)
+ * updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?")
+ * ...
+ * tx, err := db.Begin()
+ * ...
+ * res, err := tx.StmtContext(ctx, updateMoney).Exec(123.45, 98293203)
* ```
- */
- unmarshalJSONField(key: string, result: any): void
- }
- interface Record {
- /**
- * BaseFilesPath returns the storage dir path used by the record.
- */
- baseFilesPath(): string
- }
- interface Record {
- /**
- * FindFileFieldByFile returns the first file type field for which
- * any of the record's data contains the provided filename.
- */
- findFileFieldByFile(filename: string): (schema.SchemaField | undefined)
- }
- interface Record {
- /**
- * Load bulk loads the provided data into the current Record model.
- */
- load(data: _TygojaDict): void
- }
- interface Record {
- /**
- * ColumnValueMap implements [ColumnValueMapper] interface.
- */
- columnValueMap(): _TygojaDict
- }
- interface Record {
- /**
- * PublicExport exports only the record fields that are safe to be public.
*
- * Fields marked as hidden will be exported only if `m.IgnoreEmailVisibility(true)` is set.
- */
- publicExport(): _TygojaDict
- }
- interface Record {
- /**
- * MarshalJSON implements the [json.Marshaler] interface.
+ * The provided context is used for the preparation of the statement, not for the
+ * execution of the statement.
*
- * Only the data exported by `PublicExport()` will be serialized.
+ * The returned statement operates within the transaction and will be closed
+ * when the transaction has been committed or rolled back.
*/
- marshalJSON(): string
+ stmtContext(ctx: context.Context, stmt: Stmt): (Stmt | undefined)
}
- interface Record {
+ interface Tx {
/**
- * UnmarshalJSON implements the [json.Unmarshaler] interface.
+ * Stmt returns a transaction-specific prepared statement from
+ * an existing statement.
+ *
+ * Example:
+ *
+ * ```
+ * updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?")
+ * ...
+ * tx, err := db.Begin()
+ * ...
+ * res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203)
+ * ```
+ *
+ * The returned statement operates within the transaction and will be closed
+ * when the transaction has been committed or rolled back.
+ *
+ * Stmt uses context.Background internally; to specify the context, use
+ * StmtContext.
*/
- unmarshalJSON(data: string): void
+ stmt(stmt: Stmt): (Stmt | undefined)
}
- interface Record {
+ interface Tx {
/**
- * ReplaceModifers returns a new map with applied modifier
- * values based on the current record and the specified data.
+ * ExecContext executes a query that doesn't return rows.
+ * For example: an INSERT and UPDATE.
+ */
+ execContext(ctx: context.Context, query: string, ...args: any[]): Result
+ }
+ interface Tx {
+ /**
+ * Exec executes a query that doesn't return rows.
+ * For example: an INSERT and UPDATE.
*
- * The resolved modifier keys will be removed.
+ * Exec uses context.Background internally; to specify the context, use
+ * ExecContext.
+ */
+ exec(query: string, ...args: any[]): Result
+ }
+ interface Tx {
+ /**
+ * QueryContext executes a query that returns rows, typically a SELECT.
+ */
+ queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined)
+ }
+ interface Tx {
+ /**
+ * Query executes a query that returns rows, typically a SELECT.
*
- * Multiple modifiers will be applied one after another,
- * while reusing the previous base key value result (eg. 1; -5; +2 => -2).
+ * Query uses context.Background internally; to specify the context, use
+ * QueryContext.
+ */
+ query(query: string, ...args: any[]): (Rows | undefined)
+ }
+ interface Tx {
+ /**
+ * QueryRowContext executes a query that is expected to return at most one row.
+ * QueryRowContext always returns a non-nil value. Errors are deferred until
+ * Row's Scan method is called.
+ * If the query selects no rows, the *Row's Scan will return ErrNoRows.
+ * Otherwise, the *Row's Scan scans the first selected row and discards
+ * the rest.
+ */
+ queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined)
+ }
+ interface Tx {
+ /**
+ * QueryRow executes a query that is expected to return at most one row.
+ * QueryRow always returns a non-nil value. Errors are deferred until
+ * Row's Scan method is called.
+ * If the query selects no rows, the *Row's Scan will return ErrNoRows.
+ * Otherwise, the *Row's Scan scans the first selected row and discards
+ * the rest.
+ *
+ * QueryRow uses context.Background internally; to specify the context, use
+ * QueryRowContext.
+ */
+ queryRow(query: string, ...args: any[]): (Row | undefined)
+ }
+ /**
+ * Stmt is a prepared statement.
+ * A Stmt is safe for concurrent use by multiple goroutines.
+ *
+ * If a Stmt is prepared on a Tx or Conn, it will be bound to a single
+ * underlying connection forever. If the Tx or Conn closes, the Stmt will
+ * become unusable and all operations will return an error.
+ * If a Stmt is prepared on a DB, it will remain usable for the lifetime of the
+ * DB. When the Stmt needs to execute on a new underlying connection, it will
+ * prepare itself on the new connection automatically.
+ */
+ interface Stmt {
+ }
+ interface Stmt {
+ /**
+ * ExecContext executes a prepared statement with the given arguments and
+ * returns a Result summarizing the effect of the statement.
+ */
+ execContext(ctx: context.Context, ...args: any[]): Result
+ }
+ interface Stmt {
+ /**
+ * Exec executes a prepared statement with the given arguments and
+ * returns a Result summarizing the effect of the statement.
+ *
+ * Exec uses context.Background internally; to specify the context, use
+ * ExecContext.
+ */
+ exec(...args: any[]): Result
+ }
+ interface Stmt {
+ /**
+ * QueryContext executes a prepared query statement with the given arguments
+ * and returns the query results as a *Rows.
+ */
+ queryContext(ctx: context.Context, ...args: any[]): (Rows | undefined)
+ }
+ interface Stmt {
+ /**
+ * Query executes a prepared query statement with the given arguments
+ * and returns the query results as a *Rows.
+ *
+ * Query uses context.Background internally; to specify the context, use
+ * QueryContext.
+ */
+ query(...args: any[]): (Rows | undefined)
+ }
+ interface Stmt {
+ /**
+ * QueryRowContext executes a prepared query statement with the given arguments.
+ * If an error occurs during the execution of the statement, that error will
+ * be returned by a call to Scan on the returned *Row, which is always non-nil.
+ * If the query selects no rows, the *Row's Scan will return ErrNoRows.
+ * Otherwise, the *Row's Scan scans the first selected row and discards
+ * the rest.
+ */
+ queryRowContext(ctx: context.Context, ...args: any[]): (Row | undefined)
+ }
+ interface Stmt {
+ /**
+ * QueryRow executes a prepared query statement with the given arguments.
+ * If an error occurs during the execution of the statement, that error will
+ * be returned by a call to Scan on the returned *Row, which is always non-nil.
+ * If the query selects no rows, the *Row's Scan will return ErrNoRows.
+ * Otherwise, the *Row's Scan scans the first selected row and discards
+ * the rest.
*
* Example usage:
*
* ```
- * newData := record.ReplaceModifers(data)
- * // record: {"field": 10}
- * // data: {"field+": 5}
- * // newData: {"field": 15}
+ * var name string
+ * err := nameByUseridStmt.QueryRow(id).Scan(&name)
* ```
- */
- replaceModifers(data: _TygojaDict): _TygojaDict
- }
- interface Record {
- /**
- * Username returns the "username" auth record data value.
- */
- username(): string
- }
- interface Record {
- /**
- * SetUsername sets the "username" auth record data value.
*
- * This method doesn't check whether the provided value is a valid username.
- *
- * Returns an error if the record is not from an auth collection.
+ * QueryRow uses context.Background internally; to specify the context, use
+ * QueryRowContext.
*/
- setUsername(username: string): void
+ queryRow(...args: any[]): (Row | undefined)
}
- interface Record {
+ interface Stmt {
/**
- * Email returns the "email" auth record data value.
+ * Close closes the statement.
*/
- email(): string
- }
- interface Record {
- /**
- * SetEmail sets the "email" auth record data value.
- *
- * This method doesn't check whether the provided value is a valid email.
- *
- * Returns an error if the record is not from an auth collection.
- */
- setEmail(email: string): void
- }
- interface Record {
- /**
- * Verified returns the "emailVisibility" auth record data value.
- */
- emailVisibility(): boolean
- }
- interface Record {
- /**
- * SetEmailVisibility sets the "emailVisibility" auth record data value.
- *
- * Returns an error if the record is not from an auth collection.
- */
- setEmailVisibility(visible: boolean): void
- }
- interface Record {
- /**
- * Verified returns the "verified" auth record data value.
- */
- verified(): boolean
- }
- interface Record {
- /**
- * SetVerified sets the "verified" auth record data value.
- *
- * Returns an error if the record is not from an auth collection.
- */
- setVerified(verified: boolean): void
- }
- interface Record {
- /**
- * TokenKey returns the "tokenKey" auth record data value.
- */
- tokenKey(): string
- }
- interface Record {
- /**
- * SetTokenKey sets the "tokenKey" auth record data value.
- *
- * Returns an error if the record is not from an auth collection.
- */
- setTokenKey(key: string): void
- }
- interface Record {
- /**
- * RefreshTokenKey generates and sets new random auth record "tokenKey".
- *
- * Returns an error if the record is not from an auth collection.
- */
- refreshTokenKey(): void
- }
- interface Record {
- /**
- * LastResetSentAt returns the "lastResentSentAt" auth record data value.
- */
- lastResetSentAt(): types.DateTime
- }
- interface Record {
- /**
- * SetLastResetSentAt sets the "lastResentSentAt" auth record data value.
- *
- * Returns an error if the record is not from an auth collection.
- */
- setLastResetSentAt(dateTime: types.DateTime): void
- }
- interface Record {
- /**
- * LastVerificationSentAt returns the "lastVerificationSentAt" auth record data value.
- */
- lastVerificationSentAt(): types.DateTime
- }
- interface Record {
- /**
- * SetLastVerificationSentAt sets an "lastVerificationSentAt" auth record data value.
- *
- * Returns an error if the record is not from an auth collection.
- */
- setLastVerificationSentAt(dateTime: types.DateTime): void
- }
- interface Record {
- /**
- * PasswordHash returns the "passwordHash" auth record data value.
- */
- passwordHash(): string
- }
- interface Record {
- /**
- * ValidatePassword validates a plain password against the auth record password.
- *
- * Returns false if the password is incorrect or record is not from an auth collection.
- */
- validatePassword(password: string): boolean
- }
- interface Record {
- /**
- * SetPassword sets cryptographically secure string to the auth record "password" field.
- * This method also resets the "lastResetSentAt" and the "tokenKey" fields.
- *
- * Returns an error if the record is not from an auth collection or
- * an empty password is provided.
- */
- setPassword(password: string): void
+ close(): void
}
/**
- * RequestData defines a HTTP request data struct, usually used
- * as part of the `@request.*` filter resolver.
+ * Rows is the result of a query. Its cursor starts before the first row
+ * of the result set. Use Next to advance from row to row.
*/
- interface RequestData {
- method: string
- query: _TygojaDict
- /**
- * @todo consider changing to Body?
- */
- data: _TygojaDict
- headers: _TygojaDict
- authRecord?: Record
- admin?: Admin
+ interface Rows {
}
- interface RequestData {
+ interface Rows {
/**
- * HasModifierDataKeys loosely checks if the current struct has any modifier Data keys.
+ * Next prepares the next result row for reading with the Scan method. It
+ * returns true on success, or false if there is no next result row or an error
+ * happened while preparing it. Err should be consulted to distinguish between
+ * the two cases.
+ *
+ * Every call to Scan, even the first one, must be preceded by a call to Next.
*/
- hasModifierDataKeys(): boolean
+ next(): boolean
}
-}
-
-namespace auth {
- /**
- * AuthUser defines a standardized oauth2 user data structure.
- */
- interface AuthUser {
- id: string
- name: string
- username: string
- email: string
- avatarUrl: string
- rawUser: _TygojaDict
- accessToken: string
- refreshToken: string
+ interface Rows {
+ /**
+ * NextResultSet prepares the next result set for reading. It reports whether
+ * there is further result sets, or false if there is no further result set
+ * or if there is an error advancing to it. The Err method should be consulted
+ * to distinguish between the two cases.
+ *
+ * After calling NextResultSet, the Next method should always be called before
+ * scanning. If there are further result sets they may not have rows in the result
+ * set.
+ */
+ nextResultSet(): boolean
+ }
+ interface Rows {
+ /**
+ * Err returns the error, if any, that was encountered during iteration.
+ * Err may be called after an explicit or implicit Close.
+ */
+ err(): void
+ }
+ interface Rows {
+ /**
+ * Columns returns the column names.
+ * Columns returns an error if the rows are closed.
+ */
+ columns(): Array
+ }
+ interface Rows {
+ /**
+ * ColumnTypes returns column information such as column type, length,
+ * and nullable. Some information may not be available from some drivers.
+ */
+ columnTypes(): Array<(ColumnType | undefined)>
+ }
+ interface Rows {
+ /**
+ * Scan copies the columns in the current row into the values pointed
+ * at by dest. The number of values in dest must be the same as the
+ * number of columns in Rows.
+ *
+ * Scan converts columns read from the database into the following
+ * common Go types and special types provided by the sql package:
+ *
+ * ```
+ * *string
+ * *[]byte
+ * *int, *int8, *int16, *int32, *int64
+ * *uint, *uint8, *uint16, *uint32, *uint64
+ * *bool
+ * *float32, *float64
+ * *interface{}
+ * *RawBytes
+ * *Rows (cursor value)
+ * any type implementing Scanner (see Scanner docs)
+ * ```
+ *
+ * In the most simple case, if the type of the value from the source
+ * column is an integer, bool or string type T and dest is of type *T,
+ * Scan simply assigns the value through the pointer.
+ *
+ * Scan also converts between string and numeric types, as long as no
+ * information would be lost. While Scan stringifies all numbers
+ * scanned from numeric database columns into *string, scans into
+ * numeric types are checked for overflow. For example, a float64 with
+ * value 300 or a string with value "300" can scan into a uint16, but
+ * not into a uint8, though float64(255) or "255" can scan into a
+ * uint8. One exception is that scans of some float64 numbers to
+ * strings may lose information when stringifying. In general, scan
+ * floating point columns into *float64.
+ *
+ * If a dest argument has type *[]byte, Scan saves in that argument a
+ * copy of the corresponding data. The copy is owned by the caller and
+ * can be modified and held indefinitely. The copy can be avoided by
+ * using an argument of type *RawBytes instead; see the documentation
+ * for RawBytes for restrictions on its use.
+ *
+ * If an argument has type *interface{}, Scan copies the value
+ * provided by the underlying driver without conversion. When scanning
+ * from a source value of type []byte to *interface{}, a copy of the
+ * slice is made and the caller owns the result.
+ *
+ * Source values of type time.Time may be scanned into values of type
+ * *time.Time, *interface{}, *string, or *[]byte. When converting to
+ * the latter two, time.RFC3339Nano is used.
+ *
+ * Source values of type bool may be scanned into types *bool,
+ * *interface{}, *string, *[]byte, or *RawBytes.
+ *
+ * For scanning into *bool, the source may be true, false, 1, 0, or
+ * string inputs parseable by strconv.ParseBool.
+ *
+ * Scan can also convert a cursor returned from a query, such as
+ * "select cursor(select * from my_table) from dual", into a
+ * *Rows value that can itself be scanned from. The parent
+ * select query will close any cursor *Rows if the parent *Rows is closed.
+ *
+ * If any of the first arguments implementing Scanner returns an error,
+ * that error will be wrapped in the returned error
+ */
+ scan(...dest: any[]): void
+ }
+ interface Rows {
+ /**
+ * Close closes the Rows, preventing further enumeration. If Next is called
+ * and returns false and there are no further result sets,
+ * the Rows are closed automatically and it will suffice to check the
+ * result of Err. Close is idempotent and does not affect the result of Err.
+ */
+ close(): void
}
/**
- * Provider defines a common interface for an OAuth2 client.
+ * A Result summarizes an executed SQL command.
*/
- interface Provider {
+ interface Result {
/**
- * Scopes returns the context associated with the provider (if any).
+ * LastInsertId returns the integer generated by the database
+ * in response to a command. Typically this will be from an
+ * "auto increment" column when inserting a new row. Not all
+ * databases support this feature, and the syntax of such
+ * statements varies.
*/
- context(): context.Context
+ lastInsertId(): number
/**
- * SetContext assigns the specified context to the current provider.
+ * RowsAffected returns the number of rows affected by an
+ * update, insert, or delete. Not every database or database
+ * driver may support this.
*/
- setContext(ctx: context.Context): void
- /**
- * Scopes returns the provider access permissions that will be requested.
- */
- scopes(): Array
- /**
- * SetScopes sets the provider access permissions that will be requested later.
- */
- setScopes(scopes: Array): void
- /**
- * ClientId returns the provider client's app ID.
- */
- clientId(): string
- /**
- * SetClientId sets the provider client's ID.
- */
- setClientId(clientId: string): void
- /**
- * ClientSecret returns the provider client's app secret.
- */
- clientSecret(): string
- /**
- * SetClientSecret sets the provider client's app secret.
- */
- setClientSecret(secret: string): void
- /**
- * RedirectUrl returns the end address to redirect the user
- * going through the OAuth flow.
- */
- redirectUrl(): string
- /**
- * SetRedirectUrl sets the provider's RedirectUrl.
- */
- setRedirectUrl(url: string): void
- /**
- * AuthUrl returns the provider's authorization service url.
- */
- authUrl(): string
- /**
- * SetAuthUrl sets the provider's AuthUrl.
- */
- setAuthUrl(url: string): void
- /**
- * TokenUrl returns the provider's token exchange service url.
- */
- tokenUrl(): string
- /**
- * SetTokenUrl sets the provider's TokenUrl.
- */
- setTokenUrl(url: string): void
- /**
- * UserApiUrl returns the provider's user info api url.
- */
- userApiUrl(): string
- /**
- * SetUserApiUrl sets the provider's UserApiUrl.
- */
- setUserApiUrl(url: string): void
- /**
- * Client returns an http client using the provided token.
- */
- client(token: oauth2.Token): (http.Client | undefined)
- /**
- * BuildAuthUrl returns a URL to the provider's consent page
- * that asks for permissions for the required scopes explicitly.
- */
- buildAuthUrl(state: string, ...opts: oauth2.AuthCodeOption[]): string
- /**
- * FetchToken converts an authorization code to token.
- */
- fetchToken(code: string, ...opts: oauth2.AuthCodeOption[]): (oauth2.Token | undefined)
- /**
- * FetchRawUserData requests and marshalizes into `result` the
- * the OAuth user api response.
- */
- fetchRawUserData(token: oauth2.Token): string
- /**
- * FetchAuthUser is similar to FetchRawUserData, but normalizes and
- * marshalizes the user api response into a standardized AuthUser struct.
- */
- fetchAuthUser(token: oauth2.Token): (AuthUser | undefined)
+ rowsAffected(): number
}
}
@@ -7474,6 +6858,636 @@ namespace echo {
}
}
+/**
+ * Package models implements all PocketBase DB models and DTOs.
+ */
+namespace models {
+ type _subyitqV = BaseModel
+ interface Admin extends _subyitqV {
+ avatar: number
+ email: string
+ tokenKey: string
+ passwordHash: string
+ lastResetSentAt: types.DateTime
+ }
+ interface Admin {
+ /**
+ * TableName returns the Admin model SQL table name.
+ */
+ tableName(): string
+ }
+ interface Admin {
+ /**
+ * ValidatePassword validates a plain password against the model's password.
+ */
+ validatePassword(password: string): boolean
+ }
+ interface Admin {
+ /**
+ * SetPassword sets cryptographically secure string to `model.Password`.
+ *
+ * Additionally this method also resets the LastResetSentAt and the TokenKey fields.
+ */
+ setPassword(password: string): void
+ }
+ interface Admin {
+ /**
+ * RefreshTokenKey generates and sets new random token key.
+ */
+ refreshTokenKey(): void
+ }
+ // @ts-ignore
+ import validation = ozzo_validation
+ type _subXsndz = BaseModel
+ interface Collection extends _subXsndz {
+ name: string
+ type: string
+ system: boolean
+ schema: schema.Schema
+ indexes: types.JsonArray
+ /**
+ * rules
+ */
+ listRule?: string
+ viewRule?: string
+ createRule?: string
+ updateRule?: string
+ deleteRule?: string
+ options: types.JsonMap
+ }
+ interface Collection {
+ /**
+ * TableName returns the Collection model SQL table name.
+ */
+ tableName(): string
+ }
+ interface Collection {
+ /**
+ * BaseFilesPath returns the storage dir path used by the collection.
+ */
+ baseFilesPath(): string
+ }
+ interface Collection {
+ /**
+ * IsBase checks if the current collection has "base" type.
+ */
+ isBase(): boolean
+ }
+ interface Collection {
+ /**
+ * IsAuth checks if the current collection has "auth" type.
+ */
+ isAuth(): boolean
+ }
+ interface Collection {
+ /**
+ * IsView checks if the current collection has "view" type.
+ */
+ isView(): boolean
+ }
+ interface Collection {
+ /**
+ * MarshalJSON implements the [json.Marshaler] interface.
+ */
+ marshalJSON(): string
+ }
+ interface Collection {
+ /**
+ * BaseOptions decodes the current collection options and returns them
+ * as new [CollectionBaseOptions] instance.
+ */
+ baseOptions(): CollectionBaseOptions
+ }
+ interface Collection {
+ /**
+ * AuthOptions decodes the current collection options and returns them
+ * as new [CollectionAuthOptions] instance.
+ */
+ authOptions(): CollectionAuthOptions
+ }
+ interface Collection {
+ /**
+ * ViewOptions decodes the current collection options and returns them
+ * as new [CollectionViewOptions] instance.
+ */
+ viewOptions(): CollectionViewOptions
+ }
+ interface Collection {
+ /**
+ * NormalizeOptions updates the current collection options with a
+ * new normalized state based on the collection type.
+ */
+ normalizeOptions(): void
+ }
+ interface Collection {
+ /**
+ * DecodeOptions decodes the current collection options into the
+ * provided "result" (must be a pointer).
+ */
+ decodeOptions(result: any): void
+ }
+ interface Collection {
+ /**
+ * SetOptions normalizes and unmarshals the specified options into m.Options.
+ */
+ setOptions(typedOptions: any): void
+ }
+ type _subVrAFq = BaseModel
+ interface ExternalAuth extends _subVrAFq {
+ collectionId: string
+ recordId: string
+ provider: string
+ providerId: string
+ }
+ interface ExternalAuth {
+ tableName(): string
+ }
+ type _subpIimo = BaseModel
+ interface Record extends _subpIimo {
+ }
+ interface Record {
+ /**
+ * TableName returns the table name associated to the current Record model.
+ */
+ tableName(): string
+ }
+ interface Record {
+ /**
+ * Collection returns the Collection model associated to the current Record model.
+ */
+ collection(): (Collection | undefined)
+ }
+ interface Record {
+ /**
+ * OriginalCopy returns a copy of the current record model populated
+ * with its ORIGINAL data state (aka. the initially loaded) and
+ * everything else reset to the defaults.
+ */
+ originalCopy(): (Record | undefined)
+ }
+ interface Record {
+ /**
+ * CleanCopy returns a copy of the current record model populated only
+ * with its LATEST data state and everything else reset to the defaults.
+ */
+ cleanCopy(): (Record | undefined)
+ }
+ interface Record {
+ /**
+ * Expand returns a shallow copy of the current Record model expand data.
+ */
+ expand(): _TygojaDict
+ }
+ interface Record {
+ /**
+ * SetExpand shallow copies the provided data to the current Record model's expand.
+ */
+ setExpand(expand: _TygojaDict): void
+ }
+ interface Record {
+ /**
+ * MergeExpand merges recursively the provided expand data into
+ * the current model's expand (if any).
+ *
+ * Note that if an expanded prop with the same key is a slice (old or new expand)
+ * then both old and new records will be merged into a new slice (aka. a :merge: [b,c] => [a,b,c]).
+ * Otherwise the "old" expanded record will be replace with the "new" one (aka. a :merge: aNew => aNew).
+ */
+ mergeExpand(expand: _TygojaDict): void
+ }
+ interface Record {
+ /**
+ * SchemaData returns a shallow copy ONLY of the defined record schema fields data.
+ */
+ schemaData(): _TygojaDict
+ }
+ interface Record {
+ /**
+ * UnknownData returns a shallow copy ONLY of the unknown record fields data,
+ * aka. fields that are neither one of the base and special system ones,
+ * nor defined by the collection schema.
+ */
+ unknownData(): _TygojaDict
+ }
+ interface Record {
+ /**
+ * IgnoreEmailVisibility toggles the flag to ignore the auth record email visibility check.
+ */
+ ignoreEmailVisibility(state: boolean): void
+ }
+ interface Record {
+ /**
+ * WithUnknownData toggles the export/serialization of unknown data fields
+ * (false by default).
+ */
+ withUnknownData(state: boolean): void
+ }
+ interface Record {
+ /**
+ * Set sets the provided key-value data pair for the current Record model.
+ *
+ * If the record collection has field with name matching the provided "key",
+ * the value will be further normalized according to the field rules.
+ */
+ set(key: string, value: any): void
+ }
+ interface Record {
+ /**
+ * Get returns a single record model data value for "key".
+ */
+ get(key: string): any
+ }
+ interface Record {
+ /**
+ * GetBool returns the data value for "key" as a bool.
+ */
+ getBool(key: string): boolean
+ }
+ interface Record {
+ /**
+ * GetString returns the data value for "key" as a string.
+ */
+ getString(key: string): string
+ }
+ interface Record {
+ /**
+ * GetInt returns the data value for "key" as an int.
+ */
+ getInt(key: string): number
+ }
+ interface Record {
+ /**
+ * GetFloat returns the data value for "key" as a float64.
+ */
+ getFloat(key: string): number
+ }
+ interface Record {
+ /**
+ * GetTime returns the data value for "key" as a [time.Time] instance.
+ */
+ getTime(key: string): time.Time
+ }
+ interface Record {
+ /**
+ * GetDateTime returns the data value for "key" as a DateTime instance.
+ */
+ getDateTime(key: string): types.DateTime
+ }
+ interface Record {
+ /**
+ * GetStringSlice returns the data value for "key" as a slice of unique strings.
+ */
+ getStringSlice(key: string): Array
+ }
+ interface Record {
+ /**
+ * Retrieves the "key" json field value and unmarshals it into "result".
+ *
+ * Example
+ *
+ * ```
+ * result := struct {
+ * FirstName string `json:"first_name"`
+ * }{}
+ * err := m.UnmarshalJSONField("my_field_name", &result)
+ * ```
+ */
+ unmarshalJSONField(key: string, result: any): void
+ }
+ interface Record {
+ /**
+ * BaseFilesPath returns the storage dir path used by the record.
+ */
+ baseFilesPath(): string
+ }
+ interface Record {
+ /**
+ * FindFileFieldByFile returns the first file type field for which
+ * any of the record's data contains the provided filename.
+ */
+ findFileFieldByFile(filename: string): (schema.SchemaField | undefined)
+ }
+ interface Record {
+ /**
+ * Load bulk loads the provided data into the current Record model.
+ */
+ load(data: _TygojaDict): void
+ }
+ interface Record {
+ /**
+ * ColumnValueMap implements [ColumnValueMapper] interface.
+ */
+ columnValueMap(): _TygojaDict
+ }
+ interface Record {
+ /**
+ * PublicExport exports only the record fields that are safe to be public.
+ *
+ * Fields marked as hidden will be exported only if `m.IgnoreEmailVisibility(true)` is set.
+ */
+ publicExport(): _TygojaDict
+ }
+ interface Record {
+ /**
+ * MarshalJSON implements the [json.Marshaler] interface.
+ *
+ * Only the data exported by `PublicExport()` will be serialized.
+ */
+ marshalJSON(): string
+ }
+ interface Record {
+ /**
+ * UnmarshalJSON implements the [json.Unmarshaler] interface.
+ */
+ unmarshalJSON(data: string): void
+ }
+ interface Record {
+ /**
+ * ReplaceModifers returns a new map with applied modifier
+ * values based on the current record and the specified data.
+ *
+ * The resolved modifier keys will be removed.
+ *
+ * Multiple modifiers will be applied one after another,
+ * while reusing the previous base key value result (eg. 1; -5; +2 => -2).
+ *
+ * Example usage:
+ *
+ * ```
+ * newData := record.ReplaceModifers(data)
+ * // record: {"field": 10}
+ * // data: {"field+": 5}
+ * // newData: {"field": 15}
+ * ```
+ */
+ replaceModifers(data: _TygojaDict): _TygojaDict
+ }
+ interface Record {
+ /**
+ * Username returns the "username" auth record data value.
+ */
+ username(): string
+ }
+ interface Record {
+ /**
+ * SetUsername sets the "username" auth record data value.
+ *
+ * This method doesn't check whether the provided value is a valid username.
+ *
+ * Returns an error if the record is not from an auth collection.
+ */
+ setUsername(username: string): void
+ }
+ interface Record {
+ /**
+ * Email returns the "email" auth record data value.
+ */
+ email(): string
+ }
+ interface Record {
+ /**
+ * SetEmail sets the "email" auth record data value.
+ *
+ * This method doesn't check whether the provided value is a valid email.
+ *
+ * Returns an error if the record is not from an auth collection.
+ */
+ setEmail(email: string): void
+ }
+ interface Record {
+ /**
+ * Verified returns the "emailVisibility" auth record data value.
+ */
+ emailVisibility(): boolean
+ }
+ interface Record {
+ /**
+ * SetEmailVisibility sets the "emailVisibility" auth record data value.
+ *
+ * Returns an error if the record is not from an auth collection.
+ */
+ setEmailVisibility(visible: boolean): void
+ }
+ interface Record {
+ /**
+ * Verified returns the "verified" auth record data value.
+ */
+ verified(): boolean
+ }
+ interface Record {
+ /**
+ * SetVerified sets the "verified" auth record data value.
+ *
+ * Returns an error if the record is not from an auth collection.
+ */
+ setVerified(verified: boolean): void
+ }
+ interface Record {
+ /**
+ * TokenKey returns the "tokenKey" auth record data value.
+ */
+ tokenKey(): string
+ }
+ interface Record {
+ /**
+ * SetTokenKey sets the "tokenKey" auth record data value.
+ *
+ * Returns an error if the record is not from an auth collection.
+ */
+ setTokenKey(key: string): void
+ }
+ interface Record {
+ /**
+ * RefreshTokenKey generates and sets new random auth record "tokenKey".
+ *
+ * Returns an error if the record is not from an auth collection.
+ */
+ refreshTokenKey(): void
+ }
+ interface Record {
+ /**
+ * LastResetSentAt returns the "lastResentSentAt" auth record data value.
+ */
+ lastResetSentAt(): types.DateTime
+ }
+ interface Record {
+ /**
+ * SetLastResetSentAt sets the "lastResentSentAt" auth record data value.
+ *
+ * Returns an error if the record is not from an auth collection.
+ */
+ setLastResetSentAt(dateTime: types.DateTime): void
+ }
+ interface Record {
+ /**
+ * LastVerificationSentAt returns the "lastVerificationSentAt" auth record data value.
+ */
+ lastVerificationSentAt(): types.DateTime
+ }
+ interface Record {
+ /**
+ * SetLastVerificationSentAt sets an "lastVerificationSentAt" auth record data value.
+ *
+ * Returns an error if the record is not from an auth collection.
+ */
+ setLastVerificationSentAt(dateTime: types.DateTime): void
+ }
+ interface Record {
+ /**
+ * PasswordHash returns the "passwordHash" auth record data value.
+ */
+ passwordHash(): string
+ }
+ interface Record {
+ /**
+ * ValidatePassword validates a plain password against the auth record password.
+ *
+ * Returns false if the password is incorrect or record is not from an auth collection.
+ */
+ validatePassword(password: string): boolean
+ }
+ interface Record {
+ /**
+ * SetPassword sets cryptographically secure string to the auth record "password" field.
+ * This method also resets the "lastResetSentAt" and the "tokenKey" fields.
+ *
+ * Returns an error if the record is not from an auth collection or
+ * an empty password is provided.
+ */
+ setPassword(password: string): void
+ }
+ /**
+ * RequestData defines a HTTP request data struct, usually used
+ * as part of the `@request.*` filter resolver.
+ */
+ interface RequestData {
+ method: string
+ query: _TygojaDict
+ /**
+ * @todo consider changing to Body?
+ */
+ data: _TygojaDict
+ headers: _TygojaDict
+ authRecord?: Record
+ admin?: Admin
+ }
+ interface RequestData {
+ /**
+ * HasModifierDataKeys loosely checks if the current struct has any modifier Data keys.
+ */
+ hasModifierDataKeys(): boolean
+ }
+}
+
+namespace auth {
+ /**
+ * AuthUser defines a standardized oauth2 user data structure.
+ */
+ interface AuthUser {
+ id: string
+ name: string
+ username: string
+ email: string
+ avatarUrl: string
+ rawUser: _TygojaDict
+ accessToken: string
+ refreshToken: string
+ }
+ /**
+ * Provider defines a common interface for an OAuth2 client.
+ */
+ interface Provider {
+ /**
+ * Scopes returns the context associated with the provider (if any).
+ */
+ context(): context.Context
+ /**
+ * SetContext assigns the specified context to the current provider.
+ */
+ setContext(ctx: context.Context): void
+ /**
+ * Scopes returns the provider access permissions that will be requested.
+ */
+ scopes(): Array
+ /**
+ * SetScopes sets the provider access permissions that will be requested later.
+ */
+ setScopes(scopes: Array): void
+ /**
+ * ClientId returns the provider client's app ID.
+ */
+ clientId(): string
+ /**
+ * SetClientId sets the provider client's ID.
+ */
+ setClientId(clientId: string): void
+ /**
+ * ClientSecret returns the provider client's app secret.
+ */
+ clientSecret(): string
+ /**
+ * SetClientSecret sets the provider client's app secret.
+ */
+ setClientSecret(secret: string): void
+ /**
+ * RedirectUrl returns the end address to redirect the user
+ * going through the OAuth flow.
+ */
+ redirectUrl(): string
+ /**
+ * SetRedirectUrl sets the provider's RedirectUrl.
+ */
+ setRedirectUrl(url: string): void
+ /**
+ * AuthUrl returns the provider's authorization service url.
+ */
+ authUrl(): string
+ /**
+ * SetAuthUrl sets the provider's AuthUrl.
+ */
+ setAuthUrl(url: string): void
+ /**
+ * TokenUrl returns the provider's token exchange service url.
+ */
+ tokenUrl(): string
+ /**
+ * SetTokenUrl sets the provider's TokenUrl.
+ */
+ setTokenUrl(url: string): void
+ /**
+ * UserApiUrl returns the provider's user info api url.
+ */
+ userApiUrl(): string
+ /**
+ * SetUserApiUrl sets the provider's UserApiUrl.
+ */
+ setUserApiUrl(url: string): void
+ /**
+ * Client returns an http client using the provided token.
+ */
+ client(token: oauth2.Token): (http.Client | undefined)
+ /**
+ * BuildAuthUrl returns a URL to the provider's consent page
+ * that asks for permissions for the required scopes explicitly.
+ */
+ buildAuthUrl(state: string, ...opts: oauth2.AuthCodeOption[]): string
+ /**
+ * FetchToken converts an authorization code to token.
+ */
+ fetchToken(code: string, ...opts: oauth2.AuthCodeOption[]): (oauth2.Token | undefined)
+ /**
+ * FetchRawUserData requests and marshalizes into `result` the
+ * the OAuth user api response.
+ */
+ fetchRawUserData(token: oauth2.Token): string
+ /**
+ * FetchAuthUser is similar to FetchRawUserData, but normalizes and
+ * marshalizes the user api response into a standardized AuthUser struct.
+ */
+ fetchAuthUser(token: oauth2.Token): (AuthUser | undefined)
+ }
+}
+
namespace settings {
// @ts-ignore
import validation = ozzo_validation
@@ -8177,6 +8191,878 @@ namespace daos {
}
}
+/**
+ * Package core is the backbone of PocketBase.
+ *
+ * It defines the main PocketBase App interface and its base implementation.
+ */
+namespace core {
+ /**
+ * App defines the main PocketBase app interface.
+ */
+ interface App {
+ /**
+ * Deprecated:
+ * This method may get removed in the near future.
+ * It is recommended to access the app db instance from app.Dao().DB() or
+ * if you want more flexibility - app.Dao().ConcurrentDB() and app.Dao().NonconcurrentDB().
+ *
+ * DB returns the default app database instance.
+ */
+ db(): (dbx.DB | undefined)
+ /**
+ * Dao returns the default app Dao instance.
+ *
+ * This Dao could operate only on the tables and models
+ * associated with the default app database. For example,
+ * trying to access the request logs table will result in error.
+ */
+ dao(): (daos.Dao | undefined)
+ /**
+ * Deprecated:
+ * This method may get removed in the near future.
+ * It is recommended to access the logs db instance from app.LogsDao().DB() or
+ * if you want more flexibility - app.LogsDao().ConcurrentDB() and app.LogsDao().NonconcurrentDB().
+ *
+ * LogsDB returns the app logs database instance.
+ */
+ logsDB(): (dbx.DB | undefined)
+ /**
+ * LogsDao returns the app logs Dao instance.
+ *
+ * This Dao could operate only on the tables and models
+ * associated with the logs database. For example, trying to access
+ * the users table from LogsDao will result in error.
+ */
+ logsDao(): (daos.Dao | undefined)
+ /**
+ * DataDir returns the app data directory path.
+ */
+ dataDir(): string
+ /**
+ * EncryptionEnv returns the name of the app secret env key
+ * (used for settings encryption).
+ */
+ encryptionEnv(): string
+ /**
+ * IsDebug returns whether the app is in debug mode
+ * (showing more detailed error logs, executed sql statements, etc.).
+ */
+ isDebug(): boolean
+ /**
+ * Settings returns the loaded app settings.
+ */
+ settings(): (settings.Settings | undefined)
+ /**
+ * Cache returns the app internal cache store.
+ */
+ cache(): (store.Store | undefined)
+ /**
+ * SubscriptionsBroker returns the app realtime subscriptions broker instance.
+ */
+ subscriptionsBroker(): (subscriptions.Broker | undefined)
+ /**
+ * NewMailClient creates and returns a configured app mail client.
+ */
+ newMailClient(): mailer.Mailer
+ /**
+ * NewFilesystem creates and returns a configured filesystem.System instance
+ * for managing regular app files (eg. collection uploads).
+ *
+ * NB! Make sure to call Close() on the returned result
+ * after you are done working with it.
+ */
+ newFilesystem(): (filesystem.System | undefined)
+ /**
+ * NewBackupsFilesystem creates and returns a configured filesystem.System instance
+ * for managing app backups.
+ *
+ * NB! Make sure to call Close() on the returned result
+ * after you are done working with it.
+ */
+ newBackupsFilesystem(): (filesystem.System | undefined)
+ /**
+ * RefreshSettings reinitializes and reloads the stored application settings.
+ */
+ refreshSettings(): void
+ /**
+ * IsBootstrapped checks if the application was initialized
+ * (aka. whether Bootstrap() was called).
+ */
+ isBootstrapped(): boolean
+ /**
+ * Bootstrap takes care for initializing the application
+ * (open db connections, load settings, etc.).
+ *
+ * It will call ResetBootstrapState() if the application was already bootstrapped.
+ */
+ bootstrap(): void
+ /**
+ * ResetBootstrapState takes care for releasing initialized app resources
+ * (eg. closing db connections).
+ */
+ resetBootstrapState(): void
+ /**
+ * CreateBackup creates a new backup of the current app pb_data directory.
+ *
+ * Backups can be stored on S3 if it is configured in app.Settings().Backups.
+ *
+ * Please refer to the godoc of the specific core.App implementation
+ * for details on the backup procedures.
+ */
+ createBackup(ctx: context.Context, name: string): void
+ /**
+ * RestoreBackup restores the backup with the specified name and restarts
+ * the current running application process.
+ *
+ * The safely perform the restore it is recommended to have free disk space
+ * for at least 2x the size of the restored pb_data backup.
+ *
+ * Please refer to the godoc of the specific core.App implementation
+ * for details on the restore procedures.
+ *
+ * NB! This feature is experimental and currently is expected to work only on UNIX based systems.
+ */
+ restoreBackup(ctx: context.Context, name: string): void
+ /**
+ * Restart restarts the current running application process.
+ *
+ * Currently it is relying on execve so it is supported only on UNIX based systems.
+ */
+ restart(): void
+ /**
+ * OnBeforeBootstrap hook is triggered before initializing the main
+ * application resources (eg. before db open and initial settings load).
+ */
+ onBeforeBootstrap(): (hook.Hook | undefined)
+ /**
+ * OnAfterBootstrap hook is triggered after initializing the main
+ * application resources (eg. after db open and initial settings load).
+ */
+ onAfterBootstrap(): (hook.Hook | undefined)
+ /**
+ * OnBeforeServe hook is triggered before serving the internal router (echo),
+ * allowing you to adjust its options and attach new routes or middlewares.
+ */
+ onBeforeServe(): (hook.Hook | undefined)
+ /**
+ * OnBeforeApiError hook is triggered right before sending an error API
+ * response to the client, allowing you to further modify the error data
+ * or to return a completely different API response.
+ */
+ onBeforeApiError(): (hook.Hook | undefined)
+ /**
+ * OnAfterApiError hook is triggered right after sending an error API
+ * response to the client.
+ * It could be used to log the final API error in external services.
+ */
+ onAfterApiError(): (hook.Hook | undefined)
+ /**
+ * OnTerminate hook is triggered when the app is in the process
+ * of being terminated (eg. on SIGTERM signal).
+ */
+ onTerminate(): (hook.Hook | undefined)
+ /**
+ * OnModelBeforeCreate hook is triggered before inserting a new
+ * entry in the DB, allowing you to modify or validate the stored data.
+ *
+ * If the optional "tags" list (table names and/or the Collection id for Record models)
+ * is specified, then all event handlers registered via the created hook
+ * will be triggered and called only if their event data origin matches the tags.
+ */
+ onModelBeforeCreate(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnModelAfterCreate hook is triggered after successfully
+ * inserting a new entry in the DB.
+ *
+ * If the optional "tags" list (table names and/or the Collection id for Record models)
+ * is specified, then all event handlers registered via the created hook
+ * will be triggered and called only if their event data origin matches the tags.
+ */
+ onModelAfterCreate(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnModelBeforeUpdate hook is triggered before updating existing
+ * entry in the DB, allowing you to modify or validate the stored data.
+ *
+ * If the optional "tags" list (table names and/or the Collection id for Record models)
+ * is specified, then all event handlers registered via the created hook
+ * will be triggered and called only if their event data origin matches the tags.
+ */
+ onModelBeforeUpdate(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnModelAfterUpdate hook is triggered after successfully updating
+ * existing entry in the DB.
+ *
+ * If the optional "tags" list (table names and/or the Collection id for Record models)
+ * is specified, then all event handlers registered via the created hook
+ * will be triggered and called only if their event data origin matches the tags.
+ */
+ onModelAfterUpdate(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnModelBeforeDelete hook is triggered before deleting an
+ * existing entry from the DB.
+ *
+ * If the optional "tags" list (table names and/or the Collection id for Record models)
+ * is specified, then all event handlers registered via the created hook
+ * will be triggered and called only if their event data origin matches the tags.
+ */
+ onModelBeforeDelete(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnModelAfterDelete hook is triggered after successfully deleting an
+ * existing entry from the DB.
+ *
+ * If the optional "tags" list (table names and/or the Collection id for Record models)
+ * is specified, then all event handlers registered via the created hook
+ * will be triggered and called only if their event data origin matches the tags.
+ */
+ onModelAfterDelete(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnMailerBeforeAdminResetPasswordSend hook is triggered right
+ * before sending a password reset email to an admin, allowing you
+ * to inspect and customize the email message that is being sent.
+ */
+ onMailerBeforeAdminResetPasswordSend(): (hook.Hook | undefined)
+ /**
+ * OnMailerAfterAdminResetPasswordSend hook is triggered after
+ * admin password reset email was successfully sent.
+ */
+ onMailerAfterAdminResetPasswordSend(): (hook.Hook | undefined)
+ /**
+ * OnMailerBeforeRecordResetPasswordSend hook is triggered right
+ * before sending a password reset email to an auth record, allowing
+ * you to inspect and customize the email message that is being sent.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onMailerBeforeRecordResetPasswordSend(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnMailerAfterRecordResetPasswordSend hook is triggered after
+ * an auth record password reset email was successfully sent.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onMailerAfterRecordResetPasswordSend(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnMailerBeforeRecordVerificationSend hook is triggered right
+ * before sending a verification email to an auth record, allowing
+ * you to inspect and customize the email message that is being sent.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onMailerBeforeRecordVerificationSend(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnMailerAfterRecordVerificationSend hook is triggered after a
+ * verification email was successfully sent to an auth record.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onMailerAfterRecordVerificationSend(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnMailerBeforeRecordChangeEmailSend hook is triggered right before
+ * sending a confirmation new address email to an auth record, allowing
+ * you to inspect and customize the email message that is being sent.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onMailerBeforeRecordChangeEmailSend(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnMailerAfterRecordChangeEmailSend hook is triggered after a
+ * verification email was successfully sent to an auth record.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onMailerAfterRecordChangeEmailSend(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRealtimeConnectRequest hook is triggered right before establishing
+ * the SSE client connection.
+ */
+ onRealtimeConnectRequest(): (hook.Hook | undefined)
+ /**
+ * OnRealtimeDisconnectRequest hook is triggered on disconnected/interrupted
+ * SSE client connection.
+ */
+ onRealtimeDisconnectRequest(): (hook.Hook | undefined)
+ /**
+ * OnRealtimeBeforeMessage hook is triggered right before sending
+ * an SSE message to a client.
+ *
+ * Returning [hook.StopPropagation] will prevent sending the message.
+ * Returning any other non-nil error will close the realtime connection.
+ */
+ onRealtimeBeforeMessageSend(): (hook.Hook | undefined)
+ /**
+ * OnRealtimeBeforeMessage hook is triggered right after sending
+ * an SSE message to a client.
+ */
+ onRealtimeAfterMessageSend(): (hook.Hook | undefined)
+ /**
+ * OnRealtimeBeforeSubscribeRequest hook is triggered before changing
+ * the client subscriptions, allowing you to further validate and
+ * modify the submitted change.
+ */
+ onRealtimeBeforeSubscribeRequest(): (hook.Hook | undefined)
+ /**
+ * OnRealtimeAfterSubscribeRequest hook is triggered after the client
+ * subscriptions were successfully changed.
+ */
+ onRealtimeAfterSubscribeRequest(): (hook.Hook | undefined)
+ /**
+ * OnSettingsListRequest hook is triggered on each successful
+ * API Settings list request.
+ *
+ * Could be used to validate or modify the response before
+ * returning it to the client.
+ */
+ onSettingsListRequest(): (hook.Hook | undefined)
+ /**
+ * OnSettingsBeforeUpdateRequest hook is triggered before each API
+ * Settings update request (after request data load and before settings persistence).
+ *
+ * Could be used to additionally validate the request data or
+ * implement completely different persistence behavior.
+ */
+ onSettingsBeforeUpdateRequest(): (hook.Hook | undefined)
+ /**
+ * OnSettingsAfterUpdateRequest hook is triggered after each
+ * successful API Settings update request.
+ */
+ onSettingsAfterUpdateRequest(): (hook.Hook | undefined)
+ /**
+ * OnFileDownloadRequest hook is triggered before each API File download request.
+ *
+ * Could be used to validate or modify the file response before
+ * returning it to the client.
+ */
+ onFileDownloadRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnFileBeforeTokenRequest hook is triggered before each file
+ * token API request.
+ *
+ * If no token or model was submitted, e.Model and e.Token will be empty,
+ * allowing you to implement your own custom model file auth implementation.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onFileBeforeTokenRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnFileAfterTokenRequest hook is triggered after each
+ * successful file token API request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onFileAfterTokenRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnAdminsListRequest hook is triggered on each API Admins list request.
+ *
+ * Could be used to validate or modify the response before returning it to the client.
+ */
+ onAdminsListRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminViewRequest hook is triggered on each API Admin view request.
+ *
+ * Could be used to validate or modify the response before returning it to the client.
+ */
+ onAdminViewRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminBeforeCreateRequest hook is triggered before each API
+ * Admin create request (after request data load and before model persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ */
+ onAdminBeforeCreateRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminAfterCreateRequest hook is triggered after each
+ * successful API Admin create request.
+ */
+ onAdminAfterCreateRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminBeforeUpdateRequest hook is triggered before each API
+ * Admin update request (after request data load and before model persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ */
+ onAdminBeforeUpdateRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminAfterUpdateRequest hook is triggered after each
+ * successful API Admin update request.
+ */
+ onAdminAfterUpdateRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminBeforeDeleteRequest hook is triggered before each API
+ * Admin delete request (after model load and before actual deletion).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different delete behavior.
+ */
+ onAdminBeforeDeleteRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminAfterDeleteRequest hook is triggered after each
+ * successful API Admin delete request.
+ */
+ onAdminAfterDeleteRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminAuthRequest hook is triggered on each successful API Admin
+ * authentication request (sign-in, token refresh, etc.).
+ *
+ * Could be used to additionally validate or modify the
+ * authenticated admin data and token.
+ */
+ onAdminAuthRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminBeforeAuthWithPasswordRequest hook is triggered before each Admin
+ * auth with password API request (after request data load and before password validation).
+ *
+ * Could be used to implement for example a custom password validation
+ * or to locate a different Admin identity (by assigning [AdminAuthWithPasswordEvent.Admin]).
+ */
+ onAdminBeforeAuthWithPasswordRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminAfterAuthWithPasswordRequest hook is triggered after each
+ * successful Admin auth with password API request.
+ */
+ onAdminAfterAuthWithPasswordRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminBeforeAuthRefreshRequest hook is triggered before each Admin
+ * auth refresh API request (right before generating a new auth token).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different auth refresh behavior.
+ */
+ onAdminBeforeAuthRefreshRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminAfterAuthRefreshRequest hook is triggered after each
+ * successful auth refresh API request (right after generating a new auth token).
+ */
+ onAdminAfterAuthRefreshRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminBeforeRequestPasswordResetRequest hook is triggered before each Admin
+ * request password reset API request (after request data load and before sending the reset email).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different password reset behavior.
+ */
+ onAdminBeforeRequestPasswordResetRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminAfterRequestPasswordResetRequest hook is triggered after each
+ * successful request password reset API request.
+ */
+ onAdminAfterRequestPasswordResetRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminBeforeConfirmPasswordResetRequest hook is triggered before each Admin
+ * confirm password reset API request (after request data load and before persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ */
+ onAdminBeforeConfirmPasswordResetRequest(): (hook.Hook | undefined)
+ /**
+ * OnAdminAfterConfirmPasswordResetRequest hook is triggered after each
+ * successful confirm password reset API request.
+ */
+ onAdminAfterConfirmPasswordResetRequest(): (hook.Hook | undefined)
+ /**
+ * OnRecordAuthRequest hook is triggered on each successful API
+ * record authentication request (sign-in, token refresh, etc.).
+ *
+ * Could be used to additionally validate or modify the authenticated
+ * record data and token.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAuthRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeAuthWithPasswordRequest hook is triggered before each Record
+ * auth with password API request (after request data load and before password validation).
+ *
+ * Could be used to implement for example a custom password validation
+ * or to locate a different Record model (by reassigning [RecordAuthWithPasswordEvent.Record]).
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeAuthWithPasswordRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterAuthWithPasswordRequest hook is triggered after each
+ * successful Record auth with password API request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterAuthWithPasswordRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeAuthWithOAuth2Request hook is triggered before each Record
+ * OAuth2 sign-in/sign-up API request (after token exchange and before external provider linking).
+ *
+ * If the [RecordAuthWithOAuth2Event.Record] is not set, then the OAuth2
+ * request will try to create a new auth Record.
+ *
+ * To assign or link a different existing record model you can
+ * change the [RecordAuthWithOAuth2Event.Record] field.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeAuthWithOAuth2Request(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterAuthWithOAuth2Request hook is triggered after each
+ * successful Record OAuth2 API request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterAuthWithOAuth2Request(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeAuthRefreshRequest hook is triggered before each Record
+ * auth refresh API request (right before generating a new auth token).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different auth refresh behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeAuthRefreshRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterAuthRefreshRequest hook is triggered after each
+ * successful auth refresh API request (right after generating a new auth token).
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterAuthRefreshRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordListExternalAuthsRequest hook is triggered on each API record external auths list request.
+ *
+ * Could be used to validate or modify the response before returning it to the client.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordListExternalAuthsRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeUnlinkExternalAuthRequest hook is triggered before each API record
+ * external auth unlink request (after models load and before the actual relation deletion).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different delete behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeUnlinkExternalAuthRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterUnlinkExternalAuthRequest hook is triggered after each
+ * successful API record external auth unlink request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterUnlinkExternalAuthRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeRequestPasswordResetRequest hook is triggered before each Record
+ * request password reset API request (after request data load and before sending the reset email).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different password reset behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeRequestPasswordResetRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterRequestPasswordResetRequest hook is triggered after each
+ * successful request password reset API request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterRequestPasswordResetRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeConfirmPasswordResetRequest hook is triggered before each Record
+ * confirm password reset API request (after request data load and before persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeConfirmPasswordResetRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterConfirmPasswordResetRequest hook is triggered after each
+ * successful confirm password reset API request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterConfirmPasswordResetRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeRequestVerificationRequest hook is triggered before each Record
+ * request verification API request (after request data load and before sending the verification email).
+ *
+ * Could be used to additionally validate the loaded request data or implement
+ * completely different verification behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeRequestVerificationRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterRequestVerificationRequest hook is triggered after each
+ * successful request verification API request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterRequestVerificationRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeConfirmVerificationRequest hook is triggered before each Record
+ * confirm verification API request (after request data load and before persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeConfirmVerificationRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterConfirmVerificationRequest hook is triggered after each
+ * successful confirm verification API request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterConfirmVerificationRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeRequestEmailChangeRequest hook is triggered before each Record request email change API request
+ * (after request data load and before sending the email link to confirm the change).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different request email change behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeRequestEmailChangeRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterRequestEmailChangeRequest hook is triggered after each
+ * successful request email change API request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterRequestEmailChangeRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeConfirmEmailChangeRequest hook is triggered before each Record
+ * confirm email change API request (after request data load and before persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeConfirmEmailChangeRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterConfirmEmailChangeRequest hook is triggered after each
+ * successful confirm email change API request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterConfirmEmailChangeRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordsListRequest hook is triggered on each API Records list request.
+ *
+ * Could be used to validate or modify the response before returning it to the client.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordsListRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordViewRequest hook is triggered on each API Record view request.
+ *
+ * Could be used to validate or modify the response before returning it to the client.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordViewRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeCreateRequest hook is triggered before each API Record
+ * create request (after request data load and before model persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeCreateRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterCreateRequest hook is triggered after each
+ * successful API Record create request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterCreateRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeUpdateRequest hook is triggered before each API Record
+ * update request (after request data load and before model persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeUpdateRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterUpdateRequest hook is triggered after each
+ * successful API Record update request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterUpdateRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordBeforeDeleteRequest hook is triggered before each API Record
+ * delete request (after model load and before actual deletion).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different delete behavior.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordBeforeDeleteRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnRecordAfterDeleteRequest hook is triggered after each
+ * successful API Record delete request.
+ *
+ * If the optional "tags" list (Collection ids or names) is specified,
+ * then all event handlers registered via the created hook will be
+ * triggered and called only if their event data origin matches the tags.
+ */
+ onRecordAfterDeleteRequest(...tags: string[]): (hook.TaggedHook | undefined)
+ /**
+ * OnCollectionsListRequest hook is triggered on each API Collections list request.
+ *
+ * Could be used to validate or modify the response before returning it to the client.
+ */
+ onCollectionsListRequest(): (hook.Hook | undefined)
+ /**
+ * OnCollectionViewRequest hook is triggered on each API Collection view request.
+ *
+ * Could be used to validate or modify the response before returning it to the client.
+ */
+ onCollectionViewRequest(): (hook.Hook | undefined)
+ /**
+ * OnCollectionBeforeCreateRequest hook is triggered before each API Collection
+ * create request (after request data load and before model persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ */
+ onCollectionBeforeCreateRequest(): (hook.Hook | undefined)
+ /**
+ * OnCollectionAfterCreateRequest hook is triggered after each
+ * successful API Collection create request.
+ */
+ onCollectionAfterCreateRequest(): (hook.Hook | undefined)
+ /**
+ * OnCollectionBeforeUpdateRequest hook is triggered before each API Collection
+ * update request (after request data load and before model persistence).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different persistence behavior.
+ */
+ onCollectionBeforeUpdateRequest(): (hook.Hook | undefined)
+ /**
+ * OnCollectionAfterUpdateRequest hook is triggered after each
+ * successful API Collection update request.
+ */
+ onCollectionAfterUpdateRequest(): (hook.Hook | undefined)
+ /**
+ * OnCollectionBeforeDeleteRequest hook is triggered before each API
+ * Collection delete request (after model load and before actual deletion).
+ *
+ * Could be used to additionally validate the request data or implement
+ * completely different delete behavior.
+ */
+ onCollectionBeforeDeleteRequest(): (hook.Hook | undefined)
+ /**
+ * OnCollectionAfterDeleteRequest hook is triggered after each
+ * successful API Collection delete request.
+ */
+ onCollectionAfterDeleteRequest(): (hook.Hook | undefined)
+ /**
+ * OnCollectionsBeforeImportRequest hook is triggered before each API
+ * collections import request (after request data load and before the actual import).
+ *
+ * Could be used to additionally validate the imported collections or
+ * to implement completely different import behavior.
+ */
+ onCollectionsBeforeImportRequest(): (hook.Hook | undefined)
+ /**
+ * OnCollectionsAfterImportRequest hook is triggered after each
+ * successful API collections import request.
+ */
+ onCollectionsAfterImportRequest(): (hook.Hook | undefined)
+ }
+}
+
/**
* Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
* In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code.
@@ -9214,943 +10100,6 @@ namespace cobra {
}
}
-/**
- * Package core is the backbone of PocketBase.
- *
- * It defines the main PocketBase App interface and its base implementation.
- */
-namespace core {
- /**
- * App defines the main PocketBase app interface.
- */
- interface App {
- /**
- * Deprecated:
- * This method may get removed in the near future.
- * It is recommended to access the app db instance from app.Dao().DB() or
- * if you want more flexibility - app.Dao().ConcurrentDB() and app.Dao().NonconcurrentDB().
- *
- * DB returns the default app database instance.
- */
- db(): (dbx.DB | undefined)
- /**
- * Dao returns the default app Dao instance.
- *
- * This Dao could operate only on the tables and models
- * associated with the default app database. For example,
- * trying to access the request logs table will result in error.
- */
- dao(): (daos.Dao | undefined)
- /**
- * Deprecated:
- * This method may get removed in the near future.
- * It is recommended to access the logs db instance from app.LogsDao().DB() or
- * if you want more flexibility - app.LogsDao().ConcurrentDB() and app.LogsDao().NonconcurrentDB().
- *
- * LogsDB returns the app logs database instance.
- */
- logsDB(): (dbx.DB | undefined)
- /**
- * LogsDao returns the app logs Dao instance.
- *
- * This Dao could operate only on the tables and models
- * associated with the logs database. For example, trying to access
- * the users table from LogsDao will result in error.
- */
- logsDao(): (daos.Dao | undefined)
- /**
- * DataDir returns the app data directory path.
- */
- dataDir(): string
- /**
- * EncryptionEnv returns the name of the app secret env key
- * (used for settings encryption).
- */
- encryptionEnv(): string
- /**
- * IsDebug returns whether the app is in debug mode
- * (showing more detailed error logs, executed sql statements, etc.).
- */
- isDebug(): boolean
- /**
- * Settings returns the loaded app settings.
- */
- settings(): (settings.Settings | undefined)
- /**
- * Cache returns the app internal cache store.
- */
- cache(): (store.Store | undefined)
- /**
- * SubscriptionsBroker returns the app realtime subscriptions broker instance.
- */
- subscriptionsBroker(): (subscriptions.Broker | undefined)
- /**
- * NewMailClient creates and returns a configured app mail client.
- */
- newMailClient(): mailer.Mailer
- /**
- * NewFilesystem creates and returns a configured filesystem.System instance
- * for managing regular app files (eg. collection uploads).
- *
- * NB! Make sure to call Close() on the returned result
- * after you are done working with it.
- */
- newFilesystem(): (filesystem.System | undefined)
- /**
- * NewBackupsFilesystem creates and returns a configured filesystem.System instance
- * for managing app backups.
- *
- * NB! Make sure to call Close() on the returned result
- * after you are done working with it.
- */
- newBackupsFilesystem(): (filesystem.System | undefined)
- /**
- * RefreshSettings reinitializes and reloads the stored application settings.
- */
- refreshSettings(): void
- /**
- * IsBootstrapped checks if the application was initialized
- * (aka. whether Bootstrap() was called).
- */
- isBootstrapped(): boolean
- /**
- * Bootstrap takes care for initializing the application
- * (open db connections, load settings, etc.).
- *
- * It will call ResetBootstrapState() if the application was already bootstrapped.
- */
- bootstrap(): void
- /**
- * ResetBootstrapState takes care for releasing initialized app resources
- * (eg. closing db connections).
- */
- resetBootstrapState(): void
- /**
- * CreateBackup creates a new backup of the current app pb_data directory.
- *
- * Backups can be stored on S3 if it is configured in app.Settings().Backups.
- *
- * Please refer to the godoc of the specific core.App implementation
- * for details on the backup procedures.
- */
- createBackup(ctx: context.Context, name: string): void
- /**
- * RestoreBackup restores the backup with the specified name and restarts
- * the current running application process.
- *
- * The safely perform the restore it is recommended to have free disk space
- * for at least 2x the size of the restored pb_data backup.
- *
- * Please refer to the godoc of the specific core.App implementation
- * for details on the restore procedures.
- *
- * NB! This feature is experimental and currently is expected to work only on UNIX based systems.
- */
- restoreBackup(ctx: context.Context, name: string): void
- /**
- * Restart restarts the current running application process.
- *
- * Currently it is relying on execve so it is supported only on UNIX based systems.
- */
- restart(): void
- /**
- * OnBeforeBootstrap hook is triggered before initializing the main
- * application resources (eg. before db open and initial settings load).
- */
- onBeforeBootstrap(): (hook.Hook | undefined)
- /**
- * OnAfterBootstrap hook is triggered after initializing the main
- * application resources (eg. after db open and initial settings load).
- */
- onAfterBootstrap(): (hook.Hook | undefined)
- /**
- * OnBeforeServe hook is triggered before serving the internal router (echo),
- * allowing you to adjust its options and attach new routes or middlewares.
- */
- onBeforeServe(): (hook.Hook | undefined)
- /**
- * OnBeforeApiError hook is triggered right before sending an error API
- * response to the client, allowing you to further modify the error data
- * or to return a completely different API response.
- */
- onBeforeApiError(): (hook.Hook | undefined)
- /**
- * OnAfterApiError hook is triggered right after sending an error API
- * response to the client.
- * It could be used to log the final API error in external services.
- */
- onAfterApiError(): (hook.Hook | undefined)
- /**
- * OnTerminate hook is triggered when the app is in the process
- * of being terminated (eg. on SIGTERM signal).
- */
- onTerminate(): (hook.Hook | undefined)
- /**
- * OnModelBeforeCreate hook is triggered before inserting a new
- * entry in the DB, allowing you to modify or validate the stored data.
- *
- * If the optional "tags" list (table names and/or the Collection id for Record models)
- * is specified, then all event handlers registered via the created hook
- * will be triggered and called only if their event data origin matches the tags.
- */
- onModelBeforeCreate(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnModelAfterCreate hook is triggered after successfully
- * inserting a new entry in the DB.
- *
- * If the optional "tags" list (table names and/or the Collection id for Record models)
- * is specified, then all event handlers registered via the created hook
- * will be triggered and called only if their event data origin matches the tags.
- */
- onModelAfterCreate(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnModelBeforeUpdate hook is triggered before updating existing
- * entry in the DB, allowing you to modify or validate the stored data.
- *
- * If the optional "tags" list (table names and/or the Collection id for Record models)
- * is specified, then all event handlers registered via the created hook
- * will be triggered and called only if their event data origin matches the tags.
- */
- onModelBeforeUpdate(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnModelAfterUpdate hook is triggered after successfully updating
- * existing entry in the DB.
- *
- * If the optional "tags" list (table names and/or the Collection id for Record models)
- * is specified, then all event handlers registered via the created hook
- * will be triggered and called only if their event data origin matches the tags.
- */
- onModelAfterUpdate(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnModelBeforeDelete hook is triggered before deleting an
- * existing entry from the DB.
- *
- * If the optional "tags" list (table names and/or the Collection id for Record models)
- * is specified, then all event handlers registered via the created hook
- * will be triggered and called only if their event data origin matches the tags.
- */
- onModelBeforeDelete(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnModelAfterDelete hook is triggered after successfully deleting an
- * existing entry from the DB.
- *
- * If the optional "tags" list (table names and/or the Collection id for Record models)
- * is specified, then all event handlers registered via the created hook
- * will be triggered and called only if their event data origin matches the tags.
- */
- onModelAfterDelete(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnMailerBeforeAdminResetPasswordSend hook is triggered right
- * before sending a password reset email to an admin, allowing you
- * to inspect and customize the email message that is being sent.
- */
- onMailerBeforeAdminResetPasswordSend(): (hook.Hook | undefined)
- /**
- * OnMailerAfterAdminResetPasswordSend hook is triggered after
- * admin password reset email was successfully sent.
- */
- onMailerAfterAdminResetPasswordSend(): (hook.Hook | undefined)
- /**
- * OnMailerBeforeRecordResetPasswordSend hook is triggered right
- * before sending a password reset email to an auth record, allowing
- * you to inspect and customize the email message that is being sent.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerBeforeRecordResetPasswordSend(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnMailerAfterRecordResetPasswordSend hook is triggered after
- * an auth record password reset email was successfully sent.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerAfterRecordResetPasswordSend(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnMailerBeforeRecordVerificationSend hook is triggered right
- * before sending a verification email to an auth record, allowing
- * you to inspect and customize the email message that is being sent.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerBeforeRecordVerificationSend(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnMailerAfterRecordVerificationSend hook is triggered after a
- * verification email was successfully sent to an auth record.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerAfterRecordVerificationSend(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnMailerBeforeRecordChangeEmailSend hook is triggered right before
- * sending a confirmation new address email to an auth record, allowing
- * you to inspect and customize the email message that is being sent.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerBeforeRecordChangeEmailSend(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnMailerAfterRecordChangeEmailSend hook is triggered after a
- * verification email was successfully sent to an auth record.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onMailerAfterRecordChangeEmailSend(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRealtimeConnectRequest hook is triggered right before establishing
- * the SSE client connection.
- */
- onRealtimeConnectRequest(): (hook.Hook | undefined)
- /**
- * OnRealtimeDisconnectRequest hook is triggered on disconnected/interrupted
- * SSE client connection.
- */
- onRealtimeDisconnectRequest(): (hook.Hook | undefined)
- /**
- * OnRealtimeBeforeMessage hook is triggered right before sending
- * an SSE message to a client.
- *
- * Returning [hook.StopPropagation] will prevent sending the message.
- * Returning any other non-nil error will close the realtime connection.
- */
- onRealtimeBeforeMessageSend(): (hook.Hook | undefined)
- /**
- * OnRealtimeBeforeMessage hook is triggered right after sending
- * an SSE message to a client.
- */
- onRealtimeAfterMessageSend(): (hook.Hook | undefined)
- /**
- * OnRealtimeBeforeSubscribeRequest hook is triggered before changing
- * the client subscriptions, allowing you to further validate and
- * modify the submitted change.
- */
- onRealtimeBeforeSubscribeRequest(): (hook.Hook | undefined)
- /**
- * OnRealtimeAfterSubscribeRequest hook is triggered after the client
- * subscriptions were successfully changed.
- */
- onRealtimeAfterSubscribeRequest(): (hook.Hook | undefined)
- /**
- * OnSettingsListRequest hook is triggered on each successful
- * API Settings list request.
- *
- * Could be used to validate or modify the response before
- * returning it to the client.
- */
- onSettingsListRequest(): (hook.Hook | undefined)
- /**
- * OnSettingsBeforeUpdateRequest hook is triggered before each API
- * Settings update request (after request data load and before settings persistence).
- *
- * Could be used to additionally validate the request data or
- * implement completely different persistence behavior.
- */
- onSettingsBeforeUpdateRequest(): (hook.Hook | undefined)
- /**
- * OnSettingsAfterUpdateRequest hook is triggered after each
- * successful API Settings update request.
- */
- onSettingsAfterUpdateRequest(): (hook.Hook | undefined)
- /**
- * OnFileDownloadRequest hook is triggered before each API File download request.
- *
- * Could be used to validate or modify the file response before
- * returning it to the client.
- */
- onFileDownloadRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnFileBeforeTokenRequest hook is triggered before each file
- * token API request.
- *
- * If no token or model was submitted, e.Model and e.Token will be empty,
- * allowing you to implement your own custom model file auth implementation.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onFileBeforeTokenRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnFileAfterTokenRequest hook is triggered after each
- * successful file token API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onFileAfterTokenRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnAdminsListRequest hook is triggered on each API Admins list request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- */
- onAdminsListRequest(): (hook.Hook | undefined)
- /**
- * OnAdminViewRequest hook is triggered on each API Admin view request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- */
- onAdminViewRequest(): (hook.Hook | undefined)
- /**
- * OnAdminBeforeCreateRequest hook is triggered before each API
- * Admin create request (after request data load and before model persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- */
- onAdminBeforeCreateRequest(): (hook.Hook | undefined)
- /**
- * OnAdminAfterCreateRequest hook is triggered after each
- * successful API Admin create request.
- */
- onAdminAfterCreateRequest(): (hook.Hook | undefined)
- /**
- * OnAdminBeforeUpdateRequest hook is triggered before each API
- * Admin update request (after request data load and before model persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- */
- onAdminBeforeUpdateRequest(): (hook.Hook | undefined)
- /**
- * OnAdminAfterUpdateRequest hook is triggered after each
- * successful API Admin update request.
- */
- onAdminAfterUpdateRequest(): (hook.Hook | undefined)
- /**
- * OnAdminBeforeDeleteRequest hook is triggered before each API
- * Admin delete request (after model load and before actual deletion).
- *
- * Could be used to additionally validate the request data or implement
- * completely different delete behavior.
- */
- onAdminBeforeDeleteRequest(): (hook.Hook | undefined)
- /**
- * OnAdminAfterDeleteRequest hook is triggered after each
- * successful API Admin delete request.
- */
- onAdminAfterDeleteRequest(): (hook.Hook | undefined)
- /**
- * OnAdminAuthRequest hook is triggered on each successful API Admin
- * authentication request (sign-in, token refresh, etc.).
- *
- * Could be used to additionally validate or modify the
- * authenticated admin data and token.
- */
- onAdminAuthRequest(): (hook.Hook | undefined)
- /**
- * OnAdminBeforeAuthWithPasswordRequest hook is triggered before each Admin
- * auth with password API request (after request data load and before password validation).
- *
- * Could be used to implement for example a custom password validation
- * or to locate a different Admin identity (by assigning [AdminAuthWithPasswordEvent.Admin]).
- */
- onAdminBeforeAuthWithPasswordRequest(): (hook.Hook | undefined)
- /**
- * OnAdminAfterAuthWithPasswordRequest hook is triggered after each
- * successful Admin auth with password API request.
- */
- onAdminAfterAuthWithPasswordRequest(): (hook.Hook | undefined)
- /**
- * OnAdminBeforeAuthRefreshRequest hook is triggered before each Admin
- * auth refresh API request (right before generating a new auth token).
- *
- * Could be used to additionally validate the request data or implement
- * completely different auth refresh behavior.
- */
- onAdminBeforeAuthRefreshRequest(): (hook.Hook | undefined)
- /**
- * OnAdminAfterAuthRefreshRequest hook is triggered after each
- * successful auth refresh API request (right after generating a new auth token).
- */
- onAdminAfterAuthRefreshRequest(): (hook.Hook | undefined)
- /**
- * OnAdminBeforeRequestPasswordResetRequest hook is triggered before each Admin
- * request password reset API request (after request data load and before sending the reset email).
- *
- * Could be used to additionally validate the request data or implement
- * completely different password reset behavior.
- */
- onAdminBeforeRequestPasswordResetRequest(): (hook.Hook | undefined)
- /**
- * OnAdminAfterRequestPasswordResetRequest hook is triggered after each
- * successful request password reset API request.
- */
- onAdminAfterRequestPasswordResetRequest(): (hook.Hook | undefined)
- /**
- * OnAdminBeforeConfirmPasswordResetRequest hook is triggered before each Admin
- * confirm password reset API request (after request data load and before persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- */
- onAdminBeforeConfirmPasswordResetRequest(): (hook.Hook | undefined)
- /**
- * OnAdminAfterConfirmPasswordResetRequest hook is triggered after each
- * successful confirm password reset API request.
- */
- onAdminAfterConfirmPasswordResetRequest(): (hook.Hook | undefined)
- /**
- * OnRecordAuthRequest hook is triggered on each successful API
- * record authentication request (sign-in, token refresh, etc.).
- *
- * Could be used to additionally validate or modify the authenticated
- * record data and token.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAuthRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeAuthWithPasswordRequest hook is triggered before each Record
- * auth with password API request (after request data load and before password validation).
- *
- * Could be used to implement for example a custom password validation
- * or to locate a different Record model (by reassigning [RecordAuthWithPasswordEvent.Record]).
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeAuthWithPasswordRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterAuthWithPasswordRequest hook is triggered after each
- * successful Record auth with password API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterAuthWithPasswordRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeAuthWithOAuth2Request hook is triggered before each Record
- * OAuth2 sign-in/sign-up API request (after token exchange and before external provider linking).
- *
- * If the [RecordAuthWithOAuth2Event.Record] is not set, then the OAuth2
- * request will try to create a new auth Record.
- *
- * To assign or link a different existing record model you can
- * change the [RecordAuthWithOAuth2Event.Record] field.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeAuthWithOAuth2Request(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterAuthWithOAuth2Request hook is triggered after each
- * successful Record OAuth2 API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterAuthWithOAuth2Request(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeAuthRefreshRequest hook is triggered before each Record
- * auth refresh API request (right before generating a new auth token).
- *
- * Could be used to additionally validate the request data or implement
- * completely different auth refresh behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeAuthRefreshRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterAuthRefreshRequest hook is triggered after each
- * successful auth refresh API request (right after generating a new auth token).
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterAuthRefreshRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordListExternalAuthsRequest hook is triggered on each API record external auths list request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordListExternalAuthsRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeUnlinkExternalAuthRequest hook is triggered before each API record
- * external auth unlink request (after models load and before the actual relation deletion).
- *
- * Could be used to additionally validate the request data or implement
- * completely different delete behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeUnlinkExternalAuthRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterUnlinkExternalAuthRequest hook is triggered after each
- * successful API record external auth unlink request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterUnlinkExternalAuthRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeRequestPasswordResetRequest hook is triggered before each Record
- * request password reset API request (after request data load and before sending the reset email).
- *
- * Could be used to additionally validate the request data or implement
- * completely different password reset behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeRequestPasswordResetRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterRequestPasswordResetRequest hook is triggered after each
- * successful request password reset API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterRequestPasswordResetRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeConfirmPasswordResetRequest hook is triggered before each Record
- * confirm password reset API request (after request data load and before persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeConfirmPasswordResetRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterConfirmPasswordResetRequest hook is triggered after each
- * successful confirm password reset API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterConfirmPasswordResetRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeRequestVerificationRequest hook is triggered before each Record
- * request verification API request (after request data load and before sending the verification email).
- *
- * Could be used to additionally validate the loaded request data or implement
- * completely different verification behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeRequestVerificationRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterRequestVerificationRequest hook is triggered after each
- * successful request verification API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterRequestVerificationRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeConfirmVerificationRequest hook is triggered before each Record
- * confirm verification API request (after request data load and before persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeConfirmVerificationRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterConfirmVerificationRequest hook is triggered after each
- * successful confirm verification API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterConfirmVerificationRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeRequestEmailChangeRequest hook is triggered before each Record request email change API request
- * (after request data load and before sending the email link to confirm the change).
- *
- * Could be used to additionally validate the request data or implement
- * completely different request email change behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeRequestEmailChangeRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterRequestEmailChangeRequest hook is triggered after each
- * successful request email change API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterRequestEmailChangeRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeConfirmEmailChangeRequest hook is triggered before each Record
- * confirm email change API request (after request data load and before persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeConfirmEmailChangeRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterConfirmEmailChangeRequest hook is triggered after each
- * successful confirm email change API request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterConfirmEmailChangeRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordsListRequest hook is triggered on each API Records list request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordsListRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordViewRequest hook is triggered on each API Record view request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordViewRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeCreateRequest hook is triggered before each API Record
- * create request (after request data load and before model persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeCreateRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterCreateRequest hook is triggered after each
- * successful API Record create request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterCreateRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeUpdateRequest hook is triggered before each API Record
- * update request (after request data load and before model persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeUpdateRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterUpdateRequest hook is triggered after each
- * successful API Record update request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterUpdateRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordBeforeDeleteRequest hook is triggered before each API Record
- * delete request (after model load and before actual deletion).
- *
- * Could be used to additionally validate the request data or implement
- * completely different delete behavior.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordBeforeDeleteRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnRecordAfterDeleteRequest hook is triggered after each
- * successful API Record delete request.
- *
- * If the optional "tags" list (Collection ids or names) is specified,
- * then all event handlers registered via the created hook will be
- * triggered and called only if their event data origin matches the tags.
- */
- onRecordAfterDeleteRequest(...tags: string[]): (hook.TaggedHook | undefined)
- /**
- * OnCollectionsListRequest hook is triggered on each API Collections list request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- */
- onCollectionsListRequest(): (hook.Hook | undefined)
- /**
- * OnCollectionViewRequest hook is triggered on each API Collection view request.
- *
- * Could be used to validate or modify the response before returning it to the client.
- */
- onCollectionViewRequest(): (hook.Hook | undefined)
- /**
- * OnCollectionBeforeCreateRequest hook is triggered before each API Collection
- * create request (after request data load and before model persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- */
- onCollectionBeforeCreateRequest(): (hook.Hook | undefined)
- /**
- * OnCollectionAfterCreateRequest hook is triggered after each
- * successful API Collection create request.
- */
- onCollectionAfterCreateRequest(): (hook.Hook | undefined)
- /**
- * OnCollectionBeforeUpdateRequest hook is triggered before each API Collection
- * update request (after request data load and before model persistence).
- *
- * Could be used to additionally validate the request data or implement
- * completely different persistence behavior.
- */
- onCollectionBeforeUpdateRequest(): (hook.Hook | undefined)
- /**
- * OnCollectionAfterUpdateRequest hook is triggered after each
- * successful API Collection update request.
- */
- onCollectionAfterUpdateRequest(): (hook.Hook | undefined)
- /**
- * OnCollectionBeforeDeleteRequest hook is triggered before each API
- * Collection delete request (after model load and before actual deletion).
- *
- * Could be used to additionally validate the request data or implement
- * completely different delete behavior.
- */
- onCollectionBeforeDeleteRequest(): (hook.Hook | undefined)
- /**
- * OnCollectionAfterDeleteRequest hook is triggered after each
- * successful API Collection delete request.
- */
- onCollectionAfterDeleteRequest(): (hook.Hook | undefined)
- /**
- * OnCollectionsBeforeImportRequest hook is triggered before each API
- * collections import request (after request data load and before the actual import).
- *
- * Could be used to additionally validate the imported collections or
- * to implement completely different import behavior.
- */
- onCollectionsBeforeImportRequest(): (hook.Hook | undefined)
- /**
- * OnCollectionsAfterImportRequest hook is triggered after each
- * successful API collections import request.
- */
- onCollectionsAfterImportRequest(): (hook.Hook | undefined)
- }
-}
-
-/**
- * Package io provides basic interfaces to I/O primitives.
- * Its primary job is to wrap existing implementations of such primitives,
- * such as those in package os, into shared public interfaces that
- * abstract the functionality, plus some other related primitives.
- *
- * Because these interfaces and primitives wrap lower-level operations with
- * various implementations, unless otherwise informed clients should not
- * assume they are safe for parallel execution.
- */
-namespace io {
- /**
- * Reader is the interface that wraps the basic Read method.
- *
- * Read reads up to len(p) bytes into p. It returns the number of bytes
- * read (0 <= n <= len(p)) and any error encountered. Even if Read
- * returns n < len(p), it may use all of p as scratch space during the call.
- * If some data is available but not len(p) bytes, Read conventionally
- * returns what is available instead of waiting for more.
- *
- * When Read encounters an error or end-of-file condition after
- * successfully reading n > 0 bytes, it returns the number of
- * bytes read. It may return the (non-nil) error from the same call
- * or return the error (and n == 0) from a subsequent call.
- * An instance of this general case is that a Reader returning
- * a non-zero number of bytes at the end of the input stream may
- * return either err == EOF or err == nil. The next Read should
- * return 0, EOF.
- *
- * Callers should always process the n > 0 bytes returned before
- * considering the error err. Doing so correctly handles I/O errors
- * that happen after reading some bytes and also both of the
- * allowed EOF behaviors.
- *
- * Implementations of Read are discouraged from returning a
- * zero byte count with a nil error, except when len(p) == 0.
- * Callers should treat a return of 0 and nil as indicating that
- * nothing happened; in particular it does not indicate EOF.
- *
- * Implementations must not retain p.
- */
- interface Reader {
- read(p: string): number
- }
- /**
- * Writer is the interface that wraps the basic Write method.
- *
- * Write writes len(p) bytes from p to the underlying data stream.
- * It returns the number of bytes written from p (0 <= n <= len(p))
- * and any error encountered that caused the write to stop early.
- * Write must return a non-nil error if it returns n < len(p).
- * Write must not modify the slice data, even temporarily.
- *
- * Implementations must not retain p.
- */
- interface Writer {
- write(p: string): number
- }
- /**
- * ReadCloser is the interface that groups the basic Read and Close methods.
- */
- interface ReadCloser {
- }
-}
-
/**
* Package time provides functionality for measuring and displaying time.
*
@@ -10626,25 +10575,6 @@ namespace time {
}
}
-/**
- * Package fs defines basic interfaces to a file system.
- * A file system can be provided by the host operating system
- * but also by other packages.
- */
-namespace fs {
- /**
- * A File provides access to a single file.
- * The File interface is the minimum implementation required of the file.
- * Directory files should also implement ReadDirFile.
- * A file may implement io.ReaderAt or io.Seeker as optimizations.
- */
- interface File {
- stat(): FileInfo
- read(_arg0: string): number
- close(): void
- }
-}
-
/**
* Package context defines the Context type, which carries deadlines,
* cancellation signals, and other request-scoped values across API boundaries
@@ -10695,6 +10625,838 @@ namespace fs {
namespace context {
}
+/**
+ * Package io provides basic interfaces to I/O primitives.
+ * Its primary job is to wrap existing implementations of such primitives,
+ * such as those in package os, into shared public interfaces that
+ * abstract the functionality, plus some other related primitives.
+ *
+ * Because these interfaces and primitives wrap lower-level operations with
+ * various implementations, unless otherwise informed clients should not
+ * assume they are safe for parallel execution.
+ */
+namespace io {
+ /**
+ * Reader is the interface that wraps the basic Read method.
+ *
+ * Read reads up to len(p) bytes into p. It returns the number of bytes
+ * read (0 <= n <= len(p)) and any error encountered. Even if Read
+ * returns n < len(p), it may use all of p as scratch space during the call.
+ * If some data is available but not len(p) bytes, Read conventionally
+ * returns what is available instead of waiting for more.
+ *
+ * When Read encounters an error or end-of-file condition after
+ * successfully reading n > 0 bytes, it returns the number of
+ * bytes read. It may return the (non-nil) error from the same call
+ * or return the error (and n == 0) from a subsequent call.
+ * An instance of this general case is that a Reader returning
+ * a non-zero number of bytes at the end of the input stream may
+ * return either err == EOF or err == nil. The next Read should
+ * return 0, EOF.
+ *
+ * Callers should always process the n > 0 bytes returned before
+ * considering the error err. Doing so correctly handles I/O errors
+ * that happen after reading some bytes and also both of the
+ * allowed EOF behaviors.
+ *
+ * Implementations of Read are discouraged from returning a
+ * zero byte count with a nil error, except when len(p) == 0.
+ * Callers should treat a return of 0 and nil as indicating that
+ * nothing happened; in particular it does not indicate EOF.
+ *
+ * Implementations must not retain p.
+ */
+ interface Reader {
+ read(p: string): number
+ }
+ /**
+ * Writer is the interface that wraps the basic Write method.
+ *
+ * Write writes len(p) bytes from p to the underlying data stream.
+ * It returns the number of bytes written from p (0 <= n <= len(p))
+ * and any error encountered that caused the write to stop early.
+ * Write must return a non-nil error if it returns n < len(p).
+ * Write must not modify the slice data, even temporarily.
+ *
+ * Implementations must not retain p.
+ */
+ interface Writer {
+ write(p: string): number
+ }
+ /**
+ * ReadCloser is the interface that groups the basic Read and Close methods.
+ */
+ interface ReadCloser {
+ }
+}
+
+namespace store {
+ /**
+ * Store defines a concurrent safe in memory key-value data store.
+ */
+ interface Store {
+ }
+ interface Store {
+ /**
+ * Reset clears the store and replaces the store data with a
+ * shallow copy of the provided newData.
+ */
+ reset(newData: _TygojaDict): void
+ }
+ interface Store {
+ /**
+ * Length returns the current number of elements in the store.
+ */
+ length(): number
+ }
+ interface Store {
+ /**
+ * RemoveAll removes all the existing store entries.
+ */
+ removeAll(): void
+ }
+ interface Store {
+ /**
+ * Remove removes a single entry from the store.
+ *
+ * Remove does nothing if key doesn't exist in the store.
+ */
+ remove(key: string): void
+ }
+ interface Store {
+ /**
+ * Has checks if element with the specified key exist or not.
+ */
+ has(key: string): boolean
+ }
+ interface Store {
+ /**
+ * Get returns a single element value from the store.
+ *
+ * If key is not set, the zero T value is returned.
+ */
+ get(key: string): T
+ }
+ interface Store {
+ /**
+ * GetAll returns a shallow copy of the current store data.
+ */
+ getAll(): _TygojaDict
+ }
+ interface Store {
+ /**
+ * Set sets (or overwrite if already exist) a new value for key.
+ */
+ set(key: string, value: T): void
+ }
+ interface Store {
+ /**
+ * SetIfLessThanLimit sets (or overwrite if already exist) a new value for key.
+ *
+ * This method is similar to Set() but **it will skip adding new elements**
+ * to the store if the store length has reached the specified limit.
+ * false is returned if maxAllowedElements limit is reached.
+ */
+ setIfLessThanLimit(key: string, value: T, maxAllowedElements: number): boolean
+ }
+}
+
+/**
+ * Package fs defines basic interfaces to a file system.
+ * A file system can be provided by the host operating system
+ * but also by other packages.
+ */
+namespace fs {
+ /**
+ * A File provides access to a single file.
+ * The File interface is the minimum implementation required of the file.
+ * Directory files should also implement ReadDirFile.
+ * A file may implement io.ReaderAt or io.Seeker as optimizations.
+ */
+ interface File {
+ stat(): FileInfo
+ read(_arg0: string): number
+ close(): void
+ }
+}
+
+/**
+ * Package driver defines interfaces to be implemented by database
+ * drivers as used by package sql.
+ *
+ * Most code should use package sql.
+ *
+ * The driver interface has evolved over time. Drivers should implement
+ * Connector and DriverContext interfaces.
+ * The Connector.Connect and Driver.Open methods should never return ErrBadConn.
+ * ErrBadConn should only be returned from Validator, SessionResetter, or
+ * a query method if the connection is already in an invalid (e.g. closed) state.
+ *
+ * All Conn implementations should implement the following interfaces:
+ * Pinger, SessionResetter, and Validator.
+ *
+ * If named parameters or context are supported, the driver's Conn should implement:
+ * ExecerContext, QueryerContext, ConnPrepareContext, and ConnBeginTx.
+ *
+ * To support custom data types, implement NamedValueChecker. NamedValueChecker
+ * also allows queries to accept per-query options as a parameter by returning
+ * ErrRemoveArgument from CheckNamedValue.
+ *
+ * If multiple result sets are supported, Rows should implement RowsNextResultSet.
+ * If the driver knows how to describe the types present in the returned result
+ * it should implement the following interfaces: RowsColumnTypeScanType,
+ * RowsColumnTypeDatabaseTypeName, RowsColumnTypeLength, RowsColumnTypeNullable,
+ * and RowsColumnTypePrecisionScale. A given row value may also return a Rows
+ * type, which may represent a database cursor value.
+ *
+ * Before a connection is returned to the connection pool after use, IsValid is
+ * called if implemented. Before a connection is reused for another query,
+ * ResetSession is called if implemented. If a connection is never returned to the
+ * connection pool but immediately reused, then ResetSession is called prior to
+ * reuse but IsValid is not called.
+ */
+namespace driver {
+ /**
+ * Value is a value that drivers must be able to handle.
+ * It is either nil, a type handled by a database driver's NamedValueChecker
+ * interface, or an instance of one of these types:
+ *
+ * ```
+ * int64
+ * float64
+ * bool
+ * []byte
+ * string
+ * time.Time
+ * ```
+ *
+ * If the driver supports cursors, a returned Value may also implement the Rows interface
+ * in this package. This is used, for example, when a user selects a cursor
+ * such as "select cursor(select * from my_table) from dual". If the Rows
+ * from the select is closed, the cursor Rows will also be closed.
+ */
+ interface Value extends _TygojaAny{}
+ /**
+ * Driver is the interface that must be implemented by a database
+ * driver.
+ *
+ * Database drivers may implement DriverContext for access
+ * to contexts and to parse the name only once for a pool of connections,
+ * instead of once per connection.
+ */
+ interface Driver {
+ /**
+ * Open returns a new connection to the database.
+ * The name is a string in a driver-specific format.
+ *
+ * Open may return a cached connection (one previously
+ * closed), but doing so is unnecessary; the sql package
+ * maintains a pool of idle connections for efficient re-use.
+ *
+ * The returned connection is only used by one goroutine at a
+ * time.
+ */
+ open(name: string): Conn
+ }
+}
+
+/**
+ * Package url parses URLs and implements query escaping.
+ */
+namespace url {
+ /**
+ * A URL represents a parsed URL (technically, a URI reference).
+ *
+ * The general form represented is:
+ *
+ * ```
+ * [scheme:][//[userinfo@]host][/]path[?query][#fragment]
+ * ```
+ *
+ * URLs that do not start with a slash after the scheme are interpreted as:
+ *
+ * ```
+ * scheme:opaque[?query][#fragment]
+ * ```
+ *
+ * Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.
+ * A consequence is that it is impossible to tell which slashes in the Path were
+ * slashes in the raw URL and which were %2f. This distinction is rarely important,
+ * but when it is, the code should use RawPath, an optional field which only gets
+ * set if the default encoding is different from Path.
+ *
+ * URL's String method uses the EscapedPath method to obtain the path. See the
+ * EscapedPath method for more details.
+ */
+ interface URL {
+ scheme: string
+ opaque: string // encoded opaque data
+ user?: Userinfo // username and password information
+ host: string // host or host:port
+ path: string // path (relative paths may omit leading slash)
+ rawPath: string // encoded path hint (see EscapedPath method)
+ omitHost: boolean // do not emit empty host (authority)
+ forceQuery: boolean // append a query ('?') even if RawQuery is empty
+ rawQuery: string // encoded query values, without '?'
+ fragment: string // fragment for references, without '#'
+ rawFragment: string // encoded fragment hint (see EscapedFragment method)
+ }
+ interface URL {
+ /**
+ * EscapedPath returns the escaped form of u.Path.
+ * In general there are multiple possible escaped forms of any path.
+ * EscapedPath returns u.RawPath when it is a valid escaping of u.Path.
+ * Otherwise EscapedPath ignores u.RawPath and computes an escaped
+ * form on its own.
+ * The String and RequestURI methods use EscapedPath to construct
+ * their results.
+ * In general, code should call EscapedPath instead of
+ * reading u.RawPath directly.
+ */
+ escapedPath(): string
+ }
+ interface URL {
+ /**
+ * EscapedFragment returns the escaped form of u.Fragment.
+ * In general there are multiple possible escaped forms of any fragment.
+ * EscapedFragment returns u.RawFragment when it is a valid escaping of u.Fragment.
+ * Otherwise EscapedFragment ignores u.RawFragment and computes an escaped
+ * form on its own.
+ * The String method uses EscapedFragment to construct its result.
+ * In general, code should call EscapedFragment instead of
+ * reading u.RawFragment directly.
+ */
+ escapedFragment(): string
+ }
+ interface URL {
+ /**
+ * String reassembles the URL into a valid URL string.
+ * The general form of the result is one of:
+ *
+ * ```
+ * scheme:opaque?query#fragment
+ * scheme://userinfo@host/path?query#fragment
+ * ```
+ *
+ * If u.Opaque is non-empty, String uses the first form;
+ * otherwise it uses the second form.
+ * Any non-ASCII characters in host are escaped.
+ * To obtain the path, String uses u.EscapedPath().
+ *
+ * In the second form, the following rules apply:
+ * ```
+ * - if u.Scheme is empty, scheme: is omitted.
+ * - if u.User is nil, userinfo@ is omitted.
+ * - if u.Host is empty, host/ is omitted.
+ * - if u.Scheme and u.Host are empty and u.User is nil,
+ * the entire scheme://userinfo@host/ is omitted.
+ * - if u.Host is non-empty and u.Path begins with a /,
+ * the form host/path does not add its own /.
+ * - if u.RawQuery is empty, ?query is omitted.
+ * - if u.Fragment is empty, #fragment is omitted.
+ * ```
+ */
+ string(): string
+ }
+ interface URL {
+ /**
+ * Redacted is like String but replaces any password with "xxxxx".
+ * Only the password in u.URL is redacted.
+ */
+ redacted(): string
+ }
+ /**
+ * Values maps a string key to a list of values.
+ * It is typically used for query parameters and form values.
+ * Unlike in the http.Header map, the keys in a Values map
+ * are case-sensitive.
+ */
+ interface Values extends _TygojaDict{}
+ interface Values {
+ /**
+ * Get gets the first value associated with the given key.
+ * If there are no values associated with the key, Get returns
+ * the empty string. To access multiple values, use the map
+ * directly.
+ */
+ get(key: string): string
+ }
+ interface Values {
+ /**
+ * Set sets the key to value. It replaces any existing
+ * values.
+ */
+ set(key: string): void
+ }
+ interface Values {
+ /**
+ * Add adds the value to key. It appends to any existing
+ * values associated with key.
+ */
+ add(key: string): void
+ }
+ interface Values {
+ /**
+ * Del deletes the values associated with key.
+ */
+ del(key: string): void
+ }
+ interface Values {
+ /**
+ * Has checks whether a given key is set.
+ */
+ has(key: string): boolean
+ }
+ interface Values {
+ /**
+ * Encode encodes the values into “URL encoded” form
+ * ("bar=baz&foo=quux") sorted by key.
+ */
+ encode(): string
+ }
+ interface URL {
+ /**
+ * IsAbs reports whether the URL is absolute.
+ * Absolute means that it has a non-empty scheme.
+ */
+ isAbs(): boolean
+ }
+ interface URL {
+ /**
+ * Parse parses a URL in the context of the receiver. The provided URL
+ * may be relative or absolute. Parse returns nil, err on parse
+ * failure, otherwise its return value is the same as ResolveReference.
+ */
+ parse(ref: string): (URL | undefined)
+ }
+ interface URL {
+ /**
+ * ResolveReference resolves a URI reference to an absolute URI from
+ * an absolute base URI u, per RFC 3986 Section 5.2. The URI reference
+ * may be relative or absolute. ResolveReference always returns a new
+ * URL instance, even if the returned URL is identical to either the
+ * base or reference. If ref is an absolute URL, then ResolveReference
+ * ignores base and returns a copy of ref.
+ */
+ resolveReference(ref: URL): (URL | undefined)
+ }
+ interface URL {
+ /**
+ * Query parses RawQuery and returns the corresponding values.
+ * It silently discards malformed value pairs.
+ * To check errors use ParseQuery.
+ */
+ query(): Values
+ }
+ interface URL {
+ /**
+ * RequestURI returns the encoded path?query or opaque?query
+ * string that would be used in an HTTP request for u.
+ */
+ requestURI(): string
+ }
+ interface URL {
+ /**
+ * Hostname returns u.Host, stripping any valid port number if present.
+ *
+ * If the result is enclosed in square brackets, as literal IPv6 addresses are,
+ * the square brackets are removed from the result.
+ */
+ hostname(): string
+ }
+ interface URL {
+ /**
+ * Port returns the port part of u.Host, without the leading colon.
+ *
+ * If u.Host doesn't contain a valid numeric port, Port returns an empty string.
+ */
+ port(): string
+ }
+ interface URL {
+ marshalBinary(): string
+ }
+ interface URL {
+ unmarshalBinary(text: string): void
+ }
+ interface URL {
+ /**
+ * JoinPath returns a new URL with the provided path elements joined to
+ * any existing path and the resulting path cleaned of any ./ or ../ elements.
+ * Any sequences of multiple / characters will be reduced to a single /.
+ */
+ joinPath(...elem: string[]): (URL | undefined)
+ }
+}
+
+/**
+ * Package types implements some commonly used db serializable types
+ * like datetime, json, etc.
+ */
+namespace types {
+ /**
+ * DateTime represents a [time.Time] instance in UTC that is wrapped
+ * and serialized using the app default date layout.
+ */
+ interface DateTime {
+ }
+ interface DateTime {
+ /**
+ * Time returns the internal [time.Time] instance.
+ */
+ time(): time.Time
+ }
+ interface DateTime {
+ /**
+ * IsZero checks whether the current DateTime instance has zero time value.
+ */
+ isZero(): boolean
+ }
+ interface DateTime {
+ /**
+ * String serializes the current DateTime instance into a formatted
+ * UTC date string.
+ *
+ * The zero value is serialized to an empty string.
+ */
+ string(): string
+ }
+ interface DateTime {
+ /**
+ * MarshalJSON implements the [json.Marshaler] interface.
+ */
+ marshalJSON(): string
+ }
+ interface DateTime {
+ /**
+ * UnmarshalJSON implements the [json.Unmarshaler] interface.
+ */
+ unmarshalJSON(b: string): void
+ }
+ interface DateTime {
+ /**
+ * Value implements the [driver.Valuer] interface.
+ */
+ value(): driver.Value
+ }
+ interface DateTime {
+ /**
+ * Scan implements [sql.Scanner] interface to scan the provided value
+ * into the current DateTime instance.
+ */
+ scan(value: any): void
+ }
+}
+
+/**
+ * Package sql provides a generic interface around SQL (or SQL-like)
+ * databases.
+ *
+ * The sql package must be used in conjunction with a database driver.
+ * See https://golang.org/s/sqldrivers for a list of drivers.
+ *
+ * Drivers that do not support context cancellation will not return until
+ * after the query is completed.
+ *
+ * For usage examples, see the wiki page at
+ * https://golang.org/s/sqlwiki.
+ */
+namespace sql {
+ /**
+ * IsolationLevel is the transaction isolation level used in TxOptions.
+ */
+ interface IsolationLevel extends Number{}
+ interface IsolationLevel {
+ /**
+ * String returns the name of the transaction isolation level.
+ */
+ string(): string
+ }
+ /**
+ * DBStats contains database statistics.
+ */
+ interface DBStats {
+ maxOpenConnections: number // Maximum number of open connections to the database.
+ /**
+ * Pool Status
+ */
+ openConnections: number // The number of established connections both in use and idle.
+ inUse: number // The number of connections currently in use.
+ idle: number // The number of idle connections.
+ /**
+ * Counters
+ */
+ waitCount: number // The total number of connections waited for.
+ waitDuration: time.Duration // The total time blocked waiting for a new connection.
+ maxIdleClosed: number // The total number of connections closed due to SetMaxIdleConns.
+ maxIdleTimeClosed: number // The total number of connections closed due to SetConnMaxIdleTime.
+ maxLifetimeClosed: number // The total number of connections closed due to SetConnMaxLifetime.
+ }
+ /**
+ * Conn represents a single database connection rather than a pool of database
+ * connections. Prefer running queries from DB unless there is a specific
+ * need for a continuous single database connection.
+ *
+ * A Conn must call Close to return the connection to the database pool
+ * and may do so concurrently with a running query.
+ *
+ * After a call to Close, all operations on the
+ * connection fail with ErrConnDone.
+ */
+ interface Conn {
+ }
+ interface Conn {
+ /**
+ * PingContext verifies the connection to the database is still alive.
+ */
+ pingContext(ctx: context.Context): void
+ }
+ interface Conn {
+ /**
+ * ExecContext executes a query without returning any rows.
+ * The args are for any placeholder parameters in the query.
+ */
+ execContext(ctx: context.Context, query: string, ...args: any[]): Result
+ }
+ interface Conn {
+ /**
+ * QueryContext executes a query that returns rows, typically a SELECT.
+ * The args are for any placeholder parameters in the query.
+ */
+ queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined)
+ }
+ interface Conn {
+ /**
+ * QueryRowContext executes a query that is expected to return at most one row.
+ * QueryRowContext always returns a non-nil value. Errors are deferred until
+ * Row's Scan method is called.
+ * If the query selects no rows, the *Row's Scan will return ErrNoRows.
+ * Otherwise, the *Row's Scan scans the first selected row and discards
+ * the rest.
+ */
+ queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined)
+ }
+ interface Conn {
+ /**
+ * PrepareContext creates a prepared statement for later queries or executions.
+ * Multiple queries or executions may be run concurrently from the
+ * returned statement.
+ * The caller must call the statement's Close method
+ * when the statement is no longer needed.
+ *
+ * The provided context is used for the preparation of the statement, not for the
+ * execution of the statement.
+ */
+ prepareContext(ctx: context.Context, query: string): (Stmt | undefined)
+ }
+ interface Conn {
+ /**
+ * Raw executes f exposing the underlying driver connection for the
+ * duration of f. The driverConn must not be used outside of f.
+ *
+ * Once f returns and err is not driver.ErrBadConn, the Conn will continue to be usable
+ * until Conn.Close is called.
+ */
+ raw(f: (driverConn: any) => void): void
+ }
+ interface Conn {
+ /**
+ * BeginTx starts a transaction.
+ *
+ * The provided context is used until the transaction is committed or rolled back.
+ * If the context is canceled, the sql package will roll back
+ * the transaction. Tx.Commit will return an error if the context provided to
+ * BeginTx is canceled.
+ *
+ * The provided TxOptions is optional and may be nil if defaults should be used.
+ * If a non-default isolation level is used that the driver doesn't support,
+ * an error will be returned.
+ */
+ beginTx(ctx: context.Context, opts: TxOptions): (Tx | undefined)
+ }
+ interface Conn {
+ /**
+ * Close returns the connection to the connection pool.
+ * All operations after a Close will return with ErrConnDone.
+ * Close is safe to call concurrently with other operations and will
+ * block until all other operations finish. It may be useful to first
+ * cancel any used context and then call close directly after.
+ */
+ close(): void
+ }
+ /**
+ * ColumnType contains the name and type of a column.
+ */
+ interface ColumnType {
+ }
+ interface ColumnType {
+ /**
+ * Name returns the name or alias of the column.
+ */
+ name(): string
+ }
+ interface ColumnType {
+ /**
+ * Length returns the column type length for variable length column types such
+ * as text and binary field types. If the type length is unbounded the value will
+ * be math.MaxInt64 (any database limits will still apply).
+ * If the column type is not variable length, such as an int, or if not supported
+ * by the driver ok is false.
+ */
+ length(): [number, boolean]
+ }
+ interface ColumnType {
+ /**
+ * DecimalSize returns the scale and precision of a decimal type.
+ * If not applicable or if not supported ok is false.
+ */
+ decimalSize(): [number, boolean]
+ }
+ interface ColumnType {
+ /**
+ * ScanType returns a Go type suitable for scanning into using Rows.Scan.
+ * If a driver does not support this property ScanType will return
+ * the type of an empty interface.
+ */
+ scanType(): reflect.Type
+ }
+ interface ColumnType {
+ /**
+ * Nullable reports whether the column may be null.
+ * If a driver does not support this property ok will be false.
+ */
+ nullable(): boolean
+ }
+ interface ColumnType {
+ /**
+ * DatabaseTypeName returns the database system name of the column type. If an empty
+ * string is returned, then the driver type name is not supported.
+ * Consult your driver documentation for a list of driver data types. Length specifiers
+ * are not included.
+ * Common type names include "VARCHAR", "TEXT", "NVARCHAR", "DECIMAL", "BOOL",
+ * "INT", and "BIGINT".
+ */
+ databaseTypeName(): string
+ }
+ /**
+ * Row is the result of calling QueryRow to select a single row.
+ */
+ interface Row {
+ }
+ interface Row {
+ /**
+ * Scan copies the columns from the matched row into the values
+ * pointed at by dest. See the documentation on Rows.Scan for details.
+ * If more than one row matches the query,
+ * Scan uses the first row and discards the rest. If no row matches
+ * the query, Scan returns ErrNoRows.
+ */
+ scan(...dest: any[]): void
+ }
+ interface Row {
+ /**
+ * Err provides a way for wrapping packages to check for
+ * query errors without calling Scan.
+ * Err returns the error, if any, that was encountered while running the query.
+ * If this error is not nil, this error will also be returned from Scan.
+ */
+ err(): void
+ }
+}
+
+/**
+ * Package tls partially implements TLS 1.2, as specified in RFC 5246,
+ * and TLS 1.3, as specified in RFC 8446.
+ */
+namespace tls {
+ /**
+ * ConnectionState records basic TLS details about the connection.
+ */
+ interface ConnectionState {
+ /**
+ * Version is the TLS version used by the connection (e.g. VersionTLS12).
+ */
+ version: number
+ /**
+ * HandshakeComplete is true if the handshake has concluded.
+ */
+ handshakeComplete: boolean
+ /**
+ * DidResume is true if this connection was successfully resumed from a
+ * previous session with a session ticket or similar mechanism.
+ */
+ didResume: boolean
+ /**
+ * CipherSuite is the cipher suite negotiated for the connection (e.g.
+ * TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_AES_128_GCM_SHA256).
+ */
+ cipherSuite: number
+ /**
+ * NegotiatedProtocol is the application protocol negotiated with ALPN.
+ */
+ negotiatedProtocol: string
+ /**
+ * NegotiatedProtocolIsMutual used to indicate a mutual NPN negotiation.
+ *
+ * Deprecated: this value is always true.
+ */
+ negotiatedProtocolIsMutual: boolean
+ /**
+ * ServerName is the value of the Server Name Indication extension sent by
+ * the client. It's available both on the server and on the client side.
+ */
+ serverName: string
+ /**
+ * PeerCertificates are the parsed certificates sent by the peer, in the
+ * order in which they were sent. The first element is the leaf certificate
+ * that the connection is verified against.
+ *
+ * On the client side, it can't be empty. On the server side, it can be
+ * empty if Config.ClientAuth is not RequireAnyClientCert or
+ * RequireAndVerifyClientCert.
+ */
+ peerCertificates: Array<(x509.Certificate | undefined)>
+ /**
+ * VerifiedChains is a list of one or more chains where the first element is
+ * PeerCertificates[0] and the last element is from Config.RootCAs (on the
+ * client side) or Config.ClientCAs (on the server side).
+ *
+ * On the client side, it's set if Config.InsecureSkipVerify is false. On
+ * the server side, it's set if Config.ClientAuth is VerifyClientCertIfGiven
+ * (and the peer provided a certificate) or RequireAndVerifyClientCert.
+ */
+ verifiedChains: Array>
+ /**
+ * SignedCertificateTimestamps is a list of SCTs provided by the peer
+ * through the TLS handshake for the leaf certificate, if any.
+ */
+ signedCertificateTimestamps: Array
+ /**
+ * OCSPResponse is a stapled Online Certificate Status Protocol (OCSP)
+ * response provided by the peer for the leaf certificate, if any.
+ */
+ ocspResponse: string
+ /**
+ * TLSUnique contains the "tls-unique" channel binding value (see RFC 5929,
+ * Section 3). This value will be nil for TLS 1.3 connections and for all
+ * resumed connections.
+ *
+ * Deprecated: there are conditions in which this value might not be unique
+ * to a connection. See the Security Considerations sections of RFC 5705 and
+ * RFC 7627, and https://mitls.org/pages/attacks/3SHAKE#channelbindings.
+ */
+ tlsUnique: string
+ }
+ interface ConnectionState {
+ /**
+ * ExportKeyingMaterial returns length bytes of exported key material in a new
+ * slice as defined in RFC 5705. If context is nil, it is not used as part of
+ * the seed. If the connection was set to allow renegotiation via
+ * Config.Renegotiation, this function will return an error.
+ */
+ exportKeyingMaterial(label: string, context: string, length: number): string
+ }
+}
+
/**
* Package textproto implements generic support for text-based request/response
* protocols in the style of HTTP, NNTP, and SMTP.
@@ -10766,6 +11528,1689 @@ namespace textproto {
}
}
+/**
+ * Package multipart implements MIME multipart parsing, as defined in RFC
+ * 2046.
+ *
+ * The implementation is sufficient for HTTP (RFC 2388) and the multipart
+ * bodies generated by popular browsers.
+ */
+namespace multipart {
+ interface Reader {
+ /**
+ * ReadForm parses an entire multipart message whose parts have
+ * a Content-Disposition of "form-data".
+ * It stores up to maxMemory bytes + 10MB (reserved for non-file parts)
+ * in memory. File parts which can't be stored in memory will be stored on
+ * disk in temporary files.
+ * It returns ErrMessageTooLarge if all non-file parts can't be stored in
+ * memory.
+ */
+ readForm(maxMemory: number): (Form | undefined)
+ }
+ /**
+ * Form is a parsed multipart form.
+ * Its File parts are stored either in memory or on disk,
+ * and are accessible via the *FileHeader's Open method.
+ * Its Value parts are stored as strings.
+ * Both are keyed by field name.
+ */
+ interface Form {
+ value: _TygojaDict
+ file: _TygojaDict
+ }
+ interface Form {
+ /**
+ * RemoveAll removes any temporary files associated with a Form.
+ */
+ removeAll(): void
+ }
+ /**
+ * File is an interface to access the file part of a multipart message.
+ * Its contents may be either stored in memory or on disk.
+ * If stored on disk, the File's underlying concrete type will be an *os.File.
+ */
+ interface File {
+ }
+ /**
+ * Reader is an iterator over parts in a MIME multipart body.
+ * Reader's underlying parser consumes its input as needed. Seeking
+ * isn't supported.
+ */
+ interface Reader {
+ }
+ interface Reader {
+ /**
+ * NextPart returns the next part in the multipart or an error.
+ * When there are no more parts, the error io.EOF is returned.
+ *
+ * As a special case, if the "Content-Transfer-Encoding" header
+ * has a value of "quoted-printable", that header is instead
+ * hidden and the body is transparently decoded during Read calls.
+ */
+ nextPart(): (Part | undefined)
+ }
+ interface Reader {
+ /**
+ * NextRawPart returns the next part in the multipart or an error.
+ * When there are no more parts, the error io.EOF is returned.
+ *
+ * Unlike NextPart, it does not have special handling for
+ * "Content-Transfer-Encoding: quoted-printable".
+ */
+ nextRawPart(): (Part | undefined)
+ }
+}
+
+/**
+ * Package http provides HTTP client and server implementations.
+ *
+ * Get, Head, Post, and PostForm make HTTP (or HTTPS) requests:
+ *
+ * ```
+ * resp, err := http.Get("http://example.com/")
+ * ...
+ * resp, err := http.Post("http://example.com/upload", "image/jpeg", &buf)
+ * ...
+ * resp, err := http.PostForm("http://example.com/form",
+ * url.Values{"key": {"Value"}, "id": {"123"}})
+ * ```
+ *
+ * The client must close the response body when finished with it:
+ *
+ * ```
+ * resp, err := http.Get("http://example.com/")
+ * if err != nil {
+ * // handle error
+ * }
+ * defer resp.Body.Close()
+ * body, err := io.ReadAll(resp.Body)
+ * // ...
+ * ```
+ *
+ * For control over HTTP client headers, redirect policy, and other
+ * settings, create a Client:
+ *
+ * ```
+ * client := &http.Client{
+ * CheckRedirect: redirectPolicyFunc,
+ * }
+ *
+ * resp, err := client.Get("http://example.com")
+ * // ...
+ *
+ * req, err := http.NewRequest("GET", "http://example.com", nil)
+ * // ...
+ * req.Header.Add("If-None-Match", `W/"wyzzy"`)
+ * resp, err := client.Do(req)
+ * // ...
+ * ```
+ *
+ * For control over proxies, TLS configuration, keep-alives,
+ * compression, and other settings, create a Transport:
+ *
+ * ```
+ * tr := &http.Transport{
+ * MaxIdleConns: 10,
+ * IdleConnTimeout: 30 * time.Second,
+ * DisableCompression: true,
+ * }
+ * client := &http.Client{Transport: tr}
+ * resp, err := client.Get("https://example.com")
+ * ```
+ *
+ * Clients and Transports are safe for concurrent use by multiple
+ * goroutines and for efficiency should only be created once and re-used.
+ *
+ * ListenAndServe starts an HTTP server with a given address and handler.
+ * The handler is usually nil, which means to use DefaultServeMux.
+ * Handle and HandleFunc add handlers to DefaultServeMux:
+ *
+ * ```
+ * http.Handle("/foo", fooHandler)
+ *
+ * http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) {
+ * fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
+ * })
+ *
+ * log.Fatal(http.ListenAndServe(":8080", nil))
+ * ```
+ *
+ * More control over the server's behavior is available by creating a
+ * custom Server:
+ *
+ * ```
+ * s := &http.Server{
+ * Addr: ":8080",
+ * Handler: myHandler,
+ * ReadTimeout: 10 * time.Second,
+ * WriteTimeout: 10 * time.Second,
+ * MaxHeaderBytes: 1 << 20,
+ * }
+ * log.Fatal(s.ListenAndServe())
+ * ```
+ *
+ * Starting with Go 1.6, the http package has transparent support for the
+ * HTTP/2 protocol when using HTTPS. Programs that must disable HTTP/2
+ * can do so by setting Transport.TLSNextProto (for clients) or
+ * Server.TLSNextProto (for servers) to a non-nil, empty
+ * map. Alternatively, the following GODEBUG environment variables are
+ * currently supported:
+ *
+ * ```
+ * GODEBUG=http2client=0 # disable HTTP/2 client support
+ * GODEBUG=http2server=0 # disable HTTP/2 server support
+ * GODEBUG=http2debug=1 # enable verbose HTTP/2 debug logs
+ * GODEBUG=http2debug=2 # ... even more verbose, with frame dumps
+ * ```
+ *
+ * The GODEBUG variables are not covered by Go's API compatibility
+ * promise. Please report any issues before disabling HTTP/2
+ * support: https://golang.org/s/http2bug
+ *
+ * The http package's Transport and Server both automatically enable
+ * HTTP/2 support for simple configurations. To enable HTTP/2 for more
+ * complex configurations, to use lower-level HTTP/2 features, or to use
+ * a newer version of Go's http2 package, import "golang.org/x/net/http2"
+ * directly and use its ConfigureTransport and/or ConfigureServer
+ * functions. Manually configuring HTTP/2 via the golang.org/x/net/http2
+ * package takes precedence over the net/http package's built-in HTTP/2
+ * support.
+ */
+namespace http {
+ /**
+ * A Client is an HTTP client. Its zero value (DefaultClient) is a
+ * usable client that uses DefaultTransport.
+ *
+ * The Client's Transport typically has internal state (cached TCP
+ * connections), so Clients should be reused instead of created as
+ * needed. Clients are safe for concurrent use by multiple goroutines.
+ *
+ * A Client is higher-level than a RoundTripper (such as Transport)
+ * and additionally handles HTTP details such as cookies and
+ * redirects.
+ *
+ * When following redirects, the Client will forward all headers set on the
+ * initial Request except:
+ *
+ * • when forwarding sensitive headers like "Authorization",
+ * "WWW-Authenticate", and "Cookie" to untrusted targets.
+ * These headers will be ignored when following a redirect to a domain
+ * that is not a subdomain match or exact match of the initial domain.
+ * For example, a redirect from "foo.com" to either "foo.com" or "sub.foo.com"
+ * will forward the sensitive headers, but a redirect to "bar.com" will not.
+ *
+ * • when forwarding the "Cookie" header with a non-nil cookie Jar.
+ * Since each redirect may mutate the state of the cookie jar,
+ * a redirect may possibly alter a cookie set in the initial request.
+ * When forwarding the "Cookie" header, any mutated cookies will be omitted,
+ * with the expectation that the Jar will insert those mutated cookies
+ * with the updated values (assuming the origin matches).
+ * If Jar is nil, the initial cookies are forwarded without change.
+ */
+ interface Client {
+ /**
+ * Transport specifies the mechanism by which individual
+ * HTTP requests are made.
+ * If nil, DefaultTransport is used.
+ */
+ transport: RoundTripper
+ /**
+ * CheckRedirect specifies the policy for handling redirects.
+ * If CheckRedirect is not nil, the client calls it before
+ * following an HTTP redirect. The arguments req and via are
+ * the upcoming request and the requests made already, oldest
+ * first. If CheckRedirect returns an error, the Client's Get
+ * method returns both the previous Response (with its Body
+ * closed) and CheckRedirect's error (wrapped in a url.Error)
+ * instead of issuing the Request req.
+ * As a special case, if CheckRedirect returns ErrUseLastResponse,
+ * then the most recent response is returned with its body
+ * unclosed, along with a nil error.
+ *
+ * If CheckRedirect is nil, the Client uses its default policy,
+ * which is to stop after 10 consecutive requests.
+ */
+ checkRedirect: (req: Request, via: Array<(Request | undefined)>) => void
+ /**
+ * Jar specifies the cookie jar.
+ *
+ * The Jar is used to insert relevant cookies into every
+ * outbound Request and is updated with the cookie values
+ * of every inbound Response. The Jar is consulted for every
+ * redirect that the Client follows.
+ *
+ * If Jar is nil, cookies are only sent if they are explicitly
+ * set on the Request.
+ */
+ jar: CookieJar
+ /**
+ * Timeout specifies a time limit for requests made by this
+ * Client. The timeout includes connection time, any
+ * redirects, and reading the response body. The timer remains
+ * running after Get, Head, Post, or Do return and will
+ * interrupt reading of the Response.Body.
+ *
+ * A Timeout of zero means no timeout.
+ *
+ * The Client cancels requests to the underlying Transport
+ * as if the Request's Context ended.
+ *
+ * For compatibility, the Client will also use the deprecated
+ * CancelRequest method on Transport if found. New
+ * RoundTripper implementations should use the Request's Context
+ * for cancellation instead of implementing CancelRequest.
+ */
+ timeout: time.Duration
+ }
+ interface Client {
+ /**
+ * Get issues a GET to the specified URL. If the response is one of the
+ * following redirect codes, Get follows the redirect after calling the
+ * Client's CheckRedirect function:
+ *
+ * ```
+ * 301 (Moved Permanently)
+ * 302 (Found)
+ * 303 (See Other)
+ * 307 (Temporary Redirect)
+ * 308 (Permanent Redirect)
+ * ```
+ *
+ * An error is returned if the Client's CheckRedirect function fails
+ * or if there was an HTTP protocol error. A non-2xx response doesn't
+ * cause an error. Any returned error will be of type *url.Error. The
+ * url.Error value's Timeout method will report true if the request
+ * timed out.
+ *
+ * When err is nil, resp always contains a non-nil resp.Body.
+ * Caller should close resp.Body when done reading from it.
+ *
+ * To make a request with custom headers, use NewRequest and Client.Do.
+ *
+ * To make a request with a specified context.Context, use NewRequestWithContext
+ * and Client.Do.
+ */
+ get(url: string): (Response | undefined)
+ }
+ interface Client {
+ /**
+ * Do sends an HTTP request and returns an HTTP response, following
+ * policy (such as redirects, cookies, auth) as configured on the
+ * client.
+ *
+ * An error is returned if caused by client policy (such as
+ * CheckRedirect), or failure to speak HTTP (such as a network
+ * connectivity problem). A non-2xx status code doesn't cause an
+ * error.
+ *
+ * If the returned error is nil, the Response will contain a non-nil
+ * Body which the user is expected to close. If the Body is not both
+ * read to EOF and closed, the Client's underlying RoundTripper
+ * (typically Transport) may not be able to re-use a persistent TCP
+ * connection to the server for a subsequent "keep-alive" request.
+ *
+ * The request Body, if non-nil, will be closed by the underlying
+ * Transport, even on errors.
+ *
+ * On error, any Response can be ignored. A non-nil Response with a
+ * non-nil error only occurs when CheckRedirect fails, and even then
+ * the returned Response.Body is already closed.
+ *
+ * Generally Get, Post, or PostForm will be used instead of Do.
+ *
+ * If the server replies with a redirect, the Client first uses the
+ * CheckRedirect function to determine whether the redirect should be
+ * followed. If permitted, a 301, 302, or 303 redirect causes
+ * subsequent requests to use HTTP method GET
+ * (or HEAD if the original request was HEAD), with no body.
+ * A 307 or 308 redirect preserves the original HTTP method and body,
+ * provided that the Request.GetBody function is defined.
+ * The NewRequest function automatically sets GetBody for common
+ * standard library body types.
+ *
+ * Any returned error will be of type *url.Error. The url.Error
+ * value's Timeout method will report true if the request timed out.
+ */
+ do(req: Request): (Response | undefined)
+ }
+ interface Client {
+ /**
+ * Post issues a POST to the specified URL.
+ *
+ * Caller should close resp.Body when done reading from it.
+ *
+ * If the provided body is an io.Closer, it is closed after the
+ * request.
+ *
+ * To set custom headers, use NewRequest and Client.Do.
+ *
+ * To make a request with a specified context.Context, use NewRequestWithContext
+ * and Client.Do.
+ *
+ * See the Client.Do method documentation for details on how redirects
+ * are handled.
+ */
+ post(url: string, body: io.Reader): (Response | undefined)
+ }
+ interface Client {
+ /**
+ * PostForm issues a POST to the specified URL,
+ * with data's keys and values URL-encoded as the request body.
+ *
+ * The Content-Type header is set to application/x-www-form-urlencoded.
+ * To set other headers, use NewRequest and Client.Do.
+ *
+ * When err is nil, resp always contains a non-nil resp.Body.
+ * Caller should close resp.Body when done reading from it.
+ *
+ * See the Client.Do method documentation for details on how redirects
+ * are handled.
+ *
+ * To make a request with a specified context.Context, use NewRequestWithContext
+ * and Client.Do.
+ */
+ postForm(url: string, data: url.Values): (Response | undefined)
+ }
+ interface Client {
+ /**
+ * Head issues a HEAD to the specified URL. If the response is one of the
+ * following redirect codes, Head follows the redirect after calling the
+ * Client's CheckRedirect function:
+ *
+ * ```
+ * 301 (Moved Permanently)
+ * 302 (Found)
+ * 303 (See Other)
+ * 307 (Temporary Redirect)
+ * 308 (Permanent Redirect)
+ * ```
+ *
+ * To make a request with a specified context.Context, use NewRequestWithContext
+ * and Client.Do.
+ */
+ head(url: string): (Response | undefined)
+ }
+ interface Client {
+ /**
+ * CloseIdleConnections closes any connections on its Transport which
+ * were previously connected from previous requests but are now
+ * sitting idle in a "keep-alive" state. It does not interrupt any
+ * connections currently in use.
+ *
+ * If the Client's Transport does not have a CloseIdleConnections method
+ * then this method does nothing.
+ */
+ closeIdleConnections(): void
+ }
+ /**
+ * A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an
+ * HTTP response or the Cookie header of an HTTP request.
+ *
+ * See https://tools.ietf.org/html/rfc6265 for details.
+ */
+ interface Cookie {
+ name: string
+ value: string
+ path: string // optional
+ domain: string // optional
+ expires: time.Time // optional
+ rawExpires: string // for reading cookies only
+ /**
+ * MaxAge=0 means no 'Max-Age' attribute specified.
+ * MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
+ * MaxAge>0 means Max-Age attribute present and given in seconds
+ */
+ maxAge: number
+ secure: boolean
+ httpOnly: boolean
+ sameSite: SameSite
+ raw: string
+ unparsed: Array // Raw text of unparsed attribute-value pairs
+ }
+ interface Cookie {
+ /**
+ * String returns the serialization of the cookie for use in a Cookie
+ * header (if only Name and Value are set) or a Set-Cookie response
+ * header (if other fields are set).
+ * If c is nil or c.Name is invalid, the empty string is returned.
+ */
+ string(): string
+ }
+ interface Cookie {
+ /**
+ * Valid reports whether the cookie is valid.
+ */
+ valid(): void
+ }
+ // @ts-ignore
+ import mathrand = rand
+ /**
+ * A Header represents the key-value pairs in an HTTP header.
+ *
+ * The keys should be in canonical form, as returned by
+ * CanonicalHeaderKey.
+ */
+ interface Header extends _TygojaDict{}
+ interface Header {
+ /**
+ * Add adds the key, value pair to the header.
+ * It appends to any existing values associated with key.
+ * The key is case insensitive; it is canonicalized by
+ * CanonicalHeaderKey.
+ */
+ add(key: string): void
+ }
+ interface Header {
+ /**
+ * Set sets the header entries associated with key to the
+ * single element value. It replaces any existing values
+ * associated with key. The key is case insensitive; it is
+ * canonicalized by textproto.CanonicalMIMEHeaderKey.
+ * To use non-canonical keys, assign to the map directly.
+ */
+ set(key: string): void
+ }
+ interface Header {
+ /**
+ * Get gets the first value associated with the given key. If
+ * there are no values associated with the key, Get returns "".
+ * It is case insensitive; textproto.CanonicalMIMEHeaderKey is
+ * used to canonicalize the provided key. Get assumes that all
+ * keys are stored in canonical form. To use non-canonical keys,
+ * access the map directly.
+ */
+ get(key: string): string
+ }
+ interface Header {
+ /**
+ * Values returns all values associated with the given key.
+ * It is case insensitive; textproto.CanonicalMIMEHeaderKey is
+ * used to canonicalize the provided key. To use non-canonical
+ * keys, access the map directly.
+ * The returned slice is not a copy.
+ */
+ values(key: string): Array
+ }
+ interface Header {
+ /**
+ * Del deletes the values associated with key.
+ * The key is case insensitive; it is canonicalized by
+ * CanonicalHeaderKey.
+ */
+ del(key: string): void
+ }
+ interface Header {
+ /**
+ * Write writes a header in wire format.
+ */
+ write(w: io.Writer): void
+ }
+ interface Header {
+ /**
+ * Clone returns a copy of h or nil if h is nil.
+ */
+ clone(): Header
+ }
+ interface Header {
+ /**
+ * WriteSubset writes a header in wire format.
+ * If exclude is not nil, keys where exclude[key] == true are not written.
+ * Keys are not canonicalized before checking the exclude map.
+ */
+ writeSubset(w: io.Writer, exclude: _TygojaDict): void
+ }
+ // @ts-ignore
+ import urlpkg = url
+ /**
+ * Response represents the response from an HTTP request.
+ *
+ * The Client and Transport return Responses from servers once
+ * the response headers have been received. The response body
+ * is streamed on demand as the Body field is read.
+ */
+ interface Response {
+ status: string // e.g. "200 OK"
+ statusCode: number // e.g. 200
+ proto: string // e.g. "HTTP/1.0"
+ protoMajor: number // e.g. 1
+ protoMinor: number // e.g. 0
+ /**
+ * Header maps header keys to values. If the response had multiple
+ * headers with the same key, they may be concatenated, with comma
+ * delimiters. (RFC 7230, section 3.2.2 requires that multiple headers
+ * be semantically equivalent to a comma-delimited sequence.) When
+ * Header values are duplicated by other fields in this struct (e.g.,
+ * ContentLength, TransferEncoding, Trailer), the field values are
+ * authoritative.
+ *
+ * Keys in the map are canonicalized (see CanonicalHeaderKey).
+ */
+ header: Header
+ /**
+ * Body represents the response body.
+ *
+ * The response body is streamed on demand as the Body field
+ * is read. If the network connection fails or the server
+ * terminates the response, Body.Read calls return an error.
+ *
+ * The http Client and Transport guarantee that Body is always
+ * non-nil, even on responses without a body or responses with
+ * a zero-length body. It is the caller's responsibility to
+ * close Body. The default HTTP client's Transport may not
+ * reuse HTTP/1.x "keep-alive" TCP connections if the Body is
+ * not read to completion and closed.
+ *
+ * The Body is automatically dechunked if the server replied
+ * with a "chunked" Transfer-Encoding.
+ *
+ * As of Go 1.12, the Body will also implement io.Writer
+ * on a successful "101 Switching Protocols" response,
+ * as used by WebSockets and HTTP/2's "h2c" mode.
+ */
+ body: io.ReadCloser
+ /**
+ * ContentLength records the length of the associated content. The
+ * value -1 indicates that the length is unknown. Unless Request.Method
+ * is "HEAD", values >= 0 indicate that the given number of bytes may
+ * be read from Body.
+ */
+ contentLength: number
+ /**
+ * Contains transfer encodings from outer-most to inner-most. Value is
+ * nil, means that "identity" encoding is used.
+ */
+ transferEncoding: Array
+ /**
+ * Close records whether the header directed that the connection be
+ * closed after reading Body. The value is advice for clients: neither
+ * ReadResponse nor Response.Write ever closes a connection.
+ */
+ close: boolean
+ /**
+ * Uncompressed reports whether the response was sent compressed but
+ * was decompressed by the http package. When true, reading from
+ * Body yields the uncompressed content instead of the compressed
+ * content actually set from the server, ContentLength is set to -1,
+ * and the "Content-Length" and "Content-Encoding" fields are deleted
+ * from the responseHeader. To get the original response from
+ * the server, set Transport.DisableCompression to true.
+ */
+ uncompressed: boolean
+ /**
+ * Trailer maps trailer keys to values in the same
+ * format as Header.
+ *
+ * The Trailer initially contains only nil values, one for
+ * each key specified in the server's "Trailer" header
+ * value. Those values are not added to Header.
+ *
+ * Trailer must not be accessed concurrently with Read calls
+ * on the Body.
+ *
+ * After Body.Read has returned io.EOF, Trailer will contain
+ * any trailer values sent by the server.
+ */
+ trailer: Header
+ /**
+ * Request is the request that was sent to obtain this Response.
+ * Request's Body is nil (having already been consumed).
+ * This is only populated for Client requests.
+ */
+ request?: Request
+ /**
+ * TLS contains information about the TLS connection on which the
+ * response was received. It is nil for unencrypted responses.
+ * The pointer is shared between responses and should not be
+ * modified.
+ */
+ tls?: tls.ConnectionState
+ }
+ interface Response {
+ /**
+ * Cookies parses and returns the cookies set in the Set-Cookie headers.
+ */
+ cookies(): Array<(Cookie | undefined)>
+ }
+ interface Response {
+ /**
+ * Location returns the URL of the response's "Location" header,
+ * if present. Relative redirects are resolved relative to
+ * the Response's Request. ErrNoLocation is returned if no
+ * Location header is present.
+ */
+ location(): (url.URL | undefined)
+ }
+ interface Response {
+ /**
+ * ProtoAtLeast reports whether the HTTP protocol used
+ * in the response is at least major.minor.
+ */
+ protoAtLeast(major: number): boolean
+ }
+ interface Response {
+ /**
+ * Write writes r to w in the HTTP/1.x server response format,
+ * including the status line, headers, body, and optional trailer.
+ *
+ * This method consults the following fields of the response r:
+ *
+ * ```
+ * StatusCode
+ * ProtoMajor
+ * ProtoMinor
+ * Request.Method
+ * TransferEncoding
+ * Trailer
+ * Body
+ * ContentLength
+ * Header, values for non-canonical keys will have unpredictable behavior
+ * ```
+ *
+ * The Response Body is closed after it is sent.
+ */
+ write(w: io.Writer): void
+ }
+}
+
+/**
+ * Package schema implements custom Schema and SchemaField datatypes
+ * for handling the Collection schema definitions.
+ */
+namespace schema {
+ // @ts-ignore
+ import validation = ozzo_validation
+ /**
+ * SchemaField defines a single schema field structure.
+ */
+ interface SchemaField {
+ system: boolean
+ id: string
+ name: string
+ type: string
+ required: boolean
+ /**
+ * Deprecated: This field is no-op and will be removed in future versions.
+ * Please use the collection.Indexes field to define a unique constraint.
+ */
+ unique: boolean
+ options: any
+ }
+ interface SchemaField {
+ /**
+ * ColDefinition returns the field db column type definition as string.
+ */
+ colDefinition(): string
+ }
+ interface SchemaField {
+ /**
+ * String serializes and returns the current field as string.
+ */
+ string(): string
+ }
+ interface SchemaField {
+ /**
+ * MarshalJSON implements the [json.Marshaler] interface.
+ */
+ marshalJSON(): string
+ }
+ interface SchemaField {
+ /**
+ * UnmarshalJSON implements the [json.Unmarshaler] interface.
+ *
+ * The schema field options are auto initialized on success.
+ */
+ unmarshalJSON(data: string): void
+ }
+ interface SchemaField {
+ /**
+ * Validate makes `SchemaField` validatable by implementing [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ interface SchemaField {
+ /**
+ * InitOptions initializes the current field options based on its type.
+ *
+ * Returns error on unknown field type.
+ */
+ initOptions(): void
+ }
+ interface SchemaField {
+ /**
+ * PrepareValue returns normalized and properly formatted field value.
+ */
+ prepareValue(value: any): any
+ }
+ interface SchemaField {
+ /**
+ * PrepareValueWithModifier returns normalized and properly formatted field value
+ * by "merging" baseValue with the modifierValue based on the specified modifier (+ or -).
+ */
+ prepareValueWithModifier(baseValue: any, modifier: string, modifierValue: any): any
+ }
+}
+
+/**
+ * Package models implements all PocketBase DB models and DTOs.
+ */
+namespace models {
+ /**
+ * Model defines an interface with common methods that all db models should have.
+ */
+ interface Model {
+ tableName(): string
+ isNew(): boolean
+ markAsNew(): void
+ markAsNotNew(): void
+ hasId(): boolean
+ getId(): string
+ setId(id: string): void
+ getCreated(): types.DateTime
+ getUpdated(): types.DateTime
+ refreshId(): void
+ refreshCreated(): void
+ refreshUpdated(): void
+ }
+ /**
+ * BaseModel defines common fields and methods used by all other models.
+ */
+ interface BaseModel {
+ id: string
+ created: types.DateTime
+ updated: types.DateTime
+ }
+ interface BaseModel {
+ /**
+ * HasId returns whether the model has a nonzero id.
+ */
+ hasId(): boolean
+ }
+ interface BaseModel {
+ /**
+ * GetId returns the model id.
+ */
+ getId(): string
+ }
+ interface BaseModel {
+ /**
+ * SetId sets the model id to the provided string value.
+ */
+ setId(id: string): void
+ }
+ interface BaseModel {
+ /**
+ * MarkAsNew marks the model as "new" (aka. enforces m.IsNew() to be true).
+ */
+ markAsNew(): void
+ }
+ interface BaseModel {
+ /**
+ * MarkAsNotNew marks the model as "not new" (aka. enforces m.IsNew() to be false)
+ */
+ markAsNotNew(): void
+ }
+ interface BaseModel {
+ /**
+ * IsNew indicates what type of db query (insert or update)
+ * should be used with the model instance.
+ */
+ isNew(): boolean
+ }
+ interface BaseModel {
+ /**
+ * GetCreated returns the model Created datetime.
+ */
+ getCreated(): types.DateTime
+ }
+ interface BaseModel {
+ /**
+ * GetUpdated returns the model Updated datetime.
+ */
+ getUpdated(): types.DateTime
+ }
+ interface BaseModel {
+ /**
+ * RefreshId generates and sets a new model id.
+ *
+ * The generated id is a cryptographically random 15 characters length string.
+ */
+ refreshId(): void
+ }
+ interface BaseModel {
+ /**
+ * RefreshCreated updates the model Created field with the current datetime.
+ */
+ refreshCreated(): void
+ }
+ interface BaseModel {
+ /**
+ * RefreshUpdated updates the model Updated field with the current datetime.
+ */
+ refreshUpdated(): void
+ }
+ interface BaseModel {
+ /**
+ * PostScan implements the [dbx.PostScanner] interface.
+ *
+ * It is executed right after the model was populated with the db row values.
+ */
+ postScan(): void
+ }
+ // @ts-ignore
+ import validation = ozzo_validation
+ /**
+ * CollectionBaseOptions defines the "base" Collection.Options fields.
+ */
+ interface CollectionBaseOptions {
+ }
+ interface CollectionBaseOptions {
+ /**
+ * Validate implements [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ /**
+ * CollectionAuthOptions defines the "auth" Collection.Options fields.
+ */
+ interface CollectionAuthOptions {
+ manageRule?: string
+ allowOAuth2Auth: boolean
+ allowUsernameAuth: boolean
+ allowEmailAuth: boolean
+ requireEmail: boolean
+ exceptEmailDomains: Array
+ onlyEmailDomains: Array
+ minPasswordLength: number
+ }
+ interface CollectionAuthOptions {
+ /**
+ * Validate implements [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ /**
+ * CollectionViewOptions defines the "view" Collection.Options fields.
+ */
+ interface CollectionViewOptions {
+ query: string
+ }
+ interface CollectionViewOptions {
+ /**
+ * Validate implements [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ type _subaMhIy = BaseModel
+ interface Param extends _subaMhIy {
+ key: string
+ value: types.JsonRaw
+ }
+ interface Param {
+ tableName(): string
+ }
+ type _subfPTRA = BaseModel
+ interface Request extends _subfPTRA {
+ url: string
+ method: string
+ status: number
+ auth: string
+ userIp: string
+ remoteIp: string
+ referer: string
+ userAgent: string
+ meta: types.JsonMap
+ }
+ interface Request {
+ tableName(): string
+ }
+ interface TableInfoRow {
+ /**
+ * the `db:"pk"` tag has special semantic so we cannot rename
+ * the original field without specifying a custom mapper
+ */
+ pk: number
+ index: number
+ name: string
+ type: string
+ notNull: boolean
+ defaultValue: types.JsonRaw
+ }
+}
+
+/**
+ * Package oauth2 provides support for making
+ * OAuth2 authorized and authenticated HTTP requests,
+ * as specified in RFC 6749.
+ * It can additionally grant authorization with Bearer JWT.
+ */
+namespace oauth2 {
+ /**
+ * An AuthCodeOption is passed to Config.AuthCodeURL.
+ */
+ interface AuthCodeOption {
+ }
+ /**
+ * Token represents the credentials used to authorize
+ * the requests to access protected resources on the OAuth 2.0
+ * provider's backend.
+ *
+ * Most users of this package should not access fields of Token
+ * directly. They're exported mostly for use by related packages
+ * implementing derivative OAuth2 flows.
+ */
+ interface Token {
+ /**
+ * AccessToken is the token that authorizes and authenticates
+ * the requests.
+ */
+ accessToken: string
+ /**
+ * TokenType is the type of token.
+ * The Type method returns either this or "Bearer", the default.
+ */
+ tokenType: string
+ /**
+ * RefreshToken is a token that's used by the application
+ * (as opposed to the user) to refresh the access token
+ * if it expires.
+ */
+ refreshToken: string
+ /**
+ * Expiry is the optional expiration time of the access token.
+ *
+ * If zero, TokenSource implementations will reuse the same
+ * token forever and RefreshToken or equivalent
+ * mechanisms for that TokenSource will not be used.
+ */
+ expiry: time.Time
+ }
+ interface Token {
+ /**
+ * Type returns t.TokenType if non-empty, else "Bearer".
+ */
+ type(): string
+ }
+ interface Token {
+ /**
+ * SetAuthHeader sets the Authorization header to r using the access
+ * token in t.
+ *
+ * This method is unnecessary when using Transport or an HTTP Client
+ * returned by this package.
+ */
+ setAuthHeader(r: http.Request): void
+ }
+ interface Token {
+ /**
+ * WithExtra returns a new Token that's a clone of t, but using the
+ * provided raw extra map. This is only intended for use by packages
+ * implementing derivative OAuth2 flows.
+ */
+ withExtra(extra: {
+ }): (Token | undefined)
+ }
+ interface Token {
+ /**
+ * Extra returns an extra field.
+ * Extra fields are key-value pairs returned by the server as a
+ * part of the token retrieval response.
+ */
+ extra(key: string): {
+ }
+ }
+ interface Token {
+ /**
+ * Valid reports whether t is non-nil, has an AccessToken, and is not expired.
+ */
+ valid(): boolean
+ }
+}
+
+namespace mailer {
+ /**
+ * Mailer defines a base mail client interface.
+ */
+ interface Mailer {
+ /**
+ * Send sends an email with the provided Message.
+ */
+ send(message: Message): void
+ }
+}
+
+/**
+ * Package echo implements high performance, minimalist Go web framework.
+ *
+ * Example:
+ *
+ * ```
+ * package main
+ *
+ * import (
+ * "github.com/labstack/echo/v5"
+ * "github.com/labstack/echo/v5/middleware"
+ * "log"
+ * "net/http"
+ * )
+ *
+ * // Handler
+ * func hello(c echo.Context) error {
+ * return c.String(http.StatusOK, "Hello, World!")
+ * }
+ *
+ * func main() {
+ * // Echo instance
+ * e := echo.New()
+ *
+ * // Middleware
+ * e.Use(middleware.Logger())
+ * e.Use(middleware.Recover())
+ *
+ * // Routes
+ * e.GET("/", hello)
+ *
+ * // Start server
+ * if err := e.Start(":8080"); err != http.ErrServerClosed {
+ * log.Fatal(err)
+ * }
+ * }
+ * ```
+ *
+ * Learn more at https://echo.labstack.com
+ */
+namespace echo {
+ /**
+ * Binder is the interface that wraps the Bind method.
+ */
+ interface Binder {
+ bind(c: Context, i: {
+ }): void
+ }
+ /**
+ * ServableContext is interface that Echo context implementation must implement to be usable in middleware/handlers and
+ * be able to be routed by Router.
+ */
+ interface ServableContext {
+ /**
+ * Reset resets the context after request completes. It must be called along
+ * with `Echo#AcquireContext()` and `Echo#ReleaseContext()`.
+ * See `Echo#ServeHTTP()`
+ */
+ reset(r: http.Request, w: http.ResponseWriter): void
+ }
+ // @ts-ignore
+ import stdContext = context
+ /**
+ * JSONSerializer is the interface that encodes and decodes JSON to and from interfaces.
+ */
+ interface JSONSerializer {
+ serialize(c: Context, i: {
+ }, indent: string): void
+ deserialize(c: Context, i: {
+ }): void
+ }
+ /**
+ * HTTPErrorHandler is a centralized HTTP error handler.
+ */
+ interface HTTPErrorHandler {(c: Context, err: Error): void }
+ /**
+ * Validator is the interface that wraps the Validate function.
+ */
+ interface Validator {
+ validate(i: {
+ }): void
+ }
+ /**
+ * Renderer is the interface that wraps the Render function.
+ */
+ interface Renderer {
+ render(_arg0: io.Writer, _arg1: string, _arg2: {
+ }, _arg3: Context): void
+ }
+ /**
+ * Group is a set of sub-routes for a specified route. It can be used for inner
+ * routes that share a common middleware or functionality that should be separate
+ * from the parent echo instance while still inheriting from it.
+ */
+ interface Group {
+ }
+ interface Group {
+ /**
+ * Use implements `Echo#Use()` for sub-routes within the Group.
+ * Group middlewares are not executed on request when there is no matching route found.
+ */
+ use(...middleware: MiddlewareFunc[]): void
+ }
+ interface Group {
+ /**
+ * CONNECT implements `Echo#CONNECT()` for sub-routes within the Group. Panics on error.
+ */
+ connect(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * DELETE implements `Echo#DELETE()` for sub-routes within the Group. Panics on error.
+ */
+ delete(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * GET implements `Echo#GET()` for sub-routes within the Group. Panics on error.
+ */
+ get(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * HEAD implements `Echo#HEAD()` for sub-routes within the Group. Panics on error.
+ */
+ head(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * OPTIONS implements `Echo#OPTIONS()` for sub-routes within the Group. Panics on error.
+ */
+ options(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * PATCH implements `Echo#PATCH()` for sub-routes within the Group. Panics on error.
+ */
+ patch(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * POST implements `Echo#POST()` for sub-routes within the Group. Panics on error.
+ */
+ post(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * PUT implements `Echo#PUT()` for sub-routes within the Group. Panics on error.
+ */
+ put(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * TRACE implements `Echo#TRACE()` for sub-routes within the Group. Panics on error.
+ */
+ trace(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * Any implements `Echo#Any()` for sub-routes within the Group. Panics on error.
+ */
+ any(path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes
+ }
+ interface Group {
+ /**
+ * Match implements `Echo#Match()` for sub-routes within the Group. Panics on error.
+ */
+ match(methods: Array, path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes
+ }
+ interface Group {
+ /**
+ * Group creates a new sub-group with prefix and optional sub-group-level middleware.
+ * Important! Group middlewares are only executed in case there was exact route match and not
+ * for 404 (not found) or 405 (method not allowed) cases. If this kind of behaviour is needed then add
+ * a catch-all route `/*` for the group which handler returns always 404
+ */
+ group(prefix: string, ...middleware: MiddlewareFunc[]): (Group | undefined)
+ }
+ interface Group {
+ /**
+ * Static implements `Echo#Static()` for sub-routes within the Group.
+ */
+ static(pathPrefix: string): RouteInfo
+ }
+ interface Group {
+ /**
+ * StaticFS implements `Echo#StaticFS()` for sub-routes within the Group.
+ *
+ * When dealing with `embed.FS` use `fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary
+ * prefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths
+ * including `assets/images` as their prefix.
+ */
+ staticFS(pathPrefix: string, filesystem: fs.FS): RouteInfo
+ }
+ interface Group {
+ /**
+ * FileFS implements `Echo#FileFS()` for sub-routes within the Group.
+ */
+ fileFS(path: string, filesystem: fs.FS, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * File implements `Echo#File()` for sub-routes within the Group. Panics on error.
+ */
+ file(path: string, ...middleware: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * RouteNotFound implements `Echo#RouteNotFound()` for sub-routes within the Group.
+ *
+ * Example: `g.RouteNotFound("/*", func(c echo.Context) error { return c.NoContent(http.StatusNotFound) })`
+ */
+ routeNotFound(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * Add implements `Echo#Add()` for sub-routes within the Group. Panics on error.
+ */
+ add(method: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): RouteInfo
+ }
+ interface Group {
+ /**
+ * AddRoute registers a new Routable with Router
+ */
+ addRoute(route: Routable): RouteInfo
+ }
+ /**
+ * IPExtractor is a function to extract IP addr from http.Request.
+ * Set appropriate one to Echo#IPExtractor.
+ * See https://echo.labstack.com/guide/ip-address for more details.
+ */
+ interface IPExtractor {(_arg0: http.Request): string }
+ /**
+ * Logger defines the logging interface that Echo uses internally in few places.
+ * For logging in handlers use your own logger instance (dependency injected or package/public variable) from logging framework of your choice.
+ */
+ interface Logger {
+ /**
+ * Write provides writer interface for http.Server `ErrorLog` and for logging startup messages.
+ * `http.Server.ErrorLog` logs errors from accepting connections, unexpected behavior from handlers,
+ * and underlying FileSystem errors.
+ * `logger` middleware will use this method to write its JSON payload.
+ */
+ write(p: string): number
+ /**
+ * Error logs the error
+ */
+ error(err: Error): void
+ }
+ /**
+ * Response wraps an http.ResponseWriter and implements its interface to be used
+ * by an HTTP handler to construct an HTTP response.
+ * See: https://golang.org/pkg/net/http/#ResponseWriter
+ */
+ interface Response {
+ writer: http.ResponseWriter
+ status: number
+ size: number
+ committed: boolean
+ }
+ interface Response {
+ /**
+ * Header returns the header map for the writer that will be sent by
+ * WriteHeader. Changing the header after a call to WriteHeader (or Write) has
+ * no effect unless the modified headers were declared as trailers by setting
+ * the "Trailer" header before the call to WriteHeader (see example)
+ * To suppress implicit response headers, set their value to nil.
+ * Example: https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
+ */
+ header(): http.Header
+ }
+ interface Response {
+ /**
+ * Before registers a function which is called just before the response is written.
+ */
+ before(fn: () => void): void
+ }
+ interface Response {
+ /**
+ * After registers a function which is called just after the response is written.
+ * If the `Content-Length` is unknown, none of the after function is executed.
+ */
+ after(fn: () => void): void
+ }
+ interface Response {
+ /**
+ * WriteHeader sends an HTTP response header with status code. If WriteHeader is
+ * not called explicitly, the first call to Write will trigger an implicit
+ * WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly
+ * used to send error codes.
+ */
+ writeHeader(code: number): void
+ }
+ interface Response {
+ /**
+ * Write writes the data to the connection as part of an HTTP reply.
+ */
+ write(b: string): number
+ }
+ interface Response {
+ /**
+ * Flush implements the http.Flusher interface to allow an HTTP handler to flush
+ * buffered data to the client.
+ * See [http.Flusher](https://golang.org/pkg/net/http/#Flusher)
+ */
+ flush(): void
+ }
+ interface Response {
+ /**
+ * Hijack implements the http.Hijacker interface to allow an HTTP handler to
+ * take over the connection.
+ * See [http.Hijacker](https://golang.org/pkg/net/http/#Hijacker)
+ */
+ hijack(): [net.Conn, (bufio.ReadWriter | undefined)]
+ }
+ interface Routes {
+ /**
+ * Reverse reverses route to URL string by replacing path parameters with given params values.
+ */
+ reverse(name: string, ...params: {
+ }[]): string
+ }
+ interface Routes {
+ /**
+ * FindByMethodPath searched for matching route info by method and path
+ */
+ findByMethodPath(method: string, path: string): RouteInfo
+ }
+ interface Routes {
+ /**
+ * FilterByMethod searched for matching route info by method
+ */
+ filterByMethod(method: string): Routes
+ }
+ interface Routes {
+ /**
+ * FilterByPath searched for matching route info by path
+ */
+ filterByPath(path: string): Routes
+ }
+ interface Routes {
+ /**
+ * FilterByName searched for matching route info by name
+ */
+ filterByName(name: string): Routes
+ }
+ /**
+ * Router is interface for routing request contexts to registered routes.
+ *
+ * Contract between Echo/Context instance and the router:
+ * * all routes must be added through methods on echo.Echo instance.
+ * ```
+ * Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see `Echo.contextPathParamAllocSize`).
+ * ```
+ * * Router must populate Context during Router.Route call with:
+ * ```
+ * * RoutableContext.SetPath
+ * * RoutableContext.SetRawPathParams (IMPORTANT! with same slice pointer that c.RawPathParams() returns)
+ * * RoutableContext.SetRouteInfo
+ * And optionally can set additional information to Context with RoutableContext.Set
+ * ```
+ */
+ interface Router {
+ /**
+ * Add registers Routable with the Router and returns registered RouteInfo
+ */
+ add(routable: Routable): RouteInfo
+ /**
+ * Remove removes route from the Router
+ */
+ remove(method: string, path: string): void
+ /**
+ * Routes returns information about all registered routes
+ */
+ routes(): Routes
+ /**
+ * Route searches Router for matching route and applies it to the given context. In case when no matching method
+ * was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404
+ * handler function.
+ */
+ route(c: RoutableContext): HandlerFunc
+ }
+ /**
+ * Routable is interface for registering Route with Router. During route registration process the Router will
+ * convert Routable to RouteInfo with ToRouteInfo method. By creating custom implementation of Routable additional
+ * information about registered route can be stored in Routes (i.e. privileges used with route etc.)
+ */
+ interface Routable {
+ /**
+ * ToRouteInfo converts Routable to RouteInfo
+ *
+ * This method is meant to be used by Router after it parses url for path parameters, to store information about
+ * route just added.
+ */
+ toRouteInfo(params: Array): RouteInfo
+ /**
+ * ToRoute converts Routable to Route which Router uses to register the method handler for path.
+ *
+ * This method is meant to be used by Router to get fields (including handler and middleware functions) needed to
+ * add Route to Router.
+ */
+ toRoute(): Route
+ /**
+ * ForGroup recreates routable with added group prefix and group middlewares it is grouped to.
+ *
+ * Is necessary for Echo.Group to be able to add/register Routable with Router and having group prefix and group
+ * middlewares included in actually registered Route.
+ */
+ forGroup(pathPrefix: string, middlewares: Array): Routable
+ }
+ /**
+ * Routes is collection of RouteInfo instances with various helper methods.
+ */
+ interface Routes extends Array{}
+ /**
+ * RouteInfo describes registered route base fields.
+ * Method+Path pair uniquely identifies the Route. Name can have duplicates.
+ */
+ interface RouteInfo {
+ method(): string
+ path(): string
+ name(): string
+ params(): Array
+ reverse(...params: {
+ }[]): string
+ }
+ /**
+ * PathParams is collections of PathParam instances with various helper methods
+ */
+ interface PathParams extends Array{}
+ interface PathParams {
+ /**
+ * Get returns path parameter value for given name or default value.
+ */
+ get(name: string, defaultValue: string): string
+ }
+}
+
+namespace settings {
+ // @ts-ignore
+ import validation = ozzo_validation
+ interface TokenConfig {
+ secret: string
+ duration: number
+ }
+ interface TokenConfig {
+ /**
+ * Validate makes TokenConfig validatable by implementing [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ interface SmtpConfig {
+ enabled: boolean
+ host: string
+ port: number
+ username: string
+ password: string
+ /**
+ * SMTP AUTH - PLAIN (default) or LOGIN
+ */
+ authMethod: string
+ /**
+ * Whether to enforce TLS encryption for the mail server connection.
+ *
+ * When set to false StartTLS command is send, leaving the server
+ * to decide whether to upgrade the connection or not.
+ */
+ tls: boolean
+ }
+ interface SmtpConfig {
+ /**
+ * Validate makes SmtpConfig validatable by implementing [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ interface S3Config {
+ enabled: boolean
+ bucket: string
+ region: string
+ endpoint: string
+ accessKey: string
+ secret: string
+ forcePathStyle: boolean
+ }
+ interface S3Config {
+ /**
+ * Validate makes S3Config validatable by implementing [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ interface BackupsConfig {
+ /**
+ * Cron is a cron expression to schedule auto backups, eg. "* * * * *".
+ *
+ * Leave it empty to disable the auto backups functionality.
+ */
+ cron: string
+ /**
+ * CronMaxKeep is the the max number of cron generated backups to
+ * keep before removing older entries.
+ *
+ * This field works only when the cron config has valid cron expression.
+ */
+ cronMaxKeep: number
+ /**
+ * S3 is an optional S3 storage config specifying where to store the app backups.
+ */
+ s3: S3Config
+ }
+ interface BackupsConfig {
+ /**
+ * Validate makes BackupsConfig validatable by implementing [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ interface MetaConfig {
+ appName: string
+ appUrl: string
+ hideControls: boolean
+ senderName: string
+ senderAddress: string
+ verificationTemplate: EmailTemplate
+ resetPasswordTemplate: EmailTemplate
+ confirmEmailChangeTemplate: EmailTemplate
+ }
+ interface MetaConfig {
+ /**
+ * Validate makes MetaConfig validatable by implementing [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ interface LogsConfig {
+ maxDays: number
+ }
+ interface LogsConfig {
+ /**
+ * Validate makes LogsConfig validatable by implementing [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ interface AuthProviderConfig {
+ enabled: boolean
+ clientId: string
+ clientSecret: string
+ authUrl: string
+ tokenUrl: string
+ userApiUrl: string
+ }
+ interface AuthProviderConfig {
+ /**
+ * Validate makes `ProviderConfig` validatable by implementing [validation.Validatable] interface.
+ */
+ validate(): void
+ }
+ interface AuthProviderConfig {
+ /**
+ * SetupProvider loads the current AuthProviderConfig into the specified provider.
+ */
+ setupProvider(provider: auth.Provider): void
+ }
+ /**
+ * Deprecated: Will be removed in v0.9+
+ */
+ interface EmailAuthConfig {
+ enabled: boolean
+ exceptDomains: Array
+ onlyDomains: Array
+ minPasswordLength: number
+ }
+ interface EmailAuthConfig {
+ /**
+ * Deprecated: Will be removed in v0.9+
+ */
+ validate(): void
+ }
+}
+
+/**
+ * Package daos handles common PocketBase DB model manipulations.
+ *
+ * Think of daos as DB repository and service layer in one.
+ */
+namespace daos {
+ /**
+ * ExpandFetchFunc defines the function that is used to fetch the expanded relation records.
+ */
+ interface ExpandFetchFunc {(relCollection: models.Collection, relIds: Array): Array<(models.Record | undefined)> }
+ // @ts-ignore
+ import validation = ozzo_validation
+ interface RequestsStatsItem {
+ total: number
+ date: types.DateTime
+ }
+}
+
+namespace subscriptions {
+ /**
+ * Broker defines a struct for managing subscriptions clients.
+ */
+ interface Broker {
+ }
+ interface Broker {
+ /**
+ * Clients returns a shallow copy of all registered clients indexed
+ * with their connection id.
+ */
+ clients(): _TygojaDict
+ }
+ interface Broker {
+ /**
+ * ClientById finds a registered client by its id.
+ *
+ * Returns non-nil error when client with clientId is not registered.
+ */
+ clientById(clientId: string): Client
+ }
+ interface Broker {
+ /**
+ * Register adds a new client to the broker instance.
+ */
+ register(client: Client): void
+ }
+ interface Broker {
+ /**
+ * Unregister removes a single client by its id.
+ *
+ * If client with clientId doesn't exist, this method does nothing.
+ */
+ unregister(clientId: string): void
+ }
+}
+
/**
* Package pflag is a drop-in replacement for Go's flag package, implementing
* POSIX/GNU-style --flags.
@@ -12326,2378 +14771,51 @@ namespace pflag {
}
/**
- * Package url parses URLs and implements query escaping.
+ * Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
+ * In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code.
*/
-namespace url {
- /**
- * A URL represents a parsed URL (technically, a URI reference).
- *
- * The general form represented is:
- *
- * ```
- * [scheme:][//[userinfo@]host][/]path[?query][#fragment]
- * ```
- *
- * URLs that do not start with a slash after the scheme are interpreted as:
- *
- * ```
- * scheme:opaque[?query][#fragment]
- * ```
- *
- * Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.
- * A consequence is that it is impossible to tell which slashes in the Path were
- * slashes in the raw URL and which were %2f. This distinction is rarely important,
- * but when it is, the code should use RawPath, an optional field which only gets
- * set if the default encoding is different from Path.
- *
- * URL's String method uses the EscapedPath method to obtain the path. See the
- * EscapedPath method for more details.
- */
- interface URL {
- scheme: string
- opaque: string // encoded opaque data
- user?: Userinfo // username and password information
- host: string // host or host:port
- path: string // path (relative paths may omit leading slash)
- rawPath: string // encoded path hint (see EscapedPath method)
- omitHost: boolean // do not emit empty host (authority)
- forceQuery: boolean // append a query ('?') even if RawQuery is empty
- rawQuery: string // encoded query values, without '?'
- fragment: string // fragment for references, without '#'
- rawFragment: string // encoded fragment hint (see EscapedFragment method)
- }
- interface URL {
- /**
- * EscapedPath returns the escaped form of u.Path.
- * In general there are multiple possible escaped forms of any path.
- * EscapedPath returns u.RawPath when it is a valid escaping of u.Path.
- * Otherwise EscapedPath ignores u.RawPath and computes an escaped
- * form on its own.
- * The String and RequestURI methods use EscapedPath to construct
- * their results.
- * In general, code should call EscapedPath instead of
- * reading u.RawPath directly.
- */
- escapedPath(): string
- }
- interface URL {
- /**
- * EscapedFragment returns the escaped form of u.Fragment.
- * In general there are multiple possible escaped forms of any fragment.
- * EscapedFragment returns u.RawFragment when it is a valid escaping of u.Fragment.
- * Otherwise EscapedFragment ignores u.RawFragment and computes an escaped
- * form on its own.
- * The String method uses EscapedFragment to construct its result.
- * In general, code should call EscapedFragment instead of
- * reading u.RawFragment directly.
- */
- escapedFragment(): string
- }
- interface URL {
- /**
- * String reassembles the URL into a valid URL string.
- * The general form of the result is one of:
- *
- * ```
- * scheme:opaque?query#fragment
- * scheme://userinfo@host/path?query#fragment
- * ```
- *
- * If u.Opaque is non-empty, String uses the first form;
- * otherwise it uses the second form.
- * Any non-ASCII characters in host are escaped.
- * To obtain the path, String uses u.EscapedPath().
- *
- * In the second form, the following rules apply:
- * ```
- * - if u.Scheme is empty, scheme: is omitted.
- * - if u.User is nil, userinfo@ is omitted.
- * - if u.Host is empty, host/ is omitted.
- * - if u.Scheme and u.Host are empty and u.User is nil,
- * the entire scheme://userinfo@host/ is omitted.
- * - if u.Host is non-empty and u.Path begins with a /,
- * the form host/path does not add its own /.
- * - if u.RawQuery is empty, ?query is omitted.
- * - if u.Fragment is empty, #fragment is omitted.
- * ```
- */
- string(): string
- }
- interface URL {
- /**
- * Redacted is like String but replaces any password with "xxxxx".
- * Only the password in u.URL is redacted.
- */
- redacted(): string
- }
- /**
- * Values maps a string key to a list of values.
- * It is typically used for query parameters and form values.
- * Unlike in the http.Header map, the keys in a Values map
- * are case-sensitive.
- */
- interface Values extends _TygojaDict{}
- interface Values {
- /**
- * Get gets the first value associated with the given key.
- * If there are no values associated with the key, Get returns
- * the empty string. To access multiple values, use the map
- * directly.
- */
- get(key: string): string
- }
- interface Values {
- /**
- * Set sets the key to value. It replaces any existing
- * values.
- */
- set(key: string): void
- }
- interface Values {
- /**
- * Add adds the value to key. It appends to any existing
- * values associated with key.
- */
- add(key: string): void
- }
- interface Values {
- /**
- * Del deletes the values associated with key.
- */
- del(key: string): void
- }
- interface Values {
- /**
- * Has checks whether a given key is set.
- */
- has(key: string): boolean
- }
- interface Values {
- /**
- * Encode encodes the values into “URL encoded” form
- * ("bar=baz&foo=quux") sorted by key.
- */
- encode(): string
- }
- interface URL {
- /**
- * IsAbs reports whether the URL is absolute.
- * Absolute means that it has a non-empty scheme.
- */
- isAbs(): boolean
- }
- interface URL {
- /**
- * Parse parses a URL in the context of the receiver. The provided URL
- * may be relative or absolute. Parse returns nil, err on parse
- * failure, otherwise its return value is the same as ResolveReference.
- */
- parse(ref: string): (URL | undefined)
- }
- interface URL {
- /**
- * ResolveReference resolves a URI reference to an absolute URI from
- * an absolute base URI u, per RFC 3986 Section 5.2. The URI reference
- * may be relative or absolute. ResolveReference always returns a new
- * URL instance, even if the returned URL is identical to either the
- * base or reference. If ref is an absolute URL, then ResolveReference
- * ignores base and returns a copy of ref.
- */
- resolveReference(ref: URL): (URL | undefined)
- }
- interface URL {
- /**
- * Query parses RawQuery and returns the corresponding values.
- * It silently discards malformed value pairs.
- * To check errors use ParseQuery.
- */
- query(): Values
- }
- interface URL {
- /**
- * RequestURI returns the encoded path?query or opaque?query
- * string that would be used in an HTTP request for u.
- */
- requestURI(): string
- }
- interface URL {
- /**
- * Hostname returns u.Host, stripping any valid port number if present.
- *
- * If the result is enclosed in square brackets, as literal IPv6 addresses are,
- * the square brackets are removed from the result.
- */
- hostname(): string
- }
- interface URL {
- /**
- * Port returns the port part of u.Host, without the leading colon.
- *
- * If u.Host doesn't contain a valid numeric port, Port returns an empty string.
- */
- port(): string
- }
- interface URL {
- marshalBinary(): string
- }
- interface URL {
- unmarshalBinary(text: string): void
- }
- interface URL {
- /**
- * JoinPath returns a new URL with the provided path elements joined to
- * any existing path and the resulting path cleaned of any ./ or ../ elements.
- * Any sequences of multiple / characters will be reduced to a single /.
- */
- joinPath(...elem: string[]): (URL | undefined)
- }
-}
-
-/**
- * Package tls partially implements TLS 1.2, as specified in RFC 5246,
- * and TLS 1.3, as specified in RFC 8446.
- */
-namespace tls {
- /**
- * ConnectionState records basic TLS details about the connection.
- */
- interface ConnectionState {
- /**
- * Version is the TLS version used by the connection (e.g. VersionTLS12).
- */
- version: number
- /**
- * HandshakeComplete is true if the handshake has concluded.
- */
- handshakeComplete: boolean
- /**
- * DidResume is true if this connection was successfully resumed from a
- * previous session with a session ticket or similar mechanism.
- */
- didResume: boolean
- /**
- * CipherSuite is the cipher suite negotiated for the connection (e.g.
- * TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_AES_128_GCM_SHA256).
- */
- cipherSuite: number
- /**
- * NegotiatedProtocol is the application protocol negotiated with ALPN.
- */
- negotiatedProtocol: string
- /**
- * NegotiatedProtocolIsMutual used to indicate a mutual NPN negotiation.
- *
- * Deprecated: this value is always true.
- */
- negotiatedProtocolIsMutual: boolean
- /**
- * ServerName is the value of the Server Name Indication extension sent by
- * the client. It's available both on the server and on the client side.
- */
- serverName: string
- /**
- * PeerCertificates are the parsed certificates sent by the peer, in the
- * order in which they were sent. The first element is the leaf certificate
- * that the connection is verified against.
- *
- * On the client side, it can't be empty. On the server side, it can be
- * empty if Config.ClientAuth is not RequireAnyClientCert or
- * RequireAndVerifyClientCert.
- */
- peerCertificates: Array<(x509.Certificate | undefined)>
- /**
- * VerifiedChains is a list of one or more chains where the first element is
- * PeerCertificates[0] and the last element is from Config.RootCAs (on the
- * client side) or Config.ClientCAs (on the server side).
- *
- * On the client side, it's set if Config.InsecureSkipVerify is false. On
- * the server side, it's set if Config.ClientAuth is VerifyClientCertIfGiven
- * (and the peer provided a certificate) or RequireAndVerifyClientCert.
- */
- verifiedChains: Array>
- /**
- * SignedCertificateTimestamps is a list of SCTs provided by the peer
- * through the TLS handshake for the leaf certificate, if any.
- */
- signedCertificateTimestamps: Array
- /**
- * OCSPResponse is a stapled Online Certificate Status Protocol (OCSP)
- * response provided by the peer for the leaf certificate, if any.
- */
- ocspResponse: string
- /**
- * TLSUnique contains the "tls-unique" channel binding value (see RFC 5929,
- * Section 3). This value will be nil for TLS 1.3 connections and for all
- * resumed connections.
- *
- * Deprecated: there are conditions in which this value might not be unique
- * to a connection. See the Security Considerations sections of RFC 5705 and
- * RFC 7627, and https://mitls.org/pages/attacks/3SHAKE#channelbindings.
- */
- tlsUnique: string
- }
- interface ConnectionState {
- /**
- * ExportKeyingMaterial returns length bytes of exported key material in a new
- * slice as defined in RFC 5705. If context is nil, it is not used as part of
- * the seed. If the connection was set to allow renegotiation via
- * Config.Renegotiation, this function will return an error.
- */
- exportKeyingMaterial(label: string, context: string, length: number): string
- }
-}
-
-/**
- * Package multipart implements MIME multipart parsing, as defined in RFC
- * 2046.
- *
- * The implementation is sufficient for HTTP (RFC 2388) and the multipart
- * bodies generated by popular browsers.
- */
-namespace multipart {
- interface Reader {
- /**
- * ReadForm parses an entire multipart message whose parts have
- * a Content-Disposition of "form-data".
- * It stores up to maxMemory bytes + 10MB (reserved for non-file parts)
- * in memory. File parts which can't be stored in memory will be stored on
- * disk in temporary files.
- * It returns ErrMessageTooLarge if all non-file parts can't be stored in
- * memory.
- */
- readForm(maxMemory: number): (Form | undefined)
- }
- /**
- * Form is a parsed multipart form.
- * Its File parts are stored either in memory or on disk,
- * and are accessible via the *FileHeader's Open method.
- * Its Value parts are stored as strings.
- * Both are keyed by field name.
- */
- interface Form {
- value: _TygojaDict
- file: _TygojaDict
- }
- interface Form {
- /**
- * RemoveAll removes any temporary files associated with a Form.
- */
- removeAll(): void
- }
- /**
- * File is an interface to access the file part of a multipart message.
- * Its contents may be either stored in memory or on disk.
- * If stored on disk, the File's underlying concrete type will be an *os.File.
- */
- interface File {
- }
- /**
- * Reader is an iterator over parts in a MIME multipart body.
- * Reader's underlying parser consumes its input as needed. Seeking
- * isn't supported.
- */
- interface Reader {
- }
- interface Reader {
- /**
- * NextPart returns the next part in the multipart or an error.
- * When there are no more parts, the error io.EOF is returned.
- *
- * As a special case, if the "Content-Transfer-Encoding" header
- * has a value of "quoted-printable", that header is instead
- * hidden and the body is transparently decoded during Read calls.
- */
- nextPart(): (Part | undefined)
- }
- interface Reader {
- /**
- * NextRawPart returns the next part in the multipart or an error.
- * When there are no more parts, the error io.EOF is returned.
- *
- * Unlike NextPart, it does not have special handling for
- * "Content-Transfer-Encoding: quoted-printable".
- */
- nextRawPart(): (Part | undefined)
- }
-}
-
-/**
- * Package http provides HTTP client and server implementations.
- *
- * Get, Head, Post, and PostForm make HTTP (or HTTPS) requests:
- *
- * ```
- * resp, err := http.Get("http://example.com/")
- * ...
- * resp, err := http.Post("http://example.com/upload", "image/jpeg", &buf)
- * ...
- * resp, err := http.PostForm("http://example.com/form",
- * url.Values{"key": {"Value"}, "id": {"123"}})
- * ```
- *
- * The client must close the response body when finished with it:
- *
- * ```
- * resp, err := http.Get("http://example.com/")
- * if err != nil {
- * // handle error
- * }
- * defer resp.Body.Close()
- * body, err := io.ReadAll(resp.Body)
- * // ...
- * ```
- *
- * For control over HTTP client headers, redirect policy, and other
- * settings, create a Client:
- *
- * ```
- * client := &http.Client{
- * CheckRedirect: redirectPolicyFunc,
- * }
- *
- * resp, err := client.Get("http://example.com")
- * // ...
- *
- * req, err := http.NewRequest("GET", "http://example.com", nil)
- * // ...
- * req.Header.Add("If-None-Match", `W/"wyzzy"`)
- * resp, err := client.Do(req)
- * // ...
- * ```
- *
- * For control over proxies, TLS configuration, keep-alives,
- * compression, and other settings, create a Transport:
- *
- * ```
- * tr := &http.Transport{
- * MaxIdleConns: 10,
- * IdleConnTimeout: 30 * time.Second,
- * DisableCompression: true,
- * }
- * client := &http.Client{Transport: tr}
- * resp, err := client.Get("https://example.com")
- * ```
- *
- * Clients and Transports are safe for concurrent use by multiple
- * goroutines and for efficiency should only be created once and re-used.
- *
- * ListenAndServe starts an HTTP server with a given address and handler.
- * The handler is usually nil, which means to use DefaultServeMux.
- * Handle and HandleFunc add handlers to DefaultServeMux:
- *
- * ```
- * http.Handle("/foo", fooHandler)
- *
- * http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) {
- * fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
- * })
- *
- * log.Fatal(http.ListenAndServe(":8080", nil))
- * ```
- *
- * More control over the server's behavior is available by creating a
- * custom Server:
- *
- * ```
- * s := &http.Server{
- * Addr: ":8080",
- * Handler: myHandler,
- * ReadTimeout: 10 * time.Second,
- * WriteTimeout: 10 * time.Second,
- * MaxHeaderBytes: 1 << 20,
- * }
- * log.Fatal(s.ListenAndServe())
- * ```
- *
- * Starting with Go 1.6, the http package has transparent support for the
- * HTTP/2 protocol when using HTTPS. Programs that must disable HTTP/2
- * can do so by setting Transport.TLSNextProto (for clients) or
- * Server.TLSNextProto (for servers) to a non-nil, empty
- * map. Alternatively, the following GODEBUG environment variables are
- * currently supported:
- *
- * ```
- * GODEBUG=http2client=0 # disable HTTP/2 client support
- * GODEBUG=http2server=0 # disable HTTP/2 server support
- * GODEBUG=http2debug=1 # enable verbose HTTP/2 debug logs
- * GODEBUG=http2debug=2 # ... even more verbose, with frame dumps
- * ```
- *
- * The GODEBUG variables are not covered by Go's API compatibility
- * promise. Please report any issues before disabling HTTP/2
- * support: https://golang.org/s/http2bug
- *
- * The http package's Transport and Server both automatically enable
- * HTTP/2 support for simple configurations. To enable HTTP/2 for more
- * complex configurations, to use lower-level HTTP/2 features, or to use
- * a newer version of Go's http2 package, import "golang.org/x/net/http2"
- * directly and use its ConfigureTransport and/or ConfigureServer
- * functions. Manually configuring HTTP/2 via the golang.org/x/net/http2
- * package takes precedence over the net/http package's built-in HTTP/2
- * support.
- */
-namespace http {
- /**
- * A Client is an HTTP client. Its zero value (DefaultClient) is a
- * usable client that uses DefaultTransport.
- *
- * The Client's Transport typically has internal state (cached TCP
- * connections), so Clients should be reused instead of created as
- * needed. Clients are safe for concurrent use by multiple goroutines.
- *
- * A Client is higher-level than a RoundTripper (such as Transport)
- * and additionally handles HTTP details such as cookies and
- * redirects.
- *
- * When following redirects, the Client will forward all headers set on the
- * initial Request except:
- *
- * • when forwarding sensitive headers like "Authorization",
- * "WWW-Authenticate", and "Cookie" to untrusted targets.
- * These headers will be ignored when following a redirect to a domain
- * that is not a subdomain match or exact match of the initial domain.
- * For example, a redirect from "foo.com" to either "foo.com" or "sub.foo.com"
- * will forward the sensitive headers, but a redirect to "bar.com" will not.
- *
- * • when forwarding the "Cookie" header with a non-nil cookie Jar.
- * Since each redirect may mutate the state of the cookie jar,
- * a redirect may possibly alter a cookie set in the initial request.
- * When forwarding the "Cookie" header, any mutated cookies will be omitted,
- * with the expectation that the Jar will insert those mutated cookies
- * with the updated values (assuming the origin matches).
- * If Jar is nil, the initial cookies are forwarded without change.
- */
- interface Client {
- /**
- * Transport specifies the mechanism by which individual
- * HTTP requests are made.
- * If nil, DefaultTransport is used.
- */
- transport: RoundTripper
- /**
- * CheckRedirect specifies the policy for handling redirects.
- * If CheckRedirect is not nil, the client calls it before
- * following an HTTP redirect. The arguments req and via are
- * the upcoming request and the requests made already, oldest
- * first. If CheckRedirect returns an error, the Client's Get
- * method returns both the previous Response (with its Body
- * closed) and CheckRedirect's error (wrapped in a url.Error)
- * instead of issuing the Request req.
- * As a special case, if CheckRedirect returns ErrUseLastResponse,
- * then the most recent response is returned with its body
- * unclosed, along with a nil error.
- *
- * If CheckRedirect is nil, the Client uses its default policy,
- * which is to stop after 10 consecutive requests.
- */
- checkRedirect: (req: Request, via: Array<(Request | undefined)>) => void
- /**
- * Jar specifies the cookie jar.
- *
- * The Jar is used to insert relevant cookies into every
- * outbound Request and is updated with the cookie values
- * of every inbound Response. The Jar is consulted for every
- * redirect that the Client follows.
- *
- * If Jar is nil, cookies are only sent if they are explicitly
- * set on the Request.
- */
- jar: CookieJar
- /**
- * Timeout specifies a time limit for requests made by this
- * Client. The timeout includes connection time, any
- * redirects, and reading the response body. The timer remains
- * running after Get, Head, Post, or Do return and will
- * interrupt reading of the Response.Body.
- *
- * A Timeout of zero means no timeout.
- *
- * The Client cancels requests to the underlying Transport
- * as if the Request's Context ended.
- *
- * For compatibility, the Client will also use the deprecated
- * CancelRequest method on Transport if found. New
- * RoundTripper implementations should use the Request's Context
- * for cancellation instead of implementing CancelRequest.
- */
- timeout: time.Duration
- }
- interface Client {
- /**
- * Get issues a GET to the specified URL. If the response is one of the
- * following redirect codes, Get follows the redirect after calling the
- * Client's CheckRedirect function:
- *
- * ```
- * 301 (Moved Permanently)
- * 302 (Found)
- * 303 (See Other)
- * 307 (Temporary Redirect)
- * 308 (Permanent Redirect)
- * ```
- *
- * An error is returned if the Client's CheckRedirect function fails
- * or if there was an HTTP protocol error. A non-2xx response doesn't
- * cause an error. Any returned error will be of type *url.Error. The
- * url.Error value's Timeout method will report true if the request
- * timed out.
- *
- * When err is nil, resp always contains a non-nil resp.Body.
- * Caller should close resp.Body when done reading from it.
- *
- * To make a request with custom headers, use NewRequest and Client.Do.
- *
- * To make a request with a specified context.Context, use NewRequestWithContext
- * and Client.Do.
- */
- get(url: string): (Response | undefined)
- }
- interface Client {
- /**
- * Do sends an HTTP request and returns an HTTP response, following
- * policy (such as redirects, cookies, auth) as configured on the
- * client.
- *
- * An error is returned if caused by client policy (such as
- * CheckRedirect), or failure to speak HTTP (such as a network
- * connectivity problem). A non-2xx status code doesn't cause an
- * error.
- *
- * If the returned error is nil, the Response will contain a non-nil
- * Body which the user is expected to close. If the Body is not both
- * read to EOF and closed, the Client's underlying RoundTripper
- * (typically Transport) may not be able to re-use a persistent TCP
- * connection to the server for a subsequent "keep-alive" request.
- *
- * The request Body, if non-nil, will be closed by the underlying
- * Transport, even on errors.
- *
- * On error, any Response can be ignored. A non-nil Response with a
- * non-nil error only occurs when CheckRedirect fails, and even then
- * the returned Response.Body is already closed.
- *
- * Generally Get, Post, or PostForm will be used instead of Do.
- *
- * If the server replies with a redirect, the Client first uses the
- * CheckRedirect function to determine whether the redirect should be
- * followed. If permitted, a 301, 302, or 303 redirect causes
- * subsequent requests to use HTTP method GET
- * (or HEAD if the original request was HEAD), with no body.
- * A 307 or 308 redirect preserves the original HTTP method and body,
- * provided that the Request.GetBody function is defined.
- * The NewRequest function automatically sets GetBody for common
- * standard library body types.
- *
- * Any returned error will be of type *url.Error. The url.Error
- * value's Timeout method will report true if the request timed out.
- */
- do(req: Request): (Response | undefined)
- }
- interface Client {
- /**
- * Post issues a POST to the specified URL.
- *
- * Caller should close resp.Body when done reading from it.
- *
- * If the provided body is an io.Closer, it is closed after the
- * request.
- *
- * To set custom headers, use NewRequest and Client.Do.
- *
- * To make a request with a specified context.Context, use NewRequestWithContext
- * and Client.Do.
- *
- * See the Client.Do method documentation for details on how redirects
- * are handled.
- */
- post(url: string, body: io.Reader): (Response | undefined)
- }
- interface Client {
- /**
- * PostForm issues a POST to the specified URL,
- * with data's keys and values URL-encoded as the request body.
- *
- * The Content-Type header is set to application/x-www-form-urlencoded.
- * To set other headers, use NewRequest and Client.Do.
- *
- * When err is nil, resp always contains a non-nil resp.Body.
- * Caller should close resp.Body when done reading from it.
- *
- * See the Client.Do method documentation for details on how redirects
- * are handled.
- *
- * To make a request with a specified context.Context, use NewRequestWithContext
- * and Client.Do.
- */
- postForm(url: string, data: url.Values): (Response | undefined)
- }
- interface Client {
- /**
- * Head issues a HEAD to the specified URL. If the response is one of the
- * following redirect codes, Head follows the redirect after calling the
- * Client's CheckRedirect function:
- *
- * ```
- * 301 (Moved Permanently)
- * 302 (Found)
- * 303 (See Other)
- * 307 (Temporary Redirect)
- * 308 (Permanent Redirect)
- * ```
- *
- * To make a request with a specified context.Context, use NewRequestWithContext
- * and Client.Do.
- */
- head(url: string): (Response | undefined)
- }
- interface Client {
- /**
- * CloseIdleConnections closes any connections on its Transport which
- * were previously connected from previous requests but are now
- * sitting idle in a "keep-alive" state. It does not interrupt any
- * connections currently in use.
- *
- * If the Client's Transport does not have a CloseIdleConnections method
- * then this method does nothing.
- */
- closeIdleConnections(): void
- }
- /**
- * A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an
- * HTTP response or the Cookie header of an HTTP request.
- *
- * See https://tools.ietf.org/html/rfc6265 for details.
- */
- interface Cookie {
- name: string
- value: string
- path: string // optional
- domain: string // optional
- expires: time.Time // optional
- rawExpires: string // for reading cookies only
- /**
- * MaxAge=0 means no 'Max-Age' attribute specified.
- * MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
- * MaxAge>0 means Max-Age attribute present and given in seconds
- */
- maxAge: number
- secure: boolean
- httpOnly: boolean
- sameSite: SameSite
- raw: string
- unparsed: Array // Raw text of unparsed attribute-value pairs
- }
- interface Cookie {
- /**
- * String returns the serialization of the cookie for use in a Cookie
- * header (if only Name and Value are set) or a Set-Cookie response
- * header (if other fields are set).
- * If c is nil or c.Name is invalid, the empty string is returned.
- */
- string(): string
- }
- interface Cookie {
- /**
- * Valid reports whether the cookie is valid.
- */
- valid(): void
- }
+namespace cobra {
+ interface PositionalArgs {(cmd: Command, args: Array): void }
// @ts-ignore
- import mathrand = rand
+ import flag = pflag
/**
- * A Header represents the key-value pairs in an HTTP header.
- *
- * The keys should be in canonical form, as returned by
- * CanonicalHeaderKey.
+ * FParseErrWhitelist configures Flag parse errors to be ignored
*/
- interface Header extends _TygojaDict{}
- interface Header {
- /**
- * Add adds the key, value pair to the header.
- * It appends to any existing values associated with key.
- * The key is case insensitive; it is canonicalized by
- * CanonicalHeaderKey.
- */
- add(key: string): void
- }
- interface Header {
- /**
- * Set sets the header entries associated with key to the
- * single element value. It replaces any existing values
- * associated with key. The key is case insensitive; it is
- * canonicalized by textproto.CanonicalMIMEHeaderKey.
- * To use non-canonical keys, assign to the map directly.
- */
- set(key: string): void
- }
- interface Header {
- /**
- * Get gets the first value associated with the given key. If
- * there are no values associated with the key, Get returns "".
- * It is case insensitive; textproto.CanonicalMIMEHeaderKey is
- * used to canonicalize the provided key. Get assumes that all
- * keys are stored in canonical form. To use non-canonical keys,
- * access the map directly.
- */
- get(key: string): string
- }
- interface Header {
- /**
- * Values returns all values associated with the given key.
- * It is case insensitive; textproto.CanonicalMIMEHeaderKey is
- * used to canonicalize the provided key. To use non-canonical
- * keys, access the map directly.
- * The returned slice is not a copy.
- */
- values(key: string): Array
- }
- interface Header {
- /**
- * Del deletes the values associated with key.
- * The key is case insensitive; it is canonicalized by
- * CanonicalHeaderKey.
- */
- del(key: string): void
- }
- interface Header {
- /**
- * Write writes a header in wire format.
- */
- write(w: io.Writer): void
- }
- interface Header {
- /**
- * Clone returns a copy of h or nil if h is nil.
- */
- clone(): Header
- }
- interface Header {
- /**
- * WriteSubset writes a header in wire format.
- * If exclude is not nil, keys where exclude[key] == true are not written.
- * Keys are not canonicalized before checking the exclude map.
- */
- writeSubset(w: io.Writer, exclude: _TygojaDict): void
- }
- // @ts-ignore
- import urlpkg = url
+ interface FParseErrWhitelist extends flag.ParseErrorsWhitelist{}
/**
- * Response represents the response from an HTTP request.
- *
- * The Client and Transport return Responses from servers once
- * the response headers have been received. The response body
- * is streamed on demand as the Body field is read.
+ * Group Structure to manage groups for commands
*/
- interface Response {
- status: string // e.g. "200 OK"
- statusCode: number // e.g. 200
- proto: string // e.g. "HTTP/1.0"
- protoMajor: number // e.g. 1
- protoMinor: number // e.g. 0
- /**
- * Header maps header keys to values. If the response had multiple
- * headers with the same key, they may be concatenated, with comma
- * delimiters. (RFC 7230, section 3.2.2 requires that multiple headers
- * be semantically equivalent to a comma-delimited sequence.) When
- * Header values are duplicated by other fields in this struct (e.g.,
- * ContentLength, TransferEncoding, Trailer), the field values are
- * authoritative.
- *
- * Keys in the map are canonicalized (see CanonicalHeaderKey).
- */
- header: Header
- /**
- * Body represents the response body.
- *
- * The response body is streamed on demand as the Body field
- * is read. If the network connection fails or the server
- * terminates the response, Body.Read calls return an error.
- *
- * The http Client and Transport guarantee that Body is always
- * non-nil, even on responses without a body or responses with
- * a zero-length body. It is the caller's responsibility to
- * close Body. The default HTTP client's Transport may not
- * reuse HTTP/1.x "keep-alive" TCP connections if the Body is
- * not read to completion and closed.
- *
- * The Body is automatically dechunked if the server replied
- * with a "chunked" Transfer-Encoding.
- *
- * As of Go 1.12, the Body will also implement io.Writer
- * on a successful "101 Switching Protocols" response,
- * as used by WebSockets and HTTP/2's "h2c" mode.
- */
- body: io.ReadCloser
- /**
- * ContentLength records the length of the associated content. The
- * value -1 indicates that the length is unknown. Unless Request.Method
- * is "HEAD", values >= 0 indicate that the given number of bytes may
- * be read from Body.
- */
- contentLength: number
- /**
- * Contains transfer encodings from outer-most to inner-most. Value is
- * nil, means that "identity" encoding is used.
- */
- transferEncoding: Array
- /**
- * Close records whether the header directed that the connection be
- * closed after reading Body. The value is advice for clients: neither
- * ReadResponse nor Response.Write ever closes a connection.
- */
- close: boolean
- /**
- * Uncompressed reports whether the response was sent compressed but
- * was decompressed by the http package. When true, reading from
- * Body yields the uncompressed content instead of the compressed
- * content actually set from the server, ContentLength is set to -1,
- * and the "Content-Length" and "Content-Encoding" fields are deleted
- * from the responseHeader. To get the original response from
- * the server, set Transport.DisableCompression to true.
- */
- uncompressed: boolean
- /**
- * Trailer maps trailer keys to values in the same
- * format as Header.
- *
- * The Trailer initially contains only nil values, one for
- * each key specified in the server's "Trailer" header
- * value. Those values are not added to Header.
- *
- * Trailer must not be accessed concurrently with Read calls
- * on the Body.
- *
- * After Body.Read has returned io.EOF, Trailer will contain
- * any trailer values sent by the server.
- */
- trailer: Header
- /**
- * Request is the request that was sent to obtain this Response.
- * Request's Body is nil (having already been consumed).
- * This is only populated for Client requests.
- */
- request?: Request
- /**
- * TLS contains information about the TLS connection on which the
- * response was received. It is nil for unencrypted responses.
- * The pointer is shared between responses and should not be
- * modified.
- */
- tls?: tls.ConnectionState
- }
- interface Response {
- /**
- * Cookies parses and returns the cookies set in the Set-Cookie headers.
- */
- cookies(): Array<(Cookie | undefined)>
- }
- interface Response {
- /**
- * Location returns the URL of the response's "Location" header,
- * if present. Relative redirects are resolved relative to
- * the Response's Request. ErrNoLocation is returned if no
- * Location header is present.
- */
- location(): (url.URL | undefined)
- }
- interface Response {
- /**
- * ProtoAtLeast reports whether the HTTP protocol used
- * in the response is at least major.minor.
- */
- protoAtLeast(major: number): boolean
- }
- interface Response {
- /**
- * Write writes r to w in the HTTP/1.x server response format,
- * including the status line, headers, body, and optional trailer.
- *
- * This method consults the following fields of the response r:
- *
- * ```
- * StatusCode
- * ProtoMajor
- * ProtoMinor
- * Request.Method
- * TransferEncoding
- * Trailer
- * Body
- * ContentLength
- * Header, values for non-canonical keys will have unpredictable behavior
- * ```
- *
- * The Response Body is closed after it is sent.
- */
- write(w: io.Writer): void
- }
-}
-
-/**
- * Package driver defines interfaces to be implemented by database
- * drivers as used by package sql.
- *
- * Most code should use package sql.
- *
- * The driver interface has evolved over time. Drivers should implement
- * Connector and DriverContext interfaces.
- * The Connector.Connect and Driver.Open methods should never return ErrBadConn.
- * ErrBadConn should only be returned from Validator, SessionResetter, or
- * a query method if the connection is already in an invalid (e.g. closed) state.
- *
- * All Conn implementations should implement the following interfaces:
- * Pinger, SessionResetter, and Validator.
- *
- * If named parameters or context are supported, the driver's Conn should implement:
- * ExecerContext, QueryerContext, ConnPrepareContext, and ConnBeginTx.
- *
- * To support custom data types, implement NamedValueChecker. NamedValueChecker
- * also allows queries to accept per-query options as a parameter by returning
- * ErrRemoveArgument from CheckNamedValue.
- *
- * If multiple result sets are supported, Rows should implement RowsNextResultSet.
- * If the driver knows how to describe the types present in the returned result
- * it should implement the following interfaces: RowsColumnTypeScanType,
- * RowsColumnTypeDatabaseTypeName, RowsColumnTypeLength, RowsColumnTypeNullable,
- * and RowsColumnTypePrecisionScale. A given row value may also return a Rows
- * type, which may represent a database cursor value.
- *
- * Before a connection is returned to the connection pool after use, IsValid is
- * called if implemented. Before a connection is reused for another query,
- * ResetSession is called if implemented. If a connection is never returned to the
- * connection pool but immediately reused, then ResetSession is called prior to
- * reuse but IsValid is not called.
- */
-namespace driver {
- /**
- * Value is a value that drivers must be able to handle.
- * It is either nil, a type handled by a database driver's NamedValueChecker
- * interface, or an instance of one of these types:
- *
- * ```
- * int64
- * float64
- * bool
- * []byte
- * string
- * time.Time
- * ```
- *
- * If the driver supports cursors, a returned Value may also implement the Rows interface
- * in this package. This is used, for example, when a user selects a cursor
- * such as "select cursor(select * from my_table) from dual". If the Rows
- * from the select is closed, the cursor Rows will also be closed.
- */
- interface Value extends _TygojaAny{}
- /**
- * Driver is the interface that must be implemented by a database
- * driver.
- *
- * Database drivers may implement DriverContext for access
- * to contexts and to parse the name only once for a pool of connections,
- * instead of once per connection.
- */
- interface Driver {
- /**
- * Open returns a new connection to the database.
- * The name is a string in a driver-specific format.
- *
- * Open may return a cached connection (one previously
- * closed), but doing so is unnecessary; the sql package
- * maintains a pool of idle connections for efficient re-use.
- *
- * The returned connection is only used by one goroutine at a
- * time.
- */
- open(name: string): Conn
- }
-}
-
-/**
- * Package sql provides a generic interface around SQL (or SQL-like)
- * databases.
- *
- * The sql package must be used in conjunction with a database driver.
- * See https://golang.org/s/sqldrivers for a list of drivers.
- *
- * Drivers that do not support context cancellation will not return until
- * after the query is completed.
- *
- * For usage examples, see the wiki page at
- * https://golang.org/s/sqlwiki.
- */
-namespace sql {
- /**
- * IsolationLevel is the transaction isolation level used in TxOptions.
- */
- interface IsolationLevel extends Number{}
- interface IsolationLevel {
- /**
- * String returns the name of the transaction isolation level.
- */
- string(): string
- }
- /**
- * DBStats contains database statistics.
- */
- interface DBStats {
- maxOpenConnections: number // Maximum number of open connections to the database.
- /**
- * Pool Status
- */
- openConnections: number // The number of established connections both in use and idle.
- inUse: number // The number of connections currently in use.
- idle: number // The number of idle connections.
- /**
- * Counters
- */
- waitCount: number // The total number of connections waited for.
- waitDuration: time.Duration // The total time blocked waiting for a new connection.
- maxIdleClosed: number // The total number of connections closed due to SetMaxIdleConns.
- maxIdleTimeClosed: number // The total number of connections closed due to SetConnMaxIdleTime.
- maxLifetimeClosed: number // The total number of connections closed due to SetConnMaxLifetime.
- }
- /**
- * Conn represents a single database connection rather than a pool of database
- * connections. Prefer running queries from DB unless there is a specific
- * need for a continuous single database connection.
- *
- * A Conn must call Close to return the connection to the database pool
- * and may do so concurrently with a running query.
- *
- * After a call to Close, all operations on the
- * connection fail with ErrConnDone.
- */
- interface Conn {
- }
- interface Conn {
- /**
- * PingContext verifies the connection to the database is still alive.
- */
- pingContext(ctx: context.Context): void
- }
- interface Conn {
- /**
- * ExecContext executes a query without returning any rows.
- * The args are for any placeholder parameters in the query.
- */
- execContext(ctx: context.Context, query: string, ...args: any[]): Result
- }
- interface Conn {
- /**
- * QueryContext executes a query that returns rows, typically a SELECT.
- * The args are for any placeholder parameters in the query.
- */
- queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined)
- }
- interface Conn {
- /**
- * QueryRowContext executes a query that is expected to return at most one row.
- * QueryRowContext always returns a non-nil value. Errors are deferred until
- * Row's Scan method is called.
- * If the query selects no rows, the *Row's Scan will return ErrNoRows.
- * Otherwise, the *Row's Scan scans the first selected row and discards
- * the rest.
- */
- queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined)
- }
- interface Conn {
- /**
- * PrepareContext creates a prepared statement for later queries or executions.
- * Multiple queries or executions may be run concurrently from the
- * returned statement.
- * The caller must call the statement's Close method
- * when the statement is no longer needed.
- *
- * The provided context is used for the preparation of the statement, not for the
- * execution of the statement.
- */
- prepareContext(ctx: context.Context, query: string): (Stmt | undefined)
- }
- interface Conn {
- /**
- * Raw executes f exposing the underlying driver connection for the
- * duration of f. The driverConn must not be used outside of f.
- *
- * Once f returns and err is not driver.ErrBadConn, the Conn will continue to be usable
- * until Conn.Close is called.
- */
- raw(f: (driverConn: any) => void): void
- }
- interface Conn {
- /**
- * BeginTx starts a transaction.
- *
- * The provided context is used until the transaction is committed or rolled back.
- * If the context is canceled, the sql package will roll back
- * the transaction. Tx.Commit will return an error if the context provided to
- * BeginTx is canceled.
- *
- * The provided TxOptions is optional and may be nil if defaults should be used.
- * If a non-default isolation level is used that the driver doesn't support,
- * an error will be returned.
- */
- beginTx(ctx: context.Context, opts: TxOptions): (Tx | undefined)
- }
- interface Conn {
- /**
- * Close returns the connection to the connection pool.
- * All operations after a Close will return with ErrConnDone.
- * Close is safe to call concurrently with other operations and will
- * block until all other operations finish. It may be useful to first
- * cancel any used context and then call close directly after.
- */
- close(): void
- }
- /**
- * ColumnType contains the name and type of a column.
- */
- interface ColumnType {
- }
- interface ColumnType {
- /**
- * Name returns the name or alias of the column.
- */
- name(): string
- }
- interface ColumnType {
- /**
- * Length returns the column type length for variable length column types such
- * as text and binary field types. If the type length is unbounded the value will
- * be math.MaxInt64 (any database limits will still apply).
- * If the column type is not variable length, such as an int, or if not supported
- * by the driver ok is false.
- */
- length(): [number, boolean]
- }
- interface ColumnType {
- /**
- * DecimalSize returns the scale and precision of a decimal type.
- * If not applicable or if not supported ok is false.
- */
- decimalSize(): [number, boolean]
- }
- interface ColumnType {
- /**
- * ScanType returns a Go type suitable for scanning into using Rows.Scan.
- * If a driver does not support this property ScanType will return
- * the type of an empty interface.
- */
- scanType(): reflect.Type
- }
- interface ColumnType {
- /**
- * Nullable reports whether the column may be null.
- * If a driver does not support this property ok will be false.
- */
- nullable(): boolean
- }
- interface ColumnType {
- /**
- * DatabaseTypeName returns the database system name of the column type. If an empty
- * string is returned, then the driver type name is not supported.
- * Consult your driver documentation for a list of driver data types. Length specifiers
- * are not included.
- * Common type names include "VARCHAR", "TEXT", "NVARCHAR", "DECIMAL", "BOOL",
- * "INT", and "BIGINT".
- */
- databaseTypeName(): string
- }
- /**
- * Row is the result of calling QueryRow to select a single row.
- */
- interface Row {
- }
- interface Row {
- /**
- * Scan copies the columns from the matched row into the values
- * pointed at by dest. See the documentation on Rows.Scan for details.
- * If more than one row matches the query,
- * Scan uses the first row and discards the rest. If no row matches
- * the query, Scan returns ErrNoRows.
- */
- scan(...dest: any[]): void
- }
- interface Row {
- /**
- * Err provides a way for wrapping packages to check for
- * query errors without calling Scan.
- * Err returns the error, if any, that was encountered while running the query.
- * If this error is not nil, this error will also be returned from Scan.
- */
- err(): void
- }
-}
-
-namespace store {
- /**
- * Store defines a concurrent safe in memory key-value data store.
- */
- interface Store {
- }
- interface Store {
- /**
- * Reset clears the store and replaces the store data with a
- * shallow copy of the provided newData.
- */
- reset(newData: _TygojaDict): void
- }
- interface Store {
- /**
- * Length returns the current number of elements in the store.
- */
- length(): number
- }
- interface Store {
- /**
- * RemoveAll removes all the existing store entries.
- */
- removeAll(): void
- }
- interface Store {
- /**
- * Remove removes a single entry from the store.
- *
- * Remove does nothing if key doesn't exist in the store.
- */
- remove(key: string): void
- }
- interface Store {
- /**
- * Has checks if element with the specified key exist or not.
- */
- has(key: string): boolean
- }
- interface Store {
- /**
- * Get returns a single element value from the store.
- *
- * If key is not set, the zero T value is returned.
- */
- get(key: string): T
- }
- interface Store {
- /**
- * GetAll returns a shallow copy of the current store data.
- */
- getAll(): _TygojaDict
- }
- interface Store {
- /**
- * Set sets (or overwrite if already exist) a new value for key.
- */
- set(key: string, value: T): void
- }
- interface Store {
- /**
- * SetIfLessThanLimit sets (or overwrite if already exist) a new value for key.
- *
- * This method is similar to Set() but **it will skip adding new elements**
- * to the store if the store length has reached the specified limit.
- * false is returned if maxAllowedElements limit is reached.
- */
- setIfLessThanLimit(key: string, value: T, maxAllowedElements: number): boolean
- }
-}
-
-/**
- * Package types implements some commonly used db serializable types
- * like datetime, json, etc.
- */
-namespace types {
- /**
- * DateTime represents a [time.Time] instance in UTC that is wrapped
- * and serialized using the app default date layout.
- */
- interface DateTime {
- }
- interface DateTime {
- /**
- * Time returns the internal [time.Time] instance.
- */
- time(): time.Time
- }
- interface DateTime {
- /**
- * IsZero checks whether the current DateTime instance has zero time value.
- */
- isZero(): boolean
- }
- interface DateTime {
- /**
- * String serializes the current DateTime instance into a formatted
- * UTC date string.
- *
- * The zero value is serialized to an empty string.
- */
- string(): string
- }
- interface DateTime {
- /**
- * MarshalJSON implements the [json.Marshaler] interface.
- */
- marshalJSON(): string
- }
- interface DateTime {
- /**
- * UnmarshalJSON implements the [json.Unmarshaler] interface.
- */
- unmarshalJSON(b: string): void
- }
- interface DateTime {
- /**
- * Value implements the [driver.Valuer] interface.
- */
- value(): driver.Value
- }
- interface DateTime {
- /**
- * Scan implements [sql.Scanner] interface to scan the provided value
- * into the current DateTime instance.
- */
- scan(value: any): void
- }
-}
-
-/**
- * Package schema implements custom Schema and SchemaField datatypes
- * for handling the Collection schema definitions.
- */
-namespace schema {
- // @ts-ignore
- import validation = ozzo_validation
- /**
- * SchemaField defines a single schema field structure.
- */
- interface SchemaField {
- system: boolean
+ interface Group {
id: string
- name: string
- type: string
- required: boolean
- /**
- * Deprecated: This field is no-op and will be removed in future versions.
- * Please use the collection.Indexes field to define a unique constraint.
- */
- unique: boolean
- options: any
- }
- interface SchemaField {
- /**
- * ColDefinition returns the field db column type definition as string.
- */
- colDefinition(): string
- }
- interface SchemaField {
- /**
- * String serializes and returns the current field as string.
- */
- string(): string
- }
- interface SchemaField {
- /**
- * MarshalJSON implements the [json.Marshaler] interface.
- */
- marshalJSON(): string
- }
- interface SchemaField {
- /**
- * UnmarshalJSON implements the [json.Unmarshaler] interface.
- *
- * The schema field options are auto initialized on success.
- */
- unmarshalJSON(data: string): void
- }
- interface SchemaField {
- /**
- * Validate makes `SchemaField` validatable by implementing [validation.Validatable] interface.
- */
- validate(): void
- }
- interface SchemaField {
- /**
- * InitOptions initializes the current field options based on its type.
- *
- * Returns error on unknown field type.
- */
- initOptions(): void
- }
- interface SchemaField {
- /**
- * PrepareValue returns normalized and properly formatted field value.
- */
- prepareValue(value: any): any
- }
- interface SchemaField {
- /**
- * PrepareValueWithModifier returns normalized and properly formatted field value
- * by "merging" baseValue with the modifierValue based on the specified modifier (+ or -).
- */
- prepareValueWithModifier(baseValue: any, modifier: string, modifierValue: any): any
- }
-}
-
-/**
- * Package models implements all PocketBase DB models and DTOs.
- */
-namespace models {
- /**
- * Model defines an interface with common methods that all db models should have.
- */
- interface Model {
- tableName(): string
- isNew(): boolean
- markAsNew(): void
- markAsNotNew(): void
- hasId(): boolean
- getId(): string
- setId(id: string): void
- getCreated(): types.DateTime
- getUpdated(): types.DateTime
- refreshId(): void
- refreshCreated(): void
- refreshUpdated(): void
+ title: string
}
/**
- * BaseModel defines common fields and methods used by all other models.
+ * ShellCompDirective is a bit map representing the different behaviors the shell
+ * can be instructed to have once completions have been provided.
*/
- interface BaseModel {
- id: string
- created: types.DateTime
- updated: types.DateTime
- }
- interface BaseModel {
- /**
- * HasId returns whether the model has a nonzero id.
- */
- hasId(): boolean
- }
- interface BaseModel {
- /**
- * GetId returns the model id.
- */
- getId(): string
- }
- interface BaseModel {
- /**
- * SetId sets the model id to the provided string value.
- */
- setId(id: string): void
- }
- interface BaseModel {
- /**
- * MarkAsNew marks the model as "new" (aka. enforces m.IsNew() to be true).
- */
- markAsNew(): void
- }
- interface BaseModel {
- /**
- * MarkAsNotNew marks the model as "not new" (aka. enforces m.IsNew() to be false)
- */
- markAsNotNew(): void
- }
- interface BaseModel {
- /**
- * IsNew indicates what type of db query (insert or update)
- * should be used with the model instance.
- */
- isNew(): boolean
- }
- interface BaseModel {
- /**
- * GetCreated returns the model Created datetime.
- */
- getCreated(): types.DateTime
- }
- interface BaseModel {
- /**
- * GetUpdated returns the model Updated datetime.
- */
- getUpdated(): types.DateTime
- }
- interface BaseModel {
- /**
- * RefreshId generates and sets a new model id.
- *
- * The generated id is a cryptographically random 15 characters length string.
- */
- refreshId(): void
- }
- interface BaseModel {
- /**
- * RefreshCreated updates the model Created field with the current datetime.
- */
- refreshCreated(): void
- }
- interface BaseModel {
- /**
- * RefreshUpdated updates the model Updated field with the current datetime.
- */
- refreshUpdated(): void
- }
- interface BaseModel {
- /**
- * PostScan implements the [dbx.PostScanner] interface.
- *
- * It is executed right after the model was populated with the db row values.
- */
- postScan(): void
- }
- // @ts-ignore
- import validation = ozzo_validation
+ interface ShellCompDirective extends Number{}
/**
- * CollectionBaseOptions defines the "base" Collection.Options fields.
+ * CompletionOptions are the options to control shell completion
*/
- interface CollectionBaseOptions {
- }
- interface CollectionBaseOptions {
+ interface CompletionOptions {
/**
- * Validate implements [validation.Validatable] interface.
+ * DisableDefaultCmd prevents Cobra from creating a default 'completion' command
*/
- validate(): void
- }
- /**
- * CollectionAuthOptions defines the "auth" Collection.Options fields.
- */
- interface CollectionAuthOptions {
- manageRule?: string
- allowOAuth2Auth: boolean
- allowUsernameAuth: boolean
- allowEmailAuth: boolean
- requireEmail: boolean
- exceptEmailDomains: Array
- onlyEmailDomains: Array
- minPasswordLength: number
- }
- interface CollectionAuthOptions {
+ disableDefaultCmd: boolean
/**
- * Validate implements [validation.Validatable] interface.
+ * DisableNoDescFlag prevents Cobra from creating the '--no-descriptions' flag
+ * for shells that support completion descriptions
*/
- validate(): void
- }
- /**
- * CollectionViewOptions defines the "view" Collection.Options fields.
- */
- interface CollectionViewOptions {
- query: string
- }
- interface CollectionViewOptions {
+ disableNoDescFlag: boolean
/**
- * Validate implements [validation.Validatable] interface.
+ * DisableDescriptions turns off all completion descriptions for shells
+ * that support them
*/
- validate(): void
- }
- type _subzTvtd = BaseModel
- interface Param extends _subzTvtd {
- key: string
- value: types.JsonRaw
- }
- interface Param {
- tableName(): string
- }
- type _subGrFwx = BaseModel
- interface Request extends _subGrFwx {
- url: string
- method: string
- status: number
- auth: string
- userIp: string
- remoteIp: string
- referer: string
- userAgent: string
- meta: types.JsonMap
- }
- interface Request {
- tableName(): string
- }
- interface TableInfoRow {
+ disableDescriptions: boolean
/**
- * the `db:"pk"` tag has special semantic so we cannot rename
- * the original field without specifying a custom mapper
+ * HiddenDefaultCmd makes the default 'completion' command hidden
*/
- pk: number
- index: number
- name: string
- type: string
- notNull: boolean
- defaultValue: types.JsonRaw
- }
-}
-
-/**
- * Package oauth2 provides support for making
- * OAuth2 authorized and authenticated HTTP requests,
- * as specified in RFC 6749.
- * It can additionally grant authorization with Bearer JWT.
- */
-namespace oauth2 {
- /**
- * An AuthCodeOption is passed to Config.AuthCodeURL.
- */
- interface AuthCodeOption {
- }
- /**
- * Token represents the credentials used to authorize
- * the requests to access protected resources on the OAuth 2.0
- * provider's backend.
- *
- * Most users of this package should not access fields of Token
- * directly. They're exported mostly for use by related packages
- * implementing derivative OAuth2 flows.
- */
- interface Token {
- /**
- * AccessToken is the token that authorizes and authenticates
- * the requests.
- */
- accessToken: string
- /**
- * TokenType is the type of token.
- * The Type method returns either this or "Bearer", the default.
- */
- tokenType: string
- /**
- * RefreshToken is a token that's used by the application
- * (as opposed to the user) to refresh the access token
- * if it expires.
- */
- refreshToken: string
- /**
- * Expiry is the optional expiration time of the access token.
- *
- * If zero, TokenSource implementations will reuse the same
- * token forever and RefreshToken or equivalent
- * mechanisms for that TokenSource will not be used.
- */
- expiry: time.Time
- }
- interface Token {
- /**
- * Type returns t.TokenType if non-empty, else "Bearer".
- */
- type(): string
- }
- interface Token {
- /**
- * SetAuthHeader sets the Authorization header to r using the access
- * token in t.
- *
- * This method is unnecessary when using Transport or an HTTP Client
- * returned by this package.
- */
- setAuthHeader(r: http.Request): void
- }
- interface Token {
- /**
- * WithExtra returns a new Token that's a clone of t, but using the
- * provided raw extra map. This is only intended for use by packages
- * implementing derivative OAuth2 flows.
- */
- withExtra(extra: {
- }): (Token | undefined)
- }
- interface Token {
- /**
- * Extra returns an extra field.
- * Extra fields are key-value pairs returned by the server as a
- * part of the token retrieval response.
- */
- extra(key: string): {
- }
- }
- interface Token {
- /**
- * Valid reports whether t is non-nil, has an AccessToken, and is not expired.
- */
- valid(): boolean
- }
-}
-
-namespace mailer {
- /**
- * Mailer defines a base mail client interface.
- */
- interface Mailer {
- /**
- * Send sends an email with the provided Message.
- */
- send(message: Message): void
- }
-}
-
-/**
- * Package echo implements high performance, minimalist Go web framework.
- *
- * Example:
- *
- * ```
- * package main
- *
- * import (
- * "github.com/labstack/echo/v5"
- * "github.com/labstack/echo/v5/middleware"
- * "log"
- * "net/http"
- * )
- *
- * // Handler
- * func hello(c echo.Context) error {
- * return c.String(http.StatusOK, "Hello, World!")
- * }
- *
- * func main() {
- * // Echo instance
- * e := echo.New()
- *
- * // Middleware
- * e.Use(middleware.Logger())
- * e.Use(middleware.Recover())
- *
- * // Routes
- * e.GET("/", hello)
- *
- * // Start server
- * if err := e.Start(":8080"); err != http.ErrServerClosed {
- * log.Fatal(err)
- * }
- * }
- * ```
- *
- * Learn more at https://echo.labstack.com
- */
-namespace echo {
- /**
- * Binder is the interface that wraps the Bind method.
- */
- interface Binder {
- bind(c: Context, i: {
- }): void
- }
- /**
- * ServableContext is interface that Echo context implementation must implement to be usable in middleware/handlers and
- * be able to be routed by Router.
- */
- interface ServableContext {
- /**
- * Reset resets the context after request completes. It must be called along
- * with `Echo#AcquireContext()` and `Echo#ReleaseContext()`.
- * See `Echo#ServeHTTP()`
- */
- reset(r: http.Request, w: http.ResponseWriter): void
- }
- // @ts-ignore
- import stdContext = context
- /**
- * JSONSerializer is the interface that encodes and decodes JSON to and from interfaces.
- */
- interface JSONSerializer {
- serialize(c: Context, i: {
- }, indent: string): void
- deserialize(c: Context, i: {
- }): void
- }
- /**
- * HTTPErrorHandler is a centralized HTTP error handler.
- */
- interface HTTPErrorHandler {(c: Context, err: Error): void }
- /**
- * Validator is the interface that wraps the Validate function.
- */
- interface Validator {
- validate(i: {
- }): void
- }
- /**
- * Renderer is the interface that wraps the Render function.
- */
- interface Renderer {
- render(_arg0: io.Writer, _arg1: string, _arg2: {
- }, _arg3: Context): void
- }
- /**
- * Group is a set of sub-routes for a specified route. It can be used for inner
- * routes that share a common middleware or functionality that should be separate
- * from the parent echo instance while still inheriting from it.
- */
- interface Group {
- }
- interface Group {
- /**
- * Use implements `Echo#Use()` for sub-routes within the Group.
- * Group middlewares are not executed on request when there is no matching route found.
- */
- use(...middleware: MiddlewareFunc[]): void
- }
- interface Group {
- /**
- * CONNECT implements `Echo#CONNECT()` for sub-routes within the Group. Panics on error.
- */
- connect(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * DELETE implements `Echo#DELETE()` for sub-routes within the Group. Panics on error.
- */
- delete(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * GET implements `Echo#GET()` for sub-routes within the Group. Panics on error.
- */
- get(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * HEAD implements `Echo#HEAD()` for sub-routes within the Group. Panics on error.
- */
- head(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * OPTIONS implements `Echo#OPTIONS()` for sub-routes within the Group. Panics on error.
- */
- options(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * PATCH implements `Echo#PATCH()` for sub-routes within the Group. Panics on error.
- */
- patch(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * POST implements `Echo#POST()` for sub-routes within the Group. Panics on error.
- */
- post(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * PUT implements `Echo#PUT()` for sub-routes within the Group. Panics on error.
- */
- put(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * TRACE implements `Echo#TRACE()` for sub-routes within the Group. Panics on error.
- */
- trace(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * Any implements `Echo#Any()` for sub-routes within the Group. Panics on error.
- */
- any(path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes
- }
- interface Group {
- /**
- * Match implements `Echo#Match()` for sub-routes within the Group. Panics on error.
- */
- match(methods: Array, path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes
- }
- interface Group {
- /**
- * Group creates a new sub-group with prefix and optional sub-group-level middleware.
- * Important! Group middlewares are only executed in case there was exact route match and not
- * for 404 (not found) or 405 (method not allowed) cases. If this kind of behaviour is needed then add
- * a catch-all route `/*` for the group which handler returns always 404
- */
- group(prefix: string, ...middleware: MiddlewareFunc[]): (Group | undefined)
- }
- interface Group {
- /**
- * Static implements `Echo#Static()` for sub-routes within the Group.
- */
- static(pathPrefix: string): RouteInfo
- }
- interface Group {
- /**
- * StaticFS implements `Echo#StaticFS()` for sub-routes within the Group.
- *
- * When dealing with `embed.FS` use `fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary
- * prefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths
- * including `assets/images` as their prefix.
- */
- staticFS(pathPrefix: string, filesystem: fs.FS): RouteInfo
- }
- interface Group {
- /**
- * FileFS implements `Echo#FileFS()` for sub-routes within the Group.
- */
- fileFS(path: string, filesystem: fs.FS, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * File implements `Echo#File()` for sub-routes within the Group. Panics on error.
- */
- file(path: string, ...middleware: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * RouteNotFound implements `Echo#RouteNotFound()` for sub-routes within the Group.
- *
- * Example: `g.RouteNotFound("/*", func(c echo.Context) error { return c.NoContent(http.StatusNotFound) })`
- */
- routeNotFound(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * Add implements `Echo#Add()` for sub-routes within the Group. Panics on error.
- */
- add(method: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): RouteInfo
- }
- interface Group {
- /**
- * AddRoute registers a new Routable with Router
- */
- addRoute(route: Routable): RouteInfo
- }
- /**
- * IPExtractor is a function to extract IP addr from http.Request.
- * Set appropriate one to Echo#IPExtractor.
- * See https://echo.labstack.com/guide/ip-address for more details.
- */
- interface IPExtractor {(_arg0: http.Request): string }
- /**
- * Logger defines the logging interface that Echo uses internally in few places.
- * For logging in handlers use your own logger instance (dependency injected or package/public variable) from logging framework of your choice.
- */
- interface Logger {
- /**
- * Write provides writer interface for http.Server `ErrorLog` and for logging startup messages.
- * `http.Server.ErrorLog` logs errors from accepting connections, unexpected behavior from handlers,
- * and underlying FileSystem errors.
- * `logger` middleware will use this method to write its JSON payload.
- */
- write(p: string): number
- /**
- * Error logs the error
- */
- error(err: Error): void
- }
- /**
- * Response wraps an http.ResponseWriter and implements its interface to be used
- * by an HTTP handler to construct an HTTP response.
- * See: https://golang.org/pkg/net/http/#ResponseWriter
- */
- interface Response {
- writer: http.ResponseWriter
- status: number
- size: number
- committed: boolean
- }
- interface Response {
- /**
- * Header returns the header map for the writer that will be sent by
- * WriteHeader. Changing the header after a call to WriteHeader (or Write) has
- * no effect unless the modified headers were declared as trailers by setting
- * the "Trailer" header before the call to WriteHeader (see example)
- * To suppress implicit response headers, set their value to nil.
- * Example: https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
- */
- header(): http.Header
- }
- interface Response {
- /**
- * Before registers a function which is called just before the response is written.
- */
- before(fn: () => void): void
- }
- interface Response {
- /**
- * After registers a function which is called just after the response is written.
- * If the `Content-Length` is unknown, none of the after function is executed.
- */
- after(fn: () => void): void
- }
- interface Response {
- /**
- * WriteHeader sends an HTTP response header with status code. If WriteHeader is
- * not called explicitly, the first call to Write will trigger an implicit
- * WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly
- * used to send error codes.
- */
- writeHeader(code: number): void
- }
- interface Response {
- /**
- * Write writes the data to the connection as part of an HTTP reply.
- */
- write(b: string): number
- }
- interface Response {
- /**
- * Flush implements the http.Flusher interface to allow an HTTP handler to flush
- * buffered data to the client.
- * See [http.Flusher](https://golang.org/pkg/net/http/#Flusher)
- */
- flush(): void
- }
- interface Response {
- /**
- * Hijack implements the http.Hijacker interface to allow an HTTP handler to
- * take over the connection.
- * See [http.Hijacker](https://golang.org/pkg/net/http/#Hijacker)
- */
- hijack(): [net.Conn, (bufio.ReadWriter | undefined)]
- }
- interface Routes {
- /**
- * Reverse reverses route to URL string by replacing path parameters with given params values.
- */
- reverse(name: string, ...params: {
- }[]): string
- }
- interface Routes {
- /**
- * FindByMethodPath searched for matching route info by method and path
- */
- findByMethodPath(method: string, path: string): RouteInfo
- }
- interface Routes {
- /**
- * FilterByMethod searched for matching route info by method
- */
- filterByMethod(method: string): Routes
- }
- interface Routes {
- /**
- * FilterByPath searched for matching route info by path
- */
- filterByPath(path: string): Routes
- }
- interface Routes {
- /**
- * FilterByName searched for matching route info by name
- */
- filterByName(name: string): Routes
- }
- /**
- * Router is interface for routing request contexts to registered routes.
- *
- * Contract between Echo/Context instance and the router:
- * * all routes must be added through methods on echo.Echo instance.
- * ```
- * Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see `Echo.contextPathParamAllocSize`).
- * ```
- * * Router must populate Context during Router.Route call with:
- * ```
- * * RoutableContext.SetPath
- * * RoutableContext.SetRawPathParams (IMPORTANT! with same slice pointer that c.RawPathParams() returns)
- * * RoutableContext.SetRouteInfo
- * And optionally can set additional information to Context with RoutableContext.Set
- * ```
- */
- interface Router {
- /**
- * Add registers Routable with the Router and returns registered RouteInfo
- */
- add(routable: Routable): RouteInfo
- /**
- * Remove removes route from the Router
- */
- remove(method: string, path: string): void
- /**
- * Routes returns information about all registered routes
- */
- routes(): Routes
- /**
- * Route searches Router for matching route and applies it to the given context. In case when no matching method
- * was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404
- * handler function.
- */
- route(c: RoutableContext): HandlerFunc
- }
- /**
- * Routable is interface for registering Route with Router. During route registration process the Router will
- * convert Routable to RouteInfo with ToRouteInfo method. By creating custom implementation of Routable additional
- * information about registered route can be stored in Routes (i.e. privileges used with route etc.)
- */
- interface Routable {
- /**
- * ToRouteInfo converts Routable to RouteInfo
- *
- * This method is meant to be used by Router after it parses url for path parameters, to store information about
- * route just added.
- */
- toRouteInfo(params: Array): RouteInfo
- /**
- * ToRoute converts Routable to Route which Router uses to register the method handler for path.
- *
- * This method is meant to be used by Router to get fields (including handler and middleware functions) needed to
- * add Route to Router.
- */
- toRoute(): Route
- /**
- * ForGroup recreates routable with added group prefix and group middlewares it is grouped to.
- *
- * Is necessary for Echo.Group to be able to add/register Routable with Router and having group prefix and group
- * middlewares included in actually registered Route.
- */
- forGroup(pathPrefix: string, middlewares: Array): Routable
- }
- /**
- * Routes is collection of RouteInfo instances with various helper methods.
- */
- interface Routes extends Array{}
- /**
- * RouteInfo describes registered route base fields.
- * Method+Path pair uniquely identifies the Route. Name can have duplicates.
- */
- interface RouteInfo {
- method(): string
- path(): string
- name(): string
- params(): Array
- reverse(...params: {
- }[]): string
- }
- /**
- * PathParams is collections of PathParam instances with various helper methods
- */
- interface PathParams extends Array{}
- interface PathParams {
- /**
- * Get returns path parameter value for given name or default value.
- */
- get(name: string, defaultValue: string): string
- }
-}
-
-namespace settings {
- // @ts-ignore
- import validation = ozzo_validation
- interface TokenConfig {
- secret: string
- duration: number
- }
- interface TokenConfig {
- /**
- * Validate makes TokenConfig validatable by implementing [validation.Validatable] interface.
- */
- validate(): void
- }
- interface SmtpConfig {
- enabled: boolean
- host: string
- port: number
- username: string
- password: string
- /**
- * SMTP AUTH - PLAIN (default) or LOGIN
- */
- authMethod: string
- /**
- * Whether to enforce TLS encryption for the mail server connection.
- *
- * When set to false StartTLS command is send, leaving the server
- * to decide whether to upgrade the connection or not.
- */
- tls: boolean
- }
- interface SmtpConfig {
- /**
- * Validate makes SmtpConfig validatable by implementing [validation.Validatable] interface.
- */
- validate(): void
- }
- interface S3Config {
- enabled: boolean
- bucket: string
- region: string
- endpoint: string
- accessKey: string
- secret: string
- forcePathStyle: boolean
- }
- interface S3Config {
- /**
- * Validate makes S3Config validatable by implementing [validation.Validatable] interface.
- */
- validate(): void
- }
- interface BackupsConfig {
- /**
- * Cron is a cron expression to schedule auto backups, eg. "* * * * *".
- *
- * Leave it empty to disable the auto backups functionality.
- */
- cron: string
- /**
- * CronMaxKeep is the the max number of cron generated backups to
- * keep before removing older entries.
- *
- * This field works only when the cron config has valid cron expression.
- */
- cronMaxKeep: number
- /**
- * S3 is an optional S3 storage config specifying where to store the app backups.
- */
- s3: S3Config
- }
- interface BackupsConfig {
- /**
- * Validate makes BackupsConfig validatable by implementing [validation.Validatable] interface.
- */
- validate(): void
- }
- interface MetaConfig {
- appName: string
- appUrl: string
- hideControls: boolean
- senderName: string
- senderAddress: string
- verificationTemplate: EmailTemplate
- resetPasswordTemplate: EmailTemplate
- confirmEmailChangeTemplate: EmailTemplate
- }
- interface MetaConfig {
- /**
- * Validate makes MetaConfig validatable by implementing [validation.Validatable] interface.
- */
- validate(): void
- }
- interface LogsConfig {
- maxDays: number
- }
- interface LogsConfig {
- /**
- * Validate makes LogsConfig validatable by implementing [validation.Validatable] interface.
- */
- validate(): void
- }
- interface AuthProviderConfig {
- enabled: boolean
- clientId: string
- clientSecret: string
- authUrl: string
- tokenUrl: string
- userApiUrl: string
- }
- interface AuthProviderConfig {
- /**
- * Validate makes `ProviderConfig` validatable by implementing [validation.Validatable] interface.
- */
- validate(): void
- }
- interface AuthProviderConfig {
- /**
- * SetupProvider loads the current AuthProviderConfig into the specified provider.
- */
- setupProvider(provider: auth.Provider): void
- }
- /**
- * Deprecated: Will be removed in v0.9+
- */
- interface EmailAuthConfig {
- enabled: boolean
- exceptDomains: Array
- onlyDomains: Array
- minPasswordLength: number
- }
- interface EmailAuthConfig {
- /**
- * Deprecated: Will be removed in v0.9+
- */
- validate(): void
+ hiddenDefaultCmd: boolean
}
}
@@ -14756,8 +14874,8 @@ namespace hook {
* TaggedHook defines a proxy hook which register handlers that are triggered only
* if the TaggedHook.tags are empty or includes at least one of the event data tag(s).
*/
- type _subGfVxY = mainHook
- interface TaggedHook extends _subGfVxY {
+ type _subjCWii = mainHook
+ interface TaggedHook extends _subjCWii {
}
interface TaggedHook {
/**
@@ -14784,61 +14902,6 @@ namespace hook {
}
}
-/**
- * Package daos handles common PocketBase DB model manipulations.
- *
- * Think of daos as DB repository and service layer in one.
- */
-namespace daos {
- /**
- * ExpandFetchFunc defines the function that is used to fetch the expanded relation records.
- */
- interface ExpandFetchFunc {(relCollection: models.Collection, relIds: Array): Array<(models.Record | undefined)> }
- // @ts-ignore
- import validation = ozzo_validation
- interface RequestsStatsItem {
- total: number
- date: types.DateTime
- }
-}
-
-namespace subscriptions {
- /**
- * Broker defines a struct for managing subscriptions clients.
- */
- interface Broker {
- }
- interface Broker {
- /**
- * Clients returns a shallow copy of all registered clients indexed
- * with their connection id.
- */
- clients(): _TygojaDict
- }
- interface Broker {
- /**
- * ClientById finds a registered client by its id.
- *
- * Returns non-nil error when client with clientId is not registered.
- */
- clientById(clientId: string): Client
- }
- interface Broker {
- /**
- * Register adds a new client to the broker instance.
- */
- register(client: Client): void
- }
- interface Broker {
- /**
- * Unregister removes a single client by its id.
- *
- * If client with clientId doesn't exist, this method does nothing.
- */
- unregister(clientId: string): void
- }
-}
-
/**
* Package core is the backbone of PocketBase.
*
@@ -14861,12 +14924,12 @@ namespace core {
httpContext: echo.Context
error: Error
}
- type _subjAsxB = BaseModelEvent
- interface ModelEvent extends _subjAsxB {
+ type _subXiQJZ = BaseModelEvent
+ interface ModelEvent extends _subXiQJZ {
dao?: daos.Dao
}
- type _subnBsJi = BaseCollectionEvent
- interface MailerRecordEvent extends _subnBsJi {
+ type _subJxYuz = BaseCollectionEvent
+ interface MailerRecordEvent extends _subJxYuz {
mailClient: mailer.Mailer
message?: mailer.Message
record?: models.Record
@@ -14905,50 +14968,50 @@ namespace core {
oldSettings?: settings.Settings
newSettings?: settings.Settings
}
- type _subhkGBs = BaseCollectionEvent
- interface RecordsListEvent extends _subhkGBs {
+ type _subVznAr = BaseCollectionEvent
+ interface RecordsListEvent extends _subVznAr {
httpContext: echo.Context
records: Array<(models.Record | undefined)>
result?: search.Result
}
- type _subccSVx = BaseCollectionEvent
- interface RecordViewEvent extends _subccSVx {
+ type _subRGPHi = BaseCollectionEvent
+ interface RecordViewEvent extends _subRGPHi {
httpContext: echo.Context
record?: models.Record
}
- type _subsAlBM = BaseCollectionEvent
- interface RecordCreateEvent extends _subsAlBM {
+ type _subZvdde = BaseCollectionEvent
+ interface RecordCreateEvent extends _subZvdde {
httpContext: echo.Context
record?: models.Record
uploadedFiles: _TygojaDict
}
- type _subcyKVT = BaseCollectionEvent
- interface RecordUpdateEvent extends _subcyKVT {
+ type _subNztCq = BaseCollectionEvent
+ interface RecordUpdateEvent extends _subNztCq {
httpContext: echo.Context
record?: models.Record
uploadedFiles: _TygojaDict
}
- type _subVlEQH = BaseCollectionEvent
- interface RecordDeleteEvent extends _subVlEQH {
+ type _subJjOkU = BaseCollectionEvent
+ interface RecordDeleteEvent extends _subJjOkU {
httpContext: echo.Context
record?: models.Record
}
- type _subJlFDk = BaseCollectionEvent
- interface RecordAuthEvent extends _subJlFDk {
+ type _subJxQdR = BaseCollectionEvent
+ interface RecordAuthEvent extends _subJxQdR {
httpContext: echo.Context
record?: models.Record
token: string
meta: any
}
- type _subsJIRT = BaseCollectionEvent
- interface RecordAuthWithPasswordEvent extends _subsJIRT {
+ type _subkVhuk = BaseCollectionEvent
+ interface RecordAuthWithPasswordEvent extends _subkVhuk {
httpContext: echo.Context
record?: models.Record
identity: string
password: string
}
- type _subZISFk = BaseCollectionEvent
- interface RecordAuthWithOAuth2Event extends _subZISFk {
+ type _subsckgr = BaseCollectionEvent
+ interface RecordAuthWithOAuth2Event extends _subsckgr {
httpContext: echo.Context
providerName: string
providerClient: auth.Provider
@@ -14956,49 +15019,49 @@ namespace core {
oAuth2User?: auth.AuthUser
isNewRecord: boolean
}
- type _subdrEeY = BaseCollectionEvent
- interface RecordAuthRefreshEvent extends _subdrEeY {
+ type _subgrWws = BaseCollectionEvent
+ interface RecordAuthRefreshEvent extends _subgrWws {
httpContext: echo.Context
record?: models.Record
}
- type _subHQiCu = BaseCollectionEvent
- interface RecordRequestPasswordResetEvent extends _subHQiCu {
+ type _subqhmmP = BaseCollectionEvent
+ interface RecordRequestPasswordResetEvent extends _subqhmmP {
httpContext: echo.Context
record?: models.Record
}
- type _subCtUoL = BaseCollectionEvent
- interface RecordConfirmPasswordResetEvent extends _subCtUoL {
+ type _subasXdC = BaseCollectionEvent
+ interface RecordConfirmPasswordResetEvent extends _subasXdC {
httpContext: echo.Context
record?: models.Record
}
- type _subtzMDV = BaseCollectionEvent
- interface RecordRequestVerificationEvent extends _subtzMDV {
+ type _subnmFUY = BaseCollectionEvent
+ interface RecordRequestVerificationEvent extends _subnmFUY {
httpContext: echo.Context
record?: models.Record
}
- type _subIimzC = BaseCollectionEvent
- interface RecordConfirmVerificationEvent extends _subIimzC {
+ type _subinGTz = BaseCollectionEvent
+ interface RecordConfirmVerificationEvent extends _subinGTz {
httpContext: echo.Context
record?: models.Record
}
- type _subhkdTN = BaseCollectionEvent
- interface RecordRequestEmailChangeEvent extends _subhkdTN {
+ type _subVyyEl = BaseCollectionEvent
+ interface RecordRequestEmailChangeEvent extends _subVyyEl {
httpContext: echo.Context
record?: models.Record
}
- type _subAZUGE = BaseCollectionEvent
- interface RecordConfirmEmailChangeEvent extends _subAZUGE {
+ type _subycCpV = BaseCollectionEvent
+ interface RecordConfirmEmailChangeEvent extends _subycCpV {
httpContext: echo.Context
record?: models.Record
}
- type _subRKfcB = BaseCollectionEvent
- interface RecordListExternalAuthsEvent extends _subRKfcB {
+ type _subkutBy = BaseCollectionEvent
+ interface RecordListExternalAuthsEvent extends _subkutBy {
httpContext: echo.Context
record?: models.Record
externalAuths: Array<(models.ExternalAuth | undefined)>
}
- type _subLghDg = BaseCollectionEvent
- interface RecordUnlinkExternalAuthEvent extends _subLghDg {
+ type _subEvolH = BaseCollectionEvent
+ interface RecordUnlinkExternalAuthEvent extends _subEvolH {
httpContext: echo.Context
record?: models.Record
externalAuth?: models.ExternalAuth
@@ -15052,33 +15115,33 @@ namespace core {
collections: Array<(models.Collection | undefined)>
result?: search.Result
}
- type _subyTsJW = BaseCollectionEvent
- interface CollectionViewEvent extends _subyTsJW {
+ type _suboEYGQ = BaseCollectionEvent
+ interface CollectionViewEvent extends _suboEYGQ {
httpContext: echo.Context
}
- type _subNfxRD = BaseCollectionEvent
- interface CollectionCreateEvent extends _subNfxRD {
+ type _subbBBie = BaseCollectionEvent
+ interface CollectionCreateEvent extends _subbBBie {
httpContext: echo.Context
}
- type _subDGTac = BaseCollectionEvent
- interface CollectionUpdateEvent extends _subDGTac {
+ type _subRjuAx = BaseCollectionEvent
+ interface CollectionUpdateEvent extends _subRjuAx {
httpContext: echo.Context
}
- type _subKCLvw = BaseCollectionEvent
- interface CollectionDeleteEvent extends _subKCLvw {
+ type _subdneDu = BaseCollectionEvent
+ interface CollectionDeleteEvent extends _subdneDu {
httpContext: echo.Context
}
interface CollectionsImportEvent {
httpContext: echo.Context
collections: Array<(models.Collection | undefined)>
}
- type _subWInyL = BaseModelEvent
- interface FileTokenEvent extends _subWInyL {
+ type _subJTztS = BaseModelEvent
+ interface FileTokenEvent extends _subJTztS {
httpContext: echo.Context
token: string
}
- type _subiIFNV = BaseCollectionEvent
- interface FileDownloadEvent extends _subiIFNV {
+ type _subnzfuJ = BaseCollectionEvent
+ interface FileDownloadEvent extends _subnzfuJ {
httpContext: echo.Context
record?: models.Record
fileField?: schema.SchemaField
@@ -15095,55 +15158,6 @@ namespace migrate {
}
}
-/**
- * Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
- * In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code.
- */
-namespace cobra {
- interface PositionalArgs {(cmd: Command, args: Array): void }
- // @ts-ignore
- import flag = pflag
- /**
- * FParseErrWhitelist configures Flag parse errors to be ignored
- */
- interface FParseErrWhitelist extends flag.ParseErrorsWhitelist{}
- /**
- * Group Structure to manage groups for commands
- */
- interface Group {
- id: string
- title: string
- }
- /**
- * ShellCompDirective is a bit map representing the different behaviors the shell
- * can be instructed to have once completions have been provided.
- */
- interface ShellCompDirective extends Number{}
- /**
- * CompletionOptions are the options to control shell completion
- */
- interface CompletionOptions {
- /**
- * DisableDefaultCmd prevents Cobra from creating a default 'completion' command
- */
- disableDefaultCmd: boolean
- /**
- * DisableNoDescFlag prevents Cobra from creating the '--no-descriptions' flag
- * for shells that support completion descriptions
- */
- disableNoDescFlag: boolean
- /**
- * DisableDescriptions turns off all completion descriptions for shells
- * that support them
- */
- disableDescriptions: boolean
- /**
- * HiddenDefaultCmd makes the default 'completion' command hidden
- */
- hiddenDefaultCmd: boolean
- }
-}
-
/**
* Package reflect implements run-time reflection, allowing a program to
* manipulate objects with arbitrary types. The typical use is to take a value
@@ -15508,39 +15522,18 @@ namespace fs {
}
}
-namespace store {
-}
-
/**
- * Package url parses URLs and implements query escaping.
+ * Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer
+ * object, creating another object (Reader or Writer) that also implements
+ * the interface but provides buffering and some help for textual I/O.
*/
-namespace url {
+namespace bufio {
/**
- * The Userinfo type is an immutable encapsulation of username and
- * password details for a URL. An existing Userinfo value is guaranteed
- * to have a username set (potentially empty, as allowed by RFC 2396),
- * and optionally a password.
+ * ReadWriter stores pointers to a Reader and a Writer.
+ * It implements io.ReadWriter.
*/
- interface Userinfo {
- }
- interface Userinfo {
- /**
- * Username returns the username.
- */
- username(): string
- }
- interface Userinfo {
- /**
- * Password returns the password in case it is set, and whether it is set.
- */
- password(): [string, boolean]
- }
- interface Userinfo {
- /**
- * String returns the encoded userinfo information in the standard form
- * of "username[:password]".
- */
- string(): string
+ type _subXTTec = Reader&Writer
+ interface ReadWriter extends _subXTTec {
}
}
@@ -15884,6 +15877,39 @@ namespace net {
}
}
+/**
+ * Package url parses URLs and implements query escaping.
+ */
+namespace url {
+ /**
+ * The Userinfo type is an immutable encapsulation of username and
+ * password details for a URL. An existing Userinfo value is guaranteed
+ * to have a username set (potentially empty, as allowed by RFC 2396),
+ * and optionally a password.
+ */
+ interface Userinfo {
+ }
+ interface Userinfo {
+ /**
+ * Username returns the username.
+ */
+ username(): string
+ }
+ interface Userinfo {
+ /**
+ * Password returns the password in case it is set, and whether it is set.
+ */
+ password(): [string, boolean]
+ }
+ interface Userinfo {
+ /**
+ * String returns the encoded userinfo information in the standard form
+ * of "username[:password]".
+ */
+ string(): string
+ }
+}
+
/**
* Copyright 2021 The Go Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
@@ -16089,97 +16115,6 @@ namespace x509 {
}
}
-namespace hook {
- /**
- * Handler defines a hook handler function.
- */
- interface Handler {(e: T): void }
- /**
- * wrapped local Hook embedded struct to limit the public API surface.
- */
- type _subzsrRp