spyne 0.19.0 → 0.20.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/.eslintrc.js +4 -3
- package/.travis.yml +24 -11
- package/karma.conf.js +76 -86
- package/lib/spyne.esm.js +15 -0
- package/lib/spyne.esm.js.map +1 -0
- package/lib/spyne.umd.js +9565 -0
- package/package.json +46 -26
- package/rollup.config.js +26 -0
- package/src/spyne/channels/channel-fetch-class.js +39 -43
- package/src/spyne/channels/channel-payload-class.js +61 -74
- package/src/spyne/channels/channel-proxy.js +25 -26
- package/src/spyne/channels/channel.js +141 -149
- package/src/spyne/channels/channels-config.js +46 -47
- package/src/spyne/channels/channels-map.js +61 -65
- package/src/spyne/channels/spyne-channel-lifecycle.js +12 -12
- package/src/spyne/channels/spyne-channel-route.js +241 -250
- package/src/spyne/channels/spyne-channel-ui.js +213 -75
- package/src/spyne/channels/spyne-channel-window.js +157 -157
- package/src/spyne/spyne-app.js +32 -19
- package/src/spyne/spyne-plugins.js +55 -70
- package/src/spyne/spyne.js +23 -23
- package/src/spyne/utils/channel-config-validator.js +10 -10
- package/src/spyne/utils/channel-fetch-util.js +72 -55
- package/src/spyne/utils/channel-payload-filter.js +89 -100
- package/src/spyne/utils/deep-merge.js +31 -29
- package/src/spyne/utils/frp-tools.js +108 -92
- package/src/spyne/utils/gc.js +6 -6
- package/src/spyne/utils/mixins/base-core-mixins.js +17 -15
- package/src/spyne/utils/mixins/base-streams-mixins.js +9 -9
- package/src/spyne/utils/route-channel-updater.js +23 -29
- package/src/spyne/utils/safe-clone.js +40 -58
- package/src/spyne/utils/sanitize-html.js +35 -0
- package/src/spyne/utils/security-policy.js +11 -0
- package/src/spyne/utils/spyne-app-properties.js +110 -114
- package/src/spyne/utils/spyne-logger.js +4 -11
- package/src/spyne/utils/spyne-plugins-methods.js +38 -63
- package/src/spyne/utils/spyne-trait.js +33 -33
- package/src/spyne/utils/spyne-utils-channel-route-url.js +229 -153
- package/src/spyne/utils/spyne-utils-channel-route.js +128 -138
- package/src/spyne/utils/spyne-utils-channel-window.js +39 -39
- package/src/spyne/utils/viewstream-animations.js +12 -12
- package/src/spyne/utils/viewstream-observables.js +45 -45
- package/src/spyne/views/dom-element-template.js +111 -114
- package/src/spyne/views/dom-element.js +82 -84
- package/src/spyne/views/view-stream-broadcaster.js +66 -62
- package/src/spyne/views/view-stream-element.js +105 -106
- package/src/spyne/views/view-stream-payload.js +25 -27
- package/src/spyne/views/view-stream-selector.js +157 -163
- package/src/spyne/views/view-stream.js +416 -640
- package/src/tests/channels/channel-dom.test.js +15 -15
- package/src/tests/channels/channel-fetch.test.js +51 -62
- package/src/tests/channels/channel-payload-class.test.js +50 -63
- package/src/tests/channels/channel-payload-filter.test.js +133 -193
- package/src/tests/channels/channel-route.test.js +102 -112
- package/src/tests/channels/channel-stream-item.test.js +19 -19
- package/src/tests/channels/channel-ui.test.js +15 -27
- package/src/tests/channels/channel-util-dom.test.js +31 -31
- package/src/tests/channels/channel.test.js +20 -25
- package/src/tests/channels/route-utils.test.js +61 -66
- package/src/tests/channels/url-utils.test.js +151 -151
- package/src/tests/channels/view-stream-broadcaster.test.js +7 -7
- package/src/tests/import.test.js +5 -5
- package/src/tests/index.js +6 -7
- package/src/tests/index.test.js +6 -8
- package/src/tests/mocks/channel-payload-data.js +218 -220
- package/src/tests/mocks/enhancer.test.js +5 -5
- package/src/tests/mocks/payload-ui.js +87 -90
- package/src/tests/mocks/routes-data.js +264 -266
- package/src/tests/mocks/spyne-docs.mocks.js +3 -3
- package/src/tests/mocks/template-renderer.mocks.js +47 -47
- package/src/tests/mocks/utils-data.js +78 -79
- package/src/tests/mocks/viewstream-internal-payload.mocks.js +50 -50
- package/src/tests/mocks/window-events-arr.js +1 -1
- package/src/tests/package-json.spec.test.js +9 -0
- package/src/tests/spyne-app.test.js +15 -18
- package/src/tests/spyne-plugin.test.js +16 -20
- package/src/tests/utils/channel-action-filter.test.js +84 -86
- package/src/tests/utils/channel-data-packet-generator.unused.js +62 -86
- package/src/tests/utils/channel-fetch-util.test.js +64 -66
- package/src/tests/utils/frp-tools.test.js +19 -19
- package/src/tests/utils/plugins-methods.test.js +31 -55
- package/src/tests/utils/security.test.js +10 -0
- package/src/tests/utils/spyne-app-properties.test.js +4 -8
- package/src/tests/views/dom-el-selectors.test.js +112 -119
- package/src/tests/views/dom-el-template-proxy.test.js +7 -0
- package/src/tests/views/dom-el-template.test.js +186 -156
- package/src/tests/views/dom-el.test.js +58 -56
- package/src/tests/views/view-stream-enhancer-loader.test.js +2 -2
- package/src/tests/views/view-stream-enhancer.test.js +11 -11
- package/src/tests/views/view-stream.test.js +22 -33
- package/webpack.config.js +76 -67
- package/docs/-_%20Solves%20equations%20of%20the%20form%20a%20_%20x%20=%20b.html +0 -487
- package/docs/DomItem.html +0 -298
- package/docs/DomItem_DomItem.html +0 -314
- package/docs/ViewStream.html +0 -2249
- package/docs/ViewStream_ViewStream.html +0 -503
- package/docs/custom/css/jsdoc-viewstream.css +0 -377
- package/docs/custom/layout.tmpl +0 -47
- package/docs/dom-item.js.html +0 -213
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/global.html +0 -548
- package/docs/index-custom.html +0 -79
- package/docs/index.html +0 -82
- package/docs/jsdoc.config.json +0 -22
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/styles/jsdoc-default.css +0 -358
- package/docs/styles/prettify-jsdoc.css +0 -111
- package/docs/styles/prettify-tomorrow.css +0 -132
- package/docs/view-stream.js.html +0 -767
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { SpyneChannelRoute } from './spyne-channel-route'
|
|
2
|
-
import { SpyneChannelUI } from './spyne-channel-ui'
|
|
3
|
-
import { SpyneChannelWindow } from './spyne-channel-window'
|
|
4
|
-
import { SpyneChannelLifecycle } from './spyne-channel-lifecycle'
|
|
1
|
+
import { SpyneChannelRoute } from './spyne-channel-route'
|
|
2
|
+
import { SpyneChannelUI } from './spyne-channel-ui'
|
|
3
|
+
import { SpyneChannelWindow } from './spyne-channel-window'
|
|
4
|
+
import { SpyneChannelLifecycle } from './spyne-channel-lifecycle'
|
|
5
5
|
|
|
6
|
-
import { Subject } from 'rxjs'
|
|
7
|
-
import { ChannelProxy } from './channel-proxy'
|
|
8
|
-
import {propEq, pluck, prop, filter, pathEq, reject, compose, join} from 'ramda'
|
|
9
|
-
const rMap = require('ramda').map;
|
|
10
|
-
const _map = new Map();
|
|
6
|
+
import { Subject } from 'rxjs'
|
|
7
|
+
import { ChannelProxy } from './channel-proxy'
|
|
8
|
+
import { propEq, pluck, prop, filter, pathEq, reject, compose, join, map as rMap } from 'ramda'
|
|
11
9
|
|
|
10
|
+
const _map = new Map()
|
|
12
11
|
|
|
13
12
|
export class ChannelsMap {
|
|
14
13
|
/**
|
|
@@ -22,115 +21,112 @@ export class ChannelsMap {
|
|
|
22
21
|
*
|
|
23
22
|
*/
|
|
24
23
|
|
|
25
|
-
|
|
26
24
|
constructor() {
|
|
27
|
-
this.addMixins()
|
|
28
|
-
_map.set('DISPATCHER', new Subject())
|
|
29
|
-
this.listRegisteredChannels = ChannelsMap.listRegisteredChannels.bind(this)
|
|
30
|
-
this.getChannelsList = ChannelsMap.getChannelsList.bind(this)
|
|
25
|
+
this.addMixins()
|
|
26
|
+
_map.set('DISPATCHER', new Subject())
|
|
27
|
+
this.listRegisteredChannels = ChannelsMap.listRegisteredChannels.bind(this)
|
|
28
|
+
this.getChannelsList = ChannelsMap.getChannelsList.bind(this)
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
get map(){
|
|
34
|
-
return _map
|
|
31
|
+
get map() {
|
|
32
|
+
return _map
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
static getChannelsList() {
|
|
38
36
|
const proxyMapFn = (k, v) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return { key, val }
|
|
42
|
-
}
|
|
43
|
-
return Array.from(_map, proxyMapFn)
|
|
37
|
+
const key = k[0]
|
|
38
|
+
const val = k[1].constructor.name
|
|
39
|
+
return { key, val }
|
|
40
|
+
}
|
|
41
|
+
return Array.from(_map, proxyMapFn)
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
static listRegisteredChannels(showOnlyProxies = false) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return pluck(['key'], removedProxyArr)
|
|
45
|
+
const proxyMap = this.getChannelsList()
|
|
46
|
+
const rejectProxyFn = reject(propEq('ChannelProxy', 'val'))
|
|
47
|
+
const filterProxyFn = filter(propEq('ChannelProxy', 'val'))
|
|
48
|
+
const fn = showOnlyProxies === true ? filterProxyFn : rejectProxyFn
|
|
49
|
+
const removedProxyArr = fn(proxyMap)
|
|
50
|
+
return pluck(['key'], removedProxyArr)
|
|
53
51
|
}
|
|
52
|
+
|
|
54
53
|
listProxyChannels() {
|
|
55
|
-
return this.listRegisteredChannels(true)
|
|
54
|
+
return this.listRegisteredChannels(true)
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
checkForMissingChannels() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const proxyMap = this.getChannelsList()
|
|
59
|
+
const filterProxyFn = filter(propEq('ChannelProxy', 'val'))
|
|
60
|
+
const filterProxyArr = filterProxyFn(proxyMap)
|
|
62
61
|
|
|
63
62
|
if (filterProxyArr.length >= 1) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
console.warn(filterPrefixWarning)
|
|
63
|
+
const channelStr = filterProxyArr.length === 1 ? 'Channel has' : 'Channels have'
|
|
64
|
+
const channels = compose(join(', '), rMap(prop('key')))(filterProxyArr)
|
|
65
|
+
const filterPrefixWarning = `Spyne Warning: The following ${channelStr} not been initialized: ${channels}`
|
|
66
|
+
console.warn(filterPrefixWarning)
|
|
68
67
|
}
|
|
69
|
-
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
init() {
|
|
73
|
-
this.createMainStreams()
|
|
71
|
+
this.createMainStreams()
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
|
|
77
74
|
createMainStreams() {
|
|
78
|
-
this.routeStream = new SpyneChannelRoute()
|
|
79
|
-
_map.set('CHANNEL_ROUTE', this.routeStream)
|
|
75
|
+
this.routeStream = new SpyneChannelRoute()
|
|
76
|
+
_map.set('CHANNEL_ROUTE', this.routeStream)
|
|
80
77
|
|
|
81
|
-
this.uiStream = new SpyneChannelUI()
|
|
82
|
-
_map.set('CHANNEL_UI', this.uiStream)
|
|
78
|
+
this.uiStream = new SpyneChannelUI()
|
|
79
|
+
_map.set('CHANNEL_UI', this.uiStream)
|
|
83
80
|
|
|
84
|
-
this.domStream = new SpyneChannelWindow()
|
|
85
|
-
_map.set('CHANNEL_WINDOW', this.domStream)
|
|
81
|
+
this.domStream = new SpyneChannelWindow()
|
|
82
|
+
_map.set('CHANNEL_WINDOW', this.domStream)
|
|
86
83
|
|
|
87
|
-
this.viewStreamLifecycle = new SpyneChannelLifecycle()
|
|
88
|
-
_map.set('CHANNEL_LIFECYCLE', this.viewStreamLifecycle)
|
|
84
|
+
this.viewStreamLifecycle = new SpyneChannelLifecycle()
|
|
85
|
+
_map.set('CHANNEL_LIFECYCLE', this.viewStreamLifecycle)
|
|
89
86
|
|
|
90
|
-
this.routeStream.initializeStream()
|
|
91
|
-
this.domStream.initializeStream()
|
|
87
|
+
this.routeStream.initializeStream()
|
|
88
|
+
this.domStream.initializeStream()
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
addKeyEvent(key) {
|
|
95
|
-
_map.get('UI').addKeyEvent(key)
|
|
92
|
+
_map.get('UI').addKeyEvent(key)
|
|
96
93
|
}
|
|
97
94
|
|
|
98
95
|
registerStream(val) {
|
|
99
|
-
|
|
100
|
-
const nameExists = _map.has(name)
|
|
101
|
-
if (nameExists){
|
|
102
|
-
const isAlreadyRegisterd = compose(pathEq(['props', 'isRegistered'], true))(_map.get(name))
|
|
103
|
-
if(isAlreadyRegisterd){
|
|
104
|
-
console.warn(`Spyne Warning: The Channel, ${name}, has already been registered!`)
|
|
105
|
-
return
|
|
96
|
+
const name = val.channelName
|
|
97
|
+
const nameExists = _map.has(name)
|
|
98
|
+
if (nameExists) {
|
|
99
|
+
const isAlreadyRegisterd = compose(pathEq(['props', 'isRegistered'], true))(_map.get(name))
|
|
100
|
+
if (isAlreadyRegisterd) {
|
|
101
|
+
console.warn(`Spyne Warning: The Channel, ${name}, has already been registered!`)
|
|
102
|
+
return
|
|
106
103
|
}
|
|
107
104
|
}
|
|
108
105
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
val.initializeStream();
|
|
106
|
+
_map.set(name, val)
|
|
107
|
+
val.initializeStream()
|
|
112
108
|
}
|
|
113
109
|
|
|
114
110
|
getChannelActions(str) {
|
|
115
|
-
return _map.get(str).addRegisteredActions()
|
|
111
|
+
return _map.get(str).addRegisteredActions()
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
getProxySubject(name, isReplaySubject = false) {
|
|
119
|
-
|
|
115
|
+
const subjectType = isReplaySubject === true ? 'replaySubject' : 'subject'
|
|
120
116
|
|
|
121
|
-
return _map.get(name)[subjectType]
|
|
117
|
+
return _map.get(name)[subjectType]
|
|
122
118
|
}
|
|
123
119
|
|
|
124
120
|
testStream(name) {
|
|
125
|
-
return _map.get(name) !== undefined
|
|
121
|
+
return _map.get(name) !== undefined
|
|
126
122
|
}
|
|
127
123
|
|
|
128
124
|
getStream(name) {
|
|
129
125
|
if (this.testStream(name) === false) {
|
|
130
|
-
_map.set(name, new ChannelProxy(name))
|
|
126
|
+
_map.set(name, new ChannelProxy(name))
|
|
131
127
|
}
|
|
132
128
|
|
|
133
|
-
return _map.get(name)
|
|
129
|
+
return _map.get(name)
|
|
134
130
|
}
|
|
135
131
|
|
|
136
132
|
addMixins() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Channel } from './channel'
|
|
1
|
+
import { Channel } from './channel'
|
|
2
2
|
|
|
3
3
|
export class SpyneChannelLifecycle extends Channel {
|
|
4
4
|
/**
|
|
@@ -18,28 +18,28 @@ export class SpyneChannelLifecycle extends Channel {
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
constructor(props = {}) {
|
|
21
|
-
super('CHANNEL_LIFECYCLE', props)
|
|
21
|
+
super('CHANNEL_LIFECYCLE', props)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
addRegisteredActions() {
|
|
25
25
|
return [
|
|
26
26
|
'CHANNEL_LIFECYCLE_RENDERED_EVENT',
|
|
27
27
|
'CHANNEL_LIFECYCLE_DISPOSED_EVENT'
|
|
28
|
-
]
|
|
28
|
+
]
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
onViewStreamInfo(obj) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
payload
|
|
35
|
-
this.onSendEvent(action, payload)
|
|
32
|
+
const { action, srcElement } = obj
|
|
33
|
+
const payload = srcElement
|
|
34
|
+
payload.action = action
|
|
35
|
+
this.onSendEvent(action, payload)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
onSendEvent(actionStr, payload = {}) {
|
|
39
|
-
const action = this.channelActions[actionStr]
|
|
40
|
-
const srcElement = {}
|
|
41
|
-
const event = undefined
|
|
42
|
-
const delayStream = () => this.sendChannelPayload(action, payload, srcElement, event)
|
|
43
|
-
window.setTimeout(delayStream, 0)
|
|
39
|
+
const action = this.channelActions[actionStr]
|
|
40
|
+
const srcElement = {}
|
|
41
|
+
const event = undefined
|
|
42
|
+
const delayStream = () => this.sendChannelPayload(action, payload, srcElement, event)
|
|
43
|
+
window.setTimeout(delayStream, 0)
|
|
44
44
|
}
|
|
45
45
|
}
|