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

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 +862 -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,862 @@
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
+ console.log("Full URL object", fullURL);
432
+ var containerUrl = fullURL.hostname + fullURL.pathname.split('/')[0];
433
+ console.log("Container URL for wildcard purge", containerUrl);
434
+ const headers = { ...this.headers,
435
+ 'X-Cache-Purge-Match': 'wildcard'
436
+ };
437
+ console.log("Headers", headers);
438
+ await this.fetchAuthn(containerUrl + '/*', {
439
+ method: "PURGE",
440
+ headers: headers
441
+ }).catch(function (error) {
442
+ console.warn('No purge method allowed: ' + error);
443
+ });
444
+ } catch (error) {
445
+ console.warn('The resource ID is not a complete URL: ' + error);
446
+ return;
447
+ }
448
+ }
449
+ /**
450
+ * Send a DELETE request to delete a resource
451
+ * @param id - uri of the resource to delete
452
+ * @param context - can be used to expand id
453
+ *
454
+ * @returns id of the deleted resource
455
+ */
456
+
457
+
458
+ async delete(id, context = {}) {
459
+ const expandedId = this._getExpandedId(id, context);
460
+
461
+ const deleted = await this.fetchAuthn(expandedId, {
462
+ method: 'DELETE',
463
+ headers: this.headers,
464
+ credentials: 'include'
465
+ });
466
+ await this.purge(id);
467
+ const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];
468
+ const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];
469
+ this.refreshResources([...resourcesToNotify, ...resourcesToRefresh]).then(resourceIds => this.notifyResources(resourceIds));
470
+ return deleted;
471
+ }
472
+ /**
473
+ * Convert headers object to Headers
474
+ * @param headersObject - object
475
+ * @returns {Headers}
476
+ */
477
+
478
+
479
+ _convertHeaders(headersObject) {
480
+ const headers = new Headers();
481
+
482
+ for (const [key, value] of Object.entries(headersObject)) {
483
+ headers.set(key, value);
484
+ }
485
+
486
+ return headers;
487
+ }
488
+
489
+ _getExpandedId(id, context) {
490
+ return context && Object.keys(context) ? ContextParser.expandTerm(id, context) : id;
491
+ }
492
+
493
+ _isLocalId(id) {
494
+ return id.startsWith('store://local.');
495
+ }
496
+ /**
497
+ * Make a resource listen changes of another one
498
+ * @param resourceId - id of the resource which needs to be updated
499
+ * @param nestedResourceId - id of the resource which will change
500
+ */
501
+
502
+
503
+ subscribeResourceTo(resourceId, nestedResourceId) {
504
+ const existingSubscriptions = this.subscriptionIndex.get(nestedResourceId) || [];
505
+ this.subscriptionIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, resourceId])]);
506
+ }
507
+ /**
508
+ * Make a virtual container listen for changes of a resource
509
+ * @param virtualContainerId - id of the container which needs to be updated
510
+ * @param nestedResourceId - id of the resource which will change
511
+ */
512
+
513
+
514
+ subscribeVirtualContainerTo(virtualContainerId, nestedResourceId) {
515
+ const existingSubscriptions = this.subscriptionVirtualContainersIndex.get(nestedResourceId) || [];
516
+ this.subscriptionVirtualContainersIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, virtualContainerId])]);
517
+ }
518
+ /**
519
+ * Return absolute IRI of the resource
520
+ * @param id
521
+ * @param context
522
+ * @param parentId
523
+ */
524
+
525
+
526
+ _getAbsoluteIri(id, context, parentId) {
527
+ let iri = ContextParser.expandTerm(id, context); // expand if reduced ids
528
+
529
+ if (parentId) {
530
+ // and get full URL from parent caller for local files
531
+ let parentIri = new URL(parentId, document.location.href).href;
532
+ iri = new URL(iri, parentIri).href;
533
+ } else {
534
+ iri = new URL(iri, document.location.href).href;
535
+ }
536
+
537
+ return iri;
538
+ }
539
+ /**
540
+ * Check if object is a full resource
541
+ * @param resource
542
+ */
543
+
544
+
545
+ _resourceIsComplete(resource) {
546
+ return !!(Object.keys(resource).filter(p => !p.startsWith('@')).length > 0 && resource['@id']);
547
+ }
548
+ /**
549
+ * Return language of the users
550
+ */
551
+
552
+
553
+ _getLanguage() {
554
+ return localStorage.getItem('language') || window.navigator.language.slice(0, 2);
555
+ }
556
+ /**
557
+ * Save the preferred language of the user
558
+ * @param selectedLanguageCode
559
+ */
560
+
561
+
562
+ selectLanguage(selectedLanguageCode) {
563
+ localStorage.setItem('language', selectedLanguageCode);
564
+ }
565
+
566
+ }
567
+
568
+ let store;
569
+
570
+ if (window.sibStore) {
571
+ store = window.sibStore;
572
+ } else {
573
+ const sibAuth = document.querySelector('sib-auth');
574
+ const storeOptions = {};
575
+
576
+ if (sibAuth) {
577
+ const sibAuthDefined = customElements.whenDefined(sibAuth.localName);
578
+ storeOptions.session = sibAuthDefined.then(() => sibAuth.session);
579
+ storeOptions.fetchMethod = sibAuthDefined.then(() => sibAuth.getFetch());
580
+ }
581
+
582
+ store = new Store(storeOptions);
583
+ window.sibStore = store;
584
+ }
585
+
586
+ export { store };
587
+ _Symbol$toPrimitive = Symbol.toPrimitive;
588
+
589
+ class CustomGetter {
590
+ // content of the requested resource
591
+ // context given by the app
592
+ // context given by the server
593
+ // id of the parent resource, used to get the absolute url of the current resource
594
+ constructor(resourceId, resource, clientContext, serverContext = {}, parentId = "") {
595
+ _defineProperty(this, "resource", void 0);
596
+
597
+ _defineProperty(this, "resourceId", void 0);
598
+
599
+ _defineProperty(this, "clientContext", void 0);
600
+
601
+ _defineProperty(this, "serverContext", void 0);
602
+
603
+ _defineProperty(this, "parentId", void 0);
604
+
605
+ this.clientContext = clientContext;
606
+ this.serverContext = serverContext;
607
+ this.parentId = parentId;
608
+ this.resource = this.expandProperties({ ...resource
609
+ }, serverContext);
610
+ this.resourceId = resourceId;
611
+ }
612
+ /**
613
+ * Expand all predicates of a resource with a given context
614
+ * @param resource: object
615
+ * @param context: object
616
+ */
617
+
618
+
619
+ expandProperties(resource, context) {
620
+ for (let prop of Object.keys(resource)) {
621
+ if (!prop) continue;
622
+ this.objectReplaceProperty(resource, prop, ContextParser.expandTerm(prop, context, true));
623
+ }
624
+
625
+ return resource;
626
+ }
627
+ /**
628
+ * Change the key of an object
629
+ * @param object: object
630
+ * @param oldProp: string - current key
631
+ * @param newProp: string - new key to set
632
+ */
633
+
634
+
635
+ objectReplaceProperty(object, oldProp, newProp) {
636
+ if (newProp !== oldProp) {
637
+ Object.defineProperty(object, newProp, Object.getOwnPropertyDescriptor(object, oldProp) || '');
638
+ delete object[oldProp];
639
+ }
640
+ }
641
+ /**
642
+ * Get the property of a resource for a given path
643
+ * @param path: string
644
+ */
645
+
646
+
647
+ async get(path) {
648
+ if (!path) return;
649
+ const path1 = path.split('.');
650
+ const path2 = [];
651
+ let value;
652
+
653
+ if (!this.isFullResource()) {
654
+ // if resource is not complete, fetch it first
655
+ await this.getResource(this.resourceId, this.clientContext, this.parentId);
656
+ }
657
+
658
+ while (true) {
659
+ try {
660
+ value = this.resource[this.getExpandedPredicate(path1[0])];
661
+ } catch (e) {
662
+ break;
663
+ }
664
+
665
+ if (path1.length <= 1) break; // no dot path
666
+
667
+ const lastPath1El = path1.pop();
668
+ if (lastPath1El) path2.unshift(lastPath1El);
669
+ }
670
+
671
+ if (path2.length === 0) {
672
+ // end of the path
673
+ if (!value || !value['@id']) return value; // no value or not a resource
674
+
675
+ return await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId); // return complete resource
676
+ }
677
+
678
+ if (!value) return undefined;
679
+ let resource = await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId);
680
+ store.subscribeResourceTo(this.resourceId, value['@id']);
681
+ return resource ? await resource[path2.join('.')] : undefined; // return value
682
+ }
683
+ /**
684
+ * Cache resource in the store, and return the created proxy
685
+ * @param id
686
+ * @param context
687
+ * @param iriParent
688
+ * @param forceFetch
689
+ */
690
+
691
+
692
+ async getResource(id, context, iriParent, forceFetch = false) {
693
+ return store.getData(id, context, iriParent, undefined, forceFetch);
694
+ }
695
+ /**
696
+ * Return true if the resource is a container
697
+ */
698
+
699
+
700
+ isContainer() {
701
+ return this.resource["@type"] == "ldp:Container" || this.resource["@type"] == "sib:federatedContainer";
702
+ }
703
+ /**
704
+ * Get all properties of a resource
705
+ */
706
+
707
+
708
+ getProperties() {
709
+ return Object.keys(this.resource).map(prop => this.getCompactedPredicate(prop));
710
+ }
711
+ /**
712
+ * Get children of container as objects
713
+ */
714
+
715
+
716
+ getChildren() {
717
+ return this.resource[this.getExpandedPredicate("ldp:contains")] || [];
718
+ }
719
+ /**
720
+ * Get children of container as Proxys
721
+ */
722
+
723
+
724
+ getLdpContains() {
725
+ const children = this.resource[this.getExpandedPredicate("ldp:contains")];
726
+ return children ? children.map(res => store.get(res['@id'])) : [];
727
+ }
728
+ /**
729
+ * Get all nested resource or containers which contains datas
730
+ */
731
+
732
+
733
+ getSubObjects() {
734
+ let subObjects = [];
735
+
736
+ for (let p of Object.keys(this.resource)) {
737
+ let property = this.resource[p];
738
+ if (!this.isFullNestedResource(property)) continue; // if not a resource, stop
739
+
740
+ 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
741
+
742
+ subObjects.push(property);
743
+ }
744
+
745
+ return subObjects;
746
+ }
747
+
748
+ merge(resource) {
749
+ this.resource = { ...this.getResourceData(),
750
+ ...resource.getResourceData()
751
+ };
752
+ }
753
+
754
+ getResourceData() {
755
+ return this.resource;
756
+ }
757
+ /**
758
+ * return true if prop is a resource with an @id and some properties
759
+ * @param prop
760
+ */
761
+
762
+
763
+ isFullNestedResource(prop) {
764
+ return prop && typeof prop == "object" && prop['@id'] != undefined && Object.keys(prop).filter(p => !p.startsWith('@')).length > 0;
765
+ }
766
+ /**
767
+ * return true resource seems complete
768
+ * @param prop
769
+ */
770
+
771
+
772
+ isFullResource() {
773
+ return Object.keys(this.resource).filter(p => !p.startsWith('@')).length > 0;
774
+ }
775
+
776
+ async getPermissions() {
777
+ const permissionPredicate = this.getExpandedPredicate("permissions");
778
+ let permissions = this.resource[permissionPredicate];
779
+
780
+ if (!permissions) {
781
+ // if no permission, re-fetch data
782
+ await this.getResource(this.resourceId, this.clientContext, this.parentId, true);
783
+ permissions = this.resource[permissionPredicate];
784
+ }
785
+
786
+ return permissions ? permissions.map(perm => ContextParser.expandTerm(perm.mode['@type'], this.serverContext, true)) : [];
787
+ }
788
+ /**
789
+ * Remove the resource from the cache
790
+ */
791
+
792
+
793
+ clearCache() {
794
+ store.clearCache(this.resourceId);
795
+ }
796
+
797
+ getExpandedPredicate(property) {
798
+ return ContextParser.expandTerm(property, this.clientContext, true);
799
+ }
800
+
801
+ getCompactedPredicate(property) {
802
+ return ContextParser.compactIri(property, this.clientContext, true);
803
+ }
804
+
805
+ getCompactedIri(id) {
806
+ return ContextParser.compactIri(id, this.clientContext);
807
+ }
808
+
809
+ toString() {
810
+ return this.getCompactedIri(this.resource['@id']);
811
+ }
812
+
813
+ [_Symbol$toPrimitive]() {
814
+ return this.getCompactedIri(this.resource['@id']);
815
+ }
816
+ /**
817
+ * Returns a Proxy which handles the different get requests
818
+ */
819
+
820
+
821
+ getProxy() {
822
+ return new Proxy(this, {
823
+ get: (resource, property) => {
824
+ if (!this.resource) return undefined;
825
+ if (typeof resource[property] === 'function') return resource[property].bind(resource);
826
+
827
+ switch (property) {
828
+ case '@id':
829
+ return this.getCompactedIri(this.resource['@id']);
830
+ // Compact @id if possible
831
+
832
+ case '@type':
833
+ return this.resource['@type'];
834
+ // return synchronously
835
+
836
+ case 'properties':
837
+ return this.getProperties();
838
+
839
+ case 'ldp:contains':
840
+ return this.getLdpContains();
841
+ // returns standard arrays synchronously
842
+
843
+ case 'permissions':
844
+ return this.getPermissions();
845
+ // get expanded permissions
846
+
847
+ case 'clientContext':
848
+ return this.clientContext;
849
+ // get saved client context to re-fetch easily a resource
850
+
851
+ case 'then':
852
+ return;
853
+
854
+ default:
855
+ return resource.get(property);
856
+ }
857
+ }
858
+ });
859
+ }
860
+
861
+ }
862
+ //# sourceMappingURL=store.js.map