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