solid-logic 3.0.9-ea192f01 → 3.0.9-ed64096

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 (81) hide show
  1. package/package.json +9 -3
  2. package/babel.config.js +0 -6
  3. package/eslint.config.js +0 -28
  4. package/jest.config.js +0 -17
  5. package/rollup.config.js +0 -29
  6. package/src/acl/aclLogic.ts +0 -156
  7. package/src/authSession/authSession.ts +0 -13
  8. package/src/authn/SolidAuthnLogic.ts +0 -126
  9. package/src/authn/authUtil.ts +0 -70
  10. package/src/chat/chatLogic.ts +0 -226
  11. package/src/inbox/inboxLogic.ts +0 -59
  12. package/src/index.ts +0 -21
  13. package/src/issuer/issuerLogic.ts +0 -40
  14. package/src/logic/CustomError.ts +0 -29
  15. package/src/logic/solidLogic.ts +0 -76
  16. package/src/logic/solidLogicSingleton.ts +0 -20
  17. package/src/profile/profileLogic.ts +0 -125
  18. package/src/typeIndex/typeIndexLogic.ts +0 -198
  19. package/src/types.ts +0 -122
  20. package/src/util/containerLogic.ts +0 -53
  21. package/src/util/debug.ts +0 -16
  22. package/src/util/ns.ts +0 -5
  23. package/src/util/utilityLogic.ts +0 -156
  24. package/src/util/utils.ts +0 -52
  25. package/src/versionInfo.ts +0 -32
  26. package/test/aclLogic.test.ts +0 -24
  27. package/test/authUtil.test.ts +0 -23
  28. package/test/chatLogic.test.ts +0 -322
  29. package/test/container.test.ts +0 -58
  30. package/test/helpers/dataSetup.ts +0 -135
  31. package/test/helpers/setup.ts +0 -22
  32. package/test/inboxLogic.test.ts +0 -209
  33. package/test/logic.test.ts +0 -29
  34. package/test/profileLogic.test.ts +0 -248
  35. package/test/solidAuthLogic.test.ts +0 -49
  36. package/test/typeIndexLogic.test.ts +0 -255
  37. package/test/utilityLogic.test.ts +0 -180
  38. package/test/utils.test.ts +0 -32
  39. package/timestamp.sh +0 -13
  40. package/tsconfig.json +0 -77
  41. package/tsconfig.test.json +0 -8
  42. /package/{lib → dist}/acl/aclLogic.d.ts +0 -0
  43. /package/{lib → dist}/acl/aclLogic.d.ts.map +0 -0
  44. /package/{lib → dist}/authSession/authSession.d.ts +0 -0
  45. /package/{lib → dist}/authSession/authSession.d.ts.map +0 -0
  46. /package/{lib → dist}/authn/SolidAuthnLogic.d.ts +0 -0
  47. /package/{lib → dist}/authn/SolidAuthnLogic.d.ts.map +0 -0
  48. /package/{lib → dist}/authn/authUtil.d.ts +0 -0
  49. /package/{lib → dist}/authn/authUtil.d.ts.map +0 -0
  50. /package/{lib → dist}/chat/chatLogic.d.ts +0 -0
  51. /package/{lib → dist}/chat/chatLogic.d.ts.map +0 -0
  52. /package/{lib → dist}/inbox/inboxLogic.d.ts +0 -0
  53. /package/{lib → dist}/inbox/inboxLogic.d.ts.map +0 -0
  54. /package/{lib → dist}/index.d.ts +0 -0
  55. /package/{lib → dist}/index.d.ts.map +0 -0
  56. /package/{lib → dist}/issuer/issuerLogic.d.ts +0 -0
  57. /package/{lib → dist}/issuer/issuerLogic.d.ts.map +0 -0
  58. /package/{lib → dist}/logic/CustomError.d.ts +0 -0
  59. /package/{lib → dist}/logic/CustomError.d.ts.map +0 -0
  60. /package/{lib → dist}/logic/solidLogic.d.ts +0 -0
  61. /package/{lib → dist}/logic/solidLogic.d.ts.map +0 -0
  62. /package/{lib → dist}/logic/solidLogicSingleton.d.ts +0 -0
  63. /package/{lib → dist}/logic/solidLogicSingleton.d.ts.map +0 -0
  64. /package/{lib → dist}/profile/profileLogic.d.ts +0 -0
  65. /package/{lib → dist}/profile/profileLogic.d.ts.map +0 -0
  66. /package/{lib → dist}/solid-logic.js +0 -0
  67. /package/{lib → dist}/solid-logic.js.map +0 -0
  68. /package/{lib → dist}/typeIndex/typeIndexLogic.d.ts +0 -0
  69. /package/{lib → dist}/typeIndex/typeIndexLogic.d.ts.map +0 -0
  70. /package/{lib → dist}/types.d.ts +0 -0
  71. /package/{lib → dist}/types.d.ts.map +0 -0
  72. /package/{lib → dist}/util/containerLogic.d.ts +0 -0
  73. /package/{lib → dist}/util/containerLogic.d.ts.map +0 -0
  74. /package/{lib → dist}/util/debug.d.ts +0 -0
  75. /package/{lib → dist}/util/debug.d.ts.map +0 -0
  76. /package/{lib → dist}/util/ns.d.ts +0 -0
  77. /package/{lib → dist}/util/ns.d.ts.map +0 -0
  78. /package/{lib → dist}/util/utilityLogic.d.ts +0 -0
  79. /package/{lib → dist}/util/utilityLogic.d.ts.map +0 -0
  80. /package/{lib → dist}/util/utils.d.ts +0 -0
  81. /package/{lib → dist}/util/utils.d.ts.map +0 -0
