@atlaskit/media-common 13.0.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 +7 -0
- package/dist/cjs/copyIntent/clientIdCache.js +7 -10
- package/dist/es2019/copyIntent/clientIdCache.js +7 -10
- package/dist/esm/copyIntent/clientIdCache.js +7 -10
- package/dist/types/copyIntent/clientIdCache.d.ts +5 -3
- package/dist/types-ts4.5/copyIntent/clientIdCache.d.ts +5 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
|
|
3
10
|
## 13.0.0
|
|
4
11
|
|
|
5
12
|
### Major 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
|
|
14
|
-
*
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
|
8
|
-
*
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
|
8
|
-
*
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
|
8
|
-
*
|
|
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
|
|
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
|
/**
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Used for cross-client copy/paste scenarios
|
|
6
6
|
*
|
|
7
|
-
* Entries
|
|
8
|
-
*
|
|
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
|
|
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
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-common",
|
|
3
|
-
"version": "13.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,7 +31,7 @@
|
|
|
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.
|
|
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",
|