rdflib 2.2.24-4e18cd59 → 2.2.24-ce092266

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,55 +691,32 @@ var Fetcher = /*#__PURE__*/function () {
691
691
  }
692
692
  }, {
693
693
  key: "pendingFetchPromise",
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);
694
+ value: function pendingFetchPromise(uri, originalUri, options) {
695
+ var _this3 = this;
696
+ var pendingPromise;
697
+ function fetchQueueResolvePromise(fetchQueue) {
698
+ return fetchQueue;
740
699
  }
741
- return pendingFetchPromise;
742
- }()
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);
710
+ }
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
+
743
720
  /**
744
721
  * @param _options - DEPRECATED
745
722
  */
@@ -1179,64 +1156,64 @@ var Fetcher = /*#__PURE__*/function () {
1179
1156
  }, {
1180
1157
  key: "createIfNotExists",
1181
1158
  value: function () {
1182
- var _createIfNotExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(doc) {
1159
+ var _createIfNotExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(doc) {
1183
1160
  var contentType,
1184
1161
  data,
1185
1162
  fetcher,
1186
1163
  response,
1187
- _args2 = arguments;
1188
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1189
- while (1) switch (_context2.prev = _context2.next) {
1164
+ _args = arguments;
1165
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1166
+ while (1) switch (_context.prev = _context.next) {
1190
1167
  case 0:
1191
- contentType = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : TurtleContentType;
1192
- data = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : '';
1168
+ contentType = _args.length > 1 && _args[1] !== undefined ? _args[1] : TurtleContentType;
1169
+ data = _args.length > 2 && _args[2] !== undefined ? _args[2] : '';
1193
1170
  fetcher = this;
1194
- _context2.prev = 3;
1195
- _context2.next = 6;
1171
+ _context.prev = 3;
1172
+ _context.next = 6;
1196
1173
  return fetcher.load(doc);
1197
1174
  case 6:
1198
- response = _context2.sent;
1199
- _context2.next = 29;
1175
+ response = _context.sent;
1176
+ _context.next = 29;
1200
1177
  break;
1201
1178
  case 9:
1202
- _context2.prev = 9;
1203
- _context2.t0 = _context2["catch"](3);
1204
- if (!(_context2.t0.response.status === 404)) {
1205
- _context2.next = 27;
1179
+ _context.prev = 9;
1180
+ _context.t0 = _context["catch"](3);
1181
+ if (!(_context.t0.response.status === 404)) {
1182
+ _context.next = 27;
1206
1183
  break;
1207
1184
  }
1208
1185
  console.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
1209
- _context2.prev = 13;
1210
- _context2.next = 16;
1186
+ _context.prev = 13;
1187
+ _context.next = 16;
1211
1188
  return fetcher.webOperation('PUT', doc.value, {
1212
1189
  data: data,
1213
1190
  contentType: contentType
1214
1191
  });
1215
1192
  case 16:
1216
- response = _context2.sent;
1217
- _context2.next = 23;
1193
+ response = _context.sent;
1194
+ _context.next = 23;
1218
1195
  break;
1219
1196
  case 19:
1220
- _context2.prev = 19;
1221
- _context2.t1 = _context2["catch"](13);
1222
- console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context2.t1);
1223
- throw _context2.t1;
1197
+ _context.prev = 19;
1198
+ _context.t1 = _context["catch"](13);
1199
+ console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context.t1);
1200
+ throw _context.t1;
1224
1201
  case 23:
1225
1202
  delete fetcher.requested[doc.value]; // delete cached 404 error
1226
1203
  // console.log('createIfNotExists doc created ok ' + doc)
1227
- return _context2.abrupt("return", response);
1204
+ return _context.abrupt("return", response);
1228
1205
  case 27:
1229
- console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context2.t0);
1230
- throw _context2.t0;
1206
+ console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context.t0);
1207
+ throw _context.t0;
1231
1208
  case 29:
1232
- return _context2.abrupt("return", response);
1209
+ return _context.abrupt("return", response);
1233
1210
  case 30:
1234
1211
  case "end":
1235
- return _context2.stop();
1212
+ return _context.stop();
1236
1213
  }
1237
- }, _callee2, this, [[3, 9], [13, 19]]);
1214
+ }, _callee, this, [[3, 9], [13, 19]]);
1238
1215
  }));
1239
- function createIfNotExists(_x4) {
1216
+ function createIfNotExists(_x) {
1240
1217
  return _createIfNotExists.apply(this, arguments);
1241
1218
  }
1242
1219
  return createIfNotExists;
package/lib/fetcher.js CHANGED
@@ -674,55 +674,32 @@ var Fetcher = /*#__PURE__*/function () {
674
674
  }
675
675
  }, {
676
676
  key: "pendingFetchPromise",
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);
677
+ value: function pendingFetchPromise(uri, originalUri, options) {
678
+ var _this3 = this;
679
+ var pendingPromise;
680
+ function fetchQueueResolvePromise(fetchQueue) {
681
+ return fetchQueue;
723
682
  }
724
- return pendingFetchPromise;
725
- }()
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);
693
+ }
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
+
726
703
  /**
727
704
  * @param _options - DEPRECATED
728
705
  */
