solid-logic 3.0.9-d0d78d33 → 3.0.9-ea192f01

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/babel.config.js +6 -0
  2. package/eslint.config.js +23 -24
  3. package/jest.config.js +15 -8
  4. package/lib/acl/aclLogic.d.ts +2 -2
  5. package/lib/acl/aclLogic.d.ts.map +1 -1
  6. package/lib/authn/SolidAuthnLogic.d.ts +3 -3
  7. package/lib/authn/SolidAuthnLogic.d.ts.map +1 -1
  8. package/lib/authn/authUtil.d.ts +1 -1
  9. package/lib/chat/chatLogic.d.ts +1 -1
  10. package/lib/inbox/inboxLogic.d.ts +1 -1
  11. package/lib/inbox/inboxLogic.d.ts.map +1 -1
  12. package/lib/index.d.ts +1 -1
  13. package/lib/index.d.ts.map +1 -1
  14. package/lib/logic/CustomError.d.ts.map +1 -1
  15. package/lib/logic/solidLogic.d.ts +2 -2
  16. package/lib/logic/solidLogic.d.ts.map +1 -1
  17. package/lib/profile/profileLogic.d.ts +1 -1
  18. package/lib/solid-logic.js +107 -0
  19. package/lib/solid-logic.js.map +1 -0
  20. package/lib/types.d.ts +2 -2
  21. package/lib/util/containerLogic.d.ts +1 -1
  22. package/lib/util/containerLogic.d.ts.map +1 -1
  23. package/lib/util/debug.d.ts.map +1 -1
  24. package/lib/util/utilityLogic.d.ts +1 -1
  25. package/lib/util/utilityLogic.d.ts.map +1 -1
  26. package/lib/util/utils.d.ts +1 -1
  27. package/lib/util/utils.d.ts.map +1 -1
  28. package/package.json +38 -15
  29. package/rollup.config.js +29 -0
  30. package/src/acl/aclLogic.ts +8 -8
  31. package/src/authn/SolidAuthnLogic.ts +6 -6
  32. package/src/authn/authUtil.ts +1 -1
  33. package/src/chat/chatLogic.ts +75 -75
  34. package/src/inbox/inboxLogic.ts +19 -19
  35. package/src/index.ts +1 -1
  36. package/src/logic/CustomError.ts +6 -6
  37. package/src/logic/solidLogic.ts +22 -22
  38. package/src/logic/solidLogicSingleton.ts +3 -3
  39. package/src/profile/profileLogic.ts +22 -22
  40. package/src/typeIndex/typeIndexLogic.ts +7 -7
  41. package/src/types.ts +2 -2
  42. package/src/util/containerLogic.ts +15 -15
  43. package/src/util/debug.ts +4 -8
  44. package/src/util/utilityLogic.ts +18 -18
  45. package/src/util/utils.ts +12 -12
  46. package/src/versionInfo.ts +32 -0
  47. package/test/aclLogic.test.ts +5 -5
  48. package/test/authUtil.test.ts +1 -1
  49. package/test/chatLogic.test.ts +160 -154
  50. package/test/container.test.ts +23 -23
  51. package/test/helpers/dataSetup.ts +2 -1
  52. package/test/helpers/setup.ts +8 -3
  53. package/test/inboxLogic.test.ts +101 -110
  54. package/test/logic.test.ts +2 -2
  55. package/test/profileLogic.test.ts +35 -33
  56. package/test/solidAuthLogic.test.ts +1 -1
  57. package/test/typeIndexLogic.test.ts +71 -71
  58. package/test/utilityLogic.test.ts +46 -45
  59. package/test/utils.test.ts +11 -11
  60. package/timestamp.sh +13 -0
  61. package/tsconfig.json +5 -3
  62. package/tsconfig.test.json +8 -0
  63. package/lib/acl/aclLogic.js +0 -168
  64. package/lib/acl/aclLogic.js.map +0 -1
  65. package/lib/authSession/authSession.js +0 -8
  66. package/lib/authSession/authSession.js.map +0 -1
  67. package/lib/authn/SolidAuthnLogic.js +0 -191
  68. package/lib/authn/SolidAuthnLogic.js.map +0 -1
  69. package/lib/authn/authUtil.js +0 -105
  70. package/lib/authn/authUtil.js.map +0 -1
  71. package/lib/chat/chatLogic.js +0 -272
  72. package/lib/chat/chatLogic.js.map +0 -1
  73. package/lib/inbox/inboxLogic.js +0 -139
  74. package/lib/inbox/inboxLogic.js.map +0 -1
  75. package/lib/index.js +0 -29
  76. package/lib/index.js.map +0 -1
  77. package/lib/issuer/issuerLogic.js +0 -52
  78. package/lib/issuer/issuerLogic.js.map +0 -1
  79. package/lib/logic/CustomError.js +0 -89
  80. package/lib/logic/CustomError.js.map +0 -1
  81. package/lib/logic/solidLogic.js +0 -102
  82. package/lib/logic/solidLogic.js.map +0 -1
  83. package/lib/logic/solidLogicSingleton.js +0 -94
  84. package/lib/logic/solidLogicSingleton.js.map +0 -1
  85. package/lib/profile/profileLogic.js +0 -259
  86. package/lib/profile/profileLogic.js.map +0 -1
  87. package/lib/typeIndex/typeIndexLogic.js +0 -399
  88. package/lib/typeIndex/typeIndexLogic.js.map +0 -1
  89. package/lib/types.js +0 -3
  90. package/lib/types.js.map +0 -1
  91. package/lib/util/containerLogic.js +0 -102
  92. package/lib/util/containerLogic.js.map +0 -1
  93. package/lib/util/debug.js +0 -40
  94. package/lib/util/debug.js.map +0 -1
  95. package/lib/util/ns.js +0 -44
  96. package/lib/util/ns.js.map +0 -1
  97. package/lib/util/utilityLogic.js +0 -284
  98. package/lib/util/utilityLogic.js.map +0 -1
  99. package/lib/util/utils.js +0 -47
  100. package/lib/util/utils.js.map +0 -1
