storage
const storage: { get: Promise<StorageEntry | null>; getAll: Promise<StorageEntry[]>; getAllAcrossPresentations: Promise<StorageEntry[]>; getForPresentation: Promise<StorageEntry[]>; query: Promise<StorageEntry[]>; search: Promise<StorageEntry[]>; save: Promise<StorageEntry>; delete: Promise<void>;};Defined in: domains/storage.ts:178
Type Declaration
Section titled “Type Declaration”get(name): Promise<StorageEntry | null>;Get a single storage entry by name for the current presentation and user.
On Mobile Locker app hosts that implement
GET /user/user-storage-entries/item?name=, this is a single-key read.
Older hosts fall back to listing current-presentation entries.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name |
string |
The key name of the entry to retrieve. |
Returns
Section titled “Returns”Promise<StorageEntry | null>
The matching StorageEntry, or null if not found.
Throws
Section titled “Throws”MobileLockerError on network failure or server error.
getAll()
Section titled “getAll()”getAll(): Promise<StorageEntry[]>;Get all storage entries for the current presentation and user.
Returns
Section titled “Returns”Promise<StorageEntry[]>
Array of StorageEntry objects.
Throws
Section titled “Throws”MobileLockerError on network failure or server error.
getAllAcrossPresentations()
Section titled “getAllAcrossPresentations()”getAllAcrossPresentations(): Promise<StorageEntry[]>;Get all storage entries for the current user across every presentation.
Returns
Section titled “Returns”Promise<StorageEntry[]>
Array of StorageEntry objects.
Remarks
Section titled “Remarks”Previously misnamed getAllForPresentation (that name hit this same
unrestricted list endpoint). Use getAll for the current presentation only.
Throws
Section titled “Throws”MobileLockerError on network failure or server error.
getForPresentation()
Section titled “getForPresentation()”getForPresentation(presentationID): Promise<StorageEntry[]>;Get all storage entries for a specific presentation by ID.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
presentationID |
number |
The numeric ID of the presentation. |
Returns
Section titled “Returns”Promise<StorageEntry[]>
Array of StorageEntry objects.
Throws
Section titled “Throws”MobileLockerError on network failure or server error.
query()
Section titled “query()”query(filter?): Promise<StorageEntry[]>;Query storage entries with optional filtering.
Outside the Mobile Locker app, filters are applied locally against IndexedDB.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
filter? |
StorageFilter |
Optional filter by name, presentation, date range, and limit. |
Returns
Section titled “Returns”Promise<StorageEntry[]>
Array of matching StorageEntry objects.
Throws
Section titled “Throws”MobileLockerError on network failure or server error.
Example
Section titled “Example”const entries = await mobilelocker.storage.query({ name: 'scan-results', limit: 10 })search()
Section titled “search()”search(text, filter?): Promise<StorageEntry[]>;Full-text search across storage entry names and data.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
text |
string |
The search string. Matched against name and the stringified data. |
filter? |
StorageFilter |
Optional pre-filter applied before the text search. |
Returns
Section titled “Returns”Promise<StorageEntry[]>
Array of matching StorageEntry objects.
Throws
Section titled “Throws”MobileLockerError on network failure or server error.
save()
Section titled “save()”save(name, data): Promise<StorageEntry>;Save a value to storage under the given name.
Creates a new entry if one does not exist, or updates the existing entry. Outside the Mobile Locker app, persists to IndexedDB via localforage.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name |
string |
The key name for the entry. |
data |
unknown |
Any JSON-serializable value to store. |
Returns
Section titled “Returns”Promise<StorageEntry>
The saved StorageEntry.
Throws
Section titled “Throws”MobileLockerError on network failure or server error.
Example
Section titled “Example”await mobilelocker.storage.save('scan-results', { leads: [...] })delete()
Section titled “delete()”delete(name): Promise<void>;Delete the storage entry with the given name.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name |
string |
The key name of the entry to delete. |
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”MobileLockerError on network failure or server error.