From f4a6d8af49e3c8c345a17984b52348a13879f22a Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Wed, 26 Jul 2023 10:45:06 +0300 Subject: [PATCH] excluded unnecessary types to reduce the size of the generated declarations file --- .../jsvm/internal/types/generated/types.d.ts | 13721 ++++------------ plugins/jsvm/internal/types/types.go | 17 + 2 files changed, 2974 insertions(+), 10764 deletions(-) diff --git a/plugins/jsvm/internal/types/generated/types.d.ts b/plugins/jsvm/internal/types/generated/types.d.ts index 470809c7..173ab201 100644 --- a/plugins/jsvm/internal/types/generated/types.d.ts +++ b/plugins/jsvm/internal/types/generated/types.d.ts @@ -1484,8 +1484,8 @@ namespace os { */ readFrom(r: io.Reader): number } - type _subQrtZf = io.Writer - interface onlyWriter extends _subQrtZf { + type _subSoosR = io.Writer + interface onlyWriter extends _subSoosR { } interface File { /** @@ -2109,8 +2109,8 @@ namespace os { /** * File represents an open file descriptor. */ - type _subPogFl = file - interface File extends _subPogFl { + type _subWKkaL = file + interface File extends _subWKkaL { } /** * A FileInfo describes a file and is returned by Stat and Lstat. @@ -2476,6 +2476,119 @@ namespace filepath { } } +/** + * Package validation provides configurable and extensible rules for validating data of various types. + */ +namespace ozzo_validation { + /** + * Error interface represents an validation error + */ + interface Error { + error(): string + code(): string + message(): string + setMessage(_arg0: string): Error + params(): _TygojaDict + setParams(_arg0: _TygojaDict): Error + } +} + +namespace security { + // @ts-ignore + import crand = rand + interface s256Challenge { + /** + * S256Challenge creates base64 encoded sha256 challenge string derived from code. + * The padding of the result base64 string is stripped per [RFC 7636]. + * + * [RFC 7636]: https://datatracker.ietf.org/doc/html/rfc7636#section-4.2 + */ + (code: string): string + } + interface encrypt { + /** + * Encrypt encrypts data with key (must be valid 32 char aes key). + */ + (data: string, key: string): string + } + interface decrypt { + /** + * Decrypt decrypts encrypted text with key (must be valid 32 chars aes key). + */ + (cipherText: string, key: string): string + } + interface parseUnverifiedJWT { + /** + * ParseUnverifiedJWT parses JWT token and returns its claims + * but DOES NOT verify the signature. + * + * It verifies only the exp, iat and nbf claims. + */ + (token: string): jwt.MapClaims + } + interface parseJWT { + /** + * ParseJWT verifies and parses JWT token and returns its claims. + */ + (token: string, verificationKey: string): jwt.MapClaims + } + interface newJWT { + /** + * NewJWT generates and returns new HS256 signed JWT token. + */ + (payload: jwt.MapClaims, signingKey: string, secondsDuration: number): string + } + interface newToken { + /** + * Deprecated: + * Consider replacing with NewJWT(). + * + * NewToken is a legacy alias for NewJWT that generates a HS256 signed JWT token. + */ + (payload: jwt.MapClaims, signingKey: string, secondsDuration: number): string + } + // @ts-ignore + import cryptoRand = rand + // @ts-ignore + import mathRand = rand + interface randomString { + /** + * RandomString generates a cryptographically random string with the specified length. + * + * The generated string matches [A-Za-z0-9]+ and it's transparent to URL-encoding. + */ + (length: number): string + } + interface randomStringWithAlphabet { + /** + * RandomStringWithAlphabet generates a cryptographically random string + * with the specified length and characters set. + * + * It panics if for some reason rand.Int returns a non-nil error. + */ + (length: number, alphabet: string): string + } + interface pseudorandomString { + /** + * PseudorandomString generates a pseudorandom string with the specified length. + * + * The generated string matches [A-Za-z0-9]+ and it's transparent to URL-encoding. + * + * For a cryptographically random string (but a little bit slower) use RandomString instead. + */ + (length: number): string + } + interface pseudorandomStringWithAlphabet { + /** + * PseudorandomStringWithAlphabet generates a pseudorandom string + * with the specified length and characters set. + * + * For a cryptographically random (but a little bit slower) use RandomStringWithAlphabet instead. + */ + (length: number, alphabet: string): string + } +} + /** * 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 @@ -2524,23 +2637,6 @@ namespace exec { } } -/** - * Package validation provides configurable and extensible rules for validating data of various types. - */ -namespace ozzo_validation { - /** - * Error interface represents an validation error - */ - interface Error { - error(): string - code(): string - message(): string - setMessage(_arg0: string): Error - params(): _TygojaDict - setParams(_arg0: _TygojaDict): Error - } -} - /** * Package dbx provides a set of DB-agnostic and easy-to-use query building methods for relational databases. */ @@ -2876,14 +2972,14 @@ namespace dbx { /** * MssqlBuilder is the builder for SQL Server databases. */ - type _subebZDX = BaseBuilder - interface MssqlBuilder extends _subebZDX { + type _subZKOJb = BaseBuilder + interface MssqlBuilder extends _subZKOJb { } /** * MssqlQueryBuilder is the query builder for SQL Server databases. */ - type _subDPgCp = BaseQueryBuilder - interface MssqlQueryBuilder extends _subDPgCp { + type _subMnXZI = BaseQueryBuilder + interface MssqlQueryBuilder extends _subMnXZI { } interface newMssqlBuilder { /** @@ -2954,8 +3050,8 @@ namespace dbx { /** * MysqlBuilder is the builder for MySQL databases. */ - type _subBudbH = BaseBuilder - interface MysqlBuilder extends _subBudbH { + type _subWVzWV = BaseBuilder + interface MysqlBuilder extends _subWVzWV { } interface newMysqlBuilder { /** @@ -3030,14 +3126,14 @@ namespace dbx { /** * OciBuilder is the builder for Oracle databases. */ - type _subKEild = BaseBuilder - interface OciBuilder extends _subKEild { + type _subdHwNS = BaseBuilder + interface OciBuilder extends _subdHwNS { } /** * OciQueryBuilder is the query builder for Oracle databases. */ - type _subkQfUv = BaseQueryBuilder - interface OciQueryBuilder extends _subkQfUv { + type _subHiiqh = BaseQueryBuilder + interface OciQueryBuilder extends _subHiiqh { } interface newOciBuilder { /** @@ -3100,8 +3196,8 @@ namespace dbx { /** * PgsqlBuilder is the builder for PostgreSQL databases. */ - type _subzYxNs = BaseBuilder - interface PgsqlBuilder extends _subzYxNs { + type _subGVIzr = BaseBuilder + interface PgsqlBuilder extends _subGVIzr { } interface newPgsqlBuilder { /** @@ -3168,8 +3264,8 @@ namespace dbx { /** * SqliteBuilder is the builder for SQLite databases. */ - type _subxIIHo = BaseBuilder - interface SqliteBuilder extends _subxIIHo { + type _subZDhdR = BaseBuilder + interface SqliteBuilder extends _subZDhdR { } interface newSqliteBuilder { /** @@ -3268,8 +3364,8 @@ namespace dbx { /** * StandardBuilder is the builder that is used by DB for an unknown driver. */ - type _subrSRpD = BaseBuilder - interface StandardBuilder extends _subrSRpD { + type _subwihYq = BaseBuilder + interface StandardBuilder extends _subwihYq { } interface newStandardBuilder { /** @@ -3335,8 +3431,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 _subfOzrJ = Builder - interface DB extends _subfOzrJ { + type _suburejI = Builder + interface DB extends _suburejI { /** * FieldMapper maps struct fields to DB columns. Defaults to DefaultFieldMapFunc. */ @@ -4134,8 +4230,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 _subHdEAg = sql.Rows - interface Rows extends _subHdEAg { + type _subHZTEr = sql.Rows + interface Rows extends _subHZTEr { } interface Rows { /** @@ -4492,8 +4588,8 @@ namespace dbx { }): string } interface structInfo { } - type _submNwoT = structInfo - interface structValue extends _submNwoT { + type _subclwGU = structInfo + interface structValue extends _subclwGU { } interface fieldInfo { } @@ -4531,8 +4627,8 @@ namespace dbx { /** * Tx enhances sql.Tx with additional querying methods. */ - type _subdDnXC = Builder - interface Tx extends _subdDnXC { + type _subMIsIT = Builder + interface Tx extends _subMIsIT { } interface Tx { /** @@ -4548,182 +4644,6 @@ namespace dbx { } } -namespace security { - // @ts-ignore - import crand = rand - interface s256Challenge { - /** - * S256Challenge creates base64 encoded sha256 challenge string derived from code. - * The padding of the result base64 string is stripped per [RFC 7636]. - * - * [RFC 7636]: https://datatracker.ietf.org/doc/html/rfc7636#section-4.2 - */ - (code: string): string - } - interface encrypt { - /** - * Encrypt encrypts data with key (must be valid 32 char aes key). - */ - (data: string, key: string): string - } - interface decrypt { - /** - * Decrypt decrypts encrypted text with key (must be valid 32 chars aes key). - */ - (cipherText: string, key: string): string - } - interface parseUnverifiedJWT { - /** - * ParseUnverifiedJWT parses JWT token and returns its claims - * but DOES NOT verify the signature. - * - * It verifies only the exp, iat and nbf claims. - */ - (token: string): jwt.MapClaims - } - interface parseJWT { - /** - * ParseJWT verifies and parses JWT token and returns its claims. - */ - (token: string, verificationKey: string): jwt.MapClaims - } - interface newJWT { - /** - * NewJWT generates and returns new HS256 signed JWT token. - */ - (payload: jwt.MapClaims, signingKey: string, secondsDuration: number): string - } - interface newToken { - /** - * Deprecated: - * Consider replacing with NewJWT(). - * - * NewToken is a legacy alias for NewJWT that generates a HS256 signed JWT token. - */ - (payload: jwt.MapClaims, signingKey: string, secondsDuration: number): string - } - // @ts-ignore - import cryptoRand = rand - // @ts-ignore - import mathRand = rand - interface randomString { - /** - * RandomString generates a cryptographically random string with the specified length. - * - * The generated string matches [A-Za-z0-9]+ and it's transparent to URL-encoding. - */ - (length: number): string - } - interface randomStringWithAlphabet { - /** - * RandomStringWithAlphabet generates a cryptographically random string - * with the specified length and characters set. - * - * It panics if for some reason rand.Int returns a non-nil error. - */ - (length: number, alphabet: string): string - } - interface pseudorandomString { - /** - * PseudorandomString generates a pseudorandom string with the specified length. - * - * The generated string matches [A-Za-z0-9]+ and it's transparent to URL-encoding. - * - * For a cryptographically random string (but a little bit slower) use RandomString instead. - */ - (length: number): string - } - interface pseudorandomStringWithAlphabet { - /** - * PseudorandomStringWithAlphabet generates a pseudorandom string - * with the specified length and characters set. - * - * For a cryptographically random (but a little bit slower) use RandomStringWithAlphabet instead. - */ - (length: number, alphabet: string): string - } -} - -/** - * Package template is a thin wrapper arround 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 blank templates registry. - * - * Use the Registry.Load* methods to load templates into the registry. - */ - (): (Registry | undefined) - } - /** - * 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 { - /** - * 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 | undefined) - } - 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 | undefined) - } - interface Registry { - /** - * LoadString 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(fs: fs.FS, ...globPatterns: string[]): (Renderer | undefined) - } - /** - * 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 filesystem { /** * FileReader defines an interface for a file resource reader. @@ -4796,8 +4716,8 @@ namespace filesystem { */ open(): io.ReadSeekCloser } - type _subMlzdm = bytes.Reader - interface bytesReadSeekCloser extends _subMlzdm { + type _subGrsQI = bytes.Reader + interface bytesReadSeekCloser extends _subGrsQI { } interface bytesReadSeekCloser { /** @@ -5855,8 +5775,8 @@ namespace forms { /** * SettingsUpsert is a [settings.Settings] upsert (create/update) form. */ - type _subLPviZ = settings.Settings - interface SettingsUpsert extends _subLPviZ { + type _subqjPhT = settings.Settings + interface SettingsUpsert extends _subqjPhT { } interface newSettingsUpsert { /** @@ -6252,8 +6172,8 @@ namespace pocketbase { /** * appWrapper serves as a private core.App instance wrapper. */ - type _subxRQgd = core.App - interface appWrapper extends _subxRQgd { + type _subBwhHt = core.App + interface appWrapper extends _subBwhHt { } /** * PocketBase defines a PocketBase app launcher. @@ -6261,8 +6181,8 @@ namespace pocketbase { * It implements [core.App] via embedding and all of the app interface methods * could be accessed directly through the instance (eg. PocketBase.DataDir()). */ - type _subcrHdR = appWrapper - interface PocketBase extends _subcrHdR { + type _subVHZJG = appWrapper + interface PocketBase extends _subVHZJG { /** * RootCmd is the main console command */ @@ -6334,6 +6254,86 @@ namespace pocketbase { } } +/** + * Package template is a thin wrapper arround 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 blank templates registry. + * + * Use the Registry.Load* methods to load templates into the registry. + */ + (): (Registry | undefined) + } + /** + * 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 { + /** + * 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 | undefined) + } + 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 | undefined) + } + interface Registry { + /** + * LoadString 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(fs: fs.FS, ...globPatterns: string[]): (Renderer | undefined) + } + /** + * 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 io provides basic interfaces to I/O primitives. * Its primary job is to wrap existing implementations of such primitives, @@ -7864,7 +7864,7 @@ namespace http { * otherwise it leaves the field nil. * This field is ignored by the HTTP client. */ - tls?: tls.ConnectionState + tls?: any /** * Cancel is an optional channel whose closure indicates that the client * request should be regarded as canceled. Not all implementations of @@ -8200,7 +8200,7 @@ namespace http { * SetSessionTicketKeys, use Server.Serve with a TLS Listener * instead. */ - tlsConfig?: tls.Config + tlsConfig?: any /** * ReadTimeout is the maximum duration for reading the entire * request, including the body. A zero or negative value means @@ -8268,7 +8268,7 @@ namespace http { * underlying FileSystem errors. * If nil, logging is done via the log package's standard logger. */ - errorLog?: log.Logger + errorLog?: any /** * BaseContext optionally specifies a function that returns * the base context for incoming requests on this server. @@ -8412,871 +8412,6 @@ namespace http { } } -/** - * Package blob provides an easy and portable way to interact with blobs - * within a storage location. Subpackages contain driver implementations of - * blob for supported services. - * - * See https://gocloud.dev/howto/blob/ for a detailed how-to guide. - * - * *blob.Bucket implements io/fs.FS and io/fs.SubFS, so it can be used with - * functions in that package. - * - * # Errors - * - * The errors returned from this package can be inspected in several ways: - * - * The Code function from gocloud.dev/gcerrors will return an error code, also - * defined in that package, when invoked on an error. - * - * The Bucket.ErrorAs method can retrieve the driver error underlying the returned - * error. - * - * # OpenCensus Integration - * - * OpenCensus supports tracing and metric collection for multiple languages and - * backend providers. See https://opencensus.io. - * - * This API collects OpenCensus traces and metrics for the following methods: - * ``` - * - Attributes - * - Copy - * - Delete - * - ListPage - * - NewRangeReader, from creation until the call to Close. (NewReader and ReadAll - * are included because they call NewRangeReader.) - * - NewWriter, from creation until the call to Close. - * ``` - * - * All trace and metric names begin with the package import path. - * The traces add the method name. - * For example, "gocloud.dev/blob/Attributes". - * The metrics are "completed_calls", a count of completed method calls by driver, - * method and status (error code); and "latency", a distribution of method latency - * by driver and method. - * For example, "gocloud.dev/blob/latency". - * - * It also collects the following metrics: - * ``` - * - gocloud.dev/blob/bytes_read: the total number of bytes read, by driver. - * - gocloud.dev/blob/bytes_written: the total number of bytes written, by driver. - * ``` - * - * To enable trace collection in your application, see "Configure Exporter" at - * https://opencensus.io/quickstart/go/tracing. - * To enable metric collection in your application, see "Exporting stats" at - * https://opencensus.io/quickstart/go/metrics. - */ -namespace blob { - /** - * 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): 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 { - /** - * As converts i to driver-specific types. - * See https://gocloud.dev/concepts/as/ for background information, the "As" - * examples in this package for examples, and the driver package - * documentation for the specific types supported for that driver. - */ - as(i: { - }): boolean - } - 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 - } - /** - * 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 - /** - * ETag for the blob; see https://en.wikipedia.org/wiki/HTTP_ETag. - */ - eTag: string - } - interface Attributes { - /** - * As converts i to driver-specific types. - * See https://gocloud.dev/concepts/as/ for background information, the "As" - * examples in this package for examples, and the driver package - * documentation for the specific types supported for that driver. - */ - as(i: { - }): boolean - } - /** - * ListObject represents a single blob returned from List. - */ - interface ListObject { - /** - * 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 - /** - * 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 - } - interface ListObject { - /** - * As converts i to driver-specific types. - * See https://gocloud.dev/concepts/as/ for background information, the "As" - * examples in this package for examples, and the driver package - * documentation for the specific types supported for that driver. - */ - as(i: { - }): boolean - } -} - -/** - * Package sql provides a generic interface around SQL (or SQL-like) - * databases. - * - * The sql package must be used in conjunction with a database driver. - * See https://golang.org/s/sqldrivers for a list of drivers. - * - * Drivers that do not support context cancellation will not return until - * after the query is completed. - * - * For usage examples, see the wiki page at - * https://golang.org/s/sqlwiki. - */ -namespace sql { - /** - * TxOptions holds the transaction options to be used in DB.BeginTx. - */ - interface TxOptions { - /** - * Isolation is the transaction isolation level. - * If zero, the driver or database's default level is used. - */ - isolation: IsolationLevel - readOnly: boolean - } - /** - * DB is a database handle representing a pool of zero or more - * underlying connections. It's safe for concurrent use by multiple - * goroutines. - * - * The sql package creates and frees connections automatically; it - * also maintains a free pool of idle connections. If the database has - * a concept of per-connection state, such state can be reliably observed - * within a transaction (Tx) or connection (Conn). Once DB.Begin is called, the - * returned Tx is bound to a single connection. Once Commit or - * Rollback is called on the transaction, that transaction's - * connection is returned to DB's idle connection pool. The pool size - * can be controlled with SetMaxIdleConns. - */ - interface DB { - } - interface DB { - /** - * PingContext verifies a connection to the database is still alive, - * establishing a connection if necessary. - */ - pingContext(ctx: context.Context): void - } - interface DB { - /** - * Ping verifies a connection to the database is still alive, - * establishing a connection if necessary. - * - * Ping uses context.Background internally; to specify the context, use - * PingContext. - */ - ping(): void - } - interface DB { - /** - * Close closes the database and prevents new queries from starting. - * Close then waits for all queries that have started processing on the server - * to finish. - * - * It is rare to Close a DB, as the DB handle is meant to be - * long-lived and shared between many goroutines. - */ - close(): void - } - interface DB { - /** - * SetMaxIdleConns sets the maximum number of connections in the idle - * connection pool. - * - * If MaxOpenConns is greater than 0 but less than the new MaxIdleConns, - * then the new MaxIdleConns will be reduced to match the MaxOpenConns limit. - * - * If n <= 0, no idle connections are retained. - * - * The default max idle connections is currently 2. This may change in - * a future release. - */ - setMaxIdleConns(n: number): void - } - interface DB { - /** - * SetMaxOpenConns sets the maximum number of open connections to the database. - * - * If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than - * MaxIdleConns, then MaxIdleConns will be reduced to match the new - * MaxOpenConns limit. - * - * If n <= 0, then there is no limit on the number of open connections. - * The default is 0 (unlimited). - */ - setMaxOpenConns(n: number): void - } - interface DB { - /** - * SetConnMaxLifetime sets the maximum amount of time a connection may be reused. - * - * Expired connections may be closed lazily before reuse. - * - * If d <= 0, connections are not closed due to a connection's age. - */ - setConnMaxLifetime(d: time.Duration): void - } - interface DB { - /** - * SetConnMaxIdleTime sets the maximum amount of time a connection may be idle. - * - * Expired connections may be closed lazily before reuse. - * - * If d <= 0, connections are not closed due to a connection's idle time. - */ - setConnMaxIdleTime(d: time.Duration): void - } - interface DB { - /** - * Stats returns database statistics. - */ - stats(): DBStats - } - interface DB { - /** - * PrepareContext creates a prepared statement for later queries or executions. - * Multiple queries or executions may be run concurrently from the - * returned statement. - * The caller must call the statement's Close method - * when the statement is no longer needed. - * - * The provided context is used for the preparation of the statement, not for the - * execution of the statement. - */ - prepareContext(ctx: context.Context, query: string): (Stmt | undefined) - } - interface DB { - /** - * Prepare creates a prepared statement for later queries or executions. - * Multiple queries or executions may be run concurrently from the - * returned statement. - * The caller must call the statement's Close method - * when the statement is no longer needed. - * - * Prepare uses context.Background internally; to specify the context, use - * PrepareContext. - */ - prepare(query: string): (Stmt | undefined) - } - interface DB { - /** - * ExecContext executes a query without returning any rows. - * The args are for any placeholder parameters in the query. - */ - execContext(ctx: context.Context, query: string, ...args: any[]): Result - } - interface DB { - /** - * Exec executes a query without returning any rows. - * The args are for any placeholder parameters in the query. - * - * Exec uses context.Background internally; to specify the context, use - * ExecContext. - */ - exec(query: string, ...args: any[]): Result - } - interface DB { - /** - * QueryContext executes a query that returns rows, typically a SELECT. - * The args are for any placeholder parameters in the query. - */ - queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined) - } - interface DB { - /** - * Query executes a query that returns rows, typically a SELECT. - * The args are for any placeholder parameters in the query. - * - * Query uses context.Background internally; to specify the context, use - * QueryContext. - */ - query(query: string, ...args: any[]): (Rows | undefined) - } - interface DB { - /** - * QueryRowContext executes a query that is expected to return at most one row. - * QueryRowContext always returns a non-nil value. Errors are deferred until - * Row's Scan method is called. - * If the query selects no rows, the *Row's Scan will return ErrNoRows. - * Otherwise, the *Row's Scan scans the first selected row and discards - * the rest. - */ - queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined) - } - interface DB { - /** - * QueryRow executes a query that is expected to return at most one row. - * QueryRow always returns a non-nil value. Errors are deferred until - * Row's Scan method is called. - * If the query selects no rows, the *Row's Scan will return ErrNoRows. - * Otherwise, the *Row's Scan scans the first selected row and discards - * the rest. - * - * QueryRow uses context.Background internally; to specify the context, use - * QueryRowContext. - */ - queryRow(query: string, ...args: any[]): (Row | undefined) - } - interface DB { - /** - * BeginTx starts a transaction. - * - * The provided context is used until the transaction is committed or rolled back. - * If the context is canceled, the sql package will roll back - * the transaction. Tx.Commit will return an error if the context provided to - * BeginTx is canceled. - * - * The provided TxOptions is optional and may be nil if defaults should be used. - * If a non-default isolation level is used that the driver doesn't support, - * an error will be returned. - */ - beginTx(ctx: context.Context, opts: TxOptions): (Tx | undefined) - } - interface DB { - /** - * Begin starts a transaction. The default isolation level is dependent on - * the driver. - * - * Begin uses context.Background internally; to specify the context, use - * BeginTx. - */ - begin(): (Tx | undefined) - } - interface DB { - /** - * Driver returns the database's underlying driver. - */ - driver(): driver.Driver - } - interface DB { - /** - * Conn returns a single connection by either opening a new connection - * or returning an existing connection from the connection pool. Conn will - * block until either a connection is returned or ctx is canceled. - * Queries run on the same Conn will be run in the same database session. - * - * Every Conn must be returned to the database pool after use by - * calling Conn.Close. - */ - conn(ctx: context.Context): (Conn | undefined) - } - /** - * Tx is an in-progress database transaction. - * - * A transaction must end with a call to Commit or Rollback. - * - * After a call to Commit or Rollback, all operations on the - * transaction fail with ErrTxDone. - * - * The statements prepared for a transaction by calling - * the transaction's Prepare or Stmt methods are closed - * by the call to Commit or Rollback. - */ - interface Tx { - } - interface Tx { - /** - * Commit commits the transaction. - */ - commit(): void - } - interface Tx { - /** - * Rollback aborts the transaction. - */ - rollback(): void - } - interface Tx { - /** - * PrepareContext creates a prepared statement for use within a transaction. - * - * The returned statement operates within the transaction and will be closed - * when the transaction has been committed or rolled back. - * - * To use an existing prepared statement on this transaction, see Tx.Stmt. - * - * The provided context will be used for the preparation of the context, not - * for the execution of the returned statement. The returned statement - * will run in the transaction context. - */ - prepareContext(ctx: context.Context, query: string): (Stmt | undefined) - } - interface Tx { - /** - * Prepare creates a prepared statement for use within a transaction. - * - * The returned statement operates within the transaction and will be closed - * when the transaction has been committed or rolled back. - * - * To use an existing prepared statement on this transaction, see Tx.Stmt. - * - * Prepare uses context.Background internally; to specify the context, use - * PrepareContext. - */ - prepare(query: string): (Stmt | undefined) - } - interface Tx { - /** - * StmtContext returns a transaction-specific prepared statement from - * an existing statement. - * - * Example: - * updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?") - * ... - * tx, err := db.Begin() - * ... - * res, err := tx.StmtContext(ctx, updateMoney).Exec(123.45, 98293203) - * - * The provided context is used for the preparation of the statement, not for the - * execution of the statement. - * - * The returned statement operates within the transaction and will be closed - * when the transaction has been committed or rolled back. - */ - stmtContext(ctx: context.Context, stmt: Stmt): (Stmt | undefined) - } - interface Tx { - /** - * Stmt returns a transaction-specific prepared statement from - * an existing statement. - * - * Example: - * updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?") - * ... - * tx, err := db.Begin() - * ... - * res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203) - * - * The returned statement operates within the transaction and will be closed - * when the transaction has been committed or rolled back. - * - * Stmt uses context.Background internally; to specify the context, use - * StmtContext. - */ - stmt(stmt: Stmt): (Stmt | undefined) - } - interface Tx { - /** - * ExecContext executes a query that doesn't return rows. - * For example: an INSERT and UPDATE. - */ - execContext(ctx: context.Context, query: string, ...args: any[]): Result - } - interface Tx { - /** - * Exec executes a query that doesn't return rows. - * For example: an INSERT and UPDATE. - * - * Exec uses context.Background internally; to specify the context, use - * ExecContext. - */ - exec(query: string, ...args: any[]): Result - } - interface Tx { - /** - * QueryContext executes a query that returns rows, typically a SELECT. - */ - queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined) - } - interface Tx { - /** - * Query executes a query that returns rows, typically a SELECT. - * - * Query uses context.Background internally; to specify the context, use - * QueryContext. - */ - query(query: string, ...args: any[]): (Rows | undefined) - } - interface Tx { - /** - * QueryRowContext executes a query that is expected to return at most one row. - * QueryRowContext always returns a non-nil value. Errors are deferred until - * Row's Scan method is called. - * If the query selects no rows, the *Row's Scan will return ErrNoRows. - * Otherwise, the *Row's Scan scans the first selected row and discards - * the rest. - */ - queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined) - } - interface Tx { - /** - * QueryRow executes a query that is expected to return at most one row. - * QueryRow always returns a non-nil value. Errors are deferred until - * Row's Scan method is called. - * If the query selects no rows, the *Row's Scan will return ErrNoRows. - * Otherwise, the *Row's Scan scans the first selected row and discards - * the rest. - * - * QueryRow uses context.Background internally; to specify the context, use - * QueryRowContext. - */ - queryRow(query: string, ...args: any[]): (Row | undefined) - } - /** - * Stmt is a prepared statement. - * A Stmt is safe for concurrent use by multiple goroutines. - * - * If a Stmt is prepared on a Tx or Conn, it will be bound to a single - * underlying connection forever. If the Tx or Conn closes, the Stmt will - * become unusable and all operations will return an error. - * If a Stmt is prepared on a DB, it will remain usable for the lifetime of the - * DB. When the Stmt needs to execute on a new underlying connection, it will - * prepare itself on the new connection automatically. - */ - interface Stmt { - } - interface Stmt { - /** - * ExecContext executes a prepared statement with the given arguments and - * returns a Result summarizing the effect of the statement. - */ - execContext(ctx: context.Context, ...args: any[]): Result - } - interface Stmt { - /** - * Exec executes a prepared statement with the given arguments and - * returns a Result summarizing the effect of the statement. - * - * Exec uses context.Background internally; to specify the context, use - * ExecContext. - */ - exec(...args: any[]): Result - } - interface Stmt { - /** - * QueryContext executes a prepared query statement with the given arguments - * and returns the query results as a *Rows. - */ - queryContext(ctx: context.Context, ...args: any[]): (Rows | undefined) - } - interface Stmt { - /** - * Query executes a prepared query statement with the given arguments - * and returns the query results as a *Rows. - * - * Query uses context.Background internally; to specify the context, use - * QueryContext. - */ - query(...args: any[]): (Rows | undefined) - } - interface Stmt { - /** - * QueryRowContext executes a prepared query statement with the given arguments. - * If an error occurs during the execution of the statement, that error will - * be returned by a call to Scan on the returned *Row, which is always non-nil. - * If the query selects no rows, the *Row's Scan will return ErrNoRows. - * Otherwise, the *Row's Scan scans the first selected row and discards - * the rest. - */ - queryRowContext(ctx: context.Context, ...args: any[]): (Row | undefined) - } - interface Stmt { - /** - * QueryRow executes a prepared query statement with the given arguments. - * If an error occurs during the execution of the statement, that error will - * be returned by a call to Scan on the returned *Row, which is always non-nil. - * If the query selects no rows, the *Row's Scan will return ErrNoRows. - * Otherwise, the *Row's Scan scans the first selected row and discards - * the rest. - * - * Example usage: - * - * var name string - * err := nameByUseridStmt.QueryRow(id).Scan(&name) - * - * QueryRow uses context.Background internally; to specify the context, use - * QueryRowContext. - */ - queryRow(...args: any[]): (Row | undefined) - } - interface Stmt { - /** - * Close closes the statement. - */ - close(): void - } - /** - * Rows is the result of a query. Its cursor starts before the first row - * of the result set. Use Next to advance from row to row. - */ - interface Rows { - } - interface Rows { - /** - * Next prepares the next result row for reading with the Scan method. It - * returns true on success, or false if there is no next result row or an error - * happened while preparing it. Err should be consulted to distinguish between - * the two cases. - * - * Every call to Scan, even the first one, must be preceded by a call to Next. - */ - next(): boolean - } - interface Rows { - /** - * NextResultSet prepares the next result set for reading. It reports whether - * there is further result sets, or false if there is no further result set - * or if there is an error advancing to it. The Err method should be consulted - * to distinguish between the two cases. - * - * After calling NextResultSet, the Next method should always be called before - * scanning. If there are further result sets they may not have rows in the result - * set. - */ - nextResultSet(): boolean - } - interface Rows { - /** - * Err returns the error, if any, that was encountered during iteration. - * Err may be called after an explicit or implicit Close. - */ - err(): void - } - interface Rows { - /** - * Columns returns the column names. - * Columns returns an error if the rows are closed. - */ - columns(): Array - } - interface Rows { - /** - * ColumnTypes returns column information such as column type, length, - * and nullable. Some information may not be available from some drivers. - */ - columnTypes(): Array<(ColumnType | undefined)> - } - interface Rows { - /** - * Scan copies the columns in the current row into the values pointed - * at by dest. The number of values in dest must be the same as the - * number of columns in Rows. - * - * Scan converts columns read from the database into the following - * common Go types and special types provided by the sql package: - * - * ``` - * *string - * *[]byte - * *int, *int8, *int16, *int32, *int64 - * *uint, *uint8, *uint16, *uint32, *uint64 - * *bool - * *float32, *float64 - * *interface{} - * *RawBytes - * *Rows (cursor value) - * any type implementing Scanner (see Scanner docs) - * ``` - * - * In the most simple case, if the type of the value from the source - * column is an integer, bool or string type T and dest is of type *T, - * Scan simply assigns the value through the pointer. - * - * Scan also converts between string and numeric types, as long as no - * information would be lost. While Scan stringifies all numbers - * scanned from numeric database columns into *string, scans into - * numeric types are checked for overflow. For example, a float64 with - * value 300 or a string with value "300" can scan into a uint16, but - * not into a uint8, though float64(255) or "255" can scan into a - * uint8. One exception is that scans of some float64 numbers to - * strings may lose information when stringifying. In general, scan - * floating point columns into *float64. - * - * If a dest argument has type *[]byte, Scan saves in that argument a - * copy of the corresponding data. The copy is owned by the caller and - * can be modified and held indefinitely. The copy can be avoided by - * using an argument of type *RawBytes instead; see the documentation - * for RawBytes for restrictions on its use. - * - * If an argument has type *interface{}, Scan copies the value - * provided by the underlying driver without conversion. When scanning - * from a source value of type []byte to *interface{}, a copy of the - * slice is made and the caller owns the result. - * - * Source values of type time.Time may be scanned into values of type - * *time.Time, *interface{}, *string, or *[]byte. When converting to - * the latter two, time.RFC3339Nano is used. - * - * Source values of type bool may be scanned into types *bool, - * *interface{}, *string, *[]byte, or *RawBytes. - * - * For scanning into *bool, the source may be true, false, 1, 0, or - * string inputs parseable by strconv.ParseBool. - * - * Scan can also convert a cursor returned from a query, such as - * "select cursor(select * from my_table) from dual", into a - * *Rows value that can itself be scanned from. The parent - * select query will close any cursor *Rows if the parent *Rows is closed. - * - * If any of the first arguments implementing Scanner returns an error, - * that error will be wrapped in the returned error - */ - scan(...dest: any[]): void - } - interface Rows { - /** - * Close closes the Rows, preventing further enumeration. If Next is called - * and returns false and there are no further result sets, - * the Rows are closed automatically and it will suffice to check the - * result of Err. Close is idempotent and does not affect the result of Err. - */ - close(): void - } - /** - * A Result summarizes an executed SQL command. - */ - interface Result { - /** - * LastInsertId returns the integer generated by the database - * in response to a command. Typically this will be from an - * "auto increment" column when inserting a new row. Not all - * databases support this feature, and the syntax of such - * statements varies. - */ - lastInsertId(): number - /** - * RowsAffected returns the number of rows affected by an - * update, insert, or delete. Not every database or database - * driver may support this. - */ - rowsAffected(): number - } -} - /** * Package echo implements high performance, minimalist Go web framework. * @@ -10081,6 +9216,1707 @@ namespace exec { } } +/** + * Package sql provides a generic interface around SQL (or SQL-like) + * databases. + * + * The sql package must be used in conjunction with a database driver. + * See https://golang.org/s/sqldrivers for a list of drivers. + * + * Drivers that do not support context cancellation will not return until + * after the query is completed. + * + * For usage examples, see the wiki page at + * https://golang.org/s/sqlwiki. + */ +namespace sql { + /** + * TxOptions holds the transaction options to be used in DB.BeginTx. + */ + interface TxOptions { + /** + * Isolation is the transaction isolation level. + * If zero, the driver or database's default level is used. + */ + isolation: IsolationLevel + readOnly: boolean + } + /** + * DB is a database handle representing a pool of zero or more + * underlying connections. It's safe for concurrent use by multiple + * goroutines. + * + * The sql package creates and frees connections automatically; it + * also maintains a free pool of idle connections. If the database has + * a concept of per-connection state, such state can be reliably observed + * within a transaction (Tx) or connection (Conn). Once DB.Begin is called, the + * returned Tx is bound to a single connection. Once Commit or + * Rollback is called on the transaction, that transaction's + * connection is returned to DB's idle connection pool. The pool size + * can be controlled with SetMaxIdleConns. + */ + interface DB { + } + interface DB { + /** + * PingContext verifies a connection to the database is still alive, + * establishing a connection if necessary. + */ + pingContext(ctx: context.Context): void + } + interface DB { + /** + * Ping verifies a connection to the database is still alive, + * establishing a connection if necessary. + * + * Ping uses context.Background internally; to specify the context, use + * PingContext. + */ + ping(): void + } + interface DB { + /** + * Close closes the database and prevents new queries from starting. + * Close then waits for all queries that have started processing on the server + * to finish. + * + * It is rare to Close a DB, as the DB handle is meant to be + * long-lived and shared between many goroutines. + */ + close(): void + } + interface DB { + /** + * SetMaxIdleConns sets the maximum number of connections in the idle + * connection pool. + * + * If MaxOpenConns is greater than 0 but less than the new MaxIdleConns, + * then the new MaxIdleConns will be reduced to match the MaxOpenConns limit. + * + * If n <= 0, no idle connections are retained. + * + * The default max idle connections is currently 2. This may change in + * a future release. + */ + setMaxIdleConns(n: number): void + } + interface DB { + /** + * SetMaxOpenConns sets the maximum number of open connections to the database. + * + * If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than + * MaxIdleConns, then MaxIdleConns will be reduced to match the new + * MaxOpenConns limit. + * + * If n <= 0, then there is no limit on the number of open connections. + * The default is 0 (unlimited). + */ + setMaxOpenConns(n: number): void + } + interface DB { + /** + * SetConnMaxLifetime sets the maximum amount of time a connection may be reused. + * + * Expired connections may be closed lazily before reuse. + * + * If d <= 0, connections are not closed due to a connection's age. + */ + setConnMaxLifetime(d: time.Duration): void + } + interface DB { + /** + * SetConnMaxIdleTime sets the maximum amount of time a connection may be idle. + * + * Expired connections may be closed lazily before reuse. + * + * If d <= 0, connections are not closed due to a connection's idle time. + */ + setConnMaxIdleTime(d: time.Duration): void + } + interface DB { + /** + * Stats returns database statistics. + */ + stats(): DBStats + } + interface DB { + /** + * PrepareContext creates a prepared statement for later queries or executions. + * Multiple queries or executions may be run concurrently from the + * returned statement. + * The caller must call the statement's Close method + * when the statement is no longer needed. + * + * The provided context is used for the preparation of the statement, not for the + * execution of the statement. + */ + prepareContext(ctx: context.Context, query: string): (Stmt | undefined) + } + interface DB { + /** + * Prepare creates a prepared statement for later queries or executions. + * Multiple queries or executions may be run concurrently from the + * returned statement. + * The caller must call the statement's Close method + * when the statement is no longer needed. + * + * Prepare uses context.Background internally; to specify the context, use + * PrepareContext. + */ + prepare(query: string): (Stmt | undefined) + } + interface DB { + /** + * ExecContext executes a query without returning any rows. + * The args are for any placeholder parameters in the query. + */ + execContext(ctx: context.Context, query: string, ...args: any[]): Result + } + interface DB { + /** + * Exec executes a query without returning any rows. + * The args are for any placeholder parameters in the query. + * + * Exec uses context.Background internally; to specify the context, use + * ExecContext. + */ + exec(query: string, ...args: any[]): Result + } + interface DB { + /** + * QueryContext executes a query that returns rows, typically a SELECT. + * The args are for any placeholder parameters in the query. + */ + queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined) + } + interface DB { + /** + * Query executes a query that returns rows, typically a SELECT. + * The args are for any placeholder parameters in the query. + * + * Query uses context.Background internally; to specify the context, use + * QueryContext. + */ + query(query: string, ...args: any[]): (Rows | undefined) + } + interface DB { + /** + * QueryRowContext executes a query that is expected to return at most one row. + * QueryRowContext always returns a non-nil value. Errors are deferred until + * Row's Scan method is called. + * If the query selects no rows, the *Row's Scan will return ErrNoRows. + * Otherwise, the *Row's Scan scans the first selected row and discards + * the rest. + */ + queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined) + } + interface DB { + /** + * QueryRow executes a query that is expected to return at most one row. + * QueryRow always returns a non-nil value. Errors are deferred until + * Row's Scan method is called. + * If the query selects no rows, the *Row's Scan will return ErrNoRows. + * Otherwise, the *Row's Scan scans the first selected row and discards + * the rest. + * + * QueryRow uses context.Background internally; to specify the context, use + * QueryRowContext. + */ + queryRow(query: string, ...args: any[]): (Row | undefined) + } + interface DB { + /** + * BeginTx starts a transaction. + * + * The provided context is used until the transaction is committed or rolled back. + * If the context is canceled, the sql package will roll back + * the transaction. Tx.Commit will return an error if the context provided to + * BeginTx is canceled. + * + * The provided TxOptions is optional and may be nil if defaults should be used. + * If a non-default isolation level is used that the driver doesn't support, + * an error will be returned. + */ + beginTx(ctx: context.Context, opts: TxOptions): (Tx | undefined) + } + interface DB { + /** + * Begin starts a transaction. The default isolation level is dependent on + * the driver. + * + * Begin uses context.Background internally; to specify the context, use + * BeginTx. + */ + begin(): (Tx | undefined) + } + interface DB { + /** + * Driver returns the database's underlying driver. + */ + driver(): 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 | undefined) + } + /** + * Tx is an in-progress database transaction. + * + * A transaction must end with a call to Commit or Rollback. + * + * After a call to Commit or Rollback, all operations on the + * transaction fail with ErrTxDone. + * + * The statements prepared for a transaction by calling + * the transaction's Prepare or Stmt methods are closed + * by the call to Commit or Rollback. + */ + interface Tx { + } + interface Tx { + /** + * Commit commits the transaction. + */ + commit(): void + } + interface Tx { + /** + * Rollback aborts the transaction. + */ + rollback(): void + } + interface Tx { + /** + * PrepareContext creates a prepared statement for use within a transaction. + * + * The returned statement operates within the transaction and will be closed + * when the transaction has been committed or rolled back. + * + * To use an existing prepared statement on this transaction, see Tx.Stmt. + * + * The provided context will be used for the preparation of the context, not + * for the execution of the returned statement. The returned statement + * will run in the transaction context. + */ + prepareContext(ctx: context.Context, query: string): (Stmt | undefined) + } + interface Tx { + /** + * Prepare creates a prepared statement for use within a transaction. + * + * The returned statement operates within the transaction and will be closed + * when the transaction has been committed or rolled back. + * + * To use an existing prepared statement on this transaction, see Tx.Stmt. + * + * Prepare uses context.Background internally; to specify the context, use + * PrepareContext. + */ + prepare(query: string): (Stmt | undefined) + } + interface Tx { + /** + * StmtContext returns a transaction-specific prepared statement from + * an existing statement. + * + * Example: + * updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?") + * ... + * tx, err := db.Begin() + * ... + * res, err := tx.StmtContext(ctx, updateMoney).Exec(123.45, 98293203) + * + * The provided context is used for the preparation of the statement, not for the + * execution of the statement. + * + * The returned statement operates within the transaction and will be closed + * when the transaction has been committed or rolled back. + */ + stmtContext(ctx: context.Context, stmt: Stmt): (Stmt | undefined) + } + interface Tx { + /** + * Stmt returns a transaction-specific prepared statement from + * an existing statement. + * + * Example: + * updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?") + * ... + * tx, err := db.Begin() + * ... + * res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203) + * + * The returned statement operates within the transaction and will be closed + * when the transaction has been committed or rolled back. + * + * Stmt uses context.Background internally; to specify the context, use + * StmtContext. + */ + stmt(stmt: Stmt): (Stmt | undefined) + } + interface Tx { + /** + * ExecContext executes a query that doesn't return rows. + * For example: an INSERT and UPDATE. + */ + execContext(ctx: context.Context, query: string, ...args: any[]): Result + } + interface Tx { + /** + * Exec executes a query that doesn't return rows. + * For example: an INSERT and UPDATE. + * + * Exec uses context.Background internally; to specify the context, use + * ExecContext. + */ + exec(query: string, ...args: any[]): Result + } + interface Tx { + /** + * QueryContext executes a query that returns rows, typically a SELECT. + */ + queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined) + } + interface Tx { + /** + * Query executes a query that returns rows, typically a SELECT. + * + * Query uses context.Background internally; to specify the context, use + * QueryContext. + */ + query(query: string, ...args: any[]): (Rows | undefined) + } + interface Tx { + /** + * QueryRowContext executes a query that is expected to return at most one row. + * QueryRowContext always returns a non-nil value. Errors are deferred until + * Row's Scan method is called. + * If the query selects no rows, the *Row's Scan will return ErrNoRows. + * Otherwise, the *Row's Scan scans the first selected row and discards + * the rest. + */ + queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined) + } + interface Tx { + /** + * QueryRow executes a query that is expected to return at most one row. + * QueryRow always returns a non-nil value. Errors are deferred until + * Row's Scan method is called. + * If the query selects no rows, the *Row's Scan will return ErrNoRows. + * Otherwise, the *Row's Scan scans the first selected row and discards + * the rest. + * + * QueryRow uses context.Background internally; to specify the context, use + * QueryRowContext. + */ + queryRow(query: string, ...args: any[]): (Row | undefined) + } + /** + * Stmt is a prepared statement. + * A Stmt is safe for concurrent use by multiple goroutines. + * + * If a Stmt is prepared on a Tx or Conn, it will be bound to a single + * underlying connection forever. If the Tx or Conn closes, the Stmt will + * become unusable and all operations will return an error. + * If a Stmt is prepared on a DB, it will remain usable for the lifetime of the + * DB. When the Stmt needs to execute on a new underlying connection, it will + * prepare itself on the new connection automatically. + */ + interface Stmt { + } + interface Stmt { + /** + * ExecContext executes a prepared statement with the given arguments and + * returns a Result summarizing the effect of the statement. + */ + execContext(ctx: context.Context, ...args: any[]): Result + } + interface Stmt { + /** + * Exec executes a prepared statement with the given arguments and + * returns a Result summarizing the effect of the statement. + * + * Exec uses context.Background internally; to specify the context, use + * ExecContext. + */ + exec(...args: any[]): Result + } + interface Stmt { + /** + * QueryContext executes a prepared query statement with the given arguments + * and returns the query results as a *Rows. + */ + queryContext(ctx: context.Context, ...args: any[]): (Rows | undefined) + } + interface Stmt { + /** + * Query executes a prepared query statement with the given arguments + * and returns the query results as a *Rows. + * + * Query uses context.Background internally; to specify the context, use + * QueryContext. + */ + query(...args: any[]): (Rows | undefined) + } + interface Stmt { + /** + * QueryRowContext executes a prepared query statement with the given arguments. + * If an error occurs during the execution of the statement, that error will + * be returned by a call to Scan on the returned *Row, which is always non-nil. + * If the query selects no rows, the *Row's Scan will return ErrNoRows. + * Otherwise, the *Row's Scan scans the first selected row and discards + * the rest. + */ + queryRowContext(ctx: context.Context, ...args: any[]): (Row | undefined) + } + interface Stmt { + /** + * QueryRow executes a prepared query statement with the given arguments. + * If an error occurs during the execution of the statement, that error will + * be returned by a call to Scan on the returned *Row, which is always non-nil. + * If the query selects no rows, the *Row's Scan will return ErrNoRows. + * Otherwise, the *Row's Scan scans the first selected row and discards + * the rest. + * + * Example usage: + * + * var name string + * err := nameByUseridStmt.QueryRow(id).Scan(&name) + * + * QueryRow uses context.Background internally; to specify the context, use + * QueryRowContext. + */ + queryRow(...args: any[]): (Row | undefined) + } + interface Stmt { + /** + * Close closes the statement. + */ + close(): void + } + /** + * Rows is the result of a query. Its cursor starts before the first row + * of the result set. Use Next to advance from row to row. + */ + interface Rows { + } + interface Rows { + /** + * Next prepares the next result row for reading with the Scan method. It + * returns true on success, or false if there is no next result row or an error + * happened while preparing it. Err should be consulted to distinguish between + * the two cases. + * + * Every call to Scan, even the first one, must be preceded by a call to Next. + */ + next(): boolean + } + interface Rows { + /** + * NextResultSet prepares the next result set for reading. It reports whether + * there is further result sets, or false if there is no further result set + * or if there is an error advancing to it. The Err method should be consulted + * to distinguish between the two cases. + * + * After calling NextResultSet, the Next method should always be called before + * scanning. If there are further result sets they may not have rows in the result + * set. + */ + nextResultSet(): boolean + } + interface Rows { + /** + * Err returns the error, if any, that was encountered during iteration. + * Err may be called after an explicit or implicit Close. + */ + err(): void + } + interface Rows { + /** + * Columns returns the column names. + * Columns returns an error if the rows are closed. + */ + columns(): Array + } + interface Rows { + /** + * ColumnTypes returns column information such as column type, length, + * and nullable. Some information may not be available from some drivers. + */ + columnTypes(): Array<(ColumnType | undefined)> + } + interface Rows { + /** + * Scan copies the columns in the current row into the values pointed + * at by dest. The number of values in dest must be the same as the + * number of columns in Rows. + * + * Scan converts columns read from the database into the following + * common Go types and special types provided by the sql package: + * + * ``` + * *string + * *[]byte + * *int, *int8, *int16, *int32, *int64 + * *uint, *uint8, *uint16, *uint32, *uint64 + * *bool + * *float32, *float64 + * *interface{} + * *RawBytes + * *Rows (cursor value) + * any type implementing Scanner (see Scanner docs) + * ``` + * + * In the most simple case, if the type of the value from the source + * column is an integer, bool or string type T and dest is of type *T, + * Scan simply assigns the value through the pointer. + * + * Scan also converts between string and numeric types, as long as no + * information would be lost. While Scan stringifies all numbers + * scanned from numeric database columns into *string, scans into + * numeric types are checked for overflow. For example, a float64 with + * value 300 or a string with value "300" can scan into a uint16, but + * not into a uint8, though float64(255) or "255" can scan into a + * uint8. One exception is that scans of some float64 numbers to + * strings may lose information when stringifying. In general, scan + * floating point columns into *float64. + * + * If a dest argument has type *[]byte, Scan saves in that argument a + * copy of the corresponding data. The copy is owned by the caller and + * can be modified and held indefinitely. The copy can be avoided by + * using an argument of type *RawBytes instead; see the documentation + * for RawBytes for restrictions on its use. + * + * If an argument has type *interface{}, Scan copies the value + * provided by the underlying driver without conversion. When scanning + * from a source value of type []byte to *interface{}, a copy of the + * slice is made and the caller owns the result. + * + * Source values of type time.Time may be scanned into values of type + * *time.Time, *interface{}, *string, or *[]byte. When converting to + * the latter two, time.RFC3339Nano is used. + * + * Source values of type bool may be scanned into types *bool, + * *interface{}, *string, *[]byte, or *RawBytes. + * + * For scanning into *bool, the source may be true, false, 1, 0, or + * string inputs parseable by strconv.ParseBool. + * + * Scan can also convert a cursor returned from a query, such as + * "select cursor(select * from my_table) from dual", into a + * *Rows value that can itself be scanned from. The parent + * select query will close any cursor *Rows if the parent *Rows is closed. + * + * If any of the first arguments implementing Scanner returns an error, + * that error will be wrapped in the returned error + */ + scan(...dest: any[]): void + } + interface Rows { + /** + * Close closes the Rows, preventing further enumeration. If Next is called + * and returns false and there are no further result sets, + * the Rows are closed automatically and it will suffice to check the + * result of Err. Close is idempotent and does not affect the result of Err. + */ + close(): void + } + /** + * A Result summarizes an executed SQL command. + */ + interface Result { + /** + * LastInsertId returns the integer generated by the database + * in response to a command. Typically this will be from an + * "auto increment" column when inserting a new row. Not all + * databases support this feature, and the syntax of such + * statements varies. + */ + lastInsertId(): number + /** + * RowsAffected returns the number of rows affected by an + * update, insert, or delete. Not every database or database + * driver may support this. + */ + rowsAffected(): number + } +} + +namespace migrate { + /** + * MigrationsList defines a list with migration definitions + */ + interface MigrationsList { + } + interface MigrationsList { + /** + * Item returns a single migration from the list by its index. + */ + item(index: number): (Migration | undefined) + } + interface MigrationsList { + /** + * Items returns the internal migrations list slice. + */ + items(): Array<(Migration | undefined)> + } + interface MigrationsList { + /** + * Register adds new migration definition to the list. + * + * If `optFilename` is not provided, it will try to get the name from its .go file. + * + * The list will be sorted automatically based on the migrations file name. + */ + register(up: (db: dbx.Builder) => void, down: (db: dbx.Builder) => void, ...optFilename: string[]): void + } +} + +/** + * Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces. + * In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code. + */ +namespace cobra { + interface Command { + /** + * GenBashCompletion generates bash completion file and writes to the passed writer. + */ + genBashCompletion(w: io.Writer): void + } + interface Command { + /** + * GenBashCompletionFile generates bash completion file. + */ + genBashCompletionFile(filename: string): void + } + interface Command { + /** + * GenBashCompletionFileV2 generates Bash completion version 2. + */ + genBashCompletionFileV2(filename: string, includeDesc: boolean): void + } + interface Command { + /** + * GenBashCompletionV2 generates Bash completion file version 2 + * and writes it to the passed writer. + */ + genBashCompletionV2(w: io.Writer, includeDesc: boolean): void + } + // @ts-ignore + import flag = pflag + /** + * Command is just that, a command for your application. + * E.g. 'go run ...' - 'run' is the command. Cobra requires + * you to define the usage and description as part of your command + * definition to ensure usability. + */ + interface Command { + /** + * Use is the one-line usage message. + * Recommended syntax is as follows: + * ``` + * [ ] identifies an optional argument. Arguments that are not enclosed in brackets are required. + * ... indicates that you can specify multiple values for the previous argument. + * | indicates mutually exclusive information. You can use the argument to the left of the separator or the + * argument to the right of the separator. You cannot use both arguments in a single use of the command. + * { } delimits a set of mutually exclusive arguments when one of the arguments is required. If the arguments are + * optional, they are enclosed in brackets ([ ]). + * ``` + * Example: add [-F file | -D dir]... [-f format] profile + */ + use: string + /** + * Aliases is an array of aliases that can be used instead of the first word in Use. + */ + aliases: Array + /** + * SuggestFor is an array of command names for which this command will be suggested - + * similar to aliases but only suggests. + */ + suggestFor: Array + /** + * Short is the short description shown in the 'help' output. + */ + short: string + /** + * The group id under which this subcommand is grouped in the 'help' output of its parent. + */ + groupID: string + /** + * Long is the long message shown in the 'help ' output. + */ + long: string + /** + * Example is examples of how to use the command. + */ + example: string + /** + * ValidArgs is list of all valid non-flag arguments that are accepted in shell completions + */ + validArgs: Array + /** + * ValidArgsFunction is an optional function that provides valid non-flag arguments for shell completion. + * It is a dynamic version of using ValidArgs. + * Only one of ValidArgs and ValidArgsFunction can be used for a command. + */ + validArgsFunction: (cmd: Command, args: Array, toComplete: string) => [Array, ShellCompDirective] + /** + * Expected arguments + */ + args: PositionalArgs + /** + * ArgAliases is List of aliases for ValidArgs. + * These are not suggested to the user in the shell completion, + * but accepted if entered manually. + */ + argAliases: Array + /** + * BashCompletionFunction is custom bash functions used by the legacy bash autocompletion generator. + * For portability with other shells, it is recommended to instead use ValidArgsFunction + */ + bashCompletionFunction: string + /** + * Deprecated defines, if this command is deprecated and should print this string when used. + */ + deprecated: string + /** + * Annotations are key/value pairs that can be used by applications to identify or + * group commands. + */ + annotations: _TygojaDict + /** + * Version defines the version for this command. If this value is non-empty and the command does not + * define a "version" flag, a "version" boolean flag will be added to the command and, if specified, + * will print content of the "Version" variable. A shorthand "v" flag will also be added if the + * command does not define one. + */ + version: string + /** + * The *Run functions are executed in the following order: + * ``` + * * PersistentPreRun() + * * PreRun() + * * Run() + * * PostRun() + * * PersistentPostRun() + * ``` + * All functions get the same args, the arguments after the command name. + * + * PersistentPreRun: children of this command will inherit and execute. + */ + persistentPreRun: (cmd: Command, args: Array) => void + /** + * PersistentPreRunE: PersistentPreRun but returns an error. + */ + persistentPreRunE: (cmd: Command, args: Array) => void + /** + * PreRun: children of this command will not inherit. + */ + preRun: (cmd: Command, args: Array) => void + /** + * PreRunE: PreRun but returns an error. + */ + preRunE: (cmd: Command, args: Array) => void + /** + * Run: Typically the actual work function. Most commands will only implement this. + */ + run: (cmd: Command, args: Array) => void + /** + * RunE: Run but returns an error. + */ + runE: (cmd: Command, args: Array) => void + /** + * PostRun: run after the Run command. + */ + postRun: (cmd: Command, args: Array) => void + /** + * PostRunE: PostRun but returns an error. + */ + postRunE: (cmd: Command, args: Array) => void + /** + * PersistentPostRun: children of this command will inherit and execute after PostRun. + */ + persistentPostRun: (cmd: Command, args: Array) => void + /** + * PersistentPostRunE: PersistentPostRun but returns an error. + */ + persistentPostRunE: (cmd: Command, args: Array) => void + /** + * FParseErrWhitelist flag parse errors to be ignored + */ + fParseErrWhitelist: FParseErrWhitelist + /** + * CompletionOptions is a set of options to control the handling of shell completion + */ + completionOptions: CompletionOptions + /** + * TraverseChildren parses flags on all parents before executing child command. + */ + traverseChildren: boolean + /** + * Hidden defines, if this command is hidden and should NOT show up in the list of available commands. + */ + hidden: boolean + /** + * SilenceErrors is an option to quiet errors down stream. + */ + silenceErrors: boolean + /** + * SilenceUsage is an option to silence usage when an error occurs. + */ + silenceUsage: boolean + /** + * DisableFlagParsing disables the flag parsing. + * If this is true all flags will be passed to the command as arguments. + */ + disableFlagParsing: boolean + /** + * DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...") + * will be printed by generating docs for this command. + */ + disableAutoGenTag: boolean + /** + * DisableFlagsInUseLine will disable the addition of [flags] to the usage + * line of a command when printing help or generating docs + */ + disableFlagsInUseLine: boolean + /** + * DisableSuggestions disables the suggestions based on Levenshtein distance + * that go along with 'unknown command' messages. + */ + disableSuggestions: boolean + /** + * SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions. + * Must be > 0. + */ + suggestionsMinimumDistance: number + } + interface Command { + /** + * Context returns underlying command context. If command was executed + * with ExecuteContext or the context was set with SetContext, the + * previously set context will be returned. Otherwise, nil is returned. + * + * Notice that a call to Execute and ExecuteC will replace a nil context of + * a command with a context.Background, so a background context will be + * returned by Context after one of these functions has been called. + */ + context(): context.Context + } + interface Command { + /** + * SetContext sets context for the command. This context will be overwritten by + * Command.ExecuteContext or Command.ExecuteContextC. + */ + setContext(ctx: context.Context): void + } + interface Command { + /** + * SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden + * particularly useful when testing. + */ + setArgs(a: Array): void + } + interface Command { + /** + * SetOutput sets the destination for usage and error messages. + * If output is nil, os.Stderr is used. + * Deprecated: Use SetOut and/or SetErr instead + */ + setOutput(output: io.Writer): void + } + interface Command { + /** + * SetOut sets the destination for usage messages. + * If newOut is nil, os.Stdout is used. + */ + setOut(newOut: io.Writer): void + } + interface Command { + /** + * SetErr sets the destination for error messages. + * If newErr is nil, os.Stderr is used. + */ + setErr(newErr: io.Writer): void + } + interface Command { + /** + * SetIn sets the source for input data + * If newIn is nil, os.Stdin is used. + */ + setIn(newIn: io.Reader): void + } + interface Command { + /** + * SetUsageFunc sets usage function. Usage can be defined by application. + */ + setUsageFunc(f: (_arg0: Command) => void): void + } + interface Command { + /** + * SetUsageTemplate sets usage template. Can be defined by Application. + */ + setUsageTemplate(s: string): void + } + interface Command { + /** + * SetFlagErrorFunc sets a function to generate an error when flag parsing + * fails. + */ + setFlagErrorFunc(f: (_arg0: Command, _arg1: Error) => void): void + } + interface Command { + /** + * SetHelpFunc sets help function. Can be defined by Application. + */ + setHelpFunc(f: (_arg0: Command, _arg1: Array) => void): void + } + interface Command { + /** + * SetHelpCommand sets help command. + */ + setHelpCommand(cmd: Command): void + } + interface Command { + /** + * SetHelpCommandGroupID sets the group id of the help command. + */ + setHelpCommandGroupID(groupID: string): void + } + interface Command { + /** + * SetCompletionCommandGroupID sets the group id of the completion command. + */ + setCompletionCommandGroupID(groupID: string): void + } + interface Command { + /** + * SetHelpTemplate sets help template to be used. Application can use it to set custom template. + */ + setHelpTemplate(s: string): void + } + interface Command { + /** + * SetVersionTemplate sets version template to be used. Application can use it to set custom template. + */ + setVersionTemplate(s: string): void + } + interface Command { + /** + * SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands. + * The user should not have a cyclic dependency on commands. + */ + setGlobalNormalizationFunc(n: (f: any, name: string) => any): void + } + interface Command { + /** + * OutOrStdout returns output to stdout. + */ + outOrStdout(): io.Writer + } + interface Command { + /** + * OutOrStderr returns output to stderr + */ + outOrStderr(): io.Writer + } + interface Command { + /** + * ErrOrStderr returns output to stderr + */ + errOrStderr(): io.Writer + } + interface Command { + /** + * InOrStdin returns input to stdin + */ + inOrStdin(): io.Reader + } + interface Command { + /** + * UsageFunc returns either the function set by SetUsageFunc for this command + * or a parent, or it returns a default usage function. + */ + usageFunc(): (_arg0: Command) => void + } + interface Command { + /** + * Usage puts out the usage for the command. + * Used when a user provides invalid input. + * Can be defined by user by overriding UsageFunc. + */ + usage(): void + } + interface Command { + /** + * HelpFunc returns either the function set by SetHelpFunc for this command + * or a parent, or it returns a function with default help behavior. + */ + helpFunc(): (_arg0: Command, _arg1: Array) => void + } + interface Command { + /** + * Help puts out the help for the command. + * Used when a user calls help [command]. + * Can be defined by user by overriding HelpFunc. + */ + help(): void + } + interface Command { + /** + * UsageString returns usage string. + */ + usageString(): string + } + interface Command { + /** + * FlagErrorFunc returns either the function set by SetFlagErrorFunc for this + * command or a parent, or it returns a function which returns the original + * error. + */ + flagErrorFunc(): (_arg0: Command, _arg1: Error) => void + } + interface Command { + /** + * UsagePadding return padding for the usage. + */ + usagePadding(): number + } + interface Command { + /** + * CommandPathPadding return padding for the command path. + */ + commandPathPadding(): number + } + interface Command { + /** + * NamePadding returns padding for the name. + */ + namePadding(): number + } + interface Command { + /** + * UsageTemplate returns usage template for the command. + */ + usageTemplate(): string + } + interface Command { + /** + * HelpTemplate return help template for the command. + */ + helpTemplate(): string + } + interface Command { + /** + * VersionTemplate return version template for the command. + */ + versionTemplate(): string + } + interface Command { + /** + * Find the target command given the args and command tree + * Meant to be run on the highest node. Only searches down. + */ + find(args: Array): [(Command | undefined), Array] + } + interface Command { + /** + * Traverse the command tree to find the command, and parse args for + * each parent. + */ + traverse(args: Array): [(Command | undefined), Array] + } + interface Command { + /** + * SuggestionsFor provides suggestions for the typedName. + */ + suggestionsFor(typedName: string): Array + } + interface Command { + /** + * VisitParents visits all parents of the command and invokes fn on each parent. + */ + visitParents(fn: (_arg0: Command) => void): void + } + interface Command { + /** + * Root finds root command. + */ + root(): (Command | undefined) + } + interface Command { + /** + * ArgsLenAtDash will return the length of c.Flags().Args at the moment + * when a -- was found during args parsing. + */ + argsLenAtDash(): number + } + interface Command { + /** + * ExecuteContext is the same as Execute(), but sets the ctx on the command. + * Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs + * functions. + */ + executeContext(ctx: context.Context): void + } + interface Command { + /** + * Execute uses the args (os.Args[1:] by default) + * and run through the command tree finding appropriate matches + * for commands and then corresponding flags. + */ + execute(): void + } + interface Command { + /** + * ExecuteContextC is the same as ExecuteC(), but sets the ctx on the command. + * Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs + * functions. + */ + executeContextC(ctx: context.Context): (Command | undefined) + } + interface Command { + /** + * ExecuteC executes the command. + */ + executeC(): (Command | undefined) + } + interface Command { + validateArgs(args: Array): void + } + interface Command { + /** + * ValidateRequiredFlags validates all required flags are present and returns an error otherwise + */ + validateRequiredFlags(): void + } + interface Command { + /** + * InitDefaultHelpFlag adds default help flag to c. + * It is called automatically by executing the c or by calling help and usage. + * If c already has help flag, it will do nothing. + */ + initDefaultHelpFlag(): void + } + interface Command { + /** + * InitDefaultVersionFlag adds default version flag to c. + * It is called automatically by executing the c. + * If c already has a version flag, it will do nothing. + * If c.Version is empty, it will do nothing. + */ + initDefaultVersionFlag(): void + } + interface Command { + /** + * InitDefaultHelpCmd adds default help command to c. + * It is called automatically by executing the c or by calling help and usage. + * If c already has help command or c has no subcommands, it will do nothing. + */ + initDefaultHelpCmd(): void + } + interface Command { + /** + * ResetCommands delete parent, subcommand and help command from c. + */ + resetCommands(): void + } + interface Command { + /** + * Commands returns a sorted slice of child commands. + */ + commands(): Array<(Command | undefined)> + } + interface Command { + /** + * AddCommand adds one or more commands to this parent command. + */ + addCommand(...cmds: (Command | undefined)[]): void + } + interface Command { + /** + * Groups returns a slice of child command groups. + */ + groups(): Array<(Group | undefined)> + } + interface Command { + /** + * AllChildCommandsHaveGroup returns if all subcommands are assigned to a group + */ + allChildCommandsHaveGroup(): boolean + } + interface Command { + /** + * ContainsGroup return if groupID exists in the list of command groups. + */ + containsGroup(groupID: string): boolean + } + interface Command { + /** + * AddGroup adds one or more command groups to this parent command. + */ + addGroup(...groups: (Group | undefined)[]): void + } + interface Command { + /** + * RemoveCommand removes one or more commands from a parent command. + */ + removeCommand(...cmds: (Command | undefined)[]): void + } + interface Command { + /** + * Print is a convenience method to Print to the defined output, fallback to Stderr if not set. + */ + print(...i: { + }[]): void + } + interface Command { + /** + * Println is a convenience method to Println to the defined output, fallback to Stderr if not set. + */ + println(...i: { + }[]): void + } + interface Command { + /** + * Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set. + */ + printf(format: string, ...i: { + }[]): void + } + interface Command { + /** + * PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set. + */ + printErr(...i: { + }[]): void + } + interface Command { + /** + * PrintErrln is a convenience method to Println to the defined Err output, fallback to Stderr if not set. + */ + printErrln(...i: { + }[]): void + } + interface Command { + /** + * PrintErrf is a convenience method to Printf to the defined Err output, fallback to Stderr if not set. + */ + printErrf(format: string, ...i: { + }[]): void + } + interface Command { + /** + * CommandPath returns the full path to this command. + */ + commandPath(): string + } + interface Command { + /** + * UseLine puts out the full usage for a given command (including parents). + */ + useLine(): string + } + interface Command { + /** + * DebugFlags used to determine which flags have been assigned to which commands + * and which persist. + */ + debugFlags(): void + } + interface Command { + /** + * Name returns the command's name: the first word in the use line. + */ + name(): string + } + interface Command { + /** + * HasAlias determines if a given string is an alias of the command. + */ + hasAlias(s: string): boolean + } + interface Command { + /** + * CalledAs returns the command name or alias that was used to invoke + * this command or an empty string if the command has not been called. + */ + calledAs(): string + } + interface Command { + /** + * NameAndAliases returns a list of the command name and all aliases + */ + nameAndAliases(): string + } + interface Command { + /** + * HasExample determines if the command has example. + */ + hasExample(): boolean + } + interface Command { + /** + * Runnable determines if the command is itself runnable. + */ + runnable(): boolean + } + interface Command { + /** + * HasSubCommands determines if the command has children commands. + */ + hasSubCommands(): boolean + } + interface Command { + /** + * IsAvailableCommand determines if a command is available as a non-help command + * (this includes all non deprecated/hidden commands). + */ + isAvailableCommand(): boolean + } + interface Command { + /** + * IsAdditionalHelpTopicCommand determines if a command is an additional + * help topic command; additional help topic command is determined by the + * fact that it is NOT runnable/hidden/deprecated, and has no sub commands that + * are runnable/hidden/deprecated. + * Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924. + */ + isAdditionalHelpTopicCommand(): boolean + } + interface Command { + /** + * HasHelpSubCommands determines if a command has any available 'help' sub commands + * that need to be shown in the usage/help default template under 'additional help + * topics'. + */ + hasHelpSubCommands(): boolean + } + interface Command { + /** + * HasAvailableSubCommands determines if a command has available sub commands that + * need to be shown in the usage/help default template under 'available commands'. + */ + hasAvailableSubCommands(): boolean + } + interface Command { + /** + * HasParent determines if the command is a child command. + */ + hasParent(): boolean + } + interface Command { + /** + * GlobalNormalizationFunc returns the global normalization function or nil if it doesn't exist. + */ + globalNormalizationFunc(): (f: any, name: string) => any + } + interface Command { + /** + * Flags returns the complete FlagSet that applies + * to this command (local and persistent declared here and by all parents). + */ + flags(): (any | undefined) + } + interface Command { + /** + * LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands. + */ + localNonPersistentFlags(): (any | undefined) + } + interface Command { + /** + * LocalFlags returns the local FlagSet specifically set in the current command. + */ + localFlags(): (any | undefined) + } + interface Command { + /** + * InheritedFlags returns all flags which were inherited from parent commands. + */ + inheritedFlags(): (any | undefined) + } + interface Command { + /** + * NonInheritedFlags returns all flags which were not inherited from parent commands. + */ + nonInheritedFlags(): (any | undefined) + } + interface Command { + /** + * PersistentFlags returns the persistent FlagSet specifically set in the current command. + */ + persistentFlags(): (any | undefined) + } + interface Command { + /** + * ResetFlags deletes all flags from command. + */ + resetFlags(): void + } + interface Command { + /** + * HasFlags checks if the command contains any flags (local plus persistent from the entire structure). + */ + hasFlags(): boolean + } + interface Command { + /** + * HasPersistentFlags checks if the command contains persistent flags. + */ + hasPersistentFlags(): boolean + } + interface Command { + /** + * HasLocalFlags checks if the command has flags specifically declared locally. + */ + hasLocalFlags(): boolean + } + interface Command { + /** + * HasInheritedFlags checks if the command has flags inherited from its parent command. + */ + hasInheritedFlags(): boolean + } + interface Command { + /** + * HasAvailableFlags checks if the command contains any flags (local plus persistent from the entire + * structure) which are not hidden or deprecated. + */ + hasAvailableFlags(): boolean + } + interface Command { + /** + * HasAvailablePersistentFlags checks if the command contains persistent flags which are not hidden or deprecated. + */ + hasAvailablePersistentFlags(): boolean + } + interface Command { + /** + * HasAvailableLocalFlags checks if the command has flags specifically declared locally which are not hidden + * or deprecated. + */ + hasAvailableLocalFlags(): boolean + } + interface Command { + /** + * HasAvailableInheritedFlags checks if the command has flags inherited from its parent command which are + * not hidden or deprecated. + */ + hasAvailableInheritedFlags(): boolean + } + interface Command { + /** + * Flag climbs up the command tree looking for matching flag. + */ + flag(name: string): (any | undefined) + } + interface Command { + /** + * ParseFlags parses persistent flag tree and local flags. + */ + parseFlags(args: Array): void + } + interface Command { + /** + * Parent returns a commands parent command. + */ + parent(): (Command | undefined) + } + interface Command { + /** + * RegisterFlagCompletionFunc should be called to register a function to provide completion for a flag. + */ + registerFlagCompletionFunc(flagName: string, f: (cmd: Command, args: Array, toComplete: string) => [Array, ShellCompDirective]): void + } + interface Command { + /** + * InitDefaultCompletionCmd adds a default 'completion' command to c. + * This function will do nothing if any of the following is true: + * 1- the feature has been explicitly disabled by the program, + * 2- c has no subcommands (to avoid creating one), + * 3- c already has a 'completion' command provided by the program. + */ + initDefaultCompletionCmd(): void + } + interface Command { + /** + * GenFishCompletion generates fish completion file and writes to the passed writer. + */ + genFishCompletion(w: io.Writer, includeDesc: boolean): void + } + interface Command { + /** + * GenFishCompletionFile generates fish completion file. + */ + genFishCompletionFile(filename: string, includeDesc: boolean): void + } + interface Command { + /** + * MarkFlagsRequiredTogether marks the given flags with annotations so that Cobra errors + * if the command is invoked with a subset (but not all) of the given flags. + */ + markFlagsRequiredTogether(...flagNames: string[]): void + } + interface Command { + /** + * MarkFlagsMutuallyExclusive marks the given flags with annotations so that Cobra errors + * if the command is invoked with more than one flag from the given set of flags. + */ + markFlagsMutuallyExclusive(...flagNames: string[]): void + } + interface Command { + /** + * ValidateFlagGroups validates the mutuallyExclusive/requiredAsGroup logic and returns the + * first error encountered. + */ + validateFlagGroups(): void + } + interface Command { + /** + * GenPowerShellCompletionFile generates powershell completion file without descriptions. + */ + genPowerShellCompletionFile(filename: string): void + } + interface Command { + /** + * GenPowerShellCompletion generates powershell completion file without descriptions + * and writes it to the passed writer. + */ + genPowerShellCompletion(w: io.Writer): void + } + interface Command { + /** + * GenPowerShellCompletionFileWithDesc generates powershell completion file with descriptions. + */ + genPowerShellCompletionFileWithDesc(filename: string): void + } + interface Command { + /** + * GenPowerShellCompletionWithDesc generates powershell completion file with descriptions + * and writes it to the passed writer. + */ + genPowerShellCompletionWithDesc(w: io.Writer): void + } + interface Command { + /** + * MarkFlagRequired instructs the various shell completion implementations to + * prioritize the named flag when performing completion, + * and causes your command to report an error if invoked without the flag. + */ + markFlagRequired(name: string): void + } + interface Command { + /** + * MarkPersistentFlagRequired instructs the various shell completion implementations to + * prioritize the named persistent flag when performing completion, + * and causes your command to report an error if invoked without the flag. + */ + markPersistentFlagRequired(name: string): void + } + interface Command { + /** + * MarkFlagFilename instructs the various shell completion implementations to + * limit completions for the named flag to the specified file extensions. + */ + markFlagFilename(name: string, ...extensions: string[]): void + } + interface Command { + /** + * MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. + * The bash completion script will call the bash function f for the flag. + * + * This will only work for bash completion. + * It is recommended to instead use c.RegisterFlagCompletionFunc(...) which allows + * to register a Go function which will work across all shells. + */ + markFlagCustom(name: string, f: string): void + } + interface Command { + /** + * MarkPersistentFlagFilename instructs the various shell completion + * implementations to limit completions for the named persistent flag to the + * specified file extensions. + */ + markPersistentFlagFilename(name: string, ...extensions: string[]): void + } + interface Command { + /** + * MarkFlagDirname instructs the various shell completion implementations to + * limit completions for the named flag to directory names. + */ + markFlagDirname(name: string): void + } + interface Command { + /** + * MarkPersistentFlagDirname instructs the various shell completion + * implementations to limit completions for the named persistent flag to + * directory names. + */ + markPersistentFlagDirname(name: string): void + } + interface Command { + /** + * GenZshCompletionFile generates zsh completion file including descriptions. + */ + genZshCompletionFile(filename: string): void + } + interface Command { + /** + * GenZshCompletion generates zsh completion file including descriptions + * and writes it to the passed writer. + */ + genZshCompletion(w: io.Writer): void + } + interface Command { + /** + * GenZshCompletionFileNoDesc generates zsh completion file without descriptions. + */ + genZshCompletionFileNoDesc(filename: string): void + } + interface Command { + /** + * GenZshCompletionNoDesc generates zsh completion file without descriptions + * and writes it to the passed writer. + */ + genZshCompletionNoDesc(w: io.Writer): void + } + interface Command { + /** + * MarkZshCompPositionalArgumentFile only worked for zsh and its behavior was + * not consistent with Bash completion. It has therefore been disabled. + * Instead, when no other completion is specified, file completion is done by + * default for every argument. One can disable file completion on a per-argument + * basis by using ValidArgsFunction and ShellCompDirectiveNoFileComp. + * To achieve file extension filtering, one can use ValidArgsFunction and + * ShellCompDirectiveFilterFileExt. + * + * Deprecated + */ + markZshCompPositionalArgumentFile(argPosition: number, ...patterns: string[]): void + } + interface Command { + /** + * MarkZshCompPositionalArgumentWords only worked for zsh. It has therefore + * been disabled. + * To achieve the same behavior across all shells, one can use + * ValidArgs (for the first argument only) or ValidArgsFunction for + * any argument (can include the first one also). + * + * Deprecated + */ + markZshCompPositionalArgumentWords(argPosition: number, ...words: string[]): void + } +} + /** * Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html * @@ -10138,6 +10974,237 @@ namespace jwt { } } +/** + * Package blob provides an easy and portable way to interact with blobs + * within a storage location. Subpackages contain driver implementations of + * blob for supported services. + * + * See https://gocloud.dev/howto/blob/ for a detailed how-to guide. + * + * *blob.Bucket implements io/fs.FS and io/fs.SubFS, so it can be used with + * functions in that package. + * + * # Errors + * + * The errors returned from this package can be inspected in several ways: + * + * The Code function from gocloud.dev/gcerrors will return an error code, also + * defined in that package, when invoked on an error. + * + * The Bucket.ErrorAs method can retrieve the driver error underlying the returned + * error. + * + * # OpenCensus Integration + * + * OpenCensus supports tracing and metric collection for multiple languages and + * backend providers. See https://opencensus.io. + * + * This API collects OpenCensus traces and metrics for the following methods: + * ``` + * - Attributes + * - Copy + * - Delete + * - ListPage + * - NewRangeReader, from creation until the call to Close. (NewReader and ReadAll + * are included because they call NewRangeReader.) + * - NewWriter, from creation until the call to Close. + * ``` + * + * All trace and metric names begin with the package import path. + * The traces add the method name. + * For example, "gocloud.dev/blob/Attributes". + * The metrics are "completed_calls", a count of completed method calls by driver, + * method and status (error code); and "latency", a distribution of method latency + * by driver and method. + * For example, "gocloud.dev/blob/latency". + * + * It also collects the following metrics: + * ``` + * - gocloud.dev/blob/bytes_read: the total number of bytes read, by driver. + * - gocloud.dev/blob/bytes_written: the total number of bytes written, by driver. + * ``` + * + * To enable trace collection in your application, see "Configure Exporter" at + * https://opencensus.io/quickstart/go/tracing. + * To enable metric collection in your application, see "Exporting stats" at + * https://opencensus.io/quickstart/go/metrics. + */ +namespace blob { + /** + * 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): 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 { + /** + * As converts i to driver-specific types. + * See https://gocloud.dev/concepts/as/ for background information, the "As" + * examples in this package for examples, and the driver package + * documentation for the specific types supported for that driver. + */ + as(i: { + }): boolean + } + 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 + } + /** + * 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 + /** + * ETag for the blob; see https://en.wikipedia.org/wiki/HTTP_ETag. + */ + eTag: string + } + interface Attributes { + /** + * As converts i to driver-specific types. + * See https://gocloud.dev/concepts/as/ for background information, the "As" + * examples in this package for examples, and the driver package + * documentation for the specific types supported for that driver. + */ + as(i: { + }): boolean + } + /** + * ListObject represents a single blob returned from List. + */ + interface ListObject { + /** + * 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 + /** + * 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 + } + interface ListObject { + /** + * As converts i to driver-specific types. + * See https://gocloud.dev/concepts/as/ for background information, the "As" + * examples in this package for examples, and the driver package + * documentation for the specific types supported for that driver. + */ + as(i: { + }): boolean + } +} + /** * Package types implements some commonly used db serializable types * like datetime, json, etc. @@ -10157,7 +11224,7 @@ namespace types { /** * Value implements the [driver.Valuer] interface. */ - value(): driver.Value + value(): any } interface JsonArray { /** @@ -10198,7 +11265,7 @@ namespace types { /** * Value implements the [driver.Valuer] interface. */ - value(): driver.Value + value(): any } interface JsonMap { /** @@ -10304,7 +11371,7 @@ namespace schema { /** * Value implements the [driver.Valuer] interface. */ - value(): driver.Value + value(): any } interface Schema { /** @@ -10319,8 +11386,8 @@ namespace schema { * Package models implements all PocketBase DB models and DTOs. */ namespace models { - type _subYVarR = BaseModel - interface Admin extends _subYVarR { + type _subkrpXR = BaseModel + interface Admin extends _subkrpXR { avatar: number email: string tokenKey: string @@ -10355,8 +11422,8 @@ namespace models { } // @ts-ignore import validation = ozzo_validation - type _suboFtRn = BaseModel - interface Collection extends _suboFtRn { + type _subdjZco = BaseModel + interface Collection extends _subdjZco { name: string type: string system: boolean @@ -10449,8 +11516,8 @@ namespace models { */ setOptions(typedOptions: any): void } - type _subfYwDx = BaseModel - interface ExternalAuth extends _subfYwDx { + type _submdeaW = BaseModel + interface ExternalAuth extends _submdeaW { collectionId: string recordId: string provider: string @@ -10459,8 +11526,8 @@ namespace models { interface ExternalAuth { tableName(): string } - type _subSBxco = BaseModel - interface Record extends _subSBxco { + type _subEstnT = BaseModel + interface Record extends _subEstnT { } interface Record { /** @@ -10944,7 +12011,7 @@ namespace auth { /** * Client returns an http client using the provided token. */ - client(token: oauth2.Token): (http.Client | undefined) + client(token: oauth2.Token): (any | undefined) /** * BuildAuthUrl returns a URL to the provider's consent page * that asks for permissions for the required scopes explicitly. @@ -12564,1073 +13631,6 @@ namespace core { } } -/** - * Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces. - * In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code. - */ -namespace cobra { - interface Command { - /** - * GenBashCompletion generates bash completion file and writes to the passed writer. - */ - genBashCompletion(w: io.Writer): void - } - interface Command { - /** - * GenBashCompletionFile generates bash completion file. - */ - genBashCompletionFile(filename: string): void - } - interface Command { - /** - * GenBashCompletionFileV2 generates Bash completion version 2. - */ - genBashCompletionFileV2(filename: string, includeDesc: boolean): void - } - interface Command { - /** - * GenBashCompletionV2 generates Bash completion file version 2 - * and writes it to the passed writer. - */ - genBashCompletionV2(w: io.Writer, includeDesc: boolean): void - } - // @ts-ignore - import flag = pflag - /** - * Command is just that, a command for your application. - * E.g. 'go run ...' - 'run' is the command. Cobra requires - * you to define the usage and description as part of your command - * definition to ensure usability. - */ - interface Command { - /** - * Use is the one-line usage message. - * Recommended syntax is as follows: - * ``` - * [ ] identifies an optional argument. Arguments that are not enclosed in brackets are required. - * ... indicates that you can specify multiple values for the previous argument. - * | indicates mutually exclusive information. You can use the argument to the left of the separator or the - * argument to the right of the separator. You cannot use both arguments in a single use of the command. - * { } delimits a set of mutually exclusive arguments when one of the arguments is required. If the arguments are - * optional, they are enclosed in brackets ([ ]). - * ``` - * Example: add [-F file | -D dir]... [-f format] profile - */ - use: string - /** - * Aliases is an array of aliases that can be used instead of the first word in Use. - */ - aliases: Array - /** - * SuggestFor is an array of command names for which this command will be suggested - - * similar to aliases but only suggests. - */ - suggestFor: Array - /** - * Short is the short description shown in the 'help' output. - */ - short: string - /** - * The group id under which this subcommand is grouped in the 'help' output of its parent. - */ - groupID: string - /** - * Long is the long message shown in the 'help ' output. - */ - long: string - /** - * Example is examples of how to use the command. - */ - example: string - /** - * ValidArgs is list of all valid non-flag arguments that are accepted in shell completions - */ - validArgs: Array - /** - * ValidArgsFunction is an optional function that provides valid non-flag arguments for shell completion. - * It is a dynamic version of using ValidArgs. - * Only one of ValidArgs and ValidArgsFunction can be used for a command. - */ - validArgsFunction: (cmd: Command, args: Array, toComplete: string) => [Array, ShellCompDirective] - /** - * Expected arguments - */ - args: PositionalArgs - /** - * ArgAliases is List of aliases for ValidArgs. - * These are not suggested to the user in the shell completion, - * but accepted if entered manually. - */ - argAliases: Array - /** - * BashCompletionFunction is custom bash functions used by the legacy bash autocompletion generator. - * For portability with other shells, it is recommended to instead use ValidArgsFunction - */ - bashCompletionFunction: string - /** - * Deprecated defines, if this command is deprecated and should print this string when used. - */ - deprecated: string - /** - * Annotations are key/value pairs that can be used by applications to identify or - * group commands. - */ - annotations: _TygojaDict - /** - * Version defines the version for this command. If this value is non-empty and the command does not - * define a "version" flag, a "version" boolean flag will be added to the command and, if specified, - * will print content of the "Version" variable. A shorthand "v" flag will also be added if the - * command does not define one. - */ - version: string - /** - * The *Run functions are executed in the following order: - * ``` - * * PersistentPreRun() - * * PreRun() - * * Run() - * * PostRun() - * * PersistentPostRun() - * ``` - * All functions get the same args, the arguments after the command name. - * - * PersistentPreRun: children of this command will inherit and execute. - */ - persistentPreRun: (cmd: Command, args: Array) => void - /** - * PersistentPreRunE: PersistentPreRun but returns an error. - */ - persistentPreRunE: (cmd: Command, args: Array) => void - /** - * PreRun: children of this command will not inherit. - */ - preRun: (cmd: Command, args: Array) => void - /** - * PreRunE: PreRun but returns an error. - */ - preRunE: (cmd: Command, args: Array) => void - /** - * Run: Typically the actual work function. Most commands will only implement this. - */ - run: (cmd: Command, args: Array) => void - /** - * RunE: Run but returns an error. - */ - runE: (cmd: Command, args: Array) => void - /** - * PostRun: run after the Run command. - */ - postRun: (cmd: Command, args: Array) => void - /** - * PostRunE: PostRun but returns an error. - */ - postRunE: (cmd: Command, args: Array) => void - /** - * PersistentPostRun: children of this command will inherit and execute after PostRun. - */ - persistentPostRun: (cmd: Command, args: Array) => void - /** - * PersistentPostRunE: PersistentPostRun but returns an error. - */ - persistentPostRunE: (cmd: Command, args: Array) => void - /** - * FParseErrWhitelist flag parse errors to be ignored - */ - fParseErrWhitelist: FParseErrWhitelist - /** - * CompletionOptions is a set of options to control the handling of shell completion - */ - completionOptions: CompletionOptions - /** - * TraverseChildren parses flags on all parents before executing child command. - */ - traverseChildren: boolean - /** - * Hidden defines, if this command is hidden and should NOT show up in the list of available commands. - */ - hidden: boolean - /** - * SilenceErrors is an option to quiet errors down stream. - */ - silenceErrors: boolean - /** - * SilenceUsage is an option to silence usage when an error occurs. - */ - silenceUsage: boolean - /** - * DisableFlagParsing disables the flag parsing. - * If this is true all flags will be passed to the command as arguments. - */ - disableFlagParsing: boolean - /** - * DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...") - * will be printed by generating docs for this command. - */ - disableAutoGenTag: boolean - /** - * DisableFlagsInUseLine will disable the addition of [flags] to the usage - * line of a command when printing help or generating docs - */ - disableFlagsInUseLine: boolean - /** - * DisableSuggestions disables the suggestions based on Levenshtein distance - * that go along with 'unknown command' messages. - */ - disableSuggestions: boolean - /** - * SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions. - * Must be > 0. - */ - suggestionsMinimumDistance: number - } - interface Command { - /** - * Context returns underlying command context. If command was executed - * with ExecuteContext or the context was set with SetContext, the - * previously set context will be returned. Otherwise, nil is returned. - * - * Notice that a call to Execute and ExecuteC will replace a nil context of - * a command with a context.Background, so a background context will be - * returned by Context after one of these functions has been called. - */ - context(): context.Context - } - interface Command { - /** - * SetContext sets context for the command. This context will be overwritten by - * Command.ExecuteContext or Command.ExecuteContextC. - */ - setContext(ctx: context.Context): void - } - interface Command { - /** - * SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden - * particularly useful when testing. - */ - setArgs(a: Array): void - } - interface Command { - /** - * SetOutput sets the destination for usage and error messages. - * If output is nil, os.Stderr is used. - * Deprecated: Use SetOut and/or SetErr instead - */ - setOutput(output: io.Writer): void - } - interface Command { - /** - * SetOut sets the destination for usage messages. - * If newOut is nil, os.Stdout is used. - */ - setOut(newOut: io.Writer): void - } - interface Command { - /** - * SetErr sets the destination for error messages. - * If newErr is nil, os.Stderr is used. - */ - setErr(newErr: io.Writer): void - } - interface Command { - /** - * SetIn sets the source for input data - * If newIn is nil, os.Stdin is used. - */ - setIn(newIn: io.Reader): void - } - interface Command { - /** - * SetUsageFunc sets usage function. Usage can be defined by application. - */ - setUsageFunc(f: (_arg0: Command) => void): void - } - interface Command { - /** - * SetUsageTemplate sets usage template. Can be defined by Application. - */ - setUsageTemplate(s: string): void - } - interface Command { - /** - * SetFlagErrorFunc sets a function to generate an error when flag parsing - * fails. - */ - setFlagErrorFunc(f: (_arg0: Command, _arg1: Error) => void): void - } - interface Command { - /** - * SetHelpFunc sets help function. Can be defined by Application. - */ - setHelpFunc(f: (_arg0: Command, _arg1: Array) => void): void - } - interface Command { - /** - * SetHelpCommand sets help command. - */ - setHelpCommand(cmd: Command): void - } - interface Command { - /** - * SetHelpCommandGroupID sets the group id of the help command. - */ - setHelpCommandGroupID(groupID: string): void - } - interface Command { - /** - * SetCompletionCommandGroupID sets the group id of the completion command. - */ - setCompletionCommandGroupID(groupID: string): void - } - interface Command { - /** - * SetHelpTemplate sets help template to be used. Application can use it to set custom template. - */ - setHelpTemplate(s: string): void - } - interface Command { - /** - * SetVersionTemplate sets version template to be used. Application can use it to set custom template. - */ - setVersionTemplate(s: string): void - } - interface Command { - /** - * SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands. - * The user should not have a cyclic dependency on commands. - */ - setGlobalNormalizationFunc(n: (f: flag.FlagSet, name: string) => flag.NormalizedName): void - } - interface Command { - /** - * OutOrStdout returns output to stdout. - */ - outOrStdout(): io.Writer - } - interface Command { - /** - * OutOrStderr returns output to stderr - */ - outOrStderr(): io.Writer - } - interface Command { - /** - * ErrOrStderr returns output to stderr - */ - errOrStderr(): io.Writer - } - interface Command { - /** - * InOrStdin returns input to stdin - */ - inOrStdin(): io.Reader - } - interface Command { - /** - * UsageFunc returns either the function set by SetUsageFunc for this command - * or a parent, or it returns a default usage function. - */ - usageFunc(): (_arg0: Command) => void - } - interface Command { - /** - * Usage puts out the usage for the command. - * Used when a user provides invalid input. - * Can be defined by user by overriding UsageFunc. - */ - usage(): void - } - interface Command { - /** - * HelpFunc returns either the function set by SetHelpFunc for this command - * or a parent, or it returns a function with default help behavior. - */ - helpFunc(): (_arg0: Command, _arg1: Array) => void - } - interface Command { - /** - * Help puts out the help for the command. - * Used when a user calls help [command]. - * Can be defined by user by overriding HelpFunc. - */ - help(): void - } - interface Command { - /** - * UsageString returns usage string. - */ - usageString(): string - } - interface Command { - /** - * FlagErrorFunc returns either the function set by SetFlagErrorFunc for this - * command or a parent, or it returns a function which returns the original - * error. - */ - flagErrorFunc(): (_arg0: Command, _arg1: Error) => void - } - interface Command { - /** - * UsagePadding return padding for the usage. - */ - usagePadding(): number - } - interface Command { - /** - * CommandPathPadding return padding for the command path. - */ - commandPathPadding(): number - } - interface Command { - /** - * NamePadding returns padding for the name. - */ - namePadding(): number - } - interface Command { - /** - * UsageTemplate returns usage template for the command. - */ - usageTemplate(): string - } - interface Command { - /** - * HelpTemplate return help template for the command. - */ - helpTemplate(): string - } - interface Command { - /** - * VersionTemplate return version template for the command. - */ - versionTemplate(): string - } - interface Command { - /** - * Find the target command given the args and command tree - * Meant to be run on the highest node. Only searches down. - */ - find(args: Array): [(Command | undefined), Array] - } - interface Command { - /** - * Traverse the command tree to find the command, and parse args for - * each parent. - */ - traverse(args: Array): [(Command | undefined), Array] - } - interface Command { - /** - * SuggestionsFor provides suggestions for the typedName. - */ - suggestionsFor(typedName: string): Array - } - interface Command { - /** - * VisitParents visits all parents of the command and invokes fn on each parent. - */ - visitParents(fn: (_arg0: Command) => void): void - } - interface Command { - /** - * Root finds root command. - */ - root(): (Command | undefined) - } - interface Command { - /** - * ArgsLenAtDash will return the length of c.Flags().Args at the moment - * when a -- was found during args parsing. - */ - argsLenAtDash(): number - } - interface Command { - /** - * ExecuteContext is the same as Execute(), but sets the ctx on the command. - * Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs - * functions. - */ - executeContext(ctx: context.Context): void - } - interface Command { - /** - * Execute uses the args (os.Args[1:] by default) - * and run through the command tree finding appropriate matches - * for commands and then corresponding flags. - */ - execute(): void - } - interface Command { - /** - * ExecuteContextC is the same as ExecuteC(), but sets the ctx on the command. - * Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs - * functions. - */ - executeContextC(ctx: context.Context): (Command | undefined) - } - interface Command { - /** - * ExecuteC executes the command. - */ - executeC(): (Command | undefined) - } - interface Command { - validateArgs(args: Array): void - } - interface Command { - /** - * ValidateRequiredFlags validates all required flags are present and returns an error otherwise - */ - validateRequiredFlags(): void - } - interface Command { - /** - * InitDefaultHelpFlag adds default help flag to c. - * It is called automatically by executing the c or by calling help and usage. - * If c already has help flag, it will do nothing. - */ - initDefaultHelpFlag(): void - } - interface Command { - /** - * InitDefaultVersionFlag adds default version flag to c. - * It is called automatically by executing the c. - * If c already has a version flag, it will do nothing. - * If c.Version is empty, it will do nothing. - */ - initDefaultVersionFlag(): void - } - interface Command { - /** - * InitDefaultHelpCmd adds default help command to c. - * It is called automatically by executing the c or by calling help and usage. - * If c already has help command or c has no subcommands, it will do nothing. - */ - initDefaultHelpCmd(): void - } - interface Command { - /** - * ResetCommands delete parent, subcommand and help command from c. - */ - resetCommands(): void - } - interface Command { - /** - * Commands returns a sorted slice of child commands. - */ - commands(): Array<(Command | undefined)> - } - interface Command { - /** - * AddCommand adds one or more commands to this parent command. - */ - addCommand(...cmds: (Command | undefined)[]): void - } - interface Command { - /** - * Groups returns a slice of child command groups. - */ - groups(): Array<(Group | undefined)> - } - interface Command { - /** - * AllChildCommandsHaveGroup returns if all subcommands are assigned to a group - */ - allChildCommandsHaveGroup(): boolean - } - interface Command { - /** - * ContainsGroup return if groupID exists in the list of command groups. - */ - containsGroup(groupID: string): boolean - } - interface Command { - /** - * AddGroup adds one or more command groups to this parent command. - */ - addGroup(...groups: (Group | undefined)[]): void - } - interface Command { - /** - * RemoveCommand removes one or more commands from a parent command. - */ - removeCommand(...cmds: (Command | undefined)[]): void - } - interface Command { - /** - * Print is a convenience method to Print to the defined output, fallback to Stderr if not set. - */ - print(...i: { - }[]): void - } - interface Command { - /** - * Println is a convenience method to Println to the defined output, fallback to Stderr if not set. - */ - println(...i: { - }[]): void - } - interface Command { - /** - * Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set. - */ - printf(format: string, ...i: { - }[]): void - } - interface Command { - /** - * PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set. - */ - printErr(...i: { - }[]): void - } - interface Command { - /** - * PrintErrln is a convenience method to Println to the defined Err output, fallback to Stderr if not set. - */ - printErrln(...i: { - }[]): void - } - interface Command { - /** - * PrintErrf is a convenience method to Printf to the defined Err output, fallback to Stderr if not set. - */ - printErrf(format: string, ...i: { - }[]): void - } - interface Command { - /** - * CommandPath returns the full path to this command. - */ - commandPath(): string - } - interface Command { - /** - * UseLine puts out the full usage for a given command (including parents). - */ - useLine(): string - } - interface Command { - /** - * DebugFlags used to determine which flags have been assigned to which commands - * and which persist. - */ - debugFlags(): void - } - interface Command { - /** - * Name returns the command's name: the first word in the use line. - */ - name(): string - } - interface Command { - /** - * HasAlias determines if a given string is an alias of the command. - */ - hasAlias(s: string): boolean - } - interface Command { - /** - * CalledAs returns the command name or alias that was used to invoke - * this command or an empty string if the command has not been called. - */ - calledAs(): string - } - interface Command { - /** - * NameAndAliases returns a list of the command name and all aliases - */ - nameAndAliases(): string - } - interface Command { - /** - * HasExample determines if the command has example. - */ - hasExample(): boolean - } - interface Command { - /** - * Runnable determines if the command is itself runnable. - */ - runnable(): boolean - } - interface Command { - /** - * HasSubCommands determines if the command has children commands. - */ - hasSubCommands(): boolean - } - interface Command { - /** - * IsAvailableCommand determines if a command is available as a non-help command - * (this includes all non deprecated/hidden commands). - */ - isAvailableCommand(): boolean - } - interface Command { - /** - * IsAdditionalHelpTopicCommand determines if a command is an additional - * help topic command; additional help topic command is determined by the - * fact that it is NOT runnable/hidden/deprecated, and has no sub commands that - * are runnable/hidden/deprecated. - * Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924. - */ - isAdditionalHelpTopicCommand(): boolean - } - interface Command { - /** - * HasHelpSubCommands determines if a command has any available 'help' sub commands - * that need to be shown in the usage/help default template under 'additional help - * topics'. - */ - hasHelpSubCommands(): boolean - } - interface Command { - /** - * HasAvailableSubCommands determines if a command has available sub commands that - * need to be shown in the usage/help default template under 'available commands'. - */ - hasAvailableSubCommands(): boolean - } - interface Command { - /** - * HasParent determines if the command is a child command. - */ - hasParent(): boolean - } - interface Command { - /** - * GlobalNormalizationFunc returns the global normalization function or nil if it doesn't exist. - */ - globalNormalizationFunc(): (f: flag.FlagSet, name: string) => flag.NormalizedName - } - interface Command { - /** - * Flags returns the complete FlagSet that applies - * to this command (local and persistent declared here and by all parents). - */ - flags(): (flag.FlagSet | undefined) - } - interface Command { - /** - * LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands. - */ - localNonPersistentFlags(): (flag.FlagSet | undefined) - } - interface Command { - /** - * LocalFlags returns the local FlagSet specifically set in the current command. - */ - localFlags(): (flag.FlagSet | undefined) - } - interface Command { - /** - * InheritedFlags returns all flags which were inherited from parent commands. - */ - inheritedFlags(): (flag.FlagSet | undefined) - } - interface Command { - /** - * NonInheritedFlags returns all flags which were not inherited from parent commands. - */ - nonInheritedFlags(): (flag.FlagSet | undefined) - } - interface Command { - /** - * PersistentFlags returns the persistent FlagSet specifically set in the current command. - */ - persistentFlags(): (flag.FlagSet | undefined) - } - interface Command { - /** - * ResetFlags deletes all flags from command. - */ - resetFlags(): void - } - interface Command { - /** - * HasFlags checks if the command contains any flags (local plus persistent from the entire structure). - */ - hasFlags(): boolean - } - interface Command { - /** - * HasPersistentFlags checks if the command contains persistent flags. - */ - hasPersistentFlags(): boolean - } - interface Command { - /** - * HasLocalFlags checks if the command has flags specifically declared locally. - */ - hasLocalFlags(): boolean - } - interface Command { - /** - * HasInheritedFlags checks if the command has flags inherited from its parent command. - */ - hasInheritedFlags(): boolean - } - interface Command { - /** - * HasAvailableFlags checks if the command contains any flags (local plus persistent from the entire - * structure) which are not hidden or deprecated. - */ - hasAvailableFlags(): boolean - } - interface Command { - /** - * HasAvailablePersistentFlags checks if the command contains persistent flags which are not hidden or deprecated. - */ - hasAvailablePersistentFlags(): boolean - } - interface Command { - /** - * HasAvailableLocalFlags checks if the command has flags specifically declared locally which are not hidden - * or deprecated. - */ - hasAvailableLocalFlags(): boolean - } - interface Command { - /** - * HasAvailableInheritedFlags checks if the command has flags inherited from its parent command which are - * not hidden or deprecated. - */ - hasAvailableInheritedFlags(): boolean - } - interface Command { - /** - * Flag climbs up the command tree looking for matching flag. - */ - flag(name: string): (flag.Flag | undefined) - } - interface Command { - /** - * ParseFlags parses persistent flag tree and local flags. - */ - parseFlags(args: Array): void - } - interface Command { - /** - * Parent returns a commands parent command. - */ - parent(): (Command | undefined) - } - interface Command { - /** - * RegisterFlagCompletionFunc should be called to register a function to provide completion for a flag. - */ - registerFlagCompletionFunc(flagName: string, f: (cmd: Command, args: Array, toComplete: string) => [Array, ShellCompDirective]): void - } - interface Command { - /** - * InitDefaultCompletionCmd adds a default 'completion' command to c. - * This function will do nothing if any of the following is true: - * 1- the feature has been explicitly disabled by the program, - * 2- c has no subcommands (to avoid creating one), - * 3- c already has a 'completion' command provided by the program. - */ - initDefaultCompletionCmd(): void - } - interface Command { - /** - * GenFishCompletion generates fish completion file and writes to the passed writer. - */ - genFishCompletion(w: io.Writer, includeDesc: boolean): void - } - interface Command { - /** - * GenFishCompletionFile generates fish completion file. - */ - genFishCompletionFile(filename: string, includeDesc: boolean): void - } - interface Command { - /** - * MarkFlagsRequiredTogether marks the given flags with annotations so that Cobra errors - * if the command is invoked with a subset (but not all) of the given flags. - */ - markFlagsRequiredTogether(...flagNames: string[]): void - } - interface Command { - /** - * MarkFlagsMutuallyExclusive marks the given flags with annotations so that Cobra errors - * if the command is invoked with more than one flag from the given set of flags. - */ - markFlagsMutuallyExclusive(...flagNames: string[]): void - } - interface Command { - /** - * ValidateFlagGroups validates the mutuallyExclusive/requiredAsGroup logic and returns the - * first error encountered. - */ - validateFlagGroups(): void - } - interface Command { - /** - * GenPowerShellCompletionFile generates powershell completion file without descriptions. - */ - genPowerShellCompletionFile(filename: string): void - } - interface Command { - /** - * GenPowerShellCompletion generates powershell completion file without descriptions - * and writes it to the passed writer. - */ - genPowerShellCompletion(w: io.Writer): void - } - interface Command { - /** - * GenPowerShellCompletionFileWithDesc generates powershell completion file with descriptions. - */ - genPowerShellCompletionFileWithDesc(filename: string): void - } - interface Command { - /** - * GenPowerShellCompletionWithDesc generates powershell completion file with descriptions - * and writes it to the passed writer. - */ - genPowerShellCompletionWithDesc(w: io.Writer): void - } - interface Command { - /** - * MarkFlagRequired instructs the various shell completion implementations to - * prioritize the named flag when performing completion, - * and causes your command to report an error if invoked without the flag. - */ - markFlagRequired(name: string): void - } - interface Command { - /** - * MarkPersistentFlagRequired instructs the various shell completion implementations to - * prioritize the named persistent flag when performing completion, - * and causes your command to report an error if invoked without the flag. - */ - markPersistentFlagRequired(name: string): void - } - interface Command { - /** - * MarkFlagFilename instructs the various shell completion implementations to - * limit completions for the named flag to the specified file extensions. - */ - markFlagFilename(name: string, ...extensions: string[]): void - } - interface Command { - /** - * MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. - * The bash completion script will call the bash function f for the flag. - * - * This will only work for bash completion. - * It is recommended to instead use c.RegisterFlagCompletionFunc(...) which allows - * to register a Go function which will work across all shells. - */ - markFlagCustom(name: string, f: string): void - } - interface Command { - /** - * MarkPersistentFlagFilename instructs the various shell completion - * implementations to limit completions for the named persistent flag to the - * specified file extensions. - */ - markPersistentFlagFilename(name: string, ...extensions: string[]): void - } - interface Command { - /** - * MarkFlagDirname instructs the various shell completion implementations to - * limit completions for the named flag to directory names. - */ - markFlagDirname(name: string): void - } - interface Command { - /** - * MarkPersistentFlagDirname instructs the various shell completion - * implementations to limit completions for the named persistent flag to - * directory names. - */ - markPersistentFlagDirname(name: string): void - } - interface Command { - /** - * GenZshCompletionFile generates zsh completion file including descriptions. - */ - genZshCompletionFile(filename: string): void - } - interface Command { - /** - * GenZshCompletion generates zsh completion file including descriptions - * and writes it to the passed writer. - */ - genZshCompletion(w: io.Writer): void - } - interface Command { - /** - * GenZshCompletionFileNoDesc generates zsh completion file without descriptions. - */ - genZshCompletionFileNoDesc(filename: string): void - } - interface Command { - /** - * GenZshCompletionNoDesc generates zsh completion file without descriptions - * and writes it to the passed writer. - */ - genZshCompletionNoDesc(w: io.Writer): void - } - interface Command { - /** - * MarkZshCompPositionalArgumentFile only worked for zsh and its behavior was - * not consistent with Bash completion. It has therefore been disabled. - * Instead, when no other completion is specified, file completion is done by - * default for every argument. One can disable file completion on a per-argument - * basis by using ValidArgsFunction and ShellCompDirectiveNoFileComp. - * To achieve file extension filtering, one can use ValidArgsFunction and - * ShellCompDirectiveFilterFileExt. - * - * Deprecated - */ - markZshCompPositionalArgumentFile(argPosition: number, ...patterns: string[]): void - } - interface Command { - /** - * MarkZshCompPositionalArgumentWords only worked for zsh. It has therefore - * been disabled. - * To achieve the same behavior across all shells, one can use - * ValidArgs (for the first argument only) or ValidArgsFunction for - * any argument (can include the first one also). - * - * Deprecated - */ - markZshCompPositionalArgumentWords(argPosition: number, ...words: string[]): void - } -} - -namespace migrate { - /** - * MigrationsList defines a list with migration definitions - */ - interface MigrationsList { - } - interface MigrationsList { - /** - * Item returns a single migration from the list by its index. - */ - item(index: number): (Migration | undefined) - } - interface MigrationsList { - /** - * Items returns the internal migrations list slice. - */ - items(): Array<(Migration | undefined)> - } - interface MigrationsList { - /** - * Register adds new migration definition to the list. - * - * If `optFilename` is not provided, it will try to get the name from its .go file. - * - * The list will be sorted automatically based on the migrations file name. - */ - register(up: (db: dbx.Builder) => void, down: (db: dbx.Builder) => void, ...optFilename: string[]): void - } -} - /** * Package syscall contains an interface to the low-level operating system * primitives. The details vary depending on the underlying system, and @@ -13882,86 +13882,6 @@ namespace io { namespace fs { } -/** - * Package driver defines interfaces to be implemented by database - * drivers as used by package sql. - * - * Most code should use package sql. - * - * The driver interface has evolved over time. Drivers should implement - * Connector and DriverContext interfaces. - * The Connector.Connect and Driver.Open methods should never return ErrBadConn. - * ErrBadConn should only be returned from Validator, SessionResetter, or - * a query method if the connection is already in an invalid (e.g. closed) state. - * - * All Conn implementations should implement the following interfaces: - * Pinger, SessionResetter, and Validator. - * - * If named parameters or context are supported, the driver's Conn should implement: - * ExecerContext, QueryerContext, ConnPrepareContext, and ConnBeginTx. - * - * To support custom data types, implement NamedValueChecker. NamedValueChecker - * also allows queries to accept per-query options as a parameter by returning - * ErrRemoveArgument from CheckNamedValue. - * - * If multiple result sets are supported, Rows should implement RowsNextResultSet. - * If the driver knows how to describe the types present in the returned result - * it should implement the following interfaces: RowsColumnTypeScanType, - * RowsColumnTypeDatabaseTypeName, RowsColumnTypeLength, RowsColumnTypeNullable, - * and RowsColumnTypePrecisionScale. A given row value may also return a Rows - * type, which may represent a database cursor value. - * - * Before a connection is returned to the connection pool after use, IsValid is - * called if implemented. Before a connection is reused for another query, - * ResetSession is called if implemented. If a connection is never returned to the - * connection pool but immediately reused, then ResetSession is called prior to - * reuse but IsValid is not called. - */ -namespace driver { - /** - * Value is a value that drivers must be able to handle. - * It is either nil, a type handled by a database driver's NamedValueChecker - * interface, or an instance of one of these types: - * - * ``` - * int64 - * float64 - * bool - * []byte - * string - * time.Time - * ``` - * - * If the driver supports cursors, a returned Value may also implement the Rows interface - * in this package. This is used, for example, when a user selects a cursor - * such as "select cursor(select * from my_table) from dual". If the Rows - * from the select is closed, the cursor Rows will also be closed. - */ - interface Value extends _TygojaAny{} - /** - * Driver is the interface that must be implemented by a database - * driver. - * - * Database drivers may implement DriverContext for access - * to contexts and to parse the name only once for a pool of connections, - * instead of once per connection. - */ - interface Driver { - /** - * Open returns a new connection to the database. - * The name is a string in a driver-specific format. - * - * Open may return a cached connection (one previously - * closed), but doing so is unnecessary; the sql package - * maintains a pool of idle connections for efficient re-use. - * - * The returned connection is only used by one goroutine at a - * time. - */ - open(name: string): Conn - } -} - /** * Package url parses URLs and implements query escaping. */ @@ -14353,508 +14273,6 @@ namespace net { } } -/** - * Package log implements a simple logging package. It defines a type, Logger, - * with methods for formatting output. It also has a predefined 'standard' - * Logger accessible through helper functions Print[f|ln], Fatal[f|ln], and - * Panic[f|ln], which are easier to use than creating a Logger manually. - * That logger writes to standard error and prints the date and time - * of each logged message. - * Every log message is output on a separate line: if the message being - * printed does not end in a newline, the logger will add one. - * The Fatal functions call os.Exit(1) after writing the log message. - * The Panic functions call panic after writing the log message. - */ -namespace log { - /** - * A Logger represents an active logging object that generates lines of - * output to an io.Writer. Each logging operation makes a single call to - * the Writer's Write method. A Logger can be used simultaneously from - * multiple goroutines; it guarantees to serialize access to the Writer. - */ - interface Logger { - } - interface Logger { - /** - * SetOutput sets the output destination for the logger. - */ - setOutput(w: io.Writer): void - } - interface Logger { - /** - * Output writes the output for a logging event. The string s contains - * the text to print after the prefix specified by the flags of the - * Logger. A newline is appended if the last character of s is not - * already a newline. Calldepth is used to recover the PC and is - * provided for generality, although at the moment on all pre-defined - * paths it will be 2. - */ - output(calldepth: number, s: string): void - } - interface Logger { - /** - * Printf calls l.Output to print to the logger. - * Arguments are handled in the manner of fmt.Printf. - */ - printf(format: string, ...v: any[]): void - } - interface Logger { - /** - * Print calls l.Output to print to the logger. - * Arguments are handled in the manner of fmt.Print. - */ - print(...v: any[]): void - } - interface Logger { - /** - * Println calls l.Output to print to the logger. - * Arguments are handled in the manner of fmt.Println. - */ - println(...v: any[]): void - } - interface Logger { - /** - * Fatal is equivalent to l.Print() followed by a call to os.Exit(1). - */ - fatal(...v: any[]): void - } - interface Logger { - /** - * Fatalf is equivalent to l.Printf() followed by a call to os.Exit(1). - */ - fatalf(format: string, ...v: any[]): void - } - interface Logger { - /** - * Fatalln is equivalent to l.Println() followed by a call to os.Exit(1). - */ - fatalln(...v: any[]): void - } - interface Logger { - /** - * Panic is equivalent to l.Print() followed by a call to panic(). - */ - panic(...v: any[]): void - } - interface Logger { - /** - * Panicf is equivalent to l.Printf() followed by a call to panic(). - */ - panicf(format: string, ...v: any[]): void - } - interface Logger { - /** - * Panicln is equivalent to l.Println() followed by a call to panic(). - */ - panicln(...v: any[]): void - } - interface Logger { - /** - * Flags returns the output flags for the logger. - * The flag bits are Ldate, Ltime, and so on. - */ - flags(): number - } - interface Logger { - /** - * SetFlags sets the output flags for the logger. - * The flag bits are Ldate, Ltime, and so on. - */ - setFlags(flag: number): void - } - interface Logger { - /** - * Prefix returns the output prefix for the logger. - */ - prefix(): string - } - interface Logger { - /** - * SetPrefix sets the output prefix for the logger. - */ - setPrefix(prefix: string): void - } - interface Logger { - /** - * Writer returns the output destination for the logger. - */ - writer(): io.Writer - } -} - -/** - * Package tls partially implements TLS 1.2, as specified in RFC 5246, - * and TLS 1.3, as specified in RFC 8446. - */ -namespace tls { - /** - * ConnectionState records basic TLS details about the connection. - */ - interface ConnectionState { - /** - * Version is the TLS version used by the connection (e.g. VersionTLS12). - */ - version: number - /** - * HandshakeComplete is true if the handshake has concluded. - */ - handshakeComplete: boolean - /** - * DidResume is true if this connection was successfully resumed from a - * previous session with a session ticket or similar mechanism. - */ - didResume: boolean - /** - * CipherSuite is the cipher suite negotiated for the connection (e.g. - * TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_AES_128_GCM_SHA256). - */ - cipherSuite: number - /** - * NegotiatedProtocol is the application protocol negotiated with ALPN. - */ - negotiatedProtocol: string - /** - * NegotiatedProtocolIsMutual used to indicate a mutual NPN negotiation. - * - * Deprecated: this value is always true. - */ - negotiatedProtocolIsMutual: boolean - /** - * ServerName is the value of the Server Name Indication extension sent by - * the client. It's available both on the server and on the client side. - */ - serverName: string - /** - * PeerCertificates are the parsed certificates sent by the peer, in the - * order in which they were sent. The first element is the leaf certificate - * that the connection is verified against. - * - * On the client side, it can't be empty. On the server side, it can be - * empty if Config.ClientAuth is not RequireAnyClientCert or - * RequireAndVerifyClientCert. - */ - peerCertificates: Array<(x509.Certificate | undefined)> - /** - * VerifiedChains is a list of one or more chains where the first element is - * PeerCertificates[0] and the last element is from Config.RootCAs (on the - * client side) or Config.ClientCAs (on the server side). - * - * On the client side, it's set if Config.InsecureSkipVerify is false. On - * the server side, it's set if Config.ClientAuth is VerifyClientCertIfGiven - * (and the peer provided a certificate) or RequireAndVerifyClientCert. - */ - verifiedChains: Array> - /** - * SignedCertificateTimestamps is a list of SCTs provided by the peer - * through the TLS handshake for the leaf certificate, if any. - */ - signedCertificateTimestamps: Array - /** - * OCSPResponse is a stapled Online Certificate Status Protocol (OCSP) - * response provided by the peer for the leaf certificate, if any. - */ - ocspResponse: string - /** - * TLSUnique contains the "tls-unique" channel binding value (see RFC 5929, - * Section 3). This value will be nil for TLS 1.3 connections and for all - * resumed connections. - * - * Deprecated: there are conditions in which this value might not be unique - * to a connection. See the Security Considerations sections of RFC 5705 and - * RFC 7627, and https://mitls.org/pages/attacks/3SHAKE#channelbindings. - */ - tlsUnique: string - } - interface ConnectionState { - /** - * ExportKeyingMaterial returns length bytes of exported key material in a new - * slice as defined in RFC 5705. If context is nil, it is not used as part of - * the seed. If the connection was set to allow renegotiation via - * Config.Renegotiation, this function will return an error. - */ - exportKeyingMaterial(label: string, context: string, length: number): string - } - /** - * A Config structure is used to configure a TLS client or server. - * After one has been passed to a TLS function it must not be - * modified. A Config may be reused; the tls package will also not - * modify it. - */ - interface Config { - /** - * Rand provides the source of entropy for nonces and RSA blinding. - * If Rand is nil, TLS uses the cryptographic random reader in package - * crypto/rand. - * The Reader must be safe for use by multiple goroutines. - */ - rand: io.Reader - /** - * Time returns the current time as the number of seconds since the epoch. - * If Time is nil, TLS uses time.Now. - */ - time: () => time.Time - /** - * Certificates contains one or more certificate chains to present to the - * other side of the connection. The first certificate compatible with the - * peer's requirements is selected automatically. - * - * Server configurations must set one of Certificates, GetCertificate or - * GetConfigForClient. Clients doing client-authentication may set either - * Certificates or GetClientCertificate. - * - * Note: if there are multiple Certificates, and they don't have the - * optional field Leaf set, certificate selection will incur a significant - * per-handshake performance cost. - */ - certificates: Array - /** - * NameToCertificate maps from a certificate name to an element of - * Certificates. Note that a certificate name can be of the form - * '*.example.com' and so doesn't have to be a domain name as such. - * - * Deprecated: NameToCertificate only allows associating a single - * certificate with a given name. Leave this field nil to let the library - * select the first compatible chain from Certificates. - */ - nameToCertificate: _TygojaDict - /** - * GetCertificate returns a Certificate based on the given - * ClientHelloInfo. It will only be called if the client supplies SNI - * information or if Certificates is empty. - * - * If GetCertificate is nil or returns nil, then the certificate is - * retrieved from NameToCertificate. If NameToCertificate is nil, the - * best element of Certificates will be used. - */ - getCertificate: (_arg0: ClientHelloInfo) => (Certificate | undefined) - /** - * GetClientCertificate, if not nil, is called when a server requests a - * certificate from a client. If set, the contents of Certificates will - * be ignored. - * - * If GetClientCertificate returns an error, the handshake will be - * aborted and that error will be returned. Otherwise - * GetClientCertificate must return a non-nil Certificate. If - * Certificate.Certificate is empty then no certificate will be sent to - * the server. If this is unacceptable to the server then it may abort - * the handshake. - * - * GetClientCertificate may be called multiple times for the same - * connection if renegotiation occurs or if TLS 1.3 is in use. - */ - getClientCertificate: (_arg0: CertificateRequestInfo) => (Certificate | undefined) - /** - * GetConfigForClient, if not nil, is called after a ClientHello is - * received from a client. It may return a non-nil Config in order to - * change the Config that will be used to handle this connection. If - * the returned Config is nil, the original Config will be used. The - * Config returned by this callback may not be subsequently modified. - * - * If GetConfigForClient is nil, the Config passed to Server() will be - * used for all connections. - * - * If SessionTicketKey was explicitly set on the returned Config, or if - * SetSessionTicketKeys was called on the returned Config, those keys will - * be used. Otherwise, the original Config keys will be used (and possibly - * rotated if they are automatically managed). - */ - getConfigForClient: (_arg0: ClientHelloInfo) => (Config | undefined) - /** - * VerifyPeerCertificate, if not nil, is called after normal - * certificate verification by either a TLS client or server. It - * receives the raw ASN.1 certificates provided by the peer and also - * any verified chains that normal processing found. If it returns a - * non-nil error, the handshake is aborted and that error results. - * - * If normal verification fails then the handshake will abort before - * considering this callback. If normal verification is disabled by - * setting InsecureSkipVerify, or (for a server) when ClientAuth is - * RequestClientCert or RequireAnyClientCert, then this callback will - * be considered but the verifiedChains argument will always be nil. - */ - verifyPeerCertificate: (rawCerts: Array, verifiedChains: Array>) => void - /** - * VerifyConnection, if not nil, is called after normal certificate - * verification and after VerifyPeerCertificate by either a TLS client - * or server. If it returns a non-nil error, the handshake is aborted - * and that error results. - * - * If normal verification fails then the handshake will abort before - * considering this callback. This callback will run for all connections - * regardless of InsecureSkipVerify or ClientAuth settings. - */ - verifyConnection: (_arg0: ConnectionState) => void - /** - * RootCAs defines the set of root certificate authorities - * that clients use when verifying server certificates. - * If RootCAs is nil, TLS uses the host's root CA set. - */ - rootCAs?: x509.CertPool - /** - * NextProtos is a list of supported application level protocols, in - * order of preference. If both peers support ALPN, the selected - * protocol will be one from this list, and the connection will fail - * if there is no mutually supported protocol. If NextProtos is empty - * or the peer doesn't support ALPN, the connection will succeed and - * ConnectionState.NegotiatedProtocol will be empty. - */ - nextProtos: Array - /** - * ServerName is used to verify the hostname on the returned - * certificates unless InsecureSkipVerify is given. It is also included - * in the client's handshake to support virtual hosting unless it is - * an IP address. - */ - serverName: string - /** - * ClientAuth determines the server's policy for - * TLS Client Authentication. The default is NoClientCert. - */ - clientAuth: ClientAuthType - /** - * ClientCAs defines the set of root certificate authorities - * that servers use if required to verify a client certificate - * by the policy in ClientAuth. - */ - clientCAs?: x509.CertPool - /** - * InsecureSkipVerify controls whether a client verifies the server's - * certificate chain and host name. If InsecureSkipVerify is true, crypto/tls - * accepts any certificate presented by the server and any host name in that - * certificate. In this mode, TLS is susceptible to machine-in-the-middle - * attacks unless custom verification is used. This should be used only for - * testing or in combination with VerifyConnection or VerifyPeerCertificate. - */ - insecureSkipVerify: boolean - /** - * CipherSuites is a list of enabled TLS 1.0–1.2 cipher suites. The order of - * the list is ignored. Note that TLS 1.3 ciphersuites are not configurable. - * - * If CipherSuites is nil, a safe default list is used. The default cipher - * suites might change over time. - */ - cipherSuites: Array - /** - * PreferServerCipherSuites is a legacy field and has no effect. - * - * It used to control whether the server would follow the client's or the - * server's preference. Servers now select the best mutually supported - * cipher suite based on logic that takes into account inferred client - * hardware, server hardware, and security. - * - * Deprecated: PreferServerCipherSuites is ignored. - */ - preferServerCipherSuites: boolean - /** - * SessionTicketsDisabled may be set to true to disable session ticket and - * PSK (resumption) support. Note that on clients, session ticket support is - * also disabled if ClientSessionCache is nil. - */ - sessionTicketsDisabled: boolean - /** - * SessionTicketKey is used by TLS servers to provide session resumption. - * See RFC 5077 and the PSK mode of RFC 8446. If zero, it will be filled - * with random data before the first server handshake. - * - * Deprecated: if this field is left at zero, session ticket keys will be - * automatically rotated every day and dropped after seven days. For - * customizing the rotation schedule or synchronizing servers that are - * terminating connections for the same host, use SetSessionTicketKeys. - */ - sessionTicketKey: string - /** - * ClientSessionCache is a cache of ClientSessionState entries for TLS - * session resumption. It is only used by clients. - */ - clientSessionCache: ClientSessionCache - /** - * MinVersion contains the minimum TLS version that is acceptable. - * - * By default, TLS 1.2 is currently used as the minimum when acting as a - * client, and TLS 1.0 when acting as a server. TLS 1.0 is the minimum - * supported by this package, both as a client and as a server. - * - * The client-side default can temporarily be reverted to TLS 1.0 by - * including the value "x509sha1=1" in the GODEBUG environment variable. - * Note that this option will be removed in Go 1.19 (but it will still be - * possible to set this field to VersionTLS10 explicitly). - */ - minVersion: number - /** - * MaxVersion contains the maximum TLS version that is acceptable. - * - * By default, the maximum version supported by this package is used, - * which is currently TLS 1.3. - */ - maxVersion: number - /** - * CurvePreferences contains the elliptic curves that will be used in - * an ECDHE handshake, in preference order. If empty, the default will - * be used. The client will use the first preference as the type for - * its key share in TLS 1.3. This may change in the future. - */ - curvePreferences: Array - /** - * DynamicRecordSizingDisabled disables adaptive sizing of TLS records. - * When true, the largest possible TLS record size is always used. When - * false, the size of TLS records may be adjusted in an attempt to - * improve latency. - */ - dynamicRecordSizingDisabled: boolean - /** - * Renegotiation controls what types of renegotiation are supported. - * The default, none, is correct for the vast majority of applications. - */ - renegotiation: RenegotiationSupport - /** - * KeyLogWriter optionally specifies a destination for TLS master secrets - * in NSS key log format that can be used to allow external programs - * such as Wireshark to decrypt TLS connections. - * See https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format. - * Use of KeyLogWriter compromises security and should only be - * used for debugging. - */ - keyLogWriter: io.Writer - } - interface Config { - /** - * Clone returns a shallow clone of c or nil if c is nil. It is safe to clone a Config that is - * being used concurrently by a TLS client or server. - */ - clone(): (Config | undefined) - } - interface Config { - /** - * SetSessionTicketKeys updates the session ticket keys for a server. - * - * The first key will be used when creating new tickets, while all keys can be - * used for decrypting tickets. It is safe to call this function while the - * server is running in order to rotate the session ticket keys. The function - * will panic if keys is empty. - * - * Calling this function will turn off automatic session ticket key rotation. - * - * If multiple servers are terminating connections for the same host they should - * all have the same session ticket keys. If the session ticket keys leaks, - * previously recorded and future TLS connections using those keys might be - * compromised. - */ - setSessionTicketKeys(keys: Array): void - } - interface Config { - /** - * BuildNameToCertificate parses c.Certificates and builds c.NameToCertificate - * from the CommonName and SubjectAlternateName fields of each of the leaf - * certificates. - * - * Deprecated: NameToCertificate only allows associating a single certificate - * with a given name. Leave that field nil to let the library select the first - * compatible chain from Certificates. - */ - buildNameToCertificate(): void - } -} - /** * Package textproto implements generic support for text-based request/response * protocols in the style of HTTP, NNTP, and SMTP. @@ -15116,231 +14534,6 @@ namespace multipart { * support. */ namespace http { - /** - * A Client is an HTTP client. Its zero value (DefaultClient) is a - * usable client that uses DefaultTransport. - * - * The Client's Transport typically has internal state (cached TCP - * connections), so Clients should be reused instead of created as - * needed. Clients are safe for concurrent use by multiple goroutines. - * - * A Client is higher-level than a RoundTripper (such as Transport) - * and additionally handles HTTP details such as cookies and - * redirects. - * - * When following redirects, the Client will forward all headers set on the - * initial Request except: - * - * • when forwarding sensitive headers like "Authorization", - * "WWW-Authenticate", and "Cookie" to untrusted targets. - * These headers will be ignored when following a redirect to a domain - * that is not a subdomain match or exact match of the initial domain. - * For example, a redirect from "foo.com" to either "foo.com" or "sub.foo.com" - * will forward the sensitive headers, but a redirect to "bar.com" will not. - * - * • when forwarding the "Cookie" header with a non-nil cookie Jar. - * Since each redirect may mutate the state of the cookie jar, - * a redirect may possibly alter a cookie set in the initial request. - * When forwarding the "Cookie" header, any mutated cookies will be omitted, - * with the expectation that the Jar will insert those mutated cookies - * with the updated values (assuming the origin matches). - * If Jar is nil, the initial cookies are forwarded without change. - */ - interface Client { - /** - * Transport specifies the mechanism by which individual - * HTTP requests are made. - * If nil, DefaultTransport is used. - */ - transport: RoundTripper - /** - * CheckRedirect specifies the policy for handling redirects. - * If CheckRedirect is not nil, the client calls it before - * following an HTTP redirect. The arguments req and via are - * the upcoming request and the requests made already, oldest - * first. If CheckRedirect returns an error, the Client's Get - * method returns both the previous Response (with its Body - * closed) and CheckRedirect's error (wrapped in a url.Error) - * instead of issuing the Request req. - * As a special case, if CheckRedirect returns ErrUseLastResponse, - * then the most recent response is returned with its body - * unclosed, along with a nil error. - * - * If CheckRedirect is nil, the Client uses its default policy, - * which is to stop after 10 consecutive requests. - */ - checkRedirect: (req: Request, via: Array<(Request | undefined)>) => void - /** - * Jar specifies the cookie jar. - * - * The Jar is used to insert relevant cookies into every - * outbound Request and is updated with the cookie values - * of every inbound Response. The Jar is consulted for every - * redirect that the Client follows. - * - * If Jar is nil, cookies are only sent if they are explicitly - * set on the Request. - */ - jar: CookieJar - /** - * Timeout specifies a time limit for requests made by this - * Client. The timeout includes connection time, any - * redirects, and reading the response body. The timer remains - * running after Get, Head, Post, or Do return and will - * interrupt reading of the Response.Body. - * - * A Timeout of zero means no timeout. - * - * The Client cancels requests to the underlying Transport - * as if the Request's Context ended. - * - * For compatibility, the Client will also use the deprecated - * CancelRequest method on Transport if found. New - * RoundTripper implementations should use the Request's Context - * for cancellation instead of implementing CancelRequest. - */ - timeout: time.Duration - } - interface Client { - /** - * Get issues a GET to the specified URL. If the response is one of the - * following redirect codes, Get follows the redirect after calling the - * Client's CheckRedirect function: - * - * ``` - * 301 (Moved Permanently) - * 302 (Found) - * 303 (See Other) - * 307 (Temporary Redirect) - * 308 (Permanent Redirect) - * ``` - * - * An error is returned if the Client's CheckRedirect function fails - * or if there was an HTTP protocol error. A non-2xx response doesn't - * cause an error. Any returned error will be of type *url.Error. The - * url.Error value's Timeout method will report true if the request - * timed out. - * - * When err is nil, resp always contains a non-nil resp.Body. - * Caller should close resp.Body when done reading from it. - * - * To make a request with custom headers, use NewRequest and Client.Do. - * - * To make a request with a specified context.Context, use NewRequestWithContext - * and Client.Do. - */ - get(url: string): (Response | undefined) - } - interface Client { - /** - * Do sends an HTTP request and returns an HTTP response, following - * policy (such as redirects, cookies, auth) as configured on the - * client. - * - * An error is returned if caused by client policy (such as - * CheckRedirect), or failure to speak HTTP (such as a network - * connectivity problem). A non-2xx status code doesn't cause an - * error. - * - * If the returned error is nil, the Response will contain a non-nil - * Body which the user is expected to close. If the Body is not both - * read to EOF and closed, the Client's underlying RoundTripper - * (typically Transport) may not be able to re-use a persistent TCP - * connection to the server for a subsequent "keep-alive" request. - * - * The request Body, if non-nil, will be closed by the underlying - * Transport, even on errors. - * - * On error, any Response can be ignored. A non-nil Response with a - * non-nil error only occurs when CheckRedirect fails, and even then - * the returned Response.Body is already closed. - * - * Generally Get, Post, or PostForm will be used instead of Do. - * - * If the server replies with a redirect, the Client first uses the - * CheckRedirect function to determine whether the redirect should be - * followed. If permitted, a 301, 302, or 303 redirect causes - * subsequent requests to use HTTP method GET - * (or HEAD if the original request was HEAD), with no body. - * A 307 or 308 redirect preserves the original HTTP method and body, - * provided that the Request.GetBody function is defined. - * The NewRequest function automatically sets GetBody for common - * standard library body types. - * - * Any returned error will be of type *url.Error. The url.Error - * value's Timeout method will report true if the request timed out. - */ - do(req: Request): (Response | undefined) - } - interface Client { - /** - * Post issues a POST to the specified URL. - * - * Caller should close resp.Body when done reading from it. - * - * If the provided body is an io.Closer, it is closed after the - * request. - * - * To set custom headers, use NewRequest and Client.Do. - * - * To make a request with a specified context.Context, use NewRequestWithContext - * and Client.Do. - * - * See the Client.Do method documentation for details on how redirects - * are handled. - */ - post(url: string, body: io.Reader): (Response | undefined) - } - interface Client { - /** - * PostForm issues a POST to the specified URL, - * with data's keys and values URL-encoded as the request body. - * - * The Content-Type header is set to application/x-www-form-urlencoded. - * To set other headers, use NewRequest and Client.Do. - * - * When err is nil, resp always contains a non-nil resp.Body. - * Caller should close resp.Body when done reading from it. - * - * See the Client.Do method documentation for details on how redirects - * are handled. - * - * To make a request with a specified context.Context, use NewRequestWithContext - * and Client.Do. - */ - postForm(url: string, data: url.Values): (Response | undefined) - } - interface Client { - /** - * Head issues a HEAD to the specified URL. If the response is one of the - * following redirect codes, Head follows the redirect after calling the - * Client's CheckRedirect function: - * - * ``` - * 301 (Moved Permanently) - * 302 (Found) - * 303 (See Other) - * 307 (Temporary Redirect) - * 308 (Permanent Redirect) - * ``` - * - * To make a request with a specified context.Context, use NewRequestWithContext - * and Client.Do. - */ - head(url: string): (Response | undefined) - } - interface Client { - /** - * CloseIdleConnections closes any connections on its Transport which - * were previously connected from previous requests but are now - * sitting idle in a "keep-alive" state. It does not interrupt any - * connections currently in use. - * - * If the Client's Transport does not have a CloseIdleConnections method - * then this method does nothing. - */ - closeIdleConnections(): void - } /** * A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an * HTTP response or the Cookie header of an HTTP request. @@ -15561,7 +14754,7 @@ namespace http { * The pointer is shared between responses and should not be * modified. */ - tls?: tls.ConnectionState + tls?: any } interface Response { /** @@ -15764,7 +14957,7 @@ namespace types { /** * Value implements the [driver.Valuer] interface. */ - value(): driver.Value + value(): any } interface DateTime { /** @@ -15853,2244 +15046,6 @@ namespace schema { } } -/** - * Package pflag is a drop-in replacement for Go's flag package, implementing - * POSIX/GNU-style --flags. - * - * pflag is compatible with the GNU extensions to the POSIX recommendations - * for command-line options. See - * http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html - * - * Usage: - * - * pflag is a drop-in replacement of Go's native flag package. If you import - * pflag under the name "flag" then all code should continue to function - * with no changes. - * - * ``` - * import flag "github.com/spf13/pflag" - * ``` - * - * There is one exception to this: if you directly instantiate the Flag struct - * there is one more field "Shorthand" that you will need to set. - * Most code never instantiates this struct directly, and instead uses - * functions such as String(), BoolVar(), and Var(), and is therefore - * unaffected. - * - * Define flags using flag.String(), Bool(), Int(), etc. - * - * This declares an integer flag, -flagname, stored in the pointer ip, with type *int. - * ``` - * var ip = flag.Int("flagname", 1234, "help message for flagname") - * ``` - * If you like, you can bind the flag to a variable using the Var() functions. - * ``` - * var flagvar int - * func init() { - * flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") - * } - * ``` - * Or you can create custom flags that satisfy the Value interface (with - * pointer receivers) and couple them to flag parsing by - * ``` - * flag.Var(&flagVal, "name", "help message for flagname") - * ``` - * For such flags, the default value is just the initial value of the variable. - * - * After all flags are defined, call - * ``` - * flag.Parse() - * ``` - * to parse the command line into the defined flags. - * - * Flags may then be used directly. If you're using the flags themselves, - * they are all pointers; if you bind to variables, they're values. - * ``` - * fmt.Println("ip has value ", *ip) - * fmt.Println("flagvar has value ", flagvar) - * ``` - * - * After parsing, the arguments after the flag are available as the - * slice flag.Args() or individually as flag.Arg(i). - * The arguments are indexed from 0 through flag.NArg()-1. - * - * The pflag package also defines some new functions that are not in flag, - * that give one-letter shorthands for flags. You can use these by appending - * 'P' to the name of any function that defines a flag. - * ``` - * var ip = flag.IntP("flagname", "f", 1234, "help message") - * var flagvar bool - * func init() { - * flag.BoolVarP(&flagvar, "boolname", "b", true, "help message") - * } - * flag.VarP(&flagval, "varname", "v", "help message") - * ``` - * Shorthand letters can be used with single dashes on the command line. - * Boolean shorthand flags can be combined with other shorthand flags. - * - * Command line flag syntax: - * ``` - * --flag // boolean flags only - * --flag=x - * ``` - * - * Unlike the flag package, a single dash before an option means something - * different than a double dash. Single dashes signify a series of shorthand - * letters for flags. All but the last shorthand letter must be boolean flags. - * ``` - * // boolean flags - * -f - * -abc - * // non-boolean flags - * -n 1234 - * -Ifile - * // mixed - * -abcs "hello" - * -abcn1234 - * ``` - * - * Flag parsing stops after the terminator "--". Unlike the flag package, - * flags can be interspersed with arguments anywhere on the command line - * before this terminator. - * - * Integer flags accept 1234, 0664, 0x1234 and may be negative. - * Boolean flags (in their long form) accept 1, 0, t, f, true, false, - * TRUE, FALSE, True, False. - * Duration flags accept any input valid for time.ParseDuration. - * - * The default set of command-line flags is controlled by - * top-level functions. The FlagSet type allows one to define - * independent sets of flags, such as to implement subcommands - * in a command-line interface. The methods of FlagSet are - * analogous to the top-level functions for the command-line - * flag set. - */ -namespace pflag { - interface FlagSet { - /** - * GetBool return the bool value of a flag with the given name - */ - getBool(name: string): boolean - } - interface FlagSet { - /** - * BoolVar defines a bool flag with specified name, default value, and usage string. - * The argument p points to a bool variable in which to store the value of the flag. - */ - boolVar(p: boolean, name: string, value: boolean, usage: string): void - } - interface FlagSet { - /** - * BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash. - */ - boolVarP(p: boolean, name: string, value: boolean, usage: string): void - } - interface FlagSet { - /** - * Bool defines a bool flag with specified name, default value, and usage string. - * The return value is the address of a bool variable that stores the value of the flag. - */ - bool(name: string, value: boolean, usage: string): (boolean | undefined) - } - interface FlagSet { - /** - * BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash. - */ - boolP(name: string, value: boolean, usage: string): (boolean | undefined) - } - interface FlagSet { - /** - * GetBoolSlice returns the []bool value of a flag with the given name. - */ - getBoolSlice(name: string): Array - } - interface FlagSet { - /** - * BoolSliceVar defines a boolSlice flag with specified name, default value, and usage string. - * The argument p points to a []bool variable in which to store the value of the flag. - */ - boolSliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - boolSliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * BoolSlice defines a []bool flag with specified name, default value, and usage string. - * The return value is the address of a []bool variable that stores the value of the flag. - */ - boolSlice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash. - */ - boolSliceP(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * GetBytesHex return the []byte value of a flag with the given name - */ - getBytesHex(name: string): string - } - interface FlagSet { - /** - * BytesHexVar defines an []byte flag with specified name, default value, and usage string. - * The argument p points to an []byte variable in which to store the value of the flag. - */ - bytesHexVar(p: string, name: string, value: string, usage: string): void - } - interface FlagSet { - /** - * BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash. - */ - bytesHexVarP(p: string, name: string, value: string, usage: string): void - } - interface FlagSet { - /** - * BytesHex defines an []byte flag with specified name, default value, and usage string. - * The return value is the address of an []byte variable that stores the value of the flag. - */ - bytesHex(name: string, value: string, usage: string): (string | undefined) - } - interface FlagSet { - /** - * BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash. - */ - bytesHexP(name: string, value: string, usage: string): (string | undefined) - } - interface FlagSet { - /** - * GetBytesBase64 return the []byte value of a flag with the given name - */ - getBytesBase64(name: string): string - } - interface FlagSet { - /** - * BytesBase64Var defines an []byte flag with specified name, default value, and usage string. - * The argument p points to an []byte variable in which to store the value of the flag. - */ - bytesBase64Var(p: string, name: string, value: string, usage: string): void - } - interface FlagSet { - /** - * BytesBase64VarP is like BytesBase64Var, but accepts a shorthand letter that can be used after a single dash. - */ - bytesBase64VarP(p: string, name: string, value: string, usage: string): void - } - interface FlagSet { - /** - * BytesBase64 defines an []byte flag with specified name, default value, and usage string. - * The return value is the address of an []byte variable that stores the value of the flag. - */ - bytesBase64(name: string, value: string, usage: string): (string | undefined) - } - interface FlagSet { - /** - * BytesBase64P is like BytesBase64, but accepts a shorthand letter that can be used after a single dash. - */ - bytesBase64P(name: string, value: string, usage: string): (string | undefined) - } - interface FlagSet { - /** - * GetCount return the int value of a flag with the given name - */ - getCount(name: string): number - } - interface FlagSet { - /** - * CountVar defines a count flag with specified name, default value, and usage string. - * The argument p points to an int variable in which to store the value of the flag. - * A count flag will add 1 to its value every time it is found on the command line - */ - countVar(p: number, name: string, usage: string): void - } - interface FlagSet { - /** - * CountVarP is like CountVar only take a shorthand for the flag name. - */ - countVarP(p: number, name: string, usage: string): void - } - interface FlagSet { - /** - * Count defines a count flag with specified name, default value, and usage string. - * The return value is the address of an int variable that stores the value of the flag. - * A count flag will add 1 to its value every time it is found on the command line - */ - count(name: string, usage: string): (number | undefined) - } - interface FlagSet { - /** - * CountP is like Count only takes a shorthand for the flag name. - */ - countP(name: string, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetDuration return the duration value of a flag with the given name - */ - getDuration(name: string): time.Duration - } - interface FlagSet { - /** - * DurationVar defines a time.Duration flag with specified name, default value, and usage string. - * The argument p points to a time.Duration variable in which to store the value of the flag. - */ - durationVar(p: time.Duration, name: string, value: time.Duration, usage: string): void - } - interface FlagSet { - /** - * DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash. - */ - durationVarP(p: time.Duration, name: string, value: time.Duration, usage: string): void - } - interface FlagSet { - /** - * Duration defines a time.Duration flag with specified name, default value, and usage string. - * The return value is the address of a time.Duration variable that stores the value of the flag. - */ - duration(name: string, value: time.Duration, usage: string): (time.Duration | undefined) - } - interface FlagSet { - /** - * DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash. - */ - durationP(name: string, value: time.Duration, usage: string): (time.Duration | undefined) - } - interface FlagSet { - /** - * GetDurationSlice returns the []time.Duration value of a flag with the given name - */ - getDurationSlice(name: string): Array - } - interface FlagSet { - /** - * DurationSliceVar defines a durationSlice flag with specified name, default value, and usage string. - * The argument p points to a []time.Duration variable in which to store the value of the flag. - */ - durationSliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - durationSliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * DurationSlice defines a []time.Duration flag with specified name, default value, and usage string. - * The return value is the address of a []time.Duration variable that stores the value of the flag. - */ - durationSlice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash. - */ - durationSliceP(name: string, value: Array, usage: string): (Array | undefined) - } - // @ts-ignore - import goflag = flag - /** - * NormalizedName is a flag name that has been normalized according to rules - * for the FlagSet (e.g. making '-' and '_' equivalent). - */ - interface NormalizedName extends String{} - /** - * A FlagSet represents a set of defined flags. - */ - interface FlagSet { - /** - * Usage is the function called when an error occurs while parsing flags. - * The field is a function (not a method) that may be changed to point to - * a custom error handler. - */ - usage: () => void - /** - * SortFlags is used to indicate, if user wants to have sorted flags in - * help/usage messages. - */ - sortFlags: boolean - /** - * ParseErrorsWhitelist is used to configure a whitelist of errors - */ - parseErrorsWhitelist: ParseErrorsWhitelist - } - /** - * A Flag represents the state of a flag. - */ - interface Flag { - name: string // name as it appears on command line - shorthand: string // one-letter abbreviated flag - usage: string // help message - value: Value // value as set - defValue: string // default value (as text); for usage message - changed: boolean // If the user set the value (or if left to default) - noOptDefVal: string // default value (as text); if the flag is on the command line without any options - deprecated: string // If this flag is deprecated, this string is the new or now thing to use - hidden: boolean // used by cobra.Command to allow flags to be hidden from help/usage text - shorthandDeprecated: string // If the shorthand of this flag is deprecated, this string is the new or now thing to use - annotations: _TygojaDict // used by cobra.Command bash autocomple code - } - interface FlagSet { - /** - * SetNormalizeFunc allows you to add a function which can translate flag names. - * Flags added to the FlagSet will be translated and then when anything tries to - * look up the flag that will also be translated. So it would be possible to create - * a flag named "getURL" and have it translated to "geturl". A user could then pass - * "--getUrl" which may also be translated to "geturl" and everything will work. - */ - setNormalizeFunc(n: (f: FlagSet, name: string) => NormalizedName): void - } - interface FlagSet { - /** - * GetNormalizeFunc returns the previously set NormalizeFunc of a function which - * does no translation, if not set previously. - */ - getNormalizeFunc(): (f: FlagSet, name: string) => NormalizedName - } - interface FlagSet { - /** - * SetOutput sets the destination for usage and error messages. - * If output is nil, os.Stderr is used. - */ - setOutput(output: io.Writer): void - } - interface FlagSet { - /** - * VisitAll visits the flags in lexicographical order or - * in primordial order if f.SortFlags is false, calling fn for each. - * It visits all flags, even those not set. - */ - visitAll(fn: (_arg0: Flag) => void): void - } - interface FlagSet { - /** - * HasFlags returns a bool to indicate if the FlagSet has any flags defined. - */ - hasFlags(): boolean - } - interface FlagSet { - /** - * HasAvailableFlags returns a bool to indicate if the FlagSet has any flags - * that are not hidden. - */ - hasAvailableFlags(): boolean - } - interface FlagSet { - /** - * Visit visits the flags in lexicographical order or - * in primordial order if f.SortFlags is false, calling fn for each. - * It visits only those flags that have been set. - */ - visit(fn: (_arg0: Flag) => void): void - } - interface FlagSet { - /** - * Lookup returns the Flag structure of the named flag, returning nil if none exists. - */ - lookup(name: string): (Flag | undefined) - } - interface FlagSet { - /** - * ShorthandLookup returns the Flag structure of the short handed flag, - * returning nil if none exists. - * It panics, if len(name) > 1. - */ - shorthandLookup(name: string): (Flag | undefined) - } - interface FlagSet { - /** - * ArgsLenAtDash will return the length of f.Args at the moment when a -- was - * found during arg parsing. This allows your program to know which args were - * before the -- and which came after. - */ - argsLenAtDash(): number - } - interface FlagSet { - /** - * MarkDeprecated indicated that a flag is deprecated in your program. It will - * continue to function but will not show up in help or usage messages. Using - * this flag will also print the given usageMessage. - */ - markDeprecated(name: string, usageMessage: string): void - } - interface FlagSet { - /** - * MarkShorthandDeprecated will mark the shorthand of a flag deprecated in your - * program. It will continue to function but will not show up in help or usage - * messages. Using this flag will also print the given usageMessage. - */ - markShorthandDeprecated(name: string, usageMessage: string): void - } - interface FlagSet { - /** - * MarkHidden sets a flag to 'hidden' in your program. It will continue to - * function but will not show up in help or usage messages. - */ - markHidden(name: string): void - } - interface FlagSet { - /** - * Set sets the value of the named flag. - */ - set(name: string): void - } - interface FlagSet { - /** - * SetAnnotation allows one to set arbitrary annotations on a flag in the FlagSet. - * This is sometimes used by spf13/cobra programs which want to generate additional - * bash completion information. - */ - setAnnotation(name: string, values: Array): void - } - interface FlagSet { - /** - * Changed returns true if the flag was explicitly set during Parse() and false - * otherwise - */ - changed(name: string): boolean - } - interface FlagSet { - /** - * PrintDefaults prints, to standard error unless configured - * otherwise, the default values of all defined flags in the set. - */ - printDefaults(): void - } - interface FlagSet { - /** - * FlagUsagesWrapped returns a string containing the usage information - * for all flags in the FlagSet. Wrapped to `cols` columns (0 for no - * wrapping) - */ - flagUsagesWrapped(cols: number): string - } - interface FlagSet { - /** - * FlagUsages returns a string containing the usage information for all flags in - * the FlagSet - */ - flagUsages(): string - } - interface FlagSet { - /** - * NFlag returns the number of flags that have been set. - */ - nFlag(): number - } - interface FlagSet { - /** - * Arg returns the i'th argument. Arg(0) is the first remaining argument - * after flags have been processed. - */ - arg(i: number): string - } - interface FlagSet { - /** - * NArg is the number of arguments remaining after flags have been processed. - */ - nArg(): number - } - interface FlagSet { - /** - * Args returns the non-flag arguments. - */ - args(): Array - } - interface FlagSet { - /** - * Var defines a flag with the specified name and usage string. The type and - * value of the flag are represented by the first argument, of type Value, which - * typically holds a user-defined implementation of Value. For instance, the - * caller could create a flag that turns a comma-separated string into a slice - * of strings by giving the slice the methods of Value; in particular, Set would - * decompose the comma-separated string into the slice. - */ - var(value: Value, name: string, usage: string): void - } - interface FlagSet { - /** - * VarPF is like VarP, but returns the flag created - */ - varPF(value: Value, name: string): (Flag | undefined) - } - interface FlagSet { - /** - * VarP is like Var, but accepts a shorthand letter that can be used after a single dash. - */ - varP(value: Value, name: string): void - } - interface FlagSet { - /** - * AddFlag will add the flag to the FlagSet - */ - addFlag(flag: Flag): void - } - interface FlagSet { - /** - * AddFlagSet adds one FlagSet to another. If a flag is already present in f - * the flag from newSet will be ignored. - */ - addFlagSet(newSet: FlagSet): void - } - interface FlagSet { - /** - * Parse parses flag definitions from the argument list, which should not - * include the command name. Must be called after all flags in the FlagSet - * are defined and before flags are accessed by the program. - * The return value will be ErrHelp if -help was set but not defined. - */ - parse(arguments: Array): void - } - interface FlagSet { - /** - * ParseAll parses flag definitions from the argument list, which should not - * include the command name. The arguments for fn are flag and value. Must be - * called after all flags in the FlagSet are defined and before flags are - * accessed by the program. The return value will be ErrHelp if -help was set - * but not defined. - */ - parseAll(arguments: Array, fn: (flag: Flag, value: string) => void): void - } - interface FlagSet { - /** - * Parsed reports whether f.Parse has been called. - */ - parsed(): boolean - } - interface FlagSet { - /** - * SetInterspersed sets whether to support interspersed option/non-option arguments. - */ - setInterspersed(interspersed: boolean): void - } - interface FlagSet { - /** - * Init sets the name and error handling property for a flag set. - * By default, the zero FlagSet uses an empty name and the - * ContinueOnError error handling policy. - */ - init(name: string, errorHandling: ErrorHandling): void - } - interface FlagSet { - /** - * GetFloat32 return the float32 value of a flag with the given name - */ - getFloat32(name: string): number - } - interface FlagSet { - /** - * Float32Var defines a float32 flag with specified name, default value, and usage string. - * The argument p points to a float32 variable in which to store the value of the flag. - */ - float32Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. - */ - float32VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Float32 defines a float32 flag with specified name, default value, and usage string. - * The return value is the address of a float32 variable that stores the value of the flag. - */ - float32(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. - */ - float32P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetFloat32Slice return the []float32 value of a flag with the given name - */ - getFloat32Slice(name: string): Array - } - interface FlagSet { - /** - * Float32SliceVar defines a float32Slice flag with specified name, default value, and usage string. - * The argument p points to a []float32 variable in which to store the value of the flag. - */ - float32SliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * Float32SliceVarP is like Float32SliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - float32SliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * Float32Slice defines a []float32 flag with specified name, default value, and usage string. - * The return value is the address of a []float32 variable that stores the value of the flag. - */ - float32Slice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * Float32SliceP is like Float32Slice, but accepts a shorthand letter that can be used after a single dash. - */ - float32SliceP(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * GetFloat64 return the float64 value of a flag with the given name - */ - getFloat64(name: string): number - } - interface FlagSet { - /** - * Float64Var defines a float64 flag with specified name, default value, and usage string. - * The argument p points to a float64 variable in which to store the value of the flag. - */ - float64Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash. - */ - float64VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Float64 defines a float64 flag with specified name, default value, and usage string. - * The return value is the address of a float64 variable that stores the value of the flag. - */ - float64(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash. - */ - float64P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetFloat64Slice return the []float64 value of a flag with the given name - */ - getFloat64Slice(name: string): Array - } - interface FlagSet { - /** - * Float64SliceVar defines a float64Slice flag with specified name, default value, and usage string. - * The argument p points to a []float64 variable in which to store the value of the flag. - */ - float64SliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * Float64SliceVarP is like Float64SliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - float64SliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * Float64Slice defines a []float64 flag with specified name, default value, and usage string. - * The return value is the address of a []float64 variable that stores the value of the flag. - */ - float64Slice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * Float64SliceP is like Float64Slice, but accepts a shorthand letter that can be used after a single dash. - */ - float64SliceP(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * AddGoFlag will add the given *flag.Flag to the pflag.FlagSet - */ - addGoFlag(goflag: goflag.Flag): void - } - interface FlagSet { - /** - * AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet - */ - addGoFlagSet(newSet: goflag.FlagSet): void - } - interface FlagSet { - /** - * GetInt return the int value of a flag with the given name - */ - getInt(name: string): number - } - interface FlagSet { - /** - * IntVar defines an int flag with specified name, default value, and usage string. - * The argument p points to an int variable in which to store the value of the flag. - */ - intVar(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash. - */ - intVarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int defines an int flag with specified name, default value, and usage string. - * The return value is the address of an int variable that stores the value of the flag. - */ - int(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * IntP is like Int, but accepts a shorthand letter that can be used after a single dash. - */ - intP(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetInt16 returns the int16 value of a flag with the given name - */ - getInt16(name: string): number - } - interface FlagSet { - /** - * Int16Var defines an int16 flag with specified name, default value, and usage string. - * The argument p points to an int16 variable in which to store the value of the flag. - */ - int16Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int16VarP is like Int16Var, but accepts a shorthand letter that can be used after a single dash. - */ - int16VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int16 defines an int16 flag with specified name, default value, and usage string. - * The return value is the address of an int16 variable that stores the value of the flag. - */ - int16(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Int16P is like Int16, but accepts a shorthand letter that can be used after a single dash. - */ - int16P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetInt32 return the int32 value of a flag with the given name - */ - getInt32(name: string): number - } - interface FlagSet { - /** - * Int32Var defines an int32 flag with specified name, default value, and usage string. - * The argument p points to an int32 variable in which to store the value of the flag. - */ - int32Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash. - */ - int32VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int32 defines an int32 flag with specified name, default value, and usage string. - * The return value is the address of an int32 variable that stores the value of the flag. - */ - int32(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash. - */ - int32P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetInt32Slice return the []int32 value of a flag with the given name - */ - getInt32Slice(name: string): Array - } - interface FlagSet { - /** - * Int32SliceVar defines a int32Slice flag with specified name, default value, and usage string. - * The argument p points to a []int32 variable in which to store the value of the flag. - */ - int32SliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * Int32SliceVarP is like Int32SliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - int32SliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * Int32Slice defines a []int32 flag with specified name, default value, and usage string. - * The return value is the address of a []int32 variable that stores the value of the flag. - */ - int32Slice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * Int32SliceP is like Int32Slice, but accepts a shorthand letter that can be used after a single dash. - */ - int32SliceP(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * GetInt64 return the int64 value of a flag with the given name - */ - getInt64(name: string): number - } - interface FlagSet { - /** - * Int64Var defines an int64 flag with specified name, default value, and usage string. - * The argument p points to an int64 variable in which to store the value of the flag. - */ - int64Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash. - */ - int64VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int64 defines an int64 flag with specified name, default value, and usage string. - * The return value is the address of an int64 variable that stores the value of the flag. - */ - int64(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash. - */ - int64P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetInt64Slice return the []int64 value of a flag with the given name - */ - getInt64Slice(name: string): Array - } - interface FlagSet { - /** - * Int64SliceVar defines a int64Slice flag with specified name, default value, and usage string. - * The argument p points to a []int64 variable in which to store the value of the flag. - */ - int64SliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * Int64SliceVarP is like Int64SliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - int64SliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * Int64Slice defines a []int64 flag with specified name, default value, and usage string. - * The return value is the address of a []int64 variable that stores the value of the flag. - */ - int64Slice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * Int64SliceP is like Int64Slice, but accepts a shorthand letter that can be used after a single dash. - */ - int64SliceP(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * GetInt8 return the int8 value of a flag with the given name - */ - getInt8(name: string): number - } - interface FlagSet { - /** - * Int8Var defines an int8 flag with specified name, default value, and usage string. - * The argument p points to an int8 variable in which to store the value of the flag. - */ - int8Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash. - */ - int8VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int8 defines an int8 flag with specified name, default value, and usage string. - * The return value is the address of an int8 variable that stores the value of the flag. - */ - int8(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash. - */ - int8P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetIntSlice return the []int value of a flag with the given name - */ - getIntSlice(name: string): Array - } - interface FlagSet { - /** - * IntSliceVar defines a intSlice flag with specified name, default value, and usage string. - * The argument p points to a []int variable in which to store the value of the flag. - */ - intSliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - intSliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * IntSlice defines a []int flag with specified name, default value, and usage string. - * The return value is the address of a []int variable that stores the value of the flag. - */ - intSlice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash. - */ - intSliceP(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * GetIP return the net.IP value of a flag with the given name - */ - getIP(name: string): net.IP - } - interface FlagSet { - /** - * IPVar defines an net.IP flag with specified name, default value, and usage string. - * The argument p points to an net.IP variable in which to store the value of the flag. - */ - ipVar(p: net.IP, name: string, value: net.IP, usage: string): void - } - interface FlagSet { - /** - * IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash. - */ - ipVarP(p: net.IP, name: string, value: net.IP, usage: string): void - } - interface FlagSet { - /** - * IP defines an net.IP flag with specified name, default value, and usage string. - * The return value is the address of an net.IP variable that stores the value of the flag. - */ - ip(name: string, value: net.IP, usage: string): (net.IP | undefined) - } - interface FlagSet { - /** - * IPP is like IP, but accepts a shorthand letter that can be used after a single dash. - */ - ipp(name: string, value: net.IP, usage: string): (net.IP | undefined) - } - interface FlagSet { - /** - * GetIPSlice returns the []net.IP value of a flag with the given name - */ - getIPSlice(name: string): Array - } - interface FlagSet { - /** - * IPSliceVar defines a ipSlice flag with specified name, default value, and usage string. - * The argument p points to a []net.IP variable in which to store the value of the flag. - */ - ipSliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - ipSliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * IPSlice defines a []net.IP flag with specified name, default value, and usage string. - * The return value is the address of a []net.IP variable that stores the value of that flag. - */ - ipSlice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash. - */ - ipSliceP(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * GetIPv4Mask return the net.IPv4Mask value of a flag with the given name - */ - getIPv4Mask(name: string): net.IPMask - } - interface FlagSet { - /** - * IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string. - * The argument p points to an net.IPMask variable in which to store the value of the flag. - */ - ipMaskVar(p: net.IPMask, name: string, value: net.IPMask, usage: string): void - } - interface FlagSet { - /** - * IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash. - */ - ipMaskVarP(p: net.IPMask, name: string, value: net.IPMask, usage: string): void - } - interface FlagSet { - /** - * IPMask defines an net.IPMask flag with specified name, default value, and usage string. - * The return value is the address of an net.IPMask variable that stores the value of the flag. - */ - ipMask(name: string, value: net.IPMask, usage: string): (net.IPMask | undefined) - } - interface FlagSet { - /** - * IPMaskP is like IPMask, but accepts a shorthand letter that can be used after a single dash. - */ - ipMaskP(name: string, value: net.IPMask, usage: string): (net.IPMask | undefined) - } - interface FlagSet { - /** - * GetIPNet return the net.IPNet value of a flag with the given name - */ - getIPNet(name: string): net.IPNet - } - interface FlagSet { - /** - * IPNetVar defines an net.IPNet flag with specified name, default value, and usage string. - * The argument p points to an net.IPNet variable in which to store the value of the flag. - */ - ipNetVar(p: net.IPNet, name: string, value: net.IPNet, usage: string): void - } - interface FlagSet { - /** - * IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash. - */ - ipNetVarP(p: net.IPNet, name: string, value: net.IPNet, usage: string): void - } - interface FlagSet { - /** - * IPNet defines an net.IPNet flag with specified name, default value, and usage string. - * The return value is the address of an net.IPNet variable that stores the value of the flag. - */ - ipNet(name: string, value: net.IPNet, usage: string): (net.IPNet | undefined) - } - interface FlagSet { - /** - * IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash. - */ - ipNetP(name: string, value: net.IPNet, usage: string): (net.IPNet | undefined) - } - interface FlagSet { - /** - * GetString return the string value of a flag with the given name - */ - getString(name: string): string - } - interface FlagSet { - /** - * StringVar defines a string flag with specified name, default value, and usage string. - * The argument p points to a string variable in which to store the value of the flag. - */ - stringVar(p: string, name: string, value: string, usage: string): void - } - interface FlagSet { - /** - * StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash. - */ - stringVarP(p: string, name: string, value: string, usage: string): void - } - interface FlagSet { - /** - * String defines a string flag with specified name, default value, and usage string. - * The return value is the address of a string variable that stores the value of the flag. - */ - string(name: string, value: string, usage: string): (string | undefined) - } - interface FlagSet { - /** - * StringP is like String, but accepts a shorthand letter that can be used after a single dash. - */ - stringP(name: string, value: string, usage: string): (string | undefined) - } - interface FlagSet { - /** - * GetStringArray return the []string value of a flag with the given name - */ - getStringArray(name: string): Array - } - interface FlagSet { - /** - * StringArrayVar defines a string flag with specified name, default value, and usage string. - * The argument p points to a []string variable in which to store the values of the multiple flags. - * The value of each argument will not try to be separated by comma. Use a StringSlice for that. - */ - stringArrayVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash. - */ - stringArrayVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * StringArray defines a string flag with specified name, default value, and usage string. - * The return value is the address of a []string variable that stores the value of the flag. - * The value of each argument will not try to be separated by comma. Use a StringSlice for that. - */ - stringArray(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash. - */ - stringArrayP(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * GetStringSlice return the []string value of a flag with the given name - */ - getStringSlice(name: string): Array - } - interface FlagSet { - /** - * StringSliceVar defines a string flag with specified name, default value, and usage string. - * The argument p points to a []string variable in which to store the value of the flag. - * Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. - * For example: - * ``` - * --ss="v1,v2" --ss="v3" - * ``` - * will result in - * ``` - * []string{"v1", "v2", "v3"} - * ``` - */ - stringSliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - stringSliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * StringSlice defines a string flag with specified name, default value, and usage string. - * The return value is the address of a []string variable that stores the value of the flag. - * Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. - * For example: - * ``` - * --ss="v1,v2" --ss="v3" - * ``` - * will result in - * ``` - * []string{"v1", "v2", "v3"} - * ``` - */ - stringSlice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash. - */ - stringSliceP(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * GetStringToInt return the map[string]int value of a flag with the given name - */ - getStringToInt(name: string): _TygojaDict - } - interface FlagSet { - /** - * StringToIntVar defines a string flag with specified name, default value, and usage string. - * The argument p points to a map[string]int variable in which to store the values of the multiple flags. - * The value of each argument will not try to be separated by comma - */ - stringToIntVar(p: _TygojaDict, name: string, value: _TygojaDict, usage: string): void - } - interface FlagSet { - /** - * StringToIntVarP is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash. - */ - stringToIntVarP(p: _TygojaDict, name: string, value: _TygojaDict, usage: string): void - } - interface FlagSet { - /** - * StringToInt defines a string flag with specified name, default value, and usage string. - * The return value is the address of a map[string]int variable that stores the value of the flag. - * The value of each argument will not try to be separated by comma - */ - stringToInt(name: string, value: _TygojaDict, usage: string): (_TygojaDict | undefined) - } - interface FlagSet { - /** - * StringToIntP is like StringToInt, but accepts a shorthand letter that can be used after a single dash. - */ - stringToIntP(name: string, value: _TygojaDict, usage: string): (_TygojaDict | undefined) - } - interface FlagSet { - /** - * GetStringToInt64 return the map[string]int64 value of a flag with the given name - */ - getStringToInt64(name: string): _TygojaDict - } - interface FlagSet { - /** - * StringToInt64Var defines a string flag with specified name, default value, and usage string. - * The argument p point64s to a map[string]int64 variable in which to store the values of the multiple flags. - * The value of each argument will not try to be separated by comma - */ - stringToInt64Var(p: _TygojaDict, name: string, value: _TygojaDict, usage: string): void - } - interface FlagSet { - /** - * StringToInt64VarP is like StringToInt64Var, but accepts a shorthand letter that can be used after a single dash. - */ - stringToInt64VarP(p: _TygojaDict, name: string, value: _TygojaDict, usage: string): void - } - interface FlagSet { - /** - * StringToInt64 defines a string flag with specified name, default value, and usage string. - * The return value is the address of a map[string]int64 variable that stores the value of the flag. - * The value of each argument will not try to be separated by comma - */ - stringToInt64(name: string, value: _TygojaDict, usage: string): (_TygojaDict | undefined) - } - interface FlagSet { - /** - * StringToInt64P is like StringToInt64, but accepts a shorthand letter that can be used after a single dash. - */ - stringToInt64P(name: string, value: _TygojaDict, usage: string): (_TygojaDict | undefined) - } - interface FlagSet { - /** - * GetStringToString return the map[string]string value of a flag with the given name - */ - getStringToString(name: string): _TygojaDict - } - interface FlagSet { - /** - * StringToStringVar defines a string flag with specified name, default value, and usage string. - * The argument p points to a map[string]string variable in which to store the values of the multiple flags. - * The value of each argument will not try to be separated by comma - */ - stringToStringVar(p: _TygojaDict, name: string, value: _TygojaDict, usage: string): void - } - interface FlagSet { - /** - * StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash. - */ - stringToStringVarP(p: _TygojaDict, name: string, value: _TygojaDict, usage: string): void - } - interface FlagSet { - /** - * StringToString defines a string flag with specified name, default value, and usage string. - * The return value is the address of a map[string]string variable that stores the value of the flag. - * The value of each argument will not try to be separated by comma - */ - stringToString(name: string, value: _TygojaDict, usage: string): (_TygojaDict | undefined) - } - interface FlagSet { - /** - * StringToStringP is like StringToString, but accepts a shorthand letter that can be used after a single dash. - */ - stringToStringP(name: string, value: _TygojaDict, usage: string): (_TygojaDict | undefined) - } - interface FlagSet { - /** - * GetUint return the uint value of a flag with the given name - */ - getUint(name: string): number - } - interface FlagSet { - /** - * UintVar defines a uint flag with specified name, default value, and usage string. - * The argument p points to a uint variable in which to store the value of the flag. - */ - uintVar(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash. - */ - uintVarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint defines a uint flag with specified name, default value, and usage string. - * The return value is the address of a uint variable that stores the value of the flag. - */ - uint(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * UintP is like Uint, but accepts a shorthand letter that can be used after a single dash. - */ - uintP(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetUint16 return the uint16 value of a flag with the given name - */ - getUint16(name: string): number - } - interface FlagSet { - /** - * Uint16Var defines a uint flag with specified name, default value, and usage string. - * The argument p points to a uint variable in which to store the value of the flag. - */ - uint16Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash. - */ - uint16VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint16 defines a uint flag with specified name, default value, and usage string. - * The return value is the address of a uint variable that stores the value of the flag. - */ - uint16(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash. - */ - uint16P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetUint32 return the uint32 value of a flag with the given name - */ - getUint32(name: string): number - } - interface FlagSet { - /** - * Uint32Var defines a uint32 flag with specified name, default value, and usage string. - * The argument p points to a uint32 variable in which to store the value of the flag. - */ - uint32Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash. - */ - uint32VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint32 defines a uint32 flag with specified name, default value, and usage string. - * The return value is the address of a uint32 variable that stores the value of the flag. - */ - uint32(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash. - */ - uint32P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetUint64 return the uint64 value of a flag with the given name - */ - getUint64(name: string): number - } - interface FlagSet { - /** - * Uint64Var defines a uint64 flag with specified name, default value, and usage string. - * The argument p points to a uint64 variable in which to store the value of the flag. - */ - uint64Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash. - */ - uint64VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint64 defines a uint64 flag with specified name, default value, and usage string. - * The return value is the address of a uint64 variable that stores the value of the flag. - */ - uint64(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash. - */ - uint64P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetUint8 return the uint8 value of a flag with the given name - */ - getUint8(name: string): number - } - interface FlagSet { - /** - * Uint8Var defines a uint8 flag with specified name, default value, and usage string. - * The argument p points to a uint8 variable in which to store the value of the flag. - */ - uint8Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash. - */ - uint8VarP(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint8 defines a uint8 flag with specified name, default value, and usage string. - * The return value is the address of a uint8 variable that stores the value of the flag. - */ - uint8(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash. - */ - uint8P(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * GetUintSlice returns the []uint value of a flag with the given name. - */ - getUintSlice(name: string): Array - } - interface FlagSet { - /** - * UintSliceVar defines a uintSlice flag with specified name, default value, and usage string. - * The argument p points to a []uint variable in which to store the value of the flag. - */ - uintSliceVar(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * UintSliceVarP is like UintSliceVar, but accepts a shorthand letter that can be used after a single dash. - */ - uintSliceVarP(p: Array, name: string, value: Array, usage: string): void - } - interface FlagSet { - /** - * UintSlice defines a []uint flag with specified name, default value, and usage string. - * The return value is the address of a []uint variable that stores the value of the flag. - */ - uintSlice(name: string, value: Array, usage: string): (Array | undefined) - } - interface FlagSet { - /** - * UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash. - */ - uintSliceP(name: string, value: Array, usage: string): (Array | undefined) - } -} - -/** - * Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces. - * In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code. - */ -namespace cobra { - interface PositionalArgs {(cmd: Command, args: Array): void } - // @ts-ignore - import flag = pflag - /** - * FParseErrWhitelist configures Flag parse errors to be ignored - */ - interface FParseErrWhitelist extends flag.ParseErrorsWhitelist{} - /** - * Group Structure to manage groups for commands - */ - interface Group { - id: string - title: string - } - /** - * ShellCompDirective is a bit map representing the different behaviors the shell - * can be instructed to have once completions have been provided. - */ - interface ShellCompDirective extends Number{} - /** - * CompletionOptions are the options to control shell completion - */ - interface CompletionOptions { - /** - * DisableDefaultCmd prevents Cobra from creating a default 'completion' command - */ - disableDefaultCmd: boolean - /** - * DisableNoDescFlag prevents Cobra from creating the '--no-descriptions' flag - * for shells that support completion descriptions - */ - disableNoDescFlag: boolean - /** - * DisableDescriptions turns off all completion descriptions for shells - * that support them - */ - disableDescriptions: boolean - /** - * HiddenDefaultCmd makes the default 'completion' command hidden - */ - hiddenDefaultCmd: boolean - } -} - -/** - * Package oauth2 provides support for making - * OAuth2 authorized and authenticated HTTP requests, - * as specified in RFC 6749. - * It can additionally grant authorization with Bearer JWT. - */ -namespace oauth2 { - /** - * An AuthCodeOption is passed to Config.AuthCodeURL. - */ - interface AuthCodeOption { - } - /** - * Token represents the credentials used to authorize - * the requests to access protected resources on the OAuth 2.0 - * provider's backend. - * - * Most users of this package should not access fields of Token - * directly. They're exported mostly for use by related packages - * implementing derivative OAuth2 flows. - */ - interface Token { - /** - * AccessToken is the token that authorizes and authenticates - * the requests. - */ - accessToken: string - /** - * TokenType is the type of token. - * The Type method returns either this or "Bearer", the default. - */ - tokenType: string - /** - * RefreshToken is a token that's used by the application - * (as opposed to the user) to refresh the access token - * if it expires. - */ - refreshToken: string - /** - * Expiry is the optional expiration time of the access token. - * - * If zero, TokenSource implementations will reuse the same - * token forever and RefreshToken or equivalent - * mechanisms for that TokenSource will not be used. - */ - expiry: time.Time - } - interface Token { - /** - * Type returns t.TokenType if non-empty, else "Bearer". - */ - type(): string - } - interface Token { - /** - * SetAuthHeader sets the Authorization header to r using the access - * token in t. - * - * This method is unnecessary when using Transport or an HTTP Client - * returned by this package. - */ - setAuthHeader(r: http.Request): void - } - interface Token { - /** - * WithExtra returns a new Token that's a clone of t, but using the - * provided raw extra map. This is only intended for use by packages - * implementing derivative OAuth2 flows. - */ - withExtra(extra: { - }): (Token | undefined) - } - interface Token { - /** - * Extra returns an extra field. - * Extra fields are key-value pairs returned by the server as a - * part of the token retrieval response. - */ - extra(key: string): { - } - } - interface Token { - /** - * Valid reports whether t is non-nil, has an AccessToken, and is not expired. - */ - valid(): boolean - } -} - -namespace mailer { - /** - * Mailer defines a base mail client interface. - */ - interface Mailer { - /** - * Send sends an email with the provided Message. - */ - send(message: Message): void - } -} - -namespace hook { - /** - * Hook defines a concurrent safe structure for handling event hooks - * (aka. callbacks propagation). - */ - interface Hook { - } - interface Hook { - /** - * PreAdd registers a new handler to the hook by prepending it to the existing queue. - * - * Returns an autogenerated hook id that could be used later to remove the hook with Hook.Remove(id). - */ - preAdd(fn: Handler): string - } - interface Hook { - /** - * Add registers a new handler to the hook by appending it to the existing queue. - * - * Returns an autogenerated hook id that could be used later to remove the hook with Hook.Remove(id). - */ - add(fn: Handler): string - } - interface Hook { - /** - * Remove removes a single hook handler by its id. - */ - remove(id: string): void - } - interface Hook { - /** - * RemoveAll removes all registered handlers. - */ - removeAll(): void - } - interface Hook { - /** - * Trigger executes all registered hook handlers one by one - * with the specified `data` as an argument. - * - * Optionally, this method allows also to register additional one off - * handlers that will be temporary appended to the handlers queue. - * - * The execution stops when: - * - hook.StopPropagation is returned in one of the handlers - * - any non-nil error is returned in one of the handlers - */ - trigger(data: T, ...oneOffHandlers: Handler[]): 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 _subjpZgw = mainHook - interface TaggedHook extends _subjpZgw { - } - interface TaggedHook { - /** - * CanTriggerOn checks if the current TaggedHook can be triggered with - * the provided event data tags. - */ - canTriggerOn(tags: Array): boolean - } - interface TaggedHook { - /** - * PreAdd registers a new handler to the hook by prepending it to the existing queue. - * - * The fn handler will be called only if the event data tags satisfy h.CanTriggerOn. - */ - preAdd(fn: Handler): string - } - interface TaggedHook { - /** - * Add registers a new handler to the hook by appending it to the existing queue. - * - * The fn handler will be called only if the event data tags satisfy h.CanTriggerOn. - */ - add(fn: Handler): string - } -} - -/** - * Package sql provides a generic interface around SQL (or SQL-like) - * databases. - * - * The sql package must be used in conjunction with a database driver. - * See https://golang.org/s/sqldrivers for a list of drivers. - * - * Drivers that do not support context cancellation will not return until - * after the query is completed. - * - * For usage examples, see the wiki page at - * https://golang.org/s/sqlwiki. - */ -namespace sql { - /** - * IsolationLevel is the transaction isolation level used in TxOptions. - */ - interface IsolationLevel extends Number{} - interface IsolationLevel { - /** - * String returns the name of the transaction isolation level. - */ - string(): string - } - /** - * DBStats contains database statistics. - */ - interface DBStats { - maxOpenConnections: number // Maximum number of open connections to the database. - /** - * Pool Status - */ - openConnections: number // The number of established connections both in use and idle. - inUse: number // The number of connections currently in use. - idle: number // The number of idle connections. - /** - * Counters - */ - waitCount: number // The total number of connections waited for. - waitDuration: time.Duration // The total time blocked waiting for a new connection. - maxIdleClosed: number // The total number of connections closed due to SetMaxIdleConns. - maxIdleTimeClosed: number // The total number of connections closed due to SetConnMaxIdleTime. - maxLifetimeClosed: number // The total number of connections closed due to SetConnMaxLifetime. - } - /** - * Conn represents a single database connection rather than a pool of database - * connections. Prefer running queries from DB unless there is a specific - * need for a continuous single database connection. - * - * A Conn must call Close to return the connection to the database pool - * and may do so concurrently with a running query. - * - * After a call to Close, all operations on the - * connection fail with ErrConnDone. - */ - interface Conn { - } - interface Conn { - /** - * PingContext verifies the connection to the database is still alive. - */ - pingContext(ctx: context.Context): void - } - interface Conn { - /** - * ExecContext executes a query without returning any rows. - * The args are for any placeholder parameters in the query. - */ - execContext(ctx: context.Context, query: string, ...args: any[]): Result - } - interface Conn { - /** - * QueryContext executes a query that returns rows, typically a SELECT. - * The args are for any placeholder parameters in the query. - */ - queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined) - } - interface Conn { - /** - * QueryRowContext executes a query that is expected to return at most one row. - * QueryRowContext always returns a non-nil value. Errors are deferred until - * Row's Scan method is called. - * If the query selects no rows, the *Row's Scan will return ErrNoRows. - * Otherwise, the *Row's Scan scans the first selected row and discards - * the rest. - */ - queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined) - } - interface Conn { - /** - * PrepareContext creates a prepared statement for later queries or executions. - * Multiple queries or executions may be run concurrently from the - * returned statement. - * The caller must call the statement's Close method - * when the statement is no longer needed. - * - * The provided context is used for the preparation of the statement, not for the - * execution of the statement. - */ - prepareContext(ctx: context.Context, query: string): (Stmt | undefined) - } - interface Conn { - /** - * Raw executes f exposing the underlying driver connection for the - * duration of f. The driverConn must not be used outside of f. - * - * Once f returns and err is not driver.ErrBadConn, the Conn will continue to be usable - * until Conn.Close is called. - */ - raw(f: (driverConn: any) => void): void - } - interface Conn { - /** - * BeginTx starts a transaction. - * - * The provided context is used until the transaction is committed or rolled back. - * If the context is canceled, the sql package will roll back - * the transaction. Tx.Commit will return an error if the context provided to - * BeginTx is canceled. - * - * The provided TxOptions is optional and may be nil if defaults should be used. - * If a non-default isolation level is used that the driver doesn't support, - * an error will be returned. - */ - beginTx(ctx: context.Context, opts: TxOptions): (Tx | undefined) - } - interface Conn { - /** - * Close returns the connection to the connection pool. - * All operations after a Close will return with ErrConnDone. - * Close is safe to call concurrently with other operations and will - * block until all other operations finish. It may be useful to first - * cancel any used context and then call close directly after. - */ - close(): void - } - /** - * ColumnType contains the name and type of a column. - */ - interface ColumnType { - } - interface ColumnType { - /** - * Name returns the name or alias of the column. - */ - name(): string - } - interface ColumnType { - /** - * Length returns the column type length for variable length column types such - * as text and binary field types. If the type length is unbounded the value will - * be math.MaxInt64 (any database limits will still apply). - * If the column type is not variable length, such as an int, or if not supported - * by the driver ok is false. - */ - length(): [number, boolean] - } - interface ColumnType { - /** - * DecimalSize returns the scale and precision of a decimal type. - * If not applicable or if not supported ok is false. - */ - decimalSize(): [number, boolean] - } - interface ColumnType { - /** - * ScanType returns a Go type suitable for scanning into using Rows.Scan. - * If a driver does not support this property ScanType will return - * the type of an empty interface. - */ - scanType(): reflect.Type - } - interface ColumnType { - /** - * Nullable reports whether the column may be null. - * If a driver does not support this property ok will be false. - */ - nullable(): boolean - } - interface ColumnType { - /** - * DatabaseTypeName returns the database system name of the column type. If an empty - * string is returned, then the driver type name is not supported. - * Consult your driver documentation for a list of driver data types. Length specifiers - * are not included. - * Common type names include "VARCHAR", "TEXT", "NVARCHAR", "DECIMAL", "BOOL", - * "INT", and "BIGINT". - */ - databaseTypeName(): string - } - /** - * Row is the result of calling QueryRow to select a single row. - */ - interface Row { - } - interface Row { - /** - * Scan copies the columns from the matched row into the values - * pointed at by dest. See the documentation on Rows.Scan for details. - * If more than one row matches the query, - * Scan uses the first row and discards the rest. If no row matches - * the query, Scan returns ErrNoRows. - */ - scan(...dest: any[]): void - } - interface Row { - /** - * Err provides a way for wrapping packages to check for - * query errors without calling Scan. - * Err returns the error, if any, that was encountered while running the query. - * If this error is not nil, this error will also be returned from Scan. - */ - err(): void - } -} - -namespace migrate { - interface Migration { - file: string - up: (db: dbx.Builder) => void - down: (db: dbx.Builder) => void - } -} - -namespace subscriptions { - /** - * Broker defines a struct for managing subscriptions clients. - */ - interface Broker { - } - interface Broker { - /** - * Clients returns a shallow copy of all registered clients indexed - * with their connection id. - */ - clients(): _TygojaDict - } - interface Broker { - /** - * ClientById finds a registered client by its id. - * - * Returns non-nil error when client with clientId is not registered. - */ - clientById(clientId: string): Client - } - interface Broker { - /** - * Register adds a new client to the broker instance. - */ - register(client: Client): void - } - interface Broker { - /** - * Unregister removes a single client by its id. - * - * If client with clientId doesn't exist, this method does nothing. - */ - unregister(clientId: string): void - } -} - -/** - * Package models implements all PocketBase DB models and DTOs. - */ -namespace models { - /** - * Model defines an interface with common methods that all db models should have. - */ - interface Model { - tableName(): string - isNew(): boolean - markAsNew(): void - markAsNotNew(): void - hasId(): boolean - getId(): string - setId(id: string): void - getCreated(): types.DateTime - getUpdated(): types.DateTime - refreshId(): void - refreshCreated(): void - refreshUpdated(): void - } - /** - * BaseModel defines common fields and methods used by all other models. - */ - interface BaseModel { - id: string - created: types.DateTime - updated: types.DateTime - } - interface BaseModel { - /** - * HasId returns whether the model has a nonzero id. - */ - hasId(): boolean - } - interface BaseModel { - /** - * GetId returns the model id. - */ - getId(): string - } - interface BaseModel { - /** - * SetId sets the model id to the provided string value. - */ - setId(id: string): void - } - interface BaseModel { - /** - * MarkAsNew marks the model as "new" (aka. enforces m.IsNew() to be true). - */ - markAsNew(): void - } - interface BaseModel { - /** - * MarkAsNotNew marks the model as "not new" (aka. enforces m.IsNew() to be false) - */ - markAsNotNew(): void - } - interface BaseModel { - /** - * IsNew indicates what type of db query (insert or update) - * should be used with the model instance. - */ - isNew(): boolean - } - interface BaseModel { - /** - * GetCreated returns the model Created datetime. - */ - getCreated(): types.DateTime - } - interface BaseModel { - /** - * GetUpdated returns the model Updated datetime. - */ - getUpdated(): types.DateTime - } - interface BaseModel { - /** - * RefreshId generates and sets a new model id. - * - * The generated id is a cryptographically random 15 characters length string. - */ - refreshId(): void - } - interface BaseModel { - /** - * RefreshCreated updates the model Created field with the current datetime. - */ - refreshCreated(): void - } - interface BaseModel { - /** - * RefreshUpdated updates the model Updated field with the current datetime. - */ - refreshUpdated(): void - } - interface BaseModel { - /** - * PostScan implements the [dbx.PostScanner] interface. - * - * It is executed right after the model was populated with the db row values. - */ - postScan(): void - } - // @ts-ignore - import validation = ozzo_validation - /** - * CollectionBaseOptions defines the "base" Collection.Options fields. - */ - interface CollectionBaseOptions { - } - interface CollectionBaseOptions { - /** - * Validate implements [validation.Validatable] interface. - */ - validate(): void - } - /** - * CollectionAuthOptions defines the "auth" Collection.Options fields. - */ - interface CollectionAuthOptions { - manageRule?: string - allowOAuth2Auth: boolean - allowUsernameAuth: boolean - allowEmailAuth: boolean - requireEmail: boolean - exceptEmailDomains: Array - onlyEmailDomains: Array - minPasswordLength: number - } - interface CollectionAuthOptions { - /** - * Validate implements [validation.Validatable] interface. - */ - validate(): void - } - /** - * CollectionViewOptions defines the "view" Collection.Options fields. - */ - interface CollectionViewOptions { - query: string - } - interface CollectionViewOptions { - /** - * Validate implements [validation.Validatable] interface. - */ - validate(): void - } - type _subFqmsh = BaseModel - interface Param extends _subFqmsh { - key: string - value: types.JsonRaw - } - interface Param { - tableName(): string - } - type _subWnaEV = BaseModel - interface Request extends _subWnaEV { - url: string - method: string - status: number - auth: string - userIp: string - remoteIp: string - referer: string - userAgent: string - meta: types.JsonMap - } - interface Request { - tableName(): string - } - interface TableInfoRow { - /** - * the `db:"pk"` tag has special semantic so we cannot rename - * the original field without specifying a custom mapper - */ - pk: number - index: number - name: string - type: string - notNull: boolean - defaultValue: types.JsonRaw - } -} - /** * Package echo implements high performance, minimalist Go web framework. * @@ -18538,6 +15493,380 @@ namespace echo { } } +/** + * Package sql provides a generic interface around SQL (or SQL-like) + * databases. + * + * The sql package must be used in conjunction with a database driver. + * See https://golang.org/s/sqldrivers for a list of drivers. + * + * Drivers that do not support context cancellation will not return until + * after the query is completed. + * + * For usage examples, see the wiki page at + * https://golang.org/s/sqlwiki. + */ +namespace sql { + /** + * IsolationLevel is the transaction isolation level used in TxOptions. + */ + interface IsolationLevel extends Number{} + interface IsolationLevel { + /** + * String returns the name of the transaction isolation level. + */ + string(): string + } + /** + * DBStats contains database statistics. + */ + interface DBStats { + maxOpenConnections: number // Maximum number of open connections to the database. + /** + * Pool Status + */ + openConnections: number // The number of established connections both in use and idle. + inUse: number // The number of connections currently in use. + idle: number // The number of idle connections. + /** + * Counters + */ + waitCount: number // The total number of connections waited for. + waitDuration: time.Duration // The total time blocked waiting for a new connection. + maxIdleClosed: number // The total number of connections closed due to SetMaxIdleConns. + maxIdleTimeClosed: number // The total number of connections closed due to SetConnMaxIdleTime. + maxLifetimeClosed: number // The total number of connections closed due to SetConnMaxLifetime. + } + /** + * Conn represents a single database connection rather than a pool of database + * connections. Prefer running queries from DB unless there is a specific + * need for a continuous single database connection. + * + * A Conn must call Close to return the connection to the database pool + * and may do so concurrently with a running query. + * + * After a call to Close, all operations on the + * connection fail with ErrConnDone. + */ + interface Conn { + } + interface Conn { + /** + * PingContext verifies the connection to the database is still alive. + */ + pingContext(ctx: context.Context): void + } + interface Conn { + /** + * ExecContext executes a query without returning any rows. + * The args are for any placeholder parameters in the query. + */ + execContext(ctx: context.Context, query: string, ...args: any[]): Result + } + interface Conn { + /** + * QueryContext executes a query that returns rows, typically a SELECT. + * The args are for any placeholder parameters in the query. + */ + queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows | undefined) + } + interface Conn { + /** + * QueryRowContext executes a query that is expected to return at most one row. + * QueryRowContext always returns a non-nil value. Errors are deferred until + * Row's Scan method is called. + * If the query selects no rows, the *Row's Scan will return ErrNoRows. + * Otherwise, the *Row's Scan scans the first selected row and discards + * the rest. + */ + queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row | undefined) + } + interface Conn { + /** + * PrepareContext creates a prepared statement for later queries or executions. + * Multiple queries or executions may be run concurrently from the + * returned statement. + * The caller must call the statement's Close method + * when the statement is no longer needed. + * + * The provided context is used for the preparation of the statement, not for the + * execution of the statement. + */ + prepareContext(ctx: context.Context, query: string): (Stmt | undefined) + } + interface Conn { + /** + * Raw executes f exposing the underlying driver connection for the + * duration of f. The driverConn must not be used outside of f. + * + * Once f returns and err is not driver.ErrBadConn, the Conn will continue to be usable + * until Conn.Close is called. + */ + raw(f: (driverConn: any) => void): void + } + interface Conn { + /** + * BeginTx starts a transaction. + * + * The provided context is used until the transaction is committed or rolled back. + * If the context is canceled, the sql package will roll back + * the transaction. Tx.Commit will return an error if the context provided to + * BeginTx is canceled. + * + * The provided TxOptions is optional and may be nil if defaults should be used. + * If a non-default isolation level is used that the driver doesn't support, + * an error will be returned. + */ + beginTx(ctx: context.Context, opts: TxOptions): (Tx | undefined) + } + interface Conn { + /** + * Close returns the connection to the connection pool. + * All operations after a Close will return with ErrConnDone. + * Close is safe to call concurrently with other operations and will + * block until all other operations finish. It may be useful to first + * cancel any used context and then call close directly after. + */ + close(): void + } + /** + * ColumnType contains the name and type of a column. + */ + interface ColumnType { + } + interface ColumnType { + /** + * Name returns the name or alias of the column. + */ + name(): string + } + interface ColumnType { + /** + * Length returns the column type length for variable length column types such + * as text and binary field types. If the type length is unbounded the value will + * be math.MaxInt64 (any database limits will still apply). + * If the column type is not variable length, such as an int, or if not supported + * by the driver ok is false. + */ + length(): [number, boolean] + } + interface ColumnType { + /** + * DecimalSize returns the scale and precision of a decimal type. + * If not applicable or if not supported ok is false. + */ + decimalSize(): [number, boolean] + } + interface ColumnType { + /** + * ScanType returns a Go type suitable for scanning into using Rows.Scan. + * If a driver does not support this property ScanType will return + * the type of an empty interface. + */ + scanType(): any + } + interface ColumnType { + /** + * Nullable reports whether the column may be null. + * If a driver does not support this property ok will be false. + */ + nullable(): boolean + } + interface ColumnType { + /** + * DatabaseTypeName returns the database system name of the column type. If an empty + * string is returned, then the driver type name is not supported. + * Consult your driver documentation for a list of driver data types. Length specifiers + * are not included. + * Common type names include "VARCHAR", "TEXT", "NVARCHAR", "DECIMAL", "BOOL", + * "INT", and "BIGINT". + */ + databaseTypeName(): string + } + /** + * Row is the result of calling QueryRow to select a single row. + */ + interface Row { + } + interface Row { + /** + * Scan copies the columns from the matched row into the values + * pointed at by dest. See the documentation on Rows.Scan for details. + * If more than one row matches the query, + * Scan uses the first row and discards the rest. If no row matches + * the query, Scan returns ErrNoRows. + */ + scan(...dest: any[]): void + } + interface Row { + /** + * Err provides a way for wrapping packages to check for + * query errors without calling Scan. + * Err returns the error, if any, that was encountered while running the query. + * If this error is not nil, this error will also be returned from Scan. + */ + err(): void + } +} + +namespace migrate { + interface Migration { + file: string + up: (db: dbx.Builder) => void + down: (db: dbx.Builder) => void + } +} + +/** + * Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces. + * In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code. + */ +namespace cobra { + interface PositionalArgs {(cmd: Command, args: Array): void } + // @ts-ignore + import flag = pflag + /** + * FParseErrWhitelist configures Flag parse errors to be ignored + */ + interface FParseErrWhitelist extends _TygojaAny{} + /** + * Group Structure to manage groups for commands + */ + interface Group { + id: string + title: string + } + /** + * ShellCompDirective is a bit map representing the different behaviors the shell + * can be instructed to have once completions have been provided. + */ + interface ShellCompDirective extends Number{} + /** + * CompletionOptions are the options to control shell completion + */ + interface CompletionOptions { + /** + * DisableDefaultCmd prevents Cobra from creating a default 'completion' command + */ + disableDefaultCmd: boolean + /** + * DisableNoDescFlag prevents Cobra from creating the '--no-descriptions' flag + * for shells that support completion descriptions + */ + disableNoDescFlag: boolean + /** + * DisableDescriptions turns off all completion descriptions for shells + * that support them + */ + disableDescriptions: boolean + /** + * HiddenDefaultCmd makes the default 'completion' command hidden + */ + hiddenDefaultCmd: boolean + } +} + +/** + * Package oauth2 provides support for making + * OAuth2 authorized and authenticated HTTP requests, + * as specified in RFC 6749. + * It can additionally grant authorization with Bearer JWT. + */ +namespace oauth2 { + /** + * An AuthCodeOption is passed to Config.AuthCodeURL. + */ + interface AuthCodeOption { + } + /** + * Token represents the credentials used to authorize + * the requests to access protected resources on the OAuth 2.0 + * provider's backend. + * + * Most users of this package should not access fields of Token + * directly. They're exported mostly for use by related packages + * implementing derivative OAuth2 flows. + */ + interface Token { + /** + * AccessToken is the token that authorizes and authenticates + * the requests. + */ + accessToken: string + /** + * TokenType is the type of token. + * The Type method returns either this or "Bearer", the default. + */ + tokenType: string + /** + * RefreshToken is a token that's used by the application + * (as opposed to the user) to refresh the access token + * if it expires. + */ + refreshToken: string + /** + * Expiry is the optional expiration time of the access token. + * + * If zero, TokenSource implementations will reuse the same + * token forever and RefreshToken or equivalent + * mechanisms for that TokenSource will not be used. + */ + expiry: time.Time + } + interface Token { + /** + * Type returns t.TokenType if non-empty, else "Bearer". + */ + type(): string + } + interface Token { + /** + * SetAuthHeader sets the Authorization header to r using the access + * token in t. + * + * This method is unnecessary when using Transport or an HTTP Client + * returned by this package. + */ + setAuthHeader(r: http.Request): void + } + interface Token { + /** + * WithExtra returns a new Token that's a clone of t, but using the + * provided raw extra map. This is only intended for use by packages + * implementing derivative OAuth2 flows. + */ + withExtra(extra: { + }): (Token | undefined) + } + interface Token { + /** + * Extra returns an extra field. + * Extra fields are key-value pairs returned by the server as a + * part of the token retrieval response. + */ + extra(key: string): { + } + } + interface Token { + /** + * Valid reports whether t is non-nil, has an AccessToken, and is not expired. + */ + valid(): boolean + } +} + +namespace mailer { + /** + * Mailer defines a base mail client interface. + */ + interface Mailer { + /** + * Send sends an email with the provided Message. + */ + send(message: Message): void + } +} + namespace settings { // @ts-ignore import validation = ozzo_validation @@ -18677,6 +16006,193 @@ namespace settings { } } +/** + * Package models implements all PocketBase DB models and DTOs. + */ +namespace models { + /** + * Model defines an interface with common methods that all db models should have. + */ + interface Model { + tableName(): string + isNew(): boolean + markAsNew(): void + markAsNotNew(): void + hasId(): boolean + getId(): string + setId(id: string): void + getCreated(): types.DateTime + getUpdated(): types.DateTime + refreshId(): void + refreshCreated(): void + refreshUpdated(): void + } + /** + * BaseModel defines common fields and methods used by all other models. + */ + interface BaseModel { + id: string + created: types.DateTime + updated: types.DateTime + } + interface BaseModel { + /** + * HasId returns whether the model has a nonzero id. + */ + hasId(): boolean + } + interface BaseModel { + /** + * GetId returns the model id. + */ + getId(): string + } + interface BaseModel { + /** + * SetId sets the model id to the provided string value. + */ + setId(id: string): void + } + interface BaseModel { + /** + * MarkAsNew marks the model as "new" (aka. enforces m.IsNew() to be true). + */ + markAsNew(): void + } + interface BaseModel { + /** + * MarkAsNotNew marks the model as "not new" (aka. enforces m.IsNew() to be false) + */ + markAsNotNew(): void + } + interface BaseModel { + /** + * IsNew indicates what type of db query (insert or update) + * should be used with the model instance. + */ + isNew(): boolean + } + interface BaseModel { + /** + * GetCreated returns the model Created datetime. + */ + getCreated(): types.DateTime + } + interface BaseModel { + /** + * GetUpdated returns the model Updated datetime. + */ + getUpdated(): types.DateTime + } + interface BaseModel { + /** + * RefreshId generates and sets a new model id. + * + * The generated id is a cryptographically random 15 characters length string. + */ + refreshId(): void + } + interface BaseModel { + /** + * RefreshCreated updates the model Created field with the current datetime. + */ + refreshCreated(): void + } + interface BaseModel { + /** + * RefreshUpdated updates the model Updated field with the current datetime. + */ + refreshUpdated(): void + } + interface BaseModel { + /** + * PostScan implements the [dbx.PostScanner] interface. + * + * It is executed right after the model was populated with the db row values. + */ + postScan(): void + } + // @ts-ignore + import validation = ozzo_validation + /** + * CollectionBaseOptions defines the "base" Collection.Options fields. + */ + interface CollectionBaseOptions { + } + interface CollectionBaseOptions { + /** + * Validate implements [validation.Validatable] interface. + */ + validate(): void + } + /** + * CollectionAuthOptions defines the "auth" Collection.Options fields. + */ + interface CollectionAuthOptions { + manageRule?: string + allowOAuth2Auth: boolean + allowUsernameAuth: boolean + allowEmailAuth: boolean + requireEmail: boolean + exceptEmailDomains: Array + onlyEmailDomains: Array + minPasswordLength: number + } + interface CollectionAuthOptions { + /** + * Validate implements [validation.Validatable] interface. + */ + validate(): void + } + /** + * CollectionViewOptions defines the "view" Collection.Options fields. + */ + interface CollectionViewOptions { + query: string + } + interface CollectionViewOptions { + /** + * Validate implements [validation.Validatable] interface. + */ + validate(): void + } + type _subbHrVN = BaseModel + interface Param extends _subbHrVN { + key: string + value: types.JsonRaw + } + interface Param { + tableName(): string + } + type _subbQguO = BaseModel + interface Request extends _subbQguO { + url: string + method: string + status: number + auth: string + userIp: string + remoteIp: string + referer: string + userAgent: string + meta: types.JsonMap + } + interface Request { + tableName(): string + } + interface TableInfoRow { + /** + * the `db:"pk"` tag has special semantic so we cannot rename + * the original field without specifying a custom mapper + */ + pk: number + index: number + name: string + type: string + notNull: boolean + defaultValue: types.JsonRaw + } +} + /** * Package daos handles common PocketBase DB model manipulations. * @@ -18695,6 +16211,124 @@ namespace daos { } } +namespace subscriptions { + /** + * Broker defines a struct for managing subscriptions clients. + */ + interface Broker { + } + interface Broker { + /** + * Clients returns a shallow copy of all registered clients indexed + * with their connection id. + */ + clients(): _TygojaDict + } + interface Broker { + /** + * ClientById finds a registered client by its id. + * + * Returns non-nil error when client with clientId is not registered. + */ + clientById(clientId: string): Client + } + interface Broker { + /** + * Register adds a new client to the broker instance. + */ + register(client: Client): void + } + interface Broker { + /** + * Unregister removes a single client by its id. + * + * If client with clientId doesn't exist, this method does nothing. + */ + unregister(clientId: string): void + } +} + +namespace hook { + /** + * Hook defines a concurrent safe structure for handling event hooks + * (aka. callbacks propagation). + */ + interface Hook { + } + interface Hook { + /** + * PreAdd registers a new handler to the hook by prepending it to the existing queue. + * + * Returns an autogenerated hook id that could be used later to remove the hook with Hook.Remove(id). + */ + preAdd(fn: Handler): string + } + interface Hook { + /** + * Add registers a new handler to the hook by appending it to the existing queue. + * + * Returns an autogenerated hook id that could be used later to remove the hook with Hook.Remove(id). + */ + add(fn: Handler): string + } + interface Hook { + /** + * Remove removes a single hook handler by its id. + */ + remove(id: string): void + } + interface Hook { + /** + * RemoveAll removes all registered handlers. + */ + removeAll(): void + } + interface Hook { + /** + * Trigger executes all registered hook handlers one by one + * with the specified `data` as an argument. + * + * Optionally, this method allows also to register additional one off + * handlers that will be temporary appended to the handlers queue. + * + * The execution stops when: + * - hook.StopPropagation is returned in one of the handlers + * - any non-nil error is returned in one of the handlers + */ + trigger(data: T, ...oneOffHandlers: Handler[]): 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 _subrBUiS = mainHook + interface TaggedHook extends _subrBUiS { + } + interface TaggedHook { + /** + * CanTriggerOn checks if the current TaggedHook can be triggered with + * the provided event data tags. + */ + canTriggerOn(tags: Array): boolean + } + interface TaggedHook { + /** + * PreAdd registers a new handler to the hook by prepending it to the existing queue. + * + * The fn handler will be called only if the event data tags satisfy h.CanTriggerOn. + */ + preAdd(fn: Handler): string + } + interface TaggedHook { + /** + * Add registers a new handler to the hook by appending it to the existing queue. + * + * The fn handler will be called only if the event data tags satisfy h.CanTriggerOn. + */ + add(fn: Handler): string + } +} + /** * Package core is the backbone of PocketBase. * @@ -18711,18 +16345,18 @@ namespace core { app: App router?: echo.Echo server?: http.Server - certManager?: autocert.Manager + certManager?: any } interface ApiErrorEvent { httpContext: echo.Context error: Error } - type _subOlMbn = BaseModelEvent - interface ModelEvent extends _subOlMbn { + type _subxwdjC = BaseModelEvent + interface ModelEvent extends _subxwdjC { dao?: daos.Dao } - type _subNwvmu = BaseCollectionEvent - interface MailerRecordEvent extends _subNwvmu { + type _subOsGxr = BaseCollectionEvent + interface MailerRecordEvent extends _subOsGxr { mailClient: mailer.Mailer message?: mailer.Message record?: models.Record @@ -18761,50 +16395,50 @@ namespace core { oldSettings?: settings.Settings newSettings?: settings.Settings } - type _subbnnDk = BaseCollectionEvent - interface RecordsListEvent extends _subbnnDk { + type _subulCGx = BaseCollectionEvent + interface RecordsListEvent extends _subulCGx { httpContext: echo.Context records: Array<(models.Record | undefined)> result?: search.Result } - type _subRQsyi = BaseCollectionEvent - interface RecordViewEvent extends _subRQsyi { + type _subvJEoC = BaseCollectionEvent + interface RecordViewEvent extends _subvJEoC { httpContext: echo.Context record?: models.Record } - type _subgOjdL = BaseCollectionEvent - interface RecordCreateEvent extends _subgOjdL { + type _subWSKHD = BaseCollectionEvent + interface RecordCreateEvent extends _subWSKHD { httpContext: echo.Context record?: models.Record uploadedFiles: _TygojaDict } - type _subwBzwp = BaseCollectionEvent - interface RecordUpdateEvent extends _subwBzwp { + type _subwWDoV = BaseCollectionEvent + interface RecordUpdateEvent extends _subwWDoV { httpContext: echo.Context record?: models.Record uploadedFiles: _TygojaDict } - type _submQjSw = BaseCollectionEvent - interface RecordDeleteEvent extends _submQjSw { + type _subeMHyi = BaseCollectionEvent + interface RecordDeleteEvent extends _subeMHyi { httpContext: echo.Context record?: models.Record } - type _subLElyu = BaseCollectionEvent - interface RecordAuthEvent extends _subLElyu { + type _subqNUXJ = BaseCollectionEvent + interface RecordAuthEvent extends _subqNUXJ { httpContext: echo.Context record?: models.Record token: string meta: any } - type _subhMBcR = BaseCollectionEvent - interface RecordAuthWithPasswordEvent extends _subhMBcR { + type _subKAjtD = BaseCollectionEvent + interface RecordAuthWithPasswordEvent extends _subKAjtD { httpContext: echo.Context record?: models.Record identity: string password: string } - type _subfgbBn = BaseCollectionEvent - interface RecordAuthWithOAuth2Event extends _subfgbBn { + type _subWVKvP = BaseCollectionEvent + interface RecordAuthWithOAuth2Event extends _subWVKvP { httpContext: echo.Context providerName: string providerClient: auth.Provider @@ -18812,49 +16446,49 @@ namespace core { oAuth2User?: auth.AuthUser isNewRecord: boolean } - type _subjVMoh = BaseCollectionEvent - interface RecordAuthRefreshEvent extends _subjVMoh { + type _subMlesm = BaseCollectionEvent + interface RecordAuthRefreshEvent extends _subMlesm { httpContext: echo.Context record?: models.Record } - type _subNHWZH = BaseCollectionEvent - interface RecordRequestPasswordResetEvent extends _subNHWZH { + type _subcdbuh = BaseCollectionEvent + interface RecordRequestPasswordResetEvent extends _subcdbuh { httpContext: echo.Context record?: models.Record } - type _subQtqMv = BaseCollectionEvent - interface RecordConfirmPasswordResetEvent extends _subQtqMv { + type _subwxpWd = BaseCollectionEvent + interface RecordConfirmPasswordResetEvent extends _subwxpWd { httpContext: echo.Context record?: models.Record } - type _subQzssp = BaseCollectionEvent - interface RecordRequestVerificationEvent extends _subQzssp { + type _subcnoWm = BaseCollectionEvent + interface RecordRequestVerificationEvent extends _subcnoWm { httpContext: echo.Context record?: models.Record } - type _subFHKhR = BaseCollectionEvent - interface RecordConfirmVerificationEvent extends _subFHKhR { + type _subXIyLG = BaseCollectionEvent + interface RecordConfirmVerificationEvent extends _subXIyLG { httpContext: echo.Context record?: models.Record } - type _subfCiAo = BaseCollectionEvent - interface RecordRequestEmailChangeEvent extends _subfCiAo { + type _subghLCj = BaseCollectionEvent + interface RecordRequestEmailChangeEvent extends _subghLCj { httpContext: echo.Context record?: models.Record } - type _subpsiKj = BaseCollectionEvent - interface RecordConfirmEmailChangeEvent extends _subpsiKj { + type _subDfErw = BaseCollectionEvent + interface RecordConfirmEmailChangeEvent extends _subDfErw { httpContext: echo.Context record?: models.Record } - type _subwAZXa = BaseCollectionEvent - interface RecordListExternalAuthsEvent extends _subwAZXa { + type _subvYoxX = BaseCollectionEvent + interface RecordListExternalAuthsEvent extends _subvYoxX { httpContext: echo.Context record?: models.Record externalAuths: Array<(models.ExternalAuth | undefined)> } - type _subctvQT = BaseCollectionEvent - interface RecordUnlinkExternalAuthEvent extends _subctvQT { + type _subFEnsz = BaseCollectionEvent + interface RecordUnlinkExternalAuthEvent extends _subFEnsz { httpContext: echo.Context record?: models.Record externalAuth?: models.ExternalAuth @@ -18908,33 +16542,33 @@ namespace core { collections: Array<(models.Collection | undefined)> result?: search.Result } - type _sublaaPC = BaseCollectionEvent - interface CollectionViewEvent extends _sublaaPC { + type _subucfFk = BaseCollectionEvent + interface CollectionViewEvent extends _subucfFk { httpContext: echo.Context } - type _subxkcHj = BaseCollectionEvent - interface CollectionCreateEvent extends _subxkcHj { + type _subtNMRU = BaseCollectionEvent + interface CollectionCreateEvent extends _subtNMRU { httpContext: echo.Context } - type _subxxmuG = BaseCollectionEvent - interface CollectionUpdateEvent extends _subxxmuG { + type _subpGCNO = BaseCollectionEvent + interface CollectionUpdateEvent extends _subpGCNO { httpContext: echo.Context } - type _subcqMnG = BaseCollectionEvent - interface CollectionDeleteEvent extends _subcqMnG { + type _subrzmgW = BaseCollectionEvent + interface CollectionDeleteEvent extends _subrzmgW { httpContext: echo.Context } interface CollectionsImportEvent { httpContext: echo.Context collections: Array<(models.Collection | undefined)> } - type _subnqgHo = BaseModelEvent - interface FileTokenEvent extends _subnqgHo { + type _subUTfeA = BaseModelEvent + interface FileTokenEvent extends _subUTfeA { httpContext: echo.Context token: string } - type _subbTIsc = BaseCollectionEvent - interface FileDownloadEvent extends _subbTIsc { + type _subuWfmi = BaseCollectionEvent + interface FileDownloadEvent extends _subuWfmi { httpContext: echo.Context record?: models.Record fileField?: schema.SchemaField @@ -18943,230 +16577,39 @@ namespace core { } } +namespace store { +} + /** - * Package reflect implements run-time reflection, allowing a program to - * manipulate objects with arbitrary types. The typical use is to take a value - * with static type interface{} and extract its dynamic type information by - * calling TypeOf, which returns a Type. - * - * A call to ValueOf returns a Value representing the run-time data. - * Zero takes a Type and returns a Value representing a zero value - * for that type. - * - * See "The Laws of Reflection" for an introduction to reflection in Go: - * https://golang.org/doc/articles/laws_of_reflection.html + * Package url parses URLs and implements query escaping. */ -namespace reflect { +namespace url { /** - * Type is the representation of a Go type. - * - * Not all methods apply to all kinds of types. Restrictions, - * if any, are noted in the documentation for each method. - * Use the Kind method to find out the kind of type before - * calling kind-specific methods. Calling a method - * inappropriate to the kind of type causes a run-time panic. - * - * Type values are comparable, such as with the == operator, - * so they can be used as map keys. - * Two Type values are equal if they represent identical types. + * 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 Type { + interface Userinfo { + } + interface Userinfo { /** - * Align returns the alignment in bytes of a value of - * this type when allocated in memory. + * Username returns the username. */ - align(): number + username(): string + } + interface Userinfo { /** - * FieldAlign returns the alignment in bytes of a value of - * this type when used as a field in a struct. + * Password returns the password in case it is set, and whether it is set. */ - fieldAlign(): number + password(): [string, boolean] + } + interface Userinfo { /** - * Method returns the i'th method in the type's method set. - * It panics if i is not in the range [0, NumMethod()). - * - * For a non-interface type T or *T, the returned Method's Type and Func - * fields describe a function whose first argument is the receiver, - * and only exported methods are accessible. - * - * For an interface type, the returned Method's Type field gives the - * method signature, without a receiver, and the Func field is nil. - * - * Methods are sorted in lexicographic order. - */ - method(_arg0: number): Method - /** - * MethodByName returns the method with that name in the type's - * method set and a boolean indicating if the method was found. - * - * For a non-interface type T or *T, the returned Method's Type and Func - * fields describe a function whose first argument is the receiver. - * - * For an interface type, the returned Method's Type field gives the - * method signature, without a receiver, and the Func field is nil. - */ - methodByName(_arg0: string): [Method, boolean] - /** - * NumMethod returns the number of methods accessible using Method. - * - * Note that NumMethod counts unexported methods only for interface types. - */ - numMethod(): number - /** - * Name returns the type's name within its package for a defined type. - * For other (non-defined) types it returns the empty string. - */ - name(): string - /** - * PkgPath returns a defined type's package path, that is, the import path - * that uniquely identifies the package, such as "encoding/base64". - * If the type was predeclared (string, error) or not defined (*T, struct{}, - * []int, or A where A is an alias for a non-defined type), the package path - * will be the empty string. - */ - pkgPath(): string - /** - * Size returns the number of bytes needed to store - * a value of the given type; it is analogous to unsafe.Sizeof. - */ - size(): number - /** - * String returns a string representation of the type. - * The string representation may use shortened package names - * (e.g., base64 instead of "encoding/base64") and is not - * guaranteed to be unique among types. To test for type identity, - * compare the Types directly. + * String returns the encoded userinfo information in the standard form + * of "username[:password]". */ string(): string - /** - * Kind returns the specific kind of this type. - */ - kind(): Kind - /** - * Implements reports whether the type implements the interface type u. - */ - implements(u: Type): boolean - /** - * AssignableTo reports whether a value of the type is assignable to type u. - */ - assignableTo(u: Type): boolean - /** - * ConvertibleTo reports whether a value of the type is convertible to type u. - * Even if ConvertibleTo returns true, the conversion may still panic. - * For example, a slice of type []T is convertible to *[N]T, - * but the conversion will panic if its length is less than N. - */ - convertibleTo(u: Type): boolean - /** - * Comparable reports whether values of this type are comparable. - * Even if Comparable returns true, the comparison may still panic. - * For example, values of interface type are comparable, - * but the comparison will panic if their dynamic type is not comparable. - */ - comparable(): boolean - /** - * Bits returns the size of the type in bits. - * It panics if the type's Kind is not one of the - * sized or unsized Int, Uint, Float, or Complex kinds. - */ - bits(): number - /** - * ChanDir returns a channel type's direction. - * It panics if the type's Kind is not Chan. - */ - chanDir(): ChanDir - /** - * IsVariadic reports whether a function type's final input parameter - * is a "..." parameter. If so, t.In(t.NumIn() - 1) returns the parameter's - * implicit actual type []T. - * - * For concreteness, if t represents func(x int, y ... float64), then - * - * ``` - * t.NumIn() == 2 - * t.In(0) is the reflect.Type for "int" - * t.In(1) is the reflect.Type for "[]float64" - * t.IsVariadic() == true - * ``` - * - * IsVariadic panics if the type's Kind is not Func. - */ - isVariadic(): boolean - /** - * Elem returns a type's element type. - * It panics if the type's Kind is not Array, Chan, Map, Pointer, or Slice. - */ - elem(): Type - /** - * Field returns a struct type's i'th field. - * It panics if the type's Kind is not Struct. - * It panics if i is not in the range [0, NumField()). - */ - field(i: number): StructField - /** - * FieldByIndex returns the nested field corresponding - * to the index sequence. It is equivalent to calling Field - * successively for each index i. - * It panics if the type's Kind is not Struct. - */ - fieldByIndex(index: Array): StructField - /** - * FieldByName returns the struct field with the given name - * and a boolean indicating if the field was found. - */ - fieldByName(name: string): [StructField, boolean] - /** - * FieldByNameFunc returns the struct field with a name - * that satisfies the match function and a boolean indicating if - * the field was found. - * - * FieldByNameFunc considers the fields in the struct itself - * and then the fields in any embedded structs, in breadth first order, - * stopping at the shallowest nesting depth containing one or more - * fields satisfying the match function. If multiple fields at that depth - * satisfy the match function, they cancel each other - * and FieldByNameFunc returns no match. - * This behavior mirrors Go's handling of name lookup in - * structs containing embedded fields. - */ - fieldByNameFunc(match: (_arg0: string) => boolean): [StructField, boolean] - /** - * In returns the type of a function type's i'th input parameter. - * It panics if the type's Kind is not Func. - * It panics if i is not in the range [0, NumIn()). - */ - in(i: number): Type - /** - * Key returns a map type's key type. - * It panics if the type's Kind is not Map. - */ - key(): Type - /** - * Len returns an array type's length. - * It panics if the type's Kind is not Array. - */ - len(): number - /** - * NumField returns a struct type's field count. - * It panics if the type's Kind is not Struct. - */ - numField(): number - /** - * NumIn returns a function type's input parameter count. - * It panics if the type's Kind is not Func. - */ - numIn(): number - /** - * NumOut returns a function type's output parameter count. - * It panics if the type's Kind is not Func. - */ - numOut(): number - /** - * Out returns the type of a function type's i'th output parameter. - * It panics if the type's Kind is not Func. - * It panics if i is not in the range [0, NumOut()). - */ - out(i: number): Type } } @@ -19180,8 +16623,8 @@ namespace bufio { * ReadWriter stores pointers to a Reader and a Writer. * It implements io.ReadWriter. */ - type _subUlsiJ = Reader&Writer - interface ReadWriter extends _subUlsiJ { + type _subnXDSC = Reader&Writer + interface ReadWriter extends _subnXDSC { } } @@ -19265,193 +16708,6 @@ namespace bufio { * On Windows, the resolver always uses C library functions, such as GetAddrInfo and DnsQuery. */ namespace net { - /** - * An IP is a single IP address, a slice of bytes. - * Functions in this package accept either 4-byte (IPv4) - * or 16-byte (IPv6) slices as input. - * - * Note that in this documentation, referring to an - * IP address as an IPv4 address or an IPv6 address - * is a semantic property of the address, not just the - * length of the byte slice: a 16-byte slice can still - * be an IPv4 address. - */ - interface IP extends String{} - /** - * An IPMask is a bitmask that can be used to manipulate - * IP addresses for IP addressing and routing. - * - * See type IPNet and func ParseCIDR for details. - */ - interface IPMask extends String{} - /** - * An IPNet represents an IP network. - */ - interface IPNet { - ip: IP // network number - mask: IPMask // network mask - } - interface IP { - /** - * IsUnspecified reports whether ip is an unspecified address, either - * the IPv4 address "0.0.0.0" or the IPv6 address "::". - */ - isUnspecified(): boolean - } - interface IP { - /** - * IsLoopback reports whether ip is a loopback address. - */ - isLoopback(): boolean - } - interface IP { - /** - * IsPrivate reports whether ip is a private address, according to - * RFC 1918 (IPv4 addresses) and RFC 4193 (IPv6 addresses). - */ - isPrivate(): boolean - } - interface IP { - /** - * IsMulticast reports whether ip is a multicast address. - */ - isMulticast(): boolean - } - interface IP { - /** - * IsInterfaceLocalMulticast reports whether ip is - * an interface-local multicast address. - */ - isInterfaceLocalMulticast(): boolean - } - interface IP { - /** - * IsLinkLocalMulticast reports whether ip is a link-local - * multicast address. - */ - isLinkLocalMulticast(): boolean - } - interface IP { - /** - * IsLinkLocalUnicast reports whether ip is a link-local - * unicast address. - */ - isLinkLocalUnicast(): boolean - } - interface IP { - /** - * IsGlobalUnicast reports whether ip is a global unicast - * address. - * - * The identification of global unicast addresses uses address type - * identification as defined in RFC 1122, RFC 4632 and RFC 4291 with - * the exception of IPv4 directed broadcast addresses. - * It returns true even if ip is in IPv4 private address space or - * local IPv6 unicast address space. - */ - isGlobalUnicast(): boolean - } - interface IP { - /** - * To4 converts the IPv4 address ip to a 4-byte representation. - * If ip is not an IPv4 address, To4 returns nil. - */ - to4(): IP - } - interface IP { - /** - * To16 converts the IP address ip to a 16-byte representation. - * If ip is not an IP address (it is the wrong length), To16 returns nil. - */ - to16(): IP - } - interface IP { - /** - * DefaultMask returns the default IP mask for the IP address ip. - * Only IPv4 addresses have default masks; DefaultMask returns - * nil if ip is not a valid IPv4 address. - */ - defaultMask(): IPMask - } - interface IP { - /** - * Mask returns the result of masking the IP address ip with mask. - */ - mask(mask: IPMask): IP - } - interface IP { - /** - * String returns the string form of the IP address ip. - * It returns one of 4 forms: - * ``` - * - "", if ip has length 0 - * - dotted decimal ("192.0.2.1"), if ip is an IPv4 or IP4-mapped IPv6 address - * - IPv6 conforming to RFC 5952 ("2001:db8::1"), if ip is a valid IPv6 address - * - the hexadecimal form of ip, without punctuation, if no other cases apply - * ``` - */ - string(): string - } - interface IP { - /** - * MarshalText implements the encoding.TextMarshaler interface. - * The encoding is the same as returned by String, with one exception: - * When len(ip) is zero, it returns an empty slice. - */ - marshalText(): string - } - interface IP { - /** - * UnmarshalText implements the encoding.TextUnmarshaler interface. - * The IP address is expected in a form accepted by ParseIP. - */ - unmarshalText(text: string): void - } - interface IP { - /** - * Equal reports whether ip and x are the same IP address. - * An IPv4 address and that same address in IPv6 form are - * considered to be equal. - */ - equal(x: IP): boolean - } - interface IPMask { - /** - * Size returns the number of leading ones and total bits in the mask. - * If the mask is not in the canonical form--ones followed by zeros--then - * Size returns 0, 0. - */ - size(): number - } - interface IPMask { - /** - * String returns the hexadecimal form of m, with no punctuation. - */ - string(): string - } - interface IPNet { - /** - * Contains reports whether the network includes ip. - */ - contains(ip: IP): boolean - } - interface IPNet { - /** - * Network returns the address's network name, "ip+net". - */ - network(): string - } - interface IPNet { - /** - * String returns the CIDR notation of n like "192.0.2.0/24" - * or "2001:db8::/48" as defined in RFC 4632 and RFC 4291. - * If the mask is not in the canonical form, it returns the - * string which consists of an IP address, followed by a slash - * character and a mask expressed as hexadecimal form with no - * punctuation like "198.51.100.0/c000ff00". - */ - string(): string - } /** * Addr represents a network end point address. * @@ -19465,576 +16721,17 @@ namespace net { } } -/** - * Package url parses URLs and implements query escaping. - */ -namespace url { +namespace hook { /** - * 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. + * Handler defines a hook handler function. */ - interface Userinfo { - } - interface Userinfo { - /** - * Username returns the username. - */ - username(): string - } - interface Userinfo { - /** - * Password returns the password in case it is set, and whether it is set. - */ - password(): [string, boolean] - } - interface Userinfo { - /** - * String returns the encoded userinfo information in the standard form - * of "username[:password]". - */ - string(): string - } -} - -/** - * Copyright 2021 The Go Authors. All rights reserved. - * Use of this source code is governed by a BSD-style - * license that can be found in the LICENSE file. - */ -/** - * Package x509 parses X.509-encoded keys and certificates. - */ -namespace x509 { + interface Handler {(e: T): void } /** - * CertPool is a set of certificates. + * wrapped local Hook embedded struct to limit the public API surface. */ - interface CertPool { + type _submLIZl = Hook + interface mainHook extends _submLIZl { } - interface CertPool { - /** - * AddCert adds a certificate to a pool. - */ - addCert(cert: Certificate): void - } - interface CertPool { - /** - * AppendCertsFromPEM attempts to parse a series of PEM encoded certificates. - * It appends any certificates found to s and reports whether any certificates - * were successfully parsed. - * - * On many Linux systems, /etc/ssl/cert.pem will contain the system wide set - * of root CAs in a format suitable for this function. - */ - appendCertsFromPEM(pemCerts: string): boolean - } - interface CertPool { - /** - * Subjects returns a list of the DER-encoded subjects of - * all of the certificates in the pool. - * - * Deprecated: if s was returned by SystemCertPool, Subjects - * will not include the system roots. - */ - subjects(): Array - } - // @ts-ignore - import cryptobyte_asn1 = asn1 - interface Certificate { - /** - * Verify attempts to verify c by building one or more chains from c to a - * certificate in opts.Roots, using certificates in opts.Intermediates if - * needed. If successful, it returns one or more chains where the first - * element of the chain is c and the last element is from opts.Roots. - * - * If opts.Roots is nil, the platform verifier might be used, and - * verification details might differ from what is described below. If system - * roots are unavailable the returned error will be of type SystemRootsError. - * - * Name constraints in the intermediates will be applied to all names claimed - * in the chain, not just opts.DNSName. Thus it is invalid for a leaf to claim - * example.com if an intermediate doesn't permit it, even if example.com is not - * the name being validated. Note that DirectoryName constraints are not - * supported. - * - * Name constraint validation follows the rules from RFC 5280, with the - * addition that DNS name constraints may use the leading period format - * defined for emails and URIs. When a constraint has a leading period - * it indicates that at least one additional label must be prepended to - * the constrained name to be considered valid. - * - * Extended Key Usage values are enforced nested down a chain, so an intermediate - * or root that enumerates EKUs prevents a leaf from asserting an EKU not in that - * list. (While this is not specified, it is common practice in order to limit - * the types of certificates a CA can issue.) - * - * Certificates that use SHA1WithRSA and ECDSAWithSHA1 signatures are not supported, - * and will not be used to build chains. - * - * WARNING: this function doesn't do any revocation checking. - */ - verify(opts: VerifyOptions): Array> - } - interface Certificate { - /** - * VerifyHostname returns nil if c is a valid certificate for the named host. - * Otherwise it returns an error describing the mismatch. - * - * IP addresses can be optionally enclosed in square brackets and are checked - * against the IPAddresses field. Other names are checked case insensitively - * against the DNSNames field. If the names are valid hostnames, the certificate - * fields can have a wildcard as the left-most label. - * - * Note that the legacy Common Name field is ignored. - */ - verifyHostname(h: string): void - } - /** - * A Certificate represents an X.509 certificate. - */ - interface Certificate { - raw: string // Complete ASN.1 DER content (certificate, signature algorithm and signature). - rawTBSCertificate: string // Certificate part of raw ASN.1 DER content. - rawSubjectPublicKeyInfo: string // DER encoded SubjectPublicKeyInfo. - rawSubject: string // DER encoded Subject - rawIssuer: string // DER encoded Issuer - signature: string - signatureAlgorithm: SignatureAlgorithm - publicKeyAlgorithm: PublicKeyAlgorithm - publicKey: any - version: number - serialNumber?: big.Int - issuer: pkix.Name - subject: pkix.Name - notBefore: time.Time // Validity bounds. - keyUsage: KeyUsage - /** - * Extensions contains raw X.509 extensions. When parsing certificates, - * this can be used to extract non-critical extensions that are not - * parsed by this package. When marshaling certificates, the Extensions - * field is ignored, see ExtraExtensions. - */ - extensions: Array - /** - * ExtraExtensions contains extensions to be copied, raw, into any - * marshaled certificates. Values override any extensions that would - * otherwise be produced based on the other fields. The ExtraExtensions - * field is not populated when parsing certificates, see Extensions. - */ - extraExtensions: Array - /** - * UnhandledCriticalExtensions contains a list of extension IDs that - * were not (fully) processed when parsing. Verify will fail if this - * slice is non-empty, unless verification is delegated to an OS - * library which understands all the critical extensions. - * - * Users can access these extensions using Extensions and can remove - * elements from this slice if they believe that they have been - * handled. - */ - unhandledCriticalExtensions: Array - extKeyUsage: Array // Sequence of extended key usages. - unknownExtKeyUsage: Array // Encountered extended key usages unknown to this package. - /** - * BasicConstraintsValid indicates whether IsCA, MaxPathLen, - * and MaxPathLenZero are valid. - */ - basicConstraintsValid: boolean - isCA: boolean - /** - * MaxPathLen and MaxPathLenZero indicate the presence and - * value of the BasicConstraints' "pathLenConstraint". - * - * When parsing a certificate, a positive non-zero MaxPathLen - * means that the field was specified, -1 means it was unset, - * and MaxPathLenZero being true mean that the field was - * explicitly set to zero. The case of MaxPathLen==0 with MaxPathLenZero==false - * should be treated equivalent to -1 (unset). - * - * When generating a certificate, an unset pathLenConstraint - * can be requested with either MaxPathLen == -1 or using the - * zero value for both MaxPathLen and MaxPathLenZero. - */ - maxPathLen: number - /** - * MaxPathLenZero indicates that BasicConstraintsValid==true - * and MaxPathLen==0 should be interpreted as an actual - * maximum path length of zero. Otherwise, that combination is - * interpreted as MaxPathLen not being set. - */ - maxPathLenZero: boolean - subjectKeyId: string - authorityKeyId: string - /** - * RFC 5280, 4.2.2.1 (Authority Information Access) - */ - ocspServer: Array - issuingCertificateURL: Array - /** - * Subject Alternate Name values. (Note that these values may not be valid - * if invalid values were contained within a parsed certificate. For - * example, an element of DNSNames may not be a valid DNS domain name.) - */ - dnsNames: Array - emailAddresses: Array - ipAddresses: Array - urIs: Array<(url.URL | undefined)> - /** - * Name constraints - */ - permittedDNSDomainsCritical: boolean // if true then the name constraints are marked critical. - permittedDNSDomains: Array - excludedDNSDomains: Array - permittedIPRanges: Array<(net.IPNet | undefined)> - excludedIPRanges: Array<(net.IPNet | undefined)> - permittedEmailAddresses: Array - excludedEmailAddresses: Array - permittedURIDomains: Array - excludedURIDomains: Array - /** - * CRL Distribution Points - */ - crlDistributionPoints: Array - policyIdentifiers: Array - } - interface Certificate { - equal(other: Certificate): boolean - } - interface Certificate { - /** - * CheckSignatureFrom verifies that the signature on c is a valid signature - * from parent. SHA1WithRSA and ECDSAWithSHA1 signatures are not supported. - */ - checkSignatureFrom(parent: Certificate): void - } - interface Certificate { - /** - * CheckSignature verifies that signature is a valid signature over signed from - * c's public key. - */ - checkSignature(algo: SignatureAlgorithm, signed: string): void - } - interface Certificate { - /** - * CheckCRLSignature checks that the signature in crl is from c. - */ - checkCRLSignature(crl: pkix.CertificateList): void - } - interface Certificate { - /** - * CreateCRL returns a DER encoded CRL, signed by this Certificate, that - * contains the given list of revoked certificates. - * - * Note: this method does not generate an RFC 5280 conformant X.509 v2 CRL. - * To generate a standards compliant CRL, use CreateRevocationList instead. - */ - createCRL(rand: io.Reader, priv: any, revokedCerts: Array, now: time.Time): string - } -} - -/** - * Package driver defines interfaces to be implemented by database - * drivers as used by package sql. - * - * Most code should use package sql. - * - * The driver interface has evolved over time. Drivers should implement - * Connector and DriverContext interfaces. - * The Connector.Connect and Driver.Open methods should never return ErrBadConn. - * ErrBadConn should only be returned from Validator, SessionResetter, or - * a query method if the connection is already in an invalid (e.g. closed) state. - * - * All Conn implementations should implement the following interfaces: - * Pinger, SessionResetter, and Validator. - * - * If named parameters or context are supported, the driver's Conn should implement: - * ExecerContext, QueryerContext, ConnPrepareContext, and ConnBeginTx. - * - * To support custom data types, implement NamedValueChecker. NamedValueChecker - * also allows queries to accept per-query options as a parameter by returning - * ErrRemoveArgument from CheckNamedValue. - * - * If multiple result sets are supported, Rows should implement RowsNextResultSet. - * If the driver knows how to describe the types present in the returned result - * it should implement the following interfaces: RowsColumnTypeScanType, - * RowsColumnTypeDatabaseTypeName, RowsColumnTypeLength, RowsColumnTypeNullable, - * and RowsColumnTypePrecisionScale. A given row value may also return a Rows - * type, which may represent a database cursor value. - * - * Before a connection is returned to the connection pool after use, IsValid is - * called if implemented. Before a connection is reused for another query, - * ResetSession is called if implemented. If a connection is never returned to the - * connection pool but immediately reused, then ResetSession is called prior to - * reuse but IsValid is not called. - */ -namespace driver { - /** - * Conn is a connection to a database. It is not used concurrently - * by multiple goroutines. - * - * Conn is assumed to be stateful. - */ - interface Conn { - /** - * Prepare returns a prepared statement, bound to this connection. - */ - prepare(query: string): Stmt - /** - * Close invalidates and potentially stops any current - * prepared statements and transactions, marking this - * connection as no longer in use. - * - * Because the sql package maintains a free pool of - * connections and only calls Close when there's a surplus of - * idle connections, it shouldn't be necessary for drivers to - * do their own connection caching. - * - * Drivers must ensure all network calls made by Close - * do not block indefinitely (e.g. apply a timeout). - */ - close(): void - /** - * Begin starts and returns a new transaction. - * - * Deprecated: Drivers should implement ConnBeginTx instead (or additionally). - */ - begin(): Tx - } -} - -/** - * Package tls partially implements TLS 1.2, as specified in RFC 5246, - * and TLS 1.3, as specified in RFC 8446. - */ -namespace tls { - /** - * CurveID is the type of a TLS identifier for an elliptic curve. See - * https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-8. - * - * In TLS 1.3, this type is called NamedGroup, but at this time this library - * only supports Elliptic Curve based groups. See RFC 8446, Section 4.2.7. - */ - interface CurveID extends Number{} - /** - * ClientAuthType declares the policy the server will follow for - * TLS Client Authentication. - */ - interface ClientAuthType extends Number{} - /** - * ClientSessionCache is a cache of ClientSessionState objects that can be used - * by a client to resume a TLS session with a given server. ClientSessionCache - * implementations should expect to be called concurrently from different - * goroutines. Up to TLS 1.2, only ticket-based resumption is supported, not - * SessionID-based resumption. In TLS 1.3 they were merged into PSK modes, which - * are supported via this interface. - */ - interface ClientSessionCache { - /** - * Get searches for a ClientSessionState associated with the given key. - * On return, ok is true if one was found. - */ - get(sessionKey: string): [(ClientSessionState | undefined), boolean] - /** - * Put adds the ClientSessionState to the cache with the given key. It might - * get called multiple times in a connection if a TLS 1.3 server provides - * more than one session ticket. If called with a nil *ClientSessionState, - * it should remove the cache entry. - */ - put(sessionKey: string, cs: ClientSessionState): void - } - /** - * ClientHelloInfo contains information from a ClientHello message in order to - * guide application logic in the GetCertificate and GetConfigForClient callbacks. - */ - interface ClientHelloInfo { - /** - * CipherSuites lists the CipherSuites supported by the client (e.g. - * TLS_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256). - */ - cipherSuites: Array - /** - * ServerName indicates the name of the server requested by the client - * in order to support virtual hosting. ServerName is only set if the - * client is using SNI (see RFC 4366, Section 3.1). - */ - serverName: string - /** - * SupportedCurves lists the elliptic curves supported by the client. - * SupportedCurves is set only if the Supported Elliptic Curves - * Extension is being used (see RFC 4492, Section 5.1.1). - */ - supportedCurves: Array - /** - * SupportedPoints lists the point formats supported by the client. - * SupportedPoints is set only if the Supported Point Formats Extension - * is being used (see RFC 4492, Section 5.1.2). - */ - supportedPoints: Array - /** - * SignatureSchemes lists the signature and hash schemes that the client - * is willing to verify. SignatureSchemes is set only if the Signature - * Algorithms Extension is being used (see RFC 5246, Section 7.4.1.4.1). - */ - signatureSchemes: Array - /** - * SupportedProtos lists the application protocols supported by the client. - * SupportedProtos is set only if the Application-Layer Protocol - * Negotiation Extension is being used (see RFC 7301, Section 3.1). - * - * Servers can select a protocol by setting Config.NextProtos in a - * GetConfigForClient return value. - */ - supportedProtos: Array - /** - * SupportedVersions lists the TLS versions supported by the client. - * For TLS versions less than 1.3, this is extrapolated from the max - * version advertised by the client, so values other than the greatest - * might be rejected if used. - */ - supportedVersions: Array - /** - * Conn is the underlying net.Conn for the connection. Do not read - * from, or write to, this connection; that will cause the TLS - * connection to fail. - */ - conn: net.Conn - } - interface ClientHelloInfo { - /** - * Context returns the context of the handshake that is in progress. - * This context is a child of the context passed to HandshakeContext, - * if any, and is canceled when the handshake concludes. - */ - context(): context.Context - } - /** - * CertificateRequestInfo contains information from a server's - * CertificateRequest message, which is used to demand a certificate and proof - * of control from a client. - */ - interface CertificateRequestInfo { - /** - * AcceptableCAs contains zero or more, DER-encoded, X.501 - * Distinguished Names. These are the names of root or intermediate CAs - * that the server wishes the returned certificate to be signed by. An - * empty slice indicates that the server has no preference. - */ - acceptableCAs: Array - /** - * SignatureSchemes lists the signature schemes that the server is - * willing to verify. - */ - signatureSchemes: Array - /** - * Version is the TLS version that was negotiated for this connection. - */ - version: number - } - interface CertificateRequestInfo { - /** - * Context returns the context of the handshake that is in progress. - * This context is a child of the context passed to HandshakeContext, - * if any, and is canceled when the handshake concludes. - */ - context(): context.Context - } - /** - * RenegotiationSupport enumerates the different levels of support for TLS - * renegotiation. TLS renegotiation is the act of performing subsequent - * handshakes on a connection after the first. This significantly complicates - * the state machine and has been the source of numerous, subtle security - * issues. Initiating a renegotiation is not supported, but support for - * accepting renegotiation requests may be enabled. - * - * Even when enabled, the server may not change its identity between handshakes - * (i.e. the leaf certificate must be the same). Additionally, concurrent - * handshake and application data flow is not permitted so renegotiation can - * only be used with protocols that synchronise with the renegotiation, such as - * HTTPS. - * - * Renegotiation is not defined in TLS 1.3. - */ - interface RenegotiationSupport extends Number{} - interface ClientHelloInfo { - /** - * SupportsCertificate returns nil if the provided certificate is supported by - * the client that sent the ClientHello. Otherwise, it returns an error - * describing the reason for the incompatibility. - * - * If this ClientHelloInfo was passed to a GetConfigForClient or GetCertificate - * callback, this method will take into account the associated Config. Note that - * if GetConfigForClient returns a different Config, the change can't be - * accounted for by this method. - * - * This function will call x509.ParseCertificate unless c.Leaf is set, which can - * incur a significant performance cost. - */ - supportsCertificate(c: Certificate): void - } - interface CertificateRequestInfo { - /** - * SupportsCertificate returns nil if the provided certificate is supported by - * the server that sent the CertificateRequest. Otherwise, it returns an error - * describing the reason for the incompatibility. - */ - supportsCertificate(c: Certificate): void - } - /** - * A Certificate is a chain of one or more certificates, leaf first. - */ - interface Certificate { - certificate: Array - /** - * PrivateKey contains the private key corresponding to the public key in - * Leaf. This must implement crypto.Signer with an RSA, ECDSA or Ed25519 PublicKey. - * For a server up to TLS 1.2, it can also implement crypto.Decrypter with - * an RSA PublicKey. - */ - privateKey: crypto.PrivateKey - /** - * SupportedSignatureAlgorithms is an optional list restricting what - * signature algorithms the PrivateKey can be used for. - */ - supportedSignatureAlgorithms: Array - /** - * OCSPStaple contains an optional OCSP response which will be served - * to clients that request it. - */ - ocspStaple: string - /** - * SignedCertificateTimestamps contains an optional list of Signed - * Certificate Timestamps which will be served to clients that request it. - */ - signedCertificateTimestamps: Array - /** - * Leaf is the parsed form of the leaf certificate, which may be initialized - * using x509.ParseCertificate to reduce per-handshake processing. If nil, - * the leaf certificate will be parsed as needed. - */ - leaf?: x509.Certificate - } - interface CurveID { - string(): string - } - interface ClientAuthType { - string(): string - } -} - -/** - * Package log implements a simple logging package. It defines a type, Logger, - * with methods for formatting output. It also has a predefined 'standard' - * Logger accessible through helper functions Print[f|ln], Fatal[f|ln], and - * Panic[f|ln], which are easier to use than creating a Logger manually. - * That logger writes to standard error and prints the date and time - * of each logged message. - * Every log message is output on a separate line: if the message being - * printed does not end in a newline, the logger will add one. - * The Fatal functions call os.Exit(1) after writing the log message. - * The Panic functions call panic after writing the log message. - */ -namespace log { } /** @@ -20199,42 +16896,6 @@ namespace multipart { * support. */ namespace http { - /** - * RoundTripper is an interface representing the ability to execute a - * single HTTP transaction, obtaining the Response for a given Request. - * - * A RoundTripper must be safe for concurrent use by multiple - * goroutines. - */ - interface RoundTripper { - /** - * RoundTrip executes a single HTTP transaction, returning - * a Response for the provided Request. - * - * RoundTrip should not attempt to interpret the response. In - * particular, RoundTrip must return err == nil if it obtained - * a response, regardless of the response's HTTP status code. - * A non-nil err should be reserved for failure to obtain a - * response. Similarly, RoundTrip should not attempt to - * handle higher-level protocol details such as redirects, - * authentication, or cookies. - * - * RoundTrip should not modify the request, except for - * consuming and closing the Request's Body. RoundTrip may - * read fields of the request in a separate goroutine. Callers - * should not mutate or reuse the request until the Response's - * Body has been closed. - * - * RoundTrip must always close the body, including on errors, - * but depending on the implementation may do so in a separate - * goroutine even after RoundTrip returns. This means that - * callers wanting to reuse the body for subsequent requests - * must arrange to wait for the Close call before doing so. - * - * The Request's URL and Header fields must be initialized. - */ - roundTrip(_arg0: Request): (Response | undefined) - } /** * 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 @@ -20246,52 +16907,10 @@ namespace http { interface SameSite extends Number{} // @ts-ignore import mathrand = rand - /** - * A CookieJar manages storage and use of cookies in HTTP requests. - * - * Implementations of CookieJar must be safe for concurrent use by multiple - * goroutines. - * - * The net/http/cookiejar package provides a CookieJar implementation. - */ - interface CookieJar { - /** - * SetCookies handles the receipt of the cookies in a reply for the - * given URL. It may or may not choose to save the cookies, depending - * on the jar's policy and implementation. - */ - setCookies(u: url.URL, cookies: Array<(Cookie | undefined)>): void - /** - * Cookies returns the cookies to send in a request for the given URL. - * It is up to the implementation to honor the standard cookie use - * restrictions such as in RFC 6265. - */ - cookies(u: url.URL): Array<(Cookie | undefined)> - } // @ts-ignore import urlpkg = url } -namespace store { -} - -namespace mailer { - /** - * Message defines a generic email message struct. - */ - interface Message { - from: mail.Address - to: Array - bcc: Array - cc: Array - subject: string - html: string - text: string - headers: _TygojaDict - attachments: _TygojaDict - } -} - /** * Package echo implements high performance, minimalist Go web framework. * @@ -20406,6 +17025,23 @@ namespace echo { } } +namespace mailer { + /** + * Message defines a generic email message struct. + */ + interface Message { + from: mail.Address + to: Array + bcc: Array + cc: Array + subject: string + html: string + text: string + headers: _TygojaDict + attachments: _TygojaDict + } +} + /** * Package types implements some commonly used db serializable types * like datetime, json, etc. @@ -20437,7 +17073,7 @@ namespace types { /** * Value implements the [driver.Valuer] interface. */ - value(): driver.Value + value(): any } interface JsonRaw { /** @@ -20485,19 +17121,6 @@ namespace settings { } } -namespace hook { - /** - * Handler defines a hook handler function. - */ - interface Handler {(e: T): void } - /** - * wrapped local Hook embedded struct to limit the public API surface. - */ - type _subOzNui = Hook - interface mainHook extends _subOzNui { - } -} - namespace subscriptions { /** * Message defines a client's channel data. @@ -20565,173 +17188,6 @@ namespace subscriptions { } } -/** - * Package autocert provides automatic access to certificates from Let's Encrypt - * and any other ACME-based CA. - * - * This package is a work in progress and makes no API stability promises. - */ -namespace autocert { - // @ts-ignore - import mathrand = rand - /** - * Manager is a stateful certificate manager built on top of acme.Client. - * It obtains and refreshes certificates automatically using "tls-alpn-01" - * or "http-01" challenge types, as well as providing them to a TLS server - * via tls.Config. - * - * You must specify a cache implementation, such as DirCache, - * to reuse obtained certificates across program restarts. - * Otherwise your server is very likely to exceed the certificate - * issuer's request rate limits. - */ - interface Manager { - /** - * Prompt specifies a callback function to conditionally accept a CA's Terms of Service (TOS). - * The registration may require the caller to agree to the CA's TOS. - * If so, Manager calls Prompt with a TOS URL provided by the CA. Prompt should report - * whether the caller agrees to the terms. - * - * To always accept the terms, the callers can use AcceptTOS. - */ - prompt: (tosURL: string) => boolean - /** - * Cache optionally stores and retrieves previously-obtained certificates - * and other state. If nil, certs will only be cached for the lifetime of - * the Manager. Multiple Managers can share the same Cache. - * - * Using a persistent Cache, such as DirCache, is strongly recommended. - */ - cache: Cache - /** - * HostPolicy controls which domains the Manager will attempt - * to retrieve new certificates for. It does not affect cached certs. - * - * If non-nil, HostPolicy is called before requesting a new cert. - * If nil, all hosts are currently allowed. This is not recommended, - * as it opens a potential attack where clients connect to a server - * by IP address and pretend to be asking for an incorrect host name. - * Manager will attempt to obtain a certificate for that host, incorrectly, - * eventually reaching the CA's rate limit for certificate requests - * and making it impossible to obtain actual certificates. - * - * See GetCertificate for more details. - */ - hostPolicy: HostPolicy - /** - * RenewBefore optionally specifies how early certificates should - * be renewed before they expire. - * - * If zero, they're renewed 30 days before expiration. - */ - renewBefore: time.Duration - /** - * Client is used to perform low-level operations, such as account registration - * and requesting new certificates. - * - * If Client is nil, a zero-value acme.Client is used with DefaultACMEDirectory - * as the directory endpoint. - * If the Client.Key is nil, a new ECDSA P-256 key is generated and, - * if Cache is not nil, stored in cache. - * - * Mutating the field after the first call of GetCertificate method will have no effect. - */ - client?: acme.Client - /** - * Email optionally specifies a contact email address. - * This is used by CAs, such as Let's Encrypt, to notify about problems - * with issued certificates. - * - * If the Client's account key is already registered, Email is not used. - */ - email: string - /** - * ForceRSA used to make the Manager generate RSA certificates. It is now ignored. - * - * Deprecated: the Manager will request the correct type of certificate based - * on what each client supports. - */ - forceRSA: boolean - /** - * ExtraExtensions are used when generating a new CSR (Certificate Request), - * thus allowing customization of the resulting certificate. - * For instance, TLS Feature Extension (RFC 7633) can be used - * to prevent an OCSP downgrade attack. - * - * The field value is passed to crypto/x509.CreateCertificateRequest - * in the template's ExtraExtensions field as is. - */ - extraExtensions: Array - /** - * ExternalAccountBinding optionally represents an arbitrary binding to an - * account of the CA to which the ACME server is tied. - * See RFC 8555, Section 7.3.4 for more details. - */ - externalAccountBinding?: acme.ExternalAccountBinding - } - interface Manager { - /** - * TLSConfig creates a new TLS config suitable for net/http.Server servers, - * supporting HTTP/2 and the tls-alpn-01 ACME challenge type. - */ - tlsConfig(): (tls.Config | undefined) - } - interface Manager { - /** - * GetCertificate implements the tls.Config.GetCertificate hook. - * It provides a TLS certificate for hello.ServerName host, including answering - * tls-alpn-01 challenges. - * All other fields of hello are ignored. - * - * If m.HostPolicy is non-nil, GetCertificate calls the policy before requesting - * a new cert. A non-nil error returned from m.HostPolicy halts TLS negotiation. - * The error is propagated back to the caller of GetCertificate and is user-visible. - * This does not affect cached certs. See HostPolicy field description for more details. - * - * If GetCertificate is used directly, instead of via Manager.TLSConfig, package users will - * also have to add acme.ALPNProto to NextProtos for tls-alpn-01, or use HTTPHandler for http-01. - */ - getCertificate(hello: tls.ClientHelloInfo): (tls.Certificate | undefined) - } - interface Manager { - /** - * HTTPHandler configures the Manager to provision ACME "http-01" challenge responses. - * It returns an http.Handler that responds to the challenges and must be - * running on port 80. If it receives a request that is not an ACME challenge, - * it delegates the request to the optional fallback handler. - * - * If fallback is nil, the returned handler redirects all GET and HEAD requests - * to the default TLS port 443 with 302 Found status code, preserving the original - * request path and query. It responds with 400 Bad Request to all other HTTP methods. - * The fallback is not protected by the optional HostPolicy. - * - * Because the fallback handler is run with unencrypted port 80 requests, - * the fallback should not serve TLS-only requests. - * - * If HTTPHandler is never called, the Manager will only use the "tls-alpn-01" - * challenge for domain verification. - */ - httpHandler(fallback: http.Handler): http.Handler - } - interface Manager { - /** - * Listener listens on the standard TLS port (443) on all interfaces - * and returns a net.Listener returning *tls.Conn connections. - * - * The returned listener uses a *tls.Config that enables HTTP/2, and - * should only be used with servers that support HTTP/2. - * - * The returned Listener also enables TCP keep-alives on the accepted - * connections. The returned *tls.Conn are returned before their TLS - * handshake has completed. - * - * Unlike NewListener, it is the caller's responsibility to initialize - * the Manager m's Prompt, Cache, HostPolicy, and other desired options. - */ - listener(): net.Listener - } -} - /** * Package core is the backbone of PocketBase. * @@ -20752,1345 +17208,6 @@ namespace core { } } -/** - * ``` - * Package flag implements command-line flag parsing. - * - * Usage - * - * Define flags using flag.String(), Bool(), Int(), etc. - * - * This declares an integer flag, -n, stored in the pointer nFlag, with type *int: - * import "flag" - * var nFlag = flag.Int("n", 1234, "help message for flag n") - * If you like, you can bind the flag to a variable using the Var() functions. - * var flagvar int - * func init() { - * flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") - * } - * Or you can create custom flags that satisfy the Value interface (with - * pointer receivers) and couple them to flag parsing by - * flag.Var(&flagVal, "name", "help message for flagname") - * For such flags, the default value is just the initial value of the variable. - * - * After all flags are defined, call - * flag.Parse() - * to parse the command line into the defined flags. - * - * Flags may then be used directly. If you're using the flags themselves, - * they are all pointers; if you bind to variables, they're values. - * fmt.Println("ip has value ", *ip) - * fmt.Println("flagvar has value ", flagvar) - * - * After parsing, the arguments following the flags are available as the - * slice flag.Args() or individually as flag.Arg(i). - * The arguments are indexed from 0 through flag.NArg()-1. - * - * Command line flag syntax - * - * The following forms are permitted: - * - * -flag - * -flag=x - * -flag x // non-boolean flags only - * One or two minus signs may be used; they are equivalent. - * The last form is not permitted for boolean flags because the - * meaning of the command - * cmd -x * - * where * is a Unix shell wildcard, will change if there is a file - * called 0, false, etc. You must use the -flag=false form to turn - * off a boolean flag. - * - * Flag parsing stops just before the first non-flag argument - * ("-" is a non-flag argument) or after the terminator "--". - * - * Integer flags accept 1234, 0664, 0x1234 and may be negative. - * Boolean flags may be: - * 1, 0, t, f, T, F, true, false, TRUE, FALSE, True, False - * Duration flags accept any input valid for time.ParseDuration. - * - * The default set of command-line flags is controlled by - * top-level functions. The FlagSet type allows one to define - * independent sets of flags, such as to implement subcommands - * in a command-line interface. The methods of FlagSet are - * analogous to the top-level functions for the command-line - * flag set. - * ``` - */ -namespace flag { - /** - * A FlagSet represents a set of defined flags. The zero value of a FlagSet - * has no name and has ContinueOnError error handling. - * - * Flag names must be unique within a FlagSet. An attempt to define a flag whose - * name is already in use will cause a panic. - */ - interface FlagSet { - /** - * Usage is the function called when an error occurs while parsing flags. - * The field is a function (not a method) that may be changed to point to - * a custom error handler. What happens after Usage is called depends - * on the ErrorHandling setting; for the command line, this defaults - * to ExitOnError, which exits the program after calling Usage. - */ - usage: () => void - } - /** - * A Flag represents the state of a flag. - */ - interface Flag { - name: string // name as it appears on command line - usage: string // help message - value: Value // value as set - defValue: string // default value (as text); for usage message - } - interface FlagSet { - /** - * Output returns the destination for usage and error messages. os.Stderr is returned if - * output was not set or was set to nil. - */ - output(): io.Writer - } - interface FlagSet { - /** - * Name returns the name of the flag set. - */ - name(): string - } - interface FlagSet { - /** - * ErrorHandling returns the error handling behavior of the flag set. - */ - errorHandling(): ErrorHandling - } - interface FlagSet { - /** - * SetOutput sets the destination for usage and error messages. - * If output is nil, os.Stderr is used. - */ - setOutput(output: io.Writer): void - } - interface FlagSet { - /** - * VisitAll visits the flags in lexicographical order, calling fn for each. - * It visits all flags, even those not set. - */ - visitAll(fn: (_arg0: Flag) => void): void - } - interface FlagSet { - /** - * Visit visits the flags in lexicographical order, calling fn for each. - * It visits only those flags that have been set. - */ - visit(fn: (_arg0: Flag) => void): void - } - interface FlagSet { - /** - * Lookup returns the Flag structure of the named flag, returning nil if none exists. - */ - lookup(name: string): (Flag | undefined) - } - interface FlagSet { - /** - * Set sets the value of the named flag. - */ - set(name: string): void - } - interface FlagSet { - /** - * PrintDefaults prints, to standard error unless configured otherwise, the - * default values of all defined command-line flags in the set. See the - * documentation for the global function PrintDefaults for more information. - */ - printDefaults(): void - } - interface FlagSet { - /** - * NFlag returns the number of flags that have been set. - */ - nFlag(): number - } - interface FlagSet { - /** - * Arg returns the i'th argument. Arg(0) is the first remaining argument - * after flags have been processed. Arg returns an empty string if the - * requested element does not exist. - */ - arg(i: number): string - } - interface FlagSet { - /** - * NArg is the number of arguments remaining after flags have been processed. - */ - nArg(): number - } - interface FlagSet { - /** - * Args returns the non-flag arguments. - */ - args(): Array - } - interface FlagSet { - /** - * BoolVar defines a bool flag with specified name, default value, and usage string. - * The argument p points to a bool variable in which to store the value of the flag. - */ - boolVar(p: boolean, name: string, value: boolean, usage: string): void - } - interface FlagSet { - /** - * Bool defines a bool flag with specified name, default value, and usage string. - * The return value is the address of a bool variable that stores the value of the flag. - */ - bool(name: string, value: boolean, usage: string): (boolean | undefined) - } - interface FlagSet { - /** - * IntVar defines an int flag with specified name, default value, and usage string. - * The argument p points to an int variable in which to store the value of the flag. - */ - intVar(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int defines an int flag with specified name, default value, and usage string. - * The return value is the address of an int variable that stores the value of the flag. - */ - int(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Int64Var defines an int64 flag with specified name, default value, and usage string. - * The argument p points to an int64 variable in which to store the value of the flag. - */ - int64Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Int64 defines an int64 flag with specified name, default value, and usage string. - * The return value is the address of an int64 variable that stores the value of the flag. - */ - int64(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * UintVar defines a uint flag with specified name, default value, and usage string. - * The argument p points to a uint variable in which to store the value of the flag. - */ - uintVar(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint defines a uint flag with specified name, default value, and usage string. - * The return value is the address of a uint variable that stores the value of the flag. - */ - uint(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * Uint64Var defines a uint64 flag with specified name, default value, and usage string. - * The argument p points to a uint64 variable in which to store the value of the flag. - */ - uint64Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Uint64 defines a uint64 flag with specified name, default value, and usage string. - * The return value is the address of a uint64 variable that stores the value of the flag. - */ - uint64(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * StringVar defines a string flag with specified name, default value, and usage string. - * The argument p points to a string variable in which to store the value of the flag. - */ - stringVar(p: string, name: string, value: string, usage: string): void - } - interface FlagSet { - /** - * String defines a string flag with specified name, default value, and usage string. - * The return value is the address of a string variable that stores the value of the flag. - */ - string(name: string, value: string, usage: string): (string | undefined) - } - interface FlagSet { - /** - * Float64Var defines a float64 flag with specified name, default value, and usage string. - * The argument p points to a float64 variable in which to store the value of the flag. - */ - float64Var(p: number, name: string, value: number, usage: string): void - } - interface FlagSet { - /** - * Float64 defines a float64 flag with specified name, default value, and usage string. - * The return value is the address of a float64 variable that stores the value of the flag. - */ - float64(name: string, value: number, usage: string): (number | undefined) - } - interface FlagSet { - /** - * DurationVar defines a time.Duration flag with specified name, default value, and usage string. - * The argument p points to a time.Duration variable in which to store the value of the flag. - * The flag accepts a value acceptable to time.ParseDuration. - */ - durationVar(p: time.Duration, name: string, value: time.Duration, usage: string): void - } - interface FlagSet { - /** - * Duration defines a time.Duration flag with specified name, default value, and usage string. - * The return value is the address of a time.Duration variable that stores the value of the flag. - * The flag accepts a value acceptable to time.ParseDuration. - */ - duration(name: string, value: time.Duration, usage: string): (time.Duration | undefined) - } - interface FlagSet { - /** - * Func defines a flag with the specified name and usage string. - * Each time the flag is seen, fn is called with the value of the flag. - * If fn returns a non-nil error, it will be treated as a flag value parsing error. - */ - func(name: string, fn: (_arg0: string) => void): void - } - interface FlagSet { - /** - * Var defines a flag with the specified name and usage string. The type and - * value of the flag are represented by the first argument, of type Value, which - * typically holds a user-defined implementation of Value. For instance, the - * caller could create a flag that turns a comma-separated string into a slice - * of strings by giving the slice the methods of Value; in particular, Set would - * decompose the comma-separated string into the slice. - */ - var(value: Value, name: string, usage: string): void - } - interface FlagSet { - /** - * Parse parses flag definitions from the argument list, which should not - * include the command name. Must be called after all flags in the FlagSet - * are defined and before flags are accessed by the program. - * The return value will be ErrHelp if -help or -h were set but not defined. - */ - parse(arguments: Array): void - } - interface FlagSet { - /** - * Parsed reports whether f.Parse has been called. - */ - parsed(): boolean - } - interface FlagSet { - /** - * Init sets the name and error handling property for a flag set. - * By default, the zero FlagSet uses an empty name and the - * ContinueOnError error handling policy. - */ - init(name: string, errorHandling: ErrorHandling): void - } -} - -/** - * Package pflag is a drop-in replacement for Go's flag package, implementing - * POSIX/GNU-style --flags. - * - * pflag is compatible with the GNU extensions to the POSIX recommendations - * for command-line options. See - * http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html - * - * Usage: - * - * pflag is a drop-in replacement of Go's native flag package. If you import - * pflag under the name "flag" then all code should continue to function - * with no changes. - * - * ``` - * import flag "github.com/spf13/pflag" - * ``` - * - * There is one exception to this: if you directly instantiate the Flag struct - * there is one more field "Shorthand" that you will need to set. - * Most code never instantiates this struct directly, and instead uses - * functions such as String(), BoolVar(), and Var(), and is therefore - * unaffected. - * - * Define flags using flag.String(), Bool(), Int(), etc. - * - * This declares an integer flag, -flagname, stored in the pointer ip, with type *int. - * ``` - * var ip = flag.Int("flagname", 1234, "help message for flagname") - * ``` - * If you like, you can bind the flag to a variable using the Var() functions. - * ``` - * var flagvar int - * func init() { - * flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") - * } - * ``` - * Or you can create custom flags that satisfy the Value interface (with - * pointer receivers) and couple them to flag parsing by - * ``` - * flag.Var(&flagVal, "name", "help message for flagname") - * ``` - * For such flags, the default value is just the initial value of the variable. - * - * After all flags are defined, call - * ``` - * flag.Parse() - * ``` - * to parse the command line into the defined flags. - * - * Flags may then be used directly. If you're using the flags themselves, - * they are all pointers; if you bind to variables, they're values. - * ``` - * fmt.Println("ip has value ", *ip) - * fmt.Println("flagvar has value ", flagvar) - * ``` - * - * After parsing, the arguments after the flag are available as the - * slice flag.Args() or individually as flag.Arg(i). - * The arguments are indexed from 0 through flag.NArg()-1. - * - * The pflag package also defines some new functions that are not in flag, - * that give one-letter shorthands for flags. You can use these by appending - * 'P' to the name of any function that defines a flag. - * ``` - * var ip = flag.IntP("flagname", "f", 1234, "help message") - * var flagvar bool - * func init() { - * flag.BoolVarP(&flagvar, "boolname", "b", true, "help message") - * } - * flag.VarP(&flagval, "varname", "v", "help message") - * ``` - * Shorthand letters can be used with single dashes on the command line. - * Boolean shorthand flags can be combined with other shorthand flags. - * - * Command line flag syntax: - * ``` - * --flag // boolean flags only - * --flag=x - * ``` - * - * Unlike the flag package, a single dash before an option means something - * different than a double dash. Single dashes signify a series of shorthand - * letters for flags. All but the last shorthand letter must be boolean flags. - * ``` - * // boolean flags - * -f - * -abc - * // non-boolean flags - * -n 1234 - * -Ifile - * // mixed - * -abcs "hello" - * -abcn1234 - * ``` - * - * Flag parsing stops after the terminator "--". Unlike the flag package, - * flags can be interspersed with arguments anywhere on the command line - * before this terminator. - * - * Integer flags accept 1234, 0664, 0x1234 and may be negative. - * Boolean flags (in their long form) accept 1, 0, t, f, true, false, - * TRUE, FALSE, True, False. - * Duration flags accept any input valid for time.ParseDuration. - * - * The default set of command-line flags is controlled by - * top-level functions. The FlagSet type allows one to define - * independent sets of flags, such as to implement subcommands - * in a command-line interface. The methods of FlagSet are - * analogous to the top-level functions for the command-line - * flag set. - */ -namespace pflag { - // @ts-ignore - import goflag = flag - /** - * ErrorHandling defines how to handle flag parsing errors. - */ - interface ErrorHandling extends Number{} - /** - * ParseErrorsWhitelist defines the parsing errors that can be ignored - */ - interface ParseErrorsWhitelist { - /** - * UnknownFlags will ignore unknown flags errors and continue parsing rest of the flags - */ - unknownFlags: boolean - } - /** - * Value is the interface to the dynamic value stored in a flag. - * (The default value is represented as a string.) - */ - interface Value { - string(): string - set(_arg0: string): void - type(): string - } -} - -/** - * Package reflect implements run-time reflection, allowing a program to - * manipulate objects with arbitrary types. The typical use is to take a value - * with static type interface{} and extract its dynamic type information by - * calling TypeOf, which returns a Type. - * - * A call to ValueOf returns a Value representing the run-time data. - * Zero takes a Type and returns a Value representing a zero value - * for that type. - * - * See "The Laws of Reflection" for an introduction to reflection in Go: - * https://golang.org/doc/articles/laws_of_reflection.html - */ -namespace reflect { - /** - * A Kind represents the specific kind of type that a Type represents. - * The zero Kind is not a valid kind. - */ - interface Kind extends Number{} - /** - * ChanDir represents a channel type's direction. - */ - interface ChanDir extends Number{} - /** - * Method represents a single method. - */ - interface Method { - /** - * Name is the method name. - */ - name: string - /** - * PkgPath is the package path that qualifies a lower case (unexported) - * method name. It is empty for upper case (exported) method names. - * The combination of PkgPath and Name uniquely identifies a method - * in a method set. - * See https://golang.org/ref/spec#Uniqueness_of_identifiers - */ - pkgPath: string - type: Type // method type - func: Value // func with receiver as first argument - index: number // index for Type.Method - } - interface Method { - /** - * IsExported reports whether the method is exported. - */ - isExported(): boolean - } - interface Kind { - /** - * String returns the name of k. - */ - string(): string - } - interface ChanDir { - string(): string - } - /** - * A StructField describes a single field in a struct. - */ - interface StructField { - /** - * Name is the field name. - */ - name: string - /** - * PkgPath is the package path that qualifies a lower case (unexported) - * field name. It is empty for upper case (exported) field names. - * See https://golang.org/ref/spec#Uniqueness_of_identifiers - */ - pkgPath: string - type: Type // field type - tag: StructTag // field tag string - offset: number // offset within struct, in bytes - index: Array // index sequence for Type.FieldByIndex - anonymous: boolean // is an embedded field - } - interface StructField { - /** - * IsExported reports whether the field is exported. - */ - isExported(): boolean - } -} - -/** - * Package crypto collects common cryptographic constants. - */ -namespace crypto { - /** - * PrivateKey represents a private key using an unspecified algorithm. - * - * Although this type is an empty interface for backwards compatibility reasons, - * all private key types in the standard library implement the following interface - * - * ``` - * interface{ - * Public() crypto.PublicKey - * Equal(x crypto.PrivateKey) bool - * } - * ``` - * - * as well as purpose-specific interfaces such as Signer and Decrypter, which - * can be used for increased type safety within applications. - */ - interface PrivateKey extends _TygojaAny{} -} - -/** - * Package big implements arbitrary-precision arithmetic (big numbers). - * The following numeric types are supported: - * - * ``` - * Int signed integers - * Rat rational numbers - * Float floating-point numbers - * ``` - * - * The zero value for an Int, Rat, or Float correspond to 0. Thus, new - * values can be declared in the usual ways and denote 0 without further - * initialization: - * - * ``` - * var x Int // &x is an *Int of value 0 - * var r = &Rat{} // r is a *Rat of value 0 - * y := new(Float) // y is a *Float of value 0 - * ``` - * - * Alternatively, new values can be allocated and initialized with factory - * functions of the form: - * - * ``` - * func NewT(v V) *T - * ``` - * - * For instance, NewInt(x) returns an *Int set to the value of the int64 - * argument x, NewRat(a, b) returns a *Rat set to the fraction a/b where - * a and b are int64 values, and NewFloat(f) returns a *Float initialized - * to the float64 argument f. More flexibility is provided with explicit - * setters, for instance: - * - * ``` - * var z1 Int - * z1.SetUint64(123) // z1 := 123 - * z2 := new(Rat).SetFloat64(1.25) // z2 := 5/4 - * z3 := new(Float).SetInt(z1) // z3 := 123.0 - * ``` - * - * Setters, numeric operations and predicates are represented as methods of - * the form: - * - * ``` - * func (z *T) SetV(v V) *T // z = v - * func (z *T) Unary(x *T) *T // z = unary x - * func (z *T) Binary(x, y *T) *T // z = x binary y - * func (x *T) Pred() P // p = pred(x) - * ``` - * - * with T one of Int, Rat, or Float. For unary and binary operations, the - * result is the receiver (usually named z in that case; see below); if it - * is one of the operands x or y it may be safely overwritten (and its memory - * reused). - * - * Arithmetic expressions are typically written as a sequence of individual - * method calls, with each call corresponding to an operation. The receiver - * denotes the result and the method arguments are the operation's operands. - * For instance, given three *Int values a, b and c, the invocation - * - * ``` - * c.Add(a, b) - * ``` - * - * computes the sum a + b and stores the result in c, overwriting whatever - * value was held in c before. Unless specified otherwise, operations permit - * aliasing of parameters, so it is perfectly ok to write - * - * ``` - * sum.Add(sum, x) - * ``` - * - * to accumulate values x in a sum. - * - * (By always passing in a result value via the receiver, memory use can be - * much better controlled. Instead of having to allocate new memory for each - * result, an operation can reuse the space allocated for the result value, - * and overwrite that value with the new result in the process.) - * - * Notational convention: Incoming method parameters (including the receiver) - * are named consistently in the API to clarify their use. Incoming operands - * are usually named x, y, a, b, and so on, but never z. A parameter specifying - * the result is named z (typically the receiver). - * - * For instance, the arguments for (*Int).Add are named x and y, and because - * the receiver specifies the result destination, it is called z: - * - * ``` - * func (z *Int) Add(x, y *Int) *Int - * ``` - * - * Methods of this form typically return the incoming receiver as well, to - * enable simple call chaining. - * - * Methods which don't require a result value to be passed in (for instance, - * Int.Sign), simply return the result. In this case, the receiver is typically - * the first operand, named x: - * - * ``` - * func (x *Int) Sign() int - * ``` - * - * Various methods support conversions between strings and corresponding - * numeric values, and vice versa: *Int, *Rat, and *Float values implement - * the Stringer interface for a (default) string representation of the value, - * but also provide SetString methods to initialize a value from a string in - * a variety of supported formats (see the respective SetString documentation). - * - * Finally, *Int, *Rat, and *Float satisfy the fmt package's Scanner interface - * for scanning and (except for *Rat) the Formatter interface for formatted - * printing. - */ -namespace big { - /** - * An Int represents a signed multi-precision integer. - * The zero value for an Int represents the value 0. - * - * Operations always take pointer arguments (*Int) rather - * than Int values, and each unique Int value requires - * its own unique *Int pointer. To "copy" an Int value, - * an existing (or newly allocated) Int must be set to - * a new value using the Int.Set method; shallow copies - * of Ints are not supported and may lead to errors. - */ - interface Int { - } - interface Int { - /** - * Sign returns: - * - * ``` - * -1 if x < 0 - * 0 if x == 0 - * +1 if x > 0 - * ``` - */ - sign(): number - } - interface Int { - /** - * SetInt64 sets z to x and returns z. - */ - setInt64(x: number): (Int | undefined) - } - interface Int { - /** - * SetUint64 sets z to x and returns z. - */ - setUint64(x: number): (Int | undefined) - } - interface Int { - /** - * Set sets z to x and returns z. - */ - set(x: Int): (Int | undefined) - } - interface Int { - /** - * Bits provides raw (unchecked but fast) access to x by returning its - * absolute value as a little-endian Word slice. The result and x share - * the same underlying array. - * Bits is intended to support implementation of missing low-level Int - * functionality outside this package; it should be avoided otherwise. - */ - bits(): Array - } - interface Int { - /** - * SetBits provides raw (unchecked but fast) access to z by setting its - * value to abs, interpreted as a little-endian Word slice, and returning - * z. The result and abs share the same underlying array. - * SetBits is intended to support implementation of missing low-level Int - * functionality outside this package; it should be avoided otherwise. - */ - setBits(abs: Array): (Int | undefined) - } - interface Int { - /** - * Abs sets z to |x| (the absolute value of x) and returns z. - */ - abs(x: Int): (Int | undefined) - } - interface Int { - /** - * Neg sets z to -x and returns z. - */ - neg(x: Int): (Int | undefined) - } - interface Int { - /** - * Add sets z to the sum x+y and returns z. - */ - add(x: Int): (Int | undefined) - } - interface Int { - /** - * Sub sets z to the difference x-y and returns z. - */ - sub(x: Int): (Int | undefined) - } - interface Int { - /** - * Mul sets z to the product x*y and returns z. - */ - mul(x: Int): (Int | undefined) - } - interface Int { - /** - * MulRange sets z to the product of all integers - * in the range [a, b] inclusively and returns z. - * If a > b (empty range), the result is 1. - */ - mulRange(a: number): (Int | undefined) - } - interface Int { - /** - * Binomial sets z to the binomial coefficient of (n, k) and returns z. - */ - binomial(n: number): (Int | undefined) - } - interface Int { - /** - * Quo sets z to the quotient x/y for y != 0 and returns z. - * If y == 0, a division-by-zero run-time panic occurs. - * Quo implements truncated division (like Go); see QuoRem for more details. - */ - quo(x: Int): (Int | undefined) - } - interface Int { - /** - * Rem sets z to the remainder x%y for y != 0 and returns z. - * If y == 0, a division-by-zero run-time panic occurs. - * Rem implements truncated modulus (like Go); see QuoRem for more details. - */ - rem(x: Int): (Int | undefined) - } - interface Int { - /** - * QuoRem sets z to the quotient x/y and r to the remainder x%y - * and returns the pair (z, r) for y != 0. - * If y == 0, a division-by-zero run-time panic occurs. - * - * QuoRem implements T-division and modulus (like Go): - * - * ``` - * q = x/y with the result truncated to zero - * r = x - y*q - * ``` - * - * (See Daan Leijen, ``Division and Modulus for Computer Scientists''.) - * See DivMod for Euclidean division and modulus (unlike Go). - */ - quoRem(x: Int): [(Int | undefined), (Int | undefined)] - } - interface Int { - /** - * Div sets z to the quotient x/y for y != 0 and returns z. - * If y == 0, a division-by-zero run-time panic occurs. - * Div implements Euclidean division (unlike Go); see DivMod for more details. - */ - div(x: Int): (Int | undefined) - } - interface Int { - /** - * Mod sets z to the modulus x%y for y != 0 and returns z. - * If y == 0, a division-by-zero run-time panic occurs. - * Mod implements Euclidean modulus (unlike Go); see DivMod for more details. - */ - mod(x: Int): (Int | undefined) - } - interface Int { - /** - * DivMod sets z to the quotient x div y and m to the modulus x mod y - * and returns the pair (z, m) for y != 0. - * If y == 0, a division-by-zero run-time panic occurs. - * - * DivMod implements Euclidean division and modulus (unlike Go): - * - * ``` - * q = x div y such that - * m = x - y*q with 0 <= m < |y| - * ``` - * - * (See Raymond T. Boute, ``The Euclidean definition of the functions - * div and mod''. ACM Transactions on Programming Languages and - * Systems (TOPLAS), 14(2):127-144, New York, NY, USA, 4/1992. - * ACM press.) - * See QuoRem for T-division and modulus (like Go). - */ - divMod(x: Int): [(Int | undefined), (Int | undefined)] - } - interface Int { - /** - * Cmp compares x and y and returns: - * - * ``` - * -1 if x < y - * 0 if x == y - * +1 if x > y - * ``` - */ - cmp(y: Int): number - } - interface Int { - /** - * CmpAbs compares the absolute values of x and y and returns: - * - * ``` - * -1 if |x| < |y| - * 0 if |x| == |y| - * +1 if |x| > |y| - * ``` - */ - cmpAbs(y: Int): number - } - interface Int { - /** - * Int64 returns the int64 representation of x. - * If x cannot be represented in an int64, the result is undefined. - */ - int64(): number - } - interface Int { - /** - * Uint64 returns the uint64 representation of x. - * If x cannot be represented in a uint64, the result is undefined. - */ - uint64(): number - } - interface Int { - /** - * IsInt64 reports whether x can be represented as an int64. - */ - isInt64(): boolean - } - interface Int { - /** - * IsUint64 reports whether x can be represented as a uint64. - */ - isUint64(): boolean - } - interface Int { - /** - * SetString sets z to the value of s, interpreted in the given base, - * and returns z and a boolean indicating success. The entire string - * (not just a prefix) must be valid for success. If SetString fails, - * the value of z is undefined but the returned value is nil. - * - * The base argument must be 0 or a value between 2 and MaxBase. - * For base 0, the number prefix determines the actual base: A prefix of - * ``0b'' or ``0B'' selects base 2, ``0'', ``0o'' or ``0O'' selects base 8, - * and ``0x'' or ``0X'' selects base 16. Otherwise, the selected base is 10 - * and no prefix is accepted. - * - * For bases <= 36, lower and upper case letters are considered the same: - * The letters 'a' to 'z' and 'A' to 'Z' represent digit values 10 to 35. - * For bases > 36, the upper case letters 'A' to 'Z' represent the digit - * values 36 to 61. - * - * For base 0, an underscore character ``_'' may appear between a base - * prefix and an adjacent digit, and between successive digits; such - * underscores do not change the value of the number. - * Incorrect placement of underscores is reported as an error if there - * are no other errors. If base != 0, underscores are not recognized - * and act like any other character that is not a valid digit. - */ - setString(s: string, base: number): [(Int | undefined), boolean] - } - interface Int { - /** - * SetBytes interprets buf as the bytes of a big-endian unsigned - * integer, sets z to that value, and returns z. - */ - setBytes(buf: string): (Int | undefined) - } - interface Int { - /** - * Bytes returns the absolute value of x as a big-endian byte slice. - * - * To use a fixed length slice, or a preallocated one, use FillBytes. - */ - bytes(): string - } - interface Int { - /** - * FillBytes sets buf to the absolute value of x, storing it as a zero-extended - * big-endian byte slice, and returns buf. - * - * If the absolute value of x doesn't fit in buf, FillBytes will panic. - */ - fillBytes(buf: string): string - } - interface Int { - /** - * BitLen returns the length of the absolute value of x in bits. - * The bit length of 0 is 0. - */ - bitLen(): number - } - interface Int { - /** - * TrailingZeroBits returns the number of consecutive least significant zero - * bits of |x|. - */ - trailingZeroBits(): number - } - interface Int { - /** - * Exp sets z = x**y mod |m| (i.e. the sign of m is ignored), and returns z. - * If m == nil or m == 0, z = x**y unless y <= 0 then z = 1. If m != 0, y < 0, - * and x and m are not relatively prime, z is unchanged and nil is returned. - * - * Modular exponentiation of inputs of a particular size is not a - * cryptographically constant-time operation. - */ - exp(x: Int): (Int | undefined) - } - interface Int { - /** - * GCD sets z to the greatest common divisor of a and b and returns z. - * If x or y are not nil, GCD sets their value such that z = a*x + b*y. - * - * a and b may be positive, zero or negative. (Before Go 1.14 both had - * to be > 0.) Regardless of the signs of a and b, z is always >= 0. - * - * If a == b == 0, GCD sets z = x = y = 0. - * - * If a == 0 and b != 0, GCD sets z = |b|, x = 0, y = sign(b) * 1. - * - * If a != 0 and b == 0, GCD sets z = |a|, x = sign(a) * 1, y = 0. - */ - gcd(x: Int): (Int | undefined) - } - interface Int { - /** - * Rand sets z to a pseudo-random number in [0, n) and returns z. - * - * As this uses the math/rand package, it must not be used for - * security-sensitive work. Use crypto/rand.Int instead. - */ - rand(rnd: rand.Rand, n: Int): (Int | undefined) - } - interface Int { - /** - * ModInverse sets z to the multiplicative inverse of g in the ring ℤ/nℤ - * and returns z. If g and n are not relatively prime, g has no multiplicative - * inverse in the ring ℤ/nℤ. In this case, z is unchanged and the return value - * is nil. - */ - modInverse(g: Int): (Int | undefined) - } - interface Int { - /** - * ModSqrt sets z to a square root of x mod p if such a square root exists, and - * returns z. The modulus p must be an odd prime. If x is not a square mod p, - * ModSqrt leaves z unchanged and returns nil. This function panics if p is - * not an odd integer. - */ - modSqrt(x: Int): (Int | undefined) - } - interface Int { - /** - * Lsh sets z = x << n and returns z. - */ - lsh(x: Int, n: number): (Int | undefined) - } - interface Int { - /** - * Rsh sets z = x >> n and returns z. - */ - rsh(x: Int, n: number): (Int | undefined) - } - interface Int { - /** - * Bit returns the value of the i'th bit of x. That is, it - * returns (x>>i)&1. The bit index i must be >= 0. - */ - bit(i: number): number - } - interface Int { - /** - * SetBit sets z to x, with x's i'th bit set to b (0 or 1). - * That is, if b is 1 SetBit sets z = x | (1 << i); - * if b is 0 SetBit sets z = x &^ (1 << i). If b is not 0 or 1, - * SetBit will panic. - */ - setBit(x: Int, i: number, b: number): (Int | undefined) - } - interface Int { - /** - * And sets z = x & y and returns z. - */ - and(x: Int): (Int | undefined) - } - interface Int { - /** - * AndNot sets z = x &^ y and returns z. - */ - andNot(x: Int): (Int | undefined) - } - interface Int { - /** - * Or sets z = x | y and returns z. - */ - or(x: Int): (Int | undefined) - } - interface Int { - /** - * Xor sets z = x ^ y and returns z. - */ - xor(x: Int): (Int | undefined) - } - interface Int { - /** - * Not sets z = ^x and returns z. - */ - not(x: Int): (Int | undefined) - } - interface Int { - /** - * Sqrt sets z to ⌊√x⌋, the largest integer such that z² ≤ x, and returns z. - * It panics if x is negative. - */ - sqrt(x: Int): (Int | undefined) - } - interface Int { - /** - * Text returns the string representation of x in the given base. - * Base must be between 2 and 62, inclusive. The result uses the - * lower-case letters 'a' to 'z' for digit values 10 to 35, and - * the upper-case letters 'A' to 'Z' for digit values 36 to 61. - * No prefix (such as "0x") is added to the string. If x is a nil - * pointer it returns "". - */ - text(base: number): string - } - interface Int { - /** - * Append appends the string representation of x, as generated by - * x.Text(base), to buf and returns the extended buffer. - */ - append(buf: string, base: number): string - } - interface Int { - /** - * String returns the decimal representation of x as generated by - * x.Text(10). - */ - string(): string - } - interface Int { - /** - * Format implements fmt.Formatter. It accepts the formats - * 'b' (binary), 'o' (octal with 0 prefix), 'O' (octal with 0o prefix), - * 'd' (decimal), 'x' (lowercase hexadecimal), and - * 'X' (uppercase hexadecimal). - * Also supported are the full suite of package fmt's format - * flags for integral types, including '+' and ' ' for sign - * control, '#' for leading zero in octal and for hexadecimal, - * a leading "0x" or "0X" for "%#x" and "%#X" respectively, - * specification of minimum digits precision, output field - * width, space or zero padding, and '-' for left or right - * justification. - */ - format(s: fmt.State, ch: string): void - } - interface Int { - /** - * Scan is a support routine for fmt.Scanner; it sets z to the value of - * the scanned number. It accepts the formats 'b' (binary), 'o' (octal), - * 'd' (decimal), 'x' (lowercase hexadecimal), and 'X' (uppercase hexadecimal). - */ - scan(s: fmt.ScanState, ch: string): void - } - interface Int { - /** - * GobEncode implements the gob.GobEncoder interface. - */ - gobEncode(): string - } - interface Int { - /** - * GobDecode implements the gob.GobDecoder interface. - */ - gobDecode(buf: string): void - } - interface Int { - /** - * MarshalText implements the encoding.TextMarshaler interface. - */ - marshalText(): string - } - interface Int { - /** - * UnmarshalText implements the encoding.TextUnmarshaler interface. - */ - unmarshalText(text: string): void - } - interface Int { - /** - * MarshalJSON implements the json.Marshaler interface. - */ - marshalJSON(): string - } - interface Int { - /** - * UnmarshalJSON implements the json.Unmarshaler interface. - */ - unmarshalJSON(text: string): void - } - interface Int { - /** - * ProbablyPrime reports whether x is probably prime, - * applying the Miller-Rabin test with n pseudorandomly chosen bases - * as well as a Baillie-PSW test. - * - * If x is prime, ProbablyPrime returns true. - * If x is chosen randomly and not prime, ProbablyPrime probably returns false. - * The probability of returning true for a randomly chosen non-prime is at most ¼ⁿ. - * - * ProbablyPrime is 100% accurate for inputs less than 2⁶⁴. - * See Menezes et al., Handbook of Applied Cryptography, 1997, pp. 145-149, - * and FIPS 186-4 Appendix F for further discussion of the error probabilities. - * - * ProbablyPrime is not suitable for judging primes that an adversary may - * have crafted to fool the test. - * - * As of Go 1.8, ProbablyPrime(0) is allowed and applies only a Baillie-PSW test. - * Before Go 1.8, ProbablyPrime applied only the Miller-Rabin tests, and ProbablyPrime(0) panicked. - */ - probablyPrime(n: number): boolean - } -} - -/** - * Package asn1 implements parsing of DER-encoded ASN.1 data structures, - * as defined in ITU-T Rec X.690. - * - * See also ``A Layman's Guide to a Subset of ASN.1, BER, and DER,'' - * http://luca.ntop.org/Teaching/Appunti/asn1.html. - */ -namespace asn1 { - /** - * An ObjectIdentifier represents an ASN.1 OBJECT IDENTIFIER. - */ - interface ObjectIdentifier extends Array{} - interface ObjectIdentifier { - /** - * Equal reports whether oi and other represent the same identifier. - */ - equal(other: ObjectIdentifier): boolean - } - interface ObjectIdentifier { - string(): string - } -} - -/** - * Package pkix contains shared, low level structures used for ASN.1 parsing - * and serialization of X.509 certificates, CRL and OCSP. - */ -namespace pkix { - /** - * Extension represents the ASN.1 structure of the same name. See RFC - * 5280, section 4.2. - */ - interface Extension { - id: asn1.ObjectIdentifier - critical: boolean - value: string - } - /** - * Name represents an X.509 distinguished name. This only includes the common - * elements of a DN. Note that Name is only an approximation of the X.509 - * structure. If an accurate representation is needed, asn1.Unmarshal the raw - * subject or issuer as an RDNSequence. - */ - interface Name { - country: Array - locality: Array - streetAddress: Array - serialNumber: string - /** - * Names contains all parsed attributes. When parsing distinguished names, - * this can be used to extract non-standard attributes that are not parsed - * by this package. When marshaling to RDNSequences, the Names field is - * ignored, see ExtraNames. - */ - names: Array - /** - * ExtraNames contains attributes to be copied, raw, into any marshaled - * distinguished names. Values override any attributes with the same OID. - * The ExtraNames field is not populated when parsing, see Names. - */ - extraNames: Array - } - interface Name { - /** - * FillFromRDNSequence populates n from the provided RDNSequence. - * Multi-entry RDNs are flattened, all entries are added to the - * relevant n fields, and the grouping is not preserved. - */ - fillFromRDNSequence(rdns: RDNSequence): void - } - interface Name { - /** - * ToRDNSequence converts n into a single RDNSequence. The following - * attributes are encoded as multi-value RDNs: - * - * - Country - * - Organization - * - OrganizationalUnit - * - Locality - * - Province - * - StreetAddress - * - PostalCode - * - * Each ExtraNames entry is encoded as an individual RDN. - */ - toRDNSequence(): RDNSequence - } - interface Name { - /** - * String returns the string form of n, roughly following - * the RFC 2253 Distinguished Names syntax. - */ - string(): string - } - /** - * CertificateList represents the ASN.1 structure of the same name. See RFC - * 5280, section 5.1. Use Certificate.CheckCRLSignature to verify the - * signature. - */ - interface CertificateList { - tbsCertList: TBSCertificateList - signatureAlgorithm: AlgorithmIdentifier - signatureValue: asn1.BitString - } - interface CertificateList { - /** - * HasExpired reports whether certList should have been updated by now. - */ - hasExpired(now: time.Time): boolean - } - /** - * RevokedCertificate represents the ASN.1 structure of the same name. See RFC - * 5280, section 5.1. - */ - interface RevokedCertificate { - serialNumber?: big.Int - revocationTime: time.Time - extensions: Array - } -} - /** * Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer * object, creating another object (Reader or Writer) that also implements @@ -22388,2932 +17505,8 @@ namespace mail { } } -/** - * Copyright 2021 The Go Authors. All rights reserved. - * Use of this source code is governed by a BSD-style - * license that can be found in the LICENSE file. - */ -/** - * Package x509 parses X.509-encoded keys and certificates. - */ -namespace x509 { - // @ts-ignore - import cryptobyte_asn1 = asn1 - /** - * VerifyOptions contains parameters for Certificate.Verify. - */ - interface VerifyOptions { - /** - * DNSName, if set, is checked against the leaf certificate with - * Certificate.VerifyHostname or the platform verifier. - */ - dnsName: string - /** - * Intermediates is an optional pool of certificates that are not trust - * anchors, but can be used to form a chain from the leaf certificate to a - * root certificate. - */ - intermediates?: CertPool - /** - * Roots is the set of trusted root certificates the leaf certificate needs - * to chain up to. If nil, the system roots or the platform verifier are used. - */ - roots?: CertPool - /** - * CurrentTime is used to check the validity of all certificates in the - * chain. If zero, the current time is used. - */ - currentTime: time.Time - /** - * KeyUsages specifies which Extended Key Usage values are acceptable. A - * chain is accepted if it allows any of the listed values. An empty list - * means ExtKeyUsageServerAuth. To accept any key usage, include ExtKeyUsageAny. - */ - keyUsages: Array - /** - * MaxConstraintComparisions is the maximum number of comparisons to - * perform when checking a given certificate's name constraints. If - * zero, a sensible default is used. This limit prevents pathological - * certificates from consuming excessive amounts of CPU time when - * validating. It does not apply to the platform verifier. - */ - maxConstraintComparisions: number - } - interface SignatureAlgorithm extends Number{} - interface SignatureAlgorithm { - string(): string - } - interface PublicKeyAlgorithm extends Number{} - interface PublicKeyAlgorithm { - string(): string - } - /** - * KeyUsage represents the set of actions that are valid for a given key. It's - * a bitmap of the KeyUsage* constants. - */ - interface KeyUsage extends Number{} - /** - * ExtKeyUsage represents an extended set of actions that are valid for a given key. - * Each of the ExtKeyUsage* constants define a unique action. - */ - interface ExtKeyUsage extends Number{} -} - -/** - * Package tls partially implements TLS 1.2, as specified in RFC 5246, - * and TLS 1.3, as specified in RFC 8446. - */ -namespace tls { - /** - * ClientSessionState contains the state needed by clients to resume TLS - * sessions. - */ - interface ClientSessionState { - } - /** - * SignatureScheme identifies a signature algorithm supported by TLS. See - * RFC 8446, Section 4.2.3. - */ - interface SignatureScheme extends Number{} - interface SignatureScheme { - string(): string - } -} - -/** - * Package acme provides an implementation of the - * Automatic Certificate Management Environment (ACME) spec, - * most famously used by Let's Encrypt. - * - * The initial implementation of this package was based on an early version - * of the spec. The current implementation supports only the modern - * RFC 8555 but some of the old API surface remains for compatibility. - * While code using the old API will still compile, it will return an error. - * Note the deprecation comments to update your code. - * - * See https://tools.ietf.org/html/rfc8555 for the spec. - * - * Most common scenarios will want to use autocert subdirectory instead, - * which provides automatic access to certificates from Let's Encrypt - * and any other ACME-based CA. - */ -namespace acme { - /** - * Client is an ACME client. - * - * The only required field is Key. An example of creating a client with a new key - * is as follows: - * - * ``` - * key, err := rsa.GenerateKey(rand.Reader, 2048) - * if err != nil { - * log.Fatal(err) - * } - * client := &Client{Key: key} - * ``` - */ - interface Client { - /** - * Key is the account key used to register with a CA and sign requests. - * Key.Public() must return a *rsa.PublicKey or *ecdsa.PublicKey. - * - * The following algorithms are supported: - * RS256, ES256, ES384 and ES512. - * See RFC 7518 for more details about the algorithms. - */ - key: crypto.Signer - /** - * HTTPClient optionally specifies an HTTP client to use - * instead of http.DefaultClient. - */ - httpClient?: http.Client - /** - * DirectoryURL points to the CA directory endpoint. - * If empty, LetsEncryptURL is used. - * Mutating this value after a successful call of Client's Discover method - * will have no effect. - */ - directoryURL: string - /** - * RetryBackoff computes the duration after which the nth retry of a failed request - * should occur. The value of n for the first call on failure is 1. - * The values of r and resp are the request and response of the last failed attempt. - * If the returned value is negative or zero, no more retries are done and an error - * is returned to the caller of the original method. - * - * Requests which result in a 4xx client error are not retried, - * except for 400 Bad Request due to "bad nonce" errors and 429 Too Many Requests. - * - * If RetryBackoff is nil, a truncated exponential backoff algorithm - * with the ceiling of 10 seconds is used, where each subsequent retry n - * is done after either ("Retry-After" + jitter) or (2^n seconds + jitter), - * preferring the former if "Retry-After" header is found in the resp. - * The jitter is a random value up to 1 second. - */ - retryBackoff: (n: number, r: http.Request, resp: http.Response) => time.Duration - /** - * UserAgent is prepended to the User-Agent header sent to the ACME server, - * which by default is this package's name and version. - * - * Reusable libraries and tools in particular should set this value to be - * identifiable by the server, in case they are causing issues. - */ - userAgent: string - /** - * KID is the key identifier provided by the CA. If not provided it will be - * retrieved from the CA by making a call to the registration endpoint. - */ - kid: KeyID - } - interface Client { - /** - * Discover performs ACME server discovery using c.DirectoryURL. - * - * It caches successful result. So, subsequent calls will not result in - * a network round-trip. This also means mutating c.DirectoryURL after successful call - * of this method will have no effect. - */ - discover(ctx: context.Context): Directory - } - interface Client { - /** - * CreateCert was part of the old version of ACME. It is incompatible with RFC 8555. - * - * Deprecated: this was for the pre-RFC 8555 version of ACME. Callers should use CreateOrderCert. - */ - createCert(ctx: context.Context, csr: string, exp: time.Duration, bundle: boolean): [Array, string] - } - interface Client { - /** - * FetchCert retrieves already issued certificate from the given url, in DER format. - * It retries the request until the certificate is successfully retrieved, - * context is cancelled by the caller or an error response is received. - * - * If the bundle argument is true, the returned value also contains the CA (issuer) - * certificate chain. - * - * FetchCert returns an error if the CA's response or chain was unreasonably large. - * Callers are encouraged to parse the returned value to ensure the certificate is valid - * and has expected features. - */ - fetchCert(ctx: context.Context, url: string, bundle: boolean): Array - } - interface Client { - /** - * RevokeCert revokes a previously issued certificate cert, provided in DER format. - * - * The key argument, used to sign the request, must be authorized - * to revoke the certificate. It's up to the CA to decide which keys are authorized. - * For instance, the key pair of the certificate may be authorized. - * If the key is nil, c.Key is used instead. - */ - revokeCert(ctx: context.Context, key: crypto.Signer, cert: string, reason: CRLReasonCode): void - } - interface Client { - /** - * Register creates a new account with the CA using c.Key. - * It returns the registered account. The account acct is not modified. - * - * The registration may require the caller to agree to the CA's Terms of Service (TOS). - * If so, and the account has not indicated the acceptance of the terms (see Account for details), - * Register calls prompt with a TOS URL provided by the CA. Prompt should report - * whether the caller agrees to the terms. To always accept the terms, the caller can use AcceptTOS. - * - * When interfacing with an RFC-compliant CA, non-RFC 8555 fields of acct are ignored - * and prompt is called if Directory's Terms field is non-zero. - * Also see Error's Instance field for when a CA requires already registered accounts to agree - * to an updated Terms of Service. - */ - register(ctx: context.Context, acct: Account, prompt: (tosURL: string) => boolean): (Account | undefined) - } - interface Client { - /** - * GetReg retrieves an existing account associated with c.Key. - * - * The url argument is a legacy artifact of the pre-RFC 8555 API - * and is ignored. - */ - getReg(ctx: context.Context, url: string): (Account | undefined) - } - interface Client { - /** - * UpdateReg updates an existing registration. - * It returns an updated account copy. The provided account is not modified. - * - * The account's URI is ignored and the account URL associated with - * c.Key is used instead. - */ - updateReg(ctx: context.Context, acct: Account): (Account | undefined) - } - interface Client { - /** - * AccountKeyRollover attempts to transition a client's account key to a new key. - * On success client's Key is updated which is not concurrency safe. - * On failure an error will be returned. - * The new key is already registered with the ACME provider if the following is true: - * ``` - * - error is of type acme.Error - * - StatusCode should be 409 (Conflict) - * - Location header will have the KID of the associated account - * ``` - * - * More about account key rollover can be found at - * https://tools.ietf.org/html/rfc8555#section-7.3.5. - */ - accountKeyRollover(ctx: context.Context, newKey: crypto.Signer): void - } - interface Client { - /** - * Authorize performs the initial step in the pre-authorization flow, - * as opposed to order-based flow. - * The caller will then need to choose from and perform a set of returned - * challenges using c.Accept in order to successfully complete authorization. - * - * Once complete, the caller can use AuthorizeOrder which the CA - * should provision with the already satisfied authorization. - * For pre-RFC CAs, the caller can proceed directly to requesting a certificate - * using CreateCert method. - * - * If an authorization has been previously granted, the CA may return - * a valid authorization which has its Status field set to StatusValid. - * - * More about pre-authorization can be found at - * https://tools.ietf.org/html/rfc8555#section-7.4.1. - */ - authorize(ctx: context.Context, domain: string): (Authorization | undefined) - } - interface Client { - /** - * AuthorizeIP is the same as Authorize but requests IP address authorization. - * Clients which successfully obtain such authorization may request to issue - * a certificate for IP addresses. - * - * See the ACME spec extension for more details about IP address identifiers: - * https://tools.ietf.org/html/draft-ietf-acme-ip. - */ - authorizeIP(ctx: context.Context, ipaddr: string): (Authorization | undefined) - } - interface Client { - /** - * GetAuthorization retrieves an authorization identified by the given URL. - * - * If a caller needs to poll an authorization until its status is final, - * see the WaitAuthorization method. - */ - getAuthorization(ctx: context.Context, url: string): (Authorization | undefined) - } - interface Client { - /** - * RevokeAuthorization relinquishes an existing authorization identified - * by the given URL. - * The url argument is an Authorization.URI value. - * - * If successful, the caller will be required to obtain a new authorization - * using the Authorize or AuthorizeOrder methods before being able to request - * a new certificate for the domain associated with the authorization. - * - * It does not revoke existing certificates. - */ - revokeAuthorization(ctx: context.Context, url: string): void - } - interface Client { - /** - * WaitAuthorization polls an authorization at the given URL - * until it is in one of the final states, StatusValid or StatusInvalid, - * the ACME CA responded with a 4xx error code, or the context is done. - * - * It returns a non-nil Authorization only if its Status is StatusValid. - * In all other cases WaitAuthorization returns an error. - * If the Status is StatusInvalid, the returned error is of type *AuthorizationError. - */ - waitAuthorization(ctx: context.Context, url: string): (Authorization | undefined) - } - interface Client { - /** - * GetChallenge retrieves the current status of an challenge. - * - * A client typically polls a challenge status using this method. - */ - getChallenge(ctx: context.Context, url: string): (Challenge | undefined) - } - interface Client { - /** - * Accept informs the server that the client accepts one of its challenges - * previously obtained with c.Authorize. - * - * The server will then perform the validation asynchronously. - */ - accept(ctx: context.Context, chal: Challenge): (Challenge | undefined) - } - interface Client { - /** - * DNS01ChallengeRecord returns a DNS record value for a dns-01 challenge response. - * A TXT record containing the returned value must be provisioned under - * "_acme-challenge" name of the domain being validated. - * - * The token argument is a Challenge.Token value. - */ - dns01ChallengeRecord(token: string): string - } - interface Client { - /** - * HTTP01ChallengeResponse returns the response for an http-01 challenge. - * Servers should respond with the value to HTTP requests at the URL path - * provided by HTTP01ChallengePath to validate the challenge and prove control - * over a domain name. - * - * The token argument is a Challenge.Token value. - */ - http01ChallengeResponse(token: string): string - } - interface Client { - /** - * HTTP01ChallengePath returns the URL path at which the response for an http-01 challenge - * should be provided by the servers. - * The response value can be obtained with HTTP01ChallengeResponse. - * - * The token argument is a Challenge.Token value. - */ - http01ChallengePath(token: string): string - } - interface Client { - /** - * TLSSNI01ChallengeCert creates a certificate for TLS-SNI-01 challenge response. - * - * Deprecated: This challenge type is unused in both draft-02 and RFC versions of the ACME spec. - */ - tlssni01ChallengeCert(token: string, ...opt: CertOption[]): [tls.Certificate, string] - } - interface Client { - /** - * TLSSNI02ChallengeCert creates a certificate for TLS-SNI-02 challenge response. - * - * Deprecated: This challenge type is unused in both draft-02 and RFC versions of the ACME spec. - */ - tlssni02ChallengeCert(token: string, ...opt: CertOption[]): [tls.Certificate, string] - } - interface Client { - /** - * TLSALPN01ChallengeCert creates a certificate for TLS-ALPN-01 challenge response. - * Servers can present the certificate to validate the challenge and prove control - * over a domain name. For more details on TLS-ALPN-01 see - * https://tools.ietf.org/html/draft-shoemaker-acme-tls-alpn-00#section-3 - * - * The token argument is a Challenge.Token value. - * If a WithKey option is provided, its private part signs the returned cert, - * and the public part is used to specify the signee. - * If no WithKey option is provided, a new ECDSA key is generated using P-256 curve. - * - * The returned certificate is valid for the next 24 hours and must be presented only when - * the server name in the TLS ClientHello matches the domain, and the special acme-tls/1 ALPN protocol - * has been specified. - */ - tlsalpn01ChallengeCert(token: string, ...opt: CertOption[]): tls.Certificate - } - interface Client { - /** - * DeactivateReg permanently disables an existing account associated with c.Key. - * A deactivated account can no longer request certificate issuance or access - * resources related to the account, such as orders or authorizations. - * - * It only works with CAs implementing RFC 8555. - */ - deactivateReg(ctx: context.Context): void - } - interface Client { - /** - * AuthorizeOrder initiates the order-based application for certificate issuance, - * as opposed to pre-authorization in Authorize. - * It is only supported by CAs implementing RFC 8555. - * - * The caller then needs to fetch each authorization with GetAuthorization, - * identify those with StatusPending status and fulfill a challenge using Accept. - * Once all authorizations are satisfied, the caller will typically want to poll - * order status using WaitOrder until it's in StatusReady state. - * To finalize the order and obtain a certificate, the caller submits a CSR with CreateOrderCert. - */ - authorizeOrder(ctx: context.Context, id: Array, ...opt: OrderOption[]): (Order | undefined) - } - interface Client { - /** - * GetOrder retrives an order identified by the given URL. - * For orders created with AuthorizeOrder, the url value is Order.URI. - * - * If a caller needs to poll an order until its status is final, - * see the WaitOrder method. - */ - getOrder(ctx: context.Context, url: string): (Order | undefined) - } - interface Client { - /** - * WaitOrder polls an order from the given URL until it is in one of the final states, - * StatusReady, StatusValid or StatusInvalid, the CA responded with a non-retryable error - * or the context is done. - * - * It returns a non-nil Order only if its Status is StatusReady or StatusValid. - * In all other cases WaitOrder returns an error. - * If the Status is StatusInvalid, the returned error is of type *OrderError. - */ - waitOrder(ctx: context.Context, url: string): (Order | undefined) - } - interface Client { - /** - * CreateOrderCert submits the CSR (Certificate Signing Request) to a CA at the specified URL. - * The URL is the FinalizeURL field of an Order created with AuthorizeOrder. - * - * If the bundle argument is true, the returned value also contain the CA (issuer) - * certificate chain. Otherwise, only a leaf certificate is returned. - * The returned URL can be used to re-fetch the certificate using FetchCert. - * - * This method is only supported by CAs implementing RFC 8555. See CreateCert for pre-RFC CAs. - * - * CreateOrderCert returns an error if the CA's response is unreasonably large. - * Callers are encouraged to parse the returned value to ensure the certificate is valid and has the expected features. - */ - createOrderCert(ctx: context.Context, url: string, csr: string, bundle: boolean): [Array, string] - } - interface Client { - /** - * ListCertAlternates retrieves any alternate certificate chain URLs for the - * given certificate chain URL. These alternate URLs can be passed to FetchCert - * in order to retrieve the alternate certificate chains. - * - * If there are no alternate issuer certificate chains, a nil slice will be - * returned. - */ - listCertAlternates(ctx: context.Context, url: string): Array - } - /** - * ExternalAccountBinding contains the data needed to form a request with - * an external account binding. - * See https://tools.ietf.org/html/rfc8555#section-7.3.4 for more details. - */ - interface ExternalAccountBinding { - /** - * KID is the Key ID of the symmetric MAC key that the CA provides to - * identify an external account from ACME. - */ - kid: string - /** - * Key is the bytes of the symmetric key that the CA provides to identify - * the account. Key must correspond to the KID. - */ - key: string - } - interface ExternalAccountBinding { - string(): string - } +namespace search { } namespace subscriptions { } - -/** - * Package autocert provides automatic access to certificates from Let's Encrypt - * and any other ACME-based CA. - * - * This package is a work in progress and makes no API stability promises. - */ -namespace autocert { - // @ts-ignore - import mathrand = rand - /** - * HostPolicy specifies which host names the Manager is allowed to respond to. - * It returns a non-nil error if the host should be rejected. - * The returned error is accessible via tls.Conn.Handshake and its callers. - * See Manager's HostPolicy field and GetCertificate method docs for more details. - */ - interface HostPolicy {(ctx: context.Context, host: string): void } - /** - * Cache is used by Manager to store and retrieve previously obtained certificates - * and other account data as opaque blobs. - * - * Cache implementations should not rely on the key naming pattern. Keys can - * include any printable ASCII characters, except the following: \/:*?"<>| - */ - interface Cache { - /** - * Get returns a certificate data for the specified key. - * If there's no such key, Get returns ErrCacheMiss. - */ - get(ctx: context.Context, key: string): string - /** - * Put stores the data in the cache under the specified key. - * Underlying implementations may use any data storage format, - * as long as the reverse operation, Get, results in the original data. - */ - put(ctx: context.Context, key: string, data: string): void - /** - * Delete removes a certificate data from the cache under the specified key. - * If there's no such key in the cache, Delete returns nil. - */ - delete(ctx: context.Context, key: string): void - } -} - -/** - * Package driver defines interfaces to be implemented by database - * drivers as used by package sql. - * - * Most code should use package sql. - * - * The driver interface has evolved over time. Drivers should implement - * Connector and DriverContext interfaces. - * The Connector.Connect and Driver.Open methods should never return ErrBadConn. - * ErrBadConn should only be returned from Validator, SessionResetter, or - * a query method if the connection is already in an invalid (e.g. closed) state. - * - * All Conn implementations should implement the following interfaces: - * Pinger, SessionResetter, and Validator. - * - * If named parameters or context are supported, the driver's Conn should implement: - * ExecerContext, QueryerContext, ConnPrepareContext, and ConnBeginTx. - * - * To support custom data types, implement NamedValueChecker. NamedValueChecker - * also allows queries to accept per-query options as a parameter by returning - * ErrRemoveArgument from CheckNamedValue. - * - * If multiple result sets are supported, Rows should implement RowsNextResultSet. - * If the driver knows how to describe the types present in the returned result - * it should implement the following interfaces: RowsColumnTypeScanType, - * RowsColumnTypeDatabaseTypeName, RowsColumnTypeLength, RowsColumnTypeNullable, - * and RowsColumnTypePrecisionScale. A given row value may also return a Rows - * type, which may represent a database cursor value. - * - * Before a connection is returned to the connection pool after use, IsValid is - * called if implemented. Before a connection is reused for another query, - * ResetSession is called if implemented. If a connection is never returned to the - * connection pool but immediately reused, then ResetSession is called prior to - * reuse but IsValid is not called. - */ -namespace driver { - /** - * Stmt is a prepared statement. It is bound to a Conn and not - * used by multiple goroutines concurrently. - */ - interface Stmt { - /** - * Close closes the statement. - * - * As of Go 1.1, a Stmt will not be closed if it's in use - * by any queries. - * - * Drivers must ensure all network calls made by Close - * do not block indefinitely (e.g. apply a timeout). - */ - close(): void - /** - * NumInput returns the number of placeholder parameters. - * - * If NumInput returns >= 0, the sql package will sanity check - * argument counts from callers and return errors to the caller - * before the statement's Exec or Query methods are called. - * - * NumInput may also return -1, if the driver doesn't know - * its number of placeholders. In that case, the sql package - * will not sanity check Exec or Query argument counts. - */ - numInput(): number - /** - * Exec executes a query that doesn't return rows, such - * as an INSERT or UPDATE. - * - * Deprecated: Drivers should implement StmtExecContext instead (or additionally). - */ - exec(args: Array): Result - /** - * Query executes a query that may return rows, such as a - * SELECT. - * - * Deprecated: Drivers should implement StmtQueryContext instead (or additionally). - */ - query(args: Array): Rows - } - /** - * Tx is a transaction. - */ - interface Tx { - commit(): void - rollback(): void - } -} - -namespace search { -} - -/** - * ``` - * Package flag implements command-line flag parsing. - * - * Usage - * - * Define flags using flag.String(), Bool(), Int(), etc. - * - * This declares an integer flag, -n, stored in the pointer nFlag, with type *int: - * import "flag" - * var nFlag = flag.Int("n", 1234, "help message for flag n") - * If you like, you can bind the flag to a variable using the Var() functions. - * var flagvar int - * func init() { - * flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") - * } - * Or you can create custom flags that satisfy the Value interface (with - * pointer receivers) and couple them to flag parsing by - * flag.Var(&flagVal, "name", "help message for flagname") - * For such flags, the default value is just the initial value of the variable. - * - * After all flags are defined, call - * flag.Parse() - * to parse the command line into the defined flags. - * - * Flags may then be used directly. If you're using the flags themselves, - * they are all pointers; if you bind to variables, they're values. - * fmt.Println("ip has value ", *ip) - * fmt.Println("flagvar has value ", flagvar) - * - * After parsing, the arguments following the flags are available as the - * slice flag.Args() or individually as flag.Arg(i). - * The arguments are indexed from 0 through flag.NArg()-1. - * - * Command line flag syntax - * - * The following forms are permitted: - * - * -flag - * -flag=x - * -flag x // non-boolean flags only - * One or two minus signs may be used; they are equivalent. - * The last form is not permitted for boolean flags because the - * meaning of the command - * cmd -x * - * where * is a Unix shell wildcard, will change if there is a file - * called 0, false, etc. You must use the -flag=false form to turn - * off a boolean flag. - * - * Flag parsing stops just before the first non-flag argument - * ("-" is a non-flag argument) or after the terminator "--". - * - * Integer flags accept 1234, 0664, 0x1234 and may be negative. - * Boolean flags may be: - * 1, 0, t, f, T, F, true, false, TRUE, FALSE, True, False - * Duration flags accept any input valid for time.ParseDuration. - * - * The default set of command-line flags is controlled by - * top-level functions. The FlagSet type allows one to define - * independent sets of flags, such as to implement subcommands - * in a command-line interface. The methods of FlagSet are - * analogous to the top-level functions for the command-line - * flag set. - * ``` - */ -namespace flag { - /** - * Value is the interface to the dynamic value stored in a flag. - * (The default value is represented as a string.) - * - * If a Value has an IsBoolFlag() bool method returning true, - * the command-line parser makes -name equivalent to -name=true - * rather than using the next command-line argument. - * - * Set is called once, in command line order, for each flag present. - * The flag package may call the String method with a zero-valued receiver, - * such as a nil pointer. - */ - interface Value { - string(): string - set(_arg0: string): void - } - /** - * ErrorHandling defines how FlagSet.Parse behaves if the parse fails. - */ - interface ErrorHandling extends Number{} -} - -/** - * Package reflect implements run-time reflection, allowing a program to - * manipulate objects with arbitrary types. The typical use is to take a value - * with static type interface{} and extract its dynamic type information by - * calling TypeOf, which returns a Type. - * - * A call to ValueOf returns a Value representing the run-time data. - * Zero takes a Type and returns a Value representing a zero value - * for that type. - * - * See "The Laws of Reflection" for an introduction to reflection in Go: - * https://golang.org/doc/articles/laws_of_reflection.html - */ -namespace reflect { - /** - * A StructTag is the tag string in a struct field. - * - * By convention, tag strings are a concatenation of - * optionally space-separated key:"value" pairs. - * Each key is a non-empty string consisting of non-control - * characters other than space (U+0020 ' '), quote (U+0022 '"'), - * and colon (U+003A ':'). Each value is quoted using U+0022 '"' - * characters and Go string literal syntax. - */ - interface StructTag extends String{} - interface StructTag { - /** - * Get returns the value associated with key in the tag string. - * If there is no such key in the tag, Get returns the empty string. - * If the tag does not have the conventional format, the value - * returned by Get is unspecified. To determine whether a tag is - * explicitly set to the empty string, use Lookup. - */ - get(key: string): string - } - interface StructTag { - /** - * Lookup returns the value associated with key in the tag string. - * If the key is present in the tag the value (which may be empty) - * is returned. Otherwise the returned value will be the empty string. - * The ok return value reports whether the value was explicitly set in - * the tag string. If the tag does not have the conventional format, - * the value returned by Lookup is unspecified. - */ - lookup(key: string): [string, boolean] - } - /** - * Value is the reflection interface to a Go value. - * - * Not all methods apply to all kinds of values. Restrictions, - * if any, are noted in the documentation for each method. - * Use the Kind method to find out the kind of value before - * calling kind-specific methods. Calling a method - * inappropriate to the kind of type causes a run time panic. - * - * The zero Value represents no value. - * Its IsValid method returns false, its Kind method returns Invalid, - * its String method returns "", and all other methods panic. - * Most functions and methods never return an invalid value. - * If one does, its documentation states the conditions explicitly. - * - * A Value can be used concurrently by multiple goroutines provided that - * the underlying Go value can be used concurrently for the equivalent - * direct operations. - * - * To compare two Values, compare the results of the Interface method. - * Using == on two Values does not compare the underlying values - * they represent. - */ - type _subVocpK = flag - interface Value extends _subVocpK { - } - interface Value { - /** - * Addr returns a pointer value representing the address of v. - * It panics if CanAddr() returns false. - * Addr is typically used to obtain a pointer to a struct field - * or slice element in order to call a method that requires a - * pointer receiver. - */ - addr(): Value - } - interface Value { - /** - * Bool returns v's underlying value. - * It panics if v's kind is not Bool. - */ - bool(): boolean - } - interface Value { - /** - * Bytes returns v's underlying value. - * It panics if v's underlying value is not a slice of bytes. - */ - bytes(): string - } - interface Value { - /** - * CanAddr reports whether the value's address can be obtained with Addr. - * Such values are called addressable. A value is addressable if it is - * an element of a slice, an element of an addressable array, - * a field of an addressable struct, or the result of dereferencing a pointer. - * If CanAddr returns false, calling Addr will panic. - */ - canAddr(): boolean - } - interface Value { - /** - * CanSet reports whether the value of v can be changed. - * A Value can be changed only if it is addressable and was not - * obtained by the use of unexported struct fields. - * If CanSet returns false, calling Set or any type-specific - * setter (e.g., SetBool, SetInt) will panic. - */ - canSet(): boolean - } - interface Value { - /** - * Call calls the function v with the input arguments in. - * For example, if len(in) == 3, v.Call(in) represents the Go call v(in[0], in[1], in[2]). - * Call panics if v's Kind is not Func. - * It returns the output results as Values. - * As in Go, each input argument must be assignable to the - * type of the function's corresponding input parameter. - * If v is a variadic function, Call creates the variadic slice parameter - * itself, copying in the corresponding values. - */ - call(_arg0: Array): Array - } - interface Value { - /** - * CallSlice calls the variadic function v with the input arguments in, - * assigning the slice in[len(in)-1] to v's final variadic argument. - * For example, if len(in) == 3, v.CallSlice(in) represents the Go call v(in[0], in[1], in[2]...). - * CallSlice panics if v's Kind is not Func or if v is not variadic. - * It returns the output results as Values. - * As in Go, each input argument must be assignable to the - * type of the function's corresponding input parameter. - */ - callSlice(_arg0: Array): Array - } - interface Value { - /** - * Cap returns v's capacity. - * It panics if v's Kind is not Array, Chan, or Slice. - */ - cap(): number - } - interface Value { - /** - * Close closes the channel v. - * It panics if v's Kind is not Chan. - */ - close(): void - } - interface Value { - /** - * CanComplex reports whether Complex can be used without panicking. - */ - canComplex(): boolean - } - interface Value { - /** - * Complex returns v's underlying value, as a complex128. - * It panics if v's Kind is not Complex64 or Complex128 - */ - complex(): number - } - interface Value { - /** - * Elem returns the value that the interface v contains - * or that the pointer v points to. - * It panics if v's Kind is not Interface or Pointer. - * It returns the zero Value if v is nil. - */ - elem(): Value - } - interface Value { - /** - * Field returns the i'th field of the struct v. - * It panics if v's Kind is not Struct or i is out of range. - */ - field(i: number): Value - } - interface Value { - /** - * FieldByIndex returns the nested field corresponding to index. - * It panics if evaluation requires stepping through a nil - * pointer or a field that is not a struct. - */ - fieldByIndex(index: Array): Value - } - interface Value { - /** - * FieldByIndexErr returns the nested field corresponding to index. - * It returns an error if evaluation requires stepping through a nil - * pointer, but panics if it must step through a field that - * is not a struct. - */ - fieldByIndexErr(index: Array): Value - } - interface Value { - /** - * FieldByName returns the struct field with the given name. - * It returns the zero Value if no field was found. - * It panics if v's Kind is not struct. - */ - fieldByName(name: string): Value - } - interface Value { - /** - * FieldByNameFunc returns the struct field with a name - * that satisfies the match function. - * It panics if v's Kind is not struct. - * It returns the zero Value if no field was found. - */ - fieldByNameFunc(match: (_arg0: string) => boolean): Value - } - interface Value { - /** - * CanFloat reports whether Float can be used without panicking. - */ - canFloat(): boolean - } - interface Value { - /** - * Float returns v's underlying value, as a float64. - * It panics if v's Kind is not Float32 or Float64 - */ - float(): number - } - interface Value { - /** - * Index returns v's i'th element. - * It panics if v's Kind is not Array, Slice, or String or i is out of range. - */ - index(i: number): Value - } - interface Value { - /** - * CanInt reports whether Int can be used without panicking. - */ - canInt(): boolean - } - interface Value { - /** - * Int returns v's underlying value, as an int64. - * It panics if v's Kind is not Int, Int8, Int16, Int32, or Int64. - */ - int(): number - } - interface Value { - /** - * CanInterface reports whether Interface can be used without panicking. - */ - canInterface(): boolean - } - interface Value { - /** - * Interface returns v's current value as an interface{}. - * It is equivalent to: - * ``` - * var i interface{} = (v's underlying value) - * ``` - * It panics if the Value was obtained by accessing - * unexported struct fields. - */ - interface(): any - } - interface Value { - /** - * InterfaceData returns a pair of unspecified uintptr values. - * It panics if v's Kind is not Interface. - * - * In earlier versions of Go, this function returned the interface's - * value as a uintptr pair. As of Go 1.4, the implementation of - * interface values precludes any defined use of InterfaceData. - * - * Deprecated: The memory representation of interface values is not - * compatible with InterfaceData. - */ - interfaceData(): Array - } - interface Value { - /** - * IsNil reports whether its argument v is nil. The argument must be - * a chan, func, interface, map, pointer, or slice value; if it is - * not, IsNil panics. Note that IsNil is not always equivalent to a - * regular comparison with nil in Go. For example, if v was created - * by calling ValueOf with an uninitialized interface variable i, - * i==nil will be true but v.IsNil will panic as v will be the zero - * Value. - */ - isNil(): boolean - } - interface Value { - /** - * IsValid reports whether v represents a value. - * It returns false if v is the zero Value. - * If IsValid returns false, all other methods except String panic. - * Most functions and methods never return an invalid Value. - * If one does, its documentation states the conditions explicitly. - */ - isValid(): boolean - } - interface Value { - /** - * IsZero reports whether v is the zero value for its type. - * It panics if the argument is invalid. - */ - isZero(): boolean - } - interface Value { - /** - * Kind returns v's Kind. - * If v is the zero Value (IsValid returns false), Kind returns Invalid. - */ - kind(): Kind - } - interface Value { - /** - * Len returns v's length. - * It panics if v's Kind is not Array, Chan, Map, Slice, or String. - */ - len(): number - } - interface Value { - /** - * MapIndex returns the value associated with key in the map v. - * It panics if v's Kind is not Map. - * It returns the zero Value if key is not found in the map or if v represents a nil map. - * As in Go, the key's value must be assignable to the map's key type. - */ - mapIndex(key: Value): Value - } - interface Value { - /** - * MapKeys returns a slice containing all the keys present in the map, - * in unspecified order. - * It panics if v's Kind is not Map. - * It returns an empty slice if v represents a nil map. - */ - mapKeys(): Array - } - interface Value { - /** - * SetIterKey assigns to v the key of iter's current map entry. - * It is equivalent to v.Set(iter.Key()), but it avoids allocating a new Value. - * As in Go, the key must be assignable to v's type. - */ - setIterKey(iter: MapIter): void - } - interface Value { - /** - * SetIterValue assigns to v the value of iter's current map entry. - * It is equivalent to v.Set(iter.Value()), but it avoids allocating a new Value. - * As in Go, the value must be assignable to v's type. - */ - setIterValue(iter: MapIter): void - } - interface Value { - /** - * MapRange returns a range iterator for a map. - * It panics if v's Kind is not Map. - * - * Call Next to advance the iterator, and Key/Value to access each entry. - * Next returns false when the iterator is exhausted. - * MapRange follows the same iteration semantics as a range statement. - * - * Example: - * - * ``` - * iter := reflect.ValueOf(m).MapRange() - * for iter.Next() { - * k := iter.Key() - * v := iter.Value() - * ... - * } - * ``` - */ - mapRange(): (MapIter | undefined) - } - interface Value { - /** - * Method returns a function value corresponding to v's i'th method. - * The arguments to a Call on the returned function should not include - * a receiver; the returned function will always use v as the receiver. - * Method panics if i is out of range or if v is a nil interface value. - */ - method(i: number): Value - } - interface Value { - /** - * NumMethod returns the number of exported methods in the value's method set. - */ - numMethod(): number - } - interface Value { - /** - * MethodByName returns a function value corresponding to the method - * of v with the given name. - * The arguments to a Call on the returned function should not include - * a receiver; the returned function will always use v as the receiver. - * It returns the zero Value if no method was found. - */ - methodByName(name: string): Value - } - interface Value { - /** - * NumField returns the number of fields in the struct v. - * It panics if v's Kind is not Struct. - */ - numField(): number - } - interface Value { - /** - * OverflowComplex reports whether the complex128 x cannot be represented by v's type. - * It panics if v's Kind is not Complex64 or Complex128. - */ - overflowComplex(x: number): boolean - } - interface Value { - /** - * OverflowFloat reports whether the float64 x cannot be represented by v's type. - * It panics if v's Kind is not Float32 or Float64. - */ - overflowFloat(x: number): boolean - } - interface Value { - /** - * OverflowInt reports whether the int64 x cannot be represented by v's type. - * It panics if v's Kind is not Int, Int8, Int16, Int32, or Int64. - */ - overflowInt(x: number): boolean - } - interface Value { - /** - * OverflowUint reports whether the uint64 x cannot be represented by v's type. - * It panics if v's Kind is not Uint, Uintptr, Uint8, Uint16, Uint32, or Uint64. - */ - overflowUint(x: number): boolean - } - interface Value { - /** - * Pointer returns v's value as a uintptr. - * It returns uintptr instead of unsafe.Pointer so that - * code using reflect cannot obtain unsafe.Pointers - * without importing the unsafe package explicitly. - * It panics if v's Kind is not Chan, Func, Map, Pointer, Slice, or UnsafePointer. - * - * If v's Kind is Func, the returned pointer is an underlying - * code pointer, but not necessarily enough to identify a - * single function uniquely. The only guarantee is that the - * result is zero if and only if v is a nil func Value. - * - * If v's Kind is Slice, the returned pointer is to the first - * element of the slice. If the slice is nil the returned value - * is 0. If the slice is empty but non-nil the return value is non-zero. - * - * It's preferred to use uintptr(Value.UnsafePointer()) to get the equivalent result. - */ - pointer(): number - } - interface Value { - /** - * Recv receives and returns a value from the channel v. - * It panics if v's Kind is not Chan. - * The receive blocks until a value is ready. - * The boolean value ok is true if the value x corresponds to a send - * on the channel, false if it is a zero value received because the channel is closed. - */ - recv(): [Value, boolean] - } - interface Value { - /** - * Send sends x on the channel v. - * It panics if v's kind is not Chan or if x's type is not the same type as v's element type. - * As in Go, x's value must be assignable to the channel's element type. - */ - send(x: Value): void - } - interface Value { - /** - * Set assigns x to the value v. - * It panics if CanSet returns false. - * As in Go, x's value must be assignable to v's type. - */ - set(x: Value): void - } - interface Value { - /** - * SetBool sets v's underlying value. - * It panics if v's Kind is not Bool or if CanSet() is false. - */ - setBool(x: boolean): void - } - interface Value { - /** - * SetBytes sets v's underlying value. - * It panics if v's underlying value is not a slice of bytes. - */ - setBytes(x: string): void - } - interface Value { - /** - * SetComplex sets v's underlying value to x. - * It panics if v's Kind is not Complex64 or Complex128, or if CanSet() is false. - */ - setComplex(x: number): void - } - interface Value { - /** - * SetFloat sets v's underlying value to x. - * It panics if v's Kind is not Float32 or Float64, or if CanSet() is false. - */ - setFloat(x: number): void - } - interface Value { - /** - * SetInt sets v's underlying value to x. - * It panics if v's Kind is not Int, Int8, Int16, Int32, or Int64, or if CanSet() is false. - */ - setInt(x: number): void - } - interface Value { - /** - * SetLen sets v's length to n. - * It panics if v's Kind is not Slice or if n is negative or - * greater than the capacity of the slice. - */ - setLen(n: number): void - } - interface Value { - /** - * SetCap sets v's capacity to n. - * It panics if v's Kind is not Slice or if n is smaller than the length or - * greater than the capacity of the slice. - */ - setCap(n: number): void - } - interface Value { - /** - * SetMapIndex sets the element associated with key in the map v to elem. - * It panics if v's Kind is not Map. - * If elem is the zero Value, SetMapIndex deletes the key from the map. - * Otherwise if v holds a nil map, SetMapIndex will panic. - * As in Go, key's elem must be assignable to the map's key type, - * and elem's value must be assignable to the map's elem type. - */ - setMapIndex(key: Value): void - } - interface Value { - /** - * SetUint sets v's underlying value to x. - * It panics if v's Kind is not Uint, Uintptr, Uint8, Uint16, Uint32, or Uint64, or if CanSet() is false. - */ - setUint(x: number): void - } - interface Value { - /** - * SetPointer sets the unsafe.Pointer value v to x. - * It panics if v's Kind is not UnsafePointer. - */ - setPointer(x: number): void - } - interface Value { - /** - * SetString sets v's underlying value to x. - * It panics if v's Kind is not String or if CanSet() is false. - */ - setString(x: string): void - } - interface Value { - /** - * Slice returns v[i:j]. - * It panics if v's Kind is not Array, Slice or String, or if v is an unaddressable array, - * or if the indexes are out of bounds. - */ - slice(i: number): Value - } - interface Value { - /** - * Slice3 is the 3-index form of the slice operation: it returns v[i:j:k]. - * It panics if v's Kind is not Array or Slice, or if v is an unaddressable array, - * or if the indexes are out of bounds. - */ - slice3(i: number): Value - } - interface Value { - /** - * String returns the string v's underlying value, as a string. - * String is a special case because of Go's String method convention. - * Unlike the other getters, it does not panic if v's Kind is not String. - * Instead, it returns a string of the form "" where T is v's type. - * The fmt package treats Values specially. It does not call their String - * method implicitly but instead prints the concrete values they hold. - */ - string(): string - } - interface Value { - /** - * TryRecv attempts to receive a value from the channel v but will not block. - * It panics if v's Kind is not Chan. - * If the receive delivers a value, x is the transferred value and ok is true. - * If the receive cannot finish without blocking, x is the zero Value and ok is false. - * If the channel is closed, x is the zero value for the channel's element type and ok is false. - */ - tryRecv(): [Value, boolean] - } - interface Value { - /** - * TrySend attempts to send x on the channel v but will not block. - * It panics if v's Kind is not Chan. - * It reports whether the value was sent. - * As in Go, x's value must be assignable to the channel's element type. - */ - trySend(x: Value): boolean - } - interface Value { - /** - * Type returns v's type. - */ - type(): Type - } - interface Value { - /** - * CanUint reports whether Uint can be used without panicking. - */ - canUint(): boolean - } - interface Value { - /** - * Uint returns v's underlying value, as a uint64. - * It panics if v's Kind is not Uint, Uintptr, Uint8, Uint16, Uint32, or Uint64. - */ - uint(): number - } - interface Value { - /** - * UnsafeAddr returns a pointer to v's data, as a uintptr. - * It is for advanced clients that also import the "unsafe" package. - * It panics if v is not addressable. - * - * It's preferred to use uintptr(Value.Addr().UnsafePointer()) to get the equivalent result. - */ - unsafeAddr(): number - } - interface Value { - /** - * UnsafePointer returns v's value as a unsafe.Pointer. - * It panics if v's Kind is not Chan, Func, Map, Pointer, Slice, or UnsafePointer. - * - * If v's Kind is Func, the returned pointer is an underlying - * code pointer, but not necessarily enough to identify a - * single function uniquely. The only guarantee is that the - * result is zero if and only if v is a nil func Value. - * - * If v's Kind is Slice, the returned pointer is to the first - * element of the slice. If the slice is nil the returned value - * is nil. If the slice is empty but non-nil the return value is non-nil. - */ - unsafePointer(): number - } - interface Value { - /** - * Convert returns the value v converted to type t. - * If the usual Go conversion rules do not allow conversion - * of the value v to type t, or if converting v to type t panics, Convert panics. - */ - convert(t: Type): Value - } - interface Value { - /** - * CanConvert reports whether the value v can be converted to type t. - * If v.CanConvert(t) returns true then v.Convert(t) will not panic. - */ - canConvert(t: Type): boolean - } -} - -/** - * ``` - * Package fmt implements formatted I/O with functions analogous - * to C's printf and scanf. The format 'verbs' are derived from C's but - * are simpler. - * - * Printing - * - * The verbs: - * - * General: - * %v the value in a default format - * when printing structs, the plus flag (%+v) adds field names - * %#v a Go-syntax representation of the value - * %T a Go-syntax representation of the type of the value - * %% a literal percent sign; consumes no value - * - * Boolean: - * %t the word true or false - * Integer: - * %b base 2 - * %c the character represented by the corresponding Unicode code point - * %d base 10 - * %o base 8 - * %O base 8 with 0o prefix - * %q a single-quoted character literal safely escaped with Go syntax. - * %x base 16, with lower-case letters for a-f - * %X base 16, with upper-case letters for A-F - * %U Unicode format: U+1234; same as "U+%04X" - * Floating-point and complex constituents: - * %b decimalless scientific notation with exponent a power of two, - * in the manner of strconv.FormatFloat with the 'b' format, - * e.g. -123456p-78 - * %e scientific notation, e.g. -1.234456e+78 - * %E scientific notation, e.g. -1.234456E+78 - * %f decimal point but no exponent, e.g. 123.456 - * %F synonym for %f - * %g %e for large exponents, %f otherwise. Precision is discussed below. - * %G %E for large exponents, %F otherwise - * %x hexadecimal notation (with decimal power of two exponent), e.g. -0x1.23abcp+20 - * %X upper-case hexadecimal notation, e.g. -0X1.23ABCP+20 - * String and slice of bytes (treated equivalently with these verbs): - * %s the uninterpreted bytes of the string or slice - * %q a double-quoted string safely escaped with Go syntax - * %x base 16, lower-case, two characters per byte - * %X base 16, upper-case, two characters per byte - * Slice: - * %p address of 0th element in base 16 notation, with leading 0x - * Pointer: - * %p base 16 notation, with leading 0x - * The %b, %d, %o, %x and %X verbs also work with pointers, - * formatting the value exactly as if it were an integer. - * - * The default format for %v is: - * bool: %t - * int, int8 etc.: %d - * uint, uint8 etc.: %d, %#x if printed with %#v - * float32, complex64, etc: %g - * string: %s - * chan: %p - * pointer: %p - * For compound objects, the elements are printed using these rules, recursively, - * laid out like this: - * struct: {field0 field1 ...} - * array, slice: [elem0 elem1 ...] - * maps: map[key1:value1 key2:value2 ...] - * pointer to above: &{}, &[], &map[] - * - * Width is specified by an optional decimal number immediately preceding the verb. - * If absent, the width is whatever is necessary to represent the value. - * Precision is specified after the (optional) width by a period followed by a - * decimal number. If no period is present, a default precision is used. - * A period with no following number specifies a precision of zero. - * Examples: - * %f default width, default precision - * %9f width 9, default precision - * %.2f default width, precision 2 - * %9.2f width 9, precision 2 - * %9.f width 9, precision 0 - * - * Width and precision are measured in units of Unicode code points, - * that is, runes. (This differs from C's printf where the - * units are always measured in bytes.) Either or both of the flags - * may be replaced with the character '*', causing their values to be - * obtained from the next operand (preceding the one to format), - * which must be of type int. - * - * For most values, width is the minimum number of runes to output, - * padding the formatted form with spaces if necessary. - * - * For strings, byte slices and byte arrays, however, precision - * limits the length of the input to be formatted (not the size of - * the output), truncating if necessary. Normally it is measured in - * runes, but for these types when formatted with the %x or %X format - * it is measured in bytes. - * - * For floating-point values, width sets the minimum width of the field and - * precision sets the number of places after the decimal, if appropriate, - * except that for %g/%G precision sets the maximum number of significant - * digits (trailing zeros are removed). For example, given 12.345 the format - * %6.3f prints 12.345 while %.3g prints 12.3. The default precision for %e, %f - * and %#g is 6; for %g it is the smallest number of digits necessary to identify - * the value uniquely. - * - * For complex numbers, the width and precision apply to the two - * components independently and the result is parenthesized, so %f applied - * to 1.2+3.4i produces (1.200000+3.400000i). - * - * Other flags: - * + always print a sign for numeric values; - * guarantee ASCII-only output for %q (%+q) - * - pad with spaces on the right rather than the left (left-justify the field) - * # alternate format: add leading 0b for binary (%#b), 0 for octal (%#o), - * 0x or 0X for hex (%#x or %#X); suppress 0x for %p (%#p); - * for %q, print a raw (backquoted) string if strconv.CanBackquote - * returns true; - * always print a decimal point for %e, %E, %f, %F, %g and %G; - * do not remove trailing zeros for %g and %G; - * write e.g. U+0078 'x' if the character is printable for %U (%#U). - * ' ' (space) leave a space for elided sign in numbers (% d); - * put spaces between bytes printing strings or slices in hex (% x, % X) - * 0 pad with leading zeros rather than spaces; - * for numbers, this moves the padding after the sign - * - * Flags are ignored by verbs that do not expect them. - * For example there is no alternate decimal format, so %#d and %d - * behave identically. - * - * For each Printf-like function, there is also a Print function - * that takes no format and is equivalent to saying %v for every - * operand. Another variant Println inserts blanks between - * operands and appends a newline. - * - * Regardless of the verb, if an operand is an interface value, - * the internal concrete value is used, not the interface itself. - * Thus: - * var i interface{} = 23 - * fmt.Printf("%v\n", i) - * will print 23. - * - * Except when printed using the verbs %T and %p, special - * formatting considerations apply for operands that implement - * certain interfaces. In order of application: - * - * 1. If the operand is a reflect.Value, the operand is replaced by the - * concrete value that it holds, and printing continues with the next rule. - * - * 2. If an operand implements the Formatter interface, it will - * be invoked. In this case the interpretation of verbs and flags is - * controlled by that implementation. - * - * 3. If the %v verb is used with the # flag (%#v) and the operand - * implements the GoStringer interface, that will be invoked. - * - * If the format (which is implicitly %v for Println etc.) is valid - * for a string (%s %q %v %x %X), the following two rules apply: - * - * 4. If an operand implements the error interface, the Error method - * will be invoked to convert the object to a string, which will then - * be formatted as required by the verb (if any). - * - * 5. If an operand implements method String() string, that method - * will be invoked to convert the object to a string, which will then - * be formatted as required by the verb (if any). - * - * For compound operands such as slices and structs, the format - * applies to the elements of each operand, recursively, not to the - * operand as a whole. Thus %q will quote each element of a slice - * of strings, and %6.2f will control formatting for each element - * of a floating-point array. - * - * However, when printing a byte slice with a string-like verb - * (%s %q %x %X), it is treated identically to a string, as a single item. - * - * To avoid recursion in cases such as - * type X string - * func (x X) String() string { return Sprintf("<%s>", x) } - * convert the value before recurring: - * func (x X) String() string { return Sprintf("<%s>", string(x)) } - * Infinite recursion can also be triggered by self-referential data - * structures, such as a slice that contains itself as an element, if - * that type has a String method. Such pathologies are rare, however, - * and the package does not protect against them. - * - * When printing a struct, fmt cannot and therefore does not invoke - * formatting methods such as Error or String on unexported fields. - * - * Explicit argument indexes - * - * In Printf, Sprintf, and Fprintf, the default behavior is for each - * formatting verb to format successive arguments passed in the call. - * However, the notation [n] immediately before the verb indicates that the - * nth one-indexed argument is to be formatted instead. The same notation - * before a '*' for a width or precision selects the argument index holding - * the value. After processing a bracketed expression [n], subsequent verbs - * will use arguments n+1, n+2, etc. unless otherwise directed. - * - * For example, - * fmt.Sprintf("%[2]d %[1]d\n", 11, 22) - * will yield "22 11", while - * fmt.Sprintf("%[3]*.[2]*[1]f", 12.0, 2, 6) - * equivalent to - * fmt.Sprintf("%6.2f", 12.0) - * will yield " 12.00". Because an explicit index affects subsequent verbs, - * this notation can be used to print the same values multiple times - * by resetting the index for the first argument to be repeated: - * fmt.Sprintf("%d %d %#[1]x %#x", 16, 17) - * will yield "16 17 0x10 0x11". - * - * Format errors - * - * If an invalid argument is given for a verb, such as providing - * a string to %d, the generated string will contain a - * description of the problem, as in these examples: - * - * Wrong type or unknown verb: %!verb(type=value) - * Printf("%d", "hi"): %!d(string=hi) - * Too many arguments: %!(EXTRA type=value) - * Printf("hi", "guys"): hi%!(EXTRA string=guys) - * Too few arguments: %!verb(MISSING) - * Printf("hi%d"): hi%!d(MISSING) - * Non-int for width or precision: %!(BADWIDTH) or %!(BADPREC) - * Printf("%*s", 4.5, "hi"): %!(BADWIDTH)hi - * Printf("%.*s", 4.5, "hi"): %!(BADPREC)hi - * Invalid or invalid use of argument index: %!(BADINDEX) - * Printf("%*[2]d", 7): %!d(BADINDEX) - * Printf("%.[2]d", 7): %!d(BADINDEX) - * - * All errors begin with the string "%!" followed sometimes - * by a single character (the verb) and end with a parenthesized - * description. - * - * If an Error or String method triggers a panic when called by a - * print routine, the fmt package reformats the error message - * from the panic, decorating it with an indication that it came - * through the fmt package. For example, if a String method - * calls panic("bad"), the resulting formatted message will look - * like - * %!s(PANIC=bad) - * - * The %!s just shows the print verb in use when the failure - * occurred. If the panic is caused by a nil receiver to an Error - * or String method, however, the output is the undecorated - * string, "". - * - * Scanning - * - * An analogous set of functions scans formatted text to yield - * values. Scan, Scanf and Scanln read from os.Stdin; Fscan, - * Fscanf and Fscanln read from a specified io.Reader; Sscan, - * Sscanf and Sscanln read from an argument string. - * - * Scan, Fscan, Sscan treat newlines in the input as spaces. - * - * Scanln, Fscanln and Sscanln stop scanning at a newline and - * require that the items be followed by a newline or EOF. - * - * Scanf, Fscanf, and Sscanf parse the arguments according to a - * format string, analogous to that of Printf. In the text that - * follows, 'space' means any Unicode whitespace character - * except newline. - * - * In the format string, a verb introduced by the % character - * consumes and parses input; these verbs are described in more - * detail below. A character other than %, space, or newline in - * the format consumes exactly that input character, which must - * be present. A newline with zero or more spaces before it in - * the format string consumes zero or more spaces in the input - * followed by a single newline or the end of the input. A space - * following a newline in the format string consumes zero or more - * spaces in the input. Otherwise, any run of one or more spaces - * in the format string consumes as many spaces as possible in - * the input. Unless the run of spaces in the format string - * appears adjacent to a newline, the run must consume at least - * one space from the input or find the end of the input. - * - * The handling of spaces and newlines differs from that of C's - * scanf family: in C, newlines are treated as any other space, - * and it is never an error when a run of spaces in the format - * string finds no spaces to consume in the input. - * - * The verbs behave analogously to those of Printf. - * For example, %x will scan an integer as a hexadecimal number, - * and %v will scan the default representation format for the value. - * The Printf verbs %p and %T and the flags # and + are not implemented. - * For floating-point and complex values, all valid formatting verbs - * (%b %e %E %f %F %g %G %x %X and %v) are equivalent and accept - * both decimal and hexadecimal notation (for example: "2.3e+7", "0x4.5p-8") - * and digit-separating underscores (for example: "3.14159_26535_89793"). - * - * Input processed by verbs is implicitly space-delimited: the - * implementation of every verb except %c starts by discarding - * leading spaces from the remaining input, and the %s verb - * (and %v reading into a string) stops consuming input at the first - * space or newline character. - * - * The familiar base-setting prefixes 0b (binary), 0o and 0 (octal), - * and 0x (hexadecimal) are accepted when scanning integers - * without a format or with the %v verb, as are digit-separating - * underscores. - * - * Width is interpreted in the input text but there is no - * syntax for scanning with a precision (no %5.2f, just %5f). - * If width is provided, it applies after leading spaces are - * trimmed and specifies the maximum number of runes to read - * to satisfy the verb. For example, - * Sscanf(" 1234567 ", "%5s%d", &s, &i) - * will set s to "12345" and i to 67 while - * Sscanf(" 12 34 567 ", "%5s%d", &s, &i) - * will set s to "12" and i to 34. - * - * In all the scanning functions, a carriage return followed - * immediately by a newline is treated as a plain newline - * (\r\n means the same as \n). - * - * In all the scanning functions, if an operand implements method - * Scan (that is, it implements the Scanner interface) that - * method will be used to scan the text for that operand. Also, - * if the number of arguments scanned is less than the number of - * arguments provided, an error is returned. - * - * All arguments to be scanned must be either pointers to basic - * types or implementations of the Scanner interface. - * - * Like Scanf and Fscanf, Sscanf need not consume its entire input. - * There is no way to recover how much of the input string Sscanf used. - * - * Note: Fscan etc. can read one character (rune) past the input - * they return, which means that a loop calling a scan routine - * may skip some of the input. This is usually a problem only - * when there is no space between input values. If the reader - * provided to Fscan implements ReadRune, that method will be used - * to read characters. If the reader also implements UnreadRune, - * that method will be used to save the character and successive - * calls will not lose data. To attach ReadRune and UnreadRune - * methods to a reader without that capability, use - * bufio.NewReader. - * ``` - */ -namespace fmt { - /** - * State represents the printer state passed to custom formatters. - * It provides access to the io.Writer interface plus information about - * the flags and options for the operand's format specifier. - */ - interface State { - /** - * Write is the function to call to emit formatted output to be printed. - */ - write(b: string): number - /** - * Width returns the value of the width option and whether it has been set. - */ - width(): [number, boolean] - /** - * Precision returns the value of the precision option and whether it has been set. - */ - precision(): [number, boolean] - /** - * Flag reports whether the flag c, a character, has been set. - */ - flag(c: number): boolean - } - /** - * ScanState represents the scanner state passed to custom scanners. - * Scanners may do rune-at-a-time scanning or ask the ScanState - * to discover the next space-delimited token. - */ - interface ScanState { - /** - * ReadRune reads the next rune (Unicode code point) from the input. - * If invoked during Scanln, Fscanln, or Sscanln, ReadRune() will - * return EOF after returning the first '\n' or when reading beyond - * the specified width. - */ - readRune(): [string, number] - /** - * UnreadRune causes the next call to ReadRune to return the same rune. - */ - unreadRune(): void - /** - * SkipSpace skips space in the input. Newlines are treated appropriately - * for the operation being performed; see the package documentation - * for more information. - */ - skipSpace(): void - /** - * Token skips space in the input if skipSpace is true, then returns the - * run of Unicode code points c satisfying f(c). If f is nil, - * !unicode.IsSpace(c) is used; that is, the token will hold non-space - * characters. Newlines are treated appropriately for the operation being - * performed; see the package documentation for more information. - * The returned slice points to shared data that may be overwritten - * by the next call to Token, a call to a Scan function using the ScanState - * as input, or when the calling Scan method returns. - */ - token(skipSpace: boolean, f: (_arg0: string) => boolean): string - /** - * Width returns the value of the width option and whether it has been set. - * The unit is Unicode code points. - */ - width(): [number, boolean] - /** - * Because ReadRune is implemented by the interface, Read should never be - * called by the scanning routines and a valid implementation of - * ScanState may choose always to return an error from Read. - */ - read(buf: string): number - } -} - -/** - * Package driver defines interfaces to be implemented by database - * drivers as used by package sql. - * - * Most code should use package sql. - * - * The driver interface has evolved over time. Drivers should implement - * Connector and DriverContext interfaces. - * The Connector.Connect and Driver.Open methods should never return ErrBadConn. - * ErrBadConn should only be returned from Validator, SessionResetter, or - * a query method if the connection is already in an invalid (e.g. closed) state. - * - * All Conn implementations should implement the following interfaces: - * Pinger, SessionResetter, and Validator. - * - * If named parameters or context are supported, the driver's Conn should implement: - * ExecerContext, QueryerContext, ConnPrepareContext, and ConnBeginTx. - * - * To support custom data types, implement NamedValueChecker. NamedValueChecker - * also allows queries to accept per-query options as a parameter by returning - * ErrRemoveArgument from CheckNamedValue. - * - * If multiple result sets are supported, Rows should implement RowsNextResultSet. - * If the driver knows how to describe the types present in the returned result - * it should implement the following interfaces: RowsColumnTypeScanType, - * RowsColumnTypeDatabaseTypeName, RowsColumnTypeLength, RowsColumnTypeNullable, - * and RowsColumnTypePrecisionScale. A given row value may also return a Rows - * type, which may represent a database cursor value. - * - * Before a connection is returned to the connection pool after use, IsValid is - * called if implemented. Before a connection is reused for another query, - * ResetSession is called if implemented. If a connection is never returned to the - * connection pool but immediately reused, then ResetSession is called prior to - * reuse but IsValid is not called. - */ -namespace driver { - /** - * Result is the result of a query execution. - */ - interface Result { - /** - * LastInsertId returns the database's auto-generated ID - * after, for example, an INSERT into a table with primary - * key. - */ - lastInsertId(): number - /** - * RowsAffected returns the number of rows affected by the - * query. - */ - rowsAffected(): number - } - /** - * Rows is an iterator over an executed query's results. - */ - interface Rows { - /** - * Columns returns the names of the columns. The number of - * columns of the result is inferred from the length of the - * slice. If a particular column name isn't known, an empty - * string should be returned for that entry. - */ - columns(): Array - /** - * Close closes the rows iterator. - */ - close(): void - /** - * Next is called to populate the next row of data into - * the provided slice. The provided slice will be the same - * size as the Columns() are wide. - * - * Next should return io.EOF when there are no more rows. - * - * The dest should not be written to outside of Next. Care - * should be taken when closing Rows not to modify - * a buffer held in dest. - */ - next(dest: Array): void - } -} - -/** - * Package rand implements pseudo-random number generators unsuitable for - * security-sensitive work. - * - * Random numbers are generated by a Source. Top-level functions, such as - * Float64 and Int, use a default shared Source that produces a deterministic - * sequence of values each time a program is run. Use the Seed function to - * initialize the default Source if different behavior is required for each run. - * The default Source is safe for concurrent use by multiple goroutines, but - * Sources created by NewSource are not. - * - * This package's outputs might be easily predictable regardless of how it's - * seeded. For random numbers suitable for security-sensitive work, see the - * crypto/rand package. - */ -namespace rand { - interface Rand { - /** - * ExpFloat64 returns an exponentially distributed float64 in the range - * (0, +math.MaxFloat64] with an exponential distribution whose rate parameter - * (lambda) is 1 and whose mean is 1/lambda (1). - * To produce a distribution with a different rate parameter, - * callers can adjust the output using: - * - * sample = ExpFloat64() / desiredRateParameter - */ - expFloat64(): number - } - interface Rand { - /** - * NormFloat64 returns a normally distributed float64 in - * the range -math.MaxFloat64 through +math.MaxFloat64 inclusive, - * with standard normal distribution (mean = 0, stddev = 1). - * To produce a different normal distribution, callers can - * adjust the output using: - * - * sample = NormFloat64() * desiredStdDev + desiredMean - */ - normFloat64(): number - } - /** - * A Rand is a source of random numbers. - */ - interface Rand { - } - interface Rand { - /** - * Seed uses the provided seed value to initialize the generator to a deterministic state. - * Seed should not be called concurrently with any other Rand method. - */ - seed(seed: number): void - } - interface Rand { - /** - * Int63 returns a non-negative pseudo-random 63-bit integer as an int64. - */ - int63(): number - } - interface Rand { - /** - * Uint32 returns a pseudo-random 32-bit value as a uint32. - */ - uint32(): number - } - interface Rand { - /** - * Uint64 returns a pseudo-random 64-bit value as a uint64. - */ - uint64(): number - } - interface Rand { - /** - * Int31 returns a non-negative pseudo-random 31-bit integer as an int32. - */ - int31(): number - } - interface Rand { - /** - * Int returns a non-negative pseudo-random int. - */ - int(): number - } - interface Rand { - /** - * Int63n returns, as an int64, a non-negative pseudo-random number in the half-open interval [0,n). - * It panics if n <= 0. - */ - int63n(n: number): number - } - interface Rand { - /** - * Int31n returns, as an int32, a non-negative pseudo-random number in the half-open interval [0,n). - * It panics if n <= 0. - */ - int31n(n: number): number - } - interface Rand { - /** - * Intn returns, as an int, a non-negative pseudo-random number in the half-open interval [0,n). - * It panics if n <= 0. - */ - intn(n: number): number - } - interface Rand { - /** - * Float64 returns, as a float64, a pseudo-random number in the half-open interval [0.0,1.0). - */ - float64(): number - } - interface Rand { - /** - * Float32 returns, as a float32, a pseudo-random number in the half-open interval [0.0,1.0). - */ - float32(): number - } - interface Rand { - /** - * Perm returns, as a slice of n ints, a pseudo-random permutation of the integers - * in the half-open interval [0,n). - */ - perm(n: number): Array - } - interface Rand { - /** - * Shuffle pseudo-randomizes the order of elements. - * n is the number of elements. Shuffle panics if n < 0. - * swap swaps the elements with indexes i and j. - */ - shuffle(n: number, swap: (i: number) => void): void - } - interface Rand { - /** - * Read generates len(p) random bytes and writes them into p. It - * always returns len(p) and a nil error. - * Read should not be called concurrently with any other Rand method. - */ - read(p: string): number - } -} - -/** - * Package big implements arbitrary-precision arithmetic (big numbers). - * The following numeric types are supported: - * - * ``` - * Int signed integers - * Rat rational numbers - * Float floating-point numbers - * ``` - * - * The zero value for an Int, Rat, or Float correspond to 0. Thus, new - * values can be declared in the usual ways and denote 0 without further - * initialization: - * - * ``` - * var x Int // &x is an *Int of value 0 - * var r = &Rat{} // r is a *Rat of value 0 - * y := new(Float) // y is a *Float of value 0 - * ``` - * - * Alternatively, new values can be allocated and initialized with factory - * functions of the form: - * - * ``` - * func NewT(v V) *T - * ``` - * - * For instance, NewInt(x) returns an *Int set to the value of the int64 - * argument x, NewRat(a, b) returns a *Rat set to the fraction a/b where - * a and b are int64 values, and NewFloat(f) returns a *Float initialized - * to the float64 argument f. More flexibility is provided with explicit - * setters, for instance: - * - * ``` - * var z1 Int - * z1.SetUint64(123) // z1 := 123 - * z2 := new(Rat).SetFloat64(1.25) // z2 := 5/4 - * z3 := new(Float).SetInt(z1) // z3 := 123.0 - * ``` - * - * Setters, numeric operations and predicates are represented as methods of - * the form: - * - * ``` - * func (z *T) SetV(v V) *T // z = v - * func (z *T) Unary(x *T) *T // z = unary x - * func (z *T) Binary(x, y *T) *T // z = x binary y - * func (x *T) Pred() P // p = pred(x) - * ``` - * - * with T one of Int, Rat, or Float. For unary and binary operations, the - * result is the receiver (usually named z in that case; see below); if it - * is one of the operands x or y it may be safely overwritten (and its memory - * reused). - * - * Arithmetic expressions are typically written as a sequence of individual - * method calls, with each call corresponding to an operation. The receiver - * denotes the result and the method arguments are the operation's operands. - * For instance, given three *Int values a, b and c, the invocation - * - * ``` - * c.Add(a, b) - * ``` - * - * computes the sum a + b and stores the result in c, overwriting whatever - * value was held in c before. Unless specified otherwise, operations permit - * aliasing of parameters, so it is perfectly ok to write - * - * ``` - * sum.Add(sum, x) - * ``` - * - * to accumulate values x in a sum. - * - * (By always passing in a result value via the receiver, memory use can be - * much better controlled. Instead of having to allocate new memory for each - * result, an operation can reuse the space allocated for the result value, - * and overwrite that value with the new result in the process.) - * - * Notational convention: Incoming method parameters (including the receiver) - * are named consistently in the API to clarify their use. Incoming operands - * are usually named x, y, a, b, and so on, but never z. A parameter specifying - * the result is named z (typically the receiver). - * - * For instance, the arguments for (*Int).Add are named x and y, and because - * the receiver specifies the result destination, it is called z: - * - * ``` - * func (z *Int) Add(x, y *Int) *Int - * ``` - * - * Methods of this form typically return the incoming receiver as well, to - * enable simple call chaining. - * - * Methods which don't require a result value to be passed in (for instance, - * Int.Sign), simply return the result. In this case, the receiver is typically - * the first operand, named x: - * - * ``` - * func (x *Int) Sign() int - * ``` - * - * Various methods support conversions between strings and corresponding - * numeric values, and vice versa: *Int, *Rat, and *Float values implement - * the Stringer interface for a (default) string representation of the value, - * but also provide SetString methods to initialize a value from a string in - * a variety of supported formats (see the respective SetString documentation). - * - * Finally, *Int, *Rat, and *Float satisfy the fmt package's Scanner interface - * for scanning and (except for *Rat) the Formatter interface for formatted - * printing. - */ -namespace big { - /** - * A Word represents a single digit of a multi-precision unsigned integer. - */ - interface Word extends Number{} -} - -/** - * Package crypto collects common cryptographic constants. - */ -namespace crypto { - /** - * Signer is an interface for an opaque private key that can be used for - * signing operations. For example, an RSA key kept in a hardware module. - */ - interface Signer { - /** - * Public returns the public key corresponding to the opaque, - * private key. - */ - public(): PublicKey - /** - * Sign signs digest with the private key, possibly using entropy from - * rand. For an RSA key, the resulting signature should be either a - * PKCS #1 v1.5 or PSS signature (as indicated by opts). For an (EC)DSA - * key, it should be a DER-serialised, ASN.1 signature structure. - * - * Hash implements the SignerOpts interface and, in most cases, one can - * simply pass in the hash function used as opts. Sign may also attempt - * to type assert opts to other types in order to obtain algorithm - * specific values. See the documentation in each package for details. - * - * Note that when a signature of a hash of a larger message is needed, - * the caller is responsible for hashing the larger message and passing - * the hash (as digest) and the hash function (as opts) to Sign. - */ - sign(rand: io.Reader, digest: string, opts: SignerOpts): string - } -} - -/** - * Package asn1 implements parsing of DER-encoded ASN.1 data structures, - * as defined in ITU-T Rec X.690. - * - * See also ``A Layman's Guide to a Subset of ASN.1, BER, and DER,'' - * http://luca.ntop.org/Teaching/Appunti/asn1.html. - */ -namespace asn1 { - /** - * BitString is the structure to use when you want an ASN.1 BIT STRING type. A - * bit string is padded up to the nearest byte in memory and the number of - * valid bits is recorded. Padding bits will be zero. - */ - interface BitString { - bytes: string // bits packed into bytes. - bitLength: number // length in bits. - } - interface BitString { - /** - * At returns the bit at the given index. If the index is out of range it - * returns false. - */ - at(i: number): number - } - interface BitString { - /** - * RightAlign returns a slice where the padding bits are at the beginning. The - * slice may share memory with the BitString. - */ - rightAlign(): string - } -} - -/** - * Package pkix contains shared, low level structures used for ASN.1 parsing - * and serialization of X.509 certificates, CRL and OCSP. - */ -namespace pkix { - /** - * AlgorithmIdentifier represents the ASN.1 structure of the same name. See RFC - * 5280, section 4.1.1.2. - */ - interface AlgorithmIdentifier { - algorithm: asn1.ObjectIdentifier - parameters: asn1.RawValue - } - interface RDNSequence extends Array{} - interface RDNSequence { - /** - * String returns a string representation of the sequence r, - * roughly following the RFC 2253 Distinguished Names syntax. - */ - string(): string - } - /** - * AttributeTypeAndValue mirrors the ASN.1 structure of the same name in - * RFC 5280, Section 4.1.2.4. - */ - interface AttributeTypeAndValue { - type: asn1.ObjectIdentifier - value: any - } - /** - * TBSCertificateList represents the ASN.1 structure of the same name. See RFC - * 5280, section 5.1. - */ - interface TBSCertificateList { - raw: asn1.RawContent - version: number - signature: AlgorithmIdentifier - issuer: RDNSequence - thisUpdate: time.Time - nextUpdate: time.Time - revokedCertificates: Array - extensions: Array - } -} - -/** - * Package acme provides an implementation of the - * Automatic Certificate Management Environment (ACME) spec, - * most famously used by Let's Encrypt. - * - * The initial implementation of this package was based on an early version - * of the spec. The current implementation supports only the modern - * RFC 8555 but some of the old API surface remains for compatibility. - * While code using the old API will still compile, it will return an error. - * Note the deprecation comments to update your code. - * - * See https://tools.ietf.org/html/rfc8555 for the spec. - * - * Most common scenarios will want to use autocert subdirectory instead, - * which provides automatic access to certificates from Let's Encrypt - * and any other ACME-based CA. - */ -namespace acme { - /** - * KeyID is the account key identity provided by a CA during registration. - */ - interface KeyID extends String{} - /** - * CRLReasonCode identifies the reason for a certificate revocation. - */ - interface CRLReasonCode extends Number{} - /** - * Account is a user account. It is associated with a private key. - * Non-RFC 8555 fields are empty when interfacing with a compliant CA. - */ - interface Account { - /** - * URI is the account unique ID, which is also a URL used to retrieve - * account data from the CA. - * When interfacing with RFC 8555-compliant CAs, URI is the "kid" field - * value in JWS signed requests. - */ - uri: string - /** - * Contact is a slice of contact info used during registration. - * See https://tools.ietf.org/html/rfc8555#section-7.3 for supported - * formats. - */ - contact: Array - /** - * Status indicates current account status as returned by the CA. - * Possible values are StatusValid, StatusDeactivated, and StatusRevoked. - */ - status: string - /** - * OrdersURL is a URL from which a list of orders submitted by this account - * can be fetched. - */ - ordersURL: string - /** - * The terms user has agreed to. - * A value not matching CurrentTerms indicates that the user hasn't agreed - * to the actual Terms of Service of the CA. - * - * It is non-RFC 8555 compliant. Package users can store the ToS they agree to - * during Client's Register call in the prompt callback function. - */ - agreedTerms: string - /** - * Actual terms of a CA. - * - * It is non-RFC 8555 compliant. Use Directory's Terms field. - * When a CA updates their terms and requires an account agreement, - * a URL at which instructions to do so is available in Error's Instance field. - */ - currentTerms: string - /** - * Authz is the authorization URL used to initiate a new authz flow. - * - * It is non-RFC 8555 compliant. Use Directory's AuthzURL or OrderURL. - */ - authz: string - /** - * Authorizations is a URI from which a list of authorizations - * granted to this account can be fetched via a GET request. - * - * It is non-RFC 8555 compliant and is obsoleted by OrdersURL. - */ - authorizations: string - /** - * Certificates is a URI from which a list of certificates - * issued for this account can be fetched via a GET request. - * - * It is non-RFC 8555 compliant and is obsoleted by OrdersURL. - */ - certificates: string - /** - * ExternalAccountBinding represents an arbitrary binding to an account of - * the CA which the ACME server is tied to. - * See https://tools.ietf.org/html/rfc8555#section-7.3.4 for more details. - */ - externalAccountBinding?: ExternalAccountBinding - } - /** - * Directory is ACME server discovery data. - * See https://tools.ietf.org/html/rfc8555#section-7.1.1 for more details. - */ - interface Directory { - /** - * NonceURL indicates an endpoint where to fetch fresh nonce values from. - */ - nonceURL: string - /** - * RegURL is an account endpoint URL, allowing for creating new accounts. - * Pre-RFC 8555 CAs also allow modifying existing accounts at this URL. - */ - regURL: string - /** - * OrderURL is used to initiate the certificate issuance flow - * as described in RFC 8555. - */ - orderURL: string - /** - * AuthzURL is used to initiate identifier pre-authorization flow. - * Empty string indicates the flow is unsupported by the CA. - */ - authzURL: string - /** - * CertURL is a new certificate issuance endpoint URL. - * It is non-RFC 8555 compliant and is obsoleted by OrderURL. - */ - certURL: string - /** - * RevokeURL is used to initiate a certificate revocation flow. - */ - revokeURL: string - /** - * KeyChangeURL allows to perform account key rollover flow. - */ - keyChangeURL: string - /** - * Term is a URI identifying the current terms of service. - */ - terms: string - /** - * Website is an HTTP or HTTPS URL locating a website - * providing more information about the ACME server. - */ - website: string - /** - * CAA consists of lowercase hostname elements, which the ACME server - * recognises as referring to itself for the purposes of CAA record validation - * as defined in RFC 6844. - */ - caa: Array - /** - * ExternalAccountRequired indicates that the CA requires for all account-related - * requests to include external account binding information. - */ - externalAccountRequired: boolean - } - /** - * Order represents a client's request for a certificate. - * It tracks the request flow progress through to issuance. - */ - interface Order { - /** - * URI uniquely identifies an order. - */ - uri: string - /** - * Status represents the current status of the order. - * It indicates which action the client should take. - * - * Possible values are StatusPending, StatusReady, StatusProcessing, StatusValid and StatusInvalid. - * Pending means the CA does not believe that the client has fulfilled the requirements. - * Ready indicates that the client has fulfilled all the requirements and can submit a CSR - * to obtain a certificate. This is done with Client's CreateOrderCert. - * Processing means the certificate is being issued. - * Valid indicates the CA has issued the certificate. It can be downloaded - * from the Order's CertURL. This is done with Client's FetchCert. - * Invalid means the certificate will not be issued. Users should consider this order - * abandoned. - */ - status: string - /** - * Expires is the timestamp after which CA considers this order invalid. - */ - expires: time.Time - /** - * Identifiers contains all identifier objects which the order pertains to. - */ - identifiers: Array - /** - * NotBefore is the requested value of the notBefore field in the certificate. - */ - notBefore: time.Time - /** - * NotAfter is the requested value of the notAfter field in the certificate. - */ - notAfter: time.Time - /** - * AuthzURLs represents authorizations to complete before a certificate - * for identifiers specified in the order can be issued. - * It also contains unexpired authorizations that the client has completed - * in the past. - * - * Authorization objects can be fetched using Client's GetAuthorization method. - * - * The required authorizations are dictated by CA policies. - * There may not be a 1:1 relationship between the identifiers and required authorizations. - * Required authorizations can be identified by their StatusPending status. - * - * For orders in the StatusValid or StatusInvalid state these are the authorizations - * which were completed. - */ - authzURLs: Array - /** - * FinalizeURL is the endpoint at which a CSR is submitted to obtain a certificate - * once all the authorizations are satisfied. - */ - finalizeURL: string - /** - * CertURL points to the certificate that has been issued in response to this order. - */ - certURL: string - /** - * The error that occurred while processing the order as received from a CA, if any. - */ - error?: Error - } - /** - * OrderOption allows customizing Client.AuthorizeOrder call. - */ - interface OrderOption { - } - /** - * Authorization encodes an authorization response. - */ - interface Authorization { - /** - * URI uniquely identifies a authorization. - */ - uri: string - /** - * Status is the current status of an authorization. - * Possible values are StatusPending, StatusValid, StatusInvalid, StatusDeactivated, - * StatusExpired and StatusRevoked. - */ - status: string - /** - * Identifier is what the account is authorized to represent. - */ - identifier: AuthzID - /** - * The timestamp after which the CA considers the authorization invalid. - */ - expires: time.Time - /** - * Wildcard is true for authorizations of a wildcard domain name. - */ - wildcard: boolean - /** - * Challenges that the client needs to fulfill in order to prove possession - * of the identifier (for pending authorizations). - * For valid authorizations, the challenge that was validated. - * For invalid authorizations, the challenge that was attempted and failed. - * - * RFC 8555 compatible CAs require users to fuflfill only one of the challenges. - */ - challenges: Array<(Challenge | undefined)> - /** - * A collection of sets of challenges, each of which would be sufficient - * to prove possession of the identifier. - * Clients must complete a set of challenges that covers at least one set. - * Challenges are identified by their indices in the challenges array. - * If this field is empty, the client needs to complete all challenges. - * - * This field is unused in RFC 8555. - */ - combinations: Array> - } - /** - * AuthzID is an identifier that an account is authorized to represent. - */ - interface AuthzID { - type: string // The type of identifier, "dns" or "ip". - value: string // The identifier itself, e.g. "example.org". - } - /** - * Challenge encodes a returned CA challenge. - * Its Error field may be non-nil if the challenge is part of an Authorization - * with StatusInvalid. - */ - interface Challenge { - /** - * Type is the challenge type, e.g. "http-01", "tls-alpn-01", "dns-01". - */ - type: string - /** - * URI is where a challenge response can be posted to. - */ - uri: string - /** - * Token is a random value that uniquely identifies the challenge. - */ - token: string - /** - * Status identifies the status of this challenge. - * In RFC 8555, possible values are StatusPending, StatusProcessing, StatusValid, - * and StatusInvalid. - */ - status: string - /** - * Validated is the time at which the CA validated this challenge. - * Always zero value in pre-RFC 8555. - */ - validated: time.Time - /** - * Error indicates the reason for an authorization failure - * when this challenge was used. - * The type of a non-nil value is *Error. - */ - error: Error - } - /** - * CertOption is an optional argument type for the TLS ChallengeCert methods for - * customizing a temporary certificate for TLS-based challenges. - */ - interface CertOption { - } -} - -/** - * Package crypto collects common cryptographic constants. - */ -namespace crypto { - /** - * PublicKey represents a public key using an unspecified algorithm. - * - * Although this type is an empty interface for backwards compatibility reasons, - * all public key types in the standard library implement the following interface - * - * ``` - * interface{ - * Equal(x crypto.PublicKey) bool - * } - * ``` - * - * which can be used for increased type safety within applications. - */ - interface PublicKey extends _TygojaAny{} - /** - * SignerOpts contains options for signing with a Signer. - */ - interface SignerOpts { - /** - * HashFunc returns an identifier for the hash function used to produce - * the message passed to Signer.Sign, or else zero to indicate that no - * hashing was done. - */ - hashFunc(): Hash - } -} - -/** - * Package reflect implements run-time reflection, allowing a program to - * manipulate objects with arbitrary types. The typical use is to take a value - * with static type interface{} and extract its dynamic type information by - * calling TypeOf, which returns a Type. - * - * A call to ValueOf returns a Value representing the run-time data. - * Zero takes a Type and returns a Value representing a zero value - * for that type. - * - * See "The Laws of Reflection" for an introduction to reflection in Go: - * https://golang.org/doc/articles/laws_of_reflection.html - */ -namespace reflect { - interface flag extends Number{} - /** - * A MapIter is an iterator for ranging over a map. - * See Value.MapRange. - */ - interface MapIter { - } - interface MapIter { - /** - * Key returns the key of iter's current map entry. - */ - key(): Value - } - interface MapIter { - /** - * Value returns the value of iter's current map entry. - */ - value(): Value - } - interface MapIter { - /** - * Next advances the map iterator and reports whether there is another - * entry. It returns false when iter is exhausted; subsequent - * calls to Key, Value, or Next will panic. - */ - next(): boolean - } - interface MapIter { - /** - * Reset modifies iter to iterate over v. - * It panics if v's Kind is not Map and v is not the zero Value. - * Reset(Value{}) causes iter to not to refer to any map, - * which may allow the previously iterated-over map to be garbage collected. - */ - reset(v: Value): void - } -} - -/** - * Package asn1 implements parsing of DER-encoded ASN.1 data structures, - * as defined in ITU-T Rec X.690. - * - * See also ``A Layman's Guide to a Subset of ASN.1, BER, and DER,'' - * http://luca.ntop.org/Teaching/Appunti/asn1.html. - */ -namespace asn1 { - /** - * A RawValue represents an undecoded ASN.1 object. - */ - interface RawValue { - class: number - isCompound: boolean - bytes: string - fullBytes: string // includes the tag and length - } - /** - * RawContent is used to signal that the undecoded, DER data needs to be - * preserved for a struct. To use it, the first field of the struct must have - * this type. It's an error for any of the other fields to have this type. - */ - interface RawContent extends String{} -} - -/** - * Package pkix contains shared, low level structures used for ASN.1 parsing - * and serialization of X.509 certificates, CRL and OCSP. - */ -namespace pkix { - interface RelativeDistinguishedNameSET extends Array{} -} - -/** - * Package acme provides an implementation of the - * Automatic Certificate Management Environment (ACME) spec, - * most famously used by Let's Encrypt. - * - * The initial implementation of this package was based on an early version - * of the spec. The current implementation supports only the modern - * RFC 8555 but some of the old API surface remains for compatibility. - * While code using the old API will still compile, it will return an error. - * Note the deprecation comments to update your code. - * - * See https://tools.ietf.org/html/rfc8555 for the spec. - * - * Most common scenarios will want to use autocert subdirectory instead, - * which provides automatic access to certificates from Let's Encrypt - * and any other ACME-based CA. - */ -namespace acme { - /** - * Error is an ACME error, defined in Problem Details for HTTP APIs doc - * http://tools.ietf.org/html/draft-ietf-appsawg-http-problem. - */ - interface Error { - /** - * StatusCode is The HTTP status code generated by the origin server. - */ - statusCode: number - /** - * ProblemType is a URI reference that identifies the problem type, - * typically in a "urn:acme:error:xxx" form. - */ - problemType: string - /** - * Detail is a human-readable explanation specific to this occurrence of the problem. - */ - detail: string - /** - * Instance indicates a URL that the client should direct a human user to visit - * in order for instructions on how to agree to the updated Terms of Service. - * In such an event CA sets StatusCode to 403, ProblemType to - * "urn:ietf:params:acme:error:userActionRequired" and a Link header with relation - * "terms-of-service" containing the latest TOS URL. - */ - instance: string - /** - * Header is the original server error response headers. - * It may be nil. - */ - header: http.Header - /** - * Subproblems may contain more detailed information about the individual problems - * that caused the error. This field is only sent by RFC 8555 compatible ACME - * servers. Defined in RFC 8555 Section 6.7.1. - */ - subproblems: Array - } - interface Error { - error(): string - } -} - -/** - * Package crypto collects common cryptographic constants. - */ -namespace crypto { - /** - * Hash identifies a cryptographic hash function that is implemented in another - * package. - */ - interface Hash extends Number{} - interface Hash { - /** - * HashFunc simply returns the value of h so that Hash implements SignerOpts. - */ - hashFunc(): Hash - } - interface Hash { - string(): string - } - interface Hash { - /** - * Size returns the length, in bytes, of a digest resulting from the given hash - * function. It doesn't require that the hash function in question be linked - * into the program. - */ - size(): number - } - interface Hash { - /** - * New returns a new hash.Hash calculating the given hash function. New panics - * if the hash function is not linked into the binary. - */ - new(): hash.Hash - } - interface Hash { - /** - * Available reports whether the given hash function is linked into the binary. - */ - available(): boolean - } -} - -/** - * Package acme provides an implementation of the - * Automatic Certificate Management Environment (ACME) spec, - * most famously used by Let's Encrypt. - * - * The initial implementation of this package was based on an early version - * of the spec. The current implementation supports only the modern - * RFC 8555 but some of the old API surface remains for compatibility. - * While code using the old API will still compile, it will return an error. - * Note the deprecation comments to update your code. - * - * See https://tools.ietf.org/html/rfc8555 for the spec. - * - * Most common scenarios will want to use autocert subdirectory instead, - * which provides automatic access to certificates from Let's Encrypt - * and any other ACME-based CA. - */ -namespace acme { - /** - * A Subproblem describes an ACME subproblem as reported in an Error. - */ - interface Subproblem { - /** - * Type is a URI reference that identifies the problem type, - * typically in a "urn:acme:error:xxx" form. - */ - type: string - /** - * Detail is a human-readable explanation specific to this occurrence of the problem. - */ - detail: string - /** - * Instance indicates a URL that the client should direct a human user to visit - * in order for instructions on how to agree to the updated Terms of Service. - * In such an event CA sets StatusCode to 403, Type to - * "urn:ietf:params:acme:error:userActionRequired", and adds a Link header with relation - * "terms-of-service" containing the latest TOS URL. - */ - instance: string - /** - * Identifier may contain the ACME identifier that the error is for. - */ - identifier?: AuthzID - } - interface Subproblem { - string(): string - } -} - -/** - * Package hash provides interfaces for hash functions. - */ -namespace hash { - /** - * Hash is the common interface implemented by all hash functions. - * - * Hash implementations in the standard library (e.g. hash/crc32 and - * crypto/sha256) implement the encoding.BinaryMarshaler and - * encoding.BinaryUnmarshaler interfaces. Marshaling a hash implementation - * allows its internal state to be saved and used for additional processing - * later, without having to re-write the data previously written to the hash. - * The hash state may contain portions of the input in its original form, - * which users are expected to handle for any possible security implications. - * - * Compatibility: Any future changes to hash or crypto packages will endeavor - * to maintain compatibility with state encoded using previous versions. - * That is, any released versions of the packages should be able to - * decode data written with any previously released version, - * subject to issues such as security fixes. - * See the Go compatibility document for background: https://golang.org/doc/go1compat - */ - interface Hash { - /** - * Write (via the embedded io.Writer interface) adds more data to the running hash. - * It never returns an error. - */ - /** - * Sum appends the current hash to b and returns the resulting slice. - * It does not change the underlying hash state. - */ - sum(b: string): string - /** - * Reset resets the Hash to its initial state. - */ - reset(): void - /** - * Size returns the number of bytes Sum will return. - */ - size(): number - /** - * BlockSize returns the hash's underlying block size. - * The Write method must be able to accept any amount - * of data, but it may operate more efficiently if all writes - * are a multiple of the block size. - */ - blockSize(): number - } -} diff --git a/plugins/jsvm/internal/types/types.go b/plugins/jsvm/internal/types/types.go index 6b2035d0..0a90bd84 100644 --- a/plugins/jsvm/internal/types/types.go +++ b/plugins/jsvm/internal/types/types.go @@ -922,6 +922,23 @@ func main() { MethodNameFormatter: func(s string) string { return mapper.MethodName(nil, reflect.Method{Name: s}) }, + TypeMappings: map[string]string{ + "crypto.*": "any", + "acme.*": "any", + "autocert.*": "any", + "driver.*": "any", + "reflect.*": "any", + "fmt.*": "any", + "rand.*": "any", + "tls.*": "any", + "asn1.*": "any", + "pkix.*": "any", + "x509.*": "any", + "pflag.*": "any", + "flag.*": "any", + "log.*": "any", + "http.Client": "any", + }, Indent: " ", // use only a single space to reduce slight the size WithPackageFunctions: true, Heading: declarations,