diff --git a/.github/SECURITY.md b/.github/SECURITY.md
index 43226b5e..bb7819aa 100644
--- a/.github/SECURITY.md
+++ b/.github/SECURITY.md
@@ -84,6 +84,14 @@ In many places where applicable we've tried to minimize the impact by using cons
If you think that there is a place where we can improve the handling without hurting too much the user experience, feel free to open a regular public issue and it will be considered.
+
+Attack-vectors relying on social engineering
+
+Reports for attacks relying on various social engineering tactics _(e.g. tricking someone to click on a link)_ are valid concerns but usually out of the security scope of the project as there are a lot of cases where this behavior is deliberate for better UX.
+
+If you have concerns for such attack, feel free to open a regular public issue and we can eventually try to reconsider adding extra guards when feasible _(or at least properly document the existing behavior)_.
+
+
disintegration/imaging CVE-2023-36308
diff --git a/plugins/jsvm/internal/types/generated/types.d.ts b/plugins/jsvm/internal/types/generated/types.d.ts
index 47a18c2a..3f05dfae 100644
--- a/plugins/jsvm/internal/types/generated/types.d.ts
+++ b/plugins/jsvm/internal/types/generated/types.d.ts
@@ -1,4 +1,4 @@
-// 1779420329
+// 1779777274
// GENERATED CODE - DO NOT MODIFY BY HAND
// -------------------------------------------------------------------
@@ -1948,8 +1948,8 @@ namespace os {
* than ReadFrom. This is used to permit ReadFrom to call io.Copy
* without leading to a recursive call to ReadFrom.
*/
- type _sGozlON = noReadFrom&File
- interface fileWithoutReadFrom extends _sGozlON {
+ type _ssqhaJc = noReadFrom&File
+ interface fileWithoutReadFrom extends _ssqhaJc {
}
interface File {
/**
@@ -1993,8 +1993,8 @@ namespace os {
* than WriteTo. This is used to permit WriteTo to call io.Copy
* without leading to a recursive call to WriteTo.
*/
- type _snJjIdl = noWriteTo&File
- interface fileWithoutWriteTo extends _snJjIdl {
+ type _sIZDPbJ = noWriteTo&File
+ interface fileWithoutWriteTo extends _sIZDPbJ {
}
interface File {
/**
@@ -2940,8 +2940,8 @@ namespace os {
*
* The methods of File are safe for concurrent use.
*/
- type _sBEtBrg = file
- interface File extends _sBEtBrg {
+ type _svZZVrJ = file
+ interface File extends _svZZVrJ {
}
/**
* A FileInfo describes a file and is returned by [Stat] and [Lstat].
@@ -3333,237 +3333,6 @@ namespace filepath {
}
}
-/**
- * Package exec runs external commands. It wraps os.StartProcess to make it
- * easier to remap stdin and stdout, connect I/O with pipes, and do other
- * adjustments.
- *
- * Unlike the "system" library call from C and other languages, the
- * os/exec package intentionally does not invoke the system shell and
- * does not expand any glob patterns or handle other expansions,
- * pipelines, or redirections typically done by shells. The package
- * behaves more like C's "exec" family of functions. To expand glob
- * patterns, either call the shell directly, taking care to escape any
- * dangerous input, or use the [path/filepath] package's Glob function.
- * To expand environment variables, use package os's ExpandEnv.
- *
- * Note that the examples in this package assume a Unix system.
- * They may not run on Windows, and they do not run in the Go Playground
- * used by go.dev and pkg.go.dev.
- *
- * # Executables in the current directory
- *
- * The functions [Command] and [LookPath] look for a program
- * in the directories listed in the current path, following the
- * conventions of the host operating system.
- * Operating systems have for decades included the current
- * directory in this search, sometimes implicitly and sometimes
- * configured explicitly that way by default.
- * Modern practice is that including the current directory
- * is usually unexpected and often leads to security problems.
- *
- * To avoid those security problems, as of Go 1.19, this package will not resolve a program
- * using an implicit or explicit path entry relative to the current directory.
- * That is, if you run [LookPath]("go"), it will not successfully return
- * ./go on Unix nor .\go.exe on Windows, no matter how the path is configured.
- * Instead, if the usual path algorithms would result in that answer,
- * these functions return an error err satisfying [errors.Is](err, [ErrDot]).
- *
- * For example, consider these two program snippets:
- *
- * ```
- * path, err := exec.LookPath("prog")
- * if err != nil {
- * log.Fatal(err)
- * }
- * use(path)
- * ```
- *
- * and
- *
- * ```
- * cmd := exec.Command("prog")
- * if err := cmd.Run(); err != nil {
- * log.Fatal(err)
- * }
- * ```
- *
- * These will not find and run ./prog or .\prog.exe,
- * no matter how the current path is configured.
- *
- * Code that always wants to run a program from the current directory
- * can be rewritten to say "./prog" instead of "prog".
- *
- * Code that insists on including results from relative path entries
- * can instead override the error using an errors.Is check:
- *
- * ```
- * path, err := exec.LookPath("prog")
- * if errors.Is(err, exec.ErrDot) {
- * err = nil
- * }
- * if err != nil {
- * log.Fatal(err)
- * }
- * use(path)
- * ```
- *
- * and
- *
- * ```
- * cmd := exec.Command("prog")
- * if errors.Is(cmd.Err, exec.ErrDot) {
- * cmd.Err = nil
- * }
- * if err := cmd.Run(); err != nil {
- * log.Fatal(err)
- * }
- * ```
- *
- * Setting the environment variable GODEBUG=execerrdot=0
- * disables generation of ErrDot entirely, temporarily restoring the pre-Go 1.19
- * behavior for programs that are unable to apply more targeted fixes.
- * A future version of Go may remove support for this variable.
- *
- * Before adding such overrides, make sure you understand the
- * security implications of doing so.
- * See https://go.dev/blog/path-security for more information.
- */
-namespace exec {
- interface command {
- /**
- * Command returns the [Cmd] struct to execute the named program with
- * the given arguments.
- *
- * It sets only the Path and Args in the returned structure.
- *
- * If name contains no path separators, Command uses [LookPath] to
- * resolve name to a complete path if possible. Otherwise it uses name
- * directly as Path.
- *
- * The returned Cmd's Args field is constructed from the command name
- * followed by the elements of arg, so arg should not include the
- * command name itself. For example, Command("echo", "hello").
- * Args[0] is always name, not the possibly resolved Path.
- *
- * On Windows, processes receive the whole command line as a single string
- * and do their own parsing. Command combines and quotes Args into a command
- * line string with an algorithm compatible with applications using
- * CommandLineToArgvW (which is the most common way). Notable exceptions are
- * msiexec.exe and cmd.exe (and thus, all batch files), which have a different
- * unquoting algorithm. In these or other similar cases, you can do the
- * quoting yourself and provide the full command line in SysProcAttr.CmdLine,
- * leaving Args empty.
- */
- (name: string, ...arg: string[]): (Cmd)
- }
-}
-
-/**
- * Package template is a thin wrapper around the standard html/template
- * and text/template packages that implements a convenient registry to
- * load and cache templates on the fly concurrently.
- *
- * It was created to assist the JSVM plugin HTML rendering, but could be used in other Go code.
- *
- * Example:
- *
- * ```
- * registry := template.NewRegistry()
- *
- * html1, err := registry.LoadFiles(
- * // the files set wil be parsed only once and then cached
- * "layout.html",
- * "content.html",
- * ).Render(map[string]any{"name": "John"})
- *
- * html2, err := registry.LoadFiles(
- * // reuse the already parsed and cached files set
- * "layout.html",
- * "content.html",
- * ).Render(map[string]any{"name": "Jane"})
- * ```
- */
-namespace template {
- interface newRegistry {
- /**
- * NewRegistry creates and initializes a new templates registry with
- * some defaults (eg. global "raw" template function for unescaped HTML).
- *
- * Use the Registry.Load* methods to load templates into the registry.
- */
- (): (Registry)
- }
- /**
- * Registry defines a templates registry that is safe to be used by multiple goroutines.
- *
- * Use the Registry.Load* methods to load templates into the registry.
- */
- interface Registry {
- }
- interface Registry {
- /**
- * AddFuncs registers new global template functions.
- *
- * The key of each map entry is the function name that will be used in the templates.
- * If a function with the map entry name already exists it will be replaced with the new one.
- *
- * The value of each map entry is a function that must have either a
- * single return value, or two return values of which the second has type error.
- *
- * Example:
- *
- * ```
- * r.AddFuncs(map[string]any{
- * "toUpper": func(str string) string {
- * return strings.ToUppser(str)
- * },
- * ...
- * })
- * ```
- */
- addFuncs(funcs: _TygojaDict): (Registry)
- }
- interface Registry {
- /**
- * LoadFiles caches (if not already) the specified filenames set as a
- * single template and returns a ready to use Renderer instance.
- *
- * There must be at least 1 filename specified.
- */
- loadFiles(...filenames: string[]): (Renderer)
- }
- interface Registry {
- /**
- * LoadString caches (if not already) the specified inline string as a
- * single template and returns a ready to use Renderer instance.
- */
- loadString(text: string): (Renderer)
- }
- interface Registry {
- /**
- * LoadFS caches (if not already) the specified fs and globPatterns
- * pair as single template and returns a ready to use Renderer instance.
- *
- * There must be at least 1 file matching the provided globPattern(s)
- * (note that most file names serves as glob patterns matching themselves).
- */
- loadFS(fsys: fs.FS, ...globPatterns: string[]): (Renderer)
- }
- /**
- * Renderer defines a single parsed template.
- */
- interface Renderer {
- }
- interface Renderer {
- /**
- * Render executes the template with the specified data as the dot object
- * and returns the result as plain string.
- */
- render(data: any): string
- }
-}
-
/**
* Package validation provides configurable and extensible rules for validating data of various types.
*/
@@ -3918,14 +3687,14 @@ namespace dbx {
/**
* MssqlBuilder is the builder for SQL Server databases.
*/
- type _snIGhfU = BaseBuilder
- interface MssqlBuilder extends _snIGhfU {
+ type _sMZwbbB = BaseBuilder
+ interface MssqlBuilder extends _sMZwbbB {
}
/**
* MssqlQueryBuilder is the query builder for SQL Server databases.
*/
- type _sjHCovf = BaseQueryBuilder
- interface MssqlQueryBuilder extends _sjHCovf {
+ type _sxJjajk = BaseQueryBuilder
+ interface MssqlQueryBuilder extends _sxJjajk {
}
interface newMssqlBuilder {
/**
@@ -3996,8 +3765,8 @@ namespace dbx {
/**
* MysqlBuilder is the builder for MySQL databases.
*/
- type _swFflHh = BaseBuilder
- interface MysqlBuilder extends _swFflHh {
+ type _ssPbydH = BaseBuilder
+ interface MysqlBuilder extends _ssPbydH {
}
interface newMysqlBuilder {
/**
@@ -4072,14 +3841,14 @@ namespace dbx {
/**
* OciBuilder is the builder for Oracle databases.
*/
- type _swWgIXv = BaseBuilder
- interface OciBuilder extends _swWgIXv {
+ type _seYOrNJ = BaseBuilder
+ interface OciBuilder extends _seYOrNJ {
}
/**
* OciQueryBuilder is the query builder for Oracle databases.
*/
- type _sdeiqyP = BaseQueryBuilder
- interface OciQueryBuilder extends _sdeiqyP {
+ type _sIRntDt = BaseQueryBuilder
+ interface OciQueryBuilder extends _sIRntDt {
}
interface newOciBuilder {
/**
@@ -4142,8 +3911,8 @@ namespace dbx {
/**
* PgsqlBuilder is the builder for PostgreSQL databases.
*/
- type _sLjEWOf = BaseBuilder
- interface PgsqlBuilder extends _sLjEWOf {
+ type _sbxWXON = BaseBuilder
+ interface PgsqlBuilder extends _sbxWXON {
}
interface newPgsqlBuilder {
/**
@@ -4210,8 +3979,8 @@ namespace dbx {
/**
* SqliteQueryBuilder is the query builder for SQLite databases.
*/
- type _sMHLebw = BaseQueryBuilder
- interface SqliteQueryBuilder extends _sMHLebw {
+ type _slQgtol = BaseQueryBuilder
+ interface SqliteQueryBuilder extends _slQgtol {
}
interface SqliteQueryBuilder {
/**
@@ -4232,8 +4001,8 @@ namespace dbx {
/**
* SqliteBuilder is the builder for SQLite databases.
*/
- type _sEpwqho = BaseBuilder
- interface SqliteBuilder extends _sEpwqho {
+ type _skuKJHH = BaseBuilder
+ interface SqliteBuilder extends _skuKJHH {
}
interface newSqliteBuilder {
/**
@@ -4332,8 +4101,8 @@ namespace dbx {
/**
* StandardBuilder is the builder that is used by DB for an unknown driver.
*/
- type _sSNzkZZ = BaseBuilder
- interface StandardBuilder extends _sSNzkZZ {
+ type _sKuPRax = BaseBuilder
+ interface StandardBuilder extends _sKuPRax {
}
interface newStandardBuilder {
/**
@@ -4399,8 +4168,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 _sbeJecG = Builder
- interface DB extends _sbeJecG {
+ type _sTvJEoD = Builder
+ interface DB extends _sTvJEoD {
/**
* FieldMapper maps struct fields to DB columns. Defaults to DefaultFieldMapFunc.
*/
@@ -5230,8 +4999,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 _szfuzfG = sql.Rows
- interface Rows extends _szfuzfG {
+ type _stMAERG = sql.Rows
+ interface Rows extends _stMAERG {
}
interface Rows {
/**
@@ -5606,8 +5375,8 @@ namespace dbx {
}): string }
interface structInfo {
}
- type _sXCLSJx = structInfo
- interface structValue extends _sXCLSJx {
+ type _sjVxZMw = structInfo
+ interface structValue extends _sjVxZMw {
}
interface fieldInfo {
}
@@ -5646,8 +5415,8 @@ namespace dbx {
/**
* Tx enhances sql.Tx with additional querying methods.
*/
- type _sSVUUjW = Builder
- interface Tx extends _sSVUUjW {
+ type _sBdbStn = Builder
+ interface Tx extends _sBdbStn {
}
interface Tx {
/**
@@ -5902,8 +5671,8 @@ namespace filesystem {
*/
open(): io.ReadSeekCloser
}
- type _shFWJYs = bytes.Reader
- interface bytesReadSeekCloser extends _shFWJYs {
+ type _sVUpJJx = bytes.Reader
+ interface bytesReadSeekCloser extends _sVUpJJx {
}
interface bytesReadSeekCloser {
/**
@@ -6087,6 +5856,132 @@ namespace filesystem {
}
}
+/**
+ * Package exec runs external commands. It wraps os.StartProcess to make it
+ * easier to remap stdin and stdout, connect I/O with pipes, and do other
+ * adjustments.
+ *
+ * Unlike the "system" library call from C and other languages, the
+ * os/exec package intentionally does not invoke the system shell and
+ * does not expand any glob patterns or handle other expansions,
+ * pipelines, or redirections typically done by shells. The package
+ * behaves more like C's "exec" family of functions. To expand glob
+ * patterns, either call the shell directly, taking care to escape any
+ * dangerous input, or use the [path/filepath] package's Glob function.
+ * To expand environment variables, use package os's ExpandEnv.
+ *
+ * Note that the examples in this package assume a Unix system.
+ * They may not run on Windows, and they do not run in the Go Playground
+ * used by go.dev and pkg.go.dev.
+ *
+ * # Executables in the current directory
+ *
+ * The functions [Command] and [LookPath] look for a program
+ * in the directories listed in the current path, following the
+ * conventions of the host operating system.
+ * Operating systems have for decades included the current
+ * directory in this search, sometimes implicitly and sometimes
+ * configured explicitly that way by default.
+ * Modern practice is that including the current directory
+ * is usually unexpected and often leads to security problems.
+ *
+ * To avoid those security problems, as of Go 1.19, this package will not resolve a program
+ * using an implicit or explicit path entry relative to the current directory.
+ * That is, if you run [LookPath]("go"), it will not successfully return
+ * ./go on Unix nor .\go.exe on Windows, no matter how the path is configured.
+ * Instead, if the usual path algorithms would result in that answer,
+ * these functions return an error err satisfying [errors.Is](err, [ErrDot]).
+ *
+ * For example, consider these two program snippets:
+ *
+ * ```
+ * path, err := exec.LookPath("prog")
+ * if err != nil {
+ * log.Fatal(err)
+ * }
+ * use(path)
+ * ```
+ *
+ * and
+ *
+ * ```
+ * cmd := exec.Command("prog")
+ * if err := cmd.Run(); err != nil {
+ * log.Fatal(err)
+ * }
+ * ```
+ *
+ * These will not find and run ./prog or .\prog.exe,
+ * no matter how the current path is configured.
+ *
+ * Code that always wants to run a program from the current directory
+ * can be rewritten to say "./prog" instead of "prog".
+ *
+ * Code that insists on including results from relative path entries
+ * can instead override the error using an errors.Is check:
+ *
+ * ```
+ * path, err := exec.LookPath("prog")
+ * if errors.Is(err, exec.ErrDot) {
+ * err = nil
+ * }
+ * if err != nil {
+ * log.Fatal(err)
+ * }
+ * use(path)
+ * ```
+ *
+ * and
+ *
+ * ```
+ * cmd := exec.Command("prog")
+ * if errors.Is(cmd.Err, exec.ErrDot) {
+ * cmd.Err = nil
+ * }
+ * if err := cmd.Run(); err != nil {
+ * log.Fatal(err)
+ * }
+ * ```
+ *
+ * Setting the environment variable GODEBUG=execerrdot=0
+ * disables generation of ErrDot entirely, temporarily restoring the pre-Go 1.19
+ * behavior for programs that are unable to apply more targeted fixes.
+ * A future version of Go may remove support for this variable.
+ *
+ * Before adding such overrides, make sure you understand the
+ * security implications of doing so.
+ * See https://go.dev/blog/path-security for more information.
+ */
+namespace exec {
+ interface command {
+ /**
+ * Command returns the [Cmd] struct to execute the named program with
+ * the given arguments.
+ *
+ * It sets only the Path and Args in the returned structure.
+ *
+ * If name contains no path separators, Command uses [LookPath] to
+ * resolve name to a complete path if possible. Otherwise it uses name
+ * directly as Path.
+ *
+ * The returned Cmd's Args field is constructed from the command name
+ * followed by the elements of arg, so arg should not include the
+ * command name itself. For example, Command("echo", "hello").
+ * Args[0] is always name, not the possibly resolved Path.
+ *
+ * On Windows, processes receive the whole command line as a single string
+ * and do their own parsing. Command combines and quotes Args into a command
+ * line string with an algorithm compatible with applications using
+ * CommandLineToArgvW (which is the most common way). Notable exceptions are
+ * msiexec.exe and cmd.exe (and thus, all batch files), which have a different
+ * unquoting algorithm. In these or other similar cases, you can do the
+ * quoting yourself and provide the full command line in SysProcAttr.CmdLine,
+ * leaving Args empty.
+ */
+ (name: string, ...arg: string[]): (Cmd)
+ }
+}
+
/**
* Package core is the backbone of PocketBase.
*
@@ -7761,8 +7656,8 @@ namespace core {
/**
* AuthOrigin defines a Record proxy for working with the authOrigins collection.
*/
- type _sDsYzGn = Record
- interface AuthOrigin extends _sDsYzGn {
+ type _sFwuAmG = Record
+ interface AuthOrigin extends _sFwuAmG {
}
interface newAuthOrigin {
/**
@@ -8508,8 +8403,8 @@ namespace core {
* @todo experiment eventually replacing the rules *string with a struct?
* @todo consider changing the Indexes field to a "getter" for the sqlite_master table?
*/
- type _saSJqew = BaseModel
- interface baseCollection extends _saSJqew {
+ type _spJvUTL = BaseModel
+ interface baseCollection extends _spJvUTL {
listRule?: string
viewRule?: string
createRule?: string
@@ -8536,8 +8431,8 @@ namespace core {
/**
* Collection defines the table, fields and various options related to a set of records.
*/
- type _sjnatUq = baseCollection&collectionAuthOptions&collectionViewOptions
- interface Collection extends _sjnatUq {
+ type _sTUEmFE = baseCollection&collectionAuthOptions&collectionViewOptions
+ interface Collection extends _sTUEmFE {
}
interface newCollection {
/**
@@ -9547,8 +9442,8 @@ namespace core {
/**
* RequestEvent defines the PocketBase router handler event.
*/
- type _smnVmhK = router.Event
- interface RequestEvent extends _smnVmhK {
+ type _sfHmUZW = router.Event
+ interface RequestEvent extends _sfHmUZW {
app: App
auth?: Record
}
@@ -9608,8 +9503,8 @@ namespace core {
*/
clone(): (RequestInfo)
}
- type _sWFMCAQ = hook.Event&RequestEvent
- interface BatchRequestEvent extends _sWFMCAQ {
+ type _skyECwH = hook.Event&RequestEvent
+ interface BatchRequestEvent extends _skyECwH {
batch: Array<(InternalRequest | undefined)>
}
interface InternalRequest {
@@ -9651,24 +9546,24 @@ namespace core {
*/
tags(): Array
}
- type _sXOrPFy = hook.Event
- interface BootstrapEvent extends _sXOrPFy {
+ type _sBqSFqP = hook.Event
+ interface BootstrapEvent extends _sBqSFqP {
app: App
}
- type _sWeAblh = hook.Event
- interface TerminateEvent extends _sWeAblh {
+ type _sUazvVP = hook.Event
+ interface TerminateEvent extends _sUazvVP {
app: App
isRestart: boolean
}
- type _sLScowx = hook.Event
- interface BackupEvent extends _sLScowx {
+ type _srqtLnd = hook.Event
+ interface BackupEvent extends _srqtLnd {
app: App
context: context.Context
name: string // the name of the backup to create/restore.
exclude: Array // list of dir entries to exclude from the backup create/restore.
}
- type _sgITmjv = hook.Event
- interface ServeEvent extends _sgITmjv {
+ type _sYPbdTc = hook.Event
+ interface ServeEvent extends _sYPbdTc {
app: App
router?: router.Router
server?: http.Server
@@ -9715,31 +9610,31 @@ namespace core {
*/
fs: fs.FS
}
- type _siroWOi = hook.Event&RequestEvent
- interface SettingsListRequestEvent extends _siroWOi {
+ type _sPjWcKD = hook.Event&RequestEvent
+ interface SettingsListRequestEvent extends _sPjWcKD {
settings?: Settings
}
- type _semKMJq = hook.Event&RequestEvent
- interface SettingsUpdateRequestEvent extends _semKMJq {
+ type _sOAxiGd = hook.Event&RequestEvent
+ interface SettingsUpdateRequestEvent extends _sOAxiGd {
oldSettings?: Settings
newSettings?: Settings
}
- type _sCrmZmR = hook.Event
- interface SettingsReloadEvent extends _sCrmZmR {
+ type _sbpsTEC = hook.Event
+ interface SettingsReloadEvent extends _sbpsTEC {
app: App
}
- type _slCWszp = hook.Event
- interface MailerEvent extends _slCWszp {
+ type _sjjIGnu = hook.Event
+ interface MailerEvent extends _sjjIGnu {
app: App
mailer: mailer.Mailer
message?: mailer.Message
}
- type _sJpGSgU = MailerEvent&baseRecordEventData
- interface MailerRecordEvent extends _sJpGSgU {
+ type _sArfjEv = MailerEvent&baseRecordEventData
+ interface MailerRecordEvent extends _sArfjEv {
meta: _TygojaDict
}
- type _sQIKDLN = hook.Event&baseModelEventData
- interface ModelEvent extends _sQIKDLN {
+ type _suCogmi = hook.Event&baseModelEventData
+ interface ModelEvent extends _suCogmi {
app: App
context: context.Context
/**
@@ -9751,12 +9646,12 @@ namespace core {
*/
type: string
}
- type _sSuWzfC = ModelEvent
- interface ModelErrorEvent extends _sSuWzfC {
+ type _sPCfNda = ModelEvent
+ interface ModelErrorEvent extends _sPCfNda {
error: Error
}
- type _sxZXxtH = hook.Event&baseRecordEventData
- interface RecordEvent extends _sxZXxtH {
+ type _saJpCpe = hook.Event&baseRecordEventData
+ interface RecordEvent extends _saJpCpe {
app: App
context: context.Context
/**
@@ -9768,12 +9663,12 @@ namespace core {
*/
type: string
}
- type _soehWmo = RecordEvent
- interface RecordErrorEvent extends _soehWmo {
+ type _sdVlFeN = RecordEvent
+ interface RecordErrorEvent extends _sdVlFeN {
error: Error
}
- type _sQumdEr = hook.Event&baseCollectionEventData
- interface CollectionEvent extends _sQumdEr {
+ type _sbwlOCN = hook.Event&baseCollectionEventData
+ interface CollectionEvent extends _sbwlOCN {
app: App
context: context.Context
/**
@@ -9785,16 +9680,16 @@ namespace core {
*/
type: string
}
- type _sUANPEO = CollectionEvent
- interface CollectionErrorEvent extends _sUANPEO {
+ type _sVEWmXX = CollectionEvent
+ interface CollectionErrorEvent extends _sVEWmXX {
error: Error
}
- type _sfflLvc = hook.Event&RequestEvent&baseRecordEventData
- interface FileTokenRequestEvent extends _sfflLvc {
+ type _sKSkZUv = hook.Event&RequestEvent&baseRecordEventData
+ interface FileTokenRequestEvent extends _sKSkZUv {
token: string
}
- type _sZjIYBc = hook.Event&RequestEvent&baseCollectionEventData
- interface FileDownloadRequestEvent extends _sZjIYBc {
+ type _sIZkGMZ = hook.Event&RequestEvent&baseCollectionEventData
+ interface FileDownloadRequestEvent extends _sIZkGMZ {
record?: Record
fileField?: FileField
servedPath: string
@@ -9808,21 +9703,21 @@ namespace core {
*/
thumbError: Error
}
- type _sEKtjbu = hook.Event&RequestEvent
- interface CollectionsListRequestEvent extends _sEKtjbu {
+ type _safXfXB = hook.Event&RequestEvent
+ interface CollectionsListRequestEvent extends _safXfXB {
collections: Array<(Collection | undefined)>
result?: search.Result
}
- type _sseKrNj = hook.Event&RequestEvent
- interface CollectionsImportRequestEvent extends _sseKrNj {
+ type _sAatzbA = hook.Event&RequestEvent
+ interface CollectionsImportRequestEvent extends _sAatzbA {
collectionsData: Array<_TygojaDict>
deleteMissing: boolean
}
- type _sOaeClz = hook.Event&RequestEvent&baseCollectionEventData
- interface CollectionRequestEvent extends _sOaeClz {
+ type _sdqMPwQ = hook.Event&RequestEvent&baseCollectionEventData
+ interface CollectionRequestEvent extends _sdqMPwQ {
}
- type _sLvENGB = hook.Event&RequestEvent
- interface RealtimeConnectRequestEvent extends _sLvENGB {
+ type _sFICDXu = hook.Event&RequestEvent
+ interface RealtimeConnectRequestEvent extends _sFICDXu {
client: subscriptions.Client
/**
* IdleTimeout specifies the max duration to wait for a new message
@@ -9846,59 +9741,59 @@ namespace core {
*/
maxTimeout: time.Duration
}
- type _sUHpcIW = hook.Event&RequestEvent
- interface RealtimeMessageEvent extends _sUHpcIW {
+ type _sfaysLQ = hook.Event&RequestEvent
+ interface RealtimeMessageEvent extends _sfaysLQ {
client: subscriptions.Client
message?: subscriptions.Message
}
- type _ssJaghF = hook.Event&RequestEvent
- interface RealtimeSubscribeRequestEvent extends _ssJaghF {
+ type _sUFQPbL = hook.Event&RequestEvent
+ interface RealtimeSubscribeRequestEvent extends _sUFQPbL {
client: subscriptions.Client
subscriptions: Array
}
- type _sVQwCst = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordsListRequestEvent extends _sVQwCst {
+ type _sfiLMOu = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordsListRequestEvent extends _sfiLMOu {
/**
* @todo consider removing and maybe add as generic to the search.Result?
*/
records: Array<(Record | undefined)>
result?: search.Result
}
- type _stZqtCw = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordRequestEvent extends _stZqtCw {
+ type _smoBnVw = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordRequestEvent extends _smoBnVw {
record?: Record
}
- type _sgfBLoa = hook.Event&baseRecordEventData
- interface RecordEnrichEvent extends _sgfBLoa {
+ type _sbhfUyk = hook.Event&baseRecordEventData
+ interface RecordEnrichEvent extends _sbhfUyk {
app: App
requestInfo?: RequestInfo
}
- type _sNHQqnw = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordCreateOTPRequestEvent extends _sNHQqnw {
+ type _ssnRKUu = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordCreateOTPRequestEvent extends _ssnRKUu {
record?: Record
password: string
}
- type _sYQutrh = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordAuthWithOTPRequestEvent extends _sYQutrh {
+ type _sHBfEyH = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordAuthWithOTPRequestEvent extends _sHBfEyH {
record?: Record
otp?: OTP
}
- type _sNPNnwX = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordAuthRequestEvent extends _sNPNnwX {
+ type _swQLnBE = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordAuthRequestEvent extends _swQLnBE {
record?: Record
token: string
meta: any
authMethod: string
}
- type _sQrmeKz = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordAuthWithPasswordRequestEvent extends _sQrmeKz {
+ type _sIWMAAL = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordAuthWithPasswordRequestEvent extends _sIWMAAL {
record?: Record
identity: string
identityField: string
password: string
}
- type _sOTtWeh = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordAuthWithOAuth2RequestEvent extends _sOTtWeh {
+ type _stIhdpI = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordAuthWithOAuth2RequestEvent extends _stIhdpI {
providerName: string
providerClient: auth.Provider
record?: Record
@@ -9906,41 +9801,41 @@ namespace core {
createData: _TygojaDict
isNewRecord: boolean
}
- type _sWKIovA = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordAuthRefreshRequestEvent extends _sWKIovA {
+ type _sDDPDYH = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordAuthRefreshRequestEvent extends _sDDPDYH {
record?: Record
}
- type _ssbyNua = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordRequestPasswordResetRequestEvent extends _ssbyNua {
+ type _sJEcPgm = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordRequestPasswordResetRequestEvent extends _sJEcPgm {
record?: Record
}
- type _sRAzmKa = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordConfirmPasswordResetRequestEvent extends _sRAzmKa {
+ type _siadnhy = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordConfirmPasswordResetRequestEvent extends _siadnhy {
record?: Record
}
- type _sknCDNB = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordRequestVerificationRequestEvent extends _sknCDNB {
+ type _swYdbAW = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordRequestVerificationRequestEvent extends _swYdbAW {
record?: Record
}
- type _soritSV = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordConfirmVerificationRequestEvent extends _soritSV {
+ type _sCsGIsn = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordConfirmVerificationRequestEvent extends _sCsGIsn {
record?: Record
}
- type _snPjaLh = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordRequestEmailChangeRequestEvent extends _snPjaLh {
+ type _sojRaRR = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordRequestEmailChangeRequestEvent extends _sojRaRR {
record?: Record
newEmail: string
}
- type _sLqnGij = hook.Event&RequestEvent&baseCollectionEventData
- interface RecordConfirmEmailChangeRequestEvent extends _sLqnGij {
+ type _sEvNDft = hook.Event&RequestEvent&baseCollectionEventData
+ interface RecordConfirmEmailChangeRequestEvent extends _sEvNDft {
record?: Record
newEmail: string
}
/**
* ExternalAuth defines a Record proxy for working with the externalAuths collection.
*/
- type _sLpIhOz = Record
- interface ExternalAuth extends _sLpIhOz {
+ type _sCMnJSd = Record
+ interface ExternalAuth extends _sCMnJSd {
}
interface newExternalAuth {
/**
@@ -12483,8 +12378,8 @@ namespace core {
interface onlyFieldType {
type: string
}
- type _sZFZDPR = Field
- interface fieldWithType extends _sZFZDPR {
+ type _sywpyBW = Field
+ interface fieldWithType extends _sywpyBW {
type: string
}
interface fieldWithType {
@@ -12516,8 +12411,8 @@ namespace core {
*/
scan(value: any): void
}
- type _ssTQrBX = BaseModel
- interface Log extends _ssTQrBX {
+ type _sPgjSOX = BaseModel
+ interface Log extends _sPgjSOX {
created: types.DateTime
data: types.JSONMap
message: string
@@ -12563,8 +12458,8 @@ namespace core {
/**
* MFA defines a Record proxy for working with the mfas collection.
*/
- type _sWgZOov = Record
- interface MFA extends _sWgZOov {
+ type _sMlUmMy = Record
+ interface MFA extends _sMlUmMy {
}
interface newMFA {
/**
@@ -12786,8 +12681,8 @@ namespace core {
/**
* OTP defines a Record proxy for working with the otps collection.
*/
- type _sDxlCVQ = Record
- interface OTP extends _sDxlCVQ {
+ type _sIAfObC = Record
+ interface OTP extends _sIAfObC {
}
interface newOTP {
/**
@@ -13023,8 +12918,8 @@ namespace core {
}
interface runner {
}
- type _sSJFEzD = BaseModel
- interface Record extends _sSJFEzD {
+ type _sSFYbjM = BaseModel
+ interface Record extends _sSFYbjM {
}
interface newRecord {
/**
@@ -13499,8 +13394,8 @@ namespace core {
* BaseRecordProxy implements the [RecordProxy] interface and it is intended
* to be used as embed to custom user provided Record proxy structs.
*/
- type _sWDqnrq = Record
- interface BaseRecordProxy extends _sWDqnrq {
+ type _spMGUmv = Record
+ interface BaseRecordProxy extends _spMGUmv {
}
interface BaseRecordProxy {
/**
@@ -13754,8 +13649,8 @@ namespace core {
/**
* Settings defines the PocketBase app settings.
*/
- type _sSaqNsh = settings
- interface Settings extends _sSaqNsh {
+ type _steDERL = settings
+ interface Settings extends _steDERL {
}
interface Settings {
/**
@@ -14075,8 +13970,8 @@ namespace core {
*/
string(): string
}
- type _sDqdAUN = BaseModel
- interface Param extends _sDqdAUN {
+ type _sQkGgWV = BaseModel
+ interface Param extends _sQkGgWV {
created: types.DateTime
updated: types.DateTime
value: types.JSONRaw
@@ -14617,8 +14512,8 @@ namespace apis {
*/
(limitBytes: number): (hook.Handler)
}
- type _sQnzbYU = io.ReadCloser
- interface limitedReader extends _sQnzbYU {
+ type _sKXuVGN = io.ReadCloser
+ interface limitedReader extends _sKXuVGN {
}
interface limitedReader {
read(b: string|Array): number
@@ -14772,8 +14667,8 @@ namespace apis {
*/
(config: GzipConfig): (hook.Handler)
}
- type _sTQOySj = http.ResponseWriter&io.Writer
- interface gzipResponseWriter extends _sTQOySj {
+ type _sgxTeSK = http.ResponseWriter&io.Writer
+ interface gzipResponseWriter extends _sgxTeSK {
}
interface gzipResponseWriter {
writeHeader(code: number): void
@@ -14793,16 +14688,16 @@ namespace apis {
interface gzipResponseWriter {
unwrap(): http.ResponseWriter
}
- type _sFNPXVh = sync.RWMutex
- interface rateLimiter extends _sFNPXVh {
+ type _sLqrZEU = sync.RWMutex
+ interface rateLimiter extends _sLqrZEU {
}
/**
* @todo evaluate swiching to sliding window with approximation counter similar to Cloudflare.
*
* rateClient implements fixed window rate limit strategy.
*/
- type _skkfzbu = sync.Mutex
- interface rateClient extends _skkfzbu {
+ type _sdVTVJA = sync.Mutex
+ interface rateClient extends _sdVTVJA {
}
interface realtimeSubscribeForm {
clientId: string
@@ -15039,6 +14934,125 @@ namespace apis {
interface serverErrorLogWriter {
write(p: string|Array): number
}
+ interface runSQLForm {
+ query: string
+ }
+ interface runSQLResultColumn {
+ name: string
+ type: string
+ nullable: boolean
+ }
+ interface runSQLResult {
+ execTime: number
+ affectedRows: number
+ columns: Array
+ rows: Array>
+ }
+}
+
+/**
+ * Package template is a thin wrapper around the standard html/template
+ * and text/template packages that implements a convenient registry to
+ * load and cache templates on the fly concurrently.
+ *
+ * It was created to assist the JSVM plugin HTML rendering, but could be used in other Go code.
+ *
+ * Example:
+ *
+ * ```
+ * registry := template.NewRegistry()
+ *
+ * html1, err := registry.LoadFiles(
+ * // the files set wil be parsed only once and then cached
+ * "layout.html",
+ * "content.html",
+ * ).Render(map[string]any{"name": "John"})
+ *
+ * html2, err := registry.LoadFiles(
+ * // reuse the already parsed and cached files set
+ * "layout.html",
+ * "content.html",
+ * ).Render(map[string]any{"name": "Jane"})
+ * ```
+ */
+namespace template {
+ interface newRegistry {
+ /**
+ * NewRegistry creates and initializes a new templates registry with
+ * some defaults (eg. global "raw" template function for unescaped HTML).
+ *
+ * Use the Registry.Load* methods to load templates into the registry.
+ */
+ (): (Registry)
+ }
+ /**
+ * Registry defines a templates registry that is safe to be used by multiple goroutines.
+ *
+ * Use the Registry.Load* methods to load templates into the registry.
+ */
+ interface Registry {
+ }
+ interface Registry {
+ /**
+ * AddFuncs registers new global template functions.
+ *
+ * The key of each map entry is the function name that will be used in the templates.
+ * If a function with the map entry name already exists it will be replaced with the new one.
+ *
+ * The value of each map entry is a function that must have either a
+ * single return value, or two return values of which the second has type error.
+ *
+ * Example:
+ *
+ * ```
+ * r.AddFuncs(map[string]any{
+ * "toUpper": func(str string) string {
+ * return strings.ToUppser(str)
+ * },
+ * ...
+ * })
+ * ```
+ */
+ addFuncs(funcs: _TygojaDict): (Registry)
+ }
+ interface Registry {
+ /**
+ * LoadFiles caches (if not already) the specified filenames set as a
+ * single template and returns a ready to use Renderer instance.
+ *
+ * There must be at least 1 filename specified.
+ */
+ loadFiles(...filenames: string[]): (Renderer)
+ }
+ interface Registry {
+ /**
+ * LoadString caches (if not already) the specified inline string as a
+ * single template and returns a ready to use Renderer instance.
+ */
+ loadString(text: string): (Renderer)
+ }
+ interface Registry {
+ /**
+ * LoadFS caches (if not already) the specified fs and globPatterns
+ * pair as single template and returns a ready to use Renderer instance.
+ *
+ * There must be at least 1 file matching the provided globPattern(s)
+ * (note that most file names serves as glob patterns matching themselves).
+ */
+ loadFS(fsys: fs.FS, ...globPatterns: string[]): (Renderer)
+ }
+ /**
+ * Renderer defines a single parsed template.
+ */
+ interface Renderer {
+ }
+ interface Renderer {
+ /**
+ * Render executes the template with the specified data as the dot object
+ * and returns the result as plain string.
+ */
+ render(data: any): string
+ }
}
namespace pocketbase {
@@ -15048,8 +15062,8 @@ namespace pocketbase {
* It implements [CoreApp] via embedding and all of the app interface methods
* could be accessed directly through the instance (eg. PocketBase.DataDir()).
*/
- type _svZVkkM = CoreApp
- interface PocketBase extends _svZVkkM {
+ type _szQoDIH = CoreApp
+ interface PocketBase extends _szQoDIH {
/**
* RootCmd is the main console command
*/
@@ -15285,184 +15299,6 @@ namespace sync {
}
}
-/**
- * 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.
- *
- * If len(p) == 0, Read should always return n == 0. It may return a
- * non-nil error if some error condition is known, such as EOF.
- *
- * 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 {
- [key:string]: any;
- read(p: string|Array): 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 {
- [key:string]: any;
- write(p: string|Array): number
- }
- /**
- * ReadCloser is the interface that groups the basic Read and Close methods.
- */
- interface ReadCloser {
- [key:string]: any;
- }
- /**
- * ReadSeekCloser is the interface that groups the basic Read, Seek and Close
- * methods.
- */
- interface ReadSeekCloser {
- [key:string]: any;
- }
-}
-
-/**
- * Package bytes implements functions for the manipulation of byte slices.
- * It is analogous to the facilities of the [strings] package.
- */
-namespace bytes {
- /**
- * A Reader implements the [io.Reader], [io.ReaderAt], [io.WriterTo], [io.Seeker],
- * [io.ByteScanner], and [io.RuneScanner] interfaces by reading from
- * a byte slice.
- * Unlike a [Buffer], a Reader is read-only and supports seeking.
- * The zero value for Reader operates like a Reader of an empty slice.
- */
- interface Reader {
- }
- interface Reader {
- /**
- * Len returns the number of bytes of the unread portion of the
- * slice.
- */
- len(): number
- }
- interface Reader {
- /**
- * Size returns the original length of the underlying byte slice.
- * Size is the number of bytes available for reading via [Reader.ReadAt].
- * The result is unaffected by any method calls except [Reader.Reset].
- */
- size(): number
- }
- interface Reader {
- /**
- * Read implements the [io.Reader] interface.
- */
- read(b: string|Array): number
- }
- interface Reader {
- /**
- * ReadAt implements the [io.ReaderAt] interface.
- */
- readAt(b: string|Array, off: number): number
- }
- interface Reader {
- /**
- * ReadByte implements the [io.ByteReader] interface.
- */
- readByte(): number
- }
- interface Reader {
- /**
- * UnreadByte complements [Reader.ReadByte] in implementing the [io.ByteScanner] interface.
- */
- unreadByte(): void
- }
- interface Reader {
- /**
- * ReadRune implements the [io.RuneReader] interface.
- */
- readRune(): [number, number]
- }
- interface Reader {
- /**
- * UnreadRune complements [Reader.ReadRune] in implementing the [io.RuneScanner] interface.
- */
- unreadRune(): void
- }
- interface Reader {
- /**
- * Seek implements the [io.Seeker] interface.
- */
- seek(offset: number, whence: number): number
- }
- interface Reader {
- /**
- * WriteTo implements the [io.WriterTo] interface.
- */
- writeTo(w: io.Writer): number
- }
- interface Reader {
- /**
- * Reset resets the [Reader] to be reading from b.
- */
- reset(b: string|Array): void
- }
-}
-
-/**
- * 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 bufio {
- /**
- * ReadWriter stores pointers to a [Reader] and a [Writer].
- * It implements [io.ReadWriter].
- */
- type _sQwNHDI = Reader&Writer
- interface ReadWriter extends _sQwNHDI {
- }
-}
-
/**
* Package syscall contains an interface to the low-level operating system
* primitives. The details vary depending on the underlying system, and
@@ -16380,6 +16216,84 @@ 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.
+ *
+ * If len(p) == 0, Read should always return n == 0. It may return a
+ * non-nil error if some error condition is known, such as EOF.
+ *
+ * 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 {
+ [key:string]: any;
+ read(p: string|Array): 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 {
+ [key:string]: any;
+ write(p: string|Array): number
+ }
+ /**
+ * ReadCloser is the interface that groups the basic Read and Close methods.
+ */
+ interface ReadCloser {
+ [key:string]: any;
+ }
+ /**
+ * ReadSeekCloser is the interface that groups the basic Read, Seek and Close
+ * methods.
+ */
+ interface ReadSeekCloser {
+ [key:string]: any;
+ }
+}
+
/**
* Package fs defines basic interfaces to a file system.
* A file system can be provided by the host operating system
@@ -16582,677 +16496,87 @@ namespace fs {
}
/**
- * 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.
+ * Package bytes implements functions for the manipulation of byte slices.
+ * It is analogous to the facilities of the [strings] package.
*/
-namespace sql {
+namespace bytes {
/**
- * TxOptions holds the transaction options to be used in [DB.BeginTx].
+ * A Reader implements the [io.Reader], [io.ReaderAt], [io.WriterTo], [io.Seeker],
+ * [io.ByteScanner], and [io.RuneScanner] interfaces by reading from
+ * a byte slice.
+ * Unlike a [Buffer], a Reader is read-only and supports seeking.
+ * The zero value for Reader operates like a Reader of an empty slice.
*/
- interface TxOptions {
+ interface Reader {
+ }
+ interface Reader {
/**
- * Isolation is the transaction isolation level.
- * If zero, the driver or database's default level is used.
+ * Len returns the number of bytes of the unread portion of the
+ * slice.
*/
- isolation: IsolationLevel
- readOnly: boolean
+ len(): number
}
- /**
- * NullString represents a string that may be null.
- * NullString implements the [Scanner] interface so
- * it can be used as a scan destination:
- *
- * ```
- * var s NullString
- * err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s)
- * ...
- * if s.Valid {
- * // use s.String
- * } else {
- * // NULL value
- * }
- * ```
- */
- interface NullString {
- string: string
- valid: boolean // Valid is true if String is not NULL
- }
- interface NullString {
+ interface Reader {
/**
- * Scan implements the [Scanner] interface.
+ * Size returns the original length of the underlying byte slice.
+ * Size is the number of bytes available for reading via [Reader.ReadAt].
+ * The result is unaffected by any method calls except [Reader.Reset].
*/
- scan(value: any): void
+ size(): number
}
- interface NullString {
+ interface Reader {
/**
- * Value implements the [driver.Valuer] interface.
+ * Read implements the [io.Reader] interface.
*/
- value(): any
+ read(b: string|Array): number
}
- /**
- * 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 [Tx.Commit] or
- * [Tx.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 [DB.SetMaxIdleConns].
- */
- interface DB {
- }
- interface DB {
+ interface Reader {
/**
- * PingContext verifies a connection to the database is still alive,
- * establishing a connection if necessary.
+ * ReadAt implements the [io.ReaderAt] interface.
*/
- pingContext(ctx: context.Context): void
+ readAt(b: string|Array, off: number): number
}
- interface DB {
+ interface Reader {
/**
- * 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
- * [DB.PingContext].
+ * ReadByte implements the [io.ByteReader] interface.
*/
- ping(): void
+ readByte(): number
}
- interface DB {
+ interface Reader {
/**
- * 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.
+ * UnreadByte complements [Reader.ReadByte] in implementing the [io.ByteScanner] interface.
*/
- close(): void
+ unreadByte(): void
}
- interface DB {
+ interface Reader {
/**
- * 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.
+ * ReadRune implements the [io.RuneReader] interface.
*/
- setMaxIdleConns(n: number): void
+ readRune(): [number, number]
}
- interface DB {
+ interface Reader {
/**
- * 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).
+ * UnreadRune complements [Reader.ReadRune] in implementing the [io.RuneScanner] interface.
*/
- setMaxOpenConns(n: number): void
+ unreadRune(): void
}
- interface DB {
+ interface Reader {
/**
- * 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.
+ * Seek implements the [io.Seeker] interface.
*/
- setConnMaxLifetime(d: time.Duration): void
+ seek(offset: number, whence: number): number
}
- interface DB {
+ interface Reader {
/**
- * 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.
+ * WriteTo implements the [io.WriterTo] interface.
*/
- setConnMaxIdleTime(d: time.Duration): void
+ writeTo(w: io.Writer): number
}
- interface DB {
+ interface Reader {
/**
- * Stats returns database statistics.
+ * Reset resets the [Reader] to be reading from b.
*/
- 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 [*Stmt.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)
- }
- 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 [*Stmt.Close] method
- * when the statement is no longer needed.
- *
- * Prepare uses [context.Background] internally; to specify the context, use
- * [DB.PrepareContext].
- */
- prepare(query: string): (Stmt)
- }
- 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
- * [DB.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)
- }
- 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
- * [DB.QueryContext].
- */
- query(query: string, ...args: any[]): (Rows)
- }
- 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.Scan] will return [ErrNoRows].
- * Otherwise, [*Row.Scan] scans the first selected row and discards
- * the rest.
- */
- queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row)
- }
- 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.Scan] will return [ErrNoRows].
- * Otherwise, [*Row.Scan] scans the first selected row and discards
- * the rest.
- *
- * QueryRow uses [context.Background] internally; to specify the context, use
- * [DB.QueryRowContext].
- */
- queryRow(query: string, ...args: any[]): (Row)
- }
- 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)
- }
- 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
- * [DB.BeginTx].
- */
- begin(): (Tx)
- }
- interface DB {
- /**
- * Driver returns the database's underlying driver.
- */
- driver(): any
- }
- 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)
- }
- /**
- * Tx is an in-progress database transaction.
- *
- * A transaction must end with a call to [Tx.Commit] or [Tx.Rollback].
- *
- * After a call to [Tx.Commit] or [Tx.Rollback], all operations on the
- * transaction fail with [ErrTxDone].
- *
- * The statements prepared for a transaction by calling
- * the transaction's [Tx.Prepare] or [Tx.Stmt] methods are closed
- * by the call to [Tx.Commit] or [Tx.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)
- }
- 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
- * [Tx.PrepareContext].
- */
- prepare(query: string): (Stmt)
- }
- 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)
- }
- 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
- * [Tx.StmtContext].
- */
- stmt(stmt: Stmt): (Stmt)
- }
- 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
- * [Tx.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)
- }
- interface Tx {
- /**
- * Query executes a query that returns rows, typically a SELECT.
- *
- * Query uses [context.Background] internally; to specify the context, use
- * [Tx.QueryContext].
- */
- query(query: string, ...args: any[]): (Rows)
- }
- 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.Scan] will return [ErrNoRows].
- * Otherwise, the [*Row.Scan] scans the first selected row and discards
- * the rest.
- */
- queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row)
- }
- 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.Scan] will return [ErrNoRows].
- * Otherwise, the [*Row.Scan] scans the first selected row and discards
- * the rest.
- *
- * QueryRow uses [context.Background] internally; to specify the context, use
- * [Tx.QueryRowContext].
- */
- queryRow(query: string, ...args: any[]): (Row)
- }
- /**
- * 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
- * [Stmt.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)
- }
- 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
- * [Stmt.QueryContext].
- */
- query(...args: any[]): (Rows)
- }
- 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.Scan] will return [ErrNoRows].
- * Otherwise, the [*Row.Scan] scans the first selected row and discards
- * the rest.
- */
- queryRowContext(ctx: context.Context, ...args: any[]): (Row)
- }
- 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.Scan] will return [ErrNoRows].
- * Otherwise, the [*Row.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
- * [Stmt.QueryRowContext].
- */
- queryRow(...args: any[]): (Row)
- }
- 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 [Rows.Next] to advance from row to row.
- */
- interface Rows {
- }
- interface Rows {
- /**
- * Next prepares the next result row for reading with the [Rows.Scan] method. It
- * returns true on success, or false if there is no next result row or an error
- * happened while preparing it. [Rows.Err] should be consulted to distinguish between
- * the two cases.
- *
- * Every call to [Rows.Scan], even the first one, must be preceded by a call to [Rows.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 [Rows.Err] method should be consulted
- * to distinguish between the two cases.
- *
- * After calling NextResultSet, the [Rows.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 [Rows.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 [Rows.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 [Rows.Err]. Close is idempotent and does not affect the result of [Rows.Err].
- */
- close(): void
- }
- /**
- * A Result summarizes an executed SQL command.
- */
- interface Result {
- [key:string]: 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.
- */
- 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
+ reset(b: string|Array): void
}
}
@@ -17419,6 +16743,275 @@ namespace syntax {
interface Flags extends Number{}
}
+/**
+ * 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 {
+ /**
+ * Add returns a new DateTime based on the current DateTime + the specified duration.
+ */
+ add(duration: time.Duration): DateTime
+ }
+ interface DateTime {
+ /**
+ * Sub returns a [time.Duration] by subtracting the specified DateTime from the current one.
+ *
+ * If the result exceeds the maximum (or minimum) value that can be stored in a [time.Duration],
+ * the maximum (or minimum) duration will be returned.
+ */
+ sub(u: DateTime): time.Duration
+ }
+ interface DateTime {
+ /**
+ * AddDate returns a new DateTime based on the current one + duration.
+ *
+ * It follows the same rules as [time.AddDate].
+ */
+ addDate(years: number, months: number, days: number): DateTime
+ }
+ interface DateTime {
+ /**
+ * After reports whether the current DateTime instance is after u.
+ */
+ after(u: DateTime): boolean
+ }
+ interface DateTime {
+ /**
+ * Before reports whether the current DateTime instance is before u.
+ */
+ before(u: DateTime): boolean
+ }
+ interface DateTime {
+ /**
+ * Compare compares the current DateTime instance with u.
+ * If the current instance is before u, it returns -1.
+ * If the current instance is after u, it returns +1.
+ * If they're the same, it returns 0.
+ */
+ compare(u: DateTime): number
+ }
+ interface DateTime {
+ /**
+ * Equal reports whether the current DateTime and u represent the same time instant.
+ * Two DateTime can be equal even if they are in different locations.
+ * For example, 6:00 +0200 and 4:00 UTC are Equal.
+ */
+ equal(u: DateTime): boolean
+ }
+ interface DateTime {
+ /**
+ * Unix returns the current DateTime as a Unix time, aka.
+ * the number of seconds elapsed since January 1, 1970 UTC.
+ */
+ unix(): number
+ }
+ 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|Array
+ }
+ interface DateTime {
+ /**
+ * UnmarshalJSON implements the [json.Unmarshaler] interface.
+ */
+ unmarshalJSON(b: string|Array): void
+ }
+ interface DateTime {
+ /**
+ * Value implements the [driver.Valuer] interface.
+ */
+ value(): any
+ }
+ interface DateTime {
+ /**
+ * Scan implements [sql.Scanner] interface to scan the provided value
+ * into the current DateTime instance.
+ */
+ scan(value: any): void
+ }
+ /**
+ * GeoPoint defines a struct for storing geo coordinates as serialized json object
+ * (e.g. {lon:0,lat:0}).
+ *
+ * Note: using object notation and not a plain array to avoid the confusion
+ * as there doesn't seem to be a fixed standard for the coordinates order.
+ */
+ interface GeoPoint {
+ lon: number
+ lat: number
+ }
+ interface GeoPoint {
+ /**
+ * String returns the string representation of the current GeoPoint instance.
+ */
+ string(): string
+ }
+ interface GeoPoint {
+ /**
+ * AsMap implements [core.mapExtractor] and returns a value suitable
+ * to be used in an API rule expression.
+ */
+ asMap(): _TygojaDict
+ }
+ interface GeoPoint {
+ /**
+ * Value implements the [driver.Valuer] interface.
+ */
+ value(): any
+ }
+ interface GeoPoint {
+ /**
+ * Scan implements [sql.Scanner] interface to scan the provided value
+ * into the current GeoPoint instance.
+ *
+ * The value argument could be nil (no-op), another GeoPoint instance,
+ * map or serialized json object with lat-lon props.
+ */
+ scan(value: any): void
+ }
+ /**
+ * JSONArray defines a slice that is safe for json and db read/write.
+ */
+ interface JSONArray extends Array{}
+ interface JSONArray {
+ /**
+ * MarshalJSON implements the [json.Marshaler] interface.
+ */
+ marshalJSON(): string|Array
+ }
+ interface JSONArray {
+ /**
+ * String returns the string representation of the current json array.
+ */
+ string(): string
+ }
+ interface JSONArray {
+ /**
+ * Value implements the [driver.Valuer] interface.
+ */
+ value(): any
+ }
+ interface JSONArray {
+ /**
+ * Scan implements [sql.Scanner] interface to scan the provided value
+ * into the current JSONArray[T] instance.
+ */
+ scan(value: any): void
+ }
+ /**
+ * JSONMap defines a map that is safe for json and db read/write.
+ */
+ interface JSONMap extends _TygojaDict{}
+ interface JSONMap {
+ /**
+ * MarshalJSON implements the [json.Marshaler] interface.
+ */
+ marshalJSON(): string|Array
+ }
+ interface JSONMap {
+ /**
+ * String returns the string representation of the current json map.
+ */
+ string(): string
+ }
+ interface JSONMap {
+ /**
+ * Get retrieves a single value from the current JSONMap[T].
+ *
+ * This helper was added primarily to assist the goja integration since custom map types
+ * don't have direct access to the map keys (https://pkg.go.dev/github.com/dop251/goja#hdr-Maps_with_methods).
+ */
+ get(key: string): T
+ }
+ interface JSONMap {
+ /**
+ * Set sets a single value in the current JSONMap[T].
+ *
+ * This helper was added primarily to assist the goja integration since custom map types
+ * don't have direct access to the map keys (https://pkg.go.dev/github.com/dop251/goja#hdr-Maps_with_methods).
+ */
+ set(key: string, value: T): void
+ }
+ interface JSONMap {
+ /**
+ * Value implements the [driver.Valuer] interface.
+ */
+ value(): any
+ }
+ interface JSONMap {
+ /**
+ * Scan implements [sql.Scanner] interface to scan the provided value
+ * into the current JSONMap[T] instance.
+ */
+ scan(value: any): void
+ }
+ /**
+ * JSONRaw defines a json value type that is safe for db read/write.
+ */
+ interface JSONRaw extends Array{}
+ interface JSONRaw {
+ /**
+ * String returns the current JSONRaw instance as a json encoded string.
+ */
+ string(): string
+ }
+ interface JSONRaw {
+ /**
+ * MarshalJSON implements the [json.Marshaler] interface.
+ */
+ marshalJSON(): string|Array
+ }
+ interface JSONRaw {
+ /**
+ * UnmarshalJSON implements the [json.Unmarshaler] interface.
+ */
+ unmarshalJSON(b: string|Array): void
+ }
+ interface JSONRaw {
+ /**
+ * Value implements the [driver.Valuer] interface.
+ */
+ value(): any
+ }
+ interface JSONRaw {
+ /**
+ * Scan implements [sql.Scanner] interface to scan the provided value
+ * into the current JSONRaw instance.
+ */
+ scan(value: any): void
+ }
+}
+
/**
* Package net provides a portable interface for network I/O, including
* TCP/IP, UDP, domain name resolution, and Unix domain sockets.
@@ -17616,6 +17209,70 @@ namespace net {
import _cgopackage = cgo
}
+/**
+ * Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
+ *
+ * See README.md for more info.
+ */
+namespace jwt {
+ /**
+ * MapClaims is a claims type that uses the map[string]any for JSON
+ * decoding. This is the default claims type if you don't supply one
+ */
+ interface MapClaims extends _TygojaDict{}
+ interface MapClaims {
+ /**
+ * GetExpirationTime implements the Claims interface.
+ */
+ getExpirationTime(): (NumericDate)
+ }
+ interface MapClaims {
+ /**
+ * GetNotBefore implements the Claims interface.
+ */
+ getNotBefore(): (NumericDate)
+ }
+ interface MapClaims {
+ /**
+ * GetIssuedAt implements the Claims interface.
+ */
+ getIssuedAt(): (NumericDate)
+ }
+ interface MapClaims {
+ /**
+ * GetAudience implements the Claims interface.
+ */
+ getAudience(): ClaimStrings
+ }
+ interface MapClaims {
+ /**
+ * GetIssuer implements the Claims interface.
+ */
+ getIssuer(): string
+ }
+ interface MapClaims {
+ /**
+ * GetSubject implements the Claims interface.
+ */
+ getSubject(): string
+ }
+}
+
+/**
+ * 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 bufio {
+ /**
+ * ReadWriter stores pointers to a [Reader] and a [Writer].
+ * It implements [io.ReadWriter].
+ */
+ type _sakQbRy = Reader&Writer
+ interface ReadWriter extends _sakQbRy {
+ }
+}
+
/**
* Package multipart implements MIME multipart parsing, as defined in RFC
* 2046.
@@ -18662,163 +18319,270 @@ namespace http {
}
}
-/**
- * Package blob defines a lightweight abstration for interacting with
- * various storage services (local filesystem, S3, etc.).
- *
- * NB!
- * For compatibility with earlier PocketBase versions and to prevent
- * unnecessary breaking changes, this package is based and implemented
- * as a minimal, stripped down version of the previously used gocloud.dev/blob.
- * While there is no promise that it won't diverge in the future to accommodate
- * better some PocketBase specific use cases, currently it copies and
- * tries to follow as close as possible the same implementations,
- * conventions and rules for the key escaping/unescaping, blob read/write
- * interfaces and struct options as gocloud.dev/blob, therefore the
- * credits goes to the original Go Cloud Development Kit Authors.
- */
-namespace blob {
+namespace auth {
/**
- * ListObject represents a single blob returned from List.
+ * @todo refactor and consider replace with a plain struct
+ *
+ * Provider defines a common interface for an OAuth2 client.
*/
- interface ListObject {
+ interface Provider {
+ [key:string]: any;
/**
- * Key is the key for this blob.
- */
- key: string
- /**
- * ModTime is the time the blob was last modified.
- */
- modTime: time.Time
- /**
- * Size is the size of the blob's content in bytes.
- */
- size: number
- /**
- * MD5 is an MD5 hash of the blob contents or nil if not available.
- */
- md5: string|Array
- /**
- * IsDir indicates that this result represents a "directory" in the
- * hierarchical namespace, ending in ListOptions.Delimiter. Key can be
- * passed as ListOptions.Prefix to list items in the "directory".
- * Fields other than Key and IsDir will not be set if IsDir is true.
- */
- isDir: boolean
- }
- /**
- * Attributes contains attributes about a blob.
- */
- interface Attributes {
- /**
- * CacheControl specifies caching attributes that services may use
- * when serving the blob.
- * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
- */
- cacheControl: string
- /**
- * ContentDisposition specifies whether the blob content is expected to be
- * displayed inline or as an attachment.
- * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
- */
- contentDisposition: string
- /**
- * ContentEncoding specifies the encoding used for the blob's content, if any.
- * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
- */
- contentEncoding: string
- /**
- * ContentLanguage specifies the language used in the blob's content, if any.
- * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language
- */
- contentLanguage: string
- /**
- * ContentType is the MIME type of the blob. It will not be empty.
- * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
- */
- contentType: string
- /**
- * Metadata holds key/value pairs associated with the blob.
- * Keys are guaranteed to be in lowercase, even if the backend service
- * has case-sensitive keys (although note that Metadata written via
- * this package will always be lowercased). If there are duplicate
- * case-insensitive keys (e.g., "foo" and "FOO"), only one value
- * will be kept, and it is undefined which one.
- */
- metadata: _TygojaDict
- /**
- * CreateTime is the time the blob was created, if available. If not available,
- * CreateTime will be the zero time.
- */
- createTime: time.Time
- /**
- * ModTime is the time the blob was last modified.
- */
- modTime: time.Time
- /**
- * Size is the size of the blob's content in bytes.
- */
- size: number
- /**
- * MD5 is an MD5 hash of the blob contents or nil if not available.
- */
- md5: string|Array
- /**
- * ETag for the blob; see https://en.wikipedia.org/wiki/HTTP_ETag.
- */
- eTag: string
- }
- /**
- * Reader reads bytes from a blob.
- * It implements io.ReadSeekCloser, and must be closed after reads are finished.
- */
- interface Reader {
- }
- interface Reader {
- /**
- * Read implements io.Reader (https://golang.org/pkg/io/#Reader).
- */
- read(p: string|Array): number
- }
- interface Reader {
- /**
- * Seek implements io.Seeker (https://golang.org/pkg/io/#Seeker).
- */
- seek(offset: number, whence: number): number
- }
- interface Reader {
- /**
- * Close implements io.Closer (https://golang.org/pkg/io/#Closer).
- */
- close(): void
- }
- interface Reader {
- /**
- * ContentType returns the MIME type of the blob.
- */
- contentType(): string
- }
- interface Reader {
- /**
- * ModTime returns the time the blob was last modified.
- */
- modTime(): time.Time
- }
- interface Reader {
- /**
- * Size returns the size of the blob content in bytes.
- */
- size(): number
- }
- interface Reader {
- /**
- * WriteTo reads from r and writes to w until there's no more data or
- * an error occurs.
- * The return value is the number of bytes written to w.
+ * @todo temp backport
*
- * It implements the io.WriterTo interface.
+ * Order returns the sorting order of the provider usually used in the auth methods list response.
*/
- writeTo(w: io.Writer): number
+ logo(): string
+ /**
+ * @todo temp backport
+ *
+ * Order returns the sorting order of the provider usually used in the auth methods list response.
+ */
+ order(): number
+ /**
+ * Context 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
+ /**
+ * PKCE indicates whether the provider can use the PKCE flow.
+ */
+ pkce(): boolean
+ /**
+ * SetPKCE toggles the state whether the provider can use the PKCE flow or not.
+ */
+ setPKCE(enable: boolean): void
+ /**
+ * DisplayName usually returns provider name as it is officially written
+ * and it could be used directly in the UI.
+ */
+ displayName(): string
+ /**
+ * SetDisplayName sets the provider's display name.
+ */
+ setDisplayName(displayName: string): 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
+ /**
+ * UserInfoURL returns the provider's user info api url.
+ */
+ userInfoURL(): string
+ /**
+ * SetUserInfoURL sets the provider's UserInfoURL.
+ */
+ setUserInfoURL(url: string): void
+ /**
+ * Extra returns a shallow copy of any custom config data
+ * that the provider may need.
+ */
+ extra(): _TygojaDict
+ /**
+ * SetExtra updates the provider's custom config data.
+ */
+ setExtra(data: _TygojaDict): void
+ /**
+ * Client returns an http client using the provided token.
+ */
+ client(token: oauth2.Token): (any)
+ /**
+ * 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)
+ /**
+ * FetchRawUserInfo requests and marshalizes into `result` the
+ * the OAuth user api response.
+ */
+ fetchRawUserInfo(token: oauth2.Token): string|Array
+ /**
+ * FetchAuthUser is similar to FetchRawUserInfo, but normalizes and
+ * marshalizes the user api response into a standardized AuthUser struct.
+ */
+ fetchAuthUser(token: oauth2.Token): (AuthUser)
+ }
+ /**
+ * AuthUser defines a standardized OAuth2 user data structure.
+ */
+ interface AuthUser {
+ expiry: types.DateTime
+ rawUser: _TygojaDict
+ id: string
+ name: string
+ username: string
+ avatarURL: string
+ accessToken: string
+ refreshToken: string
+ /**
+ * The VERIFIED OAuth2 account email.
+ *
+ * It must be empty if the provider is not able to verify the email ownership.
+ */
+ email: string
+ /**
+ * @todo
+ * deprecated: use AvatarURL instead
+ * AvatarUrl will be removed after dropping v0.22 support
+ */
+ avatarUrl: string
+ }
+ interface AuthUser {
+ /**
+ * MarshalJSON implements the [json.Marshaler] interface.
+ *
+ * @todo remove after dropping v0.22 support
+ */
+ marshalJSON(): string|Array
+ }
+}
+
+/**
+ * Package cron implements a crontab-like service to execute and schedule
+ * repeative tasks/jobs.
+ *
+ * Example:
+ *
+ * ```
+ * c := cron.New()
+ * c.MustAdd("dailyReport", "0 0 * * *", func() { ... })
+ * c.Start()
+ * ```
+ */
+namespace cron {
+ /**
+ * Cron is a crontab-like struct for tasks/jobs scheduling.
+ */
+ interface Cron {
+ }
+ interface Cron {
+ /**
+ * SetInterval changes the current cron tick interval
+ * (it usually should be >= 1 minute).
+ */
+ setInterval(d: time.Duration): void
+ }
+ interface Cron {
+ /**
+ * SetTimezone changes the current cron tick timezone.
+ */
+ setTimezone(l: time.Location): void
+ }
+ interface Cron {
+ /**
+ * MustAdd is similar to Add() but panic on failure.
+ */
+ mustAdd(jobId: string, cronExpr: string, run: () => void): void
+ }
+ interface Cron {
+ /**
+ * Add registers a single cron job.
+ *
+ * If there is already a job with the provided id, then the old job
+ * will be replaced with the new one.
+ *
+ * cronExpr is a regular cron expression, eg. "0 *\/3 * * *" (aka. at minute 0 past every 3rd hour).
+ * Check cron.NewSchedule() for the supported tokens.
+ */
+ add(jobId: string, cronExpr: string, fn: () => void): void
+ }
+ interface Cron {
+ /**
+ * Remove removes a single cron job by its id.
+ */
+ remove(jobId: string): void
+ }
+ interface Cron {
+ /**
+ * RemoveAll removes all registered cron jobs.
+ */
+ removeAll(): void
+ }
+ interface Cron {
+ /**
+ * Total returns the current total number of registered cron jobs.
+ */
+ total(): number
+ }
+ interface Cron {
+ /**
+ * Jobs returns a shallow copy of the currently registered cron jobs.
+ */
+ jobs(): Array<(Job | undefined)>
+ }
+ interface Cron {
+ /**
+ * Stop stops the current cron ticker (if not already).
+ *
+ * You can resume the ticker by calling Start().
+ */
+ stop(): void
+ }
+ interface Cron {
+ /**
+ * Start starts the cron ticker.
+ *
+ * Calling Start() on already started cron will restart the ticker.
+ */
+ start(): void
+ }
+ interface Cron {
+ /**
+ * HasStarted checks whether the current Cron ticker has been started.
+ */
+ hasStarted(): boolean
}
}
@@ -18947,815 +18711,145 @@ namespace store {
}
}
-/**
- * Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
- *
- * See README.md for more info.
- */
-namespace jwt {
+namespace subscriptions {
/**
- * MapClaims is a claims type that uses the map[string]any for JSON
- * decoding. This is the default claims type if you don't supply one
+ * Broker defines a struct for managing subscriptions clients.
*/
- interface MapClaims extends _TygojaDict{}
- interface MapClaims {
- /**
- * GetExpirationTime implements the Claims interface.
- */
- getExpirationTime(): (NumericDate)
+ interface Broker {
}
- interface MapClaims {
+ interface Broker {
/**
- * GetNotBefore implements the Claims interface.
+ * Clients returns a shallow copy of all registered clients indexed
+ * with their connection id.
*/
- getNotBefore(): (NumericDate)
+ clients(): _TygojaDict
}
- interface MapClaims {
+ interface Broker {
/**
- * GetIssuedAt implements the Claims interface.
+ * ChunkedClients splits the current clients into a chunked slice.
*/
- getIssuedAt(): (NumericDate)
+ chunkedClients(chunkSize: number): Array>
}
- interface MapClaims {
+ interface Broker {
/**
- * GetAudience implements the Claims interface.
+ * TotalClients returns the total number of registered clients.
*/
- getAudience(): ClaimStrings
+ totalClients(): number
}
- interface MapClaims {
+ interface Broker {
/**
- * GetIssuer implements the Claims interface.
+ * ClientById finds a registered client by its id.
+ *
+ * Returns non-nil error when client with clientId is not registered.
*/
- getIssuer(): string
+ clientById(clientId: string): Client
}
- interface MapClaims {
+ interface Broker {
/**
- * GetSubject implements the Claims interface.
+ * Register adds a new client to the broker instance.
*/
- getSubject(): string
+ register(client: Client): void
}
-}
-
-namespace hook {
- /**
- * Event implements [Resolver] and it is intended to be used as a base
- * Hook event that you can embed in your custom typed event structs.
- *
- * Example:
- *
- * ```
- * type CustomEvent struct {
- * hook.Event
- *
- * SomeField int
- * }
- * ```
- */
- interface Event {
- }
- interface Event {
+ interface Broker {
/**
- * Next calls the next hook handler.
+ * Unregister removes a single client by its id and marks it as discarded.
+ *
+ * If client with clientId doesn't exist, this method does nothing.
*/
- next(): void
+ unregister(clientId: string): void
}
/**
- * Handler defines a single Hook handler.
- * Multiple handlers can share the same id.
- * If Id is not explicitly set it will be autogenerated by Hook.Add and Hook.AddHandler.
+ * Client is an interface for a generic subscription client.
*/
- interface Handler {
+ interface Client {
+ [key:string]: any;
/**
- * Func defines the handler function to execute.
+ * Id Returns the unique id of the client.
+ */
+ id(): string
+ /**
+ * Channel returns the client's communication channel.
*
- * Note that users need to call e.Next() in order to proceed with
- * the execution of the hook chain.
+ * NB! The channel shouldn't be used after calling Discard().
*/
- func: (_arg0: T) => void
+ channel(): undefined
/**
- * Id is the unique identifier of the handler.
+ * Subscriptions returns a shallow copy of the client subscriptions matching the prefixes.
+ * If no prefix is specified, returns all subscriptions.
+ */
+ subscriptions(...prefixes: string[]): _TygojaDict
+ /**
+ * Subscribe subscribes the client to the provided subscriptions list.
*
- * It could be used later to remove the handler from a hook via [Hook.Remove].
+ * Each subscription can also have "options" (json serialized SubscriptionOptions) as query parameter.
*
- * If missing, an autogenerated value will be assigned when adding
- * the handler to a hook.
- */
- id: string
- /**
- * Priority allows changing the default exec priority of the handler within a hook.
+ * Example:
*
- * If 0, the handler will be executed in the same order it was registered.
+ * ```
+ * Subscribe(
+ * "subscriptionA",
+ * `subscriptionB?options={"query":{"a":1},"headers":{"x_token":"abc"}}`,
+ * )
+ * ```
*/
- priority: number
- }
- /**
- * Hook defines a generic concurrent safe structure for managing event hooks.
- *
- * When using custom event it must embed the base [hook.Event].
- *
- * Example:
- *
- * ```
- * type CustomEvent struct {
- * hook.Event
- * SomeField int
- * }
- *
- * h := Hook[*CustomEvent]{}
- *
- * h.BindFunc(func(e *CustomEvent) error {
- * println(e.SomeField)
- *
- * return e.Next()
- * })
- *
- * h.Trigger(&CustomEvent{ SomeField: 123 })
- * ```
- */
- interface Hook {
- }
- interface Hook {
+ subscribe(...subs: string[]): void
/**
- * Bind registers the provided handler to the current hooks queue.
- *
- * If handler.Id is empty it is updated with autogenerated value.
- *
- * If a handler from the current hook list has Id matching handler.Id
- * then the old handler is replaced with the new one.
+ * Unsubscribe unsubscribes the client from the provided subscriptions list.
*/
- bind(handler: Handler): string
- }
- interface Hook {
+ unsubscribe(...subs: string[]): void
/**
- * BindFunc is similar to Bind but registers a new handler from just the provided function.
- *
- * The registered handler is added with a default 0 priority and the id will be autogenerated.
- *
- * If you want to register a handler with custom priority or id use the [Hook.Bind] method.
+ * HasSubscription checks if the client is subscribed to `sub`.
*/
- bindFunc(fn: (e: T) => void): string
- }
- interface Hook {
+ hasSubscription(sub: string): boolean
/**
- * Unbind removes one or many hook handler by their id.
- */
- unbind(...idsToRemove: string[]): void
- }
- interface Hook {
- /**
- * UnbindAll removes all registered handlers.
- */
- unbindAll(): void
- }
- interface Hook {
- /**
- * Length returns to total number of registered hook handlers.
- */
- length(): number
- }
- interface Hook {
- /**
- * Trigger executes all registered hook handlers one by one
- * with the specified event as an argument.
- *
- * Optionally, this method allows also to register additional one off
- * handler funcs that will be temporary appended to the handlers queue.
- *
- * NB! Each hook handler must call event.Next() in order the hook chain to proceed.
- */
- trigger(event: T, ...oneOffHandlerFuncs: ((_arg0: T) => void)[]): void
- }
- /**
- * 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 _sCZUkwD = mainHook
- interface TaggedHook extends _sCZUkwD {
- }
- interface TaggedHook {
- /**
- * CanTriggerOn checks if the current TaggedHook can be triggered with
- * the provided event data tags.
- *
- * It returns always true if the hook doesn't have any tags.
- */
- canTriggerOn(tagsToCheck: Array): boolean
- }
- interface TaggedHook {
- /**
- * Bind registers the provided handler to the current hooks queue.
- *
- * It is similar to [Hook.Bind] with the difference that the handler
- * function is invoked only if the event data tags satisfy h.CanTriggerOn.
- */
- bind(handler: Handler): string
- }
- interface TaggedHook {
- /**
- * BindFunc registers a new handler with the specified function.
- *
- * It is similar to [Hook.Bind] with the difference that the handler
- * function is invoked only if the event data tags satisfy h.CanTriggerOn.
- */
- bindFunc(fn: (e: T) => void): string
- }
-}
-
-/**
- * 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 {
- /**
- * Add returns a new DateTime based on the current DateTime + the specified duration.
- */
- add(duration: time.Duration): DateTime
- }
- interface DateTime {
- /**
- * Sub returns a [time.Duration] by subtracting the specified DateTime from the current one.
- *
- * If the result exceeds the maximum (or minimum) value that can be stored in a [time.Duration],
- * the maximum (or minimum) duration will be returned.
- */
- sub(u: DateTime): time.Duration
- }
- interface DateTime {
- /**
- * AddDate returns a new DateTime based on the current one + duration.
- *
- * It follows the same rules as [time.AddDate].
- */
- addDate(years: number, months: number, days: number): DateTime
- }
- interface DateTime {
- /**
- * After reports whether the current DateTime instance is after u.
- */
- after(u: DateTime): boolean
- }
- interface DateTime {
- /**
- * Before reports whether the current DateTime instance is before u.
- */
- before(u: DateTime): boolean
- }
- interface DateTime {
- /**
- * Compare compares the current DateTime instance with u.
- * If the current instance is before u, it returns -1.
- * If the current instance is after u, it returns +1.
- * If they're the same, it returns 0.
- */
- compare(u: DateTime): number
- }
- interface DateTime {
- /**
- * Equal reports whether the current DateTime and u represent the same time instant.
- * Two DateTime can be equal even if they are in different locations.
- * For example, 6:00 +0200 and 4:00 UTC are Equal.
- */
- equal(u: DateTime): boolean
- }
- interface DateTime {
- /**
- * Unix returns the current DateTime as a Unix time, aka.
- * the number of seconds elapsed since January 1, 1970 UTC.
- */
- unix(): number
- }
- 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|Array
- }
- interface DateTime {
- /**
- * UnmarshalJSON implements the [json.Unmarshaler] interface.
- */
- unmarshalJSON(b: string|Array): void
- }
- interface DateTime {
- /**
- * Value implements the [driver.Valuer] interface.
- */
- value(): any
- }
- interface DateTime {
- /**
- * Scan implements [sql.Scanner] interface to scan the provided value
- * into the current DateTime instance.
- */
- scan(value: any): void
- }
- /**
- * GeoPoint defines a struct for storing geo coordinates as serialized json object
- * (e.g. {lon:0,lat:0}).
- *
- * Note: using object notation and not a plain array to avoid the confusion
- * as there doesn't seem to be a fixed standard for the coordinates order.
- */
- interface GeoPoint {
- lon: number
- lat: number
- }
- interface GeoPoint {
- /**
- * String returns the string representation of the current GeoPoint instance.
- */
- string(): string
- }
- interface GeoPoint {
- /**
- * AsMap implements [core.mapExtractor] and returns a value suitable
- * to be used in an API rule expression.
- */
- asMap(): _TygojaDict
- }
- interface GeoPoint {
- /**
- * Value implements the [driver.Valuer] interface.
- */
- value(): any
- }
- interface GeoPoint {
- /**
- * Scan implements [sql.Scanner] interface to scan the provided value
- * into the current GeoPoint instance.
- *
- * The value argument could be nil (no-op), another GeoPoint instance,
- * map or serialized json object with lat-lon props.
- */
- scan(value: any): void
- }
- /**
- * JSONArray defines a slice that is safe for json and db read/write.
- */
- interface JSONArray extends Array{}
- interface JSONArray {
- /**
- * MarshalJSON implements the [json.Marshaler] interface.
- */
- marshalJSON(): string|Array
- }
- interface JSONArray {
- /**
- * String returns the string representation of the current json array.
- */
- string(): string
- }
- interface JSONArray {
- /**
- * Value implements the [driver.Valuer] interface.
- */
- value(): any
- }
- interface JSONArray {
- /**
- * Scan implements [sql.Scanner] interface to scan the provided value
- * into the current JSONArray[T] instance.
- */
- scan(value: any): void
- }
- /**
- * JSONMap defines a map that is safe for json and db read/write.
- */
- interface JSONMap extends _TygojaDict{}
- interface JSONMap {
- /**
- * MarshalJSON implements the [json.Marshaler] interface.
- */
- marshalJSON(): string|Array
- }
- interface JSONMap {
- /**
- * String returns the string representation of the current json map.
- */
- string(): string
- }
- interface JSONMap {
- /**
- * Get retrieves a single value from the current JSONMap[T].
- *
- * This helper was added primarily to assist the goja integration since custom map types
- * don't have direct access to the map keys (https://pkg.go.dev/github.com/dop251/goja#hdr-Maps_with_methods).
- */
- get(key: string): T
- }
- interface JSONMap {
- /**
- * Set sets a single value in the current JSONMap[T].
- *
- * This helper was added primarily to assist the goja integration since custom map types
- * don't have direct access to the map keys (https://pkg.go.dev/github.com/dop251/goja#hdr-Maps_with_methods).
- */
- set(key: string, value: T): void
- }
- interface JSONMap {
- /**
- * Value implements the [driver.Valuer] interface.
- */
- value(): any
- }
- interface JSONMap {
- /**
- * Scan implements [sql.Scanner] interface to scan the provided value
- * into the current JSONMap[T] instance.
- */
- scan(value: any): void
- }
- /**
- * JSONRaw defines a json value type that is safe for db read/write.
- */
- interface JSONRaw extends Array{}
- interface JSONRaw {
- /**
- * String returns the current JSONRaw instance as a json encoded string.
- */
- string(): string
- }
- interface JSONRaw {
- /**
- * MarshalJSON implements the [json.Marshaler] interface.
- */
- marshalJSON(): string|Array
- }
- interface JSONRaw {
- /**
- * UnmarshalJSON implements the [json.Unmarshaler] interface.
- */
- unmarshalJSON(b: string|Array): void
- }
- interface JSONRaw {
- /**
- * Value implements the [driver.Valuer] interface.
- */
- value(): any
- }
- interface JSONRaw {
- /**
- * Scan implements [sql.Scanner] interface to scan the provided value
- * into the current JSONRaw instance.
- */
- scan(value: any): void
- }
-}
-
-namespace search {
- /**
- * Result defines the returned search result structure.
- */
- interface Result {
- items: any
- page: number
- perPage: number
- totalItems: number
- totalPages: number
- }
- /**
- * ResolverResult defines a single FieldResolver.Resolve() successfully parsed result.
- */
- interface ResolverResult {
- /**
- * Identifier is the plain SQL identifier/column that will be used
- * in the final db expression as left or right operand.
- */
- identifier: string
- /**
- * NullFallback specify the preference for how NULL or empty values
- * should be resolved (default to "auto").
- *
- * Set to NullFallbackDisabled to prevent any COALESCE or NULL fallbacks.
- * Set to NullFallbackEnforced to prefer COALESCE or NULL fallbacks when needed.
- */
- nullFallback: NullFallbackPreference
- /**
- * Params is a map with db placeholder->value pairs that will be added
- * to the query when building both resolved operands/sides in a single expression.
- */
- params: dbx.Params
- /**
- * MultiMatchSubQuery is an optional sub query expression that will be added
- * in addition to the combined ResolverResult expression during build.
- */
- multiMatchSubQuery?: MultiMatchSubquery
- /**
- * AfterBuild is an optional function that will be called after building
- * and combining the result of both resolved operands/sides in a single expression.
- */
- afterBuild: (expr: dbx.Expression) => dbx.Expression
- }
-}
-
-namespace router {
- // @ts-ignore
- import validation = ozzo_validation
- /**
- * ApiError defines the struct for a basic api error response.
- */
- interface ApiError {
- data: _TygojaDict
- message: string
- status: number
- }
- interface ApiError {
- /**
- * Error makes it compatible with the `error` interface.
- */
- error(): string
- }
- interface ApiError {
- /**
- * RawData returns the unformatted error data (could be an internal error, text, etc.)
- */
- rawData(): any
- }
- interface ApiError {
- /**
- * Is reports whether the current ApiError wraps the target.
- */
- is(target: Error): boolean
- }
- /**
- * Event specifies based Route handler event that is usually intended
- * to be embedded as part of a custom event struct.
- *
- * NB! It is expected that the Response and Request fields are always set.
- */
- type _sZGLYtd = hook.Event
- interface Event extends _sZGLYtd {
- response: http.ResponseWriter
- request?: http.Request
- }
- interface Event {
- /**
- * Written reports whether the current response has already been written.
- *
- * This method always returns false if e.ResponseWritter doesn't implement the WriteTracker interface
- * (all router package handlers receives a ResponseWritter that implements it unless explicitly replaced with a custom one).
- */
- written(): boolean
- }
- interface Event {
- /**
- * Status reports the status code of the current response.
- *
- * This method always returns 0 if e.Response doesn't implement the StatusTracker interface
- * (all router package handlers receives a ResponseWritter that implements it unless explicitly replaced with a custom one).
- */
- status(): number
- }
- interface Event {
- /**
- * Flush flushes buffered data to the current response.
- *
- * Returns [http.ErrNotSupported] if e.Response doesn't implement the [http.Flusher] interface
- * (all router package handlers receives a ResponseWritter that implements it unless explicitly replaced with a custom one).
- */
- flush(): void
- }
- interface Event {
- /**
- * IsTLS reports whether the connection on which the request was received is TLS.
- */
- isTLS(): boolean
- }
- interface Event {
- /**
- * SetCookie is an alias for [http.SetCookie].
- *
- * SetCookie adds a Set-Cookie header to the current response's headers.
- * The provided cookie must have a valid Name.
- * Invalid cookies may be silently dropped.
- */
- setCookie(cookie: http.Cookie): void
- }
- interface Event {
- /**
- * RemoteIP returns the IP address of the client that sent the request.
- *
- * IPv6 addresses are returned expanded.
- * For example, "2001:db8::1" becomes "2001:0db8:0000:0000:0000:0000:0000:0001".
- *
- * Note that if you are behind reverse proxy(ies), this method returns
- * the IP of the last connecting proxy.
- */
- remoteIP(): string
- }
- interface Event {
- /**
- * FindUploadedFiles extracts all form files of "key" from a http request
- * and returns a slice with filesystem.File instances (if any).
- */
- findUploadedFiles(key: string): Array<(filesystem.File | undefined)>
- }
- interface Event {
- /**
- * Get retrieves single value from the current event data store.
- */
- get(key: string): any
- }
- interface Event {
- /**
- * GetAll returns a copy of the current event data store.
- */
- getAll(): _TygojaDict
- }
- interface Event {
- /**
- * Set saves single value into the current event data store.
+ * Set stores any value to the client's context.
*/
set(key: string, value: any): void
- }
- interface Event {
/**
- * SetAll saves all items from m into the current event data store.
+ * Unset removes a single value from the client's context.
*/
- setAll(m: _TygojaDict): void
- }
- interface Event {
+ unset(key: string): void
/**
- * String writes a plain string response.
+ * Get retrieves the key value from the client's context.
*/
- string(status: number, data: string): void
- }
- interface Event {
+ get(key: string): any
/**
- * HTML writes an HTML response.
- */
- html(status: number, data: string): void
- }
- interface Event {
- /**
- * JSON writes a JSON response.
+ * Discard marks the client as "discarded" (and closes its channel),
+ * meaning that it shouldn't be used anymore for sending new messages.
*
- * It also provides a generic response data fields picker if the "fields" query parameter is set.
- * For example, if you are requesting `?fields=a,b` for `e.JSON(200, map[string]int{ "a":1, "b":2, "c":3 })`,
- * it should result in a JSON response like: `{"a":1, "b": 2}`.
+ * It is safe to call Discard() multiple times.
*/
- json(status: number, data: any): void
- }
- interface Event {
+ discard(): void
/**
- * XML writes an XML response.
- * It automatically prepends the generic [xml.Header] string to the response.
+ * IsDiscarded indicates whether the client has been "discarded"
+ * and should no longer be used.
*/
- xml(status: number, data: any): void
- }
- interface Event {
+ isDiscarded(): boolean
/**
- * Stream streams the specified reader into the response.
+ * Send sends the specified message to the client's channel (if not discarded).
*/
- stream(status: number, contentType: string, reader: io.Reader): void
- }
- interface Event {
- /**
- * Blob writes a blob (bytes slice) response.
- */
- blob(status: number, contentType: string, b: string|Array): void
- }
- interface Event {
- /**
- * FileFS serves the specified filename from fsys.
- *
- * It is similar to [echo.FileFS] for consistency with earlier versions.
- */
- fileFS(fsys: fs.FS, filename: string): void
- }
- interface Event {
- /**
- * NoContent writes a response with no body (ex. 204).
- */
- noContent(status: number): void
- }
- interface Event {
- /**
- * Redirect writes a redirect response to the specified url.
- * The status code must be in between 300 – 399 range.
- */
- redirect(status: number, url: string): void
- }
- interface Event {
- error(status: number, message: string, errData: any): (ApiError)
- }
- interface Event {
- badRequestError(message: string, errData: any): (ApiError)
- }
- interface Event {
- notFoundError(message: string, errData: any): (ApiError)
- }
- interface Event {
- forbiddenError(message: string, errData: any): (ApiError)
- }
- interface Event {
- unauthorizedError(message: string, errData: any): (ApiError)
- }
- interface Event {
- tooManyRequestsError(message: string, errData: any): (ApiError)
- }
- interface Event {
- internalServerError(message: string, errData: any): (ApiError)
- }
- interface Event {
- /**
- * BindBody unmarshal the request body into the provided dst.
- *
- * dst must be either a struct pointer or map[string]any.
- *
- * The rules how the body will be scanned depends on the request Content-Type.
- *
- * Currently the following Content-Types are supported:
- * ```
- * - application/json
- * - text/xml, application/xml
- * - multipart/form-data, application/x-www-form-urlencoded
- * ```
- *
- * Respectively the following struct tags are supported (again, which one will be used depends on the Content-Type):
- * ```
- * - "json" (json body)- uses the builtin Go json package for unmarshaling.
- * - "xml" (xml body) - uses the builtin Go xml package for unmarshaling.
- * - "form" (form data) - utilizes the custom [router.UnmarshalRequestData] method.
- * ```
- *
- * NB! When dst is a struct make sure that it doesn't have public fields
- * that shouldn't be bindable and it is advisible such fields to be unexported
- * or have a separate struct just for the binding. For example:
- *
- * ```
- * data := struct{
- * somethingPrivate string
- *
- * Title string `json:"title" form:"title"`
- * Total int `json:"total" form:"total"`
- * }{}
- * err := e.BindBody(&data)
- * ```
- */
- bindBody(dst: any): void
+ send(m: Message): void
}
/**
- * Router defines a thin wrapper around the standard Go [http.ServeMux] by
- * adding support for routing sub-groups, middlewares and other common utils.
- *
- * Example:
- *
- * ```
- * r := NewRouter[*MyEvent](eventFactory)
- *
- * // middlewares
- * r.BindFunc(m1, m2)
- *
- * // routes
- * r.GET("/test", handler1)
- *
- * // sub-routers/groups
- * api := r.Group("/api")
- * api.GET("/admins", handler2)
- *
- * // generate a http.ServeMux instance based on the router configurations
- * mux, _ := r.BuildMux()
- *
- * http.ListenAndServe("localhost:8090", mux)
- * ```
+ * Message defines a client's channel data.
*/
- type _sTIrqJi = RouterGroup
- interface Router extends _sTIrqJi {
+ interface Message {
+ name: string
+ data: string|Array
}
- interface Router {
+ interface Message {
/**
- * BuildMux constructs a new mux [http.Handler] instance from the current router configurations.
+ * WriteSSE writes the current message in a SSE format into the provided writer.
+ *
+ * For example, writing to a router.Event:
+ *
+ * ```
+ * m := Message{Name: "users/create", Data: []byte{...}}
+ * m.WriteSSE(e.Response, "yourEventId")
+ * e.Flush()
+ * ```
*/
- buildMux(): http.Handler
+ writeSSE(w: io.Writer, eventId: string): void
}
}
@@ -20250,269 +19344,837 @@ namespace slog {
}
/**
- * Package cron implements a crontab-like service to execute and schedule
- * repeative tasks/jobs.
+ * Package sql provides a generic interface around SQL (or SQL-like)
+ * databases.
*
- * Example:
+ * The sql package must be used in conjunction with a database driver.
+ * See https://golang.org/s/sqldrivers for a list of drivers.
*
- * ```
- * c := cron.New()
- * c.MustAdd("dailyReport", "0 0 * * *", func() { ... })
- * c.Start()
- * ```
+ * 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 cron {
+namespace sql {
/**
- * Cron is a crontab-like struct for tasks/jobs scheduling.
+ * TxOptions holds the transaction options to be used in [DB.BeginTx].
*/
- interface Cron {
- }
- interface Cron {
+ interface TxOptions {
/**
- * SetInterval changes the current cron tick interval
- * (it usually should be >= 1 minute).
+ * Isolation is the transaction isolation level.
+ * If zero, the driver or database's default level is used.
*/
- setInterval(d: time.Duration): void
+ isolation: IsolationLevel
+ readOnly: boolean
}
- interface Cron {
+ /**
+ * NullString represents a string that may be null.
+ * NullString implements the [Scanner] interface so
+ * it can be used as a scan destination:
+ *
+ * ```
+ * var s NullString
+ * err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s)
+ * ...
+ * if s.Valid {
+ * // use s.String
+ * } else {
+ * // NULL value
+ * }
+ * ```
+ */
+ interface NullString {
+ string: string
+ valid: boolean // Valid is true if String is not NULL
+ }
+ interface NullString {
/**
- * SetTimezone changes the current cron tick timezone.
+ * Scan implements the [Scanner] interface.
*/
- setTimezone(l: time.Location): void
+ scan(value: any): void
}
- interface Cron {
+ interface NullString {
/**
- * MustAdd is similar to Add() but panic on failure.
+ * Value implements the [driver.Valuer] interface.
*/
- mustAdd(jobId: string, cronExpr: string, run: () => void): void
+ value(): any
}
- interface Cron {
+ /**
+ * 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 [Tx.Commit] or
+ * [Tx.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 [DB.SetMaxIdleConns].
+ */
+ interface DB {
+ }
+ interface DB {
/**
- * Add registers a single cron job.
+ * 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.
*
- * If there is already a job with the provided id, then the old job
- * will be replaced with the new one.
+ * Ping uses [context.Background] internally; to specify the context, use
+ * [DB.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.
*
- * cronExpr is a regular cron expression, eg. "0 *\/3 * * *" (aka. at minute 0 past every 3rd hour).
- * Check cron.NewSchedule() for the supported tokens.
+ * It is rare to Close a [DB], as the [DB] handle is meant to be
+ * long-lived and shared between many goroutines.
*/
- add(jobId: string, cronExpr: string, fn: () => void): void
+ close(): void
}
- interface Cron {
+ interface DB {
/**
- * Remove removes a single cron job by its id.
- */
- remove(jobId: string): void
- }
- interface Cron {
- /**
- * RemoveAll removes all registered cron jobs.
- */
- removeAll(): void
- }
- interface Cron {
- /**
- * Total returns the current total number of registered cron jobs.
- */
- total(): number
- }
- interface Cron {
- /**
- * Jobs returns a shallow copy of the currently registered cron jobs.
- */
- jobs(): Array<(Job | undefined)>
- }
- interface Cron {
- /**
- * Stop stops the current cron ticker (if not already).
+ * SetMaxIdleConns sets the maximum number of connections in the idle
+ * connection pool.
*
- * You can resume the ticker by calling Start().
- */
- stop(): void
- }
- interface Cron {
- /**
- * Start starts the cron ticker.
+ * If MaxOpenConns is greater than 0 but less than the new MaxIdleConns,
+ * then the new MaxIdleConns will be reduced to match the MaxOpenConns limit.
*
- * Calling Start() on already started cron will restart the ticker.
+ * If n <= 0, no idle connections are retained.
+ *
+ * The default max idle connections is currently 2. This may change in
+ * a future release.
*/
- start(): void
+ setMaxIdleConns(n: number): void
}
- interface Cron {
+ interface DB {
/**
- * HasStarted checks whether the current Cron ticker has been started.
+ * 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).
*/
- hasStarted(): boolean
+ 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 [*Stmt.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)
+ }
+ 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 [*Stmt.Close] method
+ * when the statement is no longer needed.
+ *
+ * Prepare uses [context.Background] internally; to specify the context, use
+ * [DB.PrepareContext].
+ */
+ prepare(query: string): (Stmt)
+ }
+ 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
+ * [DB.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)
+ }
+ 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
+ * [DB.QueryContext].
+ */
+ query(query: string, ...args: any[]): (Rows)
+ }
+ 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.Scan] will return [ErrNoRows].
+ * Otherwise, [*Row.Scan] scans the first selected row and discards
+ * the rest.
+ */
+ queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row)
+ }
+ 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.Scan] will return [ErrNoRows].
+ * Otherwise, [*Row.Scan] scans the first selected row and discards
+ * the rest.
+ *
+ * QueryRow uses [context.Background] internally; to specify the context, use
+ * [DB.QueryRowContext].
+ */
+ queryRow(query: string, ...args: any[]): (Row)
+ }
+ 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)
+ }
+ 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
+ * [DB.BeginTx].
+ */
+ begin(): (Tx)
+ }
+ interface DB {
+ /**
+ * Driver returns the database's underlying driver.
+ */
+ driver(): any
+ }
+ 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)
+ }
+ /**
+ * Tx is an in-progress database transaction.
+ *
+ * A transaction must end with a call to [Tx.Commit] or [Tx.Rollback].
+ *
+ * After a call to [Tx.Commit] or [Tx.Rollback], all operations on the
+ * transaction fail with [ErrTxDone].
+ *
+ * The statements prepared for a transaction by calling
+ * the transaction's [Tx.Prepare] or [Tx.Stmt] methods are closed
+ * by the call to [Tx.Commit] or [Tx.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)
+ }
+ 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
+ * [Tx.PrepareContext].
+ */
+ prepare(query: string): (Stmt)
+ }
+ 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)
+ }
+ 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
+ * [Tx.StmtContext].
+ */
+ stmt(stmt: Stmt): (Stmt)
+ }
+ 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
+ * [Tx.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)
+ }
+ interface Tx {
+ /**
+ * Query executes a query that returns rows, typically a SELECT.
+ *
+ * Query uses [context.Background] internally; to specify the context, use
+ * [Tx.QueryContext].
+ */
+ query(query: string, ...args: any[]): (Rows)
+ }
+ 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.Scan] will return [ErrNoRows].
+ * Otherwise, the [*Row.Scan] scans the first selected row and discards
+ * the rest.
+ */
+ queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row)
+ }
+ 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.Scan] will return [ErrNoRows].
+ * Otherwise, the [*Row.Scan] scans the first selected row and discards
+ * the rest.
+ *
+ * QueryRow uses [context.Background] internally; to specify the context, use
+ * [Tx.QueryRowContext].
+ */
+ queryRow(query: string, ...args: any[]): (Row)
+ }
+ /**
+ * 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
+ * [Stmt.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)
+ }
+ 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
+ * [Stmt.QueryContext].
+ */
+ query(...args: any[]): (Rows)
+ }
+ 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.Scan] will return [ErrNoRows].
+ * Otherwise, the [*Row.Scan] scans the first selected row and discards
+ * the rest.
+ */
+ queryRowContext(ctx: context.Context, ...args: any[]): (Row)
+ }
+ 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.Scan] will return [ErrNoRows].
+ * Otherwise, the [*Row.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
+ * [Stmt.QueryRowContext].
+ */
+ queryRow(...args: any[]): (Row)
+ }
+ 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 [Rows.Next] to advance from row to row.
+ */
+ interface Rows {
+ }
+ interface Rows {
+ /**
+ * Next prepares the next result row for reading with the [Rows.Scan] method. It
+ * returns true on success, or false if there is no next result row or an error
+ * happened while preparing it. [Rows.Err] should be consulted to distinguish between
+ * the two cases.
+ *
+ * Every call to [Rows.Scan], even the first one, must be preceded by a call to [Rows.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 [Rows.Err] method should be consulted
+ * to distinguish between the two cases.
+ *
+ * After calling NextResultSet, the [Rows.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 [Rows.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 [Rows.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 [Rows.Err]. Close is idempotent and does not affect the result of [Rows.Err].
+ */
+ close(): void
+ }
+ /**
+ * A Result summarizes an executed SQL command.
+ */
+ interface Result {
+ [key:string]: 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.
+ */
+ 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
}
}
-namespace auth {
+/**
+ * Package blob defines a lightweight abstration for interacting with
+ * various storage services (local filesystem, S3, etc.).
+ *
+ * NB!
+ * For compatibility with earlier PocketBase versions and to prevent
+ * unnecessary breaking changes, this package is based and implemented
+ * as a minimal, stripped down version of the previously used gocloud.dev/blob.
+ * While there is no promise that it won't diverge in the future to accommodate
+ * better some PocketBase specific use cases, currently it copies and
+ * tries to follow as close as possible the same implementations,
+ * conventions and rules for the key escaping/unescaping, blob read/write
+ * interfaces and struct options as gocloud.dev/blob, therefore the
+ * credits goes to the original Go Cloud Development Kit Authors.
+ */
+namespace blob {
/**
- * @todo refactor and consider replace with a plain struct
- *
- * Provider defines a common interface for an OAuth2 client.
+ * ListObject represents a single blob returned from List.
*/
- interface Provider {
- [key:string]: any;
+ interface ListObject {
/**
- * @todo temp backport
- *
- * Order returns the sorting order of the provider usually used in the auth methods list response.
+ * Key is the key for this blob.
*/
- logo(): string
+ key: string
/**
- * @todo temp backport
- *
- * Order returns the sorting order of the provider usually used in the auth methods list response.
+ * ModTime is the time the blob was last modified.
*/
- order(): number
+ modTime: time.Time
/**
- * Context returns the context associated with the provider (if any).
+ * Size is the size of the blob's content in bytes.
*/
- context(): context.Context
+ size: number
/**
- * SetContext assigns the specified context to the current provider.
+ * MD5 is an MD5 hash of the blob contents or nil if not available.
*/
- setContext(ctx: context.Context): void
+ md5: string|Array
/**
- * PKCE indicates whether the provider can use the PKCE flow.
+ * IsDir indicates that this result represents a "directory" in the
+ * hierarchical namespace, ending in ListOptions.Delimiter. Key can be
+ * passed as ListOptions.Prefix to list items in the "directory".
+ * Fields other than Key and IsDir will not be set if IsDir is true.
*/
- pkce(): boolean
- /**
- * SetPKCE toggles the state whether the provider can use the PKCE flow or not.
- */
- setPKCE(enable: boolean): void
- /**
- * DisplayName usually returns provider name as it is officially written
- * and it could be used directly in the UI.
- */
- displayName(): string
- /**
- * SetDisplayName sets the provider's display name.
- */
- setDisplayName(displayName: string): 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
- /**
- * UserInfoURL returns the provider's user info api url.
- */
- userInfoURL(): string
- /**
- * SetUserInfoURL sets the provider's UserInfoURL.
- */
- setUserInfoURL(url: string): void
- /**
- * Extra returns a shallow copy of any custom config data
- * that the provider may need.
- */
- extra(): _TygojaDict
- /**
- * SetExtra updates the provider's custom config data.
- */
- setExtra(data: _TygojaDict): void
- /**
- * Client returns an http client using the provided token.
- */
- client(token: oauth2.Token): (any)
- /**
- * 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)
- /**
- * FetchRawUserInfo requests and marshalizes into `result` the
- * the OAuth user api response.
- */
- fetchRawUserInfo(token: oauth2.Token): string|Array
- /**
- * FetchAuthUser is similar to FetchRawUserInfo, but normalizes and
- * marshalizes the user api response into a standardized AuthUser struct.
- */
- fetchAuthUser(token: oauth2.Token): (AuthUser)
+ isDir: boolean
}
/**
- * AuthUser defines a standardized OAuth2 user data structure.
+ * Attributes contains attributes about a blob.
*/
- interface AuthUser {
- expiry: types.DateTime
- rawUser: _TygojaDict
- id: string
- name: string
- username: string
- avatarURL: string
- accessToken: string
- refreshToken: string
+ interface Attributes {
/**
- * The VERIFIED OAuth2 account email.
- *
- * It must be empty if the provider is not able to verify the email ownership.
+ * CacheControl specifies caching attributes that services may use
+ * when serving the blob.
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
*/
- email: string
+ cacheControl: string
/**
- * @todo
- * deprecated: use AvatarURL instead
- * AvatarUrl will be removed after dropping v0.22 support
+ * ContentDisposition specifies whether the blob content is expected to be
+ * displayed inline or as an attachment.
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
*/
- avatarUrl: string
+ contentDisposition: string
+ /**
+ * ContentEncoding specifies the encoding used for the blob's content, if any.
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
+ */
+ contentEncoding: string
+ /**
+ * ContentLanguage specifies the language used in the blob's content, if any.
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language
+ */
+ contentLanguage: string
+ /**
+ * ContentType is the MIME type of the blob. It will not be empty.
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
+ */
+ contentType: string
+ /**
+ * Metadata holds key/value pairs associated with the blob.
+ * Keys are guaranteed to be in lowercase, even if the backend service
+ * has case-sensitive keys (although note that Metadata written via
+ * this package will always be lowercased). If there are duplicate
+ * case-insensitive keys (e.g., "foo" and "FOO"), only one value
+ * will be kept, and it is undefined which one.
+ */
+ metadata: _TygojaDict
+ /**
+ * CreateTime is the time the blob was created, if available. If not available,
+ * CreateTime will be the zero time.
+ */
+ createTime: time.Time
+ /**
+ * ModTime is the time the blob was last modified.
+ */
+ modTime: time.Time
+ /**
+ * Size is the size of the blob's content in bytes.
+ */
+ size: number
+ /**
+ * MD5 is an MD5 hash of the blob contents or nil if not available.
+ */
+ md5: string|Array
+ /**
+ * ETag for the blob; see https://en.wikipedia.org/wiki/HTTP_ETag.
+ */
+ eTag: string
}
- interface AuthUser {
+ /**
+ * Reader reads bytes from a blob.
+ * It implements io.ReadSeekCloser, and must be closed after reads are finished.
+ */
+ interface Reader {
+ }
+ interface Reader {
/**
- * MarshalJSON implements the [json.Marshaler] interface.
- *
- * @todo remove after dropping v0.22 support
+ * Read implements io.Reader (https://golang.org/pkg/io/#Reader).
*/
- marshalJSON(): string|Array
+ read(p: string|Array): number
+ }
+ interface Reader {
+ /**
+ * Seek implements io.Seeker (https://golang.org/pkg/io/#Seeker).
+ */
+ seek(offset: number, whence: number): number
+ }
+ interface Reader {
+ /**
+ * Close implements io.Closer (https://golang.org/pkg/io/#Closer).
+ */
+ close(): void
+ }
+ interface Reader {
+ /**
+ * ContentType returns the MIME type of the blob.
+ */
+ contentType(): string
+ }
+ interface Reader {
+ /**
+ * ModTime returns the time the blob was last modified.
+ */
+ modTime(): time.Time
+ }
+ interface Reader {
+ /**
+ * Size returns the size of the blob content in bytes.
+ */
+ size(): number
+ }
+ interface Reader {
+ /**
+ * WriteTo reads from r and writes to w until there's no more data or
+ * an error occurs.
+ * The return value is the number of bytes written to w.
+ *
+ * It implements the io.WriterTo interface.
+ */
+ writeTo(w: io.Writer): number
}
}
@@ -21598,6 +21260,171 @@ namespace cobra {
}
}
+namespace hook {
+ /**
+ * Event implements [Resolver] and it is intended to be used as a base
+ * Hook event that you can embed in your custom typed event structs.
+ *
+ * Example:
+ *
+ * ```
+ * type CustomEvent struct {
+ * hook.Event
+ *
+ * SomeField int
+ * }
+ * ```
+ */
+ interface Event {
+ }
+ interface Event {
+ /**
+ * Next calls the next hook handler.
+ */
+ next(): void
+ }
+ /**
+ * Handler defines a single Hook handler.
+ * Multiple handlers can share the same id.
+ * If Id is not explicitly set it will be autogenerated by Hook.Add and Hook.AddHandler.
+ */
+ interface Handler {
+ /**
+ * Func defines the handler function to execute.
+ *
+ * Note that users need to call e.Next() in order to proceed with
+ * the execution of the hook chain.
+ */
+ func: (_arg0: T) => void
+ /**
+ * Id is the unique identifier of the handler.
+ *
+ * It could be used later to remove the handler from a hook via [Hook.Remove].
+ *
+ * If missing, an autogenerated value will be assigned when adding
+ * the handler to a hook.
+ */
+ id: string
+ /**
+ * Priority allows changing the default exec priority of the handler within a hook.
+ *
+ * If 0, the handler will be executed in the same order it was registered.
+ */
+ priority: number
+ }
+ /**
+ * Hook defines a generic concurrent safe structure for managing event hooks.
+ *
+ * When using custom event it must embed the base [hook.Event].
+ *
+ * Example:
+ *
+ * ```
+ * type CustomEvent struct {
+ * hook.Event
+ * SomeField int
+ * }
+ *
+ * h := Hook[*CustomEvent]{}
+ *
+ * h.BindFunc(func(e *CustomEvent) error {
+ * println(e.SomeField)
+ *
+ * return e.Next()
+ * })
+ *
+ * h.Trigger(&CustomEvent{ SomeField: 123 })
+ * ```
+ */
+ interface Hook {
+ }
+ interface Hook {
+ /**
+ * Bind registers the provided handler to the current hooks queue.
+ *
+ * If handler.Id is empty it is updated with autogenerated value.
+ *
+ * If a handler from the current hook list has Id matching handler.Id
+ * then the old handler is replaced with the new one.
+ */
+ bind(handler: Handler): string
+ }
+ interface Hook {
+ /**
+ * BindFunc is similar to Bind but registers a new handler from just the provided function.
+ *
+ * The registered handler is added with a default 0 priority and the id will be autogenerated.
+ *
+ * If you want to register a handler with custom priority or id use the [Hook.Bind] method.
+ */
+ bindFunc(fn: (e: T) => void): string
+ }
+ interface Hook {
+ /**
+ * Unbind removes one or many hook handler by their id.
+ */
+ unbind(...idsToRemove: string[]): void
+ }
+ interface Hook {
+ /**
+ * UnbindAll removes all registered handlers.
+ */
+ unbindAll(): void
+ }
+ interface Hook {
+ /**
+ * Length returns to total number of registered hook handlers.
+ */
+ length(): number
+ }
+ interface Hook {
+ /**
+ * Trigger executes all registered hook handlers one by one
+ * with the specified event as an argument.
+ *
+ * Optionally, this method allows also to register additional one off
+ * handler funcs that will be temporary appended to the handlers queue.
+ *
+ * NB! Each hook handler must call event.Next() in order the hook chain to proceed.
+ */
+ trigger(event: T, ...oneOffHandlerFuncs: ((_arg0: T) => void)[]): void
+ }
+ /**
+ * 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 _sNUkeyD = mainHook
+ interface TaggedHook extends _sNUkeyD {
+ }
+ interface TaggedHook {
+ /**
+ * CanTriggerOn checks if the current TaggedHook can be triggered with
+ * the provided event data tags.
+ *
+ * It returns always true if the hook doesn't have any tags.
+ */
+ canTriggerOn(tagsToCheck: Array): boolean
+ }
+ interface TaggedHook {
+ /**
+ * Bind registers the provided handler to the current hooks queue.
+ *
+ * It is similar to [Hook.Bind] with the difference that the handler
+ * function is invoked only if the event data tags satisfy h.CanTriggerOn.
+ */
+ bind(handler: Handler): string
+ }
+ interface TaggedHook {
+ /**
+ * BindFunc registers a new handler with the specified function.
+ *
+ * It is similar to [Hook.Bind] with the difference that the handler
+ * function is invoked only if the event data tags satisfy h.CanTriggerOn.
+ */
+ bindFunc(fn: (e: T) => void): string
+ }
+}
+
namespace exec {
/**
* Cmd represents an external command being prepared or run.
@@ -21894,6 +21721,335 @@ namespace exec {
}
}
+namespace search {
+ /**
+ * Result defines the returned search result structure.
+ */
+ interface Result {
+ items: any
+ page: number
+ perPage: number
+ totalItems: number
+ totalPages: number
+ }
+ /**
+ * ResolverResult defines a single FieldResolver.Resolve() successfully parsed result.
+ */
+ interface ResolverResult {
+ /**
+ * Identifier is the plain SQL identifier/column that will be used
+ * in the final db expression as left or right operand.
+ */
+ identifier: string
+ /**
+ * NullFallback specify the preference for how NULL or empty values
+ * should be resolved (default to "auto").
+ *
+ * Set to NullFallbackDisabled to prevent any COALESCE or NULL fallbacks.
+ * Set to NullFallbackEnforced to prefer COALESCE or NULL fallbacks when needed.
+ */
+ nullFallback: NullFallbackPreference
+ /**
+ * Params is a map with db placeholder->value pairs that will be added
+ * to the query when building both resolved operands/sides in a single expression.
+ */
+ params: dbx.Params
+ /**
+ * MultiMatchSubQuery is an optional sub query expression that will be added
+ * in addition to the combined ResolverResult expression during build.
+ */
+ multiMatchSubQuery?: MultiMatchSubquery
+ /**
+ * AfterBuild is an optional function that will be called after building
+ * and combining the result of both resolved operands/sides in a single expression.
+ */
+ afterBuild: (expr: dbx.Expression) => dbx.Expression
+ }
+}
+
+namespace router {
+ // @ts-ignore
+ import validation = ozzo_validation
+ /**
+ * ApiError defines the struct for a basic api error response.
+ */
+ interface ApiError {
+ data: _TygojaDict
+ message: string
+ status: number
+ }
+ interface ApiError {
+ /**
+ * Error makes it compatible with the `error` interface.
+ */
+ error(): string
+ }
+ interface ApiError {
+ /**
+ * RawData returns the unformatted error data (could be an internal error, text, etc.)
+ */
+ rawData(): any
+ }
+ interface ApiError {
+ /**
+ * Is reports whether the current ApiError wraps the target.
+ */
+ is(target: Error): boolean
+ }
+ /**
+ * Event specifies based Route handler event that is usually intended
+ * to be embedded as part of a custom event struct.
+ *
+ * NB! It is expected that the Response and Request fields are always set.
+ */
+ type _sqtjIGA = hook.Event
+ interface Event extends _sqtjIGA {
+ response: http.ResponseWriter
+ request?: http.Request
+ }
+ interface Event {
+ /**
+ * Written reports whether the current response has already been written.
+ *
+ * This method always returns false if e.ResponseWritter doesn't implement the WriteTracker interface
+ * (all router package handlers receives a ResponseWritter that implements it unless explicitly replaced with a custom one).
+ */
+ written(): boolean
+ }
+ interface Event {
+ /**
+ * Status reports the status code of the current response.
+ *
+ * This method always returns 0 if e.Response doesn't implement the StatusTracker interface
+ * (all router package handlers receives a ResponseWritter that implements it unless explicitly replaced with a custom one).
+ */
+ status(): number
+ }
+ interface Event {
+ /**
+ * Flush flushes buffered data to the current response.
+ *
+ * Returns [http.ErrNotSupported] if e.Response doesn't implement the [http.Flusher] interface
+ * (all router package handlers receives a ResponseWritter that implements it unless explicitly replaced with a custom one).
+ */
+ flush(): void
+ }
+ interface Event {
+ /**
+ * IsTLS reports whether the connection on which the request was received is TLS.
+ */
+ isTLS(): boolean
+ }
+ interface Event {
+ /**
+ * SetCookie is an alias for [http.SetCookie].
+ *
+ * SetCookie adds a Set-Cookie header to the current response's headers.
+ * The provided cookie must have a valid Name.
+ * Invalid cookies may be silently dropped.
+ */
+ setCookie(cookie: http.Cookie): void
+ }
+ interface Event {
+ /**
+ * RemoteIP returns the IP address of the client that sent the request.
+ *
+ * IPv6 addresses are returned expanded.
+ * For example, "2001:db8::1" becomes "2001:0db8:0000:0000:0000:0000:0000:0001".
+ *
+ * Note that if you are behind reverse proxy(ies), this method returns
+ * the IP of the last connecting proxy.
+ */
+ remoteIP(): string
+ }
+ interface Event {
+ /**
+ * FindUploadedFiles extracts all form files of "key" from a http request
+ * and returns a slice with filesystem.File instances (if any).
+ */
+ findUploadedFiles(key: string): Array<(filesystem.File | undefined)>
+ }
+ interface Event {
+ /**
+ * Get retrieves single value from the current event data store.
+ */
+ get(key: string): any
+ }
+ interface Event {
+ /**
+ * GetAll returns a copy of the current event data store.
+ */
+ getAll(): _TygojaDict
+ }
+ interface Event {
+ /**
+ * Set saves single value into the current event data store.
+ */
+ set(key: string, value: any): void
+ }
+ interface Event {
+ /**
+ * SetAll saves all items from m into the current event data store.
+ */
+ setAll(m: _TygojaDict): void
+ }
+ interface Event {
+ /**
+ * String writes a plain string response.
+ */
+ string(status: number, data: string): void
+ }
+ interface Event {
+ /**
+ * HTML writes an HTML response.
+ */
+ html(status: number, data: string): void
+ }
+ interface Event {
+ /**
+ * JSON writes a JSON response.
+ *
+ * It also provides a generic response data fields picker if the "fields" query parameter is set.
+ * For example, if you are requesting `?fields=a,b` for `e.JSON(200, map[string]int{ "a":1, "b":2, "c":3 })`,
+ * it should result in a JSON response like: `{"a":1, "b": 2}`.
+ */
+ json(status: number, data: any): void
+ }
+ interface Event {
+ /**
+ * XML writes an XML response.
+ * It automatically prepends the generic [xml.Header] string to the response.
+ */
+ xml(status: number, data: any): void
+ }
+ interface Event {
+ /**
+ * Stream streams the specified reader into the response.
+ */
+ stream(status: number, contentType: string, reader: io.Reader): void
+ }
+ interface Event {
+ /**
+ * Blob writes a blob (bytes slice) response.
+ */
+ blob(status: number, contentType: string, b: string|Array): void
+ }
+ interface Event {
+ /**
+ * FileFS serves the specified filename from fsys.
+ *
+ * It is similar to [echo.FileFS] for consistency with earlier versions.
+ */
+ fileFS(fsys: fs.FS, filename: string): void
+ }
+ interface Event {
+ /**
+ * NoContent writes a response with no body (ex. 204).
+ */
+ noContent(status: number): void
+ }
+ interface Event {
+ /**
+ * Redirect writes a redirect response to the specified url.
+ * The status code must be in between 300 – 399 range.
+ */
+ redirect(status: number, url: string): void
+ }
+ interface Event {
+ error(status: number, message: string, errData: any): (ApiError)
+ }
+ interface Event {
+ badRequestError(message: string, errData: any): (ApiError)
+ }
+ interface Event {
+ notFoundError(message: string, errData: any): (ApiError)
+ }
+ interface Event {
+ forbiddenError(message: string, errData: any): (ApiError)
+ }
+ interface Event {
+ unauthorizedError(message: string, errData: any): (ApiError)
+ }
+ interface Event {
+ tooManyRequestsError(message: string, errData: any): (ApiError)
+ }
+ interface Event {
+ internalServerError(message: string, errData: any): (ApiError)
+ }
+ interface Event {
+ /**
+ * BindBody unmarshal the request body into the provided dst.
+ *
+ * dst must be either a struct pointer or map[string]any.
+ *
+ * The rules how the body will be scanned depends on the request Content-Type.
+ *
+ * Currently the following Content-Types are supported:
+ * ```
+ * - application/json
+ * - text/xml, application/xml
+ * - multipart/form-data, application/x-www-form-urlencoded
+ * ```
+ *
+ * Respectively the following struct tags are supported (again, which one will be used depends on the Content-Type):
+ * ```
+ * - "json" (json body)- uses the builtin Go json package for unmarshaling.
+ * - "xml" (xml body) - uses the builtin Go xml package for unmarshaling.
+ * - "form" (form data) - utilizes the custom [router.UnmarshalRequestData] method.
+ * ```
+ *
+ * NB! When dst is a struct make sure that it doesn't have public fields
+ * that shouldn't be bindable and it is advisible such fields to be unexported
+ * or have a separate struct just for the binding. For example:
+ *
+ * ```
+ * data := struct{
+ * somethingPrivate string
+ *
+ * Title string `json:"title" form:"title"`
+ * Total int `json:"total" form:"total"`
+ * }{}
+ * err := e.BindBody(&data)
+ * ```
+ */
+ bindBody(dst: any): void
+ }
+ /**
+ * Router defines a thin wrapper around the standard Go [http.ServeMux] by
+ * adding support for routing sub-groups, middlewares and other common utils.
+ *
+ * Example:
+ *
+ * ```
+ * r := NewRouter[*MyEvent](eventFactory)
+ *
+ * // middlewares
+ * r.BindFunc(m1, m2)
+ *
+ * // routes
+ * r.GET("/test", handler1)
+ *
+ * // sub-routers/groups
+ * api := r.Group("/api")
+ * api.GET("/admins", handler2)
+ *
+ * // generate a http.ServeMux instance based on the router configurations
+ * mux, _ := r.BuildMux()
+ *
+ * http.ListenAndServe("localhost:8090", mux)
+ * ```
+ */
+ type _slIWGhP = RouterGroup
+ interface Router extends _slIWGhP {
+ }
+ interface Router {
+ /**
+ * BuildMux constructs a new mux [http.Handler] instance from the current router configurations.
+ */
+ buildMux(): http.Handler
+ }
+}
+
namespace mailer {
/**
* Message defines a generic email message struct.
@@ -21922,148 +22078,6 @@ namespace mailer {
}
}
-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 {
- /**
- * ChunkedClients splits the current clients into a chunked slice.
- */
- chunkedClients(chunkSize: number): Array>
- }
- interface Broker {
- /**
- * TotalClients returns the total number of registered clients.
- */
- totalClients(): number
- }
- 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 and marks it as discarded.
- *
- * If client with clientId doesn't exist, this method does nothing.
- */
- unregister(clientId: string): void
- }
- /**
- * Client is an interface for a generic subscription client.
- */
- interface Client {
- [key:string]: any;
- /**
- * Id Returns the unique id of the client.
- */
- id(): string
- /**
- * Channel returns the client's communication channel.
- *
- * NB! The channel shouldn't be used after calling Discard().
- */
- channel(): undefined
- /**
- * Subscriptions returns a shallow copy of the client subscriptions matching the prefixes.
- * If no prefix is specified, returns all subscriptions.
- */
- subscriptions(...prefixes: string[]): _TygojaDict
- /**
- * Subscribe subscribes the client to the provided subscriptions list.
- *
- * Each subscription can also have "options" (json serialized SubscriptionOptions) as query parameter.
- *
- * Example:
- *
- * ```
- * Subscribe(
- * "subscriptionA",
- * `subscriptionB?options={"query":{"a":1},"headers":{"x_token":"abc"}}`,
- * )
- * ```
- */
- subscribe(...subs: string[]): void
- /**
- * Unsubscribe unsubscribes the client from the provided subscriptions list.
- */
- unsubscribe(...subs: string[]): void
- /**
- * HasSubscription checks if the client is subscribed to `sub`.
- */
- hasSubscription(sub: string): boolean
- /**
- * Set stores any value to the client's context.
- */
- set(key: string, value: any): void
- /**
- * Unset removes a single value from the client's context.
- */
- unset(key: string): void
- /**
- * Get retrieves the key value from the client's context.
- */
- get(key: string): any
- /**
- * Discard marks the client as "discarded" (and closes its channel),
- * meaning that it shouldn't be used anymore for sending new messages.
- *
- * It is safe to call Discard() multiple times.
- */
- discard(): void
- /**
- * IsDiscarded indicates whether the client has been "discarded"
- * and should no longer be used.
- */
- isDiscarded(): boolean
- /**
- * Send sends the specified message to the client's channel (if not discarded).
- */
- send(m: Message): void
- }
- /**
- * Message defines a client's channel data.
- */
- interface Message {
- name: string
- data: string|Array
- }
- interface Message {
- /**
- * WriteSSE writes the current message in a SSE format into the provided writer.
- *
- * For example, writing to a router.Event:
- *
- * ```
- * m := Message{Name: "users/create", Data: []byte{...}}
- * m.WriteSSE(e.Response, "yourEventId")
- * e.Flush()
- * ```
- */
- writeSSE(w: io.Writer, eventId: string): void
- }
-}
-
namespace sync {
// @ts-ignore
import isync = sync
@@ -22661,6 +22675,151 @@ namespace net {
import _cgopackage = cgo
}
+/**
+ * Package textproto implements generic support for text-based request/response
+ * protocols in the style of HTTP, NNTP, and SMTP.
+ *
+ * This package enforces the HTTP/1.1 character set defined by
+ * RFC 9112 for header keys and values.
+ *
+ * The package provides:
+ *
+ * [Error], which represents a numeric error response from
+ * a server.
+ *
+ * [Pipeline], to manage pipelined requests and responses
+ * in a client.
+ *
+ * [Reader], to read numeric response code lines,
+ * key: value headers, lines wrapped with leading spaces
+ * on continuation lines, and whole text blocks ending
+ * with a dot on a line by itself.
+ *
+ * [Writer], to write dot-encoded text blocks.
+ *
+ * [Conn], a convenient packaging of [Reader], [Writer], and [Pipeline] for use
+ * with a single network connection.
+ */
+namespace textproto {
+ /**
+ * A MIMEHeader represents a MIME-style header mapping
+ * keys to sets of values.
+ */
+ interface MIMEHeader extends _TygojaDict{}
+ interface MIMEHeader {
+ /**
+ * Add adds the key, value pair to the header.
+ * It appends to any existing values associated with key.
+ */
+ add(key: string, value: string): void
+ }
+ interface MIMEHeader {
+ /**
+ * Set sets the header entries associated with key to
+ * the single element value. It replaces any existing
+ * values associated with key.
+ */
+ set(key: string, value: string): void
+ }
+ interface MIMEHeader {
+ /**
+ * Get gets the first value associated with the given key.
+ * It is case insensitive; [CanonicalMIMEHeaderKey] is used
+ * to canonicalize the provided key.
+ * If there are no values associated with the key, Get returns "".
+ * To use non-canonical keys, access the map directly.
+ */
+ get(key: string): string
+ }
+ interface MIMEHeader {
+ /**
+ * Values returns all values associated with the given key.
+ * It is case insensitive; [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 MIMEHeader {
+ /**
+ * Del deletes the values associated with key.
+ */
+ del(key: string): void
+ }
+}
+
+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)
+ }
+ /**
+ * 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 {
+ [key:string]: any;
+ }
+ /**
+ * 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)
+ }
+ 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 [Reader.NextPart], it does not have special handling for
+ * "Content-Transfer-Encoding: quoted-printable".
+ */
+ nextRawPart(): (Part)
+ }
+}
+
+namespace store {
+}
+
/**
* Package url parses URLs and implements query escaping.
*
@@ -22906,145 +23065,80 @@ namespace url {
}
}
-/**
- * Package textproto implements generic support for text-based request/response
- * protocols in the style of HTTP, NNTP, and SMTP.
- *
- * This package enforces the HTTP/1.1 character set defined by
- * RFC 9112 for header keys and values.
- *
- * The package provides:
- *
- * [Error], which represents a numeric error response from
- * a server.
- *
- * [Pipeline], to manage pipelined requests and responses
- * in a client.
- *
- * [Reader], to read numeric response code lines,
- * key: value headers, lines wrapped with leading spaces
- * on continuation lines, and whole text blocks ending
- * with a dot on a line by itself.
- *
- * [Writer], to write dot-encoded text blocks.
- *
- * [Conn], a convenient packaging of [Reader], [Writer], and [Pipeline] for use
- * with a single network connection.
- */
-namespace textproto {
+namespace jwt {
/**
- * A MIMEHeader represents a MIME-style header mapping
- * keys to sets of values.
+ * NumericDate represents a JSON numeric date value, as referenced at
+ * https://datatracker.ietf.org/doc/html/rfc7519#section-2.
*/
- interface MIMEHeader extends _TygojaDict{}
- interface MIMEHeader {
- /**
- * Add adds the key, value pair to the header.
- * It appends to any existing values associated with key.
- */
- add(key: string, value: string): void
+ type _sDOmzLN = time.Time
+ interface NumericDate extends _sDOmzLN {
}
- interface MIMEHeader {
+ interface NumericDate {
/**
- * Set sets the header entries associated with key to
- * the single element value. It replaces any existing
- * values associated with key.
+ * MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch
+ * represented in NumericDate to a byte array, using the precision specified in TimePrecision.
*/
- set(key: string, value: string): void
+ marshalJSON(): string|Array
}
- interface MIMEHeader {
+ interface NumericDate {
/**
- * Get gets the first value associated with the given key.
- * It is case insensitive; [CanonicalMIMEHeaderKey] is used
- * to canonicalize the provided key.
- * If there are no values associated with the key, Get returns "".
- * To use non-canonical keys, access the map directly.
+ * UnmarshalJSON is an implementation of the json.RawMessage interface and
+ * deserializes a [NumericDate] from a JSON representation, i.e. a
+ * [json.Number]. This number represents an UNIX epoch with either integer or
+ * non-integer seconds.
*/
- get(key: string): string
+ unmarshalJSON(b: string|Array): void
}
- interface MIMEHeader {
- /**
- * Values returns all values associated with the given key.
- * It is case insensitive; [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
+ /**
+ * ClaimStrings is basically just a slice of strings, but it can be either
+ * serialized from a string array or just a string. This type is necessary,
+ * since the "aud" claim can either be a single string or an array.
+ */
+ interface ClaimStrings extends Array{}
+ interface ClaimStrings {
+ unmarshalJSON(data: string|Array): void
}
- interface MIMEHeader {
- /**
- * Del deletes the values associated with key.
- */
- del(key: string): void
+ interface ClaimStrings {
+ marshalJSON(): string|Array
}
}
-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)
- }
+namespace subscriptions {
+}
+
+namespace types {
+}
+
+namespace cron {
/**
- * 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.
+ * Job defines a single registered cron job.
*/
- interface Form {
- value: _TygojaDict
- file: _TygojaDict
+ interface Job {
}
- interface Form {
+ interface Job {
/**
- * RemoveAll removes any temporary files associated with a [Form].
+ * Id returns the cron job id.
*/
- removeAll(): void
+ id(): string
}
- /**
- * 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 {
- [key:string]: any;
- }
- /**
- * 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 {
+ interface Job {
/**
- * 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.
+ * Expression returns the plain cron job schedule expression.
*/
- nextPart(): (Part)
+ expression(): string
}
- interface Reader {
+ interface Job {
/**
- * NextRawPart returns the next part in the multipart or an error.
- * When there are no more parts, the error [io.EOF] is returned.
- *
- * Unlike [Reader.NextPart], it does not have special handling for
- * "Content-Transfer-Encoding: quoted-printable".
+ * Run runs the cron job function.
*/
- nextRawPart(): (Part)
+ run(): void
+ }
+ interface Job {
+ /**
+ * MarshalJSON implements [json.Marshaler] and export the current
+ * jobs data into valid JSON.
+ */
+ marshalJSON(): string|Array
}
}
@@ -23463,152 +23557,169 @@ namespace http {
}
}
-namespace store {
-}
-
-namespace jwt {
- /**
- * NumericDate represents a JSON numeric date value, as referenced at
- * https://datatracker.ietf.org/doc/html/rfc7519#section-2.
- */
- type _sdeDNVa = time.Time
- interface NumericDate extends _sdeDNVa {
- }
- interface NumericDate {
- /**
- * MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch
- * represented in NumericDate to a byte array, using the precision specified in TimePrecision.
- */
- marshalJSON(): string|Array
- }
- interface NumericDate {
- /**
- * UnmarshalJSON is an implementation of the json.RawMessage interface and
- * deserializes a [NumericDate] from a JSON representation, i.e. a
- * [json.Number]. This number represents an UNIX epoch with either integer or
- * non-integer seconds.
- */
- unmarshalJSON(b: string|Array): void
- }
- /**
- * ClaimStrings is basically just a slice of strings, but it can be either
- * serialized from a string array or just a string. This type is necessary,
- * since the "aud" claim can either be a single string or an array.
- */
- interface ClaimStrings extends Array{}
- interface ClaimStrings {
- unmarshalJSON(data: string|Array): void
- }
- interface ClaimStrings {
- marshalJSON(): string|Array
- }
-}
-
-namespace subscriptions {
-}
-
-/**
- * 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 {
- [key:string]: any;
- }
- /**
- * 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
- /**
- * ExpiresIn is the OAuth2 wire format "expires_in" field,
- * which specifies how many seconds later the token expires,
- * relative to an unknown time base approximately around "now".
- * It is the application's responsibility to populate
- * `Expiry` from `ExpiresIn` when required.
- */
- expiresIn: number
- }
- 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: any): (Token)
- }
- interface Token {
- /**
- * Extra returns an extra field.
- * Extra fields are key-value pairs returned by the server as
- * part of the token retrieval response.
- */
- extra(key: string): any
- }
- interface Token {
- /**
- * Valid reports whether t is non-nil, has an AccessToken, and is not expired.
- */
- valid(): boolean
- }
-}
-
namespace hook {
/**
* wrapped local Hook embedded struct to limit the public API surface.
*/
- type _sUihVaQ = Hook
- interface mainHook extends _sUihVaQ {
+ type _sCneNCs = Hook
+ interface mainHook extends _sCneNCs {
+ }
+}
+
+namespace search {
+ /**
+ * MultiMatchSubquery defines a multi-match record subquery expression.
+ */
+ interface MultiMatchSubquery {
+ targetTableAlias: string
+ fromTableName: string
+ fromTableAlias: string
+ valueIdentifier: string
+ joins: Array<(Join | undefined)>
+ params: dbx.Params
+ }
+ interface MultiMatchSubquery {
+ /**
+ * Build converts the expression into a SQL fragment.
+ *
+ * Implements [dbx.Expression] interface.
+ */
+ build(db: dbx.DB, params: dbx.Params): string
+ }
+ interface NullFallbackPreference extends Number{}
+}
+
+namespace router {
+ // @ts-ignore
+ import validation = ozzo_validation
+ /**
+ * RouterGroup represents a collection of routes and other sub groups
+ * that share common pattern prefix and middlewares.
+ */
+ interface RouterGroup {
+ prefix: string
+ middlewares: Array<(hook.Handler | undefined)>
+ }
+ interface RouterGroup {
+ /**
+ * Group creates and register a new child Group into the current one
+ * with the specified prefix.
+ *
+ * The prefix follows the standard Go net/http ServeMux pattern format ("[HOST]/[PATH]")
+ * and will be concatenated recursively into the final route path, meaning that
+ * only the root level group could have HOST as part of the prefix.
+ *
+ * Returns the newly created group to allow chaining and registering
+ * sub-routes and group specific middlewares.
+ */
+ group(prefix: string): (RouterGroup)
+ }
+ interface RouterGroup {
+ /**
+ * BindFunc registers one or multiple middleware functions to the current group.
+ *
+ * The registered middleware functions are "anonymous" and with default priority,
+ * aka. executes in the order they were registered.
+ *
+ * If you need to specify a named middleware (ex. so that it can be removed)
+ * or middleware with custom exec prirority, use [RouterGroup.Bind] method.
+ */
+ bindFunc(...middlewareFuncs: ((e: T) => void)[]): (RouterGroup)
+ }
+ interface RouterGroup {
+ /**
+ * Bind registers one or multiple middleware handlers to the current group.
+ */
+ bind(...middlewares: (hook.Handler | undefined)[]): (RouterGroup)
+ }
+ interface RouterGroup {
+ /**
+ * Unbind removes one or more middlewares with the specified id(s)
+ * from the current group and its children (if any).
+ *
+ * Anonymous middlewares are not removable, aka. this method does nothing
+ * if the middleware id is an empty string.
+ */
+ unbind(...middlewareIds: string[]): (RouterGroup)
+ }
+ interface RouterGroup {
+ /**
+ * Route registers a single route into the current group.
+ *
+ * Note that the final route path will be the concatenation of all parent groups prefixes + the route path.
+ * The path follows the standard Go net/http ServeMux format ("[HOST]/[PATH]"),
+ * meaning that only a top level group route could have HOST as part of the prefix.
+ *
+ * Returns the newly created route to allow attaching route-only middlewares.
+ */
+ route(method: string, path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * Any is a shorthand for [RouterGroup.AddRoute] with "" as route method (aka. matches any method).
+ */
+ any(path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * GET is a shorthand for [RouterGroup.AddRoute] with GET as route method.
+ */
+ get(path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * SEARCH is a shorthand for [RouterGroup.AddRoute] with SEARCH as route method.
+ */
+ search(path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * POST is a shorthand for [RouterGroup.AddRoute] with POST as route method.
+ */
+ post(path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * DELETE is a shorthand for [RouterGroup.AddRoute] with DELETE as route method.
+ */
+ delete(path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * PATCH is a shorthand for [RouterGroup.AddRoute] with PATCH as route method.
+ */
+ patch(path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * PUT is a shorthand for [RouterGroup.AddRoute] with PUT as route method.
+ */
+ put(path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * HEAD is a shorthand for [RouterGroup.AddRoute] with HEAD as route method.
+ */
+ head(path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * OPTIONS is a shorthand for [RouterGroup.AddRoute] with OPTIONS as route method.
+ */
+ options(path: string, action: (e: T) => void): (Route)
+ }
+ interface RouterGroup {
+ /**
+ * HasRoute checks whether the specified route pattern (method + path)
+ * is registered in the current group or its children.
+ *
+ * This could be useful to conditionally register and checks for routes
+ * in order prevent panic on duplicated routes.
+ *
+ * Note that routes with anonymous and named wildcard placeholder are treated as equal,
+ * aka. "GET /abc/" is considered the same as "GET /abc/{something...}".
+ */
+ hasRoute(method: string, path: string): boolean
}
}
@@ -23790,199 +23901,6 @@ namespace slog {
import loginternal = internal
}
-namespace types {
-}
-
-namespace search {
- /**
- * MultiMatchSubquery defines a multi-match record subquery expression.
- */
- interface MultiMatchSubquery {
- targetTableAlias: string
- fromTableName: string
- fromTableAlias: string
- valueIdentifier: string
- joins: Array<(Join | undefined)>
- params: dbx.Params
- }
- interface MultiMatchSubquery {
- /**
- * Build converts the expression into a SQL fragment.
- *
- * Implements [dbx.Expression] interface.
- */
- build(db: dbx.DB, params: dbx.Params): string
- }
- interface NullFallbackPreference extends Number{}
-}
-
-namespace router {
- // @ts-ignore
- import validation = ozzo_validation
- /**
- * RouterGroup represents a collection of routes and other sub groups
- * that share common pattern prefix and middlewares.
- */
- interface RouterGroup {
- prefix: string
- middlewares: Array<(hook.Handler | undefined)>
- }
- interface RouterGroup {
- /**
- * Group creates and register a new child Group into the current one
- * with the specified prefix.
- *
- * The prefix follows the standard Go net/http ServeMux pattern format ("[HOST]/[PATH]")
- * and will be concatenated recursively into the final route path, meaning that
- * only the root level group could have HOST as part of the prefix.
- *
- * Returns the newly created group to allow chaining and registering
- * sub-routes and group specific middlewares.
- */
- group(prefix: string): (RouterGroup)
- }
- interface RouterGroup {
- /**
- * BindFunc registers one or multiple middleware functions to the current group.
- *
- * The registered middleware functions are "anonymous" and with default priority,
- * aka. executes in the order they were registered.
- *
- * If you need to specify a named middleware (ex. so that it can be removed)
- * or middleware with custom exec prirority, use [RouterGroup.Bind] method.
- */
- bindFunc(...middlewareFuncs: ((e: T) => void)[]): (RouterGroup)
- }
- interface RouterGroup {
- /**
- * Bind registers one or multiple middleware handlers to the current group.
- */
- bind(...middlewares: (hook.Handler | undefined)[]): (RouterGroup)
- }
- interface RouterGroup {
- /**
- * Unbind removes one or more middlewares with the specified id(s)
- * from the current group and its children (if any).
- *
- * Anonymous middlewares are not removable, aka. this method does nothing
- * if the middleware id is an empty string.
- */
- unbind(...middlewareIds: string[]): (RouterGroup)
- }
- interface RouterGroup {
- /**
- * Route registers a single route into the current group.
- *
- * Note that the final route path will be the concatenation of all parent groups prefixes + the route path.
- * The path follows the standard Go net/http ServeMux format ("[HOST]/[PATH]"),
- * meaning that only a top level group route could have HOST as part of the prefix.
- *
- * Returns the newly created route to allow attaching route-only middlewares.
- */
- route(method: string, path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * Any is a shorthand for [RouterGroup.AddRoute] with "" as route method (aka. matches any method).
- */
- any(path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * GET is a shorthand for [RouterGroup.AddRoute] with GET as route method.
- */
- get(path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * SEARCH is a shorthand for [RouterGroup.AddRoute] with SEARCH as route method.
- */
- search(path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * POST is a shorthand for [RouterGroup.AddRoute] with POST as route method.
- */
- post(path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * DELETE is a shorthand for [RouterGroup.AddRoute] with DELETE as route method.
- */
- delete(path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * PATCH is a shorthand for [RouterGroup.AddRoute] with PATCH as route method.
- */
- patch(path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * PUT is a shorthand for [RouterGroup.AddRoute] with PUT as route method.
- */
- put(path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * HEAD is a shorthand for [RouterGroup.AddRoute] with HEAD as route method.
- */
- head(path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * OPTIONS is a shorthand for [RouterGroup.AddRoute] with OPTIONS as route method.
- */
- options(path: string, action: (e: T) => void): (Route)
- }
- interface RouterGroup {
- /**
- * HasRoute checks whether the specified route pattern (method + path)
- * is registered in the current group or its children.
- *
- * This could be useful to conditionally register and checks for routes
- * in order prevent panic on duplicated routes.
- *
- * Note that routes with anonymous and named wildcard placeholder are treated as equal,
- * aka. "GET /abc/" is considered the same as "GET /abc/{something...}".
- */
- hasRoute(method: string, path: string): boolean
- }
-}
-
-namespace cron {
- /**
- * Job defines a single registered cron job.
- */
- interface Job {
- }
- interface Job {
- /**
- * Id returns the cron job id.
- */
- id(): string
- }
- interface Job {
- /**
- * Expression returns the plain cron job schedule expression.
- */
- expression(): string
- }
- interface Job {
- /**
- * Run runs the cron job function.
- */
- run(): void
- }
- interface Job {
- /**
- * MarshalJSON implements [json.Marshaler] and export the current
- * jobs data into valid JSON.
- */
- marshalJSON(): string|Array
- }
-}
-
namespace cobra {
interface PositionalArgs {(cmd: Command, args: Array): void }
// @ts-ignore
@@ -24049,154 +23967,100 @@ namespace cobra {
interface CompletionFunc {(cmd: Command, args: Array, toComplete: string): [Array, ShellCompDirective] }
}
-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
- }
-}
-
-namespace multipart {
- /**
- * A Part represents a single part in a multipart body.
- */
- interface Part {
- /**
- * The headers of the body, if any, with the keys canonicalized
- * in the same fashion that the Go http.Request headers are.
- * For example, "foo-bar" changes case to "Foo-Bar"
- */
- header: textproto.MIMEHeader
- }
- interface Part {
- /**
- * FormName returns the name parameter if p has a Content-Disposition
- * of type "form-data". Otherwise it returns the empty string.
- */
- formName(): string
- }
- interface Part {
- /**
- * FileName returns the filename parameter of the [Part]'s Content-Disposition
- * header. If not empty, the filename is passed through filepath.Base (which is
- * platform dependent) before being returned.
- */
- fileName(): string
- }
- interface Part {
- /**
- * Read reads the body of a part, after its headers and before the
- * next part (if any) begins.
- */
- read(d: string|Array): number
- }
- interface Part {
- close(): void
- }
-}
-
-namespace http {
- /**
- * SameSite allows a server to define a cookie attribute making it impossible for
- * the browser to send this cookie along with cross-site requests. The main
- * goal is to mitigate the risk of cross-origin information leakage, and provide
- * some protection against cross-site request forgery attacks.
- *
- * See https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00 for details.
- */
- interface SameSite extends Number{}
- // @ts-ignore
- import mathrand = rand
- // @ts-ignore
- import urlpkg = url
-}
-
+/**
+ * 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 {
-}
-
-namespace search {
/**
- * Join defines common fields required for a single SQL JOIN clause.
+ * An AuthCodeOption is passed to Config.AuthCodeURL.
*/
- interface Join {
- tableName: string
- tableAlias: string
- on: dbx.Expression
+ interface AuthCodeOption {
+ [key:string]: any;
}
-}
-
-namespace router {
- // @ts-ignore
- import validation = ozzo_validation
- interface Route {
- action: (e: T) => void
- method: string
- path: string
- middlewares: Array<(hook.Handler | undefined)>
- }
- interface Route {
- /**
- * BindFunc registers one or multiple middleware functions to the current route.
- *
- * The registered middleware functions are "anonymous" and with default priority,
- * aka. executes in the order they were registered.
- *
- * If you need to specify a named middleware (ex. so that it can be removed)
- * or middleware with custom exec prirority, use the [Route.Bind] method.
- */
- bindFunc(...middlewareFuncs: ((e: T) => void)[]): (Route)
- }
- interface Route {
- /**
- * Bind registers one or multiple middleware handlers to the current route.
- */
- bind(...middlewares: (hook.Handler | undefined)[]): (Route)
- }
- interface Route {
- /**
- * Unbind removes one or more middlewares with the specified id(s) from the current route.
- *
- * It also adds the removed middleware ids to an exclude list so that they could be skipped from
- * the execution chain in case the middleware is registered in a parent group.
- *
- * Anonymous middlewares are considered non-removable, aka. this method
- * does nothing if the middleware id is an empty string.
- */
- unbind(...middlewareIds: string[]): (Route)
- }
-}
-
-namespace cobra {
- // @ts-ignore
- import flag = pflag
/**
- * ShellCompDirective is a bit map representing the different behaviors the shell
- * can be instructed to have once completions have been provided.
+ * 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 ShellCompDirective extends Number{}
+ 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
+ /**
+ * ExpiresIn is the OAuth2 wire format "expires_in" field,
+ * which specifies how many seconds later the token expires,
+ * relative to an unknown time base approximately around "now".
+ * It is the application's responsibility to populate
+ * `Expiry` from `ExpiresIn` when required.
+ */
+ expiresIn: number
+ }
+ 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: any): (Token)
+ }
+ interface Token {
+ /**
+ * Extra returns an extra field.
+ * Extra fields are key-value pairs returned by the server as
+ * part of the token retrieval response.
+ */
+ extra(key: string): any
+ }
+ interface Token {
+ /**
+ * Valid reports whether t is non-nil, has an AccessToken, and is not expired.
+ */
+ valid(): boolean
+ }
}
namespace slog {
@@ -24379,9 +24243,154 @@ namespace slog {
}
}
+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
+ }
+}
+
+namespace cobra {
+ // @ts-ignore
+ import flag = pflag
+ /**
+ * 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{}
+}
+
+namespace multipart {
+ /**
+ * A Part represents a single part in a multipart body.
+ */
+ interface Part {
+ /**
+ * The headers of the body, if any, with the keys canonicalized
+ * in the same fashion that the Go http.Request headers are.
+ * For example, "foo-bar" changes case to "Foo-Bar"
+ */
+ header: textproto.MIMEHeader
+ }
+ interface Part {
+ /**
+ * FormName returns the name parameter if p has a Content-Disposition
+ * of type "form-data". Otherwise it returns the empty string.
+ */
+ formName(): string
+ }
+ interface Part {
+ /**
+ * FileName returns the filename parameter of the [Part]'s Content-Disposition
+ * header. If not empty, the filename is passed through filepath.Base (which is
+ * platform dependent) before being returned.
+ */
+ fileName(): string
+ }
+ interface Part {
+ /**
+ * Read reads the body of a part, after its headers and before the
+ * next part (if any) begins.
+ */
+ read(d: string|Array): number
+ }
+ interface Part {
+ close(): void
+ }
+}
+
+namespace http {
+ /**
+ * SameSite allows a server to define a cookie attribute making it impossible for
+ * the browser to send this cookie along with cross-site requests. The main
+ * goal is to mitigate the risk of cross-origin information leakage, and provide
+ * some protection against cross-site request forgery attacks.
+ *
+ * See https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00 for details.
+ */
+ interface SameSite extends Number{}
+ // @ts-ignore
+ import mathrand = rand
+ // @ts-ignore
+ import urlpkg = url
+}
+
+namespace oauth2 {
+}
+
+namespace search {
+ /**
+ * Join defines common fields required for a single SQL JOIN clause.
+ */
+ interface Join {
+ tableName: string
+ tableAlias: string
+ on: dbx.Expression
+ }
+}
+
namespace router {
// @ts-ignore
import validation = ozzo_validation
+ interface Route {
+ action: (e: T) => void
+ method: string
+ path: string
+ middlewares: Array<(hook.Handler | undefined)>
+ }
+ interface Route {
+ /**
+ * BindFunc registers one or multiple middleware functions to the current route.
+ *
+ * The registered middleware functions are "anonymous" and with default priority,
+ * aka. executes in the order they were registered.
+ *
+ * If you need to specify a named middleware (ex. so that it can be removed)
+ * or middleware with custom exec prirority, use the [Route.Bind] method.
+ */
+ bindFunc(...middlewareFuncs: ((e: T) => void)[]): (Route)
+ }
+ interface Route {
+ /**
+ * Bind registers one or multiple middleware handlers to the current route.
+ */
+ bind(...middlewares: (hook.Handler | undefined)[]): (Route)
+ }
+ interface Route {
+ /**
+ * Unbind removes one or more middlewares with the specified id(s) from the current route.
+ *
+ * It also adds the removed middleware ids to an exclude list so that they could be skipped from
+ * the execution chain in case the middleware is registered in a parent group.
+ *
+ * Anonymous middlewares are considered non-removable, aka. this method
+ * does nothing if the middleware id is an empty string.
+ */
+ unbind(...middlewareIds: string[]): (Route)
+ }
}
namespace slog {
@@ -24422,3 +24431,8 @@ namespace slog {
logValue(): Value
}
}
+
+namespace router {
+ // @ts-ignore
+ import validation = ozzo_validation
+}