@@ -1162,64 +1139,64 @@ var Fetcher = /*#__PURE__*/function () {
1162
1139
  }, {
1163
1140
  key: "createIfNotExists",
1164
1141
  value: function () {
1165
- var _createIfNotExists = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(doc) {
1142
+ var _createIfNotExists = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(doc) {
1166
1143
  var contentType,
1167
1144
  data,
1168
1145
  fetcher,
1169
1146
  response,
1170
- _args2 = arguments;
1171
- return _regenerator.default.wrap(function _callee2$(_context2) {
1172
- while (1) switch (_context2.prev = _context2.next) {
1147
+ _args = arguments;
1148
+ return _regenerator.default.wrap(function _callee$(_context) {
1149
+ while (1) switch (_context.prev = _context.next) {
1173
1150
  case 0:
1174
- contentType = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : _types.TurtleContentType;
1175
- data = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : '';
1151
+ contentType = _args.length > 1 && _args[1] !== undefined ? _args[1] : _types.TurtleContentType;
1152
+ data = _args.length > 2 && _args[2] !== undefined ? _args[2] : '';
1176
1153
  fetcher = this;
1177
- _context2.prev = 3;
1178
- _context2.next = 6;
1154
+ _context.prev = 3;
1155
+ _context.next = 6;
1179
1156
  return fetcher.load(doc);
1180
1157
  case 6:
1181
- response = _context2.sent;
1182
- _context2.next = 29;
1158
+ response = _context.sent;
1159
+ _context.next = 29;
1183
1160
  break;
1184
1161
  case 9:
1185
- _context2.prev = 9;
1186
- _context2.t0 = _context2["catch"](3);
1187
- if (!(_context2.t0.response.status === 404)) {
1188
- _context2.next = 27;
1162
+ _context.prev = 9;
1163
+ _context.t0 = _context["catch"](3);
1164
+ if (!(_context.t0.response.status === 404)) {
1165
+ _context.next = 27;
1189
1166
  break;
1190
1167
  }
1191
1168
  console.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
1192
- _context2.prev = 13;
1193
- _context2.next = 16;
1169
+ _context.prev = 13;
1170
+ _context.next = 16;
1194
1171
  return fetcher.webOperation('PUT', doc.value, {
1195
1172
  data: data,
1196
1173
  contentType: contentType
1197
1174
  });
1198
1175
  case 16:
1199
- response = _context2.sent;
1200
- _context2.next = 23;
1176
+ response = _context.sent;
1177
+ _context.next = 23;
1201
1178
  break;
1202
1179
  case 19:
1203
- _context2.prev = 19;
1204
- _context2.t1 = _context2["catch"](13);
1205
- console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context2.t1);
1206
- throw _context2.t1;
1180
+ _context.prev = 19;
1181
+ _context.t1 = _context["catch"](13);
1182
+ console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context.t1);
1183
+ throw _context.t1;
1207
1184
  case 23:
1208
1185
  delete fetcher.requested[doc.value]; // delete cached 404 error
1209
1186
  // console.log('createIfNotExists doc created ok ' + doc)
1210
- return _context2.abrupt("return", response);
1187
+ return _context.abrupt("return", response);
1211
1188
  case 27:
1212
- console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context2.t0);
1213
- throw _context2.t0;
1189
+ console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context.t0);
1190
+ throw _context.t0;
1214
1191
  case 29:
1215
- return _context2.abrupt("return", response);
1192
+ return _context.abrupt("return", response);
1216
1193
  case 30:
1217
1194
  case "end":
1218
- return _context2.stop();
1195
+ return _context.stop();
1219
1196
  }
1220
- }, _callee2, this, [[3, 9], [13, 19]]);
1197
+ }, _callee, this, [[3, 9], [13, 19]]);
1221
1198
  }));
1222
- function createIfNotExists(_x4) {
1199
+ function createIfNotExists(_x) {
1223
1200
  return _createIfNotExists.apply(this, arguments);
1224
1201
  }
1225
1202
  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-4e18cd59",
4
+ "version": "2.2.24-ce092266",
5
5
  "private": false,
6
6
  "browserslist": [
7
7
  "> 0.5%"
package/src/fetcher.ts CHANGED
@@ -979,15 +979,16 @@ export default class Fetcher implements CallbackifyInterface {
979
979
  return this.pendingFetchPromise(docuri, initialisedOptions.baseURI, initialisedOptions) as any
980
980
  }
981
981
 
982
- async pendingFetchPromise (
982
+ 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 }
988
989
 
989
990
  // Check to see if some request is already dealing with this uri
990
- if (!options.force && await this.fetchQueue[originalUri]) {
991
+ if (!options.force && fetchQueueResolvePromise(this.fetchQueue[originalUri])) {
991
992
  pendingPromise = this.fetchQueue[originalUri]
992
993
  } else {
993
994
  pendingPromise = Promise