@live-change/framework 0.7.38 → 0.8.0
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/index.js +34 -20
- package/lib/App.js +31 -31
- package/lib/clientSideFilters/accessFilter.js +2 -2
- package/lib/clientSideFilters/clientSideFilter.js +1 -1
- package/lib/definition/ActionDefinition.js +2 -3
- package/lib/definition/EventDefinition.js +2 -3
- package/lib/definition/ForeignIndexDefinition.js +1 -2
- package/lib/definition/ForeignModelDefinition.js +1 -3
- package/lib/definition/IndexDefinition.js +1 -5
- package/lib/definition/ModelDefinition.js +5 -7
- package/lib/definition/PropertyDefinition.js +5 -5
- package/lib/definition/ServiceDefinition.js +13 -13
- package/lib/definition/TriggerDefinition.js +2 -2
- package/lib/definition/ViewDefinition.js +2 -2
- package/lib/processes/commandExecutor.js +5 -5
- package/lib/processes/eventListener.js +2 -2
- package/lib/processes/triggerExecutor.js +5 -5
- package/lib/processors/accessControl.js +2 -2
- package/lib/processors/accessMethod.js +1 -3
- package/lib/processors/autoValidation.js +2 -2
- package/lib/processors/crudGenerator.js +2 -2
- package/lib/processors/daoPathView.js +2 -2
- package/lib/processors/draftGenerator.js +2 -2
- package/lib/processors/fetchView.js +2 -2
- package/lib/processors/indexCode.js +1 -2
- package/lib/processors/indexList.js +2 -2
- package/lib/processors/reverseRelation.js +2 -2
- package/lib/runtime/Action.js +2 -2
- package/lib/runtime/ApiServer.js +5 -5
- package/lib/runtime/Dao.js +3 -3
- package/lib/runtime/EventHandler.js +2 -2
- package/lib/runtime/ForeignModel.js +2 -2
- package/lib/runtime/Index.js +4 -4
- package/lib/runtime/LiveDao.js +4 -4
- package/lib/runtime/Model.js +6 -8
- package/lib/runtime/ReaderModel.js +19 -19
- package/lib/runtime/SearchIndexer.js +1 -3
- package/lib/runtime/Service.js +9 -9
- package/lib/runtime/SessionDao.js +4 -4
- package/lib/runtime/TriggerHandler.js +4 -4
- package/lib/runtime/View.js +4 -4
- package/lib/runtime/params.js +3 -4
- package/lib/runtime/utils.js +2 -6
- package/lib/updaters/database.js +4 -3
- package/lib/utils/CommandQueue.js +2 -2
- package/lib/utils/EventSourcing.js +3 -3
- package/lib/utils/EventsReader.js +1 -1
- package/lib/utils/ExecutionQueue.js +1 -1
- package/lib/utils/KeyBasedExecutionQueues.js +2 -2
- package/lib/utils/ProfileLogFilesystemWriter.js +4 -4
- package/lib/utils/SingleEmitQueue.js +1 -1
- package/lib/utils/SplitEmitQueue.js +1 -1
- package/lib/utils/profileLog.js +1 -1
- package/lib/utils/validation.js +1 -1
- package/lib/utils/validators.js +2 -2
- package/lib/utils.js +1 -1
- package/package.json +5 -15
package/index.js
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
import App from './lib/App.js'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.app = () => {
|
|
3
|
+
App.app = () => {
|
|
6
4
|
if(!globalThis.liveChangeFrameworkApp) {
|
|
7
5
|
globalThis.liveChangeFrameworkApp = new App()
|
|
8
6
|
}
|
|
9
7
|
return globalThis.liveChangeFrameworkApp
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
import * as utils from './lib/utils.js'
|
|
11
|
+
import * as validation from './lib/utils/validation.js'
|
|
12
|
+
|
|
13
|
+
App.utils = utils
|
|
14
|
+
App.validation = validation
|
|
15
|
+
App.rangeProperties = utils.rangeProperties
|
|
16
|
+
App.encodeIdentifier = utils.encodeIdentifier
|
|
17
|
+
App.extractRange = utils.extractRange
|
|
18
|
+
App.isomorphic = utils.isomorphic
|
|
18
19
|
|
|
20
|
+
export default App
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
import ActionDefinition from './lib/definition/ActionDefinition.js'
|
|
23
|
+
import EventDefinition from './lib/definition/EventDefinition.js'
|
|
24
|
+
import ForeignIndexDefinition from './lib/definition/ForeignIndexDefinition.js'
|
|
25
|
+
import ForeignModelDefinition from './lib/definition/ForeignModelDefinition.js'
|
|
26
|
+
import IndexDefinition from './lib/definition/IndexDefinition.js'
|
|
27
|
+
import ModelDefinition from './lib/definition/ModelDefinition.js'
|
|
28
|
+
import PropertyDefinition from './lib/definition/PropertyDefinition.js'
|
|
29
|
+
import ServiceDefinition from './lib/definition/ServiceDefinition.js'
|
|
30
|
+
import TriggerDefinition from './lib/definition/TriggerDefinition.js'
|
|
31
|
+
import ViewDefinition from './lib/definition/ViewDefinition.js'
|
|
30
32
|
|
|
33
|
+
export {
|
|
34
|
+
ActionDefinition,
|
|
35
|
+
EventDefinition,
|
|
36
|
+
ForeignIndexDefinition,
|
|
37
|
+
ForeignModelDefinition,
|
|
38
|
+
IndexDefinition,
|
|
39
|
+
ModelDefinition,
|
|
40
|
+
PropertyDefinition,
|
|
41
|
+
ServiceDefinition,
|
|
42
|
+
TriggerDefinition,
|
|
43
|
+
ViewDefinition
|
|
44
|
+
}
|
package/lib/App.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
import { uidGenerator, randomString } from '@live-change/uid'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import ReactiveDao from "@live-change/dao"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import ServiceDefinition from "./definition/ServiceDefinition.js"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import Service from "./runtime/Service.js"
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
import profileLog from "./utils/profileLog.js"
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
import Dao from "./runtime/Dao.js"
|
|
12
|
+
import SessionDao from "./runtime/SessionDao.js"
|
|
13
|
+
import LiveDao from "./runtime/LiveDao.js"
|
|
14
|
+
import ApiServer from "./runtime/ApiServer.js"
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
import reverseRelationProcessor from "./processors/reverseRelation.js"
|
|
17
|
+
import indexListProcessor from "./processors/indexList.js"
|
|
18
|
+
import crudGenerator from "./processors/crudGenerator.js"
|
|
19
|
+
import draftGenerator from "./processors/draftGenerator.js"
|
|
20
|
+
import daoPathView from "./processors/daoPathView.js"
|
|
21
|
+
import fetchView from "./processors/fetchView.js"
|
|
22
|
+
import accessControl from "./processors/accessControl.js"
|
|
23
|
+
import autoValidation from "./processors/autoValidation.js"
|
|
24
|
+
import indexCode from "./processors/indexCode.js"
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
import databaseUpdater from "./updaters/database.js"
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
import accessControlFilter from "./clientSideFilters/accessFilter.js"
|
|
29
|
+
import clientSideFilter from "./clientSideFilters/clientSideFilter.js"
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
import commandExecutor from "./processes/commandExecutor.js"
|
|
32
|
+
import triggerExecutor from "./processes/triggerExecutor.js"
|
|
33
|
+
import eventListener from './processes/eventListener.js'
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const SingleEmitQueue = require("./utils/SingleEmitQueue.js");
|
|
35
|
+
import SplitEmitQueue from "./utils/SplitEmitQueue.js"
|
|
36
|
+
import SingleEmitQueue from "./utils/SingleEmitQueue.js"
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
import Debug from 'debug'
|
|
39
|
+
const debug = Debug('framework')
|
|
40
40
|
|
|
41
41
|
class App {
|
|
42
42
|
|
|
@@ -89,8 +89,9 @@ class App {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
createServiceDefinition( definition ) {
|
|
92
|
-
const
|
|
92
|
+
const sourceConfig = this.config && this.config.services && this.config.services.find
|
|
93
93
|
&& this.config.services.find(c => c.name == definition.name)
|
|
94
|
+
const config = { ...sourceConfig, module: null }
|
|
94
95
|
return new ServiceDefinition({ ...definition, config })
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -542,5 +543,4 @@ class App {
|
|
|
542
543
|
|
|
543
544
|
}
|
|
544
545
|
|
|
545
|
-
|
|
546
|
-
module.exports = App
|
|
546
|
+
export default App
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import getAccessMethod from "../processors/accessMethod.js"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default async function(service, definition, app, client) {
|
|
4
4
|
|
|
5
5
|
for(let actionName in definition.actions) {
|
|
6
6
|
const action = service.definition.actions[actionName]
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const utils = require("../utils.js")
|
|
1
|
+
import PropertyDefinition from "./PropertyDefinition.js"
|
|
3
2
|
|
|
4
3
|
class ActionDefinition {
|
|
5
4
|
|
|
@@ -37,4 +36,4 @@ class ActionDefinition {
|
|
|
37
36
|
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
export default ActionDefinition
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const utils = require("../utils.js")
|
|
1
|
+
import PropertyDefinition from "./PropertyDefinition.js"
|
|
3
2
|
|
|
4
3
|
class EventDefinition {
|
|
5
4
|
|
|
@@ -43,4 +42,4 @@ class EventDefinition {
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
export default EventDefinition
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const PropertyDefinition = require("./PropertyDefinition.js")
|
|
2
|
-
const utils = require("../utils.js")
|
|
3
1
|
|
|
4
2
|
class IndexDefinition {
|
|
5
3
|
|
|
@@ -37,8 +35,6 @@ class IndexDefinition {
|
|
|
37
35
|
return changes
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
export default IndexDefinition
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import PropertyDefinition from "./PropertyDefinition.js"
|
|
2
|
+
import { crudChanges } from "../utils.js"
|
|
3
3
|
|
|
4
4
|
class ModelDefinition {
|
|
5
5
|
|
|
@@ -55,9 +55,9 @@ class ModelDefinition {
|
|
|
55
55
|
oldModel.indexes = oldModel.indexes || {}
|
|
56
56
|
let changes = []
|
|
57
57
|
const json = this.toJSON()
|
|
58
|
-
changes.push(...
|
|
58
|
+
changes.push(...crudChanges(oldModel.properties || {}, json.properties || {},
|
|
59
59
|
"Property", "property", { model: this.name }))
|
|
60
|
-
changes.push(...
|
|
60
|
+
changes.push(...crudChanges(oldModel.indexes || {}, json.indexes || {},
|
|
61
61
|
"Index", "index", { model: this.name, storage: this.storage }))
|
|
62
62
|
if(oldModel.search && !this.search) changes.push({ operation: "searchDisabled", model: this.name })
|
|
63
63
|
if(!oldModel.search && this.search) changes.push({ operation: "searchEnabled", model: this.name })
|
|
@@ -76,8 +76,6 @@ class ModelDefinition {
|
|
|
76
76
|
return changes
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
79
|
}
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
export default ModelDefinition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { typeName } from "../utils.js"
|
|
2
2
|
|
|
3
3
|
class PropertyDefinition {
|
|
4
4
|
|
|
@@ -30,7 +30,7 @@ class PropertyDefinition {
|
|
|
30
30
|
}
|
|
31
31
|
let json = {
|
|
32
32
|
...this,
|
|
33
|
-
type:
|
|
33
|
+
type: typeName(this.type),
|
|
34
34
|
properties
|
|
35
35
|
}
|
|
36
36
|
if(this.of) {
|
|
@@ -43,8 +43,8 @@ class PropertyDefinition {
|
|
|
43
43
|
computeChanges( oldProperty, params, name) {
|
|
44
44
|
let changes = []
|
|
45
45
|
let typeChanged = false
|
|
46
|
-
if(
|
|
47
|
-
if((this.of &&
|
|
46
|
+
if(typeName(this.type) != typeName(oldProperty.type)) typeChanged = true
|
|
47
|
+
if((this.of && typeName(this.of.type)) != (oldProperty.of && typeName(oldProperty.of.type)))
|
|
48
48
|
typeChanged = true
|
|
49
49
|
if(typeChanged) {
|
|
50
50
|
changes.push({
|
|
@@ -67,4 +67,4 @@ class PropertyDefinition {
|
|
|
67
67
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
export default PropertyDefinition
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import ModelDefinition from "./ModelDefinition.js"
|
|
2
|
+
import ForeignModelDefinition from "./ForeignModelDefinition.js"
|
|
3
|
+
import IndexDefinition from "./IndexDefinition.js"
|
|
4
|
+
import ForeignIndexDefinition from "./ForeignIndexDefinition.js"
|
|
5
|
+
import ActionDefinition from "./ActionDefinition.js"
|
|
6
|
+
import TriggerDefinition from "./TriggerDefinition.js"
|
|
7
|
+
import ViewDefinition from "./ViewDefinition.js"
|
|
8
|
+
import EventDefinition from "./EventDefinition.js"
|
|
9
|
+
import defaultValidators from '../utils/validators.js'
|
|
10
|
+
import { crudChanges } from "../utils.js"
|
|
11
11
|
|
|
12
12
|
function createModelProxy(definition, model) {
|
|
13
13
|
return new Proxy(model, {
|
|
@@ -86,7 +86,7 @@ class ServiceDefinition {
|
|
|
86
86
|
this.authenticators = []
|
|
87
87
|
this.beforeStartCallbacks = []
|
|
88
88
|
this.endpoints = []
|
|
89
|
-
this.validators = defaultValidators
|
|
89
|
+
this.validators = { ...defaultValidators }
|
|
90
90
|
this.clientSideFilters = []
|
|
91
91
|
for(let key in definition) this[key] = definition[key]
|
|
92
92
|
}
|
|
@@ -209,11 +209,11 @@ class ServiceDefinition {
|
|
|
209
209
|
computeChanges( oldModuleParam ) {
|
|
210
210
|
let oldModule = JSON.parse(JSON.stringify(oldModuleParam))
|
|
211
211
|
let changes = []
|
|
212
|
-
changes.push(...
|
|
212
|
+
changes.push(...crudChanges(oldModule.models || {}, this.models || {},
|
|
213
213
|
"Model", "model", { }))
|
|
214
214
|
return changes
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
export default ServiceDefinition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import PropertyDefinition from "./PropertyDefinition.js"
|
|
2
2
|
|
|
3
3
|
class TriggerDefinition {
|
|
4
4
|
|
|
@@ -36,4 +36,4 @@ class TriggerDefinition {
|
|
|
36
36
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
export default TriggerDefinition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import PropertyDefinition from "./PropertyDefinition.js"
|
|
2
2
|
|
|
3
3
|
class ViewDefinition {
|
|
4
4
|
|
|
@@ -36,4 +36,4 @@ class ViewDefinition {
|
|
|
36
36
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
export default ViewDefinition
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import KeyBasedExecutionQueues from '../utils/KeyBasedExecutionQueues.js';
|
|
2
|
+
import CommandQueue from '../utils/CommandQueue.js';
|
|
3
|
+
import SingleEmitQueue from '../utils/SingleEmitQueue.js';
|
|
4
|
+
import SplitEmitQueue from '../utils/SplitEmitQueue.js';
|
|
5
5
|
|
|
6
6
|
async function startCommandExecutor(service, config) {
|
|
7
7
|
if(!config.runCommands) return
|
|
@@ -94,4 +94,4 @@ async function startCommandExecutor(service, config) {
|
|
|
94
94
|
service.commandQueue.start()
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
export default startCommandExecutor
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import EventSourcing from '../utils/EventSourcing.js'
|
|
2
2
|
|
|
3
3
|
async function startEventListener(service, config) {
|
|
4
4
|
if(!config.handleEvents) return
|
|
@@ -36,4 +36,4 @@ async function startEventListener(service, config) {
|
|
|
36
36
|
service.eventSourcing.start()
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
export default startEventListener
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import KeyBasedExecutionQueues from '../utils/KeyBasedExecutionQueues.js'
|
|
2
|
+
import CommandQueue from '../utils/CommandQueue.js'
|
|
3
|
+
import SingleEmitQueue from '../utils/SingleEmitQueue.js'
|
|
4
|
+
import SplitEmitQueue from '../utils/SplitEmitQueue.js'
|
|
5
5
|
|
|
6
6
|
async function startTriggerExecutor(service, config) {
|
|
7
7
|
if(!config.runCommands) return
|
|
@@ -34,4 +34,4 @@ async function startTriggerExecutor(service, config) {
|
|
|
34
34
|
service.triggerQueue.start()
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
export default startTriggerExecutor
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import getAccessMethod from "./accessMethod.js"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default function(module, app) {
|
|
4
4
|
for(let actionName in module.actions) {
|
|
5
5
|
const action = module.actions[actionName]
|
|
6
6
|
if(!action.access) continue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function getAccessMethod(access) {
|
|
1
|
+
export default function getAccessMethod(access) {
|
|
2
2
|
if(typeof access == 'function') {
|
|
3
3
|
return access
|
|
4
4
|
} else if(Array.isArray(access)) {
|
|
@@ -10,5 +10,3 @@ function getAccessMethod(access) {
|
|
|
10
10
|
}
|
|
11
11
|
} else throw new Error("unknown view access definition "+access)
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
module.exports = getAccessMethod
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { getValidators, validate } from '../utils/validation.js'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default function(service, app) {
|
|
4
4
|
for(let actionName in service.actions) {
|
|
5
5
|
const action = service.actions[actionName]
|
|
6
6
|
if(action.skipValidation) continue
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import * as utils from "../utils.js"
|
|
2
2
|
|
|
3
3
|
function ignoreValidation(prop) {
|
|
4
4
|
delete prop.validation
|
|
@@ -12,7 +12,7 @@ function ignoreValidation(prop) {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
export default function(service, app) {
|
|
16
16
|
if(!service) throw new Error("no service")
|
|
17
17
|
if(!app) throw new Error("no service")
|
|
18
18
|
for(let modelName in service.models) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import ReactiveDao from "@live-change/dao"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default function(service, app) {
|
|
4
4
|
for(let viewName in service.views) {
|
|
5
5
|
const view = service.views[viewName]
|
|
6
6
|
if(view.daoPath) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import * as utils from "../utils.js"
|
|
2
2
|
|
|
3
3
|
function propertyWithoutValidation(property) {
|
|
4
4
|
let prop = { ...property }
|
|
@@ -20,7 +20,7 @@ function propertiesWithoutValidation(properties, validateFields) {
|
|
|
20
20
|
return propertiesWV
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
export default function(service, app) {
|
|
24
24
|
if(!service) throw new Error("no service")
|
|
25
25
|
if(!app) throw new Error("no service")
|
|
26
26
|
for(let actionName in service.actions) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import ReactiveDao from "@live-change/dao"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default function(service, app) {
|
|
4
4
|
for(let viewName in service.views) {
|
|
5
5
|
const view = service.views[viewName]
|
|
6
6
|
if(view.fetch) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import * as utils from "../utils.js"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default function(module, app) {
|
|
4
4
|
for(let modelName in module.models) {
|
|
5
5
|
const model = module.models[modelName]
|
|
6
6
|
for(let propertyName in model.properties) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import * as utils from "../utils.js"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default function(module, app) {
|
|
4
4
|
for(let modelName in module.models) {
|
|
5
5
|
const model = module.models[modelName]
|
|
6
6
|
for(let propertyName in model.properties) {
|
package/lib/runtime/Action.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { prepareParameters, processReturn, preFilterParameters } from "./params.js"
|
|
2
2
|
|
|
3
3
|
class Action {
|
|
4
4
|
|
|
@@ -48,4 +48,4 @@ class Action {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
export default Action
|
package/lib/runtime/ApiServer.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import LcDao from "@live-change/dao"
|
|
2
|
+
import Dao from "./Dao.js"
|
|
3
|
+
import cookie from 'cookie'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { getIp } from "./utils.js"
|
|
6
6
|
|
|
7
7
|
class ApiServer {
|
|
8
8
|
constructor(config, DaoConstructor = Dao) {
|
|
@@ -55,4 +55,4 @@ class ApiServer {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
export default ApiServer
|
package/lib/runtime/Dao.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import ReactiveDao from "@live-change/dao"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import profileLog from "../utils/profileLog.js"
|
|
4
4
|
|
|
5
5
|
function promiseMap(promise, fn) {
|
|
6
6
|
if(promise.then) return promise.then(fn)
|
|
@@ -181,4 +181,4 @@ class Dao extends ReactiveDao {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
export default Dao
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { prepareParameters, processReturn } from "./params.js"
|
|
2
2
|
|
|
3
3
|
class EventHandler {
|
|
4
4
|
|
|
@@ -31,4 +31,4 @@ class EventHandler {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
export default EventHandler
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import ReaderModel from "./ReaderModel.js"
|
|
2
2
|
|
|
3
3
|
class ForeignModel extends ReaderModel {
|
|
4
4
|
|
|
@@ -9,4 +9,4 @@ class ForeignModel extends ReaderModel {
|
|
|
9
9
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
export default ForeignModel
|
package/lib/runtime/Index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import ReactiveDao from "@live-change/dao"
|
|
2
|
+
import { prefixRange } from "../utils.js"
|
|
3
3
|
|
|
4
4
|
class Index {
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ class Index {
|
|
|
19
19
|
const values = Array.isArray(range) ? range : [range]
|
|
20
20
|
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
21
21
|
if(pathRange) {
|
|
22
|
-
return this.rangePath(
|
|
22
|
+
return this.rangePath(prefixRange(pathRange, prefix, prefix))
|
|
23
23
|
}
|
|
24
24
|
return this.rangePath({ gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
25
25
|
}
|
|
@@ -45,4 +45,4 @@ class Index {
|
|
|
45
45
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
export default Index
|
package/lib/runtime/LiveDao.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import LcDao from "@live-change/dao"
|
|
2
|
+
import Dao from "./Dao.js"
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import { waitForSignal } from './utils.js'
|
|
5
5
|
|
|
6
6
|
class LiveDao extends LcDao.DaoProxy {
|
|
7
7
|
constructor(config, credentials) {
|
|
@@ -94,4 +94,4 @@ class LiveDao extends LcDao.DaoProxy {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
export default LiveDao
|
package/lib/runtime/Model.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import ReaderModel from "./ReaderModel.js"
|
|
2
|
+
import { prefixRange }from "../utils.js"
|
|
3
3
|
|
|
4
4
|
class Model extends ReaderModel {
|
|
5
5
|
|
|
@@ -44,7 +44,7 @@ class Model extends ReaderModel {
|
|
|
44
44
|
const values = Array.isArray(range) ? range : [range]
|
|
45
45
|
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
46
46
|
if(pathRange) {
|
|
47
|
-
return this.rangePath(
|
|
47
|
+
return this.rangePath(prefixRange(pathRange, prefix, prefix))
|
|
48
48
|
}
|
|
49
49
|
return this.rangePath({ gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
50
50
|
}
|
|
@@ -63,7 +63,7 @@ class Model extends ReaderModel {
|
|
|
63
63
|
const values = Array.isArray(range) ? range : [range]
|
|
64
64
|
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
65
65
|
if(pathRange) {
|
|
66
|
-
return this.indexRangeDelete(index,
|
|
66
|
+
return this.indexRangeDelete(index, prefixRange(pathRange, prefix, prefix))
|
|
67
67
|
}
|
|
68
68
|
return this.indexRangeDelete(index,{ gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
69
69
|
}
|
|
@@ -81,7 +81,7 @@ class Model extends ReaderModel {
|
|
|
81
81
|
const values = Array.isArray(range) ? range : [range]
|
|
82
82
|
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
83
83
|
if(pathRange) {
|
|
84
|
-
return this.indexRangeUpdate(index, update,
|
|
84
|
+
return this.indexRangeUpdate(index, update, prefixRange(pathRange, prefix, prefix))
|
|
85
85
|
}
|
|
86
86
|
return this.indexRangeUpdate(index, update,{ gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
87
87
|
}
|
|
@@ -95,8 +95,6 @@ class Model extends ReaderModel {
|
|
|
95
95
|
})`, { indexName: this.tableName+'_'+index, tableName: this.tableName, range, operations })
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
98
|
}
|
|
101
99
|
|
|
102
|
-
|
|
100
|
+
export default Model
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import LcDao from "@live-change/dao"
|
|
2
|
+
import { prefixRange, fieldListToFieldsObject } from "../utils.js"
|
|
3
3
|
|
|
4
4
|
class ReaderModel {
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ class ReaderModel {
|
|
|
16
16
|
|
|
17
17
|
limitedPath(id, fields) { // takes object or list of fields
|
|
18
18
|
if(Array.isArray(fields)) {
|
|
19
|
-
fields =
|
|
19
|
+
fields = fieldListToFieldsObject(fields)
|
|
20
20
|
}
|
|
21
21
|
fields.id = true // id is required
|
|
22
22
|
return ['database', 'queryObject', this.service.databaseName, `(${
|
|
@@ -44,7 +44,7 @@ class ReaderModel {
|
|
|
44
44
|
const values = Array.isArray(range) ? range : [range]
|
|
45
45
|
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
46
46
|
if(pathRange) {
|
|
47
|
-
return this.rangePath(
|
|
47
|
+
return this.rangePath(prefixRange(pathRange, prefix, prefix))
|
|
48
48
|
}
|
|
49
49
|
return this.rangePath({ gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
50
50
|
}
|
|
@@ -57,7 +57,7 @@ class ReaderModel {
|
|
|
57
57
|
const values = Array.isArray(range) ? range : [range]
|
|
58
58
|
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
59
59
|
if(pathRange) {
|
|
60
|
-
return this.indexRangePath(index,
|
|
60
|
+
return this.indexRangePath(index, prefixRange(pathRange, prefix, prefix))
|
|
61
61
|
}
|
|
62
62
|
return this.indexRangePath(index, { gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
63
63
|
}
|
|
@@ -115,7 +115,7 @@ class ReaderModel {
|
|
|
115
115
|
const values = Array.isArray(range) ? range : [range]
|
|
116
116
|
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
117
117
|
if(pathRange) {
|
|
118
|
-
return this.sortedIndexRangePath(index,
|
|
118
|
+
return this.sortedIndexRangePath(index, prefixRange(pathRange, prefix, prefix))
|
|
119
119
|
}
|
|
120
120
|
return this.sortedIndexRangePath(index, { gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
121
121
|
}
|
|
@@ -178,7 +178,7 @@ class ReaderModel {
|
|
|
178
178
|
const values = Array.isArray(range) ? range : [range]
|
|
179
179
|
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
180
180
|
if(pathRange) {
|
|
181
|
-
return this.indexObjectPath(index,
|
|
181
|
+
return this.indexObjectPath(index, prefixRange(pathRange, prefix, prefix))
|
|
182
182
|
}
|
|
183
183
|
return this.indexObjectPath(index,{ gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
184
184
|
}
|
|
@@ -216,7 +216,7 @@ class ReaderModel {
|
|
|
216
216
|
const values = Array.isArray(range) ? range : [range]
|
|
217
217
|
const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
|
|
218
218
|
if(pathRange) {
|
|
219
|
-
return this.countPath(
|
|
219
|
+
return this.countPath(prefixRange(pathRange, prefix, prefix))
|
|
220
220
|
}
|
|
221
221
|
return this.countPath({ gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
|
|
222
222
|
}
|
|
@@ -225,22 +225,22 @@ class ReaderModel {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
observable(id) {
|
|
228
|
-
return this.service.dao.observable(this.path(id),
|
|
228
|
+
return this.service.dao.observable(this.path(id), LcDao.ObservableValue)
|
|
229
229
|
}
|
|
230
230
|
async get(id) {
|
|
231
|
-
return this.service.dao.get(this.path(id),
|
|
231
|
+
return this.service.dao.get(this.path(id), LcDao.ObservableValue)
|
|
232
232
|
}
|
|
233
233
|
rangeObservable(range) {
|
|
234
|
-
return this.service.dao.observable(this.rangePath(range),
|
|
234
|
+
return this.service.dao.observable(this.rangePath(range), LcDao.ObservableList)
|
|
235
235
|
}
|
|
236
236
|
async rangeGet(range) {
|
|
237
|
-
return this.service.dao.get(this.rangePath(range),
|
|
237
|
+
return this.service.dao.get(this.rangePath(range), LcDao.ObservableList)
|
|
238
238
|
}
|
|
239
239
|
indexRangeObservable(index, range, pathRange = null) {
|
|
240
|
-
return this.service.dao.observable(this.indexRangePath(index, range, pathRange),
|
|
240
|
+
return this.service.dao.observable(this.indexRangePath(index, range, pathRange), LcDao.ObservableList)
|
|
241
241
|
}
|
|
242
242
|
async indexRangeGet(index, range, pathRange = null) {
|
|
243
|
-
return this.service.dao.get(this.indexRangePath(index, range, pathRange),
|
|
243
|
+
return this.service.dao.get(this.indexRangePath(index, range, pathRange), LcDao.ObservableList)
|
|
244
244
|
}
|
|
245
245
|
indexObjectObservable(index, range, pathRange = null) {
|
|
246
246
|
return this.service.dao.observable(this.indexObjectPath(index, range, pathRange))
|
|
@@ -249,16 +249,16 @@ class ReaderModel {
|
|
|
249
249
|
return this.service.dao.get(this.indexObjectPath(index, range, pathRange))
|
|
250
250
|
}
|
|
251
251
|
sortedIndexRangeObservable(index, range, pathRange = null) {
|
|
252
|
-
return this.service.dao.observable(this.sortedIndexRangePath(index, range, pathRange),
|
|
252
|
+
return this.service.dao.observable(this.sortedIndexRangePath(index, range, pathRange), LcDao.ObservableList)
|
|
253
253
|
}
|
|
254
254
|
async sortedIndexRangeGet(index, range, pathRange = null) {
|
|
255
|
-
return this.service.dao.get(this.sortedIndexRangePath(index, range, pathRange),
|
|
255
|
+
return this.service.dao.get(this.sortedIndexRangePath(index, range, pathRange), LcDao.ObservableList)
|
|
256
256
|
}
|
|
257
257
|
countObservable(range) {
|
|
258
|
-
return this.service.dao.observable(this.countPath(range),
|
|
258
|
+
return this.service.dao.observable(this.countPath(range), LcDao.ObservableList)
|
|
259
259
|
}
|
|
260
260
|
async countGet(range) {
|
|
261
|
-
return this.service.dao.get(this.countPath(range),
|
|
261
|
+
return this.service.dao.get(this.countPath(range), LcDao.ObservableList)
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
condition(id, condition = x => !!x, timeout = 10000) {
|
|
@@ -286,4 +286,4 @@ class ReaderModel {
|
|
|
286
286
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
|
|
289
|
+
export default ReaderModel
|
package/lib/runtime/Service.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import Model from "./Model.js"
|
|
2
|
+
import ForeignModel from "./ForeignModel.js"
|
|
3
|
+
import Index from "./Index.js"
|
|
4
|
+
import View from "./View.js"
|
|
5
|
+
import Action from "./Action.js"
|
|
6
|
+
import EventHandler from "./EventHandler.js"
|
|
7
|
+
import TriggerHandler from "./TriggerHandler.js"
|
|
8
|
+
import ExecutionQueue from "../utils/ExecutionQueue.js"
|
|
9
9
|
|
|
10
10
|
class Service {
|
|
11
11
|
|
|
@@ -99,4 +99,4 @@ class Service {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
export default Service
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import LcDao from "@live-change/dao"
|
|
2
|
+
import Dao from "./Dao.js"
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import { waitForSignal } from './utils.js'
|
|
5
5
|
|
|
6
6
|
class SessionDao extends LcDao.DaoProxy {
|
|
7
7
|
constructor(config, credentials) {
|
|
@@ -90,4 +90,4 @@ class SessionDao extends LcDao.DaoProxy {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
export default SessionDao
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { prepareParameters, processReturn } from "./params.js"
|
|
2
|
+
import SplitEmitQueue from "../utils/SplitEmitQueue.js"
|
|
3
|
+
import SingleEmitQueue from "../utils/SingleEmitQueue.js"
|
|
4
4
|
|
|
5
5
|
class TriggerHandler {
|
|
6
6
|
|
|
@@ -108,4 +108,4 @@ class TriggerHandler {
|
|
|
108
108
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
export default TriggerHandler
|
package/lib/runtime/View.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import LcDao from '@live-change/dao'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { prepareParameters, processReturn } from "./params.js"
|
|
4
4
|
|
|
5
5
|
class View {
|
|
6
6
|
constructor(definition, service) {
|
|
@@ -15,7 +15,7 @@ class View {
|
|
|
15
15
|
}
|
|
16
16
|
const preparedParameters = await prepareParameters(parameters, this.definition.properties, this.service)
|
|
17
17
|
const observable = this.definition.observable(preparedParameters, context)
|
|
18
|
-
if(observable === null) return new
|
|
18
|
+
if(observable === null) return new LcDao.ObservableValue(null)
|
|
19
19
|
return observable
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -29,4 +29,4 @@ class View {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
export default View
|
package/lib/runtime/params.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const ModelDefinition = require('../definition/ModelDefinition')
|
|
1
|
+
import Model from './Model.js'
|
|
2
|
+
import ModelDefinition from '../definition/ModelDefinition.js'
|
|
4
3
|
|
|
5
4
|
function getModelName(t) {
|
|
6
5
|
let modelName = null
|
|
@@ -96,7 +95,7 @@ async function processReturn(data, definition, service) {
|
|
|
96
95
|
return data
|
|
97
96
|
}
|
|
98
97
|
|
|
99
|
-
|
|
98
|
+
export {
|
|
100
99
|
processReturn,
|
|
101
100
|
prepareParameters,
|
|
102
101
|
preFilterParameters
|
package/lib/runtime/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function getIp(connection) {
|
|
1
|
+
export function getIp(connection) {
|
|
2
2
|
let ip =
|
|
3
3
|
connection.headers['x-real-ip'] ||
|
|
4
4
|
connection.headers['x-forwarded-for'] ||
|
|
@@ -9,7 +9,7 @@ function getIp(connection) {
|
|
|
9
9
|
return ip
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
function waitForSignal(observable, timeout = 1000, filter = () => true) {
|
|
12
|
+
export function waitForSignal(observable, timeout = 1000, filter = () => true) {
|
|
13
13
|
let observer
|
|
14
14
|
let done = false
|
|
15
15
|
return new Promise((resolve, reject) => {
|
|
@@ -32,7 +32,3 @@ function waitForSignal(observable, timeout = 1000, filter = () => true) {
|
|
|
32
32
|
observable.unobserve(observer)
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
module.exports.getIp = getIp
|
|
38
|
-
module.exports.waitForSignal = waitForSignal
|
package/lib/updaters/database.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as utils from "../utils.js"
|
|
2
|
+
import Debug from 'debug'
|
|
3
|
+
const debug = Debug('framework:updaters:db')
|
|
3
4
|
|
|
4
5
|
async function update(changes, service, app, force) {
|
|
5
6
|
|
|
@@ -278,5 +279,5 @@ async function update(changes, service, app, force) {
|
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
281
|
|
|
281
|
-
|
|
282
|
+
export default update
|
|
282
283
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import ReactiveDao from '@live-change/dao'
|
|
2
2
|
|
|
3
3
|
class CommandQueue {
|
|
4
4
|
constructor(connection, database, tableName, serviceName, config) {
|
|
@@ -165,4 +165,4 @@ class CommandQueue {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
export default CommandQueue
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import EventsReader from './EventsReader.js'
|
|
2
|
+
import ReactiveDao from '@live-change/dao'
|
|
3
3
|
|
|
4
4
|
function sleep(ms) {
|
|
5
5
|
return new Promise((resolve, reject) => setTimeout(resolve, ms))
|
|
@@ -141,4 +141,4 @@ class EventSourcing {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
export default EventSourcing
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import ExecutionQueue from './ExecutionQueue.js'
|
|
2
2
|
|
|
3
3
|
class KeyBasedExecutionQueues {
|
|
4
4
|
constructor(keyFunction) {
|
|
@@ -22,4 +22,4 @@ class KeyBasedExecutionQueues {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
export default KeyBasedExecutionQueues
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import os from 'os'
|
|
3
|
+
import { once } from 'events'
|
|
4
4
|
|
|
5
5
|
class ProfileLogFilesystemWriter {
|
|
6
6
|
constructor(path) {
|
|
@@ -37,4 +37,4 @@ class ProfileLogFilesystemWriter {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
export default ProfileLogFilesystemWriter
|
package/lib/utils/profileLog.js
CHANGED
package/lib/utils/validation.js
CHANGED
package/lib/utils/validators.js
CHANGED
|
@@ -28,7 +28,7 @@ function getField(context, fieldName) {
|
|
|
28
28
|
|
|
29
29
|
nonEmpty.isRequired = () => true
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
const validators = {
|
|
32
32
|
nonEmpty: (settings) => nonEmpty,
|
|
33
33
|
|
|
34
34
|
minLength: ({ length }) => (value) => value.length < length ? 'tooShort' : undefined,
|
|
@@ -174,4 +174,4 @@ let validators = {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
export default validators
|
package/lib/utils.js
CHANGED
|
@@ -280,7 +280,7 @@ function isomorphic( v ) {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
|
|
283
|
+
export {
|
|
284
284
|
typeName, toJSON, setDifference, mapDifference, crudChanges,
|
|
285
285
|
getProperty, setProperty, getField, setField, isObject, mergeDeep, generateDefault,
|
|
286
286
|
prefixRange, rangeProperties, fieldListToFieldsObject,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Live Change Framework - ultimate solution for real time mobile/web apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,25 +15,15 @@
|
|
|
15
15
|
"name": "Michał Łaszczewski",
|
|
16
16
|
"url": "https://www.viamage.com/"
|
|
17
17
|
},
|
|
18
|
+
"type": "module",
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"bugs": {
|
|
20
21
|
"url": "https://github.com/live-change/live-change-framework/issues"
|
|
21
22
|
},
|
|
22
23
|
"homepage": "https://github.com/live-change/live-change-framework",
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@live-change/dao": "0.
|
|
25
|
-
"@live-change/
|
|
26
|
-
"@live-change/db": "0.6.23",
|
|
27
|
-
"@live-change/db-store-level": "0.6.23",
|
|
28
|
-
"@live-change/db-store-lmdb": "0.6.23",
|
|
29
|
-
"@live-change/sockjs": "0.4.1",
|
|
30
|
-
"@live-change/uid": "^0.7.38",
|
|
31
|
-
"cookie": "^0.4.1",
|
|
32
|
-
"express": "^4.18.2",
|
|
33
|
-
"os-service": "^2.2.0",
|
|
34
|
-
"rimraf": "^3.0.2",
|
|
35
|
-
"tape": "^5.3.2",
|
|
36
|
-
"websocket": "^1.0.34"
|
|
25
|
+
"@live-change/dao": "0.6.0",
|
|
26
|
+
"@live-change/uid": "^0.8.0"
|
|
37
27
|
},
|
|
38
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "59b8c38965b6b737b6123fdcdf12fd0b5bed164f"
|
|
39
29
|
}
|