rdflib 2.2.28 → 2.2.30
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/dist/670.rdflib.min.js +1 -0
- package/dist/730.rdflib.min.js +3 -0
- package/dist/730.rdflib.min.js.LICENSE.txt +58 -0
- package/dist/730.rdflib.min.js.map +1 -0
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +0 -1
- package/esm/convert.js +60 -0
- package/esm/fetcher.js +19 -25
- package/esm/formula.js +2 -3
- package/esm/node-internal.js +0 -1
- package/esm/statement.js +1 -1
- package/lib/blank-node.js +0 -1
- package/lib/convert.d.ts +2 -0
- package/lib/convert.js +71 -0
- package/lib/fetcher.js +19 -25
- package/lib/formula.js +2 -3
- package/lib/node-internal.js +0 -1
- package/lib/statement.js +1 -1
- package/package.json +2 -2
- package/src/blank-node.ts +0 -1
- package/src/fetcher.ts +7 -12
- package/src/formula.ts +2 -3
- package/src/node-internal.ts +0 -1
- package/src/statement.ts +1 -1
package/esm/blank-node.js
CHANGED
package/esm/convert.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import asyncLib from 'async'; // @@ Goal: remove this dependency
|
|
2
|
+
import jsonld from 'jsonld';
|
|
3
|
+
import { Parser, Writer } from 'n3'; // @@ Goal: remove this dependency
|
|
4
|
+
|
|
5
|
+
export function convertToJson(n3String, jsonCallback) {
|
|
6
|
+
var jsonString;
|
|
7
|
+
var n3Parser = new Parser();
|
|
8
|
+
var n3Writer = new Writer({
|
|
9
|
+
format: 'N-Quads'
|
|
10
|
+
});
|
|
11
|
+
asyncLib.waterfall([function (callback) {
|
|
12
|
+
n3Parser.parse(n3String, function (error, quad, prefixes) {
|
|
13
|
+
if (error) {
|
|
14
|
+
callback(error);
|
|
15
|
+
} else if (quad !== null) {
|
|
16
|
+
n3Writer.addQuad(quad);
|
|
17
|
+
} else {
|
|
18
|
+
n3Writer.end(callback);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}, function (result, callback) {
|
|
22
|
+
try {
|
|
23
|
+
jsonld.fromRDF(result, {
|
|
24
|
+
format: 'application/nquads'
|
|
25
|
+
}).then(result => {
|
|
26
|
+
callback(null, result);
|
|
27
|
+
});
|
|
28
|
+
} catch (err) {
|
|
29
|
+
callback(err);
|
|
30
|
+
}
|
|
31
|
+
}, function (json, callback) {
|
|
32
|
+
jsonString = JSON.stringify(json);
|
|
33
|
+
jsonCallback(null, jsonString);
|
|
34
|
+
}], function (err, result) {
|
|
35
|
+
jsonCallback(err, jsonString);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export function convertToNQuads(n3String, nquadCallback) {
|
|
39
|
+
var nquadString;
|
|
40
|
+
var n3Parser = new Parser();
|
|
41
|
+
var n3Writer = new Writer({
|
|
42
|
+
format: 'N-Quads'
|
|
43
|
+
});
|
|
44
|
+
asyncLib.waterfall([function (callback) {
|
|
45
|
+
n3Parser.parse(n3String, function (error, triple, prefixes) {
|
|
46
|
+
if (error) {
|
|
47
|
+
callback(error);
|
|
48
|
+
} else if (quad !== null) {
|
|
49
|
+
n3Writer.addQuad(quad);
|
|
50
|
+
} else {
|
|
51
|
+
n3Writer.end(callback);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}, function (result, callback) {
|
|
55
|
+
nquadString = result;
|
|
56
|
+
nquadCallback(null, nquadString);
|
|
57
|
+
}], function (err, result) {
|
|
58
|
+
nquadCallback(err, nquadString);
|
|
59
|
+
});
|
|
60
|
+
}
|
package/esm/fetcher.js
CHANGED
|
@@ -878,7 +878,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
878
878
|
size: 0,
|
|
879
879
|
timeout: 0
|
|
880
880
|
};
|
|
881
|
-
console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
881
|
+
// console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
882
882
|
return _this5.handleError(dummyResponse, docuri, options); // possible credentials retry
|
|
883
883
|
// return this.failFetch(options, 'fetch failed: ' + error, 999, dummyResponse) // Fake status code: fetch exception
|
|
884
884
|
|
|
@@ -939,25 +939,21 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
939
939
|
if (fetchResponse.ok) {
|
|
940
940
|
userCallback(true, 'OK', fetchResponse);
|
|
941
941
|
} else {
|
|
942
|
-
// console.log('@@@ fetcher.js Should not take this path !!!!!!!!!!!!')
|
|
943
942
|
var oops = 'HTTP error: Status ' + fetchResponse.status + ' (' + fetchResponse.statusText + ')';
|
|
944
943
|
if (fetchResponse.responseText) {
|
|
945
944
|
oops += ' ' + fetchResponse.responseText; // not in 404, dns error, nock failure
|
|
946
945
|
}
|
|
947
946
|
|
|
948
|
-
console.log(oops + ' fetching ' + uri);
|
|
949
947
|
userCallback(false, oops, fetchResponse);
|
|
950
948
|
}
|
|
951
949
|
} else {
|
|
952
950
|
var _oops = '@@ nowOrWhenFetched: no response object!';
|
|
953
|
-
console.log(_oops);
|
|
954
951
|
userCallback(false, _oops);
|
|
955
952
|
}
|
|
956
953
|
}
|
|
957
954
|
}, function (err) {
|
|
958
955
|
var message = err.message || err.statusText;
|
|
959
956
|
message = 'Failed to load <' + uri + '> ' + message;
|
|
960
|
-
console.log(message);
|
|
961
957
|
if (err.response && err.response.status) {
|
|
962
958
|
message += ' status: ' + err.response.status;
|
|
963
959
|
}
|
|
@@ -1196,45 +1192,42 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1196
1192
|
return fetcher.load(doc);
|
|
1197
1193
|
case 6:
|
|
1198
1194
|
response = _context2.sent;
|
|
1199
|
-
_context2.next =
|
|
1195
|
+
_context2.next = 26;
|
|
1200
1196
|
break;
|
|
1201
1197
|
case 9:
|
|
1202
1198
|
_context2.prev = 9;
|
|
1203
1199
|
_context2.t0 = _context2["catch"](3);
|
|
1204
1200
|
if (!(_context2.t0.response.status === 404)) {
|
|
1205
|
-
_context2.next =
|
|
1201
|
+
_context2.next = 25;
|
|
1206
1202
|
break;
|
|
1207
1203
|
}
|
|
1208
|
-
|
|
1209
|
-
_context2.
|
|
1210
|
-
_context2.next = 16;
|
|
1204
|
+
_context2.prev = 12;
|
|
1205
|
+
_context2.next = 15;
|
|
1211
1206
|
return fetcher.webOperation('PUT', doc.value, {
|
|
1212
1207
|
data: data,
|
|
1213
1208
|
contentType: contentType
|
|
1214
1209
|
});
|
|
1215
|
-
case
|
|
1210
|
+
case 15:
|
|
1216
1211
|
response = _context2.sent;
|
|
1217
|
-
_context2.next =
|
|
1212
|
+
_context2.next = 21;
|
|
1218
1213
|
break;
|
|
1219
|
-
case
|
|
1220
|
-
_context2.prev =
|
|
1221
|
-
_context2.t1 = _context2["catch"](
|
|
1222
|
-
console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context2.t1);
|
|
1214
|
+
case 18:
|
|
1215
|
+
_context2.prev = 18;
|
|
1216
|
+
_context2.t1 = _context2["catch"](12);
|
|
1223
1217
|
throw _context2.t1;
|
|
1224
|
-
case
|
|
1218
|
+
case 21:
|
|
1225
1219
|
delete fetcher.requested[doc.value]; // delete cached 404 error
|
|
1226
1220
|
// console.log('createIfNotExists doc created ok ' + doc)
|
|
1227
1221
|
return _context2.abrupt("return", response);
|
|
1228
|
-
case
|
|
1229
|
-
console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context2.t0);
|
|
1222
|
+
case 25:
|
|
1230
1223
|
throw _context2.t0;
|
|
1231
|
-
case
|
|
1224
|
+
case 26:
|
|
1232
1225
|
return _context2.abrupt("return", response);
|
|
1233
|
-
case
|
|
1226
|
+
case 27:
|
|
1234
1227
|
case "end":
|
|
1235
1228
|
return _context2.stop();
|
|
1236
1229
|
}
|
|
1237
|
-
}, _callee2, this, [[3, 9], [
|
|
1230
|
+
}, _callee2, this, [[3, 9], [12, 18]]);
|
|
1238
1231
|
}));
|
|
1239
1232
|
function createIfNotExists(_x4) {
|
|
1240
1233
|
return _createIfNotExists.apply(this, arguments);
|
|
@@ -1543,7 +1536,8 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1543
1536
|
}, {
|
|
1544
1537
|
key: "retryNoCredentials",
|
|
1545
1538
|
value: function retryNoCredentials(docuri, options) {
|
|
1546
|
-
console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
1539
|
+
// console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
1540
|
+
|
|
1547
1541
|
options.retriedWithNoCredentials = true; // protect against being called twice
|
|
1548
1542
|
|
|
1549
1543
|
delete this.requested[docuri]; // forget the original request happened
|
|
@@ -1588,7 +1582,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1588
1582
|
// Now attempt retry via proxy
|
|
1589
1583
|
var proxyUri = Fetcher.crossSiteProxy(docuri);
|
|
1590
1584
|
if (proxyUri && !options.proxyUsed) {
|
|
1591
|
-
console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
1585
|
+
// console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
1592
1586
|
return this.redirectToProxy(proxyUri, options);
|
|
1593
1587
|
}
|
|
1594
1588
|
}
|
|
@@ -1661,7 +1655,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1661
1655
|
|
|
1662
1656
|
// Check for masked errors (CORS, etc)
|
|
1663
1657
|
if (response.status === 0) {
|
|
1664
|
-
console.log('Masked error - status 0 for ' + docuri)
|
|
1658
|
+
// console.log('Masked error - status 0 for ' + docuri)
|
|
1665
1659
|
return this.handleError(response, docuri, options);
|
|
1666
1660
|
}
|
|
1667
1661
|
if (response.status >= 400) {
|
package/esm/formula.js
CHANGED
|
@@ -552,7 +552,6 @@ var Formula = /*#__PURE__*/function (_Node) {
|
|
|
552
552
|
while (todo.length) {
|
|
553
553
|
follow(todo.shift());
|
|
554
554
|
}
|
|
555
|
-
// console.log('' + result.length + ' statements about ' + subject)
|
|
556
555
|
return result;
|
|
557
556
|
}
|
|
558
557
|
|
|
@@ -709,10 +708,10 @@ var Formula = /*#__PURE__*/function (_Node) {
|
|
|
709
708
|
var statementsCopy = this.statements.map(function (ea) {
|
|
710
709
|
return ea.substitute(bindings);
|
|
711
710
|
});
|
|
712
|
-
console.log('Formula subs statmnts:' + statementsCopy)
|
|
711
|
+
// console.log('Formula subs statmnts:' + statementsCopy)
|
|
713
712
|
var y = new Formula();
|
|
714
713
|
y.addAll(statementsCopy);
|
|
715
|
-
console.log('indexed-form subs formula:' + y)
|
|
714
|
+
// console.log('indexed-form subs formula:' + y)
|
|
716
715
|
return y;
|
|
717
716
|
}
|
|
718
717
|
}, {
|
package/esm/node-internal.js
CHANGED
package/esm/statement.js
CHANGED
|
@@ -76,7 +76,7 @@ var Statement = /*#__PURE__*/function () {
|
|
|
76
76
|
key: "substitute",
|
|
77
77
|
value: function substitute(bindings) {
|
|
78
78
|
var y = new Statement(this.subject.substitute(bindings), this.predicate.substitute(bindings), this.object.substitute(bindings), isDefaultGraph(this.graph) ? this.graph : this.graph.substitute(bindings)); // 2016
|
|
79
|
-
console.log('@@@ statement substitute:' + y)
|
|
79
|
+
// console.log('@@@ statement substitute:' + y)
|
|
80
80
|
return y;
|
|
81
81
|
}
|
|
82
82
|
|
package/lib/blank-node.js
CHANGED
|
@@ -100,7 +100,6 @@ var BlankNode = /*#__PURE__*/function (_Node) {
|
|
|
100
100
|
function getId(id) {
|
|
101
101
|
if (id) {
|
|
102
102
|
if (typeof id !== 'string') {
|
|
103
|
-
console.log('Bad blank id:', id);
|
|
104
103
|
throw new Error('Bad id argument to new blank node: ' + id);
|
|
105
104
|
}
|
|
106
105
|
if (id.includes('#')) {
|
package/lib/convert.d.ts
ADDED
package/lib/convert.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.convertToJson = convertToJson;
|
|
8
|
+
exports.convertToNQuads = convertToNQuads;
|
|
9
|
+
var _async = _interopRequireDefault(require("async"));
|
|
10
|
+
var _jsonld = _interopRequireDefault(require("jsonld"));
|
|
11
|
+
var _n = require("n3");
|
|
12
|
+
// @@ Goal: remove this dependency
|
|
13
|
+
|
|
14
|
+
// @@ Goal: remove this dependency
|
|
15
|
+
|
|
16
|
+
function convertToJson(n3String, jsonCallback) {
|
|
17
|
+
var jsonString;
|
|
18
|
+
var n3Parser = new _n.Parser();
|
|
19
|
+
var n3Writer = new _n.Writer({
|
|
20
|
+
format: 'N-Quads'
|
|
21
|
+
});
|
|
22
|
+
_async.default.waterfall([function (callback) {
|
|
23
|
+
n3Parser.parse(n3String, function (error, quad, prefixes) {
|
|
24
|
+
if (error) {
|
|
25
|
+
callback(error);
|
|
26
|
+
} else if (quad !== null) {
|
|
27
|
+
n3Writer.addQuad(quad);
|
|
28
|
+
} else {
|
|
29
|
+
n3Writer.end(callback);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}, function (result, callback) {
|
|
33
|
+
try {
|
|
34
|
+
_jsonld.default.fromRDF(result, {
|
|
35
|
+
format: 'application/nquads'
|
|
36
|
+
}).then(result => {
|
|
37
|
+
callback(null, result);
|
|
38
|
+
});
|
|
39
|
+
} catch (err) {
|
|
40
|
+
callback(err);
|
|
41
|
+
}
|
|
42
|
+
}, function (json, callback) {
|
|
43
|
+
jsonString = JSON.stringify(json);
|
|
44
|
+
jsonCallback(null, jsonString);
|
|
45
|
+
}], function (err, result) {
|
|
46
|
+
jsonCallback(err, jsonString);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function convertToNQuads(n3String, nquadCallback) {
|
|
50
|
+
var nquadString;
|
|
51
|
+
var n3Parser = new _n.Parser();
|
|
52
|
+
var n3Writer = new _n.Writer({
|
|
53
|
+
format: 'N-Quads'
|
|
54
|
+
});
|
|
55
|
+
_async.default.waterfall([function (callback) {
|
|
56
|
+
n3Parser.parse(n3String, function (error, triple, prefixes) {
|
|
57
|
+
if (error) {
|
|
58
|
+
callback(error);
|
|
59
|
+
} else if (quad !== null) {
|
|
60
|
+
n3Writer.addQuad(quad);
|
|
61
|
+
} else {
|
|
62
|
+
n3Writer.end(callback);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}, function (result, callback) {
|
|
66
|
+
nquadString = result;
|
|
67
|
+
nquadCallback(null, nquadString);
|
|
68
|
+
}], function (err, result) {
|
|
69
|
+
nquadCallback(err, nquadString);
|
|
70
|
+
});
|
|
71
|
+
}
|
package/lib/fetcher.js
CHANGED
|
@@ -861,7 +861,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
861
861
|
size: 0,
|
|
862
862
|
timeout: 0
|
|
863
863
|
};
|
|
864
|
-
console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
864
|
+
// console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
865
865
|
return _this5.handleError(dummyResponse, docuri, options); // possible credentials retry
|
|
866
866
|
// return this.failFetch(options, 'fetch failed: ' + error, 999, dummyResponse) // Fake status code: fetch exception
|
|
867
867
|
|
|
@@ -922,25 +922,21 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
922
922
|
if (fetchResponse.ok) {
|
|
923
923
|
userCallback(true, 'OK', fetchResponse);
|
|
924
924
|
} else {
|
|
925
|
-
// console.log('@@@ fetcher.js Should not take this path !!!!!!!!!!!!')
|
|
926
925
|
var oops = 'HTTP error: Status ' + fetchResponse.status + ' (' + fetchResponse.statusText + ')';
|
|
927
926
|
if (fetchResponse.responseText) {
|
|
928
927
|
oops += ' ' + fetchResponse.responseText; // not in 404, dns error, nock failure
|
|
929
928
|
}
|
|
930
929
|
|
|
931
|
-
console.log(oops + ' fetching ' + uri);
|
|
932
930
|
userCallback(false, oops, fetchResponse);
|
|
933
931
|
}
|
|
934
932
|
} else {
|
|
935
933
|
var _oops = '@@ nowOrWhenFetched: no response object!';
|
|
936
|
-
console.log(_oops);
|
|
937
934
|
userCallback(false, _oops);
|
|
938
935
|
}
|
|
939
936
|
}
|
|
940
937
|
}, function (err) {
|
|
941
938
|
var message = err.message || err.statusText;
|
|
942
939
|
message = 'Failed to load <' + uri + '> ' + message;
|
|
943
|
-
console.log(message);
|
|
944
940
|
if (err.response && err.response.status) {
|
|
945
941
|
message += ' status: ' + err.response.status;
|
|
946
942
|
}
|
|
@@ -1179,45 +1175,42 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1179
1175
|
return fetcher.load(doc);
|
|
1180
1176
|
case 6:
|
|
1181
1177
|
response = _context2.sent;
|
|
1182
|
-
_context2.next =
|
|
1178
|
+
_context2.next = 26;
|
|
1183
1179
|
break;
|
|
1184
1180
|
case 9:
|
|
1185
1181
|
_context2.prev = 9;
|
|
1186
1182
|
_context2.t0 = _context2["catch"](3);
|
|
1187
1183
|
if (!(_context2.t0.response.status === 404)) {
|
|
1188
|
-
_context2.next =
|
|
1184
|
+
_context2.next = 25;
|
|
1189
1185
|
break;
|
|
1190
1186
|
}
|
|
1191
|
-
|
|
1192
|
-
_context2.
|
|
1193
|
-
_context2.next = 16;
|
|
1187
|
+
_context2.prev = 12;
|
|
1188
|
+
_context2.next = 15;
|
|
1194
1189
|
return fetcher.webOperation('PUT', doc.value, {
|
|
1195
1190
|
data: data,
|
|
1196
1191
|
contentType: contentType
|
|
1197
1192
|
});
|
|
1198
|
-
case
|
|
1193
|
+
case 15:
|
|
1199
1194
|
response = _context2.sent;
|
|
1200
|
-
_context2.next =
|
|
1195
|
+
_context2.next = 21;
|
|
1201
1196
|
break;
|
|
1202
|
-
case
|
|
1203
|
-
_context2.prev =
|
|
1204
|
-
_context2.t1 = _context2["catch"](
|
|
1205
|
-
console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context2.t1);
|
|
1197
|
+
case 18:
|
|
1198
|
+
_context2.prev = 18;
|
|
1199
|
+
_context2.t1 = _context2["catch"](12);
|
|
1206
1200
|
throw _context2.t1;
|
|
1207
|
-
case
|
|
1201
|
+
case 21:
|
|
1208
1202
|
delete fetcher.requested[doc.value]; // delete cached 404 error
|
|
1209
1203
|
// console.log('createIfNotExists doc created ok ' + doc)
|
|
1210
1204
|
return _context2.abrupt("return", response);
|
|
1211
|
-
case
|
|
1212
|
-
console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context2.t0);
|
|
1205
|
+
case 25:
|
|
1213
1206
|
throw _context2.t0;
|
|
1214
|
-
case
|
|
1207
|
+
case 26:
|
|
1215
1208
|
return _context2.abrupt("return", response);
|
|
1216
|
-
case
|
|
1209
|
+
case 27:
|
|
1217
1210
|
case "end":
|
|
1218
1211
|
return _context2.stop();
|
|
1219
1212
|
}
|
|
1220
|
-
}, _callee2, this, [[3, 9], [
|
|
1213
|
+
}, _callee2, this, [[3, 9], [12, 18]]);
|
|
1221
1214
|
}));
|
|
1222
1215
|
function createIfNotExists(_x4) {
|
|
1223
1216
|
return _createIfNotExists.apply(this, arguments);
|
|
@@ -1526,7 +1519,8 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1526
1519
|
}, {
|
|
1527
1520
|
key: "retryNoCredentials",
|
|
1528
1521
|
value: function retryNoCredentials(docuri, options) {
|
|
1529
|
-
console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
1522
|
+
// console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
1523
|
+
|
|
1530
1524
|
options.retriedWithNoCredentials = true; // protect against being called twice
|
|
1531
1525
|
|
|
1532
1526
|
delete this.requested[docuri]; // forget the original request happened
|
|
@@ -1571,7 +1565,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1571
1565
|
// Now attempt retry via proxy
|
|
1572
1566
|
var proxyUri = Fetcher.crossSiteProxy(docuri);
|
|
1573
1567
|
if (proxyUri && !options.proxyUsed) {
|
|
1574
|
-
console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
1568
|
+
// console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
1575
1569
|
return this.redirectToProxy(proxyUri, options);
|
|
1576
1570
|
}
|
|
1577
1571
|
}
|
|
@@ -1644,7 +1638,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
1644
1638
|
|
|
1645
1639
|
// Check for masked errors (CORS, etc)
|
|
1646
1640
|
if (response.status === 0) {
|
|
1647
|
-
console.log('Masked error - status 0 for ' + docuri)
|
|
1641
|
+
// console.log('Masked error - status 0 for ' + docuri)
|
|
1648
1642
|
return this.handleError(response, docuri, options);
|
|
1649
1643
|
}
|
|
1650
1644
|
if (response.status >= 400) {
|
package/lib/formula.js
CHANGED
|
@@ -559,7 +559,6 @@ var Formula = /*#__PURE__*/function (_Node) {
|
|
|
559
559
|
while (todo.length) {
|
|
560
560
|
follow(todo.shift());
|
|
561
561
|
}
|
|
562
|
-
// console.log('' + result.length + ' statements about ' + subject)
|
|
563
562
|
return result;
|
|
564
563
|
}
|
|
565
564
|
|
|
@@ -716,10 +715,10 @@ var Formula = /*#__PURE__*/function (_Node) {
|
|
|
716
715
|
var statementsCopy = this.statements.map(function (ea) {
|
|
717
716
|
return ea.substitute(bindings);
|
|
718
717
|
});
|
|
719
|
-
console.log('Formula subs statmnts:' + statementsCopy)
|
|
718
|
+
// console.log('Formula subs statmnts:' + statementsCopy)
|
|
720
719
|
var y = new Formula();
|
|
721
720
|
y.addAll(statementsCopy);
|
|
722
|
-
console.log('indexed-form subs formula:' + y)
|
|
721
|
+
// console.log('indexed-form subs formula:' + y)
|
|
723
722
|
return y;
|
|
724
723
|
}
|
|
725
724
|
}, {
|
package/lib/node-internal.js
CHANGED
package/lib/statement.js
CHANGED
|
@@ -86,7 +86,7 @@ var Statement = /*#__PURE__*/function () {
|
|
|
86
86
|
key: "substitute",
|
|
87
87
|
value: function substitute(bindings) {
|
|
88
88
|
var y = new Statement(this.subject.substitute(bindings), this.predicate.substitute(bindings), this.object.substitute(bindings), (0, _defaultGraph.isDefaultGraph)(this.graph) ? this.graph : this.graph.substitute(bindings)); // 2016
|
|
89
|
-
console.log('@@@ statement substitute:' + y)
|
|
89
|
+
// console.log('@@@ statement substitute:' + y)
|
|
90
90
|
return y;
|
|
91
91
|
}
|
|
92
92
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rdflib",
|
|
3
3
|
"description": "an RDF library for node.js. Suitable for client and server side.",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.30",
|
|
5
5
|
"private": false,
|
|
6
6
|
"browserslist": [
|
|
7
7
|
"> 0.5%"
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"build:types": "tsc --emitDeclarationOnly -d --moduleResolution node --declarationDir lib",
|
|
95
95
|
"build:all": "npm run build && npm run build:types && npm run build:browser && npm run build:esm",
|
|
96
96
|
"doc": "typedoc --out ./doc ./src/index.ts --excludePrivate --excludeInternal --tsconfig ./tsconfig.json",
|
|
97
|
-
"
|
|
97
|
+
"prepublishOnly": "npm ci && npm run build:all && npm run doc && npm run test",
|
|
98
98
|
"postversion": "git push --follow-tags",
|
|
99
99
|
"start": "webpack serve --port 4800",
|
|
100
100
|
"test": "npm run test:unit && npm run test:serialize && npm run test:types",
|
package/src/blank-node.ts
CHANGED
|
@@ -19,7 +19,6 @@ export default class BlankNode extends Node implements TFBlankNode {
|
|
|
19
19
|
private static getId (id: string | unknown): string {
|
|
20
20
|
if (id) {
|
|
21
21
|
if (typeof id !== 'string') {
|
|
22
|
-
console.log('Bad blank id:', id)
|
|
23
22
|
throw new Error('Bad id argument to new blank node: ' + id)
|
|
24
23
|
}
|
|
25
24
|
|
package/src/fetcher.ts
CHANGED
|
@@ -1160,7 +1160,7 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
1160
1160
|
size: 0,
|
|
1161
1161
|
timeout: 0
|
|
1162
1162
|
}
|
|
1163
|
-
console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
1163
|
+
// console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
1164
1164
|
return this.handleError(dummyResponse, docuri, options) // possible credentials retry
|
|
1165
1165
|
// return this.failFetch(options, 'fetch failed: ' + error, 999, dummyResponse) // Fake status code: fetch exception
|
|
1166
1166
|
|
|
@@ -1227,24 +1227,20 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
1227
1227
|
if ((fetchResponse as Response).ok) {
|
|
1228
1228
|
userCallback(true, 'OK', fetchResponse)
|
|
1229
1229
|
} else {
|
|
1230
|
-
// console.log('@@@ fetcher.js Should not take this path !!!!!!!!!!!!')
|
|
1231
1230
|
let oops = 'HTTP error: Status ' + fetchResponse.status + ' (' + fetchResponse.statusText + ')'
|
|
1232
1231
|
if (fetchResponse.responseText) {
|
|
1233
1232
|
oops += ' ' + fetchResponse.responseText // not in 404, dns error, nock failure
|
|
1234
1233
|
}
|
|
1235
|
-
console.log(oops + ' fetching ' + uri)
|
|
1236
1234
|
userCallback(false, oops, fetchResponse)
|
|
1237
1235
|
}
|
|
1238
1236
|
} else {
|
|
1239
1237
|
let oops = ('@@ nowOrWhenFetched: no response object!')
|
|
1240
|
-
console.log(oops)
|
|
1241
1238
|
userCallback(false, oops)
|
|
1242
1239
|
}
|
|
1243
1240
|
}
|
|
1244
1241
|
}, function (err: FetchError) {
|
|
1245
1242
|
var message = err.message || err.statusText
|
|
1246
1243
|
message = 'Failed to load <' + uri + '> ' + message
|
|
1247
|
-
console.log(message)
|
|
1248
1244
|
if (err.response && err.response.status) {
|
|
1249
1245
|
message += ' status: ' + err.response.status
|
|
1250
1246
|
}
|
|
@@ -1497,18 +1493,18 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
1497
1493
|
} catch (err) {
|
|
1498
1494
|
// @ts-ignore
|
|
1499
1495
|
if (err.response.status === 404) {
|
|
1500
|
-
console.log('createIfNotExists: doc does NOT exist, will create... ' + doc)
|
|
1496
|
+
// console.log('createIfNotExists: doc does NOT exist, will create... ' + doc)
|
|
1501
1497
|
try {
|
|
1502
1498
|
response = await fetcher.webOperation('PUT', doc.value, {data, contentType})
|
|
1503
1499
|
} catch (err) {
|
|
1504
|
-
console.log('createIfNotExists doc FAILED: ' + doc + ': ' + err)
|
|
1500
|
+
// console.log('createIfNotExists doc FAILED: ' + doc + ': ' + err)
|
|
1505
1501
|
throw err
|
|
1506
1502
|
}
|
|
1507
1503
|
delete fetcher.requested[doc.value] // delete cached 404 error
|
|
1508
1504
|
// console.log('createIfNotExists doc created ok ' + doc)
|
|
1509
1505
|
return response
|
|
1510
1506
|
} else {
|
|
1511
|
-
console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + err)
|
|
1507
|
+
// console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + err)
|
|
1512
1508
|
throw err
|
|
1513
1509
|
}
|
|
1514
1510
|
}
|
|
@@ -1837,7 +1833,7 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
1837
1833
|
docuri: string,
|
|
1838
1834
|
options
|
|
1839
1835
|
): Promise<Result> {
|
|
1840
|
-
console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
1836
|
+
// console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
1841
1837
|
|
|
1842
1838
|
options.retriedWithNoCredentials = true // protect against being called twice
|
|
1843
1839
|
|
|
@@ -1886,8 +1882,7 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
1886
1882
|
let proxyUri = Fetcher.crossSiteProxy(docuri)
|
|
1887
1883
|
|
|
1888
1884
|
if (proxyUri && !options.proxyUsed) {
|
|
1889
|
-
console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
1890
|
-
|
|
1885
|
+
// console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
1891
1886
|
return this.redirectToProxy(proxyUri, options)
|
|
1892
1887
|
}
|
|
1893
1888
|
}
|
|
@@ -1960,7 +1955,7 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
1960
1955
|
|
|
1961
1956
|
// Check for masked errors (CORS, etc)
|
|
1962
1957
|
if (response.status === 0) {
|
|
1963
|
-
console.log('Masked error - status 0 for ' + docuri)
|
|
1958
|
+
// console.log('Masked error - status 0 for ' + docuri)
|
|
1964
1959
|
return this.handleError(response, docuri, options)
|
|
1965
1960
|
}
|
|
1966
1961
|
|
package/src/formula.ts
CHANGED
|
@@ -589,7 +589,6 @@ export default class Formula extends Node {
|
|
|
589
589
|
while (todo.length) {
|
|
590
590
|
follow(todo.shift())
|
|
591
591
|
}
|
|
592
|
-
// console.log('' + result.length + ' statements about ' + subject)
|
|
593
592
|
return result
|
|
594
593
|
}
|
|
595
594
|
|
|
@@ -736,10 +735,10 @@ export default class Formula extends Node {
|
|
|
736
735
|
let statementsCopy = this.statements.map(function (ea) {
|
|
737
736
|
return (ea as Statement).substitute(bindings)
|
|
738
737
|
})
|
|
739
|
-
console.log('Formula subs statmnts:' + statementsCopy)
|
|
738
|
+
// console.log('Formula subs statmnts:' + statementsCopy)
|
|
740
739
|
const y = new Formula()
|
|
741
740
|
y.addAll(statementsCopy as Quad[])
|
|
742
|
-
console.log('indexed-form subs formula:' + y)
|
|
741
|
+
// console.log('indexed-form subs formula:' + y)
|
|
743
742
|
return y as unknown as T
|
|
744
743
|
}
|
|
745
744
|
|
package/src/node-internal.ts
CHANGED
package/src/statement.ts
CHANGED
|
@@ -99,7 +99,7 @@ export default class Statement<
|
|
|
99
99
|
isDefaultGraph(this.graph) ? this.graph :
|
|
100
100
|
(this.graph as G).substitute(bindings)
|
|
101
101
|
) // 2016
|
|
102
|
-
console.log('@@@ statement substitute:' + y)
|
|
102
|
+
// console.log('@@@ statement substitute:' + y)
|
|
103
103
|
return y
|
|
104
104
|
}
|
|
105
105
|
|