@live-change/framework 0.9.84 → 0.9.86

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/lib/App.js CHANGED
@@ -265,7 +265,7 @@ class App {
265
265
  })
266
266
  const routes = await this.dao.get(['database', 'tableRange', this.databaseName, 'triggerRoutes',
267
267
  { gte: trigger.type+'=', lte: trigger.type+'=\xFF\xFF\xFF\xFF' }])
268
- console.log("TRIGGER ROUTES", trigger.type, '=>', routes)
268
+ console.log("TRIGGER ROUTES", trigger.type, '=>', routes.map(r => r.service).join(', '))
269
269
  let promises = []
270
270
  for(const route of routes) {
271
271
  promises.push(this.triggerService({ ...trigger, service: route.service }, { ...data }, true))
@@ -8,10 +8,12 @@ export default function clientSideFilter(service, definition, app) {
8
8
  const view = service.views[viewName]
9
9
 
10
10
  }
11
- for(let modelName in service.models) {
12
- const view = service.views[viewName]
11
+ */
13
12
 
14
- }*/
13
+ for(let modelName in definition.models) {
14
+ const model = definition.models[modelName]
15
+ if(model.indexes) delete model.indexes
16
+ }
15
17
 
16
18
  delete definition.events
17
19
  delete definition.triggers
@@ -8,7 +8,7 @@ class ForeignModelDefinition {
8
8
  }
9
9
 
10
10
  getTypeName() {
11
- return this.serviceName+':'+this.name
11
+ return this.serviceName+'_'+this.name
12
12
  }
13
13
 
14
14
  toJSON() {
@@ -7,7 +7,7 @@ import TriggerDefinition, { TriggerDefinitionSpecification } from "./TriggerDefi
7
7
  import ViewDefinition, { ViewDefinitionSpecification } from "./ViewDefinition.js"
8
8
  import EventDefinition from "./EventDefinition.js"
9
9
  import defaultValidators from '../utils/validators.js'
10
- import { crudChanges } from "../utils.js"
10
+ import { crudChanges, definitionToJSON } from "../utils.js"
11
11
 
12
12
  function createModelProxy(definition, model) {
13
13
  return new Proxy(model, {
@@ -208,7 +208,7 @@ class ServiceDefinition<T extends ServiceDefinitionSpecification> {
208
208
  for(let key in this.views) views[key] = this.views[key].toJSON()
209
209
  let triggers = {}
210
210
  for(let key in this.triggers) triggers[key] = this.triggers[key].map(t=>t.toJSON())
211
- return {
211
+ let json = {
212
212
  ...this,
213
213
  _runtime: undefined,
214
214
  models,
@@ -220,6 +220,8 @@ class ServiceDefinition<T extends ServiceDefinitionSpecification> {
220
220
  events,
221
221
  triggers
222
222
  }
223
+ const fixed = definitionToJSON(json, true)
224
+ return fixed
223
225
  }
224
226
 
225
227
  callTrigger(trigger, data) {
@@ -35,7 +35,6 @@ class ApiServer {
35
35
  allAuthenticators.push(...auth.filter(a => !!a))
36
36
  }
37
37
  for(const service of this.config.services) {
38
- //console.log("SERIVCE AUTH", service.name, service.authenticators)
39
38
  if(service.authenticators) {
40
39
  allAuthenticators.push(...service.authenticators.filter(a => !!a))
41
40
  }
@@ -75,8 +75,9 @@ async function update(changes, service, app, force) {
75
75
 
76
76
  if(index.function) {
77
77
  const functionCode = `(${index.function})`
78
- ;(globalThis.compiledFunctions = globalThis.compiledFunctions || {})[functionCode] = index.function
79
- await dao.request(['database', 'createIndex'], database, indexName, functionCode, { ...(index.parameters || {}) }, index.storage ?? {})
78
+ ;(globalThis.compiledFunctionsCandidates = globalThis.compiledFunctionsCandidates || {})[functionCode] = index.function
79
+ await dao.request(['database', 'createIndex'], database, indexName, functionCode,
80
+ { ...(index.parameters || {}) }, index.storage ?? {})
80
81
  } else {
81
82
  if(!table) throw new Error("only function indexes are possible without table")
82
83
  if(index.multi) {
@@ -118,7 +119,7 @@ async function update(changes, service, app, force) {
118
119
  })
119
120
  }
120
121
  const functionCode = `(${func})`
121
- ;(globalThis.compiledFunctions = globalThis.compiledFunctions || {})[functionCode] = func
122
+ ;(globalThis.compiledFunctionsCandidates = globalThis.compiledFunctionsCandidates || {})[functionCode] = func
122
123
  await dao.requestWithSettings(indexRequestSettings, ['database', 'createIndex'], database, indexName,
123
124
  functionCode, { properties, table, hash: index.hash }, index.storage ?? {})
124
125
  } else {
@@ -137,7 +138,7 @@ async function update(changes, service, app, force) {
137
138
  output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )
138
139
  }
139
140
  const functionCode = `(${func})`
140
- ;(globalThis.compiledFunctions = globalThis.compiledFunctions || {})[functionCode] = func
141
+ ;(globalThis.compiledFunctionsCandidates = globalThis.compiledFunctionsCandidates || {})[functionCode] = func
141
142
  await dao.requestWithSettings(indexRequestSettings, ['database', 'createIndex'], database, indexName,
142
143
  functionCode, { properties, table, hash: index.hash }, index.storage ?? {})
143
144
  }
@@ -91,7 +91,7 @@ async function validate(props, validators, context) {
91
91
  propErrors[propName] = errors[0]
92
92
  }
93
93
  }
94
- console.log("PROP ERRORS", propErrors)
94
+ //console.log("PROP ERRORS", propErrors)
95
95
  if(Object.keys(propErrors).length > 0) throw { properties: propErrors }
96
96
  }
97
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/framework",
3
- "version": "0.9.84",
3
+ "version": "0.9.86",
4
4
  "description": "Live Change Framework - ultimate solution for real time mobile/web apps",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "homepage": "https://github.com/live-change/live-change-stack",
24
24
  "devDependencies": {
25
- "@live-change/dao": "^0.9.84",
26
- "@live-change/uid": "^0.9.84",
25
+ "@live-change/dao": "^0.9.86",
26
+ "@live-change/uid": "^0.9.86",
27
27
  "typedoc": "0.28.3",
28
28
  "typedoc-plugin-markdown": "^4.6.3",
29
29
  "typedoc-plugin-rename-defaults": "^0.7.3"
30
30
  },
31
- "gitHead": "5881a5406e3a39e673034f172266409ddb306f2e"
31
+ "gitHead": "7b0013ef101d9033402eeec45fd1be60e151aada"
32
32
  }
package/typedoc.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "entryPoints": ["index.ts"],
3
- "out": "docs",
3
+ "out": "../../docs/docs/framework",
4
4
  "includeVersion": true,
5
5
  "excludePrivate": true,
6
6
  "excludeInternal": true,