@jahia/data-helper 1.1.8 → 1.1.9

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.
Files changed (266) hide show
  1. package/.autorc +10 -0
  2. package/.eslintrc +8 -0
  3. package/CHANGELOG.md +532 -0
  4. package/build.mjs +9 -0
  5. package/{esm → dist/esm}/fragments/PredefinedFragments.js +8 -3
  6. package/dist/esm/fragments/PredefinedFragments.js.map +1 -0
  7. package/dist/esm/fragments/encodeName.js.map +1 -0
  8. package/{esm → dist/esm}/fragments/fragments.utils.js +25 -34
  9. package/dist/esm/fragments/fragments.utils.js.map +1 -0
  10. package/dist/esm/fragments/getIsNodeTypeFragment.js +26 -0
  11. package/dist/esm/fragments/getIsNodeTypeFragment.js.map +1 -0
  12. package/{esm → dist/esm}/fragments/getPermissionFragment.js +5 -10
  13. package/dist/esm/fragments/getPermissionFragment.js.map +1 -0
  14. package/dist/esm/fragments/getSubNodesCountFragment.js +24 -0
  15. package/dist/esm/fragments/getSubNodesCountFragment.js.map +1 -0
  16. package/dist/esm/fragments/index.js +3 -0
  17. package/dist/esm/fragments/index.js.map +1 -0
  18. package/dist/esm/hooks/index.js +6 -0
  19. package/{esm → dist/esm}/hooks/index.js.map +1 -1
  20. package/dist/esm/hooks/useContentPreview/index.js +2 -0
  21. package/dist/esm/hooks/useContentPreview/index.js.map +1 -0
  22. package/{esm → dist/esm}/hooks/useContentPreview/useContentPreview.gql-queries.js +2 -2
  23. package/{esm → dist/esm}/hooks/useContentPreview/useContentPreview.gql-queries.js.map +1 -1
  24. package/{esm → dist/esm}/hooks/useContentPreview/useContentPreview.js +2 -2
  25. package/dist/esm/hooks/useContentPreview/useContentPreview.js.map +1 -0
  26. package/dist/esm/hooks/useDeepCompareMemo/index.js +2 -0
  27. package/dist/esm/hooks/useDeepCompareMemo/index.js.map +1 -0
  28. package/dist/esm/hooks/useDeepCompareMemo/useDeepCompareMemo.js.map +1 -0
  29. package/{esm → dist/esm}/hooks/useNodeChecks/index.js +1 -1
  30. package/dist/esm/hooks/useNodeChecks/index.js.map +1 -0
  31. package/{esm → dist/esm}/hooks/useNodeChecks/useNodeChecks.js +12 -15
  32. package/dist/esm/hooks/useNodeChecks/useNodeChecks.js.map +1 -0
  33. package/{esm → dist/esm}/hooks/useNodeInfo/index.js +1 -1
  34. package/dist/esm/hooks/useNodeInfo/index.js.map +1 -0
  35. package/dist/esm/hooks/useNodeInfo/useMemoRequest.js +43 -0
  36. package/dist/esm/hooks/useNodeInfo/useMemoRequest.js.map +1 -0
  37. package/{esm → dist/esm}/hooks/useNodeInfo/useNodeInfo.gql-queries.js +26 -20
  38. package/dist/esm/hooks/useNodeInfo/useNodeInfo.gql-queries.js.map +1 -0
  39. package/{esm → dist/esm}/hooks/useNodeInfo/useNodeInfo.js +37 -26
  40. package/dist/esm/hooks/useNodeInfo/useNodeInfo.js.map +1 -0
  41. package/{esm → dist/esm}/hooks/useNodeInfo/useNodeInfo.utils.js +3 -10
  42. package/dist/esm/hooks/useNodeInfo/useNodeInfo.utils.js.map +1 -0
  43. package/dist/esm/hooks/useSchemaFields/index.js +2 -0
  44. package/dist/esm/hooks/useSchemaFields/index.js.map +1 -0
  45. package/{esm → dist/esm}/hooks/useSchemaFields/useSchemaFields.gql-queries.js +1 -1
  46. package/{esm → dist/esm}/hooks/useSchemaFields/useSchemaFields.gql-queries.js.map +1 -1
  47. package/{esm → dist/esm}/hooks/useSchemaFields/useSchemaFields.js +2 -2
  48. package/dist/esm/hooks/useSchemaFields/useSchemaFields.js.map +1 -0
  49. package/{esm → dist/esm}/hooks/useSiteInfo/index.js +1 -1
  50. package/dist/esm/hooks/useSiteInfo/index.js.map +1 -0
  51. package/dist/esm/hooks/useSiteInfo/useSiteInfo.gql-queries.js +6 -0
  52. package/dist/esm/hooks/useSiteInfo/useSiteInfo.gql-queries.js.map +1 -0
  53. package/{esm → dist/esm}/hooks/useSiteInfo/useSiteInfo.js +12 -8
  54. package/dist/esm/hooks/useSiteInfo/useSiteInfo.js.map +1 -0
  55. package/{esm → dist/esm}/hooks/useTreeEntries/index.js +1 -1
  56. package/dist/esm/hooks/useTreeEntries/index.js.map +1 -0
  57. package/{esm → dist/esm}/hooks/useTreeEntries/useTreeEntries.gql-queries.js +2 -2
  58. package/{esm → dist/esm}/hooks/useTreeEntries/useTreeEntries.gql-queries.js.map +1 -1
  59. package/{esm → dist/esm}/hooks/useTreeEntries/useTreeEntries.js +8 -24
  60. package/dist/esm/hooks/useTreeEntries/useTreeEntries.js.map +1 -0
  61. package/dist/esm/index.js +4 -0
  62. package/dist/esm/index.js.map +1 -0
  63. package/{esm → dist/esm}/legacy/Picker.gql-fragments.js +1 -1
  64. package/{esm → dist/esm}/legacy/Picker.gql-fragments.js.map +1 -1
  65. package/{esm → dist/esm}/legacy/Picker.js +102 -135
  66. package/dist/esm/legacy/Picker.js.map +1 -0
  67. package/dist/esm/legacy/index.js +3 -0
  68. package/dist/esm/legacy/index.js.map +1 -0
  69. package/dist/js/fragments/PredefinedFragments.js +171 -0
  70. package/dist/js/fragments/PredefinedFragments.js.map +1 -0
  71. package/dist/js/fragments/encodeName.js.map +1 -0
  72. package/{js → dist/js}/fragments/fragments.utils.js +27 -36
  73. package/dist/js/fragments/fragments.utils.js.map +1 -0
  74. package/dist/js/fragments/getIsNodeTypeFragment.js +35 -0
  75. package/dist/js/fragments/getIsNodeTypeFragment.js.map +1 -0
  76. package/dist/js/fragments/getPermissionFragment.js +48 -0
  77. package/dist/js/fragments/getPermissionFragment.js.map +1 -0
  78. package/dist/js/fragments/getSubNodesCountFragment.js +33 -0
  79. package/dist/js/fragments/getSubNodesCountFragment.js.map +1 -0
  80. package/{js → dist/js}/fragments/index.js.map +1 -1
  81. package/{js → dist/js}/hooks/index.js.map +1 -1
  82. package/{js → dist/js}/hooks/useContentPreview/index.js.map +1 -1
  83. package/dist/js/hooks/useContentPreview/useContentPreview.gql-queries.js +14 -0
  84. package/dist/js/hooks/useContentPreview/useContentPreview.gql-queries.js.map +1 -0
  85. package/{js → dist/js}/hooks/useContentPreview/useContentPreview.js +2 -2
  86. package/dist/js/hooks/useContentPreview/useContentPreview.js.map +1 -0
  87. package/{js → dist/js}/hooks/useDeepCompareMemo/index.js.map +1 -1
  88. package/{js → dist/js}/hooks/useDeepCompareMemo/useDeepCompareMemo.js +1 -1
  89. package/dist/js/hooks/useDeepCompareMemo/useDeepCompareMemo.js.map +1 -0
  90. package/{js → dist/js}/hooks/useNodeChecks/index.js.map +1 -1
  91. package/{js → dist/js}/hooks/useNodeChecks/useNodeChecks.js +15 -17
  92. package/dist/js/hooks/useNodeChecks/useNodeChecks.js.map +1 -0
  93. package/{js → dist/js}/hooks/useNodeInfo/index.js.map +1 -1
  94. package/dist/js/hooks/useNodeInfo/useMemoRequest.js +50 -0
  95. package/dist/js/hooks/useNodeInfo/useMemoRequest.js.map +1 -0
  96. package/{js → dist/js}/hooks/useNodeInfo/useNodeInfo.gql-queries.js +24 -18
  97. package/dist/js/hooks/useNodeInfo/useNodeInfo.gql-queries.js.map +1 -0
  98. package/{js → dist/js}/hooks/useNodeInfo/useNodeInfo.js +37 -26
  99. package/dist/js/hooks/useNodeInfo/useNodeInfo.js.map +1 -0
  100. package/dist/js/hooks/useNodeInfo/useNodeInfo.utils.js +57 -0
  101. package/dist/js/hooks/useNodeInfo/useNodeInfo.utils.js.map +1 -0
  102. package/{js → dist/js}/hooks/useSchemaFields/index.js.map +1 -1
  103. package/dist/js/hooks/useSchemaFields/useSchemaFields.gql-queries.js +13 -0
  104. package/dist/js/hooks/useSchemaFields/useSchemaFields.gql-queries.js.map +1 -0
  105. package/{js → dist/js}/hooks/useSchemaFields/useSchemaFields.js +2 -2
  106. package/dist/js/hooks/useSchemaFields/useSchemaFields.js.map +1 -0
  107. package/{js → dist/js}/hooks/useSiteInfo/index.js.map +1 -1
  108. package/dist/js/hooks/useSiteInfo/useSiteInfo.gql-queries.js +14 -0
  109. package/dist/js/hooks/useSiteInfo/useSiteInfo.gql-queries.js.map +1 -0
  110. package/dist/js/hooks/useSiteInfo/useSiteInfo.js +47 -0
  111. package/dist/js/hooks/useSiteInfo/useSiteInfo.js.map +1 -0
  112. package/{js → dist/js}/hooks/useTreeEntries/index.js.map +1 -1
  113. package/dist/js/hooks/useTreeEntries/useTreeEntries.gql-queries.js +14 -0
  114. package/dist/js/hooks/useTreeEntries/useTreeEntries.gql-queries.js.map +1 -0
  115. package/dist/js/hooks/useTreeEntries/useTreeEntries.js +102 -0
  116. package/dist/js/hooks/useTreeEntries/useTreeEntries.js.map +1 -0
  117. package/{js → dist/js}/index.js.map +1 -1
  118. package/dist/js/legacy/Picker.gql-fragments.js +29 -0
  119. package/dist/js/legacy/Picker.gql-fragments.js.map +1 -0
  120. package/dist/js/legacy/Picker.js +363 -0
  121. package/dist/js/legacy/Picker.js.map +1 -0
  122. package/{js → dist/js}/legacy/index.js.map +1 -1
  123. package/dist/types/fragments/PredefinedFragments.d.ts +32 -0
  124. package/dist/types/fragments/encodeName.d.ts +1 -0
  125. package/dist/types/fragments/fragments.utils.d.ts +6 -0
  126. package/dist/types/fragments/getIsNodeTypeFragment.d.ts +10 -0
  127. package/dist/types/fragments/getPermissionFragment.d.ts +14 -0
  128. package/dist/types/fragments/getSubNodesCountFragment.d.ts +8 -0
  129. package/dist/types/hooks/useContentPreview/useContentPreview.d.ts +25 -0
  130. package/dist/types/hooks/useContentPreview/useContentPreview.gql-queries.d.ts +1 -0
  131. package/dist/types/hooks/useDeepCompareMemo/useDeepCompareMemo.d.ts +1 -0
  132. package/dist/types/hooks/useNodeChecks/useNodeChecks.d.ts +19 -0
  133. package/dist/types/hooks/useNodeInfo/useMemoRequest.d.ts +6 -0
  134. package/dist/types/hooks/useNodeInfo/useNodeInfo.d.ts +33 -0
  135. package/dist/types/hooks/useNodeInfo/useNodeInfo.gql-queries.d.ts +33 -0
  136. package/dist/types/hooks/useNodeInfo/useNodeInfo.utils.d.ts +12 -0
  137. package/dist/types/hooks/useSchemaFields/useSchemaFields.d.ts +5 -0
  138. package/dist/types/hooks/useSchemaFields/useSchemaFields.gql-queries.d.ts +1 -0
  139. package/dist/types/hooks/useSiteInfo/useSiteInfo.d.ts +63 -0
  140. package/dist/types/hooks/useSiteInfo/useSiteInfo.gql-queries.d.ts +1 -0
  141. package/dist/types/hooks/useTreeEntries/useTreeEntries.d.ts +39 -0
  142. package/dist/types/hooks/useTreeEntries/useTreeEntries.gql-queries.d.ts +1 -0
  143. package/dist/types/legacy/Picker.d.ts +84 -0
  144. package/dist/types/legacy/Picker.gql-fragments.d.ts +17 -0
  145. package/package.json +12 -20
  146. package/tsconfig.json +27 -0
  147. package/esm/fragments/PredefinedFragments.js.map +0 -1
  148. package/esm/fragments/encodeName.js.map +0 -1
  149. package/esm/fragments/fragments.utils.js.map +0 -1
  150. package/esm/fragments/getIsNodeTypeFragment.js +0 -30
  151. package/esm/fragments/getIsNodeTypeFragment.js.map +0 -1
  152. package/esm/fragments/getPermissionFragment.js.map +0 -1
  153. package/esm/fragments/index.js +0 -3
  154. package/esm/fragments/index.js.map +0 -1
  155. package/esm/hooks/index.js +0 -6
  156. package/esm/hooks/useContentPreview/index.js +0 -2
  157. package/esm/hooks/useContentPreview/index.js.map +0 -1
  158. package/esm/hooks/useContentPreview/useContentPreview.js.map +0 -1
  159. package/esm/hooks/useContentPreview/useContentPreview.spec.js +0 -35
  160. package/esm/hooks/useContentPreview/useContentPreview.spec.js.map +0 -1
  161. package/esm/hooks/useDeepCompareMemo/index.js +0 -2
  162. package/esm/hooks/useDeepCompareMemo/index.js.map +0 -1
  163. package/esm/hooks/useDeepCompareMemo/useDeepCompareMemo.js.map +0 -1
  164. package/esm/hooks/useDeepCompareMemo/useDeepCompareMemo.spec.js +0 -36
  165. package/esm/hooks/useDeepCompareMemo/useDeepCompareMemo.spec.js.map +0 -1
  166. package/esm/hooks/useNodeChecks/index.js.map +0 -1
  167. package/esm/hooks/useNodeChecks/useNodeChecks.js.map +0 -1
  168. package/esm/hooks/useNodeChecks/useNodeChecks.spec.js +0 -184
  169. package/esm/hooks/useNodeChecks/useNodeChecks.spec.js.map +0 -1
  170. package/esm/hooks/useNodeInfo/index.js.map +0 -1
  171. package/esm/hooks/useNodeInfo/useMemoRequest.js +0 -50
  172. package/esm/hooks/useNodeInfo/useMemoRequest.js.map +0 -1
  173. package/esm/hooks/useNodeInfo/useNodeInfo.gql-queries.js.map +0 -1
  174. package/esm/hooks/useNodeInfo/useNodeInfo.js.map +0 -1
  175. package/esm/hooks/useNodeInfo/useNodeInfo.spec.js +0 -453
  176. package/esm/hooks/useNodeInfo/useNodeInfo.spec.js.map +0 -1
  177. package/esm/hooks/useNodeInfo/useNodeInfo.utils.js.map +0 -1
  178. package/esm/hooks/useSchemaFields/index.js +0 -2
  179. package/esm/hooks/useSchemaFields/index.js.map +0 -1
  180. package/esm/hooks/useSchemaFields/useSchemaFields.js.map +0 -1
  181. package/esm/hooks/useSiteInfo/index.js.map +0 -1
  182. package/esm/hooks/useSiteInfo/useSiteInfo.gql-queries.js +0 -6
  183. package/esm/hooks/useSiteInfo/useSiteInfo.gql-queries.js.map +0 -1
  184. package/esm/hooks/useSiteInfo/useSiteInfo.js.map +0 -1
  185. package/esm/hooks/useSiteInfo/useSiteInfo.spec.js +0 -65
  186. package/esm/hooks/useSiteInfo/useSiteInfo.spec.js.map +0 -1
  187. package/esm/hooks/useTreeEntries/index.js.map +0 -1
  188. package/esm/hooks/useTreeEntries/useTreeEntries.js.map +0 -1
  189. package/esm/hooks/useTreeEntries/useTreeEntries.spec.js +0 -47
  190. package/esm/hooks/useTreeEntries/useTreeEntries.spec.js.map +0 -1
  191. package/esm/index.js +0 -4
  192. package/esm/index.js.map +0 -1
  193. package/esm/legacy/Picker.js.map +0 -1
  194. package/esm/legacy/index.js +0 -3
  195. package/esm/legacy/index.js.map +0 -1
  196. package/js/fragments/PredefinedFragments.js +0 -165
  197. package/js/fragments/PredefinedFragments.js.map +0 -1
  198. package/js/fragments/encodeName.js.map +0 -1
  199. package/js/fragments/fragments.utils.js.map +0 -1
  200. package/js/fragments/getIsNodeTypeFragment.js +0 -39
  201. package/js/fragments/getIsNodeTypeFragment.js.map +0 -1
  202. package/js/fragments/getPermissionFragment.js +0 -53
  203. package/js/fragments/getPermissionFragment.js.map +0 -1
  204. package/js/hooks/useContentPreview/useContentPreview.gql-queries.js +0 -14
  205. package/js/hooks/useContentPreview/useContentPreview.gql-queries.js.map +0 -1
  206. package/js/hooks/useContentPreview/useContentPreview.js.map +0 -1
  207. package/js/hooks/useContentPreview/useContentPreview.spec.js +0 -37
  208. package/js/hooks/useContentPreview/useContentPreview.spec.js.map +0 -1
  209. package/js/hooks/useDeepCompareMemo/useDeepCompareMemo.js.map +0 -1
  210. package/js/hooks/useDeepCompareMemo/useDeepCompareMemo.spec.js +0 -38
  211. package/js/hooks/useDeepCompareMemo/useDeepCompareMemo.spec.js.map +0 -1
  212. package/js/hooks/useNodeChecks/useNodeChecks.js.map +0 -1
  213. package/js/hooks/useNodeChecks/useNodeChecks.spec.js +0 -187
  214. package/js/hooks/useNodeChecks/useNodeChecks.spec.js.map +0 -1
  215. package/js/hooks/useNodeInfo/useMemoRequest.js +0 -57
  216. package/js/hooks/useNodeInfo/useMemoRequest.js.map +0 -1
  217. package/js/hooks/useNodeInfo/useNodeInfo.gql-queries.js.map +0 -1
  218. package/js/hooks/useNodeInfo/useNodeInfo.js.map +0 -1
  219. package/js/hooks/useNodeInfo/useNodeInfo.spec.js +0 -456
  220. package/js/hooks/useNodeInfo/useNodeInfo.spec.js.map +0 -1
  221. package/js/hooks/useNodeInfo/useNodeInfo.utils.js +0 -63
  222. package/js/hooks/useNodeInfo/useNodeInfo.utils.js.map +0 -1
  223. package/js/hooks/useSchemaFields/useSchemaFields.gql-queries.js +0 -13
  224. package/js/hooks/useSchemaFields/useSchemaFields.gql-queries.js.map +0 -1
  225. package/js/hooks/useSchemaFields/useSchemaFields.js.map +0 -1
  226. package/js/hooks/useSiteInfo/useSiteInfo.gql-queries.js +0 -14
  227. package/js/hooks/useSiteInfo/useSiteInfo.gql-queries.js.map +0 -1
  228. package/js/hooks/useSiteInfo/useSiteInfo.js +0 -42
  229. package/js/hooks/useSiteInfo/useSiteInfo.js.map +0 -1
  230. package/js/hooks/useSiteInfo/useSiteInfo.spec.js +0 -67
  231. package/js/hooks/useSiteInfo/useSiteInfo.spec.js.map +0 -1
  232. package/js/hooks/useTreeEntries/useTreeEntries.gql-queries.js +0 -14
  233. package/js/hooks/useTreeEntries/useTreeEntries.gql-queries.js.map +0 -1
  234. package/js/hooks/useTreeEntries/useTreeEntries.js +0 -117
  235. package/js/hooks/useTreeEntries/useTreeEntries.js.map +0 -1
  236. package/js/hooks/useTreeEntries/useTreeEntries.spec.js +0 -49
  237. package/js/hooks/useTreeEntries/useTreeEntries.spec.js.map +0 -1
  238. package/js/legacy/Picker.gql-fragments.js +0 -29
  239. package/js/legacy/Picker.gql-fragments.js.map +0 -1
  240. package/js/legacy/Picker.js +0 -396
  241. package/js/legacy/Picker.js.map +0 -1
  242. /package/{esm → dist/esm}/fragments/encodeName.js +0 -0
  243. /package/{esm → dist/esm}/hooks/useDeepCompareMemo/useDeepCompareMemo.js +0 -0
  244. /package/{js → dist/js}/fragments/encodeName.js +0 -0
  245. /package/{js → dist/js}/fragments/index.js +0 -0
  246. /package/{js → dist/js}/hooks/index.js +0 -0
  247. /package/{js → dist/js}/hooks/useContentPreview/index.js +0 -0
  248. /package/{js → dist/js}/hooks/useDeepCompareMemo/index.js +0 -0
  249. /package/{js → dist/js}/hooks/useNodeChecks/index.js +0 -0
  250. /package/{js → dist/js}/hooks/useNodeInfo/index.js +0 -0
  251. /package/{js → dist/js}/hooks/useSchemaFields/index.js +0 -0
  252. /package/{js → dist/js}/hooks/useSiteInfo/index.js +0 -0
  253. /package/{js → dist/js}/hooks/useTreeEntries/index.js +0 -0
  254. /package/{js → dist/js}/index.js +0 -0
  255. /package/{js → dist/js}/legacy/index.js +0 -0
  256. /package/{esm → dist/types}/fragments/index.d.ts +0 -0
  257. /package/{esm → dist/types}/hooks/index.d.ts +0 -0
  258. /package/{esm → dist/types}/hooks/useContentPreview/index.d.ts +0 -0
  259. /package/{esm → dist/types}/hooks/useDeepCompareMemo/index.d.ts +0 -0
  260. /package/{esm → dist/types}/hooks/useNodeChecks/index.d.ts +0 -0
  261. /package/{esm → dist/types}/hooks/useNodeInfo/index.d.ts +0 -0
  262. /package/{esm → dist/types}/hooks/useSchemaFields/index.d.ts +0 -0
  263. /package/{esm → dist/types}/hooks/useSiteInfo/index.d.ts +0 -0
  264. /package/{esm → dist/types}/hooks/useTreeEntries/index.d.ts +0 -0
  265. /package/{esm → dist/types}/index.d.ts +0 -0
  266. /package/{esm → dist/types}/legacy/index.d.ts +0 -0
