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