diff --git a/.eslintrc.json b/.eslintrc.json index 20ca80b..f80fe73 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,6 +7,7 @@ "@typescript-eslint/ban-types": "off", "@typescript-eslint/no-namespace": "off", "@typescript-eslint/triple-slash-reference": "off", - "@typescript-eslint/no-unused-vars": "off" + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-empty-interface": "off" } } \ No newline at end of file diff --git a/README.md b/README.md index 37cd6e8..ef46d36 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ declare const __non_webpack_require__: =16.0.0" @@ -232,12 +232,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.28.0.tgz", - "integrity": "sha512-SyKjKh4CXPglueyC6ceAFytjYWMoPHMswPQae236zqe1YbhvCVQyIawesYywGiu98L9DwrxsBN69vGIVxJ4mQQ==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.29.0.tgz", + "integrity": "sha512-JK6bAaaiJozbox3K220VRfCzLa9n0ib/J+FHIwnaV3Enw/TO267qe0pM1b1QrrEuy6xun374XEAsRlA86JJnyg==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.28.0", + "@typescript-eslint/utils": "5.29.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -258,9 +258,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.28.0.tgz", - "integrity": "sha512-2OOm8ZTOQxqkPbf+DAo8oc16sDlVR5owgJfKheBkxBKg1vAfw2JsSofH9+16VPlN9PWtv8Wzhklkqw3k/zCVxA==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.29.0.tgz", + "integrity": "sha512-X99VbqvAXOMdVyfFmksMy3u8p8yoRGITgU1joBJPzeYa0rhdf5ok9S56/itRoUSh99fiDoMtarSIJXo7H/SnOg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -271,13 +271,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.28.0.tgz", - "integrity": "sha512-9GX+GfpV+F4hdTtYc6OV9ZkyYilGXPmQpm6AThInpBmKJEyRSIjORJd1G9+bknb7OTFYL+Vd4FBJAO6T78OVqA==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.29.0.tgz", + "integrity": "sha512-mQvSUJ/JjGBdvo+1LwC+GY2XmSYjK1nAaVw2emp/E61wEVYEyibRHCqm1I1vEKbXCpUKuW4G7u9ZCaZhJbLoNQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.28.0", - "@typescript-eslint/visitor-keys": "5.28.0", + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/visitor-keys": "5.29.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -298,15 +298,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.28.0.tgz", - "integrity": "sha512-E60N5L0fjv7iPJV3UGc4EC+A3Lcj4jle9zzR0gW7vXhflO7/J29kwiTGITA2RlrmPokKiZbBy2DgaclCaEUs6g==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.29.0.tgz", + "integrity": "sha512-3Eos6uP1nyLOBayc/VUdKZikV90HahXE5Dx9L5YlSd/7ylQPXhLk1BYb29SDgnBnTp+jmSZUU0QxUiyHgW4p7A==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.28.0", - "@typescript-eslint/types": "5.28.0", - "@typescript-eslint/typescript-estree": "5.28.0", + "@typescript-eslint/scope-manager": "5.29.0", + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/typescript-estree": "5.29.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -322,12 +322,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.28.0.tgz", - "integrity": "sha512-BtfP1vCor8cWacovzzPFOoeW4kBQxzmhxGoOpt0v1SFvG+nJ0cWaVdJk7cky1ArTcFHHKNIxyo2LLr3oNkSuXA==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.29.0.tgz", + "integrity": "sha512-Hpb/mCWsjILvikMQoZIE3voc9wtQcS0A9FUw3h8bhr9UxBdtI/tw1ZDZUOXHXLOVMedKCH5NxyzATwnU78bWCQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.28.0", + "@typescript-eslint/types": "5.29.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -698,9 +698,9 @@ } }, "node_modules/eslint": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.17.0.tgz", - "integrity": "sha512-gq0m0BTJfci60Fz4nczYxNAlED+sMcihltndR8t9t1evnU/azx53x3t2UHXC/uRjcbvRw/XctpaNygSTcQD+Iw==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz", + "integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==", "dev": true, "dependencies": { "@eslint/eslintrc": "^1.3.0", @@ -1613,9 +1613,9 @@ } }, "node_modules/prettier": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.0.tgz", - "integrity": "sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -2012,9 +2012,9 @@ } }, "node_modules/typescript": { - "version": "4.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz", - "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==", + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -2273,14 +2273,14 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.28.0.tgz", - "integrity": "sha512-DXVU6Cg29H2M6EybqSg2A+x8DgO9TCUBRp4QEXQHJceLS7ogVDP0g3Lkg/SZCqcvkAP/RruuQqK0gdlkgmhSUA==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.29.0.tgz", + "integrity": "sha512-kgTsISt9pM53yRFQmLZ4npj99yGl3x3Pl7z4eA66OuTzAGC4bQB5H5fuLwPnqTKU3yyrrg4MIhjF17UYnL4c0w==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.28.0", - "@typescript-eslint/type-utils": "5.28.0", - "@typescript-eslint/utils": "5.28.0", + "@typescript-eslint/scope-manager": "5.29.0", + "@typescript-eslint/type-utils": "5.29.0", + "@typescript-eslint/utils": "5.29.0", "debug": "^4.3.4", "functional-red-black-tree": "^1.0.1", "ignore": "^5.2.0", @@ -2290,52 +2290,52 @@ } }, "@typescript-eslint/parser": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.28.0.tgz", - "integrity": "sha512-ekqoNRNK1lAcKhZESN/PdpVsWbP9jtiNqzFWkp/yAUdZvJalw2heCYuqRmM5eUJSIYEkgq5sGOjq+ZqsLMjtRA==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.29.0.tgz", + "integrity": "sha512-ruKWTv+x0OOxbzIw9nW5oWlUopvP/IQDjB5ZqmTglLIoDTctLlAJpAQFpNPJP/ZI7hTT9sARBosEfaKbcFuECw==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.28.0", - "@typescript-eslint/types": "5.28.0", - "@typescript-eslint/typescript-estree": "5.28.0", + "@typescript-eslint/scope-manager": "5.29.0", + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/typescript-estree": "5.29.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.28.0.tgz", - "integrity": "sha512-LeBLTqF/he1Z+boRhSqnso6YrzcKMTQ8bO/YKEe+6+O/JGof9M0g3IJlIsqfrK/6K03MlFIlycbf1uQR1IjE+w==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.29.0.tgz", + "integrity": "sha512-etbXUT0FygFi2ihcxDZjz21LtC+Eps9V2xVx09zFoN44RRHPrkMflidGMI+2dUs821zR1tDS6Oc9IXxIjOUZwA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.28.0", - "@typescript-eslint/visitor-keys": "5.28.0" + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/visitor-keys": "5.29.0" } }, "@typescript-eslint/type-utils": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.28.0.tgz", - "integrity": "sha512-SyKjKh4CXPglueyC6ceAFytjYWMoPHMswPQae236zqe1YbhvCVQyIawesYywGiu98L9DwrxsBN69vGIVxJ4mQQ==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.29.0.tgz", + "integrity": "sha512-JK6bAaaiJozbox3K220VRfCzLa9n0ib/J+FHIwnaV3Enw/TO267qe0pM1b1QrrEuy6xun374XEAsRlA86JJnyg==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.28.0", + "@typescript-eslint/utils": "5.29.0", "debug": "^4.3.4", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.28.0.tgz", - "integrity": "sha512-2OOm8ZTOQxqkPbf+DAo8oc16sDlVR5owgJfKheBkxBKg1vAfw2JsSofH9+16VPlN9PWtv8Wzhklkqw3k/zCVxA==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.29.0.tgz", + "integrity": "sha512-X99VbqvAXOMdVyfFmksMy3u8p8yoRGITgU1joBJPzeYa0rhdf5ok9S56/itRoUSh99fiDoMtarSIJXo7H/SnOg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.28.0.tgz", - "integrity": "sha512-9GX+GfpV+F4hdTtYc6OV9ZkyYilGXPmQpm6AThInpBmKJEyRSIjORJd1G9+bknb7OTFYL+Vd4FBJAO6T78OVqA==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.29.0.tgz", + "integrity": "sha512-mQvSUJ/JjGBdvo+1LwC+GY2XmSYjK1nAaVw2emp/E61wEVYEyibRHCqm1I1vEKbXCpUKuW4G7u9ZCaZhJbLoNQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.28.0", - "@typescript-eslint/visitor-keys": "5.28.0", + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/visitor-keys": "5.29.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2344,26 +2344,26 @@ } }, "@typescript-eslint/utils": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.28.0.tgz", - "integrity": "sha512-E60N5L0fjv7iPJV3UGc4EC+A3Lcj4jle9zzR0gW7vXhflO7/J29kwiTGITA2RlrmPokKiZbBy2DgaclCaEUs6g==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.29.0.tgz", + "integrity": "sha512-3Eos6uP1nyLOBayc/VUdKZikV90HahXE5Dx9L5YlSd/7ylQPXhLk1BYb29SDgnBnTp+jmSZUU0QxUiyHgW4p7A==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.28.0", - "@typescript-eslint/types": "5.28.0", - "@typescript-eslint/typescript-estree": "5.28.0", + "@typescript-eslint/scope-manager": "5.29.0", + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/typescript-estree": "5.29.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/visitor-keys": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.28.0.tgz", - "integrity": "sha512-BtfP1vCor8cWacovzzPFOoeW4kBQxzmhxGoOpt0v1SFvG+nJ0cWaVdJk7cky1ArTcFHHKNIxyo2LLr3oNkSuXA==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.29.0.tgz", + "integrity": "sha512-Hpb/mCWsjILvikMQoZIE3voc9wtQcS0A9FUw3h8bhr9UxBdtI/tw1ZDZUOXHXLOVMedKCH5NxyzATwnU78bWCQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.28.0", + "@typescript-eslint/types": "5.29.0", "eslint-visitor-keys": "^3.3.0" } }, @@ -2655,9 +2655,9 @@ "dev": true }, "eslint": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.17.0.tgz", - "integrity": "sha512-gq0m0BTJfci60Fz4nczYxNAlED+sMcihltndR8t9t1evnU/azx53x3t2UHXC/uRjcbvRw/XctpaNygSTcQD+Iw==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz", + "integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==", "dev": true, "requires": { "@eslint/eslintrc": "^1.3.0", @@ -3375,9 +3375,9 @@ "dev": true }, "prettier": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.0.tgz", - "integrity": "sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", "dev": true }, "prettier-linter-helpers": { @@ -3660,9 +3660,9 @@ "dev": true }, "typescript": { - "version": "4.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz", - "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==", + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "dev": true }, "untildify": { diff --git a/package.json b/package.json index c0ee1ad..14a3fc4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "enonic-types", "sideEffects": false, - "version": "0.4.9", + "version": "0.4.10", "description": "TypeScript types for Enonic XP", "typings": "index.d.ts", "scripts": { @@ -26,15 +26,15 @@ }, "homepage": "https://github.com/ItemConsulting/enonic-types#readme", "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.28.0", - "@typescript-eslint/parser": "^5.28.0", + "@typescript-eslint/eslint-plugin": "^5.29.0", + "@typescript-eslint/parser": "^5.29.0", "copyfiles": "^2.4.1", - "eslint": "^8.17.0", + "eslint": "^8.18.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.0.0", "json-schema-to-typescript": "^10.1.5", - "prettier": "^2.7.0", + "prettier": "^2.7.1", "rimraf": "^3.0.2", - "typescript": "^4.7.3" + "typescript": "^4.7.4" } } diff --git a/src/grid.ts b/src/grid.ts new file mode 100644 index 0000000..eafbd5c --- /dev/null +++ b/src/grid.ts @@ -0,0 +1,79 @@ +declare module "*/lib/xp/grid" { + namespace gridLib { + export type GridMap = Record; + + /** + * @since 7.10.0 + */ + interface GridLibrary { + /** + * Returns an instance of Shared Memory (Shared Map) by the specified map identifier. + */ + getMap(mapId: string): SharedMemory; + } + + export interface SharedMemory { + /** + * Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. + */ + get(key: Key): Map[Key] | null; + + /** + * Puts an entry into this map with a given time to live (TTL). + * If value is null, the existing entry will be removed. + */ + set(params: SetParams): void; + + /** + * Removes the mapping for the key from this map if it is present. + */ + delete(key: keyof Map): void; + + /** + * Attempts to compute a mapping for the specified key and its current mapped value. + */ + modify(params: ModifyParams): void; + } + + export interface SetParams { + /** + * Key of the entry + */ + key: Key; + + /** + * Value of the entry + */ + value: Map[Key]; + + /** + * 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) + */ + ttlSeconds?: number; + } + + interface ModifyParams { + /** + * Key of the entry + */ + key: Key; + + /** + * Mapping function that accepts the existing mapped value (or null, if there is no associated mapping). + * The returned value replaces the existing mapped value for the specified key. + * If returned value is null then the value is removed from the map + */ + func: (value: Map[Key]) => Map[Key]; + + /** + * 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) + */ + ttlSeconds?: number; + } + } + + const gridLib: gridLib.GridLibrary; + export = gridLib; +} diff --git a/src/index.ts b/src/index.ts index 48fd9b1..b2772f0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,6 +14,7 @@ /// /// /// +/// /// /// /// diff --git a/src/libs.ts b/src/libs.ts index 33802e1..4bfe6f4 100644 --- a/src/libs.ts +++ b/src/libs.ts @@ -22,6 +22,7 @@ export interface EnonicLibraryMap { "/lib/tineikt/freemarker": typeof import("/lib/tineikt/freemarker"); "/lib/graphql": typeof import("/lib/graphql"); "/lib/graphql-playground": typeof import("/lib/graphql-playground"); + "/lib/xp/grid": typeof import("/lib/xp/grid"); "/lib/guillotine": typeof import("/lib/guillotine"); "/lib/http-client": typeof import("/lib/http-client"); "/lib/xp/i18n": typeof import("/lib/xp/i18n");