diff --git a/CHANGELOG.md b/CHANGELOG.md index 750418c8..67fdadf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,10 +15,12 @@ - Fixed the scrolling area withing the table so that the horizontal scrollbar and table header are always reachable ([#2505](https://github.com/pocketbase/pocketbase/issues/2505)). -## v0.18.9-WIP +## v0.18.9 - Fixed empty thumbs directories not getting deleted on Windows after deleting a record img file ([#3382](https://github.com/pocketbase/pocketbase/issues/3382)). +- Updated the generated JSVM typings to silent the TS warnings when trying to access a field/method in a Go->TS interface. + ## v0.18.8 diff --git a/go.mod b/go.mod index d37e4c88..6d3d23db 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/AlecAivazis/survey/v2 v2.3.7 - github.com/aws/aws-sdk-go v1.45.14 + github.com/aws/aws-sdk-go v1.45.16 github.com/disintegration/imaging v1.6.2 github.com/domodwyer/mailyak/v3 v3.6.2 github.com/dop251/goja v0.0.0-20230919151941-fc55792775de @@ -19,7 +19,7 @@ require ( github.com/labstack/echo/v5 v5.0.0-20230722203903-ec5b858dab61 github.com/mattn/go-sqlite3 v1.14.17 github.com/pocketbase/dbx v1.10.1 - github.com/pocketbase/tygoja v0.0.0-20230920202922-6d9f9488868c + github.com/pocketbase/tygoja v0.0.0-20230927153855-adeeda907bc8 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.7.0 gocloud.dev v0.34.0 @@ -34,21 +34,21 @@ require ( github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/aws/aws-sdk-go-v2 v1.21.0 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 // indirect - github.com/aws/aws-sdk-go-v2/config v1.18.41 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.13.39 // indirect + github.com/aws/aws-sdk-go-v2/config v1.18.42 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.13.40 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 // indirect - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.85 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.86 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14 // indirect github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4 // indirect github.com/aws/aws-sdk-go-v2/service/s3 v1.39.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.14.0 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.0 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.14.1 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.22.0 // indirect github.com/aws/smithy-go v1.14.2 // indirect github.com/dlclark/regexp2 v1.10.0 // indirect diff --git a/go.sum b/go.sum index 7067af94..1f5b1027 100644 --- a/go.sum +++ b/go.sum @@ -12,26 +12,26 @@ github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDe github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go v1.45.14 h1:/IPMEh9oelbK7506fdMHkbV9mq4a6f5aeiy9OT0PRKw= -github.com/aws/aws-sdk-go v1.45.14/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.45.16 h1:spca2z7UJgoQ5V2fX6XiHDCj2E65kOJAfbUPozSkE24= +github.com/aws/aws-sdk-go v1.45.16/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v1.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzRdJc= github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 h1:OPLEkmhXf6xFPiz0bLeDArZIDx1NNS4oJyG4nv3Gct0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13/go.mod h1:gpAbvyDGQFozTEmlTFO8XcQKHzubdq0LzRyJpG6MiXM= -github.com/aws/aws-sdk-go-v2/config v1.18.41 h1:Go7z97YDsBJVNAaL7pDPKB6LeHEsAkHmFe+CeK30fUQ= -github.com/aws/aws-sdk-go-v2/config v1.18.41/go.mod h1:+yR45+A0LIMKT8bWOKo90Hy9rSrovEmEKoPKLmmVec8= -github.com/aws/aws-sdk-go-v2/credentials v1.13.39 h1:UnwBXDIHKDaejSXaRzKR57IdGCizk+z1DEhnsFpus7Q= -github.com/aws/aws-sdk-go-v2/credentials v1.13.39/go.mod h1:OJ9P239A90TnglJEF3qofKiNeEM6PCV/m+aNGV5WC24= +github.com/aws/aws-sdk-go-v2/config v1.18.42 h1:28jHROB27xZwU0CB88giDSjz7M1Sba3olb5JBGwina8= +github.com/aws/aws-sdk-go-v2/config v1.18.42/go.mod h1:4AZM3nMMxwlG+eZlxvBKqwVbkDLlnN2a4UGTL6HjaZI= +github.com/aws/aws-sdk-go-v2/credentials v1.13.40 h1:s8yOkDh+5b1jUDhMBtngF6zKWLDs84chUk2Vk0c38Og= +github.com/aws/aws-sdk-go-v2/credentials v1.13.40/go.mod h1:VtEHVAAqDWASwdOqj/1huyT6uHbs5s8FUHfDQdky/Rs= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 h1:uDZJF1hu0EVT/4bogChk8DyjSF6fof6uL/0Y26Ma7Fg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11/go.mod h1:TEPP4tENqBGO99KwVpV9MlOX4NSrSLP8u3KRy2CDwA8= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.85 h1:PH1OSkrdY8X+ENBz8ZhgWhR/975S05gcFPM4PxpAFrI= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.85/go.mod h1:4X3OaVfB/ZjZsB9eHpFLnNT00sw+ZE81kQ2E9FysTaU= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.86 h1:tnn/U5bz5flqoTCFSgRMEdg93ULR9Q6+tL5LkwjJ0DM= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.86/go.mod h1:TJGNZIhz3fsaQ6PU9roZacAEMMnG89X2UzaDblNoeNw= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 h1:22dGT7PneFMx4+b3pz7lMTRyN8ZKH7M2cW4GP9yUS2g= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 h1:SijA0mgjV8E+8G45ltVHs0fvKpTj8xmZJ3VwhGKtUSI= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 h1:GPUcE/Yq7Ur8YSUk6lVkoIMWnJNO0HT18GUzCWCgCI0= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42/go.mod h1:rzfdUlfA+jdgLDmPKjd3Chq9V7LVLYo1Nz++Wb91aRo= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43 h1:g+qlObJH4Kn4n21g69DjspU0hKTjWtq7naZ9OLCv0ew= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43/go.mod h1:rzfdUlfA+jdgLDmPKjd3Chq9V7LVLYo1Nz++Wb91aRo= github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4 h1:6lJvvkQ9HmbHZ4h/IEwclwv2mrTW8Uq1SOB/kXy0mfw= github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4/go.mod h1:1PrKYwxTM+zjpw9Y41KFtoJCQrJ34Z47Y4VgVbfndjo= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14 h1:m0QTSI6pZYJTk5WSKx3fm5cNW/DCicVzULBgU/6IyD0= @@ -44,10 +44,10 @@ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4 h1:v0jkRigbSD6uOd github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4/go.mod h1:LhTyt8J04LL+9cIt7pYJ5lbS/U98ZmXovLOR/4LUsk8= github.com/aws/aws-sdk-go-v2/service/s3 v1.39.0 h1:VZ2WMkKLio5tVjYfThcy5+pb6YHGd6B6egq75FfM6hU= github.com/aws/aws-sdk-go-v2/service/s3 v1.39.0/go.mod h1:rDGMZA7f4pbmTtPOk5v5UM2lmX6UAbRnMDJeDvnH7AM= -github.com/aws/aws-sdk-go-v2/service/sso v1.14.0 h1:AR/hlTsCyk1CwlyKnPFvIMvnONydRjDDRT9OGb0i+/g= -github.com/aws/aws-sdk-go-v2/service/sso v1.14.0/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.0 h1:UniOmlPJelksyP5dGjfRoFTmLDy4/o0HH1lK2Op7zC8= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.0/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= +github.com/aws/aws-sdk-go-v2/service/sso v1.14.1 h1:YkNzx1RLS0F5qdf9v1Q8Cuv9NXCL2TkosOxhzlUPV64= +github.com/aws/aws-sdk-go-v2/service/sso v1.14.1/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1 h1:8lKOidPkmSmfUtiTgtdXWgaKItCZ/g75/jEk6Ql6GsA= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= github.com/aws/aws-sdk-go-v2/service/sts v1.22.0 h1:s4bioTgjSFRwOoyEFzAVCmFmoowBgjTR8gkrF/sQ4wk= github.com/aws/aws-sdk-go-v2/service/sts v1.22.0/go.mod h1:VC7JDqsqiwXukYEDjoHh9U0fOJtNWh04FPQz4ct4GGU= github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ= @@ -188,8 +188,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pocketbase/dbx v1.10.1 h1:cw+vsyfCJD8YObOVeqb93YErnlxwYMkNZ4rwN0G0AaA= github.com/pocketbase/dbx v1.10.1/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs= -github.com/pocketbase/tygoja v0.0.0-20230920202922-6d9f9488868c h1:VnvV4DsPKiKOgJm3tqOiqMxmS0ghU+Bb355jFR5f3h8= -github.com/pocketbase/tygoja v0.0.0-20230920202922-6d9f9488868c/go.mod h1:dOJ+pCyqm/jRn5kO/TX598J0e5xGDcJAZerK5atCrKI= +github.com/pocketbase/tygoja v0.0.0-20230927153855-adeeda907bc8 h1:52UxdJXNrH/PX+HUObEnfn7Z28m7pFXTq8K5156oJiU= +github.com/pocketbase/tygoja v0.0.0-20230927153855-adeeda907bc8/go.mod h1:dOJ+pCyqm/jRn5kO/TX598J0e5xGDcJAZerK5atCrKI= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= diff --git a/plugins/jsvm/internal/types/generated/types.d.ts b/plugins/jsvm/internal/types/generated/types.d.ts index bbb0f94c..c3db68e5 100644 --- a/plugins/jsvm/internal/types/generated/types.d.ts +++ b/plugins/jsvm/internal/types/generated/types.d.ts @@ -129,8 +129,19 @@ declare function routerPre(...middlewares: Array): v */ declare var __hooks: string -// skip on* hook methods as they are registered via the global on* method -type appWithoutHooks = Omit +// Utility type to exclude the on* hook methods from a type +// (hooks are separately generated as global methods). +// +// See https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#key-remapping-via-as +type excludeHooks = { + [Property in keyof Type as Exclude]: Type[Property] +}; + +// CoreApp without the on* hook methods +type CoreApp = excludeHooks + +// PocketBase without the on* hook methods +type PocketBase = excludeHooks /** * `$app` is the current running PocketBase instance that is globally @@ -141,7 +152,7 @@ type appWithoutHooks = Omit * @namespace * @group PocketBase */ -declare var $app: appWithoutHooks +declare var $app: PocketBase /** * `$template` is a global helper to load and cache HTML templates on the fly. @@ -592,7 +603,7 @@ interface AdminLoginForm extends forms.AdminLogin{} // merge * @group PocketBase */ declare class AdminLoginForm implements forms.AdminLogin { - constructor(app: core.App) + constructor(app: CoreApp) } interface AdminPasswordResetConfirmForm extends forms.AdminPasswordResetConfirm{} // merge @@ -601,7 +612,7 @@ interface AdminPasswordResetConfirmForm extends forms.AdminPasswordResetConfirm{ * @group PocketBase */ declare class AdminPasswordResetConfirmForm implements forms.AdminPasswordResetConfirm { - constructor(app: core.App) + constructor(app: CoreApp) } interface AdminPasswordResetRequestForm extends forms.AdminPasswordResetRequest{} // merge @@ -610,7 +621,7 @@ interface AdminPasswordResetRequestForm extends forms.AdminPasswordResetRequest{ * @group PocketBase */ declare class AdminPasswordResetRequestForm implements forms.AdminPasswordResetRequest { - constructor(app: core.App) + constructor(app: CoreApp) } interface AdminUpsertForm extends forms.AdminUpsert{} // merge @@ -619,7 +630,7 @@ interface AdminUpsertForm extends forms.AdminUpsert{} // merge * @group PocketBase */ declare class AdminUpsertForm implements forms.AdminUpsert { - constructor(app: core.App, admin: models.Admin) + constructor(app: CoreApp, admin: models.Admin) } interface AppleClientSecretCreateForm extends forms.AppleClientSecretCreate{} // merge @@ -628,7 +639,7 @@ interface AppleClientSecretCreateForm extends forms.AppleClientSecretCreate{} // * @group PocketBase */ declare class AppleClientSecretCreateForm implements forms.AppleClientSecretCreate { - constructor(app: core.App) + constructor(app: CoreApp) } interface CollectionUpsertForm extends forms.CollectionUpsert{} // merge @@ -637,7 +648,7 @@ interface CollectionUpsertForm extends forms.CollectionUpsert{} // merge * @group PocketBase */ declare class CollectionUpsertForm implements forms.CollectionUpsert { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface CollectionsImportForm extends forms.CollectionsImport{} // merge @@ -646,7 +657,7 @@ interface CollectionsImportForm extends forms.CollectionsImport{} // merge * @group PocketBase */ declare class CollectionsImportForm implements forms.CollectionsImport { - constructor(app: core.App) + constructor(app: CoreApp) } interface RealtimeSubscribeForm extends forms.RealtimeSubscribe{} // merge @@ -662,7 +673,7 @@ interface RecordEmailChangeConfirmForm extends forms.RecordEmailChangeConfirm{} * @group PocketBase */ declare class RecordEmailChangeConfirmForm implements forms.RecordEmailChangeConfirm { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordEmailChangeRequestForm extends forms.RecordEmailChangeRequest{} // merge @@ -671,7 +682,7 @@ interface RecordEmailChangeRequestForm extends forms.RecordEmailChangeRequest{} * @group PocketBase */ declare class RecordEmailChangeRequestForm implements forms.RecordEmailChangeRequest { - constructor(app: core.App, record: models.Record) + constructor(app: CoreApp, record: models.Record) } interface RecordOAuth2LoginForm extends forms.RecordOAuth2Login{} // merge @@ -680,7 +691,7 @@ interface RecordOAuth2LoginForm extends forms.RecordOAuth2Login{} // merge * @group PocketBase */ declare class RecordOAuth2LoginForm implements forms.RecordOAuth2Login { - constructor(app: core.App, collection: models.Collection, optAuthRecord?: models.Record) + constructor(app: CoreApp, collection: models.Collection, optAuthRecord?: models.Record) } interface RecordPasswordLoginForm extends forms.RecordPasswordLogin{} // merge @@ -689,7 +700,7 @@ interface RecordPasswordLoginForm extends forms.RecordPasswordLogin{} // merge * @group PocketBase */ declare class RecordPasswordLoginForm implements forms.RecordPasswordLogin { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordPasswordResetConfirmForm extends forms.RecordPasswordResetConfirm{} // merge @@ -698,7 +709,7 @@ interface RecordPasswordResetConfirmForm extends forms.RecordPasswordResetConfir * @group PocketBase */ declare class RecordPasswordResetConfirmForm implements forms.RecordPasswordResetConfirm { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordPasswordResetRequestForm extends forms.RecordPasswordResetRequest{} // merge @@ -707,7 +718,7 @@ interface RecordPasswordResetRequestForm extends forms.RecordPasswordResetReques * @group PocketBase */ declare class RecordPasswordResetRequestForm implements forms.RecordPasswordResetRequest { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordUpsertForm extends forms.RecordUpsert{} // merge @@ -716,7 +727,7 @@ interface RecordUpsertForm extends forms.RecordUpsert{} // merge * @group PocketBase */ declare class RecordUpsertForm implements forms.RecordUpsert { - constructor(app: core.App, record: models.Record) + constructor(app: CoreApp, record: models.Record) } interface RecordVerificationConfirmForm extends forms.RecordVerificationConfirm{} // merge @@ -725,7 +736,7 @@ interface RecordVerificationConfirmForm extends forms.RecordVerificationConfirm{ * @group PocketBase */ declare class RecordVerificationConfirmForm implements forms.RecordVerificationConfirm { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordVerificationRequestForm extends forms.RecordVerificationRequest{} // merge @@ -734,7 +745,7 @@ interface RecordVerificationRequestForm extends forms.RecordVerificationRequest{ * @group PocketBase */ declare class RecordVerificationRequestForm implements forms.RecordVerificationRequest { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface SettingsUpsertForm extends forms.SettingsUpsert{} // merge @@ -743,7 +754,7 @@ interface SettingsUpsertForm extends forms.SettingsUpsert{} // merge * @group PocketBase */ declare class SettingsUpsertForm implements forms.SettingsUpsert { - constructor(app: core.App) + constructor(app: CoreApp) } interface TestEmailSendForm extends forms.TestEmailSend{} // merge @@ -752,7 +763,7 @@ interface TestEmailSendForm extends forms.TestEmailSend{} // merge * @group PocketBase */ declare class TestEmailSendForm implements forms.TestEmailSend { - constructor(app: core.App) + constructor(app: CoreApp) } interface TestS3FilesystemForm extends forms.TestS3Filesystem{} // merge @@ -761,7 +772,7 @@ interface TestS3FilesystemForm extends forms.TestS3Filesystem{} // merge * @group PocketBase */ declare class TestS3FilesystemForm implements forms.TestS3Filesystem { - constructor(app: core.App) + constructor(app: CoreApp) } // ------------------------------------------------------------------- @@ -1179,6 +1190,7 @@ namespace os { (): Array } interface timeout { + [key:string]: any; timeout(): boolean } /** @@ -1306,6 +1318,7 @@ namespace os { * on Unix it is syscall.Signal. */ interface Signal { + [key:string]: any; string(): string signal(): void // to distinguish from other Stringers } @@ -1511,8 +1524,8 @@ namespace os { */ readFrom(r: io.Reader): number } - type _subXnQKc = io.Writer - interface onlyWriter extends _subXnQKc { + type _subUNBXw = io.Writer + interface onlyWriter extends _subUNBXw { } interface File { /** @@ -2136,8 +2149,8 @@ namespace os { /** * File represents an open file descriptor. */ - type _subvPiVJ = file - interface File extends _subvPiVJ { + type _subDoehp = file + interface File extends _subDoehp { } /** * A FileInfo describes a file and is returned by Stat and Lstat. @@ -2503,6 +2516,87 @@ namespace filepath { } } +/** + * Package template is a thin wrapper around the standard html/template + * and text/template packages that implements a convenient registry to + * load and cache templates on the fly concurrently. + * + * It was created to assist the JSVM plugin HTML rendering, but could be used in other Go code. + * + * Example: + * + * ``` + * registry := template.NewRegistry() + * + * html1, err := registry.LoadFiles( + * // the files set wil be parsed only once and then cached + * "layout.html", + * "content.html", + * ).Render(map[string]any{"name": "John"}) + * + * html2, err := registry.LoadFiles( + * // reuse the already parsed and cached files set + * "layout.html", + * "content.html", + * ).Render(map[string]any{"name": "Jane"}) + * ``` + */ +namespace template { + interface newRegistry { + /** + * NewRegistry creates and initializes a new 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 validation provides configurable and extensible rules for validating data of various types. */ @@ -2511,6 +2605,7 @@ namespace ozzo_validation { * Error interface represents an validation error */ interface Error { + [key:string]: any; error(): string code(): string message(): string @@ -2530,6 +2625,7 @@ namespace dbx { * and those manipulating DB data or schema (e.g. INSERT statements, CREATE TABLE statements). */ interface Builder { + [key:string]: any; /** * NewQuery creates a new Query object with the given SQL statement. * The SQL statement may contain parameter placeholders which can be bound with actual parameter @@ -2855,14 +2951,14 @@ namespace dbx { /** * MssqlBuilder is the builder for SQL Server databases. */ - type _subAeOly = BaseBuilder - interface MssqlBuilder extends _subAeOly { + type _subjzTBM = BaseBuilder + interface MssqlBuilder extends _subjzTBM { } /** * MssqlQueryBuilder is the query builder for SQL Server databases. */ - type _subawIlx = BaseQueryBuilder - interface MssqlQueryBuilder extends _subawIlx { + type _subjYYdD = BaseQueryBuilder + interface MssqlQueryBuilder extends _subjYYdD { } interface newMssqlBuilder { /** @@ -2933,8 +3029,8 @@ namespace dbx { /** * MysqlBuilder is the builder for MySQL databases. */ - type _subTlOCt = BaseBuilder - interface MysqlBuilder extends _subTlOCt { + type _subbyrUx = BaseBuilder + interface MysqlBuilder extends _subbyrUx { } interface newMysqlBuilder { /** @@ -3009,14 +3105,14 @@ namespace dbx { /** * OciBuilder is the builder for Oracle databases. */ - type _subuXVyd = BaseBuilder - interface OciBuilder extends _subuXVyd { + type _subOAnvw = BaseBuilder + interface OciBuilder extends _subOAnvw { } /** * OciQueryBuilder is the query builder for Oracle databases. */ - type _subcIGvv = BaseQueryBuilder - interface OciQueryBuilder extends _subcIGvv { + type _subtxiJS = BaseQueryBuilder + interface OciQueryBuilder extends _subtxiJS { } interface newOciBuilder { /** @@ -3079,8 +3175,8 @@ namespace dbx { /** * PgsqlBuilder is the builder for PostgreSQL databases. */ - type _subWYzqm = BaseBuilder - interface PgsqlBuilder extends _subWYzqm { + type _subsSqnK = BaseBuilder + interface PgsqlBuilder extends _subsSqnK { } interface newPgsqlBuilder { /** @@ -3147,8 +3243,8 @@ namespace dbx { /** * SqliteBuilder is the builder for SQLite databases. */ - type _subvqxJH = BaseBuilder - interface SqliteBuilder extends _subvqxJH { + type _subTRmFu = BaseBuilder + interface SqliteBuilder extends _subTRmFu { } interface newSqliteBuilder { /** @@ -3247,8 +3343,8 @@ namespace dbx { /** * StandardBuilder is the builder that is used by DB for an unknown driver. */ - type _subTUqAm = BaseBuilder - interface StandardBuilder extends _subTUqAm { + type _subioGnm = BaseBuilder + interface StandardBuilder extends _subioGnm { } interface newStandardBuilder { /** @@ -3314,8 +3410,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 _subtkYVL = Builder - interface DB extends _subtkYVL { + type _subPcUFU = Builder + interface DB extends _subPcUFU { /** * FieldMapper maps struct fields to DB columns. Defaults to DefaultFieldMapFunc. */ @@ -3466,6 +3562,7 @@ namespace dbx { * Expression represents a DB expression that can be embedded in a SQL statement. */ interface Expression { + [key:string]: any; /** * Build converts an expression into a SQL fragment. * If the expression contains binding parameters, they will be added to the given Params. @@ -3713,6 +3810,7 @@ namespace dbx { * TableModel is the interface that should be implemented by models which have unconventional table names. */ interface TableModel { + [key:string]: any; tableName(): string } /** @@ -3797,6 +3895,7 @@ namespace dbx { * Executor prepares, executes, or queries a SQL statement. */ interface Executor { + [key:string]: any; /** * Exec executes a SQL statement */ @@ -3984,6 +4083,7 @@ namespace dbx { * QueryBuilder builds different clauses for a SELECT SQL statement. */ interface QueryBuilder { + [key:string]: any; /** * BuildSelect generates a SELECT clause from the given selected column names. */ @@ -4113,8 +4213,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 _subJeswK = sql.Rows - interface Rows extends _subJeswK { + type _subTiDXG = sql.Rows + interface Rows extends _subTiDXG { } interface Rows { /** @@ -4471,8 +4571,8 @@ namespace dbx { }): string } interface structInfo { } - type _subGgTzp = structInfo - interface structValue extends _subGgTzp { + type _subpauYP = structInfo + interface structValue extends _subpauYP { } interface fieldInfo { } @@ -4482,6 +4582,7 @@ namespace dbx { * PostScanner is an optional interface used by ScanStruct. */ interface PostScanner { + [key:string]: any; /** * PostScan executes right after the struct has been populated * with the DB values, allowing you to further normalize or validate @@ -4510,8 +4611,8 @@ namespace dbx { /** * Tx enhances sql.Tx with additional querying methods. */ - type _submkOML = Builder - interface Tx extends _submkOML { + type _subgoVXX = Builder + interface Tx extends _subgoVXX { } interface Tx { /** @@ -4712,6 +4813,7 @@ namespace filesystem { * FileReader defines an interface for a file resource reader. */ interface FileReader { + [key:string]: any; open(): io.ReadSeekCloser } /** @@ -4779,8 +4881,8 @@ namespace filesystem { */ open(): io.ReadSeekCloser } - type _subICwUq = bytes.Reader - interface bytesReadSeekCloser extends _subICwUq { + type _subtgoAt = bytes.Reader + interface bytesReadSeekCloser extends _subtgoAt { } interface bytesReadSeekCloser { /** @@ -4908,49 +5010,49 @@ namespace tokens { /** * NewAdminAuthToken generates and returns a new admin authentication token. */ - (app: core.App, admin: models.Admin): string + (app: CoreApp, admin: models.Admin): string } interface newAdminResetPasswordToken { /** * NewAdminResetPasswordToken generates and returns a new admin password reset request token. */ - (app: core.App, admin: models.Admin): string + (app: CoreApp, admin: models.Admin): string } interface newAdminFileToken { /** * NewAdminFileToken generates and returns a new admin private file access token. */ - (app: core.App, admin: models.Admin): string + (app: CoreApp, admin: models.Admin): string } interface newRecordAuthToken { /** * NewRecordAuthToken generates and returns a new auth record authentication token. */ - (app: core.App, record: models.Record): string + (app: CoreApp, record: models.Record): string } interface newRecordVerifyToken { /** * NewRecordVerifyToken generates and returns a new record verification token. */ - (app: core.App, record: models.Record): string + (app: CoreApp, record: models.Record): string } interface newRecordResetPasswordToken { /** * NewRecordResetPasswordToken generates and returns a new auth record password reset request token. */ - (app: core.App, record: models.Record): string + (app: CoreApp, record: models.Record): string } interface newRecordChangeEmailToken { /** * NewRecordChangeEmailToken generates and returns a new auth record change email request token. */ - (app: core.App, record: models.Record, newEmail: string): string + (app: CoreApp, record: models.Record, newEmail: string): string } interface newRecordFileToken { /** * NewRecordFileToken generates and returns a new record private file access token. */ - (app: core.App, record: models.Record): string + (app: CoreApp, record: models.Record): string } } @@ -4971,12 +5073,12 @@ namespace forms { interface newAdminLogin { /** * NewAdminLogin creates a new [AdminLogin] form initialized with - * the provided [core.App] instance. + * the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App): (AdminLogin | undefined) + (app: CoreApp): (AdminLogin | undefined) } interface AdminLogin { /** @@ -5011,12 +5113,12 @@ namespace forms { interface newAdminPasswordResetConfirm { /** * NewAdminPasswordResetConfirm creates a new [AdminPasswordResetConfirm] - * form initialized with from the provided [core.App] instance. + * form initialized with from the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App): (AdminPasswordResetConfirm | undefined) + (app: CoreApp): (AdminPasswordResetConfirm | undefined) } interface AdminPasswordResetConfirm { /** @@ -5052,12 +5154,12 @@ namespace forms { interface newAdminPasswordResetRequest { /** * NewAdminPasswordResetRequest creates a new [AdminPasswordResetRequest] - * form initialized with from the provided [core.App] instance. + * form initialized with from the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App): (AdminPasswordResetRequest | undefined) + (app: CoreApp): (AdminPasswordResetRequest | undefined) } interface AdminPasswordResetRequest { /** @@ -5096,13 +5198,13 @@ namespace forms { interface newAdminUpsert { /** * NewAdminUpsert creates a new [AdminUpsert] form with initializer - * config created from the provided [core.App] and [models.Admin] instances + * config created from the provided [CoreApp] and [models.Admin] instances * (for create you could pass a pointer to an empty Admin - `&models.Admin{}`). * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, admin: models.Admin): (AdminUpsert | undefined) + (app: CoreApp, admin: models.Admin): (AdminUpsert | undefined) } interface AdminUpsert { /** @@ -5159,9 +5261,9 @@ namespace forms { interface newAppleClientSecretCreate { /** * NewAppleClientSecretCreate creates a new [AppleClientSecretCreate] form with initializer - * config created from the provided [core.App] instances. + * config created from the provided [CoreApp] instances. */ - (app: core.App): (AppleClientSecretCreate | undefined) + (app: CoreApp): (AppleClientSecretCreate | undefined) } interface AppleClientSecretCreate { /** @@ -5185,7 +5287,7 @@ namespace forms { /** * NewBackupCreate creates new BackupCreate request form. */ - (app: core.App): (BackupCreate | undefined) + (app: CoreApp): (BackupCreate | undefined) } interface BackupCreate { /** @@ -5218,7 +5320,7 @@ namespace forms { /** * NewBackupUpload creates new BackupUpload request form. */ - (app: core.App): (BackupUpload | undefined) + (app: CoreApp): (BackupUpload | undefined) } interface BackupUpload { /** @@ -5271,13 +5373,13 @@ namespace forms { interface newCollectionUpsert { /** * NewCollectionUpsert creates a new [CollectionUpsert] form with initializer - * config created from the provided [core.App] and [models.Collection] instances + * config created from the provided [CoreApp] and [models.Collection] instances * (for create you could pass a pointer to an empty Collection - `&models.Collection{}`). * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, collection: models.Collection): (CollectionUpsert | undefined) + (app: CoreApp, collection: models.Collection): (CollectionUpsert | undefined) } interface CollectionUpsert { /** @@ -5313,12 +5415,12 @@ namespace forms { interface newCollectionsImport { /** * NewCollectionsImport creates a new [CollectionsImport] form with - * initialized with from the provided [core.App] instance. + * initialized with from the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App): (CollectionsImport | undefined) + (app: CoreApp): (CollectionsImport | undefined) } interface CollectionsImport { /** @@ -5377,12 +5479,12 @@ namespace forms { interface newRecordEmailChangeConfirm { /** * NewRecordEmailChangeConfirm creates a new [RecordEmailChangeConfirm] form - * initialized with from the provided [core.App] and [models.Collection] instances. + * initialized with from the provided [CoreApp] and [models.Collection] instances. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, collection: models.Collection): (RecordEmailChangeConfirm | undefined) + (app: CoreApp, collection: models.Collection): (RecordEmailChangeConfirm | undefined) } interface RecordEmailChangeConfirm { /** @@ -5415,12 +5517,12 @@ namespace forms { interface newRecordEmailChangeRequest { /** * NewRecordEmailChangeRequest creates a new [RecordEmailChangeRequest] form - * initialized with from the provided [core.App] and [models.Record] instances. + * initialized with from the provided [CoreApp] and [models.Record] instances. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, record: models.Record): (RecordEmailChangeRequest | undefined) + (app: CoreApp, record: models.Record): (RecordEmailChangeRequest | undefined) } interface RecordEmailChangeRequest { /** @@ -5486,12 +5588,12 @@ namespace forms { interface newRecordOAuth2Login { /** * NewRecordOAuth2Login creates a new [RecordOAuth2Login] form with - * initialized with from the provided [core.App] instance. + * initialized with from the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, collection: models.Collection, optAuthRecord: models.Record): (RecordOAuth2Login | undefined) + (app: CoreApp, collection: models.Collection, optAuthRecord: models.Record): (RecordOAuth2Login | undefined) } interface RecordOAuth2Login { /** @@ -5536,12 +5638,12 @@ namespace forms { interface newRecordPasswordLogin { /** * NewRecordPasswordLogin creates a new [RecordPasswordLogin] form initialized - * with from the provided [core.App] and [models.Collection] instance. + * with from the provided [CoreApp] and [models.Collection] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, collection: models.Collection): (RecordPasswordLogin | undefined) + (app: CoreApp, collection: models.Collection): (RecordPasswordLogin | undefined) } interface RecordPasswordLogin { /** @@ -5576,12 +5678,12 @@ namespace forms { interface newRecordPasswordResetConfirm { /** * NewRecordPasswordResetConfirm creates a new [RecordPasswordResetConfirm] - * form initialized with from the provided [core.App] instance. + * form initialized with from the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, collection: models.Collection): (RecordPasswordResetConfirm | undefined) + (app: CoreApp, collection: models.Collection): (RecordPasswordResetConfirm | undefined) } interface RecordPasswordResetConfirm { /** @@ -5614,12 +5716,12 @@ namespace forms { interface newRecordPasswordResetRequest { /** * NewRecordPasswordResetRequest creates a new [RecordPasswordResetRequest] - * form initialized with from the provided [core.App] instance. + * form initialized with from the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, collection: models.Collection): (RecordPasswordResetRequest | undefined) + (app: CoreApp, collection: models.Collection): (RecordPasswordResetRequest | undefined) } interface RecordPasswordResetRequest { /** @@ -5668,13 +5770,13 @@ namespace forms { interface newRecordUpsert { /** * NewRecordUpsert creates a new [RecordUpsert] form with initializer - * config created from the provided [core.App] and [models.Record] instances + * config created from the provided [CoreApp] and [models.Record] instances * (for create you could pass a pointer to an empty Record - models.NewRecord(collection)). * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, record: models.Record): (RecordUpsert | undefined) + (app: CoreApp, record: models.Record): (RecordUpsert | undefined) } interface RecordUpsert { /** @@ -5799,12 +5901,12 @@ namespace forms { interface newRecordVerificationConfirm { /** * NewRecordVerificationConfirm creates a new [RecordVerificationConfirm] - * form initialized with from the provided [core.App] instance. + * form initialized with from the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, collection: models.Collection): (RecordVerificationConfirm | undefined) + (app: CoreApp, collection: models.Collection): (RecordVerificationConfirm | undefined) } interface RecordVerificationConfirm { /** @@ -5837,12 +5939,12 @@ namespace forms { interface newRecordVerificationRequest { /** * NewRecordVerificationRequest creates a new [RecordVerificationRequest] - * form initialized with from the provided [core.App] instance. + * form initialized with from the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App, collection: models.Collection): (RecordVerificationRequest | undefined) + (app: CoreApp, collection: models.Collection): (RecordVerificationRequest | undefined) } interface RecordVerificationRequest { /** @@ -5871,18 +5973,18 @@ namespace forms { /** * SettingsUpsert is a [settings.Settings] upsert (create/update) form. */ - type _subWSPCa = settings.Settings - interface SettingsUpsert extends _subWSPCa { + type _subIiPFs = settings.Settings + interface SettingsUpsert extends _subIiPFs { } interface newSettingsUpsert { /** * NewSettingsUpsert creates a new [SettingsUpsert] form with initializer - * config created from the provided [core.App] instance. + * config created from the provided [CoreApp] instance. * * If you want to submit the form as part of a transaction, * you can change the default Dao via [SetDao()]. */ - (app: core.App): (SettingsUpsert | undefined) + (app: CoreApp): (SettingsUpsert | undefined) } interface SettingsUpsert { /** @@ -5918,7 +6020,7 @@ namespace forms { /** * NewTestEmailSend creates and initializes new TestEmailSend form. */ - (app: core.App): (TestEmailSend | undefined) + (app: CoreApp): (TestEmailSend | undefined) } interface TestEmailSend { /** @@ -5945,7 +6047,7 @@ namespace forms { /** * NewTestS3Filesystem creates and initializes new TestS3Filesystem form. */ - (app: core.App): (TestS3Filesystem | undefined) + (app: CoreApp): (TestS3Filesystem | undefined) } interface TestS3Filesystem { /** @@ -6026,7 +6128,7 @@ namespace apis { * InitApi creates a configured echo instance with registered * system and app specific routes and middlewares. */ - (app: core.App): (echo.Echo | undefined) + (app: CoreApp): (echo.Echo | undefined) } interface staticDirectoryHandler { /** @@ -6113,7 +6215,7 @@ namespace apis { * a valid admin Authorization header ONLY if the application has * at least 1 existing Admin model. */ - (app: core.App): echo.MiddlewareFunc + (app: CoreApp): echo.MiddlewareFunc } interface requireAdminOrRecordAuth { /** @@ -6145,7 +6247,7 @@ namespace apis { * * This middleware is expected to be already registered by default for all routes. */ - (app: core.App): echo.MiddlewareFunc + (app: CoreApp): echo.MiddlewareFunc } interface loadCollectionContext { /** @@ -6154,7 +6256,7 @@ namespace apis { * * Set optCollectionTypes to further filter the found collection by its type. */ - (app: core.App, ...optCollectionTypes: string[]): echo.MiddlewareFunc + (app: CoreApp, ...optCollectionTypes: string[]): echo.MiddlewareFunc } interface activityLogger { /** @@ -6164,7 +6266,7 @@ namespace apis { * The middleware does nothing if the app logs retention period is zero * (aka. app.Settings().Logs.MaxDays = 0). */ - (app: core.App): echo.MiddlewareFunc + (app: CoreApp): echo.MiddlewareFunc } interface realtimeApi { } @@ -6173,6 +6275,7 @@ namespace apis { record?: models.Record } interface getter { + [key:string]: any; get(_arg0: string): any } interface recordAuthApi { @@ -6205,7 +6308,7 @@ namespace apis { * RecordAuthResponse writes standardised json record auth response * into the specified request context. */ - (app: core.App, c: echo.Context, authRecord: models.Record, meta: any, ...finalizers: ((token: string) => void)[]): void + (app: CoreApp, c: echo.Context, authRecord: models.Record, meta: any, ...finalizers: ((token: string) => void)[]): void } interface enrichRecord { /** @@ -6275,7 +6378,7 @@ namespace apis { * }) * ``` */ - (app: core.App, config: ServeConfig): (http.Server | undefined) + (app: CoreApp, config: ServeConfig): (http.Server | undefined) } interface migrationsConnection { db?: dbx.DB @@ -6287,19 +6390,19 @@ namespace apis { namespace pocketbase { /** - * appWrapper serves as a private core.App instance wrapper. + * appWrapper serves as a private CoreApp instance wrapper. */ - type _subsidmK = core.App - interface appWrapper extends _subsidmK { + type _subkELXZ = CoreApp + interface appWrapper extends _subkELXZ { } /** * PocketBase defines a PocketBase app launcher. * - * It implements [core.App] via embedding and all of the app interface methods + * It implements [CoreApp] via embedding and all of the app interface methods * could be accessed directly through the instance (eg. PocketBase.DataDir()). */ - type _subUGhCL = appWrapper - interface PocketBase extends _subUGhCL { + type _subcomrR = appWrapper + interface PocketBase extends _subcomrR { /** * RootCmd is the main console command */ @@ -6372,83 +6475,157 @@ namespace pocketbase { } /** - * Package template is a thin wrapper around the standard html/template - * and text/template packages that implements a convenient registry to - * load and cache templates on the fly concurrently. + * Package io provides basic interfaces to I/O primitives. + * Its primary job is to wrap existing implementations of such primitives, + * such as those in package os, into shared public interfaces that + * abstract the functionality, plus some other related primitives. * - * 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"}) - * ``` + * Because these interfaces and primitives wrap lower-level operations with + * various implementations, unless otherwise informed clients should not + * assume they are safe for parallel execution. */ -namespace 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) - } +namespace io { /** - * Registry defines a templates registry that is safe to be used by multiple goroutines. + * Reader is the interface that wraps the basic Read method. * - * Use the Registry.Load* methods to load templates into the registry. + * Read reads up to len(p) bytes into p. It returns the number of bytes + * read (0 <= n <= len(p)) and any error encountered. Even if Read + * returns n < len(p), it may use all of p as scratch space during the call. + * If some data is available but not len(p) bytes, Read conventionally + * returns what is available instead of waiting for more. + * + * When Read encounters an error or end-of-file condition after + * successfully reading n > 0 bytes, it returns the number of + * bytes read. It may return the (non-nil) error from the same call + * or return the error (and n == 0) from a subsequent call. + * An instance of this general case is that a Reader returning + * a non-zero number of bytes at the end of the input stream may + * return either err == EOF or err == nil. The next Read should + * return 0, EOF. + * + * Callers should always process the n > 0 bytes returned before + * considering the error err. Doing so correctly handles I/O errors + * that happen after reading some bytes and also both of the + * allowed EOF behaviors. + * + * Implementations of Read are discouraged from returning a + * zero byte count with a nil error, except when len(p) == 0. + * Callers should treat a return of 0 and nil as indicating that + * nothing happened; in particular it does not indicate EOF. + * + * Implementations must not retain p. */ - interface 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) + interface Reader { + [key:string]: any; + read(p: string): number } /** - * Renderer defines a single parsed template. + * Writer is the interface that wraps the basic Write method. + * + * Write writes len(p) bytes from p to the underlying data stream. + * It returns the number of bytes written from p (0 <= n <= len(p)) + * and any error encountered that caused the write to stop early. + * Write must return a non-nil error if it returns n < len(p). + * Write must not modify the slice data, even temporarily. + * + * Implementations must not retain p. */ - interface Renderer { + interface Writer { + [key:string]: any; + write(p: string): number } - interface Renderer { + /** + * ReadSeekCloser is the interface that groups the basic Read, Seek and Close + * methods. + */ + interface ReadSeekCloser { + [key:string]: any; + } +} + +/** + * Package bytes implements functions for the manipulation of byte slices. + * It is analogous to the facilities of the strings package. + */ +namespace bytes { + /** + * A Reader implements the io.Reader, io.ReaderAt, io.WriterTo, io.Seeker, + * io.ByteScanner, and io.RuneScanner interfaces by reading from + * a byte slice. + * Unlike a Buffer, a Reader is read-only and supports seeking. + * The zero value for Reader operates like a Reader of an empty slice. + */ + interface Reader { + } + interface Reader { /** - * Render executes the template with the specified data as the dot object - * and returns the result as plain string. + * Len returns the number of bytes of the unread portion of the + * slice. */ - render(data: any): string + len(): number + } + interface Reader { + /** + * Size returns the original length of the underlying byte slice. + * Size is the number of bytes available for reading via ReadAt. + * The returned value is always the same and is not affected by calls + * to any other method. + */ + size(): number + } + interface Reader { + /** + * Read implements the io.Reader interface. + */ + read(b: string): number + } + interface Reader { + /** + * ReadAt implements the io.ReaderAt interface. + */ + readAt(b: string, off: number): number + } + interface Reader { + /** + * ReadByte implements the io.ByteReader interface. + */ + readByte(): number + } + interface Reader { + /** + * UnreadByte complements ReadByte in implementing the io.ByteScanner interface. + */ + unreadByte(): void + } + interface Reader { + /** + * ReadRune implements the io.RuneReader interface. + */ + readRune(): [number, number] + } + interface Reader { + /** + * UnreadRune complements ReadRune in implementing the io.RuneScanner interface. + */ + unreadRune(): void + } + interface Reader { + /** + * Seek implements the io.Seeker interface. + */ + seek(offset: number, whence: number): number + } + interface Reader { + /** + * WriteTo implements the io.WriterTo interface. + */ + writeTo(w: io.Writer): number + } + interface Reader { + /** + * Reset resets the Reader to be reading from b. + */ + reset(b: string): void } } @@ -6529,6 +6706,7 @@ namespace syscall { * A RawConn is a raw network connection. */ interface RawConn { + [key:string]: any; /** * Control invokes f on the underlying connection's file * descriptor or handle. @@ -7115,314 +7293,6 @@ namespace time { } } -/** - * Package context defines the Context type, which carries deadlines, - * cancellation signals, and other request-scoped values across API boundaries - * and between processes. - * - * Incoming requests to a server should create a Context, and outgoing - * calls to servers should accept a Context. The chain of function - * calls between them must propagate the Context, optionally replacing - * it with a derived Context created using WithCancel, WithDeadline, - * WithTimeout, or WithValue. When a Context is canceled, all - * Contexts derived from it are also canceled. - * - * The WithCancel, WithDeadline, and WithTimeout functions take a - * Context (the parent) and return a derived Context (the child) and a - * CancelFunc. Calling the CancelFunc cancels the child and its - * children, removes the parent's reference to the child, and stops - * any associated timers. Failing to call the CancelFunc leaks the - * child and its children until the parent is canceled or the timer - * fires. The go vet tool checks that CancelFuncs are used on all - * control-flow paths. - * - * Programs that use Contexts should follow these rules to keep interfaces - * consistent across packages and enable static analysis tools to check context - * propagation: - * - * Do not store Contexts inside a struct type; instead, pass a Context - * explicitly to each function that needs it. The Context should be the first - * parameter, typically named ctx: - * - * ``` - * func DoSomething(ctx context.Context, arg Arg) error { - * // ... use ctx ... - * } - * ``` - * - * Do not pass a nil Context, even if a function permits it. Pass context.TODO - * if you are unsure about which Context to use. - * - * Use context Values only for request-scoped data that transits processes and - * APIs, not for passing optional parameters to functions. - * - * The same Context may be passed to functions running in different goroutines; - * Contexts are safe for simultaneous use by multiple goroutines. - * - * See https://blog.golang.org/context for example code for a server that uses - * Contexts. - */ -namespace context { - /** - * A Context carries a deadline, a cancellation signal, and other values across - * API boundaries. - * - * Context's methods may be called by multiple goroutines simultaneously. - */ - interface Context { - /** - * Deadline returns the time when work done on behalf of this context - * should be canceled. Deadline returns ok==false when no deadline is - * set. Successive calls to Deadline return the same results. - */ - deadline(): [time.Time, boolean] - /** - * Done returns a channel that's closed when work done on behalf of this - * context should be canceled. Done may return nil if this context can - * never be canceled. Successive calls to Done return the same value. - * The close of the Done channel may happen asynchronously, - * after the cancel function returns. - * - * WithCancel arranges for Done to be closed when cancel is called; - * WithDeadline arranges for Done to be closed when the deadline - * expires; WithTimeout arranges for Done to be closed when the timeout - * elapses. - * - * Done is provided for use in select statements: - * - * // Stream generates values with DoSomething and sends them to out - * // until DoSomething returns an error or ctx.Done is closed. - * func Stream(ctx context.Context, out chan<- Value) error { - * for { - * v, err := DoSomething(ctx) - * if err != nil { - * return err - * } - * select { - * case <-ctx.Done(): - * return ctx.Err() - * case out <- v: - * } - * } - * } - * - * See https://blog.golang.org/pipelines for more examples of how to use - * a Done channel for cancellation. - */ - done(): undefined - /** - * If Done is not yet closed, Err returns nil. - * If Done is closed, Err returns a non-nil error explaining why: - * Canceled if the context was canceled - * or DeadlineExceeded if the context's deadline passed. - * After Err returns a non-nil error, successive calls to Err return the same error. - */ - err(): void - /** - * Value returns the value associated with this context for key, or nil - * if no value is associated with key. Successive calls to Value with - * the same key returns the same result. - * - * Use context values only for request-scoped data that transits - * processes and API boundaries, not for passing optional parameters to - * functions. - * - * A key identifies a specific value in a Context. Functions that wish - * to store values in Context typically allocate a key in a global - * variable then use that key as the argument to context.WithValue and - * Context.Value. A key can be any type that supports equality; - * packages should define keys as an unexported type to avoid - * collisions. - * - * Packages that define a Context key should provide type-safe accessors - * for the values stored using that key: - * - * ``` - * // Package user defines a User type that's stored in Contexts. - * package user - * - * import "context" - * - * // User is the type of value stored in the Contexts. - * type User struct {...} - * - * // key is an unexported type for keys defined in this package. - * // This prevents collisions with keys defined in other packages. - * type key int - * - * // userKey is the key for user.User values in Contexts. It is - * // unexported; clients use user.NewContext and user.FromContext - * // instead of using this key directly. - * var userKey key - * - * // NewContext returns a new Context that carries value u. - * func NewContext(ctx context.Context, u *User) context.Context { - * return context.WithValue(ctx, userKey, u) - * } - * - * // FromContext returns the User value stored in ctx, if any. - * func FromContext(ctx context.Context) (*User, bool) { - * u, ok := ctx.Value(userKey).(*User) - * return u, ok - * } - * ``` - */ - value(key: any): any - } -} - -/** - * Package io provides basic interfaces to I/O primitives. - * Its primary job is to wrap existing implementations of such primitives, - * such as those in package os, into shared public interfaces that - * abstract the functionality, plus some other related primitives. - * - * Because these interfaces and primitives wrap lower-level operations with - * various implementations, unless otherwise informed clients should not - * assume they are safe for parallel execution. - */ -namespace io { - /** - * Reader is the interface that wraps the basic Read method. - * - * Read reads up to len(p) bytes into p. It returns the number of bytes - * read (0 <= n <= len(p)) and any error encountered. Even if Read - * returns n < len(p), it may use all of p as scratch space during the call. - * If some data is available but not len(p) bytes, Read conventionally - * returns what is available instead of waiting for more. - * - * When Read encounters an error or end-of-file condition after - * successfully reading n > 0 bytes, it returns the number of - * bytes read. It may return the (non-nil) error from the same call - * or return the error (and n == 0) from a subsequent call. - * An instance of this general case is that a Reader returning - * a non-zero number of bytes at the end of the input stream may - * return either err == EOF or err == nil. The next Read should - * return 0, EOF. - * - * Callers should always process the n > 0 bytes returned before - * considering the error err. Doing so correctly handles I/O errors - * that happen after reading some bytes and also both of the - * allowed EOF behaviors. - * - * Implementations of Read are discouraged from returning a - * zero byte count with a nil error, except when len(p) == 0. - * Callers should treat a return of 0 and nil as indicating that - * nothing happened; in particular it does not indicate EOF. - * - * Implementations must not retain p. - */ - interface Reader { - read(p: string): number - } - /** - * Writer is the interface that wraps the basic Write method. - * - * Write writes len(p) bytes from p to the underlying data stream. - * It returns the number of bytes written from p (0 <= n <= len(p)) - * and any error encountered that caused the write to stop early. - * Write must return a non-nil error if it returns n < len(p). - * Write must not modify the slice data, even temporarily. - * - * Implementations must not retain p. - */ - interface Writer { - write(p: string): number - } - /** - * ReadSeekCloser is the interface that groups the basic Read, Seek and Close - * methods. - */ - interface ReadSeekCloser { - } -} - -/** - * Package bytes implements functions for the manipulation of byte slices. - * It is analogous to the facilities of the strings package. - */ -namespace bytes { - /** - * A Reader implements the io.Reader, io.ReaderAt, io.WriterTo, io.Seeker, - * io.ByteScanner, and io.RuneScanner interfaces by reading from - * a byte slice. - * Unlike a Buffer, a Reader is read-only and supports seeking. - * The zero value for Reader operates like a Reader of an empty slice. - */ - interface Reader { - } - interface Reader { - /** - * Len returns the number of bytes of the unread portion of the - * slice. - */ - len(): number - } - interface Reader { - /** - * Size returns the original length of the underlying byte slice. - * Size is the number of bytes available for reading via ReadAt. - * The returned value is always the same and is not affected by calls - * to any other method. - */ - size(): number - } - interface Reader { - /** - * Read implements the io.Reader interface. - */ - read(b: string): number - } - interface Reader { - /** - * ReadAt implements the io.ReaderAt interface. - */ - readAt(b: string, off: number): number - } - interface Reader { - /** - * ReadByte implements the io.ByteReader interface. - */ - readByte(): number - } - interface Reader { - /** - * UnreadByte complements ReadByte in implementing the io.ByteScanner interface. - */ - unreadByte(): void - } - interface Reader { - /** - * ReadRune implements the io.RuneReader interface. - */ - readRune(): [number, number] - } - interface Reader { - /** - * UnreadRune complements ReadRune in implementing the io.RuneScanner interface. - */ - unreadRune(): void - } - interface Reader { - /** - * Seek implements the io.Seeker interface. - */ - seek(offset: number, whence: number): number - } - interface Reader { - /** - * WriteTo implements the io.WriterTo interface. - */ - writeTo(w: io.Writer): number - } - interface Reader { - /** - * Reset resets the Reader to be reading from b. - */ - reset(b: string): void - } -} - /** * Package fs defines basic interfaces to a file system. * A file system can be provided by the host operating system @@ -7437,6 +7307,7 @@ namespace fs { * such as ReadFileFS, to provide additional or optimized functionality. */ interface FS { + [key:string]: any; /** * Open opens the named file. * @@ -7457,6 +7328,7 @@ namespace fs { * A file may implement io.ReaderAt or io.Seeker as optimizations. */ interface File { + [key:string]: any; stat(): FileInfo read(_arg0: string): number close(): void @@ -7466,6 +7338,7 @@ namespace fs { * (using the ReadDir function or a ReadDirFile's ReadDir method). */ interface DirEntry { + [key:string]: any; /** * Name returns the name of the file (or subdirectory) described by the entry. * This name is only the final element of the path (the base name), not the entire path. @@ -7495,6 +7368,7 @@ namespace fs { * A FileInfo describes a file and is returned by Stat. */ interface FileInfo { + [key:string]: any; name(): string // base name of the file size(): number // length in bytes for regular files; system-dependent for others mode(): FileMode // file mode bits @@ -7610,6 +7484,163 @@ namespace fs { interface WalkDirFunc {(path: string, d: DirEntry, err: Error): void } } +/** + * Package context defines the Context type, which carries deadlines, + * cancellation signals, and other request-scoped values across API boundaries + * and between processes. + * + * Incoming requests to a server should create a Context, and outgoing + * calls to servers should accept a Context. The chain of function + * calls between them must propagate the Context, optionally replacing + * it with a derived Context created using WithCancel, WithDeadline, + * WithTimeout, or WithValue. When a Context is canceled, all + * Contexts derived from it are also canceled. + * + * The WithCancel, WithDeadline, and WithTimeout functions take a + * Context (the parent) and return a derived Context (the child) and a + * CancelFunc. Calling the CancelFunc cancels the child and its + * children, removes the parent's reference to the child, and stops + * any associated timers. Failing to call the CancelFunc leaks the + * child and its children until the parent is canceled or the timer + * fires. The go vet tool checks that CancelFuncs are used on all + * control-flow paths. + * + * Programs that use Contexts should follow these rules to keep interfaces + * consistent across packages and enable static analysis tools to check context + * propagation: + * + * Do not store Contexts inside a struct type; instead, pass a Context + * explicitly to each function that needs it. The Context should be the first + * parameter, typically named ctx: + * + * ``` + * func DoSomething(ctx context.Context, arg Arg) error { + * // ... use ctx ... + * } + * ``` + * + * Do not pass a nil Context, even if a function permits it. Pass context.TODO + * if you are unsure about which Context to use. + * + * Use context Values only for request-scoped data that transits processes and + * APIs, not for passing optional parameters to functions. + * + * The same Context may be passed to functions running in different goroutines; + * Contexts are safe for simultaneous use by multiple goroutines. + * + * See https://blog.golang.org/context for example code for a server that uses + * Contexts. + */ +namespace context { + /** + * A Context carries a deadline, a cancellation signal, and other values across + * API boundaries. + * + * Context's methods may be called by multiple goroutines simultaneously. + */ + interface Context { + [key:string]: any; + /** + * Deadline returns the time when work done on behalf of this context + * should be canceled. Deadline returns ok==false when no deadline is + * set. Successive calls to Deadline return the same results. + */ + deadline(): [time.Time, boolean] + /** + * Done returns a channel that's closed when work done on behalf of this + * context should be canceled. Done may return nil if this context can + * never be canceled. Successive calls to Done return the same value. + * The close of the Done channel may happen asynchronously, + * after the cancel function returns. + * + * WithCancel arranges for Done to be closed when cancel is called; + * WithDeadline arranges for Done to be closed when the deadline + * expires; WithTimeout arranges for Done to be closed when the timeout + * elapses. + * + * Done is provided for use in select statements: + * + * // Stream generates values with DoSomething and sends them to out + * // until DoSomething returns an error or ctx.Done is closed. + * func Stream(ctx context.Context, out chan<- Value) error { + * for { + * v, err := DoSomething(ctx) + * if err != nil { + * return err + * } + * select { + * case <-ctx.Done(): + * return ctx.Err() + * case out <- v: + * } + * } + * } + * + * See https://blog.golang.org/pipelines for more examples of how to use + * a Done channel for cancellation. + */ + done(): undefined + /** + * If Done is not yet closed, Err returns nil. + * If Done is closed, Err returns a non-nil error explaining why: + * Canceled if the context was canceled + * or DeadlineExceeded if the context's deadline passed. + * After Err returns a non-nil error, successive calls to Err return the same error. + */ + err(): void + /** + * Value returns the value associated with this context for key, or nil + * if no value is associated with key. Successive calls to Value with + * the same key returns the same result. + * + * Use context values only for request-scoped data that transits + * processes and API boundaries, not for passing optional parameters to + * functions. + * + * A key identifies a specific value in a Context. Functions that wish + * to store values in Context typically allocate a key in a global + * variable then use that key as the argument to context.WithValue and + * Context.Value. A key can be any type that supports equality; + * packages should define keys as an unexported type to avoid + * collisions. + * + * Packages that define a Context key should provide type-safe accessors + * for the values stored using that key: + * + * ``` + * // Package user defines a User type that's stored in Contexts. + * package user + * + * import "context" + * + * // User is the type of value stored in the Contexts. + * type User struct {...} + * + * // key is an unexported type for keys defined in this package. + * // This prevents collisions with keys defined in other packages. + * type key int + * + * // userKey is the key for user.User values in Contexts. It is + * // unexported; clients use user.NewContext and user.FromContext + * // instead of using this key directly. + * var userKey key + * + * // NewContext returns a new Context that carries value u. + * func NewContext(ctx context.Context, u *User) context.Context { + * return context.WithValue(ctx, userKey, u) + * } + * + * // FromContext returns the User value stored in ctx, if any. + * func FromContext(ctx context.Context) (*User, bool) { + * u, ok := ctx.Value(userKey).(*User) + * return u, ok + * } + * ``` + */ + value(key: any): any + } +} + /** * Package sql provides a generic interface around SQL (or SQL-like) * databases. @@ -8227,6 +8258,7 @@ namespace sql { * A Result summarizes an executed SQL command. */ interface Result { + [key:string]: any; /** * LastInsertId returns the integer generated by the database * in response to a command. Typically this will be from an @@ -8866,6 +8898,7 @@ namespace http { * has returned. */ interface ResponseWriter { + [key:string]: any; /** * Header returns the header map that will be sent by * WriteHeader. The Header map also is the mechanism with which @@ -9862,8 +9895,8 @@ namespace schema { * Package models implements all PocketBase DB models and DTOs. */ namespace models { - type _subANUob = BaseModel - interface Admin extends _subANUob { + type _subaPprY = BaseModel + interface Admin extends _subaPprY { avatar: number email: string tokenKey: string @@ -9898,8 +9931,8 @@ namespace models { } // @ts-ignore import validation = ozzo_validation - type _subOapyP = BaseModel - interface Collection extends _subOapyP { + type _subJYtgp = BaseModel + interface Collection extends _subJYtgp { name: string type: string system: boolean @@ -9992,8 +10025,8 @@ namespace models { */ setOptions(typedOptions: any): void } - type _subNrXSv = BaseModel - interface ExternalAuth extends _subNrXSv { + type _subMmoyb = BaseModel + interface ExternalAuth extends _subMmoyb { collectionId: string recordId: string provider: string @@ -10002,8 +10035,8 @@ namespace models { interface ExternalAuth { tableName(): string } - type _subGpXFH = BaseModel - interface Record extends _subGpXFH { + type _subULPwt = BaseModel + interface Record extends _subULPwt { } interface Record { /** @@ -10401,6 +10434,116 @@ namespace models { } } +namespace auth { + /** + * AuthUser defines a standardized oauth2 user data structure. + */ + interface AuthUser { + id: string + name: string + username: string + email: string + avatarUrl: string + rawUser: _TygojaDict + accessToken: string + refreshToken: string + } + /** + * Provider defines a common interface for an OAuth2 client. + */ + interface Provider { + [key:string]: any; + /** + * Scopes returns the context associated with the provider (if any). + */ + context(): context.Context + /** + * SetContext assigns the specified context to the current provider. + */ + setContext(ctx: context.Context): void + /** + * Scopes returns the provider access permissions that will be requested. + */ + scopes(): Array + /** + * SetScopes sets the provider access permissions that will be requested later. + */ + setScopes(scopes: Array): void + /** + * ClientId returns the provider client's app ID. + */ + clientId(): string + /** + * SetClientId sets the provider client's ID. + */ + setClientId(clientId: string): void + /** + * ClientSecret returns the provider client's app secret. + */ + clientSecret(): string + /** + * SetClientSecret sets the provider client's app secret. + */ + setClientSecret(secret: string): void + /** + * RedirectUrl returns the end address to redirect the user + * going through the OAuth flow. + */ + redirectUrl(): string + /** + * SetRedirectUrl sets the provider's RedirectUrl. + */ + setRedirectUrl(url: string): void + /** + * AuthUrl returns the provider's authorization service url. + */ + authUrl(): string + /** + * SetAuthUrl sets the provider's AuthUrl. + */ + setAuthUrl(url: string): void + /** + * TokenUrl returns the provider's token exchange service url. + */ + tokenUrl(): string + /** + * SetTokenUrl sets the provider's TokenUrl. + */ + setTokenUrl(url: string): void + /** + * UserApiUrl returns the provider's user info api url. + */ + userApiUrl(): string + /** + * SetUserApiUrl sets the provider's UserApiUrl. + */ + setUserApiUrl(url: string): void + /** + * Client returns an http client using the provided token. + */ + client(token: oauth2.Token): (any | undefined) + /** + * BuildAuthUrl returns a URL to the provider's consent page + * that asks for permissions for the required scopes explicitly. + */ + buildAuthUrl(state: string, ...opts: oauth2.AuthCodeOption[]): string + /** + * FetchToken converts an authorization code to token. + */ + fetchToken(code: string, ...opts: oauth2.AuthCodeOption[]): (oauth2.Token | undefined) + /** + * FetchRawUserData requests and marshalizes into `result` the + * the OAuth user api response. + */ + fetchRawUserData(token: oauth2.Token): string + /** + * FetchAuthUser is similar to FetchRawUserData, but normalizes and + * marshalizes the user api response into a standardized AuthUser struct. + */ + fetchAuthUser(token: oauth2.Token): (AuthUser | undefined) + } +} + /** * Package echo implements high performance, minimalist Go web framework. * @@ -10447,6 +10590,7 @@ namespace echo { * response objects, path, path parameters, data and registered handler. */ interface Context { + [key:string]: any; /** * Request returns `*http.Request`. */ @@ -10976,115 +11120,6 @@ namespace echo { } } -namespace auth { - /** - * AuthUser defines a standardized oauth2 user data structure. - */ - interface AuthUser { - id: string - name: string - username: string - email: string - avatarUrl: string - rawUser: _TygojaDict - accessToken: string - refreshToken: string - } - /** - * Provider defines a common interface for an OAuth2 client. - */ - interface Provider { - /** - * Scopes returns the context associated with the provider (if any). - */ - context(): context.Context - /** - * SetContext assigns the specified context to the current provider. - */ - setContext(ctx: context.Context): void - /** - * Scopes returns the provider access permissions that will be requested. - */ - scopes(): Array - /** - * SetScopes sets the provider access permissions that will be requested later. - */ - setScopes(scopes: Array): void - /** - * ClientId returns the provider client's app ID. - */ - clientId(): string - /** - * SetClientId sets the provider client's ID. - */ - setClientId(clientId: string): void - /** - * ClientSecret returns the provider client's app secret. - */ - clientSecret(): string - /** - * SetClientSecret sets the provider client's app secret. - */ - setClientSecret(secret: string): void - /** - * RedirectUrl returns the end address to redirect the user - * going through the OAuth flow. - */ - redirectUrl(): string - /** - * SetRedirectUrl sets the provider's RedirectUrl. - */ - setRedirectUrl(url: string): void - /** - * AuthUrl returns the provider's authorization service url. - */ - authUrl(): string - /** - * SetAuthUrl sets the provider's AuthUrl. - */ - setAuthUrl(url: string): void - /** - * TokenUrl returns the provider's token exchange service url. - */ - tokenUrl(): string - /** - * SetTokenUrl sets the provider's TokenUrl. - */ - setTokenUrl(url: string): void - /** - * UserApiUrl returns the provider's user info api url. - */ - userApiUrl(): string - /** - * SetUserApiUrl sets the provider's UserApiUrl. - */ - setUserApiUrl(url: string): void - /** - * Client returns an http client using the provided token. - */ - client(token: oauth2.Token): (any | undefined) - /** - * BuildAuthUrl returns a URL to the provider's consent page - * that asks for permissions for the required scopes explicitly. - */ - buildAuthUrl(state: string, ...opts: oauth2.AuthCodeOption[]): string - /** - * FetchToken converts an authorization code to token. - */ - fetchToken(code: string, ...opts: oauth2.AuthCodeOption[]): (oauth2.Token | undefined) - /** - * FetchRawUserData requests and marshalizes into `result` the - * the OAuth user api response. - */ - fetchRawUserData(token: oauth2.Token): string - /** - * FetchAuthUser is similar to FetchRawUserData, but normalizes and - * marshalizes the user api response into a standardized AuthUser struct. - */ - fetchAuthUser(token: oauth2.Token): (AuthUser | undefined) - } -} - namespace settings { // @ts-ignore import validation = ozzo_validation @@ -12863,6 +12898,7 @@ namespace core { * App defines the main PocketBase app interface. */ interface App { + [key:string]: any; /** * Deprecated: * This method may get removed in the near future. @@ -12969,7 +13005,7 @@ namespace core { * * Backups can be stored on S3 if it is configured in app.Settings().Backups. * - * Please refer to the godoc of the specific core.App implementation + * Please refer to the godoc of the specific CoreApp implementation * for details on the backup procedures. */ createBackup(ctx: context.Context, name: string): void @@ -12980,7 +13016,7 @@ namespace core { * The safely perform the restore it is recommended to have free disk space * for at least 2x the size of the restored pb_data backup. * - * Please refer to the godoc of the specific core.App implementation + * Please refer to the godoc of the specific CoreApp implementation * for details on the restore procedures. * * NB! This feature is experimental and currently is expected to work only on UNIX based systems. @@ -13770,11 +13806,13 @@ namespace io { * ReadCloser is the interface that groups the basic Read and Close methods. */ interface ReadCloser { + [key:string]: any; } /** * WriteCloser is the interface that groups the basic Write and Close methods. */ interface WriteCloser { + [key:string]: any; } } @@ -14006,178 +14044,6 @@ namespace fs { namespace context { } -/** - * Package net provides a portable interface for network I/O, including - * TCP/IP, UDP, domain name resolution, and Unix domain sockets. - * - * Although the package provides access to low-level networking - * primitives, most clients will need only the basic interface provided - * by the Dial, Listen, and Accept functions and the associated - * Conn and Listener interfaces. The crypto/tls package uses - * the same interfaces and similar Dial and Listen functions. - * - * The Dial function connects to a server: - * - * ``` - * conn, err := net.Dial("tcp", "golang.org:80") - * if err != nil { - * // handle error - * } - * fmt.Fprintf(conn, "GET / HTTP/1.0\r\n\r\n") - * status, err := bufio.NewReader(conn).ReadString('\n') - * // ... - * ``` - * - * The Listen function creates servers: - * - * ``` - * ln, err := net.Listen("tcp", ":8080") - * if err != nil { - * // handle error - * } - * for { - * conn, err := ln.Accept() - * if err != nil { - * // handle error - * } - * go handleConnection(conn) - * } - * ``` - * - * Name Resolution - * - * The method for resolving domain names, whether indirectly with functions like Dial - * or directly with functions like LookupHost and LookupAddr, varies by operating system. - * - * On Unix systems, the resolver has two options for resolving names. - * It can use a pure Go resolver that sends DNS requests directly to the servers - * listed in /etc/resolv.conf, or it can use a cgo-based resolver that calls C - * library routines such as getaddrinfo and getnameinfo. - * - * By default the pure Go resolver is used, because a blocked DNS request consumes - * only a goroutine, while a blocked C call consumes an operating system thread. - * When cgo is available, the cgo-based resolver is used instead under a variety of - * conditions: on systems that do not let programs make direct DNS requests (OS X), - * when the LOCALDOMAIN environment variable is present (even if empty), - * when the RES_OPTIONS or HOSTALIASES environment variable is non-empty, - * when the ASR_CONFIG environment variable is non-empty (OpenBSD only), - * when /etc/resolv.conf or /etc/nsswitch.conf specify the use of features that the - * Go resolver does not implement, and when the name being looked up ends in .local - * or is an mDNS name. - * - * The resolver decision can be overridden by setting the netdns value of the - * GODEBUG environment variable (see package runtime) to go or cgo, as in: - * - * ``` - * export GODEBUG=netdns=go # force pure Go resolver - * export GODEBUG=netdns=cgo # force cgo resolver - * ``` - * - * The decision can also be forced while building the Go source tree - * by setting the netgo or netcgo build tag. - * - * A numeric netdns setting, as in GODEBUG=netdns=1, causes the resolver - * to print debugging information about its decisions. - * To force a particular resolver while also printing debugging information, - * join the two settings by a plus sign, as in GODEBUG=netdns=go+1. - * - * On Plan 9, the resolver always accesses /net/cs and /net/dns. - * - * On Windows, the resolver always uses C library functions, such as GetAddrInfo and DnsQuery. - */ -namespace net { - /** - * Conn is a generic stream-oriented network connection. - * - * Multiple goroutines may invoke methods on a Conn simultaneously. - */ - interface Conn { - /** - * Read reads data from the connection. - * Read can be made to time out and return an error after a fixed - * time limit; see SetDeadline and SetReadDeadline. - */ - read(b: string): number - /** - * Write writes data to the connection. - * Write can be made to time out and return an error after a fixed - * time limit; see SetDeadline and SetWriteDeadline. - */ - write(b: string): number - /** - * Close closes the connection. - * Any blocked Read or Write operations will be unblocked and return errors. - */ - close(): void - /** - * LocalAddr returns the local network address, if known. - */ - localAddr(): Addr - /** - * RemoteAddr returns the remote network address, if known. - */ - remoteAddr(): Addr - /** - * SetDeadline sets the read and write deadlines associated - * with the connection. It is equivalent to calling both - * SetReadDeadline and SetWriteDeadline. - * - * A deadline is an absolute time after which I/O operations - * fail instead of blocking. The deadline applies to all future - * and pending I/O, not just the immediately following call to - * Read or Write. After a deadline has been exceeded, the - * connection can be refreshed by setting a deadline in the future. - * - * If the deadline is exceeded a call to Read or Write or to other - * I/O methods will return an error that wraps os.ErrDeadlineExceeded. - * This can be tested using errors.Is(err, os.ErrDeadlineExceeded). - * The error's Timeout method will return true, but note that there - * are other possible errors for which the Timeout method will - * return true even if the deadline has not been exceeded. - * - * An idle timeout can be implemented by repeatedly extending - * the deadline after successful Read or Write calls. - * - * A zero value for t means I/O operations will not time out. - */ - setDeadline(t: time.Time): void - /** - * SetReadDeadline sets the deadline for future Read calls - * and any currently-blocked Read call. - * A zero value for t means Read will not time out. - */ - setReadDeadline(t: time.Time): void - /** - * SetWriteDeadline sets the deadline for future Write calls - * and any currently-blocked Write call. - * Even if write times out, it may return n > 0, indicating that - * some of the data was successfully written. - * A zero value for t means Write will not time out. - */ - setWriteDeadline(t: time.Time): void - } - /** - * A Listener is a generic network listener for stream-oriented protocols. - * - * Multiple goroutines may invoke methods on a Listener simultaneously. - */ - interface Listener { - /** - * Accept waits for and returns the next connection to the listener. - */ - accept(): Conn - /** - * Close closes the listener. - * Any blocked Accept operations will be unblocked and return errors. - */ - close(): void - /** - * Addr returns the listener's network address. - */ - addr(): Addr - } -} - /** * Package url parses URLs and implements query escaping. */ @@ -14397,6 +14263,180 @@ namespace url { } } +/** + * Package net provides a portable interface for network I/O, including + * TCP/IP, UDP, domain name resolution, and Unix domain sockets. + * + * Although the package provides access to low-level networking + * primitives, most clients will need only the basic interface provided + * by the Dial, Listen, and Accept functions and the associated + * Conn and Listener interfaces. The crypto/tls package uses + * the same interfaces and similar Dial and Listen functions. + * + * The Dial function connects to a server: + * + * ``` + * conn, err := net.Dial("tcp", "golang.org:80") + * if err != nil { + * // handle error + * } + * fmt.Fprintf(conn, "GET / HTTP/1.0\r\n\r\n") + * status, err := bufio.NewReader(conn).ReadString('\n') + * // ... + * ``` + * + * The Listen function creates servers: + * + * ``` + * ln, err := net.Listen("tcp", ":8080") + * if err != nil { + * // handle error + * } + * for { + * conn, err := ln.Accept() + * if err != nil { + * // handle error + * } + * go handleConnection(conn) + * } + * ``` + * + * Name Resolution + * + * The method for resolving domain names, whether indirectly with functions like Dial + * or directly with functions like LookupHost and LookupAddr, varies by operating system. + * + * On Unix systems, the resolver has two options for resolving names. + * It can use a pure Go resolver that sends DNS requests directly to the servers + * listed in /etc/resolv.conf, or it can use a cgo-based resolver that calls C + * library routines such as getaddrinfo and getnameinfo. + * + * By default the pure Go resolver is used, because a blocked DNS request consumes + * only a goroutine, while a blocked C call consumes an operating system thread. + * When cgo is available, the cgo-based resolver is used instead under a variety of + * conditions: on systems that do not let programs make direct DNS requests (OS X), + * when the LOCALDOMAIN environment variable is present (even if empty), + * when the RES_OPTIONS or HOSTALIASES environment variable is non-empty, + * when the ASR_CONFIG environment variable is non-empty (OpenBSD only), + * when /etc/resolv.conf or /etc/nsswitch.conf specify the use of features that the + * Go resolver does not implement, and when the name being looked up ends in .local + * or is an mDNS name. + * + * The resolver decision can be overridden by setting the netdns value of the + * GODEBUG environment variable (see package runtime) to go or cgo, as in: + * + * ``` + * export GODEBUG=netdns=go # force pure Go resolver + * export GODEBUG=netdns=cgo # force cgo resolver + * ``` + * + * The decision can also be forced while building the Go source tree + * by setting the netgo or netcgo build tag. + * + * A numeric netdns setting, as in GODEBUG=netdns=1, causes the resolver + * to print debugging information about its decisions. + * To force a particular resolver while also printing debugging information, + * join the two settings by a plus sign, as in GODEBUG=netdns=go+1. + * + * On Plan 9, the resolver always accesses /net/cs and /net/dns. + * + * On Windows, the resolver always uses C library functions, such as GetAddrInfo and DnsQuery. + */ +namespace net { + /** + * Conn is a generic stream-oriented network connection. + * + * Multiple goroutines may invoke methods on a Conn simultaneously. + */ + interface Conn { + [key:string]: any; + /** + * Read reads data from the connection. + * Read can be made to time out and return an error after a fixed + * time limit; see SetDeadline and SetReadDeadline. + */ + read(b: string): number + /** + * Write writes data to the connection. + * Write can be made to time out and return an error after a fixed + * time limit; see SetDeadline and SetWriteDeadline. + */ + write(b: string): number + /** + * Close closes the connection. + * Any blocked Read or Write operations will be unblocked and return errors. + */ + close(): void + /** + * LocalAddr returns the local network address, if known. + */ + localAddr(): Addr + /** + * RemoteAddr returns the remote network address, if known. + */ + remoteAddr(): Addr + /** + * SetDeadline sets the read and write deadlines associated + * with the connection. It is equivalent to calling both + * SetReadDeadline and SetWriteDeadline. + * + * A deadline is an absolute time after which I/O operations + * fail instead of blocking. The deadline applies to all future + * and pending I/O, not just the immediately following call to + * Read or Write. After a deadline has been exceeded, the + * connection can be refreshed by setting a deadline in the future. + * + * If the deadline is exceeded a call to Read or Write or to other + * I/O methods will return an error that wraps os.ErrDeadlineExceeded. + * This can be tested using errors.Is(err, os.ErrDeadlineExceeded). + * The error's Timeout method will return true, but note that there + * are other possible errors for which the Timeout method will + * return true even if the deadline has not been exceeded. + * + * An idle timeout can be implemented by repeatedly extending + * the deadline after successful Read or Write calls. + * + * A zero value for t means I/O operations will not time out. + */ + setDeadline(t: time.Time): void + /** + * SetReadDeadline sets the deadline for future Read calls + * and any currently-blocked Read call. + * A zero value for t means Read will not time out. + */ + setReadDeadline(t: time.Time): void + /** + * SetWriteDeadline sets the deadline for future Write calls + * and any currently-blocked Write call. + * Even if write times out, it may return n > 0, indicating that + * some of the data was successfully written. + * A zero value for t means Write will not time out. + */ + setWriteDeadline(t: time.Time): void + } + /** + * A Listener is a generic network listener for stream-oriented protocols. + * + * Multiple goroutines may invoke methods on a Listener simultaneously. + */ + interface Listener { + [key:string]: any; + /** + * Accept waits for and returns the next connection to the listener. + */ + accept(): Conn + /** + * Close closes the listener. + * Any blocked Accept operations will be unblocked and return errors. + */ + close(): void + /** + * Addr returns the listener's network address. + */ + addr(): Addr + } +} + /** * Package textproto implements generic support for text-based request/response * protocols in the style of HTTP, NNTP, and SMTP. @@ -14511,6 +14551,7 @@ namespace multipart { * If stored on disk, the File's underlying concrete type will be an *os.File. */ interface File { + [key:string]: any; } /** * Reader is an iterator over parts in a MIME multipart body. @@ -14950,6 +14991,7 @@ namespace http { * an error, panic with the value ErrAbortHandler. */ interface Handler { + [key:string]: any; serveHTTP(_arg0: ResponseWriter, _arg1: Request): void } /** @@ -14963,61 +15005,632 @@ namespace http { } /** - * Package types implements some commonly used db serializable types - * like datetime, json, etc. + * 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 types { +namespace oauth2 { /** - * DateTime represents a [time.Time] instance in UTC that is wrapped - * and serialized using the app default date layout. + * An AuthCodeOption is passed to Config.AuthCodeURL. */ - interface DateTime { + interface AuthCodeOption { + [key:string]: any; } - interface DateTime { + /** + * 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 { /** - * Time returns the internal [time.Time] instance. + * AccessToken is the token that authorizes and authenticates + * the requests. */ - time(): time.Time - } - interface DateTime { + accessToken: string /** - * IsZero checks whether the current DateTime instance has zero time value. + * TokenType is the type of token. + * The Type method returns either this or "Bearer", the default. */ - isZero(): boolean - } - interface DateTime { + tokenType: string /** - * String serializes the current DateTime instance into a formatted - * UTC date 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. * - * The zero value is serialized to an empty string. + * If zero, TokenSource implementations will reuse the same + * token forever and RefreshToken or equivalent + * mechanisms for that TokenSource will not be used. */ - string(): string + expiry: time.Time } - interface DateTime { + interface Token { /** - * MarshalJSON implements the [json.Marshaler] interface. + * Type returns t.TokenType if non-empty, else "Bearer". */ - marshalJSON(): string + type(): string } - interface DateTime { + interface Token { /** - * UnmarshalJSON implements the [json.Unmarshaler] interface. + * 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. */ - unmarshalJSON(b: string): void + setAuthHeader(r: http.Request): void } - interface DateTime { + interface Token { /** - * Value implements the [driver.Valuer] interface. + * 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. */ - value(): any + withExtra(extra: { + }): (Token | undefined) } - interface DateTime { + interface Token { /** - * Scan implements [sql.Scanner] interface to scan the provided value - * into the current DateTime instance. + * Extra returns an extra field. + * Extra fields are key-value pairs returned by the server as a + * part of the token retrieval response. */ - scan(value: any): void + extra(key: string): { + } + } + interface Token { + /** + * Valid reports whether t is non-nil, has an AccessToken, and is not expired. + */ + valid(): boolean + } +} + +namespace store { + /** + * Store defines a concurrent safe in memory key-value data store. + */ + interface Store { + } + interface Store { + /** + * Reset clears the store and replaces the store data with a + * shallow copy of the provided newData. + */ + reset(newData: _TygojaDict): void + } + interface Store { + /** + * Length returns the current number of elements in the store. + */ + length(): number + } + interface Store { + /** + * RemoveAll removes all the existing store entries. + */ + removeAll(): void + } + interface Store { + /** + * Remove removes a single entry from the store. + * + * Remove does nothing if key doesn't exist in the store. + */ + remove(key: string): void + } + interface Store { + /** + * Has checks if element with the specified key exist or not. + */ + has(key: string): boolean + } + interface Store { + /** + * Get returns a single element value from the store. + * + * If key is not set, the zero T value is returned. + */ + get(key: string): T + } + interface Store { + /** + * GetAll returns a shallow copy of the current store data. + */ + getAll(): _TygojaDict + } + interface Store { + /** + * Set sets (or overwrite if already exist) a new value for key. + */ + set(key: string, value: T): void + } + interface Store { + /** + * SetIfLessThanLimit sets (or overwrite if already exist) a new value for key. + * + * This method is similar to Set() but **it will skip adding new elements** + * to the store if the store length has reached the specified limit. + * false is returned if maxAllowedElements limit is reached. + */ + setIfLessThanLimit(key: string, value: T, maxAllowedElements: number): boolean + } +} + +namespace mailer { + /** + * Mailer defines a base mail client interface. + */ + interface Mailer { + [key:string]: any; + /** + * Send sends an email with the provided Message. + */ + send(message: Message): void + } +} + +/** + * Package echo implements high performance, minimalist Go web framework. + * + * Example: + * + * ``` + * package main + * + * import ( + * "github.com/labstack/echo/v5" + * "github.com/labstack/echo/v5/middleware" + * "log" + * "net/http" + * ) + * + * // Handler + * func hello(c echo.Context) error { + * return c.String(http.StatusOK, "Hello, World!") + * } + * + * func main() { + * // Echo instance + * e := echo.New() + * + * // Middleware + * e.Use(middleware.Logger()) + * e.Use(middleware.Recover()) + * + * // Routes + * e.GET("/", hello) + * + * // Start server + * if err := e.Start(":8080"); err != http.ErrServerClosed { + * log.Fatal(err) + * } + * } + * ``` + * + * Learn more at https://echo.labstack.com + */ +namespace echo { + /** + * Binder is the interface that wraps the Bind method. + */ + interface Binder { + [key:string]: any; + bind(c: Context, i: { + }): void + } + /** + * ServableContext is interface that Echo context implementation must implement to be usable in middleware/handlers and + * be able to be routed by Router. + */ + interface ServableContext { + [key:string]: any; + /** + * Reset resets the context after request completes. It must be called along + * with `Echo#AcquireContext()` and `Echo#ReleaseContext()`. + * See `Echo#ServeHTTP()` + */ + reset(r: http.Request, w: http.ResponseWriter): void + } + // @ts-ignore + import stdContext = context + /** + * JSONSerializer is the interface that encodes and decodes JSON to and from interfaces. + */ + interface JSONSerializer { + [key:string]: any; + serialize(c: Context, i: { + }, indent: string): void + deserialize(c: Context, i: { + }): void + } + /** + * HTTPErrorHandler is a centralized HTTP error handler. + */ + interface HTTPErrorHandler {(c: Context, err: Error): void } + /** + * Validator is the interface that wraps the Validate function. + */ + interface Validator { + [key:string]: any; + validate(i: { + }): void + } + /** + * Renderer is the interface that wraps the Render function. + */ + interface Renderer { + [key:string]: any; + render(_arg0: io.Writer, _arg1: string, _arg2: { + }, _arg3: Context): void + } + /** + * Group is a set of sub-routes for a specified route. It can be used for inner + * routes that share a common middleware or functionality that should be separate + * from the parent echo instance while still inheriting from it. + */ + interface Group { + } + interface Group { + /** + * Use implements `Echo#Use()` for sub-routes within the Group. + * Group middlewares are not executed on request when there is no matching route found. + */ + use(...middleware: MiddlewareFunc[]): void + } + interface Group { + /** + * CONNECT implements `Echo#CONNECT()` for sub-routes within the Group. Panics on error. + */ + connect(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * DELETE implements `Echo#DELETE()` for sub-routes within the Group. Panics on error. + */ + delete(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * GET implements `Echo#GET()` for sub-routes within the Group. Panics on error. + */ + get(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * HEAD implements `Echo#HEAD()` for sub-routes within the Group. Panics on error. + */ + head(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * OPTIONS implements `Echo#OPTIONS()` for sub-routes within the Group. Panics on error. + */ + options(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * PATCH implements `Echo#PATCH()` for sub-routes within the Group. Panics on error. + */ + patch(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * POST implements `Echo#POST()` for sub-routes within the Group. Panics on error. + */ + post(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * PUT implements `Echo#PUT()` for sub-routes within the Group. Panics on error. + */ + put(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * TRACE implements `Echo#TRACE()` for sub-routes within the Group. Panics on error. + */ + trace(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * Any implements `Echo#Any()` for sub-routes within the Group. Panics on error. + */ + any(path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes + } + interface Group { + /** + * Match implements `Echo#Match()` for sub-routes within the Group. Panics on error. + */ + match(methods: Array, path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes + } + interface Group { + /** + * Group creates a new sub-group with prefix and optional sub-group-level middleware. + * Important! Group middlewares are only executed in case there was exact route match and not + * for 404 (not found) or 405 (method not allowed) cases. If this kind of behaviour is needed then add + * a catch-all route `/*` for the group which handler returns always 404 + */ + group(prefix: string, ...middleware: MiddlewareFunc[]): (Group | undefined) + } + interface Group { + /** + * Static implements `Echo#Static()` for sub-routes within the Group. + */ + static(pathPrefix: string): RouteInfo + } + interface Group { + /** + * StaticFS implements `Echo#StaticFS()` for sub-routes within the Group. + * + * When dealing with `embed.FS` use `fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary + * prefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths + * including `assets/images` as their prefix. + */ + staticFS(pathPrefix: string, filesystem: fs.FS): RouteInfo + } + interface Group { + /** + * FileFS implements `Echo#FileFS()` for sub-routes within the Group. + */ + fileFS(path: string, filesystem: fs.FS, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * File implements `Echo#File()` for sub-routes within the Group. Panics on error. + */ + file(path: string, ...middleware: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * RouteNotFound implements `Echo#RouteNotFound()` for sub-routes within the Group. + * + * Example: `g.RouteNotFound("/*", func(c echo.Context) error { return c.NoContent(http.StatusNotFound) })` + */ + routeNotFound(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * Add implements `Echo#Add()` for sub-routes within the Group. Panics on error. + */ + add(method: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * AddRoute registers a new Routable with Router + */ + addRoute(route: Routable): RouteInfo + } + /** + * IPExtractor is a function to extract IP addr from http.Request. + * Set appropriate one to Echo#IPExtractor. + * See https://echo.labstack.com/guide/ip-address for more details. + */ + interface IPExtractor {(_arg0: http.Request): string } + /** + * Logger defines the logging interface that Echo uses internally in few places. + * For logging in handlers use your own logger instance (dependency injected or package/public variable) from logging framework of your choice. + */ + interface Logger { + [key:string]: any; + /** + * Write provides writer interface for http.Server `ErrorLog` and for logging startup messages. + * `http.Server.ErrorLog` logs errors from accepting connections, unexpected behavior from handlers, + * and underlying FileSystem errors. + * `logger` middleware will use this method to write its JSON payload. + */ + write(p: string): number + /** + * Error logs the error + */ + error(err: Error): void + } + /** + * Response wraps an http.ResponseWriter and implements its interface to be used + * by an HTTP handler to construct an HTTP response. + * See: https://golang.org/pkg/net/http/#ResponseWriter + */ + interface Response { + writer: http.ResponseWriter + status: number + size: number + committed: boolean + } + interface Response { + /** + * Header returns the header map for the writer that will be sent by + * WriteHeader. Changing the header after a call to WriteHeader (or Write) has + * no effect unless the modified headers were declared as trailers by setting + * the "Trailer" header before the call to WriteHeader (see example) + * To suppress implicit response headers, set their value to nil. + * Example: https://golang.org/pkg/net/http/#example_ResponseWriter_trailers + */ + header(): http.Header + } + interface Response { + /** + * Before registers a function which is called just before the response is written. + */ + before(fn: () => void): void + } + interface Response { + /** + * After registers a function which is called just after the response is written. + * If the `Content-Length` is unknown, none of the after function is executed. + */ + after(fn: () => void): void + } + interface Response { + /** + * WriteHeader sends an HTTP response header with status code. If WriteHeader is + * not called explicitly, the first call to Write will trigger an implicit + * WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly + * used to send error codes. + */ + writeHeader(code: number): void + } + interface Response { + /** + * Write writes the data to the connection as part of an HTTP reply. + */ + write(b: string): number + } + interface Response { + /** + * Flush implements the http.Flusher interface to allow an HTTP handler to flush + * buffered data to the client. + * See [http.Flusher](https://golang.org/pkg/net/http/#Flusher) + */ + flush(): void + } + interface Response { + /** + * Hijack implements the http.Hijacker interface to allow an HTTP handler to + * take over the connection. + * See [http.Hijacker](https://golang.org/pkg/net/http/#Hijacker) + */ + hijack(): [net.Conn, (bufio.ReadWriter | undefined)] + } + interface Response { + /** + * Unwrap returns the original http.ResponseWriter. + * ResponseController can be used to access the original http.ResponseWriter. + * See [https://go.dev/blog/go1.20] + */ + unwrap(): http.ResponseWriter + } + interface Routes { + /** + * Reverse reverses route to URL string by replacing path parameters with given params values. + */ + reverse(name: string, ...params: { + }[]): string + } + interface Routes { + /** + * FindByMethodPath searched for matching route info by method and path + */ + findByMethodPath(method: string, path: string): RouteInfo + } + interface Routes { + /** + * FilterByMethod searched for matching route info by method + */ + filterByMethod(method: string): Routes + } + interface Routes { + /** + * FilterByPath searched for matching route info by path + */ + filterByPath(path: string): Routes + } + interface Routes { + /** + * FilterByName searched for matching route info by name + */ + filterByName(name: string): Routes + } + /** + * Router is interface for routing request contexts to registered routes. + * + * Contract between Echo/Context instance and the router: + * ``` + * - all routes must be added through methods on echo.Echo instance. + * Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see `Echo.contextPathParamAllocSize`). + * - Router must populate Context during Router.Route call with: + * - RoutableContext.SetPath + * - RoutableContext.SetRawPathParams (IMPORTANT! with same slice pointer that c.RawPathParams() returns) + * - RoutableContext.SetRouteInfo + * And optionally can set additional information to Context with RoutableContext.Set + * ``` + */ + interface Router { + [key:string]: any; + /** + * Add registers Routable with the Router and returns registered RouteInfo + */ + add(routable: Routable): RouteInfo + /** + * Remove removes route from the Router + */ + remove(method: string, path: string): void + /** + * Routes returns information about all registered routes + */ + routes(): Routes + /** + * Route searches Router for matching route and applies it to the given context. In case when no matching method + * was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404 + * handler function. + */ + route(c: RoutableContext): HandlerFunc + } + /** + * Routable is interface for registering Route with Router. During route registration process the Router will + * convert Routable to RouteInfo with ToRouteInfo method. By creating custom implementation of Routable additional + * information about registered route can be stored in Routes (i.e. privileges used with route etc.) + */ + interface Routable { + [key:string]: any; + /** + * ToRouteInfo converts Routable to RouteInfo + * + * This method is meant to be used by Router after it parses url for path parameters, to store information about + * route just added. + */ + toRouteInfo(params: Array): RouteInfo + /** + * ToRoute converts Routable to Route which Router uses to register the method handler for path. + * + * This method is meant to be used by Router to get fields (including handler and middleware functions) needed to + * add Route to Router. + */ + toRoute(): Route + /** + * ForGroup recreates routable with added group prefix and group middlewares it is grouped to. + * + * Is necessary for Echo.Group to be able to add/register Routable with Router and having group prefix and group + * middlewares included in actually registered Route. + */ + forGroup(pathPrefix: string, middlewares: Array): Routable + } + /** + * Routes is collection of RouteInfo instances with various helper methods. + */ + interface Routes extends Array{} + /** + * RouteInfo describes registered route base fields. + * Method+Path pair uniquely identifies the Route. Name can have duplicates. + */ + interface RouteInfo { + [key:string]: any; + method(): string + path(): string + name(): string + params(): Array + /** + * Reverse reverses route to URL string by replacing path parameters with given params values. + */ + reverse(...params: { + }[]): string + } + /** + * PathParams is collections of PathParam instances with various helper methods + */ + interface PathParams extends Array{} + interface PathParams { + /** + * Get returns path parameter value for given name or default value. + */ + get(name: string, defaultValue: string): string } } @@ -15237,892 +15850,62 @@ namespace sql { } } -namespace store { - /** - * Store defines a concurrent safe in memory key-value data store. - */ - interface Store { - } - interface Store { - /** - * Reset clears the store and replaces the store data with a - * shallow copy of the provided newData. - */ - reset(newData: _TygojaDict): void - } - interface Store { - /** - * Length returns the current number of elements in the store. - */ - length(): number - } - interface Store { - /** - * RemoveAll removes all the existing store entries. - */ - removeAll(): void - } - interface Store { - /** - * Remove removes a single entry from the store. - * - * Remove does nothing if key doesn't exist in the store. - */ - remove(key: string): void - } - interface Store { - /** - * Has checks if element with the specified key exist or not. - */ - has(key: string): boolean - } - interface Store { - /** - * Get returns a single element value from the store. - * - * If key is not set, the zero T value is returned. - */ - get(key: string): T - } - interface Store { - /** - * GetAll returns a shallow copy of the current store data. - */ - getAll(): _TygojaDict - } - interface Store { - /** - * Set sets (or overwrite if already exist) a new value for key. - */ - set(key: string, value: T): void - } - interface Store { - /** - * SetIfLessThanLimit sets (or overwrite if already exist) a new value for key. - * - * This method is similar to Set() but **it will skip adding new elements** - * to the store if the store length has reached the specified limit. - * false is returned if maxAllowedElements limit is reached. - */ - setIfLessThanLimit(key: string, value: T, maxAllowedElements: number): boolean - } -} - /** - * Package schema implements custom Schema and SchemaField datatypes - * for handling the Collection schema definitions. + * Package types implements some commonly used db serializable types + * like datetime, json, etc. */ -namespace schema { - // @ts-ignore - import validation = ozzo_validation +namespace types { /** - * SchemaField defines a single schema field structure. + * DateTime represents a [time.Time] instance in UTC that is wrapped + * and serialized using the app default date layout. */ - interface SchemaField { - system: boolean - id: string - name: string - type: string - required: boolean - /** - * Presentable indicates whether the field is suitable for - * visualization purposes (eg. in the Admin UI relation views). - */ - presentable: boolean - /** - * Deprecated: This field is no-op and will be removed in future versions. - * Please use the collection.Indexes field to define a unique constraint. - */ - unique: boolean - options: any + interface DateTime { } - interface SchemaField { + interface DateTime { /** - * ColDefinition returns the field db column type definition as string. + * Time returns the internal [time.Time] instance. */ - colDefinition(): string + time(): time.Time } - interface SchemaField { + interface DateTime { /** - * String serializes and returns the current field as string. + * IsZero checks whether the current DateTime instance has zero time value. + */ + isZero(): boolean + } + interface DateTime { + /** + * String serializes the current DateTime instance into a formatted + * UTC date string. + * + * The zero value is serialized to an empty string. */ string(): string } - interface SchemaField { + interface DateTime { /** * MarshalJSON implements the [json.Marshaler] interface. */ marshalJSON(): string } - interface SchemaField { + interface DateTime { /** * UnmarshalJSON implements the [json.Unmarshaler] interface. - * - * The schema field options are auto initialized on success. */ - unmarshalJSON(data: string): void + unmarshalJSON(b: string): void } - interface SchemaField { + interface DateTime { /** - * Validate makes `SchemaField` validatable by implementing [validation.Validatable] interface. + * Value implements the [driver.Valuer] interface. */ - validate(): void + value(): any } - interface SchemaField { + interface DateTime { /** - * InitOptions initializes the current field options based on its type. - * - * Returns error on unknown field type. + * Scan implements [sql.Scanner] interface to scan the provided value + * into the current DateTime instance. */ - initOptions(): void - } - interface SchemaField { - /** - * PrepareValue returns normalized and properly formatted field value. - */ - prepareValue(value: any): any - } - interface SchemaField { - /** - * PrepareValueWithModifier returns normalized and properly formatted field value - * by "merging" baseValue with the modifierValue based on the specified modifier (+ or -). - */ - prepareValueWithModifier(baseValue: any, modifier: string, modifierValue: any): any - } -} - -/** - * Package models implements all PocketBase DB models and DTOs. - */ -namespace models { - /** - * Model defines an interface with common methods that all db models should have. - */ - interface Model { - tableName(): string - isNew(): boolean - markAsNew(): void - markAsNotNew(): void - hasId(): boolean - getId(): string - setId(id: string): void - getCreated(): types.DateTime - getUpdated(): types.DateTime - refreshId(): void - refreshCreated(): void - refreshUpdated(): void - } - /** - * BaseModel defines common fields and methods used by all other models. - */ - interface BaseModel { - id: string - created: types.DateTime - updated: types.DateTime - } - interface BaseModel { - /** - * HasId returns whether the model has a nonzero id. - */ - hasId(): boolean - } - interface BaseModel { - /** - * GetId returns the model id. - */ - getId(): string - } - interface BaseModel { - /** - * SetId sets the model id to the provided string value. - */ - setId(id: string): void - } - interface BaseModel { - /** - * MarkAsNew marks the model as "new" (aka. enforces m.IsNew() to be true). - */ - markAsNew(): void - } - interface BaseModel { - /** - * MarkAsNotNew marks the model as "not new" (aka. enforces m.IsNew() to be false) - */ - markAsNotNew(): void - } - interface BaseModel { - /** - * IsNew indicates what type of db query (insert or update) - * should be used with the model instance. - */ - isNew(): boolean - } - interface BaseModel { - /** - * GetCreated returns the model Created datetime. - */ - getCreated(): types.DateTime - } - interface BaseModel { - /** - * GetUpdated returns the model Updated datetime. - */ - getUpdated(): types.DateTime - } - interface BaseModel { - /** - * RefreshId generates and sets a new model id. - * - * The generated id is a cryptographically random 15 characters length string. - */ - refreshId(): void - } - interface BaseModel { - /** - * RefreshCreated updates the model Created field with the current datetime. - */ - refreshCreated(): void - } - interface BaseModel { - /** - * RefreshUpdated updates the model Updated field with the current datetime. - */ - refreshUpdated(): void - } - interface BaseModel { - /** - * PostScan implements the [dbx.PostScanner] interface. - * - * It is executed right after the model was populated with the db row values. - */ - postScan(): void - } - // @ts-ignore - import validation = ozzo_validation - /** - * CollectionBaseOptions defines the "base" Collection.Options fields. - */ - interface CollectionBaseOptions { - } - interface CollectionBaseOptions { - /** - * Validate implements [validation.Validatable] interface. - */ - validate(): void - } - /** - * CollectionAuthOptions defines the "auth" Collection.Options fields. - */ - interface CollectionAuthOptions { - manageRule?: string - allowOAuth2Auth: boolean - allowUsernameAuth: boolean - allowEmailAuth: boolean - requireEmail: boolean - exceptEmailDomains: Array - onlyEmailDomains: Array - minPasswordLength: number - } - interface CollectionAuthOptions { - /** - * Validate implements [validation.Validatable] interface. - */ - validate(): void - } - /** - * CollectionViewOptions defines the "view" Collection.Options fields. - */ - interface CollectionViewOptions { - query: string - } - interface CollectionViewOptions { - /** - * Validate implements [validation.Validatable] interface. - */ - validate(): void - } - type _subHJowg = BaseModel - interface Param extends _subHJowg { - key: string - value: types.JsonRaw - } - interface Param { - tableName(): string - } - type _subZZSZN = BaseModel - interface Request extends _subZZSZN { - 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. - * - * Example: - * - * ``` - * package main - * - * import ( - * "github.com/labstack/echo/v5" - * "github.com/labstack/echo/v5/middleware" - * "log" - * "net/http" - * ) - * - * // Handler - * func hello(c echo.Context) error { - * return c.String(http.StatusOK, "Hello, World!") - * } - * - * func main() { - * // Echo instance - * e := echo.New() - * - * // Middleware - * e.Use(middleware.Logger()) - * e.Use(middleware.Recover()) - * - * // Routes - * e.GET("/", hello) - * - * // Start server - * if err := e.Start(":8080"); err != http.ErrServerClosed { - * log.Fatal(err) - * } - * } - * ``` - * - * Learn more at https://echo.labstack.com - */ -namespace echo { - /** - * Binder is the interface that wraps the Bind method. - */ - interface Binder { - bind(c: Context, i: { - }): void - } - /** - * ServableContext is interface that Echo context implementation must implement to be usable in middleware/handlers and - * be able to be routed by Router. - */ - interface ServableContext { - /** - * Reset resets the context after request completes. It must be called along - * with `Echo#AcquireContext()` and `Echo#ReleaseContext()`. - * See `Echo#ServeHTTP()` - */ - reset(r: http.Request, w: http.ResponseWriter): void - } - // @ts-ignore - import stdContext = context - /** - * JSONSerializer is the interface that encodes and decodes JSON to and from interfaces. - */ - interface JSONSerializer { - serialize(c: Context, i: { - }, indent: string): void - deserialize(c: Context, i: { - }): void - } - /** - * HTTPErrorHandler is a centralized HTTP error handler. - */ - interface HTTPErrorHandler {(c: Context, err: Error): void } - /** - * Validator is the interface that wraps the Validate function. - */ - interface Validator { - validate(i: { - }): void - } - /** - * Renderer is the interface that wraps the Render function. - */ - interface Renderer { - render(_arg0: io.Writer, _arg1: string, _arg2: { - }, _arg3: Context): void - } - /** - * Group is a set of sub-routes for a specified route. It can be used for inner - * routes that share a common middleware or functionality that should be separate - * from the parent echo instance while still inheriting from it. - */ - interface Group { - } - interface Group { - /** - * Use implements `Echo#Use()` for sub-routes within the Group. - * Group middlewares are not executed on request when there is no matching route found. - */ - use(...middleware: MiddlewareFunc[]): void - } - interface Group { - /** - * CONNECT implements `Echo#CONNECT()` for sub-routes within the Group. Panics on error. - */ - connect(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * DELETE implements `Echo#DELETE()` for sub-routes within the Group. Panics on error. - */ - delete(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * GET implements `Echo#GET()` for sub-routes within the Group. Panics on error. - */ - get(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * HEAD implements `Echo#HEAD()` for sub-routes within the Group. Panics on error. - */ - head(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * OPTIONS implements `Echo#OPTIONS()` for sub-routes within the Group. Panics on error. - */ - options(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * PATCH implements `Echo#PATCH()` for sub-routes within the Group. Panics on error. - */ - patch(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * POST implements `Echo#POST()` for sub-routes within the Group. Panics on error. - */ - post(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * PUT implements `Echo#PUT()` for sub-routes within the Group. Panics on error. - */ - put(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * TRACE implements `Echo#TRACE()` for sub-routes within the Group. Panics on error. - */ - trace(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * Any implements `Echo#Any()` for sub-routes within the Group. Panics on error. - */ - any(path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes - } - interface Group { - /** - * Match implements `Echo#Match()` for sub-routes within the Group. Panics on error. - */ - match(methods: Array, path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes - } - interface Group { - /** - * Group creates a new sub-group with prefix and optional sub-group-level middleware. - * Important! Group middlewares are only executed in case there was exact route match and not - * for 404 (not found) or 405 (method not allowed) cases. If this kind of behaviour is needed then add - * a catch-all route `/*` for the group which handler returns always 404 - */ - group(prefix: string, ...middleware: MiddlewareFunc[]): (Group | undefined) - } - interface Group { - /** - * Static implements `Echo#Static()` for sub-routes within the Group. - */ - static(pathPrefix: string): RouteInfo - } - interface Group { - /** - * StaticFS implements `Echo#StaticFS()` for sub-routes within the Group. - * - * When dealing with `embed.FS` use `fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary - * prefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths - * including `assets/images` as their prefix. - */ - staticFS(pathPrefix: string, filesystem: fs.FS): RouteInfo - } - interface Group { - /** - * FileFS implements `Echo#FileFS()` for sub-routes within the Group. - */ - fileFS(path: string, filesystem: fs.FS, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * File implements `Echo#File()` for sub-routes within the Group. Panics on error. - */ - file(path: string, ...middleware: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * RouteNotFound implements `Echo#RouteNotFound()` for sub-routes within the Group. - * - * Example: `g.RouteNotFound("/*", func(c echo.Context) error { return c.NoContent(http.StatusNotFound) })` - */ - routeNotFound(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * Add implements `Echo#Add()` for sub-routes within the Group. Panics on error. - */ - add(method: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * AddRoute registers a new Routable with Router - */ - addRoute(route: Routable): RouteInfo - } - /** - * IPExtractor is a function to extract IP addr from http.Request. - * Set appropriate one to Echo#IPExtractor. - * See https://echo.labstack.com/guide/ip-address for more details. - */ - interface IPExtractor {(_arg0: http.Request): string } - /** - * Logger defines the logging interface that Echo uses internally in few places. - * For logging in handlers use your own logger instance (dependency injected or package/public variable) from logging framework of your choice. - */ - interface Logger { - /** - * Write provides writer interface for http.Server `ErrorLog` and for logging startup messages. - * `http.Server.ErrorLog` logs errors from accepting connections, unexpected behavior from handlers, - * and underlying FileSystem errors. - * `logger` middleware will use this method to write its JSON payload. - */ - write(p: string): number - /** - * Error logs the error - */ - error(err: Error): void - } - /** - * Response wraps an http.ResponseWriter and implements its interface to be used - * by an HTTP handler to construct an HTTP response. - * See: https://golang.org/pkg/net/http/#ResponseWriter - */ - interface Response { - writer: http.ResponseWriter - status: number - size: number - committed: boolean - } - interface Response { - /** - * Header returns the header map for the writer that will be sent by - * WriteHeader. Changing the header after a call to WriteHeader (or Write) has - * no effect unless the modified headers were declared as trailers by setting - * the "Trailer" header before the call to WriteHeader (see example) - * To suppress implicit response headers, set their value to nil. - * Example: https://golang.org/pkg/net/http/#example_ResponseWriter_trailers - */ - header(): http.Header - } - interface Response { - /** - * Before registers a function which is called just before the response is written. - */ - before(fn: () => void): void - } - interface Response { - /** - * After registers a function which is called just after the response is written. - * If the `Content-Length` is unknown, none of the after function is executed. - */ - after(fn: () => void): void - } - interface Response { - /** - * WriteHeader sends an HTTP response header with status code. If WriteHeader is - * not called explicitly, the first call to Write will trigger an implicit - * WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly - * used to send error codes. - */ - writeHeader(code: number): void - } - interface Response { - /** - * Write writes the data to the connection as part of an HTTP reply. - */ - write(b: string): number - } - interface Response { - /** - * Flush implements the http.Flusher interface to allow an HTTP handler to flush - * buffered data to the client. - * See [http.Flusher](https://golang.org/pkg/net/http/#Flusher) - */ - flush(): void - } - interface Response { - /** - * Hijack implements the http.Hijacker interface to allow an HTTP handler to - * take over the connection. - * See [http.Hijacker](https://golang.org/pkg/net/http/#Hijacker) - */ - hijack(): [net.Conn, (bufio.ReadWriter | undefined)] - } - interface Response { - /** - * Unwrap returns the original http.ResponseWriter. - * ResponseController can be used to access the original http.ResponseWriter. - * See [https://go.dev/blog/go1.20] - */ - unwrap(): http.ResponseWriter - } - interface Routes { - /** - * Reverse reverses route to URL string by replacing path parameters with given params values. - */ - reverse(name: string, ...params: { - }[]): string - } - interface Routes { - /** - * FindByMethodPath searched for matching route info by method and path - */ - findByMethodPath(method: string, path: string): RouteInfo - } - interface Routes { - /** - * FilterByMethod searched for matching route info by method - */ - filterByMethod(method: string): Routes - } - interface Routes { - /** - * FilterByPath searched for matching route info by path - */ - filterByPath(path: string): Routes - } - interface Routes { - /** - * FilterByName searched for matching route info by name - */ - filterByName(name: string): Routes - } - /** - * Router is interface for routing request contexts to registered routes. - * - * Contract between Echo/Context instance and the router: - * ``` - * - all routes must be added through methods on echo.Echo instance. - * Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see `Echo.contextPathParamAllocSize`). - * - Router must populate Context during Router.Route call with: - * - RoutableContext.SetPath - * - RoutableContext.SetRawPathParams (IMPORTANT! with same slice pointer that c.RawPathParams() returns) - * - RoutableContext.SetRouteInfo - * And optionally can set additional information to Context with RoutableContext.Set - * ``` - */ - interface Router { - /** - * Add registers Routable with the Router and returns registered RouteInfo - */ - add(routable: Routable): RouteInfo - /** - * Remove removes route from the Router - */ - remove(method: string, path: string): void - /** - * Routes returns information about all registered routes - */ - routes(): Routes - /** - * Route searches Router for matching route and applies it to the given context. In case when no matching method - * was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404 - * handler function. - */ - route(c: RoutableContext): HandlerFunc - } - /** - * Routable is interface for registering Route with Router. During route registration process the Router will - * convert Routable to RouteInfo with ToRouteInfo method. By creating custom implementation of Routable additional - * information about registered route can be stored in Routes (i.e. privileges used with route etc.) - */ - interface Routable { - /** - * ToRouteInfo converts Routable to RouteInfo - * - * This method is meant to be used by Router after it parses url for path parameters, to store information about - * route just added. - */ - toRouteInfo(params: Array): RouteInfo - /** - * ToRoute converts Routable to Route which Router uses to register the method handler for path. - * - * This method is meant to be used by Router to get fields (including handler and middleware functions) needed to - * add Route to Router. - */ - toRoute(): Route - /** - * ForGroup recreates routable with added group prefix and group middlewares it is grouped to. - * - * Is necessary for Echo.Group to be able to add/register Routable with Router and having group prefix and group - * middlewares included in actually registered Route. - */ - forGroup(pathPrefix: string, middlewares: Array): Routable - } - /** - * Routes is collection of RouteInfo instances with various helper methods. - */ - interface Routes extends Array{} - /** - * RouteInfo describes registered route base fields. - * Method+Path pair uniquely identifies the Route. Name can have duplicates. - */ - interface RouteInfo { - method(): string - path(): string - name(): string - params(): Array - /** - * Reverse reverses route to URL string by replacing path parameters with given params values. - */ - reverse(...params: { - }[]): string - } - /** - * PathParams is collections of PathParam instances with various helper methods - */ - interface PathParams extends Array{} - interface PathParams { - /** - * Get returns path parameter value for given name or default value. - */ - get(name: string, defaultValue: string): string - } -} - -/** - * 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 + scan(value: any): void } } @@ -16272,6 +16055,277 @@ namespace settings { } } +/** + * Package schema implements custom Schema and SchemaField datatypes + * for handling the Collection schema definitions. + */ +namespace schema { + // @ts-ignore + import validation = ozzo_validation + /** + * SchemaField defines a single schema field structure. + */ + interface SchemaField { + system: boolean + id: string + name: string + type: string + required: boolean + /** + * Presentable indicates whether the field is suitable for + * visualization purposes (eg. in the Admin UI relation views). + */ + presentable: boolean + /** + * Deprecated: This field is no-op and will be removed in future versions. + * Please use the collection.Indexes field to define a unique constraint. + */ + unique: boolean + options: any + } + interface SchemaField { + /** + * ColDefinition returns the field db column type definition as string. + */ + colDefinition(): string + } + interface SchemaField { + /** + * String serializes and returns the current field as string. + */ + string(): string + } + interface SchemaField { + /** + * MarshalJSON implements the [json.Marshaler] interface. + */ + marshalJSON(): string + } + interface SchemaField { + /** + * UnmarshalJSON implements the [json.Unmarshaler] interface. + * + * The schema field options are auto initialized on success. + */ + unmarshalJSON(data: string): void + } + interface SchemaField { + /** + * Validate makes `SchemaField` validatable by implementing [validation.Validatable] interface. + */ + validate(): void + } + interface SchemaField { + /** + * InitOptions initializes the current field options based on its type. + * + * Returns error on unknown field type. + */ + initOptions(): void + } + interface SchemaField { + /** + * PrepareValue returns normalized and properly formatted field value. + */ + prepareValue(value: any): any + } + interface SchemaField { + /** + * PrepareValueWithModifier returns normalized and properly formatted field value + * by "merging" baseValue with the modifierValue based on the specified modifier (+ or -). + */ + prepareValueWithModifier(baseValue: any, modifier: string, modifierValue: any): any + } +} + +/** + * Package models implements all PocketBase DB models and DTOs. + */ +namespace models { + /** + * Model defines an interface with common methods that all db models should have. + */ + interface Model { + [key:string]: any; + 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 _subniAni = BaseModel + interface Param extends _subniAni { + key: string + value: types.JsonRaw + } + interface Param { + tableName(): string + } + type _subGkOeg = BaseModel + interface Request extends _subGkOeg { + 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. * @@ -16290,100 +16344,6 @@ 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 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 - } -} - namespace hook { /** * Hook defines a concurrent safe structure for handling event hooks @@ -16437,8 +16397,8 @@ namespace hook { * TaggedHook defines a proxy hook which register handlers that are triggered only * if the TaggedHook.tags are empty or includes at least one of the event data tag(s). */ - type _subymeLM = mainHook - interface TaggedHook extends _subymeLM { + type _subvmsmn = mainHook + interface TaggedHook extends _subvmsmn { } interface TaggedHook { /** @@ -16465,6 +16425,43 @@ namespace hook { } } +namespace subscriptions { + /** + * Broker defines a struct for managing subscriptions clients. + */ + interface Broker { + } + interface Broker { + /** + * Clients returns a shallow copy of all registered clients indexed + * with their connection id. + */ + clients(): _TygojaDict + } + interface Broker { + /** + * ClientById finds a registered client by its id. + * + * Returns non-nil error when client with clientId is not registered. + */ + clientById(clientId: string): Client + } + interface Broker { + /** + * Register adds a new client to the broker instance. + */ + register(client: Client): void + } + interface Broker { + /** + * Unregister removes a single client by its id. + * + * If client with clientId doesn't exist, this method does nothing. + */ + unregister(clientId: string): void + } +} + /** * Package core is the backbone of PocketBase. * @@ -16487,12 +16484,12 @@ namespace core { httpContext: echo.Context error: Error } - type _subHMIKX = BaseModelEvent - interface ModelEvent extends _subHMIKX { + type _subHnAxS = BaseModelEvent + interface ModelEvent extends _subHnAxS { dao?: daos.Dao } - type _subjAZZF = BaseCollectionEvent - interface MailerRecordEvent extends _subjAZZF { + type _subdPSOd = BaseCollectionEvent + interface MailerRecordEvent extends _subdPSOd { mailClient: mailer.Mailer message?: mailer.Message record?: models.Record @@ -16532,50 +16529,50 @@ namespace core { oldSettings?: settings.Settings newSettings?: settings.Settings } - type _subEWcUn = BaseCollectionEvent - interface RecordsListEvent extends _subEWcUn { + type _subTWZep = BaseCollectionEvent + interface RecordsListEvent extends _subTWZep { httpContext: echo.Context records: Array<(models.Record | undefined)> result?: search.Result } - type _subwdnkZ = BaseCollectionEvent - interface RecordViewEvent extends _subwdnkZ { + type _subyQuRg = BaseCollectionEvent + interface RecordViewEvent extends _subyQuRg { httpContext: echo.Context record?: models.Record } - type _subDGnHr = BaseCollectionEvent - interface RecordCreateEvent extends _subDGnHr { + type _subYToDk = BaseCollectionEvent + interface RecordCreateEvent extends _subYToDk { httpContext: echo.Context record?: models.Record uploadedFiles: _TygojaDict } - type _subWWmlV = BaseCollectionEvent - interface RecordUpdateEvent extends _subWWmlV { + type _subxoVCk = BaseCollectionEvent + interface RecordUpdateEvent extends _subxoVCk { httpContext: echo.Context record?: models.Record uploadedFiles: _TygojaDict } - type _subgcfgC = BaseCollectionEvent - interface RecordDeleteEvent extends _subgcfgC { + type _subaOvYD = BaseCollectionEvent + interface RecordDeleteEvent extends _subaOvYD { httpContext: echo.Context record?: models.Record } - type _subneJSk = BaseCollectionEvent - interface RecordAuthEvent extends _subneJSk { + type _subxbPBz = BaseCollectionEvent + interface RecordAuthEvent extends _subxbPBz { httpContext: echo.Context record?: models.Record token: string meta: any } - type _subKwbhH = BaseCollectionEvent - interface RecordAuthWithPasswordEvent extends _subKwbhH { + type _subZwMbg = BaseCollectionEvent + interface RecordAuthWithPasswordEvent extends _subZwMbg { httpContext: echo.Context record?: models.Record identity: string password: string } - type _subhrXao = BaseCollectionEvent - interface RecordAuthWithOAuth2Event extends _subhrXao { + type _subfRrvQ = BaseCollectionEvent + interface RecordAuthWithOAuth2Event extends _subfRrvQ { httpContext: echo.Context providerName: string providerClient: auth.Provider @@ -16583,49 +16580,49 @@ namespace core { oAuth2User?: auth.AuthUser isNewRecord: boolean } - type _subPwken = BaseCollectionEvent - interface RecordAuthRefreshEvent extends _subPwken { + type _subTQFGk = BaseCollectionEvent + interface RecordAuthRefreshEvent extends _subTQFGk { httpContext: echo.Context record?: models.Record } - type _subaAZvP = BaseCollectionEvent - interface RecordRequestPasswordResetEvent extends _subaAZvP { + type _subEPlaU = BaseCollectionEvent + interface RecordRequestPasswordResetEvent extends _subEPlaU { httpContext: echo.Context record?: models.Record } - type _subDbFMi = BaseCollectionEvent - interface RecordConfirmPasswordResetEvent extends _subDbFMi { + type _subwwCNQ = BaseCollectionEvent + interface RecordConfirmPasswordResetEvent extends _subwwCNQ { httpContext: echo.Context record?: models.Record } - type _subIgdGl = BaseCollectionEvent - interface RecordRequestVerificationEvent extends _subIgdGl { + type _subUBkoS = BaseCollectionEvent + interface RecordRequestVerificationEvent extends _subUBkoS { httpContext: echo.Context record?: models.Record } - type _subNAKdq = BaseCollectionEvent - interface RecordConfirmVerificationEvent extends _subNAKdq { + type _subdnEnC = BaseCollectionEvent + interface RecordConfirmVerificationEvent extends _subdnEnC { httpContext: echo.Context record?: models.Record } - type _subfUGzM = BaseCollectionEvent - interface RecordRequestEmailChangeEvent extends _subfUGzM { + type _subPvXDo = BaseCollectionEvent + interface RecordRequestEmailChangeEvent extends _subPvXDo { httpContext: echo.Context record?: models.Record } - type _subliRky = BaseCollectionEvent - interface RecordConfirmEmailChangeEvent extends _subliRky { + type _subUbZvh = BaseCollectionEvent + interface RecordConfirmEmailChangeEvent extends _subUbZvh { httpContext: echo.Context record?: models.Record } - type _subQwxzp = BaseCollectionEvent - interface RecordListExternalAuthsEvent extends _subQwxzp { + type _subtvkwz = BaseCollectionEvent + interface RecordListExternalAuthsEvent extends _subtvkwz { httpContext: echo.Context record?: models.Record externalAuths: Array<(models.ExternalAuth | undefined)> } - type _subthYjW = BaseCollectionEvent - interface RecordUnlinkExternalAuthEvent extends _subthYjW { + type _subSPsPz = BaseCollectionEvent + interface RecordUnlinkExternalAuthEvent extends _subSPsPz { httpContext: echo.Context record?: models.Record externalAuth?: models.ExternalAuth @@ -16679,33 +16676,33 @@ namespace core { collections: Array<(models.Collection | undefined)> result?: search.Result } - type _subjying = BaseCollectionEvent - interface CollectionViewEvent extends _subjying { + type _subpURcs = BaseCollectionEvent + interface CollectionViewEvent extends _subpURcs { httpContext: echo.Context } - type _subOPJCw = BaseCollectionEvent - interface CollectionCreateEvent extends _subOPJCw { + type _subxckPu = BaseCollectionEvent + interface CollectionCreateEvent extends _subxckPu { httpContext: echo.Context } - type _subelyqu = BaseCollectionEvent - interface CollectionUpdateEvent extends _subelyqu { + type _subkEDIa = BaseCollectionEvent + interface CollectionUpdateEvent extends _subkEDIa { httpContext: echo.Context } - type _sublGYeg = BaseCollectionEvent - interface CollectionDeleteEvent extends _sublGYeg { + type _subRtQFA = BaseCollectionEvent + interface CollectionDeleteEvent extends _subRtQFA { httpContext: echo.Context } interface CollectionsImportEvent { httpContext: echo.Context collections: Array<(models.Collection | undefined)> } - type _subZUvIC = BaseModelEvent - interface FileTokenEvent extends _subZUvIC { + type _subXzsil = BaseModelEvent + interface FileTokenEvent extends _subXzsil { httpContext: echo.Context token: string } - type _subRdKhy = BaseCollectionEvent - interface FileDownloadEvent extends _subRdKhy { + type _submoRja = BaseCollectionEvent + interface FileDownloadEvent extends _submoRja { httpContext: echo.Context record?: models.Record fileField?: schema.SchemaField @@ -16714,6 +16711,66 @@ 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 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 + } +} + +namespace migrate { + interface Migration { + file: string + up: (db: dbx.Builder) => void + down: (db: dbx.Builder) => void + } +} + +namespace store { +} + /** * Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer * object, creating another object (Reader or Writer) that also implements @@ -16724,8 +16781,8 @@ namespace bufio { * ReadWriter stores pointers to a Reader and a Writer. * It implements io.ReadWriter. */ - type _subNELno = Reader&Writer - interface ReadWriter extends _subNELno { + type _subknzCt = Reader&Writer + interface ReadWriter extends _subknzCt { } } @@ -16817,6 +16874,7 @@ namespace net { * and meaning of the strings is up to the implementation. */ interface Addr { + [key:string]: any; network(): string // name of the network (for example, "tcp", "udp") string(): string // string form of address (for example, "192.0.2.1:25", "[2001:db8::1]:80") } @@ -16855,89 +16913,6 @@ namespace url { } } -namespace subscriptions { - /** - * Message defines a client's channel data. - */ - interface Message { - name: string - data: string - } - /** - * Client is an interface for a generic subscription client. - */ - interface Client { - /** - * Id Returns the unique id of the client. - */ - id(): string - /** - * Channel returns the client's communication channel. - */ - channel(): undefined - /** - * Subscriptions returns all subscriptions to which the client has subscribed to. - */ - subscriptions(): _TygojaDict - /** - * Subscribe subscribes the client to the provided subscriptions list. - */ - subscribe(...subs: string[]): void - /** - * Unsubscribe unsubscribes the client from the provided subscriptions list. - */ - unsubscribe(...subs: string[]): void - /** - * HasSubscription checks if the client is subscribed to `sub`. - */ - hasSubscription(sub: string): boolean - /** - * Set stores any value to the client's context. - */ - set(key: string, value: any): void - /** - * Unset removes a single value from the client's context. - */ - unset(key: string): void - /** - * Get retrieves the key value from the client's context. - */ - get(key: string): any - /** - * Discard marks the client as "discarded", meaning that it - * shouldn't be used anymore for sending new messages. - * - * It is safe to call Discard() multiple times. - */ - discard(): void - /** - * IsDiscarded indicates whether the client has been "discarded" - * and should no longer be used. - */ - isDiscarded(): boolean - /** - * Send sends the specified message to the client's channel (if not discarded). - */ - send(m: Message): void - } -} - -namespace store { -} - -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 _subVhRPd = Hook - interface mainHook extends _subVhRPd { - } -} - /** * Package multipart implements MIME multipart parsing, as defined in RFC * 2046. @@ -17115,23 +17090,6 @@ namespace http { import urlpkg = url } -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. * @@ -17209,6 +17167,7 @@ namespace echo { * interface are meant for request routing purposes and should not be used in middlewares. */ interface RoutableContext { + [key:string]: any; /** * Request returns `*http.Request`. */ @@ -17289,6 +17248,23 @@ namespace types { } } +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 + } +} + namespace search { /** * Result defines the returned search result structure. @@ -17325,6 +17301,87 @@ 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 _subDPTfS = Hook + interface mainHook extends _subDPTfS { + } +} + +namespace subscriptions { + /** + * Message defines a client's channel data. + */ + interface Message { + name: string + data: string + } + /** + * Client is an interface for a generic subscription client. + */ + interface Client { + [key:string]: any; + /** + * Id Returns the unique id of the client. + */ + id(): string + /** + * Channel returns the client's communication channel. + */ + channel(): undefined + /** + * Subscriptions returns all subscriptions to which the client has subscribed to. + */ + subscriptions(): _TygojaDict + /** + * Subscribe subscribes the client to the provided subscriptions list. + */ + subscribe(...subs: string[]): void + /** + * Unsubscribe unsubscribes the client from the provided subscriptions list. + */ + unsubscribe(...subs: string[]): void + /** + * HasSubscription checks if the client is subscribed to `sub`. + */ + hasSubscription(sub: string): boolean + /** + * Set stores any value to the client's context. + */ + set(key: string, value: any): void + /** + * Unset removes a single value from the client's context. + */ + unset(key: string): void + /** + * Get retrieves the key value from the client's context. + */ + get(key: string): any + /** + * Discard marks the client as "discarded", meaning that it + * shouldn't be used anymore for sending new messages. + * + * It is safe to call Discard() multiple times. + */ + discard(): void + /** + * IsDiscarded indicates whether the client has been "discarded" + * and should no longer be used. + */ + isDiscarded(): boolean + /** + * Send sends the specified message to the client's channel (if not discarded). + */ + send(m: Message): void + } +} + /** * Package core is the backbone of PocketBase. * @@ -17607,9 +17664,6 @@ namespace bufio { } } -namespace subscriptions { -} - /** * Package mail implements parsing of mail messages. * @@ -17647,3 +17701,6 @@ namespace mail { namespace search { } + +namespace subscriptions { +} diff --git a/plugins/jsvm/internal/types/types.go b/plugins/jsvm/internal/types/types.go index 2f1c97ca..e298df98 100644 --- a/plugins/jsvm/internal/types/types.go +++ b/plugins/jsvm/internal/types/types.go @@ -144,8 +144,19 @@ declare function routerPre(...middlewares: Array): v */ declare var __hooks: string -// skip on* hook methods as they are registered via the global on* method -type appWithoutHooks = Omit +// Utility type to exclude the on* hook methods from a type +// (hooks are separately generated as global methods). +// +// See https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#key-remapping-via-as +type excludeHooks = { + [Property in keyof Type as Exclude]: Type[Property] +}; + +// core.App without the on* hook methods +type CoreApp = excludeHooks + +// pocketbase.PocketBase without the on* hook methods +type PocketBase = excludeHooks /** * ` + "`$app`" + ` is the current running PocketBase instance that is globally @@ -156,7 +167,7 @@ type appWithoutHooks = Omit * @namespace * @group PocketBase */ -declare var $app: appWithoutHooks +declare var $app: PocketBase /** * ` + "`$template`" + ` is a global helper to load and cache HTML templates on the fly. @@ -607,7 +618,7 @@ interface AdminLoginForm extends forms.AdminLogin{} // merge * @group PocketBase */ declare class AdminLoginForm implements forms.AdminLogin { - constructor(app: core.App) + constructor(app: CoreApp) } interface AdminPasswordResetConfirmForm extends forms.AdminPasswordResetConfirm{} // merge @@ -616,7 +627,7 @@ interface AdminPasswordResetConfirmForm extends forms.AdminPasswordResetConfirm{ * @group PocketBase */ declare class AdminPasswordResetConfirmForm implements forms.AdminPasswordResetConfirm { - constructor(app: core.App) + constructor(app: CoreApp) } interface AdminPasswordResetRequestForm extends forms.AdminPasswordResetRequest{} // merge @@ -625,7 +636,7 @@ interface AdminPasswordResetRequestForm extends forms.AdminPasswordResetRequest{ * @group PocketBase */ declare class AdminPasswordResetRequestForm implements forms.AdminPasswordResetRequest { - constructor(app: core.App) + constructor(app: CoreApp) } interface AdminUpsertForm extends forms.AdminUpsert{} // merge @@ -634,7 +645,7 @@ interface AdminUpsertForm extends forms.AdminUpsert{} // merge * @group PocketBase */ declare class AdminUpsertForm implements forms.AdminUpsert { - constructor(app: core.App, admin: models.Admin) + constructor(app: CoreApp, admin: models.Admin) } interface AppleClientSecretCreateForm extends forms.AppleClientSecretCreate{} // merge @@ -643,7 +654,7 @@ interface AppleClientSecretCreateForm extends forms.AppleClientSecretCreate{} // * @group PocketBase */ declare class AppleClientSecretCreateForm implements forms.AppleClientSecretCreate { - constructor(app: core.App) + constructor(app: CoreApp) } interface CollectionUpsertForm extends forms.CollectionUpsert{} // merge @@ -652,7 +663,7 @@ interface CollectionUpsertForm extends forms.CollectionUpsert{} // merge * @group PocketBase */ declare class CollectionUpsertForm implements forms.CollectionUpsert { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface CollectionsImportForm extends forms.CollectionsImport{} // merge @@ -661,7 +672,7 @@ interface CollectionsImportForm extends forms.CollectionsImport{} // merge * @group PocketBase */ declare class CollectionsImportForm implements forms.CollectionsImport { - constructor(app: core.App) + constructor(app: CoreApp) } interface RealtimeSubscribeForm extends forms.RealtimeSubscribe{} // merge @@ -677,7 +688,7 @@ interface RecordEmailChangeConfirmForm extends forms.RecordEmailChangeConfirm{} * @group PocketBase */ declare class RecordEmailChangeConfirmForm implements forms.RecordEmailChangeConfirm { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordEmailChangeRequestForm extends forms.RecordEmailChangeRequest{} // merge @@ -686,7 +697,7 @@ interface RecordEmailChangeRequestForm extends forms.RecordEmailChangeRequest{} * @group PocketBase */ declare class RecordEmailChangeRequestForm implements forms.RecordEmailChangeRequest { - constructor(app: core.App, record: models.Record) + constructor(app: CoreApp, record: models.Record) } interface RecordOAuth2LoginForm extends forms.RecordOAuth2Login{} // merge @@ -695,7 +706,7 @@ interface RecordOAuth2LoginForm extends forms.RecordOAuth2Login{} // merge * @group PocketBase */ declare class RecordOAuth2LoginForm implements forms.RecordOAuth2Login { - constructor(app: core.App, collection: models.Collection, optAuthRecord?: models.Record) + constructor(app: CoreApp, collection: models.Collection, optAuthRecord?: models.Record) } interface RecordPasswordLoginForm extends forms.RecordPasswordLogin{} // merge @@ -704,7 +715,7 @@ interface RecordPasswordLoginForm extends forms.RecordPasswordLogin{} // merge * @group PocketBase */ declare class RecordPasswordLoginForm implements forms.RecordPasswordLogin { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordPasswordResetConfirmForm extends forms.RecordPasswordResetConfirm{} // merge @@ -713,7 +724,7 @@ interface RecordPasswordResetConfirmForm extends forms.RecordPasswordResetConfir * @group PocketBase */ declare class RecordPasswordResetConfirmForm implements forms.RecordPasswordResetConfirm { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordPasswordResetRequestForm extends forms.RecordPasswordResetRequest{} // merge @@ -722,7 +733,7 @@ interface RecordPasswordResetRequestForm extends forms.RecordPasswordResetReques * @group PocketBase */ declare class RecordPasswordResetRequestForm implements forms.RecordPasswordResetRequest { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordUpsertForm extends forms.RecordUpsert{} // merge @@ -731,7 +742,7 @@ interface RecordUpsertForm extends forms.RecordUpsert{} // merge * @group PocketBase */ declare class RecordUpsertForm implements forms.RecordUpsert { - constructor(app: core.App, record: models.Record) + constructor(app: CoreApp, record: models.Record) } interface RecordVerificationConfirmForm extends forms.RecordVerificationConfirm{} // merge @@ -740,7 +751,7 @@ interface RecordVerificationConfirmForm extends forms.RecordVerificationConfirm{ * @group PocketBase */ declare class RecordVerificationConfirmForm implements forms.RecordVerificationConfirm { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface RecordVerificationRequestForm extends forms.RecordVerificationRequest{} // merge @@ -749,7 +760,7 @@ interface RecordVerificationRequestForm extends forms.RecordVerificationRequest{ * @group PocketBase */ declare class RecordVerificationRequestForm implements forms.RecordVerificationRequest { - constructor(app: core.App, collection: models.Collection) + constructor(app: CoreApp, collection: models.Collection) } interface SettingsUpsertForm extends forms.SettingsUpsert{} // merge @@ -758,7 +769,7 @@ interface SettingsUpsertForm extends forms.SettingsUpsert{} // merge * @group PocketBase */ declare class SettingsUpsertForm implements forms.SettingsUpsert { - constructor(app: core.App) + constructor(app: CoreApp) } interface TestEmailSendForm extends forms.TestEmailSend{} // merge @@ -767,7 +778,7 @@ interface TestEmailSendForm extends forms.TestEmailSend{} // merge * @group PocketBase */ declare class TestEmailSendForm implements forms.TestEmailSend { - constructor(app: core.App) + constructor(app: CoreApp) } interface TestS3FilesystemForm extends forms.TestS3Filesystem{} // merge @@ -776,7 +787,7 @@ interface TestS3FilesystemForm extends forms.TestS3Filesystem{} // merge * @group PocketBase */ declare class TestS3FilesystemForm implements forms.TestS3Filesystem { - constructor(app: core.App) + constructor(app: CoreApp) } // ------------------------------------------------------------------- @@ -981,6 +992,12 @@ func main() { log.Fatal("Failed to get the current docs directory") } + // replace the original app interfaces with their non-"on*"" hooks equivalents + result = strings.ReplaceAll(result, "core.App", "CoreApp") + result = strings.ReplaceAll(result, "pocketbase.PocketBase", "PocketBase") + result = strings.ReplaceAll(result, "ORIGINAL_CORE_APP", "core.App") + result = strings.ReplaceAll(result, "ORIGINAL_POCKETBASE", "pocketbase.PocketBase") + parentDir := filepath.Dir(filename) typesFile := filepath.Join(parentDir, "generated", "types.d.ts")