solid-logic 3.0.9-e0e79662 → 3.0.9-e368b0b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +108 -2
  2. package/dist/789.solid-logic.js +11 -0
  3. package/dist/789.solid-logic.js.map +1 -0
  4. package/dist/789.solid-logic.min.js +1 -0
  5. package/dist/841.solid-logic.js +12133 -0
  6. package/dist/841.solid-logic.js.map +1 -0
  7. package/dist/841.solid-logic.min.js +73 -0
  8. package/dist/841.solid-logic.min.js.map +1 -0
  9. package/dist/acl/aclLogic.d.ts +5 -0
  10. package/{lib → dist}/acl/aclLogic.d.ts.map +1 -1
  11. package/dist/acl/aclLogic.js +118 -0
  12. package/dist/acl/aclLogic.js.map +1 -0
  13. package/{lib → dist}/authSession/authSession.d.ts.map +1 -1
  14. package/dist/authSession/authSession.js +3 -0
  15. package/dist/authSession/authSession.js.map +1 -0
  16. package/{lib → dist}/authn/SolidAuthnLogic.d.ts +3 -3
  17. package/{lib → dist}/authn/SolidAuthnLogic.d.ts.map +1 -1
  18. package/dist/authn/SolidAuthnLogic.js +110 -0
  19. package/dist/authn/SolidAuthnLogic.js.map +1 -0
  20. package/{lib → dist}/authn/authUtil.d.ts +1 -1
  21. package/dist/authn/authUtil.js +67 -0
  22. package/dist/authn/authUtil.js.map +1 -0
  23. package/{lib → dist}/chat/chatLogic.d.ts +1 -1
  24. package/dist/chat/chatLogic.js +157 -0
  25. package/dist/chat/chatLogic.js.map +1 -0
  26. package/{lib → dist}/inbox/inboxLogic.d.ts +1 -1
  27. package/{lib → dist}/inbox/inboxLogic.d.ts.map +1 -1
  28. package/dist/inbox/inboxLogic.js +52 -0
  29. package/dist/inbox/inboxLogic.js.map +1 -0
  30. package/{lib → dist}/index.d.ts +1 -1
  31. package/{lib → dist}/index.d.ts.map +1 -1
  32. package/dist/index.js +13 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/issuer/issuerLogic.js +37 -0
  35. package/dist/issuer/issuerLogic.js.map +1 -0
  36. package/{lib → dist}/logic/CustomError.d.ts.map +1 -1
  37. package/dist/logic/CustomError.js +28 -0
  38. package/dist/logic/CustomError.js.map +1 -0
  39. package/dist/logic/solidLogic.d.ts +6 -0
  40. package/{lib → dist}/logic/solidLogic.d.ts.map +1 -1
  41. package/dist/logic/solidLogic.js +65 -0
  42. package/dist/logic/solidLogic.js.map +1 -0
  43. package/dist/logic/solidLogicSingleton.js +18 -0
  44. package/dist/logic/solidLogicSingleton.js.map +1 -0
  45. package/{lib → dist}/profile/profileLogic.d.ts +1 -1
  46. package/dist/profile/profileLogic.js +129 -0
  47. package/dist/profile/profileLogic.js.map +1 -0
  48. package/dist/solid-logic.esm.external.js +7344 -0
  49. package/dist/solid-logic.esm.external.js.map +1 -0
  50. package/dist/solid-logic.esm.external.min.js +32 -0
  51. package/dist/solid-logic.esm.external.min.js.map +1 -0
  52. package/dist/solid-logic.external.js +7402 -0
  53. package/dist/solid-logic.external.js.map +1 -0
  54. package/dist/solid-logic.external.min.js +32 -0
  55. package/dist/solid-logic.external.min.js.map +1 -0
  56. package/dist/solid-logic.js +35497 -0
  57. package/dist/solid-logic.js.map +1 -0
  58. package/dist/solid-logic.min.js +41 -0
  59. package/dist/solid-logic.min.js.map +1 -0
  60. package/dist/typeIndex/typeIndexLogic.js +186 -0
  61. package/dist/typeIndex/typeIndexLogic.js.map +1 -0
  62. package/{lib → dist}/types.d.ts +2 -2
  63. package/dist/types.js +2 -0
  64. package/{lib → dist}/util/containerLogic.d.ts +1 -1
  65. package/{lib → dist}/util/containerLogic.d.ts.map +1 -1
  66. package/{src/util/containerLogic.ts → dist/util/containerLogic.js} +15 -23
  67. package/dist/util/containerLogic.js.map +1 -0
  68. package/dist/util/debug.d.ts.map +1 -0
  69. package/dist/util/debug.js +14 -0
  70. package/dist/util/debug.js.map +1 -0
  71. package/dist/util/ns.js +5 -0
  72. package/dist/util/ns.js.map +1 -0
  73. package/{lib → dist}/util/utilityLogic.d.ts +1 -1
  74. package/{lib → dist}/util/utilityLogic.d.ts.map +1 -1
  75. package/dist/util/utilityLogic.js +144 -0
  76. package/dist/util/utilityLogic.js.map +1 -0
  77. package/{lib → dist}/util/utils.d.ts +1 -1
  78. package/{lib → dist}/util/utils.d.ts.map +1 -1
  79. package/dist/util/utils.js +39 -0
  80. package/dist/util/utils.js.map +1 -0
  81. package/dist/versionInfo.js +31 -0
  82. package/dist/versionInfo.js.map +1 -0
  83. package/package.json +58 -17
  84. package/eslint.config.js +0 -29
  85. package/jest.config.js +0 -10
  86. package/lib/acl/aclLogic.d.ts +0 -5
  87. package/lib/acl/aclLogic.js +0 -168
  88. package/lib/acl/aclLogic.js.map +0 -1
  89. package/lib/authSession/authSession.js +0 -8
  90. package/lib/authSession/authSession.js.map +0 -1
  91. package/lib/authn/SolidAuthnLogic.js +0 -191
  92. package/lib/authn/SolidAuthnLogic.js.map +0 -1
  93. package/lib/authn/authUtil.js +0 -105
  94. package/lib/authn/authUtil.js.map +0 -1
  95. package/lib/chat/chatLogic.js +0 -272
  96. package/lib/chat/chatLogic.js.map +0 -1
  97. package/lib/inbox/inboxLogic.js +0 -139
  98. package/lib/inbox/inboxLogic.js.map +0 -1
  99. package/lib/index.js +0 -29
  100. package/lib/index.js.map +0 -1
  101. package/lib/issuer/issuerLogic.js +0 -52
  102. package/lib/issuer/issuerLogic.js.map +0 -1
  103. package/lib/logic/CustomError.js +0 -89
  104. package/lib/logic/CustomError.js.map +0 -1
  105. package/lib/logic/solidLogic.d.ts +0 -6
  106. package/lib/logic/solidLogic.js +0 -102
  107. package/lib/logic/solidLogic.js.map +0 -1
  108. package/lib/logic/solidLogicSingleton.js +0 -94
  109. package/lib/logic/solidLogicSingleton.js.map +0 -1
  110. package/lib/profile/profileLogic.js +0 -259
  111. package/lib/profile/profileLogic.js.map +0 -1
  112. package/lib/typeIndex/typeIndexLogic.js +0 -399
  113. package/lib/typeIndex/typeIndexLogic.js.map +0 -1
  114. package/lib/types.js +0 -3
  115. package/lib/util/containerLogic.js +0 -102
  116. package/lib/util/containerLogic.js.map +0 -1
  117. package/lib/util/debug.d.ts.map +0 -1
  118. package/lib/util/debug.js +0 -40
  119. package/lib/util/debug.js.map +0 -1
  120. package/lib/util/ns.js +0 -44
  121. package/lib/util/ns.js.map +0 -1
  122. package/lib/util/utilityLogic.js +0 -284
  123. package/lib/util/utilityLogic.js.map +0 -1
  124. package/lib/util/utils.js +0 -47
  125. package/lib/util/utils.js.map +0 -1
  126. package/src/acl/aclLogic.ts +0 -156
  127. package/src/authSession/authSession.ts +0 -13
  128. package/src/authn/SolidAuthnLogic.ts +0 -126
  129. package/src/authn/authUtil.ts +0 -70
  130. package/src/chat/chatLogic.ts +0 -226
  131. package/src/inbox/inboxLogic.ts +0 -59
  132. package/src/index.ts +0 -21
  133. package/src/issuer/issuerLogic.ts +0 -40
  134. package/src/logic/CustomError.ts +0 -29
  135. package/src/logic/solidLogic.ts +0 -76
  136. package/src/logic/solidLogicSingleton.ts +0 -20
  137. package/src/profile/profileLogic.ts +0 -125
  138. package/src/typeIndex/typeIndexLogic.ts +0 -198
  139. package/src/types.ts +0 -122
  140. package/src/util/debug.ts +0 -20
  141. package/src/util/ns.ts +0 -5
  142. package/src/util/utilityLogic.ts +0 -156
  143. package/src/util/utils.ts +0 -52
  144. package/test/aclLogic.test.ts +0 -24
  145. package/test/authUtil.test.ts +0 -23
  146. package/test/chatLogic.test.ts +0 -316
  147. package/test/container.test.ts +0 -58
  148. package/test/helpers/dataSetup.ts +0 -134
  149. package/test/helpers/setup.ts +0 -17
  150. package/test/inboxLogic.test.ts +0 -218
  151. package/test/logic.test.ts +0 -29
  152. package/test/profileLogic.test.ts +0 -246
  153. package/test/solidAuthLogic.test.ts +0 -49
  154. package/test/typeIndexLogic.test.ts +0 -255
  155. package/test/utilityLogic.test.ts +0 -179
  156. package/test/utils.test.ts +0 -32
  157. package/tsconfig.json +0 -75
  158. /package/{lib → dist}/authSession/authSession.d.ts +0 -0
  159. /package/{lib → dist}/authn/authUtil.d.ts.map +0 -0
  160. /package/{lib → dist}/chat/chatLogic.d.ts.map +0 -0
  161. /package/{lib → dist}/issuer/issuerLogic.d.ts +0 -0
  162. /package/{lib → dist}/issuer/issuerLogic.d.ts.map +0 -0
  163. /package/{lib → dist}/logic/CustomError.d.ts +0 -0
  164. /package/{lib → dist}/logic/solidLogicSingleton.d.ts +0 -0
  165. /package/{lib → dist}/logic/solidLogicSingleton.d.ts.map +0 -0
  166. /package/{lib → dist}/profile/profileLogic.d.ts.map +0 -0
  167. /package/{lib → dist}/typeIndex/typeIndexLogic.d.ts +0 -0
  168. /package/{lib → dist}/typeIndex/typeIndexLogic.d.ts.map +0 -0
  169. /package/{lib → dist}/types.d.ts.map +0 -0
  170. /package/{lib → dist}/types.js.map +0 -0
  171. /package/{lib → dist}/util/debug.d.ts +0 -0
  172. /package/{lib → dist}/util/ns.d.ts +0 -0
  173. /package/{lib → dist}/util/ns.d.ts.map +0 -0
