dmx-api 3.0.0 → 3.1.0

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/README.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## Version History
4
4
 
5
+ **3.1** -- Oct 16, 2024
6
+
7
+ * Adapted to DMX 5.3.5 (account management)
8
+
9
+ **3.0.1** -- Jun 6, 2023
10
+
11
+ * Improvement:
12
+ - In case of a dropped WebSocket connection an alert is shown and the page is reloaded
13
+
5
14
  **3.0** -- May 19, 2023
6
15
 
7
16
  Version 3.0 of the `dmx-api` library extends/modifies the API in order to support a wider variety of frontend
@@ -30,6 +39,7 @@ library's `init()` function.
30
39
  - change `Type`'s `newFormModel()`:
31
40
  - `object` parameter is now optional
32
41
  - add `allChildren` parameter (optional)
42
+ - add (optional) `level` parameter to `CompDef`'s `emptyChildInstance()`
33
43
  - add `panX`, `panY`, `zoom`, `bgImageUrl` getters to `Topicmap`
34
44
  - add `updateTopic()`, `updateAssoc()` to `Topicmap` (part of
35
45
  [dmx-topicmap-panel](https://github.com/dmx-systems/dmx-topicmap-panel) protocol)
@@ -46,7 +56,7 @@ library's `init()` function.
46
56
  * Utils:
47
57
  - add `stripHtml()`
48
58
  * Fix:
49
- - fixed a bug where nested entities loose their child values while update request
59
+ - fixed a bug where nested entities loose their child values while update request (thanks to @gevlish)
50
60
 
51
61
  **2.1** -- Jun 13, 2021
52
62
 
@@ -316,4 +326,4 @@ library's `init()` function.
316
326
 
317
327
  ------------
318
328
  Jörg Richter
319
- Jun 13, 2021
329
+ Oct 16, 2024
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dmx-api",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "API and utilities for DMX 5 based frontends",
5
5
  "author": "Jörg Richter <jri@dmx.berlin>",
6
6
  "license": "AGPL-3.0",
@@ -9,10 +9,6 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/dmx-systems/dmx-api.git"
11
11
  },
12
- "scripts": {
13
- "build": "../../node_modules/.bin/webpack -p --hide-modules",
14
- "stats": "../../node_modules/.bin/webpack -p --json > stats.json && ../../node_modules/.bin/webpack-bundle-analyzer stats.json dist"
15
- },
16
12
  "dependencies": {
17
13
  "axios": "0.18.1",
18
14
  "clone": "2.1.2",
package/src/index.js CHANGED
@@ -6,7 +6,7 @@ import icons from './icons'
6
6
  import DMXWebSocket from './websocket'
7
7
  import {default as typeCache, init as initTypeCache, storeModule} from './type-cache'
8
8
 
9
- console.log('[DMX-API] 3.0')
9
+ console.log('[DMX-API] 3.1')
10
10
 
11
11
  let adminWorkspaceId // promise
12
12
 
@@ -42,7 +42,6 @@ export default {
42
42
  }
43
43
 
44
44
  function updateClientIdCookie () {
45
- // DEV && console.log('dmx_client_id', clientId)
46
45
  utils.setCookie('dmx_client_id', clientId)
47
46
  }
48
47
 
package/src/rpc.js CHANGED
@@ -541,7 +541,7 @@ export default {
541
541
  * @return a promise for a Username topic
542
542
  */
543
543
  createUserAccount (username, password) {
544
- return http.post('/access-control/user-account', {
544
+ return http.post('/account-management/user-account', {
545
545
  username, password
546
546
  }).then(response =>
547
547
  new Topic(response.data)
package/src/websocket.js CHANGED
@@ -1,5 +1,4 @@
1
- const IDLE_INTERVAL = 60 * 1000 // 60s
2
- const RECONNECT_DELAY = 5 * 1000 // 5s
1
+ const IDLE_INTERVAL = 60 * 1000 // 60s
3
2
 
4
3
  /**
5
4
  * A WebSocket connection to the DMX server.
@@ -48,20 +47,15 @@ export default class DMXWebSocket {
48
47
  this.messageHandler(message)
49
48
  }
50
49
  this.ws.onclose = e => {
51
- DEV && console.log('[DMX] Closing WebSocket connection (' + e.reason + '), try reconnect in ' +
52
- RECONNECT_DELAY / 1000 + ' seconds')
50
+ DEV && console.log('[DMX] WebSocket connection closed (' + e.reason + ')')
53
51
  this._stopIdling()
54
- this._reconnect()
52
+ this._reload() // a closed ws connection is regarded an (backend/network) error which requires page reloading
55
53
  }
56
54
  this.ws.onerror = e => {
57
55
  DEV && console.warn('[DMX] WebSocket error')
58
56
  }
59
57
  }
60
58
 
61
- _reconnect () {
62
- setTimeout(this._connect.bind(this), RECONNECT_DELAY)
63
- }
64
-
65
59
  _startIdling () {
66
60
  this.idleId = setInterval(this._idle.bind(this), IDLE_INTERVAL)
67
61
  }
@@ -74,4 +68,12 @@ export default class DMXWebSocket {
74
68
  DEV && console.log('[DMX] WebSocket connection idle')
75
69
  this.send({type: 'idle'})
76
70
  }
71
+
72
+ _reload () {
73
+ setTimeout(() => {
74
+ alert('There is a problem with the server or network.\n\nPlease press OK to reload page.\n' +
75
+ 'If it fails try manual page reload.')
76
+ location.reload()
77
+ }, 1000) // timeout to not interfere with interactive page reload (which also closes websocket connection)
78
+ }
77
79
  }