solid-logic 1.3.14-f606b313 → 1.3.15-41ec298b
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 +0 -1
- package/.nvmrc +1 -0
- package/lib/acl/aclLogic.js +5 -1
- package/lib/acl/aclLogic.js.map +1 -1
- package/lib/authn/SolidAuthnLogic.js +5 -1
- package/lib/authn/SolidAuthnLogic.js.map +1 -1
- package/lib/authn/authUtil.js +5 -1
- package/lib/authn/authUtil.js.map +1 -1
- package/lib/discovery/discoveryLogic.d.ts +13 -0
- package/lib/discovery/discoveryLogic.d.ts.map +1 -0
- package/lib/discovery/discoveryLogic.js +203 -0
- package/lib/discovery/discoveryLogic.js.map +1 -0
- package/lib/inbox/InboxLogic.js +2 -2
- package/lib/inbox/InboxLogic.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/logic/SolidLogic.d.ts +2 -3
- package/lib/logic/SolidLogic.d.ts.map +1 -1
- package/lib/logic/SolidLogic.js +45 -41
- package/lib/logic/SolidLogic.js.map +1 -1
- package/lib/logic/solidLogicSingleton.d.ts.map +1 -1
- package/lib/logic/solidLogicSingleton.js +9 -2
- package/lib/logic/solidLogicSingleton.js.map +1 -1
- package/lib/typeIndex/typeIndexLogic.d.ts +4 -4
- package/lib/typeIndex/typeIndexLogic.d.ts.map +1 -1
- package/lib/typeIndex/typeIndexLogic.js +98 -32
- package/lib/typeIndex/typeIndexLogic.js.map +1 -1
- package/lib/util/UtilityLogic.d.ts +2 -2
- package/lib/util/UtilityLogic.d.ts.map +1 -1
- package/lib/util/UtilityLogic.js +6 -6
- package/lib/util/UtilityLogic.js.map +1 -1
- package/package.json +15 -18
- package/src/discovery/discoveryLogic.ts +90 -0
- package/src/inbox/InboxLogic.ts +2 -2
- package/src/index.ts +10 -0
- package/src/logic/SolidLogic.ts +29 -32
- package/src/logic/solidLogicSingleton.ts +3 -1
- package/src/typeIndex/typeIndexLogic.ts +92 -61
- package/src/util/UtilityLogic.ts +8 -8
- package/test/chatLogic.test.ts +1 -1
- package/test/typeIndexLogic.test.ts +18 -3
- package/renovate.json +0 -5
package/lib/logic/SolidLogic.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -67,51 +71,61 @@ var ProfileLogic_1 = require("../profile/ProfileLogic");
|
|
|
67
71
|
var debug = __importStar(require("../util/debug"));
|
|
68
72
|
var UtilityLogic_1 = require("../util/UtilityLogic");
|
|
69
73
|
var CustomError_1 = require("./CustomError");
|
|
74
|
+
/*
|
|
75
|
+
** It is important to distinquish `fetch`, a function provided by the browser
|
|
76
|
+
** and `Fetcher`, a helper object for the rdflib Store which turns it
|
|
77
|
+
** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is
|
|
78
|
+
** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
|
|
79
|
+
*/
|
|
70
80
|
var ns = (0, solid_namespace_1.default)(rdf);
|
|
71
81
|
var SolidLogic = /** @class */ (function () {
|
|
72
|
-
function SolidLogic(
|
|
82
|
+
function SolidLogic(specialFetch, session) {
|
|
83
|
+
// would xpect to be able to do it this way: but get TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation status: 999
|
|
84
|
+
// this.store = new rdf.LiveStore({})
|
|
85
|
+
// this.store.fetcher._fetch = fetch
|
|
86
|
+
console.log("SolidLogic: Unique instance created. There should only be one of these.");
|
|
73
87
|
this.store = rdf.graph(); // Make a Quad store
|
|
74
|
-
rdf.fetcher(this.store,
|
|
88
|
+
rdf.fetcher(this.store, { fetch: specialFetch.fetch }); // Attach a web I/O module, store.fetcher
|
|
75
89
|
this.store.updater = new rdf.UpdateManager(this.store); // Add real-time live updates store.updater
|
|
76
90
|
this.store.features = []; // disable automatic node merging on store load
|
|
77
91
|
this.cache = {
|
|
78
92
|
profileDocument: {},
|
|
79
93
|
preferencesFile: {},
|
|
80
94
|
};
|
|
81
|
-
this.
|
|
95
|
+
this.underlyingFetch = { fetch: fetch }; // Note global one not the one passed
|
|
82
96
|
this.authn = new SolidAuthnLogic_1.SolidAuthnLogic(session);
|
|
83
97
|
debug.log('SolidAuthnLogic initialized');
|
|
84
98
|
this.profile = new ProfileLogic_1.ProfileLogic(this.store, ns, this.authn);
|
|
85
99
|
this.chat = new ChatLogic_1.ChatLogic(this.store, ns, this.profile);
|
|
86
|
-
this.util = new UtilityLogic_1.UtilityLogic(this.store, ns, this.
|
|
100
|
+
this.util = new UtilityLogic_1.UtilityLogic(this.store, ns, this.underlyingFetch);
|
|
87
101
|
}
|
|
88
102
|
SolidLogic.prototype.findAclDocUrl = function (url) {
|
|
89
103
|
return this.util.findAclDocUrl(url);
|
|
90
104
|
};
|
|
91
|
-
SolidLogic.prototype.loadDoc = function (doc) {
|
|
92
|
-
return this.util.loadDoc(doc);
|
|
93
|
-
};
|
|
94
105
|
SolidLogic.prototype.loadProfile = function (me) {
|
|
95
106
|
return __awaiter(this, void 0, void 0, function () {
|
|
96
107
|
var profileDocument, err_1, message;
|
|
97
108
|
return __generator(this, function (_a) {
|
|
98
109
|
switch (_a.label) {
|
|
99
110
|
case 0:
|
|
100
|
-
|
|
111
|
+
/*
|
|
112
|
+
// console.log('loadProfile cache ', this.cache)
|
|
101
113
|
if (this.cache.profileDocument[me.value]) {
|
|
102
|
-
|
|
103
|
-
|
|
114
|
+
return this.cache.profileDocument[me.value];
|
|
115
|
+
} @@ just use the cache in the store
|
|
116
|
+
*/
|
|
117
|
+
console.log('loadProfile me ', me);
|
|
118
|
+
profileDocument = me.doc();
|
|
104
119
|
_a.label = 1;
|
|
105
120
|
case 1:
|
|
106
121
|
_a.trys.push([1, 3, , 4]);
|
|
107
|
-
|
|
108
|
-
return [4 /*yield*/, this.loadDoc(profileDocument)];
|
|
122
|
+
return [4 /*yield*/, this.store.fetcher.load(profileDocument)];
|
|
109
123
|
case 2:
|
|
110
124
|
_a.sent();
|
|
111
125
|
return [2 /*return*/, profileDocument];
|
|
112
126
|
case 3:
|
|
113
127
|
err_1 = _a.sent();
|
|
114
|
-
message = "
|
|
128
|
+
message = "Cannot load profile ".concat(profileDocument, " : ").concat(err_1);
|
|
115
129
|
throw new Error(message);
|
|
116
130
|
case 4: return [2 /*return*/];
|
|
117
131
|
}
|
|
@@ -135,27 +149,27 @@ var SolidLogic = /** @class */ (function () {
|
|
|
135
149
|
return __generator(this, function (_a) {
|
|
136
150
|
switch (_a.label) {
|
|
137
151
|
case 0:
|
|
138
|
-
|
|
152
|
+
console.log('loadPreferences cache ', this.cache);
|
|
139
153
|
if (this.cache.preferencesFile[me.value]) {
|
|
140
154
|
return [2 /*return*/, this.cache.preferencesFile[me.value]];
|
|
141
155
|
}
|
|
142
|
-
|
|
156
|
+
return [4 /*yield*/, this.loadProfile(me)]; // Load pointer to pref file
|
|
157
|
+
case 1:
|
|
158
|
+
_a.sent(); // Load pointer to pref file
|
|
159
|
+
preferencesFile = this.store.any(me, ns.space('preferencesFile'), null, me.doc());
|
|
143
160
|
if (!preferencesFile) {
|
|
144
161
|
throw new Error("Can't find a preference file pointer in profile ".concat(me.doc()));
|
|
145
162
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
_a.label = 1;
|
|
150
|
-
case 1:
|
|
151
|
-
_a.trys.push([1, 3, , 4]);
|
|
163
|
+
_a.label = 2;
|
|
164
|
+
case 2:
|
|
165
|
+
_a.trys.push([2, 4, , 5]);
|
|
152
166
|
return [4 /*yield*/, this.store.fetcher.load(preferencesFile, {
|
|
153
167
|
withCredentials: true,
|
|
154
168
|
})];
|
|
155
|
-
case 2:
|
|
156
|
-
_a.sent();
|
|
157
|
-
return [3 /*break*/, 4];
|
|
158
169
|
case 3:
|
|
170
|
+
_a.sent();
|
|
171
|
+
return [3 /*break*/, 5];
|
|
172
|
+
case 4:
|
|
159
173
|
err_2 = _a.sent();
|
|
160
174
|
status_1 = err_2.status;
|
|
161
175
|
debug.log("HTTP status ".concat(status_1, " for preference file ").concat(preferencesFile));
|
|
@@ -172,7 +186,7 @@ var SolidLogic = /** @class */ (function () {
|
|
|
172
186
|
throw new CustomError_1.NotFoundError(preferencesFile.value);
|
|
173
187
|
}
|
|
174
188
|
throw new CustomError_1.FetchError(err_2.status, err_2.message);
|
|
175
|
-
case
|
|
189
|
+
case 5: return [2 /*return*/, preferencesFile];
|
|
176
190
|
}
|
|
177
191
|
});
|
|
178
192
|
});
|
|
@@ -190,9 +204,6 @@ var SolidLogic = /** @class */ (function () {
|
|
|
190
204
|
});
|
|
191
205
|
};
|
|
192
206
|
SolidLogic.prototype.load = function (doc) {
|
|
193
|
-
if (!this.store.fetcher) {
|
|
194
|
-
throw new Error("Cannot load doc(s), have no fetcher");
|
|
195
|
-
}
|
|
196
207
|
return this.store.fetcher.load(doc);
|
|
197
208
|
};
|
|
198
209
|
SolidLogic.prototype.loadIndexes = function (me, publicProfile, preferencesFile, onWarning) {
|
|
@@ -252,14 +263,10 @@ var SolidLogic = /** @class */ (function () {
|
|
|
252
263
|
return __awaiter(this, void 0, void 0, function () {
|
|
253
264
|
return __generator(this, function (_a) {
|
|
254
265
|
switch (_a.label) {
|
|
255
|
-
case 0:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
return [4 /*yield*/, this.store.fetcher.webOperation("PUT", doc.uri, {
|
|
260
|
-
data: "# ".concat(new Date(), " ").concat(comment, "\n "),
|
|
261
|
-
contentType: "text/turtle",
|
|
262
|
-
})];
|
|
266
|
+
case 0: return [4 /*yield*/, this.store.fetcher.webOperation("PUT", doc.uri, {
|
|
267
|
+
data: "# ".concat(new Date(), " ").concat(comment, "\n "),
|
|
268
|
+
contentType: "text/turtle",
|
|
269
|
+
})];
|
|
263
270
|
case 1:
|
|
264
271
|
_a.sent();
|
|
265
272
|
return [2 /*return*/];
|
|
@@ -272,9 +279,6 @@ var SolidLogic = /** @class */ (function () {
|
|
|
272
279
|
var _this = this;
|
|
273
280
|
if (ins === void 0) { ins = []; }
|
|
274
281
|
return new Promise(function (resolve, reject) {
|
|
275
|
-
if (!_this.store.updater) {
|
|
276
|
-
throw new Error("Cannot updatePromise, have no updater");
|
|
277
|
-
}
|
|
278
282
|
_this.store.updater.update(del, ins, function (_uri, ok, errorBody) {
|
|
279
283
|
if (!ok) {
|
|
280
284
|
reject(new Error(errorBody));
|
|
@@ -307,7 +311,7 @@ var SolidLogic = /** @class */ (function () {
|
|
|
307
311
|
SolidLogic.prototype.fetch = function (url, options) {
|
|
308
312
|
return __awaiter(this, void 0, void 0, function () {
|
|
309
313
|
return __generator(this, function (_a) {
|
|
310
|
-
return [2 /*return*/, this.
|
|
314
|
+
return [2 /*return*/, this.underlyingFetch.fetch(url, options)];
|
|
311
315
|
});
|
|
312
316
|
});
|
|
313
317
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidLogic.js","sourceRoot":"","sources":["../../src/logic/SolidLogic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SolidLogic.js","sourceRoot":"","sources":["../../src/logic/SolidLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAA8B;AAE9B,oEAA6C;AAC7C,4DAA2D;AAC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nB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,yCAAoB,GAApB,UAAqB,aAAwB;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACzD,CAAC;IAED,wCAAmB,GAAnB,UAAoB,YAAoB;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;IAEK,oCAAe,GAArB,UAAsB,GAAW;;;gBAC7B,sBAAO,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAC;;;KACzC;IAED,+BAAU,GAAV;QACI,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IAEK,0BAAK,GAAX,UAAY,GAAW,EAAE,OAAa;;;gBAClC,sBAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,EAAC;;;KACnD;IACL,iBAAC;AAAD,CAAC,AAjPD,IAiPC;AAjPY,gCAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingleton.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAazC,QAAA,MAAM,mBAAmB,YAAiD,CAAA;AAI1E,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -60,8 +64,11 @@ var debug = __importStar(require("../util/debug"));
|
|
|
60
64
|
var authSession_1 = require("../authSession/authSession");
|
|
61
65
|
var SolidLogic_1 = require("./SolidLogic");
|
|
62
66
|
var _fetch = function (url, requestInit) { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var omitCreds;
|
|
63
68
|
return __generator(this, function (_a) {
|
|
64
|
-
|
|
69
|
+
omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit';
|
|
70
|
+
if (authSession_1.authSession.info.webId && !omitCreds) { // see https://github.com/solid/solidos/issues/114
|
|
71
|
+
// In fact ftech should respect crentials omit itself
|
|
65
72
|
return [2 /*return*/, authSession_1.authSession.fetch(url, requestInit)];
|
|
66
73
|
}
|
|
67
74
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingleton.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAsC;AACtC,0DAAwD;AACxD,2CAAyC;AAEzC,IAAM,MAAM,GAAG,UAAO,GAAG,EAAE,WAAW;;;QAC5B,SAAS,GAAG,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,MAAM,CAAA;QAC7F,IAAI,yBAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,EAAE,kDAAkD;YAC1F,qDAAqD;YACrD,sBAAO,yBAAW,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,EAAA;SAC7C;aAAM;YACH,sBAAO,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,EAAA;SACxC;;;KACJ,CAAA;AAED,mEAAmE;AACnE,IAAM,mBAAmB,GAAG,IAAI,uBAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,yBAAW,CAAC,CAAA;AAIjE,kDAAmB;AAF5B,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA"}
|
|
@@ -4,19 +4,19 @@ export declare const ns: any;
|
|
|
4
4
|
/**
|
|
5
5
|
* Resolves with the same context, outputting
|
|
6
6
|
* output: index.public, index.private
|
|
7
|
-
*
|
|
7
|
+
* @@ This is a very bizare function
|
|
8
8
|
* @see https://github.com/solid/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
9
9
|
*/
|
|
10
10
|
export declare function loadIndex(context: AuthenticationContext, isPublic: boolean): Promise<AuthenticationContext>;
|
|
11
|
-
export declare function loadTypeIndexes(context: AuthenticationContext): Promise<AuthenticationContext>;
|
|
11
|
+
export declare function loadTypeIndexes(context: AuthenticationContext): Promise<AuthenticationContext | undefined>;
|
|
12
12
|
/**
|
|
13
13
|
* Resolves with the same context, outputting
|
|
14
14
|
* @see https://github.com/solid/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
15
15
|
*/
|
|
16
|
-
export declare function ensureTypeIndexes(context: AuthenticationContext): Promise<AuthenticationContext>;
|
|
16
|
+
export declare function ensureTypeIndexes(context: AuthenticationContext, agent?: NamedNode): Promise<AuthenticationContext>;
|
|
17
17
|
/**
|
|
18
18
|
* Register a new app in a type index
|
|
19
19
|
* used in chat in bookmark.js (solid-ui)
|
|
20
20
|
*/
|
|
21
|
-
export declare function registerInTypeIndex(context: AuthenticationContext, instance: NamedNode, theClass: NamedNode, isPublic: boolean): Promise<AuthenticationContext>;
|
|
21
|
+
export declare function registerInTypeIndex(context: AuthenticationContext, instance: NamedNode, theClass: NamedNode, isPublic: boolean, agent?: NamedNode): Promise<AuthenticationContext>;
|
|
22
22
|
//# sourceMappingURL=typeIndexLogic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeIndexLogic.d.ts","sourceRoot":"","sources":["../../src/typeIndex/typeIndexLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,QAAQ,CAAA;AAK3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"typeIndexLogic.d.ts","sourceRoot":"","sources":["../../src/typeIndex/typeIndexLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,QAAQ,CAAA;AAK3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAIhD,eAAO,MAAM,EAAE,KAAuB,CAAA;AAWtC;;;;;GAKG;AACH,wBAAsB,SAAS,CAC/B,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,OAAO,GACd,OAAO,CAAC,qBAAqB,CAAC,CAYhC;AAED,wBAAsB,eAAe,CAAE,OAAO,EAAE,qBAAqB,8CAqBpE;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAE,OAAO,EAAE,qBAAqB,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAO1H;AAyFD;;;GAGG;AACH,wBAAsB,mBAAmB,CACzC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,OAAO,EACjB,KAAK,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,CAAC,CAwBhC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -65,11 +69,35 @@ var solid_namespace_1 = __importDefault(require("solid-namespace"));
|
|
|
65
69
|
var $rdf = __importStar(require("rdflib"));
|
|
66
70
|
var uri_1 = require("../util/uri");
|
|
67
71
|
var solidLogicSingleton_1 = require("../logic/solidLogicSingleton");
|
|
72
|
+
// import { ensureLoadedPreferences } from '../logic/logic'
|
|
73
|
+
var discoveryLogic_1 = require("../discovery/discoveryLogic");
|
|
68
74
|
exports.ns = (0, solid_namespace_1.default)($rdf);
|
|
75
|
+
var store = solidLogicSingleton_1.solidLogicSingleton.store;
|
|
76
|
+
function ensureLoadedPreferences(context) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
return __generator(this, function (_c) {
|
|
80
|
+
switch (_c.label) {
|
|
81
|
+
case 0:
|
|
82
|
+
if (!context.me)
|
|
83
|
+
throw new Error('@@ ensureLoadedPreferences: no user specified');
|
|
84
|
+
_a = context;
|
|
85
|
+
return [4 /*yield*/, (0, discoveryLogic_1.loadProfile)(store, context.me)];
|
|
86
|
+
case 1:
|
|
87
|
+
_a.publicProfile = _c.sent();
|
|
88
|
+
_b = context;
|
|
89
|
+
return [4 /*yield*/, (0, discoveryLogic_1.loadPreferences)(store, context.me)];
|
|
90
|
+
case 2:
|
|
91
|
+
_b.preferencesFile = _c.sent();
|
|
92
|
+
return [2 /*return*/, context];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
69
97
|
/**
|
|
70
98
|
* Resolves with the same context, outputting
|
|
71
99
|
* output: index.public, index.private
|
|
72
|
-
*
|
|
100
|
+
* @@ This is a very bizare function
|
|
73
101
|
* @see https://github.com/solid/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
74
102
|
*/
|
|
75
103
|
function loadIndex(context, isPublic) {
|
|
@@ -86,8 +114,8 @@ function loadIndex(context, isPublic) {
|
|
|
86
114
|
case 1:
|
|
87
115
|
indexes = _a.sent();
|
|
88
116
|
context.index = context.index || {};
|
|
89
|
-
context.index.private = indexes.private
|
|
90
|
-
context.index.public = indexes.public
|
|
117
|
+
context.index.private = indexes.private.concat(context.index.private || []); // otherwise concat will wrongly add 'undefined' as a private index
|
|
118
|
+
context.index.public = indexes.public.concat(context.index.public || []); // otherwise concat will wrongly add 'undefined' as a public index
|
|
91
119
|
return [2 /*return*/, context];
|
|
92
120
|
}
|
|
93
121
|
});
|
|
@@ -96,21 +124,36 @@ function loadIndex(context, isPublic) {
|
|
|
96
124
|
exports.loadIndex = loadIndex;
|
|
97
125
|
function loadTypeIndexes(context) {
|
|
98
126
|
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
-
var indexes;
|
|
127
|
+
var error_1, indexes, error_2;
|
|
100
128
|
var _this = this;
|
|
101
129
|
return __generator(this, function (_a) {
|
|
102
130
|
switch (_a.label) {
|
|
103
|
-
case 0:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return [2 /*return*/, debug.warn(err.message)];
|
|
107
|
-
}); }); })];
|
|
131
|
+
case 0:
|
|
132
|
+
_a.trys.push([0, 2, , 3]);
|
|
133
|
+
return [4 /*yield*/, (0, discoveryLogic_1.loadPreferences)(solidLogicSingleton_1.solidLogicSingleton.store, context.me)];
|
|
108
134
|
case 1:
|
|
135
|
+
_a.sent();
|
|
136
|
+
return [3 /*break*/, 3];
|
|
137
|
+
case 2:
|
|
138
|
+
error_1 = _a.sent();
|
|
139
|
+
debug.warn(error_1.message);
|
|
140
|
+
return [3 /*break*/, 3];
|
|
141
|
+
case 3:
|
|
142
|
+
_a.trys.push([3, 5, , 6]);
|
|
143
|
+
return [4 /*yield*/, solidLogicSingleton_1.solidLogicSingleton.loadIndexes(context.me, context.publicProfile || null, context.preferencesFile || null)];
|
|
144
|
+
case 4:
|
|
109
145
|
indexes = _a.sent();
|
|
110
146
|
context.index = context.index || {};
|
|
111
147
|
context.index.private = indexes.private || context.index.private;
|
|
112
148
|
context.index.public = indexes.public || context.index.public;
|
|
113
149
|
return [2 /*return*/, context];
|
|
150
|
+
case 5:
|
|
151
|
+
error_2 = _a.sent();
|
|
152
|
+
(function (error) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
153
|
+
return [2 /*return*/, debug.warn(error.message)];
|
|
154
|
+
}); }); });
|
|
155
|
+
return [3 /*break*/, 6];
|
|
156
|
+
case 6: return [2 /*return*/];
|
|
114
157
|
}
|
|
115
158
|
});
|
|
116
159
|
});
|
|
@@ -120,14 +163,18 @@ exports.loadTypeIndexes = loadTypeIndexes;
|
|
|
120
163
|
* Resolves with the same context, outputting
|
|
121
164
|
* @see https://github.com/solid/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
122
165
|
*/
|
|
123
|
-
function ensureTypeIndexes(context) {
|
|
166
|
+
function ensureTypeIndexes(context, agent) {
|
|
124
167
|
return __awaiter(this, void 0, void 0, function () {
|
|
125
168
|
return __generator(this, function (_a) {
|
|
126
169
|
switch (_a.label) {
|
|
127
|
-
case 0:
|
|
170
|
+
case 0:
|
|
171
|
+
if (!context.me) {
|
|
172
|
+
throw new Error("ensureTypeIndexes: @@ no user");
|
|
173
|
+
}
|
|
174
|
+
return [4 /*yield*/, ensureOneTypeIndex(context, true, agent)];
|
|
128
175
|
case 1:
|
|
129
176
|
_a.sent();
|
|
130
|
-
return [4 /*yield*/, ensureOneTypeIndex(context, false)];
|
|
177
|
+
return [4 /*yield*/, ensureOneTypeIndex(context, false, agent)];
|
|
131
178
|
case 2:
|
|
132
179
|
_a.sent();
|
|
133
180
|
return [2 /*return*/, context];
|
|
@@ -144,7 +191,7 @@ exports.ensureTypeIndexes = ensureTypeIndexes;
|
|
|
144
191
|
* Adds its output to the context
|
|
145
192
|
* @see https://github.com/solid/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
146
193
|
*/
|
|
147
|
-
function ensureOneTypeIndex(context, isPublic) {
|
|
194
|
+
function ensureOneTypeIndex(context, isPublic, agent) {
|
|
148
195
|
return __awaiter(this, void 0, void 0, function () {
|
|
149
196
|
function makeIndexIfNecessary(context, isPublic) {
|
|
150
197
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -175,10 +222,16 @@ function ensureOneTypeIndex(context, isPublic) {
|
|
|
175
222
|
switch (_a.label) {
|
|
176
223
|
case 0:
|
|
177
224
|
relevant = isPublic ? context.publicProfile : context.preferencesFile;
|
|
225
|
+
if (!relevant)
|
|
226
|
+
alert('@@@@ relevent null');
|
|
178
227
|
visibility = isPublic ? 'public' : 'private';
|
|
179
228
|
context.index = context.index || {};
|
|
180
229
|
context.index[visibility] = context.index[visibility] || [];
|
|
181
230
|
if (!(context.index[visibility].length === 0)) return [3 /*break*/, 6];
|
|
231
|
+
if (!store.updater.editable(relevant)) {
|
|
232
|
+
debug.log("Not adding new type index as ".concat(relevant, " is not editable"));
|
|
233
|
+
return [2 /*return*/];
|
|
234
|
+
}
|
|
182
235
|
newIndex = (0, rdflib_1.sym)("".concat(relevant.dir().uri + visibility, "TypeIndex.ttl"));
|
|
183
236
|
debug.log("Linking to new fresh type index ".concat(newIndex));
|
|
184
237
|
if (!confirm("OK to create a new empty index file at ".concat(newIndex, ", overwriting anything that is now there?"))) {
|
|
@@ -227,29 +280,41 @@ function ensureOneTypeIndex(context, isPublic) {
|
|
|
227
280
|
});
|
|
228
281
|
});
|
|
229
282
|
} // makeIndexIfNecessary
|
|
230
|
-
var
|
|
283
|
+
var context2, relevant, pp, error_3;
|
|
231
284
|
return __generator(this, function (_a) {
|
|
232
285
|
switch (_a.label) {
|
|
233
|
-
case 0:
|
|
234
|
-
_a.trys.push([0, 2, , 4]);
|
|
235
|
-
return [4 /*yield*/, loadIndex(context, isPublic)];
|
|
286
|
+
case 0: return [4 /*yield*/, ensureLoadedPreferences(context)];
|
|
236
287
|
case 1:
|
|
288
|
+
context2 = _a.sent();
|
|
289
|
+
if (!context2.publicProfile)
|
|
290
|
+
throw new Error("@@ type index: no publicProfile");
|
|
291
|
+
if (!context2.preferencesFile)
|
|
292
|
+
throw new Error("@@ type index: no preferencesFile for profile ".concat(context2.publicProfile));
|
|
293
|
+
relevant = isPublic ? context2.publicProfile : context2.preferencesFile;
|
|
294
|
+
_a.label = 2;
|
|
295
|
+
case 2:
|
|
296
|
+
_a.trys.push([2, 5, , 7]);
|
|
297
|
+
return [4 /*yield*/, loadIndex(context2, isPublic)];
|
|
298
|
+
case 3:
|
|
237
299
|
_a.sent();
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
300
|
+
pp = isPublic ? 'public' : 'private';
|
|
301
|
+
if (context2.index && context2.index[pp] && context2.index[pp].length > 0) {
|
|
302
|
+
debug.log("ensureOneTypeIndex: Type index exists already ".concat(context2.index[pp]));
|
|
303
|
+
return [2 /*return*/, context2];
|
|
242
304
|
}
|
|
243
|
-
return [
|
|
244
|
-
case
|
|
245
|
-
|
|
246
|
-
return [
|
|
247
|
-
|
|
305
|
+
return [4 /*yield*/, makeIndexIfNecessary(context2, isPublic)];
|
|
306
|
+
case 4:
|
|
307
|
+
_a.sent();
|
|
308
|
+
return [3 /*break*/, 7];
|
|
309
|
+
case 5:
|
|
310
|
+
error_3 = _a.sent();
|
|
311
|
+
return [4 /*yield*/, makeIndexIfNecessary(context2, isPublic)
|
|
312
|
+
// widgets.complain(context2, 'calling loadIndex:' + error)
|
|
248
313
|
];
|
|
249
|
-
case
|
|
314
|
+
case 6:
|
|
250
315
|
_a.sent();
|
|
251
|
-
return [3 /*break*/,
|
|
252
|
-
case
|
|
316
|
+
return [3 /*break*/, 7];
|
|
317
|
+
case 7: return [2 /*return*/];
|
|
253
318
|
}
|
|
254
319
|
});
|
|
255
320
|
});
|
|
@@ -258,12 +323,13 @@ function ensureOneTypeIndex(context, isPublic) {
|
|
|
258
323
|
* Register a new app in a type index
|
|
259
324
|
* used in chat in bookmark.js (solid-ui)
|
|
260
325
|
*/
|
|
261
|
-
function registerInTypeIndex(context, instance, theClass, isPublic
|
|
326
|
+
function registerInTypeIndex(context, instance, theClass, isPublic, agent // Defaults to current user
|
|
327
|
+
) {
|
|
262
328
|
return __awaiter(this, void 0, void 0, function () {
|
|
263
329
|
var indexes, index, registration, ins, e_2;
|
|
264
330
|
return __generator(this, function (_a) {
|
|
265
331
|
switch (_a.label) {
|
|
266
|
-
case 0: return [4 /*yield*/, ensureOneTypeIndex(context, isPublic)];
|
|
332
|
+
case 0: return [4 /*yield*/, ensureOneTypeIndex(context, isPublic, agent)];
|
|
267
333
|
case 1:
|
|
268
334
|
_a.sent();
|
|
269
335
|
if (!context.index) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeIndexLogic.js","sourceRoot":"","sources":["../../src/typeIndex/typeIndexLogic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typeIndexLogic.js","sourceRoot":"","sources":["../../src/typeIndex/typeIndexLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA2C;AAC3C,mDAAsC;AACtC,oEAA4C;AAC5C,2CAA8B;AAC9B,mCAAsC;AAEtC,oEAAkE;AAClE,2DAA2D;AAC3D,8DAA0E;AAC7D,QAAA,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAA;AA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|
|
@@ -7,10 +7,10 @@ export declare const ACL_LINK: NamedNode;
|
|
|
7
7
|
export declare class UtilityLogic {
|
|
8
8
|
store: LiveStore;
|
|
9
9
|
ns: SolidNamespace;
|
|
10
|
-
|
|
10
|
+
underlyingFetch: {
|
|
11
11
|
fetch: (url: string, options?: any) => any;
|
|
12
12
|
};
|
|
13
|
-
constructor(store: LiveStore, ns: SolidNamespace,
|
|
13
|
+
constructor(store: LiveStore, ns: SolidNamespace, underlyingFetch: {
|
|
14
14
|
fetch: (url: string, options?: any) => any;
|
|
15
15
|
});
|
|
16
16
|
findAclDocUrl(url: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityLogic.d.ts","sourceRoot":"","sources":["../../src/util/UtilityLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,QAAQ,WAEpB,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAY;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,cAAc,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"UtilityLogic.d.ts","sourceRoot":"","sources":["../../src/util/UtilityLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,QAAQ,WAEpB,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAY;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,cAAc,CAAC;IACnB,eAAe,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,GAAG,CAAA;KAAE,CAAC;gBAEpD,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,cAAc,EAAE,eAAe,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,GAAG,CAAA;KAAE;IAM3G,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
|
@@ -43,10 +43,10 @@ exports.ACL_LINK = (0, rdflib_1.sym)("http://www.iana.org/assignments/link-relat
|
|
|
43
43
|
* Utility-related logic
|
|
44
44
|
*/
|
|
45
45
|
var UtilityLogic = /** @class */ (function () {
|
|
46
|
-
function UtilityLogic(store, ns,
|
|
46
|
+
function UtilityLogic(store, ns, underlyingFetch) {
|
|
47
47
|
this.store = store;
|
|
48
48
|
this.ns = ns;
|
|
49
|
-
this.
|
|
49
|
+
this.underlyingFetch = underlyingFetch;
|
|
50
50
|
}
|
|
51
51
|
UtilityLogic.prototype.findAclDocUrl = function (url) {
|
|
52
52
|
var _a;
|
|
@@ -105,7 +105,7 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
105
105
|
return [4 /*yield*/, this.findAclDocUrl(options.target)];
|
|
106
106
|
case 1:
|
|
107
107
|
aclDocUrl = _a.sent();
|
|
108
|
-
return [2 /*return*/, this.
|
|
108
|
+
return [2 /*return*/, this.underlyingFetch.fetch(aclDocUrl, {
|
|
109
109
|
method: 'PUT',
|
|
110
110
|
body: str,
|
|
111
111
|
headers: [
|
|
@@ -151,7 +151,7 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
151
151
|
if (!this.isContainer(url)) {
|
|
152
152
|
throw new Error("Not a container URL ".concat(url));
|
|
153
153
|
}
|
|
154
|
-
return [4 /*yield*/, this.
|
|
154
|
+
return [4 /*yield*/, this.underlyingFetch.fetch(url, {
|
|
155
155
|
method: "PUT",
|
|
156
156
|
headers: {
|
|
157
157
|
"Content-Type": "text/turtle",
|
|
@@ -204,7 +204,7 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
204
204
|
return [4 /*yield*/, this.findAclDocUrl(url)];
|
|
205
205
|
case 1:
|
|
206
206
|
aclDocUrl = _a.sent();
|
|
207
|
-
return [4 /*yield*/, this.
|
|
207
|
+
return [4 /*yield*/, this.underlyingFetch.fetch(aclDocUrl, { method: "DELETE" })];
|
|
208
208
|
case 2:
|
|
209
209
|
_a.sent();
|
|
210
210
|
return [4 /*yield*/, this.getContainerMembers(url)];
|
|
@@ -214,7 +214,7 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
214
214
|
case 4:
|
|
215
215
|
_a.sent();
|
|
216
216
|
_a.label = 5;
|
|
217
|
-
case 5: return [2 /*return*/, this.
|
|
217
|
+
case 5: return [2 /*return*/, this.underlyingFetch.fetch(url, { method: "DELETE" })];
|
|
218
218
|
case 6:
|
|
219
219
|
e_1 = _a.sent();
|
|
220
220
|
return [3 /*break*/, 7];
|