@live-change/vue3-ssr 0.2.9 → 0.2.14

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 CHANGED
@@ -154,6 +154,8 @@ class Api extends DaoProxy {
154
154
  api.globals.$actions = this.actions
155
155
  api.globals.$fetch = this.fetch
156
156
 
157
+ api.windowId = this.settings.windowId || api.uid()
158
+
157
159
  for(const glob of this.globalInstances) {
158
160
  this.installInstanceProperties(glob)
159
161
  }
@@ -239,6 +241,10 @@ class Api extends DaoProxy {
239
241
  reverse: !range.reverse
240
242
  }
241
243
  }
244
+
245
+ getServiceDefinition(serviceName) {
246
+ return this.metadata.api.value.services.find(s => s.name == serviceName)
247
+ }
242
248
  }
243
249
 
244
- export default Api
250
+ export default Api
package/clientApi.js CHANGED
@@ -41,6 +41,7 @@ function clientApi(settings = {}) {
41
41
  api.setup({
42
42
  ssr: true,
43
43
  cache: true,
44
+ ...settings,
44
45
  createReactiveObject(definition) {
45
46
  //console.log("CREATE REACTIVE OBJECT", definition)
46
47
  return createReactiveObject(definition, reactiveMixin(api), reactivePrefetchMixin(api) )
@@ -54,4 +55,4 @@ function clientApi(settings = {}) {
54
55
  return api
55
56
  }
56
57
 
57
- export { clientApi }
58
+ export { clientApi }
package/index.js CHANGED
@@ -1,29 +1,34 @@
1
1
  import { getCurrentInstance, onUnmounted } from 'vue'
2
- import { live as d3live, RangeBuckets } from '@live-change/dao-vue3'
2
+ import { live as d3live, fetch as d3fetch, RangeBuckets } from '@live-change/dao-vue3'
3
+ import { InboxReader } from '@live-change/dao'
3
4
 
4
- function api(context) {
5
+ function useApi(context) {
5
6
  context = context || getCurrentInstance().appContext
6
7
  return context.config.globalProperties.$lc
7
8
  }
8
9
 
9
10
  function path(context) {
10
- return api(context).fetch
11
+ return useApi(context).fetch
11
12
  }
12
13
 
13
14
  function view(context) {
14
- return api(context).view
15
+ return useApi(context).view
15
16
  }
16
17
 
17
18
  function actions(context) {
18
- return api(context).actions
19
+ return useApi(context).actions
19
20
  }
20
21
 
21
22
  function live(path) {
22
- return d3live(api(), path)
23
+ return d3live(useApi(), path)
24
+ }
25
+
26
+ function fetch(path) {
27
+ return d3fetch(useApi(), path)
23
28
  }
24
29
 
25
30
  async function rangeBuckets(pathFunction, options, app = getCurrentInstance()) {
26
- const lc = api()
31
+ const lc = useApi()
27
32
  const extendedPathFunction = (range) => pathFunction(range, lc.fetch)
28
33
  const buckets = new RangeBuckets(lc, extendedPathFunction, options)
29
34
  if(app) {
@@ -56,12 +61,33 @@ function reverseRange(range) {
56
61
  }
57
62
  }
58
63
 
64
+ function inboxReader(pathFunction, callback, start = '', options = {}) {
65
+ const {
66
+ bucketSize = 32,
67
+ context = getCurrentInstance().appContext
68
+ } = options
69
+ const api = useApi(context)
70
+ return new InboxReader((position, bucketSize) => {
71
+ const path = pathFunction(position, bucketSize)
72
+ console.log("OBSERVE PATH", path)
73
+ return api.observable(path)
74
+ }, callback, start, bucketSize)
75
+ }
76
+
59
77
  function client(context) {
60
- return api(context).client
78
+ return useApi(context).client
61
79
  }
62
80
 
63
81
  function uid(context) {
64
- return api(context).uid
82
+ return useApi(context).uid
65
83
  }
66
84
 
67
- export { path, api, view, actions, live, client, uid, rangeBuckets, reverseRange }
85
+ const api = useApi
86
+
87
+ export {
88
+ path, live, fetch,
89
+ useApi, api,
90
+ view, actions, client, uid,
91
+ rangeBuckets, reverseRange,
92
+ inboxReader
93
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/vue3-ssr",
3
- "version": "0.2.9",
3
+ "version": "0.2.14",
4
4
  "description": "Live Change Framework - vue components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,10 +21,11 @@
21
21
  },
22
22
  "homepage": "https://github.com/live-change/live-change-framework-vue3",
23
23
  "dependencies": {
24
- "@live-change/uid": "0.6.0",
24
+ "@live-change/dao-vue3": "0.4.13",
25
+ "@live-change/uid": "0.6.5",
25
26
  "@vueuse/core": "^8.3.1",
26
27
  "debug": "^4.3.4",
27
28
  "vue": "^3.2.33"
28
29
  },
29
- "gitHead": "efcb8e4afc03219f588d6e782f29e4f3f74af3cf"
30
+ "gitHead": "f50a4c0ce7348ff25bcc59ec2de24a1da18a3210"
30
31
  }
package/serverApi.js CHANGED
@@ -7,6 +7,7 @@ async function serverApi(dao, settings = {}) {
7
7
  const api = new Api(dao)
8
8
  api.setup({
9
9
  ssr: true,
10
+ ...settings,
10
11
  createReactiveObject(definition) {
11
12
  return createReactiveObject(definition, reactiveMixin(api)/*, reactivePrefetchMixin(api)*/ )
12
13
  }