@atlaskit/node-data-provider 11.1.4 → 11.1.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/node-data-provider
2
2
 
3
+ ## 11.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 11.1.4
4
10
 
5
11
  ### Patch Changes
@@ -145,19 +145,19 @@ var NodeDataProvider = exports.NodeDataProvider = /*#__PURE__*/function () {
145
145
  key: "getDataAsync",
146
146
  value: function () {
147
147
  var _getDataAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(node, callback) {
148
- var jsonNode, dataKey, dataFromCache, cacheVersionBeforeRequest, networkRequestInFlightKey, networkRequestInFlight, data, dataPromise, _data;
149
- return _regenerator.default.wrap(function _callee$(_context) {
148
+ var jsonNode, dataKey, dataFromCache, cacheVersionBeforeRequest, networkRequestInFlightKey, networkRequestInFlight, data, dataPromise, _data, _t, _t2;
149
+ return _regenerator.default.wrap(function (_context) {
150
150
  while (1) switch (_context.prev = _context.next) {
151
151
  case 0:
152
152
  jsonNode = 'toJSON' in node ? node.toJSON() : node;
153
153
  if (this.isNodeSupported(jsonNode)) {
154
- _context.next = 4;
154
+ _context.next = 1;
155
155
  break;
156
156
  }
157
157
  // eslint-disable-next-line no-console
158
158
  console.error("The ".concat(this.constructor.name, " doesn't support Node ").concat(jsonNode.type, "."));
159
159
  return _context.abrupt("return");
160
- case 4:
160
+ case 1:
161
161
  dataKey = this.nodeDataKey(jsonNode);
162
162
  dataFromCache = this.cache[dataKey];
163
163
  if (dataFromCache !== undefined) {
@@ -167,13 +167,13 @@ var NodeDataProvider = exports.NodeDataProvider = /*#__PURE__*/function () {
167
167
  });
168
168
  }
169
169
  if (!(0, _coreUtils.isSSR)()) {
170
- _context.next = 9;
170
+ _context.next = 2;
171
171
  break;
172
172
  }
173
173
  return _context.abrupt("return");
174
- case 9:
174
+ case 2:
175
175
  if (!((dataFromCache === null || dataFromCache === void 0 ? void 0 : dataFromCache.source) !== 'network')) {
176
- _context.next = 41;
176
+ _context.next = 11;
177
177
  break;
178
178
  }
179
179
  // Store the current cache version before making the request,
@@ -184,38 +184,38 @@ var NodeDataProvider = exports.NodeDataProvider = /*#__PURE__*/function () {
184
184
  // to avoid duplicate requests.
185
185
  networkRequestInFlight = this.networkRequestsInFlight[networkRequestInFlightKey];
186
186
  if (!networkRequestInFlight) {
187
- _context.next = 25;
187
+ _context.next = 7;
188
188
  break;
189
189
  }
190
- _context.prev = 14;
191
- _context.next = 17;
190
+ _context.prev = 3;
191
+ _context.next = 4;
192
192
  return networkRequestInFlight;
193
- case 17:
193
+ case 4:
194
194
  data = _context.sent;
195
195
  callback({
196
196
  data: data
197
197
  });
198
- _context.next = 24;
198
+ _context.next = 6;
199
199
  break;
200
- case 21:
201
- _context.prev = 21;
202
- _context.t0 = _context["catch"](14);
200
+ case 5:
201
+ _context.prev = 5;
202
+ _t = _context["catch"](3);
203
203
  callback({
204
- error: _context.t0 instanceof Error ? _context.t0 : new Error(String(_context.t0))
204
+ error: _t instanceof Error ? _t : new Error(String(_t))
205
205
  });
206
- case 24:
206
+ case 6:
207
207
  return _context.abrupt("return");
208
- case 25:
209
- _context.prev = 25;
208
+ case 7:
209
+ _context.prev = 7;
210
210
  dataPromise = this.fetchNodesData([jsonNode]).then(function (_ref3) {
211
211
  var _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
212
212
  value = _ref4[0];
213
213
  return value;
214
214
  }); // Store the promise in the in-flight requests map
215
215
  this.networkRequestsInFlight[networkRequestInFlightKey] = dataPromise;
216
- _context.next = 30;
216
+ _context.next = 8;
217
217
  return dataPromise;
218
- case 30:
218
+ case 8:
219
219
  _data = _context.sent;
220
220
  // We need to call the callback with the data with result even if the cache version has changed,
221
221
  // so all promises that are waiting for the data can resolve.
@@ -239,25 +239,25 @@ var NodeDataProvider = exports.NodeDataProvider = /*#__PURE__*/function () {
239
239
  };
240
240
  }
241
241
  }
242
- _context.next = 38;
242
+ _context.next = 10;
243
243
  break;
244
- case 35:
245
- _context.prev = 35;
246
- _context.t1 = _context["catch"](25);
244
+ case 9:
245
+ _context.prev = 9;
246
+ _t2 = _context["catch"](7);
247
247
  // If an error occurs, we call the callback with the error
248
248
  callback({
249
- error: _context.t1 instanceof Error ? _context.t1 : new Error(String(_context.t1))
249
+ error: _t2 instanceof Error ? _t2 : new Error(String(_t2))
250
250
  });
251
- case 38:
252
- _context.prev = 38;
251
+ case 10:
252
+ _context.prev = 10;
253
253
  // Ensure we clean up the in-flight request entry
254
254
  delete this.networkRequestsInFlight[networkRequestInFlightKey];
255
- return _context.finish(38);
256
- case 41:
255
+ return _context.finish(10);
256
+ case 11:
257
257
  case "end":
258
258
  return _context.stop();
259
259
  }
260
- }, _callee, this, [[14, 21], [25, 35, 38, 41]]);
260
+ }, _callee, this, [[3, 5], [7, 9, 10, 11]]);
261
261
  }));
