11import tv4 from 'tv4' ;
2+ import type RemoteStorage from './remotestorage' ;
23import type { JsonSchemas } from './interfaces/json_schema' ;
34import type { ChangeObj } from './interfaces/change_obj' ;
45import type { QueuedRequestResponse } from './interfaces/queued_request_response' ;
@@ -7,7 +8,6 @@ import SchemaNotFound from './schema-not-found-error';
78import EventHandling from './eventhandling' ;
89import config from './config' ;
910import { applyMixins , cleanPath , isFolder } from './util' ;
10- import RemoteStorage from './remotestorage' ;
1111
1212function getModuleNameFromBase ( path : string ) : string {
1313 const parts = path . split ( '/' ) ;
@@ -147,8 +147,8 @@ function getModuleNameFromBase(path: string): string {
147147 * during sync.
148148 *
149149 * > [!NOTE]
150- * > Automatically receiving remote changes depends on the { @link caching!Caching} settings
151- * > for your module/paths.
150+ * > Automatically receiving remote changes depends on the
151+ * > { @link caching!Caching caching} settings for your module/paths.
152152 *
153153 * ### `window`
154154 *
@@ -180,13 +180,13 @@ function getModuleNameFromBase(path: string): string {
180180 * }
181181 * ```
182182 *
183- * But when this change is pushed out by asynchronous synchronization, this change
184- * may be rejected by the server, if the remote version has in the meantime changed
185- * from `white` to for instance `red`; this will then lead to a change event with
186- * origin `conflict` ( usually a few seconds after the event with origin `window`,
187- * if you have those activated) . Note that since you already changed it from
188- * `white` to `blue` in the local version a few seconds ago, `oldValue` is now
189- * your local value of `blue`:
183+ * However, when this change is pushed out by the sync process, it will be
184+ * rejected by the server, if the remote version has changed in the meantime,
185+ * for example from `white` to `red`. This will lead to a change event with
186+ * origin `conflict`, usually a few seconds after the event with origin
187+ * `window` . Note that since you already changed it from `white` to `blue` in
188+ * the local version a few seconds ago, `oldValue` is now your local value of
189+ * `blue`:
190190 *
191191 * ```js
192192 * {
@@ -212,11 +212,6 @@ function getModuleNameFromBase(path: string): string {
212212 *
213213 * If there is an algorithm to merge the differences between local and remote
214214 * versions of the data, conflicts may be automatically resolved.
215- * {@link storeObject} or {@link storeFile} must not be called synchronously from
216- * the change event handler, nor by chaining Promises. {@link storeObject} or
217- * {@link storeFile} must not be called until the next iteration of the JavaScript
218- * Task Queue, using for example
219- * [`setTimeout()`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout).
220215 *
221216 * If no algorithm exists, conflict resolution typically involves displaying local
222217 * and remote versions to the user, and having the user merge them, or choose
@@ -625,17 +620,16 @@ export class BaseClient {
625620 * @example
626621 * client.remove('path/to/object').then(() => console.log('item deleted'));
627622 */
628- // TODO add real return type
629623 // TODO Don't return the RemoteResponse directly, handle response properly
630- remove ( path : string ) : Promise < unknown > {
624+ async remove ( path : string ) : Promise < QueuedRequestResponse > {
631625 if ( typeof path !== 'string' ) {
632626 return Promise . reject ( 'Argument \'path\' of baseClient.remove must be a string' ) ;
633627 }
634628 if ( ! this . storage . access . checkPathPermission ( this . makePath ( path ) , 'rw' ) ) {
635629 console . warn ( 'WARNING: Removing a document to which only read access (\'r\') was claimed' ) ;
636630 }
637631
638- return this . storage . delete ( this . makePath ( path ) ) ;
632+ return this . storage . delete ( this . makePath ( path ) , this . storage . connected ) ;
639633 }
640634
641635 /**
0 commit comments