spyne 0.19.1 → 0.20.1

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 (132) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.js +4 -3
  3. package/.travis.yml +24 -11
  4. package/karma.conf.js +77 -87
  5. package/lib/spyne.esm.js +15 -0
  6. package/lib/spyne.esm.js.map +1 -0
  7. package/lib/spyne.js +248 -248
  8. package/lib/spyne.umd.js +3 -0
  9. package/lib/spyne.umd.js.LICENSE.txt +16 -0
  10. package/package.json +48 -27
  11. package/rollup.config.js +26 -0
  12. package/src/spyne/channels/channel-fetch-class.js +39 -43
  13. package/src/spyne/channels/channel-payload-class.js +61 -74
  14. package/src/spyne/channels/channel-proxy.js +25 -26
  15. package/src/spyne/channels/channel.js +141 -149
  16. package/src/spyne/channels/channels-config.js +46 -47
  17. package/src/spyne/channels/channels-map.js +61 -65
  18. package/src/spyne/channels/spyne-channel-lifecycle.js +12 -12
  19. package/src/spyne/channels/spyne-channel-route.js +241 -250
  20. package/src/spyne/channels/spyne-channel-ui.js +213 -75
  21. package/src/spyne/channels/spyne-channel-window.js +157 -157
  22. package/src/spyne/spyne-app.js +32 -19
  23. package/src/spyne/spyne-plugins.js +55 -70
  24. package/src/spyne/spyne.js +23 -23
  25. package/src/spyne/utils/channel-config-validator.js +10 -10
  26. package/src/spyne/utils/channel-fetch-util.js +72 -55
  27. package/src/spyne/utils/channel-payload-filter.js +89 -100
  28. package/src/spyne/utils/deep-merge.js +31 -29
  29. package/src/spyne/utils/frp-tools.js +108 -92
  30. package/src/spyne/utils/gc.js +6 -6
  31. package/src/spyne/utils/mixins/base-core-mixins.js +17 -15
  32. package/src/spyne/utils/mixins/base-streams-mixins.js +9 -9
  33. package/src/spyne/utils/route-channel-updater.js +23 -29
  34. package/src/spyne/utils/safe-clone.js +40 -58
  35. package/src/spyne/utils/sanitize-html.js +35 -0
  36. package/src/spyne/utils/security-policy.js +11 -0
  37. package/src/spyne/utils/spyne-app-properties.js +110 -114
  38. package/src/spyne/utils/spyne-logger.js +4 -11
  39. package/src/spyne/utils/spyne-plugins-methods.js +38 -63
  40. package/src/spyne/utils/spyne-trait.js +33 -33
  41. package/src/spyne/utils/spyne-utils-channel-route-url.js +229 -153
  42. package/src/spyne/utils/spyne-utils-channel-route.js +128 -138
  43. package/src/spyne/utils/spyne-utils-channel-window.js +39 -39
  44. package/src/spyne/utils/viewstream-animations.js +12 -12
  45. package/src/spyne/utils/viewstream-observables.js +45 -45
  46. package/src/spyne/views/dom-element-template.js +111 -114
  47. package/src/spyne/views/dom-element.js +82 -84
  48. package/src/spyne/views/view-stream-broadcaster.js +66 -62
  49. package/src/spyne/views/view-stream-element.js +105 -106
  50. package/src/spyne/views/view-stream-payload.js +25 -27
  51. package/src/spyne/views/view-stream-selector.js +157 -163
  52. package/src/spyne/views/view-stream.js +416 -640
  53. package/src/tests/channels/channel-dom.test.js +15 -15
  54. package/src/tests/channels/channel-fetch.test.js +51 -62
  55. package/src/tests/channels/channel-payload-class.test.js +50 -63
  56. package/src/tests/channels/channel-payload-filter.test.js +133 -193
  57. package/src/tests/channels/channel-route.test.js +102 -112
  58. package/src/tests/channels/channel-stream-item.test.js +19 -19
  59. package/src/tests/channels/channel-ui.test.js +15 -27
  60. package/src/tests/channels/channel-util-dom.test.js +31 -31
  61. package/src/tests/channels/channel.test.js +20 -25
  62. package/src/tests/channels/route-utils.test.js +61 -66
  63. package/src/tests/channels/url-utils.test.js +151 -151
  64. package/src/tests/channels/view-stream-broadcaster.test.js +7 -7
  65. package/src/tests/import.test.js +5 -5
  66. package/src/tests/index.js +6 -7
  67. package/src/tests/index.test.js +6 -8
  68. package/src/tests/mocks/channel-payload-data.js +218 -220
  69. package/src/tests/mocks/enhancer.test.js +5 -5
  70. package/src/tests/mocks/payload-ui.js +87 -90
  71. package/src/tests/mocks/routes-data.js +264 -266
  72. package/src/tests/mocks/spyne-docs.mocks.js +3 -3
  73. package/src/tests/mocks/template-renderer.mocks.js +47 -47
  74. package/src/tests/mocks/utils-data.js +78 -79
  75. package/src/tests/mocks/viewstream-internal-payload.mocks.js +50 -50
  76. package/src/tests/mocks/window-events-arr.js +1 -1
  77. package/src/tests/package-json.spec.test.js +9 -0
  78. package/src/tests/spyne-app.test.js +15 -18
  79. package/src/tests/spyne-plugin.test.js +16 -20
  80. package/src/tests/utils/channel-action-filter.test.js +84 -86
  81. package/src/tests/utils/channel-data-packet-generator.unused.js +62 -86
  82. package/src/tests/utils/channel-fetch-util.test.js +64 -66
  83. package/src/tests/utils/frp-tools.test.js +19 -19
  84. package/src/tests/utils/plugins-methods.test.js +31 -55
  85. package/src/tests/utils/security.test.js +10 -0
  86. package/src/tests/utils/spyne-app-properties.test.js +4 -8
  87. package/src/tests/views/dom-el-selectors.test.js +112 -119
  88. package/src/tests/views/dom-el-template-proxy.test.js +7 -0
  89. package/src/tests/views/dom-el-template.test.js +186 -156
  90. package/src/tests/views/dom-el.test.js +58 -56
  91. package/src/tests/views/view-stream-enhancer-loader.test.js +2 -2
  92. package/src/tests/views/view-stream-enhancer.test.js +11 -11
  93. package/src/tests/views/view-stream.test.js +22 -33
  94. package/webpack.config.js +76 -67
  95. package/docs/-_%20Solves%20equations%20of%20the%20form%20a%20_%20x%20=%20b.html +0 -487
  96. package/docs/DomItem.html +0 -298
  97. package/docs/DomItem_DomItem.html +0 -314
  98. package/docs/ViewStream.html +0 -2249
  99. package/docs/ViewStream_ViewStream.html +0 -503
  100. package/docs/custom/css/jsdoc-viewstream.css +0 -377
  101. package/docs/custom/layout.tmpl +0 -47
  102. package/docs/dom-item.js.html +0 -213
  103. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  104. package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
  105. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  106. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  107. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  108. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  109. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  110. package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
  111. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  112. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  113. package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
  114. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  115. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  116. package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  117. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  118. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  119. package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
  120. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  121. package/docs/global.html +0 -548
  122. package/docs/index-custom.html +0 -79
  123. package/docs/index.html +0 -82
  124. package/docs/jsdoc.config.json +0 -22
  125. package/docs/scripts/linenumber.js +0 -25
  126. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  127. package/docs/scripts/prettify/lang-css.js +0 -2
  128. package/docs/scripts/prettify/prettify.js +0 -28
  129. package/docs/styles/jsdoc-default.css +0 -358
  130. package/docs/styles/prettify-jsdoc.css +0 -111
  131. package/docs/styles/prettify-tomorrow.css +0 -132
  132. package/docs/view-stream.js.html +0 -767
