@live-change/prosemirror-service 0.2.42 → 0.2.44

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.
Files changed (2) hide show
  1. package/index.js +10 -2
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -2,9 +2,13 @@ const App = require("@live-change/framework")
2
2
  const app = App.app()
3
3
 
4
4
  const definition = require('./definition.js')
5
+ const config = definition.config
5
6
 
6
7
  const { Document, StepsBucket, schemas } = require("./model.js")
7
8
 
9
+ const { testLatency } = config
10
+ const sleep = ms => new Promise(r => setTimeout(r, ms))
11
+
8
12
  definition.view({
9
13
  name: 'document',
10
14
  properties: {
@@ -16,7 +20,8 @@ definition.view({
16
20
  returns: {
17
21
  type: Document
18
22
  },
19
- daoPath({ document }, { client, context }) {
23
+ async daoPath({ document }, { client, context }) {
24
+ if(testLatency) await sleep(testLatency)
20
25
  return Document.path( document )
21
26
  }
22
27
  })
@@ -36,7 +41,8 @@ definition.view({
36
41
  type: StepsBucket
37
42
  }
38
43
  },
39
- daoPath(props, { client, context }) {
44
+ async daoPath(props, { client, context }) {
45
+ if(testLatency) await sleep(testLatency)
40
46
  const path = StepsBucket.rangePath([props.document], App.extractRange(props))
41
47
  console.log("PATH", path)
42
48
  return path
@@ -64,6 +70,7 @@ definition.action({
64
70
  }
65
71
  },
66
72
  async execute({ document, type, purpose, content }, { client, service }, emit) {
73
+ if(testLatency) await sleep(testLatency)
67
74
  if(!schemas[type]) throw new Error(`schema not found for document type ${type}`)
68
75
  const documentData = await Document.get(document)
69
76
  if(documentData) throw new Error('document already exists')
@@ -100,6 +107,7 @@ definition.action({
100
107
  },
101
108
  queuedBy: (command) => command.client.document,
102
109
  async execute({ document, type, version, steps, window }, { client, service }, emit) {
110
+ if(testLatency) await sleep(testLatency)
103
111
  if(!schemas[type]) throw new Error(`schema not found for document type ${type}`)
104
112
  const documentData = await Document.get(document)
105
113
  if(!documentData) throw new Error('document not found')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/prosemirror-service",
3
- "version": "0.2.42",
3
+ "version": "0.2.44",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,12 +21,12 @@
21
21
  "url": "https://www.viamage.com/"
22
22
  },
23
23
  "dependencies": {
24
- "@live-change/framework": "0.6.9",
25
- "@live-change/relations-plugin": "0.6.8",
24
+ "@live-change/framework": "0.6.10",
25
+ "@live-change/relations-plugin": "0.6.10",
26
26
  "lru-cache": "^7.12.0",
27
27
  "pluralize": "8.0.0",
28
28
  "progress-stream": "^2.0.0",
29
29
  "prosemirror-model": "^1.18.1"
30
30
  },
31
- "gitHead": "ad7e746f87b5c7be7d040885ca228aab2ec2f23e"
31
+ "gitHead": "aded4481299d6f56450603608cf1b0ec199156c5"
32
32
  }