On this page
Overview
Reconciles declared and native application identity and scopes OPFS/localStorage ownership fail-closed.
- Artifact
AppDataScope.js· esm - Classification
public first party - Availability
Browser / native WebView hybrid - Normalization
Strict normalized identifiers and coded mismatch failures.
Import and lifecycle
import * as module from '/arcane/modules/AppDataScope.js';
Identity helpers are pure; openApplicationDataDirectory() opens and, by default, creates OPFS apps/<application-id>.
Application-facing behavior: Identity constants and canonicalApplicationId(), resolveApplicationId(), resolveApplicationLocalStorageKey(), openApplicationDataDirectory().
Protocol and host implementation
Arcane.app.current, DOM declaration, OPFS This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
canonicalApplicationId | function | function canonicalApplicationId(value,label='applicationId') | value,label='applicationId' |
declaredApplicationId | function | function declaredApplicationId(documentObject=globalThis.document) | documentObject=globalThis.document |
resolveBrowserApplicationId | function | function resolveBrowserApplicationId({
applicationId=null,
documentObject=globalThis.document
}={}) | {
applicationId=null,
documentObject=globalThis.document
}={} |
resolveApplicationLocalStorageKey | function | function resolveApplicationLocalStorageKey(logicalKey='',options={}) | logicalKey='',options={} |
resolveApplicationId | function | async function resolveApplicationId({
applicationId=null,
documentObject=globalThis.document,
arcane=globalThis.Arcane
}={}) | {
applicationId=null,
documentObject=globalThis.document,
arcane=globalThis.Arcane
}={} |
openApplicationDataDirectory | function | async function openApplicationDataDirectory({
storage=globalThis.navigator?.storage,
applicationId=null,
documentObject=globalThis.document,
arcane=globalThis.Arcane,
create=true
}={}) | {
storage=globalThis.navigator?.storage,
applicationId=null,
documentObject=globalThis.document,
arcane=globalThis.Arcane,
create=true
}={} |
APPLICATION_ID_MAX_LENGTH | variable · value | variable APPLICATION_ID_MAX_LENGTH | — |
APPLICATION_ID_PATTERN | variable · value | variable APPLICATION_ID_PATTERN | — |
APP_DATA_DIRECTORY | variable · value | variable APP_DATA_DIRECTORY | — |
APP_LOCAL_STORAGE_PREFIX | variable · value | variable APP_LOCAL_STORAGE_PREFIX | — |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
canonicalApplicationId | exported-function | function canonicalApplicationId(value,label='applicationId') | value,label='applicationId' |
resolveApplicationId | exported-function | async function resolveApplicationId({
applicationId=null,
documentObject=globalThis.document,
arcane=globalThis.Arcane
}={}) | {
applicationId=null,
documentObject=globalThis.document,
arcane=globalThis.Arcane
}={} |
resolveApplicationLocalStorageKey | exported-function | function resolveApplicationLocalStorageKey(logicalKey='',options={}) | logicalKey='',options={} |
openApplicationDataDirectory | exported-function | async function openApplicationDataDirectory({
storage=globalThis.navigator?.storage,
applicationId=null,
documentObject=globalThis.document,
arcane=globalThis.Arcane,
create=true
}={}) | {
storage=globalThis.navigator?.storage,
applicationId=null,
documentObject=globalThis.document,
arcane=globalThis.Arcane,
create=true
}={} |
Parameter meanings and results
Canonical IDs are lowercase hyphenated strings up to 64 characters. resolveApplicationId(options) reconciles explicit, document, and native identity; resolveApplicationLocalStorageKey(logicalKey, options) scopes a key; openApplicationDataDirectory(options) returns {applicationId, directory, path}.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
This artifact has no additional documented lifecycle event flow.
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- APP_DATA_SCOPE_INVALID
- APP_DATA_SCOPE_MISMATCH
- APP_DATA_SCOPE_REQUIRED
- APP_DATA_STORAGE_UNAVAILABLE
Availability and capabilities
Browser / native WebView hybrid. Strict normalized identifiers and coded mismatch failures.
Normalizes browser declarations with authoritative Arcane.app.current when native; browser-only OPFS isolation is organizational, while native profiles add host isolation.
Contract example
import {resolveApplicationLocalStorageKey} from '/arcane/modules/AppDataScope.js';
const key=resolveApplicationLocalStorageKey('draft',{
applicationId:'notes-app',
documentObject:null
});
console.log(key);