solid-logic 3.1.1 → 4.0.0-3818f4f
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 +129 -2
- package/dist/acl/aclLogic.d.ts +5 -0
- package/{lib → dist}/acl/aclLogic.d.ts.map +1 -1
- package/dist/acl/aclLogic.js +117 -0
- package/dist/acl/aclLogic.js.map +1 -0
- package/dist/authSession/authSession.js +3 -0
- package/dist/authSession/authSession.js.map +1 -0
- package/{lib → dist}/authn/SolidAuthnLogic.d.ts +3 -3
- package/{lib → dist}/authn/SolidAuthnLogic.d.ts.map +1 -1
- package/dist/authn/SolidAuthnLogic.js +109 -0
- package/dist/authn/SolidAuthnLogic.js.map +1 -0
- package/{lib → dist}/authn/authUtil.d.ts +1 -1
- package/dist/authn/authUtil.d.ts.map +1 -0
- package/dist/authn/authUtil.js +64 -0
- package/dist/authn/authUtil.js.map +1 -0
- package/{lib → dist}/chat/chatLogic.d.ts +1 -1
- package/{lib → dist}/chat/chatLogic.d.ts.map +1 -1
- package/dist/chat/chatLogic.js +157 -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 +51 -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/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/issuer/issuerLogic.js +37 -0
- package/dist/issuer/issuerLogic.js.map +1 -0
- package/{lib → dist}/logic/CustomError.d.ts.map +1 -1
- package/dist/logic/CustomError.js +27 -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/dist/logic/solidLogic.js +64 -0
- package/dist/logic/solidLogic.js.map +1 -0
- package/dist/logic/solidLogicSingleton.d.ts +4 -0
- package/{lib → dist}/logic/solidLogicSingleton.d.ts.map +1 -1
- package/dist/logic/solidLogicSingleton.js +31 -0
- package/dist/logic/solidLogicSingleton.js.map +1 -0
- package/{lib → dist}/profile/profileLogic.d.ts +1 -1
- package/{lib → dist}/profile/profileLogic.d.ts.map +1 -1
- package/dist/profile/profileLogic.js +128 -0
- package/dist/profile/profileLogic.js.map +1 -0
- package/dist/solid-logic.esm.js +7356 -0
- 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 +7415 -0
- package/dist/solid-logic.js.map +1 -0
- package/dist/solid-logic.min.js +32 -0
- package/dist/solid-logic.min.js.map +1 -0
- package/{lib → dist}/typeIndex/typeIndexLogic.d.ts.map +1 -1
- package/dist/typeIndex/typeIndexLogic.js +182 -0
- package/dist/typeIndex/typeIndexLogic.js.map +1 -0
- package/{lib → dist}/types.d.ts +2 -2
- package/{lib → dist}/types.d.ts.map +1 -1
- package/dist/types.js +2 -0
- 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} +15 -23
- package/dist/util/containerLogic.js.map +1 -0
- package/dist/util/debug.d.ts.map +1 -0
- package/dist/util/debug.js +13 -0
- package/dist/util/debug.js.map +1 -0
- package/dist/util/ns.js +5 -0
- package/dist/util/ns.js.map +1 -0
- package/{lib → dist}/util/utilityLogic.d.ts +1 -1
- package/{lib → dist}/util/utilityLogic.d.ts.map +1 -1
- package/dist/util/utilityLogic.js +144 -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 +39 -0
- package/dist/util/utils.js.map +1 -0
- package/dist/versionInfo.js +30 -0
- package/dist/versionInfo.js.map +1 -0
- package/package.json +51 -23
- 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/authSession/authSession.js +0 -6
- package/lib/authSession/authSession.js.map +0 -1
- package/lib/authn/SolidAuthnLogic.js +0 -193
- package/lib/authn/SolidAuthnLogic.js.map +0 -1
- package/lib/authn/authUtil.d.ts.map +0 -1
- package/lib/authn/authUtil.js +0 -105
- 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/index.js +0 -31
- package/lib/index.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 +0 -102
- package/lib/logic/solidLogic.js.map +0 -1
- package/lib/logic/solidLogicSingleton.d.ts +0 -3
- 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/types.js +0 -3
- 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/ns.js +0 -44
- package/lib/util/ns.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}/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}/typeIndex/typeIndexLogic.d.ts +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
package/package.json
CHANGED
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-logic",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Core business logic of
|
|
5
|
-
"
|
|
3
|
+
"version": "4.0.0-3818f4f",
|
|
4
|
+
"description": "Core business logic of SolidOS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/solid-logic.js",
|
|
7
|
+
"module": "dist/solid-logic.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/solid-logic.esm.js",
|
|
12
|
+
"require": "./dist/solid-logic.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
6
22
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
23
|
+
"clean": "rm -rf dist src/versionInfo.ts",
|
|
24
|
+
"build": "npm run clean && npm run typecheck && npm run build-version && npm run build-js && npm run build-dist && npm run postbuild-js",
|
|
25
|
+
"build-version": "./timestamp.sh > src/versionInfo.ts && eslint 'src/versionInfo.ts' --fix",
|
|
26
|
+
"build-js": "tsc",
|
|
27
|
+
"build-dist": "webpack --progress",
|
|
28
|
+
"postbuild-js": "rm -f dist/versionInfo.d.ts dist/versionInfo.d.ts.map",
|
|
29
|
+
"lint": "eslint",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"typecheck-test": "tsc --noEmit -p tsconfig.test.json",
|
|
32
|
+
"test": "jest --no-coverage",
|
|
33
|
+
"test-coverage": "jest --coverage",
|
|
11
34
|
"test-debug": "node --inspect-brk ./node_modules/.bin/jest -i --env jest-environment-node-debug",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"watch": "tsc --watch"
|
|
35
|
+
"ignore:prepublishOnly": "npm run build && npm run lint && npm run test",
|
|
36
|
+
"preversion": "npm run lint && npm run typecheck && npm test",
|
|
37
|
+
"postversion": "git push origin main --follow-tags",
|
|
38
|
+
"watch": "npm run build-version && tsc --watch"
|
|
16
39
|
},
|
|
17
40
|
"repository": {
|
|
18
41
|
"type": "git",
|
|
@@ -25,26 +48,31 @@
|
|
|
25
48
|
},
|
|
26
49
|
"homepage": "https://github.com/solidos/solid-logic#readme",
|
|
27
50
|
"devDependencies": {
|
|
28
|
-
"@babel/
|
|
29
|
-
"@babel/
|
|
30
|
-
"@babel/plugin-transform-optional-chaining": "^7.27.1",
|
|
31
|
-
"@babel/plugin-transform-runtime": "^7.28.0",
|
|
32
|
-
"@babel/preset-env": "^7.28.0",
|
|
51
|
+
"@babel/core": "^7.28.4",
|
|
52
|
+
"@babel/preset-env": "^7.28.3",
|
|
33
53
|
"@babel/preset-typescript": "^7.27.1",
|
|
34
54
|
"@types/jest": "^30.0.0",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
|
36
55
|
"@typescript-eslint/parser": "^8.34.0",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
56
|
+
"babel-jest": "^30.1.2",
|
|
57
|
+
"babel-loader": "^10.0.0",
|
|
58
|
+
"eslint": "^9.38.0",
|
|
59
|
+
"eslint-config-prettier": "^10.1.8",
|
|
60
|
+
"eslint-plugin-import": "^2.32.0",
|
|
61
|
+
"jest": "^30.2.0",
|
|
39
62
|
"jest-environment-jsdom": "^30.0.2",
|
|
40
|
-
"jest-environment-node-debug": "^2.0.0",
|
|
41
63
|
"jest-fetch-mock": "^3.0.3",
|
|
42
|
-
"
|
|
64
|
+
"terser-webpack-plugin": "^5.3.14",
|
|
65
|
+
"ts-loader": "^9.5.4",
|
|
66
|
+
"tslib": "^2.8.1",
|
|
67
|
+
"typescript": "^5.9.2",
|
|
68
|
+
"webpack": "^5.101.3",
|
|
69
|
+
"webpack-cli": "^6.0.1"
|
|
43
70
|
},
|
|
44
71
|
"dependencies": {
|
|
45
72
|
"@inrupt/solid-client-authn-browser": "^3.1.0",
|
|
46
|
-
"lint-staged": "^16.1.5",
|
|
47
|
-
"rdflib": "^2.2.37",
|
|
48
73
|
"solid-namespace": "^0.5.4"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"rdflib": "^2.3.0"
|
|
49
77
|
}
|
|
50
78
|
}
|
package/eslint.config.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
defineConfig,
|
|
3
|
-
} = require("eslint/config");
|
|
4
|
-
|
|
5
|
-
const tsParser = require("@typescript-eslint/parser");
|
|
6
|
-
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
|
|
7
|
-
const js = require("@eslint/js");
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
FlatCompat,
|
|
11
|
-
} = require("@eslint/eslintrc");
|
|
12
|
-
|
|
13
|
-
const compat = new FlatCompat({
|
|
14
|
-
baseDirectory: __dirname,
|
|
15
|
-
recommendedConfig: js.configs.recommended,
|
|
16
|
-
allConfig: js.configs.all
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
module.exports = defineConfig([{
|
|
20
|
-
languageOptions: {
|
|
21
|
-
parser: tsParser,
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
plugins: {
|
|
25
|
-
"@typescript-eslint": typescriptEslint,
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
extends: compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
|
|
29
|
-
}]);
|
package/jest.config.js
DELETED
package/lib/acl/aclLogic.d.ts
DELETED
package/lib/acl/aclLogic.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.ACL_LINK = void 0;
|
|
40
|
-
exports.createAclLogic = createAclLogic;
|
|
41
|
-
var rdflib_1 = require("rdflib");
|
|
42
|
-
var ns_1 = require("../util/ns");
|
|
43
|
-
exports.ACL_LINK = (0, rdflib_1.sym)("http://www.iana.org/assignments/link-relations/acl");
|
|
44
|
-
function createAclLogic(store) {
|
|
45
|
-
var ns = ns_1.ns;
|
|
46
|
-
function findAclDocUrl(url) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
-
var docNode;
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0: return [4 /*yield*/, store.fetcher.load(url)];
|
|
52
|
-
case 1:
|
|
53
|
-
_a.sent();
|
|
54
|
-
docNode = store.any(url, exports.ACL_LINK);
|
|
55
|
-
if (!docNode) {
|
|
56
|
-
throw new Error("No ACL link discovered for ".concat(url));
|
|
57
|
-
}
|
|
58
|
-
return [2 /*return*/, docNode.value];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Simple Access Control
|
|
65
|
-
*
|
|
66
|
-
* This function sets up a simple default ACL for a resource, with
|
|
67
|
-
* RWC for the owner, and a specified access (default none) for the public.
|
|
68
|
-
* In all cases owner has read write control.
|
|
69
|
-
* Parameter lists modes allowed to public
|
|
70
|
-
*
|
|
71
|
-
* @param options
|
|
72
|
-
* @param options.public eg ['Read', 'Write']
|
|
73
|
-
*
|
|
74
|
-
* @returns Resolves with aclDoc uri on successful write
|
|
75
|
-
*/
|
|
76
|
-
function setACLUserPublic(docURI, me, options) {
|
|
77
|
-
var aclDoc = store.any(store.sym(docURI), exports.ACL_LINK);
|
|
78
|
-
return Promise.resolve()
|
|
79
|
-
.then(function () {
|
|
80
|
-
if (aclDoc) {
|
|
81
|
-
return aclDoc;
|
|
82
|
-
}
|
|
83
|
-
return fetchACLRel(docURI).catch(function (err) {
|
|
84
|
-
throw new Error("Error fetching rel=ACL header for ".concat(docURI, ": ").concat(err));
|
|
85
|
-
});
|
|
86
|
-
})
|
|
87
|
-
.then(function (aclDoc) {
|
|
88
|
-
var aclText = genACLText(docURI, me, aclDoc.uri, options);
|
|
89
|
-
if (!store.fetcher) {
|
|
90
|
-
throw new Error('Cannot PUT this, store has no fetcher');
|
|
91
|
-
}
|
|
92
|
-
return store.fetcher
|
|
93
|
-
.webOperation('PUT', aclDoc.uri, {
|
|
94
|
-
data: aclText,
|
|
95
|
-
contentType: 'text/turtle'
|
|
96
|
-
})
|
|
97
|
-
.then(function (result) {
|
|
98
|
-
if (!result.ok) {
|
|
99
|
-
throw new Error('Error writing ACL text: ' + result.error);
|
|
100
|
-
}
|
|
101
|
-
return aclDoc;
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* @param docURI
|
|
107
|
-
* @returns
|
|
108
|
-
*/
|
|
109
|
-
function fetchACLRel(docURI) {
|
|
110
|
-
var fetcher = store.fetcher;
|
|
111
|
-
if (!fetcher) {
|
|
112
|
-
throw new Error('Cannot fetch ACL rel, store has no fetcher');
|
|
113
|
-
}
|
|
114
|
-
return fetcher.load(docURI).then(function (result) {
|
|
115
|
-
if (!result.ok) {
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
-
throw new Error('fetchACLRel: While loading:' + result.error);
|
|
118
|
-
}
|
|
119
|
-
var aclDoc = store.any(store.sym(docURI), exports.ACL_LINK);
|
|
120
|
-
if (!aclDoc) {
|
|
121
|
-
throw new Error('fetchACLRel: No Link rel=ACL header for ' + docURI);
|
|
122
|
-
}
|
|
123
|
-
return aclDoc;
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @param docURI
|
|
128
|
-
* @param me
|
|
129
|
-
* @param aclURI
|
|
130
|
-
* @param options
|
|
131
|
-
*
|
|
132
|
-
* @returns Serialized ACL
|
|
133
|
-
*/
|
|
134
|
-
function genACLText(docURI, me, aclURI, options) {
|
|
135
|
-
if (options === void 0) { options = {}; }
|
|
136
|
-
var optPublic = options.public || [];
|
|
137
|
-
var g = (0, rdflib_1.graph)();
|
|
138
|
-
var auth = (0, rdflib_1.Namespace)('http://www.w3.org/ns/auth/acl#');
|
|
139
|
-
var a = g.sym("".concat(aclURI, "#a1"));
|
|
140
|
-
var acl = g.sym(aclURI);
|
|
141
|
-
var doc = g.sym(docURI);
|
|
142
|
-
g.add(a, ns.rdf('type'), auth('Authorization'), acl);
|
|
143
|
-
g.add(a, auth('accessTo'), doc, acl);
|
|
144
|
-
if (options.defaultForNew) {
|
|
145
|
-
g.add(a, auth('default'), doc, acl);
|
|
146
|
-
}
|
|
147
|
-
g.add(a, auth('agent'), me, acl);
|
|
148
|
-
g.add(a, auth('mode'), auth('Read'), acl);
|
|
149
|
-
g.add(a, auth('mode'), auth('Write'), acl);
|
|
150
|
-
g.add(a, auth('mode'), auth('Control'), acl);
|
|
151
|
-
if (optPublic.length) {
|
|
152
|
-
a = g.sym("".concat(aclURI, "#a2"));
|
|
153
|
-
g.add(a, ns.rdf('type'), auth('Authorization'), acl);
|
|
154
|
-
g.add(a, auth('accessTo'), doc, acl);
|
|
155
|
-
g.add(a, auth('agentClass'), ns.foaf('Agent'), acl);
|
|
156
|
-
for (var p = 0; p < optPublic.length; p++) {
|
|
157
|
-
g.add(a, auth('mode'), auth(optPublic[p]), acl); // Like 'Read' etc
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return (0, rdflib_1.serialize)(acl, g, aclURI);
|
|
161
|
-
}
|
|
162
|
-
return {
|
|
163
|
-
findAclDocUrl: findAclDocUrl,
|
|
164
|
-
setACLUserPublic: setACLUserPublic,
|
|
165
|
-
genACLText: genACLText
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
//# sourceMappingURL=aclLogic.js.map
|
package/lib/acl/aclLogic.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aclLogic.js","sourceRoot":"","sources":["../../src/acl/aclLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wCAkJC;AA3JD,iCAAoE;AAEpE,iCAA4C;AAG/B,QAAA,QAAQ,GAAG,IAAA,YAAG,EACvB,oDAAoD,CACvD,CAAC;AAEF,SAAgB,cAAc,CAAC,KAAK;IAEhC,IAAM,EAAE,GAAG,OAAS,CAAA;IAEpB,SAAe,aAAa,CAAC,GAAc;;;;;4BACvC,qBAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAA;;wBAA7B,SAA6B,CAAC;wBACxB,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,gBAAQ,CAAC,CAAC;wBACzC,IAAI,CAAC,OAAO,EAAE,CAAC;4BACX,MAAM,IAAI,KAAK,CAAC,qCAA8B,GAAG,CAAE,CAAC,CAAC;wBACzD,CAAC;wBACD,sBAAO,OAAO,CAAC,KAAK,EAAC;;;;KACxB;IACD;;;;;;;;;;;;OAYG;IACH,SAAS,gBAAgB,CACzB,MAAc,EACd,EAAa,EACb,OAGC;QAED,IAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CACpB,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EACjB,gBAAQ,CACX,CAAA;QAED,OAAO,OAAO,CAAC,OAAO,EAAE;aACn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ACL,CAAC;QACD,OAAO,IAAA,kBAAS,EAAC,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,CAAA;IACpC,CAAC;IACD,OAAO;QACH,aAAa,eAAA;QACb,gBAAgB,kBAAA;QAChB,UAAU,YAAA;KACb,CAAA;AACL,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.authSession = void 0;
|
|
4
|
-
var solid_client_authn_browser_1 = require("@inrupt/solid-client-authn-browser");
|
|
5
|
-
exports.authSession = new solid_client_authn_browser_1.Session();
|
|
6
|
-
//# sourceMappingURL=authSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authSession.js","sourceRoot":"","sources":["../../src/authSession/authSession.ts"],"names":[],"mappings":";;;AAAA,iFAE2C;AAE9B,QAAA,WAAW,GAAG,IAAI,oCAAO,EAAE,CAAA"}
|
|
@@ -1,193 +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 () {
|
|
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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
45
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
47
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48
|
-
function step(op) {
|
|
49
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
50
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
51
|
-
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;
|
|
52
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
53
|
-
switch (op[0]) {
|
|
54
|
-
case 0: case 1: t = op; break;
|
|
55
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
56
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
57
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
58
|
-
default:
|
|
59
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
60
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
61
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
62
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
63
|
-
if (t[2]) _.ops.pop();
|
|
64
|
-
_.trys.pop(); continue;
|
|
65
|
-
}
|
|
66
|
-
op = body.call(thisArg, _);
|
|
67
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
68
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
72
|
-
exports.SolidAuthnLogic = void 0;
|
|
73
|
-
var rdflib_1 = require("rdflib");
|
|
74
|
-
var authUtil_1 = require("./authUtil");
|
|
75
|
-
var debug = __importStar(require("../util/debug"));
|
|
76
|
-
var solid_client_authn_browser_1 = require("@inrupt/solid-client-authn-browser");
|
|
77
|
-
var SolidAuthnLogic = /** @class */ (function () {
|
|
78
|
-
function SolidAuthnLogic(solidAuthSession) {
|
|
79
|
-
this.session = solidAuthSession;
|
|
80
|
-
}
|
|
81
|
-
Object.defineProperty(SolidAuthnLogic.prototype, "authSession", {
|
|
82
|
-
// we created authSession getter because we want to access it as authn.authSession externally
|
|
83
|
-
get: function () { return this.session; },
|
|
84
|
-
enumerable: false,
|
|
85
|
-
configurable: true
|
|
86
|
-
});
|
|
87
|
-
SolidAuthnLogic.prototype.currentUser = function () {
|
|
88
|
-
var app = (0, authUtil_1.appContext)();
|
|
89
|
-
if (app.viewingNoAuthPage) {
|
|
90
|
-
return (0, rdflib_1.sym)(app.webId);
|
|
91
|
-
}
|
|
92
|
-
if (this && this.session && this.session.info && this.session.info.webId && this.session.info.isLoggedIn) {
|
|
93
|
-
return (0, rdflib_1.sym)(this.session.info.webId);
|
|
94
|
-
}
|
|
95
|
-
return (0, authUtil_1.offlineTestID)(); // null unless testing
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Retrieves currently logged in webId from either
|
|
99
|
-
* defaultTestUser or SolidAuth
|
|
100
|
-
* Also activates a session after login
|
|
101
|
-
* @param [setUserCallback] Optional callback
|
|
102
|
-
* @returns Resolves with webId uri, if no callback provided
|
|
103
|
-
*/
|
|
104
|
-
SolidAuthnLogic.prototype.checkUser = function (setUserCallback) {
|
|
105
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
var preLoginRedirectHash, redirectUrl, postLoginRedirectHash, curUrl, me, webId;
|
|
107
|
-
return __generator(this, function (_a) {
|
|
108
|
-
switch (_a.label) {
|
|
109
|
-
case 0:
|
|
110
|
-
preLoginRedirectHash = new URL(window.location.href).hash;
|
|
111
|
-
if (preLoginRedirectHash) {
|
|
112
|
-
window.localStorage.setItem('preLoginRedirectHash', preLoginRedirectHash);
|
|
113
|
-
}
|
|
114
|
-
this.session.events.on(solid_client_authn_browser_1.EVENTS.SESSION_RESTORED, function (url) {
|
|
115
|
-
debug.log("Session restored to ".concat(url));
|
|
116
|
-
if (document.location.toString() !== url)
|
|
117
|
-
history.replaceState(null, '', url);
|
|
118
|
-
});
|
|
119
|
-
redirectUrl = new URL(window.location.href);
|
|
120
|
-
redirectUrl.hash = '';
|
|
121
|
-
return [4 /*yield*/, this.session
|
|
122
|
-
.handleIncomingRedirect({
|
|
123
|
-
restorePreviousSession: true,
|
|
124
|
-
url: redirectUrl.href
|
|
125
|
-
})
|
|
126
|
-
// Check to see if a hash was stored in local storage
|
|
127
|
-
];
|
|
128
|
-
case 1:
|
|
129
|
-
_a.sent();
|
|
130
|
-
postLoginRedirectHash = window.localStorage.getItem('preLoginRedirectHash');
|
|
131
|
-
if (postLoginRedirectHash) {
|
|
132
|
-
curUrl = new URL(window.location.href);
|
|
133
|
-
if (curUrl.hash !== postLoginRedirectHash) {
|
|
134
|
-
if (history.pushState) {
|
|
135
|
-
// debug.log('Setting window.location.has using pushState')
|
|
136
|
-
history.pushState(null, document.title, postLoginRedirectHash);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
// debug.warn('Setting window.location.has using location.hash')
|
|
140
|
-
location.hash = postLoginRedirectHash;
|
|
141
|
-
}
|
|
142
|
-
curUrl.hash = postLoginRedirectHash;
|
|
143
|
-
}
|
|
144
|
-
// See https://stackoverflow.com/questions/3870057/how-can-i-update-window-location-hash-without-jumping-the-document
|
|
145
|
-
// window.location.href = curUrl.toString()// @@ See https://developer.mozilla.org/en-US/docs/Web/API/Window/location
|
|
146
|
-
window.localStorage.setItem('preLoginRedirectHash', '');
|
|
147
|
-
}
|
|
148
|
-
me = (0, authUtil_1.offlineTestID)();
|
|
149
|
-
if (me) {
|
|
150
|
-
return [2 /*return*/, Promise.resolve(setUserCallback ? setUserCallback(me) : me)];
|
|
151
|
-
}
|
|
152
|
-
webId = this.webIdFromSession(this.session.info);
|
|
153
|
-
if (webId) {
|
|
154
|
-
me = this.saveUser(webId);
|
|
155
|
-
}
|
|
156
|
-
if (me) {
|
|
157
|
-
debug.log("(Logged in as ".concat(me, " by authentication)"));
|
|
158
|
-
}
|
|
159
|
-
return [2 /*return*/, Promise.resolve(setUserCallback ? setUserCallback(me) : me)];
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* Saves `webId` in `context.me`
|
|
166
|
-
* @param webId
|
|
167
|
-
* @param context
|
|
168
|
-
*
|
|
169
|
-
* @returns Returns the WebID, after setting it
|
|
170
|
-
*/
|
|
171
|
-
SolidAuthnLogic.prototype.saveUser = function (webId, context) {
|
|
172
|
-
var webIdUri;
|
|
173
|
-
if (webId) {
|
|
174
|
-
webIdUri = (typeof webId === 'string') ? webId : webId.uri;
|
|
175
|
-
var me = (0, rdflib_1.namedNode)(webIdUri);
|
|
176
|
-
if (context) {
|
|
177
|
-
context.me = me;
|
|
178
|
-
}
|
|
179
|
-
return me;
|
|
180
|
-
}
|
|
181
|
-
return null;
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* @returns {Promise<string|null>} Resolves with WebID URI or null
|
|
185
|
-
*/
|
|
186
|
-
SolidAuthnLogic.prototype.webIdFromSession = function (session) {
|
|
187
|
-
var webId = (session === null || session === void 0 ? void 0 : session.webId) && session.isLoggedIn ? session.webId : null;
|
|
188
|
-
return webId;
|
|
189
|
-
};
|
|
190
|
-
return SolidAuthnLogic;
|
|
191
|
-
}());
|
|
192
|
-
exports.SolidAuthnLogic = SolidAuthnLogic;
|
|
193
|
-
//# sourceMappingURL=SolidAuthnLogic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SolidAuthnLogic.js","sourceRoot":"","sources":["../../src/authn/SolidAuthnLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmD;AACnD,uCAAuD;AACvD,mDAAsC;AACtC,iFAAqE;AAGrE;IAGE,yBAAY,gBAAyB;QACnC,IAAI,CAA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":3,"file":"authUtil.d.ts","sourceRoot":"","sources":["../../src/authn/authUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAO,MAAM,QAAQ,CAAA;AAGvC;;;;;GAKG;AAEH,eAAO,MAAM,UAAU,QAAM,GAwB5B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAK,SAAS,GAAG,IAAI,CA0BjD"}
|
package/lib/authn/authUtil.js
DELETED
|
@@ -1,105 +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 () {
|
|
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.appContext = void 0;
|
|
37
|
-
exports.offlineTestID = offlineTestID;
|
|
38
|
-
var rdflib_1 = require("rdflib");
|
|
39
|
-
var debug = __importStar(require("../util/debug"));
|
|
40
|
-
/**
|
|
41
|
-
* find a user or app's context as set in window.SolidAppContext
|
|
42
|
-
* this is a const, not a function, because we have problems to jest mock it otherwise
|
|
43
|
-
* see: https://github.com/facebook/jest/issues/936#issuecomment-545080082 for more
|
|
44
|
-
* @return {any} - an appContext object
|
|
45
|
-
*/
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
-
var appContext = function () {
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
-
var SolidAppContext = window.SolidAppContext;
|
|
50
|
-
SolidAppContext || (SolidAppContext = {});
|
|
51
|
-
SolidAppContext.viewingNoAuthPage = false;
|
|
52
|
-
if (SolidAppContext.noAuth && window.document) {
|
|
53
|
-
var currentPage = window.document.location.href;
|
|
54
|
-
if (currentPage.startsWith(SolidAppContext.noAuth)) {
|
|
55
|
-
SolidAppContext.viewingNoAuthPage = true;
|
|
56
|
-
var params = new URLSearchParams(window.document.location.search);
|
|
57
|
-
if (params) {
|
|
58
|
-
var viewedPage = SolidAppContext.viewedPage = params.get('uri') || null;
|
|
59
|
-
if (viewedPage) {
|
|
60
|
-
viewedPage = decodeURI(viewedPage);
|
|
61
|
-
if (!viewedPage.startsWith(SolidAppContext.noAuth)) {
|
|
62
|
-
var ary = viewedPage.split(/\//);
|
|
63
|
-
SolidAppContext.idp = ary[0] + '//' + ary[2];
|
|
64
|
-
SolidAppContext.viewingNoAuthPage = false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return SolidAppContext;
|
|
71
|
-
};
|
|
72
|
-
exports.appContext = appContext;
|
|
73
|
-
/**
|
|
74
|
-
* Returns `sym($SolidTestEnvironment.username)` if
|
|
75
|
-
* `$SolidTestEnvironment.username` is defined as a global
|
|
76
|
-
* or
|
|
77
|
-
* returns testID defined in the HTML page
|
|
78
|
-
* @returns {NamedNode|null}
|
|
79
|
-
*/
|
|
80
|
-
function offlineTestID() {
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
-
var $SolidTestEnvironment = window.$SolidTestEnvironment;
|
|
83
|
-
if (typeof $SolidTestEnvironment !== 'undefined' &&
|
|
84
|
-
$SolidTestEnvironment.username) {
|
|
85
|
-
// Test setup
|
|
86
|
-
debug.log('Assuming the user is ' + $SolidTestEnvironment.username);
|
|
87
|
-
return (0, rdflib_1.sym)($SolidTestEnvironment.username);
|
|
88
|
-
}
|
|
89
|
-
// hack that makes SolidOS work in offline mode by adding the webId directly in html
|
|
90
|
-
// example usage: https://github.com/solidos/mashlib/blob/29b8b53c46bf02e0e219f0bacd51b0e9951001dd/test/contact/local.html#L37
|
|
91
|
-
if (typeof document !== 'undefined' &&
|
|
92
|
-
document.location &&
|
|
93
|
-
('' + document.location).slice(0, 16) === 'http://localhost') {
|
|
94
|
-
var div = document.getElementById('appTarget');
|
|
95
|
-
if (!div)
|
|
96
|
-
return null;
|
|
97
|
-
var id = div.getAttribute('testID');
|
|
98
|
-
if (!id)
|
|
99
|
-
return null;
|
|
100
|
-
debug.log('Assuming user is ' + id);
|
|
101
|
-
return (0, rdflib_1.sym)(id);
|
|
102
|
-
}
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=authUtil.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authUtil.js","sourceRoot":"","sources":["../../src/authn/authUtil.ts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