solid-logic 3.1.1-a37bd9c → 3.1.1-a8299b5
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 +6 -11
- package/dist/acl/aclLogic.js +11 -15
- package/dist/acl/aclLogic.js.map +1 -1
- package/dist/authSession/authSession.js +2 -5
- package/dist/authSession/authSession.js.map +1 -1
- package/dist/authn/SolidAuthnLogic.js +13 -51
- package/dist/authn/SolidAuthnLogic.js.map +1 -1
- package/dist/authn/authUtil.js +7 -45
- package/dist/authn/authUtil.js.map +1 -1
- package/dist/chat/chatLogic.js +20 -22
- package/dist/chat/chatLogic.js.map +1 -1
- package/dist/inbox/inboxLogic.js +3 -6
- package/dist/inbox/inboxLogic.js.map +1 -1
- package/dist/index.js +11 -28
- package/dist/index.js.map +1 -1
- package/dist/issuer/issuerLogic.js +1 -4
- package/dist/issuer/issuerLogic.js.map +1 -1
- package/dist/logic/CustomError.js +7 -18
- package/dist/logic/CustomError.js.map +1 -1
- package/dist/logic/solidLogic.js +19 -55
- package/dist/logic/solidLogic.js.map +1 -1
- package/dist/logic/solidLogicSingleton.d.ts +2 -1
- package/dist/logic/solidLogicSingleton.d.ts.map +1 -1
- package/dist/logic/solidLogicSingleton.js +21 -44
- package/dist/logic/solidLogicSingleton.js.map +1 -1
- package/dist/profile/profileLogic.js +17 -53
- package/dist/profile/profileLogic.js.map +1 -1
- package/dist/{solid-logic.esm.external.js → solid-logic.esm.js} +6159 -11513
- package/dist/solid-logic.esm.js.map +1 -0
- package/dist/solid-logic.esm.min.js +32 -0
- package/dist/solid-logic.esm.min.js.map +1 -0
- package/dist/solid-logic.js +6212 -39703
- package/dist/solid-logic.js.map +1 -1
- package/dist/solid-logic.min.js +10 -19
- package/dist/solid-logic.min.js.map +1 -1
- package/dist/typeIndex/typeIndexLogic.js +15 -49
- package/dist/typeIndex/typeIndexLogic.js.map +1 -1
- package/dist/types.js +1 -2
- package/dist/util/containerLogic.js +4 -7
- package/dist/util/containerLogic.js.map +1 -1
- package/dist/util/debug.js +4 -10
- package/dist/util/debug.js.map +1 -1
- package/dist/util/ns.js +3 -42
- package/dist/util/ns.js.map +1 -1
- package/dist/util/utilityLogic.js +15 -51
- package/dist/util/utilityLogic.js.map +1 -1
- package/dist/util/utils.js +11 -19
- package/dist/util/utils.js.map +1 -1
- package/dist/versionInfo.js +3 -5
- package/dist/versionInfo.js.map +1 -1
- package/package.json +6 -15
- package/dist/789.solid-logic.js +0 -11
- package/dist/789.solid-logic.js.map +0 -1
- package/dist/789.solid-logic.min.js +0 -1
- package/dist/841.solid-logic.js +0 -12133
- package/dist/841.solid-logic.js.map +0 -1
- package/dist/841.solid-logic.min.js +0 -73
- package/dist/841.solid-logic.min.js.map +0 -1
- package/dist/solid-logic.esm.external.js.map +0 -1
- package/dist/solid-logic.esm.external.min.js +0 -32
- package/dist/solid-logic.esm.external.min.js.map +0 -1
- package/dist/solid-logic.external.js +0 -12802
- package/dist/solid-logic.external.js.map +0 -1
- package/dist/solid-logic.external.min.js +0 -32
- package/dist/solid-logic.external.min.js.map +0 -1
|
@@ -1,6 +1,3 @@
|
|
|
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
1
|
class CustomError extends Error {
|
|
5
2
|
constructor(message) {
|
|
6
3
|
super(message);
|
|
@@ -9,30 +6,22 @@ class CustomError extends Error {
|
|
|
9
6
|
this.name = new.target.name; // stack traces display correctly now
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
class UnauthorizedError extends CustomError {
|
|
9
|
+
export class UnauthorizedError extends CustomError {
|
|
13
10
|
}
|
|
14
|
-
|
|
15
|
-
class CrossOriginForbiddenError extends CustomError {
|
|
11
|
+
export class CrossOriginForbiddenError extends CustomError {
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
class SameOriginForbiddenError extends CustomError {
|
|
13
|
+
export class SameOriginForbiddenError extends CustomError {
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
class NotFoundError extends CustomError {
|
|
15
|
+
export class NotFoundError extends CustomError {
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
class NotEditableError extends CustomError {
|
|
17
|
+
export class NotEditableError extends CustomError {
|
|
25
18
|
}
|
|
26
|
-
|
|
27
|
-
class WebOperationError extends CustomError {
|
|
19
|
+
export class WebOperationError extends CustomError {
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
class FetchError extends CustomError {
|
|
31
|
-
status;
|
|
21
|
+
export class FetchError extends CustomError {
|
|
32
22
|
constructor(status, message) {
|
|
33
23
|
super(message);
|
|
34
24
|
this.status = status;
|
|
35
25
|
}
|
|
36
26
|
}
|
|
37
|
-
exports.FetchError = FetchError;
|
|
38
27
|
//# sourceMappingURL=CustomError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomError.js","sourceRoot":"","sources":["../../src/logic/CustomError.ts"],"names":[],"mappings":"
|
|
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,MAAM,OAAO,iBAAkB,SAAQ,WAAW;CAAG;AAErD,MAAM,OAAO,yBAA0B,SAAQ,WAAW;CAAG;AAE7D,MAAM,OAAO,wBAAyB,SAAQ,WAAW;CAAG;AAE5D,MAAM,OAAO,aAAc,SAAQ,WAAW;CAAG;AAEjD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;CAAI;AAErD,MAAM,OAAO,iBAAkB,SAAQ,WAAW;CAAG;AAErD,MAAM,OAAO,UAAW,SAAQ,WAAW;IAGvC,YAAY,MAAc,EAAE,OAAgB;QACxC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;CACJ"}
|
package/dist/logic/solidLogic.js
CHANGED
|
@@ -1,49 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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.createSolidLogic = createSolidLogic;
|
|
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"));
|
|
1
|
+
import * as rdf from 'rdflib';
|
|
2
|
+
import { createAclLogic } from '../acl/aclLogic';
|
|
3
|
+
import { SolidAuthnLogic } from '../authn/SolidAuthnLogic';
|
|
4
|
+
import { createChatLogic } from '../chat/chatLogic';
|
|
5
|
+
import { createInboxLogic } from '../inbox/inboxLogic';
|
|
6
|
+
import { createProfileLogic } from '../profile/profileLogic';
|
|
7
|
+
import { createTypeIndexLogic } from '../typeIndex/typeIndexLogic';
|
|
8
|
+
import { createContainerLogic } from '../util/containerLogic';
|
|
9
|
+
import { createUtilityLogic } from '../util/utilityLogic';
|
|
10
|
+
import * as debug from '../util/debug';
|
|
47
11
|
/*
|
|
48
12
|
** It is important to distinquish `fetch`, a function provided by the browser
|
|
49
13
|
** and `Fetcher`, a helper object for the rdflib Store which turns it
|
|
@@ -51,20 +15,20 @@ const debug = __importStar(require("../util/debug"));
|
|
|
51
15
|
** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
|
|
52
16
|
*/
|
|
53
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
-
function createSolidLogic(specialFetch, session) {
|
|
18
|
+
export function createSolidLogic(specialFetch, session) {
|
|
55
19
|
debug.log('SolidLogic: Unique instance created. There should only be one of these.');
|
|
56
20
|
const store = rdf.graph();
|
|
57
21
|
rdf.fetcher(store, { fetch: specialFetch.fetch }); // Attach a web I/O module, store.fetcher
|
|
58
22
|
store.updater = new rdf.UpdateManager(store); // Add real-time live updates store.updater
|
|
59
23
|
store.features = []; // disable automatic node merging on store load
|
|
60
|
-
const authn = new
|
|
61
|
-
const acl =
|
|
62
|
-
const containerLogic =
|
|
63
|
-
const utilityLogic =
|
|
64
|
-
const profile =
|
|
65
|
-
const chat =
|
|
66
|
-
const inbox =
|
|
67
|
-
const typeIndex =
|
|
24
|
+
const authn = new SolidAuthnLogic(session);
|
|
25
|
+
const acl = createAclLogic(store);
|
|
26
|
+
const containerLogic = createContainerLogic(store);
|
|
27
|
+
const utilityLogic = createUtilityLogic(store, acl, containerLogic);
|
|
28
|
+
const profile = createProfileLogic(store, authn, utilityLogic);
|
|
29
|
+
const chat = createChatLogic(store, profile);
|
|
30
|
+
const inbox = createInboxLogic(store, profile, utilityLogic, containerLogic, acl);
|
|
31
|
+
const typeIndex = createTypeIndexLogic(store, authn, profile, utilityLogic);
|
|
68
32
|
debug.log('SolidAuthnLogic initialized');
|
|
69
33
|
function load(doc) {
|
|
70
34
|
return store.fetcher.load(doc);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogic.js","sourceRoot":"","sources":["../../src/logic/solidLogic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"solidLogic.js","sourceRoot":"","sources":["../../src/logic/solidLogic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CA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AO,EAAE,YAAY,CAAC,CAAA;IAC3E,KAAK,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;IAExC,SAAS,IAAI,CAAC,GAAqC;QAC/C,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAClC,CAAC;IAED,qEAAqE;IACrE,SAAS,aAAa,CAClB,GAAqB,EACrB,MAAwB,EAAE;QAE1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACvC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,IAAI,EAAE,EAAE,EAAE,SAAS;gBACxD,IAAI,CAAC,EAAE,EAAE,CAAC;oBACV,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;gBAC5B,CAAC;qBAAM,CAAC;oBACR,OAAO,EAAE,CAAA;gBACT,CAAC;YACL,CAAC,CAAC,CAAA,CAAC,WAAW;QACd,CAAC,CAAC,CAAA,CAAC,UAAU;IACjB,CAAC;IAED,SAAS,UAAU;QACf,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingleton.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAiCrC,QAAA,MAAM,mBAAmB,YAAyB,CAAA;AAElD,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,54 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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");
|
|
1
|
+
import * as debug from '../util/debug';
|
|
2
|
+
import { authSession } from '../authSession/authSession';
|
|
3
|
+
import { createSolidLogic } from './solidLogic';
|
|
40
4
|
const _fetch = async (url, requestInit) => {
|
|
41
5
|
const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit';
|
|
42
|
-
if (
|
|
6
|
+
if (authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114
|
|
43
7
|
// In fact fetch should respect credentials omit itself
|
|
44
|
-
return
|
|
8
|
+
return authSession.fetch(url, requestInit);
|
|
45
9
|
}
|
|
46
10
|
else {
|
|
47
11
|
return window.fetch(url, requestInit);
|
|
48
12
|
}
|
|
49
13
|
};
|
|
14
|
+
// Global singleton pattern to ensure unique store across library versions
|
|
15
|
+
const SINGLETON_SYMBOL = Symbol.for('solid-logic-singleton');
|
|
16
|
+
const globalThis = (typeof window !== 'undefined' ? window : global);
|
|
17
|
+
function getOrCreateSingleton() {
|
|
18
|
+
if (!globalThis[SINGLETON_SYMBOL]) {
|
|
19
|
+
debug.log('SolidLogic: Creating new global singleton instance.');
|
|
20
|
+
globalThis[SINGLETON_SYMBOL] = createSolidLogic({ fetch: _fetch }, authSession);
|
|
21
|
+
debug.log('Unique quadstore initialized.');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
debug.log('SolidLogic: Using existing global singleton instance.');
|
|
25
|
+
}
|
|
26
|
+
return globalThis[SINGLETON_SYMBOL];
|
|
27
|
+
}
|
|
50
28
|
//this const makes solidLogicSingleton global accessible in mashlib
|
|
51
|
-
const solidLogicSingleton = (
|
|
52
|
-
|
|
53
|
-
debug.log('Unique quadstore initialized.');
|
|
29
|
+
const solidLogicSingleton = getOrCreateSingleton();
|
|
30
|
+
export { solidLogicSingleton };
|
|
54
31
|
//# sourceMappingURL=solidLogicSingleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingleton.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAG/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,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,oDAAoD;QAC5F,uDAAuD;QACvD,OAAO,WAAW,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,0EAA0E;AAC1E,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;AAO5D,MAAM,UAAU,GAAG,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAwB,CAAA;AAE3F,SAAS,oBAAoB;IACzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAChC,KAAK,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAA;QAChE,UAAU,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,CAAA;QAC/E,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAC9C,CAAC;SAAM,CAAC;QACJ,KAAK,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAA;IACtE,CAAC;IACD,OAAO,UAAU,CAAC,gBAAgB,CAAE,CAAA;AACxC,CAAC;AACD,mEAAmE;AACnE,MAAM,mBAAmB,GAAG,oBAAoB,EAAE,CAAA;AAElD,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,45 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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;
|
|
1
|
+
import { CrossOriginForbiddenError, FetchError, NotEditableError, SameOriginForbiddenError, UnauthorizedError, WebOperationError } from '../logic/CustomError';
|
|
2
|
+
import * as debug from '../util/debug';
|
|
3
|
+
import { ns as namespace } from '../util/ns';
|
|
4
|
+
import { differentOrigin, suggestPreferencesFile } from '../util/utils';
|
|
5
|
+
export function createProfileLogic(store, authn, utilityLogic) {
|
|
6
|
+
const ns = namespace;
|
|
43
7
|
/**
|
|
44
8
|
* loads the preference without throwing errors - if it can create it it does so.
|
|
45
9
|
* remark: it still throws error if it cannot load profile.
|
|
@@ -63,7 +27,7 @@ function createProfileLogic(store, authn, utilityLogic) {
|
|
|
63
27
|
*/
|
|
64
28
|
async function loadPreferences(user) {
|
|
65
29
|
await loadProfile(user);
|
|
66
|
-
const possiblePreferencesFile =
|
|
30
|
+
const possiblePreferencesFile = suggestPreferencesFile(user);
|
|
67
31
|
let preferencesFile;
|
|
68
32
|
try {
|
|
69
33
|
preferencesFile = await utilityLogic.followOrCreateLink(user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc());
|
|
@@ -72,22 +36,22 @@ function createProfileLogic(store, authn, utilityLogic) {
|
|
|
72
36
|
const message = `User ${user} has no pointer in profile to preferences file.`;
|
|
73
37
|
debug.warn(message);
|
|
74
38
|
// we are listing the possible errors
|
|
75
|
-
if (err instanceof
|
|
39
|
+
if (err instanceof NotEditableError) {
|
|
76
40
|
throw err;
|
|
77
41
|
}
|
|
78
|
-
if (err instanceof
|
|
42
|
+
if (err instanceof WebOperationError) {
|
|
79
43
|
throw err;
|
|
80
44
|
}
|
|
81
|
-
if (err instanceof
|
|
45
|
+
if (err instanceof UnauthorizedError) {
|
|
82
46
|
throw err;
|
|
83
47
|
}
|
|
84
|
-
if (err instanceof
|
|
48
|
+
if (err instanceof CrossOriginForbiddenError) {
|
|
85
49
|
throw err;
|
|
86
50
|
}
|
|
87
|
-
if (err instanceof
|
|
51
|
+
if (err instanceof SameOriginForbiddenError) {
|
|
88
52
|
throw err;
|
|
89
53
|
}
|
|
90
|
-
if (err instanceof
|
|
54
|
+
if (err instanceof FetchError) {
|
|
91
55
|
throw err;
|
|
92
56
|
}
|
|
93
57
|
throw err;
|
|
@@ -99,13 +63,13 @@ function createProfileLogic(store, authn, utilityLogic) {
|
|
|
99
63
|
const msg = `Unable to load preference of user ${user}: ${err}`;
|
|
100
64
|
debug.warn(msg);
|
|
101
65
|
if (err.response.status === 401) {
|
|
102
|
-
throw new
|
|
66
|
+
throw new UnauthorizedError();
|
|
103
67
|
}
|
|
104
68
|
if (err.response.status === 403) {
|
|
105
|
-
if (
|
|
106
|
-
throw new
|
|
69
|
+
if (differentOrigin(preferencesFile)) {
|
|
70
|
+
throw new CrossOriginForbiddenError();
|
|
107
71
|
}
|
|
108
|
-
throw new
|
|
72
|
+
throw new SameOriginForbiddenError();
|
|
109
73
|
}
|
|
110
74
|
/*if (err.response.status === 404) {
|
|
111
75
|
throw new NotFoundError();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileLogic.js","sourceRoot":"","sources":["../../src/profile/profileLogic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profileLogic.js","sourceRoot":"","sources":["../../src/profile/profileLogic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC9J,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,EAAE,IAAI,SAAS,EAA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