solid-logic 1.3.17-615b75c1 → 1.3.17-80b4d030

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 (122) hide show
  1. package/jest.config.js +1 -1
  2. package/lib/acl/aclLogic.d.ts +12 -30
  3. package/lib/acl/aclLogic.d.ts.map +1 -1
  4. package/lib/acl/aclLogic.js +152 -119
  5. package/lib/acl/aclLogic.js.map +1 -1
  6. package/lib/authn/SolidAuthnLogic.d.ts.map +1 -1
  7. package/lib/authn/SolidAuthnLogic.js +2 -2
  8. package/lib/authn/SolidAuthnLogic.js.map +1 -1
  9. package/lib/chat/chatLogic.d.ts +16 -0
  10. package/lib/chat/chatLogic.d.ts.map +1 -0
  11. package/lib/chat/{ChatLogic.js → chatLogic.js} +82 -87
  12. package/lib/chat/chatLogic.js.map +1 -0
  13. package/lib/inbox/inboxLogic.d.ts +7 -0
  14. package/lib/inbox/inboxLogic.d.ts.map +1 -0
  15. package/lib/inbox/{InboxLogic.js → inboxLogic.js} +58 -64
  16. package/lib/inbox/inboxLogic.js.map +1 -0
  17. package/lib/index.d.ts +18 -9
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.js +86 -22
  20. package/lib/index.js.map +1 -1
  21. package/lib/logic/CustomError.d.ts +4 -0
  22. package/lib/logic/CustomError.d.ts.map +1 -1
  23. package/lib/logic/CustomError.js +17 -1
  24. package/lib/logic/CustomError.js.map +1 -1
  25. package/lib/logic/SolidLogic.d.ts +8 -34
  26. package/lib/logic/SolidLogic.d.ts.map +1 -1
  27. package/lib/logic/SolidLogic.js +16 -250
  28. package/lib/logic/SolidLogic.js.map +1 -1
  29. package/lib/logic/solidLogicSingleton.js +1 -1
  30. package/lib/logic/solidLogicSingleton.js.map +1 -1
  31. package/lib/logic/solidLogicSingletonNew.d.ts +80 -0
  32. package/lib/logic/solidLogicSingletonNew.d.ts.map +1 -0
  33. package/lib/logic/solidLogicSingletonNew.js +238 -0
  34. package/lib/logic/solidLogicSingletonNew.js.map +1 -0
  35. package/lib/profile/profileLogic.d.ts +13 -0
  36. package/lib/profile/profileLogic.d.ts.map +1 -0
  37. package/lib/profile/profileLogic.js +268 -0
  38. package/lib/profile/profileLogic.js.map +1 -0
  39. package/lib/typeIndex/typeIndexLogic.d.ts +31 -21
  40. package/lib/typeIndex/typeIndexLogic.d.ts.map +1 -1
  41. package/lib/typeIndex/typeIndexLogic.js +650 -295
  42. package/lib/typeIndex/typeIndexLogic.js.map +1 -1
  43. package/lib/types.d.ts +17 -0
  44. package/lib/types.d.ts.map +1 -1
  45. package/lib/util/containerLogic.d.ts +11 -0
  46. package/lib/util/containerLogic.d.ts.map +1 -0
  47. package/lib/{profile/ProfileLogic.js → util/containerLogic.js} +53 -44
  48. package/lib/util/containerLogic.js.map +1 -0
  49. package/lib/util/ns.d.ts +2 -0
  50. package/lib/util/ns.d.ts.map +1 -0
  51. package/lib/util/ns.js +34 -0
  52. package/lib/util/ns.js.map +1 -0
  53. package/lib/util/utilityLogic.d.ts +15 -0
  54. package/lib/util/utilityLogic.d.ts.map +1 -0
  55. package/lib/util/utilityLogic.js +272 -0
  56. package/lib/util/utilityLogic.js.map +1 -0
  57. package/lib/util/utils.d.ts +8 -0
  58. package/lib/util/utils.d.ts.map +1 -0
  59. package/lib/util/utils.js +48 -0
  60. package/lib/util/utils.js.map +1 -0
  61. package/package.json +3 -1
  62. package/src/acl/aclLogic.ts +136 -118
  63. package/src/authn/SolidAuthnLogic.ts +3 -2
  64. package/src/chat/chatLogic.ts +225 -0
  65. package/src/inbox/inboxLogic.ts +57 -0
  66. package/src/index.ts +142 -18
  67. package/src/logic/CustomError.ts +5 -1
  68. package/src/logic/SolidLogic.ts +30 -211
  69. package/src/logic/solidLogicSingleton.ts +1 -1
  70. package/src/logic/solidLogicSingletonNew.ts +239 -0
  71. package/src/profile/profileLogic.ts +134 -0
  72. package/src/typeIndex/typeIndexLogic.ts +417 -153
  73. package/src/types.ts +7 -3
  74. package/src/util/containerLogic.ts +54 -0
  75. package/src/util/ns.ts +5 -0
  76. package/src/util/utilityLogic.ts +155 -0
  77. package/src/util/utils.ts +52 -0
  78. package/test/aclLogic.test.ts +13 -4
  79. package/test/chatLogic.test.ts +70 -71
  80. package/test/container.test.ts +56 -0
  81. package/test/helpers/dataSetup.ts +134 -0
  82. package/test/helpers/setup.ts +1 -0
  83. package/test/inboxLogic.test.ts +39 -38
  84. package/test/logic.test.ts +10 -9
  85. package/test/profileLogic.test.ts +246 -0
  86. package/test/typeIndexLogic.test.ts +49 -22
  87. package/test/typeIndexLogicPart2.test.ts +485 -0
  88. package/test/utilityLogic.test.ts +172 -126
  89. package/test/utils.test.ts +32 -0
  90. package/lib/chat/ChatLogic.d.ts +0 -26
  91. package/lib/chat/ChatLogic.d.ts.map +0 -1
  92. package/lib/chat/ChatLogic.js.map +0 -1
  93. package/lib/chat/determineChatContainer.d.ts +0 -3
  94. package/lib/chat/determineChatContainer.d.ts.map +0 -1
  95. package/lib/chat/determineChatContainer.js +0 -12
  96. package/lib/chat/determineChatContainer.js.map +0 -1
  97. package/lib/discovery/discoveryLogic.d.ts +0 -40
  98. package/lib/discovery/discoveryLogic.d.ts.map +0 -1
  99. package/lib/discovery/discoveryLogic.js +0 -494
  100. package/lib/discovery/discoveryLogic.js.map +0 -1
  101. package/lib/inbox/InboxLogic.d.ts +0 -18
  102. package/lib/inbox/InboxLogic.d.ts.map +0 -1
  103. package/lib/inbox/InboxLogic.js.map +0 -1
  104. package/lib/profile/ProfileLogic.d.ts +0 -13
  105. package/lib/profile/ProfileLogic.d.ts.map +0 -1
  106. package/lib/profile/ProfileLogic.js.map +0 -1
  107. package/lib/util/UtilityLogic.d.ts +0 -33
  108. package/lib/util/UtilityLogic.d.ts.map +0 -1
  109. package/lib/util/UtilityLogic.js +0 -240
  110. package/lib/util/UtilityLogic.js.map +0 -1
  111. package/lib/util/uri.d.ts +0 -3
  112. package/lib/util/uri.d.ts.map +0 -1
  113. package/lib/util/uri.js +0 -9
  114. package/lib/util/uri.js.map +0 -1
  115. package/src/chat/ChatLogic.ts +0 -244
  116. package/src/chat/determineChatContainer.ts +0 -14
  117. package/src/discovery/discoveryLogic.ts +0 -311
  118. package/src/inbox/InboxLogic.ts +0 -66
  119. package/src/profile/ProfileLogic.ts +0 -44
  120. package/src/util/UtilityLogic.ts +0 -161
  121. package/src/util/uri.ts +0 -5
  122. package/test/discoveryLogic.test.ts +0 -740
