forked from pocketbase/pocketbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
1191 lines (1083 loc) · 32.7 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package main
import (
"fmt"
"log"
"os"
"path/filepath"
"reflect"
"runtime"
"strings"
"time"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/plugins/jsvm"
"github.com/pocketbase/pocketbase/tools/list"
"github.com/pocketbase/tygoja"
)
const heading = `
// -------------------------------------------------------------------
// cronBinds
// -------------------------------------------------------------------
/**
* CronAdd registers a new cron job.
*
* If a cron job with the specified name already exist, it will be
* replaced with the new one.
*
* Example:
*
* ` + "```" + `js
* // prints "Hello world!" on every 30 minutes
* cronAdd("hello", "*\/30 * * * *", () => {
* console.log("Hello world!")
* })
* ` + "```" + `
*
* _Note that this method is available only in pb_hooks context._
*
* @group PocketBase
*/
declare function cronAdd(
jobId: string,
cronExpr: string,
handler: () => void,
): void;
/**
* CronRemove removes a single registered cron job by its name.
*
* Example:
*
* ` + "```" + `js
* cronRemove("hello")
* ` + "```" + `
*
* _Note that this method is available only in pb_hooks context._
*
* @group PocketBase
*/
declare function cronRemove(jobId: string): void;
// -------------------------------------------------------------------
// routerBinds
// -------------------------------------------------------------------
/**
* RouterAdd registers a new route definition.
*
* Example:
*
* ` + "```" + `js
* routerAdd("GET", "/hello", (c) => {
* return c.json(200, {"message": "Hello!"})
* }, $apis.requireAdminOrRecordAuth())
* ` + "```" + `
*
* _Note that this method is available only in pb_hooks context._
*
* @group PocketBase
*/
declare function routerAdd(
method: string,
path: string,
handler: echo.HandlerFunc,
...middlewares: Array<string|echo.MiddlewareFunc>,
): void;
/**
* RouterUse registers one or more global middlewares that are executed
* along the handler middlewares after a matching route is found.
*
* Example:
*
* ` + "```" + `js
* routerUse((next) => {
* return (c) => {
* console.log(c.path())
* return next(c)
* }
* })
* ` + "```" + `
*
* _Note that this method is available only in pb_hooks context._
*
* @group PocketBase
*/
declare function routerUse(...middlewares: Array<string|echo.MiddlewareFunc>): void;
/**
* RouterPre registers one or more global middlewares that are executed
* BEFORE the router processes the request. It is usually used for making
* changes to the request properties, for example, adding or removing
* a trailing slash or adding segments to a path so it matches a route.
*
* NB! Since the router will not have processed the request yet,
* middlewares registered at this level won't have access to any path
* related APIs from echo.Context.
*
* Example:
*
* ` + "```" + `js
* routerPre((next) => {
* return (c) => {
* console.log(c.request().url)
* return next(c)
* }
* })
* ` + "```" + `
*
* _Note that this method is available only in pb_hooks context._
*
* @group PocketBase
*/
declare function routerPre(...middlewares: Array<string|echo.MiddlewareFunc>): void;
// -------------------------------------------------------------------
// baseBinds
// -------------------------------------------------------------------
/**
* Global helper variable that contains the absolute path to the app pb_hooks directory.
*
* @group PocketBase
*/
declare var __hooks: string
// 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<Type> = {
[Property in keyof Type as Exclude<Property, ` + "`on${string}`" + `>]: Type[Property]
};
// core.App without the on* hook methods
type CoreApp = excludeHooks<ORIGINAL_CORE_APP>
// pocketbase.PocketBase without the on* hook methods
type PocketBase = excludeHooks<ORIGINAL_POCKETBASE>
/**
* ` + "`$app`" + ` is the current running PocketBase instance that is globally
* available in each .pb.js file.
*
* _Note that this variable is available only in pb_hooks context._
*
* @namespace
* @group PocketBase
*/
declare var $app: PocketBase
/**
* ` + "`$template`" + ` is a global helper to load and cache HTML templates on the fly.
*
* The templates uses the standard Go [html/template](https://pkg.go.dev/html/template)
* and [text/template](https://pkg.go.dev/text/template) package syntax.
*
* Example:
*
* ` + "```" + `js
* const html = $template.loadFiles(
* "views/layout.html",
* "views/content.html",
* ).render({"name": "John"})
* ` + "```" + `
*
* _Note that this method is available only in pb_hooks context._
*
* @namespace
* @group PocketBase
*/
declare var $template: template.Registry
/**
* readerToString reads the content of the specified io.Reader until
* EOF or maxBytes are reached.
*
* If maxBytes is not specified it will read up to 32MB.
*
* Note that after this call the reader can't be used anymore.
*
* Example:
*
* ` + "```" + `js
* const rawBody = readerToString(c.request().body)
* ` + "```" + `
*
* @group PocketBase
*/
declare function readerToString(reader: any, maxBytes?: number): string;
/**
* sleep pauses the current goroutine for at least the specified user duration (in ms).
* A zero or negative duration returns immediately.
*
* Example:
*
* ` + "```" + `js
* sleep(250) // sleeps for 250ms
* ` + "```" + `
*
* @group PocketBase
*/
declare function sleep(milliseconds: number): void;
/**
* arrayOf creates a placeholder array of the specified models.
* Usually used to populate DB result into an array of models.
*
* Example:
*
* ` + "```" + `js
* const records = arrayOf(new Record)
*
* $app.dao().recordQuery("articles").limit(10).all(records)
* ` + "```" + `
*
* @group PocketBase
*/
declare function arrayOf<T>(model: T): Array<T>;
/**
* DynamicModel creates a new dynamic model with fields from the provided data shape.
*
* Example:
*
* ` + "```" + `js
* const model = new DynamicModel({
* name: ""
* age: 0,
* active: false,
* roles: [],
* meta: {}
* })
* ` + "```" + `
*
* @group PocketBase
*/
declare class DynamicModel {
constructor(shape?: { [key:string]: any })
}
/**
* Record model class.
*
* ` + "```" + `js
* const collection = $app.dao().findCollectionByNameOrId("article")
*
* const record = new Record(collection, {
* title: "Lorem ipsum"
* })
*
* // or set field values after the initialization
* record.set("description", "...")
* ` + "```" + `
*
* @group PocketBase
*/
declare const Record: {
new(collection?: models.Collection, data?: { [key:string]: any }): models.Record
// note: declare as "newable" const due to conflict with the Record TS utility type
}
interface Collection extends models.Collection{} // merge
/**
* Collection model class.
*
* ` + "```" + `js
* const collection = new Collection({
* name: "article",
* type: "base",
* listRule: "@request.auth.id != '' || status = 'public'",
* viewRule: "@request.auth.id != '' || status = 'public'",
* deleteRule: "@request.auth.id != ''",
* schema: [
* {
* name: "title",
* type: "text",
* required: true,
* options: { min: 6, max: 100 },
* },
* {
* name: "description",
* type: "text",
* },
* ]
* })
* ` + "```" + `
*
* @group PocketBase
*/
declare class Collection implements models.Collection {
constructor(data?: Partial<models.Collection>)
}
interface Admin extends models.Admin{} // merge
/**
* Admin model class.
*
* ` + "```" + `js
* const admin = new Admin()
* admin.email = "test@example.com"
* admin.setPassword(1234567890)
* ` + "```" + `
*
* @group PocketBase
*/
declare class Admin implements models.Admin {
constructor(data?: Partial<models.Admin>)
}
interface Schema extends schema.Schema{} // merge
/**
* Schema model class, usually used to define the Collection.schema field.
*
* @group PocketBase
*/
declare class Schema implements schema.Schema {
constructor(data?: Partial<schema.Schema>)
}
interface SchemaField extends schema.SchemaField{} // merge
/**
* SchemaField model class, usually used as part of the Schema model.
*
* @group PocketBase
*/
declare class SchemaField implements schema.SchemaField {
constructor(data?: Partial<schema.SchemaField>)
}
interface MailerMessage extends mailer.Message{} // merge
/**
* MailerMessage defines a single email message.
*
* ` + "```" + `js
* const message = new MailerMessage({
* from: {
* address: $app.settings().meta.senderAddress,
* name: $app.settings().meta.senderName,
* },
* to: [{address: "test@example.com"}],
* subject: "YOUR_SUBJECT...",
* html: "YOUR_HTML_BODY...",
* })
*
* $app.newMailClient().send(message)
* ` + "```" + `
*
* @group PocketBase
*/
declare class MailerMessage implements mailer.Message {
constructor(message?: Partial<mailer.Message>)
}
interface Command extends cobra.Command{} // merge
/**
* Command defines a single console command.
*
* Example:
*
* ` + "```" + `js
* const command = new Command({
* use: "hello",
* run: (cmd, args) => { console.log("Hello world!") },
* })
*
* $app.rootCmd.addCommand(command);
* ` + "```" + `
*
* @group PocketBase
*/
declare class Command implements cobra.Command {
constructor(cmd?: Partial<cobra.Command>)
}
interface RequestInfo extends models.RequestInfo{} // merge
/**
* RequestInfo defines a single models.RequestInfo instance, usually used
* as part of various filter checks.
*
* Example:
*
* ` + "```" + `js
* const authRecord = $app.dao().findAuthRecordByEmail("users", "test@example.com")
*
* const info = new RequestInfo({
* authRecord: authRecord,
* data: {"name": 123},
* headers: {"x-token": "..."},
* })
*
* const record = $app.dao().findFirstRecordByData("articles", "slug", "hello")
*
* const canAccess = $app.dao().canAccessRecord(record, info, "@request.auth.id != '' && @request.data.name = 123")
* ` + "```" + `
*
* @group PocketBase
*/
declare class RequestInfo implements models.RequestInfo {
constructor(date?: Partial<models.RequestInfo>)
}
interface DateTime extends types.DateTime{} // merge
/**
* DateTime defines a single DateTime type instance.
*
* Example:
*
* ` + "```" + `js
* const dt0 = new DateTime() // now
*
* const dt1 = new DateTime('2023-07-01 00:00:00.000Z')
* ` + "```" + `
*
* @group PocketBase
*/
declare class DateTime implements types.DateTime {
constructor(date?: string)
}
interface ValidationError extends ozzo_validation.Error{} // merge
/**
* ValidationError defines a single formatted data validation error,
* usually used as part of an error response.
*
* ` + "```" + `js
* new ValidationError("invalid_title", "Title is not valid")
* ` + "```" + `
*
* @group PocketBase
*/
declare class ValidationError implements ozzo_validation.Error {
constructor(code?: string, message?: string)
}
interface Dao extends daos.Dao{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class Dao implements daos.Dao {
constructor(concurrentDB?: dbx.Builder, nonconcurrentDB?: dbx.Builder)
}
interface Cookie extends http.Cookie{} // merge
/**
* A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an
* HTTP response.
*
* Example:
*
* ` + "```" + `js
* routerAdd("POST", "/example", (c) => {
* c.setCookie(new Cookie({
* name: "example_name",
* value: "example_value",
* path: "/",
* domain: "example.com",
* maxAge: 10,
* secure: true,
* httpOnly: true,
* sameSite: 3,
* }))
*
* return c.redirect(200, "/");
* })
* ` + "```" + `
*
* @group PocketBase
*/
declare class Cookie implements http.Cookie {
constructor(options?: Partial<http.Cookie>)
}
interface SubscriptionMessage extends subscriptions.Message{} // merge
/**
* SubscriptionMessage defines a realtime subscription payload.
*
* Example:
*
* ` + "```" + `js
* onRealtimeConnectRequest((e) => {
* e.client.send(new SubscriptionMessage({
* name: "example",
* data: '{"greeting": "Hello world"}'
* }))
* })
* ` + "```" + `
*
* @group PocketBase
*/
declare class SubscriptionMessage implements subscriptions.Message {
constructor(options?: Partial<subscriptions.Message>)
}
// -------------------------------------------------------------------
// dbxBinds
// -------------------------------------------------------------------
/**
* ` + "`$dbx`" + ` defines common utility for working with the DB abstraction.
* For examples and guides please check the [Database guide](https://pocketbase.io/docs/js-database).
*
* @group PocketBase
*/
declare namespace $dbx {
/**
* {@inheritDoc dbx.HashExp}
*/
export function hashExp(pairs: { [key:string]: any }): dbx.Expression
let _in: dbx._in
export { _in as in }
export let exp: dbx.newExp
export let not: dbx.not
export let and: dbx.and
export let or: dbx.or
export let notIn: dbx.notIn
export let like: dbx.like
export let orLike: dbx.orLike
export let notLike: dbx.notLike
export let orNotLike: dbx.orNotLike
export let exists: dbx.exists
export let notExists: dbx.notExists
export let between: dbx.between
export let notBetween: dbx.notBetween
}
// -------------------------------------------------------------------
// tokensBinds
// -------------------------------------------------------------------
/**
* ` + "`" + `$tokens` + "`" + ` defines high level helpers to generate
* various admins and auth records tokens (auth, forgotten password, etc.).
*
* For more control over the generated token, you can check ` + "`" + `$security` + "`" + `.
*
* @group PocketBase
*/
declare namespace $tokens {
let adminAuthToken: tokens.newAdminAuthToken
let adminResetPasswordToken: tokens.newAdminResetPasswordToken
let adminFileToken: tokens.newAdminFileToken
let recordAuthToken: tokens.newRecordAuthToken
let recordVerifyToken: tokens.newRecordVerifyToken
let recordResetPasswordToken: tokens.newRecordResetPasswordToken
let recordChangeEmailToken: tokens.newRecordChangeEmailToken
let recordFileToken: tokens.newRecordFileToken
}
// -------------------------------------------------------------------
// mailsBinds
// -------------------------------------------------------------------
/**
* ` + "`" + `$mails` + "`" + ` defines helpers to send common
* admins and auth records emails like verification, password reset, etc.
*
* @group PocketBase
*/
declare namespace $mails {
let sendAdminPasswordReset: mails.sendAdminPasswordReset
let sendRecordPasswordReset: mails.sendRecordPasswordReset
let sendRecordVerification: mails.sendRecordVerification
let sendRecordChangeEmail: mails.sendRecordChangeEmail
}
// -------------------------------------------------------------------
// securityBinds
// -------------------------------------------------------------------
/**
* ` + "`" + `$security` + "`" + ` defines low level helpers for creating
* and parsing JWTs, random string generation, AES encryption, etc.
*
* @group PocketBase
*/
declare namespace $security {
let randomString: security.randomString
let randomStringWithAlphabet: security.randomStringWithAlphabet
let pseudorandomString: security.pseudorandomString
let pseudorandomStringWithAlphabet: security.pseudorandomStringWithAlphabet
let encrypt: security.encrypt
let decrypt: security.decrypt
let hs256: security.hs256
let hs512: security.hs512
let equal: security.equal
let md5: security.md5
let sha256: security.sha256
let sha512: security.sha512
let createJWT: security.newJWT
/**
* {@inheritDoc security.parseUnverifiedJWT}
*/
export function parseUnverifiedJWT(token: string): _TygojaDict
/**
* {@inheritDoc security.parseJWT}
*/
export function parseJWT(token: string, verificationKey: string): _TygojaDict
}
// -------------------------------------------------------------------
// filesystemBinds
// -------------------------------------------------------------------
/**
* ` + "`" + `$filesystem` + "`" + ` defines common helpers for working
* with the PocketBase filesystem abstraction.
*
* @group PocketBase
*/
declare namespace $filesystem {
let fileFromPath: filesystem.newFileFromPath
let fileFromBytes: filesystem.newFileFromBytes
let fileFromMultipart: filesystem.newFileFromMultipart
/**
* fileFromUrl creates a new File from the provided url by
* downloading the resource and creating a BytesReader.
*
* Example:
*
* ` + "```" + `js
* // with default max timeout of 120sec
* const file1 = $filesystem.fileFromUrl("https://...")
*
* // with custom timeout of 15sec
* const file2 = $filesystem.fileFromUrl("https://...", 15)
* ` + "```" + `
*/
export function fileFromUrl(url: string, secTimeout?: number): filesystem.File
}
// -------------------------------------------------------------------
// filepathBinds
// -------------------------------------------------------------------
/**
* ` + "`$filepath`" + ` defines common helpers for manipulating filename
* paths in a way compatible with the target operating system-defined file paths.
*
* @group PocketBase
*/
declare namespace $filepath {
export let base: filepath.base
export let clean: filepath.clean
export let dir: filepath.dir
export let ext: filepath.ext
export let fromSlash: filepath.fromSlash
export let glob: filepath.glob
export let isAbs: filepath.isAbs
export let join: filepath.join
export let match: filepath.match
export let rel: filepath.rel
export let split: filepath.split
export let splitList: filepath.splitList
export let toSlash: filepath.toSlash
export let walk: filepath.walk
export let walkDir: filepath.walkDir
}
// -------------------------------------------------------------------
// osBinds
// -------------------------------------------------------------------
/**
* ` + "`$os`" + ` defines common helpers for working with the OS level primitives
* (eg. deleting directories, executing shell commands, etc.).
*
* @group PocketBase
*/
declare namespace $os {
/**
* Legacy alias for $os.cmd().
*/
export let exec: exec.command
/**
* Prepares an external OS command.
*
* Example:
*
* ` + "```" + `js
* // prepare the command to execute
* const cmd = $os.cmd('ls', '-sl')
*
* // execute the command and return its standard output as string
* const output = String.fromCharCode(...cmd.output());
* ` + "```" + `
*/
export let cmd: exec.command
export let args: os.args
export let exit: os.exit
export let getenv: os.getenv
export let dirFS: os.dirFS
export let readFile: os.readFile
export let writeFile: os.writeFile
export let readDir: os.readDir
export let tempDir: os.tempDir
export let truncate: os.truncate
export let getwd: os.getwd
export let mkdir: os.mkdir
export let mkdirAll: os.mkdirAll
export let rename: os.rename
export let remove: os.remove
export let removeAll: os.removeAll
}
// -------------------------------------------------------------------
// formsBinds
// -------------------------------------------------------------------
interface AdminLoginForm extends forms.AdminLogin{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class AdminLoginForm implements forms.AdminLogin {
constructor(app: CoreApp)
}
interface AdminPasswordResetConfirmForm extends forms.AdminPasswordResetConfirm{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class AdminPasswordResetConfirmForm implements forms.AdminPasswordResetConfirm {
constructor(app: CoreApp)
}
interface AdminPasswordResetRequestForm extends forms.AdminPasswordResetRequest{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class AdminPasswordResetRequestForm implements forms.AdminPasswordResetRequest {
constructor(app: CoreApp)
}
interface AdminUpsertForm extends forms.AdminUpsert{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class AdminUpsertForm implements forms.AdminUpsert {
constructor(app: CoreApp, admin: models.Admin)
}
interface AppleClientSecretCreateForm extends forms.AppleClientSecretCreate{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class AppleClientSecretCreateForm implements forms.AppleClientSecretCreate {
constructor(app: CoreApp)
}
interface CollectionUpsertForm extends forms.CollectionUpsert{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class CollectionUpsertForm implements forms.CollectionUpsert {
constructor(app: CoreApp, collection: models.Collection)
}
interface CollectionsImportForm extends forms.CollectionsImport{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class CollectionsImportForm implements forms.CollectionsImport {
constructor(app: CoreApp)
}
interface RealtimeSubscribeForm extends forms.RealtimeSubscribe{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RealtimeSubscribeForm implements forms.RealtimeSubscribe {}
interface RecordEmailChangeConfirmForm extends forms.RecordEmailChangeConfirm{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RecordEmailChangeConfirmForm implements forms.RecordEmailChangeConfirm {
constructor(app: CoreApp, collection: models.Collection)
}
interface RecordEmailChangeRequestForm extends forms.RecordEmailChangeRequest{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RecordEmailChangeRequestForm implements forms.RecordEmailChangeRequest {
constructor(app: CoreApp, record: models.Record)
}
interface RecordOAuth2LoginForm extends forms.RecordOAuth2Login{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RecordOAuth2LoginForm implements forms.RecordOAuth2Login {
constructor(app: CoreApp, collection: models.Collection, optAuthRecord?: models.Record)
}
interface RecordPasswordLoginForm extends forms.RecordPasswordLogin{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RecordPasswordLoginForm implements forms.RecordPasswordLogin {
constructor(app: CoreApp, collection: models.Collection)
}
interface RecordPasswordResetConfirmForm extends forms.RecordPasswordResetConfirm{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RecordPasswordResetConfirmForm implements forms.RecordPasswordResetConfirm {
constructor(app: CoreApp, collection: models.Collection)
}
interface RecordPasswordResetRequestForm extends forms.RecordPasswordResetRequest{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RecordPasswordResetRequestForm implements forms.RecordPasswordResetRequest {
constructor(app: CoreApp, collection: models.Collection)
}
interface RecordUpsertForm extends forms.RecordUpsert{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RecordUpsertForm implements forms.RecordUpsert {
constructor(app: CoreApp, record: models.Record)
}
interface RecordVerificationConfirmForm extends forms.RecordVerificationConfirm{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RecordVerificationConfirmForm implements forms.RecordVerificationConfirm {
constructor(app: CoreApp, collection: models.Collection)
}
interface RecordVerificationRequestForm extends forms.RecordVerificationRequest{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class RecordVerificationRequestForm implements forms.RecordVerificationRequest {
constructor(app: CoreApp, collection: models.Collection)
}
interface SettingsUpsertForm extends forms.SettingsUpsert{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class SettingsUpsertForm implements forms.SettingsUpsert {
constructor(app: CoreApp)
}
interface TestEmailSendForm extends forms.TestEmailSend{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class TestEmailSendForm implements forms.TestEmailSend {
constructor(app: CoreApp)
}
interface TestS3FilesystemForm extends forms.TestS3Filesystem{} // merge
/**
* @inheritDoc
* @group PocketBase
*/
declare class TestS3FilesystemForm implements forms.TestS3Filesystem {
constructor(app: CoreApp)
}
// -------------------------------------------------------------------
// apisBinds
// -------------------------------------------------------------------
interface ApiError extends apis.ApiError{} // merge
/**
* @inheritDoc
*
* @group PocketBase
*/
declare class ApiError implements apis.ApiError {
constructor(status?: number, message?: string, data?: any)
}
interface NotFoundError extends apis.ApiError{} // merge
/**
* NotFounderor returns 404 ApiError.
*
* @group PocketBase
*/
declare class NotFoundError implements apis.ApiError {
constructor(message?: string, data?: any)
}
interface BadRequestError extends apis.ApiError{} // merge
/**
* BadRequestError returns 400 ApiError.
*
* @group PocketBase
*/
declare class BadRequestError implements apis.ApiError {
constructor(message?: string, data?: any)
}
interface ForbiddenError extends apis.ApiError{} // merge
/**
* ForbiddenError returns 403 ApiError.
*
* @group PocketBase
*/
declare class ForbiddenError implements apis.ApiError {
constructor(message?: string, data?: any)
}
interface UnauthorizedError extends apis.ApiError{} // merge
/**
* UnauthorizedError returns 401 ApiError.
*
* @group PocketBase
*/
declare class UnauthorizedError implements apis.ApiError {
constructor(message?: string, data?: any)
}
/**
* ` + "`" + `$apis` + "`" + ` defines commonly used PocketBase api helpers and middlewares.
*
* @group PocketBase
*/
declare namespace $apis {
/**
* Route handler to serve static directory content (html, js, css, etc.).
*
* If a file resource is missing and indexFallback is set, the request
* will be forwarded to the base index.html (useful for SPA).
*/
export function staticDirectoryHandler(dir: string, indexFallback: boolean): echo.HandlerFunc
let requireGuestOnly: apis.requireGuestOnly
let requireRecordAuth: apis.requireRecordAuth
let requireAdminAuth: apis.requireAdminAuth
let requireAdminAuthOnlyIfAny: apis.requireAdminAuthOnlyIfAny
let requireAdminOrRecordAuth: apis.requireAdminOrRecordAuth
let requireAdminOrOwnerAuth: apis.requireAdminOrOwnerAuth
let activityLogger: apis.activityLogger
let requestInfo: apis.requestInfo
let recordAuthResponse: apis.recordAuthResponse
let gzip: middleware.gzip
let bodyLimit: middleware.bodyLimit
let enrichRecord: apis.enrichRecord
let enrichRecords: apis.enrichRecords