procode-lowcode-core 1.0.0 → 1.0.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.
package/dist/index.esm.js CHANGED
@@ -4,6 +4,8 @@ import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
4
4
  import { useSelector, useDispatch, Provider } from 'react-redux';
5
5
  import axios from 'axios';
6
6
  import { createSlice, configureStore } from '@reduxjs/toolkit';
7
+ import { call, select, put, all, fork, takeEvery } from 'redux-saga/effects';
8
+ import createSagaMiddleware from 'redux-saga';
7
9
 
8
10
  /******************************************************************************
9
11
  Copyright (c) Microsoft Corporation.
@@ -19,7 +21,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
21
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
22
  PERFORMANCE OF THIS SOFTWARE.
21
23
  ***************************************************************************** */
22
- /* global Reflect, Promise, SuppressedError, Symbol */
24
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
23
25
 
24
26
 
25
27
  function __rest(s, e) {
@@ -64,7 +66,6 @@ const env = {
64
66
  applicationCode: VITE_APPLICATION_CODE,
65
67
  };
66
68
  const eventServiceType = {
67
- SHOW_NOTIFICATION: "SHOW_NOTIFICATION",
68
69
  DATASTATE_ACTION: "DATASTATE_ACTION",
69
70
  DISPATCH_STORE: "DISPATCH_STORE",
70
71
  UI_SCHEMA_ACTION: "UI_SCHEMA_ACTION",
@@ -6669,7 +6670,7 @@ lodash.exports;
6669
6670
  bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
6670
6671
 
6671
6672
  if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
6672
- bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
6673
+ bitmask &= -4;
6673
6674
  }
6674
6675
  var newData = [
6675
6676
  func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
@@ -6772,7 +6773,7 @@ lodash.exports;
6772
6773
  }
6773
6774
  var length = partials ? partials.length : 0;
6774
6775
  if (!length) {
6775
- bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
6776
+ bitmask &= -97;
6776
6777
  partials = holders = undefined$1;
6777
6778
  }
6778
6779
  ary = ary === undefined$1 ? ary : nativeMax(toInteger(ary), 0);
@@ -6805,7 +6806,7 @@ lodash.exports;
6805
6806
  : nativeMax(newData[9] - length, 0);
6806
6807
 
6807
6808
  if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
6808
- bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
6809
+ bitmask &= -25;
6809
6810
  }
6810
6811
  if (!bitmask || bitmask == WRAP_BIND_FLAG) {
6811
6812
  var result = createBind(func, bitmask, thisArg);
@@ -19753,2205 +19754,74 @@ class EventService {
19753
19754
  }
19754
19755
  }
19755
19756
 
