js-bao-wss-client / DocumentIngestsAPI
Interface: DocumentIngestsAPI
Bulk loads of a large document. Accessed as client.documents.ingests.
A bulk load replaces a large document's records with the contents of an artifact, without taking it offline: the copy runs beside the live table and the swap is one transaction. Connected clients converge on the result rather than reloading it.
The verbs are thin — one request each — and the whole session is driven from them: create opens it, uploadChunk sends the artifact a chunk at a time, commit freezes the manifest and starts the pipeline, and get reports progress until the session is terminal. abort gives up and sweeps what was uploaded.
primitive documents ingest is the same sequence from a terminal, and is what most operators should reach for; these exist for an application that has to drive one itself.
Methods
abort()
abort(
documentId,sessionId):Promise<DocumentIngestSession>
Give up on a session and sweep what it uploaded.
Safe at any point before the swap; afterwards the load has landed and there is nothing to abort.
Parameters
documentId
string
The document being loaded into
sessionId
string
The session to abandon
Returns
Promise<DocumentIngestSession>
commit()
commit(
documentId,sessionId):Promise<DocumentIngestSession>
Freeze the session's manifest and start the pipeline.
Returns as soon as the session is committed; the copy, the apply, the reconcile and the swap run on the document's own alarm afterwards. Poll get until the session reports complete or failed.
Parameters
documentId
string
The document being loaded into
sessionId
string
The session to commit
Returns
Promise<DocumentIngestSession>
create()
create(
documentId):Promise<DocumentIngestSession>
Open a bulk-load session on a document.
Refused with DOCUMENT_INGEST_ACTIVE while another session on the same document is still running — one at a time, because a session owns the document's staging tables.
Parameters
documentId
string
The large document to load into
Returns
Promise<DocumentIngestSession>
get()
get(
documentId,sessionId):Promise<DocumentIngestSession>
One session's state and progress.
Parameters
documentId
string
The document the session belongs to
sessionId
string
The session to read
Returns
Promise<DocumentIngestSession>
list()
list(
documentId,options?):Promise<DocumentIngestPage>
A document's bulk-load sessions, newest first.
Parameters
documentId
string
The document whose sessions to list
options?
Page size and cursor
cursor?
string
limit?
number
Returns
Promise<DocumentIngestPage>
uploadChunk()
uploadChunk(
documentId,sessionId,chunk):Promise<DocumentIngestChunkUploadResult>
Upload one chunk of the artifact.
The descriptor travels with the bytes and the server checks both: a body whose length or SHA-256 does not match what the descriptor claims is refused before anything is stored. Ids must ascend within a chunk, and a model's chunks must ascend and not overlap in index order.
Answers for the chunk, not for the session: the accepted byte length and the chunk's place among the ones stored so far.
Parameters
documentId
string
The document being loaded into
sessionId
string
The session this chunk belongs to
chunk
The chunk's descriptor and its stored bytes
Returns
Promise<DocumentIngestChunkUploadResult>