@dabble/patches 0.5.13 → 0.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Signal } from '../event-signal.js';
|
|
2
|
-
import { Change, PatchesState, ChangeInput, CommitChangesOptions, EditableVersionMetadata, ListVersionsOptions, VersionMetadata, PatchesSnapshot } from '../types.js';
|
|
2
|
+
import { Change, PatchesState, ChangeInput, CommitChangesOptions, DeleteDocOptions, EditableVersionMetadata, ListVersionsOptions, VersionMetadata, PatchesSnapshot } from '../types.js';
|
|
3
3
|
import { JSONRPCClient } from './protocol/JSONRPCClient.js';
|
|
4
4
|
import { PatchesAPI, ClientTransport } from './protocol/types.js';
|
|
5
5
|
import '../json-patch/JSONPatch.js';
|
|
@@ -61,9 +61,10 @@ declare class PatchesClient implements PatchesAPI {
|
|
|
61
61
|
/**
|
|
62
62
|
* Deletes a document on the server.
|
|
63
63
|
* @param docId - The ID of the document to delete.
|
|
64
|
+
* @param options - Optional deletion settings (e.g., skipTombstone).
|
|
64
65
|
* @returns A promise resolving when the deletion is confirmed.
|
|
65
66
|
*/
|
|
66
|
-
deleteDoc(docId: string): Promise<void>;
|
|
67
|
+
deleteDoc(docId: string, options?: DeleteDocOptions): Promise<void>;
|
|
67
68
|
/**
|
|
68
69
|
* Creates a named version snapshot of a document's current state on the server.
|
|
69
70
|
* @param docId - The ID of the document.
|
|
@@ -74,10 +74,11 @@ class PatchesClient {
|
|
|
74
74
|
/**
|
|
75
75
|
* Deletes a document on the server.
|
|
76
76
|
* @param docId - The ID of the document to delete.
|
|
77
|
+
* @param options - Optional deletion settings (e.g., skipTombstone).
|
|
77
78
|
* @returns A promise resolving when the deletion is confirmed.
|
|
78
79
|
*/
|
|
79
|
-
async deleteDoc(docId) {
|
|
80
|
-
return this.rpc.call("deleteDoc", { docId });
|
|
80
|
+
async deleteDoc(docId, options) {
|
|
81
|
+
return this.rpc.call("deleteDoc", { docId, options });
|
|
81
82
|
}
|
|
82
83
|
// === Version Operations ===
|
|
83
84
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PatchesState, Change, CommitChangesOptions, ListVersionsOptions, VersionMetadata, EditableVersionMetadata, ListChangesOptions, Branch } from '../../types.js';
|
|
1
|
+
import { PatchesState, Change, CommitChangesOptions, DeleteDocOptions, ListVersionsOptions, VersionMetadata, EditableVersionMetadata, ListChangesOptions, Branch } from '../../types.js';
|
|
2
2
|
import { PatchesBranchManager } from '../../server/PatchesBranchManager.js';
|
|
3
3
|
import { PatchesHistoryManager } from '../../server/PatchesHistoryManager.js';
|
|
4
4
|
import { PatchesServer } from '../../server/PatchesServer.js';
|
|
@@ -78,9 +78,11 @@ declare class RPCServer {
|
|
|
78
78
|
* @param connectionId - The ID of the connection making the request
|
|
79
79
|
* @param params - The deletion parameters
|
|
80
80
|
* @param params.docId - The ID of the document to delete
|
|
81
|
+
* @param params.options - Optional deletion settings (e.g., skipTombstone)
|
|
81
82
|
*/
|
|
82
83
|
deleteDoc(params: {
|
|
83
84
|
docId: string;
|
|
85
|
+
options?: DeleteDocOptions;
|
|
84
86
|
}, ctx?: AuthContext): Promise<void>;
|
|
85
87
|
/**
|
|
86
88
|
* Removes the tombstone for a deleted document, allowing it to be recreated.
|
|
@@ -90,11 +90,12 @@ class RPCServer {
|
|
|
90
90
|
* @param connectionId - The ID of the connection making the request
|
|
91
91
|
* @param params - The deletion parameters
|
|
92
92
|
* @param params.docId - The ID of the document to delete
|
|
93
|
+
* @param params.options - Optional deletion settings (e.g., skipTombstone)
|
|
93
94
|
*/
|
|
94
95
|
async deleteDoc(params, ctx) {
|
|
95
|
-
const { docId } = params;
|
|
96
|
+
const { docId, options } = params;
|
|
96
97
|
await this.assertWrite(ctx, docId, "deleteDoc", params);
|
|
97
|
-
await this.patches.deleteDoc(docId, ctx?.clientId);
|
|
98
|
+
await this.patches.deleteDoc(docId, ctx?.clientId, options);
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
101
|
* Removes the tombstone for a deleted document, allowing it to be recreated.
|
package/dist/server/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { PatchesBranchManager } from './PatchesBranchManager.js';
|
|
|
3
3
|
export { PatchesHistoryManager } from './PatchesHistoryManager.js';
|
|
4
4
|
export { PatchesServer, PatchesServerOptions } from './PatchesServer.js';
|
|
5
5
|
export { BranchingStoreBackend, PatchesStoreBackend } from './types.js';
|
|
6
|
-
export { CommitChangesOptions } from '../types.js';
|
|
6
|
+
export { CommitChangesOptions, DeleteDocOptions } from '../types.js';
|
|
7
7
|
import '../compression/index.js';
|
|
8
8
|
import '../algorithms/shared/lz.js';
|
|
9
9
|
import '../json-patch/types.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dabble/patches",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.14",
|
|
4
4
|
"description": "Immutable JSON Patch implementation based on RFC 6902 supporting operational transformation and last-writer-wins",
|
|
5
5
|
"author": "Jacob Wright <jacwright@gmail.com>",
|
|
6
6
|
"bugs": {
|