19756
- var createSymbol = function createSymbol(name) {
19757
- return "@@redux-saga/" + name;
19758
- };
19759
-
19760
- var CANCEL$1 =
19761
- /*#__PURE__*/
19762
- createSymbol('CANCEL_PROMISE');
19763
- var CHANNEL_END_TYPE =
19764
- /*#__PURE__*/
19765
- createSymbol('CHANNEL_END');
19766
- var IO =
19767
- /*#__PURE__*/
19768
- createSymbol('IO');
19769
- var MATCH =
19770
- /*#__PURE__*/
19771
- createSymbol('MATCH');
19772
- var MULTICAST =
19773
- /*#__PURE__*/
19774
- createSymbol('MULTICAST');
19775
- var SAGA_ACTION =
19776
- /*#__PURE__*/
19777
- createSymbol('SAGA_ACTION');
19778
- var SELF_CANCELLATION =
19779
- /*#__PURE__*/
19780
- createSymbol('SELF_CANCELLATION');
19781
- var TASK =
19782
- /*#__PURE__*/
19783
- createSymbol('TASK');
19784
- var TASK_CANCEL =
19785
- /*#__PURE__*/
19786
- createSymbol('TASK_CANCEL');
19787
- var TERMINATE =
19788
- /*#__PURE__*/
19789
- createSymbol('TERMINATE');
19790
- var SAGA_LOCATION =
19791
- /*#__PURE__*/
19792
- createSymbol('LOCATION');
19793
-
19794
- function _extends() {
19795
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
19796
- for (var e = 1; e < arguments.length; e++) {
19797
- var t = arguments[e];
19798
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
19799
- }
19800
- return n;
19801
- }, _extends.apply(null, arguments);
19802
- }
19803
-
19804
- var undef = function undef(v) {
19805
- return v === null || v === undefined;
19806
- };
19807
- var notUndef = function notUndef(v) {
19808
- return v !== null && v !== undefined;
19809
- };
19810
- var func = function func(f) {
19811
- return typeof f === 'function';
19812
- };
19813
- var string$1 = function string(s) {
19814
- return typeof s === 'string';
19815
- };
19816
- var array$1 = Array.isArray;
19817
- var object = function object(obj) {
19818
- return obj && !array$1(obj) && typeof obj === 'object';
19819
- };
19820
- var promise = function promise(p) {
19821
- return p && func(p.then);
19822
- };
19823
- var iterator = function iterator(it) {
19824
- return it && func(it.next) && func(it.throw);
19825
- };
19826
- var buffer = function buffer(buf) {
19827
- return buf && func(buf.isEmpty) && func(buf.take) && func(buf.put);
19828
- };
19829
- var pattern = function pattern(pat) {
19830
- return pat && (string$1(pat) || symbol$1(pat) || func(pat) || array$1(pat) && pat.every(pattern));
19831
- };
19832
- var channel$1 = function channel(ch) {
19833
- return ch && func(ch.take) && func(ch.close);
19834
- };
19835
- var stringableFunc = function stringableFunc(f) {
19836
- return func(f) && f.hasOwnProperty('toString');
19837
- };
19838
- var symbol$1 = function symbol(sym) {
19839
- return Boolean(sym) && typeof Symbol === 'function' && sym.constructor === Symbol && sym !== Symbol.prototype;
19840
- };
19841
- var multicast = function multicast(ch) {
19842
- return channel$1(ch) && ch[MULTICAST];
19843
- };
19844
- var effect = function effect(eff) {
19845
- return eff && eff[IO];
19846
- };
19847
-
19848
- var MAX_SIGNED_INT = 2147483647;
19849
- function delayP(ms, val) {
19850
- if (val === void 0) {
19851
- val = true;
19852
- }
19853
-
19854
- // https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value
19855
- if (process.env.NODE_ENV !== 'production' && ms > MAX_SIGNED_INT) {
19856
- throw new Error('delay only supports a maximum value of ' + MAX_SIGNED_INT + 'ms');
19857
- }
19858
-
19859
- var timeoutId;
19860
- var promise = new Promise(function (resolve) {
19861
- timeoutId = setTimeout(resolve, Math.min(MAX_SIGNED_INT, ms), val);
19862
- });
19863
-
19864
- promise[CANCEL$1] = function () {
19865
- clearTimeout(timeoutId);
19866
- };
19867
-
19868
- return promise;
19869
- }
19870
-
19871
- var konst = function konst(v) {
19872
- return function () {
19873
- return v;
19874
- };
19875
- };
19876
- var kTrue =
19877
- /*#__PURE__*/
19878
- konst(true);
19879
-
19880
- var noop = function noop() {};
19881
-
19882
- if (process.env.NODE_ENV !== 'production' && typeof Proxy !== 'undefined') {
19883
- noop =
19884
- /*#__PURE__*/
19885
- new Proxy(noop, {
19886
- set: function set() {
19887
- throw internalErr('There was an attempt to assign a property to internal `noop` function.');
19888
- }
19889
- });
19890
- }
19891
- var identity = function identity(v) {
19892
- return v;
19893
- };
19894
- var hasSymbol = typeof Symbol === 'function';
19895
- var asyncIteratorSymbol = hasSymbol && Symbol.asyncIterator ? Symbol.asyncIterator : '@@asyncIterator';
19896
- function check(value, predicate, error) {
19897
- if (!predicate(value)) {
19898
- throw new Error(error);
19899
- }
19900
- }
19901
- var assignWithSymbols = function assignWithSymbols(target, source) {
19902
- _extends(target, source);
19903
-
19904
- if (Object.getOwnPropertySymbols) {
19905
- Object.getOwnPropertySymbols(source).forEach(function (s) {
19906
- target[s] = source[s];
19907
- });
19908
- }
19909
- };
19910
- var flatMap = function flatMap(mapper, arr) {
19911
- var _ref;
19912
-
19913
- return (_ref = []).concat.apply(_ref, arr.map(mapper));
19914
- };
19915
- function remove(array, item) {
19916
- var index = array.indexOf(item);
19917
-
19918
- if (index >= 0) {
19919
- array.splice(index, 1);
19920
- }
19921
- }
19922
- function once(fn) {
19923
- var called = false;
19924
- return function () {
19925
- if (called) {
19926
- return;
19927
- }
19928
-
19929
- called = true;
19930
- fn();
19931
- };
19932
- }
19933
-
19934
- var kThrow = function kThrow(err) {
19935
- throw err;
19936
- };
19937
-
19938
- var kReturn = function kReturn(value) {
19939
- return {
19940
- value: value,
19941
- done: true
19942
- };
19943
- };
19944
-
19945
- function makeIterator(next, thro, name) {
19946
- if (thro === void 0) {
19947
- thro = kThrow;
19948
- }
19949
-
19950
- if (name === void 0) {
19951
- name = 'iterator';
19952
- }
19953
-
19954
- var iterator = {
19955
- meta: {
19956
- name: name
19957
- },
19958
- next: next,
19959
- throw: thro,
19960
- return: kReturn,
19961
- isSagaIterator: true
19962
- };
19963
-
19964
- if (typeof Symbol !== 'undefined') {
19965
- iterator[Symbol.iterator] = function () {
19966
- return iterator;
19967
- };
19968
- }
19969
-
19970
- return iterator;
19971
- }
19972
- function logError(error, _ref2) {
19973
- var sagaStack = _ref2.sagaStack;
19974
-
19975
- /*eslint-disable no-console*/
19976
- console.error(error);
19977
- console.error(sagaStack);
19978
- }
19979
- var internalErr = function internalErr(err) {
19980
- return new Error("\n redux-saga: Error checking hooks detected an inconsistent state. This is likely a bug\n in redux-saga code and not yours. Thanks for reporting this in the project's github repo.\n Error: " + err + "\n");
19981
- };
19982
- var createSetContextWarning = function createSetContextWarning(ctx, props) {
19983
- return (ctx ? ctx + '.' : '') + "setContext(props): argument " + props + " is not a plain object";
19984
- };
19985
- var FROZEN_ACTION_ERROR = "You can't put (a.k.a. dispatch from saga) frozen actions.\nWe have to define a special non-enumerable property on those actions for scheduling purposes.\nOtherwise you wouldn't be able to communicate properly between sagas & other subscribers (action ordering would become far less predictable).\nIf you are using redux and you care about this behaviour (frozen actions),\nthen you might want to switch to freezing actions in a middleware rather than in action creator.\nExample implementation:\n\nconst freezeActions = store => next => action => next(Object.freeze(action))\n"; // creates empty, but not-holey array
19986
-
19987
- var createEmptyArray = function createEmptyArray(n) {
19988
- return Array.apply(null, new Array(n));
19989
- };
19990
- var wrapSagaDispatch = function wrapSagaDispatch(dispatch) {
19991
- return function (action) {
19992
- if (process.env.NODE_ENV !== 'production') {
19993
- check(action, function (ac) {
19994
- return !Object.isFrozen(ac);
19995
- }, FROZEN_ACTION_ERROR);
19996
- }
19997
-
19998
- return dispatch(Object.defineProperty(action, SAGA_ACTION, {
19999
- value: true
20000
- }));
20001
- };
20002
- };
20003
- var shouldTerminate = function shouldTerminate(res) {
20004
- return res === TERMINATE;
20005
- };
20006
- var shouldCancel = function shouldCancel(res) {
20007
- return res === TASK_CANCEL;
20008
- };
20009
- var shouldComplete = function shouldComplete(res) {
20010
- return shouldTerminate(res) || shouldCancel(res);
20011
- };
20012
- function createAllStyleChildCallbacks(shape, parentCallback) {
20013
- var keys = Object.keys(shape);
20014
- var totalCount = keys.length;
20015
-
20016
- if (process.env.NODE_ENV !== 'production') {
20017
- check(totalCount, function (c) {
20018
- return c > 0;
20019
- }, 'createAllStyleChildCallbacks: get an empty array or object');
20020
- }
20021
-
20022
- var completedCount = 0;
20023
- var completed;
20024
- var results = array$1(shape) ? createEmptyArray(totalCount) : {};
20025
- var childCallbacks = {};
20026
-
20027
- function checkEnd() {
20028
- if (completedCount === totalCount) {
20029
- completed = true;
20030
- parentCallback(results);
20031
- }
20032
- }
20033
-
20034
- keys.forEach(function (key) {
20035
- var chCbAtKey = function chCbAtKey(res, isErr) {
20036
- if (completed) {
20037
- return;
20038
- }
20039
-
20040
- if (isErr || shouldComplete(res)) {
20041
- parentCallback.cancel();
20042
- parentCallback(res, isErr);
20043
- } else {
20044
- results[key] = res;
20045
- completedCount++;
20046
- checkEnd();
20047
- }
20048
- };
20049
-
20050
- chCbAtKey.cancel = noop;
20051
- childCallbacks[key] = chCbAtKey;
20052
- });
20053
-
20054
- parentCallback.cancel = function () {
20055
- if (!completed) {
20056
- completed = true;
20057
- keys.forEach(function (key) {
20058
- return childCallbacks[key].cancel();
20059
- });
20060
- }
20061
- };
20062
-
20063
- return childCallbacks;
20064
- }
20065
- function getMetaInfo(fn) {
20066
- return {
20067
- name: fn.name || 'anonymous',
20068
- location: getLocation(fn)
20069
- };
20070
- }
20071
- function getLocation(instrumented) {
20072
- return instrumented[SAGA_LOCATION];
20073
- }
20074
- function compose() {
20075
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
20076
- funcs[_key] = arguments[_key];
20077
- }
20078
-
20079
- if (funcs.length === 0) {
20080
- return function (arg) {
20081
- return arg;
20082
- };
20083
- }
20084
-
20085
- if (funcs.length === 1) {
20086
- return funcs[0];
20087
- }
20088
-
20089
- return funcs.reduce(function (a, b) {
20090
- return function () {
20091
- return a(b.apply(void 0, arguments));
20092
- };
20093
- });
20094
- }
20095
-
20096
- var BUFFER_OVERFLOW = "Channel's Buffer overflow!";
20097
- var ON_OVERFLOW_THROW = 1;
20098
- var ON_OVERFLOW_SLIDE = 3;
20099
- var ON_OVERFLOW_EXPAND = 4;
20100
-
20101
- function ringBuffer(limit, overflowAction) {
20102
- if (limit === void 0) {
20103
- limit = 10;
20104
- }
20105
-
20106
- var arr = new Array(limit);
20107
- var length = 0;
20108
- var pushIndex = 0;
20109
- var popIndex = 0;
20110
-
20111
- var push = function push(it) {
20112
- arr[pushIndex] = it;
20113
- pushIndex = (pushIndex + 1) % limit;
20114
- length++;
20115
- };
20116
-
20117
- var take = function take() {
20118
- if (length != 0) {
20119
- var it = arr[popIndex];
20120
- arr[popIndex] = null;
20121
- length--;
20122
- popIndex = (popIndex + 1) % limit;
20123
- return it;
20124
- }
20125
- };
20126
-
20127
- var flush = function flush() {
20128
- var items = [];
20129
-
20130
- while (length) {
20131
- items.push(take());
20132
- }
20133
-
20134
- return items;
20135
- };
20136
-
20137
- return {
20138
- isEmpty: function isEmpty() {
20139
- return length == 0;
20140
- },
20141
- put: function put(it) {
20142
- if (length < limit) {
20143
- push(it);
20144
- } else {
20145
- var doubledLimit;
20146
-
20147
- switch (overflowAction) {
20148
- case ON_OVERFLOW_THROW:
20149
- throw new Error(BUFFER_OVERFLOW);
20150
-
20151
- case ON_OVERFLOW_SLIDE:
20152
- arr[pushIndex] = it;
20153
- pushIndex = (pushIndex + 1) % limit;
20154
- popIndex = pushIndex;
20155
- break;
20156
-
20157
- case ON_OVERFLOW_EXPAND:
20158
- doubledLimit = 2 * limit;
20159
- arr = flush();
20160
- length = arr.length;
20161
- pushIndex = arr.length;
20162
- popIndex = 0;
20163
- arr.length = doubledLimit;
20164
- limit = doubledLimit;
20165
- push(it);
20166
- break;
20167
-
20168
- }
20169
- }
20170
- },
20171
- take: take,
20172
- flush: flush
20173
- };
20174
- }
20175
- var expanding = function expanding(initialSize) {
20176
- return ringBuffer(initialSize, ON_OVERFLOW_EXPAND);
20177
- };
20178
-
20179
- var TAKE = 'TAKE';
20180
- var PUT = 'PUT';
20181
- var ALL = 'ALL';
20182
- var RACE = 'RACE';
20183
- var CALL = 'CALL';
20184
- var CPS = 'CPS';
20185
- var FORK = 'FORK';
20186
- var JOIN = 'JOIN';
20187
- var CANCEL = 'CANCEL';
20188
- var SELECT = 'SELECT';
20189
- var ACTION_CHANNEL = 'ACTION_CHANNEL';
20190
- var CANCELLED$1 = 'CANCELLED';
20191
- var FLUSH = 'FLUSH';
20192
- var GET_CONTEXT = 'GET_CONTEXT';
20193
- var SET_CONTEXT = 'SET_CONTEXT';
20194
-
20195
- var makeEffect = function makeEffect(type, payload) {
20196
- var _ref;
20197
-
20198
- return _ref = {}, _ref[IO] = true, _ref.combinator = false, _ref.type = type, _ref.payload = payload, _ref;
20199
- };
20200
- function take(patternOrChannel, multicastPattern) {
20201
- if (patternOrChannel === void 0) {
20202
- patternOrChannel = '*';
20203
- }
20204
-
20205
- if (process.env.NODE_ENV !== 'production' && arguments.length) {
20206
- check(arguments[0], notUndef, 'take(patternOrChannel): patternOrChannel is undefined');
20207
- }
20208
-
20209
- if (pattern(patternOrChannel)) {
20210
- if (notUndef(multicastPattern)) {
20211
- /* eslint-disable no-console */
20212
- console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types");
20213
- }
20214
-
20215
- return makeEffect(TAKE, {
20216
- pattern: patternOrChannel
20217
- });
20218
- }
20219
-
20220
- if (multicast(patternOrChannel) && notUndef(multicastPattern) && pattern(multicastPattern)) {
20221
- return makeEffect(TAKE, {
20222
- channel: patternOrChannel,
20223
- pattern: multicastPattern
20224
- });
20225
- }
20226
-
20227
- if (channel$1(patternOrChannel)) {
20228
- if (notUndef(multicastPattern)) {
20229
- /* eslint-disable no-console */
20230
- console.warn("take(channel) takes one argument but two were provided. Second argument is ignored.");
20231
- }
20232
-
20233
- return makeEffect(TAKE, {
20234
- channel: patternOrChannel
20235
- });
20236
- }
20237
-
20238
- if (process.env.NODE_ENV !== 'production') {
20239
- throw new Error("take(patternOrChannel): argument " + patternOrChannel + " is not valid channel or a valid pattern");
20240
- }
20241
- }
20242
- function put(channel$1$1, action) {
20243
- if (process.env.NODE_ENV !== 'production') {
20244
- if (arguments.length > 1) {
20245
- check(channel$1$1, notUndef, 'put(channel, action): argument channel is undefined');
20246
- check(channel$1$1, channel$1, "put(channel, action): argument " + channel$1$1 + " is not a valid channel");
20247
- check(action, notUndef, 'put(channel, action): argument action is undefined');
20248
- } else {
20249
- check(channel$1$1, notUndef, 'put(action): argument action is undefined');
20250
- }
20251
- }
20252
-
20253
- if (undef(action)) {
20254
- action = channel$1$1; // `undefined` instead of `null` to make default parameter work
20255
-
20256
- channel$1$1 = undefined;
20257
- }
20258
-
20259
- return makeEffect(PUT, {
20260
- channel: channel$1$1,
20261
- action: action
20262
- });
20263
- }
20264
- function all(effects) {
20265
- var eff = makeEffect(ALL, effects);
20266
- eff.combinator = true;
20267
- return eff;
20268
- }
20269
-
20270
- var validateFnDescriptor = function validateFnDescriptor(effectName, fnDescriptor) {
20271
- check(fnDescriptor, notUndef, effectName + ": argument fn is undefined or null");
20272
-
20273
- if (func(fnDescriptor)) {
20274
- return;
20275
- }
20276
-
20277
- var context = null;
20278
- var fn;
20279
-
20280
- if (array$1(fnDescriptor)) {
20281
- context = fnDescriptor[0];
20282
- fn = fnDescriptor[1];
20283
- check(fn, notUndef, effectName + ": argument of type [context, fn] has undefined or null `fn`");
20284
- } else if (object(fnDescriptor)) {
20285
- context = fnDescriptor.context;
20286
- fn = fnDescriptor.fn;
20287
- check(fn, notUndef, effectName + ": argument of type {context, fn} has undefined or null `fn`");
20288
- } else {
20289
- check(fnDescriptor, func, effectName + ": argument fn is not function");
20290
- return;
20291
- }
20292
-
20293
- if (context && string$1(fn)) {
20294
- check(context[fn], func, effectName + ": context arguments has no such method - \"" + fn + "\"");
20295
- return;
20296
- }
20297
-
20298
- check(fn, func, effectName + ": unpacked fn argument (from [context, fn] or {context, fn}) is not a function");
20299
- };
20300
-
20301
- function getFnCallDescriptor(fnDescriptor, args) {
20302
- var context = null;
20303
- var fn;
20304
-
20305
- if (func(fnDescriptor)) {
20306
- fn = fnDescriptor;
20307
- } else {
20308
- if (array$1(fnDescriptor)) {
20309
- context = fnDescriptor[0];
20310
- fn = fnDescriptor[1];
20311
- } else {
20312
- context = fnDescriptor.context;
20313
- fn = fnDescriptor.fn;
20314
- }
20315
-
20316
- if (context && string$1(fn) && func(context[fn])) {
20317
- fn = context[fn];
20318
- }
20319
- }
20320
-
20321
- return {
20322
- context: context,
20323
- fn: fn,
20324
- args: args
20325
- };
20326
- }
20327
-
20328
- var isNotDelayEffect = function isNotDelayEffect(fn) {
20329
- return fn !== delay;
20330
- };
20331
-
20332
- function call(fnDescriptor) {
20333
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
20334
- args[_key - 1] = arguments[_key];
20335
- }
20336
-
20337
- if (process.env.NODE_ENV !== 'production') {
20338
- var arg0 = typeof args[0] === 'number' ? args[0] : 'ms';
20339
- check(fnDescriptor, isNotDelayEffect, "instead of writing `yield call(delay, " + arg0 + ")` where delay is an effect from `redux-saga/effects` you should write `yield delay(" + arg0 + ")`");
20340
- validateFnDescriptor('call', fnDescriptor);
20341
- }
20342
-
20343
- return makeEffect(CALL, getFnCallDescriptor(fnDescriptor, args));
20344
- }
20345
- function fork(fnDescriptor) {
20346
- if (process.env.NODE_ENV !== 'production') {
20347
- validateFnDescriptor('fork', fnDescriptor);
20348
- check(fnDescriptor, function (arg) {
20349
- return !effect(arg);
20350
- }, 'fork: argument must not be an effect');
20351
- }
20352
-
20353
- for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
20354
- args[_key3 - 1] = arguments[_key3];
20355
- }
20356
-
20357
- return makeEffect(FORK, getFnCallDescriptor(fnDescriptor, args));
20358
- }
20359
- function select(selector) {
20360
- if (selector === void 0) {
20361
- selector = identity;
20362
- }
20363
-
20364
- for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
20365
- args[_key5 - 1] = arguments[_key5];
20366
- }
20367
-
20368
- if (process.env.NODE_ENV !== 'production' && arguments.length) {
20369
- check(arguments[0], notUndef, 'select(selector, [...]): argument selector is undefined');
20370
- check(selector, func, "select(selector, [...]): argument " + selector + " is not a function");
20371
- }
20372
-
20373
- return makeEffect(SELECT, {
20374
- selector: selector,
20375
- args: args
20376
- });
20377
- }
20378
- var delay =
20379
- /*#__PURE__*/
20380
- call.bind(null, delayP);
20381
-
20382
- var done = function done(value) {
20383
- return {
20384
- done: true,
20385
- value: value
20386
- };
20387
- };
20388
-
20389
- var qEnd = {};
20390
- function safeName(patternOrChannel) {
20391
- if (channel$1(patternOrChannel)) {
20392
- return 'channel';
20393
- }
20394
-
20395
- if (stringableFunc(patternOrChannel)) {
20396
- return String(patternOrChannel);
20397
- }
20398
-
20399
- if (func(patternOrChannel)) {
20400
- return patternOrChannel.name;
20401
- }
20402
-
20403
- return String(patternOrChannel);
20404
- }
20405
- function fsmIterator(fsm, startState, name) {
20406
- var stateUpdater,
20407
- errorState,
20408
- effect,
20409
- nextState = startState;
20410
-
20411
- function next(arg, error) {
20412
- if (nextState === qEnd) {
20413
- return done(arg);
20414
- }
20415
-
20416
- if (error && !errorState) {
20417
- nextState = qEnd;
20418
- throw error;
20419
- } else {
20420
- stateUpdater && stateUpdater(arg);
20421
- var currentState = error ? fsm[errorState](error) : fsm[nextState]();
20422
- nextState = currentState.nextState;
20423
- effect = currentState.effect;
20424
- stateUpdater = currentState.stateUpdater;
20425
- errorState = currentState.errorState;
20426
- return nextState === qEnd ? done(arg) : effect;
20427
- }
20428
- }
20429
-
20430
- return makeIterator(next, function (error) {
20431
- return next(null, error);
20432
- }, name);
20433
- }
20434
-
20435
- function takeEvery(patternOrChannel, worker) {
20436
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
20437
- args[_key - 2] = arguments[_key];
20438
- }
20439
-
20440
- var yTake = {
20441
- done: false,
20442
- value: take(patternOrChannel)
20443
- };
20444
-
20445
- var yFork = function yFork(ac) {
20446
- return {
20447
- done: false,
20448
- value: fork.apply(void 0, [worker].concat(args, [ac]))
20449
- };
20450
- };
20451
-
20452
- var action,
20453
- setAction = function setAction(ac) {
20454
- return action = ac;
20455
- };
20456
-
20457
- return fsmIterator({
20458
- q1: function q1() {
20459
- return {
20460
- nextState: 'q2',
20461
- effect: yTake,
20462
- stateUpdater: setAction
20463
- };
20464
- },
20465
- q2: function q2() {
20466
- return {
20467
- nextState: 'q1',
20468
- effect: yFork(action)
20469
- };
20470
- }
20471
- }, 'q1', "takeEvery(" + safeName(patternOrChannel) + ", " + worker.name + ")");
20472
- }
20473
-
20474
- var validateTakeEffect = function validateTakeEffect(fn, patternOrChannel, worker) {
20475
- check(patternOrChannel, notUndef, fn.name + " requires a pattern or channel");
20476
- check(worker, notUndef, fn.name + " requires a saga parameter");
20477
- };
20478
-
20479
- function takeEvery$1(patternOrChannel, worker) {
20480
- if (process.env.NODE_ENV !== 'production') {
20481
- validateTakeEffect(takeEvery$1, patternOrChannel, worker);
20482
- }
20483
-
20484
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
20485
- args[_key - 2] = arguments[_key];
20486
- }
20487
-
20488
- return fork.apply(void 0, [takeEvery, patternOrChannel, worker].concat(args));
20489
- }
20490
-
20491
- function* dispatchModifiedState({ existUIState, modifiedUIState, put, }) {
20492
- const isUiSchemaEqual = _.isEqual(existUIState.uiSchema, modifiedUIState.uiSchema);
20493
- const isViewModelEqual = _.isEqual(existUIState.viewModel, modifiedUIState.viewModel);
20494
- if (!isUiSchemaEqual) {
20495
- yield put(metaDataActions.save(modifiedUIState.uiSchema));
20496
- }
20497
- if (!isViewModelEqual) {
20498
- yield put(appActions.loadViewModel(modifiedUIState.viewModel));
20499
- }
20500
- }
20501
-
20502
- function* handleViewModelChange({ select, call, put }) {
20503
- const appState = yield select((state) => state.app);
20504
- const uiSchemaState = yield select((state) => state.metaData);
20505
- const modifiedState = applyUIEffectProcessor(_.cloneDeep(uiSchemaState.uiSchema), _.cloneDeep(appState.viewModel));
20506
- yield call(dispatchModifiedState, {
20507
- existUIState: {
20508
- uiSchema: uiSchemaState.uiSchema,
20509
- viewModel: appState.viewModel,
20510
- },
20511
- modifiedUIState: {
20512
- uiSchema: modifiedState.uiSchema,
20513
- viewModel: modifiedState.viewModel,
20514
- },
20515
- put,
20516
- });
20517
- }
20518
-
20519
- function* loadViewModelSaga(eventService, action) {
20520
- yield call(handleViewModelChange, { call, put, select, action });
20521
- }
20522
- const createLoadViewModelSaga = (eventService) => function* (action) {
20523
- yield* loadViewModelSaga(eventService, action);
20524
- };
20525
-
20526
- function* loadModelSaga(eventService, action) {
20527
- yield call(handleViewModelChange, { call, put, select });
20528
- }
20529
- const createLoadModelSaga = (eventService) => function* (action) {
20530
- yield* loadModelSaga();
20531
- };
20532
-
20533
- function* updateViewModelSaga(eventService, action) {
20534
- if (action.payload.callback) {
20535
- const appState = yield select((state) => state.app);
20536
- action.payload.callback(appState.viewModel);
20537
- }
20538
- yield call(handleViewModelChange, { call, put, select, action });
20539
- }
20540
- const createUpdateViewModelSaga = (eventService) => function* (action) {
20541
- yield* updateViewModelSaga(eventService, action);
20542
- };
20543
-
20544
- function* watchLoadViewModel(eventService) {
20545
- yield takeEvery$1(appActions.loadViewModel.type, createLoadViewModelSaga(eventService));
20546
- }
20547
- function* watchLoadModel(eventService) {
20548
- yield takeEvery$1(appActions.loadModel.type, createLoadModelSaga());
20549
- }
20550
- function* watchUpdateViewModel(eventService) {
20551
- yield takeEvery$1(appActions.updateViewModel.type, createUpdateViewModelSaga(eventService));
20552
- }
20553
- function* appSaga(eventService) {
20554
- yield all([
20555
- fork(watchLoadViewModel, eventService),
20556
- fork(watchLoadModel, eventService),
20557
- fork(watchUpdateViewModel, eventService),
20558
- ]);
20559
- }
20560
-
20561
- function _objectWithoutPropertiesLoose(r, e) {
20562
- if (null == r) return {};
20563
- var t = {};
20564
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
20565
- if (e.indexOf(n) >= 0) continue;
20566
- t[n] = r[n];
20567
- }
20568
- return t;
20569
- }
20570
-
20571
- function deferred() {
20572
- var def = {};
20573
- def.promise = new Promise(function (resolve, reject) {
20574
- def.resolve = resolve;
20575
- def.reject = reject;
20576
- });
20577
- return def;
20578
- }
20579
-
20580
- var queue = [];
20581
- /**
20582
- Variable to hold a counting semaphore
20583
- - Incrementing adds a lock and puts the scheduler in a `suspended` state (if it's not
20584
- already suspended)
20585
- - Decrementing releases a lock. Zero locks puts the scheduler in a `released` state. This
20586
- triggers flushing the queued tasks.
20587
- **/
20588
-
20589
- var semaphore = 0;
20590
- /**
20591
- Executes a task 'atomically'. Tasks scheduled during this execution will be queued
20592
- and flushed after this task has finished (assuming the scheduler endup in a released
20593
- state).
20594
- **/
20595
-
20596
- function exec(task) {
20597
- try {
20598
- suspend();
20599
- task();
20600
- } finally {
20601
- release();
20602
- }
20603
- }
20604
- /**
20605
- Executes or queues a task depending on the state of the scheduler (`suspended` or `released`)
20606
- **/
20607
-
20608
-
20609
- function asap(task) {
20610
- queue.push(task);
20611
-
20612
- if (!semaphore) {
20613
- suspend();
20614
- flush();
20615
- }
20616
- }
20617
- /**
20618
- * Puts the scheduler in a `suspended` state and executes a task immediately.
20619
- */
20620
-
20621
- function immediately(task) {
20622
- try {
20623
- suspend();
20624
- return task();
20625
- } finally {
20626
- flush();
20627
- }
20628
- }
20629
- /**
20630
- Puts the scheduler in a `suspended` state. Scheduled tasks will be queued until the
20631
- scheduler is released.
20632
- **/
20633
-
20634
- function suspend() {
20635
- semaphore++;
20636
- }
20637
- /**
20638
- Puts the scheduler in a `released` state.
20639
- **/
20640
-
20641
-
20642
- function release() {
20643
- semaphore--;
20644
- }
20645
- /**
20646
- Releases the current lock. Executes all queued tasks if the scheduler is in the released state.
20647
- **/
20648
-
20649
-
20650
- function flush() {
20651
- release();
20652
- var task;
20653
-
20654
- while (!semaphore && (task = queue.shift()) !== undefined) {
20655
- exec(task);
20656
- }
20657
- }
20658
-
20659
- var array = function array(patterns) {
20660
- return function (input) {
20661
- return patterns.some(function (p) {
20662
- return matcher(p)(input);
20663
- });
20664
- };
20665
- };
20666
- var predicate = function predicate(_predicate) {
20667
- return function (input) {
20668
- return _predicate(input);
20669
- };
20670
- };
20671
- var string = function string(pattern) {
20672
- return function (input) {
20673
- return input.type === String(pattern);
20674
- };
20675
- };
20676
- var symbol = function symbol(pattern) {
20677
- return function (input) {
20678
- return input.type === pattern;
20679
- };
20680
- };
20681
- var wildcard = function wildcard() {
20682
- return kTrue;
20683
- };
20684
- function matcher(pattern) {
20685
- // prettier-ignore
20686
- var matcherCreator = pattern === '*' ? wildcard : string$1(pattern) ? string : array$1(pattern) ? array : stringableFunc(pattern) ? string : func(pattern) ? predicate : symbol$1(pattern) ? symbol : null;
20687
-
20688
- if (matcherCreator === null) {
20689
- throw new Error("invalid pattern: " + pattern);
20690
- }
20691
-
20692
- return matcherCreator(pattern);
20693
- }
20694
-
20695
- var END = {
20696
- type: CHANNEL_END_TYPE
20697
- };
20698
- var isEnd = function isEnd(a) {
20699
- return a && a.type === CHANNEL_END_TYPE;
20700
- };
20701
- var CLOSED_CHANNEL_WITH_TAKERS = 'Cannot have a closed channel with pending takers';
20702
- var INVALID_BUFFER = 'invalid buffer passed to channel factory function';
20703
- var UNDEFINED_INPUT_ERROR = "Saga or channel was provided with an undefined action\nHints:\n - check that your Action Creator returns a non-undefined value\n - if the Saga was started using runSaga, check that your subscribe source provides the action to its listeners";
20704
- function channel(buffer$1) {
20705
- if (buffer$1 === void 0) {
20706
- buffer$1 = expanding();
20707
- }
20708
-
20709
- var closed = false;
20710
- var takers = [];
20711
-
20712
- if (process.env.NODE_ENV !== 'production') {
20713
- check(buffer$1, buffer, INVALID_BUFFER);
20714
- }
20715
-
20716
- function checkForbiddenStates() {
20717
- if (closed && takers.length) {
20718
- throw internalErr(CLOSED_CHANNEL_WITH_TAKERS);
20719
- }
20720
-
20721
- if (takers.length && !buffer$1.isEmpty()) {
20722
- throw internalErr('Cannot have pending takers with non empty buffer');
20723
- }
20724
- }
20725
-
20726
- function put(input) {
20727
- if (process.env.NODE_ENV !== 'production') {
20728
- checkForbiddenStates();
20729
- check(input, notUndef, UNDEFINED_INPUT_ERROR);
20730
- }
20731
-
20732
- if (closed) {
20733
- return;
20734
- }
20735
-
20736
- if (takers.length === 0) {
20737
- return buffer$1.put(input);
20738
- }
20739
-
20740
- var cb = takers.shift();
20741
- cb(input);
20742
- }
20743
-
20744
- function take(cb) {
20745
- if (process.env.NODE_ENV !== 'production') {
20746
- checkForbiddenStates();
20747
- check(cb, func, "channel.take's callback must be a function");
20748
- }
20749
-
20750
- if (closed && buffer$1.isEmpty()) {
20751
- cb(END);
20752
- } else if (!buffer$1.isEmpty()) {
20753
- cb(buffer$1.take());
20754
- } else {
20755
- takers.push(cb);
20756
-
20757
- cb.cancel = function () {
20758
- remove(takers, cb);
20759
- };
20760
- }
20761
- }
20762
-
20763
- function flush(cb) {
20764
- if (process.env.NODE_ENV !== 'production') {
20765
- checkForbiddenStates();
20766
- check(cb, func, "channel.flush' callback must be a function");
20767
- }
20768
-
20769
- if (closed && buffer$1.isEmpty()) {
20770
- cb(END);
20771
- return;
20772
- }
20773
-
20774
- cb(buffer$1.flush());
20775
- }
20776
-
20777
- function close() {
20778
- if (process.env.NODE_ENV !== 'production') {
20779
- checkForbiddenStates();
20780
- }
20781
-
20782
- if (closed) {
20783
- return;
20784
- }
20785
-
20786
- closed = true;
20787
- var arr = takers;
20788
- takers = [];
20789
-
20790
- for (var i = 0, len = arr.length; i < len; i++) {
20791
- var taker = arr[i];
20792
- taker(END);
20793
- }
20794
- }
20795
-
20796
- return {
20797
- take: take,
20798
- put: put,
20799
- flush: flush,
20800
- close: close
20801
- };
20802
- }
20803
- function multicastChannel() {
20804
- var _ref;
20805
-
20806
- var closed = false;
20807
- var currentTakers = [];
20808
- var nextTakers = currentTakers;
20809
-
20810
- function checkForbiddenStates() {
20811
- if (closed && nextTakers.length) {
20812
- throw internalErr(CLOSED_CHANNEL_WITH_TAKERS);
20813
- }
20814
- }
20815
-
20816
- var ensureCanMutateNextTakers = function ensureCanMutateNextTakers() {
20817
- if (nextTakers !== currentTakers) {
20818
- return;
20819
- }
20820
-
20821
- nextTakers = currentTakers.slice();
20822
- };
20823
-
20824
- var close = function close() {
20825
- if (process.env.NODE_ENV !== 'production') {
20826
- checkForbiddenStates();
20827
- }
20828
-
20829
- closed = true;
20830
- var takers = currentTakers = nextTakers;
20831
- nextTakers = [];
20832
- takers.forEach(function (taker) {
20833
- taker(END);
20834
- });
20835
- };
20836
-
20837
- return _ref = {}, _ref[MULTICAST] = true, _ref.put = function put(input) {
20838
- if (process.env.NODE_ENV !== 'production') {
20839
- checkForbiddenStates();
20840
- check(input, notUndef, UNDEFINED_INPUT_ERROR);
20841
- }
20842
-
20843
- if (closed) {
20844
- return;
20845
- }
20846
-
20847
- if (isEnd(input)) {
20848
- close();
20849
- return;
20850
- }
20851
-
20852
- var takers = currentTakers = nextTakers;
20853
-
20854
- for (var i = 0, len = takers.length; i < len; i++) {
20855
- var taker = takers[i];
20856
-
20857
- if (taker[MATCH](input)) {
20858
- taker.cancel();
20859
- taker(input);
20860
- }
20861
- }
20862
- }, _ref.take = function take(cb, matcher) {
20863
- if (matcher === void 0) {
20864
- matcher = wildcard;
20865
- }
20866
-
20867
- if (process.env.NODE_ENV !== 'production') {
20868
- checkForbiddenStates();
20869
- }
20870
-
20871
- if (closed) {
20872
- cb(END);
20873
- return;
20874
- }
20875
-
20876
- cb[MATCH] = matcher;
20877
- ensureCanMutateNextTakers();
20878
- nextTakers.push(cb);
20879
- cb.cancel = once(function () {
20880
- ensureCanMutateNextTakers();
20881
- remove(nextTakers, cb);
20882
- });
20883
- }, _ref.close = close, _ref;
20884
- }
20885
- function stdChannel() {
20886
- var chan = multicastChannel();
20887
- var put = chan.put;
20888
-
20889
- chan.put = function (input) {
20890
- if (input[SAGA_ACTION]) {
20891
- put(input);
20892
- return;
20893
- }
20894
-
20895
- asap(function () {
20896
- put(input);
20897
- });
20898
- };
20899
-
20900
- return chan;
20901
- }
20902
-
20903
- var RUNNING = 0;
20904
- var CANCELLED = 1;
20905
- var ABORTED = 2;
20906
- var DONE = 3;
20907
-
20908
- function resolvePromise(promise, cb) {
20909
- var cancelPromise = promise[CANCEL$1];
20910
-
20911
- if (func(cancelPromise)) {
20912
- cb.cancel = cancelPromise;
20913
- }
20914
-
20915
- promise.then(cb, function (error) {
20916
- cb(error, true);
20917
- });
20918
- }
20919
-
20920
- var current = 0;
20921
- var nextSagaId = (function () {
20922
- return ++current;
20923
- });
20924
-
20925
- var _effectRunnerMap;
20926
-
20927
- function getIteratorMetaInfo(iterator, fn) {
20928
- if (iterator.isSagaIterator) {
20929
- return {
20930
- name: iterator.meta.name
20931
- };
20932
- }
20933
-
20934
- return getMetaInfo(fn);
20935
- }
20936
-
20937
- function createTaskIterator(_ref) {
20938
- var context = _ref.context,
20939
- fn = _ref.fn,
20940
- args = _ref.args;
20941
-
20942
- // catch synchronous failures; see #152 and #441
20943
- try {
20944
- var result = fn.apply(context, args); // i.e. a generator function returns an iterator
20945
-
20946
- if (iterator(result)) {
20947
- return result;
20948
- }
20949
-
20950
- var resolved = false;
20951
-
20952
- var next = function next(arg) {
20953
- if (!resolved) {
20954
- resolved = true; // Only promises returned from fork will be interpreted. See #1573
20955
-
20956
- return {
20957
- value: result,
20958
- done: !promise(result)
20959
- };
20960
- } else {
20961
- return {
20962
- value: arg,
20963
- done: true
20964
- };
20965
- }
20966
- };
20967
-
20968
- return makeIterator(next);
20969
- } catch (err) {
20970
- // do not bubble up synchronous failures for detached forks
20971
- // instead create a failed task. See #152 and #441
20972
- return makeIterator(function () {
20973
- throw err;
20974
- });
20975
- }
20976
- }
20977
-
20978
- function runPutEffect(env, _ref2, cb) {
20979
- var channel = _ref2.channel,
20980
- action = _ref2.action,
20981
- resolve = _ref2.resolve;
20982
-
20983
- /**
20984
- Schedule the put in case another saga is holding a lock.
20985
- The put will be executed atomically. ie nested puts will execute after
20986
- this put has terminated.
20987
- **/
20988
- asap(function () {
20989
- var result;
20990
-
20991
- try {
20992
- result = (channel ? channel.put : env.dispatch)(action);
20993
- } catch (error) {
20994
- cb(error, true);
20995
- return;
20996
- }
20997
-
20998
- if (resolve && promise(result)) {
20999
- resolvePromise(result, cb);
21000
- } else {
21001
- cb(result);
21002
- }
21003
- }); // Put effects are non cancellables
21004
- }
21005
-
21006
- function runTakeEffect(env, _ref3, cb) {
21007
- var _ref3$channel = _ref3.channel,
21008
- channel = _ref3$channel === void 0 ? env.channel : _ref3$channel,
21009
- pattern = _ref3.pattern,
21010
- maybe = _ref3.maybe;
21011
-
21012
- var takeCb = function takeCb(input) {
21013
- if (input instanceof Error) {
21014
- cb(input, true);
21015
- return;
21016
- }
21017
-
21018
- if (isEnd(input) && !maybe) {
21019
- cb(TERMINATE);
21020
- return;
21021
- }
21022
-
21023
- cb(input);
21024
- };
21025
-
21026
- try {
21027
- channel.take(takeCb, notUndef(pattern) ? matcher(pattern) : null);
21028
- } catch (err) {
21029
- cb(err, true);
21030
- return;
21031
- }
21032
-
21033
- cb.cancel = takeCb.cancel;
21034
- }
21035
-
21036
- function runCallEffect(env, _ref4, cb, _ref5) {
21037
- var context = _ref4.context,
21038
- fn = _ref4.fn,
21039
- args = _ref4.args;
21040
- var task = _ref5.task;
21041
-
21042
- // catch synchronous failures; see #152
21043
- try {
21044
- var result = fn.apply(context, args);
21045
-
21046
- if (promise(result)) {
21047
- resolvePromise(result, cb);
21048
- return;
21049
- }
21050
-
21051
- if (iterator(result)) {
21052
- // resolve iterator
21053
- proc(env, result, task.context, current, getMetaInfo(fn),
21054
- /* isRoot */
21055
- false, cb);
21056
- return;
21057
- }
21058
-
21059
- cb(result);
21060
- } catch (error) {
21061
- cb(error, true);
21062
- }
21063
- }
21064
-
21065
- function runCPSEffect(env, _ref6, cb) {
21066
- var context = _ref6.context,
21067
- fn = _ref6.fn,
21068
- args = _ref6.args;
21069
-
21070
- // CPS (ie node style functions) can define their own cancellation logic
21071
- // by setting cancel field on the cb
21072
- // catch synchronous failures; see #152
21073
- try {
21074
- var cpsCb = function cpsCb(err, res) {
21075
- if (undef(err)) {
21076
- cb(res);
21077
- } else {
21078
- cb(err, true);
21079
- }
21080
- };
21081
-
21082
- fn.apply(context, args.concat(cpsCb));
21083
-
21084
- if (cpsCb.cancel) {
21085
- cb.cancel = cpsCb.cancel;
21086
- }
21087
- } catch (error) {
21088
- cb(error, true);
21089
- }
21090
- }
21091
-
21092
- function runForkEffect(env, _ref7, cb, _ref8) {
21093
- var context = _ref7.context,
21094
- fn = _ref7.fn,
21095
- args = _ref7.args,
21096
- detached = _ref7.detached;
21097
- var parent = _ref8.task;
21098
- var taskIterator = createTaskIterator({
21099
- context: context,
21100
- fn: fn,
21101
- args: args
21102
- });
21103
- var meta = getIteratorMetaInfo(taskIterator, fn);
21104
- immediately(function () {
21105
- var child = proc(env, taskIterator, parent.context, current, meta, detached, undefined);
21106
-
21107
- if (detached) {
21108
- cb(child);
21109
- } else {
21110
- if (child.isRunning()) {
21111
- parent.queue.addTask(child);
21112
- cb(child);
21113
- } else if (child.isAborted()) {
21114
- parent.queue.abort(child.error());
21115
- } else {
21116
- cb(child);
21117
- }
21118
- }
21119
- }); // Fork effects are non cancellables
21120
- }
21121
-
21122
- function runJoinEffect(env, taskOrTasks, cb, _ref9) {
21123
- var task = _ref9.task;
21124
-
21125
- var joinSingleTask = function joinSingleTask(taskToJoin, cb) {
21126
- if (taskToJoin.isRunning()) {
21127
- var joiner = {
21128
- task: task,
21129
- cb: cb
21130
- };
21131
-
21132
- cb.cancel = function () {
21133
- if (taskToJoin.isRunning()) remove(taskToJoin.joiners, joiner);
21134
- };
21135
-
21136
- taskToJoin.joiners.push(joiner);
21137
- } else {
21138
- if (taskToJoin.isAborted()) {
21139
- cb(taskToJoin.error(), true);
21140
- } else {
21141
- cb(taskToJoin.result());
21142
- }
21143
- }
21144
- };
21145
-
21146
- if (array$1(taskOrTasks)) {
21147
- if (taskOrTasks.length === 0) {
21148
- cb([]);
21149
- return;
21150
- }
21151
-
21152
- var childCallbacks = createAllStyleChildCallbacks(taskOrTasks, cb);
21153
- taskOrTasks.forEach(function (t, i) {
21154
- joinSingleTask(t, childCallbacks[i]);
21155
- });
21156
- } else {
21157
- joinSingleTask(taskOrTasks, cb);
21158
- }
21159
- }
21160
-
21161
- function cancelSingleTask(taskToCancel) {
21162
- if (taskToCancel.isRunning()) {
21163
- taskToCancel.cancel();
21164
- }
21165
- }
21166
-
21167
- function runCancelEffect(env, taskOrTasks, cb, _ref10) {
21168
- var task = _ref10.task;
21169
-
21170
- if (taskOrTasks === SELF_CANCELLATION) {
21171
- cancelSingleTask(task);
21172
- } else if (array$1(taskOrTasks)) {
21173
- taskOrTasks.forEach(cancelSingleTask);
21174
- } else {
21175
- cancelSingleTask(taskOrTasks);
21176
- }
21177
-
21178
- cb(); // cancel effects are non cancellables
21179
- }
21180
-
21181
- function runAllEffect(env, effects, cb, _ref11) {
21182
- var digestEffect = _ref11.digestEffect;
21183
- var effectId = current;
21184
- var keys = Object.keys(effects);
21185
-
21186
- if (keys.length === 0) {
21187
- cb(array$1(effects) ? [] : {});
21188
- return;
21189
- }
21190
-
21191
- var childCallbacks = createAllStyleChildCallbacks(effects, cb);
21192
- keys.forEach(function (key) {
21193
- digestEffect(effects[key], effectId, childCallbacks[key], key);
21194
- });
21195
- }
21196
-
21197
- function runRaceEffect(env, effects, cb, _ref12) {
21198
- var digestEffect = _ref12.digestEffect;
21199
- var effectId = current;
21200
- var keys = Object.keys(effects);
21201
- var response = array$1(effects) ? createEmptyArray(keys.length) : {};
21202
- var childCbs = {};
21203
- var completed = false;
21204
- keys.forEach(function (key) {
21205
- var chCbAtKey = function chCbAtKey(res, isErr) {
21206
- if (completed) {
21207
- return;
21208
- }
21209
-
21210
- if (isErr || shouldComplete(res)) {
21211
- // Race Auto cancellation
21212
- cb.cancel();
21213
- cb(res, isErr);
21214
- } else {
21215
- cb.cancel();
21216
- completed = true;
21217
- response[key] = res;
21218
- cb(response);
21219
- }
21220
- };
21221
-
21222
- chCbAtKey.cancel = noop;
21223
- childCbs[key] = chCbAtKey;
21224
- });
21225
-
21226
- cb.cancel = function () {
21227
- // prevents unnecessary cancellation
21228
- if (!completed) {
21229
- completed = true;
21230
- keys.forEach(function (key) {
21231
- return childCbs[key].cancel();
21232
- });
21233
- }
21234
- };
21235
-
21236
- keys.forEach(function (key) {
21237
- if (completed) {
21238
- return;
21239
- }
21240
-
21241
- digestEffect(effects[key], effectId, childCbs[key], key);
21242
- });
21243
- }
21244
-
21245
- function runSelectEffect(env, _ref13, cb) {
21246
- var selector = _ref13.selector,
21247
- args = _ref13.args;
21248
-
21249
- try {
21250
- var state = selector.apply(void 0, [env.getState()].concat(args));
21251
- cb(state);
21252
- } catch (error) {
21253
- cb(error, true);
21254
- }
21255
- }
21256
-
21257
- function runChannelEffect(env, _ref14, cb) {
21258
- var pattern = _ref14.pattern,
21259
- buffer = _ref14.buffer;
21260
- var chan = channel(buffer);
21261
- var match = matcher(pattern);
21262
-
21263
- var taker = function taker(action) {
21264
- if (!isEnd(action)) {
21265
- env.channel.take(taker, match);
21266
- }
21267
-
21268
- chan.put(action);
21269
- };
21270
-
21271
- var close = chan.close;
21272
-
21273
- chan.close = function () {
21274
- taker.cancel();
21275
- close();
21276
- };
21277
-
21278
- env.channel.take(taker, match);
21279
- cb(chan);
21280
- }
21281
-
21282
- function runCancelledEffect(env, data, cb, _ref15) {
21283
- var task = _ref15.task;
21284
- cb(task.isCancelled());
21285
- }
21286
-
21287
- function runFlushEffect(env, channel, cb) {
21288
- channel.flush(cb);
21289
- }
21290
-
21291
- function runGetContextEffect(env, prop, cb, _ref16) {
21292
- var task = _ref16.task;
21293
- cb(task.context[prop]);
21294
- }
21295
-
21296
- function runSetContextEffect(env, props, cb, _ref17) {
21297
- var task = _ref17.task;
21298
- assignWithSymbols(task.context, props);
21299
- cb();
21300
- }
21301
-
21302
- var effectRunnerMap = (_effectRunnerMap = {}, _effectRunnerMap[TAKE] = runTakeEffect, _effectRunnerMap[PUT] = runPutEffect, _effectRunnerMap[ALL] = runAllEffect, _effectRunnerMap[RACE] = runRaceEffect, _effectRunnerMap[CALL] = runCallEffect, _effectRunnerMap[CPS] = runCPSEffect, _effectRunnerMap[FORK] = runForkEffect, _effectRunnerMap[JOIN] = runJoinEffect, _effectRunnerMap[CANCEL] = runCancelEffect, _effectRunnerMap[SELECT] = runSelectEffect, _effectRunnerMap[ACTION_CHANNEL] = runChannelEffect, _effectRunnerMap[CANCELLED$1] = runCancelledEffect, _effectRunnerMap[FLUSH] = runFlushEffect, _effectRunnerMap[GET_CONTEXT] = runGetContextEffect, _effectRunnerMap[SET_CONTEXT] = runSetContextEffect, _effectRunnerMap);
21303
-
21304
- /**
21305
- Used to track a parent task and its forks
21306
- In the fork model, forked tasks are attached by default to their parent
21307
- We model this using the concept of Parent task && main Task
21308
- main task is the main flow of the current Generator, the parent tasks is the
21309
- aggregation of the main tasks + all its forked tasks.
21310
- Thus the whole model represents an execution tree with multiple branches (vs the
21311
- linear execution tree in sequential (non parallel) programming)
21312
-
21313
- A parent tasks has the following semantics
21314
- - It completes if all its forks either complete or all cancelled
21315
- - If it's cancelled, all forks are cancelled as well
21316
- - It aborts if any uncaught error bubbles up from forks
21317
- - If it completes, the return value is the one returned by the main task
21318
- **/
21319
-
21320
- function forkQueue(mainTask, onAbort, cont) {
21321
- var tasks = [];
21322
- var result;
21323
- var completed = false;
21324
- addTask(mainTask);
21325
-
21326
- var getTasks = function getTasks() {
21327
- return tasks;
21328
- };
21329
-
21330
- function abort(err) {
21331
- onAbort();
21332
- cancelAll();
21333
- cont(err, true);
21334
- }
21335
-
21336
- function addTask(task) {
21337
- tasks.push(task);
21338
-
21339
- task.cont = function (res, isErr) {
21340
- if (completed) {
21341
- return;
21342
- }
21343
-
21344
- remove(tasks, task);
21345
- task.cont = noop;
21346
-
21347
- if (isErr) {
21348
- abort(res);
21349
- } else {
21350
- if (task === mainTask) {
21351
- result = res;
21352
- }
21353
-
21354
- if (!tasks.length) {
21355
- completed = true;
21356
- cont(result);
21357
- }
21358
- }
21359
- };
21360
- }
21361
-
21362
- function cancelAll() {
21363
- if (completed) {
21364
- return;
21365
- }
21366
-
21367
- completed = true;
21368
- tasks.forEach(function (t) {
21369
- t.cont = noop;
21370
- t.cancel();
21371
- });
21372
- tasks = [];
21373
- }
21374
-
21375
- return {
21376
- addTask: addTask,
21377
- cancelAll: cancelAll,
21378
- abort: abort,
21379
- getTasks: getTasks
21380
- };
21381
- }
21382
-
21383
- // there can be only a single saga error created at any given moment
21384
-
21385
- function formatLocation(fileName, lineNumber) {
21386
- return fileName + "?" + lineNumber;
21387
- }
21388
-
21389
- function effectLocationAsString(effect) {
21390
- var location = getLocation(effect);
21391
-
21392
- if (location) {
21393
- var code = location.code,
21394
- fileName = location.fileName,
21395
- lineNumber = location.lineNumber;
21396
- var source = code + " " + formatLocation(fileName, lineNumber);
21397
- return source;
21398
- }
21399
-
21400
- return '';
21401
- }
21402
-
21403
- function sagaLocationAsString(sagaMeta) {
21404
- var name = sagaMeta.name,
21405
- location = sagaMeta.location;
21406
-
21407
- if (location) {
21408
- return name + " " + formatLocation(location.fileName, location.lineNumber);
21409
- }
21410
-
21411
- return name;
19757
+ function* dispatchModifiedState({ existUIState, modifiedUIState, put, }) {
19758
+ const isUiSchemaEqual = _.isEqual(existUIState.uiSchema, modifiedUIState.uiSchema);
19759
+ const isViewModelEqual = _.isEqual(existUIState.viewModel, modifiedUIState.viewModel);
19760
+ if (!isUiSchemaEqual) {
19761
+ yield put(metaDataActions.save(modifiedUIState.uiSchema));
19762
+ }
19763
+ if (!isViewModelEqual) {
19764
+ yield put(appActions.loadViewModel(modifiedUIState.viewModel));
19765
+ }
21412
19766
  }
21413
19767
 
21414
- function cancelledTasksAsString(sagaStack) {
21415
- var cancelledTasks = flatMap(function (i) {
21416
- return i.cancelledTasks;
21417
- }, sagaStack);
21418
-
21419
- if (!cancelledTasks.length) {
21420
- return '';
21421
- }
21422
-
21423
- return ['Tasks cancelled due to error:'].concat(cancelledTasks).join('\n');
19768
+ function* handleViewModelChange({ select, call, put }) {
19769
+ const appState = yield select((state) => state.app);
19770
+ const uiSchemaState = yield select((state) => state.metaData);
19771
+ const modifiedState = applyUIEffectProcessor(_.cloneDeep(uiSchemaState.uiSchema), _.cloneDeep(appState.viewModel));
19772
+ yield call(dispatchModifiedState, {
19773
+ existUIState: {
19774
+ uiSchema: uiSchemaState.uiSchema,
19775
+ viewModel: appState.viewModel,
19776
+ },
19777
+ modifiedUIState: {
19778
+ uiSchema: modifiedState.uiSchema,
19779
+ viewModel: modifiedState.viewModel,
19780
+ },
19781
+ put,
19782
+ });
21424
19783
  }
21425
19784
 
21426
- var crashedEffect = null;
21427
- var sagaStack = [];
21428
- var addSagaFrame = function addSagaFrame(frame) {
21429
- frame.crashedEffect = crashedEffect;
21430
- sagaStack.push(frame);
21431
- };
21432
- var clear = function clear() {
21433
- crashedEffect = null;
21434
- sagaStack.length = 0;
21435
- }; // this sets crashed effect for the soon-to-be-reported saga frame
21436
- // this slightly streatches the singleton nature of this module into wrong direction
21437
- // as it's even less obvious what's the data flow here, but it is what it is for now
21438
-
21439
- var setCrashedEffect = function setCrashedEffect(effect) {
21440
- crashedEffect = effect;
21441
- };
21442
- /**
21443
- @returns {string}
21444
-
21445
- @example
21446
- The above error occurred in task errorInPutSaga {pathToFile}
21447
- when executing effect put({type: 'REDUCER_ACTION_ERROR_IN_PUT'}) {pathToFile}
21448
- created by fetchSaga {pathToFile}
21449
- created by rootSaga {pathToFile}
21450
- */
21451
-
21452
- var toString = function toString() {
21453
- var firstSaga = sagaStack[0],
21454
- otherSagas = sagaStack.slice(1);
21455
- var crashedEffectLocation = firstSaga.crashedEffect ? effectLocationAsString(firstSaga.crashedEffect) : null;
21456
- var errorMessage = "The above error occurred in task " + sagaLocationAsString(firstSaga.meta) + (crashedEffectLocation ? " \n when executing effect " + crashedEffectLocation : '');
21457
- return [errorMessage].concat(otherSagas.map(function (s) {
21458
- return " created by " + sagaLocationAsString(s.meta);
21459
- }), [cancelledTasksAsString(sagaStack)]).join('\n');
19785
+ function* loadViewModelSaga(eventService, action) {
19786
+ yield call(handleViewModelChange, { call, put, select, action });
19787
+ }
19788
+ const createLoadViewModelSaga = (eventService) => function* (action) {
19789
+ yield* loadViewModelSaga(eventService, action);
21460
19790
  };
21461
19791
 
21462
- function newTask(env, mainTask, parentContext, parentEffectId, meta, isRoot, cont) {
21463
- var _task;
21464
-
21465
- if (cont === void 0) {
21466
- cont = noop;
21467
- }
21468
-
21469
- var status = RUNNING;
21470
- var taskResult;
21471
- var taskError;
21472
- var deferredEnd = null;
21473
- var cancelledDueToErrorTasks = [];
21474
- var context = Object.create(parentContext);
21475
- var queue = forkQueue(mainTask, function onAbort() {
21476
- cancelledDueToErrorTasks.push.apply(cancelledDueToErrorTasks, queue.getTasks().map(function (t) {
21477
- return t.meta.name;
21478
- }));
21479
- }, end);
21480
- /**
21481
- This may be called by a parent generator to trigger/propagate cancellation
21482
- cancel all pending tasks (including the main task), then end the current task.
21483
- Cancellation propagates down to the whole execution tree held by this Parent task
21484
- It's also propagated to all joiners of this task and their execution tree/joiners
21485
- Cancellation is noop for terminated/Cancelled tasks tasks
21486
- **/
21487
-
21488
- function cancel() {
21489
- if (status === RUNNING) {
21490
- // Setting status to CANCELLED does not necessarily mean that the task/iterators are stopped
21491
- // effects in the iterator's finally block will still be executed
21492
- status = CANCELLED;
21493
- queue.cancelAll(); // Ending with a TASK_CANCEL will propagate the Cancellation to all joiners
21494
-
21495
- end(TASK_CANCEL, false);
21496
- }
21497
- }
21498
-
21499
- function end(result, isErr) {
21500
- if (!isErr) {
21501
- // The status here may be RUNNING or CANCELLED
21502
- // If the status is CANCELLED, then we do not need to change it here
21503
- if (result === TASK_CANCEL) {
21504
- status = CANCELLED;
21505
- } else if (status !== CANCELLED) {
21506
- status = DONE;
21507
- }
21508
-
21509
- taskResult = result;
21510
- deferredEnd && deferredEnd.resolve(result);
21511
- } else {
21512
- status = ABORTED;
21513
- addSagaFrame({
21514
- meta: meta,
21515
- cancelledTasks: cancelledDueToErrorTasks
21516
- });
21517
-
21518
- if (task.isRoot) {
21519
- var sagaStack = toString(); // we've dumped the saga stack to string and are passing it to user's code
21520
- // we know that it won't be needed anymore and we need to clear it
21521
-
21522
- clear();
21523
- env.onError(result, {
21524
- sagaStack: sagaStack
21525
- });
21526
- }
21527
-
21528
- taskError = result;
21529
- deferredEnd && deferredEnd.reject(result);
21530
- }
21531
-
21532
- task.cont(result, isErr);
21533
- task.joiners.forEach(function (joiner) {
21534
- joiner.cb(result, isErr);
21535
- });
21536
- task.joiners = null;
21537
- }
21538
-
21539
- function setContext(props) {
21540
- if (process.env.NODE_ENV !== 'production') {
21541
- check(props, object, createSetContextWarning('task', props));
21542
- }
21543
-
21544
- assignWithSymbols(context, props);
21545
- }
21546
-
21547
- function toPromise() {
21548
- if (deferredEnd) {
21549
- return deferredEnd.promise;
21550
- }
21551
-
21552
- deferredEnd = deferred();
21553
-
21554
- if (status === ABORTED) {
21555
- deferredEnd.reject(taskError);
21556
- } else if (status !== RUNNING) {
21557
- deferredEnd.resolve(taskResult);
21558
- }
21559
-
21560
- return deferredEnd.promise;
21561
- }
21562
-
21563
- var task = (_task = {}, _task[TASK] = true, _task.id = parentEffectId, _task.meta = meta, _task.isRoot = isRoot, _task.context = context, _task.joiners = [], _task.queue = queue, _task.cancel = cancel, _task.cont = cont, _task.end = end, _task.setContext = setContext, _task.toPromise = toPromise, _task.isRunning = function isRunning() {
21564
- return status === RUNNING;
21565
- }, _task.isCancelled = function isCancelled() {
21566
- return status === CANCELLED || status === RUNNING && mainTask.status === CANCELLED;
21567
- }, _task.isAborted = function isAborted() {
21568
- return status === ABORTED;
21569
- }, _task.result = function result() {
21570
- return taskResult;
21571
- }, _task.error = function error() {
21572
- return taskError;
21573
- }, _task);
21574
- return task;
21575
- }
21576
-
21577
- function proc(env, iterator$1, parentContext, parentEffectId, meta, isRoot, cont) {
21578
- if (process.env.NODE_ENV !== 'production' && iterator$1[asyncIteratorSymbol]) {
21579
- throw new Error("redux-saga doesn't support async generators, please use only regular ones");
21580
- }
21581
-
21582
- var finalRunEffect = env.finalizeRunEffect(runEffect);
21583
- /**
21584
- Tracks the current effect cancellation
21585
- Each time the generator progresses. calling runEffect will set a new value
21586
- on it. It allows propagating cancellation to child effects
21587
- **/
21588
-
21589
- next.cancel = noop;
21590
- /** Creates a main task to track the main flow */
21591
-
21592
- var mainTask = {
21593
- meta: meta,
21594
- cancel: cancelMain,
21595
- status: RUNNING
21596
- };
21597
- /**
21598
- Creates a new task descriptor for this generator.
21599
- A task is the aggregation of it's mainTask and all it's forked tasks.
21600
- **/
21601
-
21602
- var task = newTask(env, mainTask, parentContext, parentEffectId, meta, isRoot, cont);
21603
- var executingContext = {
21604
- task: task,
21605
- digestEffect: digestEffect
21606
- };
21607
- /**
21608
- cancellation of the main task. We'll simply resume the Generator with a TASK_CANCEL
21609
- **/
21610
-
21611
- function cancelMain() {
21612
- if (mainTask.status === RUNNING) {
21613
- mainTask.status = CANCELLED;
21614
- next(TASK_CANCEL);
21615
- }
21616
- }
21617
- /**
21618
- attaches cancellation logic to this task's continuation
21619
- this will permit cancellation to propagate down the call chain
21620
- **/
21621
-
21622
-
21623
- if (cont) {
21624
- cont.cancel = task.cancel;
21625
- } // kicks up the generator
21626
-
21627
-
21628
- next(); // then return the task descriptor to the caller
21629
-
21630
- return task;
21631
- /**
21632
- * This is the generator driver
21633
- * It's a recursive async/continuation function which calls itself
21634
- * until the generator terminates or throws
21635
- * @param {internal commands(TASK_CANCEL | TERMINATE) | any} arg - value, generator will be resumed with.
21636
- * @param {boolean} isErr - the flag shows if effect finished with an error
21637
- *
21638
- * receives either (command | effect result, false) or (any thrown thing, true)
21639
- */
21640
-
21641
- function next(arg, isErr) {
21642
- try {
21643
- var result;
21644
-
21645
- if (isErr) {
21646
- result = iterator$1.throw(arg); // user handled the error, we can clear bookkept values
21647
-
21648
- clear();
21649
- } else if (shouldCancel(arg)) {
21650
- /**
21651
- getting TASK_CANCEL automatically cancels the main task
21652
- We can get this value here
21653
- - By cancelling the parent task manually
21654
- - By joining a Cancelled task
21655
- **/
21656
- mainTask.status = CANCELLED;
21657
- /**
21658
- Cancels the current effect; this will propagate the cancellation down to any called tasks
21659
- **/
21660
-
21661
- next.cancel();
21662
- /**
21663
- If this Generator has a `return` method then invokes it
21664
- This will jump to the finally block
21665
- **/
21666
-
21667
- result = func(iterator$1.return) ? iterator$1.return(TASK_CANCEL) : {
21668
- done: true,
21669
- value: TASK_CANCEL
21670
- };
21671
- } else if (shouldTerminate(arg)) {
21672
- // We get TERMINATE flag, i.e. by taking from a channel that ended using `take` (and not `takem` used to trap End of channels)
21673
- result = func(iterator$1.return) ? iterator$1.return() : {
21674
- done: true
21675
- };
21676
- } else {
21677
- result = iterator$1.next(arg);
21678
- }
21679
-
21680
- if (!result.done) {
21681
- digestEffect(result.value, parentEffectId, next);
21682
- } else {
21683
- /**
21684
- This Generator has ended, terminate the main task and notify the fork queue
21685
- **/
21686
- if (mainTask.status !== CANCELLED) {
21687
- mainTask.status = DONE;
21688
- }
21689
-
21690
- mainTask.cont(result.value);
21691
- }
21692
- } catch (error) {
21693
- if (mainTask.status === CANCELLED) {
21694
- throw error;
21695
- }
21696
-
21697
- mainTask.status = ABORTED;
21698
- mainTask.cont(error, true);
21699
- }
21700
- }
21701
-
21702
- function runEffect(effect, effectId, currCb) {
21703
- /**
21704
- each effect runner must attach its own logic of cancellation to the provided callback
21705
- it allows this generator to propagate cancellation downward.
21706
- ATTENTION! effect runners must setup the cancel logic by setting cb.cancel = [cancelMethod]
21707
- And the setup must occur before calling the callback
21708
- This is a sort of inversion of control: called async functions are responsible
21709
- of completing the flow by calling the provided continuation; while caller functions
21710
- are responsible for aborting the current flow by calling the attached cancel function
21711
- Library users can attach their own cancellation logic to promises by defining a
21712
- promise[CANCEL] method in their returned promises
21713
- ATTENTION! calling cancel must have no effect on an already completed or cancelled effect
21714
- **/
21715
- if (promise(effect)) {
21716
- resolvePromise(effect, currCb);
21717
- } else if (iterator(effect)) {
21718
- // resolve iterator
21719
- proc(env, effect, task.context, effectId, meta,
21720
- /* isRoot */
21721
- false, currCb);
21722
- } else if (effect && effect[IO]) {
21723
- var effectRunner = effectRunnerMap[effect.type];
21724
- effectRunner(env, effect.payload, currCb, executingContext);
21725
- } else {
21726
- // anything else returned as is
21727
- currCb(effect);
21728
- }
21729
- }
21730
-
21731
- function digestEffect(effect, parentEffectId, cb, label) {
21732
- if (label === void 0) {
21733
- label = '';
21734
- }
21735
-
21736
- var effectId = nextSagaId();
21737
- env.sagaMonitor && env.sagaMonitor.effectTriggered({
21738
- effectId: effectId,
21739
- parentEffectId: parentEffectId,
21740
- label: label,
21741
- effect: effect
21742
- });
21743
- /**
21744
- completion callback and cancel callback are mutually exclusive
21745
- We can't cancel an already completed effect
21746
- And We can't complete an already cancelled effectId
21747
- **/
21748
-
21749
- var effectSettled; // Completion callback passed to the appropriate effect runner
21750
-
21751
- function currCb(res, isErr) {
21752
- if (effectSettled) {
21753
- return;
21754
- }
21755
-
21756
- effectSettled = true;
21757
- cb.cancel = noop; // defensive measure
21758
-
21759
- if (env.sagaMonitor) {
21760
- if (isErr) {
21761
- env.sagaMonitor.effectRejected(effectId, res);
21762
- } else {
21763
- env.sagaMonitor.effectResolved(effectId, res);
21764
- }
21765
- }
21766
-
21767
- if (isErr) {
21768
- setCrashedEffect(effect);
21769
- }
21770
-
21771
- cb(res, isErr);
21772
- } // tracks down the current cancel
21773
-
21774
-
21775
- currCb.cancel = noop; // setup cancellation logic on the parent cb
21776
-
21777
- cb.cancel = function () {
21778
- // prevents cancelling an already completed effect
21779
- if (effectSettled) {
21780
- return;
21781
- }
21782
-
21783
- effectSettled = true;
21784
- currCb.cancel(); // propagates cancel downward
21785
-
21786
- currCb.cancel = noop; // defensive measure
21787
-
21788
- env.sagaMonitor && env.sagaMonitor.effectCancelled(effectId);
21789
- };
21790
-
21791
- finalRunEffect(effect, effectId, currCb);
21792
- }
21793
- }
21794
-
21795
- var RUN_SAGA_SIGNATURE = 'runSaga(options, saga, ...args)';
21796
- var NON_GENERATOR_ERR = RUN_SAGA_SIGNATURE + ": saga argument must be a Generator function!";
21797
- function runSaga(_ref, saga) {
21798
- var _ref$channel = _ref.channel,
21799
- channel = _ref$channel === void 0 ? stdChannel() : _ref$channel,
21800
- dispatch = _ref.dispatch,
21801
- getState = _ref.getState,
21802
- _ref$context = _ref.context,
21803
- context = _ref$context === void 0 ? {} : _ref$context,
21804
- sagaMonitor = _ref.sagaMonitor,
21805
- effectMiddlewares = _ref.effectMiddlewares,
21806
- _ref$onError = _ref.onError,
21807
- onError = _ref$onError === void 0 ? logError : _ref$onError;
21808
-
21809
- if (process.env.NODE_ENV !== 'production') {
21810
- check(saga, func, NON_GENERATOR_ERR);
21811
- }
21812
-
21813
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
21814
- args[_key - 2] = arguments[_key];
21815
- }
21816
-
21817
- var iterator$1 = saga.apply(void 0, args);
21818
-
21819
- if (process.env.NODE_ENV !== 'production') {
21820
- check(iterator$1, iterator, NON_GENERATOR_ERR);
21821
- }
21822
-
21823
- var effectId = nextSagaId();
21824
-
21825
- if (sagaMonitor) {
21826
- // monitors are expected to have a certain interface, let's fill-in any missing ones
21827
- sagaMonitor.rootSagaStarted = sagaMonitor.rootSagaStarted || noop;
21828
- sagaMonitor.effectTriggered = sagaMonitor.effectTriggered || noop;
21829
- sagaMonitor.effectResolved = sagaMonitor.effectResolved || noop;
21830
- sagaMonitor.effectRejected = sagaMonitor.effectRejected || noop;
21831
- sagaMonitor.effectCancelled = sagaMonitor.effectCancelled || noop;
21832
- sagaMonitor.actionDispatched = sagaMonitor.actionDispatched || noop;
21833
- sagaMonitor.rootSagaStarted({
21834
- effectId: effectId,
21835
- saga: saga,
21836
- args: args
21837
- });
21838
- }
21839
-
21840
- if (process.env.NODE_ENV !== 'production') {
21841
- if (notUndef(dispatch)) {
21842
- check(dispatch, func, 'dispatch must be a function');
21843
- }
21844
-
21845
- if (notUndef(getState)) {
21846
- check(getState, func, 'getState must be a function');
21847
- }
21848
-
21849
- if (notUndef(effectMiddlewares)) {
21850
- var MIDDLEWARE_TYPE_ERROR = 'effectMiddlewares must be an array of functions';
21851
- check(effectMiddlewares, array$1, MIDDLEWARE_TYPE_ERROR);
21852
- effectMiddlewares.forEach(function (effectMiddleware) {
21853
- return check(effectMiddleware, func, MIDDLEWARE_TYPE_ERROR);
21854
- });
21855
- }
21856
-
21857
- check(onError, func, 'onError passed to the redux-saga is not a function!');
21858
- }
21859
-
21860
- var finalizeRunEffect;
21861
-
21862
- if (effectMiddlewares) {
21863
- var middleware = compose.apply(void 0, effectMiddlewares);
21864
-
21865
- finalizeRunEffect = function finalizeRunEffect(runEffect) {
21866
- return function (effect, effectId, currCb) {
21867
- var plainRunEffect = function plainRunEffect(eff) {
21868
- return runEffect(eff, effectId, currCb);
21869
- };
21870
-
21871
- return middleware(plainRunEffect)(effect);
21872
- };
21873
- };
21874
- } else {
21875
- finalizeRunEffect = identity;
21876
- }
21877
-
21878
- var env = {
21879
- channel: channel,
21880
- dispatch: wrapSagaDispatch(dispatch),
21881
- getState: getState,
21882
- sagaMonitor: sagaMonitor,
21883
- onError: onError,
21884
- finalizeRunEffect: finalizeRunEffect
21885
- };
21886
- return immediately(function () {
21887
- var task = proc(env, iterator$1, context, effectId, getMetaInfo(saga),
21888
- /* isRoot */
21889
- true, undefined);
21890
-
21891
- if (sagaMonitor) {
21892
- sagaMonitor.effectResolved(effectId, task);
21893
- }
21894
-
21895
- return task;
21896
- });
21897
- }
21898
-
21899
- function sagaMiddlewareFactory(_temp) {
21900
- var _ref = {} ,
21901
- _ref$context = _ref.context,
21902
- context = _ref$context === void 0 ? {} : _ref$context,
21903
- _ref$channel = _ref.channel,
21904
- channel = _ref$channel === void 0 ? stdChannel() : _ref$channel,
21905
- sagaMonitor = _ref.sagaMonitor,
21906
- options = _objectWithoutPropertiesLoose(_ref, ["context", "channel", "sagaMonitor"]);
21907
-
21908
- var boundRunSaga;
21909
-
21910
- if (process.env.NODE_ENV !== 'production') {
21911
- check(channel, channel$1, 'options.channel passed to the Saga middleware is not a channel');
21912
- }
21913
-
21914
- function sagaMiddleware(_ref2) {
21915
- var getState = _ref2.getState,
21916
- dispatch = _ref2.dispatch;
21917
- boundRunSaga = runSaga.bind(null, _extends({}, options, {
21918
- context: context,
21919
- channel: channel,
21920
- dispatch: dispatch,
21921
- getState: getState,
21922
- sagaMonitor: sagaMonitor
21923
- }));
21924
- return function (next) {
21925
- return function (action) {
21926
- if (sagaMonitor && sagaMonitor.actionDispatched) {
21927
- sagaMonitor.actionDispatched(action);
21928
- }
21929
-
21930
- var result = next(action); // hit reducers
21931
-
21932
- channel.put(action);
21933
- return result;
21934
- };
21935
- };
21936
- }
21937
-
21938
- sagaMiddleware.run = function () {
21939
- if (process.env.NODE_ENV !== 'production' && !boundRunSaga) {
21940
- throw new Error('Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware');
21941
- }
21942
-
21943
- return boundRunSaga.apply(void 0, arguments);
21944
- };
21945
-
21946
- sagaMiddleware.setContext = function (props) {
21947
- if (process.env.NODE_ENV !== 'production') {
21948
- check(props, object, createSetContextWarning('sagaMiddleware', props));
21949
- }
19792
+ function* loadModelSaga(eventService, action) {
19793
+ yield call(handleViewModelChange, { call, put, select });
19794
+ }
19795
+ const createLoadModelSaga = (eventService) => function* (action) {
19796
+ yield* loadModelSaga();
19797
+ };
21950
19798
 
21951
- assignWithSymbols(context, props);
21952
- };
19799
+ function* updateViewModelSaga(eventService, action) {
19800
+ if (action.payload.callback) {
19801
+ const appState = yield select((state) => state.app);
19802
+ action.payload.callback(appState.viewModel);
19803
+ }
19804
+ yield call(handleViewModelChange, { call, put, select, action });
19805
+ }
19806
+ const createUpdateViewModelSaga = (eventService) => function* (action) {
19807
+ yield* updateViewModelSaga(eventService, action);
19808
+ };
21953
19809
 
21954
- return sagaMiddleware;
19810
+ function* watchLoadViewModel(eventService) {
19811
+ yield takeEvery(appActions.loadViewModel.type, createLoadViewModelSaga(eventService));
19812
+ }
19813
+ function* watchLoadModel(eventService) {
19814
+ yield takeEvery(appActions.loadModel.type, createLoadModelSaga());
19815
+ }
19816
+ function* watchUpdateViewModel(eventService) {
19817
+ yield takeEvery(appActions.updateViewModel.type, createUpdateViewModelSaga(eventService));
19818
+ }
19819
+ function* appSaga(eventService) {
19820
+ yield all([
19821
+ fork(watchLoadViewModel, eventService),
19822
+ fork(watchLoadModel, eventService),
19823
+ fork(watchUpdateViewModel, eventService),
19824
+ ]);
21955
19825
  }
21956
19826
 
21957
19827
  const syncStoresMiddleware = (rootStore) => (store) => (next) => (action) => {
@@ -21966,7 +19836,7 @@ const commonStore = configureStore({
21966
19836
  });
21967
19837
 
21968
19838
  const createStore = () => {
21969
- const saga = sagaMiddlewareFactory();
19839
+ const saga = createSagaMiddleware();
21970
19840
  return {
21971
19841
  store: configureStore({
21972
19842
  reducer: {
@@ -22368,28 +20238,13 @@ const Core = (coreProps) => {
22368
20238
  };
22369
20239
  var Core$1 = withNotification(Core);
22370
20240
 
22371
- // ProCode Core - Comprehensive Interface Exports
22372
- // This file exports all interfaces, types, and enums for external usage
22373
-
22374
- var interfaces = /*#__PURE__*/Object.freeze({
22375
- __proto__: null,
22376
- get AdapterType () { return AdapterType; },
22377
- EventService: EventService,
22378
- get ScreenUIType () { return ScreenUIType; },
22379
- get StandardActionType () { return StandardActionType; },
22380
- get StandardValidationType () { return StandardValidationType; },
22381
- get ValueReplacePolicy () { return ValueReplacePolicy; }
22382
- });
22383
-
22384
20241
  // ProCode Core - Main Library Entry Point
22385
20242
  // Comprehensive exports for npm library usage
22386
20243
  // Default Export - Core React Component
22387
20244
  // Core Styles Path (for SCSS imports)
22388
20245
  const coreStyles = './Assets/styles/index.scss';
22389
- const coreBaseStyles = './Assets/styles/_core-base.scss';
22390
20246
  // Utility function to get styles path
22391
- const getCoreStylesPath = () => coreStyles;
22392
- const getCoreBaseStylesPath = () => coreBaseStyles;
20247
+ const getCoreStylesPath = () => coreStyles;
22393
20248
 
22394
- export { AdapterType, Core$1 as Core, interfaces as Interfaces, StandardActionType, StandardValidationType, coreBaseStyles, coreStyles, Core$1 as default, getCoreBaseStylesPath, getCoreStylesPath };
20249
+ export { Core$1 as Core, EventService, coreStyles, Core$1 as default, getCoreStylesPath };
22395
20250
  //# sourceMappingURL=index.esm.js.map