rdflib 2.2.24-ce092266 → 2.2.25-cff3abdb

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/esm/fetcher.js CHANGED
@@ -691,32 +691,55 @@ var Fetcher = /*#__PURE__*/function () {
691
691
  }
692
692
  }, {
693
693
  key: "pendingFetchPromise",
694
- value: function pendingFetchPromise(uri, originalUri, options) {
695
- var _this3 = this;
696
- var pendingPromise;
697
- function fetchQueueResolvePromise(fetchQueue) {
698
- return fetchQueue;
699
- }
700
-
701
- // Check to see if some request is already dealing with this uri
702
- if (!options.force && fetchQueueResolvePromise(this.fetchQueue[originalUri])) {
703
- pendingPromise = this.fetchQueue[originalUri];
704
- } else {
705
- pendingPromise = Promise.race([this.setRequestTimeout(uri, options), this.fetchUri(uri, options)]);
706
- this.fetchQueue[originalUri] = pendingPromise;
707
-
708
- // Clean up the queued promise after a time, if it's resolved
709
- this.cleanupFetchRequest(originalUri, undefined, this.timeout);
694
+ value: function () {
695
+ var _pendingFetchPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(uri, originalUri, options) {
696
+ var _this3 = this;
697
+ var pendingPromise;
698
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
699
+ while (1) switch (_context.prev = _context.next) {
700
+ case 0:
701
+ _context.t0 = !options.force;
702
+ if (!_context.t0) {
703
+ _context.next = 5;
704
+ break;
705
+ }
706
+ _context.next = 4;
707
+ return this.fetchQueue[originalUri];
708
+ case 4:
709
+ _context.t0 = _context.sent;
710
+ case 5:
711
+ if (!_context.t0) {
712
+ _context.next = 9;
713
+ break;
714
+ }
715
+ pendingPromise = this.fetchQueue[originalUri];
716
+ _context.next = 12;
717
+ break;
718
+ case 9:
719
+ pendingPromise = Promise.race([this.setRequestTimeout(uri, options), this.fetchUri(uri, options)]);
720
+ this.fetchQueue[originalUri] = pendingPromise;
721
+
722
+ // Clean up the queued promise after a time, if it's resolved
723
+ this.cleanupFetchRequest(originalUri, undefined, this.timeout);
724
+ case 12:
725
+ return _context.abrupt("return", pendingPromise.then(function (x) {
726
+ if (uri in _this3.timeouts) {
727
+ _this3.timeouts[uri].forEach(clearTimeout);
728
+ delete _this3.timeouts[uri];
729
+ }
730
+ return x;
731
+ }));
732
+ case 13:
733
+ case "end":
734
+ return _context.stop();
735
+ }
736
+ }, _callee, this);
737
+ }));
738
+ function pendingFetchPromise(_x, _x2, _x3) {
739
+ return _pendingFetchPromise.apply(this, arguments);
710
740
  }
711
- return pendingPromise.then(function (x) {
712
- if (uri in _this3.timeouts) {
713
- _this3.timeouts[uri].forEach(clearTimeout);
714
- delete _this3.timeouts[uri];
715
- }
716
- return x;
717
- });
718
- }
719
-
741
+ return pendingFetchPromise;
742
+ }()
720
743
  /**
721
744
  * @param _options - DEPRECATED
722
745
  */
