@startinblox/core 0.17.21-beta.2 → 0.17.21-beta.6

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 (258) hide show
  1. package/dist/_snowpack/env.js +3 -0
  2. package/dist/_snowpack/pkg/autolinker.js +4281 -0
  3. package/dist/_snowpack/pkg/autolinker.js.map +1 -0
  4. package/dist/_snowpack/pkg/autolinker.js.map.proxy.js +1 -0
  5. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js +377 -0
  6. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js.map +1 -0
  7. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js.map.proxy.js +1 -0
  8. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js +22 -0
  9. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map +1 -0
  10. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map.proxy.js +1 -0
  11. package/dist/_snowpack/pkg/common/decode-a4c334cf.js +216 -0
  12. package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map +1 -0
  13. package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map.proxy.js +1 -0
  14. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js +1119 -0
  15. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map +1 -0
  16. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map.proxy.js +1 -0
  17. package/dist/_snowpack/pkg/delta-markdown-for-quill.js +25677 -0
  18. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +1 -0
  19. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map.proxy.js +1 -0
  20. package/dist/_snowpack/pkg/dialog-polyfill.js +859 -0
  21. package/dist/_snowpack/pkg/dialog-polyfill.js.map +1 -0
  22. package/dist/_snowpack/pkg/dialog-polyfill.js.map.proxy.js +1 -0
  23. package/dist/_snowpack/pkg/fusejs.js +1783 -0
  24. package/dist/_snowpack/pkg/fusejs.js.map +1 -0
  25. package/dist/_snowpack/pkg/fusejs.js.map.proxy.js +1 -0
  26. package/dist/_snowpack/pkg/import-map.json +23 -0
  27. package/dist/_snowpack/pkg/jsonld-context-parser.js +804 -0
  28. package/dist/_snowpack/pkg/jsonld-context-parser.js.map +1 -0
  29. package/dist/_snowpack/pkg/jsonld-context-parser.js.map.proxy.js +1 -0
  30. package/dist/_snowpack/pkg/leaflet/dist/leaflet.css +640 -0
  31. package/dist/_snowpack/pkg/leaflet/dist/leaflet.css.proxy.js +10 -0
  32. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css +60 -0
  33. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +10 -0
  34. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css +14 -0
  35. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +10 -0
  36. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +40 -0
  37. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +1 -0
  38. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map.proxy.js +1 -0
  39. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +46 -0
  40. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +1 -0
  41. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map.proxy.js +1 -0
  42. package/dist/_snowpack/pkg/lit-html/directives/until.js +88 -0
  43. package/dist/_snowpack/pkg/lit-html/directives/until.js.map +1 -0
  44. package/dist/_snowpack/pkg/lit-html/directives/until.js.map.proxy.js +1 -0
  45. package/dist/_snowpack/pkg/lit-html.js +92 -0
  46. package/dist/_snowpack/pkg/lit-html.js.map +1 -0
  47. package/dist/_snowpack/pkg/lit-html.js.map.proxy.js +1 -0
  48. package/dist/_snowpack/pkg/markdown-it.js +11860 -0
  49. package/dist/_snowpack/pkg/markdown-it.js.map +1 -0
  50. package/dist/_snowpack/pkg/markdown-it.js.map.proxy.js +1 -0
  51. package/dist/_snowpack/pkg/quill/dist/quill.snow.css +945 -0
  52. package/dist/_snowpack/pkg/quill/dist/quill.snow.css.proxy.js +10 -0
  53. package/dist/_snowpack/pkg/quill-delta-to-markdown.js +1029 -0
  54. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +1 -0
  55. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map.proxy.js +1 -0
  56. package/dist/_snowpack/pkg/quill.js +13382 -0
  57. package/dist/_snowpack/pkg/quill.js.map +1 -0
  58. package/dist/_snowpack/pkg/quill.js.map.proxy.js +1 -0
  59. package/dist/_snowpack/pkg/slim-select.js +4 -0
  60. package/dist/_snowpack/pkg/slim-select.js.map +1 -0
  61. package/dist/_snowpack/pkg/slim-select.js.map.proxy.js +1 -0
  62. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +1164 -0
  63. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +10 -0
  64. package/dist/_snowpack/pkg/tui-calendar.js +42285 -0
  65. package/dist/_snowpack/pkg/tui-calendar.js.map +1 -0
  66. package/dist/_snowpack/pkg/tui-calendar.js.map.proxy.js +1 -0
  67. package/dist/components/solid-ac-checker.js +51 -0
  68. package/dist/components/solid-ac-checker.js.map +1 -0
  69. package/dist/components/solid-calendar.js +87 -0
  70. package/dist/components/solid-calendar.js.map +1 -0
  71. package/dist/components/solid-delete.js +111 -0
  72. package/dist/components/solid-delete.js.map +1 -0
  73. package/dist/components/solid-display.js +194 -0
  74. package/dist/components/solid-display.js.map +1 -0
  75. package/dist/components/solid-form-search.js +226 -0
  76. package/dist/components/solid-form-search.js.map +1 -0
  77. package/dist/components/solid-form.js +354 -0
  78. package/dist/components/solid-form.js.map +1 -0
  79. package/dist/components/solid-lang.js +46 -0
  80. package/dist/components/solid-lang.js.map +1 -0
  81. package/dist/components/solid-map.js +242 -0
  82. package/dist/components/solid-map.js.map +1 -0
  83. package/dist/components/solid-table.js +263 -0
  84. package/dist/components/solid-table.js.map +1 -0
  85. package/dist/components/solid-widget.js +94 -0
  86. package/dist/components/solid-widget.js.map +1 -0
  87. package/dist/import.css +4 -0
  88. package/dist/index.js +43 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/libs/Component.js +19 -0
  91. package/dist/libs/Component.js.map +1 -0
  92. package/dist/libs/ComponentFactory.js +196 -0
  93. package/dist/libs/ComponentFactory.js.map +1 -0
  94. package/dist/libs/Compositor.js +103 -0
  95. package/dist/libs/Compositor.js.map +1 -0
  96. package/dist/libs/Sib.js +58 -0
  97. package/dist/libs/Sib.js.map +1 -0
  98. package/dist/libs/helpers.js +219 -0
  99. package/dist/libs/helpers.js.map +1 -0
  100. package/dist/libs/interfaces.js +6 -0
  101. package/dist/libs/interfaces.js.map +1 -0
  102. package/dist/libs/lit-helpers.js +169 -0
  103. package/dist/libs/lit-helpers.js.map +1 -0
  104. package/dist/libs/polyfills.js +40 -0
  105. package/dist/libs/polyfills.js.map +1 -0
  106. package/dist/libs/store/store.js +860 -0
  107. package/dist/libs/store/store.js.map +1 -0
  108. package/dist/locales/en.json +10 -0
  109. package/dist/locales/en.json.proxy.js +2 -0
  110. package/dist/locales/fr.json +10 -0
  111. package/dist/locales/fr.json.proxy.js +2 -0
  112. package/dist/mixins/attributeBinderMixin.js +124 -0
  113. package/dist/mixins/attributeBinderMixin.js.map +1 -0
  114. package/dist/mixins/contextMixin.js +28 -0
  115. package/dist/mixins/contextMixin.js.map +1 -0
  116. package/dist/mixins/counterMixin.js +75 -0
  117. package/dist/mixins/counterMixin.js.map +1 -0
  118. package/dist/mixins/federationMixin.js +63 -0
  119. package/dist/mixins/federationMixin.js.map +1 -0
  120. package/dist/mixins/filterMixin.js +195 -0
  121. package/dist/mixins/filterMixin.js.map +1 -0
  122. package/dist/mixins/grouperMixin.js +80 -0
  123. package/dist/mixins/grouperMixin.js.map +1 -0
  124. package/dist/mixins/highlighterMixin.js +42 -0
  125. package/dist/mixins/highlighterMixin.js.map +1 -0
  126. package/dist/mixins/interfaces.js +8 -0
  127. package/dist/mixins/interfaces.js.map +1 -0
  128. package/dist/mixins/listMixin.js +136 -0
  129. package/dist/mixins/listMixin.js.map +1 -0
  130. package/dist/mixins/nextMixin.js +26 -0
  131. package/dist/mixins/nextMixin.js.map +1 -0
  132. package/dist/mixins/paginateMixin.js +110 -0
  133. package/dist/mixins/paginateMixin.js.map +1 -0
  134. package/dist/mixins/requiredMixin.js +34 -0
  135. package/dist/mixins/requiredMixin.js.map +1 -0
  136. package/dist/mixins/sorterMixin.js +149 -0
  137. package/dist/mixins/sorterMixin.js.map +1 -0
  138. package/dist/mixins/storeMixin.js +102 -0
  139. package/dist/mixins/storeMixin.js.map +1 -0
  140. package/dist/mixins/translationMixin.js +68 -0
  141. package/dist/mixins/translationMixin.js.map +1 -0
  142. package/dist/mixins/validationMixin.js +113 -0
  143. package/dist/mixins/validationMixin.js.map +1 -0
  144. package/dist/mixins/widgetMixin.js +447 -0
  145. package/dist/mixins/widgetMixin.js.map +1 -0
  146. package/dist/new-widgets/attributeMixins/actionMixin.js +14 -0
  147. package/dist/new-widgets/attributeMixins/actionMixin.js.map +1 -0
  148. package/dist/new-widgets/attributeMixins/blankMixin.js +10 -0
  149. package/dist/new-widgets/attributeMixins/blankMixin.js.map +1 -0
  150. package/dist/new-widgets/attributeMixins/booleanMixin.js +10 -0
  151. package/dist/new-widgets/attributeMixins/booleanMixin.js.map +1 -0
  152. package/dist/new-widgets/attributeMixins/index.js +20 -0
  153. package/dist/new-widgets/attributeMixins/index.js.map +1 -0
  154. package/dist/new-widgets/attributeMixins/mailtoMixin.js +10 -0
  155. package/dist/new-widgets/attributeMixins/mailtoMixin.js.map +1 -0
  156. package/dist/new-widgets/attributeMixins/multipleMixin.js +28 -0
  157. package/dist/new-widgets/attributeMixins/multipleMixin.js.map +1 -0
  158. package/dist/new-widgets/attributeMixins/numberMixin.js +10 -0
  159. package/dist/new-widgets/attributeMixins/numberMixin.js.map +1 -0
  160. package/dist/new-widgets/attributeMixins/placeholderMixin.js +19 -0
  161. package/dist/new-widgets/attributeMixins/placeholderMixin.js.map +1 -0
  162. package/dist/new-widgets/attributeMixins/telMixin.js +10 -0
  163. package/dist/new-widgets/attributeMixins/telMixin.js.map +1 -0
  164. package/dist/new-widgets/baseWidgetMixin.js +122 -0
  165. package/dist/new-widgets/baseWidgetMixin.js.map +1 -0
  166. package/dist/new-widgets/callbackMixins/autocompletionMixin.js +104 -0
  167. package/dist/new-widgets/callbackMixins/autocompletionMixin.js.map +1 -0
  168. package/dist/new-widgets/callbackMixins/index.js +8 -0
  169. package/dist/new-widgets/callbackMixins/index.js.map +1 -0
  170. package/dist/new-widgets/callbackMixins/richtextMixin.js +42 -0
  171. package/dist/new-widgets/callbackMixins/richtextMixin.js.map +1 -0
  172. package/dist/new-widgets/callbackMixins/slimselect.css +2 -0
  173. package/dist/new-widgets/callbackMixins/slimselect.css.proxy.js +10 -0
  174. package/dist/new-widgets/new-widget-factory.js +96 -0
  175. package/dist/new-widgets/new-widget-factory.js.map +1 -0
  176. package/dist/new-widgets/templateAdditionMixins/addableMixin.js +41 -0
  177. package/dist/new-widgets/templateAdditionMixins/addableMixin.js.map +1 -0
  178. package/dist/new-widgets/templateAdditionMixins/index.js +14 -0
  179. package/dist/new-widgets/templateAdditionMixins/index.js.map +1 -0
  180. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +29 -0
  181. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js.map +1 -0
  182. package/dist/new-widgets/templateAdditionMixins/labelMixin.js +31 -0
  183. package/dist/new-widgets/templateAdditionMixins/labelMixin.js.map +1 -0
  184. package/dist/new-widgets/templates/defaultTemplatesDirectory.js +36 -0
  185. package/dist/new-widgets/templates/defaultTemplatesDirectory.js.map +1 -0
  186. package/dist/new-widgets/templates/displayTemplatesDirectory.js +90 -0
  187. package/dist/new-widgets/templates/displayTemplatesDirectory.js.map +1 -0
  188. package/dist/new-widgets/templates/formTemplatesDirectory.js +397 -0
  189. package/dist/new-widgets/templates/formTemplatesDirectory.js.map +1 -0
  190. package/dist/new-widgets/templates/groupTemplatesDirectory.js +21 -0
  191. package/dist/new-widgets/templates/groupTemplatesDirectory.js.map +1 -0
  192. package/dist/new-widgets/templates/index.js +7 -0
  193. package/dist/new-widgets/templates/index.js.map +1 -0
  194. package/dist/new-widgets/templates/setTemplatesDirectory.js +49 -0
  195. package/dist/new-widgets/templates/setTemplatesDirectory.js.map +1 -0
  196. package/dist/new-widgets/templatesDependencies/altMixin.js +13 -0
  197. package/dist/new-widgets/templatesDependencies/altMixin.js.map +1 -0
  198. package/dist/new-widgets/templatesDependencies/editableMixin.js +77 -0
  199. package/dist/new-widgets/templatesDependencies/editableMixin.js.map +1 -0
  200. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +38 -0
  201. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js.map +1 -0
  202. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +14 -0
  203. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js.map +1 -0
  204. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +51 -0
  205. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js.map +1 -0
  206. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +66 -0
  207. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js.map +1 -0
  208. package/dist/new-widgets/templatesDependencies/formFileMixin.js +81 -0
  209. package/dist/new-widgets/templatesDependencies/formFileMixin.js.map +1 -0
  210. package/dist/new-widgets/templatesDependencies/formLengthMixin.js +19 -0
  211. package/dist/new-widgets/templatesDependencies/formLengthMixin.js.map +1 -0
  212. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +19 -0
  213. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js.map +1 -0
  214. package/dist/new-widgets/templatesDependencies/formMixin.js +66 -0
  215. package/dist/new-widgets/templatesDependencies/formMixin.js.map +1 -0
  216. package/dist/new-widgets/templatesDependencies/formNumberMixin.js +14 -0
  217. package/dist/new-widgets/templatesDependencies/formNumberMixin.js.map +1 -0
  218. package/dist/new-widgets/templatesDependencies/formRadioMixin.js +16 -0
  219. package/dist/new-widgets/templatesDependencies/formRadioMixin.js.map +1 -0
  220. package/dist/new-widgets/templatesDependencies/formStepMixin.js +13 -0
  221. package/dist/new-widgets/templatesDependencies/formStepMixin.js.map +1 -0
  222. package/dist/new-widgets/templatesDependencies/linkTextMixin.js +14 -0
  223. package/dist/new-widgets/templatesDependencies/linkTextMixin.js.map +1 -0
  224. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +125 -0
  225. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js.map +1 -0
  226. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +74 -0
  227. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js.map +1 -0
  228. package/dist/new-widgets/templatesDependencies/patternMixin.js +19 -0
  229. package/dist/new-widgets/templatesDependencies/patternMixin.js.map +1 -0
  230. package/dist/new-widgets/templatesDependencies/rangeMixin.js +110 -0
  231. package/dist/new-widgets/templatesDependencies/rangeMixin.js.map +1 -0
  232. package/dist/new-widgets/templatesDependencies/setMixin.js +12 -0
  233. package/dist/new-widgets/templatesDependencies/setMixin.js.map +1 -0
  234. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +12 -0
  235. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js.map +1 -0
  236. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +18 -0
  237. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js.map +1 -0
  238. package/dist/new-widgets/valueTransformationMixins/dateMixin.js +35 -0
  239. package/dist/new-widgets/valueTransformationMixins/dateMixin.js.map +1 -0
  240. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +16 -0
  241. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js.map +1 -0
  242. package/dist/new-widgets/valueTransformationMixins/index.js +16 -0
  243. package/dist/new-widgets/valueTransformationMixins/index.js.map +1 -0
  244. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +25 -0
  245. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js.map +1 -0
  246. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +17 -0
  247. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js.map +1 -0
  248. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +27 -0
  249. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js.map +1 -0
  250. package/dist/solid-template-element.js +164 -0
  251. package/dist/solid-template-element.js.map +1 -0
  252. package/dist/style/default-theme.css +24 -0
  253. package/dist/style/default-theme.css.proxy.js +10 -0
  254. package/dist/widgets/baseWidget.js +332 -0
  255. package/dist/widgets/baseWidget.js.map +1 -0
  256. package/dist/widgets/widget-factory.js +24 -0
  257. package/dist/widgets/widget-factory.js.map +1 -0
  258. package/package.json +1 -1