@@ -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,23 +34,22 @@ 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 = []
37
+ let requests: Request[] = []
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
54
53
 
55
54
  fetchMock.mockIf(/^https?.*$/, async req => {
56
55
 
@@ -69,9 +68,9 @@ describe("TypeIndex logic NEW", () => {
69
68
  body: prefixes + contents, // Add namespaces to anything
70
69
  status: 200,
71
70
  headers: {
72
- "Content-Type": "text/turtle",
73
- "WAC-Allow": 'user="write", public="read"',
74
- "Accept-Patch": "application/sparql-update"
71
+ 'Content-Type': 'text/turtle',
72
+ 'WAC-Allow': 'user="write", public="read"',
73
+ 'Accept-Patch': 'application/sparql-update'
75
74
  }
76
75
  }
77
76
  } // if contents
@@ -82,11 +81,11 @@ describe("TypeIndex logic NEW", () => {
82
81
  })
83
82
 
84
83
  store = new Store()
85
- store.fetcher = new Fetcher(store, { fetch: fetch });
86
- store.updater = new UpdateManager(store);
84
+ store.fetcher = new Fetcher(store, { fetch: fetch })
85
+ store.updater = new UpdateManager(store)
87
86
  const util = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
88
87
  typeIndexLogic = createTypeIndexLogic(store, authn, createProfileLogic(store, authn, util), util)
89
- });
88
+ })
90
89
 
