solid-logic 1.3.17-80b4d030 → 1.3.17-81536f11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/acl/aclLogic.d.ts +2 -11
- package/lib/acl/aclLogic.d.ts.map +1 -1
- package/lib/acl/aclLogic.js.map +1 -1
- package/lib/chat/chatLogic.d.ts +2 -15
- package/lib/chat/chatLogic.d.ts.map +1 -1
- package/lib/chat/chatLogic.js +8 -7
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/inbox/inboxLogic.d.ts +2 -6
- package/lib/inbox/inboxLogic.d.ts.map +1 -1
- package/lib/inbox/inboxLogic.js.map +1 -1
- package/lib/index.d.ts +4 -18
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -86
- package/lib/index.js.map +1 -1
- package/lib/issuer/issuerLogic.js +1 -1
- package/lib/issuer/issuerLogic.js.map +1 -1
- package/lib/logic/solidLogic.d.ts +6 -0
- package/lib/logic/solidLogic.d.ts.map +1 -0
- package/lib/logic/{SolidLogic.js → solidLogic.js} +38 -33
- package/lib/logic/solidLogic.js.map +1 -0
- package/lib/logic/solidLogicSingleton.d.ts +1 -2
- package/lib/logic/solidLogicSingleton.d.ts.map +1 -1
- package/lib/logic/solidLogicSingleton.js +2 -2
- package/lib/logic/solidLogicSingleton.js.map +1 -1
- package/lib/profile/profileLogic.d.ts +2 -12
- package/lib/profile/profileLogic.d.ts.map +1 -1
- package/lib/profile/profileLogic.js +1 -23
- package/lib/profile/profileLogic.js.map +1 -1
- package/lib/typeIndex/typeIndexLogic.d.ts +2 -31
- package/lib/typeIndex/typeIndexLogic.d.ts.map +1 -1
- package/lib/typeIndex/typeIndexLogic.js +12 -359
- package/lib/typeIndex/typeIndexLogic.js.map +1 -1
- package/lib/types.d.ts +65 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/acl/aclLogic.ts +5 -4
- package/src/chat/chatLogic.ts +7 -7
- package/src/inbox/inboxLogic.ts +2 -1
- package/src/index.ts +5 -147
- package/src/issuer/issuerLogic.ts +1 -1
- package/src/logic/solidLogic.ts +75 -0
- package/src/logic/solidLogicSingleton.ts +2 -2
- package/src/profile/profileLogic.ts +4 -12
- package/src/typeIndex/typeIndexLogic.ts +6 -277
- package/src/types.ts +76 -1
- package/test/typeIndexLogic.test.ts +484 -54
- package/lib/logic/SolidLogic.d.ts +0 -22
- package/lib/logic/SolidLogic.d.ts.map +0 -1
- package/lib/logic/SolidLogic.js.map +0 -1
- package/lib/logic/solidLogicSingletonNew.d.ts +0 -80
- package/lib/logic/solidLogicSingletonNew.d.ts.map +0 -1
- package/lib/logic/solidLogicSingletonNew.js +0 -238
- package/lib/logic/solidLogicSingletonNew.js.map +0 -1
- package/src/logic/SolidLogic.ts +0 -81
- package/src/logic/solidLogicSingletonNew.ts +0 -239
- package/test/typeIndexLogicPart2.test.ts +0 -485
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (_) try {
|
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports.solidLogicSingleton = void 0;
|
|
63
|
-
var rdf = __importStar(require("rdflib"));
|
|
64
|
-
var SolidAuthnLogic_1 = require("../authn/SolidAuthnLogic");
|
|
65
|
-
var authSession_1 = require("../authSession/authSession");
|
|
66
|
-
var containerLogic_1 = require("../util/containerLogic");
|
|
67
|
-
var typeIndexLogic_1 = require("../typeIndex/typeIndexLogic");
|
|
68
|
-
var debug = __importStar(require("../util/debug"));
|
|
69
|
-
var utilityLogic_1 = require("../util/utilityLogic");
|
|
70
|
-
var profileLogic_1 = require("../profile/profileLogic");
|
|
71
|
-
var inboxLogic_1 = require("../inbox/inboxLogic");
|
|
72
|
-
var chatLogic_1 = require("../chat/chatLogic");
|
|
73
|
-
var aclLogic_1 = require("../acl/aclLogic");
|
|
74
|
-
function solidLogicSingleton() {
|
|
75
|
-
var _this = this;
|
|
76
|
-
var _fetch = function (url, requestInit) { return __awaiter(_this, void 0, void 0, function () {
|
|
77
|
-
var omitCreds;
|
|
78
|
-
return __generator(this, function (_a) {
|
|
79
|
-
omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit';
|
|
80
|
-
if (authSession_1.authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114
|
|
81
|
-
// In fact fetch should respect credentials omit itself
|
|
82
|
-
return [2 /*return*/, authSession_1.authSession.fetch(url, requestInit)];
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
return [2 /*return*/, window.fetch(url, requestInit)];
|
|
86
|
-
}
|
|
87
|
-
return [2 /*return*/];
|
|
88
|
-
});
|
|
89
|
-
}); };
|
|
90
|
-
debug.log("SolidLogicSingleton: Unique instance created. There should only be one of these.");
|
|
91
|
-
var store = rdf.graph(); // Make a Quad store
|
|
92
|
-
rdf.fetcher(store, { fetch: _fetch }); // Attach a web I/O module, store.fetcher
|
|
93
|
-
store.updater = new rdf.UpdateManager(store); // Add real-time live updates store.updater
|
|
94
|
-
store.features = []; // disable automatic node merging on store load
|
|
95
|
-
debug.log('SolidAuthnLogic initialized');
|
|
96
|
-
var authn = new SolidAuthnLogic_1.SolidAuthnLogic(authSession_1.authSession);
|
|
97
|
-
var aclLogic = (0, aclLogic_1.createAclLogic)(store);
|
|
98
|
-
var findAclDocUrl = aclLogic.findAclDocUrl, setACLUserPublic = aclLogic.setACLUserPublic, genACLText = aclLogic.genACLText;
|
|
99
|
-
var containerLogic = (0, containerLogic_1.createContainerLogic)(store);
|
|
100
|
-
var isContainer = containerLogic.isContainer, createContainer = containerLogic.createContainer, getContainerElements = containerLogic.getContainerElements, getContainerMembers = containerLogic.getContainerMembers;
|
|
101
|
-
var utilityLogic = (0, utilityLogic_1.createUtilityLogic)(store, aclLogic, containerLogic);
|
|
102
|
-
var recursiveDelete = utilityLogic.recursiveDelete, setSinglePeerAccess = utilityLogic.setSinglePeerAccess, createEmptyRdfDoc = utilityLogic.createEmptyRdfDoc, followOrCreateLink = utilityLogic.followOrCreateLink, loadOrCreateIfNotExists = utilityLogic.loadOrCreateIfNotExists;
|
|
103
|
-
var profileLogic = (0, profileLogic_1.createProfileLogic)(store, authn, utilityLogic);
|
|
104
|
-
var ensureLoadedPreferences = profileLogic.ensureLoadedPreferences, loadMe = profileLogic.loadMe, getPodRoot = profileLogic.getPodRoot, getMainInbox = profileLogic.getMainInbox, findStorage = profileLogic.findStorage, loadPreferences = profileLogic.loadPreferences, loadProfile = profileLogic.loadProfile, silencedLoadPreferences = profileLogic.silencedLoadPreferences;
|
|
105
|
-
var chatLogic = (0, chatLogic_1.createChatLogic)(store, profileLogic);
|
|
106
|
-
var setAcl = chatLogic.setAcl, addToPrivateTypeIndex = chatLogic.addToPrivateTypeIndex, findChat = chatLogic.findChat, createChatThing = chatLogic.createChatThing, getChat = chatLogic.getChat, sendInvite = chatLogic.sendInvite, mintNew = chatLogic.mintNew;
|
|
107
|
-
var inboxLogic = (0, inboxLogic_1.createInboxLogic)(store, profileLogic, utilityLogic, containerLogic, aclLogic);
|
|
108
|
-
var createInboxFor = inboxLogic.createInboxFor, getNewMessages = inboxLogic.getNewMessages, markAsRead = inboxLogic.markAsRead;
|
|
109
|
-
var typeIndexLogic = (0, typeIndexLogic_1.createTypeIndexLogic)(store, authn, profileLogic, utilityLogic);
|
|
110
|
-
var ensureTypeIndexes = typeIndexLogic.ensureTypeIndexes, loadTypeIndexes = typeIndexLogic.loadTypeIndexes, registerInTypeIndex = typeIndexLogic.registerInTypeIndex, loadIndex = typeIndexLogic.loadIndex, ensureOneTypeIndex = typeIndexLogic.ensureOneTypeIndex, putIndex = typeIndexLogic.putIndex, makeIndexIfNecessary = typeIndexLogic.makeIndexIfNecessary, loadIndexes = typeIndexLogic.loadIndexes, getTypeIndex = typeIndexLogic.getTypeIndex, getRegistrations = typeIndexLogic.getRegistrations, loadTypeIndexesFor = typeIndexLogic.loadTypeIndexesFor, loadCommunityTypeIndexes = typeIndexLogic.loadCommunityTypeIndexes, loadAllTypeIndexes = typeIndexLogic.loadAllTypeIndexes, getScopedAppInstances = typeIndexLogic.getScopedAppInstances, getAppInstances = typeIndexLogic.getAppInstances, suggestPublicTypeIndex = typeIndexLogic.suggestPublicTypeIndex, suggestPrivateTypeIndex = typeIndexLogic.suggestPrivateTypeIndex, registerInstanceInTypeIndex = typeIndexLogic.registerInstanceInTypeIndex, deleteTypeIndexRegistration = typeIndexLogic.deleteTypeIndexRegistration, getScopedAppsFromIndex = typeIndexLogic.getScopedAppsFromIndex;
|
|
111
|
-
return {
|
|
112
|
-
store: store,
|
|
113
|
-
authn: authn,
|
|
114
|
-
authSession: authSession_1.authSession,
|
|
115
|
-
//unilityLogic
|
|
116
|
-
recursiveDelete: recursiveDelete,
|
|
117
|
-
setSinglePeerAccess: setSinglePeerAccess,
|
|
118
|
-
createEmptyRdfDoc: createEmptyRdfDoc,
|
|
119
|
-
followOrCreateLink: followOrCreateLink,
|
|
120
|
-
loadOrCreateIfNotExists: loadOrCreateIfNotExists,
|
|
121
|
-
//containerLogic
|
|
122
|
-
isContainer: isContainer,
|
|
123
|
-
createContainer: createContainer,
|
|
124
|
-
getContainerElements: getContainerElements,
|
|
125
|
-
getContainerMembers: getContainerMembers,
|
|
126
|
-
//typeIndexLogic
|
|
127
|
-
ensureTypeIndexes: ensureTypeIndexes,
|
|
128
|
-
loadTypeIndexes: loadTypeIndexes,
|
|
129
|
-
registerInTypeIndex: registerInTypeIndex,
|
|
130
|
-
loadIndex: loadIndex,
|
|
131
|
-
ensureOneTypeIndex: ensureOneTypeIndex,
|
|
132
|
-
putIndex: putIndex,
|
|
133
|
-
makeIndexIfNecessary: makeIndexIfNecessary,
|
|
134
|
-
loadIndexes: loadIndexes,
|
|
135
|
-
getTypeIndex: getTypeIndex,
|
|
136
|
-
getRegistrations: getRegistrations,
|
|
137
|
-
loadTypeIndexesFor: loadTypeIndexesFor,
|
|
138
|
-
loadCommunityTypeIndexes: loadCommunityTypeIndexes,
|
|
139
|
-
loadAllTypeIndexes: loadAllTypeIndexes,
|
|
140
|
-
getScopedAppInstances: getScopedAppInstances,
|
|
141
|
-
getAppInstances: getAppInstances,
|
|
142
|
-
suggestPublicTypeIndex: suggestPublicTypeIndex,
|
|
143
|
-
suggestPrivateTypeIndex: suggestPrivateTypeIndex,
|
|
144
|
-
registerInstanceInTypeIndex: registerInstanceInTypeIndex,
|
|
145
|
-
deleteTypeIndexRegistration: deleteTypeIndexRegistration,
|
|
146
|
-
getScopedAppsFromIndex: getScopedAppsFromIndex,
|
|
147
|
-
//profileLogic
|
|
148
|
-
ensureLoadedPreferences: ensureLoadedPreferences,
|
|
149
|
-
loadMe: loadMe,
|
|
150
|
-
getPodRoot: getPodRoot,
|
|
151
|
-
getMainInbox: getMainInbox,
|
|
152
|
-
findStorage: findStorage,
|
|
153
|
-
loadPreferences: loadPreferences,
|
|
154
|
-
loadProfile: loadProfile,
|
|
155
|
-
silencedLoadPreferences: silencedLoadPreferences,
|
|
156
|
-
//inboxLogic
|
|
157
|
-
createInboxFor: createInboxFor,
|
|
158
|
-
getNewMessages: getNewMessages,
|
|
159
|
-
markAsRead: markAsRead,
|
|
160
|
-
//chatLogic
|
|
161
|
-
setAcl: setAcl,
|
|
162
|
-
addToPrivateTypeIndex: addToPrivateTypeIndex,
|
|
163
|
-
findChat: findChat,
|
|
164
|
-
createChatThing: createChatThing,
|
|
165
|
-
getChat: getChat,
|
|
166
|
-
sendInvite: sendInvite,
|
|
167
|
-
mintNew: mintNew,
|
|
168
|
-
//aclLogic
|
|
169
|
-
findAclDocUrl: findAclDocUrl,
|
|
170
|
-
setACLUserPublic: setACLUserPublic,
|
|
171
|
-
genACLText: genACLText
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
exports.solidLogicSingleton = solidLogicSingleton;
|
|
175
|
-
/*export {
|
|
176
|
-
store,
|
|
177
|
-
authn,
|
|
178
|
-
authSession,
|
|
179
|
-
//unilityLogic
|
|
180
|
-
recursiveDelete,
|
|
181
|
-
setSinglePeerAccess,
|
|
182
|
-
createEmptyRdfDoc,
|
|
183
|
-
followOrCreateLink,
|
|
184
|
-
loadOrCreateIfNotExists,
|
|
185
|
-
//containerLogic
|
|
186
|
-
isContainer,
|
|
187
|
-
createContainer,
|
|
188
|
-
getContainerElements,
|
|
189
|
-
getContainerMembers,
|
|
190
|
-
//typeIndexLogic
|
|
191
|
-
ensureTypeIndexes,
|
|
192
|
-
loadTypeIndexes,
|
|
193
|
-
registerInTypeIndex,
|
|
194
|
-
loadIndex,
|
|
195
|
-
ensureOneTypeIndex,
|
|
196
|
-
putIndex,
|
|
197
|
-
makeIndexIfNecessary,
|
|
198
|
-
loadIndexes,
|
|
199
|
-
getTypeIndex,
|
|
200
|
-
getRegistrations,
|
|
201
|
-
loadTypeIndexesFor,
|
|
202
|
-
loadCommunityTypeIndexes,
|
|
203
|
-
loadAllTypeIndexes,
|
|
204
|
-
getScopedAppInstances,
|
|
205
|
-
getAppInstances,
|
|
206
|
-
suggestPublicTypeIndex,
|
|
207
|
-
suggestPrivateTypeIndex,
|
|
208
|
-
registerInstanceInTypeIndex,
|
|
209
|
-
deleteTypeIndexRegistration,
|
|
210
|
-
getScopedAppsFromIndex,
|
|
211
|
-
//profileLogic
|
|
212
|
-
ensureLoadedPreferences,
|
|
213
|
-
loadMe,
|
|
214
|
-
getPodRoot,
|
|
215
|
-
getMainInbox,
|
|
216
|
-
findStorage,
|
|
217
|
-
loadPreferences,
|
|
218
|
-
loadProfile,
|
|
219
|
-
silencedLoadPreferences,
|
|
220
|
-
//inboxLogic
|
|
221
|
-
createInboxFor,
|
|
222
|
-
getNewMessages,
|
|
223
|
-
markAsRead,
|
|
224
|
-
//chatLogic
|
|
225
|
-
setAcl,
|
|
226
|
-
addToPrivateTypeIndex,
|
|
227
|
-
findChat,
|
|
228
|
-
createChatThing,
|
|
229
|
-
getChat,
|
|
230
|
-
sendInvite,
|
|
231
|
-
mintNew,
|
|
232
|
-
//aclLogic
|
|
233
|
-
findAclDocUrl,
|
|
234
|
-
setACLUserPublic,
|
|
235
|
-
genACLText
|
|
236
|
-
}
|
|
237
|
-
*/
|
|
238
|
-
//# sourceMappingURL=solidLogicSingletonNew.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingletonNew.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingletonNew.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6B;AAC7B,4DAA0D;AAC1D,0DAAwD;AACxD,yDAA6D;AAC7D,8DAAkE;AAClE,mDAAsC;AACtC,qDAAyD;AACzD,wDAA4D;AAC5D,kDAAsD;AACtD,+CAAmD;AACnD,4CAAgD;AAEhD,SAAgB,mBAAmB;IAAnC,iBAkKC;IAhKG,IAAM,MAAM,GAAG,UAAO,GAAG,EAAE,WAAW;;;YAC5B,SAAS,GAAG,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,MAAM,CAAA;YAC7F,IAAI,yBAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,EAAE,oDAAoD;gBAC5F,uDAAuD;gBACvD,sBAAO,yBAAW,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,EAAA;aAC7C;iBAAM;gBACH,sBAAO,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,EAAA;aACxC;;;SACJ,CAAA;IAED,KAAK,CAAC,GAAG,CAAC,mFAAmF,CAAC,CAAA;IAE9F,IAAM,KAAK,GAAG,GAAG,CAAC,KAAK,EAAmB,CAAC,CAAC,oBAAoB;IAChE,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,yCAAyC;IAChF,KAAK,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,2CAA2C;IACzF,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAA,CAAC,+C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{ Session } from "@inrupt/solid-client-authn-browser";
|
|
2
|
-
import * as rdf from "rdflib";
|
|
3
|
-
import { LiveStore, NamedNode, Statement } from "rdflib";
|
|
4
|
-
import { createAclLogic } from "../acl/aclLogic";
|
|
5
|
-
import { SolidAuthnLogic } from "../authn/SolidAuthnLogic";
|
|
6
|
-
import { createChatLogic } from "../chat/chatLogic";
|
|
7
|
-
import { createInboxLogic } from "../inbox/inboxLogic";
|
|
8
|
-
import { createProfileLogic } from "../profile/profileLogic";
|
|
9
|
-
import { createTypeIndexLogic } from "../typeIndex/typeIndexLogic";
|
|
10
|
-
import { createContainerLogic } from "../util/containerLogic";
|
|
11
|
-
import { createUtilityLogic } from "../util/utilityLogic";
|
|
12
|
-
import { AuthnLogic } from "../types";
|
|
13
|
-
import * as debug from "../util/debug";
|
|
14
|
-
/*
|
|
15
|
-
** It is important to distinquish `fetch`, a function provided by the browser
|
|
16
|
-
** and `Fetcher`, a helper object for the rdflib Store which turns it
|
|
17
|
-
** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is
|
|
18
|
-
** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
|
|
19
|
-
*/
|
|
20
|
-
export class SolidLogic {
|
|
21
|
-
|
|
22
|
-
store: LiveStore;
|
|
23
|
-
me: string | undefined;
|
|
24
|
-
authn: AuthnLogic;
|
|
25
|
-
|
|
26
|
-
aclLogic
|
|
27
|
-
utilityLogic
|
|
28
|
-
containerLogic
|
|
29
|
-
profileLogic
|
|
30
|
-
inboxLogic
|
|
31
|
-
typeIndexLogic
|
|
32
|
-
chatLogic
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
constructor(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: Session) {
|
|
36
|
-
// would xpect to be able to do it this way: but get TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation status: 999
|
|
37
|
-
// this.store = new rdf.LiveStore({})
|
|
38
|
-
// this.store.fetcher._fetch = fetch
|
|
39
|
-
debug.log("SolidLogic: Unique instance created. There should only be one of these.")
|
|
40
|
-
this.store = rdf.graph() as LiveStore; // Make a Quad store
|
|
41
|
-
rdf.fetcher(this.store, { fetch: specialFetch.fetch}); // Attach a web I/O module, store.fetcher
|
|
42
|
-
this.store.updater = new rdf.UpdateManager(this.store); // Add real-time live updates store.updater
|
|
43
|
-
this.store.features = [] // disable automatic node merging on store load
|
|
44
|
-
|
|
45
|
-
this.authn = new SolidAuthnLogic(session)
|
|
46
|
-
|
|
47
|
-
debug.log('SolidAuthnLogic initialized')
|
|
48
|
-
|
|
49
|
-
this.aclLogic = createAclLogic(this.store)
|
|
50
|
-
this.containerLogic = createContainerLogic(this.store)
|
|
51
|
-
this.utilityLogic = createUtilityLogic(this.store, this.aclLogic, this.containerLogic)
|
|
52
|
-
this.profileLogic = createProfileLogic(this.store, this.authn, this.utilityLogic)
|
|
53
|
-
this.chatLogic = createChatLogic(this.store, this.profileLogic)
|
|
54
|
-
this.inboxLogic = createInboxLogic(this.store, this.profileLogic, this.utilityLogic, this.containerLogic, this.aclLogic)
|
|
55
|
-
this.typeIndexLogic = createTypeIndexLogic(this.store, this.authn, this.profileLogic, this.utilityLogic)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
load(doc: NamedNode | NamedNode[] | string) {
|
|
59
|
-
return this.store.fetcher.load(doc);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// @@@@ use the one in rdflib.js when it is available and delete this
|
|
63
|
-
updatePromise(
|
|
64
|
-
del: Array<Statement>,
|
|
65
|
-
ins: Array<Statement> = []
|
|
66
|
-
): Promise<void> {
|
|
67
|
-
return new Promise((resolve, reject) => {
|
|
68
|
-
this.store.updater.update(del, ins, function (_uri, ok, errorBody) {
|
|
69
|
-
if (!ok) {
|
|
70
|
-
reject(new Error(errorBody));
|
|
71
|
-
} else {
|
|
72
|
-
resolve();
|
|
73
|
-
}
|
|
74
|
-
}); // callback
|
|
75
|
-
}); // promise
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
clearStore() {
|
|
79
|
-
this.store.statements.slice().forEach(this.store.remove.bind(this.store));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import * as rdf from "rdflib"
|
|
2
|
-
import { SolidAuthnLogic } from "../authn/SolidAuthnLogic"
|
|
3
|
-
import { authSession } from "../authSession/authSession"
|
|
4
|
-
import { createContainerLogic } from "../util/containerLogic"
|
|
5
|
-
import { createTypeIndexLogic } from "../typeIndex/typeIndexLogic"
|
|
6
|
-
import * as debug from "../util/debug"
|
|
7
|
-
import { createUtilityLogic } from "../util/utilityLogic"
|
|
8
|
-
import { createProfileLogic } from "../profile/profileLogic"
|
|
9
|
-
import { createInboxLogic } from "../inbox/inboxLogic"
|
|
10
|
-
import { createChatLogic } from "../chat/chatLogic"
|
|
11
|
-
import { createAclLogic } from "../acl/aclLogic"
|
|
12
|
-
|
|
13
|
-
export function solidLogicSingleton() {
|
|
14
|
-
|
|
15
|
-
const _fetch = async (url, requestInit) => {
|
|
16
|
-
const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'
|
|
17
|
-
if (authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114
|
|
18
|
-
// In fact fetch should respect credentials omit itself
|
|
19
|
-
return authSession.fetch(url, requestInit)
|
|
20
|
-
} else {
|
|
21
|
-
return window.fetch(url, requestInit)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
debug.log("SolidLogicSingleton: Unique instance created. There should only be one of these.")
|
|
26
|
-
|
|
27
|
-
const store = rdf.graph() as rdf.LiveStore; // Make a Quad store
|
|
28
|
-
rdf.fetcher(store, { fetch: _fetch }); // Attach a web I/O module, store.fetcher
|
|
29
|
-
store.updater = new rdf.UpdateManager(store); // Add real-time live updates store.updater
|
|
30
|
-
store.features = [] // disable automatic node merging on store load
|
|
31
|
-
|
|
32
|
-
debug.log('SolidAuthnLogic initialized')
|
|
33
|
-
const authn = new SolidAuthnLogic(authSession)
|
|
34
|
-
|
|
35
|
-
const aclLogic = createAclLogic(store)
|
|
36
|
-
const {
|
|
37
|
-
findAclDocUrl,
|
|
38
|
-
setACLUserPublic,
|
|
39
|
-
genACLText
|
|
40
|
-
} = aclLogic
|
|
41
|
-
|
|
42
|
-
const containerLogic = createContainerLogic(store)
|
|
43
|
-
const {
|
|
44
|
-
isContainer,
|
|
45
|
-
createContainer,
|
|
46
|
-
getContainerElements,
|
|
47
|
-
getContainerMembers
|
|
48
|
-
} = containerLogic
|
|
49
|
-
|
|
50
|
-
const utilityLogic = createUtilityLogic(store, aclLogic, containerLogic)
|
|
51
|
-
const {
|
|
52
|
-
recursiveDelete,
|
|
53
|
-
setSinglePeerAccess,
|
|
54
|
-
createEmptyRdfDoc,
|
|
55
|
-
followOrCreateLink,
|
|
56
|
-
loadOrCreateIfNotExists
|
|
57
|
-
} = utilityLogic
|
|
58
|
-
|
|
59
|
-
const profileLogic = createProfileLogic(store, authn, utilityLogic)
|
|
60
|
-
const {
|
|
61
|
-
ensureLoadedPreferences,
|
|
62
|
-
loadMe,
|
|
63
|
-
getPodRoot,
|
|
64
|
-
getMainInbox,
|
|
65
|
-
findStorage,
|
|
66
|
-
loadPreferences,
|
|
67
|
-
loadProfile,
|
|
68
|
-
silencedLoadPreferences
|
|
69
|
-
} = profileLogic
|
|
70
|
-
|
|
71
|
-
const chatLogic = createChatLogic(store, profileLogic)
|
|
72
|
-
const {
|
|
73
|
-
setAcl,
|
|
74
|
-
addToPrivateTypeIndex,
|
|
75
|
-
findChat,
|
|
76
|
-
createChatThing,
|
|
77
|
-
getChat,
|
|
78
|
-
sendInvite,
|
|
79
|
-
mintNew
|
|
80
|
-
} = chatLogic
|
|
81
|
-
|
|
82
|
-
const inboxLogic = createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic)
|
|
83
|
-
const {
|
|
84
|
-
createInboxFor,
|
|
85
|
-
getNewMessages,
|
|
86
|
-
markAsRead
|
|
87
|
-
} = inboxLogic
|
|
88
|
-
|
|
89
|
-
const typeIndexLogic = createTypeIndexLogic(store, authn, profileLogic, utilityLogic)
|
|
90
|
-
const {
|
|
91
|
-
ensureTypeIndexes,
|
|
92
|
-
loadTypeIndexes,
|
|
93
|
-
registerInTypeIndex,
|
|
94
|
-
loadIndex,
|
|
95
|
-
ensureOneTypeIndex,
|
|
96
|
-
putIndex,
|
|
97
|
-
makeIndexIfNecessary,
|
|
98
|
-
loadIndexes,
|
|
99
|
-
getTypeIndex,
|
|
100
|
-
getRegistrations,
|
|
101
|
-
loadTypeIndexesFor,
|
|
102
|
-
loadCommunityTypeIndexes,
|
|
103
|
-
loadAllTypeIndexes,
|
|
104
|
-
getScopedAppInstances,
|
|
105
|
-
getAppInstances,
|
|
106
|
-
suggestPublicTypeIndex,
|
|
107
|
-
suggestPrivateTypeIndex,
|
|
108
|
-
registerInstanceInTypeIndex,
|
|
109
|
-
deleteTypeIndexRegistration,
|
|
110
|
-
getScopedAppsFromIndex
|
|
111
|
-
} = typeIndexLogic
|
|
112
|
-
|
|
113
|
-
return {
|
|
114
|
-
store,
|
|
115
|
-
authn,
|
|
116
|
-
authSession,
|
|
117
|
-
//unilityLogic
|
|
118
|
-
recursiveDelete,
|
|
119
|
-
setSinglePeerAccess,
|
|
120
|
-
createEmptyRdfDoc,
|
|
121
|
-
followOrCreateLink,
|
|
122
|
-
loadOrCreateIfNotExists,
|
|
123
|
-
//containerLogic
|
|
124
|
-
isContainer,
|
|
125
|
-
createContainer,
|
|
126
|
-
getContainerElements,
|
|
127
|
-
getContainerMembers,
|
|
128
|
-
//typeIndexLogic
|
|
129
|
-
ensureTypeIndexes,
|
|
130
|
-
loadTypeIndexes,
|
|
131
|
-
registerInTypeIndex,
|
|
132
|
-
loadIndex,
|
|
133
|
-
ensureOneTypeIndex,
|
|
134
|
-
putIndex,
|
|
135
|
-
makeIndexIfNecessary,
|
|
136
|
-
loadIndexes,
|
|
137
|
-
getTypeIndex,
|
|
138
|
-
getRegistrations,
|
|
139
|
-
loadTypeIndexesFor,
|
|
140
|
-
loadCommunityTypeIndexes,
|
|
141
|
-
loadAllTypeIndexes,
|
|
142
|
-
getScopedAppInstances,
|
|
143
|
-
getAppInstances,
|
|
144
|
-
suggestPublicTypeIndex,
|
|
145
|
-
suggestPrivateTypeIndex,
|
|
146
|
-
registerInstanceInTypeIndex,
|
|
147
|
-
deleteTypeIndexRegistration,
|
|
148
|
-
getScopedAppsFromIndex,
|
|
149
|
-
//profileLogic
|
|
150
|
-
ensureLoadedPreferences,
|
|
151
|
-
loadMe,
|
|
152
|
-
getPodRoot,
|
|
153
|
-
getMainInbox,
|
|
154
|
-
findStorage,
|
|
155
|
-
loadPreferences,
|
|
156
|
-
loadProfile,
|
|
157
|
-
silencedLoadPreferences,
|
|
158
|
-
//inboxLogic
|
|
159
|
-
createInboxFor,
|
|
160
|
-
getNewMessages,
|
|
161
|
-
markAsRead,
|
|
162
|
-
//chatLogic
|
|
163
|
-
setAcl,
|
|
164
|
-
addToPrivateTypeIndex,
|
|
165
|
-
findChat,
|
|
166
|
-
createChatThing,
|
|
167
|
-
getChat,
|
|
168
|
-
sendInvite,
|
|
169
|
-
mintNew,
|
|
170
|
-
//aclLogic
|
|
171
|
-
findAclDocUrl,
|
|
172
|
-
setACLUserPublic,
|
|
173
|
-
genACLText
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/*export {
|
|
178
|
-
store,
|
|
179
|
-
authn,
|
|
180
|
-
authSession,
|
|
181
|
-
//unilityLogic
|
|
182
|
-
recursiveDelete,
|
|
183
|
-
setSinglePeerAccess,
|
|
184
|
-
createEmptyRdfDoc,
|
|
185
|
-
followOrCreateLink,
|
|
186
|
-
loadOrCreateIfNotExists,
|
|
187
|
-
//containerLogic
|
|
188
|
-
isContainer,
|
|
189
|
-
createContainer,
|
|
190
|
-
getContainerElements,
|
|
191
|
-
getContainerMembers,
|
|
192
|
-
//typeIndexLogic
|
|
193
|
-
ensureTypeIndexes,
|
|
194
|
-
loadTypeIndexes,
|
|
195
|
-
registerInTypeIndex,
|
|
196
|
-
loadIndex,
|
|
197
|
-
ensureOneTypeIndex,
|
|
198
|
-
putIndex,
|
|
199
|
-
makeIndexIfNecessary,
|
|
200
|
-
loadIndexes,
|
|
201
|
-
getTypeIndex,
|
|
202
|
-
getRegistrations,
|
|
203
|
-
loadTypeIndexesFor,
|
|
204
|
-
loadCommunityTypeIndexes,
|
|
205
|
-
loadAllTypeIndexes,
|
|
206
|
-
getScopedAppInstances,
|
|
207
|
-
getAppInstances,
|
|
208
|
-
suggestPublicTypeIndex,
|
|
209
|
-
suggestPrivateTypeIndex,
|
|
210
|
-
registerInstanceInTypeIndex,
|
|
211
|
-
deleteTypeIndexRegistration,
|
|
212
|
-
getScopedAppsFromIndex,
|
|
213
|
-
//profileLogic
|
|
214
|
-
ensureLoadedPreferences,
|
|
215
|
-
loadMe,
|
|
216
|
-
getPodRoot,
|
|
217
|
-
getMainInbox,
|
|
218
|
-
findStorage,
|
|
219
|
-
loadPreferences,
|
|
220
|
-
loadProfile,
|
|
221
|
-
silencedLoadPreferences,
|
|
222
|
-
//inboxLogic
|
|
223
|
-
createInboxFor,
|
|
224
|
-
getNewMessages,
|
|
225
|
-
markAsRead,
|
|
226
|
-
//chatLogic
|
|
227
|
-
setAcl,
|
|
228
|
-
addToPrivateTypeIndex,
|
|
229
|
-
findChat,
|
|
230
|
-
createChatThing,
|
|
231
|
-
getChat,
|
|
232
|
-
sendInvite,
|
|
233
|
-
mintNew,
|
|
234
|
-
//aclLogic
|
|
235
|
-
findAclDocUrl,
|
|
236
|
-
setACLUserPublic,
|
|
237
|
-
genACLText
|
|
238
|
-
}
|
|
239
|
-
*/
|