solid-logic 3.0.9-f51524a8 → 3.0.9-fa4d7e8

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 (100) hide show
  1. package/eslint.config.js +24 -23
  2. package/jest.config.js +8 -15
  3. package/lib/acl/aclLogic.d.ts +2 -2
  4. package/lib/acl/aclLogic.d.ts.map +1 -1
  5. package/lib/acl/aclLogic.js +168 -0
  6. package/lib/acl/aclLogic.js.map +1 -0
  7. package/lib/authSession/authSession.js +8 -0
  8. package/lib/authSession/authSession.js.map +1 -0
  9. package/lib/authn/SolidAuthnLogic.d.ts +3 -3
  10. package/lib/authn/SolidAuthnLogic.d.ts.map +1 -1
  11. package/lib/authn/SolidAuthnLogic.js +191 -0
  12. package/lib/authn/SolidAuthnLogic.js.map +1 -0
  13. package/lib/authn/authUtil.d.ts +1 -1
  14. package/lib/authn/authUtil.js +105 -0
  15. package/lib/authn/authUtil.js.map +1 -0
  16. package/lib/chat/chatLogic.d.ts +1 -1
  17. package/lib/chat/chatLogic.js +272 -0
  18. package/lib/chat/chatLogic.js.map +1 -0
  19. package/lib/inbox/inboxLogic.d.ts +1 -1
  20. package/lib/inbox/inboxLogic.d.ts.map +1 -1
  21. package/lib/inbox/inboxLogic.js +139 -0
  22. package/lib/inbox/inboxLogic.js.map +1 -0
  23. package/lib/index.d.ts +2 -1
  24. package/lib/index.d.ts.map +1 -1
  25. package/lib/index.js +31 -0
  26. package/lib/index.js.map +1 -0
  27. package/lib/issuer/issuerLogic.js +52 -0
  28. package/lib/issuer/issuerLogic.js.map +1 -0
  29. package/lib/logic/CustomError.d.ts.map +1 -1
  30. package/lib/logic/CustomError.js +89 -0
  31. package/lib/logic/CustomError.js.map +1 -0
  32. package/lib/logic/solidLogic.d.ts +2 -2
  33. package/lib/logic/solidLogic.d.ts.map +1 -1
  34. package/lib/logic/solidLogic.js +102 -0
  35. package/lib/logic/solidLogic.js.map +1 -0
  36. package/lib/logic/solidLogicSingleton.js +94 -0
  37. package/lib/logic/solidLogicSingleton.js.map +1 -0
  38. package/lib/profile/profileLogic.d.ts +1 -1
  39. package/lib/profile/profileLogic.js +259 -0
  40. package/lib/profile/profileLogic.js.map +1 -0
  41. package/lib/typeIndex/typeIndexLogic.js +399 -0
  42. package/lib/typeIndex/typeIndexLogic.js.map +1 -0
  43. package/lib/types.d.ts +2 -2
  44. package/lib/types.js +3 -0
  45. package/lib/types.js.map +1 -0
  46. package/lib/util/containerLogic.d.ts +1 -1
  47. package/lib/util/containerLogic.d.ts.map +1 -1
  48. package/lib/util/containerLogic.js +102 -0
  49. package/lib/util/containerLogic.js.map +1 -0
  50. package/lib/util/debug.d.ts.map +1 -1
  51. package/lib/util/debug.js +40 -0
  52. package/lib/util/debug.js.map +1 -0
  53. package/lib/util/ns.js +44 -0
  54. package/lib/util/ns.js.map +1 -0
  55. package/lib/util/utilityLogic.d.ts +1 -1
  56. package/lib/util/utilityLogic.d.ts.map +1 -1
  57. package/lib/util/utilityLogic.js +284 -0
  58. package/lib/util/utilityLogic.js.map +1 -0
  59. package/lib/util/utils.d.ts +1 -1
  60. package/lib/util/utils.d.ts.map +1 -1
  61. package/lib/util/utils.js +47 -0
  62. package/lib/util/utils.js.map +1 -0
  63. package/package.json +15 -38
  64. package/src/acl/aclLogic.ts +8 -8
  65. package/src/authn/SolidAuthnLogic.ts +6 -6
  66. package/src/authn/authUtil.ts +1 -1
  67. package/src/chat/chatLogic.ts +75 -75
  68. package/src/inbox/inboxLogic.ts +19 -19
  69. package/src/index.ts +2 -1
  70. package/src/logic/CustomError.ts +6 -6
  71. package/src/logic/solidLogic.ts +22 -22
  72. package/src/logic/solidLogicSingleton.ts +3 -3
  73. package/src/profile/profileLogic.ts +22 -22
  74. package/src/typeIndex/typeIndexLogic.ts +7 -7
  75. package/src/types.ts +2 -2
  76. package/src/util/containerLogic.ts +15 -15
  77. package/src/util/debug.ts +8 -4
  78. package/src/util/utilityLogic.ts +18 -18
  79. package/src/util/utils.ts +12 -12
  80. package/test/aclLogic.test.ts +5 -5
  81. package/test/authUtil.test.ts +1 -1
  82. package/test/chatLogic.test.ts +154 -160
  83. package/test/container.test.ts +23 -23
  84. package/test/helpers/dataSetup.ts +1 -2
  85. package/test/helpers/setup.ts +3 -8
  86. package/test/inboxLogic.test.ts +110 -101
  87. package/test/logic.test.ts +2 -2
  88. package/test/profileLogic.test.ts +33 -35
  89. package/test/solidAuthLogic.test.ts +1 -1
  90. package/test/typeIndexLogic.test.ts +71 -71
  91. package/test/utilityLogic.test.ts +45 -46
  92. package/test/utils.test.ts +11 -11
  93. package/tsconfig.json +3 -5
  94. package/babel.config.js +0 -6
  95. package/lib/solid-logic.js +0 -107
  96. package/lib/solid-logic.js.map +0 -1
  97. package/rollup.config.js +0 -29
  98. package/src/versionInfo.ts +0 -32
  99. package/timestamp.sh +0 -13
  100. package/tsconfig.test.json +0 -8
