From 9ef30d1f49c492815e760bcf4cfa3267e7a43afe Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 28 Apr 2022 11:55:38 +0200 Subject: [PATCH] New query rendering engine with handlebars --- package-lock.json | 317 ++++ package.json | 8 +- packages/common/preload_modules.ts | 2 +- .../plugos/environments/sandbox_worker.ts | 1 + packages/plugs/build/test/engine.test.js | 468 ++++++ packages/plugs/build/test/engine.test.js.map | 1 + packages/plugs/core/item.ts | 9 +- packages/plugs/core/page.ts | 37 +- packages/plugs/github/github.plug.yaml | 6 + packages/plugs/github/github.ts | 84 + packages/plugs/mattermost/mattermost.ts | 72 +- packages/plugs/package-lock.json | 1427 +++++++++++++++++ packages/plugs/package.json | 20 +- .../plugs/plugmanager/plugmanager.plug.yaml | 6 + packages/plugs/plugmanager/plugmanager.ts | 13 +- packages/plugs/query/data.ts | 5 +- packages/plugs/query/engine.test.ts | 23 + packages/plugs/query/engine.ts | 104 +- packages/plugs/query/materialized_queries.ts | 11 +- packages/plugs/query/parse-query.js | 27 +- packages/plugs/query/parse-query.terms.js | 10 +- packages/plugs/query/query.grammar | 8 +- packages/plugs/tasks/task.ts | 11 +- packages/server/package.json | 2 +- 24 files changed, 2560 insertions(+), 112 deletions(-) create mode 100644 packages/plugs/build/test/engine.test.js create mode 100644 packages/plugs/build/test/engine.test.js.map create mode 100644 packages/plugs/github/github.plug.yaml create mode 100644 packages/plugs/github/github.ts create mode 100644 packages/plugs/package-lock.json diff --git a/package-lock.json b/package-lock.json index ecea16f..79dd9ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,9 @@ "workspaces": [ "packages/*" ], + "dependencies": { + "handlebars": "^4.7.7" + }, "devDependencies": { "@parcel/core": "2.3.2", "@parcel/packager-raw-url": "2.3.2", @@ -21,6 +24,7 @@ "@parcel/validator-typescript": "2.3.2", "parcel": "2.3.2", "prettier": "^2.5.1", + "ts-node": "^10.7.0", "typescript": "^4.6.2" } }, @@ -763,6 +767,27 @@ "w3c-keyname": "^2.2.4" } }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "devOptional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "devOptional": true, + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@fortawesome/fontawesome-common-types": { "version": "0.3.0", "hasInstallScript": true, @@ -2356,6 +2381,30 @@ "node": ">=10.13.0" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "devOptional": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "devOptional": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "devOptional": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "devOptional": true + }, "node_modules/@types/babel__core": { "version": "7.1.19", "license": "MIT", @@ -2818,6 +2867,12 @@ "readable-stream": "^2.0.6" } }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "devOptional": true + }, "node_modules/argparse": { "version": "1.0.10", "license": "MIT", @@ -3601,6 +3656,12 @@ "node": ">=10" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "devOptional": true + }, "node_modules/crelt": { "version": "1.0.5", "license": "MIT" @@ -3927,6 +3988,15 @@ "wrappy": "1" } }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "devOptional": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/diff-sequences": { "version": "27.5.1", "license": "MIT", @@ -4842,6 +4912,26 @@ "version": "4.2.10", "license": "ISC" }, + "node_modules/handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, "node_modules/has": { "version": "1.0.3", "license": "MIT", @@ -6716,6 +6806,12 @@ "semver": "bin/semver.js" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "devOptional": true + }, "node_modules/makeerror": { "version": "1.0.12", "license": "BSD-3-Clause", @@ -6946,6 +7042,11 @@ "node": ">= 0.6" } }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, "node_modules/node-abi": { "version": "3.15.0", "license": "MIT", @@ -9098,6 +9199,58 @@ "node": ">=8" } }, + "node_modules/ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "devOptional": true, + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "devOptional": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/tunnel-agent": { "version": "0.6.0", "license": "Apache-2.0", @@ -9188,6 +9341,18 @@ "version": "1.0.6", "license": "MIT" }, + "node_modules/uglify-js": { + "version": "3.15.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.4.tgz", + "integrity": "sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA==", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/unbox-primitive": { "version": "1.0.1", "dev": true, @@ -9316,6 +9481,12 @@ "dev": true, "license": "MIT" }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "devOptional": true + }, "node_modules/v8-to-istanbul": { "version": "8.1.1", "license": "ISC", @@ -9516,6 +9687,11 @@ "node": ">=0.10.0" } }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, "node_modules/wrap-ansi": { "version": "7.0.0", "license": "MIT", @@ -9663,6 +9839,15 @@ "node": ">=8" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "devOptional": true, + "engines": { + "node": ">=6" + } + }, "packages/common": { "name": "@silverbulletmd/common", "version": "0.0.1", @@ -10382,6 +10567,21 @@ "w3c-keyname": "^2.2.4" } }, + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "devOptional": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "devOptional": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, "@fortawesome/fontawesome-common-types": { "version": "0.3.0" }, @@ -11461,6 +11661,30 @@ "version": "0.2.0", "dev": true }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "devOptional": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "devOptional": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "devOptional": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "devOptional": true + }, "@types/babel__core": { "version": "7.1.19", "requires": { @@ -11809,6 +12033,12 @@ "readable-stream": "^2.0.6" } }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "devOptional": true + }, "argparse": { "version": "1.0.10", "requires": { @@ -12284,6 +12514,12 @@ "yaml": "^1.10.0" } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "devOptional": true + }, "crelt": { "version": "1.0.5" }, @@ -12479,6 +12715,12 @@ "wrappy": "1" } }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "devOptional": true + }, "diff-sequences": { "version": "27.5.1" }, @@ -13055,6 +13297,18 @@ "graceful-fs": { "version": "4.2.10" }, + "handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, "has": { "version": "1.0.3", "requires": { @@ -14189,6 +14443,12 @@ } } }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "devOptional": true + }, "makeerror": { "version": "1.0.12", "requires": { @@ -14327,6 +14587,11 @@ "negotiator": { "version": "0.6.3" }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, "node-abi": { "version": "3.15.0", "requires": { @@ -15598,6 +15863,35 @@ "punycode": "^2.1.1" } }, + "ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "devOptional": true, + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "dependencies": { + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "devOptional": true + } + } + }, "tunnel-agent": { "version": "0.6.0", "requires": { @@ -15647,6 +15941,12 @@ "uc.micro": { "version": "1.0.6" }, + "uglify-js": { + "version": "3.15.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.4.tgz", + "integrity": "sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA==", + "optional": true + }, "unbox-primitive": { "version": "1.0.1", "dev": true, @@ -15731,6 +16031,12 @@ "version": "2.3.0", "dev": true }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "devOptional": true + }, "v8-to-istanbul": { "version": "8.1.1", "requires": { @@ -15861,6 +16167,11 @@ "word-wrap": { "version": "1.2.3" }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, "wrap-ansi": { "version": "7.0.0", "requires": { @@ -15947,6 +16258,12 @@ }, "yargs-parser": { "version": "21.0.1" + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "devOptional": true } } } diff --git a/package.json b/package.json index 171525c..d790bf7 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "@lezer/common": "https://github.com/zefhemel/common.git#046c880d1fcab713cadad327a5b7d8bb5de6522c" }, "scripts": { - "watch": "rm -rf .parcel-cache && parcel watch --no-hmr packages/{web,server,plugos} desktop", + "watch": "rm -rf .parcel-cache && parcel watch --no-hmr packages/{web,server,plugos,plugs} desktop", "clean": "rm -rf .parcel-cache packages/*/dist", "build": "parcel build packages/{web,server,plugos}", "plugs": "cd packages/plugs && npm run watch", @@ -25,9 +25,13 @@ "@parcel/validator-typescript": "2.3.2", "parcel": "2.3.2", "prettier": "^2.5.1", + "ts-node": "^10.7.0", "typescript": "^4.6.2" }, "workspaces": [ "packages/*" - ] + ], + "dependencies": { + "handlebars": "^4.7.7" + } } diff --git a/packages/common/preload_modules.ts b/packages/common/preload_modules.ts index 5709d7e..cb1c4cb 100644 --- a/packages/common/preload_modules.ts +++ b/packages/common/preload_modules.ts @@ -4,4 +4,4 @@ // Candidate modules for this are larger modules // When adding a module to this list, also manually add it to sandbox_worker.ts -export const preloadModules = ["@lezer/lr", "yaml"]; +export const preloadModules = ["@lezer/lr", "yaml", "handlebars"]; diff --git a/packages/plugos/environments/sandbox_worker.ts b/packages/plugos/environments/sandbox_worker.ts index 3f3fd56..06ad6e4 100644 --- a/packages/plugos/environments/sandbox_worker.ts +++ b/packages/plugos/environments/sandbox_worker.ts @@ -41,6 +41,7 @@ self.syscall = async (name: string, ...args: any[]) => { const preloadedModules: { [key: string]: any } = { "@lezer/lr": require("@lezer/lr"), yaml: require("yaml"), + handlebars: require("handlebars/dist/handlebars"), }; // for (const moduleName of preloadModules) { // preloadedModules[moduleName] = require(moduleName); diff --git a/packages/plugs/build/test/engine.test.js b/packages/plugs/build/test/engine.test.js new file mode 100644 index 0000000..64c4de7 --- /dev/null +++ b/packages/plugs/build/test/engine.test.js @@ -0,0 +1,468 @@ +var $hVExJ$jestglobals = require("@jest/globals"); +var $hVExJ$lezerlr = require("@lezer/lr"); + + +function $255163dfff8c42fb$export$6dd7a1b2f91e0e12(tree) { + if (!tree.children) return; + for (let child of tree.children){ + if (child.parent) // Already added parent pointers before + return; + child.parent = tree; + $255163dfff8c42fb$export$6dd7a1b2f91e0e12(child); + } +} +function $255163dfff8c42fb$export$7bbc263cafa7dd78(tree) { + delete tree.parent; + if (!tree.children) return; + for (let child of tree.children)$255163dfff8c42fb$export$7bbc263cafa7dd78(child); +} +function $255163dfff8c42fb$export$6dcbc6776594ee95(tree, matchFn) { + let node = tree.parent; + while(node){ + if (matchFn(node)) return node; + node = node.parent; + } + return null; +} +function $255163dfff8c42fb$export$dddeb721bf64f8df(tree, nodeType) { + return $255163dfff8c42fb$export$b86407c733c9fe3(tree, (n)=>n.type === nodeType + ); +} +function $255163dfff8c42fb$export$b86407c733c9fe3(tree, matchFn) { + if (matchFn(tree)) return [ + tree + ]; + let results = []; + if (tree.children) for (let child of tree.children)results = [ + ...results, + ...$255163dfff8c42fb$export$b86407c733c9fe3(child, matchFn) + ]; + return results; +} +function $255163dfff8c42fb$export$90b8ac453fa63932(tree, substituteFn) { + if (tree.children) { + let children = tree.children.slice(); + for (let child of children){ + let subst = substituteFn(child); + if (subst !== undefined) { + let pos = tree.children.indexOf(child); + if (subst) tree.children.splice(pos, 1, subst); + else // null = delete + tree.children.splice(pos, 1); + } else $255163dfff8c42fb$export$90b8ac453fa63932(child, substituteFn); + } + } +} +function $255163dfff8c42fb$export$4d49acedd23f9b0a(tree, matchFn) { + return $255163dfff8c42fb$export$b86407c733c9fe3(tree, matchFn)[0]; +} +function $255163dfff8c42fb$export$80a8b4335833eeeb(tree, nodeType) { + return $255163dfff8c42fb$export$b86407c733c9fe3(tree, (n)=>n.type === nodeType + )[0]; +} +function $255163dfff8c42fb$export$a41716fb83443983(tree, pos) { + if (pos < tree.from || pos > tree.to) return null; + if (!tree.children) return tree; + for (let child of tree.children){ + let n = $255163dfff8c42fb$export$a41716fb83443983(child, pos); + if (n && n.text !== undefined) // Got a text node, let's return its parent + return tree; + else if (n) // Got it + return n; + } + return null; +} +function $255163dfff8c42fb$export$f21c5276b1e9847a(tree) { + let pieces = []; + if (tree.text !== undefined) return tree.text; + for (let child of tree.children)pieces.push($255163dfff8c42fb$export$f21c5276b1e9847a(child)); + return pieces.join(""); +} + + +function $88d466d5aaf7a497$export$87cc1c28aef74af1(text, n, offset = 0) { + let children = []; + let nodeText; + let child = n.firstChild; + while(child){ + children.push($88d466d5aaf7a497$export$87cc1c28aef74af1(text, child)); + child = child.nextSibling; + } + if (children.length === 0) children = [ + { + from: n.from + offset, + to: n.to + offset, + text: text.substring(n.from, n.to) + }, + ]; + else { + let newChildren = []; + let index = n.from; + for (let child of children){ + let s = text.substring(index, child.from); + if (s) newChildren.push({ + from: index + offset, + to: child.from + offset, + text: s + }); + newChildren.push(child); + index = child.to; + } + let s = text.substring(index, n.to); + if (s) newChildren.push({ + from: index + offset, + to: n.to + offset, + text: s + }); + children = newChildren; + } + let result = { + type: n.name, + from: n.from + offset, + to: n.to + offset + }; + if (children.length > 0) result.children = children; + if (nodeText) result.text = nodeText; + return result; +} +function $88d466d5aaf7a497$export$98e6a39c04603d36(language, text) { + let tree = $88d466d5aaf7a497$export$87cc1c28aef74af1(text, language.parser.parse(text).topNode); + // replaceNodesMatching(tree, (n): MarkdownTree | undefined | null => { + // if (n.type === "FencedCode") { + // let infoN = findNodeMatching(n, (n) => n.type === "CodeInfo"); + // let language = infoN!.children![0].text; + // let textN = findNodeMatching(n, (n) => n.type === "CodeText"); + // let text = textN!.children![0].text!; + // + // console.log(language, text); + // switch (language) { + // case "yaml": + // let parsed = StreamLanguage.define(yaml).parser.parse(text); + // let subTree = treeToAST(text, parsed.topNode, n.from); + // // console.log(JSON.stringify(subTree, null, 2)); + // subTree.type = "yaml"; + // return subTree; + // } + // } + // return; + // }); + return tree; +} + + + +const $d85524f23de2149a$export$8f49e4af10703ce3 = $hVExJ$lezerlr.LRParser.deserialize({ + version: 13, + states: "&fOVQPOOOmQQO'#C^QOQPOOOtQPO'#C`OyQQO'#CkO!OQPO'#CmO!TQPO'#CnO!YQPO'#CoOOQO'#Cp'#CpO!_QQO,58xO!fQQO'#CcO#TQQO'#CaOOQO'#Ca'#CaOOQO,58z,58zO#lQPO,59VOOQO,59X,59XO#qQQO'#D`OOQO,59Y,59YOOQO,59Z,59ZOOQO-E6n-E6nO$YQQO,58}OtQPO,58|O$qQQO1G.qO%]QPO'#CrO%bQQO,59zOOQO'#Cg'#CgOOQO'#Ci'#CiO$YQQO'#CjOOQO'#Cd'#CdOOQO1G.i1G.iOOQO1G.h1G.hOOQO'#Cl'#ClOOQO7+$]7+$]OOQO,59^,59^OOQO-E6p-E6pO%yQPO'#C|O&RQPO,59UO$YQQO'#CqO&WQPO,59hOOQO1G.p1G.pOOQO,59],59]OOQO-E6o-E6o", + stateData: "&`~OiOS~ORPO~OjRO|SO!QTO!RUO!TVO~OgQX~P[ORYO~O}^O~OX_O~OR`O~OYbO~OgQa~P[OkdOsdOtdOudOvdOwdOxdOydOzdO~O{eOgTXjTX|TX!QTX!RTX!TTX~ORfO~OqgOg!SXj!SX|!SX!Q!SX!R!SX!T!SX~OXlOYlO[lOliOmiOnjOokO~O!OoO!PoOg_ij_i|_i!Q_i!R_i!T_i~ORqO~OqgOg!Saj!Sa|!Sa!Q!Sa!R!Sa!T!Sa~OquOrpX~OrwO~OquOrpa~O", + goto: "#d!TPP!UP!X!]!`!c!iPP!rP!r!r!X!w!X!X!X!z#Q#WPPPPPPPPP#^PPPPPPPPPPPPPPPPP#aRQOTWPXR]RR[RQZRRneQmdQskRxuVldkuRpfQXPRcXQvsRyvQh`RrhRtkRaU", + nodeNames: "⚠ Program Query Name WhereClause LogicalExpr AndExpr FilterExpr Value Number String Bool Regex Null List OrderClause Order LimitClause SelectClause RenderClause", + maxTerm: 51, + skippedNodes: [ + 0 + ], + repeatNodeCount: 3, + tokenData: "Ap~R}X^$Opq$Oqr$srs%W|}%r}!O%w!P!Q&Y!Q!['P!^!_'X!_!`'f!`!a's!c!}%w!}#O(Q#P#Q(V#R#S%w#T#U([#U#V*q#V#W%w#W#X+m#X#Y%w#Y#Z-i#Z#]%w#]#^/y#^#`%w#`#a0u#a#b%w#b#c3Y#c#d5U#d#f%w#f#g7i#g#h:e#h#i=a#i#k%w#k#l?]#l#o%w#y#z$O$f$g$O#BY#BZ$O$IS$I_$O$Ip$Iq%W$Iq$Ir%W$I|$JO$O$JT$JU$O$KV$KW$O&FU&FV$O~$TYi~X^$Opq$O#y#z$O$f$g$O#BY#BZ$O$IS$I_$O$I|$JO$O$JT$JU$O$KV$KW$O&FU&FV$O~$vP!_!`$y~%OPu~#r#s%R~%WOy~~%ZUOr%Wrs%ms$Ip%W$Ip$Iq%m$Iq$Ir%m$Ir~%W~%rO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+ 0, + 1 + ], + topRules: { + "Program": [ + 0, + 1 + ] + }, + tokenPrec: 0 +}); + + +const $4ba3510c824e3aea$export$c5be9092dbf465c = self.syscall; + + +async function $2780e5830b4782c9$export$c3455d2d4767a60b(unfiltered = false) { + return $4ba3510c824e3aea$export$c5be9092dbf465c("space.listPages", unfiltered); +} +async function $2780e5830b4782c9$export$126f79da5c357ad(name) { + return $4ba3510c824e3aea$export$c5be9092dbf465c("space.readPage", name); +} +async function $2780e5830b4782c9$export$7ed3b3f07f54e00c(name, text) { + return $4ba3510c824e3aea$export$c5be9092dbf465c("space.writePage", name, text); +} +async function $2780e5830b4782c9$export$2e9858c25869c949(name) { + return $4ba3510c824e3aea$export$c5be9092dbf465c("space.deletePage", name); +} + + +function $9072202279b76d33$export$1e8473eaf75b0d10(query) { + let n1 = $88d466d5aaf7a497$export$87cc1c28aef74af1(query, $d85524f23de2149a$export$8f49e4af10703ce3.parse(query).topNode); + // Clean the tree a bit + $255163dfff8c42fb$export$90b8ac453fa63932(n1, (n)=>{ + if (!n.type) { + let trimmed = n.text.trim(); + if (!trimmed) return null; + n.text = trimmed; + } + }); + // console.log("Parsed", JSON.stringify(n, null, 2)); + let queryNode = n1.children[0]; + let parsedQuery = { + table: queryNode.children[0].children[0].text, + filter: [] + }; + let orderByNode = $255163dfff8c42fb$export$80a8b4335833eeeb(queryNode, "OrderClause"); + if (orderByNode) { + let nameNode = $255163dfff8c42fb$export$80a8b4335833eeeb(orderByNode, "Name"); + parsedQuery.orderBy = nameNode.children[0].text; + let orderNode = $255163dfff8c42fb$export$80a8b4335833eeeb(orderByNode, "Order"); + parsedQuery.orderDesc = orderNode ? orderNode.children[0].text === "desc" : false; + } + let limitNode = $255163dfff8c42fb$export$80a8b4335833eeeb(queryNode, "LimitClause"); + if (limitNode) { + let nameNode = $255163dfff8c42fb$export$80a8b4335833eeeb(limitNode, "Number"); + parsedQuery.limit = $9072202279b76d33$var$valueNodeToVal(nameNode); + } + let filterNodes = $255163dfff8c42fb$export$dddeb721bf64f8df(queryNode, "FilterExpr"); + for (let filterNode of filterNodes){ + let val = undefined; + let valNode = filterNode.children[2].children[0]; + val = $9072202279b76d33$var$valueNodeToVal(valNode); + let f = { + prop: filterNode.children[0].children[0].text, + op: filterNode.children[1].text, + value: val + }; + parsedQuery.filter.push(f); + } + let selectNode = $255163dfff8c42fb$export$80a8b4335833eeeb(queryNode, "SelectClause"); + if (selectNode) { + // console.log("Select node", JSON.stringify(selectNode)); + parsedQuery.select = []; + $255163dfff8c42fb$export$dddeb721bf64f8df(selectNode, "Name").forEach((t)=>{ + parsedQuery.select.push(t.children[0].text); + }); + // let nameNode = findNodeOfType(selectNode, "Number"); + // parsedQuery.limit = +nameNode!.children![0].text!; + } + let renderNode = $255163dfff8c42fb$export$80a8b4335833eeeb(queryNode, "RenderClause"); + if (renderNode) { + let renderNameNode = $255163dfff8c42fb$export$80a8b4335833eeeb(renderNode, "String"); + parsedQuery.render = $9072202279b76d33$var$valueNodeToVal(renderNameNode); + } + // console.log(JSON.stringify(queryNode, null, 2)); + return parsedQuery; +} +function $9072202279b76d33$var$valueNodeToVal(valNode) { + switch(valNode.type){ + case "Number": + return +valNode.children[0].text; + case "Bool": + return valNode.children[0].text === "true"; + case "Null": + return null; + case "Name": + return valNode.children[0].text; + case "Regex": + let val = valNode.children[0].text; + return val.substring(1, val.length - 1); + case "String": + let stringVal = valNode.children[0].text; + return stringVal.substring(1, stringVal.length - 1); + case "List": + return $255163dfff8c42fb$export$dddeb721bf64f8df(valNode, "Value").map((t)=>$9072202279b76d33$var$valueNodeToVal(t.children[0]) + ); + } +} +function $9072202279b76d33$export$5884dae03c64f759(parsedQuery, records) { + let resultRecords = []; + if (parsedQuery.filter.length === 0) resultRecords = records.slice(); + else recordLoop: for (let record of records){ + const recordAny = record; + for (let { op: op , prop: prop , value: value } of parsedQuery.filter)switch(op){ + case "=": + if (!(recordAny[prop] == value)) continue recordLoop; + break; + case "!=": + if (!(recordAny[prop] != value)) continue recordLoop; + break; + case "<": + if (!(recordAny[prop] < value)) continue recordLoop; + break; + case "<=": + if (!(recordAny[prop] <= value)) continue recordLoop; + break; + case ">": + if (!(recordAny[prop] > value)) continue recordLoop; + break; + case ">=": + if (!(recordAny[prop] >= value)) continue recordLoop; + break; + case "=~": + // TODO: Cache regexps somehow + if (!new RegExp(value).exec(recordAny[prop])) continue recordLoop; + break; + case "!=~": + if (new RegExp(value).exec(recordAny[prop])) continue recordLoop; + break; + case "in": + if (!value.includes(recordAny[prop])) continue recordLoop; + break; + } + resultRecords.push(recordAny); + } + // Now the sorting + if (parsedQuery.orderBy) resultRecords = resultRecords.sort((a, b)=>{ + const orderBy = parsedQuery.orderBy; + const orderDesc = parsedQuery.orderDesc; + if (a[orderBy] === b[orderBy]) return 0; + if (a[orderBy] < b[orderBy]) return orderDesc ? 1 : -1; + else return orderDesc ? -1 : 1; + }); + if (parsedQuery.limit) resultRecords = resultRecords.slice(0, parsedQuery.limit); + if (parsedQuery.select) resultRecords = resultRecords.map((rec)=>{ + let newRec = { + }; + for (let k of parsedQuery.select)newRec[k] = rec[k]; + return newRec; + }); + return resultRecords; +} +async function $9072202279b76d33$var$renderQuery(parsedQuery, data) { + if (parsedQuery.render) { + let { text: templateText } = await $2780e5830b4782c9$export$126f79da5c357ad(parsedQuery.render); + // let template = Handlebars.compile(templateText); + } +} + + +$hVExJ$jestglobals.test("Test parser", ()=>{ + let parsedBasicQuery = $9072202279b76d33$export$1e8473eaf75b0d10(`page`); + $hVExJ$jestglobals.expect(parsedBasicQuery.table).toBe("page"); + let parsedQuery1 = $9072202279b76d33$export$1e8473eaf75b0d10(`task where completed = false and dueDate <= "{{today}}" order by dueDate desc limit 5`); + $hVExJ$jestglobals.expect(parsedQuery1.table).toBe("task"); + $hVExJ$jestglobals.expect(parsedQuery1.orderBy).toBe("dueDate"); + $hVExJ$jestglobals.expect(parsedQuery1.orderDesc).toBe(true); + $hVExJ$jestglobals.expect(parsedQuery1.limit).toBe(5); + $hVExJ$jestglobals.expect(parsedQuery1.filter.length).toBe(2); + $hVExJ$jestglobals.expect(parsedQuery1.filter[0]).toStrictEqual({ + op: "=", + prop: "completed", + value: false + }); + $hVExJ$jestglobals.expect(parsedQuery1.filter[1]).toStrictEqual({ + op: "<=", + prop: "dueDate", + value: "{{today}}" + }); + let parsedQuery2 = $9072202279b76d33$export$1e8473eaf75b0d10(`page where name =~ /interview\\/.*/"`); + $hVExJ$jestglobals.expect(parsedQuery2.table).toBe("page"); + $hVExJ$jestglobals.expect(parsedQuery2.filter.length).toBe(1); + $hVExJ$jestglobals.expect(parsedQuery2.filter[0]).toStrictEqual({ + op: "=~", + prop: "name", + value: "interview\\/.*" + }); + let parsedQuery3 = $9072202279b76d33$export$1e8473eaf75b0d10(`page where something != null`); + $hVExJ$jestglobals.expect(parsedQuery3.table).toBe("page"); + $hVExJ$jestglobals.expect(parsedQuery3.filter.length).toBe(1); + $hVExJ$jestglobals.expect(parsedQuery3.filter[0]).toStrictEqual({ + op: "!=", + prop: "something", + value: null + }); + $hVExJ$jestglobals.expect($9072202279b76d33$export$1e8473eaf75b0d10(`page select name`).select).toStrictEqual([ + "name" + ]); + $hVExJ$jestglobals.expect($9072202279b76d33$export$1e8473eaf75b0d10(`page select name, age`).select).toStrictEqual([ + "name", + "age", + ]); + $hVExJ$jestglobals.expect($9072202279b76d33$export$1e8473eaf75b0d10(`gh-events where type in ["PushEvent", "somethingElse"]`)).toStrictEqual({ + table: "gh-events", + filter: [ + { + op: "in", + prop: "type", + value: [ + "PushEvent", + "somethingElse" + ] + }, + ] + }); + $hVExJ$jestglobals.expect($9072202279b76d33$export$1e8473eaf75b0d10(`something render "template/table"`)).toStrictEqual({ + table: "something", + filter: [], + render: "template/table" + }); +}); +$hVExJ$jestglobals.test("Test performing the queries", ()=>{ + let data = [ + { + name: "interview/My Interview", + lastModified: 1 + }, + { + name: "interview/My Interview 2", + lastModified: 2 + }, + { + name: "Pete", + age: 38 + }, + { + name: "Angie", + age: 28 + }, + ]; + $hVExJ$jestglobals.expect($9072202279b76d33$export$5884dae03c64f759($9072202279b76d33$export$1e8473eaf75b0d10(`page where name =~ /interview\\/.*/`), data)).toStrictEqual([ + { + name: "interview/My Interview", + lastModified: 1 + }, + { + name: "interview/My Interview 2", + lastModified: 2 + }, + ]); + $hVExJ$jestglobals.expect($9072202279b76d33$export$5884dae03c64f759($9072202279b76d33$export$1e8473eaf75b0d10(`page where name =~ /interview\\/.*/ order by lastModified`), data)).toStrictEqual([ + { + name: "interview/My Interview", + lastModified: 1 + }, + { + name: "interview/My Interview 2", + lastModified: 2 + }, + ]); + $hVExJ$jestglobals.expect($9072202279b76d33$export$5884dae03c64f759($9072202279b76d33$export$1e8473eaf75b0d10(`page where name =~ /interview\\/.*/ order by lastModified desc`), data)).toStrictEqual([ + { + name: "interview/My Interview 2", + lastModified: 2 + }, + { + name: "interview/My Interview", + lastModified: 1 + }, + ]); + $hVExJ$jestglobals.expect($9072202279b76d33$export$5884dae03c64f759($9072202279b76d33$export$1e8473eaf75b0d10(`page where age > 30`), data)).toStrictEqual([ + { + name: "Pete", + age: 38 + }, + ]); + $hVExJ$jestglobals.expect($9072202279b76d33$export$5884dae03c64f759($9072202279b76d33$export$1e8473eaf75b0d10(`page where age > 28 and age < 38`), data)).toStrictEqual([]); + $hVExJ$jestglobals.expect($9072202279b76d33$export$5884dae03c64f759($9072202279b76d33$export$1e8473eaf75b0d10(`page where age > 30 select name`), data)).toStrictEqual([ + { + name: "Pete" + } + ]); + $hVExJ$jestglobals.expect($9072202279b76d33$export$5884dae03c64f759($9072202279b76d33$export$1e8473eaf75b0d10(`page where name in ["Pete"] select name`), data)).toStrictEqual([ + { + name: "Pete" + } + ]); +}); + + +//# sourceMappingURL=engine.test.js.map diff --git a/packages/plugs/build/test/engine.test.js.map b/packages/plugs/build/test/engine.test.js.map new file mode 100644 index 0000000..04aabc4 --- /dev/null +++ b/packages/plugs/build/test/engine.test.js.map @@ -0,0 +1 @@ +{"mappings":";;;;SEUgB,yC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QACnD,CAAC;YAAC,IAAI,EAAE,CAA0B;YAAE,YAAY,EAAE,CAAC;QAAC,CAAC;IACvD,CAAC;IACD,yBAAM,CACJ,yCAAU,CACR,yCAAU,EACP,+DAA+D,IAElE,IAAI,GAEN,aAAa,CAAC,CAAC;QACf,CAAC;YAAC,IAAI,EAAE,CAA0B;YAAE,YAAY,EAAE,CAAC;QAAC,CAAC;QACrD,CAAC;YAAC,IAAI,EAAE,CAAwB;YAAE,YAAY,EAAE,CAAC;QAAC,CAAC;IACrD,CAAC;IACD,yBAAM,CAAC,yCAAU,CAAC,yCAAU,EAAE,mBAAmB,IAAI,IAAI,GAAG,aAAa,CAAC,CAAC;QACzE,CAAC;YAAC,IAAI,EAAE,CAAM;YAAE,GAAG,EAAE,EAAE;QAAC,CAAC;IAC3B,CAAC;IACD,yBAAM,CACJ,yCAAU,CAAC,yCAAU,EAAE,gCAAgC,IAAI,IAAI,GAC/D,aAAa,CAAC,CAAC,CAAC;IAClB,yBAAM,CACJ,yCAAU,CAAC,yCAAU,EAAE,+BAA+B,IAAI,IAAI,GAC9D,aAAa,CAAC,CAAC;QAAA,CAAC;YAAC,IAAI,EAAE,CAAM;QAAC,CAAC;IAAA,CAAC;IAElC,yBAAM,CACJ,yCAAU,CAAC,yCAAU,EAAE,uCAAuC,IAAI,IAAI,GACtE,aAAa,CAAC,CAAC;QAAA,CAAC;YAAC,IAAI,EAAE,CAAM;QAAC,CAAC;IAAA,CAAC;AACpC,CAAC","sources":["packages/plugs/query/engine.test.ts","packages/plugs/query/engine.ts","packages/common/tree.ts","packages/common/parse_tree.ts","packages/plugs/query/parse-query.js","packages/plugos-silverbullet-syscall/space.ts","packages/plugos-silverbullet-syscall/syscall.ts"],"sourcesContent":["import { expect, test } from \"@jest/globals\";\nimport { applyQuery, parseQuery } from \"./engine\";\n\ntest(\"Test parser\", () => {\n let parsedBasicQuery = parseQuery(`page`);\n expect(parsedBasicQuery.table).toBe(\"page\");\n\n let parsedQuery1 = parseQuery(\n `task where completed = false and dueDate <= \"{{today}}\" order by dueDate desc limit 5`\n );\n expect(parsedQuery1.table).toBe(\"task\");\n expect(parsedQuery1.orderBy).toBe(\"dueDate\");\n expect(parsedQuery1.orderDesc).toBe(true);\n expect(parsedQuery1.limit).toBe(5);\n expect(parsedQuery1.filter.length).toBe(2);\n expect(parsedQuery1.filter[0]).toStrictEqual({\n op: \"=\",\n prop: \"completed\",\n value: false,\n });\n expect(parsedQuery1.filter[1]).toStrictEqual({\n op: \"<=\",\n prop: \"dueDate\",\n value: \"{{today}}\",\n });\n\n let parsedQuery2 = parseQuery(`page where name =~ /interview\\\\/.*/\"`);\n expect(parsedQuery2.table).toBe(\"page\");\n expect(parsedQuery2.filter.length).toBe(1);\n expect(parsedQuery2.filter[0]).toStrictEqual({\n op: \"=~\",\n prop: \"name\",\n value: \"interview\\\\/.*\",\n });\n\n let parsedQuery3 = parseQuery(`page where something != null`);\n expect(parsedQuery3.table).toBe(\"page\");\n expect(parsedQuery3.filter.length).toBe(1);\n expect(parsedQuery3.filter[0]).toStrictEqual({\n op: \"!=\",\n prop: \"something\",\n value: null,\n });\n\n expect(parseQuery(`page select name`).select).toStrictEqual([\"name\"]);\n expect(parseQuery(`page select name, age`).select).toStrictEqual([\n \"name\",\n \"age\",\n ]);\n\n expect(\n parseQuery(`gh-events where type in [\"PushEvent\", \"somethingElse\"]`)\n ).toStrictEqual({\n table: \"gh-events\",\n filter: [\n {\n op: \"in\",\n prop: \"type\",\n value: [\"PushEvent\", \"somethingElse\"],\n },\n ],\n });\n\n expect(parseQuery(`something render \"template/table\"`)).toStrictEqual({\n table: \"something\",\n filter: [],\n render: \"template/table\",\n });\n});\n\ntest(\"Test performing the queries\", () => {\n let data: any[] = [\n { name: \"interview/My Interview\", lastModified: 1 },\n { name: \"interview/My Interview 2\", lastModified: 2 },\n { name: \"Pete\", age: 38 },\n { name: \"Angie\", age: 28 },\n ];\n\n expect(\n applyQuery(parseQuery(`page where name =~ /interview\\\\/.*/`), data)\n ).toStrictEqual([\n { name: \"interview/My Interview\", lastModified: 1 },\n { name: \"interview/My Interview 2\", lastModified: 2 },\n ]);\n expect(\n applyQuery(\n parseQuery(`page where name =~ /interview\\\\/.*/ order by lastModified`),\n data\n )\n ).toStrictEqual([\n { name: \"interview/My Interview\", lastModified: 1 },\n { name: \"interview/My Interview 2\", lastModified: 2 },\n ]);\n expect(\n applyQuery(\n parseQuery(\n `page where name =~ /interview\\\\/.*/ order by lastModified desc`\n ),\n data\n )\n ).toStrictEqual([\n { name: \"interview/My Interview 2\", lastModified: 2 },\n { name: \"interview/My Interview\", lastModified: 1 },\n ]);\n expect(applyQuery(parseQuery(`page where age > 30`), data)).toStrictEqual([\n { name: \"Pete\", age: 38 },\n ]);\n expect(\n applyQuery(parseQuery(`page where age > 28 and age < 38`), data)\n ).toStrictEqual([]);\n expect(\n applyQuery(parseQuery(`page where age > 30 select name`), data)\n ).toStrictEqual([{ name: \"Pete\" }]);\n\n expect(\n applyQuery(parseQuery(`page where name in [\"Pete\"] select name`), data)\n ).toStrictEqual([{ name: \"Pete\" }]);\n});\n","import {\n collectNodesOfType,\n findNodeOfType,\n ParseTree,\n replaceNodesMatching,\n} from \"@silverbulletmd/common/tree\";\nimport { lezerToParseTree } from \"@silverbulletmd/common/parse_tree\";\n// import Handlebars from \"handlebars/dist/handlebars\";\n\n// @ts-ignore\nimport { parser } from \"./parse-query\";\nimport { readPage } from \"@silverbulletmd/plugos-silverbullet-syscall/space\";\n\nexport type QueryProviderEvent = {\n query: ParsedQuery;\n pageName: string;\n};\n\nexport type Filter = {\n op: string;\n prop: string;\n value: any;\n};\n\nexport type ParsedQuery = {\n table: string;\n orderBy?: string;\n orderDesc?: boolean;\n limit?: number;\n filter: Filter[];\n select?: string[];\n render?: string;\n};\n\nexport function parseQuery(query: string): ParsedQuery {\n let n = lezerToParseTree(query, parser.parse(query).topNode);\n // Clean the tree a bit\n replaceNodesMatching(n, (n) => {\n if (!n.type) {\n let trimmed = n.text!.trim();\n if (!trimmed) {\n return null;\n }\n n.text = trimmed;\n }\n });\n\n // console.log(\"Parsed\", JSON.stringify(n, null, 2));\n\n let queryNode = n.children![0];\n let parsedQuery: ParsedQuery = {\n table: queryNode.children![0].children![0].text!,\n filter: [],\n };\n let orderByNode = findNodeOfType(queryNode, \"OrderClause\");\n if (orderByNode) {\n let nameNode = findNodeOfType(orderByNode, \"Name\");\n parsedQuery.orderBy = nameNode!.children![0].text!;\n let orderNode = findNodeOfType(orderByNode, \"Order\");\n parsedQuery.orderDesc = orderNode\n ? orderNode.children![0].text! === \"desc\"\n : false;\n }\n let limitNode = findNodeOfType(queryNode, \"LimitClause\");\n if (limitNode) {\n let nameNode = findNodeOfType(limitNode, \"Number\");\n parsedQuery.limit = valueNodeToVal(nameNode!);\n }\n\n let filterNodes = collectNodesOfType(queryNode, \"FilterExpr\");\n for (let filterNode of filterNodes) {\n let val: any = undefined;\n let valNode = filterNode.children![2].children![0];\n val = valueNodeToVal(valNode);\n let f: Filter = {\n prop: filterNode.children![0].children![0].text!,\n op: filterNode.children![1].text!,\n value: val,\n };\n parsedQuery.filter.push(f);\n }\n let selectNode = findNodeOfType(queryNode, \"SelectClause\");\n if (selectNode) {\n // console.log(\"Select node\", JSON.stringify(selectNode));\n parsedQuery.select = [];\n collectNodesOfType(selectNode, \"Name\").forEach((t) => {\n parsedQuery.select!.push(t.children![0].text!);\n });\n // let nameNode = findNodeOfType(selectNode, \"Number\");\n // parsedQuery.limit = +nameNode!.children![0].text!;\n }\n\n let renderNode = findNodeOfType(queryNode, \"RenderClause\");\n if (renderNode) {\n let renderNameNode = findNodeOfType(renderNode, \"String\");\n parsedQuery.render = valueNodeToVal(renderNameNode!);\n }\n\n // console.log(JSON.stringify(queryNode, null, 2));\n return parsedQuery;\n}\n\nfunction valueNodeToVal(valNode: ParseTree): any {\n switch (valNode.type) {\n case \"Number\":\n return +valNode.children![0].text!;\n case \"Bool\":\n return valNode.children![0].text! === \"true\";\n case \"Null\":\n return null;\n case \"Name\":\n return valNode.children![0].text!;\n case \"Regex\":\n let val = valNode.children![0].text!;\n return val.substring(1, val.length - 1);\n case \"String\":\n let stringVal = valNode.children![0].text!;\n return stringVal.substring(1, stringVal.length - 1);\n case \"List\":\n return collectNodesOfType(valNode, \"Value\").map((t) =>\n valueNodeToVal(t.children![0])\n );\n }\n}\n\nexport function applyQuery(parsedQuery: ParsedQuery, records: T[]): T[] {\n let resultRecords: any[] = [];\n if (parsedQuery.filter.length === 0) {\n resultRecords = records.slice();\n } else {\n recordLoop: for (let record of records) {\n const recordAny: any = record;\n for (let { op, prop, value } of parsedQuery.filter) {\n switch (op) {\n case \"=\":\n if (!(recordAny[prop] == value)) {\n continue recordLoop;\n }\n break;\n case \"!=\":\n if (!(recordAny[prop] != value)) {\n continue recordLoop;\n }\n break;\n case \"<\":\n if (!(recordAny[prop] < value)) {\n continue recordLoop;\n }\n break;\n case \"<=\":\n if (!(recordAny[prop] <= value)) {\n continue recordLoop;\n }\n break;\n case \">\":\n if (!(recordAny[prop] > value)) {\n continue recordLoop;\n }\n break;\n case \">=\":\n if (!(recordAny[prop] >= value)) {\n continue recordLoop;\n }\n break;\n case \"=~\":\n // TODO: Cache regexps somehow\n if (!new RegExp(value).exec(recordAny[prop])) {\n continue recordLoop;\n }\n break;\n case \"!=~\":\n if (new RegExp(value).exec(recordAny[prop])) {\n continue recordLoop;\n }\n break;\n case \"in\":\n if (!value.includes(recordAny[prop])) {\n continue recordLoop;\n }\n break;\n }\n }\n resultRecords.push(recordAny);\n }\n }\n // Now the sorting\n if (parsedQuery.orderBy) {\n resultRecords = resultRecords.sort((a: any, b: any) => {\n const orderBy = parsedQuery.orderBy!;\n const orderDesc = parsedQuery.orderDesc!;\n if (a[orderBy] === b[orderBy]) {\n return 0;\n }\n\n if (a[orderBy] < b[orderBy]) {\n return orderDesc ? 1 : -1;\n } else {\n return orderDesc ? -1 : 1;\n }\n });\n }\n if (parsedQuery.limit) {\n resultRecords = resultRecords.slice(0, parsedQuery.limit);\n }\n if (parsedQuery.select) {\n resultRecords = resultRecords.map((rec) => {\n let newRec: any = {};\n for (let k of parsedQuery.select!) {\n newRec[k] = rec[k];\n }\n return newRec;\n });\n }\n return resultRecords;\n}\n\nasync function renderQuery(parsedQuery: ParsedQuery, data: any[]) {\n if (parsedQuery.render) {\n let { text: templateText } = await readPage(parsedQuery.render);\n // let template = Handlebars.compile(templateText);\n }\n}\n","export type ParseTree = {\n type?: string; // undefined === text node\n from?: number;\n to?: number;\n text?: string;\n children?: ParseTree[];\n // Only present after running addParentPointers\n parent?: ParseTree;\n};\n\nexport function addParentPointers(tree: ParseTree) {\n if (!tree.children) {\n return;\n }\n for (let child of tree.children) {\n if (child.parent) {\n // Already added parent pointers before\n return;\n }\n child.parent = tree;\n addParentPointers(child);\n }\n}\n\nexport function removeParentPointers(tree: ParseTree) {\n delete tree.parent;\n if (!tree.children) {\n return;\n }\n for (let child of tree.children) {\n removeParentPointers(child);\n }\n}\n\nexport function findParentMatching(\n tree: ParseTree,\n matchFn: (tree: ParseTree) => boolean\n): ParseTree | null {\n let node = tree.parent;\n while (node) {\n if (matchFn(node)) {\n return node;\n }\n node = node.parent;\n }\n return null;\n}\n\nexport function collectNodesOfType(\n tree: ParseTree,\n nodeType: string\n): ParseTree[] {\n return collectNodesMatching(tree, (n) => n.type === nodeType);\n}\n\nexport function collectNodesMatching(\n tree: ParseTree,\n matchFn: (tree: ParseTree) => boolean\n): ParseTree[] {\n if (matchFn(tree)) {\n return [tree];\n }\n let results: ParseTree[] = [];\n if (tree.children) {\n for (let child of tree.children) {\n results = [...results, ...collectNodesMatching(child, matchFn)];\n }\n }\n return results;\n}\n\n// return value: returning undefined = not matched, continue, null = delete, new node = replace\nexport function replaceNodesMatching(\n tree: ParseTree,\n substituteFn: (tree: ParseTree) => ParseTree | null | undefined\n) {\n if (tree.children) {\n let children = tree.children.slice();\n for (let child of children) {\n let subst = substituteFn(child);\n if (subst !== undefined) {\n let pos = tree.children.indexOf(child);\n if (subst) {\n tree.children.splice(pos, 1, subst);\n } else {\n // null = delete\n tree.children.splice(pos, 1);\n }\n } else {\n replaceNodesMatching(child, substituteFn);\n }\n }\n }\n}\n\nexport function findNodeMatching(\n tree: ParseTree,\n matchFn: (tree: ParseTree) => boolean\n): ParseTree | null {\n return collectNodesMatching(tree, matchFn)[0];\n}\n\nexport function findNodeOfType(\n tree: ParseTree,\n nodeType: string\n): ParseTree | null {\n return collectNodesMatching(tree, (n) => n.type === nodeType)[0];\n}\n\n// Finds non-text node at position\nexport function nodeAtPos(tree: ParseTree, pos: number): ParseTree | null {\n if (pos < tree.from! || pos > tree.to!) {\n return null;\n }\n if (!tree.children) {\n return tree;\n }\n for (let child of tree.children) {\n let n = nodeAtPos(child, pos);\n if (n && n.text !== undefined) {\n // Got a text node, let's return its parent\n return tree;\n } else if (n) {\n // Got it\n return n;\n }\n }\n return null;\n}\n\n// Turn ParseTree back into text\nexport function renderToText(tree: ParseTree): string {\n let pieces: string[] = [];\n if (tree.text !== undefined) {\n return tree.text;\n }\n for (let child of tree.children!) {\n pieces.push(renderToText(child));\n }\n return pieces.join(\"\");\n}\n","import type { SyntaxNode } from \"@lezer/common\";\nimport type { Language } from \"@codemirror/language\";\nimport { ParseTree } from \"./tree\";\n\nexport function lezerToParseTree(\n text: string,\n n: SyntaxNode,\n offset = 0\n): ParseTree {\n let children: ParseTree[] = [];\n let nodeText: string | undefined;\n let child = n.firstChild;\n while (child) {\n children.push(lezerToParseTree(text, child));\n child = child.nextSibling;\n }\n\n if (children.length === 0) {\n children = [\n {\n from: n.from + offset,\n to: n.to + offset,\n text: text.substring(n.from, n.to),\n },\n ];\n } else {\n let newChildren: ParseTree[] = [];\n let index = n.from;\n for (let child of children) {\n let s = text.substring(index, child.from);\n if (s) {\n newChildren.push({\n from: index + offset,\n to: child.from! + offset,\n text: s,\n });\n }\n newChildren.push(child);\n index = child.to!;\n }\n let s = text.substring(index, n.to);\n if (s) {\n newChildren.push({ from: index + offset, to: n.to + offset, text: s });\n }\n children = newChildren;\n }\n\n let result: ParseTree = {\n type: n.name,\n from: n.from + offset,\n to: n.to + offset,\n };\n if (children.length > 0) {\n result.children = children;\n }\n if (nodeText) {\n result.text = nodeText;\n }\n return result;\n}\n\nexport function parse(language: Language, text: string): ParseTree {\n let tree = lezerToParseTree(text, language.parser.parse(text).topNode);\n // replaceNodesMatching(tree, (n): MarkdownTree | undefined | null => {\n // if (n.type === \"FencedCode\") {\n // let infoN = findNodeMatching(n, (n) => n.type === \"CodeInfo\");\n // let language = infoN!.children![0].text;\n // let textN = findNodeMatching(n, (n) => n.type === \"CodeText\");\n // let text = textN!.children![0].text!;\n //\n // console.log(language, text);\n // switch (language) {\n // case \"yaml\":\n // let parsed = StreamLanguage.define(yaml).parser.parse(text);\n // let subTree = treeToAST(text, parsed.topNode, n.from);\n // // console.log(JSON.stringify(subTree, null, 2));\n // subTree.type = \"yaml\";\n // return subTree;\n // }\n // }\n // return;\n // });\n return tree;\n}\n","// This file was generated by lezer-generator. You probably shouldn't edit it.\nimport {LRParser} from \"@lezer/lr\"\nexport const parser = LRParser.deserialize({\n version: 13,\n states: \"&fOVQPOOOmQQO'#C^QOQPOOOtQPO'#C`OyQQO'#CkO!OQPO'#CmO!TQPO'#CnO!YQPO'#CoOOQO'#Cp'#CpO!_QQO,58xO!fQQO'#CcO#TQQO'#CaOOQO'#Ca'#CaOOQO,58z,58zO#lQPO,59VOOQO,59X,59XO#qQQO'#D`OOQO,59Y,59YOOQO,59Z,59ZOOQO-E6n-E6nO$YQQO,58}OtQPO,58|O$qQQO1G.qO%]QPO'#CrO%bQQO,59zOOQO'#Cg'#CgOOQO'#Ci'#CiO$YQQO'#CjOOQO'#Cd'#CdOOQO1G.i1G.iOOQO1G.h1G.hOOQO'#Cl'#ClOOQO7+$]7+$]OOQO,59^,59^OOQO-E6p-E6pO%yQPO'#C|O&RQPO,59UO$YQQO'#CqO&WQPO,59hOOQO1G.p1G.pOOQO,59],59]OOQO-E6o-E6o\",\n stateData: \"&`~OiOS~ORPO~OjRO|SO!QTO!RUO!TVO~OgQX~P[ORYO~O}^O~OX_O~OR`O~OYbO~OgQa~P[OkdOsdOtdOudOvdOwdOxdOydOzdO~O{eOgTXjTX|TX!QTX!RTX!TTX~ORfO~OqgOg!SXj!SX|!SX!Q!SX!R!SX!T!SX~OXlOYlO[lOliOmiOnjOokO~O!OoO!PoOg_ij_i|_i!Q_i!R_i!T_i~ORqO~OqgOg!Saj!Sa|!Sa!Q!Sa!R!Sa!T!Sa~OquOrpX~OrwO~OquOrpa~O\",\n goto: \"#d!TPP!UP!X!]!`!c!iPP!rP!r!r!X!w!X!X!X!z#Q#WPPPPPPPPP#^PPPPPPPPPPPPPPPPP#aRQOTWPXR]RR[RQZRRneQmdQskRxuVldkuRpfQXPRcXQvsRyvQh`RrhRtkRaU\",\n nodeNames: \"⚠ Program Query Name WhereClause LogicalExpr AndExpr FilterExpr Value Number String Bool Regex Null List OrderClause Order LimitClause SelectClause RenderClause\",\n maxTerm: 51,\n skippedNodes: [0],\n repeatNodeCount: 3,\n tokenData: \"Ap~R}X^$Opq$Oqr$srs%W|}%r}!O%w!P!Q&Y!Q!['P!^!_'X!_!`'f!`!a's!c!}%w!}#O(Q#P#Q(V#R#S%w#T#U([#U#V*q#V#W%w#W#X+m#X#Y%w#Y#Z-i#Z#]%w#]#^/y#^#`%w#`#a0u#a#b%w#b#c3Y#c#d5U#d#f%w#f#g7i#g#h:e#h#i=a#i#k%w#k#l?]#l#o%w#y#z$O$f$g$O#BY#BZ$O$IS$I_$O$Ip$Iq%W$Iq$Ir%W$I|$JO$O$JT$JU$O$KV$KW$O&FU&FV$O~$TYi~X^$Opq$O#y#z$O$f$g$O#BY#BZ$O$IS$I_$O$I|$JO$O$JT$JU$O$KV$KW$O&FU&FV$O~$vP!_!`$y~%OPu~#r#s%R~%WOy~~%ZUOr%Wrs%ms$Ip%W$Ip$Iq%m$Iq$Ir%m$Ir~%W~%rOY~~%wOq~P%|SRP}!O%w!c!}%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},\n tokenPrec: 0\n})\n","import { syscall } from \"./syscall\";\nimport { PageMeta } from \"../common/types\";\n\nexport async function listPages(unfiltered = false): Promise {\n return syscall(\"space.listPages\", unfiltered);\n}\n\nexport async function readPage(\n name: string\n): Promise<{ text: string; meta: PageMeta }> {\n return syscall(\"space.readPage\", name);\n}\n\nexport async function writePage(name: string, text: string): Promise {\n return syscall(\"space.writePage\", name, text);\n}\n\nexport async function deletePage(name: string): Promise {\n return syscall(\"space.deletePage\", name);\n}\n","declare global {\n function syscall(name: string, ...args: any[]): Promise;\n}\n\nexport const syscall = self.syscall;\n"],"names":[],"version":3,"file":"engine.test.js.map","sourceRoot":"../../../../"} \ No newline at end of file diff --git a/packages/plugs/core/item.ts b/packages/plugs/core/item.ts index 6c713ad..a36c107 100644 --- a/packages/plugs/core/item.ts +++ b/packages/plugs/core/item.ts @@ -59,7 +59,7 @@ export async function indexItems({ name, tree }: IndexTreeEvent) { export async function queryProvider({ query, -}: QueryProviderEvent): Promise { +}: QueryProviderEvent): Promise { let allItems: Item[] = []; for (let { key, page, value } of await scanPrefixGlobal("it:")) { let [, pos] = key.split(":"); @@ -69,10 +69,5 @@ export async function queryProvider({ pos: +pos, }); } - let markdownItems = applyQuery(query, allItems).map( - (item) => - `* [[${item.page}@${item.pos}]] ${item.name}` + - (item.nested ? "\n " + item.nested : "") - ); - return markdownItems.join("\n"); + return applyQuery(query, allItems); } diff --git a/packages/plugs/core/page.ts b/packages/plugs/core/page.ts index 50bf971..f155809 100644 --- a/packages/plugs/core/page.ts +++ b/packages/plugs/core/page.ts @@ -65,44 +65,35 @@ export async function indexLinks({ name, tree }: IndexTreeEvent) { export async function pageQueryProvider({ query, -}: QueryProviderEvent): Promise { +}: QueryProviderEvent): Promise { let allPages = await listPages(); - if (query.select) { - let allPageMap: Map = new Map( - allPages.map((pm) => [pm.name, pm]) - ); - for (let { page, value } of await scanPrefixGlobal("meta:")) { - let p = allPageMap.get(page); - if (p) { - for (let [k, v] of Object.entries(value)) { - p[k] = v; - } + let allPageMap: Map = new Map( + allPages.map((pm) => [pm.name, pm]) + ); + for (let { page, value } of await scanPrefixGlobal("meta:")) { + let p = allPageMap.get(page); + if (p) { + for (let [k, v] of Object.entries(value)) { + p[k] = v; } } - allPages = [...allPageMap.values()]; - return jsonToMDTable(applyQuery(query, allPages), (k, v) => - k === "name" ? `[[${v}]]` : v - ); - } else { - return applyQuery(query, allPages) - .map((pageMeta: PageMeta) => `* [[${pageMeta.name}]]`) - .join("\n"); } + allPages = [...allPageMap.values()]; + return applyQuery(query, allPages); } export async function linkQueryProvider({ query, pageName, -}: QueryProviderEvent): Promise { +}: QueryProviderEvent): Promise { let uniqueLinks = new Set(); for (let { value: name } of await scanPrefixGlobal(`pl:${pageName}:`)) { uniqueLinks.add(name); } - let markdownLinks = applyQuery( + return applyQuery( query, [...uniqueLinks].map((l) => ({ name: l })) - ).map((pageMeta) => `* [[${pageMeta.name}]]`); - return markdownLinks.join("\n"); + ); } export async function deletePage() { diff --git a/packages/plugs/github/github.plug.yaml b/packages/plugs/github/github.plug.yaml new file mode 100644 index 0000000..c27957f --- /dev/null +++ b/packages/plugs/github/github.plug.yaml @@ -0,0 +1,6 @@ +name: github +functions: + test: + path: ./github.ts:queryEvents + events: + - query:gh-events diff --git a/packages/plugs/github/github.ts b/packages/plugs/github/github.ts new file mode 100644 index 0000000..7bec413 --- /dev/null +++ b/packages/plugs/github/github.ts @@ -0,0 +1,84 @@ +import { applyQuery, QueryProviderEvent, renderQuery } from "../query/engine"; +import { jsonToMDTable } from "../query/util"; + +type GithubEvent = { + id: string; + type: string; + actor: GithubUser; + repo: GithubRepo; + created_at: string; + payload: any; + org: GithubOrg; +}; + +type GithubUser = { + id: number; + login: string; + display_login: string; + url: string; +}; + +type GithubRepo = { + id: number; + name: string; + url: string; +}; + +type GithubOrg = { + id: number; + login: string; + url: string; +}; + +type ExposedEvent = { + id: string; + type: string; + username: string; + repo: string; +}; + +async function listEvents(username: string): Promise { + let events = await fetch(`https://api.github.com/users/${username}/events`); + return await events.json(); +} + +async function listIssues(filter: string): Promise { + let issues = await fetch( + `https://api.github.com/issues?q=${encodeURIComponent(filter)}` + ); + return await issues.json(); +} + +function mapEvent(event: GithubEvent): any { + // console.log("Event", event); + return { + ...event.payload, + id: event.id, + type: event.type, + username: event.actor.login, + repo: event.repo.name, + date: event.created_at.split("T")[0], + }; +} + +export async function queryEvents({ + query, +}: QueryProviderEvent): Promise { + let usernameFilter = query.filter.find((f) => f.prop === "username"); + if (!usernameFilter) { + throw Error("No 'username' filter specified, this is mandatory"); + } + let username = usernameFilter.value; + let allEvents = (await listEvents(username)).map(mapEvent); + return applyQuery(query, allEvents); +} + +// export async function queryIssues({ +// query, +// }: QueryProviderEvent): Promise { +// let filter = query.filter.find((f) => f.prop === "filter"); +// if (!filter) { +// throw Error("No 'filter' specified, this is mandatory"); +// } +// let username = filter.value; +// } diff --git a/packages/plugs/mattermost/mattermost.ts b/packages/plugs/mattermost/mattermost.ts index d9588de..0bba9a5 100644 --- a/packages/plugs/mattermost/mattermost.ts +++ b/packages/plugs/mattermost/mattermost.ts @@ -5,6 +5,9 @@ import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markd import { extractMeta } from "../query/data"; import { niceDate } from "../core/dates"; import { Post } from "@mattermost/types/lib/posts"; +import { ServerChannel } from "@mattermost/types/lib/channels"; +import { UserProfile } from "@mattermost/types/lib/users"; +import { Team } from "@mattermost/types/lib/teams"; type AugmentedPost = Post & { // Dates we can use to filter @@ -25,6 +28,7 @@ function mattermostDesktopUrlForPost( type MattermostConfig = { url: string; token: string; + defaultTeam: string; }; async function getConfig(): Promise { @@ -46,11 +50,49 @@ function augmentPost(post: AugmentedPost) { } } +class CachingClient4 { + constructor(public client: Client4) {} + + private channelCache = new Map(); + async getChannelCached(channelId: string): Promise { + let channel = this.channelCache.get(channelId); + if (channel) { + return channel; + } + channel = await this.client.getChannel(channelId); + this.channelCache.set(channelId, channel!); + return channel!; + } + + private teamCache = new Map(); + async getTeamCached(teamId: string): Promise { + let team = this.teamCache.get(teamId); + if (team) { + return team; + } + team = await this.client.getTeam(teamId); + this.teamCache.set(teamId, team!); + return team!; + } + + private userCache = new Map(); + async getUserCached(userId: string): Promise { + let user = this.userCache.get(userId); + if (user) { + return user; + } + user = await this.client.getUser(userId); + this.userCache.set(userId, user!); + return user!; + } +} + export async function savedPostsQueryProvider({ query, -}: QueryProviderEvent): Promise { +}: QueryProviderEvent): Promise { let config = await getConfig(); let client = new Client4(); + let cachingClient = new CachingClient4(client); client.setUrl(config.url); client.setToken(config.token); let me = await client.getMe(); @@ -61,20 +103,22 @@ export async function savedPostsQueryProvider({ augmentPost(post); savedPosts.push(post); } - let savedPostsMd = []; + let resultSavedPosts = []; savedPosts = applyQuery(query, savedPosts); for (let savedPost of savedPosts) { - let channel = await client.getChannel(savedPost.channel_id); - let team = await client.getTeam(channel.team_id); - savedPostsMd.push( - `@${(await client.getUser(savedPost.user_id)).username} [${ - savedPost.createdAt - }](${mattermostDesktopUrlForPost( - client.url, - team.name, - savedPost.id - )}):\n> ${savedPost.message.substring(0, 1000).replaceAll(/\n/g, "\n> ")}` - ); + let channel = await cachingClient.getChannelCached(savedPost.channel_id); + let teamName = config.defaultTeam; + if (channel.team_id) { + let team = await cachingClient.getTeamCached(channel.team_id); + teamName = team.name; + } + resultSavedPosts.push({ + ...savedPost, + user: await cachingClient.getUserCached(savedPost.user_id), + channel: channel, + teamName: teamName, + url: mattermostDesktopUrlForPost(client.url, teamName, savedPost.id), + }); } - return savedPostsMd.join("\n\n"); + return resultSavedPosts; } diff --git a/packages/plugs/package-lock.json b/packages/plugs/package-lock.json new file mode 100644 index 0000000..d4d6d2d --- /dev/null +++ b/packages/plugs/package-lock.json @@ -0,0 +1,1427 @@ +{ + "name": "@silverbulletmd/plugs", + "version": "0.0.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@silverbulletmd/plugs", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "@jest/globals": "^27.5.1", + "@lezer/generator": "^0.15.4", + "@lezer/lr": "^0.15.8", + "@mattermost/client": "^6.7.0-0", + "@mattermost/types": "^6.7.0-0", + "@types/yaml": "^1.9.7", + "handlebars": "^4.7.7", + "markdown-it": "^12.3.2", + "markdown-it-task-lists": "^2.1.1", + "yaml": "^2.0.0" + }, + "devDependencies": { + "@types/markdown-it": "^12.2.3" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dependencies": { + "@babel/highlight": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", + "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@jest/environment": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-27.5.1.tgz", + "integrity": "sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA==", + "dependencies": { + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "jest-mock": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.5.1.tgz", + "integrity": "sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ==", + "dependencies": { + "@jest/types": "^27.5.1", + "@sinonjs/fake-timers": "^8.0.1", + "@types/node": "*", + "jest-message-util": "^27.5.1", + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-27.5.1.tgz", + "integrity": "sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q==", + "dependencies": { + "@jest/environment": "^27.5.1", + "@jest/types": "^27.5.1", + "expect": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/types": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", + "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^16.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@lezer/common": { + "version": "0.15.12", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-0.15.12.tgz", + "integrity": "sha512-edfwCxNLnzq5pBA/yaIhwJ3U3Kz8VAUOTRg0hhxaizaI1N+qxV7EXDv/kLCkLeq2RzSFvxexlaj5Mzfn2kY0Ig==" + }, + "node_modules/@lezer/generator": { + "version": "0.15.4", + "resolved": "https://registry.npmjs.org/@lezer/generator/-/generator-0.15.4.tgz", + "integrity": "sha512-9bBwU2TzKMBQ6OCEDevuMNWGOBKlkq5YIGEhjrz9pb3MLb+oYYR4dVFZ7ehwLcDoSecsSA7PdlAy0thJO5pt2w==", + "dependencies": { + "@lezer/common": "^0.15.0", + "@lezer/lr": "^0.15.0" + }, + "bin": { + "lezer-generator": "dist/lezer-generator.cjs" + } + }, + "node_modules/@lezer/lr": { + "version": "0.15.8", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-0.15.8.tgz", + "integrity": "sha512-bM6oE6VQZ6hIFxDNKk8bKPa14hqFrV07J/vHGOeiAbJReIaQXmkVb6xQu4MR+JBTLa5arGRyAAjJe1qaQt3Uvg==", + "dependencies": { + "@lezer/common": "^0.15.0" + } + }, + "node_modules/@mattermost/client": { + "version": "6.7.0-0", + "resolved": "https://registry.npmjs.org/@mattermost/client/-/client-6.7.0-0.tgz", + "integrity": "sha512-XIKEWYmadlCh3Bb3JwMi65raKe7jhBLPJ5DPPu6FPMZc4FoM1YoHdPfrkuT1c2KgcTX5HNbkGd1cXV6cLXxHUw==", + "dependencies": { + "form-data": "^4.0.0" + }, + "peerDependencies": { + "@mattermost/types": "*", + "typescript": "^4.3" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@mattermost/types": { + "version": "6.7.0-0", + "resolved": "https://registry.npmjs.org/@mattermost/types/-/types-6.7.0-0.tgz", + "integrity": "sha512-mT8wJwWEp20KPo9D12y7bW7EdUHO7VhUHxr3gH8nPGapWooGcl0Ra0H3u1iCjPpqPWvp7LiodcneU0IysunYKQ==", + "peerDependencies": { + "typescript": "^4.3" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@sinonjs/commons": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", + "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz", + "integrity": "sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==", + "dependencies": { + "@sinonjs/commons": "^1.7.0" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/linkify-it": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz", + "integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==", + "dev": true + }, + "node_modules/@types/markdown-it": { + "version": "12.2.3", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", + "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", + "dev": true, + "dependencies": { + "@types/linkify-it": "*", + "@types/mdurl": "*" + } + }, + "node_modules/@types/mdurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", + "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "17.0.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.29.tgz", + "integrity": "sha512-tx5jMmMFwx7wBwq/V7OohKDVb/JwJU5qCVkeLMh1//xycAJ/ESuw9aJ9SEtlCZDYi2pBfe4JkisSoAtbOsBNAA==" + }, + "node_modules/@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==" + }, + "node_modules/@types/yaml": { + "version": "1.9.7", + "resolved": "https://registry.npmjs.org/@types/yaml/-/yaml-1.9.7.tgz", + "integrity": "sha512-8WMXRDD1D+wCohjfslHDgICd2JtMATZU8CkhH8LVJqcJs6dyYj5TGptzP8wApbmEullGBSsCEzzap73DQ1HJaA==", + "deprecated": "This is a stub types definition. yaml provides its own type definitions, so you do not need this installed.", + "dependencies": { + "yaml": "*" + } + }, + "node_modules/@types/yargs": { + "version": "16.0.4", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", + "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ci-info": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", + "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==" + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/diff-sequences": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", + "integrity": "sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==", + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/entities": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", + "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/expect": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz", + "integrity": "sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw==", + "dependencies": { + "@jest/types": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + }, + "node_modules/handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/jest-diff": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz", + "integrity": "sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", + "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz", + "integrity": "sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw==", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.5.1.tgz", + "integrity": "sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^27.5.1", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^27.5.1", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-mock": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-27.5.1.tgz", + "integrity": "sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og==", + "dependencies": { + "@jest/types": "^27.5.1", + "@types/node": "*" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-util": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", + "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "dependencies": { + "@jest/types": "^27.5.1", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/linkify-it": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "dependencies": { + "uc.micro": "^1.0.1" + } + }, + "node_modules/markdown-it": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", + "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "dependencies": { + "argparse": "^2.0.1", + "entities": "~2.1.0", + "linkify-it": "^3.0.1", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + }, + "bin": { + "markdown-it": "bin/markdown-it.js" + } + }, + "node_modules/markdown-it-task-lists": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz", + "integrity": "sha512-TxFAc76Jnhb2OUu+n3yz9RMu4CwGfaT788br6HhEDlvWfdeJcLUsxk1Hgw2yJio0OXsxv7pyIPmvECY7bMbluA==" + }, + "node_modules/mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=" + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stack-utils": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", + "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "engines": { + "node": ">=4" + } + }, + "node_modules/uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" + }, + "node_modules/uglify-js": { + "version": "3.15.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.4.tgz", + "integrity": "sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA==", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, + "node_modules/yaml": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.1.tgz", + "integrity": "sha512-1NpAYQ3wjzIlMs0mgdBmYzLkFgWBIWrzYVDYfrixhoFNNgJ444/jT2kUT2sicRbJES3oQYRZugjB6Ro8SjKeFg==", + "engines": { + "node": ">= 14" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==" + }, + "@babel/highlight": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", + "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@jest/environment": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-27.5.1.tgz", + "integrity": "sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA==", + "requires": { + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "jest-mock": "^27.5.1" + } + }, + "@jest/fake-timers": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.5.1.tgz", + "integrity": "sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ==", + "requires": { + "@jest/types": "^27.5.1", + "@sinonjs/fake-timers": "^8.0.1", + "@types/node": "*", + "jest-message-util": "^27.5.1", + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1" + } + }, + "@jest/globals": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-27.5.1.tgz", + "integrity": "sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q==", + "requires": { + "@jest/environment": "^27.5.1", + "@jest/types": "^27.5.1", + "expect": "^27.5.1" + } + }, + "@jest/types": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", + "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^16.0.0", + "chalk": "^4.0.0" + } + }, + "@lezer/common": { + "version": "0.15.12", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-0.15.12.tgz", + "integrity": "sha512-edfwCxNLnzq5pBA/yaIhwJ3U3Kz8VAUOTRg0hhxaizaI1N+qxV7EXDv/kLCkLeq2RzSFvxexlaj5Mzfn2kY0Ig==" + }, + "@lezer/generator": { + "version": "0.15.4", + "resolved": "https://registry.npmjs.org/@lezer/generator/-/generator-0.15.4.tgz", + "integrity": "sha512-9bBwU2TzKMBQ6OCEDevuMNWGOBKlkq5YIGEhjrz9pb3MLb+oYYR4dVFZ7ehwLcDoSecsSA7PdlAy0thJO5pt2w==", + "requires": { + "@lezer/common": "^0.15.0", + "@lezer/lr": "^0.15.0" + } + }, + "@lezer/lr": { + "version": "0.15.8", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-0.15.8.tgz", + "integrity": "sha512-bM6oE6VQZ6hIFxDNKk8bKPa14hqFrV07J/vHGOeiAbJReIaQXmkVb6xQu4MR+JBTLa5arGRyAAjJe1qaQt3Uvg==", + "requires": { + "@lezer/common": "^0.15.0" + } + }, + "@mattermost/client": { + "version": "6.7.0-0", + "resolved": "https://registry.npmjs.org/@mattermost/client/-/client-6.7.0-0.tgz", + "integrity": "sha512-XIKEWYmadlCh3Bb3JwMi65raKe7jhBLPJ5DPPu6FPMZc4FoM1YoHdPfrkuT1c2KgcTX5HNbkGd1cXV6cLXxHUw==", + "requires": { + "form-data": "^4.0.0" + } + }, + "@mattermost/types": { + "version": "6.7.0-0", + "resolved": "https://registry.npmjs.org/@mattermost/types/-/types-6.7.0-0.tgz", + "integrity": "sha512-mT8wJwWEp20KPo9D12y7bW7EdUHO7VhUHxr3gH8nPGapWooGcl0Ra0H3u1iCjPpqPWvp7LiodcneU0IysunYKQ==", + "requires": {} + }, + "@sinonjs/commons": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", + "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz", + "integrity": "sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==", + "requires": { + "@sinonjs/commons": "^1.7.0" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==" + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/linkify-it": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz", + "integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==", + "dev": true + }, + "@types/markdown-it": { + "version": "12.2.3", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", + "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", + "dev": true, + "requires": { + "@types/linkify-it": "*", + "@types/mdurl": "*" + } + }, + "@types/mdurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", + "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", + "dev": true + }, + "@types/node": { + "version": "17.0.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.29.tgz", + "integrity": "sha512-tx5jMmMFwx7wBwq/V7OohKDVb/JwJU5qCVkeLMh1//xycAJ/ESuw9aJ9SEtlCZDYi2pBfe4JkisSoAtbOsBNAA==" + }, + "@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==" + }, + "@types/yaml": { + "version": "1.9.7", + "resolved": "https://registry.npmjs.org/@types/yaml/-/yaml-1.9.7.tgz", + "integrity": "sha512-8WMXRDD1D+wCohjfslHDgICd2JtMATZU8CkhH8LVJqcJs6dyYj5TGptzP8wApbmEullGBSsCEzzap73DQ1HJaA==", + "requires": { + "yaml": "*" + } + }, + "@types/yargs": { + "version": "16.0.4", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", + "integrity": "sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==", + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "ci-info": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", + "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==" + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "diff-sequences": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", + "integrity": "sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==" + }, + "entities": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", + "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==" + }, + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + }, + "expect": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz", + "integrity": "sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw==", + "requires": { + "@jest/types": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + }, + "handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "jest-diff": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz", + "integrity": "sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==", + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + } + }, + "jest-get-type": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", + "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==" + }, + "jest-matcher-utils": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz", + "integrity": "sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw==", + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + } + }, + "jest-message-util": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.5.1.tgz", + "integrity": "sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==", + "requires": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^27.5.1", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^27.5.1", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-mock": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-27.5.1.tgz", + "integrity": "sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og==", + "requires": { + "@jest/types": "^27.5.1", + "@types/node": "*" + } + }, + "jest-util": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", + "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "requires": { + "@jest/types": "^27.5.1", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "linkify-it": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "requires": { + "uc.micro": "^1.0.1" + } + }, + "markdown-it": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", + "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "requires": { + "argparse": "^2.0.1", + "entities": "~2.1.0", + "linkify-it": "^3.0.1", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + } + }, + "markdown-it-task-lists": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz", + "integrity": "sha512-TxFAc76Jnhb2OUu+n3yz9RMu4CwGfaT788br6HhEDlvWfdeJcLUsxk1Hgw2yJio0OXsxv7pyIPmvECY7bMbluA==" + }, + "mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=" + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "requires": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==" + } + } + }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "stack-utils": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", + "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "requires": { + "escape-string-regexp": "^2.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" + }, + "uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" + }, + "uglify-js": { + "version": "3.15.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.4.tgz", + "integrity": "sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA==", + "optional": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, + "yaml": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.1.tgz", + "integrity": "sha512-1NpAYQ3wjzIlMs0mgdBmYzLkFgWBIWrzYVDYfrixhoFNNgJ444/jT2kUT2sicRbJES3oQYRZugjB6Ro8SjKeFg==" + } + } +} diff --git a/packages/plugs/package.json b/packages/plugs/package.json index 77a7eb3..f399fd6 100644 --- a/packages/plugs/package.json +++ b/packages/plugs/package.json @@ -8,12 +8,28 @@ "license": "MIT", "scripts": { "generate": "lezer-generator query/query.grammar -o query/parse-query.js", - "watch": "plugos-bundle -w --dist dist --exclude @lezer/lr yaml -- */*.plug.yaml", - "build": "plugos-bundle --dist dist --exclude @lezer/lr yaml -- */*.plug.yaml" + "watch": "plugos-bundle -w --dist dist --exclude @lezer/lr yaml handlebars -- */*.plug.yaml", + "build": "plugos-bundle --dist dist --exclude @lezer/lr yaml handlebars -- */*.plug.yaml", + "test": "jest build/test" }, "files": [ "dist" ], + "targets": { + "test": { + "source": [ + "query/engine.test.ts" + ], + "outputFormat": "commonjs", + "isLibrary": true, + "context": "node", + "includeNodeModules": [ + "@silverbulletmd/common", + "@silverbulletmd/plugos-silverbullet-syscall" + ], + "distDir": "build/test" + } + }, "dependencies": { "@jest/globals": "^27.5.1", "@lezer/generator": "^0.15.4", diff --git a/packages/plugs/plugmanager/plugmanager.plug.yaml b/packages/plugs/plugmanager/plugmanager.plug.yaml index 204dfa0..8f0b02a 100644 --- a/packages/plugs/plugmanager/plugmanager.plug.yaml +++ b/packages/plugs/plugmanager/plugmanager.plug.yaml @@ -9,6 +9,12 @@ functions: updatePlugs: path: ./plugmanager.ts:updatePlugs env: server + check: + path: "./plugmanager.ts:checkCommand" + command: + name: "Plug: Check" + mac: "Cmd-Alt-c" + key: "Ctrl-Alt-c" compile: path: "./plugmanager.ts:compileCommand" command: diff --git a/packages/plugs/plugmanager/plugmanager.ts b/packages/plugs/plugmanager/plugmanager.ts index 1527d96..fdd563b 100644 --- a/packages/plugs/plugmanager/plugmanager.ts +++ b/packages/plugs/plugmanager/plugmanager.ts @@ -36,7 +36,18 @@ export async function compileCommand() { ); console.log("Wrote this plug", manifest); await hideBhs(); - // Important not to await! + await reloadPlugs(); + } catch (e: any) { + await showBhs(e.message); + // console.error("Got this error from compiler", e.message); + } +} + +export async function checkCommand() { + let text = await getText(); + try { + await compileDefinition(text); + await hideBhs(); reloadPlugs(); } catch (e: any) { await showBhs(e.message); diff --git a/packages/plugs/query/data.ts b/packages/plugs/query/data.ts index 394623d..687ad94 100644 --- a/packages/plugs/query/data.ts +++ b/packages/plugs/query/data.ts @@ -86,7 +86,7 @@ export function extractMeta(parseTree: ParseTree, remove = false): any { export async function queryProvider({ query, -}: QueryProviderEvent): Promise { +}: QueryProviderEvent): Promise { let allData: any[] = []; for (let { key, page, value } of await scanPrefixGlobal("data:")) { let [, pos] = key.split("@"); @@ -96,6 +96,5 @@ export async function queryProvider({ pos: +pos, }); } - let resultData = applyQuery(query, allData); - return jsonToMDTable(resultData); + return applyQuery(query, allData); } diff --git a/packages/plugs/query/engine.test.ts b/packages/plugs/query/engine.test.ts index 8c5c2e4..211044e 100644 --- a/packages/plugs/query/engine.test.ts +++ b/packages/plugs/query/engine.test.ts @@ -47,6 +47,25 @@ test("Test parser", () => { "name", "age", ]); + + expect( + parseQuery(`gh-events where type in ["PushEvent", "somethingElse"]`) + ).toStrictEqual({ + table: "gh-events", + filter: [ + { + op: "in", + prop: "type", + value: ["PushEvent", "somethingElse"], + }, + ], + }); + + expect(parseQuery(`something render "template/table"`)).toStrictEqual({ + table: "something", + filter: [], + render: "template/table", + }); }); test("Test performing the queries", () => { @@ -92,4 +111,8 @@ test("Test performing the queries", () => { expect( applyQuery(parseQuery(`page where age > 30 select name`), data) ).toStrictEqual([{ name: "Pete" }]); + + expect( + applyQuery(parseQuery(`page where name in ["Pete"] select name`), data) + ).toStrictEqual([{ name: "Pete" }]); }); diff --git a/packages/plugs/query/engine.ts b/packages/plugs/query/engine.ts index 50b5db9..2024cf7 100644 --- a/packages/plugs/query/engine.ts +++ b/packages/plugs/query/engine.ts @@ -1,8 +1,17 @@ -import { collectNodesOfType, findNodeOfType, replaceNodesMatching } from "@silverbulletmd/common/tree"; +import { + collectNodesOfType, + findNodeOfType, + ParseTree, + replaceNodesMatching, +} from "@silverbulletmd/common/tree"; import { lezerToParseTree } from "@silverbulletmd/common/parse_tree"; +import Handlebars from "handlebars"; +import YAML from "yaml"; // @ts-ignore import { parser } from "./parse-query"; +import { readPage } from "@silverbulletmd/plugos-silverbullet-syscall/space"; +import { niceDate } from "../core/dates"; export type QueryProviderEvent = { query: ParsedQuery; @@ -22,6 +31,7 @@ export type ParsedQuery = { limit?: number; filter: Filter[]; select?: string[]; + render?: string; }; export function parseQuery(query: string): ParsedQuery { @@ -56,34 +66,14 @@ export function parseQuery(query: string): ParsedQuery { let limitNode = findNodeOfType(queryNode, "LimitClause"); if (limitNode) { let nameNode = findNodeOfType(limitNode, "Number"); - parsedQuery.limit = +nameNode!.children![0].text!; + parsedQuery.limit = valueNodeToVal(nameNode!); } + let filterNodes = collectNodesOfType(queryNode, "FilterExpr"); for (let filterNode of filterNodes) { let val: any = undefined; let valNode = filterNode.children![2].children![0]; - switch (valNode.type) { - case "Number": - val = valNode.children![0].text!; - break; - case "Bool": - val = valNode.children![0].text! === "true"; - break; - case "Null": - val = null; - break; - case "Name": - val = valNode.children![0].text!; - break; - case "Regex": - val = valNode.children![0].text!; - val = val.substring(1, val.length - 1); - break; - case "String": - val = valNode.children![0].text!; - val = val.substring(1, val.length - 1); - break; - } + val = valueNodeToVal(valNode); let f: Filter = { prop: filterNode.children![0].children![0].text!, op: filterNode.children![1].text!, @@ -93,7 +83,7 @@ export function parseQuery(query: string): ParsedQuery { } let selectNode = findNodeOfType(queryNode, "SelectClause"); if (selectNode) { - console.log("Select node", JSON.stringify(selectNode)); + // console.log("Select node", JSON.stringify(selectNode)); parsedQuery.select = []; collectNodesOfType(selectNode, "Name").forEach((t) => { parsedQuery.select!.push(t.children![0].text!); @@ -102,10 +92,39 @@ export function parseQuery(query: string): ParsedQuery { // parsedQuery.limit = +nameNode!.children![0].text!; } + let renderNode = findNodeOfType(queryNode, "RenderClause"); + if (renderNode) { + let renderNameNode = findNodeOfType(renderNode, "String"); + parsedQuery.render = valueNodeToVal(renderNameNode!); + } + // console.log(JSON.stringify(queryNode, null, 2)); return parsedQuery; } +function valueNodeToVal(valNode: ParseTree): any { + switch (valNode.type) { + case "Number": + return +valNode.children![0].text!; + case "Bool": + return valNode.children![0].text! === "true"; + case "Null": + return null; + case "Name": + return valNode.children![0].text!; + case "Regex": + let val = valNode.children![0].text!; + return val.substring(1, val.length - 1); + case "String": + let stringVal = valNode.children![0].text!; + return stringVal.substring(1, stringVal.length - 1); + case "List": + return collectNodesOfType(valNode, "Value").map((t) => + valueNodeToVal(t.children![0]) + ); + } +} + export function applyQuery(parsedQuery: ParsedQuery, records: T[]): T[] { let resultRecords: any[] = []; if (parsedQuery.filter.length === 0) { @@ -156,6 +175,11 @@ export function applyQuery(parsedQuery: ParsedQuery, records: T[]): T[] { continue recordLoop; } break; + case "in": + if (!value.includes(recordAny[prop])) { + continue recordLoop; + } + break; } } resultRecords.push(recordAny); @@ -191,3 +215,33 @@ export function applyQuery(parsedQuery: ParsedQuery, records: T[]): T[] { } return resultRecords; } + +export async function renderQuery( + parsedQuery: ParsedQuery, + data: any[] +): Promise { + if (parsedQuery.render) { + Handlebars.registerHelper("json", (v) => JSON.stringify(v)); + Handlebars.registerHelper("niceDate", (ts) => niceDate(new Date(ts))); + Handlebars.registerHelper("yaml", (v, prefix) => { + if (typeof prefix === "string") { + let yaml = YAML.stringify(v) + .split("\n") + .join("\n" + prefix) + .trim(); + if (Array.isArray(v)) { + return "\n" + prefix + yaml; + } else { + return yaml; + } + } else { + return YAML.stringify(v).trim(); + } + }); + let { text: templateText } = await readPage(parsedQuery.render); + let template = Handlebars.compile(templateText, { noEscape: true }); + return template(data); + } + + return "ERROR"; +} diff --git a/packages/plugs/query/materialized_queries.ts b/packages/plugs/query/materialized_queries.ts index c058b2e..050d7cc 100644 --- a/packages/plugs/query/materialized_queries.ts +++ b/packages/plugs/query/materialized_queries.ts @@ -11,9 +11,9 @@ import { writePage, } from "@silverbulletmd/plugos-silverbullet-syscall/space"; import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system"; -import { parseQuery } from "./engine"; +import { parseQuery, renderQuery } from "./engine"; import { replaceTemplateVars } from "../core/template"; -import { queryRegex, removeQueries } from "./util"; +import { jsonToMDTable, queryRegex, removeQueries } from "./util"; import { dispatch } from "@plugos/plugos-syscall/event"; import { replaceAsync } from "../lib/util"; import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown"; @@ -57,7 +57,12 @@ export async function updateMaterializedQueriesOnPage(pageName: string) { if (results.length === 0) { return `${startQuery}\n${endQuery}`; } else if (results.length === 1) { - return `${startQuery}\n${results[0]}\n${endQuery}`; + if (parsedQuery.render) { + let rendered = await renderQuery(parsedQuery, results[0]); + return `${startQuery}\n${rendered.trim()}\n${endQuery}`; + } else { + return `${startQuery}\n${jsonToMDTable(results[0])}\n${endQuery}`; + } } else { console.error("Too many query results", results); return fullMatch; diff --git a/packages/plugs/query/parse-query.js b/packages/plugs/query/parse-query.js index eface02..b78cf95 100644 --- a/packages/plugs/query/parse-query.js +++ b/packages/plugs/query/parse-query.js @@ -1,21 +1,16 @@ // This file was generated by lezer-generator. You probably shouldn't edit it. -import { LRParser } from "@lezer/lr"; - +import {LRParser} from "@lezer/lr" export const parser = LRParser.deserialize({ version: 13, - states: - "%WOVQPOOO[QQO'#C^QOQPOOOmQPO'#C`OrQQO'#CjOwQPO'#ClO|QPO'#CmOOQO'#Cn'#CnO!RQQO,58xO!dQPO'#CcO#OQQO'#CaOOQO'#Ca'#CaOOQO,58z,58zO#dQPO,59UOOQO,59W,59WO#iQQO'#DWOOQO,59X,59XOOQO-E6l-E6lO#}QQO,58}OmQPO,58|O$cQQO1G.pO$zQPO'#CoO%PQQO,59rOOQO'#Cg'#CgOOQO'#Ci'#CiOOQO'#Cd'#CdOOQO1G.i1G.iOOQO1G.h1G.hOOQO'#Ck'#CkOOQO7+$[7+$[OOQO,59Z,59ZOOQO-E6m-E6m", - stateData: - "%e~OfOS~ORPO~OgROtSOxTOyUOdQX~ORXO~Ou]O~OX^O~OR_O~OgROtSOxTOyUOdQa~OhbOlbOmbOnbOobOpbOqbOrbO~OscOdTXgTXtTXxTXyTX~ORdO~O{eOdzXgzXtzXxzXyzX~OXiOYiO[iOigOjgOkhO~OvlOwlOd^ig^it^ix^iy^i~ORnO~O{eOdzagzatzaxzayza~O", - goto: "!y{PP|P!P!T!W!Z!aPP!dP!d!P!g!P!P!j!pPPPPPPPPPPPPPPPPPPPPPP!vRQOTVPWR[RRZRQYRRkcRjbRibRmdQWPRaWQf_RofR`U", - nodeNames: - "⚠ Program Query Name WhereClause LogicalExpr AndExpr FilterExpr Value Number String Bool Regex Null OrderClause Order LimitClause SelectClause", - maxTerm: 43, + states: "&fOVQPOOOmQQO'#C^QOQPOOOtQPO'#C`OyQQO'#CkO!OQPO'#CmO!TQPO'#CnO!YQPO'#CoOOQO'#Cp'#CpO!_QQO,58xO!fQQO'#CcO#TQQO'#CaOOQO'#Ca'#CaOOQO,58z,58zO#lQPO,59VOOQO,59X,59XO#qQQO'#D`OOQO,59Y,59YOOQO,59Z,59ZOOQO-E6n-E6nO$YQQO,58}OtQPO,58|O$qQQO1G.qO%]QPO'#CrO%bQQO,59zOOQO'#Cg'#CgOOQO'#Ci'#CiO$YQQO'#CjOOQO'#Cd'#CdOOQO1G.i1G.iOOQO1G.h1G.hOOQO'#Cl'#ClOOQO7+$]7+$]OOQO,59^,59^OOQO-E6p-E6pO%yQPO'#C|O&RQPO,59UO$YQQO'#CqO&WQPO,59hOOQO1G.p1G.pOOQO,59],59]OOQO-E6o-E6o", + stateData: "&`~OiOS~ORPO~OjRO|SO!QTO!RUO!TVO~OgQX~P[ORYO~O}^O~OX_O~OR`O~OYbO~OgQa~P[OkdOsdOtdOudOvdOwdOxdOydOzdO~O{eOgTXjTX|TX!QTX!RTX!TTX~ORfO~OqgOg!SXj!SX|!SX!Q!SX!R!SX!T!SX~OXlOYlO[lOliOmiOnjOokO~O!OoO!PoOg_ij_i|_i!Q_i!R_i!T_i~ORqO~OqgOg!Saj!Sa|!Sa!Q!Sa!R!Sa!T!Sa~OquOrpX~OrwO~OquOrpa~O", + goto: "#d!TPP!UP!X!]!`!c!iPP!rP!r!r!X!w!X!X!X!z#Q#WPPPPPPPPP#^PPPPPPPPPPPPPPPPP#aRQOTWPXR]RR[RQZRRneQmdQskRxuVldkuRpfQXPRcXQvsRyvQh`RrhRtkRaU", + nodeNames: "⚠ Program Query Name WhereClause L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TURP}!O%h!c!}%h#R#S%h#T#f%h#f#g9g#g#o%hR9lURP}!O%h!c!}%h#R#S%h#T#i%h#i#j:O#j#o%hR:TURP}!O%h!c!}%h#R#S%h#T#X%h#X#Y:g#Y#o%hR:nSiQRP}!O%h!c!}%h#R#S%h#T#o%hR;PURP}!O%h!c!}%h#R#S%h#T#[%h#[#];c#]#o%hR;hURP}!O%h!c!}%h#R#S%h#T#X%h#X#Y;z#Y#o%hRa#j#o%wR>fURP}!O%w!c!}%w#R#S%w#T#X%w#X#Y>x#Y#o%wR?PSlQRP}!O%w!c!}%w#R#S%w#T#o%wR?bURP}!O%w!c!}%w#R#S%w#T#[%w#[#]?t#]#o%wR?yURP}!O%w!c!}%w#R#S%w#T#X%w#X#Y@]#Y#o%wR@bURP}!O%w!c!}%w#R#S%w#T#f%w#f#g@t#g#o%wR@yURP}!O%w!c!}%w#R#S%w#T#X%w#X#YA]#Y#o%wRAdSjQRP}!O%w!c!}%w#R#S%w#T#o%w", tokenizers: [0, 1], - topRules: { Program: [0, 1] }, - tokenPrec: 0, -}); + topRules: {"Program":[0,1]}, + tokenPrec: 0 +}) diff --git a/packages/plugs/query/parse-query.terms.js b/packages/plugs/query/parse-query.terms.js index a7815a0..5e020bb 100644 --- a/packages/plugs/query/parse-query.terms.js +++ b/packages/plugs/query/parse-query.terms.js @@ -13,7 +13,9 @@ export const Bool = 11, Regex = 12, Null = 13, - OrderClause = 14, - Order = 15, - LimitClause = 16, - SelectClause = 17 + List = 14, + OrderClause = 15, + Order = 16, + LimitClause = 17, + SelectClause = 18, + RenderClause = 19 diff --git a/packages/plugs/query/query.grammar b/packages/plugs/query/query.grammar index d5634af..3af872a 100644 --- a/packages/plugs/query/query.grammar +++ b/packages/plugs/query/query.grammar @@ -3,7 +3,7 @@ @top Program { Query } Query { - Name ( WhereClause | OrderClause | LimitClause | SelectClause )* + Name ( WhereClause | OrderClause | LimitClause | SelectClause | RenderClause )* } commaSep { content ("," content)* } @@ -12,12 +12,13 @@ WhereClause { "where" LogicalExpr } OrderClause { "order" "by" Name Order? } LimitClause { "limit" Number } SelectClause { "select" commaSep } +RenderClause { "render" String } Order { "desc" | "asc" } -Value { Number | String | Bool | Regex | Null } +Value { Number | String | Bool | Regex | Null | List } LogicalExpr { AndExpr | FilterExpr } @@ -32,8 +33,11 @@ FilterExpr { | Name ">" Value | Name "=~" Value | Name "!=~" Value +| Name "in" Value } +List { "[" commaSep "]" } + @skip { space } diff --git a/packages/plugs/tasks/task.ts b/packages/plugs/tasks/task.ts index 48d5a00..10f9d8d 100644 --- a/packages/plugs/tasks/task.ts +++ b/packages/plugs/tasks/task.ts @@ -25,7 +25,7 @@ import { renderToText, } from "@silverbulletmd/common/tree"; import { removeQueries } from "../query/util"; -import { applyQuery, QueryProviderEvent } from "../query/engine"; +import { applyQuery, QueryProviderEvent, renderQuery } from "../query/engine"; import { niceDate } from "../core/dates"; export type Task = { @@ -195,7 +195,7 @@ export async function postponeCommand() { export async function queryProvider({ query, -}: QueryProviderEvent): Promise { +}: QueryProviderEvent): Promise { let allTasks: Task[] = []; for (let { key, page, value } of await scanPrefixGlobal("task:")) { let [, pos] = key.split(":"); @@ -205,10 +205,5 @@ export async function queryProvider({ pos: pos, }); } - let markdownTasks = applyQuery(query, allTasks).map( - (t) => - `* [${t.done ? "x" : " "}] [[${t.page}@${t.pos}]] ${t.name}` + - (t.nested ? "\n " + t.nested : "") - ); - return markdownTasks.join("\n"); + return applyQuery(query, allTasks); } diff --git a/packages/server/package.json b/packages/server/package.json index c7d4628..dd116e0 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -10,7 +10,7 @@ "silverbullet": "./dist/server.js" }, "scripts": { - "start": "nodemon -w dist dist/server.js ../../pages" + "start": "nodemon -w dist --exec 'node --enable-source-maps dist/server.js ../../pages'" }, "targets": { "server": {