@atlaskit/node-data-provider 4.5.3 → 4.6.0

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,21 @@
1
1
  # @atlaskit/node-data-provider
2
2
 
3
+ ## 4.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5763f85b421a2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5763f85b421a2) - -
8
+ The new method `getCacheStatusForNode` is added to `NodeDataProvider` class to get the cache
9
+ status for a given node.
10
+ - The `CardSSR` component will start supporting `hideIconLoadingSkeleton` property for any type of
11
+ smart card.
12
+
13
+ ### Patch Changes
14
+
15
+ - [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
16
+ EDITOR-1442 Bump adf-schema
17
+ - Updated dependencies
18
+
3
19
  ## 4.5.3
4
20
 
5
21
  ### Patch Changes
@@ -272,6 +272,31 @@ var NodeDataProvider = exports.NodeDataProvider = /*#__PURE__*/function () {
272
272
  }
273
273
  });
274
274
  }
275
+
276
+ /**
277
+ * Checks the cache for the given node and returns its status.
278
+ *
279
+ * Possible return values:
280
+ * - `false`: No cached data found for the node.
281
+ * - `'ssr'`: Data is cached from server-side rendering (SSR).
282
+ * - `'network'`: Data is cached from a network request.
283
+ *
284
+ * @param node The node (or its ProseMirror representation) to check in the cache.
285
+ * @returns The cache status: `false`, `'ssr'`, or `'network'`.
286
+ */
287
+ }, {
288
+ key: "getCacheStatusForNode",
289
+ value: function getCacheStatusForNode(node) {
290
+ var jsonNode = 'toJSON' in node ? node.toJSON() : node;
291
+ if (!this.isNodeSupported(jsonNode)) {
292
+ // eslint-disable-next-line no-console
293
+ console.error("The ".concat(this.constructor.name, " doesn't support Node ").concat(jsonNode.type, "."));
294
+ return false;
295
+ }
296
+ var dataKey = this.nodeDataKey(jsonNode);
297
+ var dataFromCache = this.cache[dataKey];
298
+ return dataFromCache ? dataFromCache.source : false;
299
+ }
275
300
  }]);
276
301
  }();
277
302
  function isPromise(value) {
@@ -231,6 +231,29 @@ export class NodeDataProvider {
231
231
  }
232
232
  });
233
233
  }
234
+
235
+ /**
236
+ * Checks the cache for the given node and returns its status.
237
+ *
238
+ * Possible return values:
239
+ * - `false`: No cached data found for the node.
240
+ * - `'ssr'`: Data is cached from server-side rendering (SSR).
241
+ * - `'network'`: Data is cached from a network request.
242
+ *
243
+ * @param node The node (or its ProseMirror representation) to check in the cache.
244
+ * @returns The cache status: `false`, `'ssr'`, or `'network'`.
245
+ */
246
+ getCacheStatusForNode(node) {
247
+ const jsonNode = 'toJSON' in node ? node.toJSON() : node;
248
+ if (!this.isNodeSupported(jsonNode)) {
249
+ // eslint-disable-next-line no-console
250
+ console.error(`The ${this.constructor.name} doesn't support Node ${jsonNode.type}.`);
251
+ return false;
252
+ }
253
+ const dataKey = this.nodeDataKey(jsonNode);
254
+ const dataFromCache = this.cache[dataKey];
255
+ return dataFromCache ? dataFromCache.source : false;
256
+ }
234
257
  }
235
258
  function isPromise(value) {
236
259
  return typeof value === 'object' && value !== null && 'then' in value && typeof value.then === 'function';
@@ -269,6 +269,31 @@ export var NodeDataProvider = /*#__PURE__*/function () {
269
269
  }
270
270
  });
271
271
  }