package/package.json CHANGED
@@ -1,18 +1,40 @@
1
1
  {
2
2
  "name": "solid-logic",
3
- "version": "3.0.9-e0e79662",
4
- "description": "Core business logic of Solid OS",
5
- "main": "lib/index.js",
3
+ "type": "module",
4
+ "version": "3.0.9-e368b0b",
5
+ "description": "Core business logic of SolidOS",
6
+ "main": "dist/solid-logic.umd.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.umd.js"
13
+ }
14
+ },
15
+ "sideEffects": false,
16
+ "files": [
17
+ "dist/",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
6
21
  "scripts": {
7
- "build": "npm run clean && tsc",
8
- "clean": "rm -rf lib",
9
- "lint": "eslint ./src",
10
- "test": "jest",
22
+ "clean": "rm -rf dist src/versionInfo.ts",
23
+ "build": "npm run clean && npm run build-version && npm run build-js && npm run build-dist && npm run postbuild-js",
24
+ "build-version": "./timestamp.sh > src/versionInfo.ts && eslint 'src/versionInfo.ts' --fix",
25
+ "build-js": "tsc",
26
+ "postbuild-js": "rm -f dist/versionInfo.d.ts dist/versionInfo.d.ts.map",
27
+ "build-dist": "webpack --progress",
28
+ "lint": "eslint",
29
+ "typecheck": "tsc --noEmit",
30
+ "typecheck-test": "tsc --noEmit -p tsconfig.test.json",
31
+ "test": "jest --no-coverage",
32
+ "test-coverage": "jest --coverage",
11
33
  "test-debug": "node --inspect-brk ./node_modules/.bin/jest -i --env jest-environment-node-debug",
12
- "preversion": "npm test",
13
- "postversion": "git push --follow-tags",
14
34
  "ignore:prepublishOnly": "npm run build && npm run test",
15
- "watch": "tsc --watch"
35
+ "preversion": "npm run lint && npm run typecheck && npm test",
36
+ "postversion": "git push origin main --follow-tags",
37
+ "watch": "npm run build-version && tsc --watch"
16
38
  },
17
39
  "repository": {
18
40
  "type": "git",
@@ -25,26 +47,45 @@
25
47
  },
26
48
  "homepage": "https://github.com/solidos/solid-logic#readme",
27
49
  "devDependencies": {
28
- "@babel/plugin-transform-class-properties": "^7.27.1",
29
- "@babel/plugin-transform-optional-chaining": "^7.27.1",
30
- "@babel/plugin-transform-async-to-generator": "^7.27.1",
31
- "@babel/plugin-transform-runtime": "^7.28.0",
32
- "@babel/preset-env": "^7.28.0",
50
+ "@babel/core": "^7.28.4",
51
+ "@babel/preset-env": "^7.28.3",
33
52
  "@babel/preset-typescript": "^7.27.1",
34
53
  "@types/jest": "^30.0.0",
35
54
  "@typescript-eslint/eslint-plugin": "^8.34.0",
36
55
  "@typescript-eslint/parser": "^8.34.0",
56
+ "babel-jest": "^30.1.2",
57
+ "babel-loader": "^10.0.0",
37
58
  "eslint": "^9.28.0",
59
+ "eslint-config-prettier": "^10.1.8",
60
+ "eslint-plugin-import": "^2.32.0",
61
+ "husky": "^9.1.7",
38
62
  "jest": "^30.0.2",
39
63
  "jest-environment-jsdom": "^30.0.2",
40
64
  "jest-environment-node-debug": "^2.0.0",
41
65
  "jest-fetch-mock": "^3.0.3",
42
- "typescript": "^5.7.3"
66
+ "lint-staged": "^16.1.5",
67
+ "terser-webpack-plugin": "^5.3.14",
68
+ "ts-loader": "^9.5.4",
69
+ "tslib": "^2.8.1",
70
+ "typescript": "^5.9.2",
71
+ "typescript-eslint": "^8.42.0",
72
+ "webpack": "^5.101.3",
73
+ "webpack-cli": "^6.0.1",
74
+ "webpack-node-externals": "^3.0.0"
43
75
  },
44
76
  "dependencies": {
45
- "@inrupt/solid-client-authn-browser": "1.17",
77
+ "@inrupt/solid-client-authn-browser": "^3.1.0",
46
78
  "lint-staged": "^16.1.5",
47
79
  "rdflib": "^2.2.37",
48
80
  "solid-namespace": "^0.5.4"
81
+ },
82
+ "husky": {
83
+ "hooks": {
84
+ "pre-commit": "lint-staged",
85
+ "pre-push": "npm test"
86
+ }
87
+ },
88
+ "lint-staged": {
89
+ "*.ts": "eslint --fix"
49
90
  }
50
91
  }
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
@@ -1,10 +0,0 @@
1
- module.exports = {
2
- verbose: true,
3
- testEnvironment: 'jsdom',
4
- testEnvironmentOptions: {
5
- customExportConditions: ['node']
6
- },
7
- setupFilesAfterEnv: [
8
- './test/helpers/setup.ts'
9
- ]
10
- }
@@ -1,5 +0,0 @@
1
- import { NamedNode } from "rdflib";
2
- import { AclLogic } from "../types";
3
- export declare const ACL_LINK: NamedNode;
4
- export declare function createAclLogic(store: any): AclLogic;
5
- //# sourceMappingURL=aclLogic.d.ts.map
@@ -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
@@ -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,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EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA,CAAC,kBAAkB;YAClE,CAAC;QACL,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,8 +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
- clientAuthentication: (0, solid_client_authn_browser_1.getClientAuthenticationWithDependencies)({})
7
- }, 'mySession');
8
- //# sourceMappingURL=authSession.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authSession.js","sourceRoot":"","sources":["../../src/authSession/authSession.ts"],"names":[],"mappings":";;;AAAA,iFAG2C;AAE9B,QAAA,WAAW,GAAG,IAAI,oCAAO,CAClC;IACE,oBAAoB,EAAE,IAAA,oEAAuC,EAAC,EAAE,CAAC;CAClE,EACD,WAAW,CACZ,CAAA"}
@@ -1,191 +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 SolidAuthnLogic = /** @class */ (function () {
77
- function SolidAuthnLogic(solidAuthSession) {
78
- this.session = solidAuthSession;
79
- }
80
- Object.defineProperty(SolidAuthnLogic.prototype, "authSession", {
81
- // we created authSession getter because we want to access it as authn.authSession externally
82
- get: function () { return this.session; },
83
- enumerable: false,
84
- configurable: true
85
- });
86
- SolidAuthnLogic.prototype.currentUser = function () {
87
- var app = (0, authUtil_1.appContext)();
88
- if (app.viewingNoAuthPage) {
89
- return (0, rdflib_1.sym)(app.webId);
90
- }
91
- if (this && this.session && this.session.info && this.session.info.webId && this.session.info.isLoggedIn) {
92
- return (0, rdflib_1.sym)(this.session.info.webId);
93
- }
94
- return (0, authUtil_1.offlineTestID)(); // null unless testing
95
- };
96
- /**
97
- * Retrieves currently logged in webId from either
98
- * defaultTestUser or SolidAuth
99
- * Also activates a session after login
100
- * @param [setUserCallback] Optional callback
101
- * @returns Resolves with webId uri, if no callback provided
102
- */
103
- SolidAuthnLogic.prototype.checkUser = function (setUserCallback) {
104
- return __awaiter(this, void 0, void 0, function () {
105
- var preLoginRedirectHash, redirectUrl, postLoginRedirectHash, curUrl, me, webId;
106
- return __generator(this, function (_a) {
107
- switch (_a.label) {
108
- case 0:
109
- preLoginRedirectHash = new URL(window.location.href).hash;
110
- if (preLoginRedirectHash) {
111
- window.localStorage.setItem('preLoginRedirectHash', preLoginRedirectHash);
112
- }
113
- this.session.onSessionRestore(function (url) {
114
- if (document.location.toString() !== url)
115
- history.replaceState(null, '', url);
116
- });
117
- redirectUrl = new URL(window.location.href);
118
- redirectUrl.hash = '';
119
- return [4 /*yield*/, this.session
120
- .handleIncomingRedirect({
121
- restorePreviousSession: true,
122
- url: redirectUrl.href
123
- })
124
- // Check to see if a hash was stored in local storage
125
- ];
126
- case 1:
127
- _a.sent();
128
- postLoginRedirectHash = window.localStorage.getItem('preLoginRedirectHash');
129
- if (postLoginRedirectHash) {
130
- curUrl = new URL(window.location.href);
131
- if (curUrl.hash !== postLoginRedirectHash) {
132
- if (history.pushState) {
133
- // debug.log('Setting window.location.has using pushState')
134
- history.pushState(null, document.title, postLoginRedirectHash);
135
- }
136
- else {
137
- // debug.warn('Setting window.location.has using location.hash')
138
- location.hash = postLoginRedirectHash;
139
- }
140
- curUrl.hash = postLoginRedirectHash;
141
- }
142
- // See https://stackoverflow.com/questions/3870057/how-can-i-update-window-location-hash-without-jumping-the-document
143
- // window.location.href = curUrl.toString()// @@ See https://developer.mozilla.org/en-US/docs/Web/API/Window/location
144
- window.localStorage.setItem('preLoginRedirectHash', '');
145
- }
146
- me = (0, authUtil_1.offlineTestID)();
147
- if (me) {
148
- return [2 /*return*/, Promise.resolve(setUserCallback ? setUserCallback(me) : me)];
149
- }
150
- webId = this.webIdFromSession(this.session.info);
151
- if (webId) {
152
- me = this.saveUser(webId);
153
- }
154
- if (me) {
155
- debug.log("(Logged in as ".concat(me, " by authentication)"));
156
- }
157
- return [2 /*return*/, Promise.resolve(setUserCallback ? setUserCallback(me) : me)];
158
- }
159
- });
160
- });
161
- };
162
- /**
163
- * Saves `webId` in `context.me`
164
- * @param webId
165
- * @param context
166
- *
167
- * @returns Returns the WebID, after setting it
168
- */
169
- SolidAuthnLogic.prototype.saveUser = function (webId, context) {
170
- var webIdUri;
171
- if (webId) {
172
- webIdUri = (typeof webId === 'string') ? webId : webId.uri;
173
- var me = (0, rdflib_1.namedNode)(webIdUri);
174
- if (context) {
175
- context.me = me;
176
- }
177
- return me;
178
- }
179
- return null;
180
- };
181
- /**
182
- * @returns {Promise<string|null>} Resolves with WebID URI or null
183
- */
184
- SolidAuthnLogic.prototype.webIdFromSession = function (session) {
185
- var webId = (session === null || session === void 0 ? void 0 : session.webId) && session.isLoggedIn ? session.webId : null;
186
- return webId;
187
- };
188
- return SolidAuthnLogic;
189
- }());
190
- exports.SolidAuthnLogic = SolidAuthnLogic;
191
- //# 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;AAItC;IAGE,yBAAY,gBAAyB;QACnC,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC;IAClC,CAAC;IAGD,sBAAI,wCAAW;QADf,6FAA6F;aAC7F,cAA4B,OAAO,IAAI,CAAC,OAAO,CAAA,CAAC,CAAC;;;OAAA;IAEjD,qCAAW,GAAX;QACE,IAAM,GAAG,GAAG,IAAA,qBAAU,GAAE,CAAA;QACxB,IAAI,GAAG,CAAC,iBAAiB,EAAE,CAAC;YAC1B,OAAO,IAAA,YAAG,EAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACvB,CAAC;QACD,IAAI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;;;;;;OAMG;IACH,kCAAQ,GAAR,UACE,KAAgC,EAChC,OAA+B;QAE/B,IAAI,QAAgB,CAAA;QACpB,IAAI,KAAK,EAAE,CAAC;YACV,QAAQ,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAA;YAC1D,IAAM,EAAE,GAAG,IAAA,kBAAS,EAAC,QAAQ,CAAC,CAAA;YAC9B,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,EAAE,GAAG,EAAE,CAAA;YACjB,CAAC;YACD,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;OAEG;IACH,0CAAgB,GAAhB,UAAkB,OAAiD;QACjE,IAAM,KAAK,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,KAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;QACzE,OAAO,KAAK,CAAA;IACd,CAAC;IAEH,sBAAC;AAAD,CAAC,AAvHD,IAuHC;AAvHY,0CAAe"}
@@ -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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,sCA0BC;AArED,iCAAuC;AACvC,mDAAsC;AAEtC;;;;;GAKG;AACH,8DAA8D;AACvD,IAAM,UAAU,GAAG;IACtB,8DAA8D;IACxD,IAAA,eAAe,GAAU,MAAM,gBAAhB,CAAgB;IACrC,eAAe,KAAf,eAAe,GAAK,EAAE,EAAA;IACtB,eAAe,CAAC,iBAAiB,GAAG,KAAK,CAAA;IACzC,IAAI,eAAe,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC5C,IAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,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