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
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ src/tests/**/*.test.js
2
+ src/tests/mocks/*.js
package/.eslintrc.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module.exports = {
3
- "extends": "semistandard",
3
+ "extends": "standard",
4
4
 
5
5
  "globals": {
6
6
  "requestAnimationFrame" : true
@@ -19,11 +19,12 @@ module.exports = {
19
19
  "named": "never",
20
20
  "asyncArrow": "never"
21
21
  }],
22
-
22
+ 'no-new': 'off',
23
+ 'camelcase': 'off',
23
24
  "no-unused-vars": ["error", { "caughtErrors": "none", "args": "none" }],
24
25
  "arrow-spacing": ["error", { "before": true, "after": true }],
25
26
  "no-return-assign": ["error", "except-parens"],
26
27
  "no-multi-spaces": ["error", { exceptions: { "VariableDeclarator": true } }]
27
28
  /*"class-methods-use-this": ["error", { "exceptMethods": ["foo"] }]*/
28
29
  }
29
- };
30
+ };
package/.travis.yml CHANGED
@@ -1,17 +1,30 @@
1
+ # .travis.yml
2
+ dist: jammy
1
3
  language: node_js
2
- cache:
3
- directories:
4
- - ~/.npm
5
- services:
6
- - xvfb
7
- notifications:
8
- email: false
4
+
9
5
  node_js:
10
- - '14'
11
- before_script:
12
- - npm prune
6
+ - '16'
7
+ - '18'
8
+ # Removed 'node' to avoid testing the very latest (which may require npm >= 11)
9
+
10
+ services:
11
+ - xvfb # If you need a browser environment
12
+
13
+ cache:
14
+ npm: true
15
+
16
+ # before_install:
17
+ # - npm install -g npm@latest # Removed or commented out to avoid engine mismatch
18
+
19
+ install:
20
+ - npm ci
21
+
13
22
  script:
14
23
  - npm run test:single
24
+
25
+ notifications:
26
+ email: false
27
+
15
28
  branches:
16
29
  only:
