On this page
Overview
Application-defined complete document corpus bootstrap, caller-source evaluation, atomic DBOPFS generations, lexical search, and request-context construction.
- Artifact
DBOPFSDocumentLibrary.js· esm - Classification
public first party - Availability
Browser or compatible host with an existing DBOPFS-style database adapter - Normalization
Preserves DBOPFS method semantics, commits a completion manifest last, rejects malformed stored generations, exposes explicit reject or default preserve-readable read-failure policy, and returns complete mutable context.
Import and lifecycle
import * as module from '/arcane/modules/DBOPFSDocumentLibrary.js';
Construction only validates options and binds an existing DBOPFS-compatible adapter. bootstrap is the sole corpus writer: it reads complete selected sources with caller-configured concurrency, writes a new generation, commits the completion manifest last, and then removes stale generation files. search and buildContext read only the completed generation. evaluate reads complete caller-owned sources without persisting their bodies.
Application-facing behavior: DBOPFSDocumentLibrary, createDBOPFSDocumentLibrary(), normalizeDBOPFSDocumentSchema(); schema, bootstrap(), search(), evaluate(), buildContext(), and createContextBuilder().
Protocol and host implementation
Existing DBOPFS get/set/getAllKeys/delete methods; no new storage protocol This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
DBOPFSDocumentLibrary | class | class DBOPFSDocumentLibrary | — |
createDBOPFSDocumentLibrary | function | function createDBOPFSDocumentLibrary(options) | options |
normalizeDBOPFSDocumentSchema | alias · function | function normalizeSchema(input) | input |
default | default · class | class DBOPFSDocumentLibrary | — |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
createDBOPFSDocumentLibrary | exported-function | function createDBOPFSDocumentLibrary(options) | options |
normalizeDBOPFSDocumentSchema | exported-function | function normalizeSchema(input) | input |
DBOPFSDocumentLibrary.bootstrap | public-member | async bootstrap(options={}) | options={} |
DBOPFSDocumentLibrary.search | public-member | async search(query,options={}) | query,options={} |
DBOPFSDocumentLibrary.evaluate | public-member | async evaluate(query,options={}) | query,options={} |
DBOPFSDocumentLibrary.buildContext | public-member | async buildContext(query,options={}) | query,options={} |
DBOPFSDocumentLibrary.createContextBuilder | public-member | createContextBuilder(options={}) | options={} |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
DBOPFSDocumentLibrary.constructor | constructor | constructor(options={}) | options={} |
DBOPFSDocumentLibrary.schema | get | get schema() | — |
DBOPFSDocumentLibrary.bootstrap | async method | async bootstrap(options={}) | options={} |
DBOPFSDocumentLibrary.search | async method | async search(query,options={}) | query,options={} |
DBOPFSDocumentLibrary.evaluate | async method | async evaluate(query,options={}) | query,options={} |
DBOPFSDocumentLibrary.buildContext | async method | async buildContext(query,options={}) | query,options={} |
DBOPFSDocumentLibrary.createContextBuilder | method | createContextBuilder(options={}) | options={} |
Parameter meanings and results
new DBOPFSDocumentLibrary({concurrency=4,db=globalThis.dbopfs,schema}); bootstrap({files,onProgress?,read?,readFailurePolicy?,signal?}) resolves a mutable manifest and optional partial readCoverage; search(query,{kinds?,signal?,tags?}) resolves complete {failures,matches,total}; evaluate(query,{sources,read,kinds?,tags?,readFailurePolicy?,onProgress?,signal?}) persists no caller-owned body and resolves mutable {authority:'sources',characters,coverage,documents,failures,query,text}. The default preserve-readable policy reports source failures while retaining every readable source; readFailurePolicy:'reject' opts into whole-operation rejection. buildContext() resolves complete persisted context; createContextBuilder() returns a ConfiguredAIChatSession-compatible async builder.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- optional bootstrap onProgress phases: reading, writing, cleanup, complete
- optional evaluate onProgress phases: preparing, reading, read-complete, ranking, assembling, complete
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- DBOPFS_DOCUMENT_INVALID
- DBOPFS_DOCUMENT_INVALID_LIMIT
- DBOPFS_DOCUMENT_STORAGE_UNAVAILABLE
- DBOPFS_DOCUMENT_BUSY
- DBOPFS_DOCUMENT_NOT_BOOTSTRAPPED
- DBOPFS_DOCUMENT_INCOMPLETE
- DBOPFS_DOCUMENT_CASE_COLLISION
- DBOPFS_DOCUMENT_BOOTSTRAP_FAILED
- DBOPFS_DOCUMENT_READ_FAILED
- DBOPFS_DOCUMENT_LIMIT
- DBOPFS_DOCUMENT_ABORTED
- preserved read failures without a usable source code use failures[].code DBOPFS_DOCUMENT_ERROR
Availability and capabilities
Browser or compatible host with an existing DBOPFS-style database adapter. Preserves DBOPFS method semantics, commits a completion manifest last, rejects malformed stored generations, exposes explicit reject or default preserve-readable read-failure policy, and returns complete mutable context.
Portable app-owned storage/search mechanism. It preserves existing DBOPFS method names and semantics and needs no Core RPC; the host-specific boundary is the injected storage adapter.
Contract example
import {createDBOPFSDocumentLibrary} from '/arcane/modules/DBOPFSDocumentLibrary.js';
async function replaceHelpCorpusAfterUserChoice(){
const library=createDBOPFSDocumentLibrary({
db:globalThis.dbopfs,
schema:{id:'help',version:'1',table:'help_documents'}
});
await library.bootstrap({files:[{
id:'welcome',title:'Welcome',body:'Arcane apps are portable.',path:'welcome.md'
}]});
console.log(await library.search('portable'));
}
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.