@@ -1,28 +1,28 @@
1
- import { SpyneChannelWindow } from '../../spyne/channels/spyne-channel-window';
2
- import { SpyneConfigData } from '../mocks/utils-data';
1
+ import { SpyneChannelWindow } from '../../spyne/channels/spyne-channel-window'
2
+ import { SpyneConfigData } from '../mocks/utils-data'
3
3
 
4
- const domData = SpyneConfigData.channels.WINDOW;
4
+ const domData = SpyneConfigData.channels.WINDOW
5
5
 
6
6
  describe('channel dom tests', () => {
7
7
  describe('channel outputs', () => {
8
8
  it('create observable of all queries', () => {
9
- return true;
10
- });
9
+ return true
10
+ })
11
11
 
12
12
  it('mediq query output', () => {
13
- return true;
13
+ return true
14
14
  // expect(a).to.equal(true);
15
- });
15
+ })
16
16
 
17
17
  it('touch device orientation output', () => {
18
- return true;
19
- });
18
+ return true
19
+ })
20
20
 
21
21
  it('scroll output', () => {
22
- return true;
23
- });
22
+ return true
23
+ })
24
24
  it('resize window output', () => {
25
- return true;
26
- });
27
- });
28
- });
25
+ return true
26
+ })
27
+ })
28
+ })
@@ -1,102 +1,91 @@
1
- const {expect, assert} = require('chai');
2
- const {ChannelFetch} = require('../../spyne/channels/channel-fetch-class')
1
+ const { expect, assert } = require('chai')
2
+ const { ChannelFetch } = require('../../spyne/channels/channel-fetch-class')
3
3
 
