solid-logic 1.3.17-80b4d030 → 1.3.17-81536f11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/acl/aclLogic.d.ts +2 -11
- package/lib/acl/aclLogic.d.ts.map +1 -1
- package/lib/acl/aclLogic.js.map +1 -1
- package/lib/chat/chatLogic.d.ts +2 -15
- package/lib/chat/chatLogic.d.ts.map +1 -1
- package/lib/chat/chatLogic.js +8 -7
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/inbox/inboxLogic.d.ts +2 -6
- package/lib/inbox/inboxLogic.d.ts.map +1 -1
- package/lib/inbox/inboxLogic.js.map +1 -1
- package/lib/index.d.ts +4 -18
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -86
- package/lib/index.js.map +1 -1
- package/lib/issuer/issuerLogic.js +1 -1
- package/lib/issuer/issuerLogic.js.map +1 -1
- package/lib/logic/solidLogic.d.ts +6 -0
- package/lib/logic/solidLogic.d.ts.map +1 -0
- package/lib/logic/{SolidLogic.js → solidLogic.js} +38 -33
- package/lib/logic/solidLogic.js.map +1 -0
- package/lib/logic/solidLogicSingleton.d.ts +1 -2
- package/lib/logic/solidLogicSingleton.d.ts.map +1 -1
- package/lib/logic/solidLogicSingleton.js +2 -2
- package/lib/logic/solidLogicSingleton.js.map +1 -1
- package/lib/profile/profileLogic.d.ts +2 -12
- package/lib/profile/profileLogic.d.ts.map +1 -1
- package/lib/profile/profileLogic.js +1 -23
- package/lib/profile/profileLogic.js.map +1 -1
- package/lib/typeIndex/typeIndexLogic.d.ts +2 -31
- package/lib/typeIndex/typeIndexLogic.d.ts.map +1 -1
- package/lib/typeIndex/typeIndexLogic.js +12 -359
- package/lib/typeIndex/typeIndexLogic.js.map +1 -1
- package/lib/types.d.ts +65 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/acl/aclLogic.ts +5 -4
- package/src/chat/chatLogic.ts +7 -7
- package/src/inbox/inboxLogic.ts +2 -1
- package/src/index.ts +5 -147
- package/src/issuer/issuerLogic.ts +1 -1
- package/src/logic/solidLogic.ts +75 -0
- package/src/logic/solidLogicSingleton.ts +2 -2
- package/src/profile/profileLogic.ts +4 -12
- package/src/typeIndex/typeIndexLogic.ts +6 -277
- package/src/types.ts +76 -1
- package/test/typeIndexLogic.test.ts +484 -54
- package/lib/logic/SolidLogic.d.ts +0 -22
- package/lib/logic/SolidLogic.d.ts.map +0 -1
- package/lib/logic/SolidLogic.js.map +0 -1
- package/lib/logic/solidLogicSingletonNew.d.ts +0 -80
- package/lib/logic/solidLogicSingletonNew.d.ts.map +0 -1
- package/lib/logic/solidLogicSingletonNew.js +0 -238
- package/lib/logic/solidLogicSingletonNew.js.map +0 -1
- package/src/logic/SolidLogic.ts +0 -81
- package/src/logic/solidLogicSingletonNew.ts +0 -239
- package/test/typeIndexLogicPart2.test.ts +0 -485
|
@@ -1,69 +1,499 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
1
5
|
import { Fetcher, Store, sym, UpdateManager } from "rdflib";
|
|
2
6
|
import { createAclLogic } from "../src/acl/aclLogic";
|
|
3
7
|
import { createProfileLogic } from "../src/profile/profileLogic";
|
|
4
|
-
import { createTypeIndexLogic
|
|
5
|
-
import { AuthenticationContext } from "../src/types";
|
|
8
|
+
import { createTypeIndexLogic} from "../src/typeIndex/typeIndexLogic";
|
|
6
9
|
import { createContainerLogic } from "../src/util/containerLogic";
|
|
10
|
+
import { ns } from "../src/util/ns";
|
|
7
11
|
import { createUtilityLogic } from "../src/util/utilityLogic";
|
|
8
|
-
import {
|
|
12
|
+
import { uniqueNodes } from "../src/util/utils";
|
|
13
|
+
import { alice, AlicePhotoFolder, AlicePhotos, AlicePreferences, AlicePreferencesFile, AlicePrivateTypeIndex, AlicePrivateTypes, AliceProfile, AlicePublicTypeIndex, AlicePublicTypes, bob, BobProfile, club, ClubPreferences, ClubPreferencesFile, ClubPrivateTypeIndex, ClubPrivateTypes, ClubProfile, ClubPublicTypeIndex, ClubPublicTypes } from "./helpers/dataSetup";
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
const prefixes = Object.keys(ns).map(prefix => `@prefix ${prefix}: ${ns[prefix]('')}.\n`).join('') // In turtle
|
|
16
|
+
window.$SolidTestEnvironment = { username: alice.uri }
|
|
17
|
+
|
|
18
|
+
const Tracker = ns.wf('Tracker')
|
|
19
|
+
const Image = ns.schema('Image')
|
|
20
|
+
|
|
21
|
+
//let web = {}
|
|
22
|
+
//web = loadWebObject()
|
|
23
|
+
const user = alice
|
|
24
|
+
const profile = user.doc()
|
|
25
|
+
const web = {}
|
|
26
|
+
web[profile.uri] = AliceProfile
|
|
27
|
+
web[AlicePreferencesFile.uri] = AlicePreferences
|
|
28
|
+
web[AlicePrivateTypeIndex.uri] = AlicePrivateTypes
|
|
29
|
+
web[AlicePublicTypeIndex.uri] = AlicePublicTypes
|
|
30
|
+
web[AlicePhotoFolder.uri] = AlicePhotos
|
|
31
|
+
web[bob.doc().uri] = BobProfile
|
|
32
|
+
|
|
33
|
+
web[club.doc().uri] = ClubProfile
|
|
34
|
+
web[ClubPreferencesFile.uri] = ClubPreferences
|
|
35
|
+
web[ClubPrivateTypeIndex.uri] = ClubPrivateTypes
|
|
36
|
+
web[ClubPublicTypeIndex.uri] = ClubPublicTypes
|
|
37
|
+
let requests = []
|
|
38
|
+
let statustoBeReturned = 200
|
|
12
39
|
let typeIndexLogic
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
describe("TypeIndex logic NEW", () => {
|
|
42
|
+
let store;
|
|
43
|
+
const authn = {
|
|
44
|
+
currentUser: () => {
|
|
45
|
+
return alice;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
fetchMock.resetMocks();
|
|
51
|
+
requests = []
|
|
52
|
+
statustoBeReturned = 200
|
|
53
|
+
const init = { headers: { "Content-Type": "text/turtle" } } // Fetch options tend to be called this
|
|
54
|
+
|
|
55
|
+
fetchMock.mockIf(/^https?.*$/, async req => {
|
|
56
|
+
|
|
57
|
+
if (req.method !== 'GET') {
|
|
58
|
+
requests.push(req)
|
|
59
|
+
if (req.method === 'PUT') {
|
|
60
|
+
const contents = await req.text()
|
|
61
|
+
web[req.url] = contents // Update our dummy web
|
|
62
|
+
console.log(`Tetst: Updated ${req.url} on PUT to <<<${web[req.url]}>>>`)
|
|
63
|
+
}
|
|
64
|
+
return { status: statustoBeReturned }
|
|
65
|
+
}
|
|
66
|
+
const contents = web[req.url]
|
|
67
|
+
if (contents !== undefined) { //
|
|
68
|
+
return {
|
|
69
|
+
body: prefixes + contents, // Add namespaces to anything
|
|
70
|
+
status: 200,
|
|
71
|
+
headers: {
|
|
72
|
+
"Content-Type": "text/turtle",
|
|
73
|
+
"WAC-Allow": 'user="write", public="read"',
|
|
74
|
+
"Accept-Patch": "application/sparql-update"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} // if contents
|
|
78
|
+
return {
|
|
79
|
+
status: 404,
|
|
80
|
+
body: 'Not Found'
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
store = new Store()
|
|
85
|
+
store.fetcher = new Fetcher(store, { fetch: fetch });
|
|
86
|
+
store.updater = new UpdateManager(store);
|
|
87
|
+
const util = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
|
|
88
|
+
typeIndexLogic = createTypeIndexLogic(store, authn, createProfileLogic(store, authn, util), util)
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('loadAllTypeIndexes', () => {
|
|
92
|
+
it('exists', () => {
|
|
93
|
+
expect(typeIndexLogic.loadAllTypeIndexes).toBeInstanceOf(Function)
|
|
94
|
+
})
|
|
41
95
|
})
|
|
42
|
-
})
|
|
43
96
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
97
|
+
const AliceScopes = [{
|
|
98
|
+
"agent": {
|
|
99
|
+
"classOrder": 5,
|
|
100
|
+
"termType": "NamedNode",
|
|
101
|
+
"value": "https://alice.example.com/profile/card.ttl#me",
|
|
102
|
+
},
|
|
103
|
+
"index": {
|
|
104
|
+
"classOrder": 5,
|
|
105
|
+
"termType": "NamedNode",
|
|
106
|
+
"value": "https://alice.example.com/profile/public-type-index.ttl",
|
|
107
|
+
},
|
|
108
|
+
"label": "public",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"agent": {
|
|
112
|
+
"classOrder": 5,
|
|
113
|
+
"termType": "NamedNode",
|
|
114
|
+
"value": "https://alice.example.com/profile/card.ttl#me",
|
|
115
|
+
},
|
|
116
|
+
"index": {
|
|
117
|
+
"classOrder": 5,
|
|
118
|
+
"termType": "NamedNode",
|
|
119
|
+
"value": "https://alice.example.com/settings/private-type-index.ttl",
|
|
120
|
+
},
|
|
121
|
+
"label": "private",
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
describe('loadTypeIndexesFor', () => {
|
|
126
|
+
it('exists', () => {
|
|
127
|
+
expect(typeIndexLogic.loadTypeIndexesFor).toBeInstanceOf(Function)
|
|
128
|
+
})
|
|
129
|
+
it('loads data', async () => {
|
|
130
|
+
const result = await typeIndexLogic.loadTypeIndexesFor(alice)
|
|
131
|
+
expect(result).toEqual(AliceScopes)
|
|
132
|
+
expect(store.statementsMatching(null, null, null, AlicePrivateTypeIndex).length).toEqual(8)
|
|
133
|
+
expect(store.statementsMatching(null, null, null, AlicePublicTypeIndex).length).toEqual(8)
|
|
134
|
+
})
|
|
47
135
|
})
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
136
|
+
|
|
137
|
+
const ClubScopes =
|
|
138
|
+
[
|
|
139
|
+
{
|
|
140
|
+
"agent": {
|
|
141
|
+
"classOrder": 5,
|
|
142
|
+
"termType": "NamedNode",
|
|
143
|
+
"value": "https://club.example.com/profile/card.ttl#it",
|
|
144
|
+
},
|
|
145
|
+
"index": {
|
|
146
|
+
"classOrder": 5,
|
|
147
|
+
"termType": "NamedNode",
|
|
148
|
+
"value": "https://club.example.com/profile/public-type-index.ttl",
|
|
149
|
+
},
|
|
150
|
+
"label": "public",
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"agent": {
|
|
154
|
+
"classOrder": 5,
|
|
155
|
+
"termType": "NamedNode",
|
|
156
|
+
"value": "https://club.example.com/profile/card.ttl#it",
|
|
157
|
+
},
|
|
158
|
+
"index": {
|
|
159
|
+
"classOrder": 5,
|
|
160
|
+
"termType": "NamedNode",
|
|
161
|
+
"value": "https://club.example.com/settings/private-type-index.ttl",
|
|
162
|
+
},
|
|
163
|
+
"label": "private",
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
describe('loadCommunityTypeIndexes', () => {
|
|
167
|
+
it('exists', () => {
|
|
168
|
+
expect(typeIndexLogic.loadCommunityTypeIndexes).toBeInstanceOf(Function)
|
|
169
|
+
})
|
|
170
|
+
it('loads data', async () => {
|
|
171
|
+
const result = await typeIndexLogic.loadCommunityTypeIndexes(alice)
|
|
172
|
+
expect(result).toEqual(ClubScopes)
|
|
173
|
+
})
|
|
51
174
|
})
|
|
52
|
-
})
|
|
53
175
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
176
|
+
const AliceAndClubScopes =
|
|
177
|
+
[
|
|
178
|
+
{
|
|
179
|
+
"instance": {
|
|
180
|
+
"classOrder": 5,
|
|
181
|
+
"termType": "NamedNode",
|
|
182
|
+
"value": "https://alice.example.com/publicStuff/actionItems.ttl#this",
|
|
183
|
+
},
|
|
184
|
+
"scope": {
|
|
185
|
+
"agent": {
|
|
186
|
+
"classOrder": 5,
|
|
187
|
+
"termType": "NamedNode",
|
|
188
|
+
"value": "https://alice.example.com/profile/card.ttl#me",
|
|
189
|
+
},
|
|
190
|
+
"index": {
|
|
191
|
+
"classOrder": 5,
|
|
192
|
+
"termType": "NamedNode",
|
|
193
|
+
"value": "https://alice.example.com/profile/public-type-index.ttl",
|
|
194
|
+
},
|
|
195
|
+
"label": "public",
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"instance": {
|
|
200
|
+
"classOrder": 5,
|
|
201
|
+
"termType": "NamedNode",
|
|
202
|
+
"value": "https://alice.example.com/project4/issues.ttl#this",
|
|
203
|
+
},
|
|
204
|
+
"scope": {
|
|
205
|
+
"agent": {
|
|
206
|
+
"classOrder": 5,
|
|
207
|
+
"termType": "NamedNode",
|
|
208
|
+
"value": "https://alice.example.com/profile/card.ttl#me",
|
|
209
|
+
},
|
|
210
|
+
"index": {
|
|
211
|
+
"classOrder": 5,
|
|
212
|
+
"termType": "NamedNode",
|
|
213
|
+
"value": "https://alice.example.com/profile/public-type-index.ttl",
|
|
214
|
+
},
|
|
215
|
+
"label": "public",
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"instance": {
|
|
220
|
+
"classOrder": 5,
|
|
221
|
+
"termType": "NamedNode",
|
|
222
|
+
"value": "https://alice.example.com/privateStuff/ToDo.ttl#this",
|
|
223
|
+
},
|
|
224
|
+
"scope": {
|
|
225
|
+
"agent": {
|
|
226
|
+
"classOrder": 5,
|
|
227
|
+
"termType": "NamedNode",
|
|
228
|
+
"value": "https://alice.example.com/profile/card.ttl#me",
|
|
229
|
+
},
|
|
230
|
+
"index": {
|
|
231
|
+
"classOrder": 5,
|
|
232
|
+
"termType": "NamedNode",
|
|
233
|
+
"value": "https://alice.example.com/settings/private-type-index.ttl",
|
|
234
|
+
},
|
|
235
|
+
"label": "private",
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"instance": {
|
|
240
|
+
"classOrder": 5,
|
|
241
|
+
"termType": "NamedNode",
|
|
242
|
+
"value": "https://alice.example.com/privateStuff/Goals.ttl#this",
|
|
243
|
+
},
|
|
244
|
+
"scope": {
|
|
245
|
+
"agent": {
|
|
246
|
+
"classOrder": 5,
|
|
247
|
+
"termType": "NamedNode",
|
|
248
|
+
"value": "https://alice.example.com/profile/card.ttl#me",
|
|
249
|
+
},
|
|
250
|
+
"index": {
|
|
251
|
+
"classOrder": 5,
|
|
252
|
+
"termType": "NamedNode",
|
|
253
|
+
"value": "https://alice.example.com/settings/private-type-index.ttl",
|
|
254
|
+
},
|
|
255
|
+
"label": "private",
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"instance": {
|
|
260
|
+
"classOrder": 5,
|
|
261
|
+
"termType": "NamedNode",
|
|
262
|
+
"value": "https://alice.example.com/privateStuff/workingOn.ttl#this",
|
|
263
|
+
},
|
|
264
|
+
"scope": {
|
|
265
|
+
"agent": {
|
|
266
|
+
"classOrder": 5,
|
|
267
|
+
"termType": "NamedNode",
|
|
268
|
+
"value": "https://alice.example.com/profile/card.ttl#me",
|
|
269
|
+
},
|
|
270
|
+
"index": {
|
|
271
|
+
"classOrder": 5,
|
|
272
|
+
"termType": "NamedNode",
|
|
273
|
+
"value": "https://alice.example.com/settings/private-type-index.ttl",
|
|
274
|
+
},
|
|
275
|
+
"label": "private",
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"instance": {
|
|
280
|
+
"classOrder": 5,
|
|
281
|
+
"termType": "NamedNode",
|
|
282
|
+
"value": "https://club.example.com/publicStuff/actionItems.ttl#this",
|
|
283
|
+
},
|
|
284
|
+
"scope": {
|
|
285
|
+
"agent": {
|
|
286
|
+
"classOrder": 5,
|
|
287
|
+
"termType": "NamedNode",
|
|
288
|
+
"value": "https://club.example.com/profile/card.ttl#it",
|
|
289
|
+
},
|
|
290
|
+
"index": {
|
|
291
|
+
"classOrder": 5,
|
|
292
|
+
"termType": "NamedNode",
|
|
293
|
+
"value": "https://club.example.com/profile/public-type-index.ttl",
|
|
294
|
+
},
|
|
295
|
+
"label": "public",
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"instance": {
|
|
300
|
+
"classOrder": 5,
|
|
301
|
+
"termType": "NamedNode",
|
|
302
|
+
"value": "https://club.example.com/project4/clubIssues.ttl#this",
|
|
303
|
+
},
|
|
304
|
+
"scope": {
|
|
305
|
+
"agent": {
|
|
306
|
+
"classOrder": 5,
|
|
307
|
+
"termType": "NamedNode",
|
|
308
|
+
"value": "https://club.example.com/profile/card.ttl#it",
|
|
309
|
+
},
|
|
310
|
+
"index": {
|
|
311
|
+
"classOrder": 5,
|
|
312
|
+
"termType": "NamedNode",
|
|
313
|
+
"value": "https://club.example.com/profile/public-type-index.ttl",
|
|
314
|
+
},
|
|
315
|
+
"label": "public",
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"instance": {
|
|
320
|
+
"classOrder": 5,
|
|
321
|
+
"termType": "NamedNode",
|
|
322
|
+
"value": "https://club.example.com/privateStuff/ToDo.ttl#this",
|
|
323
|
+
},
|
|
324
|
+
"scope": {
|
|
325
|
+
"agent": {
|
|
326
|
+
"classOrder": 5,
|
|
327
|
+
"termType": "NamedNode",
|
|
328
|
+
"value": "https://club.example.com/profile/card.ttl#it",
|
|
329
|
+
},
|
|
330
|
+
"index": {
|
|
331
|
+
"classOrder": 5,
|
|
332
|
+
"termType": "NamedNode",
|
|
333
|
+
"value": "https://club.example.com/settings/private-type-index.ttl",
|
|
334
|
+
},
|
|
335
|
+
"label": "private",
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"instance": {
|
|
340
|
+
"classOrder": 5,
|
|
341
|
+
"termType": "NamedNode",
|
|
342
|
+
"value": "https://club.example.com/privateStuff/Goals.ttl#this",
|
|
343
|
+
},
|
|
344
|
+
"scope": {
|
|
345
|
+
"agent": {
|
|
346
|
+
"classOrder": 5,
|
|
347
|
+
"termType": "NamedNode",
|
|
348
|
+
"value": "https://club.example.com/profile/card.ttl#it",
|
|
349
|
+
},
|
|
350
|
+
"index": {
|
|
351
|
+
"classOrder": 5,
|
|
352
|
+
"termType": "NamedNode",
|
|
353
|
+
"value": "https://club.example.com/settings/private-type-index.ttl",
|
|
354
|
+
},
|
|
355
|
+
"label": "private",
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"instance": {
|
|
360
|
+
"classOrder": 5,
|
|
361
|
+
"termType": "NamedNode",
|
|
362
|
+
"value": "https://club.example.com/privateStuff/tasks.ttl#this",
|
|
363
|
+
},
|
|
364
|
+
"scope": {
|
|
365
|
+
"agent": {
|
|
366
|
+
"classOrder": 5,
|
|
367
|
+
"termType": "NamedNode",
|
|
368
|
+
"value": "https://club.example.com/profile/card.ttl#it",
|
|
369
|
+
},
|
|
370
|
+
"index": {
|
|
371
|
+
"classOrder": 5,
|
|
372
|
+
"termType": "NamedNode",
|
|
373
|
+
"value": "https://club.example.com/settings/private-type-index.ttl",
|
|
374
|
+
},
|
|
375
|
+
"label": "private",
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
]
|
|
379
|
+
|
|
380
|
+
describe('getScopedAppInstances', () => {
|
|
381
|
+
it('exists', () => {
|
|
382
|
+
expect(typeIndexLogic.getScopedAppInstances).toBeInstanceOf(Function)
|
|
383
|
+
})
|
|
384
|
+
it('pulls in users scopes and also community ones', async () => {
|
|
385
|
+
const result = await typeIndexLogic.getScopedAppInstances(Tracker, alice)
|
|
386
|
+
expect(result).toEqual(AliceAndClubScopes)
|
|
387
|
+
})
|
|
388
|
+
it('creates new preferenceFile and typeIndex files where they dont exist', async () => {
|
|
389
|
+
const result = await typeIndexLogic.getScopedAppInstances(Tracker, bob)
|
|
390
|
+
|
|
391
|
+
expect(requests[0].method).toEqual('PATCH') // Add preferrencesFile link to profile
|
|
392
|
+
expect(requests[0].url).toEqual('https://bob.example.com/profile/card.ttl')
|
|
393
|
+
|
|
394
|
+
expect(requests[1].method).toEqual('PUT') // create publiTypeIndex
|
|
395
|
+
expect(requests[1].url).toEqual('https://bob.example.com/profile/publicTypeIndex.ttl')
|
|
396
|
+
|
|
397
|
+
expect(requests[2].method).toEqual('PATCH') // Add link of publiTypeIndex to profile
|
|
398
|
+
expect(requests[2].url).toEqual('https://bob.example.com/profile/card.ttl')
|
|
399
|
+
|
|
400
|
+
expect(requests[3].method).toEqual('PUT') // create preferenceFile
|
|
401
|
+
expect(requests[3].url).toEqual('https://bob.example.com/Settings/Preferences.ttl')
|
|
402
|
+
|
|
403
|
+
expect(requests[4].method).toEqual('PATCH') // Add privateTypeIndex link preference file
|
|
404
|
+
expect(requests[4].url).toEqual('https://bob.example.com/Settings/Preferences.ttl')
|
|
405
|
+
|
|
406
|
+
expect(requests[5].method).toEqual('PUT') //create privatTypeIndex
|
|
407
|
+
expect(requests[5].url).toEqual('https://bob.example.com/Settings/privateTypeIndex.ttl')
|
|
408
|
+
|
|
409
|
+
expect(requests.length).toEqual(6)
|
|
410
|
+
|
|
411
|
+
})
|
|
57
412
|
})
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
413
|
+
|
|
414
|
+
const TRACKERS =
|
|
415
|
+
[
|
|
416
|
+
{
|
|
417
|
+
"classOrder": 5,
|
|
418
|
+
"termType": "NamedNode",
|
|
419
|
+
"value": "https://alice.example.com/publicStuff/actionItems.ttl#this",
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"classOrder": 5,
|
|
423
|
+
"termType": "NamedNode",
|
|
424
|
+
"value": "https://alice.example.com/project4/issues.ttl#this",
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"classOrder": 5,
|
|
428
|
+
"termType": "NamedNode",
|
|
429
|
+
"value": "https://alice.example.com/privateStuff/ToDo.ttl#this",
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"classOrder": 5,
|
|
433
|
+
"termType": "NamedNode",
|
|
434
|
+
"value": "https://alice.example.com/privateStuff/Goals.ttl#this",
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"classOrder": 5,
|
|
438
|
+
"termType": "NamedNode",
|
|
439
|
+
"value": "https://alice.example.com/privateStuff/workingOn.ttl#this",
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"classOrder": 5,
|
|
443
|
+
"termType": "NamedNode",
|
|
444
|
+
"value": "https://club.example.com/publicStuff/actionItems.ttl#this",
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"classOrder": 5,
|
|
448
|
+
"termType": "NamedNode",
|
|
449
|
+
"value": "https://club.example.com/project4/clubIssues.ttl#this",
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"classOrder": 5,
|
|
453
|
+
"termType": "NamedNode",
|
|
454
|
+
"value": "https://club.example.com/privateStuff/ToDo.ttl#this",
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"classOrder": 5,
|
|
458
|
+
"termType": "NamedNode",
|
|
459
|
+
"value": "https://club.example.com/privateStuff/Goals.ttl#this",
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"classOrder": 5,
|
|
463
|
+
"termType": "NamedNode",
|
|
464
|
+
"value": "https://club.example.com/privateStuff/tasks.ttl#this",
|
|
465
|
+
},
|
|
466
|
+
]
|
|
467
|
+
|
|
468
|
+
describe('getAppInstances', () => {
|
|
469
|
+
it('exists', () => {
|
|
470
|
+
expect(typeIndexLogic.getAppInstances).toBeInstanceOf(Function)
|
|
471
|
+
})
|
|
472
|
+
it('finds trackers', async () => {
|
|
473
|
+
const result = await typeIndexLogic.getAppInstances(Tracker)
|
|
474
|
+
expect(result).toEqual(TRACKERS)
|
|
475
|
+
expect(result).toEqual(uniqueNodes(result)) // shoud have no dups
|
|
476
|
+
})
|
|
477
|
+
it('finds images in containers', async () => {
|
|
478
|
+
const result = await typeIndexLogic.getAppInstances(Image)
|
|
479
|
+
expect(result.length).toEqual(3)
|
|
480
|
+
expect(result).toEqual(uniqueNodes(result)) // shoud have no dups
|
|
481
|
+
expect(result.map(x => x.uri).join()).toEqual("https://alice.example.com/profile/Photos/photo1.png,https://alice.example.com/profile/Photos/photo2.png,https://alice.example.com/profile/Photos/photo3.png")
|
|
482
|
+
})
|
|
66
483
|
})
|
|
67
|
-
})
|
|
68
484
|
|
|
69
|
-
|
|
485
|
+
describe('registerInTypeIndex', () => {
|
|
486
|
+
it('exists', () => {
|
|
487
|
+
expect(typeIndexLogic.registerInTypeIndex).toBeInstanceOf(Function)
|
|
488
|
+
})
|
|
489
|
+
it('throws error', async () => {
|
|
490
|
+
const result = await typeIndexLogic.registerInTypeIndex(
|
|
491
|
+
sym('https://test.test#'),
|
|
492
|
+
sym('https://test.test#'),
|
|
493
|
+
sym('https://test.test/TheClass')
|
|
494
|
+
)
|
|
495
|
+
console.log(result)
|
|
496
|
+
expect(result).toEqual(null)
|
|
497
|
+
})
|
|
498
|
+
})
|
|
499
|
+
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Session } from "@inrupt/solid-client-authn-browser";
|
|
2
|
-
import { LiveStore, NamedNode, Statement } from "rdflib";
|
|
3
|
-
import { AuthnLogic } from "../types";
|
|
4
|
-
export declare class SolidLogic {
|
|
5
|
-
store: LiveStore;
|
|
6
|
-
me: string | undefined;
|
|
7
|
-
authn: AuthnLogic;
|
|
8
|
-
aclLogic: any;
|
|
9
|
-
utilityLogic: any;
|
|
10
|
-
containerLogic: any;
|
|
11
|
-
profileLogic: any;
|
|
12
|
-
inboxLogic: any;
|
|
13
|
-
typeIndexLogic: any;
|
|
14
|
-
chatLogic: any;
|
|
15
|
-
constructor(specialFetch: {
|
|
16
|
-
fetch: (url: any, requestInit: any) => any;
|
|
17
|
-
}, session: Session);
|
|
18
|
-
load(doc: NamedNode | NamedNode[] | string): Promise<Response> | Promise<Response[]>;
|
|
19
|
-
updatePromise(del: Array<Statement>, ins?: Array<Statement>): Promise<void>;
|
|
20
|
-
clearStore(): void;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=SolidLogic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidLogic.d.ts","sourceRoot":"","sources":["../../src/logic/SolidLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AASzD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAQtC,qBAAa,UAAU;IAEnB,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,KAAK,EAAE,UAAU,CAAC;IAElB,QAAQ,MAAA;IACR,YAAY,MAAA;IACZ,cAAc,MAAA;IACd,YAAY,MAAA;IACZ,UAAU,MAAA;IACV,cAAc,MAAA;IACd,SAAS,MAAA;gBAGG,YAAY,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,KAAK,GAAG,CAAA;KAAE,EAAE,OAAO,EAAE,OAAO;IAuB1F,IAAI,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,MAAM;IAK1C,aAAa,CACT,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,EACrB,GAAG,GAAE,KAAK,CAAC,SAAS,CAAM,GAC3B,OAAO,CAAC,IAAI,CAAC;IAYhB,UAAU;CAGb"}
|
|
@@ -1 +0,0 @@
|
|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EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9E,CAAC;IACL,iBAAC;AAAD,CAAC,AA7DD,IA6DC;AA7DY,gCAAU"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import * as rdf from "rdflib";
|
|
2
|
-
import { SolidAuthnLogic } from "../authn/SolidAuthnLogic";
|
|
3
|
-
export declare function solidLogicSingleton(): {
|
|
4
|
-
store: rdf.LiveStore;
|
|
5
|
-
authn: SolidAuthnLogic;
|
|
6
|
-
authSession: import("@inrupt/solid-client-authn-browser").Session;
|
|
7
|
-
recursiveDelete: (url: string) => Promise<any>;
|
|
8
|
-
setSinglePeerAccess: (options: {
|
|
9
|
-
ownerWebId: string;
|
|
10
|
-
peerWebId: string;
|
|
11
|
-
accessToModes?: string | undefined;
|
|
12
|
-
defaultModes?: string | undefined;
|
|
13
|
-
target: string;
|
|
14
|
-
}) => Promise<any>;
|
|
15
|
-
createEmptyRdfDoc: (doc: rdf.NamedNode, comment: string) => Promise<void>;
|
|
16
|
-
followOrCreateLink: (subject: rdf.NamedNode, predicate: rdf.NamedNode, object: rdf.NamedNode, doc: rdf.NamedNode) => Promise<rdf.NamedNode | null>;
|
|
17
|
-
loadOrCreateIfNotExists: (doc: rdf.NamedNode) => Promise<any>;
|
|
18
|
-
isContainer: (url: string) => boolean;
|
|
19
|
-
createContainer: (url: string) => Promise<void>;
|
|
20
|
-
getContainerElements: (containerNode: rdf.NamedNode) => rdf.NamedNode[];
|
|
21
|
-
getContainerMembers: (containerUrl: string) => Promise<string[]>;
|
|
22
|
-
ensureTypeIndexes: (context: import("..").AuthenticationContext, agent?: rdf.NamedNode | undefined) => Promise<import("..").AuthenticationContext>;
|
|
23
|
-
loadTypeIndexes: (context: import("..").AuthenticationContext) => Promise<import("..").AuthenticationContext | undefined>;
|
|
24
|
-
registerInTypeIndex: (context: import("..").AuthenticationContext, instance: rdf.NamedNode, theClass: rdf.NamedNode, isPublic: boolean, agent?: rdf.NamedNode | undefined) => Promise<import("..").AuthenticationContext>;
|
|
25
|
-
loadIndex: (context: import("..").AuthenticationContext, isPublic: boolean) => Promise<import("..").AuthenticationContext>;
|
|
26
|
-
ensureOneTypeIndex: (context: import("..").AuthenticationContext, isPublic: boolean, agent?: rdf.NamedNode | undefined) => Promise<void | import("..").AuthenticationContext>;
|
|
27
|
-
putIndex: (newIndex: any, context: any) => Promise<any>;
|
|
28
|
-
makeIndexIfNecessary: (context: any, isPublic: any, store: any, ns: any) => Promise<any>;
|
|
29
|
-
loadIndexes: (me: string | rdf.NamedNode, publicProfile: string | rdf.NamedNode | null, preferencesFile: string | rdf.NamedNode | null, onWarning?: (_err: Error) => Promise<undefined>) => Promise<{
|
|
30
|
-
private: any;
|
|
31
|
-
public: any;
|
|
32
|
-
}>;
|
|
33
|
-
getTypeIndex: (me: string | rdf.NamedNode, preferencesFile: string | rdf.NamedNode, isPublic: boolean) => rdf.NamedNode[];
|
|
34
|
-
getRegistrations: (instance: any, theClass: any) => any;
|
|
35
|
-
loadTypeIndexesFor: (user: rdf.NamedNode) => Promise<import("../types").TypeIndexScope[]>;
|
|
36
|
-
loadCommunityTypeIndexes: (user: rdf.NamedNode) => Promise<import("../types").TypeIndexScope[][]>;
|
|
37
|
-
loadAllTypeIndexes: (user: rdf.NamedNode) => Promise<import("../types").TypeIndexScope[]>;
|
|
38
|
-
getScopedAppInstances: (klass: rdf.NamedNode, user: rdf.NamedNode) => Promise<import("../types").ScopedApp[]>;
|
|
39
|
-
getAppInstances: (klass: rdf.NamedNode) => Promise<rdf.NamedNode[]>;
|
|
40
|
-
suggestPublicTypeIndex: (me: rdf.NamedNode) => rdf.NamedNode;
|
|
41
|
-
suggestPrivateTypeIndex: (preferencesFile: rdf.NamedNode) => rdf.NamedNode;
|
|
42
|
-
registerInstanceInTypeIndex: (instance: rdf.NamedNode, index: rdf.NamedNode, theClass: rdf.NamedNode) => Promise<rdf.NamedNode | null>;
|
|
43
|
-
deleteTypeIndexRegistration: (item: any) => Promise<void>;
|
|
44
|
-
getScopedAppsFromIndex: (scope: any, theClass: rdf.NamedNode | null) => Promise<{
|
|
45
|
-
instance: rdf.NamedNode;
|
|
46
|
-
scope: any;
|
|
47
|
-
}[]>;
|
|
48
|
-
ensureLoadedPreferences: (context: import("..").AuthenticationContext) => Promise<import("..").AuthenticationContext>;
|
|
49
|
-
loadMe: () => Promise<rdf.NamedNode>;
|
|
50
|
-
getPodRoot: (user: rdf.NamedNode) => rdf.NamedNode;
|
|
51
|
-
getMainInbox: (user: rdf.NamedNode) => Promise<rdf.NamedNode>;
|
|
52
|
-
findStorage: (me: rdf.NamedNode) => any;
|
|
53
|
-
loadPreferences: (user: rdf.NamedNode) => Promise<rdf.NamedNode>;
|
|
54
|
-
loadProfile: (user: rdf.NamedNode) => Promise<rdf.NamedNode>;
|
|
55
|
-
silencedLoadPreferences: (user: rdf.NamedNode) => Promise<rdf.NamedNode | undefined>;
|
|
56
|
-
createInboxFor: (peerWebId: string, nick: string) => Promise<string>;
|
|
57
|
-
getNewMessages: (user?: rdf.NamedNode | undefined) => Promise<string[]>;
|
|
58
|
-
markAsRead: (url: string, date: Date) => Promise<void>;
|
|
59
|
-
setAcl: (chatContainer: rdf.NamedNode, me: rdf.NamedNode, invitee: rdf.NamedNode) => Promise<void>;
|
|
60
|
-
addToPrivateTypeIndex: (chatThing: any, me: any) => Promise<void>;
|
|
61
|
-
findChat: (invitee: rdf.NamedNode) => Promise<{
|
|
62
|
-
me: any;
|
|
63
|
-
chatContainer: rdf.NamedNode;
|
|
64
|
-
exists: boolean;
|
|
65
|
-
}>;
|
|
66
|
-
createChatThing: (chatContainer: rdf.NamedNode, me: rdf.NamedNode) => Promise<rdf.NamedNode>;
|
|
67
|
-
getChat: (invitee: rdf.NamedNode, createIfMissing?: boolean) => Promise<rdf.NamedNode | null>;
|
|
68
|
-
sendInvite: (invitee: rdf.NamedNode, chatThing: rdf.NamedNode) => Promise<void>;
|
|
69
|
-
mintNew: (newPaneOptions: import("../types").NewPaneOptions) => Promise<import("../types").CreatedPaneOptions>;
|
|
70
|
-
findAclDocUrl: (url: string) => Promise<any>;
|
|
71
|
-
setACLUserPublic: (docURI: string, me: rdf.NamedNode, options: {
|
|
72
|
-
defaultForNew?: boolean | undefined;
|
|
73
|
-
public?: [] | undefined;
|
|
74
|
-
}) => Promise<rdf.NamedNode>;
|
|
75
|
-
genACLText: (docURI: string, me: rdf.NamedNode, aclURI: string, options?: {
|
|
76
|
-
defaultForNew?: boolean | undefined;
|
|
77
|
-
public?: [] | undefined;
|
|
78
|
-
}) => string | undefined;
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=solidLogicSingletonNew.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingletonNew.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogicSingletonNew.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAW1D,wBAAgB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkKlC"}
|