272
+
273
+ /**
274
+ * Checks the cache for the given node and returns its status.
275
+ *
276
+ * Possible return values:
277
+ * - `false`: No cached data found for the node.
278
+ * - `'ssr'`: Data is cached from server-side rendering (SSR).
279
+ * - `'network'`: Data is cached from a network request.
280
+ *
281
+ * @param node The node (or its ProseMirror representation) to check in the cache.
282
+ * @returns The cache status: `false`, `'ssr'`, or `'network'`.
283
+ */
284
+ }, {
285
+ key: "getCacheStatusForNode",
286
+ value: function getCacheStatusForNode(node) {
287
+ var jsonNode = 'toJSON' in node ? node.toJSON() : node;
288
+ if (!this.isNodeSupported(jsonNode)) {
289
+ // eslint-disable-next-line no-console
290
+ console.error("The ".concat(this.constructor.name, " doesn't support Node ").concat(jsonNode.type, "."));
291
+ return false;
292
+ }
293
+ var dataKey = this.nodeDataKey(jsonNode);
294
+ var dataFromCache = this.cache[dataKey];
295
+ return dataFromCache ? dataFromCache.source : false;
296
+ }
272
297
  }]);
273
298
  }();
274
299
  function isPromise(value) {
@@ -134,5 +134,17 @@ export declare abstract class NodeDataProvider<Node extends JSONNode, Data> {
134
134
  * @returns A promise that resolves with the node's data.
135
135
  */
136
136
  getDataAsPromise_DO_NOT_USE_OUTSIDE_MIGRATIONS(node: Node | PMNode): Promise<Data>;
137
+ /**
138
+ * Checks the cache for the given node and returns its status.
139
+ *
140
+ * Possible return values:
141
+ * - `false`: No cached data found for the node.
142
+ * - `'ssr'`: Data is cached from server-side rendering (SSR).
143
+ * - `'network'`: Data is cached from a network request.
144
+ *
145
+ * @param node The node (or its ProseMirror representation) to check in the cache.
146
+ * @returns The cache status: `false`, `'ssr'`, or `'network'`.
147
+ */
148
+ getCacheStatusForNode(node: Node | PMNode): false | 'ssr' | 'network';
137
149
  }
138
150
  export {};
@@ -134,5 +134,17 @@ export declare abstract class NodeDataProvider<Node extends JSONNode, Data> {
134
134
  * @returns A promise that resolves with the node's data.
135
135
  */
136
136
  getDataAsPromise_DO_NOT_USE_OUTSIDE_MIGRATIONS(node: Node | PMNode): Promise<Data>;
137
+ /**
138
+ * Checks the cache for the given node and returns its status.
139
+ *
140
+ * Possible return values:
141
+ * - `false`: No cached data found for the node.
142
+ * - `'ssr'`: Data is cached from server-side rendering (SSR).
143
+ * - `'network'`: Data is cached from a network request.
144
+ *
145
+ * @param node The node (or its ProseMirror representation) to check in the cache.
146
+ * @returns The cache status: `false`, `'ssr'`, or `'network'`.
147
+ */
148
+ getCacheStatusForNode(node: Node | PMNode): false | 'ssr' | 'network';
137
149
  }
138
150
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/node-data-provider",
3
- "version": "4.5.3",
3
+ "version": "4.6.0",
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",
@@ -18,18 +18,15 @@
18
18
  "types": "dist/types/index.d.ts",
19
19
  "sideEffects": false,
20
20
  "atlaskit:src": "src/index.ts",
21
- "af:exports": {
22
- ".": "./src/index.ts"
23
- },
24
21
  "dependencies": {
25
- "@atlaskit/adf-schema": "^50.2.1",
22
+ "@atlaskit/adf-schema": "^50.2.3",
26
23
  "@atlaskit/adf-utils": "^19.21.0",
27
24
  "@atlaskit/editor-json-transformer": "^8.27.0",
28
25
  "@atlaskit/editor-prosemirror": "7.0.0",
29
26
  "@babel/runtime": "^7.0.0"
30
27
  },
31
28
  "peerDependencies": {
32
- "@atlaskit/editor-common": "^107.29.0"
29
+ "@atlaskit/editor-common": "^107.33.0"
33
30
  },
34
31
  "techstack": {
35
32
  "@atlassian/frontend": {