4
4
  describe('should test ChannelFetch', () => {
5
5
  const mapFn = (p) => {
6
- //console.log('mapping fetched data ', p);
7
- return p;
8
- };
9
-
10
- const channelName = "CHANNEL_MY_FETCHED_DATA"
11
- let url = 'https://jsonplaceholder.typicode.com/posts/1';
6
+ // console.log('mapping fetched data ', p);
7
+ return p
8
+ }
12
9
 
10
+ const channelName = 'CHANNEL_MY_FETCHED_DATA'
11
+ const url = 'https://jsonplaceholder.typicode.com/posts/1'
13
12
 
14
13
  it('should return true for valid mapFn method', () => {
15
- let props = {
14
+ const props = {
16
15
  mapFn,
17
16
  url,
18
17
  method: 'GET'
19
- };
20
-
21
- const mapMethodIsValid = ChannelFetch.validateMapMethod(props, channelName);
22
- //console.log('mapFn method is valid ',{mapMethodIsValid})
23
- expect(mapMethodIsValid).to.be.true;
18
+ }
24
19
 
25
- });
20
+ const mapMethodIsValid = ChannelFetch.validateMapMethod(props, channelName)
21
+ // console.log('mapFn method is valid ',{mapMethodIsValid})
22
+ expect(mapMethodIsValid).to.be.true
23
+ })
26
24
 
27
25
  it('should return true for valid map method', () => {
28
- const map = mapFn;
29
- let props = {
26
+ const map = mapFn
27
+ const props = {
30
28
  map,
31
29
  url,
32
30
  method: 'GET'
33
- };
34
-
35
- const mapMethodIsValid = ChannelFetch.validateMapMethod(props, channelName);
36
- //console.log('map method is valid ',{mapMethodIsValid})
37
- expect(mapMethodIsValid).to.be.true;
31
+ }
38
32
 
39
- });
33
+ const mapMethodIsValid = ChannelFetch.validateMapMethod(props, channelName)
34
+ // console.log('map method is valid ',{mapMethodIsValid})
35
+ expect(mapMethodIsValid).to.be.true
36
+ })
40
37
 
41
38
  it('should return true non existing map methods', () => {
42
- let props = {
39
+ const props = {
43
40
  url
44
- };
41
+ }
45
42
 
46
- const noMapMethodAdded = ChannelFetch.validateMapMethod(props, channelName);
47
- //console.log('map methods not added and is valid ',{noMapMethodAdded})
48
- expect(noMapMethodAdded).to.be.true;
49
-
50
- });
43
+ const noMapMethodAdded = ChannelFetch.validateMapMethod(props, channelName)
44
+ // console.log('map methods not added and is valid ',{noMapMethodAdded})
45
+ expect(noMapMethodAdded).to.be.true
46
+ })
51
47
 
52
48
  it('should return false for map of wrong type', () => {
53
- const map = 4;
54
- let props = {
49
+ const map = 4
50
+ const props = {
55
51
  map,
56
52
  url
57
- };
58
-
59
- const mapTypeIsCorrect = ChannelFetch.validateMapMethod(props, "MY_TEST_NAME", true);
60
- //console.log('map methods is not of correct type added and is valid1 ',{mapTypeIsCorrect}) ; expect(mapTypeIsCorrect).to.be.false;
53
+ }
61
54
 
62
- });
55
+ const mapTypeIsCorrect = ChannelFetch.validateMapMethod(props, 'MY_TEST_NAME', true)
56
+ // console.log('map methods is not of correct type added and is valid1 ',{mapTypeIsCorrect}) ; expect(mapTypeIsCorrect).to.be.false;
57
+ })
63
58
 
64
59
  it('should return false for mapFn of wrong type', () => {
65
- const mapFn = 'my str';
66
- let props = {
60
+ const mapFn = 'my str'
61
+ const props = {
67
62
  mapFn,
68
63
  url
69
- };
70
-
71
- const mapTypeIsCorrect = ChannelFetch.validateMapMethod(props, "MY_TEST_NAME_2", true);
72
- //console.log('map methods is not of correct type added and is valid2 ',{mapTypeIsCorrect}) ; expect(mapTypeIsCorrect).to.be.false;
64
+ }
73
65
 
74
- });
66
+ const mapTypeIsCorrect = ChannelFetch.validateMapMethod(props, 'MY_TEST_NAME_2', true)
67
+ // console.log('map methods is not of correct type added and is valid2 ',{mapTypeIsCorrect}) ; expect(mapTypeIsCorrect).to.be.false;
68
+ })
75
69
 