@@ -0,0 +1,860 @@
1
+ let _Symbol$toPrimitive;
2
+
3
+ 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; }
4
+
5
+ import JSONLDContextParser from '../../_snowpack/pkg/jsonld-context-parser.js'; //@ts-ignore
6
+
7
+ import PubSub from 'https://cdn.skypack.dev/pubsub-js';
8
+ const ContextParser = JSONLDContextParser.ContextParser;
9
+ const myParser = new ContextParser();
10
+ export const base_context = {
11
+ '@vocab': 'http://happy-dev.fr/owl/#',
12
+ rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
13
+ rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
14
+ ldp: 'http://www.w3.org/ns/ldp#',
15
+ foaf: 'http://xmlns.com/foaf/0.1/',
16
+ name: 'rdfs:label',
17
+ acl: 'http://www.w3.org/ns/auth/acl#',
18
+ permissions: 'acl:accessControl',
19
+ mode: 'acl:mode',
20
+ geo: "http://www.w3.org/2003/01/geo/wgs84_pos#",
21
+ lat: "geo:lat",
22
+ lng: "geo:long"
23
+ };
24
+
25
+ class Store {
26
+ // index of all the containers per resource
27
+ // index of all the containers per resource
28
+ constructor(storeOptions) {
29
+ this.storeOptions = storeOptions;
30
+
31
+ _defineProperty(this, "cache", void 0);
32
+
33
+ _defineProperty(this, "subscriptionIndex", void 0);
34
+
35
+ _defineProperty(this, "subscriptionVirtualContainersIndex", void 0);
36
+
37
+ _defineProperty(this, "loadingList", void 0);
38
+
39
+ _defineProperty(this, "headers", void 0);
40
+
41
+ _defineProperty(this, "fetch", void 0);
42
+
43
+ _defineProperty(this, "session", void 0);
44
+
45
+ _defineProperty(this, "resolveResource", function (id, resolve) {
46
+ const handler = function (event) {
47
+ if (event.detail.id === id) {
48
+ resolve(event.detail.resource); // TODO : callback
49
+
50
+ document.removeEventListener('resourceReady', handler);
51
+ }
52
+ };
53
+
54
+ return handler;
55
+ });
56
+
57
+ this.cache = new Map();
58
+ this.subscriptionIndex = new Map();
59
+ this.subscriptionVirtualContainersIndex = new Map();
60
+ this.loadingList = new Set();
61
+ this.headers = {
62
+ 'Content-Type': 'application/ld+json'
63
+ };
64
+ this.fetch = this.storeOptions.fetchMethod;
65
+ this.session = this.storeOptions.session;
66
+ }
67
+ /**
68
+ * Fetch data and cache it
69
+ * @param id - uri of the resource to fetch
70
+ * @param context - context used to expand id and predicates when accessing the resource
71
+ * @param idParent - uri of the parent caller used to expand uri for local files
72
+ * @param localData - data to put in cache
73
+ * @param forceFetch - force the fetch of data
74
+ *
75
+ * @returns The fetched resource
76
+ *
77
+ * @async
78
+ */
79
+
80
+
81
+ async getData(id, context = {}, idParent = "", localData, forceFetch = false) {
82
+ if (localData == null && this.cache.has(id) && !this.loadingList.has(id)) {
83
+ const resource = this.get(id);
84
+ if (resource && resource.isFullResource() && !forceFetch) return resource; // if resource is not complete, re-fetch it
85
+ }
86
+
87
+ return new Promise(async resolve => {
88
+ document.addEventListener('resourceReady', this.resolveResource(id, resolve));
89
+ if (this.loadingList.has(id)) return;
90
+ this.loadingList.add(id); // Generate proxy
91
+
92
+ const clientContext = await myParser.parse(context);
93
+ let resource = null;
94
+
95
+ if (this._isLocalId(id)) {
96
+ if (localData == null) localData = {};
97
+ localData["@id"] = id;
98
+ resource = localData;
99
+ } else try {
100
+ resource = localData || (await this.fetchData(id, clientContext, idParent));
101
+ } catch (error) {
102
+ console.error(error);
103
+ }
104
+
105
+ if (!resource) {
106
+ this.loadingList.delete(id);
107
+ resolve(null);
108
+ return;
109
+ }
110
+
111
+ const serverContext = await myParser.parse([resource['@context'] || {}]);
112
+ const resourceProxy = new CustomGetter(id, resource, clientContext, serverContext, idParent).getProxy(); // Cache proxy
113
+
114
+ await this.cacheGraph(id, resourceProxy, clientContext, serverContext, idParent || id);
115
+ this.loadingList.delete(id);
116
+ document.dispatchEvent(new CustomEvent('resourceReady', {
117
+ detail: {
118
+ id: id,
119
+ resource: this.get(id)
120
+ }
121
+ }));
122
+ });
123
+ }
124
+
125
+ async fetchAuthn(iri, options) {
126
+ let authenticated = false;
127
+ if (this.session) authenticated = await this.session;
128
+
129
+ if (this.fetch && authenticated) {
130
+ // authenticated
131
+ return this.fetch.then(fn => fn(iri, options));
132
+ } else {
133
+ // anonymous
134
+ if (options.headers) options.headers = this._convertHeaders(options.headers);
135
+ return fetch(iri, options).then(function (response) {
136
+ if (options.method === "PURGE" && !response.ok && response.status === 404) {
137
+ const err = new Error("PURGE call is returning 404");
138
+ throw err;
139
+ }
140
+
141
+ return response;
142
+ });
143
+ }
144
+ }
145
+
146
+ async fetchData(id, context = {}, idParent = "") {
147
+ const iri = this._getAbsoluteIri(id, context, idParent);
148
+
149
+ const headers = { ...this.headers,
150
+ 'accept-language': this._getLanguage()
151
+ };
152
+ return this.fetchAuthn(iri, {
153
+ method: 'GET',
154
+ headers: headers,
155
+ credentials: 'include'
156
+ }).then(response => {
157
+ if (!response.ok) return;
158
+ return response.json();
159
+ });
160
+ }
161
+
162
+ async cacheGraph(key, resource, clientContext, parentContext, parentId) {
163
+ if (resource.properties) {
164
+ // if proxy, cache it
165
+ if (this.get(key)) {
166
+ // if already cached, merge data
167
+ this.cache.get(key).merge(resource);
168
+ } else {
169
+ // else, put in cache
170
+ this.cache.set(key, resource);
171
+ }
172
+ } // Cache nested resources
173
+
174
+
175
+ if (resource.getSubObjects) {
176
+ for (let res of resource.getSubObjects()) {
177
+ let newParentContext = parentContext; // If additional context in resource, use it to expand properties
178
+
179
+ if (res['@context']) newParentContext = await myParser.parse({ ...parentContext,
180
+ ...res['@context']
181
+ });
182
+ const resourceProxy = new CustomGetter(res['@id'], res, clientContext, newParentContext, parentId).getProxy(); // this.subscribeResourceTo(resource['@id'], res['@id']); // removed to prevent useless updates
183
+
184
+ await this.cacheGraph(res['@id'], resourceProxy, clientContext, parentContext, parentId);
185
+ }
186
+ } // Cache children of container
187
+
188
+
189
+ if (resource['@type'] == "ldp:Container" && resource.getChildren) {
190
+ const cacheChildrenPromises = [];
191
+
192
+ for (let res of resource.getChildren()) {
193
+ this.subscribeResourceTo(resource['@id'], res['@id']);
194
+ cacheChildrenPromises.push(this.cacheGraph(res['@id'], res, clientContext, parentContext, parentId));
195
+ }
196
+
197
+ await Promise.all(cacheChildrenPromises);
198
+ return;
199
+ } // Create proxy, (fetch data) and cache resource
200
+
201
+
202
+ if (resource['@id'] && !resource.properties) {
203
+ if (resource['@id'].match(/^b\d+$/)) return; // not anonymous node
204
+ // Fetch data if
205
+
206
+ if (resource['@type'] === "sib:federatedContainer" && resource['@cache'] !== 'false') {
207
+ // if object is federated container
208
+ await this.getData(resource['@id'], clientContext, parentId); // then init graph
209
+
210
+ return;
211
+ }
212
+
213
+ const resourceProxy = new CustomGetter(resource['@id'], resource, clientContext, parentContext, parentId).getProxy();
214
+ await this.cacheGraph(key, resourceProxy, clientContext, parentContext, parentId);
215
+ }
216
+ }
217
+ /**
218
+ * Update fetch
219
+ * @param method - 'POST', 'PATCH', 'PUT', '_LOCAL'
220
+ * @param resource - resource to send
221
+ * @param id - uri to update
222
+ * @returns - object
223
+ */
224
+
225
+
226
+ async _fetch(method, resource, id) {
227
+ if (method !== '_LOCAL') return this.fetchAuthn(id, {
228
+ method: method,
229
+ headers: this.headers,
230
+ body: JSON.stringify(resource),
231
+ credentials: 'include'
232
+ });
233
+ const resourceProxy = store.get(id);
234
+ const clientContext = resourceProxy ? resourceProxy.clientContext : resource['@context'];
235
+ this.clearCache(id);
236
+ await this.getData(id, clientContext, '', resource);
237
+ return {
238
+ ok: true
239
+ };
240
+ }
241
+
242
+ async _updateResource(method, resource, id) {
243
+ if (!['POST', 'PUT', 'PATCH', '_LOCAL'].includes(method)) throw new Error('Error: method not allowed');
244
+ const context = await myParser.parse([resource['@context'] || {}]); // parse context before expandTerm
245
+
246
+ const expandedId = this._getExpandedId(id, context);
247
+
248
+ return this._fetch(method, resource, id).then(async response => {
249
+ if (response.ok) {
250
+ var _response$headers;
251
+
252
+ if (method !== '_LOCAL') {
253
+ await this.purge(id);
254
+ this.clearCache(expandedId);
255
+ } // clear cache
256
+
257
+
258
+ this.getData(expandedId, resource['@context']).then(async () => {
259
+ // re-fetch data
260
+ const nestedResources = await this.getNestedResources(resource, id);
261
+ const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];
262
+ const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];
263
+ return this.refreshResources([...nestedResources, ...resourcesToRefresh]) // refresh related resources
264
+ .then(resourceIds => this.notifyResources([expandedId, ...resourceIds, ...resourcesToNotify])); // notify components
265
+ });
266
+ return ((_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get('Location')) || null;
267
+ } else {
268
+ throw response;
269
+ }
270
+ });
271
+ }
272
+ /**
273
+ * Clear cache and refetch data for a list of ids
274
+ * @param resourceIds -
275
+ * @returns - all the resource ids
276
+ */
277
+
278
+
279
+ async refreshResources(resourceIds) {
280
+ resourceIds = [...new Set(resourceIds.filter(id => this.cache.has(id)))]; // remove duplicates and not cached resources
281
+
282
+ const resourceWithContexts = resourceIds.map(resourceId => {
283
+ var _store$get;
284
+
285
+ return {
286
+ "id": resourceId,
287
+ "context": (_store$get = store.get(resourceId)) === null || _store$get === void 0 ? void 0 : _store$get.clientContext
288
+ };
289
+ });
290
+
291
+ for (const resource of resourceWithContexts) {
292
+ if (!this._isLocalId(resource.id)) this.clearCache(resource.id);
293
+ }
294
+
295
+ await Promise.all(resourceWithContexts.map(({
296
+ id,
297
+ context
298
+ }) => this.getData(id, context || base_context)));
299
+ return resourceIds;
300
+ }
301
+ /**
302
+ * Notifies all components for a list of ids
303
+ * @param resourceIds -
304
+ */
305
+
306
+
307
+ async notifyResources(resourceIds) {
308
+ resourceIds = [...new Set(resourceIds)]; // remove duplicates
309
+
310
+ for (const id of resourceIds) PubSub.publish(id);
311
+ }
312
+ /**
313
+ * Return id of nested properties of a resource
314
+ * @param resource - object
315
+ * @param id - string
316
+ */
317
+
318
+
319
+ async getNestedResources(resource, id) {
320
+ const cachedResource = store.get(id);
321
+ if (!cachedResource || cachedResource.isContainer()) return [];
322
+ let nestedProperties = [];
323
+ const excludeKeys = ['@context'];
324
+
325
+ for (let p of Object.keys(resource)) {
326
+ if (resource[p] && typeof resource[p] === 'object' && !excludeKeys.includes(p) && resource[p]['@id']) {
327
+ nestedProperties.push(resource[p]['@id']);
328
+ }
329
+ }
330
+
331
+ return nestedProperties;
332
+ }
333
+ /**
334
+ * Returns the resource with id from the cache
335
+ * @param id - id of the resource to retrieve
336
+ *
337
+ * @returns Resource (Proxy) if in the cache, null otherwise
338
+ */
339
+
340
+
341
+ get(id) {
342
+ return this.cache.get(id) || null;
343
+ }
344
+ /**
345
+ * Removes a resource from the cache
346
+ * @param id - id of the resource to remove from the cache
347
+ */
348
+
349
+
350
+ clearCache(id) {
351
+ if (this.cache.has(id)) {
352
+ // For federation, clear each source
353
+ const resource = this.cache.get(id);
354
+
355
+ if (resource['@type'] === 'ldp:Container') {
356
+ resource['ldp:contains'].forEach(child => {
357
+ if (child && child['@type'] === 'ldp:Container') this.cache.delete(child['@id']);
358
+ });
359
+ }
360
+
361
+ this.cache.delete(id);
362
+ }
363
+ }
364
+ /**
365
+ * Send data to create a local resource in a container
366
+ * @param resource - resource to create
367
+ * @param id - uri of the container to add resource. should start with ``
368
+ *
369
+ * @returns id of the posted resource
370
+ */
371
+
372
+
373
+ async setLocalData(resource, id) {
374
+ return this._updateResource('_LOCAL', resource, id);
375
+ }
376
+ /**
377
+ * Send a POST request to create a resource in a container
378
+ * @param resource - resource to create
379
+ * @param id - uri of the container to add resource
380
+ *
381
+ * @returns id of the posted resource
382
+ */
383
+
384
+
385
+ async post(resource, id) {
386
+ return this._updateResource('POST', resource, id);
387
+ }
388
+ /**
389
+ * Send a PUT request to edit a resource
390
+ * @param resource - resource data to send
391
+ * @param id - uri of the resource to edit
392
+ *
393
+ * @returns id of the edited resource
394
+ */
395
+
396
+
397
+ async put(resource, id) {
398
+ return this._updateResource('PUT', resource, id);
399
+ }
400
+ /**
401
+ * Send a PATCH request to edit a resource
402
+ * @param resource - resource data to send
403
+ * @param id - uri of the resource to patch
404
+ *
405
+ * @returns id of the edited resource
406
+ */
407
+
408
+
409
+ async patch(resource, id) {
410
+ return this._updateResource('PATCH', resource, id);
411
+ }
412
+ /**
413
+ * Send a PURGE request to remove a resource from REDIS AD cache
414
+ * @param id - uri of the resource to patch
415
+ *
416
+ * @returns id of the edited resource
417
+ */
418
+
419
+
420
+ async purge(id) {
421
+ console.log('Purging resource ' + id);
422
+ await this.fetchAuthn(id, {
423
+ method: "PURGE",
424
+ headers: this.headers
425
+ }).catch(function (error) {
426
+ console.warn('No purge method allowed: ' + error);
427
+ });
428
+
429
+ try {
430
+ const fullURL = new URL(id);
431
+ var pathArray = fullURL.pathname.split('/');
432
+ var containerUrl = fullURL.origin + '/' + pathArray[1] + '/';
433
+ const headers = { ...this.headers,
434
+ 'X-Cache-Purge-Match': 'startswith'
435
+ };
436
+ await this.fetchAuthn(containerUrl, {
437
+ method: "PURGE",
438
+ headers: headers
439
+ }).catch(function (error) {
440
+ console.warn('No purge method allowed: ' + error);
441
+ });
442
+ } catch (error) {
443
+ console.warn('The resource ID is not a complete URL: ' + error);
444
+ return;
445
+ }
446
+ }
447
+ /**
448
+ * Send a DELETE request to delete a resource
449
+ * @param id - uri of the resource to delete
450
+ * @param context - can be used to expand id
451
+ *
452
+ * @returns id of the deleted resource
453
+ */
454
+
455
+
456
+ async delete(id, context = {}) {
457
+ const expandedId = this._getExpandedId(id, context);
458
+
459
+ const deleted = await this.fetchAuthn(expandedId, {
460
+ method: 'DELETE',
461
+ headers: this.headers,
462
+ credentials: 'include'
463
+ });
464
+ await this.purge(id);
465
+ const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];
466
+ const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];
467
+ this.refreshResources([...resourcesToNotify, ...resourcesToRefresh]).then(resourceIds => this.notifyResources(resourceIds));
468
+ return deleted;
469
+ }
470
+ /**
471
+ * Convert headers object to Headers
472
+ * @param headersObject - object
473
+ * @returns {Headers}
474
+ */
475
+
476
+
477
+ _convertHeaders(headersObject) {
478
+ const headers = new Headers();
479
+
480
+ for (const [key, value] of Object.entries(headersObject)) {
481
+ headers.set(key, value);
482
+ }
483
+
484
+ return headers;
485
+ }
486
+
487
+ _getExpandedId(id, context) {
488
+ return context && Object.keys(context) ? ContextParser.expandTerm(id, context) : id;
489
+ }
490
+
491
+ _isLocalId(id) {
492
+ return id.startsWith('store://local.');
493
+ }
494
+ /**
495
+ * Make a resource listen changes of another one
496
+ * @param resourceId - id of the resource which needs to be updated
497
+ * @param nestedResourceId - id of the resource which will change
498
+ */
499
+
500
+
501
+ subscribeResourceTo(resourceId, nestedResourceId) {
502
+ const existingSubscriptions = this.subscriptionIndex.get(nestedResourceId) || [];
503
+ this.subscriptionIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, resourceId])]);
504
+ }
505
+ /**
506
+ * Make a virtual container listen for changes of a resource
507
+ * @param virtualContainerId - id of the container which needs to be updated
508
+ * @param nestedResourceId - id of the resource which will change
509
+ */
510
+
511
+
512
+ subscribeVirtualContainerTo(virtualContainerId, nestedResourceId) {
513
+ const existingSubscriptions = this.subscriptionVirtualContainersIndex.get(nestedResourceId) || [];
514
+ this.subscriptionVirtualContainersIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, virtualContainerId])]);
515
+ }
516
+ /**
517
+ * Return absolute IRI of the resource
518
+ * @param id
519
+ * @param context
520
+ * @param parentId
521
+ */
522
+
523
+
524
+ _getAbsoluteIri(id, context, parentId) {
525
+ let iri = ContextParser.expandTerm(id, context); // expand if reduced ids
526
+
527
+ if (parentId) {
528
+ // and get full URL from parent caller for local files
529
+ let parentIri = new URL(parentId, document.location.href).href;
530
+ iri = new URL(iri, parentIri).href;
531
+ } else {
532
+ iri = new URL(iri, document.location.href).href;
533
+ }
534
+
535
+ return iri;
536
+ }
537
+ /**
538
+ * Check if object is a full resource
539
+ * @param resource
540
+ */
541
+
542
+
543
+ _resourceIsComplete(resource) {
544
+ return !!(Object.keys(resource).filter(p => !p.startsWith('@')).length > 0 && resource['@id']);
545
+ }
546
+ /**
547
+ * Return language of the users
548
+ */
549
+
550
+
551
+ _getLanguage() {
552
+ return localStorage.getItem('language') || window.navigator.language.slice(0, 2);
553
+ }
554
+ /**
555
+ * Save the preferred language of the user
556
+ * @param selectedLanguageCode
557
+ */
558
+
559
+
560
+ selectLanguage(selectedLanguageCode) {
561
+ localStorage.setItem('language', selectedLanguageCode);
562
+ }
563
+
564
+ }
565
+
566
+ let store;
567
+
568
+ if (window.sibStore) {
569
+ store = window.sibStore;
570
+ } else {
571
+ const sibAuth = document.querySelector('sib-auth');
572
+ const storeOptions = {};
573
+
574
+ if (sibAuth) {
575
+ const sibAuthDefined = customElements.whenDefined(sibAuth.localName);
576
+ storeOptions.session = sibAuthDefined.then(() => sibAuth.session);
577
+ storeOptions.fetchMethod = sibAuthDefined.then(() => sibAuth.getFetch());
578
+ }
579
+
580
+ store = new Store(storeOptions);
581
+ window.sibStore = store;
582
+ }
583
+
584
+ export { store };
585
+ _Symbol$toPrimitive = Symbol.toPrimitive;
586
+
587
+ class CustomGetter {
588
+ // content of the requested resource
589
+ // context given by the app
590
+ // context given by the server
591
+ // id of the parent resource, used to get the absolute url of the current resource
592
+ constructor(resourceId, resource, clientContext, serverContext = {}, parentId = "") {
593
+ _defineProperty(this, "resource", void 0);
594
+
595
+ _defineProperty(this, "resourceId", void 0);
596
+
597
+ _defineProperty(this, "clientContext", void 0);
598
+
599
+ _defineProperty(this, "serverContext", void 0);
600
+
601
+ _defineProperty(this, "parentId", void 0);
602
+
603
+ this.clientContext = clientContext;
604
+ this.serverContext = serverContext;
605
+ this.parentId = parentId;
606
+ this.resource = this.expandProperties({ ...resource
607
+ }, serverContext);
608
+ this.resourceId = resourceId;
609
+ }
610
+ /**
611
+ * Expand all predicates of a resource with a given context
612
+ * @param resource: object
613
+ * @param context: object
614
+ */
615
+
616
+
617
+ expandProperties(resource, context) {
618
+ for (let prop of Object.keys(resource)) {
619
+ if (!prop) continue;
620
+ this.objectReplaceProperty(resource, prop, ContextParser.expandTerm(prop, context, true));
621
+ }
622
+
623
+ return resource;
624
+ }
625
+ /**
626
+ * Change the key of an object
627
+ * @param object: object
628
+ * @param oldProp: string - current key
629
+ * @param newProp: string - new key to set
630
+ */
631
+
632
+
633
+ objectReplaceProperty(object, oldProp, newProp) {
634
+ if (newProp !== oldProp) {
635
+ Object.defineProperty(object, newProp, Object.getOwnPropertyDescriptor(object, oldProp) || '');
636
+ delete object[oldProp];
637
+ }
638
+ }
639
+ /**
640
+ * Get the property of a resource for a given path
641
+ * @param path: string
642
+ */
643
+
644
+
645
+ async get(path) {
646
+ if (!path) return;
647
+ const path1 = path.split('.');
648
+ const path2 = [];
649
+ let value;
650
+
651
+ if (!this.isFullResource()) {
652
+ // if resource is not complete, fetch it first
653
+ await this.getResource(this.resourceId, this.clientContext, this.parentId);
654
+ }
655
+
656
+ while (true) {
657
+ try {
658
+ value = this.resource[this.getExpandedPredicate(path1[0])];
659
+ } catch (e) {
660
+ break;
661
+ }
662
+
663
+ if (path1.length <= 1) break; // no dot path
664
+
665
+ const lastPath1El = path1.pop();
666
+ if (lastPath1El) path2.unshift(lastPath1El);
667
+ }
668
+
669
+ if (path2.length === 0) {
670
+ // end of the path
671
+ if (!value || !value['@id']) return value; // no value or not a resource
672
+
673
+ return await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId); // return complete resource
674
+ }
675
+
676
+ if (!value) return undefined;
677
+ let resource = await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId);
678
+ store.subscribeResourceTo(this.resourceId, value['@id']);
679
+ return resource ? await resource[path2.join('.')] : undefined; // return value
680
+ }
681
+ /**
682
+ * Cache resource in the store, and return the created proxy
683
+ * @param id
684
+ * @param context
685
+ * @param iriParent
686
+ * @param forceFetch
687
+ */
688
+
689
+
690
+ async getResource(id, context, iriParent, forceFetch = false) {
691
+ return store.getData(id, context, iriParent, undefined, forceFetch);
692
+ }
693
+ /**
694
+ * Return true if the resource is a container
695
+ */
696
+
697
+
698
+ isContainer() {
699
+ return this.resource["@type"] == "ldp:Container" || this.resource["@type"] == "sib:federatedContainer";
700
+ }
701
+ /**
702
+ * Get all properties of a resource
703
+ */
704
+
705
+
706
+ getProperties() {
707
+ return Object.keys(this.resource).map(prop => this.getCompactedPredicate(prop));
708
+ }
709
+ /**
710
+ * Get children of container as objects
711
+ */
712
+
713
+
714
+ getChildren() {
715
+ return this.resource[this.getExpandedPredicate("ldp:contains")] || [];
716
+ }
717
+ /**
718
+ * Get children of container as Proxys
719
+ */
720
+
721
+
722
+ getLdpContains() {
723
+ const children = this.resource[this.getExpandedPredicate("ldp:contains")];
724
+ return children ? children.map(res => store.get(res['@id'])) : [];
725
+ }
726
+ /**
727
+ * Get all nested resource or containers which contains datas
728
+ */
729
+
730
+
731
+ getSubObjects() {
732
+ let subObjects = [];
733
+
734
+ for (let p of Object.keys(this.resource)) {
735
+ let property = this.resource[p];
736
+ if (!this.isFullNestedResource(property)) continue; // if not a resource, stop
737
+
738
+ if (property['@type'] == "ldp:Container" && (property['ldp:contains'] == undefined || property['ldp:contains'].length >= 1 && !this.isFullNestedResource(property['ldp:contains'][0]))) continue; // if not a full container
739
+
740
+ subObjects.push(property);
741
+ }
742
+
743
+ return subObjects;
744
+ }
745
+
746
+ merge(resource) {
747
+ this.resource = { ...this.getResourceData(),
748
+ ...resource.getResourceData()
749
+ };
750
+ }
751
+
752
+ getResourceData() {
753
+ return this.resource;
754
+ }
755
+ /**
756
+ * return true if prop is a resource with an @id and some properties
757
+ * @param prop
758
+ */
759
+
760
+
761
+ isFullNestedResource(prop) {
762
+ return prop && typeof prop == "object" && prop['@id'] != undefined && Object.keys(prop).filter(p => !p.startsWith('@')).length > 0;
763
+ }
764
+ /**
765
+ * return true resource seems complete
766
+ * @param prop
767
+ */
768
+
769
+
770
+ isFullResource() {
771
+ return Object.keys(this.resource).filter(p => !p.startsWith('@')).length > 0;
772
+ }
773
+
774
+ async getPermissions() {
775
+ const permissionPredicate = this.getExpandedPredicate("permissions");
776
+ let permissions = this.resource[permissionPredicate];
777
+
778
+ if (!permissions) {
779
+ // if no permission, re-fetch data
780
+ await this.getResource(this.resourceId, this.clientContext, this.parentId, true);
781
+ permissions = this.resource[permissionPredicate];
782
+ }
783
+
784
+ return permissions ? permissions.map(perm => ContextParser.expandTerm(perm.mode['@type'], this.serverContext, true)) : [];
785
+ }
786
+ /**
787
+ * Remove the resource from the cache
788
+ */
789
+
790
+
791
+ clearCache() {
792
+ store.clearCache(this.resourceId);
793
+ }
794
+
795
+ getExpandedPredicate(property) {
796
+ return ContextParser.expandTerm(property, this.clientContext, true);
797
+ }
798
+
799
+ getCompactedPredicate(property) {
800
+ return ContextParser.compactIri(property, this.clientContext, true);
801
+ }
802
+
803
+ getCompactedIri(id) {
804
+ return ContextParser.compactIri(id, this.clientContext);
805
+ }
806
+
807
+ toString() {
808
+ return this.getCompactedIri(this.resource['@id']);
809
+ }
810
+
811
+ [_Symbol$toPrimitive]() {
812
+ return this.getCompactedIri(this.resource['@id']);
813
+ }
814
+ /**
815
+ * Returns a Proxy which handles the different get requests
816
+ */
817
+
818
+
819
+ getProxy() {
820
+ return new Proxy(this, {
821
+ get: (resource, property) => {
822
+ if (!this.resource) return undefined;
823
+ if (typeof resource[property] === 'function') return resource[property].bind(resource);
824
+
825
+ switch (property) {
826
+ case '@id':
827
+ return this.getCompactedIri(this.resource['@id']);
828
+ // Compact @id if possible
829
+
830
+ case '@type':
831
+ return this.resource['@type'];
832
+ // return synchronously
833
+
834
+ case 'properties':
835
+ return this.getProperties();
836
+
837
+ case 'ldp:contains':
838
+ return this.getLdpContains();
839
+ // returns standard arrays synchronously
840
+
841
+ case 'permissions':
842
+ return this.getPermissions();
843
+ // get expanded permissions
844
+
845
+ case 'clientContext':
846
+ return this.clientContext;
847
+ // get saved client context to re-fetch easily a resource
848
+
849
+ case 'then':
850
+ return;
851
+
852
+ default:
853
+ return resource.get(property);
854
+ }
855
+ }
856
+ });
857
+ }
858
+
859
+ }
860
+ //# sourceMappingURL=store.js.map