package/src/index.ts CHANGED
@@ -1,39 +1,163 @@
1
1
  // Make these variables directly accessible as it is what you need most of the time
2
2
  // This also makes these variable globaly accesible in mashlib
3
3
  import { solidLogicSingleton } from './logic/solidLogicSingleton'
4
+
4
5
  const authn = solidLogicSingleton.authn
5
6
  const authSession = solidLogicSingleton.authn.authSession
6
7
  const store = solidLogicSingleton.store
7
8
 
8
- const chat = solidLogicSingleton.chat
9
- const profile = solidLogicSingleton.profile
9
+ const aclLogic = solidLogicSingleton.aclLogic
10
+ const utilityLogic = solidLogicSingleton.utilityLogic
11
+ const containerLogic = solidLogicSingleton.containerLogic
12
+ const profileLogic = solidLogicSingleton.profileLogic
13
+ const inboxLogic = solidLogicSingleton.inboxLogic
14
+ const typeIndexLogic = solidLogicSingleton.typeIndexLogic
15
+ const chatLogic = solidLogicSingleton.chatLogic
10
16
 
11
- export {
17
+ const {
18
+ findAclDocUrl,
12
19
  setACLUserPublic,
13
- genACLText
14
- } from './acl/aclLogic'
20
+ genACLText,
21
+ } = aclLogic
15
22
 