76
70
  it('should return false for map of wrong type', () => {
77
- const map = undefined;
78
- let props = {
71
+ const map = undefined
72
+ const props = {
79
73
  map,
80
74
  url
81
- };
75
+ }
82
76
 
83
- const mapTypeUndefined = ChannelFetch.validateMapMethod(props, "MY_TEST_NAME", true);
84
- //console.log('map methods is not of correct type added and is valid3 ',{mapTypeUndefined}) ; expect(mapTypeUndefined).to.be.false;
85
-
86
- });
77
+ const mapTypeUndefined = ChannelFetch.validateMapMethod(props, 'MY_TEST_NAME', true)
78
+ // console.log('map methods is not of correct type added and is valid3 ',{mapTypeUndefined}) ; expect(mapTypeUndefined).to.be.false;
79
+ })
87
80
 
88
81
  it('should return false for mapFn of wrong type', () => {
89
- const mapFn = undefined;
90
- let props = {
82
+ const mapFn = undefined
83
+ const props = {
91
84
  mapFn,
92
85
  url
93
- };
94
-
95
- const mapTypeUndefined = ChannelFetch.validateMapMethod(props, "MY_TEST_NAME_2", true);
96
- //console.log('map methods is not of correct type added and is valid4 ',{mapTypeUndefined}) ; expect(mapTypeUndefined).to.be.false;
97
-
98
- });
99
-
100
-
86
+ }
101
87
 
102
- });
88
+ const mapTypeUndefined = ChannelFetch.validateMapMethod(props, 'MY_TEST_NAME_2', true)
89
+ // console.log('map methods is not of correct type added and is valid4 ',{mapTypeUndefined}) ; expect(mapTypeUndefined).to.be.false;
90
+ })
91
+ })
@@ -1,42 +1,39 @@
1
- const {expect, assert} = require('chai');
2
- const MSFData = require('../mocks/msf-user-data.json');
3
- const MSFDataSmall = require('../mocks/msf-user-data-small.json');
4
- import {SpyneApp, Channel} from '../../spyne/spyne';
5
- import {ChannelPayload} from '../../spyne/channels/channel-payload-class'
6
- import {ChannelPayloadToTestFilters} from '../mocks/channel-payload-data';
7
- import {ChannelPayloadFilter} from '../../spyne/utils/channel-payload-filter';
8
- const R = require('ramda');
9
-
1
+ import { SpyneApp, Channel } from '../../spyne/spyne'
2
+ import { ChannelPayload } from '../../spyne/channels/channel-payload-class'
3
+ import { ChannelPayloadToTestFilters } from '../mocks/channel-payload-data'
4
+ import { ChannelPayloadFilter } from '../../spyne/utils/channel-payload-filter'
5
+ const { expect, assert } = require('chai')
6
+ const MSFData = require('../mocks/msf-user-data.json')
7
+ const MSFDataSmall = require('../mocks/msf-user-data-small.json')
8
+ const R = require('ramda')
10
9
 
