solid-logic 1.3.13-c2b08ef1 → 1.3.13-c448e6a9
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/.github/workflows/ci.yml +19 -21
- package/jest.config.js +1 -4
- package/jest.setup.ts +2 -0
- package/lib/authn/NoAuthnLogic.d.ts +9 -0
- package/lib/authn/NoAuthnLogic.d.ts.map +1 -0
- package/lib/authn/NoAuthnLogic.js +17 -0
- package/lib/authn/NoAuthnLogic.js.map +1 -0
- package/lib/authn/SolidAuthnLogic.d.ts +6 -26
- package/lib/authn/SolidAuthnLogic.d.ts.map +1 -1
- package/lib/authn/SolidAuthnLogic.js +5 -161
- package/lib/authn/SolidAuthnLogic.js.map +1 -1
- package/lib/authn/index.d.ts +5 -0
- package/lib/authn/index.d.ts.map +1 -0
- package/lib/{types.js → authn/index.js} +1 -1
- package/lib/authn/index.js.map +1 -0
- package/lib/chat/ChatLogic.d.ts +2 -2
- package/lib/chat/ChatLogic.d.ts.map +1 -1
- package/lib/chat/ChatLogic.js +2 -2
- package/lib/chat/ChatLogic.js.map +1 -1
- package/lib/chat/integration.test.d.ts +2 -0
- package/lib/chat/integration.test.d.ts.map +1 -0
- package/lib/chat/integration.test.js +318 -0
- package/lib/chat/integration.test.js.map +1 -0
- package/lib/{util/debug.d.ts → debug.d.ts} +0 -0
- package/lib/debug.d.ts.map +1 -0
- package/lib/{util/debug.js → debug.js} +0 -0
- package/lib/debug.js.map +1 -0
- package/lib/inbox/InboxLogic.d.ts +2 -2
- package/lib/inbox/InboxLogic.d.ts.map +1 -1
- package/lib/inbox/InboxLogic.js.map +1 -1
- package/lib/inbox/unit.test.d.ts +2 -0
- package/lib/inbox/unit.test.d.ts.map +1 -0
- package/lib/inbox/unit.test.js +264 -0
- package/lib/inbox/unit.test.js.map +1 -0
- package/lib/index.d.ts +67 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +385 -31
- package/lib/index.js.map +1 -1
- package/lib/profile/ProfileLogic.d.ts +3 -2
- package/lib/profile/ProfileLogic.d.ts.map +1 -1
- package/lib/profile/ProfileLogic.js.map +1 -1
- package/lib/{util/uri.d.ts → uri.d.ts} +0 -0
- package/lib/uri.d.ts.map +1 -0
- package/lib/{util/uri.js → uri.js} +0 -0
- package/lib/uri.js.map +1 -0
- package/lib/util/UtilityLogic.d.ts +2 -2
- package/lib/util/UtilityLogic.d.ts.map +1 -1
- package/lib/util/UtilityLogic.js.map +1 -1
- package/lib/util/unit.test.d.ts +2 -0
- package/lib/util/unit.test.d.ts.map +1 -0
- package/lib/util/unit.test.js +200 -0
- package/lib/util/unit.test.js.map +1 -0
- package/package.json +2 -4
- package/src/authn/NoAuthnLogic.ts +16 -0
- package/src/authn/SolidAuthnLogic.ts +10 -112
- package/src/authn/index.ts +5 -0
- package/src/chat/ChatLogic.ts +4 -4
- package/{test/chatLogic.test.ts → src/chat/integration.test.ts} +8 -8
- package/src/{util/debug.ts → debug.ts} +0 -0
- package/src/inbox/InboxLogic.ts +14 -2
- package/{test/inboxLogic.test.ts → src/inbox/unit.test.ts} +6 -5
- package/src/index.ts +310 -18
- package/src/profile/ProfileLogic.ts +3 -2
- package/src/{util/uri.ts → uri.ts} +0 -0
- package/src/util/UtilityLogic.ts +14 -2
- package/{test/utilityLogic.test.ts → src/util/unit.test.ts} +4 -3
- package/lib/acl/aclLogic.d.ts +0 -32
- package/lib/acl/aclLogic.d.ts.map +0 -1
- package/lib/acl/aclLogic.js +0 -132
- package/lib/acl/aclLogic.js.map +0 -1
- package/lib/authSession/authSession.d.ts +0 -4
- package/lib/authSession/authSession.d.ts.map +0 -1
- package/lib/authSession/authSession.js +0 -18
- package/lib/authSession/authSession.js.map +0 -1
- package/lib/authn/authUtil.d.ts +0 -17
- package/lib/authn/authUtil.d.ts.map +0 -1
- package/lib/authn/authUtil.js +0 -88
- package/lib/authn/authUtil.js.map +0 -1
- package/lib/issuer/issuerLogic.d.ts +0 -8
- package/lib/issuer/issuerLogic.d.ts.map +0 -1
- package/lib/issuer/issuerLogic.js +0 -53
- package/lib/issuer/issuerLogic.js.map +0 -1
- package/lib/logic/CustomError.d.ts +0 -17
- package/lib/logic/CustomError.d.ts.map +0 -1
- package/lib/logic/CustomError.js +0 -73
- package/lib/logic/CustomError.js.map +0 -1
- package/lib/logic/SolidLogic.d.ts +0 -49
- package/lib/logic/SolidLogic.d.ts.map +0 -1
- package/lib/logic/SolidLogic.js +0 -316
- package/lib/logic/SolidLogic.js.map +0 -1
- package/lib/logic/solidLogicSingleton.d.ts +0 -8
- package/lib/logic/solidLogicSingleton.d.ts.map +0 -1
- package/lib/logic/solidLogicSingleton.js +0 -88
- package/lib/logic/solidLogicSingleton.js.map +0 -1
- package/lib/typeIndex/typeIndexLogic.d.ts +0 -22
- package/lib/typeIndex/typeIndexLogic.d.ts.map +0 -1
- package/lib/typeIndex/typeIndexLogic.js +0 -302
- package/lib/typeIndex/typeIndexLogic.js.map +0 -1
- package/lib/types.d.ts +0 -29
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/util/debug.d.ts.map +0 -1
- package/lib/util/debug.js.map +0 -1
- package/lib/util/uri.d.ts.map +0 -1
- package/lib/util/uri.js.map +0 -1
- package/src/acl/aclLogic.ts +0 -137
- package/src/authSession/authSession.ts +0 -22
- package/src/authn/authUtil.ts +0 -67
- package/src/issuer/issuerLogic.ts +0 -40
- package/src/logic/CustomError.ts +0 -25
- package/src/logic/SolidLogic.ts +0 -264
- package/src/logic/solidLogicSingleton.ts +0 -24
- package/src/typeIndex/typeIndexLogic.ts +0 -170
- package/src/types.ts +0 -41
- package/test/aclLogic.test.ts +0 -15
- package/test/authUtil.test.ts +0 -19
- package/test/helpers/setup.ts +0 -13
- package/test/logic.test.ts +0 -28
- package/test/solidAuthLogic.test.ts +0 -45
- package/test/typeIndexLogic.test.ts +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityLogic.js","sourceRoot":"","sources":["../../src/util/UtilityLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"UtilityLogic.js","sourceRoot":"","sources":["../../src/util/UtilityLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA8E;AAKjE,QAAA,QAAQ,GAAG,IAAA,YAAG,EACzB,oDAAoD,CACrD,CAAC;AAYF;;GAEG;AACH;IAKE,sBAAY,KAAgB,EAAE,EAAkB,EAAE,OAAuD;QACvG,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEK,oCAAa,GAAnB,UAAoB,GAAW;;;;;;;wBACvB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;wBAChC,qBAAM,CAAA,MAAA,IAAI,CAAC,KAAK,CAAC,OAAO,0CAAE,IAAI,CAAC,GAAG,CAAC,CAAA,EAAA;;wBAAnC,SAAmC,CAAC;wBAC9B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,gBAAQ,CAAC,CAAC;wBAC9C,IAAI,CAAC,OAAO,EAAE;4BACZ,MAAM,IAAI,KAAK,CAAC,qCAA8B,GAAG,CAAE,CAAC,CAAC;yBACtD;wBACD,sBAAO,OAAO,CAAC,KAAK,EAAC;;;;KACtB;IAED,2GAA2G;IACrG,0CAAmB,GAAzB,UAA0B,OAMzB;;;;;;wBACK,GAAG,GAAG;4BACR,gDAAgD;4BAChD,EAAE;4BACF,sDAA+C,OAAO,CAAC,UAAU,OAAI;4BACrE,0BAAmB,OAAO,CAAC,MAAM,OAAI;4BACrC,yBAAkB,OAAO,CAAC,MAAM,OAAI;4BACpC,8CAA8C;4BAC9C,EAAE;yBACH,C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;QACnC,IAAM,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,GAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,IAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,IAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAE,CAAC,CAAE,CAAC;QACzC,OAAO,IAAI,GAAG,CAAC,oBAAa,IAAI,cAAI,KAAK,cAAI,GAAG,cAAI,QAAQ,CAAE,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;IACtF,CAAC;IACH,mBAAC;AAAD,CAAC,AAtJD,IAsJC;AAtJY,oCAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit.test.d.ts","sourceRoot":"","sources":["../../src/util/unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
31
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
32
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
33
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
|
+
function step(op) {
|
|
35
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
+
while (_) try {
|
|
37
|
+
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;
|
|
38
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
|
+
switch (op[0]) {
|
|
40
|
+
case 0: case 1: t = op; break;
|
|
41
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
42
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
43
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
44
|
+
default:
|
|
45
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
46
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
47
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49
|
+
if (t[2]) _.ops.pop();
|
|
50
|
+
_.trys.pop(); continue;
|
|
51
|
+
}
|
|
52
|
+
op = body.call(thisArg, _);
|
|
53
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
54
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
58
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
59
|
+
};
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
62
|
+
var UtilityLogic_1 = require("./UtilityLogic");
|
|
63
|
+
var solid_namespace_1 = __importDefault(require("solid-namespace"));
|
|
64
|
+
var rdf = __importStar(require("rdflib"));
|
|
65
|
+
var jest_fetch_mock_1 = __importDefault(require("jest-fetch-mock"));
|
|
66
|
+
var rdflib_1 = require("rdflib");
|
|
67
|
+
var ns = (0, solid_namespace_1.default)(rdf);
|
|
68
|
+
var alice = rdf.sym("https://alice.example/profile/card#me");
|
|
69
|
+
var bob = rdf.sym("https://bob.example/profile/card#me");
|
|
70
|
+
describe("Utility logic", function () {
|
|
71
|
+
var util;
|
|
72
|
+
var store;
|
|
73
|
+
var fetcher;
|
|
74
|
+
beforeEach(function () {
|
|
75
|
+
jest_fetch_mock_1.default.resetMocks();
|
|
76
|
+
jest_fetch_mock_1.default.mockResponse("Not Found", {
|
|
77
|
+
status: 404,
|
|
78
|
+
});
|
|
79
|
+
fetcher = { fetch: jest_fetch_mock_1.default };
|
|
80
|
+
store = rdf.graph();
|
|
81
|
+
store.fetcher = rdf.fetcher(store, fetcher);
|
|
82
|
+
store.updater = new rdflib_1.UpdateManager(store);
|
|
83
|
+
util = new UtilityLogic_1.UtilityLogic(store, ns, fetcher);
|
|
84
|
+
});
|
|
85
|
+
describe("getArchiveUrl", function () {
|
|
86
|
+
it("produces the right URL in February", function () {
|
|
87
|
+
var url = util.getArchiveUrl('https://example.com/inbox/asdf-qwer-asdf-qwer', new Date('7 Feb 2062 UTC'));
|
|
88
|
+
expect(url).toEqual('https://example.com/inbox/archive/2062/02/07/asdf-qwer-asdf-qwer');
|
|
89
|
+
});
|
|
90
|
+
it("produces the right URL in November", function () {
|
|
91
|
+
var url = util.getArchiveUrl('https://example.com/inbox/asdf-qwer-asdf-qwer', new Date('12 Nov 2012 UTC'));
|
|
92
|
+
expect(url).toEqual('https://example.com/inbox/archive/2012/11/12/asdf-qwer-asdf-qwer');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe("getContainerMembers", function () {
|
|
96
|
+
describe("When container is empty", function () {
|
|
97
|
+
var result;
|
|
98
|
+
beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
+
return __generator(this, function (_a) {
|
|
100
|
+
switch (_a.label) {
|
|
101
|
+
case 0:
|
|
102
|
+
containerIsEmpty();
|
|
103
|
+
return [4 /*yield*/, util.getContainerMembers('https://container.com/')];
|
|
104
|
+
case 1:
|
|
105
|
+
result = _a.sent();
|
|
106
|
+
return [2 /*return*/];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}); });
|
|
110
|
+
it("Resolves to an empty array", function () {
|
|
111
|
+
expect(result).toEqual([]);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
describe("When container has some containment triples", function () {
|
|
115
|
+
var result;
|
|
116
|
+
beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
117
|
+
return __generator(this, function (_a) {
|
|
118
|
+
switch (_a.label) {
|
|
119
|
+
case 0:
|
|
120
|
+
containerHasSomeContainmentTriples();
|
|
121
|
+
return [4 /*yield*/, util.getContainerMembers('https://container.com/')];
|
|
122
|
+
case 1:
|
|
123
|
+
result = _a.sent();
|
|
124
|
+
return [2 /*return*/];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}); });
|
|
128
|
+
it("Resolves to an array with some URLs", function () {
|
|
129
|
+
expect(result.sort()).toEqual([
|
|
130
|
+
'https://container.com/foo.txt',
|
|
131
|
+
'https://container.com/bar/'
|
|
132
|
+
].sort());
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
describe("setSinglePeerAccess", function () {
|
|
137
|
+
beforeEach(function () {
|
|
138
|
+
jest_fetch_mock_1.default.mockOnceIf("https://owner.com/some/resource", "hello", {
|
|
139
|
+
headers: {
|
|
140
|
+
Link: '<https://owner.com/some/acl>; rel="acl"'
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
jest_fetch_mock_1.default.mockOnceIf("https://owner.com/some/acl", "Created", {
|
|
144
|
+
status: 201
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
it("Creates the right ACL doc", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
148
|
+
return __generator(this, function (_a) {
|
|
149
|
+
switch (_a.label) {
|
|
150
|
+
case 0: return [4 /*yield*/, util.setSinglePeerAccess({
|
|
151
|
+
ownerWebId: "https://owner.com/#me",
|
|
152
|
+
peerWebId: "https://peer.com/#me",
|
|
153
|
+
accessToModes: "acl:Read, acl:Control",
|
|
154
|
+
defaultModes: "acl:Write",
|
|
155
|
+
target: "https://owner.com/some/resource"
|
|
156
|
+
})];
|
|
157
|
+
case 1:
|
|
158
|
+
_a.sent();
|
|
159
|
+
expect(jest_fetch_mock_1.default.mock.calls).toEqual([
|
|
160
|
+
["https://owner.com/some/resource", jest_fetch_mock_1.default.mock.calls[0][1]],
|
|
161
|
+
["https://owner.com/some/acl", {
|
|
162
|
+
body: '@prefix acl: <http://www.w3.org/ns/auth/acl#>.\n' +
|
|
163
|
+
'\n' +
|
|
164
|
+
'<#alice> a acl:Authorization;\n' +
|
|
165
|
+
' acl:agent <https://owner.com/#me>;\n' +
|
|
166
|
+
' acl:accessTo <https://owner.com/some/resource>;\n' +
|
|
167
|
+
' acl:default <https://owner.com/some/resource>;\n' +
|
|
168
|
+
' acl:mode acl:Read, acl:Write, acl:Control.\n' +
|
|
169
|
+
'<#bobAccessTo> a acl:Authorization;\n' +
|
|
170
|
+
' acl:agent <https://peer.com/#me>;\n' +
|
|
171
|
+
' acl:accessTo <https://owner.com/some/resource>;\n' +
|
|
172
|
+
' acl:mode acl:Read, acl:Control.\n' +
|
|
173
|
+
'<#bobDefault> a acl:Authorization;\n' +
|
|
174
|
+
' acl:agent <https://peer.com/#me>;\n' +
|
|
175
|
+
' acl:default <https://owner.com/some/resource>;\n' +
|
|
176
|
+
' acl:mode acl:Write.\n',
|
|
177
|
+
headers: [
|
|
178
|
+
["Content-Type", "text/turtle"]
|
|
179
|
+
],
|
|
180
|
+
method: "PUT"
|
|
181
|
+
}]
|
|
182
|
+
]);
|
|
183
|
+
return [2 /*return*/];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}); });
|
|
187
|
+
});
|
|
188
|
+
function containerIsEmpty() {
|
|
189
|
+
jest_fetch_mock_1.default.mockOnceIf("https://container.com/", " ", // FIXME: https://github.com/jefflau/jest-fetch-mock/issues/189
|
|
190
|
+
{
|
|
191
|
+
headers: { "Content-Type": "text/turtle" },
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function containerHasSomeContainmentTriples() {
|
|
195
|
+
jest_fetch_mock_1.default.mockOnceIf("https://container.com/", "<.> <http://www.w3.org/ns/ldp#contains> <./foo.txt>, <./bar/> .", {
|
|
196
|
+
headers: { "Content-Type": "text/turtle" },
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
//# sourceMappingURL=unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit.test.js","sourceRoot":"","sources":["../../src/util/unit.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA6D;AAC7D,+CAA8C;AAC9C,oEAA6C;AAE7C,0CAA8B;AAE9B,oEAAwC;AACxC,iCAAuC;AAEvC,IAAM,EAAE,GAAG,IAAA,yBAAc,EAAC,GAAG,CAAC,CAAC;AAE/B,IAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;AAC/D,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;AAE3D,QAAQ,CAAC,eAAe,EAAE;IACxB,IAAI,IAAI,CAAC;IACT,IAAI,KAAK,CAAC;IACV,IAAI,OAAO,CAAC;IACZ,UAAU,CAAC;QACT,yBAAS,CAAC,UAAU,EAAE,CAAC;QACvB,yBAAS,CAAC,YAAY,CAAC,WAAW,EAAE;YAClC,MAAM,EAAE,GAAG;SACZ,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,KAAK,EAAE,yBAAS,EAAE,CAAC;QAC/B,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;QACpB,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC5C,KAAK,CAAC,OAAO,GAAG,IAAI,sBAAa,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,GAAG,IAAI,2BAAY,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,eA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AC;yBACH,CAAC,CAAC;;;;aACJ,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,SAAS,gBAAgB;QACvB,yBAAS,CAAC,UAAU,CAClB,wBAAwB,EACxB,GAAG,EAAE,+DAA+D;QACpE;YACE,OAAO,EAAE,EAAE,cAAc,EAAE,aAAa,EAAE;SAC3C,CACF,CAAC;IACJ,CAAC;IAED,SAAS,kCAAkC;QACzC,yBAAS,CAAC,UAAU,CAClB,wBAAwB,EACxB,iEAAiE,EACjE;YACE,OAAO,EAAE,EAAE,cAAc,EAAE,aAAa,EAAE;SAC3C,CACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-logic",
|
|
3
|
-
"version": "1.3.13-
|
|
3
|
+
"version": "1.3.13-c448e6a9",
|
|
4
4
|
"description": "Core business logic of Solid OS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc",
|
|
8
|
-
"clean": "rm -rf lib",
|
|
9
8
|
"lint": "eslint ./src",
|
|
10
|
-
"test": "jest",
|
|
9
|
+
"test": "jest ./src",
|
|
11
10
|
"preversion": "npm test",
|
|
12
11
|
"postversion": "git push --follow-tags",
|
|
13
12
|
"ignore:prepublishOnly": "npm run build",
|
|
@@ -42,7 +41,6 @@
|
|
|
42
41
|
"typescript": "4.5.4"
|
|
43
42
|
},
|
|
44
43
|
"dependencies": {
|
|
45
|
-
"standard": "^16.0.4",
|
|
46
44
|
"rdflib": "^2.2.17",
|
|
47
45
|
"solid-namespace": "^0.5.2"
|
|
48
46
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AuthnLogic } from "./index";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fallback, if no auth client has been provided to solid-logic
|
|
5
|
+
*/
|
|
6
|
+
export class NoAuthnLogic implements AuthnLogic {
|
|
7
|
+
constructor() {
|
|
8
|
+
console.warn(
|
|
9
|
+
"no auth client passed to solid-logic, logic that relies on auth is not available"
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
currentUser(): null {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,120 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import * as debug from '../util/debug'
|
|
1
|
+
import { NamedNode, sym } from "rdflib";
|
|
2
|
+
import { AuthnLogic } from "./index";
|
|
4
3
|
import { Session } from "@inrupt/solid-client-authn-browser";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Implements AuthnLogic relying on solid-auth-client
|
|
7
|
+
*/
|
|
8
|
+
export class SolidAuthnLogic implements AuthnLogic {
|
|
9
|
+
private session?: Session;
|
|
8
10
|
|
|
9
11
|
constructor(solidAuthSession: Session) {
|
|
10
12
|
this.session = solidAuthSession;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
currentUser(): NamedNode | null {
|
|
14
|
-
|
|
15
|
-
if (app.viewingNoAuthPage) {
|
|
16
|
-
return sym(app.webId)
|
|
17
|
-
}
|
|
18
|
-
if (this.session.info.webId && this.session.info.isLoggedIn) {
|
|
19
|
-
return sym(this.session.info.webId)
|
|
20
|
-
}
|
|
21
|
-
return offlineTestID() // null unless testing
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Retrieves currently logged in webId from either
|
|
26
|
-
* defaultTestUser or SolidAuth
|
|
27
|
-
* Also activates a session after login
|
|
28
|
-
* @param [setUserCallback] Optional callback
|
|
29
|
-
* @returns Resolves with webId uri, if no callback provided
|
|
30
|
-
*/
|
|
31
|
-
async checkUser<T> (
|
|
32
|
-
setUserCallback?: (me: NamedNode | null) => T
|
|
33
|
-
): Promise<NamedNode | T | null> {
|
|
34
|
-
// Save hash for "restorePreviousSession"
|
|
35
|
-
const preLoginRedirectHash = new URL(window.location.href).hash
|
|
36
|
-
if (preLoginRedirectHash) {
|
|
37
|
-
window.localStorage.setItem('preLoginRedirectHash', preLoginRedirectHash)
|
|
38
|
-
}
|
|
39
|
-
this.session.onSessionRestore((url) => {
|
|
40
|
-
if (document.location.toString() !== url) history.replaceState(null, '', url)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Handle a successful authentication redirect
|
|
45
|
-
*/
|
|
46
|
-
await this.session
|
|
47
|
-
.handleIncomingRedirect({
|
|
48
|
-
restorePreviousSession: true,
|
|
49
|
-
url: window.location.href
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
// Check to see if a hash was stored in local storage
|
|
53
|
-
const postLoginRedirectHash = window.localStorage.getItem('preLoginRedirectHash')
|
|
54
|
-
if (postLoginRedirectHash) {
|
|
55
|
-
const curUrl = new URL(window.location.href)
|
|
56
|
-
if (curUrl.hash !== postLoginRedirectHash) {
|
|
57
|
-
if (history.pushState) {
|
|
58
|
-
// console.log('Setting window.location.has using pushState')
|
|
59
|
-
history.pushState(null, document.title, postLoginRedirectHash)
|
|
60
|
-
} else {
|
|
61
|
-
// console.warn('Setting window.location.has using location.hash')
|
|
62
|
-
location.hash = postLoginRedirectHash
|
|
63
|
-
}
|
|
64
|
-
curUrl.hash = postLoginRedirectHash
|
|
65
|
-
}
|
|
66
|
-
// See https://stackoverflow.com/questions/3870057/how-can-i-update-window-location-hash-without-jumping-the-document
|
|
67
|
-
// window.location.href = curUrl.toString()// @@ See https://developer.mozilla.org/en-US/docs/Web/API/Window/location
|
|
68
|
-
window.localStorage.setItem('preLoginRedirectHash', '')
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Check to see if already logged in / have the WebID
|
|
72
|
-
let me = offlineTestID()
|
|
73
|
-
if (me) {
|
|
74
|
-
return Promise.resolve(setUserCallback ? setUserCallback(me) : me)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const webId = this.webIdFromSession(this.session.info)
|
|
78
|
-
if (webId) {
|
|
79
|
-
me = this.saveUser(webId)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (me) {
|
|
83
|
-
debug.log(`(Logged in as ${me} by authentication)`)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return Promise.resolve(setUserCallback ? setUserCallback(me) : me)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Saves `webId` in `context.me`
|
|
91
|
-
* @param webId
|
|
92
|
-
* @param context
|
|
93
|
-
*
|
|
94
|
-
* @returns Returns the WebID, after setting it
|
|
95
|
-
*/
|
|
96
|
-
saveUser (
|
|
97
|
-
webId: NamedNode | string | null,
|
|
98
|
-
context?: AuthenticationContext
|
|
99
|
-
): NamedNode | null {
|
|
100
|
-
let webIdUri: string
|
|
101
|
-
if (webId) {
|
|
102
|
-
webIdUri = (typeof webId === 'string') ? webId : webId.uri
|
|
103
|
-
const me = namedNode(webIdUri)
|
|
104
|
-
if (context) {
|
|
105
|
-
context.me = me
|
|
106
|
-
}
|
|
107
|
-
return me
|
|
108
|
-
}
|
|
109
|
-
return null
|
|
16
|
+
return this.session?.info.webId ? sym(this.session.info.webId) : null;
|
|
110
17
|
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @returns {Promise<string|null>} Resolves with WebID URI or null
|
|
114
|
-
*/
|
|
115
|
-
webIdFromSession (session?: { webId?: string, isLoggedIn: boolean }): string | null {
|
|
116
|
-
const webId = session?.webId && session.isLoggedIn ? session.webId : null
|
|
117
|
-
return webId
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
}
|
|
18
|
+
}
|
package/src/chat/ChatLogic.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NamedNode, Node, st, term
|
|
1
|
+
import { LiveStore, NamedNode, Node, st, term } from "rdflib";
|
|
2
|
+
import { SolidNamespace } from "../index";
|
|
2
3
|
import { ProfileLogic } from "../profile/ProfileLogic";
|
|
3
|
-
import {
|
|
4
|
-
import { newThing } from "../util/uri";
|
|
4
|
+
import { newThing } from "../uri";
|
|
5
5
|
import { determineChatContainer } from "./determineChatContainer";
|
|
6
6
|
|
|
7
7
|
const CHAT_LOCATION_IN_CONTAINER = "index.ttl#this";
|
|
@@ -225,7 +225,7 @@ export class ChatLogic {
|
|
|
225
225
|
}
|
|
226
226
|
const inviteBody = `
|
|
227
227
|
<> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;
|
|
228
|
-
${this.ns.rdf("seeAlso")} <${chatThing.value}> .
|
|
228
|
+
${this.ns.rdf("seeAlso")} <${chatThing.value}> .
|
|
229
229
|
`;
|
|
230
230
|
|
|
231
231
|
const inviteResponse = await this.store.fetcher?.webOperation(
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
import { ChatLogic } from "
|
|
2
|
+
import { ChatLogic } from "./ChatLogic";
|
|
3
3
|
import solidNamespace from "solid-namespace";
|
|
4
|
+
|
|
4
5
|
import * as rdf from "rdflib";
|
|
5
|
-
import { ProfileLogic } from "../
|
|
6
|
+
import { ProfileLogic } from "../profile/ProfileLogic";
|
|
7
|
+
import fetchMock from "jest-fetch-mock";
|
|
6
8
|
import { UpdateManager } from "rdflib";
|
|
7
|
-
import { SolidNamespace } from "../src/types";
|
|
8
9
|
|
|
9
|
-
const ns
|
|
10
|
+
const ns = solidNamespace(rdf);
|
|
10
11
|
|
|
11
12
|
const alice = rdf.sym("https://alice.example/profile/card#me");
|
|
12
13
|
const bob = rdf.sym("https://bob.example/profile/card#me");
|
|
@@ -124,11 +125,10 @@ describe("Chat logic", () => {
|
|
|
124
125
|
});
|
|
125
126
|
it("sent an invitation to invitee inbox", () => {
|
|
126
127
|
const request = getRequestTo("POST", "https://bob.example/inbox");
|
|
127
|
-
expect(request.body).
|
|
128
|
+
expect(request.body).toContain(`
|
|
128
129
|
<> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;
|
|
129
|
-
<http://www.w3.org/1999/02/22-rdf-syntax-ns#seeAlso> <https://alice.example/IndividualChats/bob.example/index.ttl#this> .
|
|
130
|
-
`);
|
|
131
|
-
});
|
|
130
|
+
<http://www.w3.org/1999/02/22-rdf-syntax-ns#seeAlso> <https://alice.example/IndividualChats/bob.example/index.ttl#this> .
|
|
131
|
+
`);});
|
|
132
132
|
it("added the new chat to private type index", () => {
|
|
133
133
|
const request = getRequestTo(
|
|
134
134
|
"PATCH",
|
|
File without changes
|
package/src/inbox/InboxLogic.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
// import { v4 as uuid } from "uuid";
|
|
2
|
+
import { LiveStore, NamedNode, Node, st, term } from "rdflib";
|
|
3
|
+
import { SolidNamespace } from "../index";
|
|
2
4
|
import { ProfileLogic } from "../profile/ProfileLogic";
|
|
3
|
-
import { SolidNamespace } from "../types";
|
|
4
5
|
import { UtilityLogic } from "../util/UtilityLogic";
|
|
6
|
+
// import { newThing } from "../uri";
|
|
7
|
+
|
|
8
|
+
interface NewPaneOptions {
|
|
9
|
+
me?: NamedNode;
|
|
10
|
+
newInstance?: NamedNode;
|
|
11
|
+
newBase: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface CreatedPaneOptions {
|
|
15
|
+
newInstance: NamedNode;
|
|
16
|
+
}
|
|
5
17
|
|
|
6
18
|
/**
|
|
7
19
|
* Inbox-related logic
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
+
import { UtilityLogic } from "../util/UtilityLogic";
|
|
2
3
|
import solidNamespace from "solid-namespace";
|
|
4
|
+
|
|
3
5
|
import * as rdf from "rdflib";
|
|
6
|
+
import { ProfileLogic } from "../profile/ProfileLogic";
|
|
7
|
+
import fetchMock from "jest-fetch-mock";
|
|
4
8
|
import { UpdateManager } from "rdflib";
|
|
5
|
-
import {
|
|
6
|
-
import { UtilityLogic } from "../src/util/UtilityLogic";
|
|
7
|
-
import { InboxLogic } from "../src/inbox/InboxLogic";
|
|
8
|
-
import { SolidNamespace } from "../src/types";
|
|
9
|
+
import { InboxLogic } from "./InboxLogic";
|
|
9
10
|
|
|
10
|
-
const ns
|
|
11
|
+
const ns = solidNamespace(rdf);
|
|
11
12
|
|
|
12
13
|
const alice = rdf.sym("https://alice.example/profile/card#me");
|
|
13
14
|
const bob = rdf.sym("https://bob.example/profile/card#me");
|