@ailaw/venus 0.3.11 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/venus.es.js +182 -3765
- package/package.json +1 -1
package/dist/venus.es.js
CHANGED
|
@@ -17,13 +17,12 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { defineComponent, ref as ref$1, watch, computed, toRefs as toRefs$1, onMounted } from "vue-demi";
|
|
21
|
-
import { Select, Modal, Form, Input, Checkbox, Divider, Button, Tag, Tooltip, Upload, Row, Col, Radio, Table, Badge, message } from "ant-design-vue";
|
|
20
|
+
import { defineComponent, ref as ref$1, watch, computed, toRefs as toRefs$1, shallowRef, onMounted } from "vue-demi";
|
|
21
|
+
import { Select, Modal, Form, Input, Checkbox, Divider, Button, Tag, Tooltip, Upload, Row, Col, Radio, Table, Badge, Card, message } from "ant-design-vue";
|
|
22
22
|
import { useQuery, useResult, useMutation } from "@vue/apollo-composable";
|
|
23
23
|
import gql from "graphql-tag";
|
|
24
24
|
import { path, uniqBy, prop } from "ramda";
|
|
25
25
|
import "vue";
|
|
26
|
-
import { Source, visit } from "graphql";
|
|
27
26
|
var index$4 = "";
|
|
28
27
|
function __variableDynamicImportRuntime0__$1(path2) {
|
|
29
28
|
switch (path2) {
|
|
@@ -221,10 +220,10 @@ function useCreateProfile() {
|
|
|
221
220
|
const me = useMe();
|
|
222
221
|
const { mutate, loading } = useMutation(addProfileUserMutation);
|
|
223
222
|
const createProfile = async (profile) => {
|
|
224
|
-
var
|
|
223
|
+
var _a;
|
|
225
224
|
const variables = {
|
|
226
225
|
email: profile.email,
|
|
227
|
-
lawFirmId: (
|
|
226
|
+
lawFirmId: (_a = me.value) == null ? void 0 : _a.lawFirmId
|
|
228
227
|
};
|
|
229
228
|
if (profile.profileType === "USERPROFILE") {
|
|
230
229
|
variables.name = profile.profileName;
|
|
@@ -374,8 +373,8 @@ var __vue2_script$d = defineComponent({
|
|
|
374
373
|
},
|
|
375
374
|
setup(props, { emit }) {
|
|
376
375
|
const selectedId = computed(() => {
|
|
377
|
-
var
|
|
378
|
-
return (
|
|
376
|
+
var _a;
|
|
377
|
+
return (_a = props.value) == null ? void 0 : _a.id;
|
|
379
378
|
});
|
|
380
379
|
const handleSelect = (value) => emit("input", props.source.find((v) => String(v.id) == value));
|
|
381
380
|
const handleProfileCreate = () => emit("create-profile");
|
|
@@ -411,9 +410,9 @@ var ProfileSelector = /* @__PURE__ */ function() {
|
|
|
411
410
|
function useProfiles(keywords, onlyRole, profileIds) {
|
|
412
411
|
const me = useMe();
|
|
413
412
|
const { result, loading } = useQuery(profilesQuery, () => {
|
|
414
|
-
var
|
|
413
|
+
var _a;
|
|
415
414
|
return {
|
|
416
|
-
lawFirmId: (
|
|
415
|
+
lawFirmId: (_a = me.value) == null ? void 0 : _a.lawFirmId,
|
|
417
416
|
keywords: keywords.value,
|
|
418
417
|
profileType: onlyRole.value,
|
|
419
418
|
profileIds: profileIds.value
|
|
@@ -843,7 +842,7 @@ var __vue2_script$9 = defineComponent({
|
|
|
843
842
|
[k]: v
|
|
844
843
|
}));
|
|
845
844
|
};
|
|
846
|
-
const
|
|
845
|
+
const remove = (id) => {
|
|
847
846
|
emit("change", props.value.filter((v) => v.id !== id));
|
|
848
847
|
};
|
|
849
848
|
const beforeUpload = (file) => {
|
|
@@ -874,7 +873,7 @@ var __vue2_script$9 = defineComponent({
|
|
|
874
873
|
};
|
|
875
874
|
return {
|
|
876
875
|
changeVal,
|
|
877
|
-
remove
|
|
876
|
+
remove,
|
|
878
877
|
beforeUpload,
|
|
879
878
|
loading,
|
|
880
879
|
allowFiles: [
|
|
@@ -913,10 +912,10 @@ var AFileUploader = /* @__PURE__ */ function() {
|
|
|
913
912
|
return __component__$9.exports;
|
|
914
913
|
}();
|
|
915
914
|
var refactorParams = (record) => {
|
|
916
|
-
var
|
|
915
|
+
var _a;
|
|
917
916
|
return {
|
|
918
917
|
id: record.id,
|
|
919
|
-
sampleDocList: ((
|
|
918
|
+
sampleDocList: ((_a = record.sampleDocs) == null ? void 0 : _a.map(({ id }) => id)) || [],
|
|
920
919
|
taskName: record.taskName,
|
|
921
920
|
isEmployee: record.isEmployee || AssigneeTypes[AssigneeTypes.EMPTY_DEFAULT],
|
|
922
921
|
generalTaskType: record.generalTaskType,
|
|
@@ -1219,7 +1218,7 @@ function __vue2_injectStyles$6(context) {
|
|
|
1219
1218
|
var TaskTemplateFilter = /* @__PURE__ */ function() {
|
|
1220
1219
|
return __component__$6.exports;
|
|
1221
1220
|
}();
|
|
1222
|
-
var toString
|
|
1221
|
+
var toString = function(x) {
|
|
1223
1222
|
return Object.prototype.toString.call(x);
|
|
1224
1223
|
};
|
|
1225
1224
|
function isNative(Ctor) {
|
|
@@ -1229,8 +1228,8 @@ var hasSymbol = typeof Symbol !== "undefined" && isNative(Symbol) && typeof Refl
|
|
|
1229
1228
|
var noopFn = function(_) {
|
|
1230
1229
|
return _;
|
|
1231
1230
|
};
|
|
1232
|
-
function proxy(target, key,
|
|
1233
|
-
var get2 =
|
|
1231
|
+
function proxy(target, key, _a) {
|
|
1232
|
+
var get2 = _a.get, set2 = _a.set;
|
|
1234
1233
|
Object.defineProperty(target, key, {
|
|
1235
1234
|
enumerable: true,
|
|
1236
1235
|
configurable: true,
|
|
@@ -1246,7 +1245,7 @@ function def(obj, key, val, enumerable) {
|
|
|
1246
1245
|
configurable: true
|
|
1247
1246
|
});
|
|
1248
1247
|
}
|
|
1249
|
-
function hasOwn
|
|
1248
|
+
function hasOwn(obj, key) {
|
|
1250
1249
|
return Object.hasOwnProperty.call(obj, key);
|
|
1251
1250
|
}
|
|
1252
1251
|
function isArray(x) {
|
|
@@ -1261,7 +1260,7 @@ function isObject(val) {
|
|
|
1261
1260
|
return val !== null && typeof val === "object";
|
|
1262
1261
|
}
|
|
1263
1262
|
function isPlainObject(x) {
|
|
1264
|
-
return toString
|
|
1263
|
+
return toString(x) === "[object Object]";
|
|
1265
1264
|
}
|
|
1266
1265
|
function isFunction(x) {
|
|
1267
1266
|
return typeof x === "function";
|
|
@@ -1280,24 +1279,24 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
1280
1279
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1281
1280
|
PERFORMANCE OF THIS SOFTWARE.
|
|
1282
1281
|
***************************************************************************** */
|
|
1283
|
-
var extendStatics
|
|
1284
|
-
extendStatics
|
|
1282
|
+
var extendStatics = function(d, b) {
|
|
1283
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
1285
1284
|
d2.__proto__ = b2;
|
|
1286
1285
|
} || function(d2, b2) {
|
|
1287
1286
|
for (var p in b2)
|
|
1288
1287
|
if (Object.prototype.hasOwnProperty.call(b2, p))
|
|
1289
1288
|
d2[p] = b2[p];
|
|
1290
1289
|
};
|
|
1291
|
-
return extendStatics
|
|
1290
|
+
return extendStatics(d, b);
|
|
1292
1291
|
};
|
|
1293
|
-
function __extends
|
|
1292
|
+
function __extends(d, b) {
|
|
1294
1293
|
if (typeof b !== "function" && b !== null)
|
|
1295
1294
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1296
|
-
extendStatics
|
|
1297
|
-
function
|
|
1295
|
+
extendStatics(d, b);
|
|
1296
|
+
function __() {
|
|
1298
1297
|
this.constructor = d;
|
|
1299
1298
|
}
|
|
1300
|
-
d.prototype = b === null ? Object.create(b) : (
|
|
1299
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1301
1300
|
}
|
|
1302
1301
|
function __values(o) {
|
|
1303
1302
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
@@ -1360,7 +1359,7 @@ var EffectScopeImpl = function() {
|
|
|
1360
1359
|
return EffectScopeImpl2;
|
|
1361
1360
|
}();
|
|
1362
1361
|
(function(_super) {
|
|
1363
|
-
__extends
|
|
1362
|
+
__extends(EffectScope, _super);
|
|
1364
1363
|
function EffectScope(detached) {
|
|
1365
1364
|
if (detached === void 0) {
|
|
1366
1365
|
detached = false;
|
|
@@ -1379,13 +1378,13 @@ var EffectScopeImpl = function() {
|
|
|
1379
1378
|
return EffectScope;
|
|
1380
1379
|
})(EffectScopeImpl);
|
|
1381
1380
|
function recordEffectScope(effect, scope) {
|
|
1382
|
-
var
|
|
1381
|
+
var _a;
|
|
1383
1382
|
scope = scope || activeEffectScope;
|
|
1384
1383
|
if (scope && scope.active) {
|
|
1385
1384
|
scope.effects.push(effect);
|
|
1386
1385
|
return;
|
|
1387
1386
|
}
|
|
1388
|
-
var vm = (
|
|
1387
|
+
var vm = (_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy;
|
|
1389
1388
|
vm && vm.$on("hook:destroyed", function() {
|
|
1390
1389
|
return effect.stop();
|
|
1391
1390
|
});
|
|
@@ -1411,7 +1410,7 @@ try {
|
|
|
1411
1410
|
} else if (requiredVue && "default" in requiredVue && isVue(requiredVue.default)) {
|
|
1412
1411
|
vueDependency = requiredVue.default;
|
|
1413
1412
|
}
|
|
1414
|
-
} catch (
|
|
1413
|
+
} catch (_a) {
|
|
1415
1414
|
}
|
|
1416
1415
|
var vueConstructor = null;
|
|
1417
1416
|
var currentInstance = null;
|
|
@@ -1421,7 +1420,7 @@ function isVue(obj) {
|
|
|
1421
1420
|
return obj && isFunction(obj) && obj.name === "Vue";
|
|
1422
1421
|
}
|
|
1423
1422
|
function isVueRegistered(Vue) {
|
|
1424
|
-
return vueConstructor && hasOwn
|
|
1423
|
+
return vueConstructor && hasOwn(Vue, PluginInstalledFlag);
|
|
1425
1424
|
}
|
|
1426
1425
|
function getVueConstructor() {
|
|
1427
1426
|
return vueConstructor;
|
|
@@ -1569,12 +1568,12 @@ var accessModifiedSet = new WeakMap();
|
|
|
1569
1568
|
var readonlySet = new WeakMap();
|
|
1570
1569
|
function set$1(target, key, val) {
|
|
1571
1570
|
var Vue = getVueConstructor();
|
|
1572
|
-
var
|
|
1573
|
-
|
|
1574
|
-
var defineReactive =
|
|
1571
|
+
var _a = Vue.util;
|
|
1572
|
+
_a.warn;
|
|
1573
|
+
var defineReactive = _a.defineReactive;
|
|
1575
1574
|
var ob = target.__ob__;
|
|
1576
1575
|
function ssrMockReactivity() {
|
|
1577
|
-
if (ob && isObject(val) && !hasOwn
|
|
1576
|
+
if (ob && isObject(val) && !hasOwn(val, "__ob__")) {
|
|
1578
1577
|
mockReactivityDeep(val);
|
|
1579
1578
|
}
|
|
1580
1579
|
}
|
|
@@ -1609,8 +1608,8 @@ function set$1(target, key, val) {
|
|
|
1609
1608
|
return val;
|
|
1610
1609
|
}
|
|
1611
1610
|
var RefImpl = function() {
|
|
1612
|
-
function RefImpl2(
|
|
1613
|
-
var get2 =
|
|
1611
|
+
function RefImpl2(_a) {
|
|
1612
|
+
var get2 = _a.get, set2 = _a.set;
|
|
1614
1613
|
proxy(this, "value", {
|
|
1615
1614
|
get: get2,
|
|
1616
1615
|
set: set2
|
|
@@ -1634,11 +1633,11 @@ function createRef(options, isReadonly, isComputed) {
|
|
|
1634
1633
|
return sealed;
|
|
1635
1634
|
}
|
|
1636
1635
|
function ref(raw) {
|
|
1637
|
-
var
|
|
1636
|
+
var _a;
|
|
1638
1637
|
if (isRef(raw)) {
|
|
1639
1638
|
return raw;
|
|
1640
1639
|
}
|
|
1641
|
-
var value = reactive((
|
|
1640
|
+
var value = reactive((_a = {}, _a[RefKey] = raw, _a));
|
|
1642
1641
|
return createRef({
|
|
1643
1642
|
get: function() {
|
|
1644
1643
|
return value[RefKey];
|
|
@@ -1676,12 +1675,12 @@ function toRef(object, key) {
|
|
|
1676
1675
|
});
|
|
1677
1676
|
}
|
|
1678
1677
|
function isRaw(obj) {
|
|
1679
|
-
var
|
|
1680
|
-
return Boolean(obj && hasOwn
|
|
1678
|
+
var _a;
|
|
1679
|
+
return Boolean(obj && hasOwn(obj, "__ob__") && typeof obj.__ob__ === "object" && ((_a = obj.__ob__) === null || _a === void 0 ? void 0 : _a.__raw__));
|
|
1681
1680
|
}
|
|
1682
1681
|
function isReactive(obj) {
|
|
1683
|
-
var
|
|
1684
|
-
return Boolean(obj && hasOwn
|
|
1682
|
+
var _a;
|
|
1683
|
+
return Boolean(obj && hasOwn(obj, "__ob__") && typeof obj.__ob__ === "object" && !((_a = obj.__ob__) === null || _a === void 0 ? void 0 : _a.__raw__));
|
|
1685
1684
|
}
|
|
1686
1685
|
function setupAccessControl(target) {
|
|
1687
1686
|
if (!isPlainObject(target) || isRaw(target) || isArray(target) || isRef(target) || isComponentInstance(target) || accessModifiedSet.has(target))
|
|
@@ -1748,17 +1747,17 @@ function observe(obj) {
|
|
|
1748
1747
|
});
|
|
1749
1748
|
observed = vm._data.$$state;
|
|
1750
1749
|
}
|
|
1751
|
-
if (!hasOwn
|
|
1750
|
+
if (!hasOwn(observed, "__ob__")) {
|
|
1752
1751
|
mockReactivityDeep(observed);
|
|
1753
1752
|
}
|
|
1754
1753
|
return observed;
|
|
1755
1754
|
}
|
|
1756
1755
|
function mockReactivityDeep(obj, seen) {
|
|
1757
|
-
var e_1,
|
|
1756
|
+
var e_1, _a;
|
|
1758
1757
|
if (seen === void 0) {
|
|
1759
1758
|
seen = new Set();
|
|
1760
1759
|
}
|
|
1761
|
-
if (seen.has(obj) || hasOwn
|
|
1760
|
+
if (seen.has(obj) || hasOwn(obj, "__ob__") || !Object.isExtensible(obj))
|
|
1762
1761
|
return;
|
|
1763
1762
|
def(obj, "__ob__", mockObserver(obj));
|
|
1764
1763
|
seen.add(obj);
|
|
@@ -1775,8 +1774,8 @@ function mockReactivityDeep(obj, seen) {
|
|
|
1775
1774
|
e_1 = { error: e_1_1 };
|
|
1776
1775
|
} finally {
|
|
1777
1776
|
try {
|
|
1778
|
-
if (_c && !_c.done && (
|
|
1779
|
-
|
|
1777
|
+
if (_c && !_c.done && (_a = _b.return))
|
|
1778
|
+
_a.call(_b);
|
|
1780
1779
|
} finally {
|
|
1781
1780
|
if (e_1)
|
|
1782
1781
|
throw e_1.error;
|
|
@@ -1824,7 +1823,7 @@ var vmStateManager = {
|
|
|
1824
1823
|
};
|
|
1825
1824
|
function asVmProperty(vm, propName, propValue) {
|
|
1826
1825
|
var props = vm.$options.props;
|
|
1827
|
-
if (!(propName in vm) && !(props && hasOwn
|
|
1826
|
+
if (!(propName in vm) && !(props && hasOwn(props, propName))) {
|
|
1828
1827
|
if (isRef(propValue)) {
|
|
1829
1828
|
proxy(vm, propName, {
|
|
1830
1829
|
get: function() {
|
|
@@ -1875,7 +1874,7 @@ function updateTemplateRef(vm) {
|
|
|
1875
1874
|
vmStateManager.set(vm, "refs", validNewKeys);
|
|
1876
1875
|
}
|
|
1877
1876
|
function updateVmAttrs(vm, ctx) {
|
|
1878
|
-
var e_1,
|
|
1877
|
+
var e_1, _a;
|
|
1879
1878
|
if (!vm) {
|
|
1880
1879
|
return;
|
|
1881
1880
|
}
|
|
@@ -1897,7 +1896,7 @@ function updateVmAttrs(vm, ctx) {
|
|
|
1897
1896
|
}
|
|
1898
1897
|
var source = vm.$attrs;
|
|
1899
1898
|
var _loop_1 = function(attr2) {
|
|
1900
|
-
if (!hasOwn
|
|
1899
|
+
if (!hasOwn(attrBindings.data, attr2)) {
|
|
1901
1900
|
proxy(attrBindings.data, attr2, {
|
|
1902
1901
|
get: function() {
|
|
1903
1902
|
return vm.$attrs[attr2];
|
|
@@ -1914,8 +1913,8 @@ function updateVmAttrs(vm, ctx) {
|
|
|
1914
1913
|
e_1 = { error: e_1_1 };
|
|
1915
1914
|
} finally {
|
|
1916
1915
|
try {
|
|
1917
|
-
if (_c && !_c.done && (
|
|
1918
|
-
|
|
1916
|
+
if (_c && !_c.done && (_a = _b.return))
|
|
1917
|
+
_a.call(_b);
|
|
1919
1918
|
} finally {
|
|
1920
1919
|
if (e_1)
|
|
1921
1920
|
throw e_1.error;
|
|
@@ -1968,9 +1967,9 @@ function mixin(Vue) {
|
|
|
1968
1967
|
updateVmAttrs(this);
|
|
1969
1968
|
},
|
|
1970
1969
|
updated: function() {
|
|
1971
|
-
var
|
|
1970
|
+
var _a;
|
|
1972
1971
|
updateTemplateRef(this);
|
|
1973
|
-
if ((
|
|
1972
|
+
if ((_a = this.$vnode) === null || _a === void 0 ? void 0 : _a.context) {
|
|
1974
1973
|
updateTemplateRef(this.$vnode.context);
|
|
1975
1974
|
}
|
|
1976
1975
|
}
|
|
@@ -2152,7 +2151,7 @@ function mergeData(from, to) {
|
|
|
2152
2151
|
continue;
|
|
2153
2152
|
toVal = to[key];
|
|
2154
2153
|
fromVal = from[key];
|
|
2155
|
-
if (!hasOwn
|
|
2154
|
+
if (!hasOwn(to, key)) {
|
|
2156
2155
|
to[key] = fromVal;
|
|
2157
2156
|
} else if (toVal !== fromVal && isPlainObject(toVal) && !isRef(toVal) && isPlainObject(fromVal) && !isRef(fromVal)) {
|
|
2158
2157
|
mergeData(fromVal, toVal);
|
|
@@ -2160,7 +2159,7 @@ function mergeData(from, to) {
|
|
|
2160
2159
|
}
|
|
2161
2160
|
return to;
|
|
2162
2161
|
}
|
|
2163
|
-
function install
|
|
2162
|
+
function install(Vue) {
|
|
2164
2163
|
if (isVueRegistered(Vue)) {
|
|
2165
2164
|
return;
|
|
2166
2165
|
}
|
|
@@ -2174,7 +2173,7 @@ function install$1(Vue) {
|
|
|
2174
2173
|
}
|
|
2175
2174
|
var Plugin = {
|
|
2176
2175
|
install: function(Vue) {
|
|
2177
|
-
return install
|
|
2176
|
+
return install(Vue);
|
|
2178
2177
|
}
|
|
2179
2178
|
};
|
|
2180
2179
|
if (typeof window !== "undefined" && window.Vue) {
|
|
@@ -2372,12 +2371,12 @@ var useTaskTemplateTableData = (props, emit) => {
|
|
|
2372
2371
|
const { conditions = useSearchTaskConditions(), addedTasks = ref$1([]) } = toRefs$1(props);
|
|
2373
2372
|
const { result, loading, refetch } = useSearchTaskTemplates(initialPagination, conditions, props.lawFirmId);
|
|
2374
2373
|
const dataSource = computed(() => {
|
|
2375
|
-
var
|
|
2376
|
-
return ((
|
|
2374
|
+
var _a;
|
|
2375
|
+
return ((_a = result.value) == null ? void 0 : _a.taskTemplateSearch.taskTemplateList) || [];
|
|
2377
2376
|
});
|
|
2378
2377
|
const total = computed(() => {
|
|
2379
|
-
var
|
|
2380
|
-
return ((
|
|
2378
|
+
var _a;
|
|
2379
|
+
return ((_a = result.value) == null ? void 0 : _a.taskTemplateSearch.numResult) || 0;
|
|
2381
2380
|
});
|
|
2382
2381
|
const pagination = computed(() => __spreadProps(__spreadValues({}, initialPagination.value), {
|
|
2383
2382
|
total: total.value
|
|
@@ -2412,7 +2411,6 @@ var __vue2_script$4 = defineComponent({
|
|
|
2412
2411
|
},
|
|
2413
2412
|
addedTasks: {
|
|
2414
2413
|
type: Array,
|
|
2415
|
-
required: true,
|
|
2416
2414
|
default: () => []
|
|
2417
2415
|
},
|
|
2418
2416
|
lawFirmId: {
|
|
@@ -2436,8 +2434,8 @@ var __vue2_script$4 = defineComponent({
|
|
|
2436
2434
|
refetch,
|
|
2437
2435
|
dataSource,
|
|
2438
2436
|
pagination,
|
|
2439
|
-
changePagination,
|
|
2440
2437
|
AssigneeTypesText,
|
|
2438
|
+
changePagination,
|
|
2441
2439
|
addTask,
|
|
2442
2440
|
editTask,
|
|
2443
2441
|
removeTask
|
|
@@ -2450,12 +2448,12 @@ var render$4 = function() {
|
|
|
2450
2448
|
var _c = _vm._self._c || _h;
|
|
2451
2449
|
return _c("div", [_vm._t("default", function() {
|
|
2452
2450
|
return [_c("task-table-pure", { attrs: { "loading": _vm.loading, "data-source": _vm.dataSource, "pagination": _vm.pagination, "added-tasks": _vm.addedTasks }, on: { "editTask": _vm.editTask, "addTask": _vm.addTask, "removeTask": _vm.removeTask, "changePagination": _vm.changePagination } })];
|
|
2453
|
-
}, { "
|
|
2451
|
+
}, { "loading": _vm.loading, "dataSource": _vm.dataSource, "pagination": _vm.pagination, "AssigneeTypesText": _vm.AssigneeTypesText, "changePagination": _vm.changePagination })], 2);
|
|
2454
2452
|
};
|
|
2455
2453
|
var staticRenderFns$4 = [];
|
|
2456
2454
|
var TaskTable_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
2457
2455
|
const __cssModules$4 = {};
|
|
2458
|
-
var __component__$4 = /* @__PURE__ */ normalizeComponent(__vue2_script$4, render$4, staticRenderFns$4, false, __vue2_injectStyles$4, "
|
|
2456
|
+
var __component__$4 = /* @__PURE__ */ normalizeComponent(__vue2_script$4, render$4, staticRenderFns$4, false, __vue2_injectStyles$4, "5c367cce", null, null);
|
|
2459
2457
|
function __vue2_injectStyles$4(context) {
|
|
2460
2458
|
for (let o in __cssModules$4) {
|
|
2461
2459
|
this[o] = __cssModules$4[o];
|
|
@@ -2469,7 +2467,6 @@ var __vue2_script$3 = defineComponent({
|
|
|
2469
2467
|
components: {
|
|
2470
2468
|
TaskTable,
|
|
2471
2469
|
TaskTemplateFilter,
|
|
2472
|
-
AntModal: Modal,
|
|
2473
2470
|
AntButton: Button,
|
|
2474
2471
|
AntBadge: Badge
|
|
2475
2472
|
},
|
|
@@ -2479,25 +2476,33 @@ var __vue2_script$3 = defineComponent({
|
|
|
2479
2476
|
default: false
|
|
2480
2477
|
},
|
|
2481
2478
|
addedTasks: {
|
|
2482
|
-
type: Array
|
|
2483
|
-
required: true
|
|
2479
|
+
type: Array
|
|
2484
2480
|
},
|
|
2485
2481
|
lawFirmId: {
|
|
2486
2482
|
type: Number,
|
|
2487
2483
|
required: true
|
|
2488
2484
|
},
|
|
2489
2485
|
taskSettingPageUrl: {
|
|
2490
|
-
type: String
|
|
2491
|
-
|
|
2486
|
+
type: String
|
|
2487
|
+
},
|
|
2488
|
+
showPage: {
|
|
2489
|
+
type: Boolean,
|
|
2490
|
+
default: false
|
|
2492
2491
|
}
|
|
2493
2492
|
},
|
|
2494
|
-
setup() {
|
|
2493
|
+
setup(props, { emit }) {
|
|
2495
2494
|
const taskTable = ref$1(null);
|
|
2496
2495
|
const conditions = useSearchTaskConditions();
|
|
2496
|
+
const currentComponent = shallowRef(props.showPage ? Card : Modal);
|
|
2497
|
+
const editAction = (record) => {
|
|
2498
|
+
emit("edit", record);
|
|
2499
|
+
};
|
|
2497
2500
|
return {
|
|
2501
|
+
editAction,
|
|
2498
2502
|
taskTable,
|
|
2499
2503
|
conditions,
|
|
2500
|
-
AssigneeTypes
|
|
2504
|
+
AssigneeTypes,
|
|
2505
|
+
currentComponent
|
|
2501
2506
|
};
|
|
2502
2507
|
}
|
|
2503
2508
|
});
|
|
@@ -2505,7 +2510,7 @@ var render$3 = function() {
|
|
|
2505
2510
|
var _vm = this;
|
|
2506
2511
|
var _h = _vm.$createElement;
|
|
2507
2512
|
var _c = _vm._self._c || _h;
|
|
2508
|
-
return _c("
|
|
2513
|
+
return _c(_vm.currentComponent, { tag: "component", staticClass: "task-cart-main-modal", attrs: { "zIndex": 800, "width": 900, "visible": _vm.visible, "title": _vm.showPage ? _vm.$t("message.tasks") : _vm.$t("message.addTask") }, on: { "cancel": function($event) {
|
|
2509
2514
|
return _vm.$emit("update:visible", false);
|
|
2510
2515
|
} }, scopedSlots: _vm._u([{ key: "footer", fn: function() {
|
|
2511
2516
|
return [_c("ant-button", { staticStyle: { "margin-right": "20px" }, on: { "click": function($event) {
|
|
@@ -2513,7 +2518,7 @@ var render$3 = function() {
|
|
|
2513
2518
|
} } }, [_vm._v("Cancel ")]), _c("ant-badge", { attrs: { "count": _vm.addedTasks.length } }, [_c("ant-button", { attrs: { "disabled": _vm.addedTasks.length === 0, "type": "primary" }, on: { "click": function($event) {
|
|
2514
2519
|
return _vm.$emit("update:reviewModalVisible", true);
|
|
2515
2520
|
} } }, [_vm._v(" " + _vm._s(_vm.$t("message.reviewTasks")) + " ")])], 1)];
|
|
2516
|
-
}, proxy: true }]) }, [_c("task-template-filter", { attrs: { "show-task-home-page-link": true, "task-setting-page-url": _vm.taskSettingPageUrl, "conditions": _vm.conditions }, on: { "update:conditions": function($event) {
|
|
2521
|
+
}, proxy: true }]) }, [_c("task-template-filter", { attrs: { "show-task-home-page-link": true, "task-setting-page-url": _vm.taskSettingPageUrl, "conditions": _vm.conditions, "inline": !!_vm.showPage }, on: { "update:conditions": function($event) {
|
|
2517
2522
|
_vm.conditions = $event;
|
|
2518
2523
|
}, "update:newTaskVisible": function($event) {
|
|
2519
2524
|
return _vm.$emit("update:newTaskVisible", true);
|
|
@@ -2523,12 +2528,18 @@ var render$3 = function() {
|
|
|
2523
2528
|
return _vm.$emit("update:tempTask", $event);
|
|
2524
2529
|
}, "update:newTaskVisible": function($event) {
|
|
2525
2530
|
return _vm.$emit("update:newTaskVisible", $event);
|
|
2526
|
-
} }
|
|
2531
|
+
} }, scopedSlots: _vm._u([{ key: "default", fn: function(ref2) {
|
|
2532
|
+
var loading = ref2.loading;
|
|
2533
|
+
var dataSource = ref2.dataSource;
|
|
2534
|
+
var pagination = ref2.pagination;
|
|
2535
|
+
var changePagination = ref2.changePagination;
|
|
2536
|
+
return [_vm._t("default", null, { "editAction": _vm.editAction, "loading": loading, "dataSource": dataSource, "pagination": pagination, "changePagination": changePagination })];
|
|
2537
|
+
} }], null, true) })], 1);
|
|
2527
2538
|
};
|
|
2528
2539
|
var staticRenderFns$3 = [];
|
|
2529
2540
|
var MainModal_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
2530
2541
|
const __cssModules$3 = {};
|
|
2531
|
-
var __component__$3 = /* @__PURE__ */ normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3, "
|
|
2542
|
+
var __component__$3 = /* @__PURE__ */ normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3, "012c6784", null, null);
|
|
2532
2543
|
function __vue2_injectStyles$3(context) {
|
|
2533
2544
|
for (let o in __cssModules$3) {
|
|
2534
2545
|
this[o] = __cssModules$3[o];
|
|
@@ -2631,14 +2642,14 @@ var ReviewModal = /* @__PURE__ */ function() {
|
|
|
2631
2642
|
const useMutateTaskTemplate = () => useMutation(UpdateTaskTemplateMutation);
|
|
2632
2643
|
const useCreateTaskTemplate = () => useMutation(CreateTaskTemplateMutation);
|
|
2633
2644
|
const submit = async (record, updateTemplate, createTemplate) => {
|
|
2634
|
-
var
|
|
2645
|
+
var _a, _b, _c, _d;
|
|
2635
2646
|
let newRecord = {};
|
|
2636
2647
|
let res;
|
|
2637
2648
|
let success;
|
|
2638
2649
|
const isUpdate = !!record.taskTemplateId;
|
|
2639
2650
|
if (isUpdate) {
|
|
2640
2651
|
res = await updateTemplate.mutate(record);
|
|
2641
|
-
newRecord = ((
|
|
2652
|
+
newRecord = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.updateTaskTemplate.updatedTaskTemplate) || {};
|
|
2642
2653
|
success = ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.updateTaskTemplate.code) === ResponseCode.success;
|
|
2643
2654
|
} else {
|
|
2644
2655
|
res = await createTemplate.mutate(record);
|
|
@@ -2698,3692 +2709,88 @@ const CreateTaskTemplateMutation = gql`
|
|
|
2698
2709
|
}
|
|
2699
2710
|
${taskTemplateFragment}
|
|
2700
2711
|
`;
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
purpose with or without fee is hereby granted.
|
|
2706
|
-
|
|
2707
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2708
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2709
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2710
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2711
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2712
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2713
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2714
|
-
***************************************************************************** */
|
|
2715
|
-
var extendStatics = function(d, b) {
|
|
2716
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
2717
|
-
d2.__proto__ = b2;
|
|
2718
|
-
} || function(d2, b2) {
|
|
2719
|
-
for (var p in b2)
|
|
2720
|
-
if (Object.prototype.hasOwnProperty.call(b2, p))
|
|
2721
|
-
d2[p] = b2[p];
|
|
2722
|
-
};
|
|
2723
|
-
return extendStatics(d, b);
|
|
2724
|
-
};
|
|
2725
|
-
function __extends(d, b) {
|
|
2726
|
-
if (typeof b !== "function" && b !== null)
|
|
2727
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2728
|
-
extendStatics(d, b);
|
|
2729
|
-
function __2() {
|
|
2730
|
-
this.constructor = d;
|
|
2731
|
-
}
|
|
2732
|
-
d.prototype = b === null ? Object.create(b) : (__2.prototype = b.prototype, new __2());
|
|
2733
|
-
}
|
|
2734
|
-
var __assign = function() {
|
|
2735
|
-
__assign = Object.assign || function __assign2(t) {
|
|
2736
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2737
|
-
s = arguments[i];
|
|
2738
|
-
for (var p in s)
|
|
2739
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
2740
|
-
t[p] = s[p];
|
|
2741
|
-
}
|
|
2742
|
-
return t;
|
|
2743
|
-
};
|
|
2744
|
-
return __assign.apply(this, arguments);
|
|
2712
|
+
const defaultTaskTemplate = {
|
|
2713
|
+
taskTemplateObj: {},
|
|
2714
|
+
isAddedToTask: false,
|
|
2715
|
+
isNotified: false
|
|
2745
2716
|
};
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
}
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
}
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
}
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
return function() {
|
|
2797
|
-
if (verbosityLevels.indexOf(name) >= verbosityLevel) {
|
|
2798
|
-
var method = console[name] || console.log;
|
|
2799
|
-
return method.apply(console, arguments);
|
|
2800
|
-
}
|
|
2801
|
-
};
|
|
2802
|
-
}
|
|
2803
|
-
(function(invariant2) {
|
|
2804
|
-
invariant2.debug = wrapConsoleMethod("debug");
|
|
2805
|
-
invariant2.log = wrapConsoleMethod("log");
|
|
2806
|
-
invariant2.warn = wrapConsoleMethod("warn");
|
|
2807
|
-
invariant2.error = wrapConsoleMethod("error");
|
|
2808
|
-
})(invariant || (invariant = {}));
|
|
2809
|
-
function maybe$1(thunk) {
|
|
2810
|
-
try {
|
|
2811
|
-
return thunk();
|
|
2812
|
-
} catch (_a2) {
|
|
2813
|
-
}
|
|
2814
|
-
}
|
|
2815
|
-
var global$1 = maybe$1(function() {
|
|
2816
|
-
return globalThis;
|
|
2817
|
-
}) || maybe$1(function() {
|
|
2818
|
-
return window;
|
|
2819
|
-
}) || maybe$1(function() {
|
|
2820
|
-
return self;
|
|
2821
|
-
}) || maybe$1(function() {
|
|
2822
|
-
return global;
|
|
2823
|
-
}) || maybe$1(function() {
|
|
2824
|
-
return maybe$1.constructor("return this")();
|
|
2825
|
-
});
|
|
2826
|
-
var __ = "__";
|
|
2827
|
-
var GLOBAL_KEY = [__, __].join("DEV");
|
|
2828
|
-
function getDEV() {
|
|
2829
|
-
try {
|
|
2830
|
-
return Boolean(__DEV__);
|
|
2831
|
-
} catch (_a2) {
|
|
2832
|
-
Object.defineProperty(global$1, GLOBAL_KEY, {
|
|
2833
|
-
value: maybe$1(function() {
|
|
2834
|
-
return "production";
|
|
2835
|
-
}) !== "production",
|
|
2836
|
-
enumerable: false,
|
|
2837
|
-
configurable: true,
|
|
2838
|
-
writable: true
|
|
2839
|
-
});
|
|
2840
|
-
return global$1[GLOBAL_KEY];
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
var DEV = getDEV();
|
|
2844
|
-
function maybe(thunk) {
|
|
2845
|
-
try {
|
|
2846
|
-
return thunk();
|
|
2847
|
-
} catch (_) {
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
var safeGlobal = maybe(function() {
|
|
2851
|
-
return globalThis;
|
|
2852
|
-
}) || maybe(function() {
|
|
2853
|
-
return window;
|
|
2854
|
-
}) || maybe(function() {
|
|
2855
|
-
return self;
|
|
2856
|
-
}) || maybe(function() {
|
|
2857
|
-
return global;
|
|
2858
|
-
}) || maybe(function() {
|
|
2859
|
-
return maybe.constructor("return this")();
|
|
2860
|
-
});
|
|
2861
|
-
var needToRemove = false;
|
|
2862
|
-
function install() {
|
|
2863
|
-
if (safeGlobal && !maybe(function() {
|
|
2864
|
-
return "production";
|
|
2865
|
-
}) && !maybe(function() {
|
|
2866
|
-
return process;
|
|
2867
|
-
})) {
|
|
2868
|
-
Object.defineProperty(safeGlobal, "process", {
|
|
2869
|
-
value: {
|
|
2870
|
-
env: {
|
|
2871
|
-
NODE_ENV: "production"
|
|
2872
|
-
}
|
|
2873
|
-
},
|
|
2874
|
-
configurable: true,
|
|
2875
|
-
enumerable: false,
|
|
2876
|
-
writable: true
|
|
2877
|
-
});
|
|
2878
|
-
needToRemove = true;
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
install();
|
|
2882
|
-
function remove() {
|
|
2883
|
-
if (needToRemove) {
|
|
2884
|
-
delete safeGlobal.process;
|
|
2885
|
-
needToRemove = false;
|
|
2886
|
-
}
|
|
2887
|
-
}
|
|
2888
|
-
function removeTemporaryGlobals() {
|
|
2889
|
-
return typeof Source === "function" ? remove() : remove();
|
|
2890
|
-
}
|
|
2891
|
-
function checkDEV() {
|
|
2892
|
-
__DEV__ ? invariant(typeof DEV === "boolean", DEV) : invariant(typeof DEV === "boolean", 36);
|
|
2893
|
-
}
|
|
2894
|
-
removeTemporaryGlobals();
|
|
2895
|
-
checkDEV();
|
|
2896
|
-
function shouldInclude(_a2, variables) {
|
|
2897
|
-
var directives = _a2.directives;
|
|
2898
|
-
if (!directives || !directives.length) {
|
|
2899
|
-
return true;
|
|
2900
|
-
}
|
|
2901
|
-
return getInclusionDirectives(directives).every(function(_a3) {
|
|
2902
|
-
var directive = _a3.directive, ifArgument = _a3.ifArgument;
|
|
2903
|
-
var evaledValue = false;
|
|
2904
|
-
if (ifArgument.value.kind === "Variable") {
|
|
2905
|
-
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
2906
|
-
__DEV__ ? invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : invariant(evaledValue !== void 0, 37);
|
|
2907
|
-
} else {
|
|
2908
|
-
evaledValue = ifArgument.value.value;
|
|
2717
|
+
var __vue2_script$1 = defineComponent({
|
|
2718
|
+
name: "index",
|
|
2719
|
+
components: {
|
|
2720
|
+
NewTask,
|
|
2721
|
+
MainModal,
|
|
2722
|
+
ReviewModal
|
|
2723
|
+
},
|
|
2724
|
+
props: {
|
|
2725
|
+
uploadFilesFunc: {
|
|
2726
|
+
type: Function,
|
|
2727
|
+
required: true
|
|
2728
|
+
},
|
|
2729
|
+
visible: {
|
|
2730
|
+
type: Boolean,
|
|
2731
|
+
default: false
|
|
2732
|
+
},
|
|
2733
|
+
userId: {
|
|
2734
|
+
type: String,
|
|
2735
|
+
required: true
|
|
2736
|
+
},
|
|
2737
|
+
lawFirmId: {
|
|
2738
|
+
type: Number,
|
|
2739
|
+
required: true
|
|
2740
|
+
},
|
|
2741
|
+
value: {
|
|
2742
|
+
type: Array,
|
|
2743
|
+
default: () => []
|
|
2744
|
+
},
|
|
2745
|
+
reviewText: {
|
|
2746
|
+
type: String,
|
|
2747
|
+
default: "Add"
|
|
2748
|
+
},
|
|
2749
|
+
showSendEmail: {
|
|
2750
|
+
type: Boolean,
|
|
2751
|
+
default: false
|
|
2752
|
+
},
|
|
2753
|
+
sendEmail: {
|
|
2754
|
+
type: Boolean,
|
|
2755
|
+
default: false
|
|
2756
|
+
},
|
|
2757
|
+
taskSettingPageUrl: {
|
|
2758
|
+
type: String
|
|
2759
|
+
},
|
|
2760
|
+
allowClear: {
|
|
2761
|
+
type: Boolean,
|
|
2762
|
+
default: false
|
|
2763
|
+
},
|
|
2764
|
+
pageMode: {
|
|
2765
|
+
type: Boolean,
|
|
2766
|
+
default: false
|
|
2909
2767
|
}
|
|
2910
|
-
|
|
2911
|
-
})
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2768
|
+
},
|
|
2769
|
+
setup(props, { emit }) {
|
|
2770
|
+
const mainModal = ref$1();
|
|
2771
|
+
const reviewModal = ref$1();
|
|
2772
|
+
const newTaskVisible = ref$1(false);
|
|
2773
|
+
const reviewModalVisible = ref$1(false);
|
|
2774
|
+
const tempTask = ref$1(defaultTaskTemplate);
|
|
2775
|
+
const updateTemplate = useMutateTaskTemplate();
|
|
2776
|
+
const createTemplate = useCreateTaskTemplate();
|
|
2777
|
+
const addedTasks = ref$1([]);
|
|
2778
|
+
onMounted(() => {
|
|
2779
|
+
const { value, lawFirmId } = props;
|
|
2780
|
+
if (!value.length)
|
|
2922
2781
|
return;
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
result.push({ directive, ifArgument });
|
|
2931
|
-
});
|
|
2932
|
-
}
|
|
2933
|
-
return result;
|
|
2934
|
-
}
|
|
2935
|
-
function getFragmentQueryDocument(document, fragmentName) {
|
|
2936
|
-
var actualFragmentName = fragmentName;
|
|
2937
|
-
var fragments = [];
|
|
2938
|
-
document.definitions.forEach(function(definition) {
|
|
2939
|
-
if (definition.kind === "OperationDefinition") {
|
|
2940
|
-
throw __DEV__ ? new InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : "", ". ") + "No operations are allowed when using a fragment as a query. Only fragments are allowed.") : new InvariantError(41);
|
|
2941
|
-
}
|
|
2942
|
-
if (definition.kind === "FragmentDefinition") {
|
|
2943
|
-
fragments.push(definition);
|
|
2944
|
-
}
|
|
2945
|
-
});
|
|
2946
|
-
if (typeof actualFragmentName === "undefined") {
|
|
2947
|
-
__DEV__ ? invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : invariant(fragments.length === 1, 42);
|
|
2948
|
-
actualFragmentName = fragments[0].name.value;
|
|
2949
|
-
}
|
|
2950
|
-
var query = __assign(__assign({}, document), { definitions: __spreadArray([
|
|
2951
|
-
{
|
|
2952
|
-
kind: "OperationDefinition",
|
|
2953
|
-
operation: "query",
|
|
2954
|
-
selectionSet: {
|
|
2955
|
-
kind: "SelectionSet",
|
|
2956
|
-
selections: [
|
|
2957
|
-
{
|
|
2958
|
-
kind: "FragmentSpread",
|
|
2959
|
-
name: {
|
|
2960
|
-
kind: "Name",
|
|
2961
|
-
value: actualFragmentName
|
|
2962
|
-
}
|
|
2963
|
-
}
|
|
2964
|
-
]
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
|
-
], document.definitions, true) });
|
|
2968
|
-
return query;
|
|
2969
|
-
}
|
|
2970
|
-
function createFragmentMap(fragments) {
|
|
2971
|
-
if (fragments === void 0) {
|
|
2972
|
-
fragments = [];
|
|
2973
|
-
}
|
|
2974
|
-
var symTable = {};
|
|
2975
|
-
fragments.forEach(function(fragment) {
|
|
2976
|
-
symTable[fragment.name.value] = fragment;
|
|
2977
|
-
});
|
|
2978
|
-
return symTable;
|
|
2979
|
-
}
|
|
2980
|
-
function getFragmentFromSelection(selection, fragmentMap) {
|
|
2981
|
-
switch (selection.kind) {
|
|
2982
|
-
case "InlineFragment":
|
|
2983
|
-
return selection;
|
|
2984
|
-
case "FragmentSpread": {
|
|
2985
|
-
var fragment = fragmentMap && fragmentMap[selection.name.value];
|
|
2986
|
-
__DEV__ ? invariant(fragment, "No fragment named ".concat(selection.name.value, ".")) : invariant(fragment, 43);
|
|
2987
|
-
return fragment;
|
|
2988
|
-
}
|
|
2989
|
-
default:
|
|
2990
|
-
return null;
|
|
2991
|
-
}
|
|
2992
|
-
}
|
|
2993
|
-
function isNonNullObject(obj) {
|
|
2994
|
-
return obj !== null && typeof obj === "object";
|
|
2995
|
-
}
|
|
2996
|
-
function makeReference(id) {
|
|
2997
|
-
return { __ref: String(id) };
|
|
2998
|
-
}
|
|
2999
|
-
function isReference(obj) {
|
|
3000
|
-
return Boolean(obj && typeof obj === "object" && typeof obj.__ref === "string");
|
|
3001
|
-
}
|
|
3002
|
-
function isStringValue(value) {
|
|
3003
|
-
return value.kind === "StringValue";
|
|
3004
|
-
}
|
|
3005
|
-
function isBooleanValue(value) {
|
|
3006
|
-
return value.kind === "BooleanValue";
|
|
3007
|
-
}
|
|
3008
|
-
function isIntValue(value) {
|
|
3009
|
-
return value.kind === "IntValue";
|
|
3010
|
-
}
|
|
3011
|
-
function isFloatValue(value) {
|
|
3012
|
-
return value.kind === "FloatValue";
|
|
3013
|
-
}
|
|
3014
|
-
function isVariable(value) {
|
|
3015
|
-
return value.kind === "Variable";
|
|
3016
|
-
}
|
|
3017
|
-
function isObjectValue(value) {
|
|
3018
|
-
return value.kind === "ObjectValue";
|
|
3019
|
-
}
|
|
3020
|
-
function isListValue(value) {
|
|
3021
|
-
return value.kind === "ListValue";
|
|
3022
|
-
}
|
|
3023
|
-
function isEnumValue(value) {
|
|
3024
|
-
return value.kind === "EnumValue";
|
|
3025
|
-
}
|
|
3026
|
-
function isNullValue(value) {
|
|
3027
|
-
return value.kind === "NullValue";
|
|
3028
|
-
}
|
|
3029
|
-
function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
3030
|
-
if (isIntValue(value) || isFloatValue(value)) {
|
|
3031
|
-
argObj[name.value] = Number(value.value);
|
|
3032
|
-
} else if (isBooleanValue(value) || isStringValue(value)) {
|
|
3033
|
-
argObj[name.value] = value.value;
|
|
3034
|
-
} else if (isObjectValue(value)) {
|
|
3035
|
-
var nestedArgObj_1 = {};
|
|
3036
|
-
value.fields.map(function(obj) {
|
|
3037
|
-
return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables);
|
|
3038
|
-
});
|
|
3039
|
-
argObj[name.value] = nestedArgObj_1;
|
|
3040
|
-
} else if (isVariable(value)) {
|
|
3041
|
-
var variableValue = (variables || {})[value.name.value];
|
|
3042
|
-
argObj[name.value] = variableValue;
|
|
3043
|
-
} else if (isListValue(value)) {
|
|
3044
|
-
argObj[name.value] = value.values.map(function(listValue) {
|
|
3045
|
-
var nestedArgArrayObj = {};
|
|
3046
|
-
valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables);
|
|
3047
|
-
return nestedArgArrayObj[name.value];
|
|
3048
|
-
});
|
|
3049
|
-
} else if (isEnumValue(value)) {
|
|
3050
|
-
argObj[name.value] = value.value;
|
|
3051
|
-
} else if (isNullValue(value)) {
|
|
3052
|
-
argObj[name.value] = null;
|
|
3053
|
-
} else {
|
|
3054
|
-
throw __DEV__ ? new InvariantError('The inline argument "'.concat(name.value, '" of kind "').concat(value.kind, '"') + "is not supported. Use variables instead of inline arguments to overcome this limitation.") : new InvariantError(52);
|
|
3055
|
-
}
|
|
3056
|
-
}
|
|
3057
|
-
function storeKeyNameFromField(field, variables) {
|
|
3058
|
-
var directivesObj = null;
|
|
3059
|
-
if (field.directives) {
|
|
3060
|
-
directivesObj = {};
|
|
3061
|
-
field.directives.forEach(function(directive) {
|
|
3062
|
-
directivesObj[directive.name.value] = {};
|
|
3063
|
-
if (directive.arguments) {
|
|
3064
|
-
directive.arguments.forEach(function(_a2) {
|
|
3065
|
-
var name = _a2.name, value = _a2.value;
|
|
3066
|
-
return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables);
|
|
3067
|
-
});
|
|
3068
|
-
}
|
|
3069
|
-
});
|
|
3070
|
-
}
|
|
3071
|
-
var argObj = null;
|
|
3072
|
-
if (field.arguments && field.arguments.length) {
|
|
3073
|
-
argObj = {};
|
|
3074
|
-
field.arguments.forEach(function(_a2) {
|
|
3075
|
-
var name = _a2.name, value = _a2.value;
|
|
3076
|
-
return valueToObjectRepresentation(argObj, name, value, variables);
|
|
3077
|
-
});
|
|
3078
|
-
}
|
|
3079
|
-
return getStoreKeyName(field.name.value, argObj, directivesObj);
|
|
3080
|
-
}
|
|
3081
|
-
var KNOWN_DIRECTIVES = [
|
|
3082
|
-
"connection",
|
|
3083
|
-
"include",
|
|
3084
|
-
"skip",
|
|
3085
|
-
"client",
|
|
3086
|
-
"rest",
|
|
3087
|
-
"export"
|
|
3088
|
-
];
|
|
3089
|
-
var getStoreKeyName = Object.assign(function(fieldName, args, directives) {
|
|
3090
|
-
if (args && directives && directives["connection"] && directives["connection"]["key"]) {
|
|
3091
|
-
if (directives["connection"]["filter"] && directives["connection"]["filter"].length > 0) {
|
|
3092
|
-
var filterKeys = directives["connection"]["filter"] ? directives["connection"]["filter"] : [];
|
|
3093
|
-
filterKeys.sort();
|
|
3094
|
-
var filteredArgs_1 = {};
|
|
3095
|
-
filterKeys.forEach(function(key) {
|
|
3096
|
-
filteredArgs_1[key] = args[key];
|
|
2782
|
+
const conditions = ref$1({
|
|
2783
|
+
taskTemplateId: value
|
|
2784
|
+
});
|
|
2785
|
+
const { result } = useSearchTaskTemplates(ref$1({ current: 1, pageSize: 1e3, total: 0 }), conditions, lawFirmId);
|
|
2786
|
+
watch(() => result.value, () => {
|
|
2787
|
+
var _a, _b;
|
|
2788
|
+
addedTasks.value = ((_b = (_a = result.value) == null ? void 0 : _a.taskTemplateSearch) == null ? void 0 : _b.taskTemplateList) || [];
|
|
3097
2789
|
});
|
|
3098
|
-
return "".concat(directives["connection"]["key"], "(").concat(stringify(filteredArgs_1), ")");
|
|
3099
|
-
} else {
|
|
3100
|
-
return directives["connection"]["key"];
|
|
3101
|
-
}
|
|
3102
|
-
}
|
|
3103
|
-
var completeFieldName = fieldName;
|
|
3104
|
-
if (args) {
|
|
3105
|
-
var stringifiedArgs = stringify(args);
|
|
3106
|
-
completeFieldName += "(".concat(stringifiedArgs, ")");
|
|
3107
|
-
}
|
|
3108
|
-
if (directives) {
|
|
3109
|
-
Object.keys(directives).forEach(function(key) {
|
|
3110
|
-
if (KNOWN_DIRECTIVES.indexOf(key) !== -1)
|
|
3111
|
-
return;
|
|
3112
|
-
if (directives[key] && Object.keys(directives[key]).length) {
|
|
3113
|
-
completeFieldName += "@".concat(key, "(").concat(stringify(directives[key]), ")");
|
|
3114
|
-
} else {
|
|
3115
|
-
completeFieldName += "@".concat(key);
|
|
3116
|
-
}
|
|
3117
|
-
});
|
|
3118
|
-
}
|
|
3119
|
-
return completeFieldName;
|
|
3120
|
-
}, {
|
|
3121
|
-
setStringify: function(s) {
|
|
3122
|
-
var previous = stringify;
|
|
3123
|
-
stringify = s;
|
|
3124
|
-
return previous;
|
|
3125
|
-
}
|
|
3126
|
-
});
|
|
3127
|
-
var stringify = function defaultStringify(value) {
|
|
3128
|
-
return JSON.stringify(value, stringifyReplacer);
|
|
3129
|
-
};
|
|
3130
|
-
function stringifyReplacer(_key, value) {
|
|
3131
|
-
if (isNonNullObject(value) && !Array.isArray(value)) {
|
|
3132
|
-
value = Object.keys(value).sort().reduce(function(copy, key) {
|
|
3133
|
-
copy[key] = value[key];
|
|
3134
|
-
return copy;
|
|
3135
|
-
}, {});
|
|
3136
|
-
}
|
|
3137
|
-
return value;
|
|
3138
|
-
}
|
|
3139
|
-
function argumentsObjectFromField(field, variables) {
|
|
3140
|
-
if (field.arguments && field.arguments.length) {
|
|
3141
|
-
var argObj_1 = {};
|
|
3142
|
-
field.arguments.forEach(function(_a2) {
|
|
3143
|
-
var name = _a2.name, value = _a2.value;
|
|
3144
|
-
return valueToObjectRepresentation(argObj_1, name, value, variables);
|
|
3145
2790
|
});
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
}
|
|
3150
|
-
function resultKeyNameFromField(field) {
|
|
3151
|
-
return field.alias ? field.alias.value : field.name.value;
|
|
3152
|
-
}
|
|
3153
|
-
function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
3154
|
-
if (typeof result.__typename === "string") {
|
|
3155
|
-
return result.__typename;
|
|
3156
|
-
}
|
|
3157
|
-
for (var _i = 0, _a2 = selectionSet.selections; _i < _a2.length; _i++) {
|
|
3158
|
-
var selection = _a2[_i];
|
|
3159
|
-
if (isField(selection)) {
|
|
3160
|
-
if (selection.name.value === "__typename") {
|
|
3161
|
-
return result[resultKeyNameFromField(selection)];
|
|
3162
|
-
}
|
|
3163
|
-
} else {
|
|
3164
|
-
var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
|
|
3165
|
-
if (typeof typename === "string") {
|
|
3166
|
-
return typename;
|
|
3167
|
-
}
|
|
3168
|
-
}
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
function isField(selection) {
|
|
3172
|
-
return selection.kind === "Field";
|
|
3173
|
-
}
|
|
3174
|
-
function checkDocument(doc) {
|
|
3175
|
-
__DEV__ ? invariant(doc && doc.kind === "Document", 'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql') : invariant(doc && doc.kind === "Document", 44);
|
|
3176
|
-
var operations = doc.definitions.filter(function(d) {
|
|
3177
|
-
return d.kind !== "FragmentDefinition";
|
|
3178
|
-
}).map(function(definition) {
|
|
3179
|
-
if (definition.kind !== "OperationDefinition") {
|
|
3180
|
-
throw __DEV__ ? new InvariantError('Schema type definitions not allowed in queries. Found: "'.concat(definition.kind, '"')) : new InvariantError(45);
|
|
3181
|
-
}
|
|
3182
|
-
return definition;
|
|
3183
|
-
});
|
|
3184
|
-
__DEV__ ? invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : invariant(operations.length <= 1, 46);
|
|
3185
|
-
return doc;
|
|
3186
|
-
}
|
|
3187
|
-
function getOperationDefinition(doc) {
|
|
3188
|
-
checkDocument(doc);
|
|
3189
|
-
return doc.definitions.filter(function(definition) {
|
|
3190
|
-
return definition.kind === "OperationDefinition";
|
|
3191
|
-
})[0];
|
|
3192
|
-
}
|
|
3193
|
-
function getFragmentDefinitions(doc) {
|
|
3194
|
-
return doc.definitions.filter(function(definition) {
|
|
3195
|
-
return definition.kind === "FragmentDefinition";
|
|
3196
|
-
});
|
|
3197
|
-
}
|
|
3198
|
-
function getQueryDefinition(doc) {
|
|
3199
|
-
var queryDef = getOperationDefinition(doc);
|
|
3200
|
-
__DEV__ ? invariant(queryDef && queryDef.operation === "query", "Must contain a query definition.") : invariant(queryDef && queryDef.operation === "query", 47);
|
|
3201
|
-
return queryDef;
|
|
3202
|
-
}
|
|
3203
|
-
function getMainDefinition(queryDoc) {
|
|
3204
|
-
checkDocument(queryDoc);
|
|
3205
|
-
var fragmentDefinition;
|
|
3206
|
-
for (var _i = 0, _a2 = queryDoc.definitions; _i < _a2.length; _i++) {
|
|
3207
|
-
var definition = _a2[_i];
|
|
3208
|
-
if (definition.kind === "OperationDefinition") {
|
|
3209
|
-
var operation = definition.operation;
|
|
3210
|
-
if (operation === "query" || operation === "mutation" || operation === "subscription") {
|
|
3211
|
-
return definition;
|
|
3212
|
-
}
|
|
3213
|
-
}
|
|
3214
|
-
if (definition.kind === "FragmentDefinition" && !fragmentDefinition) {
|
|
3215
|
-
fragmentDefinition = definition;
|
|
3216
|
-
}
|
|
3217
|
-
}
|
|
3218
|
-
if (fragmentDefinition) {
|
|
3219
|
-
return fragmentDefinition;
|
|
3220
|
-
}
|
|
3221
|
-
throw __DEV__ ? new InvariantError("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.") : new InvariantError(51);
|
|
3222
|
-
}
|
|
3223
|
-
function getDefaultValues(definition) {
|
|
3224
|
-
var defaultValues = Object.create(null);
|
|
3225
|
-
var defs = definition && definition.variableDefinitions;
|
|
3226
|
-
if (defs && defs.length) {
|
|
3227
|
-
defs.forEach(function(def2) {
|
|
3228
|
-
if (def2.defaultValue) {
|
|
3229
|
-
valueToObjectRepresentation(defaultValues, def2.variable.name, def2.defaultValue);
|
|
3230
|
-
}
|
|
3231
|
-
});
|
|
3232
|
-
}
|
|
3233
|
-
return defaultValues;
|
|
3234
|
-
}
|
|
3235
|
-
var TYPENAME_FIELD = {
|
|
3236
|
-
kind: "Field",
|
|
3237
|
-
name: {
|
|
3238
|
-
kind: "Name",
|
|
3239
|
-
value: "__typename"
|
|
3240
|
-
}
|
|
3241
|
-
};
|
|
3242
|
-
var addTypenameToDocument = Object.assign(function(doc) {
|
|
3243
|
-
return visit(checkDocument(doc), {
|
|
3244
|
-
SelectionSet: {
|
|
3245
|
-
enter: function(node, _key, parent) {
|
|
3246
|
-
if (parent && parent.kind === "OperationDefinition") {
|
|
3247
|
-
return;
|
|
3248
|
-
}
|
|
3249
|
-
var selections = node.selections;
|
|
3250
|
-
if (!selections) {
|
|
3251
|
-
return;
|
|
3252
|
-
}
|
|
3253
|
-
var skip = selections.some(function(selection) {
|
|
3254
|
-
return isField(selection) && (selection.name.value === "__typename" || selection.name.value.lastIndexOf("__", 0) === 0);
|
|
3255
|
-
});
|
|
3256
|
-
if (skip) {
|
|
3257
|
-
return;
|
|
3258
|
-
}
|
|
3259
|
-
var field = parent;
|
|
3260
|
-
if (isField(field) && field.directives && field.directives.some(function(d) {
|
|
3261
|
-
return d.name.value === "export";
|
|
3262
|
-
})) {
|
|
3263
|
-
return;
|
|
3264
|
-
}
|
|
3265
|
-
return __assign(__assign({}, node), { selections: __spreadArray(__spreadArray([], selections, true), [TYPENAME_FIELD], false) });
|
|
3266
|
-
}
|
|
3267
|
-
}
|
|
3268
|
-
});
|
|
3269
|
-
}, {
|
|
3270
|
-
added: function(field) {
|
|
3271
|
-
return field === TYPENAME_FIELD;
|
|
3272
|
-
}
|
|
3273
|
-
});
|
|
3274
|
-
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
3275
|
-
var defaultReconciler = function(target, source, property) {
|
|
3276
|
-
return this.merge(target[property], source[property]);
|
|
3277
|
-
};
|
|
3278
|
-
var DeepMerger = function() {
|
|
3279
|
-
function DeepMerger2(reconciler) {
|
|
3280
|
-
if (reconciler === void 0) {
|
|
3281
|
-
reconciler = defaultReconciler;
|
|
3282
|
-
}
|
|
3283
|
-
this.reconciler = reconciler;
|
|
3284
|
-
this.isObject = isNonNullObject;
|
|
3285
|
-
this.pastCopies = new Set();
|
|
3286
|
-
}
|
|
3287
|
-
DeepMerger2.prototype.merge = function(target, source) {
|
|
3288
|
-
var _this = this;
|
|
3289
|
-
var context = [];
|
|
3290
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
3291
|
-
context[_i - 2] = arguments[_i];
|
|
3292
|
-
}
|
|
3293
|
-
if (isNonNullObject(source) && isNonNullObject(target)) {
|
|
3294
|
-
Object.keys(source).forEach(function(sourceKey) {
|
|
3295
|
-
if (hasOwnProperty$2.call(target, sourceKey)) {
|
|
3296
|
-
var targetValue = target[sourceKey];
|
|
3297
|
-
if (source[sourceKey] !== targetValue) {
|
|
3298
|
-
var result = _this.reconciler.apply(_this, __spreadArray([target, source, sourceKey], context, false));
|
|
3299
|
-
if (result !== targetValue) {
|
|
3300
|
-
target = _this.shallowCopyForMerge(target);
|
|
3301
|
-
target[sourceKey] = result;
|
|
3302
|
-
}
|
|
3303
|
-
}
|
|
3304
|
-
} else {
|
|
3305
|
-
target = _this.shallowCopyForMerge(target);
|
|
3306
|
-
target[sourceKey] = source[sourceKey];
|
|
3307
|
-
}
|
|
3308
|
-
});
|
|
3309
|
-
return target;
|
|
3310
|
-
}
|
|
3311
|
-
return source;
|
|
3312
|
-
};
|
|
3313
|
-
DeepMerger2.prototype.shallowCopyForMerge = function(value) {
|
|
3314
|
-
if (isNonNullObject(value)) {
|
|
3315
|
-
if (this.pastCopies.has(value)) {
|
|
3316
|
-
if (!Object.isFrozen(value))
|
|
3317
|
-
return value;
|
|
3318
|
-
this.pastCopies.delete(value);
|
|
3319
|
-
}
|
|
3320
|
-
if (Array.isArray(value)) {
|
|
3321
|
-
value = value.slice(0);
|
|
3322
|
-
} else {
|
|
3323
|
-
value = __assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
3324
|
-
}
|
|
3325
|
-
this.pastCopies.add(value);
|
|
3326
|
-
}
|
|
3327
|
-
return value;
|
|
3328
|
-
};
|
|
3329
|
-
return DeepMerger2;
|
|
3330
|
-
}();
|
|
3331
|
-
var toString$1 = Object.prototype.toString;
|
|
3332
|
-
function cloneDeep(value) {
|
|
3333
|
-
return cloneDeepHelper(value);
|
|
3334
|
-
}
|
|
3335
|
-
function cloneDeepHelper(val, seen) {
|
|
3336
|
-
switch (toString$1.call(val)) {
|
|
3337
|
-
case "[object Array]": {
|
|
3338
|
-
seen = seen || new Map();
|
|
3339
|
-
if (seen.has(val))
|
|
3340
|
-
return seen.get(val);
|
|
3341
|
-
var copy_1 = val.slice(0);
|
|
3342
|
-
seen.set(val, copy_1);
|
|
3343
|
-
copy_1.forEach(function(child, i) {
|
|
3344
|
-
copy_1[i] = cloneDeepHelper(child, seen);
|
|
3345
|
-
});
|
|
3346
|
-
return copy_1;
|
|
3347
|
-
}
|
|
3348
|
-
case "[object Object]": {
|
|
3349
|
-
seen = seen || new Map();
|
|
3350
|
-
if (seen.has(val))
|
|
3351
|
-
return seen.get(val);
|
|
3352
|
-
var copy_2 = Object.create(Object.getPrototypeOf(val));
|
|
3353
|
-
seen.set(val, copy_2);
|
|
3354
|
-
Object.keys(val).forEach(function(key) {
|
|
3355
|
-
copy_2[key] = cloneDeepHelper(val[key], seen);
|
|
3356
|
-
});
|
|
3357
|
-
return copy_2;
|
|
3358
|
-
}
|
|
3359
|
-
default:
|
|
3360
|
-
return val;
|
|
3361
|
-
}
|
|
3362
|
-
}
|
|
3363
|
-
function deepFreeze(value) {
|
|
3364
|
-
var workSet = new Set([value]);
|
|
3365
|
-
workSet.forEach(function(obj) {
|
|
3366
|
-
if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {
|
|
3367
|
-
Object.getOwnPropertyNames(obj).forEach(function(name) {
|
|
3368
|
-
if (isNonNullObject(obj[name]))
|
|
3369
|
-
workSet.add(obj[name]);
|
|
3370
|
-
});
|
|
3371
|
-
}
|
|
3372
|
-
});
|
|
3373
|
-
return value;
|
|
3374
|
-
}
|
|
3375
|
-
function shallowFreeze(obj) {
|
|
3376
|
-
if (__DEV__ && !Object.isFrozen(obj)) {
|
|
3377
|
-
try {
|
|
3378
|
-
Object.freeze(obj);
|
|
3379
|
-
} catch (e) {
|
|
3380
|
-
if (e instanceof TypeError)
|
|
3381
|
-
return null;
|
|
3382
|
-
throw e;
|
|
3383
|
-
}
|
|
3384
|
-
}
|
|
3385
|
-
return obj;
|
|
3386
|
-
}
|
|
3387
|
-
function maybeDeepFreeze(obj) {
|
|
3388
|
-
if (__DEV__) {
|
|
3389
|
-
deepFreeze(obj);
|
|
3390
|
-
}
|
|
3391
|
-
return obj;
|
|
3392
|
-
}
|
|
3393
|
-
var canUseWeakMap = typeof WeakMap === "function" && !(typeof navigator === "object" && navigator.product === "ReactNative");
|
|
3394
|
-
var canUseWeakSet = typeof WeakSet === "function";
|
|
3395
|
-
function isNonEmptyArray(value) {
|
|
3396
|
-
return Array.isArray(value) && value.length > 0;
|
|
3397
|
-
}
|
|
3398
|
-
function compact() {
|
|
3399
|
-
var objects = [];
|
|
3400
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3401
|
-
objects[_i] = arguments[_i];
|
|
3402
|
-
}
|
|
3403
|
-
var result = Object.create(null);
|
|
3404
|
-
objects.forEach(function(obj) {
|
|
3405
|
-
if (!obj)
|
|
3406
|
-
return;
|
|
3407
|
-
Object.keys(obj).forEach(function(key) {
|
|
3408
|
-
var value = obj[key];
|
|
3409
|
-
if (value !== void 0) {
|
|
3410
|
-
result[key] = value;
|
|
3411
|
-
}
|
|
3412
|
-
});
|
|
3413
|
-
});
|
|
3414
|
-
return result;
|
|
3415
|
-
}
|
|
3416
|
-
var prefixCounts = new Map();
|
|
3417
|
-
function makeUniqueId(prefix) {
|
|
3418
|
-
var count = prefixCounts.get(prefix) || 1;
|
|
3419
|
-
prefixCounts.set(prefix, count + 1);
|
|
3420
|
-
return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
|
|
3421
|
-
}
|
|
3422
|
-
function stringifyForDisplay(value) {
|
|
3423
|
-
var undefId = makeUniqueId("stringifyForDisplay");
|
|
3424
|
-
return JSON.stringify(value, function(key, value2) {
|
|
3425
|
-
return value2 === void 0 ? undefId : value2;
|
|
3426
|
-
}).split(JSON.stringify(undefId)).join("<undefined>");
|
|
3427
|
-
}
|
|
3428
|
-
var _a$2 = Object.prototype, toString = _a$2.toString, hasOwnProperty$1 = _a$2.hasOwnProperty;
|
|
3429
|
-
var fnToStr = Function.prototype.toString;
|
|
3430
|
-
var previousComparisons = new Map();
|
|
3431
|
-
function equal(a, b) {
|
|
3432
|
-
try {
|
|
3433
|
-
return check(a, b);
|
|
3434
|
-
} finally {
|
|
3435
|
-
previousComparisons.clear();
|
|
3436
|
-
}
|
|
3437
|
-
}
|
|
3438
|
-
function check(a, b) {
|
|
3439
|
-
if (a === b) {
|
|
3440
|
-
return true;
|
|
3441
|
-
}
|
|
3442
|
-
var aTag = toString.call(a);
|
|
3443
|
-
var bTag = toString.call(b);
|
|
3444
|
-
if (aTag !== bTag) {
|
|
3445
|
-
return false;
|
|
3446
|
-
}
|
|
3447
|
-
switch (aTag) {
|
|
3448
|
-
case "[object Array]":
|
|
3449
|
-
if (a.length !== b.length)
|
|
3450
|
-
return false;
|
|
3451
|
-
case "[object Object]": {
|
|
3452
|
-
if (previouslyCompared(a, b))
|
|
3453
|
-
return true;
|
|
3454
|
-
var aKeys = definedKeys(a);
|
|
3455
|
-
var bKeys = definedKeys(b);
|
|
3456
|
-
var keyCount = aKeys.length;
|
|
3457
|
-
if (keyCount !== bKeys.length)
|
|
3458
|
-
return false;
|
|
3459
|
-
for (var k = 0; k < keyCount; ++k) {
|
|
3460
|
-
if (!hasOwnProperty$1.call(b, aKeys[k])) {
|
|
3461
|
-
return false;
|
|
3462
|
-
}
|
|
3463
|
-
}
|
|
3464
|
-
for (var k = 0; k < keyCount; ++k) {
|
|
3465
|
-
var key = aKeys[k];
|
|
3466
|
-
if (!check(a[key], b[key])) {
|
|
3467
|
-
return false;
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3470
|
-
return true;
|
|
3471
|
-
}
|
|
3472
|
-
case "[object Error]":
|
|
3473
|
-
return a.name === b.name && a.message === b.message;
|
|
3474
|
-
case "[object Number]":
|
|
3475
|
-
if (a !== a)
|
|
3476
|
-
return b !== b;
|
|
3477
|
-
case "[object Boolean]":
|
|
3478
|
-
case "[object Date]":
|
|
3479
|
-
return +a === +b;
|
|
3480
|
-
case "[object RegExp]":
|
|
3481
|
-
case "[object String]":
|
|
3482
|
-
return a == "" + b;
|
|
3483
|
-
case "[object Map]":
|
|
3484
|
-
case "[object Set]": {
|
|
3485
|
-
if (a.size !== b.size)
|
|
3486
|
-
return false;
|
|
3487
|
-
if (previouslyCompared(a, b))
|
|
3488
|
-
return true;
|
|
3489
|
-
var aIterator = a.entries();
|
|
3490
|
-
var isMap = aTag === "[object Map]";
|
|
3491
|
-
while (true) {
|
|
3492
|
-
var info = aIterator.next();
|
|
3493
|
-
if (info.done)
|
|
3494
|
-
break;
|
|
3495
|
-
var _a2 = info.value, aKey = _a2[0], aValue = _a2[1];
|
|
3496
|
-
if (!b.has(aKey)) {
|
|
3497
|
-
return false;
|
|
3498
|
-
}
|
|
3499
|
-
if (isMap && !check(aValue, b.get(aKey))) {
|
|
3500
|
-
return false;
|
|
3501
|
-
}
|
|
3502
|
-
}
|
|
3503
|
-
return true;
|
|
3504
|
-
}
|
|
3505
|
-
case "[object Uint16Array]":
|
|
3506
|
-
case "[object Uint8Array]":
|
|
3507
|
-
case "[object Uint32Array]":
|
|
3508
|
-
case "[object Int32Array]":
|
|
3509
|
-
case "[object Int8Array]":
|
|
3510
|
-
case "[object Int16Array]":
|
|
3511
|
-
case "[object ArrayBuffer]":
|
|
3512
|
-
a = new Uint8Array(a);
|
|
3513
|
-
b = new Uint8Array(b);
|
|
3514
|
-
case "[object DataView]": {
|
|
3515
|
-
var len = a.byteLength;
|
|
3516
|
-
if (len === b.byteLength) {
|
|
3517
|
-
while (len-- && a[len] === b[len]) {
|
|
3518
|
-
}
|
|
3519
|
-
}
|
|
3520
|
-
return len === -1;
|
|
3521
|
-
}
|
|
3522
|
-
case "[object AsyncFunction]":
|
|
3523
|
-
case "[object GeneratorFunction]":
|
|
3524
|
-
case "[object AsyncGeneratorFunction]":
|
|
3525
|
-
case "[object Function]": {
|
|
3526
|
-
var aCode = fnToStr.call(a);
|
|
3527
|
-
if (aCode !== fnToStr.call(b)) {
|
|
3528
|
-
return false;
|
|
3529
|
-
}
|
|
3530
|
-
return !endsWith(aCode, nativeCodeSuffix);
|
|
3531
|
-
}
|
|
3532
|
-
}
|
|
3533
|
-
return false;
|
|
3534
|
-
}
|
|
3535
|
-
function definedKeys(obj) {
|
|
3536
|
-
return Object.keys(obj).filter(isDefinedKey, obj);
|
|
3537
|
-
}
|
|
3538
|
-
function isDefinedKey(key) {
|
|
3539
|
-
return this[key] !== void 0;
|
|
3540
|
-
}
|
|
3541
|
-
var nativeCodeSuffix = "{ [native code] }";
|
|
3542
|
-
function endsWith(full, suffix) {
|
|
3543
|
-
var fromIndex = full.length - suffix.length;
|
|
3544
|
-
return fromIndex >= 0 && full.indexOf(suffix, fromIndex) === fromIndex;
|
|
3545
|
-
}
|
|
3546
|
-
function previouslyCompared(a, b) {
|
|
3547
|
-
var bSet = previousComparisons.get(a);
|
|
3548
|
-
if (bSet) {
|
|
3549
|
-
if (bSet.has(b))
|
|
3550
|
-
return true;
|
|
3551
|
-
} else {
|
|
3552
|
-
previousComparisons.set(a, bSet = new Set());
|
|
3553
|
-
}
|
|
3554
|
-
bSet.add(b);
|
|
3555
|
-
return false;
|
|
3556
|
-
}
|
|
3557
|
-
var defaultMakeData = function() {
|
|
3558
|
-
return Object.create(null);
|
|
3559
|
-
};
|
|
3560
|
-
var _a$1 = Array.prototype, forEach = _a$1.forEach, slice = _a$1.slice;
|
|
3561
|
-
var Trie = function() {
|
|
3562
|
-
function Trie2(weakness, makeData) {
|
|
3563
|
-
if (weakness === void 0) {
|
|
3564
|
-
weakness = true;
|
|
3565
|
-
}
|
|
3566
|
-
if (makeData === void 0) {
|
|
3567
|
-
makeData = defaultMakeData;
|
|
3568
|
-
}
|
|
3569
|
-
this.weakness = weakness;
|
|
3570
|
-
this.makeData = makeData;
|
|
3571
|
-
}
|
|
3572
|
-
Trie2.prototype.lookup = function() {
|
|
3573
|
-
var array = [];
|
|
3574
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3575
|
-
array[_i] = arguments[_i];
|
|
3576
|
-
}
|
|
3577
|
-
return this.lookupArray(array);
|
|
3578
|
-
};
|
|
3579
|
-
Trie2.prototype.lookupArray = function(array) {
|
|
3580
|
-
var node = this;
|
|
3581
|
-
forEach.call(array, function(key) {
|
|
3582
|
-
return node = node.getChildTrie(key);
|
|
3583
|
-
});
|
|
3584
|
-
return node.data || (node.data = this.makeData(slice.call(array)));
|
|
3585
|
-
};
|
|
3586
|
-
Trie2.prototype.getChildTrie = function(key) {
|
|
3587
|
-
var map = this.weakness && isObjRef(key) ? this.weak || (this.weak = new WeakMap()) : this.strong || (this.strong = new Map());
|
|
3588
|
-
var child = map.get(key);
|
|
3589
|
-
if (!child)
|
|
3590
|
-
map.set(key, child = new Trie2(this.weakness, this.makeData));
|
|
3591
|
-
return child;
|
|
3592
|
-
};
|
|
3593
|
-
return Trie2;
|
|
3594
|
-
}();
|
|
3595
|
-
function isObjRef(value) {
|
|
3596
|
-
switch (typeof value) {
|
|
3597
|
-
case "object":
|
|
3598
|
-
if (value === null)
|
|
3599
|
-
break;
|
|
3600
|
-
case "function":
|
|
3601
|
-
return true;
|
|
3602
|
-
}
|
|
3603
|
-
return false;
|
|
3604
|
-
}
|
|
3605
|
-
var currentContext = null;
|
|
3606
|
-
var MISSING_VALUE = {};
|
|
3607
|
-
var idCounter = 1;
|
|
3608
|
-
var makeSlotClass = function() {
|
|
3609
|
-
return function() {
|
|
3610
|
-
function Slot2() {
|
|
3611
|
-
this.id = [
|
|
3612
|
-
"slot",
|
|
3613
|
-
idCounter++,
|
|
3614
|
-
Date.now(),
|
|
3615
|
-
Math.random().toString(36).slice(2)
|
|
3616
|
-
].join(":");
|
|
3617
|
-
}
|
|
3618
|
-
Slot2.prototype.hasValue = function() {
|
|
3619
|
-
for (var context_1 = currentContext; context_1; context_1 = context_1.parent) {
|
|
3620
|
-
if (this.id in context_1.slots) {
|
|
3621
|
-
var value = context_1.slots[this.id];
|
|
3622
|
-
if (value === MISSING_VALUE)
|
|
3623
|
-
break;
|
|
3624
|
-
if (context_1 !== currentContext) {
|
|
3625
|
-
currentContext.slots[this.id] = value;
|
|
3626
|
-
}
|
|
3627
|
-
return true;
|
|
3628
|
-
}
|
|
3629
|
-
}
|
|
3630
|
-
if (currentContext) {
|
|
3631
|
-
currentContext.slots[this.id] = MISSING_VALUE;
|
|
3632
|
-
}
|
|
3633
|
-
return false;
|
|
3634
|
-
};
|
|
3635
|
-
Slot2.prototype.getValue = function() {
|
|
3636
|
-
if (this.hasValue()) {
|
|
3637
|
-
return currentContext.slots[this.id];
|
|
3638
|
-
}
|
|
3639
|
-
};
|
|
3640
|
-
Slot2.prototype.withValue = function(value, callback, args, thisArg) {
|
|
3641
|
-
var _a2;
|
|
3642
|
-
var slots = (_a2 = {
|
|
3643
|
-
__proto__: null
|
|
3644
|
-
}, _a2[this.id] = value, _a2);
|
|
3645
|
-
var parent = currentContext;
|
|
3646
|
-
currentContext = { parent, slots };
|
|
3647
|
-
try {
|
|
3648
|
-
return callback.apply(thisArg, args);
|
|
3649
|
-
} finally {
|
|
3650
|
-
currentContext = parent;
|
|
3651
|
-
}
|
|
3652
|
-
};
|
|
3653
|
-
Slot2.bind = function(callback) {
|
|
3654
|
-
var context = currentContext;
|
|
3655
|
-
return function() {
|
|
3656
|
-
var saved = currentContext;
|
|
3657
|
-
try {
|
|
3658
|
-
currentContext = context;
|
|
3659
|
-
return callback.apply(this, arguments);
|
|
3660
|
-
} finally {
|
|
3661
|
-
currentContext = saved;
|
|
3662
|
-
}
|
|
3663
|
-
};
|
|
3664
|
-
};
|
|
3665
|
-
Slot2.noContext = function(callback, args, thisArg) {
|
|
3666
|
-
if (currentContext) {
|
|
3667
|
-
var saved = currentContext;
|
|
3668
|
-
try {
|
|
3669
|
-
currentContext = null;
|
|
3670
|
-
return callback.apply(thisArg, args);
|
|
3671
|
-
} finally {
|
|
3672
|
-
currentContext = saved;
|
|
3673
|
-
}
|
|
3674
|
-
} else {
|
|
3675
|
-
return callback.apply(thisArg, args);
|
|
3676
|
-
}
|
|
3677
|
-
};
|
|
3678
|
-
return Slot2;
|
|
3679
|
-
}();
|
|
3680
|
-
};
|
|
3681
|
-
var globalKey = "@wry/context:Slot";
|
|
3682
|
-
var host = Array;
|
|
3683
|
-
var Slot = host[globalKey] || function() {
|
|
3684
|
-
var Slot2 = makeSlotClass();
|
|
3685
|
-
try {
|
|
3686
|
-
Object.defineProperty(host, globalKey, {
|
|
3687
|
-
value: host[globalKey] = Slot2,
|
|
3688
|
-
enumerable: false,
|
|
3689
|
-
writable: false,
|
|
3690
|
-
configurable: false
|
|
3691
|
-
});
|
|
3692
|
-
} finally {
|
|
3693
|
-
return Slot2;
|
|
3694
|
-
}
|
|
3695
|
-
}();
|
|
3696
|
-
Slot.bind;
|
|
3697
|
-
Slot.noContext;
|
|
3698
|
-
function defaultDispose() {
|
|
3699
|
-
}
|
|
3700
|
-
var Cache = function() {
|
|
3701
|
-
function Cache2(max, dispose) {
|
|
3702
|
-
if (max === void 0) {
|
|
3703
|
-
max = Infinity;
|
|
3704
|
-
}
|
|
3705
|
-
if (dispose === void 0) {
|
|
3706
|
-
dispose = defaultDispose;
|
|
3707
|
-
}
|
|
3708
|
-
this.max = max;
|
|
3709
|
-
this.dispose = dispose;
|
|
3710
|
-
this.map = new Map();
|
|
3711
|
-
this.newest = null;
|
|
3712
|
-
this.oldest = null;
|
|
3713
|
-
}
|
|
3714
|
-
Cache2.prototype.has = function(key) {
|
|
3715
|
-
return this.map.has(key);
|
|
3716
|
-
};
|
|
3717
|
-
Cache2.prototype.get = function(key) {
|
|
3718
|
-
var node = this.getNode(key);
|
|
3719
|
-
return node && node.value;
|
|
3720
|
-
};
|
|
3721
|
-
Cache2.prototype.getNode = function(key) {
|
|
3722
|
-
var node = this.map.get(key);
|
|
3723
|
-
if (node && node !== this.newest) {
|
|
3724
|
-
var older = node.older, newer = node.newer;
|
|
3725
|
-
if (newer) {
|
|
3726
|
-
newer.older = older;
|
|
3727
|
-
}
|
|
3728
|
-
if (older) {
|
|
3729
|
-
older.newer = newer;
|
|
3730
|
-
}
|
|
3731
|
-
node.older = this.newest;
|
|
3732
|
-
node.older.newer = node;
|
|
3733
|
-
node.newer = null;
|
|
3734
|
-
this.newest = node;
|
|
3735
|
-
if (node === this.oldest) {
|
|
3736
|
-
this.oldest = newer;
|
|
3737
|
-
}
|
|
3738
|
-
}
|
|
3739
|
-
return node;
|
|
3740
|
-
};
|
|
3741
|
-
Cache2.prototype.set = function(key, value) {
|
|
3742
|
-
var node = this.getNode(key);
|
|
3743
|
-
if (node) {
|
|
3744
|
-
return node.value = value;
|
|
3745
|
-
}
|
|
3746
|
-
node = {
|
|
3747
|
-
key,
|
|
3748
|
-
value,
|
|
3749
|
-
newer: null,
|
|
3750
|
-
older: this.newest
|
|
3751
|
-
};
|
|
3752
|
-
if (this.newest) {
|
|
3753
|
-
this.newest.newer = node;
|
|
3754
|
-
}
|
|
3755
|
-
this.newest = node;
|
|
3756
|
-
this.oldest = this.oldest || node;
|
|
3757
|
-
this.map.set(key, node);
|
|
3758
|
-
return node.value;
|
|
3759
|
-
};
|
|
3760
|
-
Cache2.prototype.clean = function() {
|
|
3761
|
-
while (this.oldest && this.map.size > this.max) {
|
|
3762
|
-
this.delete(this.oldest.key);
|
|
3763
|
-
}
|
|
3764
|
-
};
|
|
3765
|
-
Cache2.prototype.delete = function(key) {
|
|
3766
|
-
var node = this.map.get(key);
|
|
3767
|
-
if (node) {
|
|
3768
|
-
if (node === this.newest) {
|
|
3769
|
-
this.newest = node.older;
|
|
3770
|
-
}
|
|
3771
|
-
if (node === this.oldest) {
|
|
3772
|
-
this.oldest = node.newer;
|
|
3773
|
-
}
|
|
3774
|
-
if (node.newer) {
|
|
3775
|
-
node.newer.older = node.older;
|
|
3776
|
-
}
|
|
3777
|
-
if (node.older) {
|
|
3778
|
-
node.older.newer = node.newer;
|
|
3779
|
-
}
|
|
3780
|
-
this.map.delete(key);
|
|
3781
|
-
this.dispose(node.value, key);
|
|
3782
|
-
return true;
|
|
3783
|
-
}
|
|
3784
|
-
return false;
|
|
3785
|
-
};
|
|
3786
|
-
return Cache2;
|
|
3787
|
-
}();
|
|
3788
|
-
var parentEntrySlot = new Slot();
|
|
3789
|
-
var _a;
|
|
3790
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
3791
|
-
var toArray = (_a = Array.from, _a === void 0 ? function(collection) {
|
|
3792
|
-
var array = [];
|
|
3793
|
-
collection.forEach(function(item) {
|
|
3794
|
-
return array.push(item);
|
|
3795
|
-
});
|
|
3796
|
-
return array;
|
|
3797
|
-
} : _a);
|
|
3798
|
-
function maybeUnsubscribe(entryOrDep) {
|
|
3799
|
-
var unsubscribe = entryOrDep.unsubscribe;
|
|
3800
|
-
if (typeof unsubscribe === "function") {
|
|
3801
|
-
entryOrDep.unsubscribe = void 0;
|
|
3802
|
-
unsubscribe();
|
|
3803
|
-
}
|
|
3804
|
-
}
|
|
3805
|
-
var emptySetPool = [];
|
|
3806
|
-
var POOL_TARGET_SIZE = 100;
|
|
3807
|
-
function assert(condition, optionalMessage) {
|
|
3808
|
-
if (!condition) {
|
|
3809
|
-
throw new Error(optionalMessage || "assertion failure");
|
|
3810
|
-
}
|
|
3811
|
-
}
|
|
3812
|
-
function valueIs(a, b) {
|
|
3813
|
-
var len = a.length;
|
|
3814
|
-
return len > 0 && len === b.length && a[len - 1] === b[len - 1];
|
|
3815
|
-
}
|
|
3816
|
-
function valueGet(value) {
|
|
3817
|
-
switch (value.length) {
|
|
3818
|
-
case 0:
|
|
3819
|
-
throw new Error("unknown value");
|
|
3820
|
-
case 1:
|
|
3821
|
-
return value[0];
|
|
3822
|
-
case 2:
|
|
3823
|
-
throw value[1];
|
|
3824
|
-
}
|
|
3825
|
-
}
|
|
3826
|
-
function valueCopy(value) {
|
|
3827
|
-
return value.slice(0);
|
|
3828
|
-
}
|
|
3829
|
-
var Entry = function() {
|
|
3830
|
-
function Entry2(fn) {
|
|
3831
|
-
this.fn = fn;
|
|
3832
|
-
this.parents = new Set();
|
|
3833
|
-
this.childValues = new Map();
|
|
3834
|
-
this.dirtyChildren = null;
|
|
3835
|
-
this.dirty = true;
|
|
3836
|
-
this.recomputing = false;
|
|
3837
|
-
this.value = [];
|
|
3838
|
-
this.deps = null;
|
|
3839
|
-
++Entry2.count;
|
|
3840
|
-
}
|
|
3841
|
-
Entry2.prototype.peek = function() {
|
|
3842
|
-
if (this.value.length === 1 && !mightBeDirty(this)) {
|
|
3843
|
-
rememberParent(this);
|
|
3844
|
-
return this.value[0];
|
|
3845
|
-
}
|
|
3846
|
-
};
|
|
3847
|
-
Entry2.prototype.recompute = function(args) {
|
|
3848
|
-
assert(!this.recomputing, "already recomputing");
|
|
3849
|
-
rememberParent(this);
|
|
3850
|
-
return mightBeDirty(this) ? reallyRecompute(this, args) : valueGet(this.value);
|
|
3851
|
-
};
|
|
3852
|
-
Entry2.prototype.setDirty = function() {
|
|
3853
|
-
if (this.dirty)
|
|
3854
|
-
return;
|
|
3855
|
-
this.dirty = true;
|
|
3856
|
-
this.value.length = 0;
|
|
3857
|
-
reportDirty(this);
|
|
3858
|
-
maybeUnsubscribe(this);
|
|
3859
|
-
};
|
|
3860
|
-
Entry2.prototype.dispose = function() {
|
|
3861
|
-
var _this = this;
|
|
3862
|
-
this.setDirty();
|
|
3863
|
-
forgetChildren(this);
|
|
3864
|
-
eachParent(this, function(parent, child) {
|
|
3865
|
-
parent.setDirty();
|
|
3866
|
-
forgetChild(parent, _this);
|
|
3867
|
-
});
|
|
3868
|
-
};
|
|
3869
|
-
Entry2.prototype.forget = function() {
|
|
3870
|
-
this.dispose();
|
|
3871
|
-
};
|
|
3872
|
-
Entry2.prototype.dependOn = function(dep2) {
|
|
3873
|
-
dep2.add(this);
|
|
3874
|
-
if (!this.deps) {
|
|
3875
|
-
this.deps = emptySetPool.pop() || new Set();
|
|
3876
|
-
}
|
|
3877
|
-
this.deps.add(dep2);
|
|
3878
|
-
};
|
|
3879
|
-
Entry2.prototype.forgetDeps = function() {
|
|
3880
|
-
var _this = this;
|
|
3881
|
-
if (this.deps) {
|
|
3882
|
-
toArray(this.deps).forEach(function(dep2) {
|
|
3883
|
-
return dep2.delete(_this);
|
|
3884
|
-
});
|
|
3885
|
-
this.deps.clear();
|
|
3886
|
-
emptySetPool.push(this.deps);
|
|
3887
|
-
this.deps = null;
|
|
3888
|
-
}
|
|
3889
|
-
};
|
|
3890
|
-
Entry2.count = 0;
|
|
3891
|
-
return Entry2;
|
|
3892
|
-
}();
|
|
3893
|
-
function rememberParent(child) {
|
|
3894
|
-
var parent = parentEntrySlot.getValue();
|
|
3895
|
-
if (parent) {
|
|
3896
|
-
child.parents.add(parent);
|
|
3897
|
-
if (!parent.childValues.has(child)) {
|
|
3898
|
-
parent.childValues.set(child, []);
|
|
3899
|
-
}
|
|
3900
|
-
if (mightBeDirty(child)) {
|
|
3901
|
-
reportDirtyChild(parent, child);
|
|
3902
|
-
} else {
|
|
3903
|
-
reportCleanChild(parent, child);
|
|
3904
|
-
}
|
|
3905
|
-
return parent;
|
|
3906
|
-
}
|
|
3907
|
-
}
|
|
3908
|
-
function reallyRecompute(entry, args) {
|
|
3909
|
-
forgetChildren(entry);
|
|
3910
|
-
parentEntrySlot.withValue(entry, recomputeNewValue, [entry, args]);
|
|
3911
|
-
if (maybeSubscribe(entry, args)) {
|
|
3912
|
-
setClean(entry);
|
|
3913
|
-
}
|
|
3914
|
-
return valueGet(entry.value);
|
|
3915
|
-
}
|
|
3916
|
-
function recomputeNewValue(entry, args) {
|
|
3917
|
-
entry.recomputing = true;
|
|
3918
|
-
entry.value.length = 0;
|
|
3919
|
-
try {
|
|
3920
|
-
entry.value[0] = entry.fn.apply(null, args);
|
|
3921
|
-
} catch (e) {
|
|
3922
|
-
entry.value[1] = e;
|
|
3923
|
-
}
|
|
3924
|
-
entry.recomputing = false;
|
|
3925
|
-
}
|
|
3926
|
-
function mightBeDirty(entry) {
|
|
3927
|
-
return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size);
|
|
3928
|
-
}
|
|
3929
|
-
function setClean(entry) {
|
|
3930
|
-
entry.dirty = false;
|
|
3931
|
-
if (mightBeDirty(entry)) {
|
|
3932
|
-
return;
|
|
3933
|
-
}
|
|
3934
|
-
reportClean(entry);
|
|
3935
|
-
}
|
|
3936
|
-
function reportDirty(child) {
|
|
3937
|
-
eachParent(child, reportDirtyChild);
|
|
3938
|
-
}
|
|
3939
|
-
function reportClean(child) {
|
|
3940
|
-
eachParent(child, reportCleanChild);
|
|
3941
|
-
}
|
|
3942
|
-
function eachParent(child, callback) {
|
|
3943
|
-
var parentCount = child.parents.size;
|
|
3944
|
-
if (parentCount) {
|
|
3945
|
-
var parents = toArray(child.parents);
|
|
3946
|
-
for (var i = 0; i < parentCount; ++i) {
|
|
3947
|
-
callback(parents[i], child);
|
|
3948
|
-
}
|
|
3949
|
-
}
|
|
3950
|
-
}
|
|
3951
|
-
function reportDirtyChild(parent, child) {
|
|
3952
|
-
assert(parent.childValues.has(child));
|
|
3953
|
-
assert(mightBeDirty(child));
|
|
3954
|
-
var parentWasClean = !mightBeDirty(parent);
|
|
3955
|
-
if (!parent.dirtyChildren) {
|
|
3956
|
-
parent.dirtyChildren = emptySetPool.pop() || new Set();
|
|
3957
|
-
} else if (parent.dirtyChildren.has(child)) {
|
|
3958
|
-
return;
|
|
3959
|
-
}
|
|
3960
|
-
parent.dirtyChildren.add(child);
|
|
3961
|
-
if (parentWasClean) {
|
|
3962
|
-
reportDirty(parent);
|
|
3963
|
-
}
|
|
3964
|
-
}
|
|
3965
|
-
function reportCleanChild(parent, child) {
|
|
3966
|
-
assert(parent.childValues.has(child));
|
|
3967
|
-
assert(!mightBeDirty(child));
|
|
3968
|
-
var childValue = parent.childValues.get(child);
|
|
3969
|
-
if (childValue.length === 0) {
|
|
3970
|
-
parent.childValues.set(child, valueCopy(child.value));
|
|
3971
|
-
} else if (!valueIs(childValue, child.value)) {
|
|
3972
|
-
parent.setDirty();
|
|
3973
|
-
}
|
|
3974
|
-
removeDirtyChild(parent, child);
|
|
3975
|
-
if (mightBeDirty(parent)) {
|
|
3976
|
-
return;
|
|
3977
|
-
}
|
|
3978
|
-
reportClean(parent);
|
|
3979
|
-
}
|
|
3980
|
-
function removeDirtyChild(parent, child) {
|
|
3981
|
-
var dc = parent.dirtyChildren;
|
|
3982
|
-
if (dc) {
|
|
3983
|
-
dc.delete(child);
|
|
3984
|
-
if (dc.size === 0) {
|
|
3985
|
-
if (emptySetPool.length < POOL_TARGET_SIZE) {
|
|
3986
|
-
emptySetPool.push(dc);
|
|
3987
|
-
}
|
|
3988
|
-
parent.dirtyChildren = null;
|
|
3989
|
-
}
|
|
3990
|
-
}
|
|
3991
|
-
}
|
|
3992
|
-
function forgetChildren(parent) {
|
|
3993
|
-
if (parent.childValues.size > 0) {
|
|
3994
|
-
parent.childValues.forEach(function(_value, child) {
|
|
3995
|
-
forgetChild(parent, child);
|
|
3996
|
-
});
|
|
3997
|
-
}
|
|
3998
|
-
parent.forgetDeps();
|
|
3999
|
-
assert(parent.dirtyChildren === null);
|
|
4000
|
-
}
|
|
4001
|
-
function forgetChild(parent, child) {
|
|
4002
|
-
child.parents.delete(parent);
|
|
4003
|
-
parent.childValues.delete(child);
|
|
4004
|
-
removeDirtyChild(parent, child);
|
|
4005
|
-
}
|
|
4006
|
-
function maybeSubscribe(entry, args) {
|
|
4007
|
-
if (typeof entry.subscribe === "function") {
|
|
4008
|
-
try {
|
|
4009
|
-
maybeUnsubscribe(entry);
|
|
4010
|
-
entry.unsubscribe = entry.subscribe.apply(null, args);
|
|
4011
|
-
} catch (e) {
|
|
4012
|
-
entry.setDirty();
|
|
4013
|
-
return false;
|
|
4014
|
-
}
|
|
4015
|
-
}
|
|
4016
|
-
return true;
|
|
4017
|
-
}
|
|
4018
|
-
var EntryMethods = {
|
|
4019
|
-
setDirty: true,
|
|
4020
|
-
dispose: true,
|
|
4021
|
-
forget: true
|
|
4022
|
-
};
|
|
4023
|
-
function dep(options) {
|
|
4024
|
-
var depsByKey = new Map();
|
|
4025
|
-
var subscribe = options && options.subscribe;
|
|
4026
|
-
function depend(key) {
|
|
4027
|
-
var parent = parentEntrySlot.getValue();
|
|
4028
|
-
if (parent) {
|
|
4029
|
-
var dep_1 = depsByKey.get(key);
|
|
4030
|
-
if (!dep_1) {
|
|
4031
|
-
depsByKey.set(key, dep_1 = new Set());
|
|
4032
|
-
}
|
|
4033
|
-
parent.dependOn(dep_1);
|
|
4034
|
-
if (typeof subscribe === "function") {
|
|
4035
|
-
maybeUnsubscribe(dep_1);
|
|
4036
|
-
dep_1.unsubscribe = subscribe(key);
|
|
4037
|
-
}
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4040
|
-
depend.dirty = function dirty(key, entryMethodName) {
|
|
4041
|
-
var dep2 = depsByKey.get(key);
|
|
4042
|
-
if (dep2) {
|
|
4043
|
-
var m_1 = entryMethodName && hasOwnProperty.call(EntryMethods, entryMethodName) ? entryMethodName : "setDirty";
|
|
4044
|
-
toArray(dep2).forEach(function(entry) {
|
|
4045
|
-
return entry[m_1]();
|
|
4046
|
-
});
|
|
4047
|
-
depsByKey.delete(key);
|
|
4048
|
-
maybeUnsubscribe(dep2);
|
|
4049
|
-
}
|
|
4050
|
-
};
|
|
4051
|
-
return depend;
|
|
4052
|
-
}
|
|
4053
|
-
function makeDefaultMakeCacheKeyFunction() {
|
|
4054
|
-
var keyTrie = new Trie(typeof WeakMap === "function");
|
|
4055
|
-
return function() {
|
|
4056
|
-
return keyTrie.lookupArray(arguments);
|
|
4057
|
-
};
|
|
4058
|
-
}
|
|
4059
|
-
makeDefaultMakeCacheKeyFunction();
|
|
4060
|
-
var caches = new Set();
|
|
4061
|
-
function wrap(originalFunction, options) {
|
|
4062
|
-
if (options === void 0) {
|
|
4063
|
-
options = Object.create(null);
|
|
4064
|
-
}
|
|
4065
|
-
var cache = new Cache(options.max || Math.pow(2, 16), function(entry) {
|
|
4066
|
-
return entry.dispose();
|
|
4067
|
-
});
|
|
4068
|
-
var keyArgs = options.keyArgs;
|
|
4069
|
-
var makeCacheKey = options.makeCacheKey || makeDefaultMakeCacheKeyFunction();
|
|
4070
|
-
var optimistic = function() {
|
|
4071
|
-
var key = makeCacheKey.apply(null, keyArgs ? keyArgs.apply(null, arguments) : arguments);
|
|
4072
|
-
if (key === void 0) {
|
|
4073
|
-
return originalFunction.apply(null, arguments);
|
|
4074
|
-
}
|
|
4075
|
-
var entry = cache.get(key);
|
|
4076
|
-
if (!entry) {
|
|
4077
|
-
cache.set(key, entry = new Entry(originalFunction));
|
|
4078
|
-
entry.subscribe = options.subscribe;
|
|
4079
|
-
entry.forget = function() {
|
|
4080
|
-
return cache.delete(key);
|
|
4081
|
-
};
|
|
4082
|
-
}
|
|
4083
|
-
var value = entry.recompute(Array.prototype.slice.call(arguments));
|
|
4084
|
-
cache.set(key, entry);
|
|
4085
|
-
caches.add(cache);
|
|
4086
|
-
if (!parentEntrySlot.hasValue()) {
|
|
4087
|
-
caches.forEach(function(cache2) {
|
|
4088
|
-
return cache2.clean();
|
|
4089
|
-
});
|
|
4090
|
-
caches.clear();
|
|
4091
|
-
}
|
|
4092
|
-
return value;
|
|
4093
|
-
};
|
|
4094
|
-
Object.defineProperty(optimistic, "size", {
|
|
4095
|
-
get: function() {
|
|
4096
|
-
return cache["map"].size;
|
|
4097
|
-
},
|
|
4098
|
-
configurable: false,
|
|
4099
|
-
enumerable: false
|
|
4100
|
-
});
|
|
4101
|
-
function dirtyKey(key) {
|
|
4102
|
-
var entry = cache.get(key);
|
|
4103
|
-
if (entry) {
|
|
4104
|
-
entry.setDirty();
|
|
4105
|
-
}
|
|
4106
|
-
}
|
|
4107
|
-
optimistic.dirtyKey = dirtyKey;
|
|
4108
|
-
optimistic.dirty = function dirty() {
|
|
4109
|
-
dirtyKey(makeCacheKey.apply(null, arguments));
|
|
4110
|
-
};
|
|
4111
|
-
function peekKey(key) {
|
|
4112
|
-
var entry = cache.get(key);
|
|
4113
|
-
if (entry) {
|
|
4114
|
-
return entry.peek();
|
|
4115
|
-
}
|
|
4116
|
-
}
|
|
4117
|
-
optimistic.peekKey = peekKey;
|
|
4118
|
-
optimistic.peek = function peek() {
|
|
4119
|
-
return peekKey(makeCacheKey.apply(null, arguments));
|
|
4120
|
-
};
|
|
4121
|
-
function forgetKey(key) {
|
|
4122
|
-
return cache.delete(key);
|
|
4123
|
-
}
|
|
4124
|
-
optimistic.forgetKey = forgetKey;
|
|
4125
|
-
optimistic.forget = function forget() {
|
|
4126
|
-
return forgetKey(makeCacheKey.apply(null, arguments));
|
|
4127
|
-
};
|
|
4128
|
-
optimistic.makeCacheKey = makeCacheKey;
|
|
4129
|
-
optimistic.getKey = keyArgs ? function getKey() {
|
|
4130
|
-
return makeCacheKey.apply(null, keyArgs.apply(null, arguments));
|
|
4131
|
-
} : makeCacheKey;
|
|
4132
|
-
return Object.freeze(optimistic);
|
|
4133
|
-
}
|
|
4134
|
-
var ApolloCache = function() {
|
|
4135
|
-
function ApolloCache2() {
|
|
4136
|
-
this.getFragmentDoc = wrap(getFragmentQueryDocument);
|
|
4137
|
-
}
|
|
4138
|
-
ApolloCache2.prototype.batch = function(options) {
|
|
4139
|
-
var _this = this;
|
|
4140
|
-
var optimisticId = typeof options.optimistic === "string" ? options.optimistic : options.optimistic === false ? null : void 0;
|
|
4141
|
-
var updateResult;
|
|
4142
|
-
this.performTransaction(function() {
|
|
4143
|
-
return updateResult = options.update(_this);
|
|
4144
|
-
}, optimisticId);
|
|
4145
|
-
return updateResult;
|
|
4146
|
-
};
|
|
4147
|
-
ApolloCache2.prototype.recordOptimisticTransaction = function(transaction, optimisticId) {
|
|
4148
|
-
this.performTransaction(transaction, optimisticId);
|
|
4149
|
-
};
|
|
4150
|
-
ApolloCache2.prototype.transformDocument = function(document) {
|
|
4151
|
-
return document;
|
|
4152
|
-
};
|
|
4153
|
-
ApolloCache2.prototype.identify = function(object) {
|
|
4154
|
-
return;
|
|
4155
|
-
};
|
|
4156
|
-
ApolloCache2.prototype.gc = function() {
|
|
4157
|
-
return [];
|
|
4158
|
-
};
|
|
4159
|
-
ApolloCache2.prototype.modify = function(options) {
|
|
4160
|
-
return false;
|
|
4161
|
-
};
|
|
4162
|
-
ApolloCache2.prototype.transformForLink = function(document) {
|
|
4163
|
-
return document;
|
|
4164
|
-
};
|
|
4165
|
-
ApolloCache2.prototype.readQuery = function(options, optimistic) {
|
|
4166
|
-
if (optimistic === void 0) {
|
|
4167
|
-
optimistic = !!options.optimistic;
|
|
4168
|
-
}
|
|
4169
|
-
return this.read(__assign(__assign({}, options), { rootId: options.id || "ROOT_QUERY", optimistic }));
|
|
4170
|
-
};
|
|
4171
|
-
ApolloCache2.prototype.readFragment = function(options, optimistic) {
|
|
4172
|
-
if (optimistic === void 0) {
|
|
4173
|
-
optimistic = !!options.optimistic;
|
|
4174
|
-
}
|
|
4175
|
-
return this.read(__assign(__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic }));
|
|
4176
|
-
};
|
|
4177
|
-
ApolloCache2.prototype.writeQuery = function(_a2) {
|
|
4178
|
-
var id = _a2.id, data = _a2.data, options = __rest(_a2, ["id", "data"]);
|
|
4179
|
-
return this.write(Object.assign(options, {
|
|
4180
|
-
dataId: id || "ROOT_QUERY",
|
|
4181
|
-
result: data
|
|
4182
|
-
}));
|
|
4183
|
-
};
|
|
4184
|
-
ApolloCache2.prototype.writeFragment = function(_a2) {
|
|
4185
|
-
var id = _a2.id, data = _a2.data, fragment = _a2.fragment, fragmentName = _a2.fragmentName, options = __rest(_a2, ["id", "data", "fragment", "fragmentName"]);
|
|
4186
|
-
return this.write(Object.assign(options, {
|
|
4187
|
-
query: this.getFragmentDoc(fragment, fragmentName),
|
|
4188
|
-
dataId: id,
|
|
4189
|
-
result: data
|
|
4190
|
-
}));
|
|
4191
|
-
};
|
|
4192
|
-
ApolloCache2.prototype.updateQuery = function(options, update) {
|
|
4193
|
-
return this.batch({
|
|
4194
|
-
update: function(cache) {
|
|
4195
|
-
var value = cache.readQuery(options);
|
|
4196
|
-
var data = update(value);
|
|
4197
|
-
if (data === void 0 || data === null)
|
|
4198
|
-
return value;
|
|
4199
|
-
cache.writeQuery(__assign(__assign({}, options), { data }));
|
|
4200
|
-
return data;
|
|
4201
|
-
}
|
|
4202
|
-
});
|
|
4203
|
-
};
|
|
4204
|
-
ApolloCache2.prototype.updateFragment = function(options, update) {
|
|
4205
|
-
return this.batch({
|
|
4206
|
-
update: function(cache) {
|
|
4207
|
-
var value = cache.readFragment(options);
|
|
4208
|
-
var data = update(value);
|
|
4209
|
-
if (data === void 0 || data === null)
|
|
4210
|
-
return value;
|
|
4211
|
-
cache.writeFragment(__assign(__assign({}, options), { data }));
|
|
4212
|
-
return data;
|
|
4213
|
-
}
|
|
4214
|
-
});
|
|
4215
|
-
};
|
|
4216
|
-
return ApolloCache2;
|
|
4217
|
-
}();
|
|
4218
|
-
var MissingFieldError = function() {
|
|
4219
|
-
function MissingFieldError2(message2, path2, query, variables) {
|
|
4220
|
-
this.message = message2;
|
|
4221
|
-
this.path = path2;
|
|
4222
|
-
this.query = query;
|
|
4223
|
-
this.variables = variables;
|
|
4224
|
-
}
|
|
4225
|
-
return MissingFieldError2;
|
|
4226
|
-
}();
|
|
4227
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
4228
|
-
function defaultDataIdFromObject(_a2, context) {
|
|
4229
|
-
var __typename = _a2.__typename, id = _a2.id, _id = _a2._id;
|
|
4230
|
-
if (typeof __typename === "string") {
|
|
4231
|
-
if (context) {
|
|
4232
|
-
context.keyObject = id !== void 0 ? { id } : _id !== void 0 ? { _id } : void 0;
|
|
4233
|
-
}
|
|
4234
|
-
if (id === void 0)
|
|
4235
|
-
id = _id;
|
|
4236
|
-
if (id !== void 0) {
|
|
4237
|
-
return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string" ? id : JSON.stringify(id));
|
|
4238
|
-
}
|
|
4239
|
-
}
|
|
4240
|
-
}
|
|
4241
|
-
var defaultConfig = {
|
|
4242
|
-
dataIdFromObject: defaultDataIdFromObject,
|
|
4243
|
-
addTypename: true,
|
|
4244
|
-
resultCaching: true,
|
|
4245
|
-
canonizeResults: false
|
|
4246
|
-
};
|
|
4247
|
-
function normalizeConfig(config) {
|
|
4248
|
-
return compact(defaultConfig, config);
|
|
4249
|
-
}
|
|
4250
|
-
function shouldCanonizeResults(config) {
|
|
4251
|
-
var value = config.canonizeResults;
|
|
4252
|
-
return value === void 0 ? defaultConfig.canonizeResults : value;
|
|
4253
|
-
}
|
|
4254
|
-
function getTypenameFromStoreObject(store, objectOrReference) {
|
|
4255
|
-
return isReference(objectOrReference) ? store.get(objectOrReference.__ref, "__typename") : objectOrReference && objectOrReference.__typename;
|
|
4256
|
-
}
|
|
4257
|
-
var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;
|
|
4258
|
-
function fieldNameFromStoreName(storeFieldName) {
|
|
4259
|
-
var match = storeFieldName.match(TypeOrFieldNameRegExp);
|
|
4260
|
-
return match ? match[0] : storeFieldName;
|
|
4261
|
-
}
|
|
4262
|
-
function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
4263
|
-
if (isNonNullObject(result)) {
|
|
4264
|
-
return Array.isArray(result) ? result.every(function(item) {
|
|
4265
|
-
return selectionSetMatchesResult(selectionSet, item, variables);
|
|
4266
|
-
}) : selectionSet.selections.every(function(field) {
|
|
4267
|
-
if (isField(field) && shouldInclude(field, variables)) {
|
|
4268
|
-
var key = resultKeyNameFromField(field);
|
|
4269
|
-
return hasOwn.call(result, key) && (!field.selectionSet || selectionSetMatchesResult(field.selectionSet, result[key], variables));
|
|
4270
|
-
}
|
|
4271
|
-
return true;
|
|
4272
|
-
});
|
|
4273
|
-
}
|
|
4274
|
-
return false;
|
|
4275
|
-
}
|
|
4276
|
-
function storeValueIsStoreObject(value) {
|
|
4277
|
-
return isNonNullObject(value) && !isReference(value) && !Array.isArray(value);
|
|
4278
|
-
}
|
|
4279
|
-
function makeProcessedFieldsMerger() {
|
|
4280
|
-
return new DeepMerger();
|
|
4281
|
-
}
|
|
4282
|
-
var DELETE = Object.create(null);
|
|
4283
|
-
var delModifier = function() {
|
|
4284
|
-
return DELETE;
|
|
4285
|
-
};
|
|
4286
|
-
var INVALIDATE = Object.create(null);
|
|
4287
|
-
var EntityStore = function() {
|
|
4288
|
-
function EntityStore2(policies, group) {
|
|
4289
|
-
var _this = this;
|
|
4290
|
-
this.policies = policies;
|
|
4291
|
-
this.group = group;
|
|
4292
|
-
this.data = Object.create(null);
|
|
4293
|
-
this.rootIds = Object.create(null);
|
|
4294
|
-
this.refs = Object.create(null);
|
|
4295
|
-
this.getFieldValue = function(objectOrReference, storeFieldName) {
|
|
4296
|
-
return maybeDeepFreeze(isReference(objectOrReference) ? _this.get(objectOrReference.__ref, storeFieldName) : objectOrReference && objectOrReference[storeFieldName]);
|
|
4297
|
-
};
|
|
4298
|
-
this.canRead = function(objOrRef) {
|
|
4299
|
-
return isReference(objOrRef) ? _this.has(objOrRef.__ref) : typeof objOrRef === "object";
|
|
4300
|
-
};
|
|
4301
|
-
this.toReference = function(objOrIdOrRef, mergeIntoStore) {
|
|
4302
|
-
if (typeof objOrIdOrRef === "string") {
|
|
4303
|
-
return makeReference(objOrIdOrRef);
|
|
4304
|
-
}
|
|
4305
|
-
if (isReference(objOrIdOrRef)) {
|
|
4306
|
-
return objOrIdOrRef;
|
|
4307
|
-
}
|
|
4308
|
-
var id = _this.policies.identify(objOrIdOrRef)[0];
|
|
4309
|
-
if (id) {
|
|
4310
|
-
var ref2 = makeReference(id);
|
|
4311
|
-
if (mergeIntoStore) {
|
|
4312
|
-
_this.merge(id, objOrIdOrRef);
|
|
4313
|
-
}
|
|
4314
|
-
return ref2;
|
|
4315
|
-
}
|
|
4316
|
-
};
|
|
4317
|
-
}
|
|
4318
|
-
EntityStore2.prototype.toObject = function() {
|
|
4319
|
-
return __assign({}, this.data);
|
|
4320
|
-
};
|
|
4321
|
-
EntityStore2.prototype.has = function(dataId) {
|
|
4322
|
-
return this.lookup(dataId, true) !== void 0;
|
|
4323
|
-
};
|
|
4324
|
-
EntityStore2.prototype.get = function(dataId, fieldName) {
|
|
4325
|
-
this.group.depend(dataId, fieldName);
|
|
4326
|
-
if (hasOwn.call(this.data, dataId)) {
|
|
4327
|
-
var storeObject = this.data[dataId];
|
|
4328
|
-
if (storeObject && hasOwn.call(storeObject, fieldName)) {
|
|
4329
|
-
return storeObject[fieldName];
|
|
4330
|
-
}
|
|
4331
|
-
}
|
|
4332
|
-
if (fieldName === "__typename" && hasOwn.call(this.policies.rootTypenamesById, dataId)) {
|
|
4333
|
-
return this.policies.rootTypenamesById[dataId];
|
|
4334
|
-
}
|
|
4335
|
-
if (this instanceof Layer) {
|
|
4336
|
-
return this.parent.get(dataId, fieldName);
|
|
4337
|
-
}
|
|
4338
|
-
};
|
|
4339
|
-
EntityStore2.prototype.lookup = function(dataId, dependOnExistence) {
|
|
4340
|
-
if (dependOnExistence)
|
|
4341
|
-
this.group.depend(dataId, "__exists");
|
|
4342
|
-
if (hasOwn.call(this.data, dataId)) {
|
|
4343
|
-
return this.data[dataId];
|
|
4344
|
-
}
|
|
4345
|
-
if (this instanceof Layer) {
|
|
4346
|
-
return this.parent.lookup(dataId, dependOnExistence);
|
|
4347
|
-
}
|
|
4348
|
-
if (this.policies.rootTypenamesById[dataId]) {
|
|
4349
|
-
return Object.create(null);
|
|
4350
|
-
}
|
|
4351
|
-
};
|
|
4352
|
-
EntityStore2.prototype.merge = function(older, newer) {
|
|
4353
|
-
var _this = this;
|
|
4354
|
-
var dataId;
|
|
4355
|
-
if (isReference(older))
|
|
4356
|
-
older = older.__ref;
|
|
4357
|
-
if (isReference(newer))
|
|
4358
|
-
newer = newer.__ref;
|
|
4359
|
-
var existing = typeof older === "string" ? this.lookup(dataId = older) : older;
|
|
4360
|
-
var incoming = typeof newer === "string" ? this.lookup(dataId = newer) : newer;
|
|
4361
|
-
if (!incoming)
|
|
4362
|
-
return;
|
|
4363
|
-
__DEV__ ? invariant(typeof dataId === "string", "store.merge expects a string ID") : invariant(typeof dataId === "string", 1);
|
|
4364
|
-
var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);
|
|
4365
|
-
this.data[dataId] = merged;
|
|
4366
|
-
if (merged !== existing) {
|
|
4367
|
-
delete this.refs[dataId];
|
|
4368
|
-
if (this.group.caching) {
|
|
4369
|
-
var fieldsToDirty_1 = Object.create(null);
|
|
4370
|
-
if (!existing)
|
|
4371
|
-
fieldsToDirty_1.__exists = 1;
|
|
4372
|
-
Object.keys(incoming).forEach(function(storeFieldName) {
|
|
4373
|
-
if (!existing || existing[storeFieldName] !== merged[storeFieldName]) {
|
|
4374
|
-
fieldsToDirty_1[storeFieldName] = 1;
|
|
4375
|
-
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
4376
|
-
if (fieldName !== storeFieldName && !_this.policies.hasKeyArgs(merged.__typename, fieldName)) {
|
|
4377
|
-
fieldsToDirty_1[fieldName] = 1;
|
|
4378
|
-
}
|
|
4379
|
-
if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) {
|
|
4380
|
-
delete merged[storeFieldName];
|
|
4381
|
-
}
|
|
4382
|
-
}
|
|
4383
|
-
});
|
|
4384
|
-
if (fieldsToDirty_1.__typename && !(existing && existing.__typename) && this.policies.rootTypenamesById[dataId] === merged.__typename) {
|
|
4385
|
-
delete fieldsToDirty_1.__typename;
|
|
4386
|
-
}
|
|
4387
|
-
Object.keys(fieldsToDirty_1).forEach(function(fieldName) {
|
|
4388
|
-
return _this.group.dirty(dataId, fieldName);
|
|
4389
|
-
});
|
|
4390
|
-
}
|
|
4391
|
-
}
|
|
4392
|
-
};
|
|
4393
|
-
EntityStore2.prototype.modify = function(dataId, fields) {
|
|
4394
|
-
var _this = this;
|
|
4395
|
-
var storeObject = this.lookup(dataId);
|
|
4396
|
-
if (storeObject) {
|
|
4397
|
-
var changedFields_1 = Object.create(null);
|
|
4398
|
-
var needToMerge_1 = false;
|
|
4399
|
-
var allDeleted_1 = true;
|
|
4400
|
-
var sharedDetails_1 = {
|
|
4401
|
-
DELETE,
|
|
4402
|
-
INVALIDATE,
|
|
4403
|
-
isReference,
|
|
4404
|
-
toReference: this.toReference,
|
|
4405
|
-
canRead: this.canRead,
|
|
4406
|
-
readField: function(fieldNameOrOptions, from) {
|
|
4407
|
-
return _this.policies.readField(typeof fieldNameOrOptions === "string" ? {
|
|
4408
|
-
fieldName: fieldNameOrOptions,
|
|
4409
|
-
from: from || makeReference(dataId)
|
|
4410
|
-
} : fieldNameOrOptions, { store: _this });
|
|
4411
|
-
}
|
|
4412
|
-
};
|
|
4413
|
-
Object.keys(storeObject).forEach(function(storeFieldName) {
|
|
4414
|
-
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
4415
|
-
var fieldValue = storeObject[storeFieldName];
|
|
4416
|
-
if (fieldValue === void 0)
|
|
4417
|
-
return;
|
|
4418
|
-
var modify = typeof fields === "function" ? fields : fields[storeFieldName] || fields[fieldName];
|
|
4419
|
-
if (modify) {
|
|
4420
|
-
var newValue = modify === delModifier ? DELETE : modify(maybeDeepFreeze(fieldValue), __assign(__assign({}, sharedDetails_1), { fieldName, storeFieldName, storage: _this.getStorage(dataId, storeFieldName) }));
|
|
4421
|
-
if (newValue === INVALIDATE) {
|
|
4422
|
-
_this.group.dirty(dataId, storeFieldName);
|
|
4423
|
-
} else {
|
|
4424
|
-
if (newValue === DELETE)
|
|
4425
|
-
newValue = void 0;
|
|
4426
|
-
if (newValue !== fieldValue) {
|
|
4427
|
-
changedFields_1[storeFieldName] = newValue;
|
|
4428
|
-
needToMerge_1 = true;
|
|
4429
|
-
fieldValue = newValue;
|
|
4430
|
-
}
|
|
4431
|
-
}
|
|
4432
|
-
}
|
|
4433
|
-
if (fieldValue !== void 0) {
|
|
4434
|
-
allDeleted_1 = false;
|
|
4435
|
-
}
|
|
4436
|
-
});
|
|
4437
|
-
if (needToMerge_1) {
|
|
4438
|
-
this.merge(dataId, changedFields_1);
|
|
4439
|
-
if (allDeleted_1) {
|
|
4440
|
-
if (this instanceof Layer) {
|
|
4441
|
-
this.data[dataId] = void 0;
|
|
4442
|
-
} else {
|
|
4443
|
-
delete this.data[dataId];
|
|
4444
|
-
}
|
|
4445
|
-
this.group.dirty(dataId, "__exists");
|
|
4446
|
-
}
|
|
4447
|
-
return true;
|
|
4448
|
-
}
|
|
4449
|
-
}
|
|
4450
|
-
return false;
|
|
4451
|
-
};
|
|
4452
|
-
EntityStore2.prototype.delete = function(dataId, fieldName, args) {
|
|
4453
|
-
var _a2;
|
|
4454
|
-
var storeObject = this.lookup(dataId);
|
|
4455
|
-
if (storeObject) {
|
|
4456
|
-
var typename = this.getFieldValue(storeObject, "__typename");
|
|
4457
|
-
var storeFieldName = fieldName && args ? this.policies.getStoreFieldName({ typename, fieldName, args }) : fieldName;
|
|
4458
|
-
return this.modify(dataId, storeFieldName ? (_a2 = {}, _a2[storeFieldName] = delModifier, _a2) : delModifier);
|
|
4459
|
-
}
|
|
4460
|
-
return false;
|
|
4461
|
-
};
|
|
4462
|
-
EntityStore2.prototype.evict = function(options, limit) {
|
|
4463
|
-
var evicted = false;
|
|
4464
|
-
if (options.id) {
|
|
4465
|
-
if (hasOwn.call(this.data, options.id)) {
|
|
4466
|
-
evicted = this.delete(options.id, options.fieldName, options.args);
|
|
4467
|
-
}
|
|
4468
|
-
if (this instanceof Layer && this !== limit) {
|
|
4469
|
-
evicted = this.parent.evict(options, limit) || evicted;
|
|
4470
|
-
}
|
|
4471
|
-
if (options.fieldName || evicted) {
|
|
4472
|
-
this.group.dirty(options.id, options.fieldName || "__exists");
|
|
4473
|
-
}
|
|
4474
|
-
}
|
|
4475
|
-
return evicted;
|
|
4476
|
-
};
|
|
4477
|
-
EntityStore2.prototype.clear = function() {
|
|
4478
|
-
this.replace(null);
|
|
4479
|
-
};
|
|
4480
|
-
EntityStore2.prototype.extract = function() {
|
|
4481
|
-
var _this = this;
|
|
4482
|
-
var obj = this.toObject();
|
|
4483
|
-
var extraRootIds = [];
|
|
4484
|
-
this.getRootIdSet().forEach(function(id) {
|
|
4485
|
-
if (!hasOwn.call(_this.policies.rootTypenamesById, id)) {
|
|
4486
|
-
extraRootIds.push(id);
|
|
4487
|
-
}
|
|
4488
|
-
});
|
|
4489
|
-
if (extraRootIds.length) {
|
|
4490
|
-
obj.__META = { extraRootIds: extraRootIds.sort() };
|
|
4491
|
-
}
|
|
4492
|
-
return obj;
|
|
4493
|
-
};
|
|
4494
|
-
EntityStore2.prototype.replace = function(newData) {
|
|
4495
|
-
var _this = this;
|
|
4496
|
-
Object.keys(this.data).forEach(function(dataId) {
|
|
4497
|
-
if (!(newData && hasOwn.call(newData, dataId))) {
|
|
4498
|
-
_this.delete(dataId);
|
|
4499
|
-
}
|
|
4500
|
-
});
|
|
4501
|
-
if (newData) {
|
|
4502
|
-
var __META = newData.__META, rest_1 = __rest(newData, ["__META"]);
|
|
4503
|
-
Object.keys(rest_1).forEach(function(dataId) {
|
|
4504
|
-
_this.merge(dataId, rest_1[dataId]);
|
|
4505
|
-
});
|
|
4506
|
-
if (__META) {
|
|
4507
|
-
__META.extraRootIds.forEach(this.retain, this);
|
|
4508
|
-
}
|
|
4509
|
-
}
|
|
4510
|
-
};
|
|
4511
|
-
EntityStore2.prototype.retain = function(rootId) {
|
|
4512
|
-
return this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1;
|
|
4513
|
-
};
|
|
4514
|
-
EntityStore2.prototype.release = function(rootId) {
|
|
4515
|
-
if (this.rootIds[rootId] > 0) {
|
|
4516
|
-
var count = --this.rootIds[rootId];
|
|
4517
|
-
if (!count)
|
|
4518
|
-
delete this.rootIds[rootId];
|
|
4519
|
-
return count;
|
|
4520
|
-
}
|
|
4521
|
-
return 0;
|
|
4522
|
-
};
|
|
4523
|
-
EntityStore2.prototype.getRootIdSet = function(ids) {
|
|
4524
|
-
if (ids === void 0) {
|
|
4525
|
-
ids = new Set();
|
|
4526
|
-
}
|
|
4527
|
-
Object.keys(this.rootIds).forEach(ids.add, ids);
|
|
4528
|
-
if (this instanceof Layer) {
|
|
4529
|
-
this.parent.getRootIdSet(ids);
|
|
4530
|
-
} else {
|
|
4531
|
-
Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids);
|
|
4532
|
-
}
|
|
4533
|
-
return ids;
|
|
4534
|
-
};
|
|
4535
|
-
EntityStore2.prototype.gc = function() {
|
|
4536
|
-
var _this = this;
|
|
4537
|
-
var ids = this.getRootIdSet();
|
|
4538
|
-
var snapshot = this.toObject();
|
|
4539
|
-
ids.forEach(function(id) {
|
|
4540
|
-
if (hasOwn.call(snapshot, id)) {
|
|
4541
|
-
Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids);
|
|
4542
|
-
delete snapshot[id];
|
|
4543
|
-
}
|
|
4544
|
-
});
|
|
4545
|
-
var idsToRemove = Object.keys(snapshot);
|
|
4546
|
-
if (idsToRemove.length) {
|
|
4547
|
-
var root_1 = this;
|
|
4548
|
-
while (root_1 instanceof Layer)
|
|
4549
|
-
root_1 = root_1.parent;
|
|
4550
|
-
idsToRemove.forEach(function(id) {
|
|
4551
|
-
return root_1.delete(id);
|
|
4552
|
-
});
|
|
4553
|
-
}
|
|
4554
|
-
return idsToRemove;
|
|
4555
|
-
};
|
|
4556
|
-
EntityStore2.prototype.findChildRefIds = function(dataId) {
|
|
4557
|
-
if (!hasOwn.call(this.refs, dataId)) {
|
|
4558
|
-
var found_1 = this.refs[dataId] = Object.create(null);
|
|
4559
|
-
var root = this.data[dataId];
|
|
4560
|
-
if (!root)
|
|
4561
|
-
return found_1;
|
|
4562
|
-
var workSet_1 = new Set([root]);
|
|
4563
|
-
workSet_1.forEach(function(obj) {
|
|
4564
|
-
if (isReference(obj)) {
|
|
4565
|
-
found_1[obj.__ref] = true;
|
|
4566
|
-
}
|
|
4567
|
-
if (isNonNullObject(obj)) {
|
|
4568
|
-
Object.keys(obj).forEach(function(key) {
|
|
4569
|
-
var child = obj[key];
|
|
4570
|
-
if (isNonNullObject(child)) {
|
|
4571
|
-
workSet_1.add(child);
|
|
4572
|
-
}
|
|
4573
|
-
});
|
|
4574
|
-
}
|
|
4575
|
-
});
|
|
4576
|
-
}
|
|
4577
|
-
return this.refs[dataId];
|
|
4578
|
-
};
|
|
4579
|
-
EntityStore2.prototype.makeCacheKey = function() {
|
|
4580
|
-
return this.group.keyMaker.lookupArray(arguments);
|
|
4581
|
-
};
|
|
4582
|
-
return EntityStore2;
|
|
4583
|
-
}();
|
|
4584
|
-
var CacheGroup = function() {
|
|
4585
|
-
function CacheGroup2(caching, parent) {
|
|
4586
|
-
if (parent === void 0) {
|
|
4587
|
-
parent = null;
|
|
4588
|
-
}
|
|
4589
|
-
this.caching = caching;
|
|
4590
|
-
this.parent = parent;
|
|
4591
|
-
this.d = null;
|
|
4592
|
-
this.resetCaching();
|
|
4593
|
-
}
|
|
4594
|
-
CacheGroup2.prototype.resetCaching = function() {
|
|
4595
|
-
this.d = this.caching ? dep() : null;
|
|
4596
|
-
this.keyMaker = new Trie(canUseWeakMap);
|
|
4597
|
-
};
|
|
4598
|
-
CacheGroup2.prototype.depend = function(dataId, storeFieldName) {
|
|
4599
|
-
if (this.d) {
|
|
4600
|
-
this.d(makeDepKey(dataId, storeFieldName));
|
|
4601
|
-
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
4602
|
-
if (fieldName !== storeFieldName) {
|
|
4603
|
-
this.d(makeDepKey(dataId, fieldName));
|
|
4604
|
-
}
|
|
4605
|
-
if (this.parent) {
|
|
4606
|
-
this.parent.depend(dataId, storeFieldName);
|
|
4607
|
-
}
|
|
4608
|
-
}
|
|
4609
|
-
};
|
|
4610
|
-
CacheGroup2.prototype.dirty = function(dataId, storeFieldName) {
|
|
4611
|
-
if (this.d) {
|
|
4612
|
-
this.d.dirty(makeDepKey(dataId, storeFieldName), storeFieldName === "__exists" ? "forget" : "setDirty");
|
|
4613
|
-
}
|
|
4614
|
-
};
|
|
4615
|
-
return CacheGroup2;
|
|
4616
|
-
}();
|
|
4617
|
-
function makeDepKey(dataId, storeFieldName) {
|
|
4618
|
-
return storeFieldName + "#" + dataId;
|
|
4619
|
-
}
|
|
4620
|
-
function maybeDependOnExistenceOfEntity(store, entityId) {
|
|
4621
|
-
if (supportsResultCaching(store)) {
|
|
4622
|
-
store.group.depend(entityId, "__exists");
|
|
4623
|
-
}
|
|
4624
|
-
}
|
|
4625
|
-
(function(EntityStore2) {
|
|
4626
|
-
var Root = function(_super) {
|
|
4627
|
-
__extends(Root2, _super);
|
|
4628
|
-
function Root2(_a2) {
|
|
4629
|
-
var policies = _a2.policies, _b = _a2.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a2.seed;
|
|
4630
|
-
var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this;
|
|
4631
|
-
_this.stump = new Stump(_this);
|
|
4632
|
-
_this.storageTrie = new Trie(canUseWeakMap);
|
|
4633
|
-
if (seed)
|
|
4634
|
-
_this.replace(seed);
|
|
4635
|
-
return _this;
|
|
4636
|
-
}
|
|
4637
|
-
Root2.prototype.addLayer = function(layerId, replay) {
|
|
4638
|
-
return this.stump.addLayer(layerId, replay);
|
|
4639
|
-
};
|
|
4640
|
-
Root2.prototype.removeLayer = function() {
|
|
4641
|
-
return this;
|
|
4642
|
-
};
|
|
4643
|
-
Root2.prototype.getStorage = function() {
|
|
4644
|
-
return this.storageTrie.lookupArray(arguments);
|
|
4645
|
-
};
|
|
4646
|
-
return Root2;
|
|
4647
|
-
}(EntityStore2);
|
|
4648
|
-
EntityStore2.Root = Root;
|
|
4649
|
-
})(EntityStore || (EntityStore = {}));
|
|
4650
|
-
var Layer = function(_super) {
|
|
4651
|
-
__extends(Layer2, _super);
|
|
4652
|
-
function Layer2(id, parent, replay, group) {
|
|
4653
|
-
var _this = _super.call(this, parent.policies, group) || this;
|
|
4654
|
-
_this.id = id;
|
|
4655
|
-
_this.parent = parent;
|
|
4656
|
-
_this.replay = replay;
|
|
4657
|
-
_this.group = group;
|
|
4658
|
-
replay(_this);
|
|
4659
|
-
return _this;
|
|
4660
|
-
}
|
|
4661
|
-
Layer2.prototype.addLayer = function(layerId, replay) {
|
|
4662
|
-
return new Layer2(layerId, this, replay, this.group);
|
|
4663
|
-
};
|
|
4664
|
-
Layer2.prototype.removeLayer = function(layerId) {
|
|
4665
|
-
var _this = this;
|
|
4666
|
-
var parent = this.parent.removeLayer(layerId);
|
|
4667
|
-
if (layerId === this.id) {
|
|
4668
|
-
if (this.group.caching) {
|
|
4669
|
-
Object.keys(this.data).forEach(function(dataId) {
|
|
4670
|
-
var ownStoreObject = _this.data[dataId];
|
|
4671
|
-
var parentStoreObject = parent["lookup"](dataId);
|
|
4672
|
-
if (!parentStoreObject) {
|
|
4673
|
-
_this.delete(dataId);
|
|
4674
|
-
} else if (!ownStoreObject) {
|
|
4675
|
-
_this.group.dirty(dataId, "__exists");
|
|
4676
|
-
Object.keys(parentStoreObject).forEach(function(storeFieldName) {
|
|
4677
|
-
_this.group.dirty(dataId, storeFieldName);
|
|
4678
|
-
});
|
|
4679
|
-
} else if (ownStoreObject !== parentStoreObject) {
|
|
4680
|
-
Object.keys(ownStoreObject).forEach(function(storeFieldName) {
|
|
4681
|
-
if (!equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) {
|
|
4682
|
-
_this.group.dirty(dataId, storeFieldName);
|
|
4683
|
-
}
|
|
4684
|
-
});
|
|
4685
|
-
}
|
|
4686
|
-
});
|
|
4687
|
-
}
|
|
4688
|
-
return parent;
|
|
4689
|
-
}
|
|
4690
|
-
if (parent === this.parent)
|
|
4691
|
-
return this;
|
|
4692
|
-
return parent.addLayer(this.id, this.replay);
|
|
4693
|
-
};
|
|
4694
|
-
Layer2.prototype.toObject = function() {
|
|
4695
|
-
return __assign(__assign({}, this.parent.toObject()), this.data);
|
|
4696
|
-
};
|
|
4697
|
-
Layer2.prototype.findChildRefIds = function(dataId) {
|
|
4698
|
-
var fromParent = this.parent.findChildRefIds(dataId);
|
|
4699
|
-
return hasOwn.call(this.data, dataId) ? __assign(__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;
|
|
4700
|
-
};
|
|
4701
|
-
Layer2.prototype.getStorage = function() {
|
|
4702
|
-
var p = this.parent;
|
|
4703
|
-
while (p.parent)
|
|
4704
|
-
p = p.parent;
|
|
4705
|
-
return p.getStorage.apply(p, arguments);
|
|
4706
|
-
};
|
|
4707
|
-
return Layer2;
|
|
4708
|
-
}(EntityStore);
|
|
4709
|
-
var Stump = function(_super) {
|
|
4710
|
-
__extends(Stump2, _super);
|
|
4711
|
-
function Stump2(root) {
|
|
4712
|
-
return _super.call(this, "EntityStore.Stump", root, function() {
|
|
4713
|
-
}, new CacheGroup(root.group.caching, root.group)) || this;
|
|
4714
|
-
}
|
|
4715
|
-
Stump2.prototype.removeLayer = function() {
|
|
4716
|
-
return this;
|
|
4717
|
-
};
|
|
4718
|
-
Stump2.prototype.merge = function() {
|
|
4719
|
-
return this.parent.merge.apply(this.parent, arguments);
|
|
4720
|
-
};
|
|
4721
|
-
return Stump2;
|
|
4722
|
-
}(Layer);
|
|
4723
|
-
function storeObjectReconciler(existingObject, incomingObject, property) {
|
|
4724
|
-
var existingValue = existingObject[property];
|
|
4725
|
-
var incomingValue = incomingObject[property];
|
|
4726
|
-
return equal(existingValue, incomingValue) ? existingValue : incomingValue;
|
|
4727
|
-
}
|
|
4728
|
-
function supportsResultCaching(store) {
|
|
4729
|
-
return !!(store instanceof EntityStore && store.group.caching);
|
|
4730
|
-
}
|
|
4731
|
-
function shallowCopy(value) {
|
|
4732
|
-
if (isNonNullObject(value)) {
|
|
4733
|
-
return Array.isArray(value) ? value.slice(0) : __assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
4734
|
-
}
|
|
4735
|
-
return value;
|
|
4736
|
-
}
|
|
4737
|
-
var ObjectCanon = function() {
|
|
4738
|
-
function ObjectCanon2() {
|
|
4739
|
-
this.known = new (canUseWeakSet ? WeakSet : Set)();
|
|
4740
|
-
this.pool = new Trie(canUseWeakMap);
|
|
4741
|
-
this.passes = new WeakMap();
|
|
4742
|
-
this.keysByJSON = new Map();
|
|
4743
|
-
this.empty = this.admit({});
|
|
4744
|
-
}
|
|
4745
|
-
ObjectCanon2.prototype.isKnown = function(value) {
|
|
4746
|
-
return isNonNullObject(value) && this.known.has(value);
|
|
4747
|
-
};
|
|
4748
|
-
ObjectCanon2.prototype.pass = function(value) {
|
|
4749
|
-
if (isNonNullObject(value)) {
|
|
4750
|
-
var copy = shallowCopy(value);
|
|
4751
|
-
this.passes.set(copy, value);
|
|
4752
|
-
return copy;
|
|
4753
|
-
}
|
|
4754
|
-
return value;
|
|
4755
|
-
};
|
|
4756
|
-
ObjectCanon2.prototype.admit = function(value) {
|
|
4757
|
-
var _this = this;
|
|
4758
|
-
if (isNonNullObject(value)) {
|
|
4759
|
-
var original = this.passes.get(value);
|
|
4760
|
-
if (original)
|
|
4761
|
-
return original;
|
|
4762
|
-
var proto = Object.getPrototypeOf(value);
|
|
4763
|
-
switch (proto) {
|
|
4764
|
-
case Array.prototype: {
|
|
4765
|
-
if (this.known.has(value))
|
|
4766
|
-
return value;
|
|
4767
|
-
var array = value.map(this.admit, this);
|
|
4768
|
-
var node = this.pool.lookupArray(array);
|
|
4769
|
-
if (!node.array) {
|
|
4770
|
-
this.known.add(node.array = array);
|
|
4771
|
-
if (__DEV__) {
|
|
4772
|
-
Object.freeze(array);
|
|
4773
|
-
}
|
|
4774
|
-
}
|
|
4775
|
-
return node.array;
|
|
4776
|
-
}
|
|
4777
|
-
case null:
|
|
4778
|
-
case Object.prototype: {
|
|
4779
|
-
if (this.known.has(value))
|
|
4780
|
-
return value;
|
|
4781
|
-
var proto_1 = Object.getPrototypeOf(value);
|
|
4782
|
-
var array_1 = [proto_1];
|
|
4783
|
-
var keys = this.sortedKeys(value);
|
|
4784
|
-
array_1.push(keys.json);
|
|
4785
|
-
var firstValueIndex_1 = array_1.length;
|
|
4786
|
-
keys.sorted.forEach(function(key) {
|
|
4787
|
-
array_1.push(_this.admit(value[key]));
|
|
4788
|
-
});
|
|
4789
|
-
var node = this.pool.lookupArray(array_1);
|
|
4790
|
-
if (!node.object) {
|
|
4791
|
-
var obj_1 = node.object = Object.create(proto_1);
|
|
4792
|
-
this.known.add(obj_1);
|
|
4793
|
-
keys.sorted.forEach(function(key, i) {
|
|
4794
|
-
obj_1[key] = array_1[firstValueIndex_1 + i];
|
|
4795
|
-
});
|
|
4796
|
-
if (__DEV__) {
|
|
4797
|
-
Object.freeze(obj_1);
|
|
4798
|
-
}
|
|
4799
|
-
}
|
|
4800
|
-
return node.object;
|
|
4801
|
-
}
|
|
4802
|
-
}
|
|
4803
|
-
}
|
|
4804
|
-
return value;
|
|
4805
|
-
};
|
|
4806
|
-
ObjectCanon2.prototype.sortedKeys = function(obj) {
|
|
4807
|
-
var keys = Object.keys(obj);
|
|
4808
|
-
var node = this.pool.lookupArray(keys);
|
|
4809
|
-
if (!node.keys) {
|
|
4810
|
-
keys.sort();
|
|
4811
|
-
var json = JSON.stringify(keys);
|
|
4812
|
-
if (!(node.keys = this.keysByJSON.get(json))) {
|
|
4813
|
-
this.keysByJSON.set(json, node.keys = { sorted: keys, json });
|
|
4814
|
-
}
|
|
4815
|
-
}
|
|
4816
|
-
return node.keys;
|
|
4817
|
-
};
|
|
4818
|
-
return ObjectCanon2;
|
|
4819
|
-
}();
|
|
4820
|
-
var canonicalStringify = Object.assign(function(value) {
|
|
4821
|
-
if (isNonNullObject(value)) {
|
|
4822
|
-
if (stringifyCanon === void 0) {
|
|
4823
|
-
resetCanonicalStringify();
|
|
4824
|
-
}
|
|
4825
|
-
var canonical = stringifyCanon.admit(value);
|
|
4826
|
-
var json = stringifyCache.get(canonical);
|
|
4827
|
-
if (json === void 0) {
|
|
4828
|
-
stringifyCache.set(canonical, json = JSON.stringify(canonical));
|
|
4829
|
-
}
|
|
4830
|
-
return json;
|
|
4831
|
-
}
|
|
4832
|
-
return JSON.stringify(value);
|
|
4833
|
-
}, {
|
|
4834
|
-
reset: resetCanonicalStringify
|
|
4835
|
-
});
|
|
4836
|
-
var stringifyCanon;
|
|
4837
|
-
var stringifyCache;
|
|
4838
|
-
function resetCanonicalStringify() {
|
|
4839
|
-
stringifyCanon = new ObjectCanon();
|
|
4840
|
-
stringifyCache = new (canUseWeakMap ? WeakMap : Map)();
|
|
4841
|
-
}
|
|
4842
|
-
function execSelectionSetKeyArgs(options) {
|
|
4843
|
-
return [
|
|
4844
|
-
options.selectionSet,
|
|
4845
|
-
options.objectOrReference,
|
|
4846
|
-
options.context,
|
|
4847
|
-
options.context.canonizeResults
|
|
4848
|
-
];
|
|
4849
|
-
}
|
|
4850
|
-
var StoreReader = function() {
|
|
4851
|
-
function StoreReader2(config) {
|
|
4852
|
-
var _this = this;
|
|
4853
|
-
this.knownResults = new (canUseWeakMap ? WeakMap : Map)();
|
|
4854
|
-
this.config = compact(config, {
|
|
4855
|
-
addTypename: config.addTypename !== false,
|
|
4856
|
-
canonizeResults: shouldCanonizeResults(config)
|
|
4857
|
-
});
|
|
4858
|
-
this.canon = config.canon || new ObjectCanon();
|
|
4859
|
-
this.executeSelectionSet = wrap(function(options) {
|
|
4860
|
-
var _a2;
|
|
4861
|
-
var canonizeResults = options.context.canonizeResults;
|
|
4862
|
-
var peekArgs = execSelectionSetKeyArgs(options);
|
|
4863
|
-
peekArgs[3] = !canonizeResults;
|
|
4864
|
-
var other = (_a2 = _this.executeSelectionSet).peek.apply(_a2, peekArgs);
|
|
4865
|
-
if (other) {
|
|
4866
|
-
if (canonizeResults) {
|
|
4867
|
-
return __assign(__assign({}, other), { result: _this.canon.admit(other.result) });
|
|
4868
|
-
}
|
|
4869
|
-
return other;
|
|
4870
|
-
}
|
|
4871
|
-
maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);
|
|
4872
|
-
return _this.execSelectionSetImpl(options);
|
|
4873
|
-
}, {
|
|
4874
|
-
max: this.config.resultCacheMaxSize,
|
|
4875
|
-
keyArgs: execSelectionSetKeyArgs,
|
|
4876
|
-
makeCacheKey: function(selectionSet, parent, context, canonizeResults) {
|
|
4877
|
-
if (supportsResultCaching(context.store)) {
|
|
4878
|
-
return context.store.makeCacheKey(selectionSet, isReference(parent) ? parent.__ref : parent, context.varString, canonizeResults);
|
|
4879
|
-
}
|
|
4880
|
-
}
|
|
4881
|
-
});
|
|
4882
|
-
this.executeSubSelectedArray = wrap(function(options) {
|
|
4883
|
-
maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);
|
|
4884
|
-
return _this.execSubSelectedArrayImpl(options);
|
|
4885
|
-
}, {
|
|
4886
|
-
max: this.config.resultCacheMaxSize,
|
|
4887
|
-
makeCacheKey: function(_a2) {
|
|
4888
|
-
var field = _a2.field, array = _a2.array, context = _a2.context;
|
|
4889
|
-
if (supportsResultCaching(context.store)) {
|
|
4890
|
-
return context.store.makeCacheKey(field, array, context.varString);
|
|
4891
|
-
}
|
|
4892
|
-
}
|
|
4893
|
-
});
|
|
4894
|
-
}
|
|
4895
|
-
StoreReader2.prototype.resetCanon = function() {
|
|
4896
|
-
this.canon = new ObjectCanon();
|
|
4897
|
-
};
|
|
4898
|
-
StoreReader2.prototype.diffQueryAgainstStore = function(_a2) {
|
|
4899
|
-
var store = _a2.store, query = _a2.query, _b = _a2.rootId, rootId = _b === void 0 ? "ROOT_QUERY" : _b, variables = _a2.variables, _c = _a2.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a2.canonizeResults, canonizeResults = _d === void 0 ? this.config.canonizeResults : _d;
|
|
4900
|
-
var policies = this.config.cache.policies;
|
|
4901
|
-
variables = __assign(__assign({}, getDefaultValues(getQueryDefinition(query))), variables);
|
|
4902
|
-
var rootRef = makeReference(rootId);
|
|
4903
|
-
var merger = new DeepMerger();
|
|
4904
|
-
var execResult = this.executeSelectionSet({
|
|
4905
|
-
selectionSet: getMainDefinition(query).selectionSet,
|
|
4906
|
-
objectOrReference: rootRef,
|
|
4907
|
-
enclosingRef: rootRef,
|
|
4908
|
-
context: {
|
|
4909
|
-
store,
|
|
4910
|
-
query,
|
|
4911
|
-
policies,
|
|
4912
|
-
variables,
|
|
4913
|
-
varString: canonicalStringify(variables),
|
|
4914
|
-
canonizeResults,
|
|
4915
|
-
fragmentMap: createFragmentMap(getFragmentDefinitions(query)),
|
|
4916
|
-
merge: function(a, b) {
|
|
4917
|
-
return merger.merge(a, b);
|
|
4918
|
-
}
|
|
4919
|
-
}
|
|
4920
|
-
});
|
|
4921
|
-
var missing;
|
|
4922
|
-
if (execResult.missing) {
|
|
4923
|
-
missing = [new MissingFieldError(firstMissing(execResult.missing), execResult.missing, query, variables)];
|
|
4924
|
-
if (!returnPartialData) {
|
|
4925
|
-
throw missing[0];
|
|
4926
|
-
}
|
|
4927
|
-
}
|
|
4928
|
-
return {
|
|
4929
|
-
result: execResult.result,
|
|
4930
|
-
complete: !missing,
|
|
4931
|
-
missing
|
|
4932
|
-
};
|
|
4933
|
-
};
|
|
4934
|
-
StoreReader2.prototype.isFresh = function(result, parent, selectionSet, context) {
|
|
4935
|
-
if (supportsResultCaching(context.store) && this.knownResults.get(result) === selectionSet) {
|
|
4936
|
-
var latest = this.executeSelectionSet.peek(selectionSet, parent, context, this.canon.isKnown(result));
|
|
4937
|
-
if (latest && result === latest.result) {
|
|
4938
|
-
return true;
|
|
4939
|
-
}
|
|
4940
|
-
}
|
|
4941
|
-
return false;
|
|
4942
|
-
};
|
|
4943
|
-
StoreReader2.prototype.execSelectionSetImpl = function(_a2) {
|
|
4944
|
-
var _this = this;
|
|
4945
|
-
var selectionSet = _a2.selectionSet, objectOrReference = _a2.objectOrReference, enclosingRef = _a2.enclosingRef, context = _a2.context;
|
|
4946
|
-
if (isReference(objectOrReference) && !context.policies.rootTypenamesById[objectOrReference.__ref] && !context.store.has(objectOrReference.__ref)) {
|
|
4947
|
-
return {
|
|
4948
|
-
result: this.canon.empty,
|
|
4949
|
-
missing: "Dangling reference to missing ".concat(objectOrReference.__ref, " object")
|
|
4950
|
-
};
|
|
4951
|
-
}
|
|
4952
|
-
var variables = context.variables, policies = context.policies, store = context.store;
|
|
4953
|
-
var typename = store.getFieldValue(objectOrReference, "__typename");
|
|
4954
|
-
var result = {};
|
|
4955
|
-
var missing;
|
|
4956
|
-
if (this.config.addTypename && typeof typename === "string" && !policies.rootIdsByTypename[typename]) {
|
|
4957
|
-
result = { __typename: typename };
|
|
4958
|
-
}
|
|
4959
|
-
function handleMissing(result2, resultName) {
|
|
4960
|
-
var _a3;
|
|
4961
|
-
if (result2.missing) {
|
|
4962
|
-
missing = context.merge(missing, (_a3 = {}, _a3[resultName] = result2.missing, _a3));
|
|
4963
|
-
}
|
|
4964
|
-
return result2.result;
|
|
4965
|
-
}
|
|
4966
|
-
var workSet = new Set(selectionSet.selections);
|
|
4967
|
-
workSet.forEach(function(selection) {
|
|
4968
|
-
var _a3, _b;
|
|
4969
|
-
if (!shouldInclude(selection, variables))
|
|
4970
|
-
return;
|
|
4971
|
-
if (isField(selection)) {
|
|
4972
|
-
var fieldValue = policies.readField({
|
|
4973
|
-
fieldName: selection.name.value,
|
|
4974
|
-
field: selection,
|
|
4975
|
-
variables: context.variables,
|
|
4976
|
-
from: objectOrReference
|
|
4977
|
-
}, context);
|
|
4978
|
-
var resultName = resultKeyNameFromField(selection);
|
|
4979
|
-
if (fieldValue === void 0) {
|
|
4980
|
-
if (!addTypenameToDocument.added(selection)) {
|
|
4981
|
-
missing = context.merge(missing, (_a3 = {}, _a3[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference) ? objectOrReference.__ref + " object" : "object " + JSON.stringify(objectOrReference, null, 2)), _a3));
|
|
4982
|
-
}
|
|
4983
|
-
} else if (Array.isArray(fieldValue)) {
|
|
4984
|
-
fieldValue = handleMissing(_this.executeSubSelectedArray({
|
|
4985
|
-
field: selection,
|
|
4986
|
-
array: fieldValue,
|
|
4987
|
-
enclosingRef,
|
|
4988
|
-
context
|
|
4989
|
-
}), resultName);
|
|
4990
|
-
} else if (!selection.selectionSet) {
|
|
4991
|
-
if (context.canonizeResults) {
|
|
4992
|
-
fieldValue = _this.canon.pass(fieldValue);
|
|
4993
|
-
}
|
|
4994
|
-
} else if (fieldValue != null) {
|
|
4995
|
-
fieldValue = handleMissing(_this.executeSelectionSet({
|
|
4996
|
-
selectionSet: selection.selectionSet,
|
|
4997
|
-
objectOrReference: fieldValue,
|
|
4998
|
-
enclosingRef: isReference(fieldValue) ? fieldValue : enclosingRef,
|
|
4999
|
-
context
|
|
5000
|
-
}), resultName);
|
|
5001
|
-
}
|
|
5002
|
-
if (fieldValue !== void 0) {
|
|
5003
|
-
result = context.merge(result, (_b = {}, _b[resultName] = fieldValue, _b));
|
|
5004
|
-
}
|
|
5005
|
-
} else {
|
|
5006
|
-
var fragment = getFragmentFromSelection(selection, context.fragmentMap);
|
|
5007
|
-
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
5008
|
-
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
5009
|
-
}
|
|
5010
|
-
}
|
|
5011
|
-
});
|
|
5012
|
-
var finalResult = { result, missing };
|
|
5013
|
-
var frozen = context.canonizeResults ? this.canon.admit(finalResult) : maybeDeepFreeze(finalResult);
|
|
5014
|
-
if (frozen.result) {
|
|
5015
|
-
this.knownResults.set(frozen.result, selectionSet);
|
|
5016
|
-
}
|
|
5017
|
-
return frozen;
|
|
5018
|
-
};
|
|
5019
|
-
StoreReader2.prototype.execSubSelectedArrayImpl = function(_a2) {
|
|
5020
|
-
var _this = this;
|
|
5021
|
-
var field = _a2.field, array = _a2.array, enclosingRef = _a2.enclosingRef, context = _a2.context;
|
|
5022
|
-
var missing;
|
|
5023
|
-
function handleMissing(childResult, i) {
|
|
5024
|
-
var _a3;
|
|
5025
|
-
if (childResult.missing) {
|
|
5026
|
-
missing = context.merge(missing, (_a3 = {}, _a3[i] = childResult.missing, _a3));
|
|
5027
|
-
}
|
|
5028
|
-
return childResult.result;
|
|
5029
|
-
}
|
|
5030
|
-
if (field.selectionSet) {
|
|
5031
|
-
array = array.filter(context.store.canRead);
|
|
5032
|
-
}
|
|
5033
|
-
array = array.map(function(item, i) {
|
|
5034
|
-
if (item === null) {
|
|
5035
|
-
return null;
|
|
5036
|
-
}
|
|
5037
|
-
if (Array.isArray(item)) {
|
|
5038
|
-
return handleMissing(_this.executeSubSelectedArray({
|
|
5039
|
-
field,
|
|
5040
|
-
array: item,
|
|
5041
|
-
enclosingRef,
|
|
5042
|
-
context
|
|
5043
|
-
}), i);
|
|
5044
|
-
}
|
|
5045
|
-
if (field.selectionSet) {
|
|
5046
|
-
return handleMissing(_this.executeSelectionSet({
|
|
5047
|
-
selectionSet: field.selectionSet,
|
|
5048
|
-
objectOrReference: item,
|
|
5049
|
-
enclosingRef: isReference(item) ? item : enclosingRef,
|
|
5050
|
-
context
|
|
5051
|
-
}), i);
|
|
5052
|
-
}
|
|
5053
|
-
if (__DEV__) {
|
|
5054
|
-
assertSelectionSetForIdValue(context.store, field, item);
|
|
5055
|
-
}
|
|
5056
|
-
return item;
|
|
5057
|
-
});
|
|
5058
|
-
return {
|
|
5059
|
-
result: context.canonizeResults ? this.canon.admit(array) : array,
|
|
5060
|
-
missing
|
|
5061
|
-
};
|
|
5062
|
-
};
|
|
5063
|
-
return StoreReader2;
|
|
5064
|
-
}();
|
|
5065
|
-
function firstMissing(tree) {
|
|
5066
|
-
try {
|
|
5067
|
-
JSON.stringify(tree, function(_, value) {
|
|
5068
|
-
if (typeof value === "string")
|
|
5069
|
-
throw value;
|
|
5070
|
-
return value;
|
|
5071
|
-
});
|
|
5072
|
-
} catch (result) {
|
|
5073
|
-
return result;
|
|
5074
|
-
}
|
|
5075
|
-
}
|
|
5076
|
-
function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
5077
|
-
if (!field.selectionSet) {
|
|
5078
|
-
var workSet_1 = new Set([fieldValue]);
|
|
5079
|
-
workSet_1.forEach(function(value) {
|
|
5080
|
-
if (isNonNullObject(value)) {
|
|
5081
|
-
__DEV__ ? invariant(!isReference(value), "Missing selection set for object of type ".concat(getTypenameFromStoreObject(store, value), " returned for query field ").concat(field.name.value)) : invariant(!isReference(value), 5);
|
|
5082
|
-
Object.values(value).forEach(workSet_1.add, workSet_1);
|
|
5083
|
-
}
|
|
5084
|
-
});
|
|
5085
|
-
}
|
|
5086
|
-
}
|
|
5087
|
-
var cacheSlot = new Slot();
|
|
5088
|
-
var cacheInfoMap = new WeakMap();
|
|
5089
|
-
function getCacheInfo(cache) {
|
|
5090
|
-
var info = cacheInfoMap.get(cache);
|
|
5091
|
-
if (!info) {
|
|
5092
|
-
cacheInfoMap.set(cache, info = {
|
|
5093
|
-
vars: new Set(),
|
|
5094
|
-
dep: dep()
|
|
5095
|
-
});
|
|
5096
|
-
}
|
|
5097
|
-
return info;
|
|
5098
|
-
}
|
|
5099
|
-
function forgetCache(cache) {
|
|
5100
|
-
getCacheInfo(cache).vars.forEach(function(rv) {
|
|
5101
|
-
return rv.forgetCache(cache);
|
|
5102
|
-
});
|
|
5103
|
-
}
|
|
5104
|
-
function recallCache(cache) {
|
|
5105
|
-
getCacheInfo(cache).vars.forEach(function(rv) {
|
|
5106
|
-
return rv.attachCache(cache);
|
|
5107
|
-
});
|
|
5108
|
-
}
|
|
5109
|
-
function makeVar(value) {
|
|
5110
|
-
var caches2 = new Set();
|
|
5111
|
-
var listeners = new Set();
|
|
5112
|
-
var rv = function(newValue) {
|
|
5113
|
-
if (arguments.length > 0) {
|
|
5114
|
-
if (value !== newValue) {
|
|
5115
|
-
value = newValue;
|
|
5116
|
-
caches2.forEach(function(cache2) {
|
|
5117
|
-
getCacheInfo(cache2).dep.dirty(rv);
|
|
5118
|
-
broadcast(cache2);
|
|
5119
|
-
});
|
|
5120
|
-
var oldListeners = Array.from(listeners);
|
|
5121
|
-
listeners.clear();
|
|
5122
|
-
oldListeners.forEach(function(listener) {
|
|
5123
|
-
return listener(value);
|
|
5124
|
-
});
|
|
5125
|
-
}
|
|
5126
|
-
} else {
|
|
5127
|
-
var cache = cacheSlot.getValue();
|
|
5128
|
-
if (cache) {
|
|
5129
|
-
attach(cache);
|
|
5130
|
-
getCacheInfo(cache).dep(rv);
|
|
5131
|
-
}
|
|
5132
|
-
}
|
|
5133
|
-
return value;
|
|
5134
|
-
};
|
|
5135
|
-
rv.onNextChange = function(listener) {
|
|
5136
|
-
listeners.add(listener);
|
|
5137
|
-
return function() {
|
|
5138
|
-
listeners.delete(listener);
|
|
5139
|
-
};
|
|
5140
|
-
};
|
|
5141
|
-
var attach = rv.attachCache = function(cache) {
|
|
5142
|
-
caches2.add(cache);
|
|
5143
|
-
getCacheInfo(cache).vars.add(rv);
|
|
5144
|
-
return rv;
|
|
5145
|
-
};
|
|
5146
|
-
rv.forgetCache = function(cache) {
|
|
5147
|
-
return caches2.delete(cache);
|
|
5148
|
-
};
|
|
5149
|
-
return rv;
|
|
5150
|
-
}
|
|
5151
|
-
function broadcast(cache) {
|
|
5152
|
-
if (cache.broadcastWatches) {
|
|
5153
|
-
cache.broadcastWatches();
|
|
5154
|
-
}
|
|
5155
|
-
}
|
|
5156
|
-
var specifierInfoCache = Object.create(null);
|
|
5157
|
-
function lookupSpecifierInfo(spec) {
|
|
5158
|
-
var cacheKey = JSON.stringify(spec);
|
|
5159
|
-
return specifierInfoCache[cacheKey] || (specifierInfoCache[cacheKey] = Object.create(null));
|
|
5160
|
-
}
|
|
5161
|
-
function keyFieldsFnFromSpecifier(specifier) {
|
|
5162
|
-
var info = lookupSpecifierInfo(specifier);
|
|
5163
|
-
return info.keyFieldsFn || (info.keyFieldsFn = function(object, context) {
|
|
5164
|
-
var extract = function(from, key) {
|
|
5165
|
-
return context.readField(key, from);
|
|
5166
|
-
};
|
|
5167
|
-
var keyObject = context.keyObject = collectSpecifierPaths(specifier, function(schemaKeyPath) {
|
|
5168
|
-
var extracted = extractKeyPath(context.storeObject, schemaKeyPath, extract);
|
|
5169
|
-
if (extracted === void 0 && object !== context.storeObject && hasOwn.call(object, schemaKeyPath[0])) {
|
|
5170
|
-
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
5171
|
-
}
|
|
5172
|
-
__DEV__ ? invariant(extracted !== void 0, "Missing field '".concat(schemaKeyPath.join("."), "' while extracting keyFields from ").concat(JSON.stringify(object))) : invariant(extracted !== void 0, 2);
|
|
5173
|
-
return extracted;
|
|
5174
|
-
});
|
|
5175
|
-
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
5176
|
-
});
|
|
5177
|
-
}
|
|
5178
|
-
function keyArgsFnFromSpecifier(specifier) {
|
|
5179
|
-
var info = lookupSpecifierInfo(specifier);
|
|
5180
|
-
return info.keyArgsFn || (info.keyArgsFn = function(args, _a2) {
|
|
5181
|
-
var field = _a2.field, variables = _a2.variables, fieldName = _a2.fieldName;
|
|
5182
|
-
var collected = collectSpecifierPaths(specifier, function(keyPath) {
|
|
5183
|
-
var firstKey = keyPath[0];
|
|
5184
|
-
var firstChar = firstKey.charAt(0);
|
|
5185
|
-
if (firstChar === "@") {
|
|
5186
|
-
if (field && isNonEmptyArray(field.directives)) {
|
|
5187
|
-
var directiveName_1 = firstKey.slice(1);
|
|
5188
|
-
var d = field.directives.find(function(d2) {
|
|
5189
|
-
return d2.name.value === directiveName_1;
|
|
5190
|
-
});
|
|
5191
|
-
var directiveArgs = d && argumentsObjectFromField(d, variables);
|
|
5192
|
-
return directiveArgs && extractKeyPath(directiveArgs, keyPath.slice(1));
|
|
5193
|
-
}
|
|
5194
|
-
return;
|
|
5195
|
-
}
|
|
5196
|
-
if (firstChar === "$") {
|
|
5197
|
-
var variableName = firstKey.slice(1);
|
|
5198
|
-
if (variables && hasOwn.call(variables, variableName)) {
|
|
5199
|
-
var varKeyPath = keyPath.slice(0);
|
|
5200
|
-
varKeyPath[0] = variableName;
|
|
5201
|
-
return extractKeyPath(variables, varKeyPath);
|
|
5202
|
-
}
|
|
5203
|
-
return;
|
|
5204
|
-
}
|
|
5205
|
-
if (args) {
|
|
5206
|
-
return extractKeyPath(args, keyPath);
|
|
5207
|
-
}
|
|
5208
|
-
});
|
|
5209
|
-
var suffix = JSON.stringify(collected);
|
|
5210
|
-
if (args || suffix !== "{}") {
|
|
5211
|
-
fieldName += ":" + suffix;
|
|
5212
|
-
}
|
|
5213
|
-
return fieldName;
|
|
5214
|
-
});
|
|
5215
|
-
}
|
|
5216
|
-
function collectSpecifierPaths(specifier, extractor) {
|
|
5217
|
-
var merger = new DeepMerger();
|
|
5218
|
-
return getSpecifierPaths(specifier).reduce(function(collected, path2) {
|
|
5219
|
-
var _a2;
|
|
5220
|
-
var toMerge = extractor(path2);
|
|
5221
|
-
if (toMerge !== void 0) {
|
|
5222
|
-
for (var i = path2.length - 1; i >= 0; --i) {
|
|
5223
|
-
toMerge = (_a2 = {}, _a2[path2[i]] = toMerge, _a2);
|
|
5224
|
-
}
|
|
5225
|
-
collected = merger.merge(collected, toMerge);
|
|
5226
|
-
}
|
|
5227
|
-
return collected;
|
|
5228
|
-
}, Object.create(null));
|
|
5229
|
-
}
|
|
5230
|
-
function getSpecifierPaths(spec) {
|
|
5231
|
-
var info = lookupSpecifierInfo(spec);
|
|
5232
|
-
if (!info.paths) {
|
|
5233
|
-
var paths_1 = info.paths = [];
|
|
5234
|
-
var currentPath_1 = [];
|
|
5235
|
-
spec.forEach(function(s, i) {
|
|
5236
|
-
if (Array.isArray(s)) {
|
|
5237
|
-
getSpecifierPaths(s).forEach(function(p) {
|
|
5238
|
-
return paths_1.push(currentPath_1.concat(p));
|
|
5239
|
-
});
|
|
5240
|
-
currentPath_1.length = 0;
|
|
5241
|
-
} else {
|
|
5242
|
-
currentPath_1.push(s);
|
|
5243
|
-
if (!Array.isArray(spec[i + 1])) {
|
|
5244
|
-
paths_1.push(currentPath_1.slice(0));
|
|
5245
|
-
currentPath_1.length = 0;
|
|
5246
|
-
}
|
|
5247
|
-
}
|
|
5248
|
-
});
|
|
5249
|
-
}
|
|
5250
|
-
return info.paths;
|
|
5251
|
-
}
|
|
5252
|
-
function extractKey(object, key) {
|
|
5253
|
-
return object[key];
|
|
5254
|
-
}
|
|
5255
|
-
function extractKeyPath(object, path2, extract) {
|
|
5256
|
-
extract = extract || extractKey;
|
|
5257
|
-
return normalize(path2.reduce(function reducer(obj, key) {
|
|
5258
|
-
return Array.isArray(obj) ? obj.map(function(child) {
|
|
5259
|
-
return reducer(child, key);
|
|
5260
|
-
}) : obj && extract(obj, key);
|
|
5261
|
-
}, object));
|
|
5262
|
-
}
|
|
5263
|
-
function normalize(value) {
|
|
5264
|
-
if (isNonNullObject(value)) {
|
|
5265
|
-
if (Array.isArray(value)) {
|
|
5266
|
-
return value.map(normalize);
|
|
5267
|
-
}
|
|
5268
|
-
return collectSpecifierPaths(Object.keys(value).sort(), function(path2) {
|
|
5269
|
-
return extractKeyPath(value, path2);
|
|
5270
|
-
});
|
|
5271
|
-
}
|
|
5272
|
-
return value;
|
|
5273
|
-
}
|
|
5274
|
-
getStoreKeyName.setStringify(canonicalStringify);
|
|
5275
|
-
function argsFromFieldSpecifier(spec) {
|
|
5276
|
-
return spec.args !== void 0 ? spec.args : spec.field ? argumentsObjectFromField(spec.field, spec.variables) : null;
|
|
5277
|
-
}
|
|
5278
|
-
var nullKeyFieldsFn = function() {
|
|
5279
|
-
return void 0;
|
|
5280
|
-
};
|
|
5281
|
-
var simpleKeyArgsFn = function(_args, context) {
|
|
5282
|
-
return context.fieldName;
|
|
5283
|
-
};
|
|
5284
|
-
var mergeTrueFn = function(existing, incoming, _a2) {
|
|
5285
|
-
var mergeObjects = _a2.mergeObjects;
|
|
5286
|
-
return mergeObjects(existing, incoming);
|
|
5287
|
-
};
|
|
5288
|
-
var mergeFalseFn = function(_, incoming) {
|
|
5289
|
-
return incoming;
|
|
5290
|
-
};
|
|
5291
|
-
var Policies = function() {
|
|
5292
|
-
function Policies2(config) {
|
|
5293
|
-
this.config = config;
|
|
5294
|
-
this.typePolicies = Object.create(null);
|
|
5295
|
-
this.toBeAdded = Object.create(null);
|
|
5296
|
-
this.supertypeMap = new Map();
|
|
5297
|
-
this.fuzzySubtypes = new Map();
|
|
5298
|
-
this.rootIdsByTypename = Object.create(null);
|
|
5299
|
-
this.rootTypenamesById = Object.create(null);
|
|
5300
|
-
this.usingPossibleTypes = false;
|
|
5301
|
-
this.config = __assign({ dataIdFromObject: defaultDataIdFromObject }, config);
|
|
5302
|
-
this.cache = this.config.cache;
|
|
5303
|
-
this.setRootTypename("Query");
|
|
5304
|
-
this.setRootTypename("Mutation");
|
|
5305
|
-
this.setRootTypename("Subscription");
|
|
5306
|
-
if (config.possibleTypes) {
|
|
5307
|
-
this.addPossibleTypes(config.possibleTypes);
|
|
5308
|
-
}
|
|
5309
|
-
if (config.typePolicies) {
|
|
5310
|
-
this.addTypePolicies(config.typePolicies);
|
|
5311
|
-
}
|
|
5312
|
-
}
|
|
5313
|
-
Policies2.prototype.identify = function(object, partialContext) {
|
|
5314
|
-
var _a2;
|
|
5315
|
-
var policies = this;
|
|
5316
|
-
var typename = partialContext && (partialContext.typename || ((_a2 = partialContext.storeObject) === null || _a2 === void 0 ? void 0 : _a2.__typename)) || object.__typename;
|
|
5317
|
-
if (typename === this.rootTypenamesById.ROOT_QUERY) {
|
|
5318
|
-
return ["ROOT_QUERY"];
|
|
5319
|
-
}
|
|
5320
|
-
var storeObject = partialContext && partialContext.storeObject || object;
|
|
5321
|
-
var context = __assign(__assign({}, partialContext), { typename, storeObject, readField: partialContext && partialContext.readField || function() {
|
|
5322
|
-
var options = normalizeReadFieldOptions(arguments, storeObject);
|
|
5323
|
-
return policies.readField(options, {
|
|
5324
|
-
store: policies.cache["data"],
|
|
5325
|
-
variables: options.variables
|
|
5326
|
-
});
|
|
5327
|
-
} });
|
|
5328
|
-
var id;
|
|
5329
|
-
var policy = typename && this.getTypePolicy(typename);
|
|
5330
|
-
var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
|
|
5331
|
-
while (keyFn) {
|
|
5332
|
-
var specifierOrId = keyFn(object, context);
|
|
5333
|
-
if (Array.isArray(specifierOrId)) {
|
|
5334
|
-
keyFn = keyFieldsFnFromSpecifier(specifierOrId);
|
|
5335
|
-
} else {
|
|
5336
|
-
id = specifierOrId;
|
|
5337
|
-
break;
|
|
5338
|
-
}
|
|
5339
|
-
}
|
|
5340
|
-
id = id ? String(id) : void 0;
|
|
5341
|
-
return context.keyObject ? [id, context.keyObject] : [id];
|
|
5342
|
-
};
|
|
5343
|
-
Policies2.prototype.addTypePolicies = function(typePolicies) {
|
|
5344
|
-
var _this = this;
|
|
5345
|
-
Object.keys(typePolicies).forEach(function(typename) {
|
|
5346
|
-
var _a2 = typePolicies[typename], queryType = _a2.queryType, mutationType = _a2.mutationType, subscriptionType = _a2.subscriptionType, incoming = __rest(_a2, ["queryType", "mutationType", "subscriptionType"]);
|
|
5347
|
-
if (queryType)
|
|
5348
|
-
_this.setRootTypename("Query", typename);
|
|
5349
|
-
if (mutationType)
|
|
5350
|
-
_this.setRootTypename("Mutation", typename);
|
|
5351
|
-
if (subscriptionType)
|
|
5352
|
-
_this.setRootTypename("Subscription", typename);
|
|
5353
|
-
if (hasOwn.call(_this.toBeAdded, typename)) {
|
|
5354
|
-
_this.toBeAdded[typename].push(incoming);
|
|
5355
|
-
} else {
|
|
5356
|
-
_this.toBeAdded[typename] = [incoming];
|
|
5357
|
-
}
|
|
5358
|
-
});
|
|
5359
|
-
};
|
|
5360
|
-
Policies2.prototype.updateTypePolicy = function(typename, incoming) {
|
|
5361
|
-
var _this = this;
|
|
5362
|
-
var existing = this.getTypePolicy(typename);
|
|
5363
|
-
var keyFields = incoming.keyFields, fields = incoming.fields;
|
|
5364
|
-
function setMerge(existing2, merge) {
|
|
5365
|
-
existing2.merge = typeof merge === "function" ? merge : merge === true ? mergeTrueFn : merge === false ? mergeFalseFn : existing2.merge;
|
|
5366
|
-
}
|
|
5367
|
-
setMerge(existing, incoming.merge);
|
|
5368
|
-
existing.keyFn = keyFields === false ? nullKeyFieldsFn : Array.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) : typeof keyFields === "function" ? keyFields : existing.keyFn;
|
|
5369
|
-
if (fields) {
|
|
5370
|
-
Object.keys(fields).forEach(function(fieldName) {
|
|
5371
|
-
var existing2 = _this.getFieldPolicy(typename, fieldName, true);
|
|
5372
|
-
var incoming2 = fields[fieldName];
|
|
5373
|
-
if (typeof incoming2 === "function") {
|
|
5374
|
-
existing2.read = incoming2;
|
|
5375
|
-
} else {
|
|
5376
|
-
var keyArgs = incoming2.keyArgs, read = incoming2.read, merge = incoming2.merge;
|
|
5377
|
-
existing2.keyFn = keyArgs === false ? simpleKeyArgsFn : Array.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) : typeof keyArgs === "function" ? keyArgs : existing2.keyFn;
|
|
5378
|
-
if (typeof read === "function") {
|
|
5379
|
-
existing2.read = read;
|
|
5380
|
-
}
|
|
5381
|
-
setMerge(existing2, merge);
|
|
5382
|
-
}
|
|
5383
|
-
if (existing2.read && existing2.merge) {
|
|
5384
|
-
existing2.keyFn = existing2.keyFn || simpleKeyArgsFn;
|
|
5385
|
-
}
|
|
5386
|
-
});
|
|
5387
|
-
}
|
|
5388
|
-
};
|
|
5389
|
-
Policies2.prototype.setRootTypename = function(which, typename) {
|
|
5390
|
-
if (typename === void 0) {
|
|
5391
|
-
typename = which;
|
|
5392
|
-
}
|
|
5393
|
-
var rootId = "ROOT_" + which.toUpperCase();
|
|
5394
|
-
var old = this.rootTypenamesById[rootId];
|
|
5395
|
-
if (typename !== old) {
|
|
5396
|
-
__DEV__ ? invariant(!old || old === which, "Cannot change root ".concat(which, " __typename more than once")) : invariant(!old || old === which, 3);
|
|
5397
|
-
if (old)
|
|
5398
|
-
delete this.rootIdsByTypename[old];
|
|
5399
|
-
this.rootIdsByTypename[typename] = rootId;
|
|
5400
|
-
this.rootTypenamesById[rootId] = typename;
|
|
5401
|
-
}
|
|
5402
|
-
};
|
|
5403
|
-
Policies2.prototype.addPossibleTypes = function(possibleTypes) {
|
|
5404
|
-
var _this = this;
|
|
5405
|
-
this.usingPossibleTypes = true;
|
|
5406
|
-
Object.keys(possibleTypes).forEach(function(supertype) {
|
|
5407
|
-
_this.getSupertypeSet(supertype, true);
|
|
5408
|
-
possibleTypes[supertype].forEach(function(subtype) {
|
|
5409
|
-
_this.getSupertypeSet(subtype, true).add(supertype);
|
|
5410
|
-
var match = subtype.match(TypeOrFieldNameRegExp);
|
|
5411
|
-
if (!match || match[0] !== subtype) {
|
|
5412
|
-
_this.fuzzySubtypes.set(subtype, new RegExp(subtype));
|
|
5413
|
-
}
|
|
5414
|
-
});
|
|
5415
|
-
});
|
|
5416
|
-
};
|
|
5417
|
-
Policies2.prototype.getTypePolicy = function(typename) {
|
|
5418
|
-
var _this = this;
|
|
5419
|
-
if (!hasOwn.call(this.typePolicies, typename)) {
|
|
5420
|
-
var policy_1 = this.typePolicies[typename] = Object.create(null);
|
|
5421
|
-
policy_1.fields = Object.create(null);
|
|
5422
|
-
var supertypes = this.supertypeMap.get(typename);
|
|
5423
|
-
if (supertypes && supertypes.size) {
|
|
5424
|
-
supertypes.forEach(function(supertype) {
|
|
5425
|
-
var _a2 = _this.getTypePolicy(supertype), fields = _a2.fields, rest = __rest(_a2, ["fields"]);
|
|
5426
|
-
Object.assign(policy_1, rest);
|
|
5427
|
-
Object.assign(policy_1.fields, fields);
|
|
5428
|
-
});
|
|
5429
|
-
}
|
|
5430
|
-
}
|
|
5431
|
-
var inbox = this.toBeAdded[typename];
|
|
5432
|
-
if (inbox && inbox.length) {
|
|
5433
|
-
inbox.splice(0).forEach(function(policy) {
|
|
5434
|
-
_this.updateTypePolicy(typename, policy);
|
|
5435
|
-
});
|
|
5436
|
-
}
|
|
5437
|
-
return this.typePolicies[typename];
|
|
5438
|
-
};
|
|
5439
|
-
Policies2.prototype.getFieldPolicy = function(typename, fieldName, createIfMissing) {
|
|
5440
|
-
if (typename) {
|
|
5441
|
-
var fieldPolicies = this.getTypePolicy(typename).fields;
|
|
5442
|
-
return fieldPolicies[fieldName] || createIfMissing && (fieldPolicies[fieldName] = Object.create(null));
|
|
5443
|
-
}
|
|
5444
|
-
};
|
|
5445
|
-
Policies2.prototype.getSupertypeSet = function(subtype, createIfMissing) {
|
|
5446
|
-
var supertypeSet = this.supertypeMap.get(subtype);
|
|
5447
|
-
if (!supertypeSet && createIfMissing) {
|
|
5448
|
-
this.supertypeMap.set(subtype, supertypeSet = new Set());
|
|
5449
|
-
}
|
|
5450
|
-
return supertypeSet;
|
|
5451
|
-
};
|
|
5452
|
-
Policies2.prototype.fragmentMatches = function(fragment, typename, result, variables) {
|
|
5453
|
-
var _this = this;
|
|
5454
|
-
if (!fragment.typeCondition)
|
|
5455
|
-
return true;
|
|
5456
|
-
if (!typename)
|
|
5457
|
-
return false;
|
|
5458
|
-
var supertype = fragment.typeCondition.name.value;
|
|
5459
|
-
if (typename === supertype)
|
|
5460
|
-
return true;
|
|
5461
|
-
if (this.usingPossibleTypes && this.supertypeMap.has(supertype)) {
|
|
5462
|
-
var typenameSupertypeSet = this.getSupertypeSet(typename, true);
|
|
5463
|
-
var workQueue_1 = [typenameSupertypeSet];
|
|
5464
|
-
var maybeEnqueue_1 = function(subtype) {
|
|
5465
|
-
var supertypeSet2 = _this.getSupertypeSet(subtype, false);
|
|
5466
|
-
if (supertypeSet2 && supertypeSet2.size && workQueue_1.indexOf(supertypeSet2) < 0) {
|
|
5467
|
-
workQueue_1.push(supertypeSet2);
|
|
5468
|
-
}
|
|
5469
|
-
};
|
|
5470
|
-
var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size);
|
|
5471
|
-
var checkingFuzzySubtypes = false;
|
|
5472
|
-
for (var i = 0; i < workQueue_1.length; ++i) {
|
|
5473
|
-
var supertypeSet = workQueue_1[i];
|
|
5474
|
-
if (supertypeSet.has(supertype)) {
|
|
5475
|
-
if (!typenameSupertypeSet.has(supertype)) {
|
|
5476
|
-
if (checkingFuzzySubtypes) {
|
|
5477
|
-
__DEV__ && invariant.warn("Inferring subtype ".concat(typename, " of supertype ").concat(supertype));
|
|
5478
|
-
}
|
|
5479
|
-
typenameSupertypeSet.add(supertype);
|
|
5480
|
-
}
|
|
5481
|
-
return true;
|
|
5482
|
-
}
|
|
5483
|
-
supertypeSet.forEach(maybeEnqueue_1);
|
|
5484
|
-
if (needToCheckFuzzySubtypes && i === workQueue_1.length - 1 && selectionSetMatchesResult(fragment.selectionSet, result, variables)) {
|
|
5485
|
-
needToCheckFuzzySubtypes = false;
|
|
5486
|
-
checkingFuzzySubtypes = true;
|
|
5487
|
-
this.fuzzySubtypes.forEach(function(regExp, fuzzyString) {
|
|
5488
|
-
var match = typename.match(regExp);
|
|
5489
|
-
if (match && match[0] === typename) {
|
|
5490
|
-
maybeEnqueue_1(fuzzyString);
|
|
5491
|
-
}
|
|
5492
|
-
});
|
|
5493
|
-
}
|
|
5494
|
-
}
|
|
5495
|
-
}
|
|
5496
|
-
return false;
|
|
5497
|
-
};
|
|
5498
|
-
Policies2.prototype.hasKeyArgs = function(typename, fieldName) {
|
|
5499
|
-
var policy = this.getFieldPolicy(typename, fieldName, false);
|
|
5500
|
-
return !!(policy && policy.keyFn);
|
|
5501
|
-
};
|
|
5502
|
-
Policies2.prototype.getStoreFieldName = function(fieldSpec) {
|
|
5503
|
-
var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName;
|
|
5504
|
-
var policy = this.getFieldPolicy(typename, fieldName, false);
|
|
5505
|
-
var storeFieldName;
|
|
5506
|
-
var keyFn = policy && policy.keyFn;
|
|
5507
|
-
if (keyFn && typename) {
|
|
5508
|
-
var context = {
|
|
5509
|
-
typename,
|
|
5510
|
-
fieldName,
|
|
5511
|
-
field: fieldSpec.field || null,
|
|
5512
|
-
variables: fieldSpec.variables
|
|
5513
|
-
};
|
|
5514
|
-
var args = argsFromFieldSpecifier(fieldSpec);
|
|
5515
|
-
while (keyFn) {
|
|
5516
|
-
var specifierOrString = keyFn(args, context);
|
|
5517
|
-
if (Array.isArray(specifierOrString)) {
|
|
5518
|
-
keyFn = keyArgsFnFromSpecifier(specifierOrString);
|
|
5519
|
-
} else {
|
|
5520
|
-
storeFieldName = specifierOrString || fieldName;
|
|
5521
|
-
break;
|
|
5522
|
-
}
|
|
5523
|
-
}
|
|
5524
|
-
}
|
|
5525
|
-
if (storeFieldName === void 0) {
|
|
5526
|
-
storeFieldName = fieldSpec.field ? storeKeyNameFromField(fieldSpec.field, fieldSpec.variables) : getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));
|
|
5527
|
-
}
|
|
5528
|
-
if (storeFieldName === false) {
|
|
5529
|
-
return fieldName;
|
|
5530
|
-
}
|
|
5531
|
-
return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName : fieldName + ":" + storeFieldName;
|
|
5532
|
-
};
|
|
5533
|
-
Policies2.prototype.readField = function(options, context) {
|
|
5534
|
-
var objectOrReference = options.from;
|
|
5535
|
-
if (!objectOrReference)
|
|
5536
|
-
return;
|
|
5537
|
-
var nameOrField = options.field || options.fieldName;
|
|
5538
|
-
if (!nameOrField)
|
|
5539
|
-
return;
|
|
5540
|
-
if (options.typename === void 0) {
|
|
5541
|
-
var typename = context.store.getFieldValue(objectOrReference, "__typename");
|
|
5542
|
-
if (typename)
|
|
5543
|
-
options.typename = typename;
|
|
5544
|
-
}
|
|
5545
|
-
var storeFieldName = this.getStoreFieldName(options);
|
|
5546
|
-
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
5547
|
-
var existing = context.store.getFieldValue(objectOrReference, storeFieldName);
|
|
5548
|
-
var policy = this.getFieldPolicy(options.typename, fieldName, false);
|
|
5549
|
-
var read = policy && policy.read;
|
|
5550
|
-
if (read) {
|
|
5551
|
-
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference) ? objectOrReference.__ref : objectOrReference, storeFieldName));
|
|
5552
|
-
return cacheSlot.withValue(this.cache, read, [existing, readOptions]);
|
|
5553
|
-
}
|
|
5554
|
-
return existing;
|
|
5555
|
-
};
|
|
5556
|
-
Policies2.prototype.getReadFunction = function(typename, fieldName) {
|
|
5557
|
-
var policy = this.getFieldPolicy(typename, fieldName, false);
|
|
5558
|
-
return policy && policy.read;
|
|
5559
|
-
};
|
|
5560
|
-
Policies2.prototype.getMergeFunction = function(parentTypename, fieldName, childTypename) {
|
|
5561
|
-
var policy = this.getFieldPolicy(parentTypename, fieldName, false);
|
|
5562
|
-
var merge = policy && policy.merge;
|
|
5563
|
-
if (!merge && childTypename) {
|
|
5564
|
-
policy = this.getTypePolicy(childTypename);
|
|
5565
|
-
merge = policy && policy.merge;
|
|
5566
|
-
}
|
|
5567
|
-
return merge;
|
|
5568
|
-
};
|
|
5569
|
-
Policies2.prototype.runMergeFunction = function(existing, incoming, _a2, context, storage) {
|
|
5570
|
-
var field = _a2.field, typename = _a2.typename, merge = _a2.merge;
|
|
5571
|
-
if (merge === mergeTrueFn) {
|
|
5572
|
-
return makeMergeObjectsFunction(context.store)(existing, incoming);
|
|
5573
|
-
}
|
|
5574
|
-
if (merge === mergeFalseFn) {
|
|
5575
|
-
return incoming;
|
|
5576
|
-
}
|
|
5577
|
-
if (context.overwrite) {
|
|
5578
|
-
existing = void 0;
|
|
5579
|
-
}
|
|
5580
|
-
return merge(existing, incoming, makeFieldFunctionOptions(this, void 0, { typename, fieldName: field.name.value, field, variables: context.variables }, context, storage || Object.create(null)));
|
|
5581
|
-
};
|
|
5582
|
-
return Policies2;
|
|
5583
|
-
}();
|
|
5584
|
-
function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) {
|
|
5585
|
-
var storeFieldName = policies.getStoreFieldName(fieldSpec);
|
|
5586
|
-
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
5587
|
-
var variables = fieldSpec.variables || context.variables;
|
|
5588
|
-
var _a2 = context.store, toReference = _a2.toReference, canRead = _a2.canRead;
|
|
5589
|
-
return {
|
|
5590
|
-
args: argsFromFieldSpecifier(fieldSpec),
|
|
5591
|
-
field: fieldSpec.field || null,
|
|
5592
|
-
fieldName,
|
|
5593
|
-
storeFieldName,
|
|
5594
|
-
variables,
|
|
5595
|
-
isReference,
|
|
5596
|
-
toReference,
|
|
5597
|
-
storage,
|
|
5598
|
-
cache: policies.cache,
|
|
5599
|
-
canRead,
|
|
5600
|
-
readField: function() {
|
|
5601
|
-
return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, context), context);
|
|
5602
|
-
},
|
|
5603
|
-
mergeObjects: makeMergeObjectsFunction(context.store)
|
|
5604
|
-
};
|
|
5605
|
-
}
|
|
5606
|
-
function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) {
|
|
5607
|
-
var fieldNameOrOptions = readFieldArgs[0], from = readFieldArgs[1], argc = readFieldArgs.length;
|
|
5608
|
-
var options;
|
|
5609
|
-
if (typeof fieldNameOrOptions === "string") {
|
|
5610
|
-
options = {
|
|
5611
|
-
fieldName: fieldNameOrOptions,
|
|
5612
|
-
from: argc > 1 ? from : objectOrReference
|
|
5613
|
-
};
|
|
5614
|
-
} else {
|
|
5615
|
-
options = __assign({}, fieldNameOrOptions);
|
|
5616
|
-
if (!hasOwn.call(options, "from")) {
|
|
5617
|
-
options.from = objectOrReference;
|
|
5618
|
-
}
|
|
5619
|
-
}
|
|
5620
|
-
if (__DEV__ && options.from === void 0) {
|
|
5621
|
-
__DEV__ && invariant.warn("Undefined 'from' passed to readField with arguments ".concat(stringifyForDisplay(Array.from(readFieldArgs))));
|
|
5622
|
-
}
|
|
5623
|
-
if (options.variables === void 0) {
|
|
5624
|
-
options.variables = variables;
|
|
5625
|
-
}
|
|
5626
|
-
return options;
|
|
5627
|
-
}
|
|
5628
|
-
function makeMergeObjectsFunction(store) {
|
|
5629
|
-
return function mergeObjects(existing, incoming) {
|
|
5630
|
-
if (Array.isArray(existing) || Array.isArray(incoming)) {
|
|
5631
|
-
throw __DEV__ ? new InvariantError("Cannot automatically merge arrays") : new InvariantError(4);
|
|
5632
|
-
}
|
|
5633
|
-
if (isNonNullObject(existing) && isNonNullObject(incoming)) {
|
|
5634
|
-
var eType = store.getFieldValue(existing, "__typename");
|
|
5635
|
-
var iType = store.getFieldValue(incoming, "__typename");
|
|
5636
|
-
var typesDiffer = eType && iType && eType !== iType;
|
|
5637
|
-
if (typesDiffer) {
|
|
5638
|
-
return incoming;
|
|
5639
|
-
}
|
|
5640
|
-
if (isReference(existing) && storeValueIsStoreObject(incoming)) {
|
|
5641
|
-
store.merge(existing.__ref, incoming);
|
|
5642
|
-
return existing;
|
|
5643
|
-
}
|
|
5644
|
-
if (storeValueIsStoreObject(existing) && isReference(incoming)) {
|
|
5645
|
-
store.merge(existing, incoming.__ref);
|
|
5646
|
-
return incoming;
|
|
5647
|
-
}
|
|
5648
|
-
if (storeValueIsStoreObject(existing) && storeValueIsStoreObject(incoming)) {
|
|
5649
|
-
return __assign(__assign({}, existing), incoming);
|
|
5650
|
-
}
|
|
5651
|
-
}
|
|
5652
|
-
return incoming;
|
|
5653
|
-
};
|
|
5654
|
-
}
|
|
5655
|
-
function getContextFlavor(context, clientOnly, deferred) {
|
|
5656
|
-
var key = "".concat(clientOnly).concat(deferred);
|
|
5657
|
-
var flavored = context.flavors.get(key);
|
|
5658
|
-
if (!flavored) {
|
|
5659
|
-
context.flavors.set(key, flavored = context.clientOnly === clientOnly && context.deferred === deferred ? context : __assign(__assign({}, context), { clientOnly, deferred }));
|
|
5660
|
-
}
|
|
5661
|
-
return flavored;
|
|
5662
|
-
}
|
|
5663
|
-
var StoreWriter = function() {
|
|
5664
|
-
function StoreWriter2(cache, reader) {
|
|
5665
|
-
this.cache = cache;
|
|
5666
|
-
this.reader = reader;
|
|
5667
|
-
}
|
|
5668
|
-
StoreWriter2.prototype.writeToStore = function(store, _a2) {
|
|
5669
|
-
var _this = this;
|
|
5670
|
-
var query = _a2.query, result = _a2.result, dataId = _a2.dataId, variables = _a2.variables, overwrite = _a2.overwrite;
|
|
5671
|
-
var operationDefinition = getOperationDefinition(query);
|
|
5672
|
-
var merger = makeProcessedFieldsMerger();
|
|
5673
|
-
variables = __assign(__assign({}, getDefaultValues(operationDefinition)), variables);
|
|
5674
|
-
var context = {
|
|
5675
|
-
store,
|
|
5676
|
-
written: Object.create(null),
|
|
5677
|
-
merge: function(existing, incoming) {
|
|
5678
|
-
return merger.merge(existing, incoming);
|
|
5679
|
-
},
|
|
5680
|
-
variables,
|
|
5681
|
-
varString: canonicalStringify(variables),
|
|
5682
|
-
fragmentMap: createFragmentMap(getFragmentDefinitions(query)),
|
|
5683
|
-
overwrite: !!overwrite,
|
|
5684
|
-
incomingById: new Map(),
|
|
5685
|
-
clientOnly: false,
|
|
5686
|
-
deferred: false,
|
|
5687
|
-
flavors: new Map()
|
|
5688
|
-
};
|
|
5689
|
-
var ref2 = this.processSelectionSet({
|
|
5690
|
-
result: result || Object.create(null),
|
|
5691
|
-
dataId,
|
|
5692
|
-
selectionSet: operationDefinition.selectionSet,
|
|
5693
|
-
mergeTree: { map: new Map() },
|
|
5694
|
-
context
|
|
5695
|
-
});
|
|
5696
|
-
if (!isReference(ref2)) {
|
|
5697
|
-
throw __DEV__ ? new InvariantError("Could not identify object ".concat(JSON.stringify(result))) : new InvariantError(6);
|
|
5698
|
-
}
|
|
5699
|
-
context.incomingById.forEach(function(_a3, dataId2) {
|
|
5700
|
-
var storeObject = _a3.storeObject, mergeTree = _a3.mergeTree, fieldNodeSet = _a3.fieldNodeSet;
|
|
5701
|
-
var entityRef = makeReference(dataId2);
|
|
5702
|
-
if (mergeTree && mergeTree.map.size) {
|
|
5703
|
-
var applied = _this.applyMerges(mergeTree, entityRef, storeObject, context);
|
|
5704
|
-
if (isReference(applied)) {
|
|
5705
|
-
return;
|
|
5706
|
-
}
|
|
5707
|
-
storeObject = applied;
|
|
5708
|
-
}
|
|
5709
|
-
if (__DEV__ && !context.overwrite) {
|
|
5710
|
-
var fieldsWithSelectionSets_1 = Object.create(null);
|
|
5711
|
-
fieldNodeSet.forEach(function(field) {
|
|
5712
|
-
if (field.selectionSet) {
|
|
5713
|
-
fieldsWithSelectionSets_1[field.name.value] = true;
|
|
5714
|
-
}
|
|
5715
|
-
});
|
|
5716
|
-
var hasSelectionSet_1 = function(storeFieldName) {
|
|
5717
|
-
return fieldsWithSelectionSets_1[fieldNameFromStoreName(storeFieldName)] === true;
|
|
5718
|
-
};
|
|
5719
|
-
var hasMergeFunction_1 = function(storeFieldName) {
|
|
5720
|
-
var childTree = mergeTree && mergeTree.map.get(storeFieldName);
|
|
5721
|
-
return Boolean(childTree && childTree.info && childTree.info.merge);
|
|
5722
|
-
};
|
|
5723
|
-
Object.keys(storeObject).forEach(function(storeFieldName) {
|
|
5724
|
-
if (hasSelectionSet_1(storeFieldName) && !hasMergeFunction_1(storeFieldName)) {
|
|
5725
|
-
warnAboutDataLoss(entityRef, storeObject, storeFieldName, context.store);
|
|
5726
|
-
}
|
|
5727
|
-
});
|
|
5728
|
-
}
|
|
5729
|
-
store.merge(dataId2, storeObject);
|
|
5730
|
-
});
|
|
5731
|
-
store.retain(ref2.__ref);
|
|
5732
|
-
return ref2;
|
|
5733
|
-
};
|
|
5734
|
-
StoreWriter2.prototype.processSelectionSet = function(_a2) {
|
|
5735
|
-
var _this = this;
|
|
5736
|
-
var dataId = _a2.dataId, result = _a2.result, selectionSet = _a2.selectionSet, context = _a2.context, mergeTree = _a2.mergeTree;
|
|
5737
|
-
var policies = this.cache.policies;
|
|
5738
|
-
var incoming = Object.create(null);
|
|
5739
|
-
var typename = dataId && policies.rootTypenamesById[dataId] || getTypenameFromResult(result, selectionSet, context.fragmentMap) || dataId && context.store.get(dataId, "__typename");
|
|
5740
|
-
if (typeof typename === "string") {
|
|
5741
|
-
incoming.__typename = typename;
|
|
5742
|
-
}
|
|
5743
|
-
var readField = function() {
|
|
5744
|
-
var options = normalizeReadFieldOptions(arguments, incoming, context.variables);
|
|
5745
|
-
if (isReference(options.from)) {
|
|
5746
|
-
var info = context.incomingById.get(options.from.__ref);
|
|
5747
|
-
if (info) {
|
|
5748
|
-
var result_1 = policies.readField(__assign(__assign({}, options), { from: info.storeObject }), context);
|
|
5749
|
-
if (result_1 !== void 0) {
|
|
5750
|
-
return result_1;
|
|
5751
|
-
}
|
|
5752
|
-
}
|
|
5753
|
-
}
|
|
5754
|
-
return policies.readField(options, context);
|
|
5755
|
-
};
|
|
5756
|
-
var fieldNodeSet = new Set();
|
|
5757
|
-
this.flattenFields(selectionSet, result, context, typename).forEach(function(context2, field) {
|
|
5758
|
-
var _a3;
|
|
5759
|
-
var resultFieldKey = resultKeyNameFromField(field);
|
|
5760
|
-
var value = result[resultFieldKey];
|
|
5761
|
-
fieldNodeSet.add(field);
|
|
5762
|
-
if (value !== void 0) {
|
|
5763
|
-
var storeFieldName = policies.getStoreFieldName({
|
|
5764
|
-
typename,
|
|
5765
|
-
fieldName: field.name.value,
|
|
5766
|
-
field,
|
|
5767
|
-
variables: context2.variables
|
|
5768
|
-
});
|
|
5769
|
-
var childTree = getChildMergeTree(mergeTree, storeFieldName);
|
|
5770
|
-
var incomingValue = _this.processFieldValue(value, field, field.selectionSet ? getContextFlavor(context2, false, false) : context2, childTree);
|
|
5771
|
-
var childTypename = void 0;
|
|
5772
|
-
if (field.selectionSet && (isReference(incomingValue) || storeValueIsStoreObject(incomingValue))) {
|
|
5773
|
-
childTypename = readField("__typename", incomingValue);
|
|
5774
|
-
}
|
|
5775
|
-
var merge = policies.getMergeFunction(typename, field.name.value, childTypename);
|
|
5776
|
-
if (merge) {
|
|
5777
|
-
childTree.info = {
|
|
5778
|
-
field,
|
|
5779
|
-
typename,
|
|
5780
|
-
merge
|
|
5781
|
-
};
|
|
5782
|
-
} else {
|
|
5783
|
-
maybeRecycleChildMergeTree(mergeTree, storeFieldName);
|
|
5784
|
-
}
|
|
5785
|
-
incoming = context2.merge(incoming, (_a3 = {}, _a3[storeFieldName] = incomingValue, _a3));
|
|
5786
|
-
} else if (__DEV__ && !context2.clientOnly && !context2.deferred && !addTypenameToDocument.added(field) && !policies.getReadFunction(typename, field.name.value)) {
|
|
5787
|
-
__DEV__ && invariant.error("Missing field '".concat(resultKeyNameFromField(field), "' while writing result ").concat(JSON.stringify(result, null, 2)).substring(0, 1e3));
|
|
5788
|
-
}
|
|
5789
|
-
});
|
|
5790
|
-
try {
|
|
5791
|
-
var _b = policies.identify(result, {
|
|
5792
|
-
typename,
|
|
5793
|
-
selectionSet,
|
|
5794
|
-
fragmentMap: context.fragmentMap,
|
|
5795
|
-
storeObject: incoming,
|
|
5796
|
-
readField
|
|
5797
|
-
}), id = _b[0], keyObject = _b[1];
|
|
5798
|
-
dataId = dataId || id;
|
|
5799
|
-
if (keyObject) {
|
|
5800
|
-
incoming = context.merge(incoming, keyObject);
|
|
5801
|
-
}
|
|
5802
|
-
} catch (e) {
|
|
5803
|
-
if (!dataId)
|
|
5804
|
-
throw e;
|
|
5805
|
-
}
|
|
5806
|
-
if (typeof dataId === "string") {
|
|
5807
|
-
var dataRef = makeReference(dataId);
|
|
5808
|
-
var sets = context.written[dataId] || (context.written[dataId] = []);
|
|
5809
|
-
if (sets.indexOf(selectionSet) >= 0)
|
|
5810
|
-
return dataRef;
|
|
5811
|
-
sets.push(selectionSet);
|
|
5812
|
-
if (this.reader && this.reader.isFresh(result, dataRef, selectionSet, context)) {
|
|
5813
|
-
return dataRef;
|
|
5814
|
-
}
|
|
5815
|
-
var previous_1 = context.incomingById.get(dataId);
|
|
5816
|
-
if (previous_1) {
|
|
5817
|
-
previous_1.storeObject = context.merge(previous_1.storeObject, incoming);
|
|
5818
|
-
previous_1.mergeTree = mergeMergeTrees(previous_1.mergeTree, mergeTree);
|
|
5819
|
-
fieldNodeSet.forEach(function(field) {
|
|
5820
|
-
return previous_1.fieldNodeSet.add(field);
|
|
5821
|
-
});
|
|
5822
|
-
} else {
|
|
5823
|
-
context.incomingById.set(dataId, {
|
|
5824
|
-
storeObject: incoming,
|
|
5825
|
-
mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree,
|
|
5826
|
-
fieldNodeSet
|
|
5827
|
-
});
|
|
5828
|
-
}
|
|
5829
|
-
return dataRef;
|
|
5830
|
-
}
|
|
5831
|
-
return incoming;
|
|
5832
|
-
};
|
|
5833
|
-
StoreWriter2.prototype.processFieldValue = function(value, field, context, mergeTree) {
|
|
5834
|
-
var _this = this;
|
|
5835
|
-
if (!field.selectionSet || value === null) {
|
|
5836
|
-
return __DEV__ ? cloneDeep(value) : value;
|
|
5837
|
-
}
|
|
5838
|
-
if (Array.isArray(value)) {
|
|
5839
|
-
return value.map(function(item, i) {
|
|
5840
|
-
var value2 = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i));
|
|
5841
|
-
maybeRecycleChildMergeTree(mergeTree, i);
|
|
5842
|
-
return value2;
|
|
5843
|
-
});
|
|
5844
|
-
}
|
|
5845
|
-
return this.processSelectionSet({
|
|
5846
|
-
result: value,
|
|
5847
|
-
selectionSet: field.selectionSet,
|
|
5848
|
-
context,
|
|
5849
|
-
mergeTree
|
|
5850
|
-
});
|
|
5851
|
-
};
|
|
5852
|
-
StoreWriter2.prototype.flattenFields = function(selectionSet, result, context, typename) {
|
|
5853
|
-
if (typename === void 0) {
|
|
5854
|
-
typename = getTypenameFromResult(result, selectionSet, context.fragmentMap);
|
|
5855
|
-
}
|
|
5856
|
-
var fieldMap = new Map();
|
|
5857
|
-
var policies = this.cache.policies;
|
|
5858
|
-
var limitingTrie = new Trie(false);
|
|
5859
|
-
(function flatten(selectionSet2, inheritedContext) {
|
|
5860
|
-
var visitedNode = limitingTrie.lookup(selectionSet2, inheritedContext.clientOnly, inheritedContext.deferred);
|
|
5861
|
-
if (visitedNode.visited)
|
|
5862
|
-
return;
|
|
5863
|
-
visitedNode.visited = true;
|
|
5864
|
-
selectionSet2.selections.forEach(function(selection) {
|
|
5865
|
-
if (!shouldInclude(selection, context.variables))
|
|
5866
|
-
return;
|
|
5867
|
-
var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred;
|
|
5868
|
-
if (!(clientOnly && deferred) && isNonEmptyArray(selection.directives)) {
|
|
5869
|
-
selection.directives.forEach(function(dir) {
|
|
5870
|
-
var name = dir.name.value;
|
|
5871
|
-
if (name === "client")
|
|
5872
|
-
clientOnly = true;
|
|
5873
|
-
if (name === "defer") {
|
|
5874
|
-
var args = argumentsObjectFromField(dir, context.variables);
|
|
5875
|
-
if (!args || args.if !== false) {
|
|
5876
|
-
deferred = true;
|
|
5877
|
-
}
|
|
5878
|
-
}
|
|
5879
|
-
});
|
|
5880
|
-
}
|
|
5881
|
-
if (isField(selection)) {
|
|
5882
|
-
var existing = fieldMap.get(selection);
|
|
5883
|
-
if (existing) {
|
|
5884
|
-
clientOnly = clientOnly && existing.clientOnly;
|
|
5885
|
-
deferred = deferred && existing.deferred;
|
|
5886
|
-
}
|
|
5887
|
-
fieldMap.set(selection, getContextFlavor(context, clientOnly, deferred));
|
|
5888
|
-
} else {
|
|
5889
|
-
var fragment = getFragmentFromSelection(selection, context.fragmentMap);
|
|
5890
|
-
if (fragment && policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
5891
|
-
flatten(fragment.selectionSet, getContextFlavor(context, clientOnly, deferred));
|
|
5892
|
-
}
|
|
5893
|
-
}
|
|
5894
|
-
});
|
|
5895
|
-
})(selectionSet, context);
|
|
5896
|
-
return fieldMap;
|
|
5897
|
-
};
|
|
5898
|
-
StoreWriter2.prototype.applyMerges = function(mergeTree, existing, incoming, context, getStorageArgs) {
|
|
5899
|
-
var _a2;
|
|
5900
|
-
var _this = this;
|
|
5901
|
-
if (mergeTree.map.size && !isReference(incoming)) {
|
|
5902
|
-
var e_1 = !Array.isArray(incoming) && (isReference(existing) || storeValueIsStoreObject(existing)) ? existing : void 0;
|
|
5903
|
-
var i_1 = incoming;
|
|
5904
|
-
if (e_1 && !getStorageArgs) {
|
|
5905
|
-
getStorageArgs = [isReference(e_1) ? e_1.__ref : e_1];
|
|
5906
|
-
}
|
|
5907
|
-
var changedFields_1;
|
|
5908
|
-
var getValue_1 = function(from, name) {
|
|
5909
|
-
return Array.isArray(from) ? typeof name === "number" ? from[name] : void 0 : context.store.getFieldValue(from, String(name));
|
|
5910
|
-
};
|
|
5911
|
-
mergeTree.map.forEach(function(childTree, storeFieldName) {
|
|
5912
|
-
var eVal = getValue_1(e_1, storeFieldName);
|
|
5913
|
-
var iVal = getValue_1(i_1, storeFieldName);
|
|
5914
|
-
if (iVal === void 0)
|
|
5915
|
-
return;
|
|
5916
|
-
if (getStorageArgs) {
|
|
5917
|
-
getStorageArgs.push(storeFieldName);
|
|
5918
|
-
}
|
|
5919
|
-
var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs);
|
|
5920
|
-
if (aVal !== iVal) {
|
|
5921
|
-
changedFields_1 = changedFields_1 || new Map();
|
|
5922
|
-
changedFields_1.set(storeFieldName, aVal);
|
|
5923
|
-
}
|
|
5924
|
-
if (getStorageArgs) {
|
|
5925
|
-
invariant(getStorageArgs.pop() === storeFieldName);
|
|
5926
|
-
}
|
|
5927
|
-
});
|
|
5928
|
-
if (changedFields_1) {
|
|
5929
|
-
incoming = Array.isArray(i_1) ? i_1.slice(0) : __assign({}, i_1);
|
|
5930
|
-
changedFields_1.forEach(function(value, name) {
|
|
5931
|
-
incoming[name] = value;
|
|
5932
|
-
});
|
|
5933
|
-
}
|
|
5934
|
-
}
|
|
5935
|
-
if (mergeTree.info) {
|
|
5936
|
-
return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a2 = context.store).getStorage.apply(_a2, getStorageArgs));
|
|
5937
|
-
}
|
|
5938
|
-
return incoming;
|
|
5939
|
-
};
|
|
5940
|
-
return StoreWriter2;
|
|
5941
|
-
}();
|
|
5942
|
-
var emptyMergeTreePool = [];
|
|
5943
|
-
function getChildMergeTree(_a2, name) {
|
|
5944
|
-
var map = _a2.map;
|
|
5945
|
-
if (!map.has(name)) {
|
|
5946
|
-
map.set(name, emptyMergeTreePool.pop() || { map: new Map() });
|
|
5947
|
-
}
|
|
5948
|
-
return map.get(name);
|
|
5949
|
-
}
|
|
5950
|
-
function mergeMergeTrees(left, right) {
|
|
5951
|
-
if (left === right || !right || mergeTreeIsEmpty(right))
|
|
5952
|
-
return left;
|
|
5953
|
-
if (!left || mergeTreeIsEmpty(left))
|
|
5954
|
-
return right;
|
|
5955
|
-
var info = left.info && right.info ? __assign(__assign({}, left.info), right.info) : left.info || right.info;
|
|
5956
|
-
var needToMergeMaps = left.map.size && right.map.size;
|
|
5957
|
-
var map = needToMergeMaps ? new Map() : left.map.size ? left.map : right.map;
|
|
5958
|
-
var merged = { info, map };
|
|
5959
|
-
if (needToMergeMaps) {
|
|
5960
|
-
var remainingRightKeys_1 = new Set(right.map.keys());
|
|
5961
|
-
left.map.forEach(function(leftTree, key) {
|
|
5962
|
-
merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key)));
|
|
5963
|
-
remainingRightKeys_1.delete(key);
|
|
5964
|
-
});
|
|
5965
|
-
remainingRightKeys_1.forEach(function(key) {
|
|
5966
|
-
merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key)));
|
|
5967
|
-
});
|
|
5968
|
-
}
|
|
5969
|
-
return merged;
|
|
5970
|
-
}
|
|
5971
|
-
function mergeTreeIsEmpty(tree) {
|
|
5972
|
-
return !tree || !(tree.info || tree.map.size);
|
|
5973
|
-
}
|
|
5974
|
-
function maybeRecycleChildMergeTree(_a2, name) {
|
|
5975
|
-
var map = _a2.map;
|
|
5976
|
-
var childTree = map.get(name);
|
|
5977
|
-
if (childTree && mergeTreeIsEmpty(childTree)) {
|
|
5978
|
-
emptyMergeTreePool.push(childTree);
|
|
5979
|
-
map.delete(name);
|
|
5980
|
-
}
|
|
5981
|
-
}
|
|
5982
|
-
var warnings = new Set();
|
|
5983
|
-
function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
5984
|
-
var getChild = function(objOrRef) {
|
|
5985
|
-
var child = store.getFieldValue(objOrRef, storeFieldName);
|
|
5986
|
-
return typeof child === "object" && child;
|
|
5987
|
-
};
|
|
5988
|
-
var existing = getChild(existingRef);
|
|
5989
|
-
if (!existing)
|
|
5990
|
-
return;
|
|
5991
|
-
var incoming = getChild(incomingObj);
|
|
5992
|
-
if (!incoming)
|
|
5993
|
-
return;
|
|
5994
|
-
if (isReference(existing))
|
|
5995
|
-
return;
|
|
5996
|
-
if (equal(existing, incoming))
|
|
5997
|
-
return;
|
|
5998
|
-
if (Object.keys(existing).every(function(key) {
|
|
5999
|
-
return store.getFieldValue(incoming, key) !== void 0;
|
|
6000
|
-
})) {
|
|
6001
|
-
return;
|
|
6002
|
-
}
|
|
6003
|
-
var parentType = store.getFieldValue(existingRef, "__typename") || store.getFieldValue(incomingObj, "__typename");
|
|
6004
|
-
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
6005
|
-
var typeDotName = "".concat(parentType, ".").concat(fieldName);
|
|
6006
|
-
if (warnings.has(typeDotName))
|
|
6007
|
-
return;
|
|
6008
|
-
warnings.add(typeDotName);
|
|
6009
|
-
var childTypenames = [];
|
|
6010
|
-
if (!Array.isArray(existing) && !Array.isArray(incoming)) {
|
|
6011
|
-
[existing, incoming].forEach(function(child) {
|
|
6012
|
-
var typename = store.getFieldValue(child, "__typename");
|
|
6013
|
-
if (typeof typename === "string" && !childTypenames.includes(typename)) {
|
|
6014
|
-
childTypenames.push(typename);
|
|
6015
|
-
}
|
|
6016
|
-
});
|
|
6017
|
-
}
|
|
6018
|
-
__DEV__ && invariant.warn("Cache data may be lost when replacing the ".concat(fieldName, " field of a ").concat(parentType, " object.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(childTypenames.length ? "either ensure all objects of type " + childTypenames.join(" and ") + " have an ID or a custom merge function, or " : "", "define a custom merge function for the ").concat(typeDotName, " field, so InMemoryCache can safely merge these objects:\n\n existing: ").concat(JSON.stringify(existing).slice(0, 1e3), "\n incoming: ").concat(JSON.stringify(incoming).slice(0, 1e3), "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"));
|
|
6019
|
-
}
|
|
6020
|
-
var InMemoryCache = function(_super) {
|
|
6021
|
-
__extends(InMemoryCache2, _super);
|
|
6022
|
-
function InMemoryCache2(config) {
|
|
6023
|
-
if (config === void 0) {
|
|
6024
|
-
config = {};
|
|
6025
|
-
}
|
|
6026
|
-
var _this = _super.call(this) || this;
|
|
6027
|
-
_this.watches = new Set();
|
|
6028
|
-
_this.typenameDocumentCache = new Map();
|
|
6029
|
-
_this.makeVar = makeVar;
|
|
6030
|
-
_this.txCount = 0;
|
|
6031
|
-
_this.config = normalizeConfig(config);
|
|
6032
|
-
_this.addTypename = !!_this.config.addTypename;
|
|
6033
|
-
_this.policies = new Policies({
|
|
6034
|
-
cache: _this,
|
|
6035
|
-
dataIdFromObject: _this.config.dataIdFromObject,
|
|
6036
|
-
possibleTypes: _this.config.possibleTypes,
|
|
6037
|
-
typePolicies: _this.config.typePolicies
|
|
6038
|
-
});
|
|
6039
|
-
_this.init();
|
|
6040
|
-
return _this;
|
|
6041
|
-
}
|
|
6042
|
-
InMemoryCache2.prototype.init = function() {
|
|
6043
|
-
var rootStore = this.data = new EntityStore.Root({
|
|
6044
|
-
policies: this.policies,
|
|
6045
|
-
resultCaching: this.config.resultCaching
|
|
6046
|
-
});
|
|
6047
|
-
this.optimisticData = rootStore.stump;
|
|
6048
|
-
this.resetResultCache();
|
|
6049
|
-
};
|
|
6050
|
-
InMemoryCache2.prototype.resetResultCache = function(resetResultIdentities) {
|
|
6051
|
-
var _this = this;
|
|
6052
|
-
var previousReader = this.storeReader;
|
|
6053
|
-
this.storeWriter = new StoreWriter(this, this.storeReader = new StoreReader({
|
|
6054
|
-
cache: this,
|
|
6055
|
-
addTypename: this.addTypename,
|
|
6056
|
-
resultCacheMaxSize: this.config.resultCacheMaxSize,
|
|
6057
|
-
canonizeResults: shouldCanonizeResults(this.config),
|
|
6058
|
-
canon: resetResultIdentities ? void 0 : previousReader && previousReader.canon
|
|
6059
|
-
}));
|
|
6060
|
-
this.maybeBroadcastWatch = wrap(function(c, options) {
|
|
6061
|
-
return _this.broadcastWatch(c, options);
|
|
6062
|
-
}, {
|
|
6063
|
-
max: this.config.resultCacheMaxSize,
|
|
6064
|
-
makeCacheKey: function(c) {
|
|
6065
|
-
var store = c.optimistic ? _this.optimisticData : _this.data;
|
|
6066
|
-
if (supportsResultCaching(store)) {
|
|
6067
|
-
var optimistic = c.optimistic, rootId = c.rootId, variables = c.variables;
|
|
6068
|
-
return store.makeCacheKey(c.query, c.callback, canonicalStringify({ optimistic, rootId, variables }));
|
|
6069
|
-
}
|
|
6070
|
-
}
|
|
6071
|
-
});
|
|
6072
|
-
new Set([
|
|
6073
|
-
this.data.group,
|
|
6074
|
-
this.optimisticData.group
|
|
6075
|
-
]).forEach(function(group) {
|
|
6076
|
-
return group.resetCaching();
|
|
6077
|
-
});
|
|
6078
|
-
};
|
|
6079
|
-
InMemoryCache2.prototype.restore = function(data) {
|
|
6080
|
-
this.init();
|
|
6081
|
-
if (data)
|
|
6082
|
-
this.data.replace(data);
|
|
6083
|
-
return this;
|
|
6084
|
-
};
|
|
6085
|
-
InMemoryCache2.prototype.extract = function(optimistic) {
|
|
6086
|
-
if (optimistic === void 0) {
|
|
6087
|
-
optimistic = false;
|
|
6088
|
-
}
|
|
6089
|
-
return (optimistic ? this.optimisticData : this.data).extract();
|
|
6090
|
-
};
|
|
6091
|
-
InMemoryCache2.prototype.read = function(options) {
|
|
6092
|
-
var _a2 = options.returnPartialData, returnPartialData = _a2 === void 0 ? false : _a2;
|
|
6093
|
-
try {
|
|
6094
|
-
return this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData })).result || null;
|
|
6095
|
-
} catch (e) {
|
|
6096
|
-
if (e instanceof MissingFieldError) {
|
|
6097
|
-
return null;
|
|
6098
|
-
}
|
|
6099
|
-
throw e;
|
|
6100
|
-
}
|
|
6101
|
-
};
|
|
6102
|
-
InMemoryCache2.prototype.write = function(options) {
|
|
6103
|
-
try {
|
|
6104
|
-
++this.txCount;
|
|
6105
|
-
return this.storeWriter.writeToStore(this.data, options);
|
|
6106
|
-
} finally {
|
|
6107
|
-
if (!--this.txCount && options.broadcast !== false) {
|
|
6108
|
-
this.broadcastWatches();
|
|
6109
|
-
}
|
|
6110
|
-
}
|
|
6111
|
-
};
|
|
6112
|
-
InMemoryCache2.prototype.modify = function(options) {
|
|
6113
|
-
if (hasOwn.call(options, "id") && !options.id) {
|
|
6114
|
-
return false;
|
|
6115
|
-
}
|
|
6116
|
-
var store = options.optimistic ? this.optimisticData : this.data;
|
|
6117
|
-
try {
|
|
6118
|
-
++this.txCount;
|
|
6119
|
-
return store.modify(options.id || "ROOT_QUERY", options.fields);
|
|
6120
|
-
} finally {
|
|
6121
|
-
if (!--this.txCount && options.broadcast !== false) {
|
|
6122
|
-
this.broadcastWatches();
|
|
6123
|
-
}
|
|
6124
|
-
}
|
|
6125
|
-
};
|
|
6126
|
-
InMemoryCache2.prototype.diff = function(options) {
|
|
6127
|
-
return this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", config: this.config }));
|
|
6128
|
-
};
|
|
6129
|
-
InMemoryCache2.prototype.watch = function(watch2) {
|
|
6130
|
-
var _this = this;
|
|
6131
|
-
if (!this.watches.size) {
|
|
6132
|
-
recallCache(this);
|
|
6133
|
-
}
|
|
6134
|
-
this.watches.add(watch2);
|
|
6135
|
-
if (watch2.immediate) {
|
|
6136
|
-
this.maybeBroadcastWatch(watch2);
|
|
6137
|
-
}
|
|
6138
|
-
return function() {
|
|
6139
|
-
if (_this.watches.delete(watch2) && !_this.watches.size) {
|
|
6140
|
-
forgetCache(_this);
|
|
6141
|
-
}
|
|
6142
|
-
_this.maybeBroadcastWatch.forget(watch2);
|
|
6143
|
-
};
|
|
6144
|
-
};
|
|
6145
|
-
InMemoryCache2.prototype.gc = function(options) {
|
|
6146
|
-
canonicalStringify.reset();
|
|
6147
|
-
var ids = this.optimisticData.gc();
|
|
6148
|
-
if (options && !this.txCount) {
|
|
6149
|
-
if (options.resetResultCache) {
|
|
6150
|
-
this.resetResultCache(options.resetResultIdentities);
|
|
6151
|
-
} else if (options.resetResultIdentities) {
|
|
6152
|
-
this.storeReader.resetCanon();
|
|
6153
|
-
}
|
|
6154
|
-
}
|
|
6155
|
-
return ids;
|
|
6156
|
-
};
|
|
6157
|
-
InMemoryCache2.prototype.retain = function(rootId, optimistic) {
|
|
6158
|
-
return (optimistic ? this.optimisticData : this.data).retain(rootId);
|
|
6159
|
-
};
|
|
6160
|
-
InMemoryCache2.prototype.release = function(rootId, optimistic) {
|
|
6161
|
-
return (optimistic ? this.optimisticData : this.data).release(rootId);
|
|
6162
|
-
};
|
|
6163
|
-
InMemoryCache2.prototype.identify = function(object) {
|
|
6164
|
-
if (isReference(object))
|
|
6165
|
-
return object.__ref;
|
|
6166
|
-
try {
|
|
6167
|
-
return this.policies.identify(object)[0];
|
|
6168
|
-
} catch (e) {
|
|
6169
|
-
__DEV__ && invariant.warn(e);
|
|
6170
|
-
}
|
|
6171
|
-
};
|
|
6172
|
-
InMemoryCache2.prototype.evict = function(options) {
|
|
6173
|
-
if (!options.id) {
|
|
6174
|
-
if (hasOwn.call(options, "id")) {
|
|
6175
|
-
return false;
|
|
6176
|
-
}
|
|
6177
|
-
options = __assign(__assign({}, options), { id: "ROOT_QUERY" });
|
|
6178
|
-
}
|
|
6179
|
-
try {
|
|
6180
|
-
++this.txCount;
|
|
6181
|
-
return this.optimisticData.evict(options, this.data);
|
|
6182
|
-
} finally {
|
|
6183
|
-
if (!--this.txCount && options.broadcast !== false) {
|
|
6184
|
-
this.broadcastWatches();
|
|
6185
|
-
}
|
|
6186
|
-
}
|
|
6187
|
-
};
|
|
6188
|
-
InMemoryCache2.prototype.reset = function(options) {
|
|
6189
|
-
var _this = this;
|
|
6190
|
-
this.init();
|
|
6191
|
-
canonicalStringify.reset();
|
|
6192
|
-
if (options && options.discardWatches) {
|
|
6193
|
-
this.watches.forEach(function(watch2) {
|
|
6194
|
-
return _this.maybeBroadcastWatch.forget(watch2);
|
|
6195
|
-
});
|
|
6196
|
-
this.watches.clear();
|
|
6197
|
-
forgetCache(this);
|
|
6198
|
-
} else {
|
|
6199
|
-
this.broadcastWatches();
|
|
6200
|
-
}
|
|
6201
|
-
return Promise.resolve();
|
|
6202
|
-
};
|
|
6203
|
-
InMemoryCache2.prototype.removeOptimistic = function(idToRemove) {
|
|
6204
|
-
var newOptimisticData = this.optimisticData.removeLayer(idToRemove);
|
|
6205
|
-
if (newOptimisticData !== this.optimisticData) {
|
|
6206
|
-
this.optimisticData = newOptimisticData;
|
|
6207
|
-
this.broadcastWatches();
|
|
6208
|
-
}
|
|
6209
|
-
};
|
|
6210
|
-
InMemoryCache2.prototype.batch = function(options) {
|
|
6211
|
-
var _this = this;
|
|
6212
|
-
var update = options.update, _a2 = options.optimistic, optimistic = _a2 === void 0 ? true : _a2, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated;
|
|
6213
|
-
var updateResult;
|
|
6214
|
-
var perform = function(layer) {
|
|
6215
|
-
var _a3 = _this, data = _a3.data, optimisticData = _a3.optimisticData;
|
|
6216
|
-
++_this.txCount;
|
|
6217
|
-
if (layer) {
|
|
6218
|
-
_this.data = _this.optimisticData = layer;
|
|
6219
|
-
}
|
|
6220
|
-
try {
|
|
6221
|
-
return updateResult = update(_this);
|
|
6222
|
-
} finally {
|
|
6223
|
-
--_this.txCount;
|
|
6224
|
-
_this.data = data;
|
|
6225
|
-
_this.optimisticData = optimisticData;
|
|
6226
|
-
}
|
|
6227
|
-
};
|
|
6228
|
-
var alreadyDirty = new Set();
|
|
6229
|
-
if (onWatchUpdated && !this.txCount) {
|
|
6230
|
-
this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function(watch2) {
|
|
6231
|
-
alreadyDirty.add(watch2);
|
|
6232
|
-
return false;
|
|
6233
|
-
} }));
|
|
6234
|
-
}
|
|
6235
|
-
if (typeof optimistic === "string") {
|
|
6236
|
-
this.optimisticData = this.optimisticData.addLayer(optimistic, perform);
|
|
6237
|
-
} else if (optimistic === false) {
|
|
6238
|
-
perform(this.data);
|
|
6239
|
-
} else {
|
|
6240
|
-
perform();
|
|
6241
|
-
}
|
|
6242
|
-
if (typeof removeOptimistic === "string") {
|
|
6243
|
-
this.optimisticData = this.optimisticData.removeLayer(removeOptimistic);
|
|
6244
|
-
}
|
|
6245
|
-
if (onWatchUpdated && alreadyDirty.size) {
|
|
6246
|
-
this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function(watch2, diff) {
|
|
6247
|
-
var result = onWatchUpdated.call(this, watch2, diff);
|
|
6248
|
-
if (result !== false) {
|
|
6249
|
-
alreadyDirty.delete(watch2);
|
|
6250
|
-
}
|
|
6251
|
-
return result;
|
|
6252
|
-
} }));
|
|
6253
|
-
if (alreadyDirty.size) {
|
|
6254
|
-
alreadyDirty.forEach(function(watch2) {
|
|
6255
|
-
return _this.maybeBroadcastWatch.dirty(watch2);
|
|
6256
|
-
});
|
|
6257
|
-
}
|
|
6258
|
-
} else {
|
|
6259
|
-
this.broadcastWatches(options);
|
|
6260
|
-
}
|
|
6261
|
-
return updateResult;
|
|
6262
|
-
};
|
|
6263
|
-
InMemoryCache2.prototype.performTransaction = function(update, optimisticId) {
|
|
6264
|
-
return this.batch({
|
|
6265
|
-
update,
|
|
6266
|
-
optimistic: optimisticId || optimisticId !== null
|
|
6267
|
-
});
|
|
6268
|
-
};
|
|
6269
|
-
InMemoryCache2.prototype.transformDocument = function(document) {
|
|
6270
|
-
if (this.addTypename) {
|
|
6271
|
-
var result = this.typenameDocumentCache.get(document);
|
|
6272
|
-
if (!result) {
|
|
6273
|
-
result = addTypenameToDocument(document);
|
|
6274
|
-
this.typenameDocumentCache.set(document, result);
|
|
6275
|
-
this.typenameDocumentCache.set(result, result);
|
|
6276
|
-
}
|
|
6277
|
-
return result;
|
|
6278
|
-
}
|
|
6279
|
-
return document;
|
|
6280
|
-
};
|
|
6281
|
-
InMemoryCache2.prototype.broadcastWatches = function(options) {
|
|
6282
|
-
var _this = this;
|
|
6283
|
-
if (!this.txCount) {
|
|
6284
|
-
this.watches.forEach(function(c) {
|
|
6285
|
-
return _this.maybeBroadcastWatch(c, options);
|
|
6286
|
-
});
|
|
6287
|
-
}
|
|
6288
|
-
};
|
|
6289
|
-
InMemoryCache2.prototype.broadcastWatch = function(c, options) {
|
|
6290
|
-
var lastDiff = c.lastDiff;
|
|
6291
|
-
var diff = this.diff(c);
|
|
6292
|
-
if (options) {
|
|
6293
|
-
if (c.optimistic && typeof options.optimistic === "string") {
|
|
6294
|
-
diff.fromOptimisticTransaction = true;
|
|
6295
|
-
}
|
|
6296
|
-
if (options.onWatchUpdated && options.onWatchUpdated.call(this, c, diff, lastDiff) === false) {
|
|
6297
|
-
return;
|
|
6298
|
-
}
|
|
6299
|
-
}
|
|
6300
|
-
if (!lastDiff || !equal(lastDiff.result, diff.result)) {
|
|
6301
|
-
c.callback(c.lastDiff = diff, lastDiff);
|
|
6302
|
-
}
|
|
6303
|
-
};
|
|
6304
|
-
return InMemoryCache2;
|
|
6305
|
-
}(ApolloCache);
|
|
6306
|
-
const defaultTaskTemplate = {
|
|
6307
|
-
taskTemplateObj: {},
|
|
6308
|
-
isAddedToTask: false,
|
|
6309
|
-
isNotified: false
|
|
6310
|
-
};
|
|
6311
|
-
var __vue2_script$1 = defineComponent({
|
|
6312
|
-
name: "index",
|
|
6313
|
-
components: {
|
|
6314
|
-
NewTask,
|
|
6315
|
-
MainModal,
|
|
6316
|
-
ReviewModal
|
|
6317
|
-
},
|
|
6318
|
-
props: {
|
|
6319
|
-
uploadFilesFunc: {
|
|
6320
|
-
type: Function,
|
|
6321
|
-
required: true
|
|
6322
|
-
},
|
|
6323
|
-
visible: {
|
|
6324
|
-
type: Boolean,
|
|
6325
|
-
default: false
|
|
6326
|
-
},
|
|
6327
|
-
userId: {
|
|
6328
|
-
type: String,
|
|
6329
|
-
required: true
|
|
6330
|
-
},
|
|
6331
|
-
lawFirmId: {
|
|
6332
|
-
type: Number,
|
|
6333
|
-
required: true
|
|
6334
|
-
},
|
|
6335
|
-
value: {
|
|
6336
|
-
type: Array,
|
|
6337
|
-
required: true,
|
|
6338
|
-
default: () => []
|
|
6339
|
-
},
|
|
6340
|
-
reviewText: {
|
|
6341
|
-
type: String,
|
|
6342
|
-
required: true
|
|
6343
|
-
},
|
|
6344
|
-
showSendEmail: {
|
|
6345
|
-
type: Boolean,
|
|
6346
|
-
default: false
|
|
6347
|
-
},
|
|
6348
|
-
sendEmail: {
|
|
6349
|
-
type: Boolean,
|
|
6350
|
-
default: false
|
|
6351
|
-
},
|
|
6352
|
-
taskSettingPageUrl: {
|
|
6353
|
-
type: String,
|
|
6354
|
-
required: true
|
|
6355
|
-
},
|
|
6356
|
-
allowClear: {
|
|
6357
|
-
type: Boolean,
|
|
6358
|
-
default: false
|
|
6359
|
-
}
|
|
6360
|
-
},
|
|
6361
|
-
setup(props, { emit }) {
|
|
6362
|
-
const mainModal = ref$1();
|
|
6363
|
-
const reviewModal = ref$1();
|
|
6364
|
-
const newTaskVisible = ref$1(false);
|
|
6365
|
-
const reviewModalVisible = ref$1(false);
|
|
6366
|
-
const tempTask = ref$1(defaultTaskTemplate);
|
|
6367
|
-
const updateTemplate = useMutateTaskTemplate();
|
|
6368
|
-
const createTemplate = useCreateTaskTemplate();
|
|
6369
|
-
const addedTasks = ref$1([]);
|
|
6370
|
-
new InMemoryCache();
|
|
6371
|
-
onMounted(() => {
|
|
6372
|
-
const { value, lawFirmId } = props;
|
|
6373
|
-
if (!value.length)
|
|
6374
|
-
return;
|
|
6375
|
-
const conditions = ref$1({
|
|
6376
|
-
taskTemplateId: value
|
|
6377
|
-
});
|
|
6378
|
-
const { result } = useSearchTaskTemplates(ref$1({ current: 1, pageSize: 1e3, total: 0 }), conditions, lawFirmId);
|
|
6379
|
-
watch(() => result.value, () => {
|
|
6380
|
-
var _a2, _b;
|
|
6381
|
-
addedTasks.value = ((_b = (_a2 = result.value) == null ? void 0 : _a2.taskTemplateSearch) == null ? void 0 : _b.taskTemplateList) || [];
|
|
6382
|
-
});
|
|
6383
|
-
});
|
|
6384
|
-
watch(() => newTaskVisible.value, (visible) => {
|
|
6385
|
-
if (!visible) {
|
|
6386
|
-
tempTask.value = defaultTaskTemplate;
|
|
2791
|
+
watch(() => newTaskVisible.value, (visible) => {
|
|
2792
|
+
if (!visible) {
|
|
2793
|
+
tempTask.value = defaultTaskTemplate;
|
|
6387
2794
|
}
|
|
6388
2795
|
});
|
|
6389
2796
|
const _submit = async (record) => {
|
|
@@ -6393,7 +2800,6 @@ var __vue2_script$1 = defineComponent({
|
|
|
6393
2800
|
} = await submit(record, updateTemplate, createTemplate);
|
|
6394
2801
|
if (success) {
|
|
6395
2802
|
newTaskVisible.value = false;
|
|
6396
|
-
message.success("Success!");
|
|
6397
2803
|
mainModal.value.taskTable.refetch();
|
|
6398
2804
|
if (reviewModalVisible.value) {
|
|
6399
2805
|
const newValue = addedTasks.value.map((originTask) => {
|
|
@@ -6404,12 +2810,17 @@ var __vue2_script$1 = defineComponent({
|
|
|
6404
2810
|
});
|
|
6405
2811
|
emit("update:value", newValue.map(({ id }) => id));
|
|
6406
2812
|
}
|
|
6407
|
-
} else {
|
|
6408
|
-
message.error("Failed!");
|
|
6409
2813
|
}
|
|
6410
2814
|
};
|
|
6411
2815
|
const submitting = computed(() => updateTemplate.loading.value || createTemplate.loading.value);
|
|
2816
|
+
const showEdit = (record) => {
|
|
2817
|
+
newTaskVisible.value = true;
|
|
2818
|
+
tempTask.value = {
|
|
2819
|
+
taskTemplateObj: __spreadValues({}, record)
|
|
2820
|
+
};
|
|
2821
|
+
};
|
|
6412
2822
|
return {
|
|
2823
|
+
showEdit,
|
|
6413
2824
|
mainModal,
|
|
6414
2825
|
reviewModal,
|
|
6415
2826
|
_submit,
|
|
@@ -6425,7 +2836,7 @@ var render$1 = function() {
|
|
|
6425
2836
|
var _vm = this;
|
|
6426
2837
|
var _h = _vm.$createElement;
|
|
6427
2838
|
var _c = _vm._self._c || _h;
|
|
6428
|
-
return _c("div", { attrs: { "id": "venus-component-task-cart" } }, [_c("main-modal", { ref: "mainModal", attrs: { "task-setting-page-url": _vm.taskSettingPageUrl, "tempTask": _vm.tempTask, "newTaskVisible": _vm.newTaskVisible, "reviewModalVisible": _vm.reviewModalVisible, "added-tasks": _vm.addedTasks, "law-firm-id": _vm.lawFirmId, "visible": _vm.visible }, on: { "update:tempTask": function($event) {
|
|
2839
|
+
return _c("div", { attrs: { "id": "venus-component-task-cart" } }, [_c("main-modal", { ref: "mainModal", attrs: { "task-setting-page-url": _vm.taskSettingPageUrl, "tempTask": _vm.tempTask, "newTaskVisible": _vm.newTaskVisible, "reviewModalVisible": _vm.reviewModalVisible, "added-tasks": _vm.addedTasks, "law-firm-id": _vm.lawFirmId, "visible": _vm.visible, "show-page": _vm.pageMode }, on: { "update:tempTask": function($event) {
|
|
6429
2840
|
_vm.tempTask = $event;
|
|
6430
2841
|
}, "update:temp-task": function($event) {
|
|
6431
2842
|
_vm.tempTask = $event;
|
|
@@ -6443,7 +2854,13 @@ var render$1 = function() {
|
|
|
6443
2854
|
_vm.addedTasks = $event;
|
|
6444
2855
|
}, "update:visible": function($event) {
|
|
6445
2856
|
return _vm.$emit("update:visible", $event);
|
|
6446
|
-
}
|
|
2857
|
+
}, "edit": _vm.showEdit }, scopedSlots: _vm._u([{ key: "default", fn: function(ref2) {
|
|
2858
|
+
var loading = ref2.loading;
|
|
2859
|
+
var dataSource = ref2.dataSource;
|
|
2860
|
+
var pagination = ref2.pagination;
|
|
2861
|
+
var changePagination = ref2.changePagination;
|
|
2862
|
+
return [_vm._t("table", null, { "loading": loading, "dataSource": dataSource, "pagination": pagination, "changePagination": changePagination })];
|
|
2863
|
+
} }], null, true) }), _c("review-modal", { ref: "reviewModal", attrs: { "tempTask": _vm.tempTask, "visible": _vm.reviewModalVisible, "newTaskVisible": _vm.newTaskVisible, "added-tasks": _vm.addedTasks, "review-text": _vm.reviewText, "showSendEmail": _vm.showSendEmail, "sendEmail": _vm.sendEmail, "allow-clear": _vm.allowClear }, on: { "update:tempTask": function($event) {
|
|
6447
2864
|
_vm.tempTask = $event;
|
|
6448
2865
|
}, "update:temp-task": function($event) {
|
|
6449
2866
|
_vm.tempTask = $event;
|
|
@@ -6470,7 +2887,7 @@ var render$1 = function() {
|
|
|
6470
2887
|
var staticRenderFns$1 = [];
|
|
6471
2888
|
var index_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
6472
2889
|
const __cssModules$1 = {};
|
|
6473
|
-
var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, "
|
|
2890
|
+
var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, "015614a4", null, null);
|
|
6474
2891
|
function __vue2_injectStyles$1(context) {
|
|
6475
2892
|
for (let o in __cssModules$1) {
|
|
6476
2893
|
this[o] = __cssModules$1[o];
|