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:
No permission check. The driver cache is process-wide and this method does not ask whether contextUser may
use the account. Code acting for a user must call StorageAccessEvaluator.AssertAccountAccess (or
AccessibleAccountIDs) first — the MJServer storage routes, the File Storage core actions and the search lane do —
and, going from an MJ: Files row to its object, should use ResolveFileObject instead.
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.
Reloads the shared account cache after a lookup missed, as the MJ system user. A forced Config loads as the user
it is given, and BaseEngine empties a config that user cannot read (MJ: File Storage Accounts), so a restricted
caller forcing the reload would blank the cache, and re-initialize every driver, for everyone. With no system user
nothing is reloaded and the miss stands.
Optionalprovider: IMetadataProviderInitializes 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 an MJ: Files row to the account, driver and object key that serve its bytes — and refuses unless
contextUser may use that account for access and may read every MJ: Files row that tracks the object.
Every route that goes from a file ID to bytes or a URL uses this: the row names only a PROVIDER (and ProviderKey
/ Name are written by whoever saved the row), so without the account gate a row could reach an account the caller
is refused, and without the tracked-file rule a second row could alias an object whose own row the caller cannot
read. Load the row as the caller first — this decides storage access, not whether the caller may see the row.
The row's storage location (ProviderID, ProviderKey, Name)
The caller the decision is for
Read to download or sign a URL; Write to delete, rename or overwrite the object
Optionalprovider: IMetadataProviderThe metadata provider to read permissions through; defaults to Metadata.Provider
The resolved object, or null when the row's provider has no storage account
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: