@jahia/data-helper 1.0.6 → 1.0.7
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/esm/fragments/PredefinedFragments.js +21 -221
- package/esm/fragments/fragments.utils.js +17 -43
- package/esm/fragments/getIsNodeTypeFragment.js +2 -15
- package/esm/fragments/getPermissionFragment.js +3 -28
- package/esm/hooks/useContentPreview/useContentPreview.gql-queries.js +2 -12
- package/esm/hooks/useContentPreview/useContentPreview.js +7 -7
- package/esm/hooks/useDeepCompareMemo/useDeepCompareMemo.js +0 -2
- package/esm/hooks/useDeepCompareMemo/useDeepCompareMemo.spec.js +0 -1
- package/esm/hooks/useNodeChecks/useNodeChecks.js +13 -28
- package/esm/hooks/useNodeChecks/useNodeChecks.spec.js +156 -67
- package/esm/hooks/useNodeInfo/useMemoRequest.js +49 -0
- package/esm/hooks/useNodeInfo/useNodeInfo.gql-queries.js +23 -104
- package/esm/hooks/useNodeInfo/useNodeInfo.js +139 -57
- package/esm/hooks/useNodeInfo/useNodeInfo.spec.js +429 -233
- package/esm/hooks/useNodeInfo/useNodeInfo.utils.js +52 -0
- package/esm/hooks/useSchemaFields/useSchemaFields.gql-queries.js +2 -12
- package/esm/hooks/useSiteInfo/useSiteInfo.gql-queries.js +2 -12
- package/esm/hooks/useSiteInfo/useSiteInfo.js +2 -9
- package/esm/hooks/useTreeEntries/useTreeEntries.gql-queries.js +2 -12
- package/esm/hooks/useTreeEntries/useTreeEntries.js +17 -38
- package/esm/legacy/Picker.gql-fragments.js +4 -34
- package/esm/legacy/Picker.js +31 -113
- package/js/fragments/PredefinedFragments.js +21 -224
- package/js/fragments/encodeName.js +0 -2
- package/js/fragments/fragments.utils.js +17 -44
- package/js/fragments/getIsNodeTypeFragment.js +2 -23
- package/js/fragments/getPermissionFragment.js +3 -38
- package/js/fragments/index.js +0 -4
- package/js/hooks/index.js +0 -10
- package/js/hooks/useContentPreview/index.js +0 -2
- package/js/hooks/useContentPreview/useContentPreview.gql-queries.js +2 -16
- package/js/hooks/useContentPreview/useContentPreview.js +7 -11
- package/js/hooks/useContentPreview/useContentPreview.spec.js +0 -2
- package/js/hooks/useDeepCompareMemo/index.js +0 -2
- package/js/hooks/useDeepCompareMemo/useDeepCompareMemo.js +0 -7
- package/js/hooks/useDeepCompareMemo/useDeepCompareMemo.spec.js +0 -2
- package/js/hooks/useNodeChecks/index.js +0 -2
- package/js/hooks/useNodeChecks/useNodeChecks.js +13 -30
- package/js/hooks/useNodeChecks/useNodeChecks.spec.js +157 -69
- package/js/hooks/useNodeInfo/index.js +0 -2
- package/js/hooks/useNodeInfo/useMemoRequest.js +56 -0
- package/js/hooks/useNodeInfo/useNodeInfo.gql-queries.js +25 -111
- package/js/hooks/useNodeInfo/useNodeInfo.js +139 -65
- package/js/hooks/useNodeInfo/useNodeInfo.spec.js +430 -236
- package/js/hooks/useNodeInfo/useNodeInfo.utils.js +60 -0
- package/js/hooks/useSchemaFields/index.js +0 -2
- package/js/hooks/useSchemaFields/useSchemaFields.gql-queries.js +2 -15
- package/js/hooks/useSchemaFields/useSchemaFields.jsx +0 -4
- package/js/hooks/useSiteInfo/index.js +0 -2
- package/js/hooks/useSiteInfo/useSiteInfo.gql-queries.js +2 -16
- package/js/hooks/useSiteInfo/useSiteInfo.js +2 -12
- package/js/hooks/useSiteInfo/useSiteInfo.spec.js +0 -4
- package/js/hooks/useTreeEntries/index.js +0 -2
- package/js/hooks/useTreeEntries/useTreeEntries.gql-queries.js +2 -16
- package/js/hooks/useTreeEntries/useTreeEntries.js +17 -43
- package/js/hooks/useTreeEntries/useTreeEntries.spec.js +0 -3
- package/js/index.js +0 -6
- package/js/legacy/Picker.gql-fragments.js +4 -37
- package/js/legacy/Picker.js +31 -134
- package/js/legacy/index.js +0 -4
- package/package.json +1 -1
|
@@ -4,219 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.subNodesCount = exports.siteLanguages = exports.siteHomePage = exports.primaryNodeType = exports.parentNode = exports.operationSupport = exports.nodeTypeSubTypes = exports.nodeTypeDisplayName = exports.nodeCacheRequiredFields = exports.mimeTypes = exports.lockInfo = exports.installedModules = exports.getProperties = exports.displayableNode = exports.displayName = exports.contentRestrictions = exports.childNodeTypes = exports.allProperties = exports.aggregatedPublicationInfoWithExistInLive = exports.aggregatedPublicationInfo = exports.PredefinedFragments = void 0;
|
|
7
|
-
|
|
8
7
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
9
|
-
|
|
8
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
|
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function _templateObject20() {
|
|
13
|
-
var data = _taggedTemplateLiteral(["fragment NodeInfoResourceNode on JCRNode {\n resourceChildren: children(names: [\"jcr:content\"]) {\n nodes {\n ...NodeCacheRequiredFields\n mimeType: property(name: \"jcr:mimeType\") {\n value\n }\n }\n }\n }"]);
|
|
14
|
-
|
|
15
|
-
_templateObject20 = function _templateObject20() {
|
|
16
|
-
return data;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function _templateObject19() {
|
|
23
|
-
var data = _taggedTemplateLiteral(["fragment NodeTypeSubTypes on JCRNodeType {\n subTypes {\n nodes {\n name\n displayName(language:$language)\n abstract\n mixin\n }\n }\n }"]);
|
|
24
|
-
|
|
25
|
-
_templateObject19 = function _templateObject19() {
|
|
26
|
-
return data;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
return data;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _templateObject18() {
|
|
33
|
-
var data = _taggedTemplateLiteral(["fragment NodeTypeDisplayName on JCRNodeType {\n displayName(language:$language)\n }"]);
|
|
34
|
-
|
|
35
|
-
_templateObject18 = function _templateObject18() {
|
|
36
|
-
return data;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return data;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function _templateObject17() {
|
|
43
|
-
var data = _taggedTemplateLiteral(["fragment NodeCacheRequiredFields on JCRNode {\n uuid\n workspace\n path\n }"]);
|
|
44
|
-
|
|
45
|
-
_templateObject17 = function _templateObject17() {
|
|
46
|
-
return data;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return data;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function _templateObject16() {
|
|
53
|
-
var data = _taggedTemplateLiteral(["fragment NodeSiteHomePage on JCRNode {\n children(typesFilter:{types:[\"jnt:page\"]}, propertiesFilter:{filters:[{property:\"j:isHomePage\", value:\"true\" }]}) {\n nodes {\n path\n ...NodeCacheRequiredFields\n }\n }\n }"]);
|
|
54
|
-
|
|
55
|
-
_templateObject16 = function _templateObject16() {
|
|
56
|
-
return data;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return data;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function _templateObject15() {
|
|
63
|
-
var data = _taggedTemplateLiteral(["fragment ContentRestriction on JCRNode {\n contributeTypes: property(name: \"j:contributeTypes\") {\n values\n }\n ancestors(fieldFilter: {filters: {evaluation: NOT_EMPTY, fieldName: \"contributeTypes\"}}) {\n ...NodeCacheRequiredFields\n contributeTypes : property(name: \"j:contributeTypes\") {\n values\n }\n }\n }"]);
|
|
64
|
-
|
|
65
|
-
_templateObject15 = function _templateObject15() {
|
|
66
|
-
return data;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return data;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function _templateObject14() {
|
|
73
|
-
var data = _taggedTemplateLiteral(["fragment AllowedChildNodeType on JCRNode {\n allowedChildNodeTypes(includeSubTypes: false) {\n name\n }\n }"]);
|
|
74
|
-
|
|
75
|
-
_templateObject14 = function _templateObject14() {
|
|
76
|
-
return data;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
return data;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _templateObject13() {
|
|
83
|
-
var data = _taggedTemplateLiteral(["fragment SubNodesCount on JCRNode {\n subNodes: children(typesFilter: {types: $subNodesCountTypes, multi: ANY}) {\n pageInfo {\n totalCount\n }\n }\n }"]);
|
|
84
|
-
|
|
85
|
-
_templateObject13 = function _templateObject13() {
|
|
86
|
-
return data;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return data;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function _templateObject12() {
|
|
93
|
-
var data = _taggedTemplateLiteral(["fragment LockInfo on JCRNode {\n lockOwner: property(name: \"jcr:lockOwner\") {\n value\n }\n lockTypes: property(name: \"j:lockTypes\") {\n values\n }\n }"]);
|
|
94
|
-
|
|
95
|
-
_templateObject12 = function _templateObject12() {
|
|
96
|
-
return data;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
return data;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function _templateObject11() {
|
|
103
|
-
var data = _taggedTemplateLiteral(["fragment DisplayableNodePath on JCRNode {\n displayableNode {\n path\n ...NodeCacheRequiredFields\n }\n }"]);
|
|
104
|
-
|
|
105
|
-
_templateObject11 = function _templateObject11() {
|
|
106
|
-
return data;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
return data;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function _templateObject10() {
|
|
113
|
-
var data = _taggedTemplateLiteral(["fragment SiteLanguages on JCRNode {\n site {\n defaultLanguage\n ...NodeCacheRequiredFields\n languages {\n displayName\n language\n activeInEdit\n }\n }\n }"]);
|
|
114
|
-
|
|
115
|
-
_templateObject10 = function _templateObject10() {
|
|
116
|
-
return data;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
return data;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function _templateObject9() {
|
|
123
|
-
var data = _taggedTemplateLiteral(["fragment SiteInstalledModules on JCRNode {\n site {\n installedModulesWithAllDependencies\n ...NodeCacheRequiredFields\n }\n }"]);
|
|
124
|
-
|
|
125
|
-
_templateObject9 = function _templateObject9() {
|
|
126
|
-
return data;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
return data;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function _templateObject8() {
|
|
133
|
-
var data = _taggedTemplateLiteral(["fragment NodeProperties on JCRNode {\n properties(names: $getPropertiesNames, language: $language) {\n name\n value\n values\n }\n }"]);
|
|
134
|
-
|
|
135
|
-
_templateObject8 = function _templateObject8() {
|
|
136
|
-
return data;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
return data;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function _templateObject7() {
|
|
143
|
-
var data = _taggedTemplateLiteral(["fragment NodeAllProperties on JCRNode {\n properties(language:$language) {\n name\n value\n values\n }\n }"]);
|
|
144
|
-
|
|
145
|
-
_templateObject7 = function _templateObject7() {
|
|
146
|
-
return data;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
return data;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function _templateObject6() {
|
|
153
|
-
var data = _taggedTemplateLiteral(["fragment OperationSupport on JCRNode {\n operationsSupport {\n lock\n markForDeletion\n publication\n }\n }"]);
|
|
154
|
-
|
|
155
|
-
_templateObject6 = function _templateObject6() {
|
|
156
|
-
return data;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
return data;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function _templateObject5() {
|
|
163
|
-
var data = _taggedTemplateLiteral(["fragment AggregatedPublicationInfoWithExistsInLive on JCRNode {\n aggregatedPublicationInfo(language: $language, subNodes: $aggregatedPublicationInfoSubNodes, references:$aggregatedPublicationInfoIncludeReference) {\n publicationStatus\n existsInLive\n }\n }"]);
|
|
164
|
-
|
|
165
|
-
_templateObject5 = function _templateObject5() {
|
|
166
|
-
return data;
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
return data;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function _templateObject4() {
|
|
173
|
-
var data = _taggedTemplateLiteral(["fragment AggregatedPublicationInfo on JCRNode {\n aggregatedPublicationInfo(language: $language, subNodes: $aggregatedPublicationInfoSubNodes, references:$aggregatedPublicationInfoIncludeReference) {\n publicationStatus\n }\n }"]);
|
|
174
|
-
|
|
175
|
-
_templateObject4 = function _templateObject4() {
|
|
176
|
-
return data;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
return data;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function _templateObject3() {
|
|
183
|
-
var data = _taggedTemplateLiteral(["fragment ParentNodeInfo on JCRNode {\n parent {\n path\n name\n ...NodeCacheRequiredFields\n }\n }"]);
|
|
184
|
-
|
|
185
|
-
_templateObject3 = function _templateObject3() {
|
|
186
|
-
return data;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
return data;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function _templateObject2() {
|
|
193
|
-
var data = _taggedTemplateLiteral(["fragment NodeInfoPrimaryNodeType on JCRNode {\n primaryNodeType {\n name\n displayName(language: $displayLanguage) @include(if: $displayLanguageSet)\n icon\n }\n }"]);
|
|
194
|
-
|
|
195
|
-
_templateObject2 = function _templateObject2() {
|
|
196
|
-
return data;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
return data;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function _templateObject() {
|
|
203
|
-
var data = _taggedTemplateLiteral(["fragment DisplayName on JCRNode {\n displayName(language:$language)\n }"]);
|
|
204
|
-
|
|
205
|
-
_templateObject = function _templateObject() {
|
|
206
|
-
return data;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
return data;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
10
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
213
|
-
|
|
214
11
|
var displayName = {
|
|
215
12
|
variables: {
|
|
216
13
|
language: 'String!'
|
|
217
14
|
},
|
|
218
15
|
applyFor: 'node',
|
|
219
|
-
gql: (0, _graphqlTag["default"])(_templateObject())
|
|
16
|
+
gql: (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["fragment DisplayName on JCRNode {\n displayName(language:$language)\n }"])))
|
|
220
17
|
};
|
|
221
18
|
exports.displayName = displayName;
|
|
222
19
|
var primaryNodeType = {
|
|
@@ -225,12 +22,12 @@ var primaryNodeType = {
|
|
|
225
22
|
displayLanguageSet: 'Boolean!'
|
|
226
23
|
},
|
|
227
24
|
applyFor: 'node',
|
|
228
|
-
gql: (0, _graphqlTag["default"])(_templateObject2())
|
|
25
|
+
gql: (0, _graphqlTag["default"])(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["fragment NodeInfoPrimaryNodeType on JCRNode {\n primaryNodeType {\n name\n displayName(language: $displayLanguage) @include(if: $displayLanguageSet)\n icon\n }\n }"])))
|
|
229
26
|
};
|
|
230
27
|
exports.primaryNodeType = primaryNodeType;
|
|
231
28
|
var parentNode = {
|
|
232
29
|
applyFor: 'node',
|
|
233
|
-
gql: (0, _graphqlTag["default"])(_templateObject3())
|
|
30
|
+
gql: (0, _graphqlTag["default"])(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["fragment ParentNodeInfo on JCRNode {\n parent {\n path\n name\n ...NodeCacheRequiredFields\n }\n }"])))
|
|
234
31
|
};
|
|
235
32
|
exports.parentNode = parentNode;
|
|
236
33
|
var aggregatedPublicationInfo = {
|
|
@@ -240,7 +37,7 @@ var aggregatedPublicationInfo = {
|
|
|
240
37
|
aggregatedPublicationInfoIncludeReference: 'Boolean'
|
|
241
38
|
},
|
|
242
39
|
applyFor: 'node',
|
|
243
|
-
gql: (0, _graphqlTag["default"])(_templateObject4())
|
|
40
|
+
gql: (0, _graphqlTag["default"])(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["fragment AggregatedPublicationInfo on JCRNode {\n aggregatedPublicationInfo(language: $language, subNodes: $aggregatedPublicationInfoSubNodes, references:$aggregatedPublicationInfoIncludeReference) {\n publicationStatus\n }\n }"])))
|
|
244
41
|
};
|
|
245
42
|
exports.aggregatedPublicationInfo = aggregatedPublicationInfo;
|
|
246
43
|
var aggregatedPublicationInfoWithExistInLive = {
|
|
@@ -250,12 +47,12 @@ var aggregatedPublicationInfoWithExistInLive = {
|
|
|
250
47
|
aggregatedPublicationInfoIncludeReference: 'Boolean'
|
|
251
48
|
},
|
|
252
49
|
applyFor: 'node',
|
|
253
|
-
gql: (0, _graphqlTag["default"])(_templateObject5())
|
|
50
|
+
gql: (0, _graphqlTag["default"])(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["fragment AggregatedPublicationInfoWithExistsInLive on JCRNode {\n aggregatedPublicationInfo(language: $language, subNodes: $aggregatedPublicationInfoSubNodes, references:$aggregatedPublicationInfoIncludeReference) {\n publicationStatus\n existsInLive\n }\n }"])))
|
|
254
51
|
};
|
|
255
52
|
exports.aggregatedPublicationInfoWithExistInLive = aggregatedPublicationInfoWithExistInLive;
|
|
256
53
|
var operationSupport = {
|
|
257
54
|
applyFor: 'node',
|
|
258
|
-
gql: (0, _graphqlTag["default"])(_templateObject6())
|
|
55
|
+
gql: (0, _graphqlTag["default"])(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["fragment OperationSupport on JCRNode {\n operationsSupport {\n lock\n markForDeletion\n publication\n }\n }"])))
|
|
259
56
|
};
|
|
260
57
|
exports.operationSupport = operationSupport;
|
|
261
58
|
var allProperties = {
|
|
@@ -263,7 +60,7 @@ var allProperties = {
|
|
|
263
60
|
language: 'String!'
|
|
264
61
|
},
|
|
265
62
|
applyFor: 'node',
|
|
266
|
-
gql: (0, _graphqlTag["default"])(_templateObject7())
|
|
63
|
+
gql: (0, _graphqlTag["default"])(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["fragment NodeAllProperties on JCRNode {\n properties(language:$language) {\n name\n value\n values\n }\n }"])))
|
|
267
64
|
};
|
|
268
65
|
exports.allProperties = allProperties;
|
|
269
66
|
var getProperties = {
|
|
@@ -272,27 +69,27 @@ var getProperties = {
|
|
|
272
69
|
getPropertiesNames: '[String!]!'
|
|
273
70
|
},
|
|
274
71
|
applyFor: 'node',
|
|
275
|
-
gql: (0, _graphqlTag["default"])(_templateObject8())
|
|
72
|
+
gql: (0, _graphqlTag["default"])(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["fragment NodeProperties on JCRNode {\n properties(names: $getPropertiesNames, language: $language) {\n name\n value\n values\n }\n }"])))
|
|
276
73
|
};
|
|
277
74
|
exports.getProperties = getProperties;
|
|
278
75
|
var installedModules = {
|
|
279
76
|
applyFor: 'node',
|
|
280
|
-
gql: (0, _graphqlTag["default"])(_templateObject9())
|
|
77
|
+
gql: (0, _graphqlTag["default"])(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["fragment SiteInstalledModules on JCRNode {\n site {\n installedModulesWithAllDependencies\n ...NodeCacheRequiredFields\n }\n }"])))
|
|
281
78
|
};
|
|
282
79
|
exports.installedModules = installedModules;
|
|
283
80
|
var siteLanguages = {
|
|
284
81
|
applyFor: 'node',
|
|
285
|
-
gql: (0, _graphqlTag["default"])(_templateObject10())
|
|
82
|
+
gql: (0, _graphqlTag["default"])(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["fragment SiteLanguages on JCRNode {\n site {\n defaultLanguage\n ...NodeCacheRequiredFields\n languages {\n displayName\n language\n activeInEdit\n }\n }\n }"])))
|
|
286
83
|
};
|
|
287
84
|
exports.siteLanguages = siteLanguages;
|
|
288
85
|
var displayableNode = {
|
|
289
86
|
applyFor: 'node',
|
|
290
|
-
gql: (0, _graphqlTag["default"])(_templateObject11())
|
|
87
|
+
gql: (0, _graphqlTag["default"])(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["fragment DisplayableNodePath on JCRNode {\n displayableNode {\n path\n ...NodeCacheRequiredFields\n }\n }"])))
|
|
291
88
|
};
|
|
292
89
|
exports.displayableNode = displayableNode;
|
|
293
90
|
var lockInfo = {
|
|
294
91
|
applyFor: 'node',
|
|
295
|
-
gql: (0, _graphqlTag["default"])(_templateObject12())
|
|
92
|
+
gql: (0, _graphqlTag["default"])(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["fragment LockInfo on JCRNode {\n lockOwner: property(name: \"jcr:lockOwner\") {\n value\n }\n lockTypes: property(name: \"j:lockTypes\") {\n values\n }\n }"])))
|
|
296
93
|
};
|
|
297
94
|
exports.lockInfo = lockInfo;
|
|
298
95
|
var subNodesCount = {
|
|
@@ -300,27 +97,27 @@ var subNodesCount = {
|
|
|
300
97
|
subNodesCountTypes: '[String!]!'
|
|
301
98
|
},
|
|
302
99
|
applyFor: 'node',
|
|
303
|
-
gql: (0, _graphqlTag["default"])(_templateObject13())
|
|
100
|
+
gql: (0, _graphqlTag["default"])(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["fragment SubNodesCount on JCRNode {\n subNodes: children(typesFilter: {types: $subNodesCountTypes, multi: ANY}) {\n pageInfo {\n totalCount\n }\n }\n }"])))
|
|
304
101
|
};
|
|
305
102
|
exports.subNodesCount = subNodesCount;
|
|
306
103
|
var childNodeTypes = {
|
|
307
104
|
applyFor: 'node',
|
|
308
|
-
gql: (0, _graphqlTag["default"])(_templateObject14())
|
|
105
|
+
gql: (0, _graphqlTag["default"])(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["fragment AllowedChildNodeType on JCRNode {\n allowedChildNodeTypes(includeSubTypes: false) {\n name\n }\n }"])))
|
|
309
106
|
};
|
|
310
107
|
exports.childNodeTypes = childNodeTypes;
|
|
311
108
|
var contentRestrictions = {
|
|
312
109
|
applyFor: 'node',
|
|
313
|
-
gql: (0, _graphqlTag["default"])(_templateObject15())
|
|
110
|
+
gql: (0, _graphqlTag["default"])(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["fragment ContentRestriction on JCRNode {\n contributeTypes: property(name: \"j:contributeTypes\") {\n values\n }\n ancestors(fieldFilter: {filters: {evaluation: NOT_EMPTY, fieldName: \"contributeTypes\"}}) {\n ...NodeCacheRequiredFields\n contributeTypes : property(name: \"j:contributeTypes\") {\n values\n }\n }\n }"])))
|
|
314
111
|
};
|
|
315
112
|
exports.contentRestrictions = contentRestrictions;
|
|
316
113
|
var siteHomePage = {
|
|
317
114
|
applyFor: 'node',
|
|
318
|
-
gql: (0, _graphqlTag["default"])(_templateObject16())
|
|
115
|
+
gql: (0, _graphqlTag["default"])(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["fragment NodeSiteHomePage on JCRNode {\n children(typesFilter:{types:[\"jnt:page\"]}, propertiesFilter:{filters:[{property:\"j:isHomePage\", value:\"true\" }]}) {\n nodes {\n path\n ...NodeCacheRequiredFields\n }\n }\n }"])))
|
|
319
116
|
};
|
|
320
117
|
exports.siteHomePage = siteHomePage;
|
|
321
118
|
var nodeCacheRequiredFields = {
|
|
322
119
|
applyFor: 'node',
|
|
323
|
-
gql: (0, _graphqlTag["default"])(_templateObject17())
|
|
120
|
+
gql: (0, _graphqlTag["default"])(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["fragment NodeCacheRequiredFields on JCRNode {\n uuid\n workspace\n path\n }"])))
|
|
324
121
|
};
|
|
325
122
|
exports.nodeCacheRequiredFields = nodeCacheRequiredFields;
|
|
326
123
|
var nodeTypeDisplayName = {
|
|
@@ -328,7 +125,7 @@ var nodeTypeDisplayName = {
|
|
|
328
125
|
language: 'String!'
|
|
329
126
|
},
|
|
330
127
|
applyFor: 'nodeType',
|
|
331
|
-
gql: (0, _graphqlTag["default"])(_templateObject18())
|
|
128
|
+
gql: (0, _graphqlTag["default"])(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["fragment NodeTypeDisplayName on JCRNodeType {\n displayName(language:$language)\n }"])))
|
|
332
129
|
};
|
|
333
130
|
exports.nodeTypeDisplayName = nodeTypeDisplayName;
|
|
334
131
|
var nodeTypeSubTypes = {
|
|
@@ -336,12 +133,12 @@ var nodeTypeSubTypes = {
|
|
|
336
133
|
language: 'String!'
|
|
337
134
|
},
|
|
338
135
|
applyFor: 'nodeType',
|
|
339
|
-
gql: (0, _graphqlTag["default"])(_templateObject19())
|
|
136
|
+
gql: (0, _graphqlTag["default"])(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["fragment NodeTypeSubTypes on JCRNodeType {\n subTypes {\n nodes {\n name\n displayName(language:$language)\n abstract\n mixin\n }\n }\n }"])))
|
|
340
137
|
};
|
|
341
138
|
exports.nodeTypeSubTypes = nodeTypeSubTypes;
|
|
342
139
|
var mimeTypes = {
|
|
343
140
|
applyFor: 'node',
|
|
344
|
-
gql: (0, _graphqlTag["default"])(_templateObject20())
|
|
141
|
+
gql: (0, _graphqlTag["default"])(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["fragment NodeInfoResourceNode on JCRNode {\n resourceChildren: children(names: [\"jcr:content\"]) {\n nodes {\n ...NodeCacheRequiredFields\n mimeType: property(name: \"jcr:mimeType\") {\n value\n }\n }\n }\n }"])))
|
|
345
142
|
};
|
|
346
143
|
exports.mimeTypes = mimeTypes;
|
|
347
144
|
var PredefinedFragments = {
|
|
@@ -6,62 +6,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.findFragmentsInSelectionSet = findFragmentsInSelectionSet;
|
|
7
7
|
exports.findParametersInDocument = findParametersInDocument;
|
|
8
8
|
exports.replaceFragmentsInDocument = replaceFragmentsInDocument;
|
|
9
|
-
|
|
10
9
|
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
11
|
-
|
|
12
10
|
var _graphql = require("graphql");
|
|
13
|
-
|
|
14
11
|
var _fragments = require("../fragments");
|
|
15
|
-
|
|
16
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
-
|
|
20
14
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
-
|
|
22
15
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
-
|
|
24
16
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
-
|
|
26
17
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
27
|
-
|
|
28
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
-
|
|
30
19
|
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; }
|
|
31
|
-
|
|
32
20
|
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) { _defineProperty(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; }
|
|
33
|
-
|
|
34
21
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
35
|
-
|
|
36
22
|
function findParametersInDocument(doc) {
|
|
37
23
|
if (doc && doc.definitions) {
|
|
38
24
|
return doc.definitions.flatMap(function (def) {
|
|
39
25
|
return findParametersInSelectionSet(def.selectionSet);
|
|
40
26
|
});
|
|
41
27
|
}
|
|
42
|
-
|
|
43
28
|
return [];
|
|
44
29
|
}
|
|
45
|
-
|
|
46
30
|
var queryCache = {};
|
|
47
|
-
|
|
48
31
|
function replaceFragmentsInDocument(doc, fragments) {
|
|
49
32
|
if (!fragments) {
|
|
50
33
|
fragments = [];
|
|
51
34
|
}
|
|
52
|
-
|
|
53
35
|
var key = doc.definitions[0].name.value + '__' + fragments.map(function (f) {
|
|
54
36
|
return typeof f === 'string' ? _fragments.PredefinedFragments[f] : f;
|
|
55
37
|
}).map(function (f) {
|
|
56
38
|
return f.gql.definitions[0].name.value;
|
|
57
39
|
}).sort().join('_');
|
|
58
|
-
|
|
59
40
|
if (queryCache[key]) {
|
|
60
41
|
return queryCache[key];
|
|
61
42
|
}
|
|
62
|
-
|
|
63
43
|
var clonedQuery = null;
|
|
64
|
-
|
|
65
44
|
if (doc && doc.definitions) {
|
|
66
45
|
clonedQuery = (0, _cloneDeep2["default"])(doc);
|
|
67
46
|
clonedQuery.definitions.forEach(function (def) {
|
|
@@ -69,11 +48,9 @@ function replaceFragmentsInDocument(doc, fragments) {
|
|
|
69
48
|
});
|
|
70
49
|
clonedQuery.definitions[0].name.value = key;
|
|
71
50
|
}
|
|
72
|
-
|
|
73
51
|
queryCache[key] = clonedQuery;
|
|
74
52
|
return clonedQuery;
|
|
75
53
|
}
|
|
76
|
-
|
|
77
54
|
function findParametersInSelectionSet(selectionSet) {
|
|
78
55
|
if (selectionSet && selectionSet.selections) {
|
|
79
56
|
return selectionSet.selections.flatMap(function (sel) {
|
|
@@ -86,10 +63,8 @@ function findParametersInSelectionSet(selectionSet) {
|
|
|
86
63
|
});
|
|
87
64
|
});
|
|
88
65
|
}
|
|
89
|
-
|
|
90
66
|
return [];
|
|
91
67
|
}
|
|
92
|
-
|
|
93
68
|
function findFragmentsInSelectionSet(selectionSet) {
|
|
94
69
|
if (selectionSet && selectionSet.selections) {
|
|
95
70
|
return selectionSet.selections.filter(function (sel) {
|
|
@@ -100,17 +75,14 @@ function findFragmentsInSelectionSet(selectionSet) {
|
|
|
100
75
|
return findFragmentsInSelectionSet(sel.selectionSet);
|
|
101
76
|
}));
|
|
102
77
|
}
|
|
103
|
-
|
|
104
78
|
return [];
|
|
105
79
|
}
|
|
106
|
-
|
|
107
80
|
function replaceFragmentsInSelectionSet(selectionSet, fragments, def, document) {
|
|
108
81
|
if (selectionSet && selectionSet.selections) {
|
|
109
82
|
var _selectionSet$selecti;
|
|
110
|
-
|
|
111
83
|
var newFragmentsSpreads = [];
|
|
112
|
-
var removedFragmentSpreads = [];
|
|
113
|
-
|
|
84
|
+
var removedFragmentSpreads = [];
|
|
85
|
+
// Look for all existing fragment spreads in selection set
|
|
114
86
|
selectionSet.selections.filter(function (sel) {
|
|
115
87
|
return sel.kind === 'FragmentSpread';
|
|
116
88
|
}).forEach(function (sel) {
|
|
@@ -120,11 +92,11 @@ function replaceFragmentsInSelectionSet(selectionSet, fragments, def, document)
|
|
|
120
92
|
var existing = document.definitions.find(function (definition) {
|
|
121
93
|
return definition.kind === 'FragmentDefinition' && definition.name.value === sel.name.value;
|
|
122
94
|
});
|
|
123
|
-
|
|
124
95
|
if (!existing) {
|
|
125
96
|
// First remove the spread, as it has no match in document
|
|
126
|
-
removedFragmentSpreads.push(sel);
|
|
97
|
+
removedFragmentSpreads.push(sel);
|
|
127
98
|
|
|
99
|
+
// Check if a replacement is provided for this pseudo-fragment, then insert spreads and definitions
|
|
128
100
|
if (fragments) {
|
|
129
101
|
fragments = fragments.map(function (frag) {
|
|
130
102
|
return typeof frag === 'string' ? _fragments.PredefinedFragments[frag] : frag;
|
|
@@ -137,29 +109,28 @@ function replaceFragmentsInSelectionSet(selectionSet, fragments, def, document)
|
|
|
137
109
|
}).forEach(function (frag) {
|
|
138
110
|
var newSpread = (0, _cloneDeep2["default"])(sel);
|
|
139
111
|
newSpread.name.value = frag.name.value;
|
|
140
|
-
newFragmentsSpreads.push(newSpread);
|
|
112
|
+
newFragmentsSpreads.push(newSpread);
|
|
141
113
|
|
|
114
|
+
// Add the new fragment definition in document if it has not already been added
|
|
142
115
|
var existing = document.definitions.find(function (definition) {
|
|
143
116
|
return definition.kind === 'FragmentDefinition' && definition.name.value === frag.name.value;
|
|
144
117
|
});
|
|
145
|
-
|
|
146
118
|
if (!existing) {
|
|
147
119
|
document.definitions.push(frag);
|
|
148
120
|
}
|
|
149
|
-
});
|
|
121
|
+
});
|
|
150
122
|
|
|
123
|
+
// Adds the associated variables to the query
|
|
151
124
|
var allVariables = applyableFragments.reduce(function (result, n) {
|
|
152
|
-
return _objectSpread({}, result,
|
|
125
|
+
return _objectSpread(_objectSpread({}, result), n.variables);
|
|
153
126
|
}, {});
|
|
154
127
|
Object.entries(allVariables).forEach(function (_ref) {
|
|
155
128
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
129
|
+
name = _ref2[0],
|
|
130
|
+
value = _ref2[1];
|
|
159
131
|
var existing = def.variableDefinitions.find(function (def) {
|
|
160
132
|
return def.variable.name.value === name;
|
|
161
133
|
});
|
|
162
|
-
|
|
163
134
|
if (!existing) {
|
|
164
135
|
var type = (0, _graphql.parseType)(value, {
|
|
165
136
|
noLocation: true
|
|
@@ -180,15 +151,17 @@ function replaceFragmentsInSelectionSet(selectionSet, fragments, def, document)
|
|
|
180
151
|
}
|
|
181
152
|
}
|
|
182
153
|
}
|
|
183
|
-
});
|
|
154
|
+
});
|
|
184
155
|
|
|
156
|
+
// Removed replaced spreads
|
|
185
157
|
selectionSet.selections = selectionSet.selections.filter(function (sel) {
|
|
186
158
|
return removedFragmentSpreads.indexOf(sel) === -1;
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
(_selectionSet$selecti = selectionSet.selections).push.apply(_selectionSet$selecti, newFragmentsSpreads); // Recursively call on sub-selections set
|
|
159
|
+
});
|
|
190
160
|
|
|
161
|
+
// Add all new spreads
|
|
162
|
+
(_selectionSet$selecti = selectionSet.selections).push.apply(_selectionSet$selecti, newFragmentsSpreads);
|
|
191
163
|
|
|
164
|
+
// Recursively call on sub-selections set
|
|
192
165
|
selectionSet.selections.forEach(function (sel) {
|
|
193
166
|
return replaceFragmentsInSelectionSet(sel.selectionSet, fragments, def, document);
|
|
194
167
|
});
|
|
@@ -4,41 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getNodeTypeFragment = exports.getEncodedNodeTypeName = void 0;
|
|
7
|
-
|
|
8
7
|
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
9
|
-
|
|
10
8
|
var _encodeName = require("./encodeName");
|
|
11
|
-
|
|
9
|
+
var _templateObject;
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
function _templateObject() {
|
|
15
|
-
var data = _taggedTemplateLiteral(["fragment NodeType_", " on JCRNode {\n ", ":isNodeType(type: $", ")\n }"]);
|
|
16
|
-
|
|
17
|
-
_templateObject = function _templateObject() {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
11
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
25
|
-
|
|
26
12
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
-
|
|
28
13
|
var fragments = {};
|
|
29
|
-
|
|
30
14
|
var getNodeTypeFragment = function getNodeTypeFragment(name) {
|
|
31
15
|
var encodedName = getEncodedNodeTypeName(name);
|
|
32
|
-
|
|
33
16
|
if (!fragments[encodedName]) {
|
|
34
17
|
var fragment = {
|
|
35
18
|
applyFor: 'node',
|
|
36
19
|
variables: _defineProperty({}, encodedName, 'InputNodeTypesInput!'),
|
|
37
|
-
gql: (0, _graphqlTag["default"])(_templateObject(), encodedName, encodedName, encodedName)
|
|
20
|
+
gql: (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["fragment NodeType_", " on JCRNode {\n ", ":isNodeType(type: $", ")\n }"])), encodedName, encodedName, encodedName)
|
|
38
21
|
};
|
|
39
22
|
fragments[encodedName] = fragment;
|
|
40
23
|
}
|
|
41
|
-
|
|
42
24
|
return {
|
|
43
25
|
fragment: fragments[encodedName],
|
|
44
26
|
variables: _defineProperty({}, encodedName, {
|
|
@@ -46,11 +28,8 @@ var getNodeTypeFragment = function getNodeTypeFragment(name) {
|
|
|
46
28
|
})
|
|
47
29
|
};
|
|
48
30
|
};
|
|
49
|
-
|
|
50
31
|
exports.getNodeTypeFragment = getNodeTypeFragment;
|
|
51
|
-
|
|
52
32
|
var getEncodedNodeTypeName = function getEncodedNodeTypeName(name) {
|
|
53
33
|
return 'nodeType_' + (0, _encodeName.encodeName)(name);
|
|
54
34
|
};
|
|
55
|
-
|
|
56
35
|
exports.getEncodedNodeTypeName = getEncodedNodeTypeName;
|