@enonic-types/lib-grid 0.1.0 → 7.11.0-B1
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/grid.d.ts +78 -71
- package/package.json +1 -5
package/grid.d.ts
CHANGED
|
@@ -1,71 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* @param {
|
|
50
|
-
* @param {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* @param {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Grid related functions.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* var gridLib = require('/lib/xp/grid');
|
|
6
|
+
*
|
|
7
|
+
* @module grid
|
|
8
|
+
*/
|
|
9
|
+
declare global {
|
|
10
|
+
interface XpLibraries {
|
|
11
|
+
'/lib/xp/grid': typeof import('./grid');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare type SharedMapValueType = string | number | boolean | object | null;
|
|
15
|
+
export declare type SharedMapModifierFn = (oldValue: SharedMapValueType) => SharedMapValueType;
|
|
16
|
+
export interface SetParams {
|
|
17
|
+
key: string;
|
|
18
|
+
value: SharedMapValueType;
|
|
19
|
+
ttlSeconds?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ModifyParams {
|
|
22
|
+
key: string;
|
|
23
|
+
func: SharedMapModifierFn;
|
|
24
|
+
ttlSeconds?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Shared Map is similar to other Map, but its instances are shared across all applications and even cluster nodes.
|
|
28
|
+
|
|
29
|
+
WARNING: Due to distributed nature of the Shared Map not all types of keys and values can be used. Strings, numbers, and pure JSON objects are supported. There is no runtime check for type compatibility due to performance reasons. The developer is also responsible for not modifying shared objects (keys and values) in place.
|
|
30
|
+
* @param mapId - map identifier
|
|
31
|
+
* @constructor
|
|
32
|
+
*/
|
|
33
|
+
export declare class SharedMap {
|
|
34
|
+
private map;
|
|
35
|
+
constructor(mapId: string);
|
|
36
|
+
/**
|
|
37
|
+
* Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} key - key the key whose associated value is to be returned
|
|
40
|
+
* @returns {string|number|boolean|JSON|null} the value to which the specified key is mapped, or null if this map contains no mapping for the key
|
|
41
|
+
*/
|
|
42
|
+
get(key: string): SharedMapValueType;
|
|
43
|
+
/**
|
|
44
|
+
* Puts an entry into this map with a given time to live (TTL).
|
|
45
|
+
* If value is null, the existing entry will be removed.
|
|
46
|
+
*
|
|
47
|
+
* @param {object} params JSON with the parameters.
|
|
48
|
+
* @param {string} params.key key of the entry
|
|
49
|
+
* @param {string|number|boolean|JSON|null} params.value value of the entry
|
|
50
|
+
* @param {number} [params.ttlSeconds] maximum time to live in seconds for this entry to stay in the map. (0 means infinite, negative means map config default or infinite if map config is not available)
|
|
51
|
+
*/
|
|
52
|
+
set(params: SetParams): void;
|
|
53
|
+
/**
|
|
54
|
+
* Attempts to compute a mapping for the specified key and its current mapped value.
|
|
55
|
+
*
|
|
56
|
+
* @param {object} params JSON with the parameters.
|
|
57
|
+
* @param {string} params.key key of the entry
|
|
58
|
+
* @param {function} params.func mapping function that accepts the existing mapped value (or null, if there is no associated mapping).
|
|
59
|
+
* The returned value replaces the existing mapped value for the specified key.
|
|
60
|
+
* If returned value is null then the value is removed from the map
|
|
61
|
+
* @param {number} [params.ttlSeconds] maximum time to live in seconds for this entry to stay in the map. (0 means infinite, negative means map config default or infinite if map config is not available)
|
|
62
|
+
* @returns the new value to which the specified key is mapped, or null if this map no longer contains mapping for the key
|
|
63
|
+
*/
|
|
64
|
+
modify(params: ModifyParams): SharedMapValueType;
|
|
65
|
+
/**
|
|
66
|
+
* Removes the mapping for the key from this map if it is present.
|
|
67
|
+
*
|
|
68
|
+
* @param {string} key the key whose associated value is to be removed
|
|
69
|
+
*/
|
|
70
|
+
delete(key: string): void;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns an instance of SharedMap by the specified map identifier.
|
|
74
|
+
*
|
|
75
|
+
* @param {string} mapId map identifier
|
|
76
|
+
* @returns {SharedMap} an instance of SharedMap
|
|
77
|
+
*/
|
|
78
|
+
export declare function getMap(mapId: string): SharedMap;
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-grid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.11.0-B1",
|
|
4
4
|
"description": "Type definitions for lib-grid.",
|
|
5
5
|
"types": "grid.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"grid.d.ts"
|
|
8
8
|
],
|
|
9
|
-
"scripts": {
|
|
10
|
-
"pre": "npm run --prefix ../ pre",
|
|
11
|
-
"packlist": "npx npm-packlist"
|
|
12
|
-
},
|
|
13
9
|
"repository": {
|
|
14
10
|
"type": "git",
|
|
15
11
|
"url": "git+https://github.com/enonic/xp.git#master"
|