@@ -2,15 +2,15 @@
2
2
  * @jest-environment jsdom
3
3
  *
4
4
  */
5
- import { Fetcher, Store, sym, UpdateManager } from 'rdflib'
6
- import { createAclLogic } from '../src/acl/aclLogic'
7
- import { createProfileLogic } from '../src/profile/profileLogic'
8
- import { createTypeIndexLogic} from '../src/typeIndex/typeIndexLogic'
9
- import { createContainerLogic } from '../src/util/containerLogic'
10
- import { ns } from '../src/util/ns'
11
- import { createUtilityLogic } from '../src/util/utilityLogic'
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'
5
+ import { Fetcher, Store, sym, UpdateManager } from "rdflib";
6
+ import { createAclLogic } from "../src/acl/aclLogic";
7
+ import { createProfileLogic } from "../src/profile/profileLogic";
8
+ import { createTypeIndexLogic} from "../src/typeIndex/typeIndexLogic";
9
+ import { createContainerLogic } from "../src/util/containerLogic";
10
+ import { ns } from "../src/util/ns";
11
+ import { createUtilityLogic } from "../src/util/utilityLogic";
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";
14
14
 
15
15
  const prefixes = Object.keys(ns).map(prefix => `@prefix ${prefix}: ${ns[prefix]('')}.\n`).join('') // In turtle
16
16
  window.$SolidTestEnvironment = { username: alice.uri }
@@ -34,22 +34,23 @@ web[club.doc().uri] = ClubProfile
34
34
  web[ClubPreferencesFile.uri] = ClubPreferences
35
35
  web[ClubPrivateTypeIndex.uri] = ClubPrivateTypes
36
36
  web[ClubPublicTypeIndex.uri] = ClubPublicTypes
37
- let requests: Request[] = []
37
+ let requests = []
38
38
  let statustoBeReturned = 200
39
39
  let typeIndexLogic
40
40
 
41
- describe('TypeIndex logic NEW', () => {
42
- let store
41
+ describe("TypeIndex logic NEW", () => {
42
+ let store;
43
43
  const authn = {
44
44
  currentUser: () => {
45
- return alice
45
+ return alice;
46
46
  },
47
- }
47
+ };
48
48
 
49
49
  beforeEach(() => {
50
- fetchMock.resetMocks()
50
+ fetchMock.resetMocks();
51
51
  requests = []
52
52
  statustoBeReturned = 200
53
+ const init = { headers: { "Content-Type": "text/turtle" } } // Fetch options tend to be called this
53
54
 
54
55
  fetchMock.mockIf(/^https?.*$/, async req => {
55
56
 
@@ -68,9 +69,9 @@ describe('TypeIndex logic NEW', () => {
68
69
  body: prefixes + contents, // Add namespaces to anything
69
70
  status: 200,
70
71
  headers: {
71
- 'Content-Type': 'text/turtle',
72
- 'WAC-Allow': 'user="write", public="read"',
73
- 'Accept-Patch': 'application/sparql-update'
72
+ "Content-Type": "text/turtle",
73
+ "WAC-Allow": 'user="write", public="read"',
74
+ "Accept-Patch": "application/sparql-update"
74
75
  }
75
76
  }
76
77
  } // if contents
@@ -81,11 +82,11 @@ describe('TypeIndex logic NEW', () => {
81
82
  })
82
83
 
83
84
  store = new Store()
84
- store.fetcher = new Fetcher(store, { fetch: fetch })
85
- store.updater = new UpdateManager(store)
85
+ store.fetcher = new Fetcher(store, { fetch: fetch });
86
+ store.updater = new UpdateManager(store);
86
87
  const util = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
87
88
  typeIndexLogic = createTypeIndexLogic(store, authn, createProfileLogic(store, authn, util), util)
88
- })
89
+ });
89
90
 
90
91
  describe('loadAllTypeIndexes', () => {
91
92
  it('exists', () => {
@@ -94,32 +95,32 @@ describe('TypeIndex logic NEW', () => {
94
95
  })
95
96
 
96
97
  const AliceScopes = [{
97
- 'agent': {
98
- 'classOrder': 5,
99
- 'termType': 'NamedNode',
100
- 'value': 'https://alice.example.com/profile/card.ttl#me',
98
+ "agent": {
99
+ "classOrder": 5,
100
+ "termType": "NamedNode",
101
+ "value": "https://alice.example.com/profile/card.ttl#me",
101
102
  },
102
- 'index': {
103
- 'classOrder': 5,
104
- 'termType': 'NamedNode',
105
- 'value': 'https://alice.example.com/profile/public-type-index.ttl',
103
+ "index": {
104
+ "classOrder": 5,
105
+ "termType": "NamedNode",
106
+ "value": "https://alice.example.com/profile/public-type-index.ttl",
106
107
  },
107
- 'label': 'public',
108
+ "label": "public",
108
109
  },
109
110
  {
110
- 'agent': {
111
- 'classOrder': 5,
112
- 'termType': 'NamedNode',
113
- 'value': 'https://alice.example.com/profile/card.ttl#me',
111
+ "agent": {
112
+ "classOrder": 5,
113
+ "termType": "NamedNode",
114
+ "value": "https://alice.example.com/profile/card.ttl#me",
114
115
  },
115
- 'index': {
116
- 'classOrder': 5,
117
- 'termType': 'NamedNode',
118
- 'value': 'https://alice.example.com/settings/private-type-index.ttl',
116
+ "index": {
117
+ "classOrder": 5,
118
+ "termType": "NamedNode",
119
+ "value": "https://alice.example.com/settings/private-type-index.ttl",
119
120
  },
120
- 'label': 'private',
121
+ "label": "private",
121
122
  }
122
- ]
123
+ ];
123
124
 
124
125
  describe('loadTypeIndexesFor', () => {
125
126
  it('exists', () => {
@@ -136,30 +137,30 @@ describe('TypeIndex logic NEW', () => {
136
137
  const ClubScopes =
137
138
  [
138
139
  {
139
- 'agent': {
140
- 'classOrder': 5,
141
- 'termType': 'NamedNode',
142
- 'value': 'https://club.example.com/profile/card.ttl#it',
140
+ "agent": {
141
+ "classOrder": 5,
142
+ "termType": "NamedNode",
143
+ "value": "https://club.example.com/profile/card.ttl#it",
143
144
  },
144
- 'index': {
145
- 'classOrder': 5,
146
- 'termType': 'NamedNode',
147
- 'value': 'https://club.example.com/profile/public-type-index.ttl',
145
+ "index": {
146
+ "classOrder": 5,
147
+ "termType": "NamedNode",
148
+ "value": "https://club.example.com/profile/public-type-index.ttl",
148
149
  },
149
- 'label': 'public',
150
+ "label": "public",
150
151
  },
151
152
  {
152
- 'agent': {
153
- 'classOrder': 5,
154
- 'termType': 'NamedNode',
155
- 'value': 'https://club.example.com/profile/card.ttl#it',
153
+ "agent": {
154
+ "classOrder": 5,
155
+ "termType": "NamedNode",
156
+ "value": "https://club.example.com/profile/card.ttl#it",
156
157
  },
157
- 'index': {
158
- 'classOrder': 5,
159
- 'termType': 'NamedNode',
160
- 'value': 'https://club.example.com/settings/private-type-index.ttl',
158
+ "index": {
159
+ "classOrder": 5,
160
+ "termType": "NamedNode",
161
+ "value": "https://club.example.com/settings/private-type-index.ttl",
161
162
  },
162
- 'label': 'private',
163
+ "label": "private",
163
164
  }
164
165
  ]
165
166
  describe('loadCommunityTypeIndexes', () => {
@@ -172,7 +173,7 @@ describe('TypeIndex logic NEW', () => {
172
173
  })
173
174
  })
174
175
 
175
- const AliceAndClubScopes = [{'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/publicStuff/actionItems.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/profile/card.ttl#me'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/profile/public-type-index.ttl'}, 'label': 'public'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}, {'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/project4/issues.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/profile/card.ttl#me'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/profile/public-type-index.ttl'}, 'label': 'public'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}, {'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/privateStuff/ToDo.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/profile/card.ttl#me'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/settings/private-type-index.ttl'}, 'label': 'private'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}, {'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/privateStuff/Goals.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/profile/card.ttl#me'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/settings/private-type-index.ttl'}, 'label': 'private'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}, {'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/privateStuff/workingOn.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/profile/card.ttl#me'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/settings/private-type-index.ttl'}, 'label': 'private'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}, {'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/publicStuff/actionItems.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/profile/card.ttl#it'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/profile/public-type-index.ttl'}, 'label': 'public'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}, {'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/project4/clubIssues.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/profile/card.ttl#it'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/profile/public-type-index.ttl'}, 'label': 'public'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}, {'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/privateStuff/ToDo.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/profile/card.ttl#it'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/settings/private-type-index.ttl'}, 'label': 'private'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}, {'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/privateStuff/Goals.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/profile/card.ttl#it'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/settings/private-type-index.ttl'}, 'label': 'private'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}, {'instance': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/privateStuff/tasks.ttl#this'}, 'scope': {'agent': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/profile/card.ttl#it'}, 'index': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/settings/private-type-index.ttl'}, 'label': 'private'}, 'type': {'classOrder': 5, 'termType': 'NamedNode', 'value': 'http://www.w3.org/2005/01/wf/flow#Tracker'}}]
176
+ const AliceAndClubScopes = [{"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/publicStuff/actionItems.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/profile/card.ttl#me"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/profile/public-type-index.ttl"}, "label": "public"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}, {"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/project4/issues.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/profile/card.ttl#me"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/profile/public-type-index.ttl"}, "label": "public"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}, {"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/privateStuff/ToDo.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/profile/card.ttl#me"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/settings/private-type-index.ttl"}, "label": "private"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}, {"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/privateStuff/Goals.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/profile/card.ttl#me"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/settings/private-type-index.ttl"}, "label": "private"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}, {"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/privateStuff/workingOn.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/profile/card.ttl#me"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/settings/private-type-index.ttl"}, "label": "private"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}, {"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/publicStuff/actionItems.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/profile/card.ttl#it"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/profile/public-type-index.ttl"}, "label": "public"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}, {"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/project4/clubIssues.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/profile/card.ttl#it"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/profile/public-type-index.ttl"}, "label": "public"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}, {"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/privateStuff/ToDo.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/profile/card.ttl#it"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/settings/private-type-index.ttl"}, "label": "private"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}, {"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/privateStuff/Goals.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/profile/card.ttl#it"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/settings/private-type-index.ttl"}, "label": "private"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}, {"instance": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/privateStuff/tasks.ttl#this"}, "scope": {"agent": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/profile/card.ttl#it"}, "index": {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/settings/private-type-index.ttl"}, "label": "private"}, "type": {"classOrder": 5, "termType": "NamedNode", "value": "http://www.w3.org/2005/01/wf/flow#Tracker"}}]
176
177
 
177
178
  describe('getScopedAppInstances', () => {
178
179
  it('exists', () => {
@@ -183,7 +184,6 @@ describe('TypeIndex logic NEW', () => {
183
184
  expect(result).toEqual(AliceAndClubScopes) // @@ AliceAndClubScopes
184
185
  })
185
186
  it('creates new preferenceFile and typeIndex files where they dont exist', async () => {
186
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
187
187
  const result = await typeIndexLogic.getScopedAppInstances(Tracker, bob)
188
188
 
189
189
  expect(requests[0].method).toEqual('PATCH') // Add preferrencesFile link to profile
@@ -210,16 +210,16 @@ describe('TypeIndex logic NEW', () => {
210
210
  })
211
211
 
212
212
  const TRACKERS =
213
- [{'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/publicStuff/actionItems.ttl#this'},
214
- {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/project4/issues.ttl#this'},
215
- {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/privateStuff/ToDo.ttl#this'},
216
- {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/privateStuff/Goals.ttl#this'},
217
- {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://alice.example.com/privateStuff/workingOn.ttl#this'},
218
- {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/publicStuff/actionItems.ttl#this'},
219
- {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/project4/clubIssues.ttl#this'},
220
- {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/privateStuff/ToDo.ttl#this'},
221
- {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/privateStuff/Goals.ttl#this'},
222
- {'classOrder': 5, 'termType': 'NamedNode', 'value': 'https://club.example.com/privateStuff/tasks.ttl#this'} ]
213
+ [{"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/publicStuff/actionItems.ttl#this"},
214
+ {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/project4/issues.ttl#this"},
215
+ {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/privateStuff/ToDo.ttl#this"},
216
+ {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/privateStuff/Goals.ttl#this"},
217
+ {"classOrder": 5, "termType": "NamedNode", "value": "https://alice.example.com/privateStuff/workingOn.ttl#this"},
218
+ {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/publicStuff/actionItems.ttl#this"},
219
+ {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/project4/clubIssues.ttl#this"},
220
+ {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/privateStuff/ToDo.ttl#this"},
221
+ {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/privateStuff/Goals.ttl#this"},
222
+ {"classOrder": 5, "termType": "NamedNode", "value": "https://club.example.com/privateStuff/tasks.ttl#this"} ]
223
223
 
224
224
  describe('getAppInstances', () => {
225
225
  it('exists', () => {
@@ -234,7 +234,7 @@ describe('TypeIndex logic NEW', () => {
234
234
  const result = await typeIndexLogic.getAppInstances(Image)
235
235
  expect(result.length).toEqual(1)
236
236
  expect(result).toEqual(uniqueNodes(result)) // shoud have no dups
237
- expect(result.map(x => x.uri).join()).toEqual('https://alice.example.com/profile/Photos/')
237
+ expect(result.map(x => x.uri).join()).toEqual("https://alice.example.com/profile/Photos/")
238
238
  })
239
239
  })
240
240
 
@@ -2,32 +2,33 @@
2
2
  * @jest-environment jsdom
3
3
  *
4
4
  */
5
- import fetchMock from 'jest-fetch-mock'
6
- import { UpdateManager, sym, Fetcher, Store } from 'rdflib'
7
- import { createAclLogic } from '../src/acl/aclLogic'
8
- import { WebOperationError } from '../src/logic/CustomError'
9
- import { createContainerLogic } from '../src/util/containerLogic'
10
- import { ns } from '../src/util/ns'
11
- import { createUtilityLogic } from '../src/util/utilityLogic'
12
- import { alice, AlicePhotoFolder, AlicePhotos, AlicePreferences, AlicePreferencesFile, AlicePrivateTypeIndex, AlicePrivateTypes, AliceProfile, AlicePublicTypeIndex, AlicePublicTypes, bob, BobProfile, club, ClubPreferences, ClubPreferencesFile, ClubPrivateTypeIndex, ClubPrivateTypes, ClubProfile, ClubPublicTypeIndex, ClubPublicTypes } from './helpers/dataSetup'
5
+ import fetchMock from "jest-fetch-mock";
6
+ import { UpdateManager, sym, Fetcher, Store } from "rdflib";
7
+ import { createAclLogic } from "../src/acl/aclLogic";
8
+ import { WebOperationError } from "../src/logic/CustomError";
9
+ import { createContainerLogic } from "../src/util/containerLogic";
10
+ import { ns } from "../src/util/ns";
11
+ import { createUtilityLogic } from "../src/util/utilityLogic";
12
+ import { alice, AlicePhotoFolder, AlicePhotos, AlicePreferences, AlicePreferencesFile, AlicePrivateTypeIndex, AlicePrivateTypes, AliceProfile, AlicePublicTypeIndex, AlicePublicTypes, bob, BobProfile, club, ClubPreferences, ClubPreferencesFile, ClubPrivateTypeIndex, ClubPrivateTypes, ClubProfile, ClubPublicTypeIndex, ClubPublicTypes } from "./helpers/dataSetup";
13
13
 
14
14
  window.$SolidTestEnvironment = { username: alice.uri }
15
15
  const prefixes = Object.keys(ns).map(prefix => `@prefix ${prefix}: ${ns[prefix]('')}.\n`).join('') // In turtle
16
16
 
17
- describe('utilityLogic', () => {
18
- let store
19
- let options
17
+ describe("utilityLogic", () => {
18
+ let store;
19
+ let options;
20
20
  let web = {}
21
- let requests: Request[] = []
21
+ let requests = []
22
22
  let statustoBeReturned = 200
23
23
  let utilityLogic
24
24
  beforeEach(() => {
25
- fetchMock.resetMocks()
26
- fetchMock.mockResponse('Not Found', {
25
+ fetchMock.resetMocks();
26
+ fetchMock.mockResponse("Not Found", {
27
27
  status: 404,
28
- })
28
+ });
29
29
  requests = []
30
30
  statustoBeReturned = 200
31
+ const init = { headers: { "Content-Type": "text/turtle" } } // Fetch options tend to be called this
31
32
 
32
33
  fetchMock.mockIf(/^https?.*$/, async req => {
33
34
 
@@ -46,9 +47,9 @@ describe('utilityLogic', () => {
46
47
  body: prefixes + contents, // Add namespaces to anything
47
48
  status: 200,
48
49
  headers: {
49
- 'Content-Type': 'text/turtle',
50
- 'WAC-Allow': 'user="write", public="read"',
51
- 'Accept-Patch': 'application/sparql-update'
50
+ "Content-Type": "text/turtle",
51
+ "WAC-Allow": 'user="write", public="read"',
52
+ "Accept-Patch": "application/sparql-update"
52
53
  }
53
54
  }
54
55
  } // if contents
@@ -70,27 +71,25 @@ describe('utilityLogic', () => {
70
71
  web[ClubPrivateTypeIndex.uri] = ClubPrivateTypes
71
72
  web[ClubPublicTypeIndex.uri] = ClubPublicTypes
72
73
 
73
- options = { fetch: fetch }
74
+ options = { fetch: fetch };
74
75
  store = new Store()
75
- store.fetcher = new Fetcher(store, options)
76
- store.updater = new UpdateManager(store)
76
+ store.fetcher = new Fetcher(store, options);
77
+ store.updater = new UpdateManager(store);
77
78
  requests = []
78
79
  utilityLogic = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
79
- })
80
+ });
80
81
 
81
82
  describe('loadOrCreateIfNotExists', () => {
82
83
  it('exists', () => {
83
84
  expect(utilityLogic.loadOrCreateIfNotExists).toBeInstanceOf(Function)
84
85
  })
85
86
  it('does nothing if existing file', async () => {
86
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
87
87
  const result = await utilityLogic.loadOrCreateIfNotExists(alice.doc())
88
88
  expect(requests).toEqual([])
89
89
 
90
90
  })
91
91
  it('creates empty file if did not exist', async () => {
92
92
  const suggestion = 'https://bob.example.com/settings/prefsSuggestion.ttl'
93
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
94
93
  const result = await utilityLogic.loadOrCreateIfNotExists(sym(suggestion))
95
94
  expect(requests[0].method).toEqual('PUT')
96
95
  expect(requests[0].url).toEqual(suggestion)
@@ -127,32 +126,32 @@ describe('utilityLogic', () => {
127
126
  })
128
127
 
129
128
  })
130
- describe('setSinglePeerAccess', () => {
129
+ describe("setSinglePeerAccess", () => {
131
130
  beforeEach(() => {
132
131
  fetchMock.mockOnceIf(
133
- 'https://owner.com/some/resource',
134
- 'hello', {
132
+ "https://owner.com/some/resource",
133
+ "hello", {
135
134
  headers: {
136
135
  Link: '<https://owner.com/some/acl>; rel="acl"'
137
136
  }
138
- })
137
+ });
139
138
  fetchMock.mockOnceIf(
140
- 'https://owner.com/some/acl',
141
- 'Created', {
139
+ "https://owner.com/some/acl",
140
+ "Created", {
142
141
  status: 201
143
- })
144
- })
145
- it('Creates the right ACL doc', async () => {
142
+ });
143
+ });
144
+ it("Creates the right ACL doc", async () => {
146
145
  await utilityLogic.setSinglePeerAccess({
147
- ownerWebId: 'https://owner.com/#me',
148
- peerWebId: 'https://peer.com/#me',
149
- accessToModes: 'acl:Read, acl:Control',
150
- defaultModes: 'acl:Write',
151
- target: 'https://owner.com/some/resource'
152
- })
146
+ ownerWebId: "https://owner.com/#me",
147
+ peerWebId: "https://peer.com/#me",
148
+ accessToModes: "acl:Read, acl:Control",
149
+ defaultModes: "acl:Write",
150
+ target: "https://owner.com/some/resource"
151
+ });
153
152
  expect(fetchMock.mock.calls).toEqual([
154
- [ 'https://owner.com/some/resource', fetchMock.mock.calls[0][1] ],
155
- [ 'https://owner.com/some/acl', {
153
+ [ "https://owner.com/some/resource", fetchMock.mock.calls[0][1] ],
154
+ [ "https://owner.com/some/acl", {
156
155
  body: '@prefix acl: <http://www.w3.org/ns/auth/acl#>.\n' +
157
156
  '\n' +
158
157
  '<#alice> a acl:Authorization;\n' +
@@ -169,12 +168,12 @@ describe('setSinglePeerAccess', () => {
169
168
  ' acl:default <https://owner.com/some/resource>;\n' +
170
169
  ' acl:mode acl:Write.\n',
171
170
  headers: [
172
- ['Content-Type', 'text/turtle']
171
+ ["Content-Type", "text/turtle"]
173
172
  ],
174
- method: 'PUT'
173
+ method: "PUT"
175
174
  }]
176
- ])
177
- })
178
- })
175
+ ]);
176
+ });
177
+ });
179
178
 
180
179
  })
@@ -1,5 +1,5 @@
1
- import * as rdf from 'rdflib'
2
- import { getArchiveUrl, uniqueNodes } from '../src/util/utils'
1
+ import * as rdf from "rdflib";
2
+ import { getArchiveUrl, uniqueNodes } from '../src/util/utils';
3
3
 
4
4
  describe('utils', () => {
5
5
  describe('uniqueNodes', () => {
@@ -19,14 +19,14 @@ describe('utils', () => {
19
19
  })
20
20
  })
21
21
 
22
- describe('getArchiveUrl', () => {
23
- it('produces the right URL in February', () => {
24
- const url = getArchiveUrl('https://example.com/inbox/asdf-qwer-asdf-qwer', new Date('7 Feb 2062 UTC'))
25
- expect(url).toEqual('https://example.com/inbox/archive/2062/02/07/asdf-qwer-asdf-qwer')
26
- })
27
- it('produces the right URL in November', () => {
28
- const url = getArchiveUrl('https://example.com/inbox/asdf-qwer-asdf-qwer', new Date('12 Nov 2012 UTC'))
29
- expect(url).toEqual('https://example.com/inbox/archive/2012/11/12/asdf-qwer-asdf-qwer')
30
- })
22
+ describe("getArchiveUrl", () => {
23
+ it("produces the right URL in February", () => {
24
+ const url = getArchiveUrl('https://example.com/inbox/asdf-qwer-asdf-qwer', new Date('7 Feb 2062 UTC'));
25
+ expect(url).toEqual('https://example.com/inbox/archive/2062/02/07/asdf-qwer-asdf-qwer');
26
+ });
27
+ it("produces the right URL in November", () => {
28
+ const url = getArchiveUrl('https://example.com/inbox/asdf-qwer-asdf-qwer', new Date('12 Nov 2012 UTC'));
29
+ expect(url).toEqual('https://example.com/inbox/archive/2012/11/12/asdf-qwer-asdf-qwer');
30
+ });
31
31
  })
32
32
  })
package/tsconfig.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Basic Options */
4
- "target": "ES2020", /* Allow top-level await and modern JS features. */
5
- "module": "ESNext", /* Use ESNext modules for Webpack/Babel compatibility. */
6
- "moduleResolution": "node", /* Use Node.js-style module resolution for Webpack compatibility. */
4
+ "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
5
+ "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
7
6
  "lib": [
8
7
  "dom",
9
8
  "es2015",
@@ -72,6 +71,5 @@
72
71
  },
73
72
  "include": [
74
73
  "src/**/*"
75
- ],
76
- "exclude": ["node_modules"]
74
+ ]
77
75
  }
package/babel.config.js DELETED
@@ -1,6 +0,0 @@
1
- export default {
2
- presets: [
3
- ["@babel/preset-env", { targets: { node: "current" } }],
4
- "@babel/preset-typescript"
5
- ]
6
- };