@live-change/vue3-ssr 0.2.17 → 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.
Files changed (3) hide show
  1. package/Api.js +4 -2
  2. package/clientApi.js +16 -4
  3. package/package.json +4 -4
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 = {}
@@ -165,7 +168,6 @@ class Api extends DaoProxy {
165
168
  }
166
169
 
167
170
  if(api.resolveReadyPromise) {
168
- console.trace("RESOLVE READY PROMISE")
169
171
  api.resolveReadyPromise()
170
172
  api.resolveReadyPromise = null
171
173
  }
package/clientApi.js CHANGED
@@ -7,18 +7,30 @@ import Api from "./Api.js"
7
7
  function clientApi(settings = {}) {
8
8
  let credentials = window.__DAO_CACHE__ ? window.__CREDENTIALS__ : undefined
9
9
  if(settings.credentials) {
10
- credentials = { ...credentials, ...settings.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
- remoteUrl: document.location.protocol + '//' + document.location.host + "/api/sockjs",
24
+ remoteUrl: settings.remoteUrl || document.location.protocol + '//' + document.location.host + "/api/sockjs",
14
25
  protocols: {
15
26
  'sockjs': SockJsConnection
16
27
  },
17
28
 
18
- ...settings,
29
+ ...local,
19
30
 
20
31
  connectionSettings: {
21
- fastAuth: !window.hasOwnProperty('__CREDENTIALS__'),
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.17",
3
+ "version": "0.2.19",
4
4
  "description": "Live Change Framework - vue components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,10 +21,10 @@
21
21
  },
22
22
  "homepage": "https://github.com/live-change/live-change-framework-vue3",
23
23
  "dependencies": {
24
- "@live-change/dao-vue3": "0.5.9",
25
- "@live-change/uid": "0.7.15",
24
+ "@live-change/dao-vue3": "0.5.10",
25
+ "@live-change/uid": "0.7.18",
26
26
  "@vueuse/core": "^9.1.0",
27
27
  "debug": "^4.3.4"
28
28
  },
29
- "gitHead": "72026576e9525cfea2960d4f291de151d9d6d112"
29
+ "gitHead": "90a9050401e8ac3f2b45505526153b07ccde3839"
30
30
  }