braid-text 0.2.106 → 0.2.108

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 CHANGED
@@ -209,46 +209,49 @@ function create_braid_text() {
209
209
  }
210
210
 
211
211
  async function send_pump() {
212
- if (signal.aborted) return
213
212
  send_pump_lock++
214
213
  if (send_pump_lock > 1) return
215
- if (in_flight.size >= max_in_flight) return
216
- if (!q.length) {
217
- // Extend frontier based on in-flight updates
218
- var frontier = resource.meta.fork_point || []
219
- for (var u of in_flight.values())
220
- frontier = extend_frontier(frontier, u.version, u.parents)
221
-
222
- var temp_ac = new AbortController()
223
- temp_acs.add(temp_ac)
224
- var get_options = {
225
- signal: temp_ac.signal,
226
- parents: frontier,
227
- merge_type: 'dt',
228
- peer: options.peer,
229
- subscribe: u => u.version?.length && q.push(u)
230
- }
231
- await braid_text.get(a, get_options)
232
- await get_options.my_subscribe_chain
214
+ try {
233
215
  if (signal.aborted) return
234
- temp_ac.abort()
235
- temp_acs.delete(temp_ac)
236
- }
237
- while (q.length && in_flight.size < max_in_flight) {
238
- let u = q.shift()
239
- if (!u.version?.length) continue
240
- in_flight.set(u.version[0], u)
241
- void (async () => {
242
- try {
243
- await send_out(u)
244
- if (signal.aborted) return
245
- in_flight.delete(u.version[0])
246
- setTimeout(send_pump, 0)
247
- } catch (e) { handle_error(e) }
248
- })()
216
+ if (in_flight.size >= max_in_flight) return
217
+ if (!q.length) {
218
+ // Extend frontier based on in-flight updates
219
+ var frontier = resource.meta.fork_point || []
220
+ for (var u of in_flight.values())
221
+ frontier = extend_frontier(frontier, u.version, u.parents)
222
+
223
+ var temp_ac = new AbortController()
224
+ temp_acs.add(temp_ac)
225
+ var get_options = {
226
+ signal: temp_ac.signal,
227
+ parents: frontier,
228
+ merge_type: 'dt',
229
+ peer: options.peer,
230
+ subscribe: u => u.version?.length && q.push(u)
231
+ }
232
+ await braid_text.get(a, get_options)
233
+ await get_options.my_subscribe_chain
234
+ if (signal.aborted) return
235
+ temp_ac.abort()
236
+ temp_acs.delete(temp_ac)
237
+ }
238
+ while (q.length && in_flight.size < max_in_flight) {
239
+ let u = q.shift()
240
+ if (!u.version?.length) continue
241
+ in_flight.set(u.version[0], u)
242
+ void (async () => {
243
+ try {
244
+ await send_out(u)
245
+ if (signal.aborted) return
246
+ in_flight.delete(u.version[0])
247
+ setTimeout(send_pump, 0)
248
+ } catch (e) { handle_error(e) }
249
+ })()
250
+ }
251
+ } finally {
252
+ if (send_pump_lock > 1) setTimeout(send_pump, 0)
253
+ send_pump_lock = 0
249
254
  }
250
- if (send_pump_lock > 1) setTimeout(send_pump, 0)
251
- send_pump_lock = 0
252
255
  }
253
256
 
254
257
  var a_ops = {
package/package.json CHANGED
@@ -1,12 +1,22 @@
1
1
  {
2
2
  "name": "braid-text",
3
- "version": "0.2.106",
3
+ "version": "0.2.108",
4
4
  "description": "Library for collaborative text over http using braid.",
5
5
  "author": "Braid Working Group",
6
6
  "repository": "braid-org/braid-text",
7
7
  "homepage": "https://braid.org",
8
+ "files": [
9
+ "index.js",
10
+ "simpleton-client.js",
11
+ "web-utils.js",
12
+ "README.md",
13
+ "AI-README.md",
14
+ "editor.html",
15
+ "markdown-editor.html",
16
+ "server-demo.js"
17
+ ],
8
18
  "dependencies": {
9
19
  "@braid.org/diamond-types-node": "^2.0.0",
10
- "braid-http": "~1.3.86"
20
+ "braid-http": "~1.3.89"
11
21
  }
12
22
  }
@@ -1,9 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(node test/test.js:*)"
5
- ],
6
- "deny": [],
7
- "ask": []
8
- }
9
- }