91
90
  describe('loadAllTypeIndexes', () => {
92
91
  it('exists', () => {
@@ -95,32 +94,32 @@ describe("TypeIndex logic NEW", () => {
95
94
  })
96
95
 
97
96
  const AliceScopes = [{
98
- "agent": {
99
- "classOrder": 5,
100
- "termType": "NamedNode",
101
- "value": "https://alice.example.com/profile/card.ttl#me",
97
+ 'agent': {
98
+ 'classOrder': 5,
99
+ 'termType': 'NamedNode',
100
+ 'value': 'https://alice.example.com/profile/card.ttl#me',
102
101
  },
103
- "index": {
104
- "classOrder": 5,
105
- "termType": "NamedNode",
106
- "value": "https://alice.example.com/profile/public-type-index.ttl",
102
+ 'index': {
103
+ 'classOrder': 5,
104
+ 'termType': 'NamedNode',
105
+ 'value': 'https://alice.example.com/profile/public-type-index.ttl',
107
106
  },
108
- "label": "public",
107
+ 'label': 'public',
109
108
  },
110
109
  {
111
- "agent": {
112
- "classOrder": 5,
113
- "termType": "NamedNode",
114
- "value": "https://alice.example.com/profile/card.ttl#me",
110
+ 'agent': {
111
+ 'classOrder': 5,
112
+ 'termType': 'NamedNode',
113
+ 'value': 'https://alice.example.com/profile/card.ttl#me',
115
114
  },
116
- "index": {
117
- "classOrder": 5,
118
- "termType": "NamedNode",
119
- "value": "https://alice.example.com/settings/private-type-index.ttl",
115
+ 'index': {
116
+ 'classOrder': 5,
117
+ 'termType': 'NamedNode',
118
+ 'value': 'https://alice.example.com/settings/private-type-index.ttl',
120
119
  },
121
- "label": "private",
120
+ 'label': 'private',
122
121
  }
123
- ];
122
+ ]
124
123
 
125
124
  describe('loadTypeIndexesFor', () => {
126
125
  it('exists', () => {
@@ -137,30 +136,30 @@ describe("TypeIndex logic NEW", () => {
137
136
  const ClubScopes =
138
137
  [
139
138
  {
140
- "agent": {
141
- "classOrder": 5,
142
- "termType": "NamedNode",
143
- "value": "https://club.example.com/profile/card.ttl#it",
139
+ 'agent': {
140
+ 'classOrder': 5,
141
+ 'termType': 'NamedNode',
142
+ 'value': 'https://club.example.com/profile/card.ttl#it',
144
143
  },
145
- "index": {
146
- "classOrder": 5,
147
- "termType": "NamedNode",
148
- "value": "https://club.example.com/profile/public-type-index.ttl",
144
+ 'index': {
145
+ 'classOrder': 5,
146
+ 'termType': 'NamedNode',
147
+ 'value': 'https://club.example.com/profile/public-type-index.ttl',
149
148
  },
150
- "label": "public",
149
+ 'label': 'public',
151
150
  },
152
151
  {
153
- "agent": {
154
- "classOrder": 5,
155
- "termType": "NamedNode",
156
- "value": "https://club.example.com/profile/card.ttl#it",
152
+ 'agent': {
153
+ 'classOrder': 5,
154
+ 'termType': 'NamedNode',
155
+ 'value': 'https://club.example.com/profile/card.ttl#it',
157
156
  },
158
- "index": {
159
- "classOrder": 5,
160
- "termType": "NamedNode",
161
- "value": "https://club.example.com/settings/private-type-index.ttl",
157
+ 'index': {
158
+ 'classOrder': 5,
159
+ 'termType': 'NamedNode',
160
+ 'value': 'https://club.example.com/settings/private-type-index.ttl',
162
161
  },
163
- "label": "private",
162
+ 'label': 'private',
164
163
  }
165
164
  ]
166
165
  describe('loadCommunityTypeIndexes', () => {
@@ -173,7 +172,7 @@ describe("TypeIndex logic NEW", () => {
173
172
  })
174
173
  })
175
174
 
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"}}]
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'}}]
177
176
 
178
177
  describe('getScopedAppInstances', () => {
179
178
  it('exists', () => {
@@ -184,6 +183,7 @@ describe("TypeIndex logic NEW", () => {
184
183
  expect(result).toEqual(AliceAndClubScopes) // @@ AliceAndClubScopes
185
184
  })
186
185
  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,33 +2,32 @@
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 = []
21
+ let requests: Request[] = []
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
32
31
 
33
32
  fetchMock.mockIf(/^https?.*$/, async req => {
34
33
 
@@ -47,9 +46,9 @@ describe("utilityLogic", () => {
47
46
  body: prefixes + contents, // Add namespaces to anything
48
47
  status: 200,
49
48
  headers: {
50
- "Content-Type": "text/turtle",
51
- "WAC-Allow": 'user="write", public="read"',
52
- "Accept-Patch": "application/sparql-update"
49
+ 'Content-Type': 'text/turtle',
50
+ 'WAC-Allow': 'user="write", public="read"',
51
+ 'Accept-Patch': 'application/sparql-update'
53
52
  }
54
53
  }
55
54
  } // if contents
@@ -71,25 +70,27 @@ describe("utilityLogic", () => {
71
70
  web[ClubPrivateTypeIndex.uri] = ClubPrivateTypes
72
71
  web[ClubPublicTypeIndex.uri] = ClubPublicTypes
73
72
 
74
- options = { fetch: fetch };
73
+ options = { fetch: fetch }
75
74
  store = new Store()
76
- store.fetcher = new Fetcher(store, options);
77
- store.updater = new UpdateManager(store);
75
+ store.fetcher = new Fetcher(store, options)
76
+ store.updater = new UpdateManager(store)
78
77
  requests = []
79
78
  utilityLogic = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
80
- });
79
+ })
81
80
 
82
81
  describe('loadOrCreateIfNotExists', () => {
83
82
  it('exists', () => {
84
83
  expect(utilityLogic.loadOrCreateIfNotExists).toBeInstanceOf(Function)
85
84
  })
86
85
  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
93
94
  const result = await utilityLogic.loadOrCreateIfNotExists(sym(suggestion))
94
95
  expect(requests[0].method).toEqual('PUT')
95
96
  expect(requests[0].url).toEqual(suggestion)
@@ -126,32 +127,32 @@ describe("utilityLogic", () => {
126
127
  })
127
128
 
128
129
  })
129
- describe("setSinglePeerAccess", () => {
130
+ describe('setSinglePeerAccess', () => {
130
131
  beforeEach(() => {
131
132
  fetchMock.mockOnceIf(
132
- "https://owner.com/some/resource",
133
- "hello", {
133
+ 'https://owner.com/some/resource',
134
+ 'hello', {
134
135
  headers: {
135
136
  Link: '<https://owner.com/some/acl>; rel="acl"'
136
137
  }
137
- });
138
+ })
138
139
  fetchMock.mockOnceIf(
139
- "https://owner.com/some/acl",
140
- "Created", {
140
+ 'https://owner.com/some/acl',
141
+ 'Created', {
141
142
  status: 201
142
- });
143
- });
144
- it("Creates the right ACL doc", async () => {
143
+ })
144
+ })
145
+ it('Creates the right ACL doc', async () => {
145
146
  await utilityLogic.setSinglePeerAccess({
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
- });
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
+ })
152
153
  expect(fetchMock.mock.calls).toEqual([
153
- [ "https://owner.com/some/resource", fetchMock.mock.calls[0][1] ],
154
- [ "https://owner.com/some/acl", {
154
+ [ 'https://owner.com/some/resource', fetchMock.mock.calls[0][1] ],
155
+ [ 'https://owner.com/some/acl', {
155
156
  body: '@prefix acl: <http://www.w3.org/ns/auth/acl#>.\n' +
156
157
  '\n' +
157
158
  '<#alice> a acl:Authorization;\n' +
@@ -168,12 +169,12 @@ describe("setSinglePeerAccess", () => {
168
169
  ' acl:default <https://owner.com/some/resource>;\n' +
169
170
  ' acl:mode acl:Write.\n',
170
171
  headers: [
171
- ["Content-Type", "text/turtle"]
172
+ ['Content-Type', 'text/turtle']
172
173
  ],
173
- method: "PUT"
174
+ method: 'PUT'
174
175
  }]
175
- ]);
176
- });
177
- });
176
+ ])
177
+ })
178
+ })
178
179
 
179
180
  })
@@ -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/timestamp.sh ADDED
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+
3
+ echo "export default {"
4
+ date -u '+buildTime: "%Y-%m-%dT%H:%M:%SZ",'
5
+ git log | grep commit | head -1 | sed -e 's/ /: "/' | sed -e 's/$/",/'
6
+ echo " npmInfo: {"
7
+ npm version | sed 's/\x1b\[[0-9;:]*[mG]//g' | grep -v '^{' | while read line; do
8
+ key=$(echo "$line" | cut -d ':' -f 1 | tr -d ' ')
9
+ value=$(echo "$line" | cut -d ':' -f 2- | tr -d ' ')
10
+ echo " \"${key}\": \"${value}\","
11
+ done
12
+ echo " }"
13
+ echo "};"
package/tsconfig.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Basic Options */
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'. */,
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. */
6
7
  "lib": [
7
8
  "dom",
8
9
  "es2015",
@@ -71,5 +72,6 @@
71
72
  },
72
73
  "include": [
73
74
  "src/**/*"
74
- ]
75
+ ],
76
+ "exclude": ["node_modules"]
75
77
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["test/**/*"],
4
+ "compilerOptions": {
5
+ "rootDir": ".",
6
+ "noEmit": true
7
+ }
8
+ }