@@ -1,22 +1,15 @@
1
- import _cloneDeep from "lodash/cloneDeep"; // TODO BACKLOG-12393 - remove lodash
2
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
- 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."); }
5
- 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); }
6
- 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; }
7
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
8
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
3
  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; }
10
4
  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; }
11
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
5
  import { parseType } from 'graphql';
15
- import { PredefinedFragments } from '../fragments';
6
+ import { PredefinedFragments } from "../fragments";
7
+ import rfdc from 'rfdc';
8
+ var clone = rfdc();
16
9
  function findParametersInDocument(doc) {
17
10
  if (doc && doc.definitions) {
18
11
  return doc.definitions.flatMap(function (def) {
19
- return findParametersInSelectionSet(def.selectionSet);
12
+ return 'selectionSet' in def ? findParametersInSelectionSet(def.selectionSet) : [];
20
13
  });
21
14
  }
22
15
  return [];
@@ -36,11 +29,12 @@ function replaceFragmentsInDocument(doc, fragments) {
36
29
  }
37
30
  var clonedQuery = null;
38
31
  if (doc && doc.definitions) {
39
- clonedQuery = _cloneDeep(doc);
32
+ clonedQuery = clone(doc);
40
33
  clonedQuery.definitions.forEach(function (def) {
41
- return replaceFragmentsInSelectionSet(def.selectionSet, fragments, def, clonedQuery);
34
+ return 'selectionSet' in def && replaceFragmentsInSelectionSet(def.selectionSet, fragments, def, clonedQuery);
42
35
  });
43
- clonedQuery.definitions[0].name.value = key;
36
+ var operationDefinition = clonedQuery.definitions[0];
37
+ operationDefinition.name.value = key;
44
38
  }
45
39
  queryCache[key] = clonedQuery;
46
40
  return clonedQuery;
@@ -48,10 +42,10 @@ function replaceFragmentsInDocument(doc, fragments) {
48
42
  function findParametersInSelectionSet(selectionSet) {
49
43
  if (selectionSet && selectionSet.selections) {
50
44
  return selectionSet.selections.flatMap(function (sel) {
51
- return sel.arguments.filter(function (arg) {
45
+ return 'arguments' in sel && sel.arguments.filter(function (arg) {
52
46
  return arg.value.kind === 'Variable';
53
47
  }).flatMap(function (arg) {
54
- return arg.value.name.value;
48
+ return 'name' in arg.value ? arg.value.name.value : [];
55
49
  }).concat(findParametersInSelectionSet(sel.selectionSet)).filter(function (f) {
56
50
  return typeof f !== 'undefined';
57
51
  });
@@ -66,14 +60,14 @@ function findFragmentsInSelectionSet(selectionSet) {
66
60
  }).map(function (sel) {
67
61
  return sel.name.value;
68
62
  }).concat(selectionSet.selections.flatMap(function (sel) {
69
- return findFragmentsInSelectionSet(sel.selectionSet);
63
+ return findFragmentsInSelectionSet('selectionSet' in sel && sel.selectionSet);
70
64
  }));
71
65
  }
72
66
  return [];
73
67
  }
74
68
  function replaceFragmentsInSelectionSet(selectionSet, fragments, def, document) {
75
69
  if (selectionSet && selectionSet.selections) {
76
- var _selectionSet$selecti;
70
+ var _ref3;
77
71
  var newFragmentsSpreads = [];
78
72
  var removedFragmentSpreads = [];
79
73
  // Look for all existing fragment spreads in selection set
@@ -92,24 +86,22 @@ function replaceFragmentsInSelectionSet(selectionSet, fragments, def, document)
92
86
 
93
87
  // Check if a replacement is provided for this pseudo-fragment, then insert spreads and definitions
94
88
  if (fragments) {
95
- fragments = fragments.map(function (frag) {
89
+ var applyableFragments = fragments.map(function (frag) {
96
90
  return typeof frag === 'string' ? PredefinedFragments[frag] : frag;
97
- });
98
- var applyableFragments = fragments.filter(function (frag) {
91
+ }).filter(function (frag) {
99
92
  return frag.applyFor === sel.name.value;
100
93
  });
101
94
  applyableFragments.flatMap(function (fragment) {
102
95
  return fragment.gql.definitions;
103
96
  }).forEach(function (frag) {
104
- var newSpread = _cloneDeep(sel);
97
+ var newSpread = clone(sel);
105
98
  newSpread.name.value = frag.name.value;
106
99
  newFragmentsSpreads.push(newSpread);
107
100
 
108
101
  // Add the new fragment definition in document if it has not already been added
109
- var existing = document.definitions.find(function (definition) {
102
+ if (!document.definitions.find(function (definition) {
110
103
  return definition.kind === 'FragmentDefinition' && definition.name.value === frag.name.value;
111
- });
112
- if (!existing) {
104
+ })) {
113
105
  document.definitions.push(frag);
114
106
  }
115
107
  });
@@ -122,10 +114,9 @@ function replaceFragmentsInSelectionSet(selectionSet, fragments, def, document)
122
114
  var _ref2 = _slicedToArray(_ref, 2),
123
115
  name = _ref2[0],
124
116
  value = _ref2[1];
125
- var existing = def.variableDefinitions.find(function (def) {
126
- return def.variable.name.value === name;
127
- });
128
- if (!existing) {
117
+ if (!def.variableDefinitions.find(function (variableDef) {
118
+ return variableDef.variable.name.value === name;
119
+ })) {
129
120
  var type = parseType(value, {
130
121
  noLocation: true
131
122
  });
@@ -149,15 +140,15 @@ function replaceFragmentsInSelectionSet(selectionSet, fragments, def, document)
149
140
 
150
141
  // Removed replaced spreads
151
142
  selectionSet.selections = selectionSet.selections.filter(function (sel) {
152
- return removedFragmentSpreads.indexOf(sel) === -1;
143
+ return sel.kind !== 'FragmentSpread' || removedFragmentSpreads.indexOf(sel) === -1;
153
144
  });
154
145
 
155
146
  // Add all new spreads
156
- (_selectionSet$selecti = selectionSet.selections).push.apply(_selectionSet$selecti, newFragmentsSpreads);
147
+ (_ref3 = selectionSet.selections).push.apply(_ref3, newFragmentsSpreads);
157
148
 
158
149
  // Recursively call on sub-selections set
159
150
  selectionSet.selections.forEach(function (sel) {
160
- return replaceFragmentsInSelectionSet(sel.selectionSet, fragments, def, document);
151
+ return 'selectionSet' in sel && replaceFragmentsInSelectionSet(sel.selectionSet, fragments, def, document);
161
152
  });
162
153
  }
163
154
  }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["parseType","PredefinedFragments","rfdc","clone","findParametersInDocument","doc","definitions","flatMap","def","findParametersInSelectionSet","selectionSet","queryCache","replaceFragmentsInDocument","fragments","key","name","value","map","f","gql","sort","join","clonedQuery","forEach","replaceFragmentsInSelectionSet","operationDefinition","selections","sel","arguments","filter","arg","kind","concat","findFragmentsInSelectionSet","document","_ref3","newFragmentsSpreads","removedFragmentSpreads","existing","find","definition","push","applyableFragments","frag","applyFor","fragment","newSpread","allVariables","reduce","result","n","_objectSpread","variables","Object","entries","_ref","_ref2","_slicedToArray","variableDefinitions","variableDef","variable","type","noLocation","indexOf","apply"],"sources":["fragments.utils.ts"],"sourcesContent":["import {\n DefinitionNode,\n DocumentNode,\n FragmentSpreadNode,\n NameNode,\n parseType,\n SelectionNode,\n SelectionSetNode,\n VariableDefinitionNode\n} from 'graphql';\nimport {Fragment, PredefinedFragments} from '../fragments';\nimport {ExecutableDefinitionNode, FragmentDefinitionNode, OperationDefinitionNode} from 'graphql/language/ast';\nimport rfdc from 'rfdc';\n\nconst clone = rfdc();\n\ntype Mutable<T> = {\n -readonly [P in keyof T]: T[P]\n};\n\nfunction findParametersInDocument(doc: DocumentNode): string[] {\n if (doc && doc.definitions) {\n return doc.definitions.flatMap(def => 'selectionSet' in def ? findParametersInSelectionSet(def.selectionSet) : []);\n }\n\n return [];\n}\n\nconst queryCache: {[key:string]: DocumentNode} = {};\n\nfunction replaceFragmentsInDocument(doc: DocumentNode, fragments: (string|Fragment)[]) {\n if (!fragments) {\n fragments = [];\n }\n\n const key = (doc.definitions[0] as ExecutableDefinitionNode).name.value + '__' + fragments\n .map(f => (typeof f === 'string') ? PredefinedFragments[f] : f)\n .map(f => (f.gql.definitions[0] as FragmentDefinitionNode).name.value)\n .sort()\n .join('_');\n\n if (queryCache[key]) {\n return queryCache[key];\n }\n\n let clonedQuery: DocumentNode = null;\n if (doc && doc.definitions) {\n clonedQuery = clone(doc);\n clonedQuery.definitions.forEach(def => 'selectionSet' in def && replaceFragmentsInSelectionSet(def.selectionSet, fragments, def, clonedQuery));\n const operationDefinition = clonedQuery.definitions[0] as OperationDefinitionNode;\n (operationDefinition.name as Mutable<NameNode>).value = key;\n }\n\n queryCache[key] = clonedQuery;\n\n return clonedQuery;\n}\n\nfunction findParametersInSelectionSet(selectionSet: SelectionSetNode): string[] {\n if (selectionSet && selectionSet.selections) {\n return selectionSet.selections.flatMap(sel => 'arguments' in sel &&\n sel.arguments.filter(arg => (arg.value.kind === 'Variable')).flatMap(arg => 'name' in arg.value ? arg.value.name.value : [])\n .concat(findParametersInSelectionSet(sel.selectionSet))\n .filter(f => typeof f !== 'undefined')\n );\n }\n\n return [];\n}\n\nfunction findFragmentsInSelectionSet(selectionSet: SelectionSetNode): string[] {\n if (selectionSet && selectionSet.selections) {\n return selectionSet.selections\n .filter<FragmentSpreadNode>((sel): sel is FragmentSpreadNode => sel.kind === 'FragmentSpread').map(sel => sel.name.value)\n .concat(selectionSet.selections.flatMap(sel => findFragmentsInSelectionSet('selectionSet' in sel && sel.selectionSet)));\n }\n\n return [];\n}\n\nfunction replaceFragmentsInSelectionSet(selectionSet: SelectionSetNode, fragments: (string|Fragment)[], def: ExecutableDefinitionNode, document: Mutable<DocumentNode>) {\n if (selectionSet && selectionSet.selections) {\n const newFragmentsSpreads: FragmentSpreadNode[] = [];\n const removedFragmentSpreads: FragmentSpreadNode[] = [];\n // Look for all existing fragment spreads in selection set\n selectionSet.selections.filter<FragmentSpreadNode>((sel): sel is FragmentSpreadNode => sel.kind === 'FragmentSpread').forEach(sel => {\n // Handle only named fragments\n if (sel.name.value) {\n // Check if spread exists in current doc - if not, we replace or remove it\n const existing = document.definitions.find(definition => definition.kind === 'FragmentDefinition' && definition.name.value === sel.name.value);\n\n if (!existing) {\n // First remove the spread, as it has no match in document\n removedFragmentSpreads.push(sel);\n\n // Check if a replacement is provided for this pseudo-fragment, then insert spreads and definitions\n if (fragments) {\n const applyableFragments = fragments\n .map(frag => (typeof frag === 'string') ? PredefinedFragments[frag] : frag)\n .filter(frag => frag.applyFor === sel.name.value);\n\n applyableFragments.flatMap((fragment:Fragment) => fragment.gql.definitions).forEach((frag: FragmentDefinitionNode) => {\n const newSpread = clone(sel);\n (newSpread.name as Mutable<NameNode>).value = (frag as FragmentDefinitionNode).name.value;\n newFragmentsSpreads.push(newSpread);\n\n // Add the new fragment definition in document if it has not already been added\n if (!document.definitions.find(definition => definition.kind === 'FragmentDefinition' && definition.name.value === frag.name.value)) {\n (document.definitions as Array<DefinitionNode>).push(frag);\n }\n });\n\n // Adds the associated variables to the query\n const allVariables = applyableFragments.reduce((result:{[key: string]:string}, n) => ({...result, ...n.variables}), {});\n Object.entries(allVariables).forEach(([name, value]) => {\n if (!def.variableDefinitions.find(variableDef => variableDef.variable.name.value === name)) {\n const type = parseType(value, {noLocation: true});\n (def.variableDefinitions as Array<VariableDefinitionNode>).push({\n kind: 'VariableDefinition',\n variable: {\n kind: 'Variable',\n name: {\n kind: 'Name',\n value: name\n }\n },\n type\n });\n }\n });\n }\n }\n }\n });\n\n // Removed replaced spreads\n selectionSet.selections = selectionSet.selections.filter(sel => sel.kind !== 'FragmentSpread' || removedFragmentSpreads.indexOf(sel) === -1);\n\n // Add all new spreads\n (selectionSet.selections as Array<SelectionNode>).push(...newFragmentsSpreads);\n\n // Recursively call on sub-selections set\n selectionSet.selections.forEach(sel => 'selectionSet' in sel && replaceFragmentsInSelectionSet(sel.selectionSet, fragments, def, document));\n }\n}\n\nexport {replaceFragmentsInDocument, findParametersInDocument, findFragmentsInSelectionSet};\n"],"mappings":";;;;AAAA,SAKIA,SAAS,QAIN,SAAS;AAChB,SAAkBC,mBAAmB;AAErC,OAAOC,IAAI,MAAM,MAAM;AAEvB,IAAMC,KAAK,GAAGD,IAAI,CAAC,CAAC;AAMpB,SAASE,wBAAwBA,CAACC,GAAiB,EAAY;EAC3D,IAAIA,GAAG,IAAIA,GAAG,CAACC,WAAW,EAAE;IACxB,OAAOD,GAAG,CAACC,WAAW,CAACC,OAAO,CAAC,UAAAC,GAAG;MAAA,OAAI,cAAc,IAAIA,GAAG,GAAGC,4BAA4B,CAACD,GAAG,CAACE,YAAY,CAAC,GAAG,EAAE;IAAA,EAAC;EACtH;EAEA,OAAO,EAAE;AACb;AAEA,IAAMC,UAAwC,GAAG,CAAC,CAAC;AAEnD,SAASC,0BAA0BA,CAACP,GAAiB,EAAEQ,SAA8B,EAAE;EACnF,IAAI,CAACA,SAAS,EAAE;IACZA,SAAS,GAAG,EAAE;EAClB;EAEA,IAAMC,GAAG,GAAIT,GAAG,CAACC,WAAW,CAAC,CAAC,CAAC,CAA8BS,IAAI,CAACC,KAAK,GAAG,IAAI,GAAGH,SAAS,CACrFI,GAAG,CAAC,UAAAC,CAAC;IAAA,OAAK,OAAOA,CAAC,KAAK,QAAQ,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CAAC,CAAC;IAAA,EAAC;;IAE5I;IACA,CAAAQ,KAAA,GAACzB,YAAY,CAACgB,UAAU,EAA0Be,IAAI,CAAAuB,KAAA,CAAA7B,KAAA,EAAIC,mBAAmB,CAAC;;IAE9E;IACA1B,YAAY,CAACgB,UAAU,CAACH,OAAO,CAAC,UAAAI,GAAG;MAAA,OAAI,cAAc,IAAIA,GAAG,IAAIH,8BAA8B,CAACG,GAAG,CAACjB,YAAY,EAAEG,SAAS,EAAEL,GAAG,EAAE0B,QAAQ,CAAC;IAAA,EAAC;EAC/I;AACJ;AAEA,SAAQtB,0BAA0B,EAAER,wBAAwB,EAAE6B,2BAA2B"}
@@ -0,0 +1,26 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ var _templateObject;
4
+ import gql from 'graphql-tag';
5
+ import { encodeName } from "./encodeName";
6
+ var fragments = {};
7
+ export var getNodeTypeFragment = function getNodeTypeFragment(name) {
8
+ var encodedName = getEncodedNodeTypeName(name);
9
+ if (!fragments[encodedName]) {
10
+ fragments[encodedName] = {
11
+ applyFor: 'node',
12
+ variables: _defineProperty({}, encodedName, 'InputNodeTypesInput!'),
13
+ gql: gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["fragment NodeType_", " on JCRNode {\n ", ":isNodeType(type: $", ")\n }"])), encodedName, encodedName, encodedName)
14
+ };
15
+ }
16
+ return {
17
+ fragment: fragments[encodedName],
18
+ variables: _defineProperty({}, encodedName, {
19
+ types: name
20
+ })
21
+ };
22
+ };
23
+ export var getEncodedNodeTypeName = function getEncodedNodeTypeName(name) {
24
+ return 'nodeType_' + encodeName(name);
25
+ };
26
+ //# sourceMappingURL=getIsNodeTypeFragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["gql","encodeName","fragments","getNodeTypeFragment","name","encodedName","getEncodedNodeTypeName","applyFor","variables","_defineProperty","_templateObject","_taggedTemplateLiteral","fragment","types"],"sources":["getIsNodeTypeFragment.ts"],"sourcesContent":["import gql from 'graphql-tag';\nimport {encodeName} from './encodeName';\nimport {Fragment} from '~/fragments/PredefinedFragments';\n\nconst fragments:{[key:string]: Fragment} = {};\n\nexport const getNodeTypeFragment = (name: string) => {\n const encodedName = getEncodedNodeTypeName(name);\n if (!fragments[encodedName]) {\n fragments[encodedName] = {\n applyFor: 'node',\n variables: {\n [encodedName]: 'InputNodeTypesInput!'\n },\n gql: gql`fragment NodeType_${encodedName} on JCRNode {\n ${encodedName}:isNodeType(type: $${encodedName})\n }`\n };\n }\n\n return {\n fragment: fragments[encodedName],\n variables: {\n [encodedName]: {\n types: name\n }\n }\n };\n};\n\nexport const getEncodedNodeTypeName = (name:string) => 'nodeType_' + encodeName(name);\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,aAAa;AAC7B,SAAQC,UAAU;AAGlB,IAAMC,SAAkC,GAAG,CAAC,CAAC;AAE7C,OAAO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,IAAY,EAAK;EACjD,IAAMC,WAAW,GAAGC,sBAAsB,CAACF,IAAI,CAAC;EAChD,IAAI,CAACF,SAAS,CAACG,WAAW,CAAC,EAAE;IACzBH,SAAS,CAACG,WAAW,CAAC,GAAG;MACrBE,QAAQ,EAAE,MAAM;MAChBC,SAAS,EAAAC,eAAA,KACJJ,WAAW,EAAG,sBAAsB,CACxC;MACDL,GAAG,EAAEA,GAAG,CAAAU,eAAA,KAAAA,eAAA,GAAAC,sBAAA,yGAAqBN,WAAW,EAClCA,WAAW,EAAsBA,WAAW;IAEtD,CAAC;EACL;EAEA,OAAO;IACHO,QAAQ,EAAEV,SAAS,CAACG,WAAW,CAAC;IAChCG,SAAS,EAAAC,eAAA,KACJJ,WAAW,EAAG;MACXQ,KAAK,EAAET;IACX,CAAC;EAET,CAAC;AACL,CAAC;AAED,OAAO,IAAME,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAIF,IAAW;EAAA,OAAK,WAAW,GAAGH,UAAU,CAACG,IAAI,CAAC;AAAA"}
@@ -1,21 +1,17 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
3
  var _templateObject, _templateObject2;
2
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
4
  import gql from 'graphql-tag';
8
- import { encodeName } from './encodeName';
5
+ import { encodeName } from "./encodeName";
9
6
  var fragments = {};
10
7
  export var getPermissionFragment = function getPermissionFragment(name) {
11
8
  var encodedName = getEncodedPermissionName(name);
12
9
  if (!fragments[encodedName]) {
13
- var fragment = {
10
+ fragments[encodedName] = {
14
11
  applyFor: 'node',
15
12
  variables: _defineProperty({}, encodedName, 'String!'),
16
13
  gql: gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["fragment NodePermission_", " on JCRNode {\n ", ":hasPermission(permissionName: $", ")\n }"])), encodedName, encodedName, encodedName)
17
14
  };
18
- fragments[encodedName] = fragment;
19
15
  }
20
16
  return {
21
17
  fragment: fragments[encodedName],
@@ -25,12 +21,11 @@ export var getPermissionFragment = function getPermissionFragment(name) {
25
21
  export var getSitePermissionFragment = function getSitePermissionFragment(name) {
26
22
  var encodedName = getEncodedPermissionName(name);
27
23
  if (!fragments['site_' + encodedName]) {
28
- var fragment = {
24
+ fragments['site_' + encodedName] = {
29
25
  applyFor: 'node',
30
26
  variables: _defineProperty({}, encodedName, 'String!'),
31
27
  gql: gql(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["fragment SiteNodePermission_", " on JCRNode {\n site {\n ...NodeCacheRequiredFields\n ", ":hasPermission(permissionName: $", ")\n }\n }"])), encodedName, encodedName, encodedName)
32
28
  };
33
- fragments['site_' + encodedName] = fragment;
34
29
  }
35
30
  return {
36
31
  fragment: fragments['site_' + encodedName],
@@ -0,0 +1 @@
1
+ {"version":3,"names":["gql","encodeName","fragments","getPermissionFragment","name","encodedName","getEncodedPermissionName","applyFor","variables","_defineProperty","_templateObject","_taggedTemplateLiteral","fragment","getSitePermissionFragment","_templateObject2"],"sources":["getPermissionFragment.ts"],"sourcesContent":["import gql from 'graphql-tag';\nimport {encodeName} from './encodeName';\nimport {Fragment} from '~/fragments/PredefinedFragments';\n\nconst fragments:{[key:string]: Fragment} = {};\n\nexport const getPermissionFragment = (name: string) => {\n const encodedName = getEncodedPermissionName(name);\n if (!fragments[encodedName]) {\n fragments[encodedName] = {\n applyFor: 'node',\n variables: {\n [encodedName]: 'String!'\n },\n gql: gql`fragment NodePermission_${encodedName} on JCRNode {\n ${encodedName}:hasPermission(permissionName: $${encodedName})\n }`\n };\n }\n\n return {\n fragment: fragments[encodedName],\n variables: {\n [encodedName]: name\n }\n };\n};\n\nexport const getSitePermissionFragment = (name: string) => {\n const encodedName = getEncodedPermissionName(name);\n if (!fragments['site_' + encodedName]) {\n fragments['site_' + encodedName] = {\n applyFor: 'node',\n variables: {\n [encodedName]: 'String!'\n },\n gql: gql`fragment SiteNodePermission_${encodedName} on JCRNode {\n site {\n ...NodeCacheRequiredFields\n ${encodedName}:hasPermission(permissionName: $${encodedName})\n }\n }`\n };\n }\n\n return {\n fragment: fragments['site_' + encodedName],\n variables: {\n [encodedName]: name\n }\n };\n};\n\nexport const getEncodedPermissionName = (name: string) => 'permission_' + encodeName(name);\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,aAAa;AAC7B,SAAQC,UAAU;AAGlB,IAAMC,SAAkC,GAAG,CAAC,CAAC;AAE7C,OAAO,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,IAAY,EAAK;EACnD,IAAMC,WAAW,GAAGC,wBAAwB,CAACF,IAAI,CAAC;EAClD,IAAI,CAACF,SAAS,CAACG,WAAW,CAAC,EAAE;IACzBH,SAAS,CAACG,WAAW,CAAC,GAAG;MACrBE,QAAQ,EAAE,MAAM;MAChBC,SAAS,EAAAC,eAAA,KACJJ,WAAW,EAAG,SAAS,CAC3B;MACDL,GAAG,EAAEA,GAAG,CAAAU,eAAA,KAAAA,eAAA,GAAAC,sBAAA,4HAA2BN,WAAW,EACxCA,WAAW,EAAmCA,WAAW;IAEnE,CAAC;EACL;EAEA,OAAO;IACHO,QAAQ,EAAEV,SAAS,CAACG,WAAW,CAAC;IAChCG,SAAS,EAAAC,eAAA,KACJJ,WAAW,EAAGD,IAAI;EAE3B,CAAC;AACL,CAAC;AAED,OAAO,IAAMS,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAIT,IAAY,EAAK;EACvD,IAAMC,WAAW,GAAGC,wBAAwB,CAACF,IAAI,CAAC;EAClD,IAAI,CAACF,SAAS,CAAC,OAAO,GAAGG,WAAW,CAAC,EAAE;IACnCH,SAAS,CAAC,OAAO,GAAGG,WAAW,CAAC,GAAG;MAC/BE,QAAQ,EAAE,MAAM;MAChBC,SAAS,EAAAC,eAAA,KACJJ,WAAW,EAAG,SAAS,CAC3B;MACDL,GAAG,EAAEA,GAAG,CAAAc,gBAAA,KAAAA,gBAAA,GAAAH,sBAAA,+NAA+BN,WAAW,EAGxCA,WAAW,EAAmCA,WAAW;IAGvE,CAAC;EACL;EAEA,OAAO;IACHO,QAAQ,EAAEV,SAAS,CAAC,OAAO,GAAGG,WAAW,CAAC;IAC1CG,SAAS,EAAAC,eAAA,KACJJ,WAAW,EAAGD,IAAI;EAE3B,CAAC;AACL,CAAC;AAED,OAAO,IAAME,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAIF,IAAY;EAAA,OAAK,aAAa,GAAGH,UAAU,CAACG,IAAI,CAAC;AAAA"}
@@ -0,0 +1,24 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ var _templateObject;
4
+ import gql from 'graphql-tag';
5
+ import { encodeName } from "./encodeName";
6
+ var fragments = {};
7
+ export var getSubNodesCountFragment = function getSubNodesCountFragment(name) {
8
+ var encodedName = getEncodedSubNodesCountName(name);
9
+ if (!fragments[encodedName]) {
10
+ fragments[encodedName] = {
11
+ applyFor: 'node',
12
+ variables: _defineProperty({}, encodedName, '[String!]!'),
13
+ gql: gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["fragment SubNodesCount_", " on JCRNode {\n ", ": children(typesFilter: {types: $", "}) {\n pageInfo {\n totalCount\n }\n }\n }"])), encodedName, encodedName, encodedName)
14
+ };
15
+ }
16
+ return {
17
+ fragment: fragments[encodedName],
18
+ variables: _defineProperty({}, encodedName, [name])
19
+ };
20
+ };
21
+ export var getEncodedSubNodesCountName = function getEncodedSubNodesCountName(name) {
22
+ return 'subNodesCount_' + encodeName(name);
23
+ };
24
+ //# sourceMappingURL=getSubNodesCountFragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["gql","encodeName","fragments","getSubNodesCountFragment","name","encodedName","getEncodedSubNodesCountName","applyFor","variables","_defineProperty","_templateObject","_taggedTemplateLiteral","fragment"],"sources":["getSubNodesCountFragment.ts"],"sourcesContent":["import gql from 'graphql-tag';\nimport {encodeName} from './encodeName';\nimport {Fragment} from '~/fragments/PredefinedFragments';\n\nconst fragments:{[key:string]: Fragment} = {};\n\nexport const getSubNodesCountFragment = (name: string) => {\n const encodedName = getEncodedSubNodesCountName(name);\n if (!fragments[encodedName]) {\n fragments[encodedName] = {\n applyFor: 'node',\n variables: {\n [encodedName]: '[String!]!'\n },\n gql: gql`fragment SubNodesCount_${encodedName} on JCRNode {\n ${encodedName}: children(typesFilter: {types: $${encodedName}}) {\n pageInfo {\n totalCount\n }\n }\n }`\n };\n }\n\n return {\n fragment: fragments[encodedName],\n variables: {\n [encodedName]: [name]\n }\n };\n};\n\nexport const getEncodedSubNodesCountName = (name:string) => 'subNodesCount_' + encodeName(name);\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,aAAa;AAC7B,SAAQC,UAAU;AAGlB,IAAMC,SAAkC,GAAG,CAAC,CAAC;AAE7C,OAAO,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAIC,IAAY,EAAK;EACtD,IAAMC,WAAW,GAAGC,2BAA2B,CAACF,IAAI,CAAC;EACrD,IAAI,CAACF,SAAS,CAACG,WAAW,CAAC,EAAE;IACzBH,SAAS,CAACG,WAAW,CAAC,GAAG;MACrBE,QAAQ,EAAE,MAAM;MAChBC,SAAS,EAAAC,eAAA,KACJJ,WAAW,EAAG,YAAY,CAC9B;MACDL,GAAG,EAAEA,GAAG,CAAAU,eAAA,KAAAA,eAAA,GAAAC,sBAAA,6OAA0BN,WAAW,EACvCA,WAAW,EAAoCA,WAAW;IAMpE,CAAC;EACL;EAEA,OAAO;IACHO,QAAQ,EAAEV,SAAS,CAACG,WAAW,CAAC;IAChCG,SAAS,EAAAC,eAAA,KACJJ,WAAW,EAAG,CAACD,IAAI,CAAC;EAE7B,CAAC;AACL,CAAC;AAED,OAAO,IAAME,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAAIF,IAAW;EAAA,OAAK,gBAAgB,GAAGH,UAAU,CAACG,IAAI,CAAC;AAAA"}
@@ -0,0 +1,3 @@
1
+ export * from "./PredefinedFragments";
2
+ export * from "./fragments.utils";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './PredefinedFragments';\nexport * from './fragments.utils';\n"],"mappings":"AAAA;AACA"}
@@ -0,0 +1,6 @@
1
+ export * from "./useContentPreview";
2
+ export * from "./useNodeChecks";
3
+ export * from "./useNodeInfo";
4
+ export * from "./useSiteInfo";
5
+ export * from "./useTreeEntries";
6
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.js"],"sourcesContent":["export * from './useContentPreview';\nexport * from './useNodeChecks';\nexport * from './useNodeInfo';\nexport * from './useSiteInfo';\nexport * from './useTreeEntries';\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,kBAAkB"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './useContentPreview';\nexport * from './useNodeChecks';\nexport * from './useNodeInfo';\nexport * from './useSiteInfo';\nexport * from './useTreeEntries';\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA"}
@@ -0,0 +1,2 @@
1
+ export * from "./useContentPreview";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './useContentPreview';\n"],"mappings":"AAAA"}
@@ -1,6 +1,6 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
1
2
  var _templateObject;
2
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
3
  import gql from 'graphql-tag';
4
- import { mimeTypes, nodeCacheRequiredFields } from '../../fragments';
4
+ import { mimeTypes, nodeCacheRequiredFields } from "../../fragments";
5
5
  export var CONTENT_PREVIEW_QUERY = gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["query previewQueryByWorkspace($path: String!, $templateType: String!, $view: String!, $contextConfiguration: String!, $language: String!, $workspace: Workspace!, $requestAttributes: [InputRenderRequestAttributeInput]) {\n jcr(workspace: $workspace) {\n nodeByPath(path: $path) {\n id: uuid\n isFile: isNodeType(type: {types: [\"jnt:file\"]})\n path\n lastModified: property(name: \"jcr:lastModified\", language: $language) {\n value\n }\n renderedContent(templateType: $templateType, view: $view, contextConfiguration: $contextConfiguration, language: $language, requestAttributes: $requestAttributes) {\n output\n staticAssets(type: \"css\") {\n key\n }\n }\n ...NodeInfoResourceNode\n ...NodeCacheRequiredFields\n }\n }\n}", "", ""])), nodeCacheRequiredFields.gql, mimeTypes.gql);
6
6
  //# sourceMappingURL=useContentPreview.gql-queries.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["gql","mimeTypes","nodeCacheRequiredFields","CONTENT_PREVIEW_QUERY","_templateObject","_taggedTemplateLiteral"],"sources":["useContentPreview.gql-queries.js"],"sourcesContent":["import gql from 'graphql-tag';\nimport {mimeTypes, nodeCacheRequiredFields} from '../../fragments';\n\nexport const CONTENT_PREVIEW_QUERY = gql`query previewQueryByWorkspace($path: String!, $templateType: String!, $view: String!, $contextConfiguration: String!, $language: String!, $workspace: Workspace!, $requestAttributes: [InputRenderRequestAttributeInput]) {\n jcr(workspace: $workspace) {\n nodeByPath(path: $path) {\n id: uuid\n isFile: isNodeType(type: {types: [\"jnt:file\"]})\n path\n lastModified: property(name: \"jcr:lastModified\", language: $language) {\n value\n }\n renderedContent(templateType: $templateType, view: $view, contextConfiguration: $contextConfiguration, language: $language, requestAttributes: $requestAttributes) {\n output\n staticAssets(type: \"css\") {\n key\n }\n }\n ...NodeInfoResourceNode\n ...NodeCacheRequiredFields\n }\n }\n}${nodeCacheRequiredFields.gql}${mimeTypes.gql}`;\n"],"mappings":";;AAAA,OAAOA,GAAG,MAAM,aAAa;AAC7B,SAAQC,SAAS,EAAEC,uBAAuB,QAAO,iBAAiB;AAElE,OAAO,IAAMC,qBAAqB,GAAGH,GAAG,CAAAI,eAAA,KAAAA,eAAA,GAAAC,sBAAA,26BAmBrCH,uBAAuB,CAACF,GAAG,EAAGC,SAAS,CAACD,GAAG,CAAE"}
1
+ {"version":3,"names":["gql","mimeTypes","nodeCacheRequiredFields","CONTENT_PREVIEW_QUERY","_templateObject","_taggedTemplateLiteral"],"sources":["useContentPreview.gql-queries.ts"],"sourcesContent":["import gql from 'graphql-tag';\nimport {mimeTypes, nodeCacheRequiredFields} from '../../fragments';\n\nexport const CONTENT_PREVIEW_QUERY = gql`query previewQueryByWorkspace($path: String!, $templateType: String!, $view: String!, $contextConfiguration: String!, $language: String!, $workspace: Workspace!, $requestAttributes: [InputRenderRequestAttributeInput]) {\n jcr(workspace: $workspace) {\n nodeByPath(path: $path) {\n id: uuid\n isFile: isNodeType(type: {types: [\"jnt:file\"]})\n path\n lastModified: property(name: \"jcr:lastModified\", language: $language) {\n value\n }\n renderedContent(templateType: $templateType, view: $view, contextConfiguration: $contextConfiguration, language: $language, requestAttributes: $requestAttributes) {\n output\n staticAssets(type: \"css\") {\n key\n }\n }\n ...NodeInfoResourceNode\n ...NodeCacheRequiredFields\n }\n }\n}${nodeCacheRequiredFields.gql}${mimeTypes.gql}`;\n"],"mappings":";;AAAA,OAAOA,GAAG,MAAM,aAAa;AAC7B,SAAQC,SAAS,EAAEC,uBAAuB;AAE1C,OAAO,IAAMC,qBAAqB,GAAGH,GAAG,CAAAI,eAAA,KAAAA,eAAA,GAAAC,sBAAA,26BAmBrCH,uBAAuB,CAACF,GAAG,EAAGC,SAAS,CAACD,GAAG,CAAE"}
@@ -1,5 +1,5 @@
1
- import { useQuery } from 'react-apollo';
2
- import { CONTENT_PREVIEW_QUERY } from './useContentPreview.gql-queries';
1
+ import { useQuery } from '@apollo/client';
2
+ import { CONTENT_PREVIEW_QUERY } from "./useContentPreview.gql-queries";
3
3
  export var useContentPreview = function useContentPreview(_ref) {
4
4
  var path = _ref.path,
5
5
  workspace = _ref.workspace,
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useQuery","CONTENT_PREVIEW_QUERY","useContentPreview","_ref","path","workspace","language","templateType","view","contextConfiguration","requestAttributes","fetchPolicy","variables","toUpperCase","errorPolicy"],"sources":["useContentPreview.ts"],"sourcesContent":["import {FetchPolicy, useQuery} from '@apollo/client';\nimport {CONTENT_PREVIEW_QUERY} from './useContentPreview.gql-queries';\n\ntype RequestAttribute = {\n name: string, value:string\n}\n\ntype UseContentPreviewType = {\n path: string,\n workspace: string,\n language: string,\n templateType: string,\n view: string,\n contextConfiguration: string,\n requestAttributes?: RequestAttribute[],\n fetchPolicy?: FetchPolicy\n};\n\nexport const useContentPreview = ({\n path,\n workspace,\n language,\n templateType,\n view,\n contextConfiguration,\n requestAttributes,\n fetchPolicy\n}: UseContentPreviewType) => {\n const variables = {\n path,\n templateType,\n view,\n contextConfiguration,\n language,\n workspace: workspace.toUpperCase(),\n requestAttributes\n };\n\n return useQuery(CONTENT_PREVIEW_QUERY, {\n variables,\n errorPolicy: 'all',\n fetchPolicy\n });\n};\n"],"mappings":"AAAA,SAAqBA,QAAQ,QAAO,gBAAgB;AACpD,SAAQC,qBAAqB;AAiB7B,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EASD;EAAA,IARzBC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,IAAI,GAAAL,IAAA,CAAJK,IAAI;IACJC,oBAAoB,GAAAN,IAAA,CAApBM,oBAAoB;IACpBC,iBAAiB,GAAAP,IAAA,CAAjBO,iBAAiB;IACjBC,WAAW,GAAAR,IAAA,CAAXQ,WAAW;EAEX,IAAMC,SAAS,GAAG;IACdR,IAAI,EAAJA,IAAI;IACJG,YAAY,EAAZA,YAAY;IACZC,IAAI,EAAJA,IAAI;IACJC,oBAAoB,EAApBA,oBAAoB;IACpBH,QAAQ,EAARA,QAAQ;IACRD,SAAS,EAAEA,SAAS,CAACQ,WAAW,CAAC,CAAC;IAClCH,iBAAiB,EAAjBA;EACJ,CAAC;EAED,OAAOV,QAAQ,CAACC,qBAAqB,EAAE;IACnCW,SAAS,EAATA,SAAS;IACTE,WAAW,EAAE,KAAK;IAClBH,WAAW,EAAXA;EACJ,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./useDeepCompareMemo";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './useDeepCompareMemo';\n"],"mappings":"AAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useRef","deepEquals","useDeepCompareMemoize","value","ref","current"],"sources":["useDeepCompareMemo.ts"],"sourcesContent":["import {useRef} from 'react';\nimport deepEquals from 'fast-deep-equal';\n\nexport const useDeepCompareMemoize = <T>(value: T) => {\n const ref = useRef<T>(value);\n\n if (!deepEquals(value, ref.current)) {\n ref.current = value;\n }\n\n return ref.current;\n};\n"],"mappings":"AAAA,SAAQA,MAAM,QAAO,OAAO;AAC5B,OAAOC,UAAU,MAAM,iBAAiB;AAExC,OAAO,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAOC,KAAQ,EAAK;EAClD,IAAMC,GAAG,GAAGJ,MAAM,CAAIG,KAAK,CAAC;EAE5B,IAAI,CAACF,UAAU,CAACE,KAAK,EAAEC,GAAG,CAACC,OAAO,CAAC,EAAE;IACjCD,GAAG,CAACC,OAAO,GAAGF,KAAK;EACvB;EAEA,OAAOC,GAAG,CAACC,OAAO;AACtB,CAAC"}
@@ -1,2 +1,2 @@
1
- export * from './useNodeChecks';
1
+ export * from "./useNodeChecks";
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './useNodeChecks';\n"],"mappings":"AAAA"}
@@ -1,14 +1,10 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["requiredPermission", "requiredSitePermission", "showOnNodeTypes", "hideOnNodeTypes", "requireModuleInstalledOnSite", "showForPaths", "hideForPaths"],
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["requiredPermission", "requiredSitePermission", "showOnNodeTypes", "hideOnNodeTypes", "requireModuleInstalledOnSite", "showForPaths", "hideForPaths", "hideOnExternal"],
3
4
  _excluded2 = ["node", "nodes", "loading"];
4
5
  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; }