16
- export {
23
+ const {
17
24
  ensureTypeIndexes,
18
25
  loadTypeIndexes,
19
26
  registerInTypeIndex,
20
- loadIndex
21
- } from './typeIndex/typeIndexLogic'
22
-
23
- export {
24
- loadProfile,
25
- loadPreferences,
27
+ loadIndex,
28
+ ensureOneTypeIndex,
29
+ putIndex,
30
+ makeIndexIfNecessary,
31
+ loadIndexes,
32
+ getTypeIndex,
33
+ getRegistrations,
34
+ //NEW function for discovery
26
35
  loadTypeIndexesFor,
27
36
  loadCommunityTypeIndexes,
28
- loadAllTypeIndexes
29
- } from './discovery/discoveryLogic'
37
+ loadAllTypeIndexes,
38
+ getScopedAppInstances,
39
+ getAppInstances,
40
+ suggestPublicTypeIndex,
41
+ suggestPrivateTypeIndex,
42
+ registerInstanceInTypeIndex,
43
+ deleteTypeIndexRegistration,
44
+ getScopedAppsFromIndex
45
+ } = typeIndexLogic
30
46
 
31
- export { SolidLogic } from './logic/SolidLogic'
47
+ const {
48
+ setAcl,
49
+ addToPrivateTypeIndex,
50
+ findChat,
51
+ createChatThing,
52
+ getChat,
53
+ sendInvite,
54
+ mintNew
55
+ } = chatLogic
56
+
57
+ const { createInboxFor, getNewMessages, markAsRead } = inboxLogic
58
+ const {
59
+ recursiveDelete,
60
+ setSinglePeerAccess,
61
+ createEmptyRdfDoc,
62
+ //NEW function for discovery
63
+ followOrCreateLink,
64
+ loadOrCreateIfNotExists,
65
+ } = utilityLogic
66
+
67
+ const {
68
+ ensureLoadedPreferences,
69
+ loadMe,
70
+ getPodRoot,
71
+ getMainInbox,
72
+ findStorage,
73
+ //NEW content from discovery
74
+ loadPreferences,
75
+ loadProfile,
76
+ //NEW function for discovery
77
+ silencedLoadPreferences
78
+ } = profileLogic
79
+
80
+ const {
81
+ isContainer,
82
+ createContainer,
83
+ getContainerElements,
84
+ getContainerMembers
85
+ } = containerLogic
86
+
87
+ export { ACL_LINK } from './acl/aclLogic'
32
88
  export { offlineTestID, appContext } from './authn/authUtil'
