ProtectedconstructorGets all file storage accounts (cached).
Gets all storage accounts combined with their provider details (cached).
ProtectedBaseAccess to the underlying metadata-only engine.
Whether any storage accounts are configured.
Returns true if the engine has been configured.
Gets all file storage providers (cached).
StaticInstanceReturns the global singleton instance.
Configures the engine by loading the underlying metadata cache and any
server-specific state. Safe to call multiple times — uses cached data
unless forceRefresh is true. Concurrent callers share a single loading
promise to avoid redundant work.
OptionalforceRefresh: booleanOptionalcontextUser: UserInfoOptionalprovider: IMetadataProviderGets a file storage account by its ID.
Gets a file storage account by its name (case-insensitive).
Gets file storage accounts linked to a given provider ID.
Gets a storage account with its provider details by account ID.
Returns an authenticated storage driver for a given account.
Checks the pre-initialized driver cache first (populated during Config()). If the account wasn't cached (e.g., it failed during Config or was added after), falls back to on-demand initialization.
This handles:
The FileStorageAccount ID to get a driver for
User context for credential decryption (used for on-demand init)
An initialized, ready-to-use FileStorageBase driver
The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared because it is possible that a given class might have copies of its code in multiple paths in a deployed application. This approach ensures that no matter how many code copies might exist, there is only one instance of the object in question by using the Global Object Store.
Gets a file storage provider by its ID.
Initializes storage drivers for all active accounts and caches them. Called automatically during Config(). Can also be called independently to re-initialize drivers without reloading metadata (e.g., after credential rotation). Accounts that fail to initialize are logged and skipped — they will fall back to on-demand initialization when GetDriver() is called.
Resolves a storage account to use for file operations.
Resolution logic:
accountId is provided, returns that specific accountOptionalaccountId: stringOptional explicit account ID
The resolved account with provider, or null if no accounts are configured
Uploads a file to MJ Storage and creates an MJ: Files entity record.
This is the primary high-level method for storing files. It handles:
MJ: Files database recordUpload options (content, fileName, mimeType, contextUser, etc.)
Upload result containing the file ID, storage path, and account/provider used
Protected StaticgetReturns the singleton instance of the class. If the instance does not exist, it is created and stored in the Global Object Store. If className is provided it will be used as part of the key in the Global Object Store, otherwise the actual class name will be used. NOTE: the class name used by default is the lowest level of the object hierarchy, so if you have a class that extends another class, the lowest level class name will be used.
OptionalclassName: string
Server-side file storage engine providing high-level operations for uploading, downloading, and managing files in MJ Storage.
Follows the containment pattern (like AIEngine wraps AIEngineBase):
Client-side code should use
FileStorageEngineBasefrom@memberjunction/core-entitiesfor metadata-only access (accounts, providers, lookups).Usage: