@atlaskit/media-common 12.4.0 → 13.0.1

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,20 @@
1
1
  # @atlaskit/media-common
2
2
 
3
+ ## 13.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`539f26aebdac4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/539f26aebdac4) -
8
+ Update CopyIntent clientId cache to be mutli use following LRU principles
9
+
10
+ ## 13.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - [`bc6f294d90d3f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bc6f294d90d3f) -
15
+ Upgrade immer dependency to 11.1.4 (COMMIT-24745). Addresses dependency debt and version conflicts
16
+ for downstream consumers. Uses `produce` API which is compatible across v8–v11.
17
+
3
18
  ## 12.4.0
4
19
 
5
20
  ### Minor Changes
@@ -10,11 +10,12 @@ exports.setClientIdForFile = exports.getClientIdForFile = exports.extractClientI
10
10
  *
11
11
  * Used for cross-client copy/paste scenarios
12
12
  *
13
- * Entries are one-time use (consumed on read), with a max size limit
14
- * to guard against build-up if entries are never consumed (should not happpen).
13
+ * Entries persist across reads to support multiple pastes of the same content.
14
+ * An LRU-style max size limit guards against unbounded growth the oldest entry
15
+ * is evicted whenever the cache exceeds CLIENT_ID_CACHE_MAX_SIZE.
15
16
  */
16
17
 
17
- var CLIENT_ID_CACHE_MAX_SIZE = 100;
18
+ var CLIENT_ID_CACHE_MAX_SIZE = 20;
18
19
  var clientIdCache = new Map();
19
20
  var setClientIdForFile = exports.setClientIdForFile = function setClientIdForFile(fileId, clientId) {
20
21
  clientIdCache.set(fileId, clientId);
@@ -29,16 +30,12 @@ var setClientIdForFile = exports.setClientIdForFile = function setClientIdForFil
29
30
  };
30
31
 
31
32
  /**
32
- * Retrieve and consume clientId for a file ID (called during copyFile)
33
+ * Retrieve clientId for a file ID (called during copyFile).
33
34
  * Returns undefined if not found.
35
+ * Entries are NOT consumed on read — the same file can be pasted multiple times.
34
36
  */
35
37
  var getClientIdForFile = exports.getClientIdForFile = function getClientIdForFile(fileId) {
36
- var clientId = clientIdCache.get(fileId);
37
- // Consume the entry after reading (one-time use)
38
- if (clientId) {
39
- clientIdCache.delete(fileId);
40
- }
41
- return clientId;
38
+ return clientIdCache.get(fileId);
42
39
  };
43
40
 
44
41
  /**
@@ -4,11 +4,12 @@
4
4
  *
5
5
  * Used for cross-client copy/paste scenarios
6
6
  *
7
- * Entries are one-time use (consumed on read), with a max size limit
8
- * to guard against build-up if entries are never consumed (should not happpen).
7
+ * Entries persist across reads to support multiple pastes of the same content.
8
+ * An LRU-style max size limit guards against unbounded growth the oldest entry
9
+ * is evicted whenever the cache exceeds CLIENT_ID_CACHE_MAX_SIZE.
9
10
  */
10
11
 
11
- const CLIENT_ID_CACHE_MAX_SIZE = 100;
12
+ const CLIENT_ID_CACHE_MAX_SIZE = 20;
12
13
  const clientIdCache = new Map();
