@live-change/framework 0.9.156 → 0.9.158
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.
|
@@ -18,12 +18,12 @@ class ForeignModelDefinition {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
$_toQueryDescription() {
|
|
22
22
|
return `[ForeignModel ${this.serviceName}.${this.name}]`
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
toString() {
|
|
26
|
-
return this
|
|
26
|
+
return this.$_toQueryDescription()
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
}
|
|
@@ -6,6 +6,7 @@ export interface IndexDefinitionSpecification {
|
|
|
6
6
|
parameters: Record<string, any>
|
|
7
7
|
storage: any
|
|
8
8
|
multi: boolean,
|
|
9
|
+
sourceName?: string,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
class IndexDefinition<T extends IndexDefinitionSpecification> {
|
|
@@ -48,6 +49,10 @@ class IndexDefinition<T extends IndexDefinitionSpecification> {
|
|
|
48
49
|
return changes
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
|
|
53
|
+
$_toQueryDescription() {
|
|
54
|
+
return `[Index ${this.serviceName}.${this.name}]`
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
export default IndexDefinition
|
|
@@ -31,7 +31,7 @@ export interface ModelDefinitionSpecification {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
class ModelDefinition<T extends ModelDefinitionSpecification> {
|
|
34
|
-
|
|
34
|
+
serviceName: string
|
|
35
35
|
[key: string]: any
|
|
36
36
|
|
|
37
37
|
constructor(definition, serviceName) {
|
|
@@ -53,7 +53,7 @@ class ModelDefinition<T extends ModelDefinitionSpecification> {
|
|
|
53
53
|
return this.serviceName + '_' + this.name
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
$_toQueryDescription() {
|
|
57
57
|
return `[Model ${this.serviceName}.${this.name}]`
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -114,7 +114,7 @@ class ModelDefinition<T extends ModelDefinitionSpecification> {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
toString() {
|
|
117
|
-
return this
|
|
117
|
+
return this.$_toQueryDescription()
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
}
|
package/lib/updaters/database.js
CHANGED
|
@@ -77,10 +77,10 @@ async function update(changes, service, app, force) {
|
|
|
77
77
|
requestTimeout: 24 * 60 * 60 * 1000 // 10 minutes?
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
async function doCreateIndexIfNotExists(indexName, functionCode, parameters,
|
|
80
|
+
async function doCreateIndexIfNotExists(indexName, functionCode, parameters, config) {
|
|
81
81
|
try {
|
|
82
82
|
await dao.requestWithSettings(indexRequestSettings, ['database', 'createIndex'], database, indexName,
|
|
83
|
-
functionCode, parameters,
|
|
83
|
+
functionCode, parameters, config)
|
|
84
84
|
} catch(e) {
|
|
85
85
|
if((e.message ?? e).toString().includes("already exists")) {
|
|
86
86
|
const indexConfig = await dao.get(['database', 'indexConfig', database, indexName])
|
|
@@ -97,7 +97,7 @@ async function update(changes, service, app, force) {
|
|
|
97
97
|
if(!match) {
|
|
98
98
|
console.log("INDEXES NOT MATCHING, DELETING AND RECREATING", indexConfigClean, requiredConfig)
|
|
99
99
|
await dao.requestWithSettings(updaterRequestSettings, ['database', 'deleteIndex'], database, indexName)
|
|
100
|
-
return await doCreateIndexIfNotExists(indexName, functionCode, parameters,
|
|
100
|
+
return await doCreateIndexIfNotExists(indexName, functionCode, parameters, config)
|
|
101
101
|
} else {
|
|
102
102
|
console.log("INDEXES MATCHING, SKIPPING")
|
|
103
103
|
return 'ok'
|
|
@@ -119,7 +119,12 @@ async function update(changes, service, app, force) {
|
|
|
119
119
|
if(index.function) {
|
|
120
120
|
const functionCode = `(${index.function})`
|
|
121
121
|
;(globalThis.compiledFunctionsCandidates = globalThis.compiledFunctionsCandidates || {})[functionCode] = index.function
|
|
122
|
-
await doCreateIndexIfNotExists(
|
|
122
|
+
await doCreateIndexIfNotExists(
|
|
123
|
+
indexName,
|
|
124
|
+
functionCode,
|
|
125
|
+
{ ...(index.parameters || {}) },
|
|
126
|
+
{ ...index.storage ?? {}, sourceName: index.sourceName ?? undefined }
|
|
127
|
+
)
|
|
123
128
|
} else {
|
|
124
129
|
if(!table) throw new Error("only function indexes are possible without table")
|
|
125
130
|
if(index.multi) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/framework",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.158",
|
|
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.
|
|
26
|
-
"@live-change/uid": "^0.9.
|
|
25
|
+
"@live-change/dao": "^0.9.158",
|
|
26
|
+
"@live-change/uid": "^0.9.158",
|
|
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": "
|
|
31
|
+
"gitHead": "bd30de9030c65b93fbb26b6879f574d5f93baea3"
|
|
32
32
|
}
|