33
- export { ACL_LINK } from './util/UtilityLogic'
34
89
  export { getSuggestedIssuers } from './issuer/issuerLogic'
90
+ export { SolidLogic } from './logic/SolidLogic'
35
91
  export { AppDetails, SolidNamespace, AuthenticationContext } from './types'
36
92
  // solidLogicSingleton is exported entirely because it is used in solid-panes
37
93
  export { solidLogicSingleton } from './logic/solidLogicSingleton'
38
- export { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError } from './logic/CustomError'
39
- export { authn, authSession, store, chat, profile }
94
+ export { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError'
95
+
96
+ export {
97
+ store,
98
+ authn,
99
+ authSession,
100
+ aclLogic,
101
+ utilityLogic,
102
+ containerLogic,
103
+ profileLogic,
104
+ inboxLogic,
105
+ typeIndexLogic,
106
+ chatLogic,
107
+ //aclLogic
108
+ findAclDocUrl,
109
+ setACLUserPublic,
110
+ genACLText,
111
+ //typeIndexLogic
112
+ ensureTypeIndexes,
113
+ loadTypeIndexes,
114
+ registerInTypeIndex,
115
+ loadIndex,
116
+ ensureOneTypeIndex,
117
+ putIndex,
118
+ makeIndexIfNecessary,
119
+ loadIndexes,
120
+ getTypeIndex,
121
+ getRegistrations,
122
+ loadTypeIndexesFor,
123
+ loadCommunityTypeIndexes,
124
+ loadAllTypeIndexes,
125
+ getScopedAppInstances,
126
+ getAppInstances,
127
+ suggestPublicTypeIndex,
128
+ suggestPrivateTypeIndex,
129
+ registerInstanceInTypeIndex,
130
+ deleteTypeIndexRegistration,
131
+ getScopedAppsFromIndex,
132
+ setAcl,
133
+ addToPrivateTypeIndex,
134
+ findChat,
135
+ createChatThing,
136
+ getChat,
137
+ sendInvite,
138
+ //inboxLogic
139
+ mintNew,
140
+ createInboxFor,
141
+ getNewMessages,
142
+ markAsRead,
143
+ //utilityLogic
144
+ recursiveDelete,
145
+ setSinglePeerAccess,
146
+ createEmptyRdfDoc,
147
+ followOrCreateLink,
148
+ loadOrCreateIfNotExists,
149
+ //profileLogic
150
+ ensureLoadedPreferences,
151
+ loadMe,
152
+ getPodRoot,
153
+ getMainInbox,
154
+ findStorage,
155
+ loadPreferences,
156
+ loadProfile,
157
+ silencedLoadPreferences,
158
+ //containerLogic
159
+ isContainer,
160
+ createContainer,
161
+ getContainerElements,
162
+ getContainerMembers
163
+ }
@@ -6,7 +6,7 @@ class CustomError extends Error {
6
6
  this.name = new.target.name; // stack traces display correctly now
7
7
  }
8
8
  }
9
-
9
+
10
10
  export class UnauthorizedError extends CustomError {}
11
11
 
12
12
  export class CrossOriginForbiddenError extends CustomError {}
@@ -15,6 +15,10 @@ export class SameOriginForbiddenError extends CustomError {}
15
15
 
16
16
  export class NotFoundError extends CustomError {}
17
17
 
