@dabble/patches 0.8.17 → 0.8.18
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.
|
@@ -65,9 +65,8 @@ class OTBranchManager {
|
|
|
65
65
|
endedAt: now,
|
|
66
66
|
endRev: rev,
|
|
67
67
|
startRev: rev,
|
|
68
|
-
name: metadata?.name,
|
|
69
68
|
groupId: branchDocId,
|
|
70
|
-
|
|
69
|
+
...metadata?.name !== void 0 && { name: metadata.name }
|
|
71
70
|
});
|
|
72
71
|
await this.store.createVersion(branchDocId, initialVersionMetadata, initChanges);
|
|
73
72
|
}
|
|
@@ -117,14 +116,15 @@ class OTBranchManager {
|
|
|
117
116
|
const branchVersions = await this.store.listVersions(branchId, { origin: "main" });
|
|
118
117
|
let lastVersionId;
|
|
119
118
|
for (const v of branchVersions) {
|
|
120
|
-
const
|
|
119
|
+
const base = {
|
|
121
120
|
...v,
|
|
122
121
|
origin: "branch",
|
|
123
122
|
startRev: branchStartRevOnSource,
|
|
124
123
|
groupId: branchId,
|
|
125
|
-
branchName: branch.name,
|
|
126
124
|
parentId: lastVersionId
|
|
127
|
-
}
|
|
125
|
+
};
|
|
126
|
+
if (base.parentId === void 0) delete base.parentId;
|
|
127
|
+
const newVersionMetadata = createVersionMetadata(base);
|
|
128
128
|
const changes = await this.store.loadVersionChanges?.(branchId, v.id);
|
|
129
129
|
await this.store.createVersion(sourceDocId, newVersionMetadata, changes);
|
|
130
130
|
lastVersionId = newVersionMetadata.id;
|
package/dist/server/utils.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -176,8 +176,6 @@ interface VersionMetadata {
|
|
|
176
176
|
origin: 'main' | 'offline-branch' | 'branch';
|
|
177
177
|
/** Was this version created while offline? Tracks creation context separately from timeline position. */
|
|
178
178
|
isOffline?: boolean;
|
|
179
|
-
/** User-defined name if origin is 'branch'. */
|
|
180
|
-
branchName?: string;
|
|
181
179
|
/** Whether this version was auto-saved immediately before restoring a previous version. */
|
|
182
180
|
beforeRestored?: boolean;
|
|
183
181
|
/** Unix timestamp in milliseconds of version start. */
|
|
@@ -194,7 +192,7 @@ interface VersionMetadata {
|
|
|
194
192
|
type Disallowed<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & {
|
|
195
193
|
[P in K]?: never;
|
|
196
194
|
};
|
|
197
|
-
type EditableVersionMetadata = Disallowed<VersionMetadata, 'id' | 'parentId' | 'groupId' | 'origin' | '
|
|
195
|
+
type EditableVersionMetadata = Disallowed<VersionMetadata, 'id' | 'parentId' | 'groupId' | 'origin' | 'startedAt' | 'endedAt' | 'endRev' | 'startRev'>;
|
|
198
196
|
/**
|
|
199
197
|
* Options for committing changes.
|
|
200
198
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dabble/patches",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.18",
|
|
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": {
|