5
6
  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; }
6
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
- import { useNodeInfo } from '../useNodeInfo';
7
+ import { useNodeInfo } from "../useNodeInfo";
12
8
  var evaluateVisibilityPaths = function evaluateVisibilityPaths(visible, visibilityPaths, nodePath) {
13
9
  for (var i = 0; i < visibilityPaths.length; i++) {
14
10
  if (new RegExp(visibilityPaths[i]).test(nodePath)) {
@@ -33,6 +29,7 @@ export var useNodeChecks = function useNodeChecks(variables, options, queryOptio
33
29
  requireModuleInstalledOnSite = options.requireModuleInstalledOnSite,
34
30
  showForPaths = options.showForPaths,
35
31
  hideForPaths = options.hideForPaths,
32
+ hideOnExternal = options.hideOnExternal,
36
33
  othersOptions = _objectWithoutProperties(options, _excluded);
37
34
  var useNodeInfoOptions = _objectSpread({}, othersOptions);
38
35
  var requiredPermissions = typeof requiredPermission === 'string' ? [requiredPermission] : requiredPermission;
@@ -60,18 +57,18 @@ export var useNodeChecks = function useNodeChecks(variables, options, queryOptio
60
57
  loading: loading
61
58
  }, othersResults);
62
59
  }
63
- var doNodeCheck = function doNodeCheck(node) {
60
+ var doNodeCheck = function doNodeCheck(currentNode) {
64
61
  return (!requiredPermissions || requiredPermissions.reduce(function (acc, val) {
65
- return acc || node[val];
62
+ return acc || currentNode[val];
66
63
  }, false)) && (!requiredSitePermissions || requiredSitePermissions.reduce(function (acc, val) {
67
- return acc || node.site[val];
64
+ return acc || currentNode.site[val];
68
65
  }, false)) && (!showOnNodeTypes || showOnNodeTypes.reduce(function (acc, val) {
69
- return acc || node[val];
66
+ return acc || currentNode[val];
70
67
  }, false)) && (!hideOnNodeTypes || !hideOnNodeTypes.reduce(function (acc, val) {
71
- return acc || node[val];
68
+ return acc || currentNode[val];
72
69
  }, false)) && (!requireModuleInstalledOnSite || requireModuleInstalledOnSite.reduce(function (acc, val) {
73
- return acc && node.site.installedModulesWithAllDependencies.includes(val);
74
- }, true)) && (!hideForPaths || evaluateVisibilityPaths(false, hideForPaths, node.path || variables.path)) && (!showForPaths || evaluateVisibilityPaths(true, showForPaths, node.path || variables.path));
70
+ return acc && currentNode.site.installedModulesWithAllDependencies.includes(val);
71
+ }, true)) && (!hideForPaths || evaluateVisibilityPaths(false, hideForPaths, currentNode.path || variables.path)) && (!showForPaths || evaluateVisibilityPaths(true, showForPaths, currentNode.path || variables.path)) && hideOnExternal && !currentNode.isExternal;
75
72
  };
