@protobase/server 0.23.4 → 0.23.5

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.
@@ -5,6 +5,7 @@ import { PluginOption } from "./plugins/plugin-settings.js";
5
5
  import { SourceOption } from "./sources/source-settings.js";
6
6
  import { CorsOrigins } from "./api-cors.js";
7
7
  import { AssistantOptions } from "./assistant/assistant-settings.js";
8
+ import { LocaleOption } from "./locale/locale-option.js";
8
9
  import { RuntimeOptions } from "./runtime/runtime-settings.js";
9
10
  import { ResolveOptions, RoleLimit } from "@protobase/schema";
10
11
  //#region src/admin-options.d.ts
@@ -59,6 +60,11 @@ export type AdminOptions = {
59
60
  * with `false`, the app draws no maps.
60
61
  */
61
62
  maps?: MapOptions | false;
63
+ /**
64
+ * The language of the admin app's built-in screens and of its numbers and dates, for every user: `'en'` or `'nl'`.
65
+ * Unset, each user sees their browser's language when the screens come in it, and English otherwise.
66
+ */
67
+ locale?: LocaleOption;
62
68
  /**
63
69
  * The plugins the admin app loads (see `PluginOption`), before the ones the platform lists in `PROTOBASE_PLUGINS`
64
70
  * and, for those that load before sign-in, `PROTOBASE_PLUGINS_BEFORE_SIGN_IN`; `false` turns all of them off.
@@ -42,6 +42,7 @@ import { fileRoutes } from "./files/routes.js";
42
42
  import { formRoutes } from "./forms/routes.js";
43
43
  import { createFormsRuntime } from "./forms/runtime.js";
44
44
  import { functionRoutes } from "./functions/routes.js";
45
+ import { localeSetting } from "./locale/locale-option.js";
45
46
  import { mapSettings } from "./maps/map-settings.js";
46
47
  import { pluginOptions, pluginsBeforeSignIn } from "./plugins/plugin-settings.js";
47
48
  import { runtimeUrl } from "./runtime/runtime-settings.js";
@@ -114,6 +115,7 @@ const createAdmin = ({ resources: appResources, views: appViews = [], pages = []
114
115
  const runtime = runtimeUrl(options.runtime, globalThis.process?.env ?? {});
115
116
  const errorReporting = errorReportingSettings(options.errorReporting, globalThis.process?.env ?? {});
116
117
  const maps = mapSettings(options.maps, globalThis.process?.env ?? {});
118
+ const locale = localeSetting(options.locale);
117
119
  const plugins = pluginOptions(options.plugins, globalThis.process?.env ?? {}, bundlePlugins);
118
120
  const sources = sourceOptions(options.sources, globalThis.process?.env ?? {});
119
121
  checkSourceNames(sources, {
@@ -156,6 +158,7 @@ const createAdmin = ({ resources: appResources, views: appViews = [], pages = []
156
158
  ...runtime && { runtime },
157
159
  ...errorReporting && { errorReporting },
158
160
  ...maps && { maps },
161
+ ...locale && { locale },
159
162
  plugins,
160
163
  sources,
161
164
  ...files && { files },
package/dist/deps.d.ts CHANGED
@@ -6,5 +6,6 @@ import "./plugins/plugin-settings.js";
6
6
  import "./registry.js";
7
7
  import "./scan-guard.js";
8
8
  import { PageModel } from "@protobase/layout";
9
+ import { Locale } from "@protobase/schema/internal";
9
10
  import { ResolveOptions, ViewModel } from "@protobase/schema";
10
11
  import { Db } from "@protobase/query";
@@ -0,0 +1,5 @@
1
+ import { Locale } from "@protobase/schema/internal";
2
+ //#region src/locale/locale-option.d.ts
3
+ /** The language of the admin app's built-in screens, for every user; unset, each sees their browser's language. */
4
+ export type LocaleOption = Locale;
5
+ //#endregion
@@ -0,0 +1,10 @@
1
+ import { isLocale, locales } from "@protobase/schema/internal";
2
+ //#region src/locale/locale-option.ts
3
+ /** The option, checked: a language the screens do not come in stops startup. */
4
+ const localeSetting = (option) => {
5
+ if (option === void 0) return void 0;
6
+ if (isLocale(option)) return option;
7
+ throw new Error(`options.locale is ${JSON.stringify(option)}: use one of ${locales.map((locale) => `'${locale}'`).join(", ")}`);
8
+ };
9
+ //#endregion
10
+ export { localeSetting };
package/dist/meta.js CHANGED
@@ -86,6 +86,7 @@ const createMeta = (deps, appName) => {
86
86
  ...deps.runtime && seesRuntime(session.user.roles) && { runtime: { url: deps.runtime } },
87
87
  ...deps.errorReporting && { errorReporting: deps.errorReporting },
88
88
  ...deps.maps && { maps: deps.maps },
89
+ ...deps.locale && { locale: deps.locale },
89
90
  ...deps.files && deps.files.trustedHosts.length > 0 && { files: { trustedHosts: deps.files.trustedHosts } },
90
91
  ...plugins.length > 0 && { plugins },
91
92
  ...sources.length > 0 && { sources }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/server",
3
- "version": "0.23.4",
3
+ "version": "0.23.5",
4
4
  "description": "The Protobase REST API as a Hono app, with Better Auth sign-in.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  "dependencies": {
32
32
  "@better-auth/passkey": "^1.7.7",
33
33
  "@better-auth/sso": "^1.7.7",
34
- "@protobase/layout": "0.23.4",
35
- "@protobase/query": "0.23.4",
36
- "@protobase/schema": "0.23.4",
34
+ "@protobase/layout": "0.23.5",
35
+ "@protobase/query": "0.23.5",
36
+ "@protobase/schema": "0.23.5",
37
37
  "@react-email/render": "^2.1.0",
38
38
  "@scalar/hono-api-reference": "^0.12.10",
39
39
  "@sentry/core": "^11.7.0",