spyne 0.17.1 → 0.18.3
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/README.md +0 -60
- package/karma.conf.js +5 -61
- package/lib/spyne.js +566 -1218
- package/lib/spyne.min.js +1 -1
- package/lib/spyne.min.js.LICENSE.txt +1 -1
- package/package.json +22 -15
- package/src/spyne/channels/channel-fetch-class.js +1 -4
- package/src/spyne/channels/channel-payload-class.js +8 -9
- package/src/spyne/channels/channel-proxy.js +1 -1
- package/src/spyne/channels/channel.js +3 -26
- package/src/spyne/channels/channels-config.js +0 -2
- package/src/spyne/channels/channels-map.js +1 -18
- package/src/spyne/channels/spyne-channel-lifecycle.js +1 -2
- package/src/spyne/channels/spyne-channel-route.js +7 -47
- package/src/spyne/channels/spyne-channel-ui.js +0 -2
- package/src/spyne/channels/spyne-channel-window.js +4 -54
- package/src/spyne/spyne-app.js +5 -21
- package/src/spyne/spyne-plugins.js +35 -64
- package/src/spyne/spyne.js +0 -1
- package/src/spyne/utils/channel-config-validator.js +0 -1
- package/src/spyne/utils/channel-fetch-util.js +1 -2
- package/src/spyne/utils/channel-payload-filter.js +4 -73
- package/src/spyne/utils/gc.js +1 -1
- package/src/spyne/utils/route-channel-updater.js +0 -4
- package/src/spyne/utils/spyne-app-properties.js +42 -72
- package/src/spyne/utils/spyne-plugins-methods.js +1 -9
- package/src/spyne/utils/spyne-trait.js +2 -5
- package/src/spyne/utils/spyne-utils-channel-route-url.js +1 -7
- package/src/spyne/utils/spyne-utils-channel-route.js +3 -13
- package/src/spyne/utils/spyne-utils-channel-window.js +2 -4
- package/src/spyne/utils/viewstream-observables.js +2 -3
- package/src/spyne/views/dom-element-template.js +1 -6
- package/src/spyne/views/dom-element.js +0 -19
- package/src/spyne/views/view-stream-broadcaster.js +2 -7
- package/src/spyne/views/view-stream-element.js +1 -18
- package/src/spyne/views/view-stream-payload.js +2 -69
- package/src/spyne/views/view-stream-selector.js +1 -6
- package/src/spyne/views/view-stream.js +253 -280
- package/webpack.config.js +0 -29
- package/lib/channel-action-filter.test.871939702.js +0 -20
- package/lib/channel-dom.test.2857423116.js +0 -20
- package/lib/channel-fetch-util.test.1782805723.js +0 -20
- package/lib/channel-fetch.test.3331576485.js +0 -20
- package/lib/channel-payload-class.test.99440410.js +0 -20
- package/lib/channel-payload-filter.test.2135136282.js +0 -20
- package/lib/channel-route.test.3036804306.js +0 -20
- package/lib/channel-stream-item.test.1523843610.js +0 -20
- package/lib/channel-ui.test.367398224.js +0 -20
- package/lib/channel-util-dom.test.3758627277.js +0 -20
- package/lib/channel.test.1717017712.js +0 -20
- package/lib/commons.js +0 -50372
- package/lib/dom-el-selectors.test.2633571626.js +0 -20
- package/lib/dom-el-template.test.268653142.js +0 -20
- package/lib/dom-el.test.4051977500.js +0 -20
- package/lib/frp-tools.test.3814897075.js +0 -20
- package/lib/index.test.1514915838.js +0 -20
- package/lib/plugins-methods.test.2326717190.js +0 -20
- package/lib/route-utils.test.2350761994.js +0 -20
- package/lib/runtime.js +0 -174
- package/lib/spyne-app-properties.test.96729569.js +0 -20
- package/lib/spyne-app.test.1443517996.js +0 -20
- package/lib/spyne-plugin.test.1247070970.js +0 -20
- package/lib/url-utils.test.516839067.js +0 -20
- package/lib/view-stream-broadcaster.test.934532750.js +0 -20
- package/lib/view-stream-enhancer-loader.test.2755314117.js +0 -20
- package/lib/view-stream-enhancer.test.414877881.js +0 -20
- package/lib/view-stream.test.2479353905.js +0 -20
- package/src/spyne/channels/lifestream-payload.js +0 -56
- package/src/spyne/utils/spyne-scroll-lock.js +0 -95
- package/src/spyne/views/view-stream-enhancer-loader.js +0 -70
|
@@ -2,7 +2,6 @@ import { from } from 'rxjs';
|
|
|
2
2
|
import { flatMap, map, publish, tap } from 'rxjs/operators';
|
|
3
3
|
import {compose, prop, defaultTo, over, lensProp, has, propEq, when, propIs, allPass, assoc, pick, mergeDeepRight} from 'ramda';
|
|
4
4
|
export class ChannelFetchUtil {
|
|
5
|
-
// METHOD GET POST PUT PATCH DELETE
|
|
6
5
|
/**
|
|
7
6
|
* @module ChannelFetchUtil
|
|
8
7
|
* @type util
|
|
@@ -49,7 +48,7 @@ export class ChannelFetchUtil {
|
|
|
49
48
|
|
|
50
49
|
|
|
51
50
|
constructor(options, subscriber, testMode) {
|
|
52
|
-
|
|
51
|
+
|
|
53
52
|
const testSubscriber = (p) => console.log('FETCH RETURNED ', p);
|
|
54
53
|
|
|
55
54
|
this._mapFn = ChannelFetchUtil.setMapFn(options);
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
is,
|
|
3
3
|
reject,
|
|
4
|
-
ifElse,
|
|
5
|
-
invoker,
|
|
6
|
-
identity,
|
|
7
|
-
assoc,
|
|
8
4
|
isNil,
|
|
9
|
-
|
|
5
|
+
find,
|
|
10
6
|
allPass,
|
|
11
|
-
tap,
|
|
12
7
|
forEachObjIndexed,
|
|
13
8
|
not,
|
|
14
9
|
isEmpty,
|
|
@@ -19,16 +14,11 @@ import {
|
|
|
19
14
|
where,
|
|
20
15
|
defaultTo,
|
|
21
16
|
mergeAll,
|
|
22
|
-
__,
|
|
23
17
|
omit,
|
|
24
|
-
path,
|
|
25
|
-
call,
|
|
26
|
-
clone,
|
|
27
18
|
flatten,
|
|
28
19
|
any,
|
|
29
|
-
type,
|
|
30
20
|
curry,
|
|
31
|
-
|
|
21
|
+
lte
|
|
32
22
|
} from 'ramda';
|
|
33
23
|
|
|
34
24
|
import {SpyneAppProperties} from './spyne-app-properties';
|
|
@@ -125,8 +115,6 @@ export class ChannelPayloadFilter {
|
|
|
125
115
|
|
|
126
116
|
const debugLabelArr = [debugLabel, prop('debugLabel', filters)]
|
|
127
117
|
|
|
128
|
-
const makeBool = b => Boolean(b);
|
|
129
|
-
|
|
130
118
|
debugLabel = compose(find(is(String)))(debugLabelArr);
|
|
131
119
|
|
|
132
120
|
let props = omit(['debugLabel', 'label', 'selector', 'props', 'testMode', 'propFilters'], filters)
|
|
@@ -140,22 +128,13 @@ export class ChannelPayloadFilter {
|
|
|
140
128
|
filters['propFilters'] = props;
|
|
141
129
|
|
|
142
130
|
let {propFilters} = filters;
|
|
143
|
-
//console.log("selector filters ", {selector, filters})
|
|
144
131
|
|
|
145
|
-
// let {selector,propFilters,debugLabel} = filters;
|
|
146
132
|
|
|
147
133
|
const addStringSelectorFilter = isNonEmptyStr(selector) ? ChannelPayloadFilter.filterSelector([selector], debugLabel) : undefined;
|
|
148
134
|
const addArraySelectorFilter = isNonEmptyArr(selector) ? ChannelPayloadFilter.filterSelector(selector, debugLabel) : undefined;
|
|
149
|
-
|
|
150
|
-
|
|
151
135
|
const addDataFilter = isNonEmptyObjectFn(propFilters) ? ChannelPayloadFilter.filterData(propFilters, debugLabel) : undefined;
|
|
152
136
|
|
|
153
|
-
//console.log("IS STRING ",{selector, addStringSelectorFilter, addArraySelectorFilter, addDataFilter},isNonEmptyStr(selector))
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
137
|
let filtersArr = reject(isNil, [addStringSelectorFilter, addArraySelectorFilter, addDataFilter]);
|
|
158
|
-
// console.log('filtersArr is ',{selector})
|
|
159
138
|
|
|
160
139
|
// IF ARRAY IS EMPTY ALWAYS RETURN FALSE;
|
|
161
140
|
|
|
@@ -168,10 +147,7 @@ export class ChannelPayloadFilter {
|
|
|
168
147
|
}
|
|
169
148
|
|
|
170
149
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
//console.log(" VALUES OF FILTERS ",{selector,propFilters,filters,debugLabel,testMode, filtersAreEmpty});
|
|
174
|
-
if (testMode === true){
|
|
150
|
+
if (testMode === true){
|
|
175
151
|
return {selector, propFilters, debugLabel, filters, testMode, filtersAreEmpty};
|
|
176
152
|
}
|
|
177
153
|
|
|
@@ -181,40 +157,21 @@ export class ChannelPayloadFilter {
|
|
|
181
157
|
static filterData(filterJson, filterdebugLabel) {
|
|
182
158
|
const debugLabel = filterdebugLabel;
|
|
183
159
|
|
|
184
|
-
//console.log('filter data is ',{filterJson, debugLabel})
|
|
185
160
|
let compareData = () => {
|
|
186
161
|
// DO NOT ALLOW AN EMPTY OBJECT TO RETURN TRUEs
|
|
187
162
|
if (isEmpty(filterJson)) {
|
|
188
163
|
return always(false);
|
|
189
164
|
}
|
|
190
165
|
|
|
191
|
-
//console.log("FILTER JSON ",filterJson);
|
|
192
166
|
// CHECKS ALL VALUES IN JSON TO DETERMINE IF THERE ARE FILTERING METHODS
|
|
193
167
|
|
|
194
|
-
//let typeArrFn = compose(values, rMap(type));
|
|
195
|
-
|
|
196
|
-
/*let sendMalFormedWarningBool = uniq(filterValsArr).length > 1;
|
|
197
|
-
if (sendMalFormedWarningBool === true) {
|
|
198
|
-
console.warn('Spyne Warningd: The data values in ChannelActionFilters needs to be either all methods or all static values. DATA: ', filterJson);
|
|
199
|
-
}*/
|
|
200
|
-
|
|
201
168
|
const createCurryComparator = compareStr => (str)=>{
|
|
202
169
|
return str===compareStr;
|
|
203
170
|
};
|
|
204
171
|
const checkToConvertToFn = (val, key, obj)=>val = is(String, val)===true ? createCurryComparator(val) : val;
|
|
205
172
|
filterJson = rMap(checkToConvertToFn, filterJson);
|
|
206
173
|
|
|
207
|
-
// console.log("FILTER JSON: ",{filterJson, newJson});
|
|
208
|
-
//const isAllMethods = all(equals('Function'), filterValsArr);
|
|
209
|
-
|
|
210
|
-
// PULL OUT THE CHANNEL PAYLOAD OBJECT IN THE MAIN PAYLOAD
|
|
211
|
-
// let payload = prop('channelPayload', eventData)
|
|
212
|
-
|
|
213
|
-
// IF THERE ARE METHODS IN THE FILTERING JSON, THEN USE where or whereEq if Basic JSON
|
|
214
|
-
// let fMethod = isAllMethods === true ? where(filterJson) : whereEq(filterJson);
|
|
215
|
-
|
|
216
174
|
// TAP LOGGER
|
|
217
|
-
|
|
218
175
|
const tapLogger = (comparedObj)=>{
|
|
219
176
|
if (debugLabel===undefined){
|
|
220
177
|
return comparedObj;
|
|
@@ -228,7 +185,6 @@ export class ChannelPayloadFilter {
|
|
|
228
185
|
};
|
|
229
186
|
|
|
230
187
|
// END TAP LOGGER
|
|
231
|
-
|
|
232
188
|
let fMethod = where(filterJson);
|
|
233
189
|
|
|
234
190
|
let getFilteringObj = (v)=>{
|
|
@@ -242,29 +198,20 @@ export class ChannelPayloadFilter {
|
|
|
242
198
|
return compose( fMethod, tapLogger, defaultTo({}), getFilteringObj);
|
|
243
199
|
|
|
244
200
|
};
|
|
245
|
-
// const filterLabel = `filtering-${Math.floor(Math.random()*999999)}`;
|
|
246
|
-
//console.time(filterLabel);
|
|
247
|
-
// const val = compareData();
|
|
248
201
|
|
|
249
|
-
//console.timeEnd(filterLabel);
|
|
250
|
-
//return val;
|
|
251
202
|
return compareData();
|
|
252
203
|
}
|
|
253
204
|
|
|
254
205
|
|
|
255
206
|
static checkPayloadSelector(arr, debugLabel, srcPayload) {
|
|
256
|
-
// ELEMENT FROM PAYLOADs
|
|
257
|
-
|
|
258
207
|
|
|
208
|
+
// ELEMENT FROM PAYLOADs
|
|
259
209
|
const {payload, srcElement, event} = srcPayload || {};
|
|
260
|
-
//console.log('payload before ',{srcPayload, payload, srcElement, event})
|
|
261
210
|
|
|
262
211
|
const reduceFindEl = (acc, src) => {
|
|
263
212
|
const el = prop('el', src);
|
|
264
|
-
//console.log("EL IS ",{el, src, acc})
|
|
265
213
|
if (ChannelPayloadFilter.elIsDomElement(el) && acc===undefined){
|
|
266
214
|
acc = el;
|
|
267
|
-
// return acc;
|
|
268
215
|
}
|
|
269
216
|
return acc;
|
|
270
217
|
}
|
|
@@ -272,19 +219,6 @@ export class ChannelPayloadFilter {
|
|
|
272
219
|
const el = [srcElement, payload, prop('srcElement', event), srcPayload].reduce(reduceFindEl, undefined);
|
|
273
220
|
|
|
274
221
|
|
|
275
|
-
//console.log('el check ',{debugLabel, srcElement, payload, event, el})
|
|
276
|
-
|
|
277
|
-
//const o = Object.assign({}, srcPayload, event,srcElement, payload);
|
|
278
|
-
|
|
279
|
-
//console.log('o is ',o);
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
//let payloadIsNotProps = compose(equals('Function'),type, prop('props') )(payload);
|
|
283
|
-
//payload = payloadIsNotProps === true ? payload.payload : payload;
|
|
284
|
-
// console.log('payload after ',{o})
|
|
285
|
-
|
|
286
|
-
// let el = path(['el'], o);
|
|
287
|
-
|
|
288
222
|
// RETURN BOOLEAN MATCH WITH PAYLOAD EL
|
|
289
223
|
const compareEls = (elCompare) => elCompare.isEqualNode((el));
|
|
290
224
|
|
|
@@ -299,10 +233,7 @@ export class ChannelPayloadFilter {
|
|
|
299
233
|
if (debugLabel!==undefined){
|
|
300
234
|
let nodeArrResultsDebugger = compose(flatten, rMap(mapNodeArrWithEl))(arr);
|
|
301
235
|
const selectorsArr = arr;
|
|
302
|
-
|
|
303
236
|
console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${debugLabel}"] - selectors: `, "color:orange;",{el, selectorsArr, nodeArrResultsDebugger});
|
|
304
|
-
|
|
305
|
-
|
|
306
237
|
}
|
|
307
238
|
|
|
308
239
|
// CHECK IF PAYLOAD EL EXISTS
|
package/src/spyne/utils/gc.js
CHANGED
|
@@ -7,10 +7,7 @@ export class RouteChannelUpdater{
|
|
|
7
7
|
let id = `${name}_ROUTE_UPDATER`;
|
|
8
8
|
|
|
9
9
|
const sendRouteChannelUpdate = curry(RouteChannelUpdater.createTemporaryViewStreamObj);
|
|
10
|
-
|
|
11
10
|
return sendRouteChannelUpdate({id,name});
|
|
12
|
-
|
|
13
|
-
//RouteChannelUpdater.createTemporaryViewStreamObj({name,id});
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
|
|
@@ -30,7 +27,6 @@ export class RouteChannelUpdater{
|
|
|
30
27
|
};
|
|
31
28
|
|
|
32
29
|
vs.appendToNull();
|
|
33
|
-
//console.log("VIEWSTREAM IS ",{vs, name,id,payload});
|
|
34
30
|
|
|
35
31
|
}
|
|
36
32
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {SpyneUtilsChannelRoute} from './spyne-utils-channel-route';
|
|
2
|
-
import {SpyneScrollLock} from './spyne-scroll-lock';
|
|
3
2
|
import {SpynePluginsMethods} from './spyne-plugins-methods';
|
|
4
|
-
import {ChannelsMap} from '../channels/channels-map';
|
|
5
3
|
import {deepMerge} from './deep-merge';
|
|
6
|
-
import {
|
|
4
|
+
import {path} from 'ramda';
|
|
7
5
|
|
|
8
6
|
let _config;
|
|
9
7
|
let _channels;
|
|
@@ -11,7 +9,6 @@ let _channelsMap
|
|
|
11
9
|
let _initialized = false;
|
|
12
10
|
let _debug = true;
|
|
13
11
|
|
|
14
|
-
const _spyneScrollLock = new SpyneScrollLock();
|
|
15
12
|
const _spynePluginMethods = new SpynePluginsMethods();
|
|
16
13
|
|
|
17
14
|
|
|
@@ -22,19 +19,48 @@ class SpyneAppPropertiesClass{
|
|
|
22
19
|
|
|
23
20
|
}
|
|
24
21
|
|
|
22
|
+
get channelsMap(){
|
|
23
|
+
return _channelsMap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get initialized(){
|
|
27
|
+
return _initialized;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get config(){
|
|
31
|
+
return _config;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get debug(){
|
|
35
|
+
return _debug;
|
|
36
|
+
}
|
|
25
37
|
|
|
38
|
+
/**
|
|
39
|
+
* This is mostly used for debugging purposes
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* TITLE['<h4>Listing the registereed Channels in the browser console</h4>']
|
|
43
|
+
* SpyneApp.listChannels();
|
|
44
|
+
*
|
|
45
|
+
* @returns A list of all registered channels
|
|
46
|
+
*/
|
|
47
|
+
static listChannels() {
|
|
48
|
+
return Array.from(_channels.map.keys());
|
|
49
|
+
}
|
|
26
50
|
|
|
27
51
|
initialize(defaultConfig={}, config={}, channelsMap){
|
|
28
52
|
_channels = channelsMap;
|
|
29
|
-
|
|
53
|
+
let userConfig = config;
|
|
54
|
+
if (config.channels && config.channels.ROUTE) {
|
|
55
|
+
userConfig = SpyneUtilsChannelRoute.conformRouteObject(config);
|
|
56
|
+
}
|
|
30
57
|
_config = deepMerge(defaultConfig, userConfig);
|
|
31
58
|
_debug = _config.debug!== undefined ? _config.debug : _debug;
|
|
32
59
|
this.getChannelActions = _channels.getChannelActions.bind(_channels);
|
|
33
60
|
this.listRegisteredChannels = _channels.listRegisteredChannels.bind(_channels);
|
|
34
61
|
_initialized = true;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//}
|
|
62
|
+
this.setChannelsMap();
|
|
63
|
+
|
|
38
64
|
|
|
39
65
|
return _config;
|
|
40
66
|
|
|
@@ -49,22 +75,13 @@ class SpyneAppPropertiesClass{
|
|
|
49
75
|
|
|
50
76
|
}
|
|
51
77
|
|
|
52
|
-
|
|
53
|
-
|
|
54
78
|
setChannelsMap(){
|
|
55
|
-
let obj = {};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
79
|
const getStream = _channels.getStream.bind(_channels);
|
|
60
80
|
const testStream = _channels.testStream.bind(_channels);
|
|
61
81
|
const getProxySubject = _channels.getProxySubject.bind(_channels);
|
|
62
82
|
|
|
63
|
-
|
|
64
83
|
_channelsMap = {getStream, testStream, getProxySubject}
|
|
65
84
|
|
|
66
|
-
|
|
67
|
-
|
|
68
85
|
}
|
|
69
86
|
|
|
70
87
|
setProp(key, val){
|
|
@@ -75,26 +92,19 @@ class SpyneAppPropertiesClass{
|
|
|
75
92
|
return path(['tmp', key], _config);
|
|
76
93
|
}
|
|
77
94
|
|
|
78
|
-
get channelsMap(){
|
|
79
|
-
return _channelsMap;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
get initialized(){
|
|
83
|
-
return _initialized;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get scrollLock(){
|
|
87
|
-
return _spyneScrollLock;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
95
|
setChannelConfig(channelName, config){
|
|
94
96
|
_config.channels[channelName] = config;
|
|
95
97
|
return _config.channels[channelName];
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
/**
|
|
101
|
+
* This method is useful to check in the console or in the code what actions are available to be listened to.
|
|
102
|
+
* @param {String} channelName
|
|
103
|
+
* @returns {Array} An array of Actions that can be listened to
|
|
104
|
+
*/
|
|
105
|
+
/* getChannelActions(channelName) {
|
|
106
|
+
return _channels.getChannelActions(channelName);
|
|
107
|
+
}*/
|
|
98
108
|
|
|
99
109
|
getChannelConfig(channelName, config=_config){
|
|
100
110
|
if (channelName === 'CHANNEL_ROUTE'){
|
|
@@ -115,41 +125,9 @@ class SpyneAppPropertiesClass{
|
|
|
115
125
|
return;
|
|
116
126
|
}
|
|
117
127
|
|
|
118
|
-
//console.log("MAIN CONFIG IS ",{channelName, channelConfig, config});
|
|
119
|
-
|
|
120
128
|
return channelConfig;
|
|
121
129
|
}
|
|
122
130
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
get config(){
|
|
127
|
-
return _config;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* This is mostly used for debugging purposes
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* TITLE['<h4>Listing the registereed Channels in the browser console</h4>']
|
|
135
|
-
* SpyneApp.listChannels();
|
|
136
|
-
*
|
|
137
|
-
* @returns A list of all registered channels
|
|
138
|
-
*/
|
|
139
|
-
static listChannels() {
|
|
140
|
-
return Array.from(_channels.map.keys());
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* This method is useful to check in the console or in the code what actions are available to be listened to.
|
|
145
|
-
* @param {String} channelName
|
|
146
|
-
* @returns {Array} An array of Actions that can be listened to
|
|
147
|
-
*/
|
|
148
|
-
/* getChannelActions(channelName) {
|
|
149
|
-
return _channels.getChannelActions(channelName);
|
|
150
|
-
}*/
|
|
151
|
-
|
|
152
|
-
|
|
153
131
|
registerChannel(){
|
|
154
132
|
|
|
155
133
|
|
|
@@ -188,9 +166,6 @@ class SpyneAppPropertiesClass{
|
|
|
188
166
|
return _config.plugins[pluginName];
|
|
189
167
|
}
|
|
190
168
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
169
|
tempGetChannelsInstance(){
|
|
195
170
|
|
|
196
171
|
}
|
|
@@ -200,11 +175,6 @@ class SpyneAppPropertiesClass{
|
|
|
200
175
|
|
|
201
176
|
}
|
|
202
177
|
|
|
203
|
-
get debug(){
|
|
204
|
-
return _debug;
|
|
205
|
-
//return _config['debug']===true;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
178
|
|
|
209
179
|
|
|
210
180
|
|
|
@@ -25,11 +25,9 @@ export class SpynePluginsMethods{
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
addMethod(key, fn, test=false){
|
|
28
|
-
//console.log('has method is 2',typeof(_pluginMethodsObj),{_pluginMethodsObj})
|
|
29
28
|
|
|
30
|
-
if (
|
|
29
|
+
if (Object.prototype.hasOwnProperty.call(_pluginMethodsObj, key)===true){
|
|
31
30
|
const warnStr = `Spyne Warning: the method name, ${key}, already exists.`;
|
|
32
|
-
|
|
33
31
|
if (test){
|
|
34
32
|
return warnStr;
|
|
35
33
|
}
|
|
@@ -50,7 +48,6 @@ export class SpynePluginsMethods{
|
|
|
50
48
|
if (isObj === false){
|
|
51
49
|
warnStr = `Spyne Warning: the pluginMethods property, ${JSON.stringify(methodsObj)} needs to be an object.`
|
|
52
50
|
if (test){
|
|
53
|
-
//console.log('this is a test ',{methodsObj})
|
|
54
51
|
return warnStr;
|
|
55
52
|
}
|
|
56
53
|
console.warn(warnStr);
|
|
@@ -63,7 +60,6 @@ export class SpynePluginsMethods{
|
|
|
63
60
|
|
|
64
61
|
const isFunction = typeof(methodVal) === 'function';
|
|
65
62
|
|
|
66
|
-
//console.log('method to add ',{keyStr, isFunction})
|
|
67
63
|
|
|
68
64
|
if (isFunction){
|
|
69
65
|
this.addMethod(keyStr, methodVal, test);
|
|
@@ -88,10 +84,6 @@ export class SpynePluginsMethods{
|
|
|
88
84
|
|
|
89
85
|
}
|
|
90
86
|
|
|
91
|
-
test1(){
|
|
92
|
-
//console.log('test 1 is ');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
87
|
|
|
96
88
|
get pluginMethodsObj(){
|
|
97
89
|
return _pluginMethodsObj;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAllMethodNames } from './frp-tools';
|
|
2
|
-
import {reject,
|
|
2
|
+
import {reject, curryN, __, map} from 'ramda';
|
|
3
3
|
|
|
4
4
|
export class SpyneTrait {
|
|
5
5
|
/**
|
|
@@ -63,13 +63,10 @@ export class SpyneTrait {
|
|
|
63
63
|
this.checkForMalformedMethods(methodsObj.allMethods);
|
|
64
64
|
let obj = {};
|
|
65
65
|
const bindMethodsToParentViewStream = (str, isStatic = false) => {
|
|
66
|
-
const addMethod = s => {
|
|
67
|
-
return context[s] = constructorType[s].bind(context);
|
|
68
|
-
};
|
|
69
66
|
let constructorType = isStatic === true ? this.constructor : this;
|
|
70
67
|
let propertyType = typeof (constructorType[str]);
|
|
71
68
|
if (propertyType === 'function') {
|
|
72
|
-
obj[str] =
|
|
69
|
+
obj[str] = context[str] = constructorType[str].bind(context);
|
|
73
70
|
}
|
|
74
71
|
};
|
|
75
72
|
|
|
@@ -62,7 +62,6 @@ export class SpyneUtilsChannelRouteUrl {
|
|
|
62
62
|
let keyword = routeObj.routeName; // PARAM FORM SPYNE CONFIG
|
|
63
63
|
let paramValFromData = data[keyword] !== undefined ? data[keyword] : prop(keyword, paramsFromLoc); // PULL VALUE FOR THIS PARAM FROM DATA
|
|
64
64
|
const paramValType = typeof (routeObj[paramValFromData]);
|
|
65
|
-
// console.log({routeObj, paramValType, paramValFromData, keyword})
|
|
66
65
|
|
|
67
66
|
if (paramValType === 'string') {
|
|
68
67
|
paramValFromData = routeObj[paramValFromData];
|
|
@@ -72,12 +71,9 @@ export class SpyneUtilsChannelRouteUrl {
|
|
|
72
71
|
|
|
73
72
|
urlObj[keyword] = paramValFromData;
|
|
74
73
|
|
|
75
|
-
// console.log("URL OBJ ",urlObj);
|
|
76
74
|
if (this.checkIfObjIsNotEmptyOrNil(urlObj)) {
|
|
77
|
-
// console.log("FOUND ",{paramValFromData, paramValType, urlObj, routeObj});
|
|
78
75
|
urlArr.push(urlObj);
|
|
79
76
|
} else {
|
|
80
|
-
// console.log("NOT FOUND ",paramValFromData, paramValType, urlObj, routeObj);
|
|
81
77
|
|
|
82
78
|
}
|
|
83
79
|
|
|
@@ -85,10 +81,8 @@ export class SpyneUtilsChannelRouteUrl {
|
|
|
85
81
|
const objectParamExists = has(paramValFromData, routeObj);
|
|
86
82
|
const objectContainsRoute = has('routePath', routeObj);
|
|
87
83
|
const recursivelyCallLoopBool = objectParamExists && isObject;
|
|
88
|
-
// console.log("CHECKS ", {isObject, objectParamExists, objectContainsRoute, recursivelyCallLoopBool})
|
|
89
84
|
if (recursivelyCallLoopBool === true) {
|
|
90
85
|
let newObj = routeObj[paramValFromData];
|
|
91
|
-
// console.log("NEW OBJ ",{paramValFromData, routeObj, newObj});
|
|
92
86
|
if (has('routePath', newObj)) {
|
|
93
87
|
loopThroughParam(newObj.routePath);
|
|
94
88
|
}
|
|
@@ -240,7 +234,7 @@ export class SpyneUtilsChannelRouteUrl {
|
|
|
240
234
|
let getParamInverted = compose(head, defaultTo([]), prop(param));
|
|
241
235
|
let paramInverted = getParamInverted(invertedObj);
|
|
242
236
|
// spyne 11.0.1;
|
|
243
|
-
let re = /^([
|
|
237
|
+
let re = /^([-$\w]*)$/;
|
|
244
238
|
let keyMatch = re.test(paramInverted);
|
|
245
239
|
|
|
246
240
|
if (keyMatch === true && is(String, paramInverted) === true) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { fromEventPattern } from 'rxjs';
|
|
2
|
-
import {last,
|
|
2
|
+
import {last, flatten, clone, pick, prop, pickAll, path, equals, compose, keys, filter, propEq, uniq, map, __, chain,is, includes, fromPairs, reject, mergeDeepRight, mergeRight, test, toPairs, values} from 'ramda';
|
|
3
3
|
import {SpyneUtilsChannelRouteUrl} from './spyne-utils-channel-route-url';
|
|
4
|
-
import {RouteDataForTests} from '../../tests/mocks/utils-data';
|
|
5
4
|
|
|
6
5
|
export class SpyneUtilsChannelRoute {
|
|
7
6
|
constructor() {
|
|
@@ -102,7 +101,7 @@ export class SpyneUtilsChannelRoute {
|
|
|
102
101
|
// create href and check to see if need to convert to hash href links
|
|
103
102
|
const getHREF = (obj)=>{
|
|
104
103
|
const santizeHREF = str => {
|
|
105
|
-
const hrefRE = /^(.*\/)([\w
|
|
104
|
+
const hrefRE = /^(.*\/)([\w-]*\/?)(.*)$/gm
|
|
106
105
|
//const hrefRE = /^(.*\/)([\w-]*)(.*)$/gm;
|
|
107
106
|
str = str.replace(hrefRE, "$1$2");
|
|
108
107
|
// str = String(str).replace('^$', "");
|
|
@@ -119,7 +118,7 @@ export class SpyneUtilsChannelRoute {
|
|
|
119
118
|
|
|
120
119
|
|
|
121
120
|
// test whether to use key or val
|
|
122
|
-
const isValidStrRE = /^([A-Za-z0-9_
|
|
121
|
+
const isValidStrRE = /^([A-Za-z0-9_-])+$/m;
|
|
123
122
|
|
|
124
123
|
const createInitialValFn = (accMain=[], routePathObj, objAcc={})=>{
|
|
125
124
|
let {routeName} = routePathObj;
|
|
@@ -179,7 +178,6 @@ export class SpyneUtilsChannelRoute {
|
|
|
179
178
|
return getMainKeys(datasetsArr);
|
|
180
179
|
}
|
|
181
180
|
const routeNamesArr = getNavProps(routeDatasetsArr);
|
|
182
|
-
//console.log('validate route names arr is ',routeNamesArr);
|
|
183
181
|
|
|
184
182
|
return {routeDatasetsArr, routeNamesArr};
|
|
185
183
|
}
|
|
@@ -189,7 +187,6 @@ export class SpyneUtilsChannelRoute {
|
|
|
189
187
|
const channelsRoutePath = path(['channels', 'ROUTE'], channelRouteObj);
|
|
190
188
|
let {add404s} = channelsRoutePath !== undefined ? channelsRoutePath : channelRouteObj;
|
|
191
189
|
add404s = add404s || add404Props;
|
|
192
|
-
//console.log("add 404s is1 ",{add404s, channelsRoutePath})
|
|
193
190
|
const parseRoutePath = (a) => {
|
|
194
191
|
let val = a[1];
|
|
195
192
|
const isArr = is(Array, val);
|
|
@@ -219,24 +216,17 @@ export class SpyneUtilsChannelRoute {
|
|
|
219
216
|
}
|
|
220
217
|
|
|
221
218
|
const configMapperFn = compose(fromPairs, map(transduceConfig), toPairs);
|
|
222
|
-
//console.log('route obj ',channelRouteObj);
|
|
223
219
|
|
|
224
220
|
|
|
225
221
|
if (channelsRoutePath !== undefined){
|
|
226
222
|
channelRouteObj.channels.ROUTE = configMapperFn(channelRouteObj.channels.ROUTE)
|
|
227
223
|
const extraRouteData = SpyneUtilsChannelRoute.addRouteDatasets(channelRouteObj.channels.ROUTE);
|
|
228
224
|
channelRouteObj.channels.ROUTE = mergeRight(channelRouteObj.channels.ROUTE, extraRouteData);
|
|
229
|
-
//console.log("CHANNEL ROUTE OBJ ",channelRouteObj.channels.ROUTE);
|
|
230
|
-
//channelRouteObj.channels.ROUTE.linkDatasets = SpyneUtilsChannelRoute.addRouteDatasets(channelRouteObj.channels.ROUTE);
|
|
231
225
|
return channelRouteObj;
|
|
232
226
|
}
|
|
233
227
|
|
|
234
|
-
|
|
235
|
-
|
|
236
228
|
return configMapperFn(channelRouteObj);
|
|
237
229
|
|
|
238
|
-
|
|
239
|
-
|
|
240
230
|
}
|
|
241
231
|
|
|
242
232
|
static getLocationData() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fromEventPattern
|
|
1
|
+
import { fromEventPattern } from 'rxjs';
|
|
2
2
|
import { map } from 'rxjs/operators';
|
|
3
3
|
import {mapObjIndexed} from 'ramda';
|
|
4
4
|
|
|
@@ -66,7 +66,7 @@ export class SpyneUtilsChannelWindow {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
static createMergedObsFromObj(config) {
|
|
69
|
-
let mediaQueriesObj = config.mediqQueries;
|
|
69
|
+
let mediaQueriesObj = config.mediaQueries || config.mediqQueries;
|
|
70
70
|
let arr = [];
|
|
71
71
|
|
|
72
72
|
const loopQueries = (val, key, obj) => {
|
|
@@ -78,8 +78,6 @@ export class SpyneUtilsChannelWindow {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
mapObjIndexed(loopQueries, mediaQueriesObj);
|
|
81
|
-
// let obs$ = Observable.merge(...arr);
|
|
82
|
-
// console.log('arr is ',arr);
|
|
83
81
|
return arr;
|
|
84
82
|
}
|
|
85
83
|
}
|
|
@@ -65,12 +65,11 @@ export class ViewStreamObservable {
|
|
|
65
65
|
|
|
66
66
|
const raw$ = obs$
|
|
67
67
|
.pipe(filter((payload) => payload !== undefined && payload.action !== undefined));
|
|
68
|
-
|
|
69
|
-
// .do(p => console.log('payload : ', p.$dir, p));
|
|
68
|
+
|
|
70
69
|
const toInternal$ = obs$.pipe(filter(filterInternal), map(addInternalfrom$));
|
|
71
70
|
const toParent$ = obs$.pipe(filter(filterParent), map(addParentfrom$));
|
|
72
71
|
const toChild$ = obs$.pipe(filter(filterChild), map(addChildfrom$));
|
|
73
|
-
|
|
72
|
+
|
|
74
73
|
const streamObj = {
|
|
75
74
|
parent: toParent$,
|
|
76
75
|
internal: toInternal$,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {includes, __, ifElse,
|
|
1
|
+
import {includes, __, ifElse, path, prop, reject, is, isNil, isEmpty} from 'ramda';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @module DomElTemplate
|
|
@@ -136,9 +136,6 @@ export class DomElementTemplate {
|
|
|
136
136
|
constructor(template, data) {
|
|
137
137
|
this.template = this.formatTemplate(template);
|
|
138
138
|
|
|
139
|
-
//const tempL = `template-${Math.floor(Math.random()*99999)}`
|
|
140
|
-
// this.tempL=tempL
|
|
141
|
-
|
|
142
139
|
const checkForArrayData = ()=>{
|
|
143
140
|
if (is(Array, data) === true) {
|
|
144
141
|
data = {spyneData:data};
|
|
@@ -206,8 +203,6 @@ export class DomElementTemplate {
|
|
|
206
203
|
|
|
207
204
|
|
|
208
205
|
renderDocFrag() {
|
|
209
|
-
|
|
210
|
-
|
|
211
206
|
const html = this.finalArr.join('');
|
|
212
207
|
const isTableSubTag = /^([^>]*?)(<){1}(\b)(thead|col|colgroup|tbody|td|tfoot|tr|th)(\b)([^\0]*)$/.test(html);
|
|
213
208
|
const el = isTableSubTag ? html : document.createRange().createContextualFragment(html);
|