@live-change/framework 0.9.92 → 0.9.94

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.
@@ -81,15 +81,21 @@ async function update(changes, service, app, force) {
81
81
  const indexConfigClean = JSON.stringify({
82
82
  ...indexConfig,
83
83
  uid: undefined,
84
- sources
84
+ sources: undefined
85
85
  })
86
86
  const requiredConfig = JSON.stringify({
87
87
  code: functionCode,
88
88
  parameters
89
89
  })
90
90
  const match = indexConfigClean === requiredConfig
91
+ console.log('ERROR INDEX MATCH', indexConfigClean, requiredConfig, "MATCH", match)
91
92
  if(!match) {
92
- console.log('ERROR INDEX MATCH', indexConfigClean, requiredConfig, "MATCH", match)
93
+ console.log("INDEXES NOT MATCHING, DELETING AND RECREATING")
94
+ await dao.request(['database', 'deleteIndex'], database, indexName)
95
+ return await doCreateIndexIfNotExists(indexName, functionCode, parameters, storage)
96
+ } else {
97
+ console.log("INDEXES MATCHING, SKIPPING")
98
+ return 'ok'
93
99
  }
94
100
  }
95
101
  throw e
@@ -112,8 +118,7 @@ async function update(changes, service, app, force) {
112
118
  if(index.function) {
113
119
  const functionCode = `(${index.function})`
114
120
  ;(globalThis.compiledFunctionsCandidates = globalThis.compiledFunctionsCandidates || {})[functionCode] = index.function
115
- await dao.request(['database', 'createIndex'], database, indexName, functionCode,
116
- { ...(index.parameters || {}) }, index.storage ?? {})
121
+ await doCreateIndexIfNotExists(indexName, functionCode, { ...(index.parameters || {}) }, index.storage ?? {})
117
122
  } else {
118
123
  if(!table) throw new Error("only function indexes are possible without table")
119
124
  if(index.multi) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/framework",
3
- "version": "0.9.92",
3
+ "version": "0.9.94",
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.92",
26
- "@live-change/uid": "^0.9.92",
25
+ "@live-change/dao": "^0.9.94",
26
+ "@live-change/uid": "^0.9.94",
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": "470f95e97f64dc3b9bbe3e6f809927a4757c2802"
31
+ "gitHead": "8e5736f32c407eb6fb8d6d5cf8cbae2ad558a7a2"
32
32
  }