@protobase/cli 0.49.0 → 0.49.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/package.js +1 -1
- package/dist/config/build-project.js +18 -8
- package/dist/config/config-defaults.js +3 -0
- package/dist/config/read-config.js +5 -1
- package/dist/db/read-only-db.js +1 -1
- package/dist/dev/dev-jobs.js +5 -3
- package/dist/dev/entry.js +3 -3
- package/dist/migration/load-project.js +1 -1
- package/dist/project/load-bundle-project.js +1 -1
- package/dist/project-auth.d.ts +2 -0
- package/dist/project-auth.js +2 -0
- package/dist/serve/app.js +1 -1
- package/dist/serve/create-admin.js +1 -1
- package/dist/serve/host-modules.js +3 -3
- package/dist/serve/lifecycle.js +4 -3
- package/dist/supabase/load-phase.js +1 -1
- package/dist/users/load-auth.d.ts +10 -0
- package/dist/users/load-auth.js +1 -1
- package/dist/worker/start-worker.js +3 -2
- package/package.json +8 -7
- package/skills/protobase/SKILL.md +7 -1
- package/skills/protobase/references/features/events-webhooks-and-jobs.md +1 -0
- package/skills/protobase/references/features/files-and-images.md +1 -0
- package/skills/protobase/references/features/sign-in-and-accounts.md +3 -0
- package/skills/protobase/references/features/start-a-project.md +7 -1
- package/skills/protobase/references/getting-started.md +13 -13
- package/skills/protobase/references/guides/deploy.md +2 -2
- package/skills/protobase/references/guides/export-a-list.md +1 -1
- package/skills/protobase/references/guides/field-type.md +1 -1
- package/skills/protobase/references/guides/first-composed-page.md +1 -1
- package/skills/protobase/references/guides/first-plugin.md +1 -1
- package/skills/protobase/references/guides/import-records.md +1 -1
- package/skills/protobase/references/guides/personal-setting.md +1 -1
- package/skills/protobase/references/guides/push-notifications.md +1 -1
- package/skills/protobase/references/guides/record-card.md +1 -1
- package/skills/protobase/references/guides/remote-resources.md +1 -1
- package/skills/protobase/references/guides/theme-an-app.md +1 -1
- package/skills/protobase/references/reference/api.md +1 -1
- package/skills/protobase/references/reference/architecture.md +4 -4
- package/skills/protobase/references/reference/auth.md +36 -4
- package/skills/protobase/references/reference/blocks.md +1 -1
- package/skills/protobase/references/reference/bottom-bar.md +1 -1
- package/skills/protobase/references/reference/cli.md +10 -10
- package/skills/protobase/references/reference/client.md +2 -2
- package/skills/protobase/references/reference/config/admin-app.md +62 -0
- package/skills/protobase/references/reference/config/api.md +164 -0
- package/skills/protobase/references/reference/config/app.md +112 -0
- package/skills/protobase/references/reference/config/files.md +99 -0
- package/skills/protobase/references/reference/config/jobs-and-events.md +267 -0
- package/skills/protobase/references/reference/config/sign-in.md +396 -0
- package/skills/protobase/references/reference/config.md +89 -70
- package/skills/protobase/references/reference/custom-components.md +2 -2
- package/skills/protobase/references/reference/data-config.md +2 -2
- package/skills/protobase/references/reference/email.md +2 -2
- package/skills/protobase/references/reference/files.md +6 -3
- package/skills/protobase/references/reference/jobs.md +15 -6
- package/skills/protobase/references/reference/sidebar.md +2 -2
- package/skills/protobase/references/reference/ui-config.md +5 -5
- package/skills/protobase/references/reference/user-menu.md +1 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<!-- Generated by scripts/protobase-skill.ts from website/src/content/docs/reference/config/app.md: run `bun run docs:skill`, do not edit. -->
|
|
2
|
+
|
|
3
|
+
# App options
|
|
4
|
+
|
|
5
|
+
The config keys of the app itself, its name, public URL, secret, language, time zone, install colours and mobile build, with their types, defaults and environment variables.
|
|
6
|
+
|
|
7
|
+
The keys of the app itself, at the top level of [`protobase.config.ts`](../config.md).
|
|
8
|
+
|
|
9
|
+
## name
|
|
10
|
+
|
|
11
|
+
- **Type:** `string`
|
|
12
|
+
- **Default:** `Protobase`
|
|
13
|
+
- **Environment variable:** `PROTOBASE_APP_NAME`, which overrides it
|
|
14
|
+
|
|
15
|
+
The app's name: sign-in prompts and passkeys show it, the mail it sends names the app with it and is sent as it, and the sidebar, the browser tabs and the [installed app](../installable-app.md) are called by it. A deployment renames the app with `PROTOBASE_APP_NAME`, which wins over the config. See [App identity](../app-identity.md#the-name).
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
export default defineConfig({ name: 'Property Finder' })
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## url
|
|
22
|
+
|
|
23
|
+
- **Type:** `string`
|
|
24
|
+
- **Default:** `PROTOBASE_URL`; in `protobase dev`, the dev server's own address
|
|
25
|
+
- **Environment variable:** `PROTOBASE_URL`
|
|
26
|
+
|
|
27
|
+
The app's public URL: the issuer and audience of its tokens, and where its emails link to. Sign-in needs it: with `auth` on, `protobase dev`, `serve` and the commands that sign people in stop with a clear message when it is missing. Other origins the app is served on are [`auth.origins`](sign-in.md#authorigins).
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
export default defineConfig({ url: 'https://admin.example.com' })
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## secret
|
|
34
|
+
|
|
35
|
+
- **Type:** `string`
|
|
36
|
+
- **Default:** `PROTOBASE_SECRET`
|
|
37
|
+
- **Environment variable:** `PROTOBASE_SECRET`
|
|
38
|
+
|
|
39
|
+
The app's secret, made with `openssl rand -base64 32`: it signs session cookies, upload tickets, download links and public forms' bot checks, and encrypts the token signing keys. Sign-in needs it, and file fields too unless [`files.secret`](files.md#filessecret) names another. Keep it out of the config's source and read it from the environment, which the default does.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
export default defineConfig(({ env }) => ({ secret: env.ADMIN_SECRET }))
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## previousSecrets
|
|
46
|
+
|
|
47
|
+
- **Type:** `string[]`
|
|
48
|
+
- **Default:** `PROTOBASE_PREVIOUS_SECRETS`, comma separated; none
|
|
49
|
+
- **Environment variable:** `PROTOBASE_PREVIOUS_SECRETS`
|
|
50
|
+
|
|
51
|
+
The app's secrets before `secret`, newest first. The app encrypts with `secret` and still decrypts what these encrypted, so after the secret changes the token signing keys keep signing and the tokens in flight keep verifying. Keep an old secret listed until the keys it encrypted have rotated out ([`signingKeyDays`](sign-in.md#signingkeydays)), and while authenticator apps set up before the change are in use. See [Changing the secret](../auth.md#changing-the-secret).
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
export default defineConfig(({ env }) => ({ secret: env.ADMIN_SECRET, previousSecrets: [env.OLD_ADMIN_SECRET] }))
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## locale
|
|
58
|
+
|
|
59
|
+
- **Type:** `'en' | 'nl'`
|
|
60
|
+
- **Default:** each user's browser's language, when the screens come in it; English otherwise
|
|
61
|
+
|
|
62
|
+
The language of the admin app's built-in screens and of its numbers and dates, for every user. Any other value stops the app at start. See [Languages](../languages.md).
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
export default defineConfig({ locale: 'nl' })
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## timezone
|
|
69
|
+
|
|
70
|
+
- **Type:** `string`
|
|
71
|
+
- **Default:** `UTC`
|
|
72
|
+
|
|
73
|
+
The time zone the jobs' schedules are read in, such as `Europe/Amsterdam`, unless a job names its own [`timezone`](jobs-and-events.md#jobs). See [Recurring jobs](../jobs.md#recurring-jobs).
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
export default defineConfig({ timezone: 'Europe/Amsterdam' })
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## themeColor
|
|
80
|
+
|
|
81
|
+
- **Type:** `string`, any CSS colour
|
|
82
|
+
|
|
83
|
+
The colour of the installed app's title bar and of the browser's toolbar around it, the web manifest's `theme_color`. See [App identity](../app-identity.md#the-colours).
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
export default defineConfig({ themeColor: '#0d9488' })
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## backgroundColor
|
|
90
|
+
|
|
91
|
+
- **Type:** `string`, any CSS colour
|
|
92
|
+
|
|
93
|
+
The colour of the screen the installed app shows while it starts, the web manifest's `background_color`.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
export default defineConfig({ backgroundColor: '#ffffff' })
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## mobile
|
|
100
|
+
|
|
101
|
+
- **Type:** `{ appId: string; plugins?: Record<string, string> }`
|
|
102
|
+
|
|
103
|
+
The app's iOS and Android build: with it, `protobase mobile` builds the app with Capacitor, and the API also allows the app's Capacitor origins (`capacitor://localhost`, `https://localhost`) for [CORS](api.md#cors). See [A mobile app](../../guides/mobile-app.md).
|
|
104
|
+
|
|
105
|
+
- `appId`: the app's id on both iOS and Android, such as `com.example.shop`: two or more dot-separated parts, each a letter then letters and digits.
|
|
106
|
+
- `plugins`: extra native Capacitor plugins, by npm name and version range. A range fetched over plain `http:` or `git:` is refused.
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
export default defineConfig({
|
|
110
|
+
mobile: { appId: 'com.example.shop', plugins: { '@capacitor/camera': '^8.0.0' } },
|
|
111
|
+
})
|
|
112
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<!-- Generated by scripts/protobase-skill.ts from website/src/content/docs/reference/config/files.md: run `bun run docs:skill`, do not edit. -->
|
|
2
|
+
|
|
3
|
+
# Files options
|
|
4
|
+
|
|
5
|
+
The config key files, where file fields keep their bytes, with each provider kind, retention, signing, trusted hosts, the Storage API and the image library, their types, defaults and environment variables.
|
|
6
|
+
|
|
7
|
+
The `files` key of [`protobase.config.ts`](../config.md): where [file fields](../files.md) keep their bytes, and how. Every key is optional; without `files`, the providers a field names default to folders under `data/files`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
files: {
|
|
12
|
+
providers: {
|
|
13
|
+
private: { kind: 'local', dir: 'data/files/private' },
|
|
14
|
+
public: { kind: 's3', bucket: 'shop-media', endpoint: 'https://<account>.eu.r2.cloudflarestorage.com', region: 'auto', public: true, publicUrl: 'https://media.shop.com' },
|
|
15
|
+
},
|
|
16
|
+
retention: '7 days',
|
|
17
|
+
images: 'sharp',
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## files.providers
|
|
23
|
+
|
|
24
|
+
- **Type:** `Record<string, LocalProvider | S3Provider | { kind: 'custom' }>`
|
|
25
|
+
- **Default:** `private` and `public`, the folders `data/files/private` and `data/files/public`, when a field names them
|
|
26
|
+
- **Environment variable:** `PROTOBASE_FILES_<NAME>`, which replaces the provider of that name, or adds one
|
|
27
|
+
|
|
28
|
+
The providers by name. A name is part of every stored value, so name the role (`archive`), not the vendor. A field that names a provider the app does not have stops it at start. See [Providers](../files.md#providers).
|
|
29
|
+
|
|
30
|
+
- `{ kind: 'local', dir, public?, publicUrl?, retention?, maxBytes?, maxFiles? }`: a folder on local disk, relative to the working directory and created when missing.
|
|
31
|
+
- `{ kind: 's3', bucket, prefix?, endpoint?, region?, accessKeyId?, secretAccessKey?, public?, publicUrl?, retention?, maxBytes?, maxFiles? }`: an S3-compatible bucket. `endpoint` defaults to AWS; the credentials default to `S3_ACCESS_KEY_ID` and `S3_SECRET_ACCESS_KEY`, then `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`. See [S3-compatible buckets](../files.md#s3-compatible-buckets).
|
|
32
|
+
- `{ kind: 'custom' }`: a `FileProvider` of the project's own, the default export of `files/<name>.ts`; a custom provider without its file stops the app at start.
|
|
33
|
+
|
|
34
|
+
For each of the first two, `public` serves files to anyone with the link, without a signature, `publicUrl` is where public files are linked from instead of the app's own `/api/files/<provider>`, such as a CDN, `retention` overrides [`files.retention`](#filesretention), and `maxBytes` (such as `'1 GB'`) and `maxFiles` cap what the provider holds. See [Limits](../files.md#limits).
|
|
35
|
+
|
|
36
|
+
`PROTOBASE_FILES_<NAME>` describes a provider as a URL, such as `PROTOBASE_FILES_ARCHIVE=s3://bucket/prefix?endpoint=…®ion=auto` or `file:///data/files/private?public=1`, with its credentials in `PROTOBASE_FILES_<NAME>_ACCESS_KEY_ID` and `PROTOBASE_FILES_<NAME>_SECRET_ACCESS_KEY`. `RETENTION`, `SECRET` and `CLEANUP_MINUTES` are settings, never provider names.
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
export default defineConfig({
|
|
40
|
+
files: { providers: { archive: { kind: 's3', bucket: 'archive', prefix: 'invoices' }, scans: { kind: 'custom' } } },
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## files.retention
|
|
45
|
+
|
|
46
|
+
- **Type:** `number | string`
|
|
47
|
+
- **Default:** `1 day`; `0` for a public provider
|
|
48
|
+
- **Environment variable:** `PROTOBASE_FILES_RETENTION`, which overrides it
|
|
49
|
+
|
|
50
|
+
How long bytes outlive their last reference, so a restore of the database to an earlier moment still finds its files: milliseconds, or text such as `14 days`. A provider's own `retention` wins over it. See [Deleting files](../files.md#deleting-files).
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
export default defineConfig({ files: { retention: '14 days' } })
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## files.secret
|
|
57
|
+
|
|
58
|
+
- **Type:** `string`
|
|
59
|
+
- **Default:** `PROTOBASE_FILES_SECRET`, else the app's [`secret`](app.md#secret)
|
|
60
|
+
- **Environment variable:** `PROTOBASE_FILES_SECRET`
|
|
61
|
+
|
|
62
|
+
Signs upload tickets and download links. The app does not start with file fields and no secret.
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
export default defineConfig(({ env }) => ({ files: { secret: env.FILES_SECRET } }))
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## files.trustedHosts
|
|
69
|
+
|
|
70
|
+
- **Type:** `string[]`
|
|
71
|
+
- **Default:** none
|
|
72
|
+
|
|
73
|
+
Hosts whose images the admin app draws with the page's referrer, besides the app's own and those its providers link public files from. Images from any other host load with `referrerPolicy="no-referrer"`. See [Image referrers](../files.md#image-referrers).
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
export default defineConfig({ files: { trustedHosts: ['images.example.com'] } })
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## files.storage
|
|
80
|
+
|
|
81
|
+
- **Type:** `{ provider?: string; maxFileSize?: number | string } | false`
|
|
82
|
+
- **Default:** `{ provider: 'private', maxFileSize: '50 MB' }`
|
|
83
|
+
|
|
84
|
+
Where `supabase.storage` keeps the bytes of its objects, which the app serves at `/api/sb/storage/v1` when it has an [API key](api.md#apikeys): `provider` names one of the providers, and `maxFileSize` caps every upload, as text or a number of bytes; a bucket's own limit can only be lower. `false` serves no `/api/sb/storage/v1`. See [Supabase Storage API](../supabase-storage.md).
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
export default defineConfig({ files: { storage: { provider: 'uploads', maxFileSize: '10 MB' } } })
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## files.images
|
|
91
|
+
|
|
92
|
+
- **Type:** `'sharp'`
|
|
93
|
+
- **Default:** none
|
|
94
|
+
|
|
95
|
+
The image library that makes the variants and placeholders of image fields, by its package name, loaded from the project's dependencies when the app serves. Fields with `.variants()` or `.placeholder()` need it. See [Image variants and placeholders](../files.md#image-variants-and-placeholders).
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
export default defineConfig({ files: { images: 'sharp' } })
|
|
99
|
+
```
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
<!-- Generated by scripts/protobase-skill.ts from website/src/content/docs/reference/config/jobs-and-events.md: run `bun run docs:skill`, do not edit. -->
|
|
2
|
+
|
|
3
|
+
# Jobs and events options
|
|
4
|
+
|
|
5
|
+
The config keys of what the app does in the background and records as it changes, jobs, events, history, webhooks and notifications, with their types and defaults, and the files where a job's run and the stores of its own go.
|
|
6
|
+
|
|
7
|
+
The keys of the app's background work and of what it keeps as records change, at the top level of [`protobase.config.ts`](../config.md).
|
|
8
|
+
|
|
9
|
+
## jobs
|
|
10
|
+
|
|
11
|
+
- **Type:** `Record<string, JobDeclaration>`
|
|
12
|
+
- **Default:** none
|
|
13
|
+
|
|
14
|
+
The app's jobs by name: what each does, its arguments, when it runs and how it retries. A name is letters, digits, `_`, `-`, `.` and `/`. What the job does is the default export of `jobs/<name>.ts`, typed with `JobRun` from `@protobase/server` and loaded the first time the job runs; a job without its file stops the app at start with an error that names the file. [Jobs](../jobs.md) shows a job's config and its `jobs/<name>.ts` side by side.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
jobs: {
|
|
19
|
+
'send-invoice': { description: 'Mails an invoice to its customer.', arguments: { invoiceId: 'integer' }, maxAttempts: 5 },
|
|
20
|
+
'daily-report': { schedule: '0 7 * * *' },
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Each job takes the keys below.
|
|
26
|
+
|
|
27
|
+
### description
|
|
28
|
+
|
|
29
|
+
- **Type:** `string`
|
|
30
|
+
|
|
31
|
+
What the job does, for the people who read the config and the failed jobs page.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
jobs: { 'send-invoice': { description: 'Mails an invoice to its customer.' } }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### arguments
|
|
38
|
+
|
|
39
|
+
- **Type:** `Record<string, ArgumentSpec>`, each a field type or `{ type, optional?, ... }` with that type's options
|
|
40
|
+
- **Default:** none
|
|
41
|
+
|
|
42
|
+
Its arguments by name, each a [field type](../data-config.md#field-types) such as `'bigint'`, or the type with options, such as `{ type: 'enum', values: ['day', 'week'] }` or `{ type: 'integer', optional: true }`. Each is checked when the job is enqueued and again before it runs, and no other argument is taken.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
jobs: { 'send-report': { arguments: { period: { type: 'enum', values: ['day', 'week'] }, userId: 'text' } } }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### maxAttempts
|
|
49
|
+
|
|
50
|
+
- **Type:** `number`
|
|
51
|
+
- **Default:** `10`
|
|
52
|
+
|
|
53
|
+
Tries before the job is kept as failed, listed in the admin app. See [Failures](../jobs.md#failures).
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
jobs: { 'send-invoice': { maxAttempts: 5 } }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### retryDelay
|
|
60
|
+
|
|
61
|
+
- **Type:** `number | string`
|
|
62
|
+
- **Default:** `2s`
|
|
63
|
+
|
|
64
|
+
The wait before the first retry, doubling with each one: milliseconds, or text such as `30 seconds`.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
jobs: { 'sync-crm': { retryDelay: '30 seconds' } }
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### maxRetryDelay
|
|
71
|
+
|
|
72
|
+
- **Type:** `number | string`
|
|
73
|
+
- **Default:** `1 hour`
|
|
74
|
+
|
|
75
|
+
The longest wait between two tries.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
jobs: { 'sync-crm': { maxRetryDelay: '10 minutes' } }
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### timeout
|
|
82
|
+
|
|
83
|
+
- **Type:** `number | string`
|
|
84
|
+
- **Default:** `15 minutes`
|
|
85
|
+
|
|
86
|
+
How long one try may run before it counts as failed.
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
jobs: { 'import-products': { timeout: '1 hour' } }
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### longQueries
|
|
93
|
+
|
|
94
|
+
- **Type:** `boolean`
|
|
95
|
+
- **Default:** `false`
|
|
96
|
+
|
|
97
|
+
Its queries through `db` may run up to 30 seconds instead of the database's own limit, on a connection kept for such work: for imports, backfills, large deletes and other bulk work. See [Long queries](../../guides/api-functions.md#long-queries).
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
jobs: { 'import-products': { longQueries: true } }
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### concurrency
|
|
104
|
+
|
|
105
|
+
- **Type:** `number`
|
|
106
|
+
- **Default:** `1`
|
|
107
|
+
|
|
108
|
+
Jobs of this name running at once in each worker process.
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
jobs: { 'send-invoice': { concurrency: 4 } }
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### ordered
|
|
115
|
+
|
|
116
|
+
- **Type:** `boolean`
|
|
117
|
+
- **Default:** `false`
|
|
118
|
+
|
|
119
|
+
Jobs run one at a time per group, in the order they were enqueued, and every enqueue names its group. Turning it on or off for a job whose queue exists stops the app at start. See [Ordered groups](../jobs.md#ordered-groups).
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
jobs: { 'sync-order': { ordered: true } }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### schedule
|
|
126
|
+
|
|
127
|
+
- **Type:** `string`, a cron expression
|
|
128
|
+
|
|
129
|
+
Runs the job on this cron schedule, such as `0 7 * * *` (with an optional seconds field first), with no payload: one run per time, however many workers run. See [Recurring jobs](../jobs.md#recurring-jobs).
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
jobs: { 'daily-report': { schedule: '0 7 * * *' } }
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### timezone
|
|
136
|
+
|
|
137
|
+
- **Type:** `string`
|
|
138
|
+
- **Default:** the config's [`timezone`](app.md#timezone), else `UTC`
|
|
139
|
+
|
|
140
|
+
The time zone `schedule` is read in, such as `Europe/Amsterdam`, so 07:00 stays 07:00 across daylight saving time.
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
jobs: { 'daily-report': { schedule: '0 7 * * *', timezone: 'Europe/Amsterdam' } }
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## events.schema
|
|
147
|
+
|
|
148
|
+
- **Type:** `string`
|
|
149
|
+
- **Default:** `changes`
|
|
150
|
+
|
|
151
|
+
The schema holding the outbox and the capture function that resources' [events](../events.md) are raised from, and the prefix of their transaction settings (`changes.actor`, `changes.capture`). Rename it when the database already has a schema by that name; lowercase letters, digits and `_`. See [How changes are captured](../events.md#how-changes-are-captured).
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
export default defineConfig({ events: { schema: 'app_changes' } })
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## history.days
|
|
158
|
+
|
|
159
|
+
- **Type:** `number`, a positive whole number
|
|
160
|
+
- **Default:** kept forever
|
|
161
|
+
|
|
162
|
+
Days a change of a resource with `.history()` is kept; a daily job deletes older ones. See [Record history](../history.md#keeping-it).
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
export default defineConfig({ history: { days: 365 } })
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## webhooks
|
|
169
|
+
|
|
170
|
+
- **Type:** `{ schema?: string; deliveryLog?: boolean; allowPrivateAddresses?: boolean }`
|
|
171
|
+
- **Default:** off; `{}` turns them on
|
|
172
|
+
|
|
173
|
+
Webhook subscriptions that people make in the admin app, kept in a table of the app's database that `protobase migration` writes. A subscription delivers as its owner, with the roles they hold now, read from the app's sign-in; a project that signs people in otherwise exports its own, `async ({ id, tenant }) => [...]`, as the default of `webhooks/owner-roles.ts`. See [Subscriptions in the admin app](../webhooks.md#subscriptions-in-the-admin-app).
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
export default defineConfig({ webhooks: {} })
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## webhooks.schema
|
|
180
|
+
|
|
181
|
+
- **Type:** `string`
|
|
182
|
+
- **Default:** `webhooks`
|
|
183
|
+
|
|
184
|
+
The schema of the subscriptions table and the deliveries view.
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
export default defineConfig({ webhooks: { schema: 'hooks' } })
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## webhooks.deliveryLog
|
|
191
|
+
|
|
192
|
+
- **Type:** `boolean`
|
|
193
|
+
- **Default:** `false`
|
|
194
|
+
|
|
195
|
+
Also keeps every try, successes too, for 30 days, listed as the Webhook delivery log.
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
export default defineConfig({ webhooks: { deliveryLog: true } })
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## webhooks.allowPrivateAddresses
|
|
202
|
+
|
|
203
|
+
- **Type:** `boolean`
|
|
204
|
+
- **Default:** `false`
|
|
205
|
+
|
|
206
|
+
Lets subscriptions send to private, loopback and link-local addresses, for development and tests. Off, a URL whose host resolves to one is refused, so a subscription cannot reach the app's own network.
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
export default defineConfig(({ command }) => ({ webhooks: { allowPrivateAddresses: command === 'dev' } }))
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## notifications
|
|
213
|
+
|
|
214
|
+
- **Type:** `{ ui?: boolean; schema?: string; devices?: { table?: string; columns?: Record<string, string> }; history?: { table?: string; columns?: Record<string, string> } }`
|
|
215
|
+
- **Default:** off; `{}` turns them on
|
|
216
|
+
|
|
217
|
+
Each user's devices and inbox: the bell in the top bar and push on their browsers, over tables that `protobase migration` writes. Web Push is on when the `PROTOBASE_VAPID_*` variables are set. See [Notifications](../notifications.md#turning-them-on).
|
|
218
|
+
|
|
219
|
+
Three files replace the built-in parts, each as its default export: `notifications/store.ts` a device store in place of the devices table, `notifications/history-store.ts` a history store in place of the history table, and `notifications/senders.ts` an array of push senders in place of the built-in ones. See [Your own parts](../notifications.md#your-own-parts).
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
export default defineConfig({ notifications: {} })
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## notifications.ui
|
|
226
|
+
|
|
227
|
+
- **Type:** `boolean`
|
|
228
|
+
- **Default:** `true`
|
|
229
|
+
|
|
230
|
+
The bell in the top bar; `false` keeps only the backend. See [Without the bell](../notifications.md#without-the-bell).
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
export default defineConfig({ notifications: { ui: false } })
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## notifications.schema
|
|
237
|
+
|
|
238
|
+
- **Type:** `string`
|
|
239
|
+
- **Default:** `notifications`
|
|
240
|
+
|
|
241
|
+
The schema of the built-in tables.
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
export default defineConfig({ notifications: { schema: 'inbox' } })
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## notifications.devices
|
|
248
|
+
|
|
249
|
+
- **Type:** `{ table?: string; columns?: Record<string, string> }`
|
|
250
|
+
- **Default:** `{ table: 'devices' }`
|
|
251
|
+
|
|
252
|
+
The devices table: its name, and its columns named otherwise than Protobase names them. See [Table names](../notifications.md#table-names).
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
export default defineConfig({ notifications: { devices: { table: 'push_devices', columns: { user_id: 'owner_id' } } } })
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## notifications.history
|
|
259
|
+
|
|
260
|
+
- **Type:** `{ table?: string; columns?: Record<string, string> }`
|
|
261
|
+
- **Default:** `{ table: 'history' }`
|
|
262
|
+
|
|
263
|
+
The history table, each user's inbox: its name, and its columns named otherwise than Protobase names them.
|
|
264
|
+
|
|
265
|
+
```ts
|
|
266
|
+
export default defineConfig({ notifications: { history: { table: 'inbox_items' } } })
|
|
267
|
+
```
|