@@ -1156,64 +1179,64 @@ var Fetcher = /*#__PURE__*/function () {
1156
1179
  }, {
1157
1180
  key: "createIfNotExists",
1158
1181
  value: function () {
1159
- var _createIfNotExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(doc) {
1182
+ var _createIfNotExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(doc) {
1160
1183
  var contentType,
1161
1184
  data,
1162
1185
  fetcher,
1163
1186
  response,
1164
- _args = arguments;
1165
- return _regeneratorRuntime.wrap(function _callee$(_context) {
1166
- while (1) switch (_context.prev = _context.next) {
1187
+ _args2 = arguments;
1188
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1189
+ while (1) switch (_context2.prev = _context2.next) {
1167
1190
  case 0:
1168
- contentType = _args.length > 1 && _args[1] !== undefined ? _args[1] : TurtleContentType;
1169
- data = _args.length > 2 && _args[2] !== undefined ? _args[2] : '';
1191
+ contentType = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : TurtleContentType;
1192
+ data = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : '';
1170
1193
  fetcher = this;
1171
- _context.prev = 3;
1172
- _context.next = 6;
1194
+ _context2.prev = 3;
1195
+ _context2.next = 6;
1173
1196
  return fetcher.load(doc);
1174
1197
  case 6:
1175
- response = _context.sent;
1176
- _context.next = 29;
1198
+ response = _context2.sent;
1199
+ _context2.next = 29;
1177
1200
  break;
1178
1201
  case 9:
1179
- _context.prev = 9;
1180
- _context.t0 = _context["catch"](3);
1181
- if (!(_context.t0.response.status === 404)) {
1182
- _context.next = 27;
1202
+ _context2.prev = 9;
1203
+ _context2.t0 = _context2["catch"](3);
1204
+ if (!(_context2.t0.response.status === 404)) {
1205
+ _context2.next = 27;
1183
1206
  break;
1184
1207
  }
1185
1208
  console.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
1186
- _context.prev = 13;
1187
- _context.next = 16;
1209
+ _context2.prev = 13;
1210
+ _context2.next = 16;
1188
1211
  return fetcher.webOperation('PUT', doc.value, {
1189
1212
  data: data,
1190
1213
  contentType: contentType
1191
1214
  });
1192
1215
  case 16:
1193
- response = _context.sent;
1194
- _context.next = 23;
1216
+ response = _context2.sent;
1217
+ _context2.next = 23;
1195
1218
  break;
1196
1219
  case 19:
1197
- _context.prev = 19;
1198
- _context.t1 = _context["catch"](13);
1199
- console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context.t1);
1200
- throw _context.t1;
1220
+ _context2.prev = 19;
1221
+ _context2.t1 = _context2["catch"](13);
1222
+ console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context2.t1);
1223
+ throw _context2.t1;
1201
1224
  case 23:
1202
1225
  delete fetcher.requested[doc.value]; // delete cached 404 error
1203
1226
  // console.log('createIfNotExists doc created ok ' + doc)
1204
- return _context.abrupt("return", response);
1227
+ return _context2.abrupt("return", response);
1205
1228
  case 27:
1206
- console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context.t0);
1207
- throw _context.t0;
1229
+ console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context2.t0);
1230
+ throw _context2.t0;
1208
1231
  case 29:
1209
- return _context.abrupt("return", response);
1232
+ return _context2.abrupt("return", response);
1210
1233
  case 30:
1211
1234
  case "end":
1212
- return _context.stop();
1235
+ return _context2.stop();
1213
1236
  }
1214
- }, _callee, this, [[3, 9], [13, 19]]);
1237
+ }, _callee2, this, [[3, 9], [13, 19]]);
1215
1238
  }));