@@ -1,322 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- *
4
- */
5
- import { UpdateManager, Store, Fetcher } from 'rdflib'
6
- import { createAclLogic } from '../src/acl/aclLogic'
7
- import { createChatLogic } from '../src/chat/chatLogic'
8
- import { createProfileLogic } from '../src/profile/profileLogic'
9
- import { createContainerLogic } from '../src/util/containerLogic'
10
- import { createUtilityLogic } from '../src/util/utilityLogic'
11
- import { alice, bob } from './helpers/dataSetup'
12
-
13
- declare global {
14
- interface Window {
15
- $SolidTestEnvironment?: { username: string }
16
- }
17
- }
18
-
19
- window.$SolidTestEnvironment = { username: alice.uri }
20
-
21
- describe('Chat logic', () => {
22
- let chatLogic
23
- let store
24
- beforeEach(() => {
25
- fetchMock.resetMocks()
26
- fetchMock.mockResponse('Not Found', {
27
- status: 404,
28
- })
29
- store = new Store()
30
- store.fetcher = new Fetcher(store, { fetch: fetch })
31
- store.updater = new UpdateManager(store)
32
- const authn = {
33
- currentUser: () => {
34
- return alice
35
- },
36
- }
37
- const util = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
38
- chatLogic = createChatLogic(store, createProfileLogic(store, authn, util))
39
- })
40
-
41
- describe('get chat, without creating', () => {
42
- describe('when no chat exists yet', () => {
43
- let result
44
- beforeEach(async () => {
45
- aliceHasValidProfile()
46
- noChatWithBobExists()
47
- result = await chatLogic.getChat(bob, false)
48
- })
49
- it('does not return a chat', async () => {
50
- expect(result).toBeNull()
51
- })
52
- it('loaded the current user profile', () => {
53
- expect(fetchMock.mock.calls[0][0]).toBe(
54
- 'https://alice.example.com/profile/card.ttl'
55
- )
56
- })
57
- it('tried to load the chat document', () => {
58
- expect(fetchMock.mock.calls[1][0]).toBe(
59
- 'https://alice.example.com/IndividualChats/bob.example.com/index.ttl'
60
- )
61
- })
62
- it('has no additional fetch requests', () => {
63
- expect(fetchMock.mock.calls.length).toBe(2)
64
- })
65
- })
66
- })
67
-
68
- describe('get chat, create if missing', () => {
69
- describe('when no chat exists yet', () => {
70
- let result
71
- beforeEach(async () => {
72
- Date.now = jest.fn(() =>
73
- new Date(Date.UTC(2021, 1, 6, 10, 11, 12)).valueOf()
74
- )
75
- aliceHasValidProfile()
76
- noChatWithBobExists()
77
- chatWithBobCanBeCreated()
78
- bobHasAnInbox()
79
- invitationCanBeSent()
80
- chatContainerIsFound()
81
- chatContainerAclCanBeSet()
82
- editablePrivateTypeIndexIsFound()
83
- privateTypeIndexIsUpdated()
84
- result = await chatLogic.getChat(bob, true)
85
- })
86
- it('returns the chat URI based on the invitee\'s WebID', () => {
87
- expect(result.uri).toBe(
88
- 'https://alice.example.com/IndividualChats/bob.example.com/index.ttl#this'
89
- )
90
- })
91
- it('created a chat document', () => {
92
- const request = getRequestTo(
93
- 'PUT',
94
- 'https://alice.example.com/IndividualChats/bob.example.com/index.ttl'
95
- )
96
- expect(request.body).toBe(`@prefix : <#>.
97
- @prefix dc: <http://purl.org/dc/elements/1.1/>.
98
- @prefix meeting: <http://www.w3.org/ns/pim/meeting#>.
99
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
100
- @prefix c: </profile/card.ttl#>.
101
-
102
- :this
103
- a meeting:LongChat;
104
- dc:author c:me;
105
- dc:created "2021-02-06T10:11:12Z"^^xsd:dateTime;
106
- dc:title "Chat channel".
107
- `)
108
- })
109
- it('allowed Bob to participate in the chat by adding an ACL', () => {
110
- const request = getRequestTo(
111
- 'PUT',
112
- 'https://alice.example.com/IndividualChats/bob.example.com/.acl'
113
- )
114
- expect(request.body).toBe(`
115
- @prefix acl: <http://www.w3.org/ns/auth/acl#>.
116
- <#owner>
117
- a acl:Authorization;
118
- acl:agent <https://alice.example.com/profile/card.ttl#me>;
119
- acl:accessTo <.>;
120
- acl:default <.>;
121
- acl:mode
122
- acl:Read, acl:Write, acl:Control.
123
- <#invitee>
124
- a acl:Authorization;
125
- acl:agent <https://bob.example.com/profile/card.ttl#me>;
126
- acl:accessTo <.>;
127
- acl:default <.>;
128
- acl:mode
129
- acl:Read, acl:Append.
130
- `)
131
- })
132
- it('sent an invitation to invitee inbox', () => {
133
- const request = getRequestTo('POST', 'https://bob.example.com/inbox')
134
- expect(request.body).toContain(`
135
- <> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;
136
- <http://www.w3.org/1999/02/22-rdf-syntax-ns#seeAlso> <https://alice.example.com/IndividualChats/bob.example.com/index.ttl#this> .
137
- `)
138
- })
139
- it('added the new chat to private type index', () => {
140
- const request = getRequestTo(
141
- 'PATCH',
142
- 'https://alice.example.com/settings/privateTypeIndex.ttl'
143
- )
144
- expect(request.body)
145
- .toBe(`INSERT DATA { <https://alice.example.com/settings/privateTypeIndex.ttl#id1612606272000> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/solid/terms#TypeRegistration> .
146
- <https://alice.example.com/settings/privateTypeIndex.ttl#id1612606272000> <http://www.w3.org/ns/solid/terms#forClass> <http://www.w3.org/ns/pim/meeting#LongChat> .
147
- <https://alice.example.com/settings/privateTypeIndex.ttl#id1612606272000> <http://www.w3.org/ns/solid/terms#instance> <https://alice.example.com/IndividualChats/bob.example.com/index.ttl#this> .
148
- }
149
- `)
150
- })
151
- it('has no additional fetch requests', () => {
152
- expect(fetchMock.mock.calls.length).toBe(9)
153
- })
154
- })
155
- })
156
-
157
- describe('possible errors', () => {
158
- it('profile does not link to storage', async () => {
159
- fetchMock.mockOnceIf('https://alice.example.com/profile/card.ttl', '<><><>.', {
160
- headers: {
161
- 'Content-Type': 'text/turtle',
162
- },
163
- })
164
- const expectedError = new Error('User pod root not found!')
165
- await expect(chatLogic.getChat(bob, false)).rejects.toEqual(expectedError)
166
- })
167
-
168
- it('invitee inbox not found', async () => {
169
- aliceHasValidProfile()
170
- noChatWithBobExists()
171
- chatWithBobCanBeCreated()
172
- bobDoesNotHaveAnInbox()
173
- const expectedError = new Error(
174
- 'Invitee inbox not found! https://bob.example.com/profile/card.ttl#me'
175
- )
176
- await expect(chatLogic.getChat(bob, true)).rejects.toEqual(expectedError)
177
- })
178
- })
179
-
180
- function aliceHasValidProfile() {
181
- fetchMock.mockOnceIf(
182
- 'https://alice.example.com/profile/card.ttl',
183
- `
184
- <https://alice.example.com/profile/card.ttl#me>
185
- <http://www.w3.org/ns/pim/space#storage> <https://alice.example.com/> ;
186
- <http://www.w3.org/ns/solid/terms#privateTypeIndex> <https://alice.example.com/settings/privateTypeIndex.ttl> ;
187
- .`,
188
- {
189
- headers: {
190
- 'Content-Type': 'text/turtle',
191
- },
192
- }
193
- )
194
- }
195
-
196
- function noChatWithBobExists() {
197
- return fetchMock.mockOnceIf(
198
- ({ url, method }) =>
199
- url === 'https://alice.example.com/IndividualChats/bob.example.com/index.ttl' &&
200
- method === 'GET',
201
- 'Not found',
202
- {
203
- status: 404,
204
- }
205
- )
206
- }
207
-
208
- function chatWithBobCanBeCreated() {
209
- return fetchMock.mockOnceIf(
210
- ({ url, method }) =>
211
- url === 'https://alice.example.com/IndividualChats/bob.example.com/index.ttl' &&
212
- method === 'PUT',
213
- 'Created',
214
- {
215
- status: 201,
216
- }
217
- )
218
- }
219
-
220
- function bobHasAnInbox() {
221
- fetchMock.mockOnceIf(
222
- 'https://bob.example.com/profile/card.ttl',
223
- '<https://bob.example.com/profile/card.ttl#me><http://www.w3.org/ns/ldp#inbox><https://bob.example.com/inbox>.',
224
- {
225
- headers: { 'Content-Type': 'text/turtle' },
226
- }
227
- )
228
- }
229
-
230
- function bobDoesNotHaveAnInbox() {
231
- fetchMock.mockOnceIf('https://bob.example.com/profile/card.ttl', '<><><>.', {
232
- headers: {
233
- 'Content-Type': 'text/turtle',
234
- },
235
- })
236
- }
237
-
238
- function invitationCanBeSent() {
239
- return fetchMock.mockOnceIf(
240
- ({ url, method }) =>
241
- url === 'https://bob.example.com/inbox' && method === 'POST',
242
- 'Created',
243
- {
244
- status: 201,
245
- headers: {
246
- location:
247
- 'https://bob.example.com/inbox/22373339-6cc0-49fc-b69e-0402edda6e4e.ttl',
248
- },
249
- }
250
- )
251
- }
252
-
253
- function chatContainerIsFound() {
254
- return fetchMock.mockOnceIf(
255
- ({ url, method }) =>
256
- url === 'https://alice.example.com/IndividualChats/bob.example.com/' &&
257
- method === 'GET',
258
- '<><><>.',
259
- {
260
- status: 200,
261
- headers: {
262
- 'Content-Type': 'text/turtle',
263
- Link: '<.acl>; rel="acl"',
264
- },
265
- }
266
- )
267
- }
268
-
269
- function chatContainerAclCanBeSet() {
270
- return fetchMock.mockOnceIf(
271
- ({ url, method }) =>
272
- url === 'https://alice.example.com/IndividualChats/bob.example.com/.acl' &&
273
- method === 'PUT',
274
- 'Created',
275
- {
276
- status: 201,
277
- }
278
- )
279
- }
280
-
281
- function editablePrivateTypeIndexIsFound() {
282
- return fetchMock.mockOnceIf(
283
- ({ url, method }) =>
284
- url === 'https://alice.example.com/settings/privateTypeIndex.ttl' &&
285
- method === 'GET',
286
- '<><><>.',
287
- {
288
- status: 200,
289
- headers: {
290
- 'Content-Type': 'text/turtle',
291
- 'wac-allow': 'user="read write append control",public=""',
292
- 'ms-author-via': 'SPARQL',
293
- },
294
- }
295
- )
296
- }
297
-
298
- function privateTypeIndexIsUpdated() {
299
- return fetchMock.mockOnceIf(
300
- ({ url, method }) =>
301
- url === 'https://alice.example.com/settings/privateTypeIndex.ttl' &&
302
- method === 'PATCH',
303
- 'OK',
304
- {
305
- status: 200,
306
- }
307
- )
308
- }
309
-
310
- function getRequestTo(
311
- method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'PATCH',
312
- url: string
313
- ): RequestInit {
314
- const call = fetchMock.mock.calls.find(
315
- (it) => it[0] === url && method === it[1]?.method
316
- )
317
- expect(call).not.toBeNull()
318
- const request = call?.[1]
319
- expect(request).not.toBeNull()
320
- return request!
321
- }
322
- })
@@ -1,58 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- *
4
- */
5
- import { UpdateManager, Store, Fetcher, sym } from 'rdflib'
6
- import { createContainerLogic } from '../src/util/containerLogic'
7
- import { alice } from './helpers/dataSetup'
8
-
9
- window.$SolidTestEnvironment = { username: alice.uri }
10
-
11
- describe('Container', () => {
12
- let store
13
- let containerLogic
14
- beforeEach(() => {
15
- fetchMock.resetMocks()
16
- store = new Store()
17
- store.fetcher = new Fetcher(store, { fetch: fetch })
18
- store.updater = new UpdateManager(store)
19
- containerLogic = createContainerLogic(store)
20
- })
21
-
22
- it('getContainerMembers - When container has some containment triples', async () => {
23
- containerHasSomeContainmentTriples()
24
- const containerMembers = await containerLogic.getContainerMembers(sym('https://container.com/'))
25
- const result = containerMembers.map(oneResult => oneResult.value)
26
- expect(result.sort()).toEqual([
27
- 'https://container.com/foo.txt',
28
- 'https://container.com/bar/'
29
- ].sort())
30
- })
31
- it.skip('getContainerMembers- When container is empty - Resolves to an empty array', async () => {
32
- jest.setTimeout(2000)
33
- containerIsEmpty()
34
- const result = await containerLogic.getContainerMembers(sym('https://container.com/'))
35
- expect(result).toEqual([])
36
- })
37
-
38
- function containerIsEmpty() {
39
- fetchMock.mockOnceIf(
40
- 'https://com/',
41
- '', // FIXME: https://github.com/jefflau/jest-fetch-mock/issues/189
42
- {
43
- headers: { 'Content-Type': 'text/turtle' },
44
- }
45
- )
46
- }
47
-
48
- function containerHasSomeContainmentTriples() {
49
- fetchMock.mockOnceIf(
50
- 'https://container.com/',
51
- '<.> <http://www.w3.org/ns/ldp#contains> <./foo.txt>, <./bar/> .',
52
- {
53
- headers: { 'Content-Type': 'text/turtle' },
54
- }
55
- )
56
-
57
- }
58
- })
@@ -1,135 +0,0 @@
1
- import { sym } from 'rdflib'
2
- import * as rdf from "rdflib";
3
- import solidNamespace from "solid-namespace";
4
- import { SolidNamespace } from '../../src/types';
5
- const ns: SolidNamespace = solidNamespace(rdf);
6
-
7
- //------ Club -------------------------------------------------------
8
- const club = sym('https://club.example.com/profile/card.ttl#it')
9
- const ClubPreferencesFile = sym('https://club.example.com/settings/prefs.ttl')
10
- const ClubPublicTypeIndex = sym('https://club.example.com/profile/public-type-index.ttl')
11
- const ClubPrivateTypeIndex = sym('https://club.example.com/settings/private-type-index.ttl')
12
-
13
- const ClubProfile = `
14
-
15
- <#it> a vcard:Organization;
16
- space:preferencesFile ${ClubPreferencesFile};
17
- solid:publicTypeIndex ${ClubPublicTypeIndex};
18
- vcard:fn "Card Club" .
19
- `
20
- const ClubPreferences = `
21
- ${club} solid:privateTypeIndex ${ClubPrivateTypeIndex} .
22
- `
23
- const ClubPublicTypes = `
24
-
25
- :chat1 solid:forClass meeting:LongChat; solid:instance <../publicStuff/ourChat.ttl#this> .
26
-
27
- :todo solid:forClass wf:Tracker; solid:instance <../publicStuff/actionItems.ttl#this>.
28
-
29
- :issues solid:forClass wf:Tracker; solid:instance <../project4/clubIssues.ttl#this>.
30
- `;
31
-
32
- const ClubPrivateTypes = `
33
- :id1592319218311 solid:forClass wf:Tracker; solid:instance <../privateStuff/ToDo.ttl#this>.
34
-
35
- :id1592319391415 solid:forClass wf:Tracker; solid:instance <../privateStuff/Goals.ttl#this>.
36
-
37
- :id1595595377864 solid:forClass wf:Tracker; solid:instance <../privateStuff/tasks.ttl#this>.
38
-
39
- :id1596123375929 solid:forClass meeting:Meeting; solid:instance <../project4/clubMeeting.ttl#this>.
40
-
41
- `;
42
-
43
- //------ Alice -------------------------------------------------------
44
- const alice = sym("https://alice.example.com/profile/card.ttl#me")
45
- const AliceProfileFile = alice.doc()
46
- const AlicePreferencesFile = sym('https://alice.example.com/settings/prefs.ttl')
47
- const AlicePublicTypeIndex = sym('https://alice.example.com/profile/public-type-index.ttl')
48
- const AlicePrivateTypeIndex = sym('https://alice.example.com/settings/private-type-index.ttl')
49
- const aliceDir = alice.dir();
50
- const AlicePhotoFolder = sym((aliceDir && aliceDir.uri ? aliceDir.uri : "") + "Photos/")
51
- const AliceProfile = `
52
- <#me> a vcard:Individual;
53
- space:preferencesFile ${AlicePreferencesFile};
54
- solid:publicTypeIndex ${AlicePublicTypeIndex};
55
- vcard:fn "Alice" .
56
- `
57
- const AlicePreferences = `
58
- ${alice} solid:privateTypeIndex ${AlicePrivateTypeIndex};
59
- solid:community ${club} .
60
- `
61
- const AlicePublicTypes = `
62
-
63
- :chat1 solid:forClass meeting:LongChat; solid:instance <../publicStuff/myChat.ttl#this> .
64
-
65
- :todo solid:forClass wf:Tracker; solid:instance <../publicStuff/actionItems.ttl#this>.
66
-
67
- :issues solid:forClass wf:Tracker; solid:instance <../project4/issues.ttl#this>.
68
-
69
- :photos solid:forClass schema:Image; solid:instanceContainer ${AlicePhotoFolder} .
70
- `;
71
-
72
- const AlicePrivateTypes = `
73
- :id1592319218311 solid:forClass wf:Tracker; solid:instance <../privateStuff/ToDo.ttl#this>.
74
-
75
- :id1592319391415 solid:forClass wf:Tracker; solid:instance <../privateStuff/Goals.ttl#this>.
76
-
77
- :id1595595377864 solid:forClass wf:Tracker; solid:instance <../privateStuff/workingOn.ttl#this>.
78
-
79
- :id1596123375929 solid:forClass meeting:Meeting; solid:instance <../project4/meeting1.ttl#this>.
80
-
81
- `;
82
-
83
- const AlicePhotos = `
84
- <>
85
- a ldp:BasicContainer, ldp:Container;
86
- dct:modified "2021-04-26T05:34:16Z"^^xsd:dateTime;
87
- ldp:contains
88
- <photo1.png>, <photo2.png>, <photo3.png> ;
89
- stat:mtime 1619415256.541;
90
- stat:size 4096 .
91
- `
92
-
93
- //------ Bob -------------------------------------------------------
94
- const bob = sym('https://bob.example.com/profile/card.ttl#me')
95
-
96
- const BobProfile = `
97
- <#me> a vcard:Individual;
98
- vcard:fn "Bob" .
99
- `
100
-
101
- //------ Boby -------------------------------------------------------
102
- const boby = sym('https://boby.example.com/profile/card.ttl#me')
103
-
104
- const BobyProfile = `
105
- <#me> a vcard:Individual;
106
- vcard:fn "Boby" .
107
- `
108
- export function loadWebObject() {
109
- const web = {}
110
- web[alice.doc().uri] = AliceProfile
111
- web[AlicePreferencesFile.uri] = AlicePreferences
112
- web[AlicePrivateTypeIndex.uri] = AlicePrivateTypes
113
- web[AlicePublicTypeIndex.uri] = AlicePublicTypes
114
- web[AlicePhotoFolder.uri] = AlicePhotos
115
- web[bob.doc().uri] = BobProfile
116
- web[boby.doc().uri] = BobyProfile
117
-
118
- web[club.doc().uri] = ClubProfile
119
- web[ClubPreferencesFile.uri] = ClubPreferences
120
- web[ClubPrivateTypeIndex.uri] = ClubPrivateTypes
121
- web[ClubPublicTypeIndex.uri] = ClubPublicTypes
122
- return web
123
- }
124
-
125
- function clearLocalStore(store) {
126
- store.statements.slice().forEach(store.remove.bind(store))
127
- }
128
-
129
- export {
130
- alice, bob, boby, club,
131
- AlicePhotoFolder, AlicePreferences, AlicePhotos, AlicePreferencesFile, AlicePrivateTypeIndex, AlicePrivateTypes, AliceProfile, AliceProfileFile, AlicePublicTypeIndex, AlicePublicTypes,
132
- BobProfile,
133
- ClubPreferences, ClubPreferencesFile, ClubPrivateTypeIndex, ClubPrivateTypes, ClubProfile, ClubPublicTypeIndex, ClubPublicTypes,
134
- clearLocalStore
135
- }
@@ -1,22 +0,0 @@
1
- import { error, log, trace, warn } from '../../src/util/debug'
2
- import fetchMock from "jest-fetch-mock";
3
- import { TextEncoder as UtilTextEncoder, TextDecoder as UtilTextDecoder } from 'util'
4
-
5
- if (typeof global.TextEncoder === 'undefined') {
6
- global.TextEncoder = UtilTextEncoder as unknown as { new (): TextEncoder; prototype: TextEncoder }
7
- }
8
- if (typeof global.TextDecoder === 'undefined') {
9
- global.TextDecoder = UtilTextDecoder as unknown as { new (): TextDecoder; prototype: TextDecoder }
10
- }
11
-
12
-
13
- fetchMock.enableMocks();
14
- // We don't want to output debug messages to console as part of the tests
15
- jest.mock('../../src/util/debug')
16
-
17
- export function silenceDebugMessages () {
18
- (log as any).mockImplementation(() => null)
19
- ;(warn as any).mockImplementation(() => null)
20
- ;(error as any).mockImplementation(() => null)
21
- ;(trace as any).mockImplementation(() => null)
22
- }