@@ -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,129 @@ 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+ * Applies changes to a document using patch operations.
312+ * @param params - Configuration object with uri and operations
313+ * @returns A result provider that resolves to patch result
314+ */
315+ patch ( params : {
316+ /** The URI of the document to patch */
317+ uri : string ;
318+ /** Patch operations (from patchBuilder) or raw patch string/Buffer */
319+ operations : any [ ] | string | Buffer ;
320+ /** Categories of information to modify (typically 'content') */
321+ categories ?: string | string [ ] ;
322+ /** Temporal collection name (for temporal documents) */
323+ temporalCollection ?: string ;
324+ /** Temporal document URI */
325+ temporalDocument ?: string ;
326+ /** Source document URI */
327+ sourceDocument ?: string ;
328+ /** Transaction id or Transaction object */
329+ txid ?: string | object ;
330+ /** Version identifier for optimistic locking */
331+ versionId ?: string ;
332+ /** Format: 'json' or 'xml' */
333+ format ?: string ;
334+ } ) : ResultProvider < PatchResult > ;
335+
336+ /**
337+ * Applies changes to a document using patch operations.
338+ * @param uri - The URI of the document to patch
339+ * @param operations - One or more patch operations from patchBuilder
340+ * @returns A result provider that resolves to patch result
341+ */
342+ patch ( uri : string , ...operations : any [ ] ) : ResultProvider < PatchResult > ;
172343 }
173344
174345 /**
0 commit comments