11
10
  describe('should test Channel Payload Class', () => {
12
- const {srcElement, event, action} = ChannelPayloadToTestFilters;
13
- const channelName = "CHANNEL_ROUTE";
14
- SpyneApp.init({debug:true}, true);
15
-
16
- before(()=>{
17
- const spyneApp = SpyneApp;
18
- spyneApp.registerChannel(new Channel("CHANNEL_MYCHANNEL"))
19
-
11
+ const { srcElement, event, action } = ChannelPayloadToTestFilters
12
+ const channelName = 'CHANNEL_ROUTE'
13
+ SpyneApp.init({ debug:true }, true)
20
14
 
15
+ before(() => {
16
+ const spyneApp = SpyneApp
17
+ spyneApp.registerChannel(new Channel('CHANNEL_MYCHANNEL'))
21
18
  })
22
19
 
23
- it('should freeze the payload', ()=>{
20
+ it('should freeze the payload', () => {
24
21
  const channnelPayload = new ChannelPayload(channelName, action, MSFData, srcElement, event)
25
- const {payload} = channnelPayload;
26
- let {section} = payload.content;
27
- let payloadIsFrozen = false;
28
- try{
29
- section.header = 'new copy';
30
- } catch(e){
31
- payloadIsFrozen = true;
22
+ const { payload } = channnelPayload
23
+ const { section } = payload.content
24
+ let payloadIsFrozen = false
25
+ try {
26
+ section.header = 'new copy'
27
+ } catch (e) {
28
+ payloadIsFrozen = true
32
29
  }
33
30
 
34
- //console.log('payload is ', {payloadIsFrozen, section});
31
+ // console.log('payload is ', {payloadIsFrozen, section});
35
32
 
36
- expect(payloadIsFrozen).to.be.true;
33
+ expect(payloadIsFrozen).to.be.true
37
34
  })
38
35
 
39
- it('should freeze the uintarray', ()=>{
36
+ it('should freeze the uintarray', () => {
40
37
  const payloadObj = {
41
38
  myArray: new Uint8Array(0),
42
39
  myDataView: new DataView(new ArrayBuffer(32))
@@ -44,16 +41,15 @@ describe('should test Channel Payload Class', () => {
44
41
  }
45
42
 
46
43
  const channnelPayload = new ChannelPayload(channelName, action, payloadObj, srcElement, event)
47
- const {payload} = channnelPayload;
48
- const {myArray} = payload;
49
- //console.log('payload is ', {payloadIsFrozen, section});
50
- // console.log('payload is ',typeof(myArray));
44
+ const { payload } = channnelPayload
45
+ const { myArray } = payload
46
+ // console.log('payload is ', {payloadIsFrozen, section});
47
+ // console.log('payload is ',typeof(myArray));
51
48
 
52
49
  expect(myArray).to.exist
53
50
  })
54
51
 
55
-
56
- /* it('should clone and unfreeze the props payload', ()=>{
52
+ /* it('should clone and unfreeze the props payload', ()=>{
57
53
 
58
54
  const channnelPayload = new ChannelPayload(channelName, action, MSFData, srcElement, event)
59
55
  const {payload, channel} = channnelPayload.props();
@@ -71,7 +67,7 @@ describe('should test Channel Payload Class', () => {
71
67
  })
72
68
  */
73
69
 
74
- /*
70
+ /*
75
71
  it('should clone and unfreeze the deconstructed props payload', ()=>{
76
72
  const channnelPayload = new ChannelPayload(channelName, action, MSFData, srcElement, event)
77
73
  const {content} = channnelPayload.props();
@@ -88,11 +84,9 @@ describe('should test Channel Payload Class', () => {
88
84
  expect(payloadPropsIsClone).to.be.true;
89
85
  })
90
86
 
91
-
92
87
  */
93
88
 
94
-
95
- /*
89
+ /*
96
90
 
97
91
  it('should clone and unfreeze the updated new prop', ()=>{
98
92
  const channnelPayload = new ChannelPayload(channelName, action, MSFData, srcElement, event)
@@ -113,37 +107,30 @@ describe('should test Channel Payload Class', () => {
113
107
 
114
108
  */
115
109
 
116
-
117
110
  it('should run shell tests', () => {
118
-
119
-
120
111
  const channnelPayload = new ChannelPayload(channelName, action, MSFData, srcElement, event)
121
- const getVals = (e)=>{
122
- let {payload} = e;
123
- let {content} = payload;
124
- //content['ubu']=4;
125
- console.log('channel FROZE payload class ',content)
126
-
112
+ const getVals = (e) => {
113
+ const { payload } = e
114
+ const { content } = payload
115
+ // content['ubu']=4;
116
+ console.log('channel FROZE payload class ', content)
127
117
  }
128
118
 
129
- const getValsFromProps = (e)=>{
130
- console.time("propsPairs");
131
- let {payload} = e.props();
132
- console.timeEnd('propsPairs');
133
- let {section} = payload.content;
119
+ const getValsFromProps = (e) => {
120
+ console.time('propsPairs')
121
+ const { payload } = e.props()
122
+ console.timeEnd('propsPairs')
123
+ const { section } = payload.content
134
124
 
135
- // section['ubu']=4;
136
- //console.log('channel PROPS payload class ',section)
125
+ // section['ubu']=4;
126
+ // console.log('channel PROPS payload class ',section)
137
127
  }
138
128
 
139
- //getVals(channnelPayload);
140
- //getValsFromProps(channnelPayload);
129
+ // getVals(channnelPayload);
130
+ // getValsFromProps(channnelPayload);
141
131
 
132
+ // console.log('channel payload class ',window.Spyne.config.channels[channelName].payload[1].payload.isDeepLink)
142
133
 
143
- //console.log('channel payload class ',window.Spyne.config.channels[channelName].payload[1].payload.isDeepLink)
144
-
145
- return true;
146
-
147
- });
148
-
149
- });
134
+ return true
135
+ })
136
+ })