solid-logic 1.3.8 → 1.3.12-bbf45639
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 +7 -1
- package/lib/chat/ChatLogic.d.ts +2 -2
- package/lib/chat/ChatLogic.d.ts.map +1 -1
- package/lib/chat/ChatLogic.js +40 -35
- package/lib/chat/ChatLogic.js.map +1 -1
- package/lib/chat/determineChatContainer.js +1 -1
- package/lib/chat/determineChatContainer.js.map +1 -1
- package/lib/inbox/InboxLogic.d.ts +2 -2
- package/lib/inbox/InboxLogic.d.ts.map +1 -1
- package/lib/inbox/InboxLogic.js +16 -15
- package/lib/inbox/InboxLogic.js.map +1 -1
- package/lib/index.d.ts +5 -22
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -8
- package/lib/index.js.map +1 -1
- package/lib/profile/ProfileLogic.d.ts +2 -2
- package/lib/profile/ProfileLogic.d.ts.map +1 -1
- package/lib/profile/ProfileLogic.js +10 -8
- package/lib/profile/ProfileLogic.js.map +1 -1
- package/lib/util/UtilityLogic.d.ts +3 -3
- package/lib/util/UtilityLogic.d.ts.map +1 -1
- package/lib/util/UtilityLogic.js +23 -21
- package/lib/util/UtilityLogic.js.map +1 -1
- package/package.json +16 -16
- package/src/chat/ChatLogic.ts +12 -12
- package/src/inbox/InboxLogic.ts +3 -3
- package/src/index.ts +3 -15
- package/src/profile/ProfileLogic.ts +4 -4
- package/src/util/UtilityLogic.ts +4 -4
package/README.md
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
# solid-logic
|
|
2
|
-
Core business logic of
|
|
2
|
+
Core business logic of SolidOS
|
|
3
|
+
|
|
4
|
+
# Adendum
|
|
5
|
+
|
|
6
|
+
Solid-logic was a move to sparate business logic from UI functionality so that people using different UI frameworks could use logic code.
|
|
7
|
+
|
|
8
|
+
It was created when the "chat with me" feature was built. We needed shared logic between chat-pane and profile-pane (which was part of solid-panes back then I think) due to that feature. The whole idea of it is to separate core solid logic from UI components, to make logic reusable, e.g. by other UI libraries or even non web apps like CLI tools etc.
|
package/lib/chat/ChatLogic.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NamedNode } from "rdflib";
|
|
2
|
-
import {
|
|
1
|
+
import { LiveStore, NamedNode } from "rdflib";
|
|
2
|
+
import { SolidNamespace } from "../index";
|
|
3
3
|
import { ProfileLogic } from "../profile/ProfileLogic";
|
|
4
4
|
/**
|
|
5
5
|
* Chat-related logic
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatLogic.d.ts","sourceRoot":"","sources":["../../src/chat/ChatLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatLogic.d.ts","sourceRoot":"","sources":["../../src/chat/ChatLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAkB,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAgBvD;;GAEG;AACH,qBAAa,SAAS;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,cAAc,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;gBAEV,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY;IAMjE,MAAM,CACV,aAAa,EAAE,SAAS,EACxB,EAAE,EAAE,SAAS,EACb,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,IAAI,CAAC;YAsCF,qBAAqB;YAqCrB,QAAQ;YAeR,eAAe;IAW7B,OAAO,CAAC,OAAO;IAoDf;;;;;OAKG;IACG,OAAO,CACX,OAAO,EAAE,SAAS,EAClB,eAAe,UAAO,GACrB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;YAgBd,UAAU;CA6BzB"}
|
package/lib/chat/ChatLogic.js
CHANGED
|
@@ -62,50 +62,52 @@ var ChatLogic = /** @class */ (function () {
|
|
|
62
62
|
this.profile = profile;
|
|
63
63
|
}
|
|
64
64
|
ChatLogic.prototype.setAcl = function (chatContainer, me, invitee) {
|
|
65
|
+
var _a, _b;
|
|
65
66
|
return __awaiter(this, void 0, void 0, function () {
|
|
66
67
|
var chatAclDoc, aclBody;
|
|
67
|
-
return __generator(this, function (
|
|
68
|
-
switch (
|
|
68
|
+
return __generator(this, function (_c) {
|
|
69
|
+
switch (_c.label) {
|
|
69
70
|
case 0:
|
|
70
71
|
// Some servers don't present a Link http response header
|
|
71
72
|
// if the container doesn't exist yet, so refetch the container
|
|
72
73
|
// now that it has been created:
|
|
73
|
-
return [4 /*yield*/, this.store.fetcher.load(chatContainer)];
|
|
74
|
+
return [4 /*yield*/, ((_a = this.store.fetcher) === null || _a === void 0 ? void 0 : _a.load(chatContainer))];
|
|
74
75
|
case 1:
|
|
75
76
|
// Some servers don't present a Link http response header
|
|
76
77
|
// if the container doesn't exist yet, so refetch the container
|
|
77
78
|
// now that it has been created:
|
|
78
|
-
|
|
79
|
+
_c.sent();
|
|
79
80
|
chatAclDoc = this.store.any(chatContainer, new rdflib_1.NamedNode("http://www.iana.org/assignments/link-relations/acl"));
|
|
80
81
|
if (!chatAclDoc) {
|
|
81
82
|
throw new Error("Chat ACL doc not found!");
|
|
82
83
|
}
|
|
83
|
-
aclBody = "\n@prefix acl: <http://www.w3.org/ns/auth/acl#>.\n<#owner>\n a acl:Authorization;\n acl:agent <"
|
|
84
|
-
return [4 /*yield*/, this.store.fetcher.webOperation("PUT", chatAclDoc.value, {
|
|
84
|
+
aclBody = "\n@prefix acl: <http://www.w3.org/ns/auth/acl#>.\n<#owner>\n a acl:Authorization;\n acl:agent <".concat(me.value, ">;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Write, acl:Control.\n<#invitee>\n a acl:Authorization;\n acl:agent <").concat(invitee.value, ">;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Append.\n");
|
|
85
|
+
return [4 /*yield*/, ((_b = this.store.fetcher) === null || _b === void 0 ? void 0 : _b.webOperation("PUT", chatAclDoc.value, {
|
|
85
86
|
data: aclBody,
|
|
86
87
|
contentType: "text/turtle",
|
|
87
|
-
})];
|
|
88
|
+
}))];
|
|
88
89
|
case 2:
|
|
89
|
-
|
|
90
|
+
_c.sent();
|
|
90
91
|
return [2 /*return*/];
|
|
91
92
|
}
|
|
92
93
|
});
|
|
93
94
|
});
|
|
94
95
|
};
|
|
95
96
|
ChatLogic.prototype.addToPrivateTypeIndex = function (chatThing, me) {
|
|
97
|
+
var _a;
|
|
96
98
|
return __awaiter(this, void 0, void 0, function () {
|
|
97
99
|
var privateTypeIndex, reg, ins;
|
|
98
100
|
var _this = this;
|
|
99
|
-
return __generator(this, function (
|
|
100
|
-
switch (
|
|
101
|
+
return __generator(this, function (_b) {
|
|
102
|
+
switch (_b.label) {
|
|
101
103
|
case 0:
|
|
102
104
|
privateTypeIndex = this.store.any(me, this.ns.solid("privateTypeIndex"));
|
|
103
105
|
if (!privateTypeIndex) {
|
|
104
106
|
throw new Error("Private type index not found!");
|
|
105
107
|
}
|
|
106
|
-
return [4 /*yield*/, this.store.fetcher.load(privateTypeIndex)];
|
|
108
|
+
return [4 /*yield*/, ((_a = this.store.fetcher) === null || _a === void 0 ? void 0 : _a.load(privateTypeIndex))];
|
|
107
109
|
case 1:
|
|
108
|
-
|
|
110
|
+
_b.sent();
|
|
109
111
|
reg = (0, uri_1.newThing)(privateTypeIndex);
|
|
110
112
|
ins = [
|
|
111
113
|
(0, rdflib_1.st)(reg, this.ns.rdf("type"), this.ns.solid("TypeRegistration"), privateTypeIndex.doc()),
|
|
@@ -113,7 +115,8 @@ var ChatLogic = /** @class */ (function () {
|
|
|
113
115
|
(0, rdflib_1.st)(reg, this.ns.solid("instance"), chatThing, privateTypeIndex.doc()),
|
|
114
116
|
];
|
|
115
117
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
116
|
-
|
|
118
|
+
var _a;
|
|
119
|
+
(_a = _this.store.updater) === null || _a === void 0 ? void 0 : _a.update([], ins, function (_uri, ok, errm) {
|
|
117
120
|
if (!ok) {
|
|
118
121
|
reject(new Error(errm));
|
|
119
122
|
}
|
|
@@ -123,34 +126,35 @@ var ChatLogic = /** @class */ (function () {
|
|
|
123
126
|
});
|
|
124
127
|
})];
|
|
125
128
|
case 2:
|
|
126
|
-
|
|
129
|
+
_b.sent();
|
|
127
130
|
return [2 /*return*/];
|
|
128
131
|
}
|
|
129
132
|
});
|
|
130
133
|
});
|
|
131
134
|
};
|
|
132
135
|
ChatLogic.prototype.findChat = function (invitee) {
|
|
136
|
+
var _a;
|
|
133
137
|
return __awaiter(this, void 0, void 0, function () {
|
|
134
138
|
var me, podRoot, chatContainer, exists, e_1;
|
|
135
|
-
return __generator(this, function (
|
|
136
|
-
switch (
|
|
139
|
+
return __generator(this, function (_b) {
|
|
140
|
+
switch (_b.label) {
|
|
137
141
|
case 0: return [4 /*yield*/, this.profile.loadMe()];
|
|
138
142
|
case 1:
|
|
139
|
-
me =
|
|
143
|
+
me = _b.sent();
|
|
140
144
|
return [4 /*yield*/, this.profile.getPodRoot(me)];
|
|
141
145
|
case 2:
|
|
142
|
-
podRoot =
|
|
146
|
+
podRoot = _b.sent();
|
|
143
147
|
chatContainer = (0, determineChatContainer_1.determineChatContainer)(invitee, podRoot);
|
|
144
148
|
exists = true;
|
|
145
|
-
|
|
149
|
+
_b.label = 3;
|
|
146
150
|
case 3:
|
|
147
|
-
|
|
148
|
-
return [4 /*yield*/, this.store.fetcher.load(new rdflib_1.NamedNode(chatContainer.value + "index.ttl#this"))];
|
|
151
|
+
_b.trys.push([3, 5, , 6]);
|
|
152
|
+
return [4 /*yield*/, ((_a = this.store.fetcher) === null || _a === void 0 ? void 0 : _a.load(new rdflib_1.NamedNode(chatContainer.value + "index.ttl#this")))];
|
|
149
153
|
case 4:
|
|
150
|
-
|
|
154
|
+
_b.sent();
|
|
151
155
|
return [3 /*break*/, 6];
|
|
152
156
|
case 5:
|
|
153
|
-
e_1 =
|
|
157
|
+
e_1 = _b.sent();
|
|
154
158
|
exists = false;
|
|
155
159
|
return [3 /*break*/, 6];
|
|
156
160
|
case 6: return [2 /*return*/, { me: me, chatContainer: chatContainer, exists: exists }];
|
|
@@ -191,7 +195,7 @@ var ChatLogic = /** @class */ (function () {
|
|
|
191
195
|
kb.add(newInstance, this.ns.dc("author"), newPaneOptions.me, newChatDoc);
|
|
192
196
|
}
|
|
193
197
|
return new Promise(function (resolve, reject) {
|
|
194
|
-
updater.put(newChatDoc, kb.statementsMatching(undefined, undefined, undefined, newChatDoc), "text/turtle", function (uri2, ok, message) {
|
|
198
|
+
updater === null || updater === void 0 ? void 0 : updater.put(newChatDoc, kb.statementsMatching(undefined, undefined, undefined, newChatDoc), "text/turtle", function (uri2, ok, message) {
|
|
195
199
|
if (ok) {
|
|
196
200
|
resolve(__assign(__assign({}, newPaneOptions), { newInstance: newInstance }));
|
|
197
201
|
}
|
|
@@ -239,27 +243,28 @@ var ChatLogic = /** @class */ (function () {
|
|
|
239
243
|
});
|
|
240
244
|
};
|
|
241
245
|
ChatLogic.prototype.sendInvite = function (invitee, chatThing) {
|
|
246
|
+
var _a, _b;
|
|
242
247
|
return __awaiter(this, void 0, void 0, function () {
|
|
243
248
|
var inviteeInbox, inviteBody, inviteResponse, locationStr;
|
|
244
|
-
return __generator(this, function (
|
|
245
|
-
switch (
|
|
246
|
-
case 0: return [4 /*yield*/, this.store.fetcher.load(invitee.doc())];
|
|
249
|
+
return __generator(this, function (_c) {
|
|
250
|
+
switch (_c.label) {
|
|
251
|
+
case 0: return [4 /*yield*/, ((_a = this.store.fetcher) === null || _a === void 0 ? void 0 : _a.load(invitee.doc()))];
|
|
247
252
|
case 1:
|
|
248
|
-
|
|
253
|
+
_c.sent();
|
|
249
254
|
inviteeInbox = this.store.any(invitee, this.ns.ldp("inbox"), undefined, invitee.doc());
|
|
250
255
|
if (!inviteeInbox) {
|
|
251
|
-
throw new Error("Invitee inbox not found! "
|
|
256
|
+
throw new Error("Invitee inbox not found! ".concat(invitee.value));
|
|
252
257
|
}
|
|
253
|
-
inviteBody = "\n<> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;\n"
|
|
254
|
-
return [4 /*yield*/, this.store.fetcher.webOperation("POST", inviteeInbox.value, {
|
|
258
|
+
inviteBody = "\n<> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;\n".concat(this.ns.rdf("seeAlso"), " <").concat(chatThing.value, "> . \n ");
|
|
259
|
+
return [4 /*yield*/, ((_b = this.store.fetcher) === null || _b === void 0 ? void 0 : _b.webOperation("POST", inviteeInbox.value, {
|
|
255
260
|
data: inviteBody,
|
|
256
261
|
contentType: "text/turtle",
|
|
257
|
-
})];
|
|
262
|
+
}))];
|
|
258
263
|
case 2:
|
|
259
|
-
inviteResponse =
|
|
260
|
-
locationStr = inviteResponse.headers.get("location");
|
|
264
|
+
inviteResponse = _c.sent();
|
|
265
|
+
locationStr = inviteResponse === null || inviteResponse === void 0 ? void 0 : inviteResponse.headers.get("location");
|
|
261
266
|
if (!locationStr) {
|
|
262
|
-
throw new Error("Invite sending returned a "
|
|
267
|
+
throw new Error("Invite sending returned a ".concat(inviteResponse === null || inviteResponse === void 0 ? void 0 : inviteResponse.status));
|
|
263
268
|
}
|
|
264
269
|
return [2 /*return*/];
|
|
265
270
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatLogic.js","sourceRoot":"","sources":["../../src/chat/ChatLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ChatLogic.js","sourceRoot":"","sources":["../../src/chat/ChatLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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pB,SAAS,EACT,OAAO,CAAC,GAAG,EAAE,CACd,CAAC;wBACF,IAAI,CAAC,YAAY,EAAE;4BACjB,MAAM,IAAI,KAAK,CAAC,mCAA4B,OAAO,CAAC,KAAK,CAAE,CAAC,CAAC;yBAC9D;wBACK,UAAU,GAAG,sEAErB,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,eAAK,SAAS,CAAC,KAAK,aACzC,CAAC;wBAEuB,qBAAM,CAAA,MAAA,IAAI,CAAC,KAAK,CAAC,OAAO,0CAAE,YAAY,CAC3D,MAAM,EACN,YAAY,CAAC,KAAK,EAClB;gCACE,IAAI,EAAE,UAAU;gCAChB,WAAW,EAAE,aAAa;6BAC3B,CACF,CAAA,EAAA;;wBAPK,cAAc,GAAG,SAOtB;wBACK,WAAW,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;wBAC5D,IAAI,CAAC,WAAW,EAAE;4BAChB,MAAM,IAAI,KAAK,CAAC,oCAA6B,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAE,CAAC,CAAC;yBACxE;;;;;KACF;IACH,gBAAC;AAAD,CAAC,AA9ND,IA8NC;AA9NY,8BAAS"}
|
|
@@ -5,7 +5,7 @@ var rdflib_1 = require("rdflib");
|
|
|
5
5
|
function determineChatContainer(invitee, podRoot) {
|
|
6
6
|
// Create chat
|
|
7
7
|
// See https://gitter.im/solid/chat-app?at=5f3c800f855be416a23ae74a
|
|
8
|
-
var chatContainerStr = new URL("IndividualChats/"
|
|
8
|
+
var chatContainerStr = new URL("IndividualChats/".concat(new URL(invitee.value).host, "/"), podRoot.value).toString();
|
|
9
9
|
return new rdflib_1.NamedNode(chatContainerStr);
|
|
10
10
|
}
|
|
11
11
|
exports.determineChatContainer = determineChatContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"determineChatContainer.js","sourceRoot":"","sources":["../../src/chat/determineChatContainer.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC,SAAgB,sBAAsB,CACpC,OAAkB,EAClB,OAAkB;IAElB,cAAc;IACd,mEAAmE;IACnE,IAAM,gBAAgB,GAAG,IAAI,GAAG,CAC9B,
|
|
1
|
+
{"version":3,"file":"determineChatContainer.js","sourceRoot":"","sources":["../../src/chat/determineChatContainer.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC,SAAgB,sBAAsB,CACpC,OAAkB,EAClB,OAAkB;IAElB,cAAc;IACd,mEAAmE;IACnE,IAAM,gBAAgB,GAAG,IAAI,GAAG,CAC9B,0BAAmB,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,MAAG,EACjD,OAAO,CAAC,KAAK,CACd,CAAC,QAAQ,EAAE,CAAC;IACb,OAAO,IAAI,kBAAS,CAAC,gBAAgB,CAAC,CAAC;AACzC,CAAC;AAXD,wDAWC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NamedNode } from "rdflib";
|
|
2
|
-
import {
|
|
1
|
+
import { LiveStore, NamedNode } from "rdflib";
|
|
2
|
+
import { SolidNamespace } from "../index";
|
|
3
3
|
import { ProfileLogic } from "../profile/ProfileLogic";
|
|
4
4
|
import { UtilityLogic } from "../util/UtilityLogic";
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InboxLogic.d.ts","sourceRoot":"","sources":["../../src/inbox/InboxLogic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"InboxLogic.d.ts","sourceRoot":"","sources":["../../src/inbox/InboxLogic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAkB,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAapD;;GAEG;AACH,qBAAa,UAAU;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,cAAc,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,YAAY,CAAC;gBAEP,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY;IAOrF,cAAc,CAClB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,MAAM,EAAE,CAAC;IAQd,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAc9C,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI;CAoBzC"}
|
package/lib/inbox/InboxLogic.js
CHANGED
|
@@ -81,7 +81,7 @@ var InboxLogic = /** @class */ (function () {
|
|
|
81
81
|
return [4 /*yield*/, this.profile.getPodRoot(myWebId)];
|
|
82
82
|
case 2:
|
|
83
83
|
podRoot = _a.sent();
|
|
84
|
-
ourInbox = podRoot.value
|
|
84
|
+
ourInbox = "".concat(podRoot.value, "p2p-inboxes/").concat(encodeURIComponent(nick), "/");
|
|
85
85
|
return [4 /*yield*/, this.util.createContainer(ourInbox)];
|
|
86
86
|
case 3:
|
|
87
87
|
_a.sent();
|
|
@@ -102,38 +102,39 @@ var InboxLogic = /** @class */ (function () {
|
|
|
102
102
|
});
|
|
103
103
|
};
|
|
104
104
|
InboxLogic.prototype.markAsRead = function (url, date) {
|
|
105
|
+
var _a;
|
|
105
106
|
return __awaiter(this, void 0, void 0, function () {
|
|
106
107
|
var downloaded, archiveUrl, options, uploaded;
|
|
107
|
-
var
|
|
108
|
-
return __generator(this, function (
|
|
109
|
-
switch (
|
|
108
|
+
var _b;
|
|
109
|
+
return __generator(this, function (_c) {
|
|
110
|
+
switch (_c.label) {
|
|
110
111
|
case 0: return [4 /*yield*/, this.util.fetcher.fetch(url)];
|
|
111
112
|
case 1:
|
|
112
|
-
downloaded =
|
|
113
|
+
downloaded = _c.sent();
|
|
113
114
|
if (downloaded.status !== 200) {
|
|
114
|
-
throw new Error("Not OK! "
|
|
115
|
+
throw new Error("Not OK! ".concat(url));
|
|
115
116
|
}
|
|
116
117
|
archiveUrl = this.util.getArchiveUrl(url, date);
|
|
117
|
-
|
|
118
|
+
_b = {
|
|
118
119
|
method: 'PUT'
|
|
119
120
|
};
|
|
120
121
|
return [4 /*yield*/, downloaded.text()];
|
|
121
122
|
case 2:
|
|
122
|
-
options = (
|
|
123
|
-
|
|
123
|
+
options = (_b.body = _c.sent(),
|
|
124
|
+
_b.headers = [
|
|
124
125
|
['Content-Type', downloaded.headers.get('Content-Type') || 'application/octet-stream']
|
|
125
126
|
],
|
|
126
|
-
|
|
127
|
+
_b);
|
|
127
128
|
return [4 /*yield*/, this.util.fetcher.fetch(archiveUrl, options)];
|
|
128
129
|
case 3:
|
|
129
|
-
uploaded =
|
|
130
|
+
uploaded = _c.sent();
|
|
130
131
|
if (!(uploaded.status.toString()[0] === '2')) return [3 /*break*/, 5];
|
|
131
|
-
return [4 /*yield*/, this.store.fetcher._fetch(url, {
|
|
132
|
+
return [4 /*yield*/, ((_a = this.store.fetcher) === null || _a === void 0 ? void 0 : _a._fetch(url, {
|
|
132
133
|
method: 'DELETE'
|
|
133
|
-
})];
|
|
134
|
+
}))];
|
|
134
135
|
case 4:
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
_c.sent();
|
|
137
|
+
_c.label = 5;
|
|
137
138
|
case 5: return [2 /*return*/];
|
|
138
139
|
}
|
|
139
140
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InboxLogic.js","sourceRoot":"","sources":["../../src/inbox/InboxLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA;;GAEG;AACH;IAME,oBAA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;;;KAEN;IACH,iBAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDY,gCAAU"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
1
|
import { Session } from "@inrupt/solid-client-authn-browser";
|
|
2
|
-
import
|
|
2
|
+
import * as rdf from "rdflib";
|
|
3
|
+
import { NamedNode, Statement } from "rdflib";
|
|
3
4
|
import { AuthnLogic } from "./authn";
|
|
4
5
|
import { ChatLogic } from "./chat/ChatLogic";
|
|
5
6
|
import { ProfileLogic } from "./profile/ProfileLogic";
|
|
6
7
|
import { UtilityLogic } from "./util/UtilityLogic";
|
|
8
|
+
import { LiveStore } from 'rdflib';
|
|
7
9
|
export { ACL_LINK } from './util/UtilityLogic';
|
|
8
|
-
interface ConnectedStore extends Store {
|
|
9
|
-
fetcher: Fetcher;
|
|
10
|
-
}
|
|
11
|
-
export interface LiveStore extends ConnectedStore {
|
|
12
|
-
updater: UpdateManager;
|
|
13
|
-
/**
|
|
14
|
-
* HACK: Something is wrong with the types in rdflib
|
|
15
|
-
* Go back and figure out what's wrong with the types
|
|
16
|
-
*/
|
|
17
|
-
any: any;
|
|
18
|
-
each: any;
|
|
19
|
-
holds: any;
|
|
20
|
-
sym: any;
|
|
21
|
-
add: any;
|
|
22
|
-
statementsMatching: any;
|
|
23
|
-
slice: any;
|
|
24
|
-
remove: any;
|
|
25
|
-
statements: any;
|
|
26
|
-
}
|
|
27
10
|
export interface SolidNamespace {
|
|
28
11
|
[key: string]: (term: string) => NamedNode;
|
|
29
12
|
}
|
|
@@ -48,12 +31,12 @@ export declare class SolidLogic {
|
|
|
48
31
|
constructor(fetcher: {
|
|
49
32
|
fetch: (url: any, requestInit: any) => any;
|
|
50
33
|
}, solidAuthSession: Session);
|
|
51
|
-
findAclDocUrl(url: string): Promise<
|
|
34
|
+
findAclDocUrl(url: string): Promise<string>;
|
|
52
35
|
loadDoc(doc: NamedNode): Promise<void>;
|
|
53
36
|
loadProfile(me: NamedNode): Promise<NamedNode>;
|
|
54
37
|
loadPreferences(me: NamedNode): Promise<NamedNode>;
|
|
55
38
|
getTypeIndex(me: NamedNode | string, preferencesFile: NamedNode | string, isPublic: boolean): NamedNode[];
|
|
56
|
-
getRegistrations(instance: any, theClass: any):
|
|
39
|
+
getRegistrations(instance: any, theClass: any): rdf.Node[];
|
|
57
40
|
load(doc: NamedNode | NamedNode[] | string): Promise<Response> | Promise<Response[]>;
|
|
58
41
|
loadIndexes(me: NamedNode | string, publicProfile: NamedNode | string | null, preferencesFile: NamedNode | string | null, onWarning?: (_err: Error) => Promise<undefined>): Promise<{
|
|
59
42
|
private: any;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAW,SAAS,EAAE,SAAS,EAAwB,MAAM,QAAQ,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAkB,SAAS,EAAE,MAAM,QAAQ,CAAA;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAY/C,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC;CAC5C;AAED,qBAAa,UAAU;IACr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,SAAS,GAAG,MAAM,GAAG,IAAI,EAC1C,SAAS,UAAgB,KAAK,uBAE7B,GACA,OAAO,CAAC;QACT,OAAO,EAAE,GAAG,CAAC;QACb,MAAM,EAAE,GAAG,CAAC;KACb,CAAC;IAyCI,iBAAiB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM;IAYvD,aAAa,CACX,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,EACrB,GAAG,GAAE,KAAK,CAAC,SAAS,CAAM,GACzB,OAAO,CAAC,IAAI,CAAC;IAehB,WAAW,CAAC,GAAG,EAAE,MAAM;IAIvB,oBAAoB,CAAC,aAAa,EAAE,SAAS,GAAG,SAAS,EAAE;IAI3D,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAItD,eAAe,CAAC,GAAG,EAAE,MAAM;IAIjC,UAAU;IAIJ,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;CAGvC;AAED,cAAM,WAAY,SAAQ,KAAK;gBACjB,OAAO,CAAC,EAAE,MAAM;CAM7B;AAED,qBAAa,iBAAkB,SAAQ,WAAW;CAAG;AAErD,qBAAa,yBAA0B,SAAQ,WAAW;CAAG;AAE7D,qBAAa,wBAAyB,SAAQ,WAAW;CAAG;AAE5D,qBAAa,aAAc,SAAQ,WAAW;CAAG;AAEjD,qBAAa,UAAW,SAAQ,WAAW;IACzC,MAAM,EAAE,MAAM,CAAC;gBAEH,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAI7C"}
|
package/lib/index.js
CHANGED
|
@@ -131,7 +131,7 @@ var SolidLogic = /** @class */ (function () {
|
|
|
131
131
|
return [2 /*return*/, profileDocument];
|
|
132
132
|
case 3:
|
|
133
133
|
err_1 = _a.sent();
|
|
134
|
-
message = "Logged in but cannot load profile "
|
|
134
|
+
message = "Logged in but cannot load profile ".concat(profileDocument, " : ").concat(err_1);
|
|
135
135
|
throw new Error(message);
|
|
136
136
|
case 4: return [2 /*return*/];
|
|
137
137
|
}
|
|
@@ -149,7 +149,7 @@ var SolidLogic = /** @class */ (function () {
|
|
|
149
149
|
if (!preferencesFile) {
|
|
150
150
|
return true;
|
|
151
151
|
}
|
|
152
|
-
return (window.location.origin
|
|
152
|
+
return ("".concat(window.location.origin, "/") !== new URL(preferencesFile.value).origin);
|
|
153
153
|
}
|
|
154
154
|
var preferencesFile, err_2, status_1;
|
|
155
155
|
return __generator(this, function (_a) {
|
|
@@ -161,7 +161,7 @@ var SolidLogic = /** @class */ (function () {
|
|
|
161
161
|
}
|
|
162
162
|
preferencesFile = this.store.any(me, ns.space("preferencesFile"));
|
|
163
163
|
if (!preferencesFile) {
|
|
164
|
-
throw new Error("Can't find a preference file pointer in profile "
|
|
164
|
+
throw new Error("Can't find a preference file pointer in profile ".concat(me.doc()));
|
|
165
165
|
}
|
|
166
166
|
if (!this.store.fetcher) {
|
|
167
167
|
throw new Error("Cannot load doc, have no fetcher");
|
|
@@ -178,7 +178,7 @@ var SolidLogic = /** @class */ (function () {
|
|
|
178
178
|
case 3:
|
|
179
179
|
err_2 = _a.sent();
|
|
180
180
|
status_1 = err_2.status;
|
|
181
|
-
debug.log("HTTP status "
|
|
181
|
+
debug.log("HTTP status ".concat(status_1, " for preference file ").concat(preferencesFile));
|
|
182
182
|
if (status_1 === 401) {
|
|
183
183
|
throw new UnauthorizedError();
|
|
184
184
|
}
|
|
@@ -240,13 +240,13 @@ var SolidLogic = /** @class */ (function () {
|
|
|
240
240
|
return [3 /*break*/, 4];
|
|
241
241
|
case 3:
|
|
242
242
|
err_3 = _a.sent();
|
|
243
|
-
onWarning(new Error("loadIndex: loading public type index(es) "
|
|
243
|
+
onWarning(new Error("loadIndex: loading public type index(es) ".concat(err_3)));
|
|
244
244
|
return [3 /*break*/, 4];
|
|
245
245
|
case 4:
|
|
246
246
|
if (!preferencesFile) return [3 /*break*/, 9];
|
|
247
247
|
privateIndexes = this.getTypeIndex(me, preferencesFile, false);
|
|
248
248
|
if (!(privateIndexes.length === 0)) return [3 /*break*/, 6];
|
|
249
|
-
return [4 /*yield*/, onWarning(new Error("Your preference file "
|
|
249
|
+
return [4 /*yield*/, onWarning(new Error("Your preference file ".concat(preferencesFile, " does not point to a private type index.")))];
|
|
250
250
|
case 5:
|
|
251
251
|
_a.sent();
|
|
252
252
|
return [3 /*break*/, 9];
|
|
@@ -258,7 +258,7 @@ var SolidLogic = /** @class */ (function () {
|
|
|
258
258
|
return [3 /*break*/, 9];
|
|
259
259
|
case 8:
|
|
260
260
|
err_4 = _a.sent();
|
|
261
|
-
onWarning(new Error("loadIndex: loading private type index(es) "
|
|
261
|
+
onWarning(new Error("loadIndex: loading private type index(es) ".concat(err_4)));
|
|
262
262
|
return [3 /*break*/, 9];
|
|
263
263
|
case 9: return [2 /*return*/, {
|
|
264
264
|
private: privateIndexes,
|
|
@@ -277,7 +277,7 @@ var SolidLogic = /** @class */ (function () {
|
|
|
277
277
|
throw new Error("Cannot create empty rdf doc, have no fetcher");
|
|
278
278
|
}
|
|
279
279
|
return [4 /*yield*/, this.store.fetcher.webOperation("PUT", doc.uri, {
|
|
280
|
-
data: "# "
|
|
280
|
+
data: "# ".concat(new Date(), " ").concat(comment, "\n"),
|
|
281
281
|
contentType: "text/turtle",
|
|
282
282
|
})];
|
|
283
283
|
case 1:
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAA8B;AAE9B,oEAA6C;AAE7C,qDAAoD;AACpD,2DAA0D;AAE1D,8CAA6C;AAC7C,6CAAiC;AACjC,uDAAsD;AACtD,oDAAmD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":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KAAI,EAAE,WAAW,SAAS,CAAC,CAAC,CAAC,0BAA0B;QAC7E,KAAI,CAAC,IAAI,GAAG,WAAW,IAAI,CAAC,CAAC,qCAAqC;;IACpE,CAAC;IACH,kBAAC;AAAD,CAAC,AAPD,CAA0B,KAAK,GAO9B;AAED;IAAuC,qCAAW;IAAlD;;IAAoD,CAAC;IAAD,wBAAC;AAAD,CAAC,AAArD,CAAuC,WAAW,GAAG;AAAxC,8CAAiB;AAE9B;IAA+C,6CAAW;IAA1D;;IAA4D,CAAC;IAAD,gCAAC;AAAD,CAAC,AAA7D,CAA+C,WAAW,GAAG;AAAhD,8DAAyB;AAEtC;IAA8C,4CAAW;IAAzD;;IAA2D,CAAC;IAAD,+BAAC;AAAD,CAAC,AAA5D,CAA8C,WAAW,GAAG;AAA/C,4DAAwB;AAErC;IAAmC,iCAAW;IAA9C;;IAAgD,CAAC;IAAD,oBAAC;AAAD,CAAC,AAAjD,CAAmC,WAAW,GAAG;AAApC,sCAAa;AAE1B;IAAgC,8BAAW;IAGzC,oBAAY,MAAc,EAAE,OAAgB;QAA5C,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACvB,CAAC;IACH,iBAAC;AAAD,CAAC,AAPD,CAAgC,WAAW,GAO1C;AAPY,gCAAU"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedNode } from "rdflib";
|
|
1
|
+
import { LiveStore, NamedNode } from "rdflib";
|
|
2
2
|
import { AuthnLogic } from "../authn";
|
|
3
|
-
import {
|
|
3
|
+
import { SolidNamespace } from "../index";
|
|
4
4
|
export declare class ProfileLogic {
|
|
5
5
|
store: LiveStore;
|
|
6
6
|
ns: SolidNamespace;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileLogic.d.ts","sourceRoot":"","sources":["../../src/profile/ProfileLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"ProfileLogic.d.ts","sourceRoot":"","sources":["../../src/profile/ProfileLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,qBAAa,YAAY;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,cAAc,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;gBAEN,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU;IAM7D,MAAM,IAAI,OAAO,CAAC,SAAS,CAAC;IASlC,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS;IAQhC,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IASvD,OAAO,CAAC,WAAW;CAGpB"}
|
|
@@ -44,18 +44,19 @@ var ProfileLogic = /** @class */ (function () {
|
|
|
44
44
|
this.authn = authn;
|
|
45
45
|
}
|
|
46
46
|
ProfileLogic.prototype.loadMe = function () {
|
|
47
|
+
var _a;
|
|
47
48
|
return __awaiter(this, void 0, void 0, function () {
|
|
48
49
|
var me;
|
|
49
|
-
return __generator(this, function (
|
|
50
|
-
switch (
|
|
50
|
+
return __generator(this, function (_b) {
|
|
51
|
+
switch (_b.label) {
|
|
51
52
|
case 0:
|
|
52
53
|
me = this.authn.currentUser();
|
|
53
54
|
if (me === null) {
|
|
54
55
|
throw new Error("Current user not found! Not logged in?");
|
|
55
56
|
}
|
|
56
|
-
return [4 /*yield*/, this.store.fetcher.load(me.doc())];
|
|
57
|
+
return [4 /*yield*/, ((_a = this.store.fetcher) === null || _a === void 0 ? void 0 : _a.load(me.doc()))];
|
|
57
58
|
case 1:
|
|
58
|
-
|
|
59
|
+
_b.sent();
|
|
59
60
|
return [2 /*return*/, me];
|
|
60
61
|
}
|
|
61
62
|
});
|
|
@@ -69,13 +70,14 @@ var ProfileLogic = /** @class */ (function () {
|
|
|
69
70
|
return podRoot;
|
|
70
71
|
};
|
|
71
72
|
ProfileLogic.prototype.getMainInbox = function (user) {
|
|
73
|
+
var _a;
|
|
72
74
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
75
|
var mainInbox;
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
switch (
|
|
76
|
-
case 0: return [4 /*yield*/, this.store.fetcher.load(user)];
|
|
76
|
+
return __generator(this, function (_b) {
|
|
77
|
+
switch (_b.label) {
|
|
78
|
+
case 0: return [4 /*yield*/, ((_a = this.store.fetcher) === null || _a === void 0 ? void 0 : _a.load(user))];
|
|
77
79
|
case 1:
|
|
78
|
-
|
|
80
|
+
_b.sent();
|
|
79
81
|
mainInbox = this.store.any(user, this.ns.ldp("inbox"), undefined, user.doc());
|
|
80
82
|
if (!mainInbox) {
|
|
81
83
|
throw new Error("User main inbox not found!");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileLogic.js","sourceRoot":"","sources":["../../src/profile/ProfileLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;IAKE,sBAAY,KAAgB,EAAE,EAAkB,EAAE,KAAiB;QACjE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEK,6BAAM,GAAZ
|
|
1
|
+
{"version":3,"file":"ProfileLogic.js","sourceRoot":"","sources":["../../src/profile/ProfileLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;IAKE,sBAAY,KAAgB,EAAE,EAAkB,EAAE,KAAiB;QACjE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;Q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AI,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3E,CAAC;IACH,mBAAC;AAAD,CAAC,AAxCD,IAwCC;AAxCY,oCAAY"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NamedNode } from "rdflib";
|
|
2
|
-
import {
|
|
1
|
+
import { LiveStore, NamedNode } from "rdflib";
|
|
2
|
+
import { SolidNamespace } from "../index";
|
|
3
3
|
export declare const ACL_LINK: NamedNode;
|
|
4
4
|
/**
|
|
5
5
|
* Utility-related logic
|
|
@@ -13,7 +13,7 @@ export declare class UtilityLogic {
|
|
|
13
13
|
constructor(store: LiveStore, ns: SolidNamespace, fetcher: {
|
|
14
14
|
fetch: (url: string, options?: any) => any;
|
|
15
15
|
});
|
|
16
|
-
findAclDocUrl(url: string): Promise<
|
|
16
|
+
findAclDocUrl(url: string): Promise<string>;
|
|
17
17
|
setSinglePeerAccess(options: {
|
|
18
18
|
ownerWebId: string;
|
|
19
19
|
peerWebId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityLogic.d.ts","sourceRoot":"","sources":["../../src/util/UtilityLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkC,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"UtilityLogic.d.ts","sourceRoot":"","sources":["../../src/util/UtilityLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAkC,MAAM,QAAQ,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI1C,eAAO,MAAM,QAAQ,WAEpB,CAAC;AAYF;;GAEG;AACH,qBAAa,YAAY;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,cAAc,CAAC;IACnB,OAAO,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,GAAG,CAAA;KAAE,CAAC;gBAE5C,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,GAAG,CAAA;KAAE;IAMnG,aAAa,CAAC,GAAG,EAAE,MAAM;IAWzB,mBAAmB,CAAC,OAAO,EAAE;QACjC,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAA;KACf;IAsCK,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAe5C,WAAW,CAAC,GAAG,EAAE,MAAM;IAIjB,eAAe,CAAC,GAAG,EAAE,MAAM;IAmBjC,oBAAoB,CAAC,aAAa,EAAE,SAAS,GAAG,SAAS,EAAE;IAWrD,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAO5D,eAAe,CAAC,GAAG,EAAE,MAAM;IAgBjC,UAAU;IAIV,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI;CAQ1C"}
|
package/lib/util/UtilityLogic.js
CHANGED
|
@@ -49,18 +49,19 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
49
49
|
this.fetcher = fetcher;
|
|
50
50
|
}
|
|
51
51
|
UtilityLogic.prototype.findAclDocUrl = function (url) {
|
|
52
|
+
var _a;
|
|
52
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
54
|
var doc, docNode;
|
|
54
|
-
return __generator(this, function (
|
|
55
|
-
switch (
|
|
55
|
+
return __generator(this, function (_b) {
|
|
56
|
+
switch (_b.label) {
|
|
56
57
|
case 0:
|
|
57
58
|
doc = this.store.sym(url);
|
|
58
|
-
return [4 /*yield*/, this.store.fetcher.load(doc)];
|
|
59
|
+
return [4 /*yield*/, ((_a = this.store.fetcher) === null || _a === void 0 ? void 0 : _a.load(doc))];
|
|
59
60
|
case 1:
|
|
60
|
-
|
|
61
|
+
_b.sent();
|
|
61
62
|
docNode = this.store.any(doc, exports.ACL_LINK);
|
|
62
63
|
if (!docNode) {
|
|
63
|
-
throw new Error("No ACL link discovered for "
|
|
64
|
+
throw new Error("No ACL link discovered for ".concat(url));
|
|
64
65
|
}
|
|
65
66
|
return [2 /*return*/, docNode.value];
|
|
66
67
|
}
|
|
@@ -77,27 +78,27 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
77
78
|
str = [
|
|
78
79
|
'@prefix acl: <http://www.w3.org/ns/auth/acl#>.',
|
|
79
80
|
'',
|
|
80
|
-
"<#alice> a acl:Authorization;\n acl:agent <"
|
|
81
|
-
" acl:accessTo <"
|
|
82
|
-
" acl:default <"
|
|
81
|
+
"<#alice> a acl:Authorization;\n acl:agent <".concat(options.ownerWebId, ">;"),
|
|
82
|
+
" acl:accessTo <".concat(options.target, ">;"),
|
|
83
|
+
" acl:default <".concat(options.target, ">;"),
|
|
83
84
|
' acl:mode acl:Read, acl:Write, acl:Control.',
|
|
84
85
|
''
|
|
85
86
|
].join('\n');
|
|
86
87
|
if (options.accessToModes) {
|
|
87
88
|
str += [
|
|
88
89
|
'<#bobAccessTo> a acl:Authorization;',
|
|
89
|
-
" acl:agent <"
|
|
90
|
-
" acl:accessTo <"
|
|
91
|
-
" acl:mode "
|
|
90
|
+
" acl:agent <".concat(options.peerWebId, ">;"),
|
|
91
|
+
" acl:accessTo <".concat(options.target, ">;"),
|
|
92
|
+
" acl:mode ".concat(options.accessToModes, "."),
|
|
92
93
|
''
|
|
93
94
|
].join('\n');
|
|
94
95
|
}
|
|
95
96
|
if (options.defaultModes) {
|
|
96
97
|
str += [
|
|
97
98
|
'<#bobDefault> a acl:Authorization;',
|
|
98
|
-
" acl:agent <"
|
|
99
|
-
" acl:default <"
|
|
100
|
-
" acl:mode "
|
|
99
|
+
" acl:agent <".concat(options.peerWebId, ">;"),
|
|
100
|
+
" acl:default <".concat(options.target, ">;"),
|
|
101
|
+
" acl:mode ".concat(options.defaultModes, "."),
|
|
101
102
|
''
|
|
102
103
|
].join('\n');
|
|
103
104
|
}
|
|
@@ -148,7 +149,7 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
148
149
|
switch (_a.label) {
|
|
149
150
|
case 0:
|
|
150
151
|
if (!this.isContainer(url)) {
|
|
151
|
-
throw new Error("Not a container URL "
|
|
152
|
+
throw new Error("Not a container URL ".concat(url));
|
|
152
153
|
}
|
|
153
154
|
return [4 /*yield*/, this.fetcher.fetch(url, {
|
|
154
155
|
method: "PUT",
|
|
@@ -162,7 +163,7 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
162
163
|
case 1:
|
|
163
164
|
result = _a.sent();
|
|
164
165
|
if (result.status.toString()[0] !== '2') {
|
|
165
|
-
throw new Error("Not OK: got "
|
|
166
|
+
throw new Error("Not OK: got ".concat(result.status, " response while creating container at ").concat(url));
|
|
166
167
|
}
|
|
167
168
|
return [2 /*return*/];
|
|
168
169
|
}
|
|
@@ -175,15 +176,16 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
175
176
|
.map(function (st) { return st.object; });
|
|
176
177
|
};
|
|
177
178
|
UtilityLogic.prototype.getContainerMembers = function (containerUrl) {
|
|
179
|
+
var _a;
|
|
178
180
|
return __awaiter(this, void 0, void 0, function () {
|
|
179
181
|
var containerNode, nodes;
|
|
180
|
-
return __generator(this, function (
|
|
181
|
-
switch (
|
|
182
|
+
return __generator(this, function (_b) {
|
|
183
|
+
switch (_b.label) {
|
|
182
184
|
case 0:
|
|
183
185
|
containerNode = this.store.sym(containerUrl);
|
|
184
|
-
return [4 /*yield*/, this.store.fetcher.load(containerNode)];
|
|
186
|
+
return [4 /*yield*/, ((_a = this.store.fetcher) === null || _a === void 0 ? void 0 : _a.load(containerNode))];
|
|
185
187
|
case 1:
|
|
186
|
-
|
|
188
|
+
_b.sent();
|
|
187
189
|
nodes = this.getContainerElements(containerNode);
|
|
188
190
|
return [2 /*return*/, nodes.map(function (node) { return node.value; })];
|
|
189
191
|
}
|
|
@@ -230,7 +232,7 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
230
232
|
var day = ('0' + (date.getUTCDate())).slice(-2);
|
|
231
233
|
var parts = baseUrl.split('/');
|
|
232
234
|
var filename = parts[parts.length - 1];
|
|
233
|
-
return new URL("./archive/"
|
|
235
|
+
return new URL("./archive/".concat(year, "/").concat(month, "/").concat(day, "/").concat(filename), baseUrl).toString();
|
|
234
236
|
};
|
|
235
237
|
return UtilityLogic;
|
|
236
238
|
}());
|
|
@@ -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,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|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.12-bbf45639",
|
|
4
4
|
"description": "Core business logic of Solid OS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,25 +23,25 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/solid/solid-logic#readme",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@babel/plugin-proposal-class-properties": "7.16.
|
|
27
|
-
"@babel/plugin-proposal-optional-chaining": "7.16.
|
|
28
|
-
"@babel/plugin-transform-async-to-generator": "7.16.
|
|
29
|
-
"@babel/plugin-transform-runtime": "7.16.
|
|
30
|
-
"@babel/preset-env": "7.16.
|
|
31
|
-
"@babel/preset-typescript": "7.16.
|
|
32
|
-
"@inrupt/solid-client-authn-browser": "^1.11.
|
|
33
|
-
"@types/jest": "^27.0.
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
35
|
-
"@typescript-eslint/parser": "^5.
|
|
26
|
+
"@babel/plugin-proposal-class-properties": "7.16.5",
|
|
27
|
+
"@babel/plugin-proposal-optional-chaining": "7.16.5",
|
|
28
|
+
"@babel/plugin-transform-async-to-generator": "7.16.5",
|
|
29
|
+
"@babel/plugin-transform-runtime": "7.16.5",
|
|
30
|
+
"@babel/preset-env": "7.16.5",
|
|
31
|
+
"@babel/preset-typescript": "7.16.5",
|
|
32
|
+
"@inrupt/solid-client-authn-browser": "^1.11.3",
|
|
33
|
+
"@types/jest": "^27.0.3",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
|
35
|
+
"@typescript-eslint/parser": "^5.8.0",
|
|
36
36
|
"eslint": "^7.32.0",
|
|
37
|
-
"jest": "27.
|
|
37
|
+
"jest": "27.4.5",
|
|
38
38
|
"jest-fetch-mock": "^3.0.3",
|
|
39
|
-
"prettier": "^2.
|
|
40
|
-
"ts-jest": "27.
|
|
41
|
-
"typescript": "4.
|
|
39
|
+
"prettier": "^2.5.1",
|
|
40
|
+
"ts-jest": "27.1.2",
|
|
41
|
+
"typescript": "4.5.4"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"rdflib": "^2.2.
|
|
44
|
+
"rdflib": "^2.2.15-bbf45639",
|
|
45
45
|
"solid-namespace": "^0.5.2"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/src/chat/ChatLogic.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NamedNode, Node, st, term } from "rdflib";
|
|
2
|
-
import {
|
|
1
|
+
import { LiveStore, NamedNode, Node, st, term } from "rdflib";
|
|
2
|
+
import { SolidNamespace } from "../index";
|
|
3
3
|
import { ProfileLogic } from "../profile/ProfileLogic";
|
|
4
4
|
import { newThing } from "../uri";
|
|
5
5
|
import { determineChatContainer } from "./determineChatContainer";
|
|
@@ -38,7 +38,7 @@ export class ChatLogic {
|
|
|
38
38
|
// Some servers don't present a Link http response header
|
|
39
39
|
// if the container doesn't exist yet, so refetch the container
|
|
40
40
|
// now that it has been created:
|
|
41
|
-
await this.store.fetcher
|
|
41
|
+
await this.store.fetcher?.load(chatContainer);
|
|
42
42
|
|
|
43
43
|
// FIXME: check the Why value on this quad:
|
|
44
44
|
const chatAclDoc = this.store.any(
|
|
@@ -66,7 +66,7 @@ export class ChatLogic {
|
|
|
66
66
|
acl:mode
|
|
67
67
|
acl:Read, acl:Append.
|
|
68
68
|
`;
|
|
69
|
-
await this.store.fetcher
|
|
69
|
+
await this.store.fetcher?.webOperation("PUT", chatAclDoc.value, {
|
|
70
70
|
data: aclBody,
|
|
71
71
|
contentType: "text/turtle",
|
|
72
72
|
});
|
|
@@ -81,7 +81,7 @@ export class ChatLogic {
|
|
|
81
81
|
if (!privateTypeIndex) {
|
|
82
82
|
throw new Error("Private type index not found!");
|
|
83
83
|
}
|
|
84
|
-
await this.store.fetcher
|
|
84
|
+
await this.store.fetcher?.load(privateTypeIndex);
|
|
85
85
|
const reg = newThing(privateTypeIndex);
|
|
86
86
|
const ins = [
|
|
87
87
|
st(
|
|
@@ -99,7 +99,7 @@ export class ChatLogic {
|
|
|
99
99
|
st(reg, this.ns.solid("instance"), chatThing, privateTypeIndex.doc()),
|
|
100
100
|
];
|
|
101
101
|
await new Promise((resolve, reject) => {
|
|
102
|
-
this.store.updater
|
|
102
|
+
this.store.updater?.update([], ins, function (_uri, ok, errm) {
|
|
103
103
|
if (!ok) {
|
|
104
104
|
reject(new Error(errm));
|
|
105
105
|
} else {
|
|
@@ -115,7 +115,7 @@ export class ChatLogic {
|
|
|
115
115
|
const chatContainer = determineChatContainer(invitee, podRoot);
|
|
116
116
|
let exists = true;
|
|
117
117
|
try {
|
|
118
|
-
await this.store.fetcher
|
|
118
|
+
await this.store.fetcher?.load(
|
|
119
119
|
new NamedNode(chatContainer.value + "index.ttl#this")
|
|
120
120
|
);
|
|
121
121
|
} catch (e) {
|
|
@@ -165,7 +165,7 @@ export class ChatLogic {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
return new Promise(function (resolve, reject) {
|
|
168
|
-
updater
|
|
168
|
+
updater?.put(
|
|
169
169
|
newChatDoc,
|
|
170
170
|
kb.statementsMatching(undefined, undefined, undefined, newChatDoc),
|
|
171
171
|
"text/turtle",
|
|
@@ -213,7 +213,7 @@ export class ChatLogic {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
private async sendInvite(invitee: NamedNode, chatThing: NamedNode) {
|
|
216
|
-
await this.store.fetcher
|
|
216
|
+
await this.store.fetcher?.load(invitee.doc());
|
|
217
217
|
const inviteeInbox = this.store.any(
|
|
218
218
|
invitee,
|
|
219
219
|
this.ns.ldp("inbox"),
|
|
@@ -228,7 +228,7 @@ export class ChatLogic {
|
|
|
228
228
|
${this.ns.rdf("seeAlso")} <${chatThing.value}> .
|
|
229
229
|
`;
|
|
230
230
|
|
|
231
|
-
const inviteResponse = await this.store.fetcher
|
|
231
|
+
const inviteResponse = await this.store.fetcher?.webOperation(
|
|
232
232
|
"POST",
|
|
233
233
|
inviteeInbox.value,
|
|
234
234
|
{
|
|
@@ -236,9 +236,9 @@ ${this.ns.rdf("seeAlso")} <${chatThing.value}> .
|
|
|
236
236
|
contentType: "text/turtle",
|
|
237
237
|
}
|
|
238
238
|
);
|
|
239
|
-
const locationStr = inviteResponse
|
|
239
|
+
const locationStr = inviteResponse?.headers.get("location");
|
|
240
240
|
if (!locationStr) {
|
|
241
|
-
throw new Error(`Invite sending returned a ${inviteResponse
|
|
241
|
+
throw new Error(`Invite sending returned a ${inviteResponse?.status}`);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
}
|
package/src/inbox/InboxLogic.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// import { v4 as uuid } from "uuid";
|
|
2
|
-
import { NamedNode, Node, st, term } from "rdflib";
|
|
3
|
-
import {
|
|
2
|
+
import { LiveStore, NamedNode, Node, st, term } from "rdflib";
|
|
3
|
+
import { SolidNamespace } from "../index";
|
|
4
4
|
import { ProfileLogic } from "../profile/ProfileLogic";
|
|
5
5
|
import { UtilityLogic } from "../util/UtilityLogic";
|
|
6
6
|
// import { newThing } from "../uri";
|
|
@@ -70,7 +70,7 @@ export class InboxLogic {
|
|
|
70
70
|
};
|
|
71
71
|
const uploaded = await this.util.fetcher.fetch(archiveUrl, options);
|
|
72
72
|
if (uploaded.status.toString()[0] === '2') {
|
|
73
|
-
await this.store.fetcher
|
|
73
|
+
await this.store.fetcher?._fetch(url, {
|
|
74
74
|
method: 'DELETE'
|
|
75
75
|
});
|
|
76
76
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,31 +10,19 @@ import { ChatLogic } from "./chat/ChatLogic";
|
|
|
10
10
|
import * as debug from "./debug";
|
|
11
11
|
import { ProfileLogic } from "./profile/ProfileLogic";
|
|
12
12
|
import { UtilityLogic } from "./util/UtilityLogic";
|
|
13
|
+
import { ConnectedStore, LiveStore } from 'rdflib'
|
|
13
14
|
|
|
14
15
|
export { ACL_LINK } from './util/UtilityLogic';
|
|
15
16
|
|
|
16
17
|
const ns: SolidNamespace = solidNamespace(rdf);
|
|
17
18
|
|
|
18
|
-
interface ConnectedStore extends Store {
|
|
19
|
+
/* interface ConnectedStore extends Store {
|
|
19
20
|
fetcher: Fetcher;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export interface LiveStore extends ConnectedStore {
|
|
23
24
|
updater: UpdateManager;
|
|
24
|
-
|
|
25
|
-
* HACK: Something is wrong with the types in rdflib
|
|
26
|
-
* Go back and figure out what's wrong with the types
|
|
27
|
-
*/
|
|
28
|
-
any: any;
|
|
29
|
-
each: any;
|
|
30
|
-
holds: any;
|
|
31
|
-
sym: any;
|
|
32
|
-
add: any;
|
|
33
|
-
statementsMatching: any;
|
|
34
|
-
slice: any;
|
|
35
|
-
remove: any;
|
|
36
|
-
statements: any;
|
|
37
|
-
}
|
|
25
|
+
} */
|
|
38
26
|
|
|
39
27
|
export interface SolidNamespace {
|
|
40
28
|
[key: string]: (term: string) => NamedNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedNode } from "rdflib";
|
|
1
|
+
import { LiveStore, NamedNode } from "rdflib";
|
|
2
2
|
import { AuthnLogic } from "../authn";
|
|
3
|
-
import {
|
|
3
|
+
import { SolidNamespace } from "../index";
|
|
4
4
|
|
|
5
5
|
export class ProfileLogic {
|
|
6
6
|
store: LiveStore;
|
|
@@ -18,7 +18,7 @@ export class ProfileLogic {
|
|
|
18
18
|
if (me === null) {
|
|
19
19
|
throw new Error("Current user not found! Not logged in?");
|
|
20
20
|
}
|
|
21
|
-
await this.store.fetcher
|
|
21
|
+
await this.store.fetcher?.load(me.doc());
|
|
22
22
|
return me;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -31,7 +31,7 @@ export class ProfileLogic {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
async getMainInbox(user: NamedNode): Promise<NamedNode> {
|
|
34
|
-
await this.store.fetcher
|
|
34
|
+
await this.store.fetcher?.load(user);
|
|
35
35
|
const mainInbox = this.store.any(user, this.ns.ldp("inbox"), undefined, user.doc());
|
|
36
36
|
if (!mainInbox) {
|
|
37
37
|
throw new Error("User main inbox not found!");
|
package/src/util/UtilityLogic.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NamedNode, Node, st, term, sym, Statement } from "rdflib";
|
|
2
|
-
import {
|
|
1
|
+
import { LiveStore, NamedNode, Node, st, term, sym, Statement } from "rdflib";
|
|
2
|
+
import { SolidNamespace } from "../index";
|
|
3
3
|
import { ProfileLogic } from "../profile/ProfileLogic";
|
|
4
4
|
import { newThing } from "../uri";
|
|
5
5
|
|
|
@@ -33,7 +33,7 @@ export class UtilityLogic {
|
|
|
33
33
|
|
|
34
34
|
async findAclDocUrl(url: string) {
|
|
35
35
|
const doc = this.store.sym(url);
|
|
36
|
-
await this.store.fetcher
|
|
36
|
+
await this.store.fetcher?.load(doc);
|
|
37
37
|
const docNode = this.store.any(doc, ACL_LINK);
|
|
38
38
|
if (!docNode) {
|
|
39
39
|
throw new Error(`No ACL link discovered for ${url}`);
|
|
@@ -137,7 +137,7 @@ export class UtilityLogic {
|
|
|
137
137
|
|
|
138
138
|
async getContainerMembers(containerUrl: string): Promise<string[]> {
|
|
139
139
|
const containerNode = this.store.sym(containerUrl);
|
|
140
|
-
await this.store.fetcher
|
|
140
|
+
await this.store.fetcher?.load(containerNode);
|
|
141
141
|
const nodes = this.getContainerElements(containerNode);
|
|
142
142
|
return nodes.map(node => node.value);
|
|
143
143
|
}
|