17
- - master
30
+ - main
package/karma.conf.js CHANGED
@@ -1,39 +1,49 @@
1
-
2
- const webpackConfig = require("./webpack.config");
3
- webpackConfig.mode = 'none';
4
- webpackConfig.watch = true;
5
- webpackConfig.entry = undefined;
6
- webpackConfig.output = undefined;
7
-
8
- const fileGlob = './src/tests/index.test.js';
9
-
10
-
11
- module.exports = function(config) {
12
-
1
+ const webpackConfigs = require('./webpack.config');
2
+
3
+ // Since webpack.config.js exports an array [esmConfig, umdConfig],
4
+ // we'll grab the second one (UMD) to use in Karma.
5
+ const [esmConfig, umdConfig] = webpackConfigs || [];
6
+
7
+ // Make a shallow clone of the UMD config so we can tweak it for Karma:
8
+ const karmaWebpackConfig = {
9
+ ...umdConfig,
10
+
11
+ // Force a "neutral" mode so Webpack doesn't minify or do env-specific optimizations
12
+ mode: 'none',
13
+
14
+ // Karma manages watching/rebuilding on its own, so we typically disable watch from Webpack
15
+ watch: false,
16
+
17
+ // Remove the library entry/output so that Karma can inline test files
18
+ entry: undefined,
19
+ output: undefined
20
+ };
21
+ karmaWebpackConfig.externals = [];
22
+ // Optionally inject any test-specific loaders/rules, e.g. coverage instrumentation:
23
+ karmaWebpackConfig.module.rules.push({
24
+ test: /\.js$/,
25
+ exclude: /node_modules/,
26
+ // If you use Babel or another coverage tool, you can add it here
27
+ // For example:
28
+ // use: {
29
+ // loader: 'babel-loader',
30
+ // options: {
31
+ // plugins: ['istanbul'] // coverage plugin
32
+ // }
33
+ // }
34
+ });
35
+
36
+ module.exports = function (config) {
37
+ // If you need Travis CI logic:
13
38
  if (process.env.TRAVIS) {
14
- config.browsers = ['Chrome_travis_ci'];
39
+ config.browsers = ['ChromeHeadlessNoSandbox'];
15
40
  }
16
41
 
17
-
18
- webpackConfig.module.rules.push(
19
- {
20
- test: /(\.js)$/,
21
- exclude: /(node_modules)/
22
- }
23
- );
24
-
25
-
26
42
  config.set({
27
-
28
- // base path that will be used to resolve all patterns (eg. files, exclude)
43
+ // Base path that will be used to resolve all patterns (eg. files, exclude)
29
44
  basePath: '',
30
45
 
31
-
32
- output:{
33
-
34
- },
35
-
36
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
46
+ // Test frameworks
37
47
  frameworks: ['webpack', 'mocha', 'chai'],
38
48
 
39
49
  plugins: [
@@ -44,90 +54,70 @@ module.exports = function(config) {
44
54
  'karma-chrome-launcher'
45
55
  ],
46
56
 
47
-
57
+ // List of files / patterns to load in the browser
48
58
  files: [
49
- {pattern: './node_modules/ramda/dist/ramda.min.js', watched:false},
50
- { pattern: './node_modules/rxjs/**/*.js', included:false, watched: false },
51
-
52
- {pattern: './src/tests/index.test.js', watched: true},
53
- {pattern: './src/tests/spyne-app.test.js', watched: true},
54
- {pattern: './src/tests/spyne-plugin.test.js', watched: true},
55
- {pattern: './src/tests/channels/*.test.js', watched: true},
56
-
57
- {pattern: './src/tests/utils/*.test.js', watched: true},
58
- {pattern: './src/tests/views/*.test.js', watched: true}
59
- ],
60
-
61
-
62
- exclude: [
63
-
59
+ // External deps you might need:
60
+ { pattern: './node_modules/ramda/dist/ramda.min.js', watched: false },
61
+ { pattern: './node_modules/rxjs/**/*.js', included: false, watched: false },
62
+
63
+ // Your test files:
64
+ { pattern: './src/tests/index.test.js', watched: true },
65
+ { pattern: './src/tests/spyne-app.test.js', watched: true },
66
+ { pattern: './src/tests/package-json.spec.test.js', watched: true },
67
+ { pattern: './src/tests/spyne-plugin.test.js', watched: true },
68
+ { pattern: './src/tests/channels/*.test.js', watched: true },
69
+ { pattern: './src/tests/utils/*.test.js', watched: true },
70
+ { pattern: './src/tests/views/*.test.js', watched: true }
64
71
  ],
65
72
 
66
-
67
- // preprocess matching files before serving them to the browser
68
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
73
+ // Preprocessors so that the files are processed by Webpack + coverage
69
74
  preprocessors: {
70
- './src/tests/*.test.js' : ['webpack', 'coverage'],
71
- './src/tests/channels/*.test.js' : ['webpack', 'coverage'],
72
- './src/tests/utils/*.test.js' : ['webpack', 'coverage'],
73
- './src/tests/views/*.test.js' : ['webpack', 'coverage']
75
+ './src/tests/*.test.js': ['webpack', 'coverage'],
76
+ './src/tests/channels/*.test.js': ['webpack', 'coverage'],
77
+ './src/tests/utils/*.test.js': ['webpack', 'coverage'],
78
+ './src/tests/views/*.test.js': ['webpack', 'coverage']
74
79
  },
75
80
 
76
- webpack: webpackConfig,
81
+ // Use our customized Webpack config
82
+ webpack: karmaWebpackConfig,
77
83
 
78
- webpackMiddleware: {noInfo: true},
84
+ // Quiet the Webpack output in the Karma logs
85
+ webpackMiddleware: { noInfo: true },
79
86
 
80
-
81
- // test results reporter to use
82
- // possible values: 'dots', 'progress'
83
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
84
- reporters: ['coverage'],
87
+ // Report results with coverage
88
+ reporters: ['progress', 'coverage'],
85
89
 
86
90
  coverageReporter: {
87
91
  reporters: [
88
- // generates ./coverage/lcov.info
89
- {type:'lcovonly', subdir: '.'},
90
- // generates ./coverage/coverage-final.json
91
- {type:'json', subdir: '.'},
92
+ { type: 'lcovonly', subdir: '.' }, // ./coverage/lcov.info
93
+ { type: 'json', subdir: '.' } // ./coverage/coverage-final.json
92
94
  ]
93
95
  },
94
96
 
95
- // web server port
96
97
  port: 9876,
97
-
98
-
99
- // enable / disable colors in the output (reporters and logs)
100
98
  colors: true,
101
-
102
-
103
- // level of logging
104
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
105
99
  logLevel: config.LOG_DEBUG,
106
100
 
107
-
108
- // enable / disable watching file and executing tests whenever any file changes
101
+ // autoWatch: if true, re-run tests on file changes
109
102
  autoWatch: true,
103
+
104
+ // For file-watching inside containers or certain OS environments
110
105
  usePolling: true,
111
106
 
112
107
  customLaunchers: {
113
- ChromeHeadlessNoSandbox: {
114
- base: 'ChromeHeadless',
115
- flags: ['--no-sandbox']
116
- }
117
-
108
+ ChromeHeadlessNoSandbox: {
109
+ base: 'ChromeHeadless',
110
+ flags: ['--no-sandbox']
111
+ }
118
112
  },
119
113
 
120
-
121
- // start these browsers
122
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
114
+ // Browsers to start (choose your launcher)
123
115
  browsers: ['Chrome'],
124
116
 
125
- // Continuous Integration mode
126
- // if true, Karma captures browsers, runs the tests and exits
117
+ // If true, Karma runs tests once and exits
127
118
  singleRun: true,
128
119
 
129
120
  // Concurrency level
130
- // how many browser should be started simultaneous
131
121
  concurrency: Infinity
132
- })
133
- }
122
+ });
123
+ };