1216
- function createIfNotExists(_x) {
1239
+ function createIfNotExists(_x4) {
1217
1240
  return _createIfNotExists.apply(this, arguments);
1218
1241
  }
1219
1242
  return createIfNotExists;
package/lib/fetcher.js CHANGED
@@ -674,32 +674,55 @@ var Fetcher = /*#__PURE__*/function () {
674
674
  }
675
675
  }, {
676
676
  key: "pendingFetchPromise",
677
- value: function pendingFetchPromise(uri, originalUri, options) {
678
- var _this3 = this;
679
- var pendingPromise;
680
- function fetchQueueResolvePromise(fetchQueue) {
681
- return fetchQueue;
682
- }
683
-
684
- // Check to see if some request is already dealing with this uri
685
- if (!options.force && fetchQueueResolvePromise(this.fetchQueue[originalUri])) {
686
- pendingPromise = this.fetchQueue[originalUri];
687
- } else {
688
- pendingPromise = Promise.race([this.setRequestTimeout(uri, options), this.fetchUri(uri, options)]);
689
- this.fetchQueue[originalUri] = pendingPromise;
690
-
691
- // Clean up the queued promise after a time, if it's resolved
692
- this.cleanupFetchRequest(originalUri, undefined, this.timeout);
677
+ value: function () {
678
+ var _pendingFetchPromise = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(uri, originalUri, options) {
679
+ var _this3 = this;
680
+ var pendingPromise;
681
+ return _regenerator.default.wrap(function _callee$(_context) {
682
+ while (1) switch (_context.prev = _context.next) {
683
+ case 0:
684
+ _context.t0 = !options.force;
685
+ if (!_context.t0) {
686
+ _context.next = 5;
687
+ break;
688
+ }
689
+ _context.next = 4;
690
+ return this.fetchQueue[originalUri];
691
+ case 4:
692
+ _context.t0 = _context.sent;
693
+ case 5:
694
+ if (!_context.t0) {
695
+ _context.next = 9;
696
+ break;
697
+ }
698
+ pendingPromise = this.fetchQueue[originalUri];
699
+ _context.next = 12;
700
+ break;
701
+ case 9:
702
+ pendingPromise = Promise.race([this.setRequestTimeout(uri, options), this.fetchUri(uri, options)]);
703
+ this.fetchQueue[originalUri] = pendingPromise;
704
+
705
+ // Clean up the queued promise after a time, if it's resolved
706
+ this.cleanupFetchRequest(originalUri, undefined, this.timeout);
707
+ case 12:
708
+ return _context.abrupt("return", pendingPromise.then(function (x) {
709
+ if (uri in _this3.timeouts) {
710
+ _this3.timeouts[uri].forEach(clearTimeout);
711
+ delete _this3.timeouts[uri];
712
+ }
713
+ return x;
714
+ }));
715
+ case 13:
716
+ case "end":
717
+ return _context.stop();
718
+ }
719
+ }, _callee, this);
720
+ }));
721
+ function pendingFetchPromise(_x, _x2, _x3) {
722
+ return _pendingFetchPromise.apply(this, arguments);
693
723
  }
694
- return pendingPromise.then(function (x) {
695
- if (uri in _this3.timeouts) {
696
- _this3.timeouts[uri].forEach(clearTimeout);
697
- delete _this3.timeouts[uri];
698
- }
699
- return x;
700
- });
701
- }
702
-
724
+ return pendingFetchPromise;
725
+ }()
703
726
  /**
704
727
  * @param _options - DEPRECATED
705
728
  */
@@ -1139,64 +1162,64 @@ var Fetcher = /*#__PURE__*/function () {
1139
1162
  }, {
1140
1163
  key: "createIfNotExists",
1141
1164
  value: function () {
1142
- var _createIfNotExists = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(doc) {
1165
+ var _createIfNotExists = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(doc) {
1143
1166
  var contentType,
1144
1167
  data,
1145
1168
  fetcher,
1146
1169
  response,
1147
- _args = arguments;
1148
- return _regenerator.default.wrap(function _callee$(_context) {
1149
- while (1) switch (_context.prev = _context.next) {
1170
+ _args2 = arguments;
1171
+ return _regenerator.default.wrap(function _callee2$(_context2) {
1172
+ while (1) switch (_context2.prev = _context2.next) {
1150
1173
  case 0:
1151
- contentType = _args.length > 1 && _args[1] !== undefined ? _args[1] : _types.TurtleContentType;
1152
- data = _args.length > 2 && _args[2] !== undefined ? _args[2] : '';
1174
+ contentType = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : _types.TurtleContentType;
1175
+ data = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : '';
1153
1176
  fetcher = this;
1154
- _context.prev = 3;
1155
- _context.next = 6;
1177
+ _context2.prev = 3;
1178
+ _context2.next = 6;
1156
1179
  return fetcher.load(doc);
1157
1180
  case 6:
1158
- response = _context.sent;
1159
- _context.next = 29;
1181
+ response = _context2.sent;
1182
+ _context2.next = 29;
1160
1183
  break;
1161
1184
  case 9:
1162
- _context.prev = 9;
1163
- _context.t0 = _context["catch"](3);
1164
- if (!(_context.t0.response.status === 404)) {
1165
- _context.next = 27;
1185
+ _context2.prev = 9;
1186
+ _context2.t0 = _context2["catch"](3);
1187
+ if (!(_context2.t0.response.status === 404)) {
1188
+ _context2.next = 27;
1166
1189
  break;
1167
1190
  }
1168
1191
  console.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
1169
- _context.prev = 13;
1170
- _context.next = 16;
1192
+ _context2.prev = 13;
1193
+ _context2.next = 16;
1171
1194
  return fetcher.webOperation('PUT', doc.value, {
1172
1195
  data: data,
1173
1196
  contentType: contentType
1174
1197
  });
1175
1198
  case 16:
1176
- response = _context.sent;
1177
- _context.next = 23;
1199
+ response = _context2.sent;
1200
+ _context2.next = 23;
1178
1201
  break;
1179
1202
  case 19:
1180
- _context.prev = 19;
1181
- _context.t1 = _context["catch"](13);
1182
- console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context.t1);
1183
- throw _context.t1;
1203
+ _context2.prev = 19;
1204
+ _context2.t1 = _context2["catch"](13);
1205
+ console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context2.t1);
1206
+ throw _context2.t1;
1184
1207
  case 23:
1185
1208
  delete fetcher.requested[doc.value]; // delete cached 404 error
1186
1209
  // console.log('createIfNotExists doc created ok ' + doc)
1187
- return _context.abrupt("return", response);
1210
+ return _context2.abrupt("return", response);
1188
1211
  case 27:
1189
- console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context.t0);
1190
- throw _context.t0;
1212
+ console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context2.t0);
1213
+ throw _context2.t0;
1191
1214
  case 29:
1192
- return _context.abrupt("return", response);
1215
+ return _context2.abrupt("return", response);
1193
1216
  case 30:
1194
1217
  case "end":
1195
- return _context.stop();
1218
+ return _context2.stop();
1196
1219
  }
1197
- }, _callee, this, [[3, 9], [13, 19]]);
1220
+ }, _callee2, this, [[3, 9], [13, 19]]);
1198
1221
  }));