13
14
  export const setClientIdForFile = (fileId, clientId) => {
14
15
  clientIdCache.set(fileId, clientId);
@@ -23,16 +24,12 @@ export const setClientIdForFile = (fileId, clientId) => {
23
24
  };
24
25
 
25
26
  /**
26
- * Retrieve and consume clientId for a file ID (called during copyFile)
27
+ * Retrieve clientId for a file ID (called during copyFile).
27
28
  * Returns undefined if not found.
29
+ * Entries are NOT consumed on read — the same file can be pasted multiple times.
28
30
  */
29
31
  export const getClientIdForFile = fileId => {
30
- const clientId = clientIdCache.get(fileId);
31
- // Consume the entry after reading (one-time use)
32
- if (clientId) {
33
- clientIdCache.delete(fileId);
34
- }
35
- return clientId;
32
+ return clientIdCache.get(fileId);
36
33
  };
37
34
 
38
35
  /**
@@ -4,11 +4,12 @@
4
4
  *
5
5
  * Used for cross-client copy/paste scenarios
6
6
  *
7
- * Entries are one-time use (consumed on read), with a max size limit
8
- * to guard against build-up if entries are never consumed (should not happpen).
7
+ * Entries persist across reads to support multiple pastes of the same content.
8
+ * An LRU-style max size limit guards against unbounded growth the oldest entry
9
+ * is evicted whenever the cache exceeds CLIENT_ID_CACHE_MAX_SIZE.
9
10
  */
10
11
 
11
- var CLIENT_ID_CACHE_MAX_SIZE = 100;
12
+ var CLIENT_ID_CACHE_MAX_SIZE = 20;
12
13
  var clientIdCache = new Map();
13
14
  export var setClientIdForFile = function setClientIdForFile(fileId, clientId) {
14
15
  clientIdCache.set(fileId, clientId);
@@ -23,16 +24,12 @@ export var setClientIdForFile = function setClientIdForFile(fileId, clientId) {
23
24
  };
24
25
 
25
26
  /**
26
- * Retrieve and consume clientId for a file ID (called during copyFile)
27
+ * Retrieve clientId for a file ID (called during copyFile).
27
28
  * Returns undefined if not found.
29
+ * Entries are NOT consumed on read — the same file can be pasted multiple times.
28
30
  */
29
31
  export var getClientIdForFile = function getClientIdForFile(fileId) {
30
- var clientId = clientIdCache.get(fileId);
31
- // Consume the entry after reading (one-time use)
32
- if (clientId) {
33
- clientIdCache.delete(fileId);
34
- }
35
- return clientId;
32
+ return clientIdCache.get(fileId);
36
33
  };
37
34
 
38
35
  /**
@@ -4,13 +4,15 @@
4
4
  *
5
5
  * Used for cross-client copy/paste scenarios
6
6
  *
7
- * Entries are one-time use (consumed on read), with a max size limit
8
- * to guard against build-up if entries are never consumed (should not happpen).
7
+ * Entries persist across reads to support multiple pastes of the same content.
8
+ * An LRU-style max size limit guards against unbounded growth the oldest entry
9
+ * is evicted whenever the cache exceeds CLIENT_ID_CACHE_MAX_SIZE.
9
10
  */
10
11
  export declare const setClientIdForFile: (fileId: string, clientId: string) => void;
11
12
  /**
12
- * Retrieve and consume clientId for a file ID (called during copyFile)
13
+ * Retrieve clientId for a file ID (called during copyFile).
13
14
  * Returns undefined if not found.
15
+ * Entries are NOT consumed on read — the same file can be pasted multiple times.
14
16
  */
15
17
  export declare const getClientIdForFile: (fileId: string) => string | undefined;
16
18
  /**
@@ -1 +1 @@
1
- export { setClientIdForFile, getClientIdForFile, clearClientIdCache, extractClientIdsFromHtml } from './clientIdCache';
1
+ export { setClientIdForFile, getClientIdForFile, clearClientIdCache, extractClientIdsFromHtml, } from './clientIdCache';
@@ -4,13 +4,15 @@
4
4
  *
5
5
  * Used for cross-client copy/paste scenarios
6
6
  *
7
- * Entries are one-time use (consumed on read), with a max size limit
8
- * to guard against build-up if entries are never consumed (should not happpen).
7
+ * Entries persist across reads to support multiple pastes of the same content.
8
+ * An LRU-style max size limit guards against unbounded growth the oldest entry
9
+ * is evicted whenever the cache exceeds CLIENT_ID_CACHE_MAX_SIZE.
9
10
  */
10
11
  export declare const setClientIdForFile: (fileId: string, clientId: string) => void;
11
12
  /**
12
- * Retrieve and consume clientId for a file ID (called during copyFile)
13
+ * Retrieve clientId for a file ID (called during copyFile).
13
14
  * Returns undefined if not found.
15
+ * Entries are NOT consumed on read — the same file can be pasted multiple times.
14
16
  */
15
17
  export declare const getClientIdForFile: (fileId: string) => string | undefined;
16
18
  /**
@@ -1 +1 @@
1
- export { setClientIdForFile, getClientIdForFile, clearClientIdCache, extractClientIdsFromHtml } from './clientIdCache';
1
+ export { setClientIdForFile, getClientIdForFile, clearClientIdCache, extractClientIdsFromHtml, } from './clientIdCache';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "12.4.0",
3
+ "version": "13.0.1",
4
4
  "description": "Includes common utilities used by other media packages",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,11 +31,11 @@
31
31
  "dependencies": {
32
32
  "@atlaskit/analytics-gas-types": "^5.1.0",
33
33
  "@atlaskit/analytics-namespaced-context": "^7.2.0",
34
- "@atlaskit/analytics-next": "^11.1.0",
34
+ "@atlaskit/analytics-next": "^11.2.0",
35
35
  "@atlaskit/link": "^3.3.0",
36
36
  "@atlaskit/section-message": "^8.12.0",
37
37
  "@babel/runtime": "^7.0.0",
38
- "immer": "^9.0.12",
38
+ "immer": "11.1.4",
39
39
  "uuid-validate": "^0.0.3"
40
40
  },
41
41
  "peerDependencies": {