@@ -128,6 +128,60 @@ declare module 'marklogic' {
128128 systemTime ?: string ;
129129 }
130130
131+ /**
132+ * Result from a removeAll operation.
133+ */
134+ export interface RemoveAllResult {
135+ /** Always false (indicates removal operation completed) */
136+ exists : boolean ;
137+ /** Collection that was removed (if specified) */
138+ collection ?: string ;
139+ /** Directory that was removed (if specified) */
140+ directory ?: string ;
141+ /** Whether all documents were removed */
142+ allDocuments ?: boolean ;
143+ }
144+
145+ /**
146+ * Result from a protect operation on a temporal document.
147+ */
148+ export interface ProtectResult {
149+ /** The URI of the protected document */
150+ uri : string ;
151+ /** The temporal collection name */
152+ temporalCollection : string ;
153+ /** The protection level (noWipe, noDelete, or noUpdate) */
154+ level : string ;
155+ }
156+
157+ /**
158+ * Result from a wipe operation on a temporal document.
159+ */
160+ export interface WipeResult {
161+ /** The URI of the wiped document */
162+ uri : string ;
163+ /** The temporal collection name */
164+ temporalCollection : string ;
165+ /** Whether the document was wiped */
166+ wiped : boolean ;
167+ }
168+
169+ /**
170+ * Result from advancing LSQT on a temporal collection.
171+ */
172+ export interface AdvanceLsqtResult {
173+ /** The new Last Stable Query Time */
174+ lsqt : string ;
175+ }
176+
177+ /**
178+ * Result from a patch operation.
179+ */
180+ export interface PatchResult {
181+ /** The URI of the patched document */
182+ uri : string ;
183+ }
184+
131185 /**
132186 * Result from a write operation.
133187 */
@@ -163,12 +217,158 @@ declare module 'marklogic' {
163217 */
164218 write ( documents : DocumentDescriptor | DocumentDescriptor [ ] ) : ResultProvider < WriteResult > ;
165219
220+ /**
221+ * Writes one or more documents with additional parameters.
222+ * @param params - Configuration object with documents and optional parameters
223+ * @returns A result provider that resolves to a write result with document URIs
224+ */
225+ write ( params : {
226+ /** The document(s) to write */
227+ documents : DocumentDescriptor | DocumentDescriptor [ ] ;
228+ /** Categories of information to write */
229+ categories ?: string | string [ ] ;
230+ /** Transaction id or Transaction object */
231+ txid ?: string | object ;
232+ /** Transform to apply on the server */
233+ transform ?: string | object ;
234+ /** Forest name to write to */
235+ forestName ?: string ;
236+ /** Temporal collection for temporal documents */
237+ temporalCollection ?: string ;
238+ /** System time for temporal documents (ISO 8601 string or Date object) */
239+ systemTime ?: string | Date ;
240+ } ) : ResultProvider < WriteResult > ;
241+
166242 /**
167243 * Removes one or more documents.
168244 * @param uris - A URI string or array of URI strings
169245 * @returns A result provider that resolves to a remove result
170246 */
171247 remove ( uris : string | string [ ] ) : ResultProvider < RemoveResult > ;
248+
249+ /**
250+ * Removes all documents in a collection, directory, or database.
251+ * Requires rest-admin role to delete all documents, rest-writer role otherwise.
252+ * @param params - Configuration object with collection, directory, all, or txid properties
253+ * @returns A result provider that resolves to a remove all result
254+ */
255+ removeAll ( params : {
256+ /** The collection whose documents should be deleted */
257+ collection ?: string ;
258+ /** A directory whose documents should be deleted */
259+ directory ?: string ;
260+ /** Delete all documents (requires rest-admin role) */
261+ all ?: boolean ;
262+ /** Transaction id or Transaction object */
263+ txid ?: string | object ;
264+ } ) : ResultProvider < RemoveAllResult > ;
265+
266+ /**
267+ * Protects a temporal document from certain operations.
268+ * Must specify either duration or expireTime.
269+ * @param params - Configuration object with either duration or expireTime
270+ * @returns A result provider that resolves to protect result
271+ */
272+ protect ( params : {
273+ /** The URI of the temporal document */
274+ uri : string ;
275+ /** The temporal collection name */
276+ temporalCollection : string ;
277+ /** Protection level: 'noWipe' | 'noDelete' | 'noUpdate' (default: 'noDelete') */
278+ level ?: string ;
279+ /** Archive path for the document */
280+ archivePath ?: string ;
281+ } & (
282+ { /** Duration as XSD duration string (e.g., 'P30D') */ duration : string ; expireTime ?: never ; } |
283+ { /** Expire time (alternative to duration) */ expireTime : string ; duration ?: never ; }
284+ ) ) : ResultProvider < ProtectResult > ;
285+
286+ /**
287+ * Deletes all versions of a temporal document.
288+ * @param params - Configuration object with uri and temporalCollection
289+ * @returns A result provider that resolves to wipe result
290+ */
291+ wipe ( params : {
292+ /** The URI of the temporal document to wipe */
293+ uri : string ;
294+ /** The temporal collection name */
295+ temporalCollection : string ;
296+ } ) : ResultProvider < WipeResult > ;
297+
298+ /**
299+ * Advances the LSQT (Last Stable Query Time) of a temporal collection.
300+ * @param params - Configuration object or temporal collection name
301+ * @returns A result provider that resolves to the new LSQT
302+ */
303+ advanceLsqt ( params : string | {
304+ /** The temporal collection name */
305+ temporalCollection : string ;
306+ /** Lag in seconds to subtract from maximum system start time */
307+ lag ?: number ;
308+ } ) : ResultProvider < AdvanceLsqtResult > ;
309+
310+ /**
311+ * Creates a writable stream for writing large documents (typically binary) in incremental chunks.
312+ * The document descriptor should NOT include a content property - content is written via the stream.
313+ * @param document - Document descriptor without content property
314+ * @returns A WritableStream with a result() method for tracking completion
315+ */
316+ createWriteStream ( document : {
317+ /** The URI for the document to write to the database */
318+ uri : string ;
319+ /** Collections to which the document should belong */
320+ collections ?: string [ ] ;
321+ /** Permissions controlling document access */
322+ permissions ?: Array < { roleName : string ; capabilities : string [ ] } > ;
323+ /** Additional properties of the document */
324+ properties ?: object ;
325+ /** Weight to increase or decrease document rank */
326+ quality ?: number ;
327+ /** Metadata values of the document */
328+ metadataValues ?: object ;
329+ /** Version identifier for optimistic locking */
330+ versionId ?: number ;
331+ /** Transaction id or Transaction object */
332+ txid ?: string | object ;
333+ /** Transform extension name or [name, params] array */
334+ transform ?: string | [ string , object ] ;
335+ /** Content type of the document */
336+ contentType ?: string ;
337+ } ) : NodeJS . WritableStream & ResultProvider < WriteResult > ;
338+
339+ /**
340+ * Applies changes to a document using patch operations.
341+ * @param params - Configuration object with uri and operations
342+ * @returns A result provider that resolves to patch result
343+ */
344+ patch ( params : {
345+ /** The URI of the document to patch */
346+ uri : string ;
347+ /** Patch operations (from patchBuilder) or raw patch string/Buffer */
348+ operations : any [ ] | string | Buffer ;
349+ /** Categories of information to modify (typically 'content') */
350+ categories ?: string | string [ ] ;
351+ /** Temporal collection name (for temporal documents) */
352+ temporalCollection ?: string ;
353+ /** Temporal document URI */
354+ temporalDocument ?: string ;
355+ /** Source document URI */
356+ sourceDocument ?: string ;
357+ /** Transaction id or Transaction object */
358+ txid ?: string | object ;
359+ /** Version identifier for optimistic locking */
360+ versionId ?: string ;
361+ /** Format: 'json' or 'xml' */
362+ format ?: string ;
363+ } ) : ResultProvider < PatchResult > ;
364+
365+ /**
366+ * Applies changes to a document using patch operations.
367+ * @param uri - The URI of the document to patch
368+ * @param operations - One or more patch operations from patchBuilder
369+ * @returns A result provider that resolves to patch result
370+ */
371+ patch ( uri : string , ...operations : any [ ] ) : ResultProvider < PatchResult > ;
172372 }
173373
174374 /**
0 commit comments