braid-text 0.0.24 → 0.0.25
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.
- package/index.js +9 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -210,12 +210,12 @@ braid_text.get = async (key, options) => {
|
|
|
210
210
|
if (options.version || options.parents) doc = dt_get(doc, options.version || options.parents)
|
|
211
211
|
|
|
212
212
|
return {
|
|
213
|
-
version: doc.getRemoteVersion().map((x) => x.join("-")),
|
|
213
|
+
version: doc.getRemoteVersion().map((x) => x.join("-")).sort(),
|
|
214
214
|
body: doc.get()
|
|
215
215
|
}
|
|
216
216
|
} else {
|
|
217
217
|
if (options.merge_type != "dt") {
|
|
218
|
-
let version = resource.doc.getRemoteVersion().map((x) => x.join("-"))
|
|
218
|
+
let version = resource.doc.getRemoteVersion().map((x) => x.join("-")).sort()
|
|
219
219
|
let x = { version }
|
|
220
220
|
|
|
221
221
|
if (!options.parents && !options.version) {
|
|
@@ -300,7 +300,7 @@ braid_text.put = async (key, options) => {
|
|
|
300
300
|
|
|
301
301
|
let resource = (typeof key == 'string') ? await get_resource(key) : key
|
|
302
302
|
|
|
303
|
-
let parents = resource.doc.getRemoteVersion().map((x) => x.join("-"))
|
|
303
|
+
let parents = resource.doc.getRemoteVersion().map((x) => x.join("-")).sort()
|
|
304
304
|
let og_parents = options_parents || parents
|
|
305
305
|
|
|
306
306
|
let max_pos = count_code_points(v_eq(parents, og_parents) ?
|
|
@@ -440,7 +440,7 @@ braid_text.put = async (key, options) => {
|
|
|
440
440
|
patches = get_xf_patches(resource.doc, v_before)
|
|
441
441
|
console.log(JSON.stringify({ patches }))
|
|
442
442
|
|
|
443
|
-
let version = resource.doc.getRemoteVersion().map((x) => x.join("-"))
|
|
443
|
+
let version = resource.doc.getRemoteVersion().map((x) => x.join("-")).sort()
|
|
444
444
|
|
|
445
445
|
for (let client of resource.simpleton_clients) {
|
|
446
446
|
if (client.peer == peer) {
|
|
@@ -450,7 +450,7 @@ braid_text.put = async (key, options) => {
|
|
|
450
450
|
function set_timeout(time_override) {
|
|
451
451
|
if (client.my_timeout) clearTimeout(client.my_timeout)
|
|
452
452
|
client.my_timeout = setTimeout(() => {
|
|
453
|
-
let version = resource.doc.getRemoteVersion().map((x) => x.join("-"))
|
|
453
|
+
let version = resource.doc.getRemoteVersion().map((x) => x.join("-")).sort()
|
|
454
454
|
let x = { version }
|
|
455
455
|
x.parents = client.my_last_seen_version
|
|
456
456
|
|
|
@@ -513,7 +513,7 @@ braid_text.put = async (key, options) => {
|
|
|
513
513
|
}
|
|
514
514
|
} else {
|
|
515
515
|
if (resource.simpleton_clients.size) {
|
|
516
|
-
let version = resource.doc.getRemoteVersion().map((x) => x.join("-"))
|
|
516
|
+
let version = resource.doc.getRemoteVersion().map((x) => x.join("-")).sort()
|
|
517
517
|
patches = get_xf_patches(resource.doc, v_before)
|
|
518
518
|
let x = { version, parents, patches }
|
|
519
519
|
console.log(`sending: ${JSON.stringify(x)}`)
|
|
@@ -836,7 +836,7 @@ function OpLog_get_patches(bytes, op_runs) {
|
|
|
836
836
|
let patches = []
|
|
837
837
|
op_runs.forEach((op_run) => {
|
|
838
838
|
let version = versions[i].join("-")
|
|
839
|
-
let parents = parentss[i].map((x) => x.join("-"))
|
|
839
|
+
let parents = parentss[i].map((x) => x.join("-")).sort()
|
|
840
840
|
let start = op_run.start
|
|
841
841
|
let end = start + 1
|
|
842
842
|
if (op_run.content) op_run.content = [...op_run.content]
|
|
@@ -863,7 +863,7 @@ function OpLog_get_patches(bytes, op_runs) {
|
|
|
863
863
|
})
|
|
864
864
|
if (j == len) break
|
|
865
865
|
version = versions[I].join("-")
|
|
866
|
-
parents = parentss[I].map((x) => x.join("-"))
|
|
866
|
+
parents = parentss[I].map((x) => x.join("-")).sort()
|
|
867
867
|
start = op_run.start + j
|
|
868
868
|
content = ""
|
|
869
869
|
}
|
|
@@ -1450,6 +1450,7 @@ function decode_filename(encodedFilename) {
|
|
|
1450
1450
|
|
|
1451
1451
|
function validate_version_array(x) {
|
|
1452
1452
|
if (!Array.isArray(x)) throw new Error(`invalid version array: not an array`)
|
|
1453
|
+
x.sort()
|
|
1453
1454
|
for (xx of x) validate_actor_seq(xx)
|
|
1454
1455
|
}
|
|
1455
1456
|
|