@blaze-cms/plugin-data-ui 0.125.0-alpha.1 → 0.125.0-alpha.13
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/CHANGELOG.md +24 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +17 -40
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +0 -4
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +67 -204
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +13 -28
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +5 -26
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +0 -4
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +0 -4
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +13 -57
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +0 -3
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +0 -16
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +0 -11
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +0 -3
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js +0 -7
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +0 -3
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +0 -18
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +0 -3
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +0 -25
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js +0 -4
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +24 -83
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js +0 -4
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js +5 -38
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +3 -38
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +17 -42
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +0 -7
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +2 -11
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +31 -116
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +9 -22
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +0 -4
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js +2 -11
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +0 -4
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +0 -4
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +13 -49
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +0 -11
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +5 -16
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/constants.js +0 -1
- package/lib/constants.js.map +1 -1
- package/lib/index.js +0 -29
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +2 -17
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +0 -12
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js +0 -10
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js +0 -10
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +0 -12
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +0 -9
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +0 -3
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js +0 -7
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js +3 -10
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib/utils/index.js +0 -3
- package/lib/utils/index.js.map +1 -1
- package/lib-es/components/EntityDataListing/EntityDataListing.js +0 -2
- package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib-es/components/EntityDataListing/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +10 -55
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js +0 -2
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +2 -5
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +0 -3
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js +0 -3
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js +0 -3
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js +0 -5
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js +0 -6
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/index.js.map +1 -1
- package/lib-es/components/EntityManager/EntityManager.js +2 -14
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
- package/lib-es/components/EntityManager/index.js.map +1 -1
- package/lib-es/components/EntityManager/utils/data-mappers.js +0 -11
- package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entity.js +0 -13
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js +0 -2
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib-es/components/EntityManager/utils/is-form-empty.js +0 -2
- package/lib-es/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib-es/components/EntityManager/utils/query.js +2 -4
- package/lib-es/components/EntityManager/utils/query.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js +0 -17
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +0 -2
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib-es/components/ListingTable/TableActions/TableActions.js +0 -2
- package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib-es/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib-es/components/ListingTable/index.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js +0 -13
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js +0 -2
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/components/Tabs/index.js +0 -2
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/index.js +2 -6
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/add-content-menu-items.js +0 -3
- package/lib-es/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/utils/build-create-entity-mutation.js +0 -3
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-delete-entity-mutation.js +0 -3
- package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-listing-query.js +0 -3
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/build-update-data-query.js +0 -3
- package/lib-es/utils/build-update-data-query.js.map +1 -1
- package/lib-es/utils/build-update-publish-unpublish-mutation.js +0 -3
- package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib-es/utils/get-default-query-params.js +0 -1
- package/lib-es/utils/get-default-query-params.js.map +1 -1
- package/lib-es/utils/hoc/withContext.js.map +1 -1
- package/lib-es/utils/hooks/useToggle.js +0 -2
- package/lib-es/utils/hooks/useToggle.js.map +1 -1
- package/lib-es/utils/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.object.keys.js");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.symbol.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.filter.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.array.for-each.js");
|
|
12
|
-
|
|
13
8
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
-
|
|
15
9
|
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
16
|
-
|
|
17
10
|
require("core-js/modules/es.object.define-properties.js");
|
|
18
|
-
|
|
19
11
|
require("core-js/modules/es.object.define-property.js");
|
|
20
|
-
|
|
21
12
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
22
|
-
|
|
23
13
|
Object.defineProperty(exports, "__esModule", {
|
|
24
14
|
value: true
|
|
25
15
|
});
|
|
@@ -28,35 +18,21 @@ exports.checkFulfilConditions = checkFulfilConditions;
|
|
|
28
18
|
exports.getUpdatedFormValues = getUpdatedFormValues;
|
|
29
19
|
exports.onViewUrlClick = onViewUrlClick;
|
|
30
20
|
exports.validateSideBarRelations = validateSideBarRelations;
|
|
31
|
-
|
|
32
21
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
33
|
-
|
|
34
22
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
35
|
-
|
|
36
23
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
37
|
-
|
|
38
24
|
require("core-js/modules/es.array.find.js");
|
|
39
|
-
|
|
40
25
|
require("core-js/modules/es.object.to-string.js");
|
|
41
|
-
|
|
42
26
|
require("core-js/modules/es.array.slice.js");
|
|
43
|
-
|
|
44
27
|
require("core-js/modules/es.array.find-index.js");
|
|
45
|
-
|
|
46
28
|
require("core-js/modules/es.array.every.js");
|
|
47
|
-
|
|
48
29
|
var _lodash = _interopRequireDefault(require("lodash.has"));
|
|
49
|
-
|
|
50
30
|
var _constants = require("../../../constants");
|
|
51
|
-
|
|
52
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
53
|
-
|
|
54
32
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
55
|
-
|
|
56
33
|
function canViewPage(formData, entity, schema, entityIsPublished) {
|
|
57
34
|
return (0, _lodash["default"])(formData, _constants.KEY_TO_CHECK) && entity && entity.id && schema && schema.id && entityIsPublished === _constants.ENTITY_PUBLISHED;
|
|
58
35
|
}
|
|
59
|
-
|
|
60
36
|
function validateSideBarRelations(updatedFormValues, requiredChildField) {
|
|
61
37
|
if (!requiredChildField) return true;
|
|
62
38
|
var parentEntityField = updatedFormValues.find(function (_ref) {
|
|
@@ -71,11 +47,9 @@ function validateSideBarRelations(updatedFormValues, requiredChildField) {
|
|
|
71
47
|
var parentIdFieldHasValue = parentIdField && parentIdField.value;
|
|
72
48
|
return !!(!parentEntityFieldHasValue || parentEntityFieldHasValue && parentIdFieldHasValue);
|
|
73
49
|
}
|
|
74
|
-
|
|
75
50
|
function onViewUrlClick(_x) {
|
|
76
51
|
return _onViewUrlClick.apply(this, arguments);
|
|
77
52
|
}
|
|
78
|
-
|
|
79
53
|
function _onViewUrlClick() {
|
|
80
54
|
_onViewUrlClick = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(getFullUrl) {
|
|
81
55
|
var fullUrl;
|
|
@@ -85,11 +59,9 @@ function _onViewUrlClick() {
|
|
|
85
59
|
case 0:
|
|
86
60
|
_context.next = 2;
|
|
87
61
|
return getFullUrl();
|
|
88
|
-
|
|
89
62
|
case 2:
|
|
90
63
|
fullUrl = _context.sent;
|
|
91
64
|
if (fullUrl) window.open(fullUrl, '_blank');
|
|
92
|
-
|
|
93
65
|
case 4:
|
|
94
66
|
case "end":
|
|
95
67
|
return _context.stop();
|
|
@@ -99,18 +71,16 @@ function _onViewUrlClick() {
|
|
|
99
71
|
}));
|
|
100
72
|
return _onViewUrlClick.apply(this, arguments);
|
|
101
73
|
}
|
|
102
|
-
|
|
103
74
|
function getUpdatedFormValues(_ref3) {
|
|
104
75
|
var id = _ref3.id,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
76
|
+
value = _ref3.value,
|
|
77
|
+
requiredChildField = _ref3.requiredChildField,
|
|
78
|
+
formValues = _ref3.formValues;
|
|
108
79
|
var updatedFormValues = formValues ? formValues.slice() : [];
|
|
109
80
|
var fieldIndex = updatedFormValues.findIndex(function (_ref4) {
|
|
110
81
|
var _id = _ref4.id;
|
|
111
82
|
return _id === id;
|
|
112
83
|
});
|
|
113
|
-
|
|
114
84
|
if (fieldIndex > -1) {
|
|
115
85
|
updatedFormValues[fieldIndex] = _objectSpread(_objectSpread({}, updatedFormValues[fieldIndex]), {}, {
|
|
116
86
|
value: value
|
|
@@ -121,13 +91,11 @@ function getUpdatedFormValues(_ref3) {
|
|
|
121
91
|
value: value
|
|
122
92
|
});
|
|
123
93
|
}
|
|
124
|
-
|
|
125
94
|
if (requiredChildField && requiredChildField.id) {
|
|
126
95
|
var requiredChildFieldIndex = updatedFormValues.findIndex(function (_ref5) {
|
|
127
96
|
var _id = _ref5.id;
|
|
128
97
|
return _id === requiredChildField.id;
|
|
129
98
|
});
|
|
130
|
-
|
|
131
99
|
if (requiredChildFieldIndex > -1) {
|
|
132
100
|
updatedFormValues[requiredChildFieldIndex] = _objectSpread(_objectSpread({}, updatedFormValues[requiredChildFieldIndex]), {}, {
|
|
133
101
|
value: requiredChildField.value
|
|
@@ -139,15 +107,12 @@ function getUpdatedFormValues(_ref3) {
|
|
|
139
107
|
});
|
|
140
108
|
}
|
|
141
109
|
}
|
|
142
|
-
|
|
143
110
|
return updatedFormValues;
|
|
144
111
|
}
|
|
145
|
-
|
|
146
112
|
function checkFulfilConditions() {
|
|
147
113
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
148
114
|
args[_key] = arguments[_key];
|
|
149
115
|
}
|
|
150
|
-
|
|
151
116
|
return args.every(function (param) {
|
|
152
117
|
return param;
|
|
153
118
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","names":["canViewPage","formData","entity","schema","entityIsPublished","has","KEY_TO_CHECK","id","ENTITY_PUBLISHED","validateSideBarRelations","updatedFormValues","requiredChildField","parentEntityField","find","parentIdField","parentEntityFieldHasValue","value","SELECT_DEFAULT_VALUE","parentIdFieldHasValue","onViewUrlClick","getFullUrl","fullUrl","window","open","getUpdatedFormValues","formValues","slice","fieldIndex","findIndex","_id","push","requiredChildFieldIndex","checkFulfilConditions","args","every","param"],"sources":["../../../../src/components/EntityManager/utils/entity.js"],"sourcesContent":["import has from 'lodash.has';\nimport { ENTITY_PUBLISHED, KEY_TO_CHECK, SELECT_DEFAULT_VALUE } from '../../../constants';\n\nfunction canViewPage(formData, entity, schema, entityIsPublished) {\n return (\n has(formData, KEY_TO_CHECK) &&\n entity &&\n entity.id &&\n schema &&\n schema.id &&\n entityIsPublished === ENTITY_PUBLISHED\n );\n}\n\nfunction validateSideBarRelations(updatedFormValues, requiredChildField) {\n if (!requiredChildField) return true;\n const parentEntityField = updatedFormValues.find(({ id }) => id === 'parentEntity');\n const parentIdField = updatedFormValues.find(({ id }) => id === 'parentId');\n\n const parentEntityFieldHasValue =\n parentEntityField &&\n parentEntityField.value &&\n parentEntityField.value !== SELECT_DEFAULT_VALUE;\n const parentIdFieldHasValue = parentIdField && parentIdField.value;\n\n return !!(!parentEntityFieldHasValue || (parentEntityFieldHasValue && parentIdFieldHasValue));\n}\n\nasync function onViewUrlClick(getFullUrl) {\n const fullUrl = await getFullUrl();\n if (fullUrl) window.open(fullUrl, '_blank');\n}\n\nfunction getUpdatedFormValues({ id, value, requiredChildField, formValues }) {\n const updatedFormValues = formValues ? formValues.slice() : [];\n const fieldIndex = updatedFormValues.findIndex(({ id: _id }) => _id === id);\n\n if (fieldIndex > -1) {\n updatedFormValues[fieldIndex] = { ...updatedFormValues[fieldIndex], value };\n } else {\n updatedFormValues.push({ id, value });\n }\n\n if (requiredChildField && requiredChildField.id) {\n const requiredChildFieldIndex = updatedFormValues.findIndex(\n ({ id: _id }) => _id === requiredChildField.id\n );\n if (requiredChildFieldIndex > -1) {\n updatedFormValues[requiredChildFieldIndex] = {\n ...updatedFormValues[requiredChildFieldIndex],\n value: requiredChildField.value\n };\n } else {\n updatedFormValues.push({\n id: requiredChildField.id,\n value: requiredChildField.value\n });\n }\n }\n\n return updatedFormValues;\n}\n\nfunction checkFulfilConditions(...args) {\n return args.every(param => param);\n}\n\nexport {\n canViewPage,\n validateSideBarRelations,\n onViewUrlClick,\n getUpdatedFormValues,\n checkFulfilConditions\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity.js","names":["canViewPage","formData","entity","schema","entityIsPublished","has","KEY_TO_CHECK","id","ENTITY_PUBLISHED","validateSideBarRelations","updatedFormValues","requiredChildField","parentEntityField","find","parentIdField","parentEntityFieldHasValue","value","SELECT_DEFAULT_VALUE","parentIdFieldHasValue","onViewUrlClick","getFullUrl","fullUrl","window","open","getUpdatedFormValues","formValues","slice","fieldIndex","findIndex","_id","push","requiredChildFieldIndex","checkFulfilConditions","args","every","param"],"sources":["../../../../src/components/EntityManager/utils/entity.js"],"sourcesContent":["import has from 'lodash.has';\nimport { ENTITY_PUBLISHED, KEY_TO_CHECK, SELECT_DEFAULT_VALUE } from '../../../constants';\n\nfunction canViewPage(formData, entity, schema, entityIsPublished) {\n return (\n has(formData, KEY_TO_CHECK) &&\n entity &&\n entity.id &&\n schema &&\n schema.id &&\n entityIsPublished === ENTITY_PUBLISHED\n );\n}\n\nfunction validateSideBarRelations(updatedFormValues, requiredChildField) {\n if (!requiredChildField) return true;\n const parentEntityField = updatedFormValues.find(({ id }) => id === 'parentEntity');\n const parentIdField = updatedFormValues.find(({ id }) => id === 'parentId');\n\n const parentEntityFieldHasValue =\n parentEntityField &&\n parentEntityField.value &&\n parentEntityField.value !== SELECT_DEFAULT_VALUE;\n const parentIdFieldHasValue = parentIdField && parentIdField.value;\n\n return !!(!parentEntityFieldHasValue || (parentEntityFieldHasValue && parentIdFieldHasValue));\n}\n\nasync function onViewUrlClick(getFullUrl) {\n const fullUrl = await getFullUrl();\n if (fullUrl) window.open(fullUrl, '_blank');\n}\n\nfunction getUpdatedFormValues({ id, value, requiredChildField, formValues }) {\n const updatedFormValues = formValues ? formValues.slice() : [];\n const fieldIndex = updatedFormValues.findIndex(({ id: _id }) => _id === id);\n\n if (fieldIndex > -1) {\n updatedFormValues[fieldIndex] = { ...updatedFormValues[fieldIndex], value };\n } else {\n updatedFormValues.push({ id, value });\n }\n\n if (requiredChildField && requiredChildField.id) {\n const requiredChildFieldIndex = updatedFormValues.findIndex(\n ({ id: _id }) => _id === requiredChildField.id\n );\n if (requiredChildFieldIndex > -1) {\n updatedFormValues[requiredChildFieldIndex] = {\n ...updatedFormValues[requiredChildFieldIndex],\n value: requiredChildField.value\n };\n } else {\n updatedFormValues.push({\n id: requiredChildField.id,\n value: requiredChildField.value\n });\n }\n }\n\n return updatedFormValues;\n}\n\nfunction checkFulfilConditions(...args) {\n return args.every(param => param);\n}\n\nexport {\n canViewPage,\n validateSideBarRelations,\n onViewUrlClick,\n getUpdatedFormValues,\n checkFulfilConditions\n};\n"],"mappings":"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"}
|
|
@@ -1,36 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
-
|
|
18
12
|
var _adminUiUtils = require("@blaze-cms/admin-ui-utils");
|
|
19
|
-
|
|
20
13
|
var _coreErrors = require("@blaze-cms/core-errors");
|
|
21
|
-
|
|
22
14
|
var entityAvailableActions = {
|
|
23
15
|
create: function () {
|
|
24
16
|
var _create = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
25
17
|
var _ref,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
client,
|
|
19
|
+
identifier,
|
|
20
|
+
query,
|
|
21
|
+
_yield$client$query,
|
|
22
|
+
_yield$client$query$d,
|
|
23
|
+
schema,
|
|
24
|
+
_args = arguments;
|
|
34
25
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
35
26
|
while (1) {
|
|
36
27
|
switch (_context.prev = _context.next) {
|
|
@@ -39,14 +30,11 @@ var entityAvailableActions = {
|
|
|
39
30
|
client: null,
|
|
40
31
|
identifier: null
|
|
41
32
|
}, client = _ref.client, identifier = _ref.identifier;
|
|
42
|
-
|
|
43
33
|
if (!(!client && !identifier)) {
|
|
44
34
|
_context.next = 3;
|
|
45
35
|
break;
|
|
46
36
|
}
|
|
47
|
-
|
|
48
37
|
throw new _coreErrors.BlazeError('Expected params client or identifier not found');
|
|
49
|
-
|
|
50
38
|
case 3:
|
|
51
39
|
query = (0, _adminUiUtils.getQuery)('GET_ENTITY_SCHEMA');
|
|
52
40
|
_context.next = 6;
|
|
@@ -56,13 +44,11 @@ var entityAvailableActions = {
|
|
|
56
44
|
identifier: identifier
|
|
57
45
|
}
|
|
58
46
|
});
|
|
59
|
-
|
|
60
47
|
case 6:
|
|
61
48
|
_yield$client$query = _context.sent;
|
|
62
49
|
_yield$client$query$d = (0, _slicedToArray2["default"])(_yield$client$query.data.getEntitySchemas, 1);
|
|
63
50
|
schema = _yield$client$query$d[0];
|
|
64
51
|
return _context.abrupt("return", [schema]);
|
|
65
|
-
|
|
66
52
|
case 10:
|
|
67
53
|
case "end":
|
|
68
54
|
return _context.stop();
|
|
@@ -70,27 +56,24 @@ var entityAvailableActions = {
|
|
|
70
56
|
}
|
|
71
57
|
}, _callee);
|
|
72
58
|
}));
|
|
73
|
-
|
|
74
59
|
function create() {
|
|
75
60
|
return _create.apply(this, arguments);
|
|
76
61
|
}
|
|
77
|
-
|
|
78
62
|
return create;
|
|
79
63
|
}(),
|
|
80
64
|
update: function () {
|
|
81
65
|
var _update = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
82
66
|
var _ref2,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
67
|
+
client,
|
|
68
|
+
identifier,
|
|
69
|
+
id,
|
|
70
|
+
_yield$entityAvailabl,
|
|
71
|
+
_yield$entityAvailabl2,
|
|
72
|
+
schema,
|
|
73
|
+
formDataQuery,
|
|
74
|
+
_yield$client$query2,
|
|
75
|
+
entityData,
|
|
76
|
+
_args2 = arguments;
|
|
94
77
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
95
78
|
while (1) {
|
|
96
79
|
switch (_context2.prev = _context2.next) {
|
|
@@ -100,21 +83,17 @@ var entityAvailableActions = {
|
|
|
100
83
|
identifier: null,
|
|
101
84
|
id: null
|
|
102
85
|
}, client = _ref2.client, identifier = _ref2.identifier, id = _ref2.id;
|
|
103
|
-
|
|
104
86
|
if (!(!client && !identifier && !id)) {
|
|
105
87
|
_context2.next = 3;
|
|
106
88
|
break;
|
|
107
89
|
}
|
|
108
|
-
|
|
109
90
|
throw new _coreErrors.BlazeError('Expected params client, identifier or id not found');
|
|
110
|
-
|
|
111
91
|
case 3:
|
|
112
92
|
_context2.next = 5;
|
|
113
93
|
return entityAvailableActions.create({
|
|
114
94
|
client: client,
|
|
115
95
|
identifier: identifier
|
|
116
96
|
});
|
|
117
|
-
|
|
118
97
|
case 5:
|
|
119
98
|
_yield$entityAvailabl = _context2.sent;
|
|
120
99
|
_yield$entityAvailabl2 = (0, _slicedToArray2["default"])(_yield$entityAvailabl, 1);
|
|
@@ -125,12 +104,10 @@ var entityAvailableActions = {
|
|
|
125
104
|
query: formDataQuery,
|
|
126
105
|
fetchPolicy: 'network-only'
|
|
127
106
|
});
|
|
128
|
-
|
|
129
107
|
case 11:
|
|
130
108
|
_yield$client$query2 = _context2.sent;
|
|
131
109
|
entityData = _yield$client$query2.data.entityData;
|
|
132
110
|
return _context2.abrupt("return", [schema, entityData, formDataQuery]);
|
|
133
|
-
|
|
134
111
|
case 14:
|
|
135
112
|
case "end":
|
|
136
113
|
return _context2.stop();
|
|
@@ -138,11 +115,9 @@ var entityAvailableActions = {
|
|
|
138
115
|
}
|
|
139
116
|
}, _callee2);
|
|
140
117
|
}));
|
|
141
|
-
|
|
142
118
|
function update() {
|
|
143
119
|
return _update.apply(this, arguments);
|
|
144
120
|
}
|
|
145
|
-
|
|
146
121
|
return update;
|
|
147
122
|
}()
|
|
148
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityAvailableActions.js","names":["entityAvailableActions","create","client","identifier","BlazeError","query","getQuery","variables","data","getEntitySchemas","schema","update","id","formDataQuery","getDynamicQuery","fetchPolicy","entityData"],"sources":["../../../../src/components/EntityManager/utils/entityAvailableActions.js"],"sourcesContent":["import { getQuery, getDynamicQuery } from '@blaze-cms/admin-ui-utils';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nconst entityAvailableActions = {\n create: async ({ client, identifier } = { client: null, identifier: null }) => {\n if (!client && !identifier) {\n throw new BlazeError('Expected params client or identifier not found');\n }\n const query = getQuery('GET_ENTITY_SCHEMA');\n const {\n data: {\n getEntitySchemas: [schema]\n }\n } = await client.query({ query, variables: { identifier } });\n return [schema];\n },\n update: async ({ client, identifier, id } = { client: null, identifier: null, id: null }) => {\n if (!client && !identifier && !id) {\n throw new BlazeError('Expected params client, identifier or id not found');\n }\n const [schema] = await entityAvailableActions.create({ client, identifier });\n const formDataQuery = getDynamicQuery('DATA_QUERY')(schema, id);\n const {\n data: { entityData }\n } = await client.query({ query: formDataQuery, fetchPolicy: 'network-only' });\n return [schema, entityData, formDataQuery];\n }\n};\n\nexport default entityAvailableActions;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"entityAvailableActions.js","names":["entityAvailableActions","create","client","identifier","BlazeError","query","getQuery","variables","data","getEntitySchemas","schema","update","id","formDataQuery","getDynamicQuery","fetchPolicy","entityData"],"sources":["../../../../src/components/EntityManager/utils/entityAvailableActions.js"],"sourcesContent":["import { getQuery, getDynamicQuery } from '@blaze-cms/admin-ui-utils';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nconst entityAvailableActions = {\n create: async ({ client, identifier } = { client: null, identifier: null }) => {\n if (!client && !identifier) {\n throw new BlazeError('Expected params client or identifier not found');\n }\n const query = getQuery('GET_ENTITY_SCHEMA');\n const {\n data: {\n getEntitySchemas: [schema]\n }\n } = await client.query({ query, variables: { identifier } });\n return [schema];\n },\n update: async ({ client, identifier, id } = { client: null, identifier: null, id: null }) => {\n if (!client && !identifier && !id) {\n throw new BlazeError('Expected params client, identifier or id not found');\n }\n const [schema] = await entityAvailableActions.create({ client, identifier });\n const formDataQuery = getDynamicQuery('DATA_QUERY')(schema, id);\n const {\n data: { entityData }\n } = await client.query({ query: formDataQuery, fetchPolicy: 'network-only' });\n return [schema, entityData, formDataQuery];\n }\n};\n\nexport default entityAvailableActions;\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AAEA,IAAMA,sBAAsB,GAAG;EAC7BC,MAAM;IAAA,4FAAE;MAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;MAAA;QAAA;UAAA;YAAA;cAAA,+DAAgC;gBAAEC,MAAM,EAAE,IAAI;gBAAEC,UAAU,EAAE;cAAK,CAAC,EAAzDD,MAAM,QAANA,MAAM,EAAEC,UAAU,QAAVA,UAAU;cAAA,MAC7B,CAACD,MAAM,IAAI,CAACC,UAAU;gBAAA;gBAAA;cAAA;cAAA,MAClB,IAAIC,sBAAU,CAAC,gDAAgD,CAAC;YAAA;cAElEC,KAAK,GAAG,IAAAC,sBAAQ,EAAC,mBAAmB,CAAC;cAAA;cAAA,OAKjCJ,MAAM,CAACG,KAAK,CAAC;gBAAEA,KAAK,EAALA,KAAK;gBAAEE,SAAS,EAAE;kBAAEJ,UAAU,EAAVA;gBAAW;cAAE,CAAC,CAAC;YAAA;cAAA;cAAA,4EAH1DK,IAAI,CACFC,gBAAgB;cAAGC,MAAM;cAAA,iCAGtB,CAACA,MAAM,CAAC;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA,CAChB;IAAA;MAAA;IAAA;IAAA;EAAA;EACDC,MAAM;IAAA,4FAAE;MAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;MAAA;QAAA;UAAA;YAAA;cAAA,mEAAoC;gBAAET,MAAM,EAAE,IAAI;gBAAEC,UAAU,EAAE,IAAI;gBAAES,EAAE,EAAE;cAAK,CAAC,EAAvEV,MAAM,SAANA,MAAM,EAAEC,UAAU,SAAVA,UAAU,EAAES,EAAE,SAAFA,EAAE;cAAA,MACjC,CAACV,MAAM,IAAI,CAACC,UAAU,IAAI,CAACS,EAAE;gBAAA;gBAAA;cAAA;cAAA,MACzB,IAAIR,sBAAU,CAAC,oDAAoD,CAAC;YAAA;cAAA;cAAA,OAErDJ,sBAAsB,CAACC,MAAM,CAAC;gBAAEC,MAAM,EAANA,MAAM;gBAAEC,UAAU,EAAVA;cAAW,CAAC,CAAC;YAAA;cAAA;cAAA;cAArEO,MAAM;cACPG,aAAa,GAAG,IAAAC,6BAAe,EAAC,YAAY,CAAC,CAACJ,MAAM,EAAEE,EAAE,CAAC;cAAA;cAAA,OAGrDV,MAAM,CAACG,KAAK,CAAC;gBAAEA,KAAK,EAAEQ,aAAa;gBAAEE,WAAW,EAAE;cAAe,CAAC,CAAC;YAAA;cAAA;cADnEC,UAAU,wBAAlBR,IAAI,CAAIQ,UAAU;cAAA,kCAEb,CAACN,MAAM,EAAEM,UAAU,EAAEH,aAAa,CAAC;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA,CAC3C;IAAA;MAAA;IAAA;IAAA;EAAA;AACH,CAAC;AAAC,eAEab,sBAAsB;AAAA"}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
require("core-js/modules/es.array.some.js");
|
|
13
|
-
|
|
14
10
|
require("core-js/modules/es.object.to-string.js");
|
|
15
|
-
|
|
16
11
|
var _lodash = _interopRequireDefault(require("lodash.isempty"));
|
|
17
|
-
|
|
18
12
|
var isFormEmpty = function isFormEmpty(formValues) {
|
|
19
13
|
if (!formValues) return false;
|
|
20
14
|
return !formValues.some(function (_ref) {
|
|
@@ -22,7 +16,6 @@ var isFormEmpty = function isFormEmpty(formValues) {
|
|
|
22
16
|
return typeof value === 'boolean' ? value : !(0, _lodash["default"])(value);
|
|
23
17
|
});
|
|
24
18
|
};
|
|
25
|
-
|
|
26
19
|
var _default = isFormEmpty;
|
|
27
20
|
exports["default"] = _default;
|
|
28
21
|
//# sourceMappingURL=is-form-empty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-form-empty.js","names":["isFormEmpty","formValues","some","value","isEmpty"],"sources":["../../../../src/components/EntityManager/utils/is-form-empty.js"],"sourcesContent":["import isEmpty from 'lodash.isempty';\n\nconst isFormEmpty = formValues => {\n if (!formValues) return false;\n return !formValues.some(({ value }) => (typeof value === 'boolean' ? value : !isEmpty(value)));\n};\n\nexport default isFormEmpty;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-form-empty.js","names":["isFormEmpty","formValues","some","value","isEmpty"],"sources":["../../../../src/components/EntityManager/utils/is-form-empty.js"],"sourcesContent":["import isEmpty from 'lodash.isempty';\n\nconst isFormEmpty = formValues => {\n if (!formValues) return false;\n return !formValues.some(({ value }) => (typeof value === 'boolean' ? value : !isEmpty(value)));\n};\n\nexport default isFormEmpty;\n"],"mappings":";;;;;;;;;;AAAA;AAEA,IAAMA,WAAW,GAAG,SAAdA,WAAW,CAAGC,UAAU,EAAI;EAChC,IAAI,CAACA,UAAU,EAAE,OAAO,KAAK;EAC7B,OAAO,CAACA,UAAU,CAACC,IAAI,CAAC;IAAA,IAAGC,KAAK,QAALA,KAAK;IAAA,OAAQ,OAAOA,KAAK,KAAK,SAAS,GAAGA,KAAK,GAAG,CAAC,IAAAC,kBAAO,EAACD,KAAK,CAAC;EAAA,CAAC,CAAC;AAChG,CAAC;AAAC,eAEaH,WAAW;AAAA"}
|
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.getAction = void 0;
|
|
11
|
-
|
|
12
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
10
|
require("core-js/modules/es.array.concat.js");
|
|
15
|
-
|
|
16
11
|
var _client = require("@apollo/client");
|
|
17
|
-
|
|
18
12
|
var _lodash = _interopRequireDefault(require("lodash.upperfirst"));
|
|
19
|
-
|
|
20
13
|
var _templateObject;
|
|
21
|
-
|
|
22
14
|
var generateQuery = function generateQuery(action, props) {
|
|
23
15
|
return "\n query getEntityData(\n $where: JSON\n $limit: Int\n $offset: Int\n $sort: [".concat((0, _lodash["default"])(action), "SortItem]){\n ").concat(action, " (where: $where, limit: $limit, offset: $offset, sort: $sort){\n ").concat(props, "\n }\n }\n ");
|
|
24
|
-
};
|
|
25
|
-
|
|
16
|
+
};
|
|
26
17
|
|
|
18
|
+
// TODO: extend function to handle properties and make them dynamic with a config schema for each entity.
|
|
27
19
|
var getAction = function getAction(action, props) {
|
|
28
20
|
var query = generateQuery(action, props);
|
|
29
21
|
return (0, _client.gql)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n "])), query);
|
|
30
22
|
};
|
|
31
|
-
|
|
32
23
|
exports.getAction = getAction;
|
|
33
24
|
//# sourceMappingURL=query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","names":["generateQuery","action","props","upperFirst","getAction","query","gql"],"sources":["../../../../src/components/EntityManager/utils/query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport upperFirst from 'lodash.upperfirst';\n\nconst generateQuery = (action, props) => `\n query getEntityData(\n $where: JSON\n $limit: Int\n $offset: Int\n $sort: [${upperFirst(action)}SortItem]){\n ${action} (where: $where, limit: $limit, offset: $offset, sort: $sort){\n ${props}\n }\n }\n `;\n\n// TODO: extend function to handle properties and make them dynamic with a config schema for each entity.\nconst getAction = (action, props) => {\n const query = generateQuery(action, props);\n return gql`\n ${query}\n `;\n};\n\nexport { getAction };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"query.js","names":["generateQuery","action","props","upperFirst","getAction","query","gql"],"sources":["../../../../src/components/EntityManager/utils/query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport upperFirst from 'lodash.upperfirst';\n\nconst generateQuery = (action, props) => `\n query getEntityData(\n $where: JSON\n $limit: Int\n $offset: Int\n $sort: [${upperFirst(action)}SortItem]){\n ${action} (where: $where, limit: $limit, offset: $offset, sort: $sort){\n ${props}\n }\n }\n `;\n\n// TODO: extend function to handle properties and make them dynamic with a config schema for each entity.\nconst getAction = (action, props) => {\n const query = generateQuery(action, props);\n return gql`\n ${query}\n `;\n};\n\nexport { getAction };\n"],"mappings":";;;;;;;;;;AAAA;AACA;AAA2C;AAE3C,IAAMA,aAAa,GAAG,SAAhBA,aAAa,CAAIC,MAAM,EAAEC,KAAK;EAAA,4GAKtB,IAAAC,kBAAU,EAACF,MAAM,CAAC,8BAC1BA,MAAM,mFACJC,KAAK;AAAA,CAGV;;AAEH;AACA,IAAME,SAAS,GAAG,SAAZA,SAAS,CAAIH,MAAM,EAAEC,KAAK,EAAK;EACnC,IAAMG,KAAK,GAAGL,aAAa,CAACC,MAAM,EAAEC,KAAK,CAAC;EAC1C,WAAOI,WAAG,sGACND,KAAK;AAEX,CAAC;AAAC"}
|