18
+ export class NotEditableError extends CustomError { }
19
+
20
+ export class WebOperationError extends CustomError {}
21
+
18
22
  export class FetchError extends CustomError {
19
23
  status: number;
20
24
 
@@ -1,225 +1,64 @@
1
1
  import { Session } from "@inrupt/solid-client-authn-browser";
2
2
  import * as rdf from "rdflib";
3
- import { NamedNode, Statement, LiveStore } from "rdflib";
4
- import solidNamespace from "solid-namespace";
3
+ import { LiveStore, NamedNode, Statement } from "rdflib";
4
+ import { createAclLogic } from "../acl/aclLogic";
5
5
  import { SolidAuthnLogic } from "../authn/SolidAuthnLogic";
6
- import { ChatLogic } from "../chat/ChatLogic";
7
- import { ProfileLogic } from "../profile/ProfileLogic";
8
- import { AuthnLogic, SolidNamespace } from "../types";
6
+ import { createChatLogic } from "../chat/chatLogic";
7
+ import { createInboxLogic } from "../inbox/inboxLogic";
8
+ import { createProfileLogic } from "../profile/profileLogic";
9
+ import { createTypeIndexLogic } from "../typeIndex/typeIndexLogic";
10
+ import { createContainerLogic } from "../util/containerLogic";
11
+ import { createUtilityLogic } from "../util/utilityLogic";
12
+ import { AuthnLogic } from "../types";
9
13
  import * as debug from "../util/debug";
10
- import { UtilityLogic } from "../util/UtilityLogic";
11
- import { CrossOriginForbiddenError, FetchError, NotFoundError, SameOriginForbiddenError, UnauthorizedError } from "./CustomError";
12
14
  /*
13
15
  ** It is important to distinquish `fetch`, a function provided by the browser
14
16
  ** and `Fetcher`, a helper object for the rdflib Store which turns it
15
17
  ** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is
16
18
  ** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
17
19
  */
18
-
19
- const ns: SolidNamespace = solidNamespace(rdf);
20
-
21
20
  export class SolidLogic {
22
- cache: {
23
- profileDocument: {
24
- [WebID: string]: NamedNode;
25
- };
26
- preferencesFile: {
27
- [WebID: string]: NamedNode;
28
- };
29
- };
30
21
 
31
22
  store: LiveStore;
32
23
  me: string | undefined;
33
- underlyingFetch: { fetch: (url: string, options?: any) => any };
34
-
35
- chat: ChatLogic;
36
- profile: ProfileLogic;
37
24
  authn: AuthnLogic;
38
- util: UtilityLogic;
25
+
26
+ aclLogic
27
+ utilityLogic
28
+ containerLogic
29
+ profileLogic
30
+ inboxLogic
31
+ typeIndexLogic
32
+ chatLogic
33
+
39
34
 
40
35
  constructor(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: Session) {
41
36
  // would xpect to be able to do it this way: but get TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation status: 999
42
37
  // this.store = new rdf.LiveStore({})
43
38
  // this.store.fetcher._fetch = fetch
44
- console.log("SolidLogic: Unique instance created. There should only be one of these.")
39
+ debug.log("SolidLogic: Unique instance created. There should only be one of these.")
45
40
  this.store = rdf.graph() as LiveStore; // Make a Quad store
46
41
  rdf.fetcher(this.store, { fetch: specialFetch.fetch}); // Attach a web I/O module, store.fetcher
47
42
  this.store.updater = new rdf.UpdateManager(this.store); // Add real-time live updates store.updater
48
-
49
43
  this.store.features = [] // disable automatic node merging on store load
50
- this.cache = {
51
- profileDocument: {},
52
- preferencesFile: {},
53
- };
54
- this.underlyingFetch = { fetch: fetch }; // Note global one not the one passed
55
- this.authn = new SolidAuthnLogic(session);
56
- debug.log('SolidAuthnLogic initialized')
57
- this.profile = new ProfileLogic(this.store, ns, this.authn);
58
- this.chat = new ChatLogic(this.store, ns, this.profile);
59
- this.util = new UtilityLogic(this.store, ns, this.underlyingFetch);
60
- }
61
-
62
- findAclDocUrl(url: string) {
63
- return this.util.findAclDocUrl(url);
64
- }
65
-
66
- async loadProfile(me: NamedNode): Promise<NamedNode> {
67
- /*
68
- // console.log('loadProfile cache ', this.cache)
69
- if (this.cache.profileDocument[me.value]) {
70
- return this.cache.profileDocument[me.value];
71
- } @@ just use the cache in the store
72
- */
73
- console.log('loadProfile me ', me)
74
- const profileDocument = me.doc()
75
- try {
76
- await this.store.fetcher.load(profileDocument);
77
- return profileDocument;
78
- } catch (err) {
79
- const message = `Cannot load profile ${profileDocument} : ${err}`;
80
- throw new Error(message);
81
- }
82
- }
83
-
84
- async loadPreferences(me: NamedNode): Promise<NamedNode> {
85
- console.log('loadPreferences cache ', this.cache)
86
- if (this.cache.preferencesFile[me.value]) {
87
- return this.cache.preferencesFile[me.value];
88
- }
89
- await this.loadProfile(me) // Load pointer to pref file
90
- const preferencesFile = this.store.any(me, ns.space('preferencesFile'), null, me.doc());
91
-
92
- // console.log('this.store.any()', this.store.any())
93
- /**
94
- * Are we working cross-origin?
95
- * Returns True if we are in a webapp at an origin, and the file origin is different
96
- */
97
- function differentOrigin(): boolean {
98
- if (!preferencesFile) {
99
- return true;
100
- }
101
- return (
102
- `${window.location.origin}/` !== new URL(preferencesFile.value).origin
103
- );
104
- }
105
-
106
- if (!preferencesFile) {
107
- throw new Error(
108
- `Can't find a preference file pointer in profile ${me.doc()}`
109
- );
110
- }
111
-
112
- // //// Load preference file
113
- try {
114
- await this.store.fetcher.load(preferencesFile as NamedNode, {
115
- withCredentials: true,
116
- });
117
- } catch (err) {
118
- // Really important to look at why
119
- const status = err.status;
120
- debug.log(`HTTP status ${status} for preference file ${preferencesFile}`);
121
- if (status === 401) {
122
- throw new UnauthorizedError();
123
- }
124
- if (status === 403) {
125
- if (differentOrigin()) {
126
- throw new CrossOriginForbiddenError();
127
- }
128
- throw new SameOriginForbiddenError();
129
- }
130
- if (status === 404) {
131
- throw new NotFoundError(preferencesFile.value);
132
- }
133
- throw new FetchError(err.status, err.message);
134
- }
135
- return preferencesFile as NamedNode;
136
- }
44
+
45
+ this.authn = new SolidAuthnLogic(session)
137
46
 
138
- getTypeIndex(
139
- me: NamedNode | string,
140
- preferencesFile: NamedNode | string,
141
- isPublic: boolean
142
- ): NamedNode[] {
143
- // console.log('getTypeIndex', this.store.each(me, undefined, undefined, preferencesFile), isPublic, preferencesFile)
144
- return this.store.each(
145
- me as NamedNode,
146
- isPublic ? ns.solid("publicTypeIndex") : ns.solid("privateTypeIndex"),
147
- undefined,
148
- preferencesFile as NamedNode
149
- ) as NamedNode[];
150
- }
47
+ debug.log('SolidAuthnLogic initialized')
151
48
 
152
- getRegistrations(instance, theClass) {
153
- return this.store
154
- .each(undefined, ns.solid("instance"), instance)
155
- .filter((r) => {
156
- return this.store.holds(r, ns.solid("forClass"), theClass);
157
- });
49
+ this.aclLogic = createAclLogic(this.store)
50
+ this.containerLogic = createContainerLogic(this.store)
51
+ this.utilityLogic = createUtilityLogic(this.store, this.aclLogic, this.containerLogic)
52
+ this.profileLogic = createProfileLogic(this.store, this.authn, this.utilityLogic)
53
+ this.chatLogic = createChatLogic(this.store, this.profileLogic)
54
+ this.inboxLogic = createInboxLogic(this.store, this.profileLogic, this.utilityLogic, this.containerLogic, this.aclLogic)
55
+ this.typeIndexLogic = createTypeIndexLogic(this.store, this.authn, this.profileLogic, this.utilityLogic)
158
56
  }
159
57
 
160
58
  load(doc: NamedNode | NamedNode[] | string) {
161
59
  return this.store.fetcher.load(doc);
162
60
  }
163
61
 
164
- async loadIndexes(
165
- me: NamedNode | string,
166
- publicProfile: NamedNode | string | null,
167
- preferencesFile: NamedNode | string | null,
168
- onWarning = async (_err: Error) => {
169
- return undefined;
170
- }
171
- ): Promise<{
172
- private: any;
173
- public: any;
174
- }> {
175
- let privateIndexes: any[] = [];
176
- let publicIndexes: any[] = [];
177
- if (publicProfile) {
178
- publicIndexes = this.getTypeIndex(me, publicProfile, true);
179
- try {
180
- await this.load(publicIndexes as NamedNode[]);
181
- } catch (err) {
182
- onWarning(new Error(`loadIndex: loading public type index(es) ${err}`));
183
- }
184
- }
185
- if (preferencesFile) {
186
- privateIndexes = this.getTypeIndex(me, preferencesFile, false);
187
- // console.log({ privateIndexes })
188
- if (privateIndexes.length === 0) {
189
- await onWarning(
190
- new Error(
191
- `Your preference file ${preferencesFile} does not point to a private type index.`
192
- )
193
- );
194
- } else {
195
- try {
196
- await this.load(privateIndexes);
197
- } catch (err) {
198
- onWarning(
199
- new Error(`loadIndex: loading private type index(es) ${err}`)
200
- );
201
- }
202
- }
203
- // } else {
204
- // debug.log(
205
- // 'We know your preference file is not available, so we are not bothering with private type indexes.'
206
- // )
207
- }
208
-
209
- return {
210
- private: privateIndexes,
211
- public: publicIndexes,
212
- };
213
- }
214
-
215
- async createEmptyRdfDoc(doc: NamedNode, comment: string) {
216
- await this.store.fetcher.webOperation("PUT", doc.uri, {
217
- data: `# ${new Date()} ${comment}
218
- `,
219
- contentType: "text/turtle",
220
- });
221
- }
222
-
223
62
  // @@@@ use the one in rdflib.js when it is available and delete this
224
63
  updatePromise(
225
64
  del: Array<Statement>,
@@ -236,27 +75,7 @@ export class SolidLogic {
236
75
  }); // promise
237
76
  }
238
77
 
239
- isContainer(url: string) {
240
- return this.util.isContainer(url);
241
- }
242
-
243
- getContainerElements(containerNode: NamedNode): NamedNode[] {
244
- return this.util.getContainerElements(containerNode);
245
- }
246
-
247
- getContainerMembers(containerUrl: string): Promise<string[]> {
248
- return this.util.getContainerMembers(containerUrl);
249
- }
250
-
251
- async recursiveDelete(url: string) {
252
- return this.util.recursiveDelete(url);
253
- }
254
-
255
78
  clearStore() {
256
- return this.util.clearStore();
257
- }
258
-
259
- async fetch(url: string, options?: any) {
260
- return this.underlyingFetch.fetch(url, options);
79
+ this.store.statements.slice().forEach(this.store.remove.bind(this.store));
261
80
  }
262
81
  }
@@ -5,7 +5,7 @@ import { SolidLogic } from "./SolidLogic"
5
5
  const _fetch = async (url, requestInit) => {
6
6
  const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'
7
7
  if (authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114
8
- // In fact ftech should respect crentials omit itself
8
+ // In fact fetch should respect credentials omit itself
9
9
  return authSession.fetch(url, requestInit)
10
10
  } else {
11
11
  return window.fetch(url, requestInit)