76
73
  var result = node ? doNodeCheck(node) : nodes.reduce(function (acc, val) {
77
74
  return acc && doNodeCheck(val);
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useNodeInfo","evaluateVisibilityPaths","visible","visibilityPaths","nodePath","i","length","RegExp","test","addArrayOptionValues","newValue","useNodeInfoOptions","useNodeInfoKey","concat","filter","item","indexOf","useNodeChecks","variables","options","queryOptions","requiredPermission","requiredSitePermission","showOnNodeTypes","hideOnNodeTypes","requireModuleInstalledOnSite","showForPaths","hideForPaths","hideOnExternal","othersOptions","_objectWithoutProperties","_excluded","_objectSpread","requiredPermissions","requiredSitePermissions","getSiteInstalledModules","_useNodeInfo","node","nodes","loading","othersResults","_excluded2","checksResult","doNodeCheck","currentNode","reduce","acc","val","site","installedModulesWithAllDependencies","includes","path","isExternal","result"],"sources":["useNodeChecks.ts"],"sourcesContent":["import {NodeInfoResult, useNodeInfo} from '../useNodeInfo';\nimport {NodeInfoOptions} from '../useNodeInfo/useNodeInfo.gql-queries';\nimport {WatchQueryOptions} from '@apollo/client';\n\nexport type NodeCheckOptions = NodeInfoOptions & Partial<{\n requiredPermission: string | string[],\n requiredSitePermission: string | string[],\n showOnNodeTypes: string[],\n hideOnNodeTypes: string[],\n requireModuleInstalledOnSite: string[],\n showForPaths: string[],\n hideForPaths: string[],\n hideOnExternal: boolean\n}>\n\nexport type NodeCheckResult = NodeInfoResult & Partial<{\n checksResult: boolean,\n}>\n\nconst evaluateVisibilityPaths = (visible: boolean, visibilityPaths: string[], nodePath: string) => {\n for (let i = 0; i < visibilityPaths.length; i++) {\n if (new RegExp(visibilityPaths[i]).test(nodePath)) {\n return visible;\n }\n }\n\n return !visible;\n};\n\nfunction addArrayOptionValues(newValue: string[], useNodeInfoOptions: NodeInfoOptions, useNodeInfoKey: 'getPermissions' | 'getSitePermissions' |'getIsNodeTypes'| 'getProperties') {\n if (newValue) {\n useNodeInfoOptions[useNodeInfoKey] = useNodeInfoOptions[useNodeInfoKey] || [];\n useNodeInfoOptions[useNodeInfoKey] = useNodeInfoOptions[useNodeInfoKey].concat(newValue.filter(item => useNodeInfoOptions[useNodeInfoKey].indexOf(item) < 0));\n }\n}\n\nexport const useNodeChecks = (variables: {[key:string]: any}, options?: NodeCheckOptions, queryOptions?: WatchQueryOptions): NodeCheckResult => {\n const {requiredPermission, requiredSitePermission, showOnNodeTypes, hideOnNodeTypes, requireModuleInstalledOnSite, showForPaths, hideForPaths, hideOnExternal, ...othersOptions} = options;\n const useNodeInfoOptions = {...othersOptions};\n\n const requiredPermissions = (typeof requiredPermission === 'string') ? [requiredPermission] : requiredPermission;\n const requiredSitePermissions = (typeof requiredSitePermission === 'string') ? [requiredSitePermission] : requiredSitePermission;\n\n addArrayOptionValues(requiredPermissions, useNodeInfoOptions, 'getPermissions');\n addArrayOptionValues(requiredSitePermissions, useNodeInfoOptions, 'getSitePermissions');\n addArrayOptionValues(showOnNodeTypes, useNodeInfoOptions, 'getIsNodeTypes');\n addArrayOptionValues(hideOnNodeTypes, useNodeInfoOptions, 'getIsNodeTypes');\n\n if (requireModuleInstalledOnSite) {\n useNodeInfoOptions.getSiteInstalledModules = true;\n }\n\n const {node, nodes, loading, ...othersResults} = useNodeInfo(variables, useNodeInfoOptions, queryOptions);\n\n if (loading) {\n return {loading, ...othersResults};\n }\n\n if (!node && !nodes) {\n return {checksResult: false, loading, ...othersResults};\n }\n\n const doNodeCheck = (currentNode: any) =>\n (!requiredPermissions || requiredPermissions.reduce((acc, val) => acc || currentNode[val], false)) &&\n (!requiredSitePermissions || requiredSitePermissions.reduce((acc, val) => acc || currentNode.site[val], false)) &&\n (!showOnNodeTypes || showOnNodeTypes.reduce((acc, val) => acc || currentNode[val], false)) &&\n (!hideOnNodeTypes || !hideOnNodeTypes.reduce((acc, val) => acc || currentNode[val], false)) &&\n (!requireModuleInstalledOnSite || requireModuleInstalledOnSite.reduce((acc, val) => acc && currentNode.site.installedModulesWithAllDependencies.includes(val), true)) &&\n (!hideForPaths || evaluateVisibilityPaths(false, hideForPaths, currentNode.path || variables.path)) &&\n (!showForPaths || evaluateVisibilityPaths(true, showForPaths, currentNode.path || variables.path)) &&\n (hideOnExternal && !currentNode.isExternal);\n\n const result = node ? doNodeCheck(node) : nodes.reduce((acc, val) => acc && doNodeCheck(val), true);\n\n return {node, nodes, checksResult: result, loading, ...othersResults};\n};\n"],"mappings":";;;;;;AAAA,SAAwBA,WAAW;AAmBnC,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAIC,OAAgB,EAAEC,eAAyB,EAAEC,QAAgB,EAAK;EAC/F,KAAK,IAAIC,CAAC,GAAG,CAAC,EAA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QK,IAAI,EAAJA,IAAI;IAAEC,KAAK,EAALA,KAAK;IAAEI,YAAY,EAAEW,MAAM;IAAEd,OAAO,EAAPA;EAAO,GAAKC,aAAa;AACxE,CAAC"}
@@ -1,2 +1,2 @@
1
- export * from './useNodeInfo';
1
+ export * from "./useNodeInfo";
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './useNodeInfo';\n"],"mappings":"AAAA"}
@@ -0,0 +1,43 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { validOptions } from "./useNodeInfo.gql-queries";
3
+ import { useRef } from 'react';
4
+ import deepEquals from 'fast-deep-equal';
5
+ var clean = function clean(obj) {
6
+ return obj && Object.fromEntries(Object.entries(obj).filter(function (_ref) {
7
+ var _ref2 = _slicedToArray(_ref, 2),
8
+ v = _ref2[1];
9
+ return v !== null && v !== undefined;
10
+ }));
11
+ };
12
+ var cleanVariables = function cleanVariables(obj) {
13
+ return obj && Object.fromEntries(Object.entries(obj).filter(function (_ref3) {
14
+ var _ref4 = _slicedToArray(_ref3, 2),
15
+ v = _ref4[1];
16
+ return v !== null && v !== undefined;
17
+ }));
18
+ };
19
+ var cleanOptions = function cleanOptions(obj) {
20
+ return obj && Object.fromEntries(Object.entries(obj).filter(function (_ref5) {
21
+ var _ref6 = _slicedToArray(_ref5, 2),
22
+ k = _ref6[0],
23
+ v = _ref6[1];
24
+ return v !== null && v !== undefined && validOptions.indexOf(k) !== -1;
25
+ }));
26
+ };
27
+ export function useMemoRequest(variables, queryOptions, options, setResult) {
28
+ variables = cleanVariables(variables);
29
+ queryOptions = clean(queryOptions);
30
+ options = cleanOptions(options);
31
+ var requestValue = {
32
+ variables: variables,
33
+ queryOptions: queryOptions,
34
+ options: options,
35
+ setResult: setResult
36
+ };
37
+ var requestRef = useRef(requestValue);
38
+ if (!deepEquals(variables, requestRef.current.variables) || !deepEquals(queryOptions, requestRef.current.queryOptions) || !deepEquals(options, requestRef.current.options)) {
39
+ requestRef.current = requestValue;
40
+ }
41
+ return [requestRef.current, requestRef.current === requestValue];
42
+ }
43
+ //# sourceMappingURL=useMemoRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["validOptions","useRef","deepEquals","clean","obj","Object","fromEntries","entries","filter","_ref","_ref2","_slicedToArray","v","undefined","cleanVariables","_ref3","_ref4","cleanOptions","_ref5","_ref6","k","indexOf","useMemoRequest","variables","queryOptions","options","setResult","requestValue","requestRef","current"],"sources":["useMemoRequest.ts"],"sourcesContent":["import {NodeInfoOptions, validOptions} from './useNodeInfo.gql-queries';\nimport {useRef} from 'react';\nimport deepEquals from 'fast-deep-equal';\nimport {WatchQueryOptions} from '@apollo/client';\nimport {QueuedRequest} from './useNodeInfo';\n\nconst clean = (obj: object) => obj && Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== null && v !== undefined));\nconst cleanVariables = (obj: object) => obj && Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== null && v !== undefined));\nconst cleanOptions = (obj: NodeInfoOptions) => obj && Object.fromEntries(Object.entries(obj).filter(([k, v]) => v !== null && v !== undefined && validOptions.indexOf(k) !== -1));\n\nexport function useMemoRequest(variables: {[key:string]: unknown}, queryOptions: Partial<WatchQueryOptions>, options: NodeInfoOptions, setResult: (data:any) => void): [QueuedRequest, boolean] {\n variables = cleanVariables(variables);\n queryOptions = clean(queryOptions);\n options = cleanOptions(options);\n\n const requestValue = {variables, queryOptions, options, setResult};\n const requestRef = useRef<QueuedRequest>(requestValue);\n\n if (!deepEquals(variables, requestRef.current.variables) || !deepEquals(queryOptions, requestRef.current.queryOptions) || !deepEquals(options, requestRef.current.options)) {\n requestRef.current = requestValue;\n }\n\n return [requestRef.current, requestRef.current === requestValue];\n}\n"],"mappings":";AAAA,SAAyBA,YAAY;AACrC,SAAQC,MAAM,QAAO,OAAO;AAC5B,OAAOC,UAAU,MAAM,iBAAiB;AAIxC,IAAMC,KAAK,GA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