solid-logic 3.1.1-f0ed025 → 3.1.1-f7eee1f
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/README.md +108 -2
- package/dist/789.solid-logic.js +11 -0
- package/dist/789.solid-logic.js.map +1 -0
- package/dist/789.solid-logic.min.js +1 -0
- package/dist/841.solid-logic.js +12133 -0
- package/dist/841.solid-logic.js.map +1 -0
- package/dist/841.solid-logic.min.js +73 -0
- package/dist/841.solid-logic.min.js.map +1 -0
- package/dist/acl/aclLogic.d.ts +5 -0
- package/{lib → dist}/acl/aclLogic.d.ts.map +1 -1
- package/dist/acl/aclLogic.js +122 -0
- package/dist/acl/aclLogic.js.map +1 -0
- package/{lib → dist}/authSession/authSession.js +1 -1
- package/{lib → dist}/authSession/authSession.js.map +1 -1
- package/{lib → dist}/authn/SolidAuthnLogic.d.ts +3 -3
- package/{lib → dist}/authn/SolidAuthnLogic.d.ts.map +1 -1
- package/dist/authn/SolidAuthnLogic.js +147 -0
- package/dist/authn/SolidAuthnLogic.js.map +1 -0
- package/{lib → dist}/authn/authUtil.d.ts +1 -1
- package/{lib → dist}/authn/authUtil.js +12 -12
- package/dist/authn/authUtil.js.map +1 -0
- package/{lib → dist}/chat/chatLogic.d.ts +1 -1
- package/dist/chat/chatLogic.js +160 -0
- package/dist/chat/chatLogic.js.map +1 -0
- package/{lib → dist}/inbox/inboxLogic.d.ts +1 -1
- package/{lib → dist}/inbox/inboxLogic.d.ts.map +1 -1
- package/dist/inbox/inboxLogic.js +55 -0
- package/dist/inbox/inboxLogic.js.map +1 -0
- package/{lib → dist}/index.d.ts +1 -1
- package/{lib → dist}/index.d.ts.map +1 -1
- package/{lib → dist}/index.js +4 -4
- package/{lib → dist}/index.js.map +1 -1
- package/dist/issuer/issuerLogic.js +40 -0
- package/dist/issuer/issuerLogic.js.map +1 -0
- package/{lib → dist}/logic/CustomError.d.ts.map +1 -1
- package/dist/logic/CustomError.js +38 -0
- package/dist/logic/CustomError.js.map +1 -0
- package/dist/logic/solidLogic.d.ts +6 -0
- package/{lib → dist}/logic/solidLogic.d.ts.map +1 -1
- package/{lib → dist}/logic/solidLogic.js +32 -33
- package/dist/logic/solidLogic.js.map +1 -0
- package/dist/logic/solidLogicSingleton.js +54 -0
- package/dist/logic/solidLogicSingleton.js.map +1 -0
- package/{lib → dist}/profile/profileLogic.d.ts +1 -1
- package/dist/profile/profileLogic.js +165 -0
- package/dist/profile/profileLogic.js.map +1 -0
- package/dist/solid-logic.esm.external.js +12725 -0
- package/dist/solid-logic.esm.external.js.map +1 -0
- package/dist/solid-logic.esm.external.min.js +32 -0
- package/dist/solid-logic.esm.external.min.js.map +1 -0
- package/dist/solid-logic.external.js +12802 -0
- package/dist/solid-logic.external.js.map +1 -0
- package/dist/solid-logic.external.min.js +32 -0
- package/dist/solid-logic.external.min.js.map +1 -0
- package/dist/solid-logic.js +40921 -0
- package/dist/solid-logic.js.map +1 -0
- package/dist/solid-logic.min.js +41 -0
- package/dist/solid-logic.min.js.map +1 -0
- package/dist/typeIndex/typeIndexLogic.js +222 -0
- package/dist/typeIndex/typeIndexLogic.js.map +1 -0
- package/{lib → dist}/types.d.ts +2 -2
- package/{lib → dist}/util/containerLogic.d.ts +1 -1
- package/{lib → dist}/util/containerLogic.d.ts.map +1 -1
- package/{src/util/containerLogic.ts → dist/util/containerLogic.js} +20 -25
- package/dist/util/containerLogic.js.map +1 -0
- package/dist/util/debug.d.ts.map +1 -0
- package/dist/util/debug.js +20 -0
- package/dist/util/debug.js.map +1 -0
- package/{lib → dist}/util/ns.js +2 -2
- package/{lib → dist}/util/ns.js.map +1 -1
- package/{lib → dist}/util/utilityLogic.d.ts +1 -1
- package/{lib → dist}/util/utilityLogic.d.ts.map +1 -1
- package/dist/util/utilityLogic.js +180 -0
- package/dist/util/utilityLogic.js.map +1 -0
- package/{lib → dist}/util/utils.d.ts +1 -1
- package/{lib → dist}/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +47 -0
- package/dist/util/utils.js.map +1 -0
- package/dist/versionInfo.js +33 -0
- package/dist/versionInfo.js.map +1 -0
- package/package.json +58 -20
- package/eslint.config.js +0 -29
- package/jest.config.js +0 -10
- package/lib/acl/aclLogic.d.ts +0 -5
- package/lib/acl/aclLogic.js +0 -168
- package/lib/acl/aclLogic.js.map +0 -1
- package/lib/authn/SolidAuthnLogic.js +0 -193
- package/lib/authn/SolidAuthnLogic.js.map +0 -1
- package/lib/authn/authUtil.js.map +0 -1
- package/lib/chat/chatLogic.js +0 -272
- package/lib/chat/chatLogic.js.map +0 -1
- package/lib/inbox/inboxLogic.js +0 -139
- package/lib/inbox/inboxLogic.js.map +0 -1
- package/lib/issuer/issuerLogic.js +0 -52
- package/lib/issuer/issuerLogic.js.map +0 -1
- package/lib/logic/CustomError.js +0 -89
- package/lib/logic/CustomError.js.map +0 -1
- package/lib/logic/solidLogic.d.ts +0 -6
- package/lib/logic/solidLogic.js.map +0 -1
- package/lib/logic/solidLogicSingleton.js +0 -94
- package/lib/logic/solidLogicSingleton.js.map +0 -1
- package/lib/profile/profileLogic.js +0 -259
- package/lib/profile/profileLogic.js.map +0 -1
- package/lib/typeIndex/typeIndexLogic.js +0 -399
- package/lib/typeIndex/typeIndexLogic.js.map +0 -1
- package/lib/util/containerLogic.js +0 -102
- package/lib/util/containerLogic.js.map +0 -1
- package/lib/util/debug.d.ts.map +0 -1
- package/lib/util/debug.js +0 -40
- package/lib/util/debug.js.map +0 -1
- package/lib/util/utilityLogic.js +0 -284
- package/lib/util/utilityLogic.js.map +0 -1
- package/lib/util/utils.js +0 -47
- package/lib/util/utils.js.map +0 -1
- package/src/acl/aclLogic.ts +0 -156
- package/src/authSession/authSession.ts +0 -7
- package/src/authn/SolidAuthnLogic.ts +0 -127
- package/src/authn/authUtil.ts +0 -70
- package/src/chat/chatLogic.ts +0 -226
- package/src/inbox/inboxLogic.ts +0 -59
- package/src/index.ts +0 -22
- package/src/issuer/issuerLogic.ts +0 -40
- package/src/logic/CustomError.ts +0 -29
- package/src/logic/solidLogic.ts +0 -76
- package/src/logic/solidLogicSingleton.ts +0 -20
- package/src/profile/profileLogic.ts +0 -125
- package/src/typeIndex/typeIndexLogic.ts +0 -198
- package/src/types.ts +0 -122
- package/src/util/debug.ts +0 -20
- package/src/util/ns.ts +0 -5
- package/src/util/utilityLogic.ts +0 -156
- package/src/util/utils.ts +0 -52
- package/test/aclLogic.test.ts +0 -24
- package/test/authUtil.test.ts +0 -23
- package/test/chatLogic.test.ts +0 -316
- package/test/container.test.ts +0 -58
- package/test/helpers/dataSetup.ts +0 -134
- package/test/helpers/setup.ts +0 -17
- package/test/inboxLogic.test.ts +0 -218
- package/test/logic.test.ts +0 -29
- package/test/profileLogic.test.ts +0 -246
- package/test/solidAuthLogic.test.ts +0 -49
- package/test/typeIndexLogic.test.ts +0 -255
- package/test/utilityLogic.test.ts +0 -179
- package/test/utils.test.ts +0 -32
- package/tsconfig.json +0 -75
- /package/{lib → dist}/authSession/authSession.d.ts +0 -0
- /package/{lib → dist}/authSession/authSession.d.ts.map +0 -0
- /package/{lib → dist}/authn/authUtil.d.ts.map +0 -0
- /package/{lib → dist}/chat/chatLogic.d.ts.map +0 -0
- /package/{lib → dist}/issuer/issuerLogic.d.ts +0 -0
- /package/{lib → dist}/issuer/issuerLogic.d.ts.map +0 -0
- /package/{lib → dist}/logic/CustomError.d.ts +0 -0
- /package/{lib → dist}/logic/solidLogicSingleton.d.ts +0 -0
- /package/{lib → dist}/logic/solidLogicSingleton.d.ts.map +0 -0
- /package/{lib → dist}/profile/profileLogic.d.ts.map +0 -0
- /package/{lib → dist}/typeIndex/typeIndexLogic.d.ts +0 -0
- /package/{lib → dist}/typeIndex/typeIndexLogic.d.ts.map +0 -0
- /package/{lib → dist}/types.d.ts.map +0 -0
- /package/{lib → dist}/types.js +0 -0
- /package/{lib → dist}/types.js.map +0 -0
- /package/{lib → dist}/util/debug.d.ts +0 -0
- /package/{lib → dist}/util/ns.d.ts +0 -0
- /package/{lib → dist}/util/ns.d.ts.map +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInboxLogic = createInboxLogic;
|
|
4
|
+
const utils_1 = require("../util/utils");
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
+
function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic) {
|
|
7
|
+
async function createInboxFor(peerWebId, nick) {
|
|
8
|
+
const myWebId = await profileLogic.loadMe();
|
|
9
|
+
const podRoot = await profileLogic.getPodRoot(myWebId);
|
|
10
|
+
const ourInbox = `${podRoot.value}p2p-inboxes/${encodeURIComponent(nick)}/`;
|
|
11
|
+
await containerLogic.createContainer(ourInbox);
|
|
12
|
+
// const aclDocUrl = await aclLogic.findAclDocUrl(ourInbox);
|
|
13
|
+
await utilityLogic.setSinglePeerAccess({
|
|
14
|
+
ownerWebId: myWebId.value,
|
|
15
|
+
peerWebId,
|
|
16
|
+
accessToModes: 'acl:Append',
|
|
17
|
+
target: ourInbox
|
|
18
|
+
});
|
|
19
|
+
return ourInbox;
|
|
20
|
+
}
|
|
21
|
+
async function getNewMessages(user) {
|
|
22
|
+
if (!user) {
|
|
23
|
+
user = await profileLogic.loadMe();
|
|
24
|
+
}
|
|
25
|
+
const inbox = await profileLogic.getMainInbox(user);
|
|
26
|
+
const urls = await containerLogic.getContainerMembers(inbox);
|
|
27
|
+
return urls.filter(url => !containerLogic.isContainer(url));
|
|
28
|
+
}
|
|
29
|
+
async function markAsRead(url, date) {
|
|
30
|
+
const downloaded = await store.fetcher._fetch(url);
|
|
31
|
+
if (downloaded.status !== 200) {
|
|
32
|
+
throw new Error(`Not OK! ${url}`);
|
|
33
|
+
}
|
|
34
|
+
const archiveUrl = (0, utils_1.getArchiveUrl)(url, date);
|
|
35
|
+
const options = {
|
|
36
|
+
method: 'PUT',
|
|
37
|
+
body: await downloaded.text(),
|
|
38
|
+
headers: [
|
|
39
|
+
['Content-Type', downloaded.headers.get('Content-Type') || 'application/octet-stream']
|
|
40
|
+
]
|
|
41
|
+
};
|
|
42
|
+
const uploaded = await store.fetcher._fetch(archiveUrl, options);
|
|
43
|
+
if (uploaded.status.toString()[0] === '2') {
|
|
44
|
+
await store.fetcher._fetch(url, {
|
|
45
|
+
method: 'DELETE'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
createInboxFor,
|
|
51
|
+
getNewMessages,
|
|
52
|
+
markAsRead
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=inboxLogic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inboxLogic.js","sourceRoot":"","sources":["../../src/inbox/inboxLogic.ts"],"names":[],"mappings":";;AAKA,4CAqDC;AAxDD,yCAA6C;AAE7C,6DAA6D;AAC7D,SAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ;IAExF,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,IAAY;QAC3D,MAAM,OAAO,GAAc,MAAM,YAAY,CAAC,MAAM,EAAE,CAAA;QACtD,MAAM,OAAO,GAAc,MAAM,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;QACjE,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC,KAAK,eAAe,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAA;QAC3E,MAAM,cAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAA;QAC9C,4DAA4D;QAC5D,MAAM,YAAY,CAAC,mBAAmB,CAAC;YACrC,UAAU,EAAE,OAAO,CAAC,KAAK;YACzB,SAAS;YACT,aAAa,EAAE,YAAY;YAC3B,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAA;QACF,OAAO,QAAQ,CAAA;IACnB,CAAC;IAED,KAAK,UAAU,cAA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CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IACD,OAAO;QACL,cAAc;QACd,cAAc;QACd,UAAU;KACX,CAAA;AACH,CAAC"}
|
package/{lib → dist}/index.d.ts
RENAMED
|
@@ -6,7 +6,7 @@ export { ACL_LINK } from './acl/aclLogic';
|
|
|
6
6
|
export { offlineTestID, appContext } from './authn/authUtil';
|
|
7
7
|
export { getSuggestedIssuers } from './issuer/issuerLogic';
|
|
8
8
|
export { createTypeIndexLogic } from './typeIndex/typeIndexLogic';
|
|
9
|
-
export { AppDetails, SolidNamespace, AuthenticationContext, SolidLogic } from './types';
|
|
9
|
+
export type { AppDetails, SolidNamespace, AuthenticationContext, SolidLogic, ChatLogic } from './types';
|
|
10
10
|
export { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError';
|
|
11
11
|
export { solidLogicSingleton, // solidLogicSingleton is exported entirely because it is used in solid-panes
|
|
12
12
|
store, authn, authSession };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,QAAA,MAAM,KAAK,8BAA4B,CAAA;AACvC,QAAA,MAAM,WAAW,sDAAwC,CAAA;AACzD,QAAA,MAAM,KAAK,4BAA4B,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,QAAA,MAAM,KAAK,8BAA4B,CAAA;AACvC,QAAA,MAAM,WAAW,sDAAwC,CAAA;AACzD,QAAA,MAAM,KAAK,4BAA4B,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,qBAAqB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACvG,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5K,OAAO,EACL,mBAAmB,EAAE,6EAA6E;AAClG,KAAK,EACL,KAAK,EACL,WAAW,EACZ,CAAA"}
|
package/{lib → dist}/index.js
RENAMED
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.authSession = exports.authn = exports.store = exports.solidLogicSingleton = exports.WebOperationError = exports.NotEditableError = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.createTypeIndexLogic = exports.getSuggestedIssuers = exports.appContext = exports.offlineTestID = exports.ACL_LINK = void 0;
|
|
4
4
|
// Make these variables directly accessible as it is what you need most of the time
|
|
5
5
|
// This also makes these variable globaly accesible in mashlib
|
|
6
|
-
|
|
6
|
+
const solidLogicSingleton_1 = require("./logic/solidLogicSingleton");
|
|
7
7
|
Object.defineProperty(exports, "solidLogicSingleton", { enumerable: true, get: function () { return solidLogicSingleton_1.solidLogicSingleton; } });
|
|
8
|
-
|
|
8
|
+
const authn = solidLogicSingleton_1.solidLogicSingleton.authn;
|
|
9
9
|
exports.authn = authn;
|
|
10
|
-
|
|
10
|
+
const authSession = solidLogicSingleton_1.solidLogicSingleton.authn.authSession;
|
|
11
11
|
exports.authSession = authSession;
|
|
12
|
-
|
|
12
|
+
const store = solidLogicSingleton_1.solidLogicSingleton.store;
|
|
13
13
|
exports.store = store;
|
|
14
14
|
var aclLogic_1 = require("./acl/aclLogic");
|
|
15
15
|
Object.defineProperty(exports, "ACL_LINK", { enumerable: true, get: function () { return aclLogic_1.ACL_LINK; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,8DAA8D;AAC9D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,8DAA8D;AAC9D,qEAAiE;AAc/D,oGAdO,yCAAmB,OAcP;AAZrB,MAAM,KAAK,GAAG,yCAAmB,CAAC,KAAK,CAAA;AAcrC,sBAAK;AAbP,MAAM,WAAW,GAAG,yCAAmB,CAAC,KAAK,CAAC,WAAW,CAAA;AAcvD,kCAAW;AAbb,MAAM,KAAK,GAAG,yCAAmB,CAAC,KAAK,CAAA;AAWrC,sBAAK;AATP,2CAAyC;AAAhC,oGAAA,QAAQ,OAAA;AACjB,6CAA4D;AAAnD,yGAAA,aAAa,OAAA;AAAE,sGAAA,UAAU,OAAA;AAClC,oDAA0D;AAAjD,kHAAA,mBAAmB,OAAA;AAC5B,6DAAiE;AAAxD,sHAAA,oBAAoB,OAAA;AAE7B,mDAA4K;AAAnK,gHAAA,iBAAiB,OAAA;AAAE,wHAAA,yBAAyB,OAAA;AAAE,uHAAA,wBAAwB,OAAA;AAAE,4GAAA,aAAa,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAAE,gHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSuggestedIssuers = getSuggestedIssuers;
|
|
4
|
+
const DEFAULT_ISSUERS = [
|
|
5
|
+
{
|
|
6
|
+
name: 'Solid Community',
|
|
7
|
+
uri: 'https://solidcommunity.net'
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: 'Solid Web',
|
|
11
|
+
uri: 'https://solidweb.org'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'Solid Web ME',
|
|
15
|
+
uri: 'https://solidweb.me'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'Inrupt.com',
|
|
19
|
+
uri: 'https://login.inrupt.com'
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* @returns - A list of suggested OIDC issuers
|
|
24
|
+
*/
|
|
25
|
+
function getSuggestedIssuers() {
|
|
26
|
+
// Suggest a default list of OIDC issuers
|
|
27
|
+
const issuers = [...DEFAULT_ISSUERS];
|
|
28
|
+
// Suggest the current host if not already included
|
|
29
|
+
const { host, origin } = new URL(location.href);
|
|
30
|
+
const hosts = issuers.map(({ uri }) => new URL(uri).host);
|
|
31
|
+
if (!hosts.includes(host) && !hosts.some(existing => isSubdomainOf(host, existing))) {
|
|
32
|
+
issuers.unshift({ name: host, uri: origin });
|
|
33
|
+
}
|
|
34
|
+
return issuers;
|
|
35
|
+
}
|
|
36
|
+
function isSubdomainOf(subdomain, domain) {
|
|
37
|
+
const dot = subdomain.length - domain.length - 1;
|
|
38
|
+
return dot > 0 && subdomain[dot] === '.' && subdomain.endsWith(domain);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=issuerLogic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuerLogic.js","sourceRoot":"","sources":["../../src/issuer/issuerLogic.ts"],"names":[],"mappings":";;AAsBA,kDA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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomError.d.ts","sourceRoot":"","sources":["../../src/logic/CustomError.ts"],"names":[],"mappings":"AAAA,cAAM,WAAY,SAAQ,KAAK;gBACf,OAAO,CAAC,EAAE,MAAM;CAM/B;AAED,qBAAa,iBAAkB,SAAQ,WAAW;CAAG;AAErD,qBAAa,yBAA0B,SAAQ,WAAW;CAAG;AAE7D,qBAAa,wBAAyB,SAAQ,WAAW;CAAG;AAE5D,qBAAa,aAAc,SAAQ,WAAW;CAAG;AAEjD,qBAAa,gBAAiB,SAAQ,WAAW;CAAI;AAErD,qBAAa,iBAAkB,SAAQ,WAAW;CAAG;AAErD,qBAAa,UAAW,SAAQ,WAAW;IACvC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CustomError.d.ts","sourceRoot":"","sources":["../../src/logic/CustomError.ts"],"names":[],"mappings":"AAAA,cAAM,WAAY,SAAQ,KAAK;gBACf,OAAO,CAAC,EAAE,MAAM;CAM/B;AAED,qBAAa,iBAAkB,SAAQ,WAAW;CAAG;AAErD,qBAAa,yBAA0B,SAAQ,WAAW;CAAG;AAE7D,qBAAa,wBAAyB,SAAQ,WAAW;CAAG;AAE5D,qBAAa,aAAc,SAAQ,WAAW;CAAG;AAEjD,qBAAa,gBAAiB,SAAQ,WAAW;CAAI;AAErD,qBAAa,iBAAkB,SAAQ,WAAW;CAAG;AAErD,qBAAa,UAAW,SAAQ,WAAW;IACvC,MAAM,EAAE,MAAM,CAAA;gBAEF,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAI/C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FetchError = exports.WebOperationError = exports.NotEditableError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = void 0;
|
|
4
|
+
class CustomError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
// see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html
|
|
8
|
+
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
|
|
9
|
+
this.name = new.target.name; // stack traces display correctly now
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class UnauthorizedError extends CustomError {
|
|
13
|
+
}
|
|
14
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
15
|
+
class CrossOriginForbiddenError extends CustomError {
|
|
16
|
+
}
|
|
17
|
+
exports.CrossOriginForbiddenError = CrossOriginForbiddenError;
|
|
18
|
+
class SameOriginForbiddenError extends CustomError {
|
|
19
|
+
}
|
|
20
|
+
exports.SameOriginForbiddenError = SameOriginForbiddenError;
|
|
21
|
+
class NotFoundError extends CustomError {
|
|
22
|
+
}
|
|
23
|
+
exports.NotFoundError = NotFoundError;
|
|
24
|
+
class NotEditableError extends CustomError {
|
|
25
|
+
}
|
|
26
|
+
exports.NotEditableError = NotEditableError;
|
|
27
|
+
class WebOperationError extends CustomError {
|
|
28
|
+
}
|
|
29
|
+
exports.WebOperationError = WebOperationError;
|
|
30
|
+
class FetchError extends CustomError {
|
|
31
|
+
status;
|
|
32
|
+
constructor(status, message) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.status = status;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.FetchError = FetchError;
|
|
38
|
+
//# sourceMappingURL=CustomError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomError.js","sourceRoot":"","sources":["../../src/logic/CustomError.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAY,SAAQ,KAAK;IAC3B,YAAY,OAAgB;QACxB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,0EAA0E;QAC1E,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA,CAAC,0BAA0B;QAC5E,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAA,CAAC,qCAAqC;IACrE,CAAC;CACJ;AAED,MAAa,iBAAkB,SAAQ,WAAW;CAAG;AAArD,8CAAqD;AAErD,MAAa,yBAA0B,SAAQ,WAAW;CAAG;AAA7D,8DAA6D;AAE7D,MAAa,wBAAyB,SAAQ,WAAW;CAAG;AAA5D,4DAA4D;AAE5D,MAAa,aAAc,SAAQ,WAAW;CAAG;AAAjD,sCAAiD;AAEjD,MAAa,gBAAiB,SAAQ,WAAW;CAAI;AAArD,4CAAqD;AAErD,MAAa,iBAAkB,SAAQ,WAAW;CAAG;AAArD,8CAAqD;AAErD,MAAa,UAAW,SAAQ,WAAW;IACvC,MAAM,CAAQ;IAEd,YAAY,MAAc,EAAE,OAAgB;QACxC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;CACJ;AAPD,gCAOC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Session } from '@inrupt/solid-client-authn-browser';
|
|
2
|
+
import { SolidLogic } from '../types';
|
|
3
|
+
export declare function createSolidLogic(specialFetch: {
|
|
4
|
+
fetch: (url: any, requestInit: any) => any;
|
|
5
|
+
}, session: Session): SolidLogic;
|
|
6
|
+
//# sourceMappingURL=solidLogic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogic.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,
|
|
1
|
+
{"version":3,"file":"solidLogic.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAW5D,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAA;AASjD,wBAAgB,gBAAgB,CAAC,YAAY,EAAE;IAAE,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,KAAK,GAAG,CAAA;CAAE,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,CAuD3H"}
|
|
@@ -34,16 +34,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.createSolidLogic = createSolidLogic;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
const rdf = __importStar(require("rdflib"));
|
|
38
|
+
const aclLogic_1 = require("../acl/aclLogic");
|
|
39
|
+
const SolidAuthnLogic_1 = require("../authn/SolidAuthnLogic");
|
|
40
|
+
const chatLogic_1 = require("../chat/chatLogic");
|
|
41
|
+
const inboxLogic_1 = require("../inbox/inboxLogic");
|
|
42
|
+
const profileLogic_1 = require("../profile/profileLogic");
|
|
43
|
+
const typeIndexLogic_1 = require("../typeIndex/typeIndexLogic");
|
|
44
|
+
const containerLogic_1 = require("../util/containerLogic");
|
|
45
|
+
const utilityLogic_1 = require("../util/utilityLogic");
|
|
46
|
+
const debug = __importStar(require("../util/debug"));
|
|
47
47
|
/*
|
|
48
48
|
** It is important to distinquish `fetch`, a function provided by the browser
|
|
49
49
|
** and `Fetcher`, a helper object for the rdflib Store which turns it
|
|
@@ -52,27 +52,26 @@ var debug = __importStar(require("../util/debug"));
|
|
|
52
52
|
*/
|
|
53
53
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
54
|
function createSolidLogic(specialFetch, session) {
|
|
55
|
-
debug.log(
|
|
56
|
-
|
|
55
|
+
debug.log('SolidLogic: Unique instance created. There should only be one of these.');
|
|
56
|
+
const store = rdf.graph();
|
|
57
57
|
rdf.fetcher(store, { fetch: specialFetch.fetch }); // Attach a web I/O module, store.fetcher
|
|
58
58
|
store.updater = new rdf.UpdateManager(store); // Add real-time live updates store.updater
|
|
59
59
|
store.features = []; // disable automatic node merging on store load
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
const authn = new SolidAuthnLogic_1.SolidAuthnLogic(session);
|
|
61
|
+
const acl = (0, aclLogic_1.createAclLogic)(store);
|
|
62
|
+
const containerLogic = (0, containerLogic_1.createContainerLogic)(store);
|
|
63
|
+
const utilityLogic = (0, utilityLogic_1.createUtilityLogic)(store, acl, containerLogic);
|
|
64
|
+
const profile = (0, profileLogic_1.createProfileLogic)(store, authn, utilityLogic);
|
|
65
|
+
const chat = (0, chatLogic_1.createChatLogic)(store, profile);
|
|
66
|
+
const inbox = (0, inboxLogic_1.createInboxLogic)(store, profile, utilityLogic, containerLogic, acl);
|
|
67
|
+
const typeIndex = (0, typeIndexLogic_1.createTypeIndexLogic)(store, authn, profile, utilityLogic);
|
|
68
68
|
debug.log('SolidAuthnLogic initialized');
|
|
69
69
|
function load(doc) {
|
|
70
70
|
return store.fetcher.load(doc);
|
|
71
71
|
}
|
|
72
72
|
// @@@@ use the one in rdflib.js when it is available and delete this
|
|
73
|
-
function updatePromise(del, ins) {
|
|
74
|
-
|
|
75
|
-
return new Promise(function (resolve, reject) {
|
|
73
|
+
function updatePromise(del, ins = []) {
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
76
75
|
store.updater.update(del, ins, function (_uri, ok, errorBody) {
|
|
77
76
|
if (!ok) {
|
|
78
77
|
reject(new Error(errorBody));
|
|
@@ -87,16 +86,16 @@ function createSolidLogic(specialFetch, session) {
|
|
|
87
86
|
store.statements.slice().forEach(store.remove.bind(store));
|
|
88
87
|
}
|
|
89
88
|
return {
|
|
90
|
-
store
|
|
91
|
-
authn
|
|
92
|
-
acl
|
|
93
|
-
inbox
|
|
94
|
-
chat
|
|
95
|
-
profile
|
|
96
|
-
typeIndex
|
|
97
|
-
load
|
|
98
|
-
updatePromise
|
|
99
|
-
clearStore
|
|
89
|
+
store,
|
|
90
|
+
authn,
|
|
91
|
+
acl,
|
|
92
|
+
inbox,
|
|
93
|
+
chat,
|
|
94
|
+
profile,
|
|
95
|
+
typeIndex,
|
|
96
|
+
load,
|
|
97
|
+
updatePromise,
|
|
98
|
+
clearStore
|
|
100
99
|
};
|
|
101
100
|
}
|
|
102
101
|
//# sourceMappingURL=solidLogic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solidLogic.js","sourceRoot":"","sources":["../../src/logic/solidLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,4CAuDC;AA1ED,4CAA6B;AAE7B,8CAAgD;AAChD,8DAA0D;AAC1D,iDAAmD;AACnD,oDAAsD;AACtD,0DAA4D;AAC5D,gEAAkE;AAClE,2DAA6D;AAC7D,uDAAyD;AAEzD,qDAAsC;AACtC;;;;;EAKE;AACF,8DAA8D;AAC9D,SAAgB,gBAAgB,CAAC,YAA4D,EAAE,OAAgB;IAE3G,KAAK,CAAC,GAAG,CAAC,0EAA0E,CAAC,CAAA;IACrF,MAAM,KAAK,GAAc,GAAG,CAAC,KAAK,EAAe,CAAA;IACjD,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAC,KAAK,EAAE,YAAY,CAAC,KAAK,EAAC,CAAC,CAAA,CAAC,yCAAyC;IACzF,KAAK,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA,CAAC,2CAA2C;IACxF,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAA,CAAC,+CAA+C;IAEnE,MAAM,KAAK,GAAe,IAAI,iCAAe,CAAC,OAAO,CAAC,CAAA;IAEtD,MAAM,GAAG,GAAG,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAA;IACjC,MAAM,cAAc,GAAG,IAAA,qCAAoB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C,KAAK,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO;QACH,KAAK;QACL,KAAK;QACL,GAAG;QACH,KAAK;QACL,IAAI;QACJ,OAAO;QACP,SAAS;QACT,IAAI;QACJ,aAAa;QACb,UAAU;KACb,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.solidLogicSingleton = void 0;
|
|
37
|
+
const debug = __importStar(require("../util/debug"));
|
|
38
|
+
const authSession_1 = require("../authSession/authSession");
|
|
39
|
+
const solidLogic_1 = require("./solidLogic");
|
|
40
|
+
const _fetch = async (url, requestInit) => {
|
|
41
|
+
const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit';
|
|
42
|
+
if (authSession_1.authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114
|
|
43
|
+
// In fact fetch should respect credentials omit itself
|
|
44
|
+
return authSession_1.authSession.fetch(url, requestInit);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return window.fetch(url, requestInit);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
//this const makes solidLogicSingleton global accessible in mashlib
|
|
51
|
+
const solidLogicSingleton = (0, solidLogic_1.createSolidLogic)({ fetch: _fetch }, authSession_1.authSession);
|
|
52
|
+
exports.solidLogicSingleton = solidLogicSingleton;
|
|
53
|
+
debug.log('Unique quadstore initialized.');
|
|
54
|
+
//# sourceMappingURL=solidLogicSingleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAsC;AACtC,4DAAwD;AACxD,6CAA+C;AAE/C,MAAM,MAAM,GAAG,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE;IACtC,MAAM,SAAS,GAAG,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,MAAM,CAAA;IAC7F,IAAI,yBAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,oDAAoD;QAC5F,uDAAuD;QACvD,OAAO,yBAAW,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IAC9C,CAAC;SAAM,CAAC;QACJ,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACzC,CAAC;AACL,CAAC,CAAA;AAED,mEAAmE;AACnE,MAAM,mBAAmB,GAAG,IAAA,6BAAgB,EAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,yBAAW,CAAC,CAAA;AAInE,kDAAmB;AAF5B,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA"}
|
|
@@ -0,0 +1,165 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createProfileLogic = createProfileLogic;
|
|
37
|
+
const CustomError_1 = require("../logic/CustomError");
|
|
38
|
+
const debug = __importStar(require("../util/debug"));
|
|
39
|
+
const ns_1 = require("../util/ns");
|
|
40
|
+
const utils_1 = require("../util/utils");
|
|
41
|
+
function createProfileLogic(store, authn, utilityLogic) {
|
|
42
|
+
const ns = ns_1.ns;
|
|
43
|
+
/**
|
|
44
|
+
* loads the preference without throwing errors - if it can create it it does so.
|
|
45
|
+
* remark: it still throws error if it cannot load profile.
|
|
46
|
+
* @param user
|
|
47
|
+
* @returns undefined if preferenceFile cannot be returned or NamedNode if it can find it or create it
|
|
48
|
+
*/
|
|
49
|
+
async function silencedLoadPreferences(user) {
|
|
50
|
+
try {
|
|
51
|
+
return await loadPreferences(user);
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* loads the preference without returning different errors if it cannot create or load it.
|
|
60
|
+
* remark: it also throws error if it cannot load profile.
|
|
61
|
+
* @param user
|
|
62
|
+
* @returns undefined if preferenceFile cannot be an Error or NamedNode if it can find it or create it
|
|
63
|
+
*/
|
|
64
|
+
async function loadPreferences(user) {
|
|
65
|
+
await loadProfile(user);
|
|
66
|
+
const possiblePreferencesFile = (0, utils_1.suggestPreferencesFile)(user);
|
|
67
|
+
let preferencesFile;
|
|
68
|
+
try {
|
|
69
|
+
preferencesFile = await utilityLogic.followOrCreateLink(user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc());
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
const message = `User ${user} has no pointer in profile to preferences file.`;
|
|
73
|
+
debug.warn(message);
|
|
74
|
+
// we are listing the possible errors
|
|
75
|
+
if (err instanceof CustomError_1.NotEditableError) {
|
|
76
|
+
throw err;
|
|
77
|
+
}
|
|
78
|
+
if (err instanceof CustomError_1.WebOperationError) {
|
|
79
|
+
throw err;
|
|
80
|
+
}
|
|
81
|
+
if (err instanceof CustomError_1.UnauthorizedError) {
|
|
82
|
+
throw err;
|
|
83
|
+
}
|
|
84
|
+
if (err instanceof CustomError_1.CrossOriginForbiddenError) {
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
if (err instanceof CustomError_1.SameOriginForbiddenError) {
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
if (err instanceof CustomError_1.FetchError) {
|
|
91
|
+
throw err;
|
|
92
|
+
}
|
|
93
|
+
throw err;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
await store.fetcher.load(preferencesFile);
|
|
97
|
+
}
|
|
98
|
+
catch (err) { // Maybe a permission problem or origin problem
|
|
99
|
+
const msg = `Unable to load preference of user ${user}: ${err}`;
|
|
100
|
+
debug.warn(msg);
|
|
101
|
+
if (err.response.status === 401) {
|
|
102
|
+
throw new CustomError_1.UnauthorizedError();
|
|
103
|
+
}
|
|
104
|
+
if (err.response.status === 403) {
|
|
105
|
+
if ((0, utils_1.differentOrigin)(preferencesFile)) {
|
|
106
|
+
throw new CustomError_1.CrossOriginForbiddenError();
|
|
107
|
+
}
|
|
108
|
+
throw new CustomError_1.SameOriginForbiddenError();
|
|
109
|
+
}
|
|
110
|
+
/*if (err.response.status === 404) {
|
|
111
|
+
throw new NotFoundError();
|
|
112
|
+
}*/
|
|
113
|
+
throw new Error(msg);
|
|
114
|
+
}
|
|
115
|
+
return preferencesFile;
|
|
116
|
+
}
|
|
117
|
+
async function loadProfile(user) {
|
|
118
|
+
if (!user) {
|
|
119
|
+
throw new Error('loadProfile: no user given.');
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
await store.fetcher.load(user.doc());
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
throw new Error(`Unable to load profile of user ${user}: ${err}`);
|
|
126
|
+
}
|
|
127
|
+
return user.doc();
|
|
128
|
+
}
|
|
129
|
+
async function loadMe() {
|
|
130
|
+
const me = authn.currentUser();
|
|
131
|
+
if (me === null) {
|
|
132
|
+
throw new Error('Current user not found! Not logged in?');
|
|
133
|
+
}
|
|
134
|
+
await store.fetcher.load(me.doc());
|
|
135
|
+
return me;
|
|
136
|
+
}
|
|
137
|
+
function getPodRoot(user) {
|
|
138
|
+
const podRoot = findStorage(user);
|
|
139
|
+
if (!podRoot) {
|
|
140
|
+
throw new Error('User pod root not found!');
|
|
141
|
+
}
|
|
142
|
+
return podRoot;
|
|
143
|
+
}
|
|
144
|
+
async function getMainInbox(user) {
|
|
145
|
+
await store.fetcher.load(user);
|
|
146
|
+
const mainInbox = store.any(user, ns.ldp('inbox'), undefined, user.doc());
|
|
147
|
+
if (!mainInbox) {
|
|
148
|
+
throw new Error('User main inbox not found!');
|
|
149
|
+
}
|
|
150
|
+
return mainInbox;
|
|
151
|
+
}
|
|
152
|
+
function findStorage(me) {
|
|
153
|
+
return store.any(me, ns.space('storage'), undefined, me.doc());
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
loadMe,
|
|
157
|
+
getPodRoot,
|
|
158
|
+
getMainInbox,
|
|
159
|
+
findStorage,
|
|
160
|
+
loadPreferences,
|
|
161
|
+
loadProfile,
|
|
162
|
+
silencedLoadPreferences
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=profileLogic.js.map
|
|
@@ -0,0 +1 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