1199
- function createIfNotExists(_x) {
1222
+ function createIfNotExists(_x4) {
1200
1223
  return _createIfNotExists.apply(this, arguments);
1201
1224
  }
1202
1225
  return createIfNotExists;
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.24-ce092266",
4
+ "version": "2.2.25-cff3abdb",
5
5
  "private": false,
6
6
  "browserslist": [
7
7
  "> 0.5%"
@@ -48,7 +48,7 @@
48
48
  "@frogcat/ttl2jsonld": "^0.0.9",
49
49
  "@xmldom/xmldom": "^0.8.6",
50
50
  "cross-fetch": "^3.1.5",
51
- "jsonld": "^8.1.0",
51
+ "jsonld": "^5.2.0",
52
52
  "n3": "^1.16.3",
53
53
  "solid-namespace": "^0.5.2"
54
54
  },
@@ -69,7 +69,7 @@
69
69
  "chai": "^4.3.7",
70
70
  "diff": "^5.1.0",
71
71
  "dirty-chai": "^2.0.1",
72
- "eslint": "^8.32.0",
72
+ "eslint": "^8.33.0",
73
73
  "fs-grep": "0.0.5",
74
74
  "locate-path": "^7.1.1",
75
75
  "mocha": "^10.2.0",
@@ -82,7 +82,7 @@
82
82
  "source-map-loader": "^4.0.1",
83
83
  "ts-node": "^10.9.1",
84
84
  "typedoc": "^0.23.24",
85
- "typescript": "^4.9.4",
85
+ "typescript": "^4.9.5",
86
86
  "webpack": "^5.75.0",
87
87
  "webpack-cli": "^5.0.1",
88
88
  "webpack-dev-server": "^4.11.1"
package/src/fetcher.ts CHANGED
@@ -979,16 +979,15 @@ export default class Fetcher implements CallbackifyInterface {
979
979
  return this.pendingFetchPromise(docuri, initialisedOptions.baseURI, initialisedOptions) as any
980
980
  }
981
981
 
982
- pendingFetchPromise (
982
+ async pendingFetchPromise (
983
983
  uri: string,
984
984
  originalUri: string,
985
985
  options: AutoInitOptions
986
986
  ): Promise<Result> {
987
987
  let pendingPromise
988
- function fetchQueueResolvePromise (fetchQueue) { return fetchQueue }
989
988
 
990
989
  // Check to see if some request is already dealing with this uri
991
- if (!options.force && fetchQueueResolvePromise(this.fetchQueue[originalUri])) {
990
+ if (!options.force && await this.fetchQueue[originalUri]) {
992
991
  pendingPromise = this.fetchQueue[originalUri]
993
992
  } else {
994
993
  pendingPromise = Promise