262
262
  function getDataAsync(_x, _x2) {
263
263
  return _getDataAsync.apply(this, arguments);
@@ -81,12 +81,12 @@ function prefetchNodeDataProvidersData(_x) {
81
81
  function _prefetchNodeDataProvidersData() {
82
82
  _prefetchNodeDataProvidersData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref) {
83
83
  var providers, doc, timeout, _ref$maxNodesToVisit, maxNodesToVisit, providersWithDefaults, providerTimeouts, nodesWithProviders, promises, results;
84
- return _regenerator.default.wrap(function _callee2$(_context2) {
84
+ return _regenerator.default.wrap(function (_context2) {
85
85
  while (1) switch (_context2.prev = _context2.next) {
86
86
  case 0:
87
87
  providers = _ref.providers, doc = _ref.doc, timeout = _ref.timeout, _ref$maxNodesToVisit = _ref.maxNodesToVisit, maxNodesToVisit = _ref$maxNodesToVisit === void 0 ? Infinity : _ref$maxNodesToVisit;
88
88
  if (!(timeout <= 0)) {
89
- _context2.next = 3;
89
+ _context2.next = 1;
90
90
  break;
91
91
  }
92
92
  return _context2.abrupt("return", providers.reduce(function (acc, _ref2) {
@@ -98,7 +98,7 @@ function _prefetchNodeDataProvidersData() {
98
98
  };
99
99
  return acc;
100
100
  }, {}));
101
- case 3:
101
+ case 1:
102
102
  providersWithDefaults = providers.map(function (_ref3) {
103
103
  var provider = _ref3.provider,
104
104
  _ref3$maxNodesToPrefe = _ref3.maxNodesToPrefetch,
@@ -129,8 +129,8 @@ function _prefetchNodeDataProvidersData() {
129
129
  });
130
130
  promises = nodesWithProviders.map( /*#__PURE__*/function () {
131
131
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref6) {
132
- var nodes, provider, timeout, start, getDurationFromStart, timeoutPromise, data;
133
- return _regenerator.default.wrap(function _callee$(_context) {
132
+ var nodes, provider, timeout, start, getDurationFromStart, timeoutPromise, data, _t;
133
+ return _regenerator.default.wrap(function (_context) {
134
134
  while (1) switch (_context.prev = _context.next) {
135
135
  case 0:
136
136
  getDurationFromStart = function _getDurationFromStart() {
@@ -138,7 +138,7 @@ function _prefetchNodeDataProvidersData() {
138
138
  };
139
139
  nodes = _ref6.nodes, provider = _ref6.provider, timeout = _ref6.timeout;
140
140
  if (!(timeout <= 0)) {
141
- _context.next = 4;
141
+ _context.next = 1;
142
142
  break;
143
143
  }
144
144
  return _context.abrupt("return", {
@@ -148,17 +148,17 @@ function _prefetchNodeDataProvidersData() {
148
148
  nodes: nodes,
149
149
  data: []
150
150
  });
151
- case 4:
151
+ case 1:
152
152
  start = performance.now();
153
- _context.prev = 5;
153
+ _context.prev = 2;
154
154
  timeoutPromise = new Promise(function (_, reject) {
155
155
  setTimeout(function () {
156
156
  reject();
157
157
  }, timeout);
158
158
  });
159
- _context.next = 9;
159
+ _context.next = 3;
160
160
  return Promise.race([provider.fetchNodesData(nodes), timeoutPromise]);
161
- case 9:
161
+ case 3:
162
162
  data = _context.sent;
163
163
  return _context.abrupt("return", {
164
164
  provider: provider,
@@ -167,9 +167,9 @@ function _prefetchNodeDataProvidersData() {
167
167
  nodes: nodes,
168
168
  data: data
169
169
  });
170
- case 13:
171
- _context.prev = 13;
172
- _context.t0 = _context["catch"](5);
170
+ case 4:
171
+ _context.prev = 4;
172
+ _t = _context["catch"](2);
173
173
  return _context.abrupt("return", {
174
174
  provider: provider,
175
175
  success: false,
@@ -177,19 +177,19 @@ function _prefetchNodeDataProvidersData() {
177
177
  nodes: nodes,
178
178
  data: []
179
179
  });
180
- case 16:
180
+ case 5:
181
181
  case "end":
182
182
  return _context.stop();
183
183
  }
184
- }, _callee, null, [[5, 13]]);
184
+ }, _callee, null, [[2, 4]]);
185
185
  }));
186
186
  return function (_x2) {
187
187
  return _ref7.apply(this, arguments);
188
188
  };
189
189
  }());
190
- _context2.next = 9;
190
+ _context2.next = 2;
191
191
  return Promise.all(promises);
192
- case 9:
192
+ case 2:
193
193
  results = _context2.sent;
194
194
  return _context2.abrupt("return", results.reduce(function (acc, _ref8) {
195
195
  var provider = _ref8.provider,
@@ -210,7 +210,7 @@ function _prefetchNodeDataProvidersData() {
210
210
  };
211
211
  return acc;
212
212
  }, {}));
213
- case 11:
213
+ case 3:
214
214
  case "end":
215
215
  return _context2.stop();
216
216
  }
@@ -142,19 +142,19 @@ export var NodeDataProvider = /*#__PURE__*/function () {
142
142
  key: "getDataAsync",
143
143
  value: function () {
144
144
  var _getDataAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(node, callback) {
145
- var jsonNode, dataKey, dataFromCache, cacheVersionBeforeRequest, networkRequestInFlightKey, networkRequestInFlight, data, dataPromise, _data;
146
- return _regeneratorRuntime.wrap(function _callee$(_context) {
145
+ var jsonNode, dataKey, dataFromCache, cacheVersionBeforeRequest, networkRequestInFlightKey, networkRequestInFlight, data, dataPromise, _data, _t, _t2;
146
+ return _regeneratorRuntime.wrap(function (_context) {
147
147
  while (1) switch (_context.prev = _context.next) {
148
148
  case 0:
149
149
  jsonNode = 'toJSON' in node ? node.toJSON() : node;
150
150
  if (this.isNodeSupported(jsonNode)) {
151
- _context.next = 4;
151
+ _context.next = 1;
152
152
  break;
153
153
  }
154
154
  // eslint-disable-next-line no-console
155
155
  console.error("The ".concat(this.constructor.name, " doesn't support Node ").concat(jsonNode.type, "."));
156
156
  return _context.abrupt("return");
157
- case 4:
157
+ case 1:
158
158
  dataKey = this.nodeDataKey(jsonNode);
159
159
  dataFromCache = this.cache[dataKey];
160
160
  if (dataFromCache !== undefined) {
@@ -164,13 +164,13 @@ export var NodeDataProvider = /*#__PURE__*/function () {
164
164
  });
165
165
  }
166
166
  if (!isSSR()) {
167
- _context.next = 9;
167
+ _context.next = 2;
168
168
  break;
169
169
  }
170
170
  return _context.abrupt("return");
171
- case 9:
171
+ case 2:
172
172
  if (!((dataFromCache === null || dataFromCache === void 0 ? void 0 : dataFromCache.source) !== 'network')) {
173
- _context.next = 41;
173
+ _context.next = 11;
174
174
  break;
175
175
  }
176
176
  // Store the current cache version before making the request,
@@ -181,38 +181,38 @@ export var NodeDataProvider = /*#__PURE__*/function () {
181
181
  // to avoid duplicate requests.
182
182
  networkRequestInFlight = this.networkRequestsInFlight[networkRequestInFlightKey];
183
183
  if (!networkRequestInFlight) {
184
- _context.next = 25;
184
+ _context.next = 7;
185
185
  break;
186
186
  }
187
- _context.prev = 14;
188
- _context.next = 17;
187
+ _context.prev = 3;
188
+ _context.next = 4;
189
189
  return networkRequestInFlight;
190
- case 17:
190
+ case 4:
191
191
  data = _context.sent;
192
192
  callback({
193
193
  data: data
194
194
  });
195
- _context.next = 24;
195
+ _context.next = 6;
196
196
  break;
197
- case 21:
198
- _context.prev = 21;
199
- _context.t0 = _context["catch"](14);
197
+ case 5:
198
+ _context.prev = 5;
199
+ _t = _context["catch"](3);
200
200
  callback({
201
- error: _context.t0 instanceof Error ? _context.t0 : new Error(String(_context.t0))
201
+ error: _t instanceof Error ? _t : new Error(String(_t))
202
202
  });
203
- case 24:
203
+ case 6:
204
204
  return _context.abrupt("return");
205
- case 25:
206
- _context.prev = 25;
205
+ case 7:
206
+ _context.prev = 7;
207
207
  dataPromise = this.fetchNodesData([jsonNode]).then(function (_ref3) {
208
208
  var _ref4 = _slicedToArray(_ref3, 1),
209
209
  value = _ref4[0];
210
210
  return value;
211
211
  }); // Store the promise in the in-flight requests map
212
212
  this.networkRequestsInFlight[networkRequestInFlightKey] = dataPromise;
213
- _context.next = 30;
213
+ _context.next = 8;
214
214
  return dataPromise;
215
- case 30:
215
+ case 8:
216
216
  _data = _context.sent;
217
217
  // We need to call the callback with the data with result even if the cache version has changed,
218
218
  // so all promises that are waiting for the data can resolve.
@@ -236,25 +236,25 @@ export var NodeDataProvider = /*#__PURE__*/function () {
236
236
  };
237
237
  }
238
238
  }
239
- _context.next = 38;
239
+ _context.next = 10;
240
240
  break;
241
- case 35:
242
- _context.prev = 35;
243
- _context.t1 = _context["catch"](25);
241
+ case 9:
242
+ _context.prev = 9;
243
+ _t2 = _context["catch"](7);
244
244
  // If an error occurs, we call the callback with the error
245
245
  callback({
246
- error: _context.t1 instanceof Error ? _context.t1 : new Error(String(_context.t1))
246
+ error: _t2 instanceof Error ? _t2 : new Error(String(_t2))
247
247
  });
248
- case 38:
249
- _context.prev = 38;
248
+ case 10:
249
+ _context.prev = 10;
250
250
  // Ensure we clean up the in-flight request entry
251
251
  delete this.networkRequestsInFlight[networkRequestInFlightKey];
252
- return _context.finish(38);
253
- case 41:
252
+ return _context.finish(10);
253
+ case 11:
254
254
  case "end":
255
255
  return _context.stop();
256
256
  }
257
- }, _callee, this, [[14, 21], [25, 35, 38, 41]]);
257
+ }, _callee, this, [[3, 5], [7, 9, 10, 11]]);
258
258
  }));
259
259
  function getDataAsync(_x, _x2) {
260
260
  return _getDataAsync.apply(this, arguments);
@@ -77,12 +77,12 @@ export function prefetchNodeDataProvidersData(_x) {
77
77
  function _prefetchNodeDataProvidersData() {
78
78
  _prefetchNodeDataProvidersData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref) {
79
79
  var providers, doc, timeout, _ref$maxNodesToVisit, maxNodesToVisit, providersWithDefaults, providerTimeouts, nodesWithProviders, promises, results;
80
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
80
+ return _regeneratorRuntime.wrap(function (_context2) {
81
81
  while (1) switch (_context2.prev = _context2.next) {
82
82
  case 0:
83
83
  providers = _ref.providers, doc = _ref.doc, timeout = _ref.timeout, _ref$maxNodesToVisit = _ref.maxNodesToVisit, maxNodesToVisit = _ref$maxNodesToVisit === void 0 ? Infinity : _ref$maxNodesToVisit;
84
84
  if (!(timeout <= 0)) {
85
- _context2.next = 3;
85
+ _context2.next = 1;
86
86
  break;
87
87
  }
88
88
  return _context2.abrupt("return", providers.reduce(function (acc, _ref2) {
@@ -94,7 +94,7 @@ function _prefetchNodeDataProvidersData() {
94
94
  };
95
95
  return acc;
96
96
  }, {}));
97
- case 3:
97
+ case 1:
98
98
  providersWithDefaults = providers.map(function (_ref3) {
99
99
  var provider = _ref3.provider,
100
100
  _ref3$maxNodesToPrefe = _ref3.maxNodesToPrefetch,
@@ -125,8 +125,8 @@ function _prefetchNodeDataProvidersData() {
125
125
  });
126
126
  promises = nodesWithProviders.map( /*#__PURE__*/function () {
127
127
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref6) {
128
- var nodes, provider, timeout, start, getDurationFromStart, timeoutPromise, data;
129
- return _regeneratorRuntime.wrap(function _callee$(_context) {
128
+ var nodes, provider, timeout, start, getDurationFromStart, timeoutPromise, data, _t;
129
+ return _regeneratorRuntime.wrap(function (_context) {
130
130
  while (1) switch (_context.prev = _context.next) {
131
131
  case 0:
132
132
  getDurationFromStart = function _getDurationFromStart() {
@@ -134,7 +134,7 @@ function _prefetchNodeDataProvidersData() {
134
134
  };
135
135
  nodes = _ref6.nodes, provider = _ref6.provider, timeout = _ref6.timeout;
136
136
  if (!(timeout <= 0)) {
137
- _context.next = 4;
137
+ _context.next = 1;
138
138
  break;
139
139
  }
140
140
  return _context.abrupt("return", {
@@ -144,17 +144,17 @@ function _prefetchNodeDataProvidersData() {
144
144
  nodes: nodes,
145
145
  data: []
146
146
  });
147
- case 4:
147
+ case 1:
148
148
  start = performance.now();
149
- _context.prev = 5;
149
+ _context.prev = 2;
150
150
  timeoutPromise = new Promise(function (_, reject) {
151
151
  setTimeout(function () {
152
152
  reject();
153
153
  }, timeout);
154
154
  });
155
- _context.next = 9;
155
+ _context.next = 3;
156
156
  return Promise.race([provider.fetchNodesData(nodes), timeoutPromise]);
157
- case 9:
157
+ case 3:
158
158
  data = _context.sent;
159
159
  return _context.abrupt("return", {
160
160
  provider: provider,
@@ -163,9 +163,9 @@ function _prefetchNodeDataProvidersData() {
163
163
  nodes: nodes,
164
164
  data: data
165
165
  });
166
- case 13:
167
- _context.prev = 13;
168
- _context.t0 = _context["catch"](5);
166
+ case 4:
167
+ _context.prev = 4;
168
+ _t = _context["catch"](2);
169
169
  return _context.abrupt("return", {
170
170
  provider: provider,
171
171
  success: false,
@@ -173,19 +173,19 @@ function _prefetchNodeDataProvidersData() {
173
173
  nodes: nodes,
174
174
  data: []
175
175
  });
176
- case 16:
176
+ case 5:
177
177
  case "end":
178
178
  return _context.stop();
179
179
  }
180
- }, _callee, null, [[5, 13]]);
180
+ }, _callee, null, [[2, 4]]);
181
181
  }));
182
182
  return function (_x2) {
183
183
  return _ref7.apply(this, arguments);
184
184
  };
185
185
  }());
186
- _context2.next = 9;
186
+ _context2.next = 2;
187
187
  return Promise.all(promises);
188
- case 9:
188
+ case 2:
189
189
  results = _context2.sent;
190
190
  return _context2.abrupt("return", results.reduce(function (acc, _ref8) {
191
191
  var provider = _ref8.provider,
@@ -206,7 +206,7 @@ function _prefetchNodeDataProvidersData() {
206
206
  };
207
207
  return acc;
208
208
  }, {}));
209
- case 11:
209
+ case 3:
210
210
  case "end":
211
211
  return _context2.stop();
212
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/node-data-provider",
3
- "version": "11.1.4",
3
+ "version": "11.1.5",
4
4
  "description": "Node data provider for @atlaskit/editor-core plugins and @atlaskit/renderer",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -19,14 +19,14 @@
19
19
  "sideEffects": false,
20
20
  "atlaskit:src": "src/index.ts",
21
21
  "dependencies": {
22
- "@atlaskit/editor-json-transformer": "^8.32.0",
22
+ "@atlaskit/editor-json-transformer": "^8.33.0",
23
23
  "@atlaskit/editor-prosemirror": "^7.3.0",
24
24
  "@atlaskit/platform-feature-flags": "^1.1.0",
25
- "@atlaskit/tmp-editor-statsig": "^84.0.0",
25
+ "@atlaskit/tmp-editor-statsig": "^85.0.0",
26
26
  "@babel/runtime": "^7.0.0"
27
27
  },
28
28
  "peerDependencies": {
29
- "@atlaskit/editor-common": "^114.47.0"
29
+ "@atlaskit/editor-common": "^114.50.0"
30
30
  },
31
31
  "techstack": {
32
32
  "@atlassian/frontend": {