@live-change/vue3-ssr 0.2.18 → 0.2.19
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/Api.js +4 -1
- package/clientApi.js +16 -4
- package/package.json +3 -3
package/Api.js
CHANGED
|
@@ -26,6 +26,8 @@ class Api extends DaoProxy {
|
|
|
26
26
|
this.readyPromise = new Promise(resolve => {
|
|
27
27
|
this.resolveReadyPromise = resolve
|
|
28
28
|
})
|
|
29
|
+
|
|
30
|
+
this.servicesDefinitions = ref()
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
setup(settings = this.settings) {
|
|
@@ -108,7 +110,7 @@ class Api extends DaoProxy {
|
|
|
108
110
|
}
|
|
109
111
|
//console.trace("GENERATE API SERVICES!")
|
|
110
112
|
//console.log("GENERATE SERVICES API", apiInfo)
|
|
111
|
-
const definitions = apiInfo?.services
|
|
113
|
+
const definitions = [...(apiInfo?.services ?? []), ...(this.settings.localDefinitions ?? [])]
|
|
112
114
|
if(JSON.stringify(definitions) == JSON.stringify(api.servicesApiDefinitions)) return
|
|
113
115
|
if(!definitions) throw new Error("API DEFINITIONS NOT FOUND! UNABLE TO GENERATE API!")
|
|
114
116
|
api.uidGenerator = uidGenerator(
|
|
@@ -116,6 +118,7 @@ class Api extends DaoProxy {
|
|
|
116
118
|
, 1, '[]')
|
|
117
119
|
//console.log("GENERATE API DEFINITIONS", definitions)
|
|
118
120
|
api.servicesApiDefinitions = definitions
|
|
121
|
+
api.servicesDefinitions.value = definitions
|
|
119
122
|
let globalViews = {}
|
|
120
123
|
let globalFetch = (...args) => new Path(...args)
|
|
121
124
|
let globalActions = {}
|
package/clientApi.js
CHANGED
|
@@ -5,20 +5,32 @@ import SockJsConnection from '@live-change/dao-sockjs'
|
|
|
5
5
|
import Api from "./Api.js"
|
|
6
6
|
|
|
7
7
|
function clientApi(settings = {}) {
|
|
8
|
-
let credentials =
|
|
8
|
+
let credentials = window.__DAO_CACHE__ ? window.__CREDENTIALS__ : undefined
|
|
9
9
|
if(settings.credentials) {
|
|
10
|
-
credentials = {
|
|
10
|
+
credentials = {
|
|
11
|
+
...credentials,
|
|
12
|
+
...(typeof settings.credentials == 'function' ? settings.credentials(credentials) : settings.credentials)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const local = {}
|
|
16
|
+
for(const key in settings.local) {
|
|
17
|
+
local[key] = {
|
|
18
|
+
type: 'local',
|
|
19
|
+
source: settings.local[key]
|
|
20
|
+
}
|
|
11
21
|
}
|
|
22
|
+
|
|
12
23
|
const dao = new lcdao.Dao(credentials, {
|
|
13
24
|
remoteUrl: settings.remoteUrl || document.location.protocol + '//' + document.location.host + "/api/sockjs",
|
|
14
25
|
protocols: {
|
|
15
26
|
'sockjs': SockJsConnection
|
|
16
27
|
},
|
|
17
28
|
|
|
18
|
-
...
|
|
29
|
+
...local,
|
|
19
30
|
|
|
20
31
|
connectionSettings: {
|
|
21
|
-
fastAuth: !window.hasOwnProperty('
|
|
32
|
+
fastAuth: (!settings.credentials && window.hasOwnProperty('__DAO_CACHE__'))
|
|
33
|
+
&& !window.hasOwnProperty('__CREDENTIALS__'),
|
|
22
34
|
|
|
23
35
|
queueRequestsWhenDisconnected: true,
|
|
24
36
|
requestSendTimeout: Infinity,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/vue3-ssr",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"description": "Live Change Framework - vue components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"homepage": "https://github.com/live-change/live-change-framework-vue3",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@live-change/dao-vue3": "0.5.10",
|
|
25
|
-
"@live-change/uid": "0.7.
|
|
25
|
+
"@live-change/uid": "0.7.18",
|
|
26
26
|
"@vueuse/core": "^9.1.0",
|
|
27
27
|
"debug": "^4.3.4"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "90a9050401e8ac3f2b45505526153b07ccde3839"
|
|
30
30
|
}
|