@casual-simulation/aux-common
Version:
Common library for AUX projects
344 lines • 12.4 kB
TypeScript
import type { RemoteCausalRepoProtocol, SharedPartitionsVersion } from '../partitions';
import { z } from 'zod';
/**
* The possible BIOS options.
*
* - "enter join code" indicates that the user should be prompted to enter a join code.
* - "temp" indicates that a temporary instance should be created (no persistence).
* - "static inst", "local inst", and "local" indicates that the instance should be loaded statically.
* - "public inst", "free inst", "public", and "free" indicates that the instance should be loaded from the public partition.
* - "private inst", "studio inst", "studio", and "locked" indicates that the instance should be loaded from the private partition.
* - "sign in" indicates that the user should be prompted to sign in.
* - "sign up" indicates that the user should be prompted to sign up.
* - "sign out" indicates that the user should be logged out.
*/
export type BiosOption = 'enter join code' | 'join inst' | 'temp' | 'temp local' | 'static inst' | 'local inst' | 'local' | 'public inst' | 'public' | 'free inst' | 'free' | 'private inst' | 'studio inst' | 'studio' | 'locked' | 'sign in' | 'sign up' | 'sign out' | 'delete inst';
export declare const BIOS_OPTION_SCHEMA: z.ZodEnum<{
local: "local";
studio: "studio";
locked: "locked";
"enter join code": "enter join code";
"join inst": "join inst";
temp: "temp";
"temp local": "temp local";
"static inst": "static inst";
"local inst": "local inst";
"public inst": "public inst";
public: "public";
"free inst": "free inst";
free: "free";
"private inst": "private inst";
"studio inst": "studio inst";
"sign in": "sign in";
"sign up": "sign up";
"sign out": "sign out";
"delete inst": "delete inst";
}>;
/**
* Defines an interface for the configuration that the web client should try to pull from the server.
*/
export interface WebConfig {
/**
* The protocol version.
*/
version: 1 | 2 | null;
/**
* The protocol that should be used for realtime connections.
*/
causalRepoConnectionProtocol: RemoteCausalRepoProtocol;
/**
* The URL that should be used for realtime connections.
*/
causalRepoConnectionUrl?: string | null;
/**
* Whether collaborative repositories should be persisted locally.
* Defaults to false.
*/
collaborativeRepoLocalPersistence?: boolean;
/**
* Whether static repositories should be persisted locally.
* Defaults to true.
*/
staticRepoLocalPersistence?: boolean;
/**
* The version of the shared partitions that should be used.
*/
sharedPartitionsVersion?: SharedPartitionsVersion | null;
/**
* The HTTP Origin that should be used for VM Iframes.
*/
vmOrigin?: string | null;
/**
* Whether to disable the VM entirely.
*
* This is primarily for custom domains and enabling full PWA support.
*
* Defaults to false.
*/
disableVm?: boolean;
/**
* The HTTP origin that should be used for auth iframes.
*/
authOrigin?: string | null;
/**
* The HTTP origin that should be used for records.
*/
recordsOrigin?: string | null;
/**
* Whether collaboration should be disabled.
* Setting this to true will replace the shared partition of simulations
* with tempLocal partitions.
*/
disableCollaboration?: boolean | null;
/**
* The URL that should be used to bootstrap AB1.
*/
ab1BootstrapURL?: string | null;
/**
* Whether the server should inject the AB1 Bootstrap script via a script tag.
*/
serverInjectBootstrapper?: boolean;
/**
* The API key that should be used for the ArcGIS mapping API.
*/
arcGisApiKey?: string | null;
/**
* The app name that should be used for the Jitsi meet portal.
*/
jitsiAppName?: string | null;
/**
* The API Key that should be used for what3words integration.
*/
what3WordsApiKey?: string | null;
/**
* Gets the player mode of this CasualOS version.
*
* - "player" indicates that the instance has been configured for experiencing AUXes.
* - "builder" indicates that the instance has been configured for building AUXes.
*/
playerMode?: 'player' | 'builder' | null;
/**
* Whether to require that users login with Privo before they can access collaboration features.
*/
requirePrivoLogin?: boolean;
/**
* The allowed BIOS options.
* If omitted, then all options are allowed.
*
* Possible options are:
* - "enter join code"
* - "temp"
* - "static inst"
* - "public inst"
* - "private inst"
* - "sign in"
* - "sign up"
* - "sign out"
*/
allowedBiosOptions?: BiosOption[];
/**
* The default BIOS option.
* If specified, then the BIOS will automatically select this option when shown.
*/
defaultBiosOption?: BiosOption;
/**
* The automatic BIOS option.
* If specified, then the BIOS will automatically execute this option.
*/
automaticBiosOption?: BiosOption;
/**
* The instance ID to use when executing the automatic BIOS option.
*
* Should be formatted as `{recordName/{instName}`. For local/public insts, recordName can be omitted (e.g. `/{instName}`).
*/
automaticBiosOptionInst?: string | null;
/**
* Whether full support for the DOM should be enabled.
* This will run the VM without the web worker so that scripts have direct access to the iframe.
* May not be supported in all environments.
* Requires a separate VM origin for security purposes.
* Defaults to false.
*/
enableDom?: boolean;
/**
* Whether to enable debug mode for the VM.
*/
debug?: boolean;
/**
* The URL of the logo to display in the loading screen.
*/
logoUrl?: string | null;
/**
* The title that should be used for the player page.
*/
pageTitle?: string | null;
/**
* The description that should be used for the player page.
*/
pageDescription?: string | null;
/**
* The title of the logo to display in the loading screen.
*/
logoTitle?: string | null;
/**
* The background color of the logo to display in the loading screen.
* This is used to set the background color of the splash screen.
*/
logoBackgroundColor?: string | null;
/**
* The URL that users can visit for support.
*/
supportUrl?: string | null;
/**
* Whether to enable SMS authentication.
* Defaults to false.
*/
enableSmsAuthentication?: boolean;
icons?: {
favicon?: string | null;
appleTouchIcon?: string | null;
};
/**
* The API key that should be used for PostHog analytics. If not specified, then PostHog will not be initialized.
*/
postHogApiKey?: string | null;
/**
* The HTTP host that should be used for PostHog analytics. If not specified, then the default PostHog cloud host will be used.
*/
postHogApiHost?: string | null;
/**
* Whether to enable simple analytics. Defaults to false.
*/
enableSimpleAnalytics?: boolean | null;
/**
* Whether to disable loading the grid portal by default.
*/
noAutomaticGridPortal?: boolean | null;
}
/**
* The configuration interface that extends the web config with computed options.
*/
export interface CasualOSConfig extends WebConfig {
/**
* Whether subscriptions are supported in this configuration.
*/
subscriptionsSupported: boolean;
/**
* Whether studios are supported in this configuration.
*/
studiosSupported: boolean;
/**
* The comID that was used to load this configuration.
*/
comId?: string | null;
}
export declare const WEB_CONFIG_SCHEMA: z.ZodObject<{
causalRepoConnectionProtocol: z.ZodPrefault<z.ZodEnum<{
"apiary-aws": "apiary-aws";
websocket: "websocket";
}>>;
causalRepoConnectionUrl: z.ZodOptional<z.ZodString>;
collaborativeRepoLocalPersistence: z.ZodPrefault<z.ZodBoolean>;
staticRepoLocalPersistence: z.ZodPrefault<z.ZodBoolean>;
sharedPartitionsVersion: z.ZodPrefault<z.ZodEnum<{
v2: "v2";
}>>;
vmOrigin: z.ZodOptional<z.ZodNullable<z.ZodString>>;
disableVM: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
authOrigin: z.ZodOptional<z.ZodNullable<z.ZodString>>;
recordsOrigin: z.ZodOptional<z.ZodNullable<z.ZodString>>;
disableCollaboration: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
ab1BootstrapURL: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serverInjectBootstrapper: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
arcGisApiKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
jitsiAppName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
what3WordsApiKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
playerMode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
builder: "builder";
player: "player";
}>>>;
requirePrivoLogin: z.ZodPrefault<z.ZodBoolean>;
allowedBiosOptions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
local: "local";
studio: "studio";
locked: "locked";
"enter join code": "enter join code";
"join inst": "join inst";
temp: "temp";
"temp local": "temp local";
"static inst": "static inst";
"local inst": "local inst";
"public inst": "public inst";
public: "public";
"free inst": "free inst";
free: "free";
"private inst": "private inst";
"studio inst": "studio inst";
"sign in": "sign in";
"sign up": "sign up";
"sign out": "sign out";
"delete inst": "delete inst";
}>>>>;
defaultBiosOption: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
local: "local";
studio: "studio";
locked: "locked";
"enter join code": "enter join code";
"join inst": "join inst";
temp: "temp";
"temp local": "temp local";
"static inst": "static inst";
"local inst": "local inst";
"public inst": "public inst";
public: "public";
"free inst": "free inst";
free: "free";
"private inst": "private inst";
"studio inst": "studio inst";
"sign in": "sign in";
"sign up": "sign up";
"sign out": "sign out";
"delete inst": "delete inst";
}>>>;
automaticBiosOption: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
local: "local";
studio: "studio";
locked: "locked";
"enter join code": "enter join code";
"join inst": "join inst";
temp: "temp";
"temp local": "temp local";
"static inst": "static inst";
"local inst": "local inst";
"public inst": "public inst";
public: "public";
"free inst": "free inst";
free: "free";
"private inst": "private inst";
"studio inst": "studio inst";
"sign in": "sign in";
"sign up": "sign up";
"sign out": "sign out";
"delete inst": "delete inst";
}>>>;
automaticBiosOptionInst: z.ZodOptional<z.ZodNullable<z.ZodString>>;
enableDom: z.ZodPrefault<z.ZodBoolean>;
debug: z.ZodPrefault<z.ZodBoolean>;
enableSmsAuthentication: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
logoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
logoBackgroundColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
logoTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
pageTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
pageDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
icons: z.ZodOptional<z.ZodNullable<z.ZodObject<{
favicon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
appleTouchIcon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, z.core.$strip>>>;
supportUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
postHogApiKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
postHogApiHost: z.ZodOptional<z.ZodNullable<z.ZodString>>;
enableSimpleAnalytics: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
noAutomaticGridPortal: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
}, z.core.$strip>;
export declare function parseWebConfig(config: any, defaultConfig: WebConfig): WebConfig;
//# sourceMappingURL=WebConfig.d.ts.map