@protobase/config 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/config.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { AdminOptions, AppIdentity, AssistantOptions, AuthSettings, AuthenticateSettings, EventsOptions, FileProviderSettings, FilesOptions, HistoryOptions, JobDeclaration, MobileConfig, NotificationsOptions, WebhooksOptions } from "@protobase/server";
2
2
  //#region src/config.d.ts
3
- /** `auth`: sign-in (see `AuthSettings`). Its URL, secret and name are the app's (`url`, `secret`, `name`). */
4
- export type AuthConfig = Omit<AuthSettings, 'baseURL' | 'secret' | 'appName'>;
3
+ /**
4
+ * `auth`: sign-in (see `AuthSettings`). Its URL, secrets and name are the app's (`url`, `secret`, `previousSecrets`,
5
+ * `name`), and so are its signing keys' (`signingKeyDays`, `signingKeyGraceDays`).
6
+ */
7
+ export type AuthConfig = Omit<AuthSettings, 'baseURL' | 'secret' | 'appName' | 'previousSecrets' | 'signingKeyDays' | 'signingKeyGraceDays'>;
5
8
  /** `files`: where file fields keep their bytes (see `FilesOptions`), with the providers as data. */
6
9
  export type FilesConfig = Omit<FilesOptions, 'providers' | 'sharp'> & {
7
10
  /**
@@ -28,6 +31,16 @@ type AppKeys = AppIdentity & {
28
31
  * and public forms' bot checks, and encrypts the token signing keys. Default `PROTOBASE_SECRET`; required with sign-in.
29
32
  */
30
33
  secret?: string;
34
+ /**
35
+ * The app's secrets before `secret`, newest first: what they encrypted still decrypts, so the token signing keys keep
36
+ * signing after the secret changes. Keep one listed while the keys it encrypted sign (`signingKeyDays`), and while
37
+ * two-factor authenticator apps set up with it are in use. Default `PROTOBASE_PREVIOUS_SECRETS`, comma separated.
38
+ */
39
+ previousSecrets?: string[];
40
+ /** Days a token signing key signs before a new one takes over. Default 30. */
41
+ signingKeyDays?: number;
42
+ /** Days a replaced signing key still verifies the tokens it signed. Default 7, at least 1. */
43
+ signingKeyGraceDays?: number;
31
44
  /** The language of the admin app's built-in screens and of its numbers and dates, for every user: `'en'` or `'nl'`; unset, each user's browser's. */
32
45
  locale?: NonNullable<AdminOptions['locale']>;
33
46
  /** The time zone the jobs' schedules are read in unless a job names its own, such as `Europe/Amsterdam`. Default `UTC`. */
package/dist/index.d.ts CHANGED
@@ -1,10 +1,15 @@
1
1
  import { AuthConfig, ConfigCommand, ConfigEnv, ConfigFunction, ConfigInput, FilesConfig, ProtobaseConfig } from "./config.js";
2
+ import { JobDeclaration } from "@protobase/server";
2
3
  //#region src/index.d.ts
4
+ type WithJobs<Jobs> = Omit<ProtobaseConfig, 'jobs'> & {
5
+ jobs?: Jobs;
6
+ };
3
7
  /**
4
8
  * Types `protobase.config.ts`'s default export and returns it as it is: a config, or a function of the command and the
5
- * environment that returns one, at once or as a promise.
9
+ * environment that returns one, at once or as a promise. Its type keeps the jobs as written, so
10
+ * `EnqueueJob<typeof config>` of `@protobase/server` knows their names and arguments.
6
11
  */
7
- export declare function defineConfig(config: ProtobaseConfig): ProtobaseConfig;
8
- export declare function defineConfig(config: ConfigFunction): ConfigFunction;
12
+ export declare function defineConfig<const Jobs extends Record<string, JobDeclaration> = {}>(config: WithJobs<Jobs>): WithJobs<Jobs>;
13
+ export declare function defineConfig<const Jobs extends Record<string, JobDeclaration> = {}>(config: (configEnv: ConfigEnv) => WithJobs<Jobs> | Promise<WithJobs<Jobs>>): (configEnv: ConfigEnv) => WithJobs<Jobs> | Promise<WithJobs<Jobs>>;
9
14
  //#endregion
10
15
  export type { AuthConfig, ConfigCommand, ConfigEnv, ConfigFunction, ConfigInput, FilesConfig, ProtobaseConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@protobase/config",
3
- "version": "0.49.0",
4
- "description": "defineConfig and the types of a Protobase project's protobase.config.ts.",
3
+ "version": "0.49.2",
4
+ "description": "defineConfig and the types of a Protobase project's protobase.config.ts, and the JSON Schema of protobase.config.json.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -15,11 +15,13 @@
15
15
  "node": ">=22.12.0"
16
16
  },
17
17
  "exports": {
18
- ".": "./dist/index.js"
18
+ ".": "./dist/index.js",
19
+ "./schema.json": "./schema.json"
19
20
  },
20
21
  "types": "./dist/index.d.ts",
21
22
  "files": [
22
- "dist"
23
+ "dist",
24
+ "schema.json"
23
25
  ],
24
26
  "scripts": {
25
27
  "build": "tsdown",
@@ -29,6 +31,6 @@
29
31
  "access": "public"
30
32
  },
31
33
  "peerDependencies": {
32
- "@protobase/server": "0.49.0"
34
+ "@protobase/server": "0.49.2"
33
35
  }
34
36
  }