serverpod_shared
library
Enums
ConsoleLogFormat
Valid values for console log format.
CookieSameSite
The SameSite attribute of a cookie, controlling whether it is sent on
cross-site requests. Maps to the HTTP SameSite values.
DatabaseDialect
Database dialect type.
ServerpodEnv
The default environment variables used by the server.
ServerpodLoggingMode
The overarching logging mode of the server. This can be set to either
normal or verbose . In normal mode, only important messages are logged,
which is the default.
ServerpodPassword
The default passwords used by the server.
ServerpodRole
The main role of the server. By default, Serverpod is running as a monolith,
but it can also be configured to run as a serverless server, or in
maintenance mode where it runs scheduled tasks, such as executing future
calls.
Constants
durationComponentPattern
→ const String
Regular expression pattern that matches a duration component with
an integer value followed by a valid unit (d, h, min, s, ms).
fullDurationPattern
→ const String
Regular expression pattern that matches a complete duration string
consisting of multiple duration components separated by spaces.
serverpodIssueTrackerUrl
→ const String
URL where users can report internal Serverpod errors.
Functions
bindUnixSocket (String path )
→ Future <ServerSocket >
Binds a ServerSocket to a Unix domain socket at path.
connectUnixSocket (String path , {Duration ? timeout })
→ Future <Socket >
Connects to a Unix domain socket at path.
databaseTypeToLowerCamelCase (String databaseType )
→ String
Splits at spaces and joins to lowerCamelCase.
ensureSecureDirectorySync (String path )
→ void
Atomically ensures a directory exists at path with mode 0700 on
POSIX (and an owner-restricted ACL on Windows). No-op if path
already exists.
formatInternalErrorMessage ([Object ? error ])
→ String
Formats an unexpected error using Serverpod's standard issue-reporting
guidance.
generateRandomBytes (int length )
→ Uint8List
Generates a list of secure random bytes of the specified length.
generateRandomString ([int length = 32 ])
→ String
Generates a secure random string of the specified length.
hasUnixSocketSupport ()
→ bool
Returns true if the current platform supports Unix domain sockets.
inferDatabaseConfigFromConfigMap (Map configMap , {Map <String , String > environment = const {} })
→ DatabaseConfig ?
Infer the database config from one run-mode config map (the body of
config/<runMode>.yaml), using the same database merging rules as
ServerpodConfig.loadFromMap .
inferDatabaseDialectFromConfigMap (Map configMap , {Map <String , String > environment = const {} })
→ DatabaseDialect ?
Infer the database dialect from one run-mode config map (the body of
config/<runMode>.yaml), using the same database merging rules as
ServerpodConfig.loadFromMap .
isValidDuration (dynamic value )
→ bool
Checks if the given value is a valid duration string, using the fullDurationPattern.
maxUnixSocketPathBytes ()
→ int
Maximum number of bytes a Unix domain socket path may occupy on the
current platform.
parseDuration (dynamic input )
→ Duration
Parses the valid duration string into a CustomDuration object.
This allows for easy access to individual components such as days, hours, minutes, seconds, and milliseconds.
requireUnixSocketPathFits (String path )
→ void
Throws a SocketException if path (after shortening) does not fit within
the platform's sockaddr_un.sun_path.
requireUnixSocketSupport ()
→ void
Throws a SocketException if the current platform does not support Unix
domain sockets.
shortestPath (String path )
→ String
Returns the shortest equivalent form of path.
shortestPathRelativeTo (String path , {required String from })
→ String
Like shortestPath , but the relative form is computed from from instead
of Directory.current .
sslCertificatePath (String runMode , int serverId )
→ String
Returns the path to SSL certificate for the specified server.
sslPrivateKeyPath (String runMode , int serverId )
→ String
Returns the path to the private SSL key for the specified server.
truncateIdentifier (String identifier , int maxLength , {int hashLength = 4 })
→ String
Deterministically truncates an identifier to a maxLength String.
uint8ListAreEqual (Uint8List a , Uint8List b )
→ bool
Checks whether the 2 given lists contain the same data.