From a0fb6dfb3112b40d559c51e62e714cdd640b94f2 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Fri, 27 May 2022 21:30:57 +0800 Subject: [PATCH 01/42] =?UTF-8?q?=F0=9F=91=B7=20ci(bot/publish):=20switch?= =?UTF-8?q?=20to=20manual=20mode=20[no=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- .github/workflows/publish.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 99666bb1..cfc417df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,4 @@ -on: - release: - types: [created] +on: workflow_dispatch name: Publish to npmjs jobs: publish-to-npm: From 7277002e652bacf3dd2b67d2d9dc41fb428ced81 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 25 Jun 2022 23:00:00 +0800 Subject: [PATCH 02/42] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20chore:=20upgrade=20d?= =?UTF-8?q?eps=20and=20deps-dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 303 +++++++++++++++++++++++++++++++--------------- package.json | 22 ++-- 2 files changed, 215 insertions(+), 110 deletions(-) diff --git a/package-lock.json b/package-lock.json index b8b045e0..b429c5cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,10 @@ "license": "Apache-2.0", "dependencies": { "@dapr/dapr": "^2.2.1", - "body-parser": "^1.18.3", - "cloudevents": "^6.0.1", + "body-parser": "^1.20.0", + "cloudevents": "^6.0.2", "debug": "^4.3.4", - "express": "^4.16.4", + "express": "^4.18.1", "express-interceptor": "^1.2.0", "lodash": "^4.17.21", "minimist": "^1.2.5", @@ -26,21 +26,23 @@ "functions-framework-nodejs": "build/src/main.js" }, "devDependencies": { - "@microsoft/api-extractor": "^7.24.0", + "@microsoft/api-extractor": "^7.26.1", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", "@types/express": "4.17.13", - "@types/lodash": "^4.14.179", + "@types/google-protobuf": "^3.15.6", + "@types/lodash": "^4.14.182", "@types/minimist": "1.2.2", "@types/mocha": "9.1.1", "@types/node": "14.18.11", + "@types/node-fetch": "^2.6.2", "@types/on-finished": "2.3.1", - "@types/semver": "^7.3.6", + "@types/semver": "^7.3.10", "@types/shelljs": "^0.8.11", - "@types/sinon": "^10.0.0", - "@types/supertest": "2.0.11", + "@types/sinon": "^10.0.11", + "@types/supertest": "2.0.12", "aedes": "^0.47.0", - "concurrently": "^7.0.0", + "concurrently": "^7.2.2", "cross-env": "^7.0.3", "env-cmd": "^10.1.0", "gts": "^3.1.0", @@ -50,7 +52,7 @@ "shelljs": "^0.8.5", "sinon": "^14.0.0", "supertest": "6.2.3", - "typescript": "^4.5.5", + "typescript": "^4.7.4", "wait-on": "^6.0.1" }, "engines": { @@ -90,9 +92,9 @@ } }, "node_modules/@dapr/dapr": { - "version": "2.2.1", - "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.2.1.tgz", - "integrity": "sha512-SSA8dtsq0k7UERjwVjopGjZqiHQu+nVcd1v8DXy2KvIGbrx0EKS3Ir63TU/2m2vFl57F6k33bg4kbqNd1RRyAQ==", + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.0.tgz", + "integrity": "sha512-zNNxoGAZjRulENGvDiLs5/0G+UolyBBkg8dJlMT/NaxE8EfI95KlXLJsR0LiQKSDwfu9gbA9Ew2z2tnIQZJCWw==", "dependencies": { "@grpc/grpc-js": "^1.3.7", "@js-temporal/polyfill": "^0.3.0", @@ -216,17 +218,17 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@microsoft/api-extractor": { - "version": "7.24.0", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.24.0.tgz", - "integrity": "sha512-cC5Vcu3N2OJh1G5v136JYtE4QQtQYq6mLiL8YXzFgu8aoq8T88kzq3/TxlihJvqGnrD96pf4PjS2Yg8RNYTQYw==", + "version": "7.26.1", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.26.1.tgz", + "integrity": "sha512-hfBumS2bJbQujXP51E83yuOQim9Df60fA6kAr6pBrH3FX6vhOX+cg/zUx0maEXyQUgOTsST8XTl774Hxyh6kdw==", "dev": true, "dependencies": { - "@microsoft/api-extractor-model": "7.17.3", + "@microsoft/api-extractor-model": "7.19.1", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.45.5", - "@rushstack/rig-package": "0.3.11", - "@rushstack/ts-command-line": "4.11.0", + "@rushstack/node-core-library": "3.46.0", + "@rushstack/rig-package": "0.3.12", + "@rushstack/ts-command-line": "4.12.0", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", @@ -239,14 +241,14 @@ } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.17.3", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.17.3.tgz", - "integrity": "sha512-ETslFxVEZTEK6mrOARxM34Ll2W/5H2aTk9Pe9dxsMCnthE8O/CaStV4WZAGsvvZKyjelSWgPVYGowxGVnwOMlQ==", + "version": "7.19.1", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.19.1.tgz", + "integrity": "sha512-nF2+4U6DYHne18+8IMJZR7NR/9rwEobzEwLqYYG1+GFefxZ0hEQTKBcqdSKToiHvZySXxcmtdXWZqzo3AbGe/A==", "dev": true, "dependencies": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.45.5" + "@rushstack/node-core-library": "3.46.0" } }, "node_modules/@microsoft/api-extractor/node_modules/resolve": { @@ -392,9 +394,9 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "node_modules/@rushstack/node-core-library": { - "version": "3.45.5", - "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.45.5.tgz", - "integrity": "sha512-KbN7Hp9vH3bD3YJfv6RnVtzzTAwGYIBl7y2HQLY4WEQqRbvE3LgI78W9l9X+cTAXCX//p0EeoiUYNTFdqJrMZg==", + "version": "3.46.0", + "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.46.0.tgz", + "integrity": "sha512-5iF21WvppEkXUPkxXkkH7HlfK5jDNFTKPJT0M+t3fG8qteoJM2atQoLtXklS0yNgOXy5zNTVTO+9lSzfVUvrCA==", "dev": true, "dependencies": { "@types/node": "12.20.24", @@ -424,9 +426,9 @@ } }, "node_modules/@rushstack/rig-package": { - "version": "0.3.11", - "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.11.tgz", - "integrity": "sha512-uI1/g5oQPtyrT9nStoyX/xgZSLa2b+srRFaDk3r1eqC7zA5th4/bvTGl2QfV3C9NcP+coSqmk5mFJkUfH6i3Lw==", + "version": "0.3.12", + "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.12.tgz", + "integrity": "sha512-ZzxuBWG0wbOtI+9IHYvOsr3QN52GtxTWpcaHMsQ/PC9us2ve/k0xK0XOMu+CtStyHSnBG2nDdnF9vFv9HMYOZg==", "dev": true, "dependencies": { "resolve": "~1.17.0", @@ -443,9 +445,9 @@ } }, "node_modules/@rushstack/ts-command-line": { - "version": "4.11.0", - "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.11.0.tgz", - "integrity": "sha512-ptG9L0mjvJ5QtK11GsAFY+jGfsnqHDS6CY6Yw1xT7a9bhjfNYnf6UPwjV+pF6UgiucfNcMDNW9lkDLxvZKKxMg==", + "version": "4.12.0", + "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.0.tgz", + "integrity": "sha512-+dC3ZwT1PjvsEnybXzM9UUYg4xdDOl6vmE+23eByxbWmAxo/nB8VAD5iFs+jbbUd9MtG/7xqCBWbMWEDA+cBjw==", "dev": true, "dependencies": { "@types/argparse": "1.0.38", @@ -604,6 +606,12 @@ "@types/node": "*" } }, + "node_modules/@types/google-protobuf": { + "version": "3.15.6", + "resolved": "https://registry.npmmirror.com/@types/google-protobuf/-/google-protobuf-3.15.6.tgz", + "integrity": "sha512-pYVNNJ+winC4aek+lZp93sIKxnXt5qMkuKmaqS3WGuTq0Bw1ZDYNBgzG5kkdtwcv+GmYJGo3yEg6z2cKKAiEdw==", + "dev": true + }, "node_modules/@types/json-schema": { "version": "7.0.9", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", @@ -653,9 +661,33 @@ }, "node_modules/@types/node": { "version": "14.18.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.11.tgz", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-14.18.11.tgz", "integrity": "sha512-zCoCEMA+IPpsRkyCFBqew5vGb7r8RSiB3uwdu/map7uwLAfu1MTazW26/pUDWoNnF88vJz4W3U56i5gtXNqxGg==" }, + "node_modules/@types/node-fetch": { + "version": "2.6.2", + "resolved": "https://registry.npmmirror.com/@types/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", + "dev": true, + "dependencies": { + "@types/node": "*", + "form-data": "^3.0.0" + } + }, + "node_modules/@types/node-fetch/node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", @@ -683,9 +715,9 @@ "dev": true }, "node_modules/@types/semver": { - "version": "7.3.9", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz", - "integrity": "sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ==", + "version": "7.3.10", + "resolved": "https://registry.npmmirror.com/@types/semver/-/semver-7.3.10.tgz", + "integrity": "sha512-zsv3fsC7S84NN6nPK06u79oWgrPVd0NvOyqgghV1haPaFcVxIrP4DLomRwGAXk0ui4HZA7mOcSFL98sMVW9viw==", "dev": true }, "node_modules/@types/serve-static": { @@ -709,14 +741,20 @@ } }, "node_modules/@types/sinon": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.6.tgz", - "integrity": "sha512-6EF+wzMWvBNeGrfP3Nx60hhx+FfwSg1JJBLAAP/IdIUq0EYkqCYf70VT3PhuhPX9eLD+Dp+lNdpb/ZeHG8Yezg==", + "version": "10.0.11", + "resolved": "https://registry.npmmirror.com/@types/sinon/-/sinon-10.0.11.tgz", + "integrity": "sha512-dmZsHlBsKUtBpHriNjlK0ndlvEh8dcb9uV9Afsbt89QIyydpC7NcR+nWlAhASfy3GHnxTl4FX/aKE7XZUt/B4g==", "dev": true, "dependencies": { - "@sinonjs/fake-timers": "^7.1.0" + "@types/sinonjs__fake-timers": "*" } }, + "node_modules/@types/sinonjs__fake-timers": { + "version": "8.1.2", + "resolved": "https://registry.npmmirror.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.2.tgz", + "integrity": "sha512-9GcLXF0/v3t80caGs5p2rRfkB+a8VBGLJZVih6CNFkx8IZ994wiKKLSRs9nuFwk1HevWs/1mnUmkApGrSGsShA==", + "dev": true + }, "node_modules/@types/superagent": { "version": "4.1.13", "resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-4.1.13.tgz", @@ -728,9 +766,9 @@ } }, "node_modules/@types/supertest": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/@types/supertest/-/supertest-2.0.11.tgz", - "integrity": "sha512-uci4Esokrw9qGb9bvhhSVEjd6rkny/dk5PK/Qz4yxKiyppEI+dOPlNrZBahE3i+PoKFYyDxChVXZ/ysS/nrm1Q==", + "version": "2.0.12", + "resolved": "https://registry.npmmirror.com/@types/supertest/-/supertest-2.0.12.tgz", + "integrity": "sha512-X3HPWTwXRerBZS7Mo1k6vMVR1Z6zmJcDVn5O/31whe0tnjE4te6ZJSJGq1RiqHPjzPdMTfjCFogDJmwng9xHaQ==", "dev": true, "dependencies": { "@types/superagent": "*" @@ -1652,11 +1690,11 @@ } }, "node_modules/cloudevents": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/cloudevents/-/cloudevents-6.0.1.tgz", - "integrity": "sha512-6Y2EOQKsEEciSeIPL8ENob2LcFSt/r0iftTefl3IanSVr2LyvXfbEdD5+pvufVDFdf6OVijvtl7UFx/0voMOsw==", + "version": "6.0.2", + "resolved": "https://registry.npmmirror.com/cloudevents/-/cloudevents-6.0.2.tgz", + "integrity": "sha512-mn/4EZnAbhfb/TghubK2jPnxYM15JRjf8LnWJtXidiVKi5ZCkd+p9jyBZbL57w7nRm6oFAzJhjxRLsXd/DNaBQ==", "dependencies": { - "ajv": "^8.6.3", + "ajv": "^8.11.0", "ajv-formats": "^2.1.1", "util": "^0.12.4", "uuid": "^8.3.2" @@ -1781,15 +1819,15 @@ } }, "node_modules/concurrently": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.2.0.tgz", - "integrity": "sha512-4KIVY5HopDRhN3ndAgfFOLsMk1PZUPgghlgTMZ5Pb5aTrqYg86RcZaIZC2Cz+qpZ9DsX36WHGjvWnXPqdnblhw==", + "version": "7.2.2", + "resolved": "https://registry.npmmirror.com/concurrently/-/concurrently-7.2.2.tgz", + "integrity": "sha512-DcQkI0ruil5BA/g7Xy3EWySGrFJovF5RYAYxwGvv9Jf9q9B1v3jPFP2tl6axExNf1qgF30kjoNYrangZ0ey4Aw==", "dev": true, "dependencies": { "chalk": "^4.1.0", "date-fns": "^2.16.1", "lodash": "^4.17.21", - "rxjs": "^6.6.3", + "rxjs": "^7.0.0", "shell-quote": "^1.7.3", "spawn-command": "^0.0.2-1", "supports-color": "^8.1.0", @@ -1867,6 +1905,15 @@ "node": ">=8" } }, + "node_modules/concurrently/node_modules/rxjs": { + "version": "7.5.5", + "resolved": "https://registry.npmmirror.com/rxjs/-/rxjs-7.5.5.tgz", + "integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/concurrently/node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz", @@ -1879,6 +1926,12 @@ "node": ">=10" } }, + "node_modules/concurrently/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true + }, "node_modules/concurrently/node_modules/yargs": { "version": "17.5.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz", @@ -7035,9 +7088,9 @@ } }, "node_modules/typescript": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz", - "integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==", + "version": "4.7.4", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -7640,9 +7693,9 @@ } }, "@dapr/dapr": { - "version": "2.2.1", - "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.2.1.tgz", - "integrity": "sha512-SSA8dtsq0k7UERjwVjopGjZqiHQu+nVcd1v8DXy2KvIGbrx0EKS3Ir63TU/2m2vFl57F6k33bg4kbqNd1RRyAQ==", + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.0.tgz", + "integrity": "sha512-zNNxoGAZjRulENGvDiLs5/0G+UolyBBkg8dJlMT/NaxE8EfI95KlXLJsR0LiQKSDwfu9gbA9Ew2z2tnIQZJCWw==", "requires": { "@grpc/grpc-js": "^1.3.7", "@js-temporal/polyfill": "^0.3.0", @@ -7749,17 +7802,17 @@ } }, "@microsoft/api-extractor": { - "version": "7.24.0", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.24.0.tgz", - "integrity": "sha512-cC5Vcu3N2OJh1G5v136JYtE4QQtQYq6mLiL8YXzFgu8aoq8T88kzq3/TxlihJvqGnrD96pf4PjS2Yg8RNYTQYw==", + "version": "7.26.1", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.26.1.tgz", + "integrity": "sha512-hfBumS2bJbQujXP51E83yuOQim9Df60fA6kAr6pBrH3FX6vhOX+cg/zUx0maEXyQUgOTsST8XTl774Hxyh6kdw==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.17.3", + "@microsoft/api-extractor-model": "7.19.1", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.45.5", - "@rushstack/rig-package": "0.3.11", - "@rushstack/ts-command-line": "4.11.0", + "@rushstack/node-core-library": "3.46.0", + "@rushstack/rig-package": "0.3.12", + "@rushstack/ts-command-line": "4.12.0", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", @@ -7786,14 +7839,14 @@ } }, "@microsoft/api-extractor-model": { - "version": "7.17.3", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.17.3.tgz", - "integrity": "sha512-ETslFxVEZTEK6mrOARxM34Ll2W/5H2aTk9Pe9dxsMCnthE8O/CaStV4WZAGsvvZKyjelSWgPVYGowxGVnwOMlQ==", + "version": "7.19.1", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.19.1.tgz", + "integrity": "sha512-nF2+4U6DYHne18+8IMJZR7NR/9rwEobzEwLqYYG1+GFefxZ0hEQTKBcqdSKToiHvZySXxcmtdXWZqzo3AbGe/A==", "dev": true, "requires": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.45.5" + "@rushstack/node-core-library": "3.46.0" } }, "@microsoft/tsdoc": { @@ -7907,9 +7960,9 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "@rushstack/node-core-library": { - "version": "3.45.5", - "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.45.5.tgz", - "integrity": "sha512-KbN7Hp9vH3bD3YJfv6RnVtzzTAwGYIBl7y2HQLY4WEQqRbvE3LgI78W9l9X+cTAXCX//p0EeoiUYNTFdqJrMZg==", + "version": "3.46.0", + "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.46.0.tgz", + "integrity": "sha512-5iF21WvppEkXUPkxXkkH7HlfK5jDNFTKPJT0M+t3fG8qteoJM2atQoLtXklS0yNgOXy5zNTVTO+9lSzfVUvrCA==", "dev": true, "requires": { "@types/node": "12.20.24", @@ -7941,9 +7994,9 @@ } }, "@rushstack/rig-package": { - "version": "0.3.11", - "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.11.tgz", - "integrity": "sha512-uI1/g5oQPtyrT9nStoyX/xgZSLa2b+srRFaDk3r1eqC7zA5th4/bvTGl2QfV3C9NcP+coSqmk5mFJkUfH6i3Lw==", + "version": "0.3.12", + "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.12.tgz", + "integrity": "sha512-ZzxuBWG0wbOtI+9IHYvOsr3QN52GtxTWpcaHMsQ/PC9us2ve/k0xK0XOMu+CtStyHSnBG2nDdnF9vFv9HMYOZg==", "dev": true, "requires": { "resolve": "~1.17.0", @@ -7962,9 +8015,9 @@ } }, "@rushstack/ts-command-line": { - "version": "4.11.0", - "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.11.0.tgz", - "integrity": "sha512-ptG9L0mjvJ5QtK11GsAFY+jGfsnqHDS6CY6Yw1xT7a9bhjfNYnf6UPwjV+pF6UgiucfNcMDNW9lkDLxvZKKxMg==", + "version": "4.12.0", + "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.0.tgz", + "integrity": "sha512-+dC3ZwT1PjvsEnybXzM9UUYg4xdDOl6vmE+23eByxbWmAxo/nB8VAD5iFs+jbbUd9MtG/7xqCBWbMWEDA+cBjw==", "dev": true, "requires": { "@types/argparse": "1.0.38", @@ -8117,6 +8170,12 @@ "@types/node": "*" } }, + "@types/google-protobuf": { + "version": "3.15.6", + "resolved": "https://registry.npmmirror.com/@types/google-protobuf/-/google-protobuf-3.15.6.tgz", + "integrity": "sha512-pYVNNJ+winC4aek+lZp93sIKxnXt5qMkuKmaqS3WGuTq0Bw1ZDYNBgzG5kkdtwcv+GmYJGo3yEg6z2cKKAiEdw==", + "dev": true + }, "@types/json-schema": { "version": "7.0.9", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", @@ -8166,9 +8225,32 @@ }, "@types/node": { "version": "14.18.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.11.tgz", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-14.18.11.tgz", "integrity": "sha512-zCoCEMA+IPpsRkyCFBqew5vGb7r8RSiB3uwdu/map7uwLAfu1MTazW26/pUDWoNnF88vJz4W3U56i5gtXNqxGg==" }, + "@types/node-fetch": { + "version": "2.6.2", + "resolved": "https://registry.npmmirror.com/@types/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", + "dev": true, + "requires": { + "@types/node": "*", + "form-data": "^3.0.0" + }, + "dependencies": { + "form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + } + } + }, "@types/normalize-package-data": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", @@ -8196,9 +8278,9 @@ "dev": true }, "@types/semver": { - "version": "7.3.9", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz", - "integrity": "sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ==", + "version": "7.3.10", + "resolved": "https://registry.npmmirror.com/@types/semver/-/semver-7.3.10.tgz", + "integrity": "sha512-zsv3fsC7S84NN6nPK06u79oWgrPVd0NvOyqgghV1haPaFcVxIrP4DLomRwGAXk0ui4HZA7mOcSFL98sMVW9viw==", "dev": true }, "@types/serve-static": { @@ -8222,14 +8304,20 @@ } }, "@types/sinon": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.6.tgz", - "integrity": "sha512-6EF+wzMWvBNeGrfP3Nx60hhx+FfwSg1JJBLAAP/IdIUq0EYkqCYf70VT3PhuhPX9eLD+Dp+lNdpb/ZeHG8Yezg==", + "version": "10.0.11", + "resolved": "https://registry.npmmirror.com/@types/sinon/-/sinon-10.0.11.tgz", + "integrity": "sha512-dmZsHlBsKUtBpHriNjlK0ndlvEh8dcb9uV9Afsbt89QIyydpC7NcR+nWlAhASfy3GHnxTl4FX/aKE7XZUt/B4g==", "dev": true, "requires": { - "@sinonjs/fake-timers": "^7.1.0" + "@types/sinonjs__fake-timers": "*" } }, + "@types/sinonjs__fake-timers": { + "version": "8.1.2", + "resolved": "https://registry.npmmirror.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.2.tgz", + "integrity": "sha512-9GcLXF0/v3t80caGs5p2rRfkB+a8VBGLJZVih6CNFkx8IZ994wiKKLSRs9nuFwk1HevWs/1mnUmkApGrSGsShA==", + "dev": true + }, "@types/superagent": { "version": "4.1.13", "resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-4.1.13.tgz", @@ -8241,9 +8329,9 @@ } }, "@types/supertest": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/@types/supertest/-/supertest-2.0.11.tgz", - "integrity": "sha512-uci4Esokrw9qGb9bvhhSVEjd6rkny/dk5PK/Qz4yxKiyppEI+dOPlNrZBahE3i+PoKFYyDxChVXZ/ysS/nrm1Q==", + "version": "2.0.12", + "resolved": "https://registry.npmmirror.com/@types/supertest/-/supertest-2.0.12.tgz", + "integrity": "sha512-X3HPWTwXRerBZS7Mo1k6vMVR1Z6zmJcDVn5O/31whe0tnjE4te6ZJSJGq1RiqHPjzPdMTfjCFogDJmwng9xHaQ==", "dev": true, "requires": { "@types/superagent": "*" @@ -8914,11 +9002,11 @@ } }, "cloudevents": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/cloudevents/-/cloudevents-6.0.1.tgz", - "integrity": "sha512-6Y2EOQKsEEciSeIPL8ENob2LcFSt/r0iftTefl3IanSVr2LyvXfbEdD5+pvufVDFdf6OVijvtl7UFx/0voMOsw==", + "version": "6.0.2", + "resolved": "https://registry.npmmirror.com/cloudevents/-/cloudevents-6.0.2.tgz", + "integrity": "sha512-mn/4EZnAbhfb/TghubK2jPnxYM15JRjf8LnWJtXidiVKi5ZCkd+p9jyBZbL57w7nRm6oFAzJhjxRLsXd/DNaBQ==", "requires": { - "ajv": "^8.6.3", + "ajv": "^8.11.0", "ajv-formats": "^2.1.1", "util": "^0.12.4", "uuid": "^8.3.2" @@ -9034,15 +9122,15 @@ } }, "concurrently": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.2.0.tgz", - "integrity": "sha512-4KIVY5HopDRhN3ndAgfFOLsMk1PZUPgghlgTMZ5Pb5aTrqYg86RcZaIZC2Cz+qpZ9DsX36WHGjvWnXPqdnblhw==", + "version": "7.2.2", + "resolved": "https://registry.npmmirror.com/concurrently/-/concurrently-7.2.2.tgz", + "integrity": "sha512-DcQkI0ruil5BA/g7Xy3EWySGrFJovF5RYAYxwGvv9Jf9q9B1v3jPFP2tl6axExNf1qgF30kjoNYrangZ0ey4Aw==", "dev": true, "requires": { "chalk": "^4.1.0", "date-fns": "^2.16.1", "lodash": "^4.17.21", - "rxjs": "^6.6.3", + "rxjs": "^7.0.0", "shell-quote": "^1.7.3", "spawn-command": "^0.0.2-1", "supports-color": "^8.1.0", @@ -9101,6 +9189,15 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "rxjs": { + "version": "7.5.5", + "resolved": "https://registry.npmmirror.com/rxjs/-/rxjs-7.5.5.tgz", + "integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, "supports-color": { "version": "8.1.1", "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz", @@ -9110,6 +9207,12 @@ "has-flag": "^4.0.0" } }, + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true + }, "yargs": { "version": "17.5.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz", @@ -12953,9 +13056,9 @@ } }, "typescript": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.2.tgz", - "integrity": "sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==", + "version": "4.7.4", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "dev": true }, "unbox-primitive": { diff --git a/package.json b/package.json index 0b40a356..7350ac7f 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,10 @@ }, "dependencies": { "@dapr/dapr": "^2.2.1", - "body-parser": "^1.18.3", - "cloudevents": "^6.0.1", + "body-parser": "^1.20.0", + "cloudevents": "^6.0.2", "debug": "^4.3.4", - "express": "^4.16.4", + "express": "^4.18.1", "express-interceptor": "^1.2.0", "lodash": "^4.17.21", "minimist": "^1.2.5", @@ -52,21 +52,23 @@ "author": "OpenFunction", "license": "Apache-2.0", "devDependencies": { - "@microsoft/api-extractor": "^7.24.0", + "@microsoft/api-extractor": "^7.26.1", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", "@types/express": "4.17.13", - "@types/lodash": "^4.14.179", + "@types/google-protobuf": "^3.15.6", + "@types/lodash": "^4.14.182", "@types/minimist": "1.2.2", "@types/mocha": "9.1.1", "@types/node": "14.18.11", + "@types/node-fetch": "^2.6.2", "@types/on-finished": "2.3.1", - "@types/semver": "^7.3.6", + "@types/semver": "^7.3.10", "@types/shelljs": "^0.8.11", - "@types/sinon": "^10.0.0", - "@types/supertest": "2.0.11", + "@types/sinon": "^10.0.11", + "@types/supertest": "2.0.12", "aedes": "^0.47.0", - "concurrently": "^7.0.0", + "concurrently": "^7.2.2", "cross-env": "^7.0.3", "env-cmd": "^10.1.0", "gts": "^3.1.0", @@ -76,7 +78,7 @@ "shelljs": "^0.8.5", "sinon": "^14.0.0", "supertest": "6.2.3", - "typescript": "^4.5.5", + "typescript": "^4.7.4", "wait-on": "^6.0.1" } } From ff4f33ac4a31cd30e9d9fd17f332981133dad5c3 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 25 Jun 2022 23:01:23 +0800 Subject: [PATCH 03/42] =?UTF-8?q?=F0=9F=93=9D=20docs:=20update=20autogen?= =?UTF-8?q?=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/generated/api.json | 94 ++++++++++++++++++++++++++++++++++------- 1 file changed, 79 insertions(+), 15 deletions(-) diff --git a/docs/generated/api.json b/docs/generated/api.json index 827731fc..bb043087 100644 --- a/docs/generated/api.json +++ b/docs/generated/api.json @@ -1,8 +1,8 @@ { "metadata": { "toolPackage": "@microsoft/api-extractor", - "toolVersion": "7.24.0", - "schemaVersion": 1005, + "toolVersion": "7.26.1", + "schemaVersion": 1007, "oldestForwardsCompatibleVersion": 1001, "tsdocConfig": { "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", @@ -164,11 +164,13 @@ "canonicalReference": "@openfunction/functions-framework!", "docComment": "", "name": "@openfunction/functions-framework", + "preserveMemberOrder": false, "members": [ { "kind": "EntryPoint", "canonicalReference": "@openfunction/functions-framework!", "name": "", + "preserveMemberOrder": false, "members": [ { "kind": "Variable", @@ -193,6 +195,7 @@ "text": ") => void" } ], + "isReadonly": true, "releaseTag": "Public", "name": "cloudEvent", "variableTypeTokenRange": { @@ -233,6 +236,7 @@ } ], "name": "CloudEventFunction", + "preserveMemberOrder": false, "members": [ { "kind": "CallSignature", @@ -318,6 +322,7 @@ } ], "name": "CloudEventFunctionWithCallback", + "preserveMemberOrder": false, "members": [ { "kind": "CallSignature", @@ -399,6 +404,7 @@ ], "releaseTag": "Public", "name": "CloudFunctionsContext", + "preserveMemberOrder": false, "members": [ { "kind": "PropertySignature", @@ -418,6 +424,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "eventId", @@ -444,6 +451,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "eventType", @@ -470,6 +478,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "resource", @@ -496,6 +505,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "timestamp", @@ -519,6 +529,7 @@ ], "releaseTag": "Public", "name": "ComponentType", + "preserveMemberOrder": false, "members": [ { "kind": "EnumMember", @@ -615,6 +626,7 @@ ], "releaseTag": "Public", "name": "ContextUtils", + "preserveMemberOrder": false, "members": [ { "kind": "Method", @@ -643,13 +655,13 @@ "text": ";" } ], - "isOptional": false, "isStatic": true, "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 }, "releaseTag": "Public", + "isProtected": false, "overloadIndex": 1, "parameters": [ { @@ -661,6 +673,7 @@ "isOptional": false } ], + "isOptional": false, "name": "IsAsyncRuntime" }, { @@ -690,13 +703,13 @@ "text": ";" } ], - "isOptional": false, "isStatic": true, "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 }, "releaseTag": "Public", + "isProtected": false, "overloadIndex": 1, "parameters": [ { @@ -708,6 +721,7 @@ "isOptional": false } ], + "isOptional": false, "name": "IsBindingComponent" }, { @@ -737,13 +751,13 @@ "text": ";" } ], - "isOptional": false, "isStatic": true, "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 }, "releaseTag": "Public", + "isProtected": false, "overloadIndex": 1, "parameters": [ { @@ -755,6 +769,7 @@ "isOptional": false } ], + "isOptional": false, "name": "IsKnativeRuntime" }, { @@ -784,13 +799,13 @@ "text": ";" } ], - "isOptional": false, "isStatic": true, "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 }, "releaseTag": "Public", + "isProtected": false, "overloadIndex": 1, "parameters": [ { @@ -802,6 +817,7 @@ "isOptional": false } ], + "isOptional": false, "name": "IsPubSubComponent" } ], @@ -819,6 +835,7 @@ ], "releaseTag": "Public", "name": "Data", + "preserveMemberOrder": false, "members": [ { "kind": "PropertySignature", @@ -838,6 +855,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": false, "releaseTag": "Public", "name": "data", @@ -861,6 +879,7 @@ ], "releaseTag": "Public", "name": "EventFunction", + "preserveMemberOrder": false, "members": [ { "kind": "CallSignature", @@ -937,6 +956,7 @@ ], "releaseTag": "Public", "name": "EventFunctionWithCallback", + "preserveMemberOrder": false, "members": [ { "kind": "CallSignature", @@ -1137,6 +1157,7 @@ "text": ") => void" } ], + "isReadonly": true, "releaseTag": "Public", "name": "http", "variableTypeTokenRange": { @@ -1156,6 +1177,7 @@ ], "releaseTag": "Public", "name": "HttpFunction", + "preserveMemberOrder": false, "members": [ { "kind": "CallSignature", @@ -1233,6 +1255,7 @@ ], "releaseTag": "Public", "name": "HttpFunctionResponse", + "preserveMemberOrder": false, "members": [ { "kind": "PropertySignature", @@ -1252,6 +1275,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "body", @@ -1278,6 +1302,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "code", @@ -1309,6 +1334,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "headers", @@ -1367,6 +1393,7 @@ ], "releaseTag": "Public", "name": "LegacyEvent", + "preserveMemberOrder": false, "members": [ { "kind": "PropertySignature", @@ -1387,6 +1414,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": false, "releaseTag": "Public", "name": "context", @@ -1413,6 +1441,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": false, "releaseTag": "Public", "name": "data", @@ -1436,6 +1465,7 @@ ], "releaseTag": "Public", "name": "OpenFunction", + "preserveMemberOrder": false, "members": [ { "kind": "CallSignature", @@ -1523,6 +1553,7 @@ "text": ") => void" } ], + "isReadonly": true, "releaseTag": "Public", "name": "openfunction", "variableTypeTokenRange": { @@ -1542,6 +1573,7 @@ ], "releaseTag": "Public", "name": "OpenFunctionBinding", + "preserveMemberOrder": false, "members": [ { "kind": "IndexSignature", @@ -1602,6 +1634,7 @@ ], "releaseTag": "Public", "name": "OpenFunctionComponent", + "preserveMemberOrder": false, "members": [ { "kind": "PropertySignature", @@ -1621,6 +1654,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": false, "releaseTag": "Public", "name": "componentName", @@ -1656,6 +1690,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": false, "releaseTag": "Public", "name": "componentType", @@ -1687,6 +1722,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "metadata", @@ -1713,6 +1749,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "operation", @@ -1739,6 +1776,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "uri", @@ -1762,6 +1800,7 @@ ], "releaseTag": "Public", "name": "OpenFunctionContext", + "preserveMemberOrder": false, "members": [ { "kind": "PropertySignature", @@ -1782,6 +1821,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "inputs", @@ -1808,6 +1848,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": false, "releaseTag": "Public", "name": "name", @@ -1835,6 +1876,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "outputs", @@ -1861,6 +1903,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "port", @@ -1932,6 +1975,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": false, "releaseTag": "Public", "name": "runtime", @@ -1958,6 +2002,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": false, "releaseTag": "Public", "name": "version", @@ -1981,6 +2026,7 @@ ], "releaseTag": "Public", "name": "OpenFunctionRuntime", + "preserveMemberOrder": false, "members": [ { "kind": "Constructor", @@ -2002,6 +2048,7 @@ } ], "releaseTag": "Public", + "isProtected": false, "overloadIndex": 1, "parameters": [ { @@ -2033,6 +2080,7 @@ "text": ";" } ], + "isReadonly": true, "isOptional": false, "releaseTag": "Public", "name": "context", @@ -2040,7 +2088,8 @@ "startIndex": 1, "endIndex": 2 }, - "isStatic": false + "isStatic": false, + "isProtected": true }, { "kind": "Method", @@ -2070,13 +2119,13 @@ "text": ";" } ], - "isOptional": false, "isStatic": true, "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 }, "releaseTag": "Public", + "isProtected": false, "overloadIndex": 1, "parameters": [ { @@ -2088,6 +2137,7 @@ "isOptional": false } ], + "isOptional": false, "name": "Parse" }, { @@ -2118,13 +2168,13 @@ "text": ";" } ], - "isOptional": false, "isStatic": true, "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 }, "releaseTag": "Public", + "isProtected": false, "overloadIndex": 1, "parameters": [ { @@ -2136,6 +2186,7 @@ "isOptional": false } ], + "isOptional": false, "name": "ProxyContext" }, { @@ -2188,6 +2239,7 @@ "text": ";" } ], + "isReadonly": true, "isOptional": false, "releaseTag": "Public", "name": "req", @@ -2195,7 +2247,8 @@ "startIndex": 1, "endIndex": 9 }, - "isStatic": false + "isStatic": false, + "isProtected": false }, { "kind": "Property", @@ -2229,6 +2282,7 @@ "text": ";" } ], + "isReadonly": true, "isOptional": false, "releaseTag": "Public", "name": "res", @@ -2236,7 +2290,8 @@ "startIndex": 1, "endIndex": 5 }, - "isStatic": false + "isStatic": false, + "isProtected": false }, { "kind": "Method", @@ -2277,13 +2332,13 @@ "text": ";" } ], - "isOptional": false, "isStatic": false, "returnTypeTokenRange": { "startIndex": 5, "endIndex": 7 }, "releaseTag": "Public", + "isProtected": false, "overloadIndex": 1, "parameters": [ { @@ -2303,6 +2358,7 @@ "isOptional": true } ], + "isOptional": false, "name": "send" }, { @@ -2341,13 +2397,13 @@ "text": ";" } ], - "isOptional": false, "isStatic": false, "returnTypeTokenRange": { "startIndex": 5, "endIndex": 6 }, "releaseTag": "Public", + "isProtected": false, "overloadIndex": 1, "parameters": [ { @@ -2367,6 +2423,7 @@ "isOptional": true } ], + "isOptional": false, "name": "setTrigger" }, { @@ -2387,6 +2444,7 @@ "text": ";" } ], + "isReadonly": true, "isOptional": false, "releaseTag": "Public", "name": "sidecarPort", @@ -2394,7 +2452,8 @@ "startIndex": 1, "endIndex": 2 }, - "isStatic": false + "isStatic": false, + "isProtected": false }, { "kind": "Property", @@ -2415,6 +2474,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "trigger", @@ -2422,7 +2482,8 @@ "startIndex": 1, "endIndex": 2 }, - "isStatic": false + "isStatic": false, + "isProtected": true } ], "implementsTokenRanges": [] @@ -2448,6 +2509,7 @@ ], "releaseTag": "Public", "name": "Request_2", + "preserveMemberOrder": false, "members": [ { "kind": "PropertySignature", @@ -2468,6 +2530,7 @@ "text": ";" } ], + "isReadonly": false, "isOptional": true, "releaseTag": "Public", "name": "rawBody", @@ -2496,6 +2559,7 @@ ], "releaseTag": "Public", "name": "RuntimeType", + "preserveMemberOrder": false, "members": [ { "kind": "EnumMember", From 4246534359139af0c8f6255b865ba4ae3f47387b Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 25 Jun 2022 23:13:04 +0800 Subject: [PATCH 04/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20upgrade=20dapr?= =?UTF-8?q?=20to=201.7.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 4ef0738e..554ef52d 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -21,7 +21,7 @@ jobs: - name: Install Dapr uses: dapr/setup-dapr@v1 with: - version: '1.5.1' + version: '1.7.3' - name: Install Docker for macOS uses: docker-practice/actions-setup-docker@master if: ${{ matrix.platform == 'macos-latest' }} From bac6e49fdad3b738c782f69bd3f5f1221300a974 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 25 Jun 2022 23:22:39 +0800 Subject: [PATCH 05/42] =?UTF-8?q?=F0=9F=93=8C=20chore(deps):=20pin=20dapr?= =?UTF-8?q?=20to=202.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index b429c5cc..8f92b70a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.5.0", "license": "Apache-2.0", "dependencies": { - "@dapr/dapr": "^2.2.1", + "@dapr/dapr": "2.2.1", "body-parser": "^1.20.0", "cloudevents": "^6.0.2", "debug": "^4.3.4", @@ -92,9 +92,9 @@ } }, "node_modules/@dapr/dapr": { - "version": "2.3.0", - "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.0.tgz", - "integrity": "sha512-zNNxoGAZjRulENGvDiLs5/0G+UolyBBkg8dJlMT/NaxE8EfI95KlXLJsR0LiQKSDwfu9gbA9Ew2z2tnIQZJCWw==", + "version": "2.2.1", + "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.2.1.tgz", + "integrity": "sha512-SSA8dtsq0k7UERjwVjopGjZqiHQu+nVcd1v8DXy2KvIGbrx0EKS3Ir63TU/2m2vFl57F6k33bg4kbqNd1RRyAQ==", "dependencies": { "@grpc/grpc-js": "^1.3.7", "@js-temporal/polyfill": "^0.3.0", @@ -7693,9 +7693,9 @@ } }, "@dapr/dapr": { - "version": "2.3.0", - "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.0.tgz", - "integrity": "sha512-zNNxoGAZjRulENGvDiLs5/0G+UolyBBkg8dJlMT/NaxE8EfI95KlXLJsR0LiQKSDwfu9gbA9Ew2z2tnIQZJCWw==", + "version": "2.2.1", + "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.2.1.tgz", + "integrity": "sha512-SSA8dtsq0k7UERjwVjopGjZqiHQu+nVcd1v8DXy2KvIGbrx0EKS3Ir63TU/2m2vFl57F6k33bg4kbqNd1RRyAQ==", "requires": { "@grpc/grpc-js": "^1.3.7", "@js-temporal/polyfill": "^0.3.0", diff --git a/package.json b/package.json index 7350ac7f..312d53b5 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "./testing": "./build/src/testing.js" }, "dependencies": { - "@dapr/dapr": "^2.2.1", + "@dapr/dapr": "2.2.1", "body-parser": "^1.20.0", "cloudevents": "^6.0.2", "debug": "^4.3.4", From f54426613a0179adea8ae61cf0981518dc778363 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 25 Jun 2022 23:26:08 +0800 Subject: [PATCH 06/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20use=20dapr=20c?= =?UTF-8?q?li=201.7.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 554ef52d..ccb68637 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -21,7 +21,7 @@ jobs: - name: Install Dapr uses: dapr/setup-dapr@v1 with: - version: '1.7.3' + version: '1.7.1' - name: Install Docker for macOS uses: docker-practice/actions-setup-docker@master if: ${{ matrix.platform == 'macos-latest' }} From 894264dff7c262c47cccd09c16cba1d41063bca7 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sun, 26 Jun 2022 12:32:50 +0800 Subject: [PATCH 07/42] =?UTF-8?q?=F0=9F=93=83=20chore:=20initialize=20issu?= =?UTF-8?q?e=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.md | 23 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..e5b6a71e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,23 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG] " +labels: 'type: bug' +assignees: '' + +--- + +### Describe the bug + + +### How to reproduce + + +### Expected behavior + + +### Screenshots + + +### Additional context + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..82d15e07 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[FEATURE] " +labels: 'type: feature' +assignees: '' + +--- + +### Please describe your usage scenario + + +### Describe the solution you'd like + + +### Describe alternatives you've considered + + +### Additional context + From 628e2b3809da15036f86f0144315b757e44a7602 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Mon, 27 Jun 2022 15:18:10 +0800 Subject: [PATCH 08/42] =?UTF-8?q?=F0=9F=93=9D=20docs(CONTRIBUTING):=20add?= =?UTF-8?q?=20commit=20msg=20guides?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTING.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c9412c2..026aaa70 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,12 @@ Contributions to this project must be accompanied by a Developer Certificate of You only need to submit a DTO once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again. +## Commit Guidelines + +Commits to this project must follow [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) specification, especially the commit message structure. + +Besides, we recommend that you could use [gitmoji](https://gitmoji.dev/related-tools) tool in your IDE to add proper emoji prefix to each commit. + ## Code reviews All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests. From 3614f2310005ee83ca3fc68a722f6721e642b9a9 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Mon, 27 Jun 2022 15:27:06 +0800 Subject: [PATCH 09/42] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20chore(deps-dev):=20u?= =?UTF-8?q?pgrade=20api-extractor=20[no=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/generated/api.json | 28 ++++++++++++------------- package-lock.json | 45 +++++++++++++++++++---------------------- package.json | 2 +- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/docs/generated/api.json b/docs/generated/api.json index bb043087..3c0972e7 100644 --- a/docs/generated/api.json +++ b/docs/generated/api.json @@ -1,8 +1,8 @@ { "metadata": { "toolPackage": "@microsoft/api-extractor", - "toolVersion": "7.26.1", - "schemaVersion": 1007, + "toolVersion": "7.27.0", + "schemaVersion": 1008, "oldestForwardsCompatibleVersion": 1001, "tsdocConfig": { "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", @@ -545,12 +545,12 @@ "text": "\"bindings\"" } ], - "releaseTag": "Public", - "name": "Binding", "initializerTokenRange": { "startIndex": 1, "endIndex": 2 - } + }, + "releaseTag": "Public", + "name": "Binding" }, { "kind": "EnumMember", @@ -566,12 +566,12 @@ "text": "\"pubsub\"" } ], - "releaseTag": "Public", - "name": "PubSub", "initializerTokenRange": { "startIndex": 1, "endIndex": 2 - } + }, + "releaseTag": "Public", + "name": "PubSub" } ] }, @@ -2575,12 +2575,12 @@ "text": "\"async\"" } ], - "releaseTag": "Public", - "name": "Async", "initializerTokenRange": { "startIndex": 1, "endIndex": 2 - } + }, + "releaseTag": "Public", + "name": "Async" }, { "kind": "EnumMember", @@ -2596,12 +2596,12 @@ "text": "\"knative\"" } ], - "releaseTag": "Public", - "name": "Knative", "initializerTokenRange": { "startIndex": 1, "endIndex": 2 - } + }, + "releaseTag": "Public", + "name": "Knative" } ] } diff --git a/package-lock.json b/package-lock.json index 8f92b70a..adff984c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "functions-framework-nodejs": "build/src/main.js" }, "devDependencies": { - "@microsoft/api-extractor": "^7.26.1", + "@microsoft/api-extractor": "^7.27.0", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", "@types/express": "4.17.13", @@ -218,12 +218,12 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@microsoft/api-extractor": { - "version": "7.26.1", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.26.1.tgz", - "integrity": "sha512-hfBumS2bJbQujXP51E83yuOQim9Df60fA6kAr6pBrH3FX6vhOX+cg/zUx0maEXyQUgOTsST8XTl774Hxyh6kdw==", + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.27.0.tgz", + "integrity": "sha512-rzVl2Rf3LQ2b7ykymVJSXZwRcy/QuwqlLmYh7NRi9Ilkk66aOloJTBgkkni/wlg5/RyohQKSdOmFYHcF+IiS3A==", "dev": true, "dependencies": { - "@microsoft/api-extractor-model": "7.19.1", + "@microsoft/api-extractor-model": "7.20.0", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", "@rushstack/node-core-library": "3.46.0", @@ -241,9 +241,9 @@ } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.19.1", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.19.1.tgz", - "integrity": "sha512-nF2+4U6DYHne18+8IMJZR7NR/9rwEobzEwLqYYG1+GFefxZ0hEQTKBcqdSKToiHvZySXxcmtdXWZqzo3AbGe/A==", + "version": "7.20.0", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.20.0.tgz", + "integrity": "sha512-6gK6ipnBsSZ9uLrUBHg3q1V7gvzvB1zVb8lbtrpKl3mQJ7vvXJm2sDNl3Vlt1gy0izgQb9s6mmyy7hLRh1qFRg==", "dev": true, "dependencies": { "@microsoft/tsdoc": "0.14.1", @@ -253,19 +253,16 @@ }, "node_modules/@microsoft/api-extractor/node_modules/resolve": { "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.17.0.tgz", "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", "dev": true, "dependencies": { "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } }, "node_modules/@microsoft/api-extractor/node_modules/typescript": { "version": "4.6.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.6.4.tgz", "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", "dev": true, "bin": { @@ -6607,7 +6604,7 @@ }, "node_modules/source-map": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, "engines": { @@ -7802,12 +7799,12 @@ } }, "@microsoft/api-extractor": { - "version": "7.26.1", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.26.1.tgz", - "integrity": "sha512-hfBumS2bJbQujXP51E83yuOQim9Df60fA6kAr6pBrH3FX6vhOX+cg/zUx0maEXyQUgOTsST8XTl774Hxyh6kdw==", + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.27.0.tgz", + "integrity": "sha512-rzVl2Rf3LQ2b7ykymVJSXZwRcy/QuwqlLmYh7NRi9Ilkk66aOloJTBgkkni/wlg5/RyohQKSdOmFYHcF+IiS3A==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.19.1", + "@microsoft/api-extractor-model": "7.20.0", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", "@rushstack/node-core-library": "3.46.0", @@ -7823,7 +7820,7 @@ "dependencies": { "resolve": { "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.17.0.tgz", "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", "dev": true, "requires": { @@ -7832,16 +7829,16 @@ }, "typescript": { "version": "4.6.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.6.4.tgz", "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", "dev": true } } }, "@microsoft/api-extractor-model": { - "version": "7.19.1", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.19.1.tgz", - "integrity": "sha512-nF2+4U6DYHne18+8IMJZR7NR/9rwEobzEwLqYYG1+GFefxZ0hEQTKBcqdSKToiHvZySXxcmtdXWZqzo3AbGe/A==", + "version": "7.20.0", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.20.0.tgz", + "integrity": "sha512-6gK6ipnBsSZ9uLrUBHg3q1V7gvzvB1zVb8lbtrpKl3mQJ7vvXJm2sDNl3Vlt1gy0izgQb9s6mmyy7hLRh1qFRg==", "dev": true, "requires": { "@microsoft/tsdoc": "0.14.1", @@ -12681,7 +12678,7 @@ }, "source-map": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, diff --git a/package.json b/package.json index 312d53b5..09be0a5d 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "author": "OpenFunction", "license": "Apache-2.0", "devDependencies": { - "@microsoft/api-extractor": "^7.26.1", + "@microsoft/api-extractor": "^7.27.0", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", "@types/express": "4.17.13", From 3b5aebfef0ae62329aca56d2892552185b211496 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Tue, 28 Jun 2022 22:35:38 +0800 Subject: [PATCH 10/42] =?UTF-8?q?=F0=9F=91=B7=20ci(bot):=20copycat=20assig?= =?UTF-8?q?n-bot=20from=20dapr=20[no=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/assign-bot.yml | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/assign-bot.yml diff --git a/.github/workflows/assign-bot.yml b/.github/workflows/assign-bot.yml new file mode 100644 index 00000000..cf672744 --- /dev/null +++ b/.github/workflows/assign-bot.yml @@ -0,0 +1,46 @@ +# ------------------------------------------------------------ +# Copyright 2021 The Dapr Authors +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------ + +name: assign-bot + +on: + issue_comment: + types: [created] + +jobs: + daprbot: + name: bot-processor + runs-on: ubuntu-latest + steps: + - name: Comment analyzer + uses: actions/github-script@v1 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const payload = context.payload; + const issue = context.issue; + const isFromPulls = !!payload.issue.pull_request; + const commentBody = payload.comment.body; + + if (!isFromPulls && commentBody && commentBody.indexOf("/assign") == 0) { + if (!issue.assignees || issue.assignees.length === 0) { + await github.issues.addAssignees({ + owner: issue.owner, + repo: issue.repo, + issue_number: issue.number, + assignees: [context.actor], + }) + } + + return; + } From 6767f90fc125cbbba7c66f245e31dedda38f35f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Jun 2022 03:35:21 +0000 Subject: [PATCH 11/42] chore(deps): bump actions/github-script from 1 to 6 Bumps [actions/github-script](https://github.com/actions/github-script) from 1 to 6. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v1...v6) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/assign-bot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assign-bot.yml b/.github/workflows/assign-bot.yml index cf672744..e771bcdd 100644 --- a/.github/workflows/assign-bot.yml +++ b/.github/workflows/assign-bot.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Comment analyzer - uses: actions/github-script@v1 + uses: actions/github-script@v6 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | From f1198e674ee51daf6a6fa8f2634db2ce11023817 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Tue, 5 Jul 2022 17:35:51 +0800 Subject: [PATCH 12/42] =?UTF-8?q?=F0=9F=90=9B=20fix(assign-bot):=20should?= =?UTF-8?q?=20use=20`github.rest.*`=20[no=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/assign-bot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assign-bot.yml b/.github/workflows/assign-bot.yml index e771bcdd..e8baf045 100644 --- a/.github/workflows/assign-bot.yml +++ b/.github/workflows/assign-bot.yml @@ -34,7 +34,7 @@ jobs: if (!isFromPulls && commentBody && commentBody.indexOf("/assign") == 0) { if (!issue.assignees || issue.assignees.length === 0) { - await github.issues.addAssignees({ + await github.rest.issues.addAssignees({ owner: issue.owner, repo: issue.repo, issue_number: issue.number, From 820c4627505227903de467376d8206d87787abac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Jul 2022 03:43:43 +0000 Subject: [PATCH 13/42] chore(deps-dev): bump concurrently from 7.2.2 to 7.3.0 Bumps [concurrently](https://github.com/open-cli-tools/concurrently) from 7.2.2 to 7.3.0. - [Release notes](https://github.com/open-cli-tools/concurrently/releases) - [Commits](https://github.com/open-cli-tools/concurrently/compare/v7.2.2...v7.3.0) --- updated-dependencies: - dependency-name: concurrently dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index adff984c..c61cfb20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1816,9 +1816,9 @@ } }, "node_modules/concurrently": { - "version": "7.2.2", - "resolved": "https://registry.npmmirror.com/concurrently/-/concurrently-7.2.2.tgz", - "integrity": "sha512-DcQkI0ruil5BA/g7Xy3EWySGrFJovF5RYAYxwGvv9Jf9q9B1v3jPFP2tl6axExNf1qgF30kjoNYrangZ0ey4Aw==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.3.0.tgz", + "integrity": "sha512-IiDwm+8DOcFEInca494A8V402tNTQlJaYq78RF2rijOrKEk/AOHTxhN4U1cp7GYKYX5Q6Ymh1dLTBlzIMN0ikA==", "dev": true, "dependencies": { "chalk": "^4.1.0", @@ -9119,9 +9119,9 @@ } }, "concurrently": { - "version": "7.2.2", - "resolved": "https://registry.npmmirror.com/concurrently/-/concurrently-7.2.2.tgz", - "integrity": "sha512-DcQkI0ruil5BA/g7Xy3EWySGrFJovF5RYAYxwGvv9Jf9q9B1v3jPFP2tl6axExNf1qgF30kjoNYrangZ0ey4Aw==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.3.0.tgz", + "integrity": "sha512-IiDwm+8DOcFEInca494A8V402tNTQlJaYq78RF2rijOrKEk/AOHTxhN4U1cp7GYKYX5Q6Ymh1dLTBlzIMN0ikA==", "dev": true, "requires": { "chalk": "^4.1.0", From ad398779f720b2a34512473e997b00bc8c8a5f99 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Tue, 19 Jul 2022 12:10:55 +0800 Subject: [PATCH 14/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20use=20dapr=20c?= =?UTF-8?q?li=201.8.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index ccb68637..d6756228 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -21,7 +21,7 @@ jobs: - name: Install Dapr uses: dapr/setup-dapr@v1 with: - version: '1.7.1' + version: '1.8.0' - name: Install Docker for macOS uses: docker-practice/actions-setup-docker@master if: ${{ matrix.platform == 'macos-latest' }} From b6856da979ca704781dfd22b3969277bbbe0dc56 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Tue, 19 Jul 2022 13:02:50 +0800 Subject: [PATCH 15/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20lock=20dapr=20?= =?UTF-8?q?runtime=20to=201.7.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- .github/workflows/unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index d6756228..cfc3e7bf 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -26,7 +26,7 @@ jobs: uses: docker-practice/actions-setup-docker@master if: ${{ matrix.platform == 'macos-latest' }} - name: Initialize Dapr - run: dapr init + run: dapr init -s --runtime-version 1.7.1 - name: Install dependencies run: npm install - name: Build TypeScript project From 351c63911cd30597dfb4cd83e856c375899b8ccf Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Tue, 19 Jul 2022 14:00:45 +0800 Subject: [PATCH 16/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20try=20to=20ena?= =?UTF-8?q?ble=20dapr=20matrix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- .github/workflows/unit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index cfc3e7bf..613898ca 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -9,6 +9,7 @@ jobs: strategy: matrix: node-version: [16] + dapr-version: [1.6.3, 1.7.4] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: @@ -26,7 +27,7 @@ jobs: uses: docker-practice/actions-setup-docker@master if: ${{ matrix.platform == 'macos-latest' }} - name: Initialize Dapr - run: dapr init -s --runtime-version 1.7.1 + run: dapr init -s --runtime-version ${{ matrix.dapr-version }} - name: Install dependencies run: npm install - name: Build TypeScript project From 820ac94b887788caa45f652f9a3fdd939a4b7555 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Wed, 20 Jul 2022 17:55:54 +0800 Subject: [PATCH 17/42] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20chore:=20bump=20deps?= =?UTF-8?q?=20and=20deps-dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- package-lock.json | 106 +++++++++++++++++++++++----------------------- package.json | 14 +++--- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/package-lock.json b/package-lock.json index c61cfb20..856f28ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,17 +16,17 @@ "express": "^4.18.1", "express-interceptor": "^1.2.0", "lodash": "^4.17.21", - "minimist": "^1.2.5", - "on-finished": "^2.3.0", + "minimist": "^1.2.6", + "on-finished": "^2.4.1", "read-pkg-up": "^7.0.1", - "semver": "^7.3.5" + "semver": "^7.3.7" }, "bin": { "functions-framework": "build/src/main.js", "functions-framework-nodejs": "build/src/main.js" }, "devDependencies": { - "@microsoft/api-extractor": "^7.27.0", + "@microsoft/api-extractor": "^7.28.4", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", "@types/express": "4.17.13", @@ -39,16 +39,16 @@ "@types/on-finished": "2.3.1", "@types/semver": "^7.3.10", "@types/shelljs": "^0.8.11", - "@types/sinon": "^10.0.11", + "@types/sinon": "10.0.11", "@types/supertest": "2.0.12", "aedes": "^0.47.0", - "concurrently": "^7.2.2", + "concurrently": "^7.3.0", "cross-env": "^7.0.3", "env-cmd": "^10.1.0", "gts": "^3.1.0", "mocha": "10.0.0", "pack-n-play": "^1.0.0-2", - "pre-push": "^0.1.2", + "pre-push": "^0.1.3", "shelljs": "^0.8.5", "sinon": "^14.0.0", "supertest": "6.2.3", @@ -218,17 +218,17 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@microsoft/api-extractor": { - "version": "7.27.0", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.27.0.tgz", - "integrity": "sha512-rzVl2Rf3LQ2b7ykymVJSXZwRcy/QuwqlLmYh7NRi9Ilkk66aOloJTBgkkni/wlg5/RyohQKSdOmFYHcF+IiS3A==", + "version": "7.28.4", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.28.4.tgz", + "integrity": "sha512-7JeROBGYTUt4/4HPnpMscsQgLzX0OfGTQR2qOQzzh3kdkMyxmiv2mzpuhoMnwbubb1GvPcyFm+NguoqOqkCVaw==", "dev": true, "dependencies": { - "@microsoft/api-extractor-model": "7.20.0", + "@microsoft/api-extractor-model": "7.21.0", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.46.0", - "@rushstack/rig-package": "0.3.12", - "@rushstack/ts-command-line": "4.12.0", + "@rushstack/node-core-library": "3.49.0", + "@rushstack/rig-package": "0.3.13", + "@rushstack/ts-command-line": "4.12.1", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", @@ -241,14 +241,14 @@ } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.20.0", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.20.0.tgz", - "integrity": "sha512-6gK6ipnBsSZ9uLrUBHg3q1V7gvzvB1zVb8lbtrpKl3mQJ7vvXJm2sDNl3Vlt1gy0izgQb9s6mmyy7hLRh1qFRg==", + "version": "7.21.0", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.21.0.tgz", + "integrity": "sha512-NN4mXzoQWTuzznIcnLWeV6tGyn6Os9frDK6M/mmTXZ73vUYOvSWoKQ5SYzyzP7HF3YtvTmr1Rs+DsBb0HRx7WQ==", "dev": true, "dependencies": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.46.0" + "@rushstack/node-core-library": "3.49.0" } }, "node_modules/@microsoft/api-extractor/node_modules/resolve": { @@ -391,9 +391,9 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "node_modules/@rushstack/node-core-library": { - "version": "3.46.0", - "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.46.0.tgz", - "integrity": "sha512-5iF21WvppEkXUPkxXkkH7HlfK5jDNFTKPJT0M+t3fG8qteoJM2atQoLtXklS0yNgOXy5zNTVTO+9lSzfVUvrCA==", + "version": "3.49.0", + "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.49.0.tgz", + "integrity": "sha512-yBJRzGgUNFwulVrwwBARhbGaHsxVMjsZ9JwU1uSBbqPYCdac+t2HYdzi4f4q/Zpgb0eNbwYj2yxgHYpJORNEaw==", "dev": true, "dependencies": { "@types/node": "12.20.24", @@ -423,9 +423,9 @@ } }, "node_modules/@rushstack/rig-package": { - "version": "0.3.12", - "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.12.tgz", - "integrity": "sha512-ZzxuBWG0wbOtI+9IHYvOsr3QN52GtxTWpcaHMsQ/PC9us2ve/k0xK0XOMu+CtStyHSnBG2nDdnF9vFv9HMYOZg==", + "version": "0.3.13", + "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.13.tgz", + "integrity": "sha512-4/2+yyA/uDl7LQvtYtFs1AkhSWuaIGEKhP9/KK2nNARqOVc5eCXmu1vyOqr5mPvNq7sHoIR+sG84vFbaKYGaDA==", "dev": true, "dependencies": { "resolve": "~1.17.0", @@ -442,9 +442,9 @@ } }, "node_modules/@rushstack/ts-command-line": { - "version": "4.12.0", - "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.0.tgz", - "integrity": "sha512-+dC3ZwT1PjvsEnybXzM9UUYg4xdDOl6vmE+23eByxbWmAxo/nB8VAD5iFs+jbbUd9MtG/7xqCBWbMWEDA+cBjw==", + "version": "4.12.1", + "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.1.tgz", + "integrity": "sha512-S1Nev6h/kNnamhHeGdp30WgxZTA+B76SJ/P721ctP7DrnC+rrjAc6h/R80I4V0cA2QuEEcMdVOQCtK2BTjsOiQ==", "dev": true, "dependencies": { "@types/argparse": "1.0.38", @@ -5699,9 +5699,9 @@ } }, "node_modules/pre-push": { - "version": "0.1.2", - "resolved": "https://registry.npmmirror.com/pre-push/-/pre-push-0.1.2.tgz", - "integrity": "sha512-WymiU20I3W1yGV4VEqa+xOqaqGHYUz49R4ARvEdmYPgL07E/Gn7NLewI9k5g6KUc2EOaWE42rBb7nfVKYtkpCA==", + "version": "0.1.3", + "resolved": "https://registry.npmmirror.com/pre-push/-/pre-push-0.1.3.tgz", + "integrity": "sha512-PXc3tT7jq/H2VrEooQ8F9QCVfQawmd52CzWMemUrPlFnL8avaXY22NTuej3ClISy8EwStaB5myiigPBP4zqSbw==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -7799,17 +7799,17 @@ } }, "@microsoft/api-extractor": { - "version": "7.27.0", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.27.0.tgz", - "integrity": "sha512-rzVl2Rf3LQ2b7ykymVJSXZwRcy/QuwqlLmYh7NRi9Ilkk66aOloJTBgkkni/wlg5/RyohQKSdOmFYHcF+IiS3A==", + "version": "7.28.4", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.28.4.tgz", + "integrity": "sha512-7JeROBGYTUt4/4HPnpMscsQgLzX0OfGTQR2qOQzzh3kdkMyxmiv2mzpuhoMnwbubb1GvPcyFm+NguoqOqkCVaw==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.20.0", + "@microsoft/api-extractor-model": "7.21.0", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.46.0", - "@rushstack/rig-package": "0.3.12", - "@rushstack/ts-command-line": "4.12.0", + "@rushstack/node-core-library": "3.49.0", + "@rushstack/rig-package": "0.3.13", + "@rushstack/ts-command-line": "4.12.1", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", @@ -7836,14 +7836,14 @@ } }, "@microsoft/api-extractor-model": { - "version": "7.20.0", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.20.0.tgz", - "integrity": "sha512-6gK6ipnBsSZ9uLrUBHg3q1V7gvzvB1zVb8lbtrpKl3mQJ7vvXJm2sDNl3Vlt1gy0izgQb9s6mmyy7hLRh1qFRg==", + "version": "7.21.0", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.21.0.tgz", + "integrity": "sha512-NN4mXzoQWTuzznIcnLWeV6tGyn6Os9frDK6M/mmTXZ73vUYOvSWoKQ5SYzyzP7HF3YtvTmr1Rs+DsBb0HRx7WQ==", "dev": true, "requires": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.46.0" + "@rushstack/node-core-library": "3.49.0" } }, "@microsoft/tsdoc": { @@ -7957,9 +7957,9 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "@rushstack/node-core-library": { - "version": "3.46.0", - "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.46.0.tgz", - "integrity": "sha512-5iF21WvppEkXUPkxXkkH7HlfK5jDNFTKPJT0M+t3fG8qteoJM2atQoLtXklS0yNgOXy5zNTVTO+9lSzfVUvrCA==", + "version": "3.49.0", + "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.49.0.tgz", + "integrity": "sha512-yBJRzGgUNFwulVrwwBARhbGaHsxVMjsZ9JwU1uSBbqPYCdac+t2HYdzi4f4q/Zpgb0eNbwYj2yxgHYpJORNEaw==", "dev": true, "requires": { "@types/node": "12.20.24", @@ -7991,9 +7991,9 @@ } }, "@rushstack/rig-package": { - "version": "0.3.12", - "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.12.tgz", - "integrity": "sha512-ZzxuBWG0wbOtI+9IHYvOsr3QN52GtxTWpcaHMsQ/PC9us2ve/k0xK0XOMu+CtStyHSnBG2nDdnF9vFv9HMYOZg==", + "version": "0.3.13", + "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.13.tgz", + "integrity": "sha512-4/2+yyA/uDl7LQvtYtFs1AkhSWuaIGEKhP9/KK2nNARqOVc5eCXmu1vyOqr5mPvNq7sHoIR+sG84vFbaKYGaDA==", "dev": true, "requires": { "resolve": "~1.17.0", @@ -8012,9 +8012,9 @@ } }, "@rushstack/ts-command-line": { - "version": "4.12.0", - "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.0.tgz", - "integrity": "sha512-+dC3ZwT1PjvsEnybXzM9UUYg4xdDOl6vmE+23eByxbWmAxo/nB8VAD5iFs+jbbUd9MtG/7xqCBWbMWEDA+cBjw==", + "version": "4.12.1", + "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.1.tgz", + "integrity": "sha512-S1Nev6h/kNnamhHeGdp30WgxZTA+B76SJ/P721ctP7DrnC+rrjAc6h/R80I4V0cA2QuEEcMdVOQCtK2BTjsOiQ==", "dev": true, "requires": { "@types/argparse": "1.0.38", @@ -11989,9 +11989,9 @@ "dev": true }, "pre-push": { - "version": "0.1.2", - "resolved": "https://registry.npmmirror.com/pre-push/-/pre-push-0.1.2.tgz", - "integrity": "sha512-WymiU20I3W1yGV4VEqa+xOqaqGHYUz49R4ARvEdmYPgL07E/Gn7NLewI9k5g6KUc2EOaWE42rBb7nfVKYtkpCA==", + "version": "0.1.3", + "resolved": "https://registry.npmmirror.com/pre-push/-/pre-push-0.1.3.tgz", + "integrity": "sha512-PXc3tT7jq/H2VrEooQ8F9QCVfQawmd52CzWMemUrPlFnL8avaXY22NTuej3ClISy8EwStaB5myiigPBP4zqSbw==", "dev": true, "requires": { "cross-spawn": "^5.0.1", diff --git a/package.json b/package.json index 09be0a5d..33b2d299 100644 --- a/package.json +++ b/package.json @@ -20,10 +20,10 @@ "express": "^4.18.1", "express-interceptor": "^1.2.0", "lodash": "^4.17.21", - "minimist": "^1.2.5", - "on-finished": "^2.3.0", + "minimist": "^1.2.6", + "on-finished": "^2.4.1", "read-pkg-up": "^7.0.1", - "semver": "^7.3.5" + "semver": "^7.3.7" }, "scripts": { "test": "cross-env DEBUG=common:*,ofn:* mocha build/test -t 60000 --recursive --exit", @@ -52,7 +52,7 @@ "author": "OpenFunction", "license": "Apache-2.0", "devDependencies": { - "@microsoft/api-extractor": "^7.27.0", + "@microsoft/api-extractor": "^7.28.4", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", "@types/express": "4.17.13", @@ -65,16 +65,16 @@ "@types/on-finished": "2.3.1", "@types/semver": "^7.3.10", "@types/shelljs": "^0.8.11", - "@types/sinon": "^10.0.11", + "@types/sinon": "10.0.11", "@types/supertest": "2.0.12", "aedes": "^0.47.0", - "concurrently": "^7.2.2", + "concurrently": "^7.3.0", "cross-env": "^7.0.3", "env-cmd": "^10.1.0", "gts": "^3.1.0", "mocha": "10.0.0", "pack-n-play": "^1.0.0-2", - "pre-push": "^0.1.2", + "pre-push": "^0.1.3", "shelljs": "^0.8.5", "sinon": "^14.0.0", "supertest": "6.2.3", From cab11148c0bd0f60b89ae2d2d4fe642f81d5e450 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Wed, 20 Jul 2022 17:58:13 +0800 Subject: [PATCH 18/42] =?UTF-8?q?=F0=9F=93=9D=20docs:=20bump=20api=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- docs/generated/api.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/generated/api.json b/docs/generated/api.json index 3c0972e7..e37b3605 100644 --- a/docs/generated/api.json +++ b/docs/generated/api.json @@ -1,8 +1,8 @@ { "metadata": { "toolPackage": "@microsoft/api-extractor", - "toolVersion": "7.27.0", - "schemaVersion": 1008, + "toolVersion": "7.28.4", + "schemaVersion": 1009, "oldestForwardsCompatibleVersion": 1001, "tsdocConfig": { "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", @@ -1602,6 +1602,7 @@ "text": ";" } ], + "isReadonly": false, "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 From 148ad5427507c198569d82a0780617be02076ddf Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Wed, 20 Jul 2022 18:01:00 +0800 Subject: [PATCH 19/42] =?UTF-8?q?=E2=9C=85=20fix(test/e2e):=20use=20direct?= =?UTF-8?q?=20ce=20msg=20for=20pubsub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- test/integration/async_server.ts | 40 +++++++++++++++++++------------- test/integration/cloud_event.ts | 2 +- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/test/integration/async_server.ts b/test/integration/async_server.ts index 7a155277..23d5a4c2 100644 --- a/test/integration/async_server.ts +++ b/test/integration/async_server.ts @@ -2,7 +2,7 @@ import {deepStrictEqual, ifError, ok} from 'assert'; import {createServer} from 'net'; -import {get} from 'lodash'; +import {get, isEmpty} from 'lodash'; import * as shell from 'shelljs'; import * as MQTT from 'aedes'; @@ -54,7 +54,16 @@ const TEST_CONTEXT: OpenFunctionContext = { }, }, }; + const TEST_PAYLOAD = {data: 'hello world'}; +const TEST_CLOUD_EVENT = { + specversion: '1.0', + id: 'test-1234-1234', + type: 'ce.openfunction', + source: 'https://github.com/OpenFunction/functions-framework-nodejs', + traceparent: '00-65088630f09e0a5359677a7429456db7-97f23477fb2bf5ec-01', + data: TEST_PAYLOAD, +}; describe('OpenFunction - Async - Binding', () => { const APPID = 'async.dapr'; @@ -139,15 +148,12 @@ describe('OpenFunction - Async - Binding', () => { it('mqtt sub w/ pub output', done => { const app = getAysncServer((ctx, data) => { + if (isEmpty(data)) return; + // Assert that user function receives correct data from input binding - try { - const recieved = JSON.parse(data as string); - deepStrictEqual(recieved, TEST_PAYLOAD); - } catch (err) { - ifError(err); - } + deepStrictEqual(data, TEST_PAYLOAD); - // Then write recived data to a local file + // Then forward received data to output channel const output = 'mqtt_pub'; broker.subscribe( get(TEST_CONTEXT, `outputs.${output}.uri`), @@ -165,15 +171,17 @@ describe('OpenFunction - Async - Binding', () => { // First, we start the async server app.start().then(() => { - // Then, we publish a message via Dapr CLI - const formatted = JSON.stringify(TEST_PAYLOAD).replace(/"/g, '\\"'); - shell.exec( - `dapr publish -i ${APPID} -p ${ - TEST_CONTEXT.inputs!.mqtt_sub!.componentName - } -t ${TEST_CONTEXT.inputs!.mqtt_sub.uri} -d '"${formatted}"'`, + // Then, we send a cloudevent format message to server + broker.publish( { - silent: true, - } + cmd: 'publish', + topic: TEST_CONTEXT.inputs!.mqtt_sub.uri!, + payload: JSON.stringify(TEST_CLOUD_EVENT), + qos: 0, + retain: false, + dup: false, + }, + err => ifError(err) ); }); }); diff --git a/test/integration/cloud_event.ts b/test/integration/cloud_event.ts index c57fa782..ce21b81d 100644 --- a/test/integration/cloud_event.ts +++ b/test/integration/cloud_event.ts @@ -25,7 +25,7 @@ import {FUNCTION_STATUS_HEADER_FIELD} from '../../src/types'; const TEST_CLOUD_EVENT = { specversion: '1.0', type: 'com.google.cloud.storage', - source: 'https://github.com/GoogleCloudPlatform/functions-framework-nodejs', + source: 'https://github.com/OpenFunction/functions-framework-nodejs', subject: 'test-subject', id: 'test-1234-1234', time: '2020-05-13T01:23:45Z', From d44a6d5287eb72d025ce4aed5c9ebf3b78d45350 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Wed, 20 Jul 2022 18:01:29 +0800 Subject: [PATCH 20/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20introduce=20da?= =?UTF-8?q?pr=201.8.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- .github/workflows/unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 613898ca..449346cd 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: node-version: [16] - dapr-version: [1.6.3, 1.7.4] + dapr-version: [1.6.3, 1.7.4, 1.8.0] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: From a316c7dc95557d2c19f7f6688174b03d76dd6b39 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Wed, 20 Jul 2022 20:06:23 +0800 Subject: [PATCH 21/42] =?UTF-8?q?=F0=9F=91=B7=20ci(bot):=20add=20stale=20a?= =?UTF-8?q?nd=20rename=20assign=20bot=20[no=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- .../workflows/{assign-bot.yml => assign.yml} | 0 .github/workflows/stale.yml | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+) rename .github/workflows/{assign-bot.yml => assign.yml} (100%) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/assign-bot.yml b/.github/workflows/assign.yml similarity index 100% rename from .github/workflows/assign-bot.yml rename to .github/workflows/assign.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..8b5e9cc6 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,54 @@ +# +# Copyright 2022 The Dapr Authors +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: stale-bot + +on: + schedule: + - cron: '*/10 * * * *' + workflow_dispatch: + +jobs: + prune_stale: + name: Prune Stale + runs-on: ubuntu-latest + steps: + - name: Prune Stale + uses: actions/stale@v5.1.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-issue-stale: 60 + days-before-pr-stale: 30 + days-before-close: 7 + stale-issue-message: > + This issue has been automatically marked as stale because it has not had activity in the last 60 days. + It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. + Thank you for your contributions. + close-issue-message: > + This issue has been automatically closed because it has not had activity in the last 67 days. + If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. + Thank you for your contributions. + stale-pr-message: > + This pull request has been automatically marked as stale because it has not had activity in the last 30 days. + It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. + Thank you for your contributions! + close-pr-message: > + This pull request has been automatically closed because it has not had activity in the last 37 days. + Please feel free to give a status update now, ping for review, or re-open when it's ready. + Thank you for your contributions! + stale-issue-label: 'stale' + exempt-issue-labels: 'pinned, good first issue, help wanted, triaged/resolved, triaged/unresolved' + stale-pr-label: 'stale' + exempt-pr-labels: 'pinned' + operations-per-run: 500 + ascending: true From ccc375b5d2af2518c7b5baa37a1c43ed5c85d3df Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Thu, 21 Jul 2022 11:06:47 +0800 Subject: [PATCH 22/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20bump=20dapr=20?= =?UTF-8?q?1.8.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- .github/workflows/unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 449346cd..6deae38c 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: node-version: [16] - dapr-version: [1.6.3, 1.7.4, 1.8.0] + dapr-version: [1.6.3, 1.7.4, 1.8.1] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: From 5388e5011a73f15f27a0603d68ec6587e8e95a1c Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Wed, 27 Jul 2022 19:54:55 +0800 Subject: [PATCH 23/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20bump=20dapr=20?= =?UTF-8?q?1.8.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- .github/workflows/unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 6deae38c..7f648691 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: node-version: [16] - dapr-version: [1.6.3, 1.7.4, 1.8.1] + dapr-version: [1.6.3, 1.7.4, 1.8.2] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: From 2934a300710497f1bf0660fa8057de81237d2dbe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Jul 2022 04:20:27 +0000 Subject: [PATCH 24/42] chore(deps): bump actions/stale from 5.1.0 to 5.1.1 Bumps [actions/stale](https://github.com/actions/stale) from 5.1.0 to 5.1.1. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/v5.1.1/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v5.1.0...v5.1.1) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 8b5e9cc6..837b2df1 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Prune Stale - uses: actions/stale@v5.1.0 + uses: actions/stale@v5.1.1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-issue-stale: 60 From 32fdb169d29c912e4c4cf9fa5cda2b0bbce844a5 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Fri, 29 Jul 2022 16:56:41 +0800 Subject: [PATCH 25/42] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20chore(deps):=20bump?= =?UTF-8?q?=20dapr=20to=202.3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 856f28ce..12f97f9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.5.0", "license": "Apache-2.0", "dependencies": { - "@dapr/dapr": "2.2.1", + "@dapr/dapr": "2.3.1", "body-parser": "^1.20.0", "cloudevents": "^6.0.2", "debug": "^4.3.4", @@ -92,9 +92,9 @@ } }, "node_modules/@dapr/dapr": { - "version": "2.2.1", - "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.2.1.tgz", - "integrity": "sha512-SSA8dtsq0k7UERjwVjopGjZqiHQu+nVcd1v8DXy2KvIGbrx0EKS3Ir63TU/2m2vFl57F6k33bg4kbqNd1RRyAQ==", + "version": "2.3.1", + "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.1.tgz", + "integrity": "sha512-qg0GmXNVmzFPEcoMRrGQQT3s8W/HPKBPv97woSCQNX+uPqzJYIxxIctbAXdzUXHUkeFG97kRJ6ghCzC2q48hRQ==", "dependencies": { "@grpc/grpc-js": "^1.3.7", "@js-temporal/polyfill": "^0.3.0", @@ -7690,9 +7690,9 @@ } }, "@dapr/dapr": { - "version": "2.2.1", - "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.2.1.tgz", - "integrity": "sha512-SSA8dtsq0k7UERjwVjopGjZqiHQu+nVcd1v8DXy2KvIGbrx0EKS3Ir63TU/2m2vFl57F6k33bg4kbqNd1RRyAQ==", + "version": "2.3.1", + "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.1.tgz", + "integrity": "sha512-qg0GmXNVmzFPEcoMRrGQQT3s8W/HPKBPv97woSCQNX+uPqzJYIxxIctbAXdzUXHUkeFG97kRJ6ghCzC2q48hRQ==", "requires": { "@grpc/grpc-js": "^1.3.7", "@js-temporal/polyfill": "^0.3.0", diff --git a/package.json b/package.json index 33b2d299..e03bf3e1 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "./testing": "./build/src/testing.js" }, "dependencies": { - "@dapr/dapr": "2.2.1", + "@dapr/dapr": "2.3.1", "body-parser": "^1.20.0", "cloudevents": "^6.0.2", "debug": "^4.3.4", From ee335ba00f3a44e0cc49da774c28c82125f420ae Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 30 Jul 2022 16:33:17 +0800 Subject: [PATCH 26/42] =?UTF-8?q?=E2=9C=A8=20feat:=20enable=20graceful=20s?= =?UTF-8?q?hutdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- package-lock.json | 1 + package.json | 1 + src/main.ts | 42 ++++++++++++++++++++++++++++++----- test/conformance/package.json | 5 +++-- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 12f97f9b..f3d638ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "debug": "^4.3.4", "express": "^4.18.1", "express-interceptor": "^1.2.0", + "http-terminator": "^3.2.0", "lodash": "^4.17.21", "minimist": "^1.2.6", "on-finished": "^2.4.1", diff --git a/package.json b/package.json index e03bf3e1..fb193a45 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "debug": "^4.3.4", "express": "^4.18.1", "express-interceptor": "^1.2.0", + "http-terminator": "^3.2.0", "lodash": "^4.17.21", "minimist": "^1.2.6", "on-finished": "^2.4.1", diff --git a/src/main.ts b/src/main.ts index 1622a9c5..bee7a1c1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,17 +16,22 @@ // Functions framework entry point that configures and starts Node.js server // that runs user's code on HTTP request. -import {getUserFunction} from './loader'; -import {ErrorHandler} from './invoker'; -import {getServer} from './server'; -import {parseOptions, helpText, OptionsError} from './options'; -import {OpenFunction} from './functions'; +import * as process from 'process'; + +import {createHttpTerminator} from 'http-terminator'; + import getAysncServer from './openfunction/async_server'; import { OpenFunctionContext, ContextUtils, } from './openfunction/function_context'; +import {getUserFunction} from './loader'; +import {ErrorHandler} from './invoker'; +import {getServer} from './server'; +import {parseOptions, helpText, OptionsError} from './options'; +import {OpenFunction} from './functions'; + /** * Main entrypoint for the functions framework that loads the user's function * and starts the HTTP server. @@ -51,6 +56,8 @@ export const main = async () => { } const {userFunction, signatureType} = loadedFunction; + // Try to determine the server runtime + // Considering the async runtime in the first place if (ContextUtils.IsAsyncRuntime(options.context as OpenFunctionContext)) { options.context!.port = options.port; @@ -59,7 +66,12 @@ export const main = async () => { options.context! ); await server.start(); - } else { + + // DaprServer uses httpTerminator in server.stop() + handleShutdown(async () => await server.stop()); + } + // Then taking sync runtime as the fallback + else { const server = getServer(userFunction!, signatureType, options.context); const errorHandler = new ErrorHandler(server); server @@ -73,6 +85,12 @@ export const main = async () => { } }) .setTimeout(0); // Disable automatic timeout on incoming connections. + + // Create and use httpTerminator for Express + const terminator = createHttpTerminator({ + server, + }); + handleShutdown(async () => await terminator.terminate()); } } catch (e) { if (e instanceof OptionsError) { @@ -86,3 +104,15 @@ export const main = async () => { // Call the main method to load the user code and start the http server. main(); + +function handleShutdown(handler: () => Promise): void { + if (!handler) return; + + const shutdown = async (code: string) => { + console.log(`🛑 Terminating OpenFunction server on code ${code}...`); + await handler(); + }; + + process.on('SIGTERM', shutdown); + process.on('SIGINT', shutdown); +} diff --git a/test/conformance/package.json b/test/conformance/package.json index f4eb9778..3145dd38 100644 --- a/test/conformance/package.json +++ b/test/conformance/package.json @@ -8,11 +8,12 @@ }, "scripts": { "start": "functions-framework --target=writeHttp", - "knative:async": "concurrently npm:knative:async:run:* npm:knative:async:test", + "compile": "cd .. && npm run compile", + "knative:async": "npm run compile && concurrently npm:knative:async:run:* npm:knative:async:test", "knative:async:run:func": "cross-env DEBUG=test:*,common:*,ofn:* env-cmd -e knative functions-framework --signature-type=openfunction --target=tryKnativeAsync", "knative:async:run:dapr": "dapr run -H 3500 -d ../data/components/http --log-level warn", "knative:async:test": "wait-on tcp:3500 tcp:8080 && curl -s -d '{\"data\": \"hello\"}' -H 'Content-Type: application/json' localhost:8080", - "async": "concurrently npm:async:run:*", + "async": "npm run compile && concurrently npm:async:run:*", "async:run:func": "cross-env DEBUG=test:*,common:*,ofn:* env-cmd -e async functions-framework --target=tryAsync", "async:run:dapr": "dapr run -H 3500 -p 8080 -d ../data/components/cron --log-level info" } From a32fa1c43d0c0872263989b21233f01d28764535 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Thu, 4 Aug 2022 13:04:12 +0800 Subject: [PATCH 27/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20bump=20dapr=20?= =?UTF-8?q?1.8.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- .github/workflows/unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 7f648691..c5cfe874 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: node-version: [16] - dapr-version: [1.6.3, 1.7.4, 1.8.2] + dapr-version: [1.6.3, 1.7.4, 1.8.3] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: From 5d914176dd864694bce71538770061ee24f3dc4a Mon Sep 17 00:00:00 2001 From: MachaYAD <43526965+YADROOKIE@users.noreply.github.com> Date: Thu, 4 Aug 2022 15:51:21 +0800 Subject: [PATCH 28/42] =?UTF-8?q?=E2=9C=A8=20feat:=20enable=20plugin=20mec?= =?UTF-8?q?hanism=20for=20async=20func=20(#70)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintignore | 1 + docs/generated/api.json | 310 ++++++++++++++++++++++++ docs/generated/api.md | 14 ++ src/loader.ts | 175 ++++++++++++- src/main.ts | 5 +- src/openfunction/async_server.ts | 19 +- src/openfunction/function_context.ts | 51 ++++ test/data/plugins/errorMissAll.js | 6 + test/data/plugins/errorMissName.js | 22 ++ test/data/plugins/errorMissVersion.js | 22 ++ test/data/plugins/plugindemo.js | 32 +++ test/data/test_data/async_plugin.ts | 111 +++++++++ test/integration/async_server.ts | 66 +---- test/integration/async_server_plugin.ts | 99 ++++++++ test/loader.ts | 200 +++++++++++++++ test/options.ts | 72 ++++++ 16 files changed, 1143 insertions(+), 62 deletions(-) create mode 100644 test/data/plugins/errorMissAll.js create mode 100644 test/data/plugins/errorMissName.js create mode 100644 test/data/plugins/errorMissVersion.js create mode 100644 test/data/plugins/plugindemo.js create mode 100644 test/data/test_data/async_plugin.ts create mode 100644 test/integration/async_server_plugin.ts diff --git a/.eslintignore b/.eslintignore index c73a9699..93d966f5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ **/node_modules build/ test/data/esm_* +test/data/plugins docs/ diff --git a/docs/generated/api.json b/docs/generated/api.json index e37b3605..3180b5a5 100644 --- a/docs/generated/api.json +++ b/docs/generated/api.json @@ -1913,6 +1913,88 @@ "endIndex": 2 } }, + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#postPlugins:member", + "docComment": "/**\n * Optional post function exec plugins.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "postPlugins?: " + }, + { + "kind": "Reference", + "text": "Array", + "canonicalReference": "!Array:interface" + }, + { + "kind": "Content", + "text": "" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "postPlugins", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 5 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#prePlugins:member", + "docComment": "/**\n * Optional pre function exec plugins.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "prePlugins?: " + }, + { + "kind": "Reference", + "text": "Array", + "canonicalReference": "!Array:interface" + }, + { + "kind": "Content", + "text": "" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "prePlugins", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 5 + } + }, { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#runtime:member", @@ -2489,6 +2571,234 @@ ], "implementsTokenRanges": [] }, + { + "kind": "Class", + "canonicalReference": "@openfunction/functions-framework!Plugin_2:class", + "docComment": "/**\n * The OpenFunction's plugin template.\n *\n * @public\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "export declare class Plugin " + } + ], + "releaseTag": "Public", + "name": "Plugin_2", + "preserveMemberOrder": false, + "members": [ + { + "kind": "Method", + "canonicalReference": "@openfunction/functions-framework!Plugin_2#execPostHook:member(1)", + "docComment": "/**\n * post main function exec.\n *\n * @param ctx - The openfunction runtime .\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "execPostHook(ctx?: " + }, + { + "kind": "Reference", + "text": "OpenFunctionRuntime", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime:class" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Reference", + "text": "Promise", + "canonicalReference": "!Promise:interface" + }, + { + "kind": "Content", + "text": "" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isStatic": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 5 + }, + "releaseTag": "Public", + "isProtected": false, + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "ctx", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "isOptional": true + } + ], + "isOptional": false, + "name": "execPostHook" + }, + { + "kind": "Method", + "canonicalReference": "@openfunction/functions-framework!Plugin_2#execPreHook:member(1)", + "docComment": "/**\n * pre main function exec.\n *\n * @param ctx - The openfunction runtime .\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "execPreHook(ctx?: " + }, + { + "kind": "Reference", + "text": "OpenFunctionRuntime", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime:class" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Reference", + "text": "Promise", + "canonicalReference": "!Promise:interface" + }, + { + "kind": "Content", + "text": "" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isStatic": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 5 + }, + "releaseTag": "Public", + "isProtected": false, + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "ctx", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "isOptional": true + } + ], + "isOptional": false, + "name": "execPreHook" + }, + { + "kind": "Method", + "canonicalReference": "@openfunction/functions-framework!Plugin_2#get:member(1)", + "docComment": "/**\n * get instance filed value.\n *\n * @param filedName - the instace filedName\n *\n * @returns filed value.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "get(filedName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isStatic": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "isProtected": false, + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "filedName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "isOptional": false + } + ], + "isOptional": false, + "name": "get" + }, + { + "kind": "Property", + "canonicalReference": "@openfunction/functions-framework!Plugin_2.OFN_PLUGIN_NAME:member", + "docComment": "", + "excerptTokens": [ + { + "kind": "Content", + "text": "static OFN_PLUGIN_NAME: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "OFN_PLUGIN_NAME", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "isStatic": true, + "isProtected": false + }, + { + "kind": "Property", + "canonicalReference": "@openfunction/functions-framework!Plugin_2.OFN_PLUGIN_VERSION:member", + "docComment": "", + "excerptTokens": [ + { + "kind": "Content", + "text": "static OFN_PLUGIN_VERSION: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "OFN_PLUGIN_VERSION", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "isStatic": true, + "isProtected": false + } + ], + "implementsTokenRanges": [] + }, { "kind": "Interface", "canonicalReference": "@openfunction/functions-framework!Request_2:interface", diff --git a/docs/generated/api.md b/docs/generated/api.md index 4d25f565..e084c92b 100644 --- a/docs/generated/api.md +++ b/docs/generated/api.md @@ -136,6 +136,8 @@ export interface OpenFunctionContext { name: string; outputs?: OpenFunctionBinding; port?: string; + postPlugins?: Array; + prePlugins?: Array; runtime: `${RuntimeType}` | `${Capitalize}` | `${Uppercase}`; version: string; } @@ -158,6 +160,18 @@ export abstract class OpenFunctionRuntime { protected trigger?: OpenFunctionTrigger; } +// @public +class Plugin_2 { + execPostHook(ctx?: OpenFunctionRuntime): Promise; + execPreHook(ctx?: OpenFunctionRuntime): Promise; + get(filedName: string): string; + // (undocumented) + static OFN_PLUGIN_NAME: string; + // (undocumented) + static OFN_PLUGIN_VERSION: string; +} +export { Plugin_2 as Plugin } + // @public (undocumented) interface Request_2 extends Request_3 { rawBody?: Buffer; diff --git a/src/loader.ts b/src/loader.ts index 99550fe2..5e943c5f 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -21,10 +21,14 @@ import * as path from 'path'; import * as semver from 'semver'; import * as readPkgUp from 'read-pkg-up'; +import * as fs from 'fs'; import {pathToFileURL} from 'url'; -import {HandlerFunction} from './functions'; +import {HandlerFunction, OpenFunctionRuntime} from './functions'; import {SignatureType} from './types'; import {getRegisteredFunction} from './function_registry'; +import {Plugin} from './openfunction/function_context'; +import {FrameworkOptions} from './options'; +import {forEach} from 'lodash'; // Dynamic import function required to load user code packaged as an // ES module is only available on Node.js v13.2.0 and up. @@ -92,6 +96,7 @@ export async function getUserFunction( } | null> { try { const functionModulePath = getFunctionModulePath(codeLocation); + if (functionModulePath === null) { console.error('Provided code is not a loadable module.'); return null; @@ -193,3 +198,171 @@ function getFunctionModulePath(codeLocation: string): string | null { } return path; } + +type PluginClass = Record; +/** + * Returns user's plugin from function file. + * Returns null if plugin can't be retrieved. + * @return User's plugins or null. + */ +export async function getUserPlugins( + options: FrameworkOptions +): Promise { + // Get plugin set + const pluginSet: Set = new Set(); + if (options.context) { + if (options.context.prePlugins) { + forEach(options.context.prePlugins, plugin => { + typeof plugin === 'string' && pluginSet.add(plugin); + }); + } + if (options.context.postPlugins) { + forEach(options.context.postPlugins, plugin => { + typeof plugin === 'string' && pluginSet.add(plugin); + }); + } + + try { + type Instance = Record; + // Load plugin js files + const instances: Instance = {}; + + const pluginFiles = getPluginFiles(options.sourceLocation); + if (pluginFiles === null) { + console.warn('[warn-!!!] user plugins files load failed '); + options.context.prePlugins = []; + options.context.postPlugins = []; + return options; + } + + // Find plugins class + const tempMap: PluginClass = {}; + for (const pluginFile of pluginFiles) { + const jsMoulde = require(pluginFile); + processJsModule(jsMoulde, tempMap); + } + + // Instance plugin dynamic set ofn_plugin_name + const pluginNames = Array.from(pluginSet.values()); + for (const name of pluginNames) { + const module = tempMap[name]; + if (module) { + const instance = new module(); + instance[Plugin.OFN_PLUGIN_NAME] = module.Name; + instance[Plugin.OFN_PLUGIN_VERSION] = module.Version || 'v1'; + + //Set default method of pre post get + if (!instance.execPreHook) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + instance.execPreHook = (ctx: OpenFunctionRuntime) => { + console.log( + `This plugin ${name} method execPreHook is not implemented.` + ); + }; + } + if (!instance.execPostHook) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + instance.execPostHook = (ctx: OpenFunctionRuntime) => { + console.log( + `This plugin ${name} method execPostHook is not implemented.` + ); + }; + } + if (!instance.get) { + instance.get = (filedName: string) => { + for (const key in instance) { + if (key === filedName) { + return instance[key]; + } + } + }; + } + instances[name] = instance as Plugin; + } + } + + const prePlugins: Array = []; + const postPlugins: Array = []; + if (options.context.prePlugins) { + forEach(options.context.prePlugins, plugin => { + if (typeof plugin === 'string') { + const instance = instances[plugin]; + typeof instance === 'object' && prePlugins.push(instance); + } + }); + } + if (options.context.postPlugins) { + forEach(options.context.postPlugins, plugin => { + if (typeof plugin === 'string') { + const instance = instances[plugin]; + typeof instance === 'object' && postPlugins.push(instance); + } + }); + } + + options.context.prePlugins = prePlugins; + options.context.postPlugins = postPlugins; + } catch (error) { + console.error('load plugins error reason: \n'); + console.error(error); + } + } + return options; +} + +/** + * Returns resolved path to the dir containing the user plugins. + * Returns null if the path is not exits + * @param codeLocation Directory with user's code. + * @return Resolved path or null. + */ +function getPluginFiles(codeLocation: string): Array | null { + const pluginFiles: Array = []; + try { + const param = path.resolve(codeLocation + '/plugins'); + const files = fs.readdirSync(param); + + for (const file of files) { + pluginFiles.push(require.resolve(path.join(param, file))); + } + } catch (ex) { + const err: Error = ex; + console.error(err.message); + return null; + } + return pluginFiles; +} +/** + * Returns rdetermine whether it is a class. + * Returns boolean is can be class + * @param obj jsmodule. + * @return boolean of it is a class. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function couldBeClass(obj: any): boolean { + return ( + typeof obj === 'function' && + obj.prototype !== undefined && + obj.prototype.constructor === obj && + obj.toString().slice(0, 5) === 'class' + ); +} + +/** + * Process jsMoulde if it can be a plugin class put it into tempMap. + * @param obj jsmodule. + * @param tempMap PluginClass. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function processJsModule(obj: any, tempMap: PluginClass) { + if (typeof obj === 'object') { + for (const o in obj) { + if (couldBeClass(obj[o]) && obj[o].Name) { + tempMap[obj[o].Name] = obj[o]; + } + } + } + if (couldBeClass(obj) && obj.Name) { + tempMap[obj.Name] = obj; + } +} diff --git a/src/main.ts b/src/main.ts index bee7a1c1..3cc5f864 100644 --- a/src/main.ts +++ b/src/main.ts @@ -26,7 +26,7 @@ import { ContextUtils, } from './openfunction/function_context'; -import {getUserFunction} from './loader'; +import {getUserFunction, getUserPlugins} from './loader'; import {ErrorHandler} from './invoker'; import {getServer} from './server'; import {parseOptions, helpText, OptionsError} from './options'; @@ -69,6 +69,9 @@ export const main = async () => { // DaprServer uses httpTerminator in server.stop() handleShutdown(async () => await server.stop()); + + // Load Plugins + await getUserPlugins(options); } // Then taking sync runtime as the fallback else { diff --git a/src/openfunction/async_server.ts b/src/openfunction/async_server.ts index 358b9ae9..6107f24e 100644 --- a/src/openfunction/async_server.ts +++ b/src/openfunction/async_server.ts @@ -1,4 +1,4 @@ -import {forEach} from 'lodash'; +import {forEach, invoke} from 'lodash'; import {DaprServer} from '@dapr/dapr'; import {OpenFunction} from '../functions'; @@ -23,7 +23,24 @@ export default function ( const ctx = OpenFunctionRuntime.ProxyContext(context); const wrapper = async (data: object) => { + // Exec pre hooks + console.log(context.prePlugins); + if (context.prePlugins) { + await context.prePlugins.reduce(async (_, current) => { + await invoke(current, 'execPreHook', ctx); + return []; + }, Promise.resolve([])); + } + await userFunction(ctx, data); + + // Exec post hooks + if (context.postPlugins) { + await context.postPlugins.reduce(async (_, current) => { + await invoke(current, 'execPostHook', ctx); + return []; + }, Promise.resolve([])); + } }; // Initialize the server with the user's function. diff --git a/src/openfunction/function_context.ts b/src/openfunction/function_context.ts index 450d7c07..fbf4dd23 100644 --- a/src/openfunction/function_context.ts +++ b/src/openfunction/function_context.ts @@ -1,3 +1,5 @@ +import {OpenFunctionRuntime} from './function_runtime'; + /** * The OpenFunction's serving context. * @public @@ -30,6 +32,14 @@ export interface OpenFunctionContext { * Optional output binding object. */ outputs?: OpenFunctionBinding; + /** + * Optional pre function exec plugins. + */ + prePlugins?: Array; + /** + * Optional post function exec plugins. + */ + postPlugins?: Array; } /** @@ -139,3 +149,44 @@ export class ContextUtils { return component?.componentType.split('.')[0] === ComponentType.PubSub; } } + +/** + * The OpenFunction's plugin template. + * @public + */ +export class Plugin { + static OFN_PLUGIN_NAME = 'ofn_plugin_name'; + static OFN_PLUGIN_VERSION = 'ofn_plugin_version'; + /** + * pre main function exec. + * @param ctx - The openfunction runtime . + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public async execPreHook(ctx?: OpenFunctionRuntime) { + console.log( + `This plugin ${this.get( + Plugin.OFN_PLUGIN_NAME + )} method execPreHook is not implemented.` + ); + } + /** + * post main function exec. + * @param ctx - The openfunction runtime . + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public async execPostHook(ctx?: OpenFunctionRuntime) { + console.log( + `This plugin ${this.get( + Plugin.OFN_PLUGIN_NAME + )} method execPostHook is not implemented.` + ); + } + /** + * get instance filed value. + * @param filedName - the instace filedName + * @returns filed value. + */ + public get(filedName: string) { + return filedName; + } +} diff --git a/test/data/plugins/errorMissAll.js b/test/data/plugins/errorMissAll.js new file mode 100644 index 00000000..413b0248 --- /dev/null +++ b/test/data/plugins/errorMissAll.js @@ -0,0 +1,6 @@ +class ErrorPlugin{ + static Version = "v1"; + static Name = "error-miss-all-plugin"; +} + +module.exports = ErrorPlugin; diff --git a/test/data/plugins/errorMissName.js b/test/data/plugins/errorMissName.js new file mode 100644 index 00000000..c1266036 --- /dev/null +++ b/test/data/plugins/errorMissName.js @@ -0,0 +1,22 @@ +class ErrorPlugin{ + static Version = "v1"; + // static Name = "error-plugin" + constructor(){ + console.log(`init error plugins`); + } + async execPreHook(ctx){ + console.log(`-----------error plugin pre hook-----------`); + } + execPostHook(ctx){ + console.log(`-----------error plugin post hook-----------`); + } + get(filedName){ + for(let key in this){ + if(key === filedName){ + return this[key]; + } + } + } +} + +module.exports = {ErrorPlugin}; diff --git a/test/data/plugins/errorMissVersion.js b/test/data/plugins/errorMissVersion.js new file mode 100644 index 00000000..aaf3087c --- /dev/null +++ b/test/data/plugins/errorMissVersion.js @@ -0,0 +1,22 @@ +class ErrorPlugin{ + // static Version = "v1" + static Name = "error-miss-version-plugin" + constructor(){ + console.log(`init error plugins`); + } + async execPreHook(ctx){ + console.log(`-----------error plugin pre hook-----------`); + } + execPostHook(ctx){ + console.log(`-----------error plugin post hook-----------`); + } + get(filedName){ + for(let key in this){ + if(key === filedName){ + return this[key]; + } + } + } +} + +module.exports = {ErrorPlugin}; diff --git a/test/data/plugins/plugindemo.js b/test/data/plugins/plugindemo.js new file mode 100644 index 00000000..6fd4ea12 --- /dev/null +++ b/test/data/plugins/plugindemo.js @@ -0,0 +1,32 @@ +function sleep(){ + return new Promise(resolve => setTimeout(resolve,3000)); +} +class DemoPlugin{ + static Version = "v1"; + static Name = "demo-plugin"; + id = '666'; + constructor(){ + console.log(`init demo plugins`); + } + async execPreHook(ctx){ + console.log(`-----------demo plugin pre hook-----------`); + ctx['pre'] = 'pre-exec'; + await sleep(); + console.log(`-----------pre sleep 3----------`) + } + async execPostHook(ctx){ + console.log(`-----------demo plugin post hook-----------`); + ctx['post'] = 'post-exec'; + console.log(`-----------send post-----------`); + } + get(filedName){ + for(let key in this){ + if(key === filedName){ + return this[key]; + } + } + } +} + +// module.exports = {DemoPlugin}; +exports.DemoPlugin = DemoPlugin; diff --git a/test/data/test_data/async_plugin.ts b/test/data/test_data/async_plugin.ts new file mode 100644 index 00000000..c281a314 --- /dev/null +++ b/test/data/test_data/async_plugin.ts @@ -0,0 +1,111 @@ +import {OpenFunctionContext} from '../../../src/openfunction/function_context'; +import {FrameworkOptions} from '../../../src/options'; + +export const TEST_CONTEXT: OpenFunctionContext = { + name: 'test-context', + version: '1.0.0', + runtime: 'Async', + port: '8080', + inputs: { + cron: { + uri: 'cron_input', + componentName: 'binding-cron', + componentType: 'bindings.cron', + }, + mqtt_binding: { + uri: 'default', + componentName: 'binding-mqtt', + componentType: 'bindings.mqtt', + }, + mqtt_sub: { + uri: 'webup', + componentName: 'pubsub-mqtt', + componentType: 'pubsub.mqtt', + }, + }, + outputs: { + cron: { + uri: 'cron_output', + operation: 'delete', + componentName: 'binding-cron', + componentType: 'bindings.cron', + }, + localfs: { + uri: 'localstorage', + operation: 'create', + componentName: 'binding-localfs', + componentType: 'bindings.localstorage', + metadata: { + fileName: 'output-file.txt', + }, + }, + mqtt_pub: { + uri: 'webup_pub', + componentName: 'pubsub-mqtt', + componentType: 'pubsub.mqtt', + }, + }, +}; +export const TEST_PLUGIN_OPTIONS: FrameworkOptions = { + port: '', + target: '', + sourceLocation: process.cwd() + '/test/data', + signatureType: 'event', + printHelp: false, + context: { + name: 'test-context-plugin', + version: '1.0.0', + runtime: 'Async', + port: '8080', + inputs: { + cron: { + uri: 'cron_input', + componentName: 'binding-cron', + componentType: 'bindings.cron', + }, + mqtt_binding: { + uri: 'default', + componentName: 'binding-mqtt', + componentType: 'bindings.mqtt', + }, + mqtt_sub: { + uri: 'webup', + componentName: 'pubsub-mqtt', + componentType: 'pubsub.mqtt', + }, + }, + outputs: { + cron: { + uri: 'cron_output', + operation: 'delete', + componentName: 'binding-cron', + componentType: 'bindings.cron', + }, + localfs: { + uri: 'localstorage', + operation: 'create', + componentName: 'binding-localfs', + componentType: 'bindings.localstorage', + metadata: { + fileName: 'output-file.txt', + }, + }, + mqtt_pub: { + uri: 'webup_pub', + componentName: 'pubsub-mqtt', + componentType: 'pubsub.mqtt', + }, + }, + prePlugins: ['demo-plugin'], + postPlugins: ['demo-plugin'], + }, +}; +export const TEST_PAYLOAD = {data: 'hello world'}; +export const TEST_CLOUD_EVENT = { + specversion: '1.0', + id: 'test-1234-1234', + type: 'ce.openfunction', + source: 'https://github.com/OpenFunction/functions-framework-nodejs', + traceparent: '00-65088630f09e0a5359677a7429456db7-97f23477fb2bf5ec-01', + data: TEST_PAYLOAD, +}; diff --git a/test/integration/async_server.ts b/test/integration/async_server.ts index 23d5a4c2..e9cddd53 100644 --- a/test/integration/async_server.ts +++ b/test/integration/async_server.ts @@ -6,72 +6,20 @@ import {get, isEmpty} from 'lodash'; import * as shell from 'shelljs'; import * as MQTT from 'aedes'; -import {OpenFunctionContext} from '../../src/openfunction/function_context'; import getAysncServer from '../../src/openfunction/async_server'; -const TEST_CONTEXT: OpenFunctionContext = { - name: 'test-context', - version: '1.0.0', - runtime: 'Async', - port: '8080', - inputs: { - cron: { - uri: 'cron_input', - componentName: 'binding-cron', - componentType: 'bindings.cron', - }, - mqtt_binding: { - uri: 'default', - componentName: 'binding-mqtt', - componentType: 'bindings.mqtt', - }, - mqtt_sub: { - uri: 'webup', - componentName: 'pubsub-mqtt', - componentType: 'pubsub.mqtt', - }, - }, - outputs: { - cron: { - uri: 'cron_output', - operation: 'delete', - componentName: 'binding-cron', - componentType: 'bindings.cron', - }, - localfs: { - uri: 'localstorage', - operation: 'create', - componentName: 'binding-localfs', - componentType: 'bindings.localstorage', - metadata: { - fileName: 'output-file.txt', - }, - }, - mqtt_pub: { - uri: 'webup_pub', - componentName: 'pubsub-mqtt', - componentType: 'pubsub.mqtt', - }, - }, -}; - -const TEST_PAYLOAD = {data: 'hello world'}; -const TEST_CLOUD_EVENT = { - specversion: '1.0', - id: 'test-1234-1234', - type: 'ce.openfunction', - source: 'https://github.com/OpenFunction/functions-framework-nodejs', - traceparent: '00-65088630f09e0a5359677a7429456db7-97f23477fb2bf5ec-01', - data: TEST_PAYLOAD, -}; +import { + TEST_CLOUD_EVENT, + TEST_CONTEXT, + TEST_PAYLOAD, +} from '../data/test_data/async_plugin'; describe('OpenFunction - Async - Binding', () => { const APPID = 'async.dapr'; const broker = MQTT.Server(); - + const server = createServer(broker.handle); before(done => { // Start simple plain MQTT server via aedes - const server = createServer(broker.handle); server.listen(1883, () => { // Try to run Dapr sidecar and listen for the async server shell.exec( @@ -90,7 +38,7 @@ describe('OpenFunction - Async - Binding', () => { shell.exec(`dapr stop ${APPID}`, { silent: true, }); - + server.close(); broker.close(done); }); diff --git a/test/integration/async_server_plugin.ts b/test/integration/async_server_plugin.ts new file mode 100644 index 00000000..c7e228ea --- /dev/null +++ b/test/integration/async_server_plugin.ts @@ -0,0 +1,99 @@ +/* eslint-disable no-restricted-properties */ +import {deepStrictEqual, ifError} from 'assert'; +import {createServer} from 'net'; + +import {get, isEmpty} from 'lodash'; +import * as shell from 'shelljs'; +import * as MQTT from 'aedes'; + +import getAysncServer from '../../src/openfunction/async_server'; +import {getUserPlugins} from '../../src/loader'; +import assert = require('assert'); +import { + TEST_CLOUD_EVENT, + TEST_CONTEXT, + TEST_PAYLOAD, + TEST_PLUGIN_OPTIONS, +} from '../data/test_data/async_plugin'; + +describe('OpenFunction - Async - Binding with plugin', () => { + const APPID = 'async.dapr'; + const broker = MQTT.Server(); + const server = createServer(broker.handle); + + before(done => { + // Start simple plain MQTT server via aedes + server.listen(1883, () => { + // Try to run Dapr sidecar and listen for the async server + shell.exec( + `dapr run -H 3500 -G 50001 -p ${TEST_CONTEXT.port} -d ./test/data/components/async -a ${APPID} --log-level debug`, + { + silent: true, + async: true, + } + ); + done(); + }); + }); + + after(done => { + // Stop dapr sidecar process + shell.exec(`dapr stop ${APPID}`, { + silent: true, + }); + server.close(); + broker.close(done); + }); + + it('mqtt sub w/ pub output with demo plugin', done => { + const app = getAysncServer((ctx, data) => { + if (isEmpty(data)) return; + + const context: any = ctx as any; + assert(context['pre'] === 'pre-exec'); + context['pre'] = 'main-exec'; + + // Assert that user function receives correct data from input binding + deepStrictEqual(data, TEST_PAYLOAD); + console.log(data); + // Then forward received data to output channel + const output = 'mqtt_pub'; + broker.subscribe( + get(TEST_PLUGIN_OPTIONS.context!, `outputs.${output}.uri`), + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (packet, _) => { + const payload = JSON.parse(Buffer.from(packet.payload).toString()); + deepStrictEqual(payload.data, TEST_PAYLOAD); + app + .stop() + .then(() => { + assert(context['pre'] === 'main-exec'); + assert(context['post'] === 'post-exec'); + }) + .finally(done); + }, + () => { + ctx.send(TEST_PAYLOAD, output); + } + ); + }, TEST_PLUGIN_OPTIONS.context!); + + // First, we start the async server + app.start().then(async () => { + await getUserPlugins(TEST_PLUGIN_OPTIONS); + console.log(TEST_PLUGIN_OPTIONS); + // Then, we send a cloudevent format message to server + broker.publish( + { + cmd: 'publish', + topic: TEST_PLUGIN_OPTIONS.context!.inputs!.mqtt_sub.uri!, + payload: JSON.stringify(TEST_CLOUD_EVENT), + qos: 0, + retain: false, + dup: false, + }, + err => ifError(err) + ); + }); + }); +}); diff --git a/test/loader.ts b/test/loader.ts index 07b97d1e..35bc528c 100644 --- a/test/loader.ts +++ b/test/loader.ts @@ -18,6 +18,8 @@ import * as semver from 'semver'; import * as functions from '../src/functions'; import * as loader from '../src/loader'; import * as FunctionRegistry from '../src/function_registry'; +import {FrameworkOptions} from '../src/options'; +import {Plugin} from '../src'; describe('loading function', () => { interface TestData { @@ -131,3 +133,201 @@ describe('loading function', () => { assert.strictEqual(loadedFunction?.signatureType, 'cloudevent'); }); }); + +describe('loading plugins', () => { + interface ExceptData { + prePlugins: Array; + postPlugins: Array; + } + + interface TestData { + options: FrameworkOptions; + except: ExceptData; + } + const testData: TestData[] = [ + { + options: { + port: '8080', + target: 'helloWorld', + sourceLocation: process.cwd() + '/test/data', + signatureType: 'event', + printHelp: false, + context: { + name: 'demo', + version: '', + runtime: 'ASYNC', + prePlugins: ['demo-plugin'], + postPlugins: ['demo-plugin'], + }, + }, + except: { + prePlugins: ['demo-plugin'], + postPlugins: ['demo-plugin'], + }, + }, + { + options: { + port: '8080', + target: 'helloWorld', + sourceLocation: process.cwd() + '/test/data', + signatureType: 'event', + printHelp: false, + context: { + name: 'demo', + version: '', + runtime: 'ASYNC', + prePlugins: ['demo-plugin'], + postPlugins: [], + }, + }, + except: { + prePlugins: ['demo-plugin'], + postPlugins: [], + }, + }, + { + options: { + port: '8080', + target: 'helloWorld', + sourceLocation: process.cwd() + '/test/data', + signatureType: 'event', + printHelp: false, + context: { + name: 'demo', + version: '', + runtime: 'ASYNC', + prePlugins: [], + postPlugins: [], + }, + }, + except: { + prePlugins: [], + postPlugins: [], + }, + }, + { + options: { + port: '8080', + target: 'helloWorld', + sourceLocation: process.cwd() + '/test/data', + signatureType: 'event', + printHelp: false, + context: { + name: 'error', + version: '', + runtime: 'ASYNC', + prePlugins: ['error-plugin'], + postPlugins: ['error-plugin'], + }, + }, + except: { + prePlugins: [], + postPlugins: [], + }, + }, + { + options: { + port: '8080', + target: 'helloWorld', + sourceLocation: process.cwd() + '/test/data', + signatureType: 'event', + printHelp: false, + context: { + name: 'error', + version: '', + runtime: 'ASYNC', + prePlugins: ['error-miss-version-plugin', 'demo-plugin'], + postPlugins: ['error-miss-version-plugin'], + }, + }, + except: { + prePlugins: ['error-miss-version-plugin', 'demo-plugin'], + postPlugins: ['error-miss-version-plugin'], + }, + }, + ]; + + it('load exits plugins', async () => { + for (const test of testData) { + const options = await loader.getUserPlugins(test.options); + const current: ExceptData = { + prePlugins: [], + postPlugins: [], + }; + + options.context!.prePlugins!.forEach(item => { + assert(typeof item === 'object'); + assert(item.get(Plugin.OFN_PLUGIN_VERSION) === 'v1'); + current.prePlugins.push(item.get(Plugin.OFN_PLUGIN_NAME)); + }); + options.context!.postPlugins!.forEach(item => { + assert(typeof item === 'object'); + assert(item.get(Plugin.OFN_PLUGIN_VERSION) === 'v1'); + current.postPlugins.push(item.get(Plugin.OFN_PLUGIN_NAME)); + }); + + assert.deepStrictEqual(current, test.except); + } + }); + + const test: TestData = { + options: { + port: '8080', + target: 'helloWorld', + sourceLocation: process.cwd() + '/test/data', + signatureType: 'event', + printHelp: false, + context: { + name: 'error', + version: '', + runtime: 'ASYNC', + prePlugins: [''], + postPlugins: [''], + }, + }, + except: { + prePlugins: [''], + postPlugins: [''], + }, + }; + + function copyAndSet(name: string): TestData { + const data: TestData = JSON.parse(JSON.stringify(test)); + data.options.context!.prePlugins![0] = name; + data.options.context!.postPlugins![0] = name; + data.except.postPlugins[0] = name; + data.except.prePlugins[0] = name; + return data; + } + + it('user plugin miss all', async () => { + const data = copyAndSet('error-miss-all-plugin'); + const options = await loader.getUserPlugins(data.options); + assert(typeof options.context!.prePlugins![0] === 'object'); + assert( + options.context!.prePlugins![0].get(Plugin.OFN_PLUGIN_NAME) === + 'error-miss-all-plugin' + ); + assert(options.context!.prePlugins![0].execPreHook); + assert(options.context!.prePlugins![0].execPostHook); + }); + + it('load multi plugins ', async () => { + const data: FrameworkOptions = { + port: '8080', + target: 'helloWorld', + sourceLocation: process.cwd() + '/test/data', + signatureType: 'event', + printHelp: false, + context: { + name: 'demo', + version: '', + runtime: 'ASYNC', + prePlugins: ['demo-plugin', 'error-miss-all-plugin'], + postPlugins: ['demo-plugin', 'error-miss-all-plugin'], + }, + }; + assert.ok(await loader.getUserPlugins(data)); + console.log(data); + }); +}); diff --git a/test/options.ts b/test/options.ts index f7cf727a..ab7a5b84 100644 --- a/test/options.ts +++ b/test/options.ts @@ -125,6 +125,78 @@ describe('parseOptions', () => { printHelp: false, }, }, + { + name: 'respects all env vars', + cliOpts: ['bin/node', '/index.js'], + envVars: { + PORT: '1234', + FUNCTION_TARGET: 'helloWorld', + FUNCTION_SIGNATURE_TYPE: 'cloudevent', + FUNCTION_SOURCE: '/source', + FUNC_CONTEXT: + '{ "name": "foo", "version": "1.0.0", "runtime": "Knative" }', + }, + expectedOptions: { + port: '1234', + target: 'helloWorld', + sourceLocation: resolve('/source'), + signatureType: 'cloudevent', + context: {name: 'foo', version: '1.0.0', runtime: 'Knative'}, + printHelp: false, + }, + }, + { + name: 'respects all env vars with empty plugins', + cliOpts: ['bin/node', '/index.js'], + envVars: { + PORT: '1234', + FUNCTION_TARGET: 'helloWorld', + FUNCTION_SIGNATURE_TYPE: 'cloudevent', + FUNCTION_SOURCE: '/source', + FUNC_CONTEXT: + '{ "name": "foo", "version": "1.0.0", "runtime": "Knative", "prePlugins": [] , "postPlugins": []}', + }, + expectedOptions: { + port: '1234', + target: 'helloWorld', + sourceLocation: resolve('/source'), + signatureType: 'cloudevent', + context: { + name: 'foo', + version: '1.0.0', + runtime: 'Knative', + prePlugins: [], + postPlugins: [], + }, + printHelp: false, + }, + }, + { + name: 'respects all env vars with plugins', + cliOpts: ['bin/node', '/index.js'], + envVars: { + PORT: '1234', + FUNCTION_TARGET: 'helloWorld', + FUNCTION_SIGNATURE_TYPE: 'cloudevent', + FUNCTION_SOURCE: '/source', + FUNC_CONTEXT: + '{ "name": "foo", "version": "1.0.0", "runtime": "Knative", "prePlugins": ["test-plugin"] , "postPlugins": ["test-plugin"]}', + }, + expectedOptions: { + port: '1234', + target: 'helloWorld', + sourceLocation: resolve('/source'), + signatureType: 'cloudevent', + context: { + name: 'foo', + version: '1.0.0', + runtime: 'Knative', + prePlugins: ['test-plugin'], + postPlugins: ['test-plugin'], + }, + printHelp: false, + }, + }, ]; testData.forEach(testCase => { From 4392ebf5554dbd3be67b21a2772421a0ba534bac Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 4 Aug 2022 07:56:42 +0000 Subject: [PATCH 29/42] docs: update README.md [skip ci] --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 9dd366fc..4d641237 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # Functions Framework for Node.js + +[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) + [![npm version](https://img.shields.io/npm/v/@openfunction/functions-framework.svg)](https://www.npmjs.com/package/@openfunction/functions-framework) [![npm downloads](https://img.shields.io/npm/dm/@openfunction/functions-framework.svg)](https://npmcharts.com/compare/@openfunction/functions-framework?minimal=true) @@ -287,3 +290,23 @@ Contributions to this library are welcome and encouraged. See [CONTRIBUTING](CON [ff_node_unit_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Unit+CI" [ff_node_lint_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Lint%20CI/badge.svg [ff_node_lint_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Lint+CI" + +## Contributors ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + +

MachaYAD

💻
+ + + + + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file From b9881f79f4c1e840730846da6a894162add74f03 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 4 Aug 2022 07:56:43 +0000 Subject: [PATCH 30/42] docs: create .all-contributorsrc [skip ci] --- .all-contributorsrc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .all-contributorsrc diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 00000000..0d0f968d --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,24 @@ +{ + "files": [ + "README.md" + ], + "imageSize": 100, + "commit": false, + "contributors": [ + { + "login": "YADROOKIE", + "name": "MachaYAD", + "avatar_url": "https://avatars.githubusercontent.com/u/43526965?v=4", + "profile": "https://github.com/YADROOKIE", + "contributions": [ + "code" + ] + } + ], + "contributorsPerLine": 7, + "projectName": "functions-framework-nodejs", + "projectOwner": "OpenFunction", + "repoType": "github", + "repoHost": "https://github.com", + "skipCi": true +} From 3849597298098b246e5d24fdeca09ec01915bf4e Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sun, 21 Aug 2022 13:24:10 +0800 Subject: [PATCH 31/42] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20plugin?= =?UTF-8?q?=20system=20revolution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- docs/generated/api.json | 383 +++++++++++++++--- docs/generated/api.md | 22 +- package-lock.json | 133 +++--- package.json | 6 +- src/function_wrappers.ts | 18 +- src/functions.ts | 4 +- src/index.ts | 7 +- src/loader.ts | 240 ++++------- src/main.ts | 14 +- src/openfunction/async_server.ts | 32 +- .../{function_context.ts => context.ts} | 51 +-- src/openfunction/dapr_output_middleware.ts | 38 -- src/openfunction/decs.d.ts | 1 - src/openfunction/plugin.ts | 196 +++++++++ .../{function_runtime.ts => runtime.ts} | 63 ++- src/options.ts | 3 +- test/data/mock/context.ts | 69 ++++ test/data/mock/index.ts | 2 + test/data/mock/payload.ts | 19 + test/data/plugins/constants.mjs | 11 + test/data/plugins/counters.mjs | 65 +++ test/data/plugins/errorMissAll.js | 6 - test/data/plugins/errorMissName.js | 22 - test/data/plugins/errorMissVersion.js | 22 - test/data/plugins/noname.mjs | 7 + test/data/plugins/plugindemo.js | 32 -- test/data/test_data/async_plugin.ts | 111 ----- test/function_wrappers.ts | 2 +- test/integration/async_server.ts | 135 ++++-- test/integration/async_server_plugin.ts | 99 ----- test/integration/cloud_event.ts | 15 +- test/integration/http_binding.ts | 56 ++- test/loader.ts | 228 +---------- test/plugin.ts | 57 +++ 34 files changed, 1129 insertions(+), 1040 deletions(-) rename src/openfunction/{function_context.ts => context.ts} (69%) delete mode 100644 src/openfunction/dapr_output_middleware.ts delete mode 100644 src/openfunction/decs.d.ts create mode 100644 src/openfunction/plugin.ts rename src/openfunction/{function_runtime.ts => runtime.ts} (67%) create mode 100644 test/data/mock/context.ts create mode 100644 test/data/mock/index.ts create mode 100644 test/data/mock/payload.ts create mode 100644 test/data/plugins/constants.mjs create mode 100644 test/data/plugins/counters.mjs delete mode 100644 test/data/plugins/errorMissAll.js delete mode 100644 test/data/plugins/errorMissName.js delete mode 100644 test/data/plugins/errorMissVersion.js create mode 100644 test/data/plugins/noname.mjs delete mode 100644 test/data/plugins/plugindemo.js delete mode 100644 test/data/test_data/async_plugin.ts delete mode 100644 test/integration/async_server_plugin.ts create mode 100644 test/plugin.ts diff --git a/docs/generated/api.json b/docs/generated/api.json index 3180b5a5..d1902656 100644 --- a/docs/generated/api.json +++ b/docs/generated/api.json @@ -1,7 +1,7 @@ { "metadata": { "toolPackage": "@microsoft/api-extractor", - "toolVersion": "7.28.4", + "toolVersion": "7.29.3", "schemaVersion": 1009, "oldestForwardsCompatibleVersion": 1001, "tsdocConfig": { @@ -1487,7 +1487,7 @@ }, { "kind": "Content", - "text": "{}" + "text": "object" }, { "kind": "Content", @@ -1916,29 +1916,15 @@ { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#postPlugins:member", - "docComment": "/**\n * Optional post function exec plugins.\n */\n", + "docComment": "/**\n * Optional plugins to be executed after user function.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "postPlugins?: " }, - { - "kind": "Reference", - "text": "Array", - "canonicalReference": "!Array:interface" - }, { "kind": "Content", - "text": "" + "text": "string[]" }, { "kind": "Content", @@ -1951,35 +1937,21 @@ "name": "postPlugins", "propertyTypeTokenRange": { "startIndex": 1, - "endIndex": 5 + "endIndex": 2 } }, { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#prePlugins:member", - "docComment": "/**\n * Optional pre function exec plugins.\n */\n", + "docComment": "/**\n * Optional plugins to be executed before user function.\n */\n", "excerptTokens": [ { "kind": "Content", "text": "prePlugins?: " }, - { - "kind": "Reference", - "text": "Array", - "canonicalReference": "!Array:interface" - }, - { - "kind": "Content", - "text": "" + "text": "string[]" }, { "kind": "Content", @@ -1992,7 +1964,7 @@ "name": "prePlugins", "propertyTypeTokenRange": { "startIndex": 1, - "endIndex": 5 + "endIndex": 2 } }, { @@ -2174,6 +2146,88 @@ "isStatic": false, "isProtected": true }, + { + "kind": "Method", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime#getPlugin:member(1)", + "docComment": "/**\n * Get a plugin from the plugin store, or if it doesn't exist, get it from the built-in plugin store.\n *\n * @param name - The name of the plugin to get.\n *\n * @returns A plugin object\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getPlugin(name: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Reference", + "text": "Plugin", + "canonicalReference": "@openfunction/functions-framework!Plugin:class" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isStatic": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "isProtected": false, + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "name", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "isOptional": false + } + ], + "isOptional": false, + "name": "getPlugin" + }, + { + "kind": "Property", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime#locals:member", + "docComment": "/**\n * An object to hold local data. TODO: Clarify the usage of this property\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "readonly locals: " + }, + { + "kind": "Reference", + "text": "Record", + "canonicalReference": "!Record:type" + }, + { + "kind": "Content", + "text": "" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": true, + "isOptional": false, + "releaseTag": "Public", + "name": "locals", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 3 + }, + "isStatic": false, + "isProtected": false + }, { "kind": "Method", "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime.Parse:member(1)", @@ -2567,6 +2621,89 @@ }, "isStatic": false, "isProtected": true + }, + { + "kind": "Method", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime.WrapUserFunction:member(1)", + "docComment": "/**\n * It takes a user function and a context object, and returns a function that executes the user function with the context object, and executes all the pre and post hooks before and after the user function.\n *\n * @param userFunction - The function that you want to wrap.\n *\n * @param context - This is the context object that is passed to the user function.\n *\n * @returns A function that takes in data and returns a promise.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "static WrapUserFunction(userFunction: " + }, + { + "kind": "Reference", + "text": "OpenFunction", + "canonicalReference": "@openfunction/functions-framework!OpenFunction:interface" + }, + { + "kind": "Content", + "text": ", context: " + }, + { + "kind": "Reference", + "text": "OpenFunctionContext", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext:interface" + }, + { + "kind": "Content", + "text": " | " + }, + { + "kind": "Reference", + "text": "OpenFunctionRuntime", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime:class" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "(data: any) => " + }, + { + "kind": "Reference", + "text": "Promise", + "canonicalReference": "!Promise:interface" + }, + { + "kind": "Content", + "text": "" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isStatic": true, + "returnTypeTokenRange": { + "startIndex": 7, + "endIndex": 10 + }, + "releaseTag": "Public", + "isProtected": false, + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "userFunction", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "isOptional": false + }, + { + "parameterName": "context", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 6 + }, + "isOptional": false + } + ], + "isOptional": false, + "name": "WrapUserFunction" } ], "implementsTokenRanges": [] @@ -2574,7 +2711,7 @@ { "kind": "Class", "canonicalReference": "@openfunction/functions-framework!Plugin_2:class", - "docComment": "/**\n * The OpenFunction's plugin template.\n *\n * @public\n */\n", + "docComment": "/**\n * Defining an abstract class to represent Plugin.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", @@ -2585,20 +2722,94 @@ "name": "Plugin_2", "preserveMemberOrder": false, "members": [ + { + "kind": "Constructor", + "canonicalReference": "@openfunction/functions-framework!Plugin_2:constructor(1)", + "docComment": "/**\n * Constructor of the OpenFunction plugin.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "constructor(name: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", version?: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ");" + } + ], + "releaseTag": "Public", + "isProtected": false, + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "name", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "isOptional": false + }, + { + "parameterName": "version", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "isOptional": true + } + ] + }, { "kind": "Method", "canonicalReference": "@openfunction/functions-framework!Plugin_2#execPostHook:member(1)", - "docComment": "/**\n * post main function exec.\n *\n * @param ctx - The openfunction runtime .\n */\n", + "docComment": "/**\n * This function is called after the user function is executed.\n *\n * @param ctx - Object that contains information about the function that is being executed.\n *\n * @param plugins - The collection of loaded pre and post hook plugins.\n */\n", "excerptTokens": [ { "kind": "Content", - "text": "execPostHook(ctx?: " + "text": "execPostHook(ctx: " }, { "kind": "Reference", "text": "OpenFunctionRuntime", "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime:class" }, + { + "kind": "Content", + "text": " | null" + }, + { + "kind": "Content", + "text": ", plugins: " + }, + { + "kind": "Reference", + "text": "Record", + "canonicalReference": "!Record:type" + }, + { + "kind": "Content", + "text": "" + }, { "kind": "Content", "text": "): " @@ -2619,8 +2830,8 @@ ], "isStatic": false, "returnTypeTokenRange": { - "startIndex": 3, - "endIndex": 5 + "startIndex": 9, + "endIndex": 11 }, "releaseTag": "Public", "isProtected": false, @@ -2630,9 +2841,17 @@ "parameterName": "ctx", "parameterTypeTokenRange": { "startIndex": 1, - "endIndex": 2 + "endIndex": 3 }, - "isOptional": true + "isOptional": false + }, + { + "parameterName": "plugins", + "parameterTypeTokenRange": { + "startIndex": 4, + "endIndex": 8 + }, + "isOptional": false } ], "isOptional": false, @@ -2641,17 +2860,43 @@ { "kind": "Method", "canonicalReference": "@openfunction/functions-framework!Plugin_2#execPreHook:member(1)", - "docComment": "/**\n * pre main function exec.\n *\n * @param ctx - The openfunction runtime .\n */\n", + "docComment": "/**\n * This function is called before the user function is executed.\n *\n * @param ctx - Object that contains information about the function that is being executed.\n *\n * @param plugins - The collection of loaded pre and post hook plugins.\n */\n", "excerptTokens": [ { "kind": "Content", - "text": "execPreHook(ctx?: " + "text": "execPreHook(ctx: " }, { "kind": "Reference", "text": "OpenFunctionRuntime", "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime:class" }, + { + "kind": "Content", + "text": " | null" + }, + { + "kind": "Content", + "text": ", plugins: " + }, + { + "kind": "Reference", + "text": "Record", + "canonicalReference": "!Record:type" + }, + { + "kind": "Content", + "text": "" + }, { "kind": "Content", "text": "): " @@ -2672,8 +2917,8 @@ ], "isStatic": false, "returnTypeTokenRange": { - "startIndex": 3, - "endIndex": 5 + "startIndex": 9, + "endIndex": 11 }, "releaseTag": "Public", "isProtected": false, @@ -2683,9 +2928,17 @@ "parameterName": "ctx", "parameterTypeTokenRange": { "startIndex": 1, - "endIndex": 2 + "endIndex": 3 }, - "isOptional": true + "isOptional": false + }, + { + "parameterName": "plugins", + "parameterTypeTokenRange": { + "startIndex": 4, + "endIndex": 8 + }, + "isOptional": false } ], "isOptional": false, @@ -2694,11 +2947,11 @@ { "kind": "Method", "canonicalReference": "@openfunction/functions-framework!Plugin_2#get:member(1)", - "docComment": "/**\n * get instance filed value.\n *\n * @param filedName - the instace filedName\n *\n * @returns filed value.\n */\n", + "docComment": "/**\n * Get the value of a property on the plugin.\n *\n * @param prop - The property to get.\n *\n * @returns The value of the property.\n */\n", "excerptTokens": [ { "kind": "Content", - "text": "get(filedName: " + "text": "get(prop: " }, { "kind": "Content", @@ -2710,7 +2963,7 @@ }, { "kind": "Content", - "text": "string" + "text": "any" }, { "kind": "Content", @@ -2727,7 +2980,7 @@ "overloadIndex": 1, "parameters": [ { - "parameterName": "filedName", + "parameterName": "prop", "parameterTypeTokenRange": { "startIndex": 1, "endIndex": 2 @@ -2740,12 +2993,12 @@ }, { "kind": "Property", - "canonicalReference": "@openfunction/functions-framework!Plugin_2.OFN_PLUGIN_NAME:member", - "docComment": "", + "canonicalReference": "@openfunction/functions-framework!Plugin_2#name:member", + "docComment": "/**\n * Name of the plugin.\n */\n", "excerptTokens": [ { "kind": "Content", - "text": "static OFN_PLUGIN_NAME: " + "text": "readonly name: " }, { "kind": "Content", @@ -2756,25 +3009,25 @@ "text": ";" } ], - "isReadonly": false, + "isReadonly": true, "isOptional": false, "releaseTag": "Public", - "name": "OFN_PLUGIN_NAME", + "name": "name", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 }, - "isStatic": true, + "isStatic": false, "isProtected": false }, { "kind": "Property", - "canonicalReference": "@openfunction/functions-framework!Plugin_2.OFN_PLUGIN_VERSION:member", - "docComment": "", + "canonicalReference": "@openfunction/functions-framework!Plugin_2#version:member", + "docComment": "/**\n * Version of the plugin.\n */\n", "excerptTokens": [ { "kind": "Content", - "text": "static OFN_PLUGIN_VERSION: " + "text": "readonly version: " }, { "kind": "Content", @@ -2785,15 +3038,15 @@ "text": ";" } ], - "isReadonly": false, + "isReadonly": true, "isOptional": false, "releaseTag": "Public", - "name": "OFN_PLUGIN_VERSION", + "name": "version", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 }, - "isStatic": true, + "isStatic": false, "isProtected": false } ], diff --git a/docs/generated/api.md b/docs/generated/api.md index e084c92b..864c4d34 100644 --- a/docs/generated/api.md +++ b/docs/generated/api.md @@ -110,7 +110,7 @@ export interface LegacyEvent { // @public export interface OpenFunction { // (undocumented) - (ctx: OpenFunctionRuntime, data: {}): any; + (ctx: OpenFunctionRuntime, data: object): any; } // @public @@ -136,8 +136,8 @@ export interface OpenFunctionContext { name: string; outputs?: OpenFunctionBinding; port?: string; - postPlugins?: Array; - prePlugins?: Array; + postPlugins?: string[]; + prePlugins?: string[]; runtime: `${RuntimeType}` | `${Capitalize}` | `${Uppercase}`; version: string; } @@ -146,6 +146,8 @@ export interface OpenFunctionContext { export abstract class OpenFunctionRuntime { constructor(context: OpenFunctionContext); protected readonly context: OpenFunctionContext; + getPlugin(name: string): Plugin_2; + readonly locals: Record; static Parse(context: OpenFunctionContext): OpenFunctionRuntime; static ProxyContext(context: OpenFunctionContext): OpenFunctionRuntime; get req(): Request_3> | undefined; @@ -158,17 +160,17 @@ export abstract class OpenFunctionRuntime { }; // Warning: (ae-forgotten-export) The symbol "OpenFunctionTrigger" needs to be exported by the entry point index.d.ts protected trigger?: OpenFunctionTrigger; + static WrapUserFunction(userFunction: OpenFunction, context: OpenFunctionContext | OpenFunctionRuntime): (data: any) => Promise; } // @public class Plugin_2 { - execPostHook(ctx?: OpenFunctionRuntime): Promise; - execPreHook(ctx?: OpenFunctionRuntime): Promise; - get(filedName: string): string; - // (undocumented) - static OFN_PLUGIN_NAME: string; - // (undocumented) - static OFN_PLUGIN_VERSION: string; + constructor(name: string, version?: string); + execPostHook(ctx: OpenFunctionRuntime | null, plugins: Record): Promise; + execPreHook(ctx: OpenFunctionRuntime | null, plugins: Record): Promise; + get(prop: string): any; + readonly name: string; + readonly version: string; } export { Plugin_2 as Plugin } diff --git a/package-lock.json b/package-lock.json index f3d638ce..81916e75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,18 +27,18 @@ "functions-framework-nodejs": "build/src/main.js" }, "devDependencies": { - "@microsoft/api-extractor": "^7.28.4", + "@microsoft/api-extractor": "^7.29.3", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", "@types/express": "4.17.13", "@types/google-protobuf": "^3.15.6", - "@types/lodash": "^4.14.182", + "@types/lodash": "^4.14.184", "@types/minimist": "1.2.2", "@types/mocha": "9.1.1", "@types/node": "14.18.11", "@types/node-fetch": "^2.6.2", "@types/on-finished": "2.3.1", - "@types/semver": "^7.3.10", + "@types/semver": "^7.3.12", "@types/shelljs": "^0.8.11", "@types/sinon": "10.0.11", "@types/supertest": "2.0.12", @@ -219,37 +219,37 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@microsoft/api-extractor": { - "version": "7.28.4", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.28.4.tgz", - "integrity": "sha512-7JeROBGYTUt4/4HPnpMscsQgLzX0OfGTQR2qOQzzh3kdkMyxmiv2mzpuhoMnwbubb1GvPcyFm+NguoqOqkCVaw==", + "version": "7.29.3", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.29.3.tgz", + "integrity": "sha512-PHq+Oo8yiXhwi11VQ1Nz36s+aZwgFqjtkd41udWHtSpyMv2slJ74m1cHdpWbs2ovGUCfldayzdpGwnexZLd2bA==", "dev": true, "dependencies": { - "@microsoft/api-extractor-model": "7.21.0", + "@microsoft/api-extractor-model": "7.23.1", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.49.0", - "@rushstack/rig-package": "0.3.13", - "@rushstack/ts-command-line": "4.12.1", + "@rushstack/node-core-library": "3.50.2", + "@rushstack/rig-package": "0.3.14", + "@rushstack/ts-command-line": "4.12.2", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", "semver": "~7.3.0", "source-map": "~0.6.1", - "typescript": "~4.6.3" + "typescript": "~4.7.4" }, "bin": { "api-extractor": "bin/api-extractor" } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.21.0", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.21.0.tgz", - "integrity": "sha512-NN4mXzoQWTuzznIcnLWeV6tGyn6Os9frDK6M/mmTXZ73vUYOvSWoKQ5SYzyzP7HF3YtvTmr1Rs+DsBb0HRx7WQ==", + "version": "7.23.1", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.23.1.tgz", + "integrity": "sha512-axlZ33H2LfYX7goAaWpzABWZl3JtX/EUkfVBsI4SuMn3AZYBJsP5MVpMCq7jt0PCefWGwwO+Rv+lCmmJIjFhlQ==", "dev": true, "dependencies": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.49.0" + "@rushstack/node-core-library": "3.50.2" } }, "node_modules/@microsoft/api-extractor/node_modules/resolve": { @@ -261,19 +261,6 @@ "path-parse": "^1.0.6" } }, - "node_modules/@microsoft/api-extractor/node_modules/typescript": { - "version": "4.6.4", - "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.6.4.tgz", - "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/@microsoft/tsdoc": { "version": "0.14.1", "resolved": "https://registry.npmmirror.com/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz", @@ -392,9 +379,9 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "node_modules/@rushstack/node-core-library": { - "version": "3.49.0", - "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.49.0.tgz", - "integrity": "sha512-yBJRzGgUNFwulVrwwBARhbGaHsxVMjsZ9JwU1uSBbqPYCdac+t2HYdzi4f4q/Zpgb0eNbwYj2yxgHYpJORNEaw==", + "version": "3.50.2", + "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.50.2.tgz", + "integrity": "sha512-+zpZBcaX5s+wA0avF0Lk3sd5jbGRo5SmsEJpElJbqQd3KGFvc/hcyeNSMqV5+esJ1JuTfnE1QyRt8nvxFNTaQg==", "dev": true, "dependencies": { "@types/node": "12.20.24", @@ -424,9 +411,9 @@ } }, "node_modules/@rushstack/rig-package": { - "version": "0.3.13", - "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.13.tgz", - "integrity": "sha512-4/2+yyA/uDl7LQvtYtFs1AkhSWuaIGEKhP9/KK2nNARqOVc5eCXmu1vyOqr5mPvNq7sHoIR+sG84vFbaKYGaDA==", + "version": "0.3.14", + "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.14.tgz", + "integrity": "sha512-Ic9EN3kWJCK6iOxEDtwED9nrM146zCDrQaUxbeGOF+q/VLZ/HNHPw+aLqrqmTl0ZT66Sf75Qk6OG+rySjTorvQ==", "dev": true, "dependencies": { "resolve": "~1.17.0", @@ -443,9 +430,9 @@ } }, "node_modules/@rushstack/ts-command-line": { - "version": "4.12.1", - "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.1.tgz", - "integrity": "sha512-S1Nev6h/kNnamhHeGdp30WgxZTA+B76SJ/P721ctP7DrnC+rrjAc6h/R80I4V0cA2QuEEcMdVOQCtK2BTjsOiQ==", + "version": "4.12.2", + "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.2.tgz", + "integrity": "sha512-poBtnumLuWmwmhCEkVAgynWgtnF9Kygekxyp4qtQUSbBrkuyPQTL85c8Cva1YfoUpOdOXxezMAkUt0n5SNKGqw==", "dev": true, "dependencies": { "@types/argparse": "1.0.38", @@ -617,9 +604,9 @@ "dev": true }, "node_modules/@types/lodash": { - "version": "4.14.182", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz", - "integrity": "sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==", + "version": "4.14.184", + "resolved": "https://registry.npmmirror.com/@types/lodash/-/lodash-4.14.184.tgz", + "integrity": "sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q==", "dev": true }, "node_modules/@types/long": { @@ -713,9 +700,9 @@ "dev": true }, "node_modules/@types/semver": { - "version": "7.3.10", - "resolved": "https://registry.npmmirror.com/@types/semver/-/semver-7.3.10.tgz", - "integrity": "sha512-zsv3fsC7S84NN6nPK06u79oWgrPVd0NvOyqgghV1haPaFcVxIrP4DLomRwGAXk0ui4HZA7mOcSFL98sMVW9viw==", + "version": "7.3.12", + "resolved": "https://registry.npmmirror.com/@types/semver/-/semver-7.3.12.tgz", + "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==", "dev": true }, "node_modules/@types/serve-static": { @@ -7800,23 +7787,23 @@ } }, "@microsoft/api-extractor": { - "version": "7.28.4", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.28.4.tgz", - "integrity": "sha512-7JeROBGYTUt4/4HPnpMscsQgLzX0OfGTQR2qOQzzh3kdkMyxmiv2mzpuhoMnwbubb1GvPcyFm+NguoqOqkCVaw==", + "version": "7.29.3", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.29.3.tgz", + "integrity": "sha512-PHq+Oo8yiXhwi11VQ1Nz36s+aZwgFqjtkd41udWHtSpyMv2slJ74m1cHdpWbs2ovGUCfldayzdpGwnexZLd2bA==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.21.0", + "@microsoft/api-extractor-model": "7.23.1", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.49.0", - "@rushstack/rig-package": "0.3.13", - "@rushstack/ts-command-line": "4.12.1", + "@rushstack/node-core-library": "3.50.2", + "@rushstack/rig-package": "0.3.14", + "@rushstack/ts-command-line": "4.12.2", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", "semver": "~7.3.0", "source-map": "~0.6.1", - "typescript": "~4.6.3" + "typescript": "~4.7.4" }, "dependencies": { "resolve": { @@ -7827,24 +7814,18 @@ "requires": { "path-parse": "^1.0.6" } - }, - "typescript": { - "version": "4.6.4", - "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.6.4.tgz", - "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", - "dev": true } } }, "@microsoft/api-extractor-model": { - "version": "7.21.0", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.21.0.tgz", - "integrity": "sha512-NN4mXzoQWTuzznIcnLWeV6tGyn6Os9frDK6M/mmTXZ73vUYOvSWoKQ5SYzyzP7HF3YtvTmr1Rs+DsBb0HRx7WQ==", + "version": "7.23.1", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.23.1.tgz", + "integrity": "sha512-axlZ33H2LfYX7goAaWpzABWZl3JtX/EUkfVBsI4SuMn3AZYBJsP5MVpMCq7jt0PCefWGwwO+Rv+lCmmJIjFhlQ==", "dev": true, "requires": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.49.0" + "@rushstack/node-core-library": "3.50.2" } }, "@microsoft/tsdoc": { @@ -7958,9 +7939,9 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "@rushstack/node-core-library": { - "version": "3.49.0", - "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.49.0.tgz", - "integrity": "sha512-yBJRzGgUNFwulVrwwBARhbGaHsxVMjsZ9JwU1uSBbqPYCdac+t2HYdzi4f4q/Zpgb0eNbwYj2yxgHYpJORNEaw==", + "version": "3.50.2", + "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.50.2.tgz", + "integrity": "sha512-+zpZBcaX5s+wA0avF0Lk3sd5jbGRo5SmsEJpElJbqQd3KGFvc/hcyeNSMqV5+esJ1JuTfnE1QyRt8nvxFNTaQg==", "dev": true, "requires": { "@types/node": "12.20.24", @@ -7992,9 +7973,9 @@ } }, "@rushstack/rig-package": { - "version": "0.3.13", - "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.13.tgz", - "integrity": "sha512-4/2+yyA/uDl7LQvtYtFs1AkhSWuaIGEKhP9/KK2nNARqOVc5eCXmu1vyOqr5mPvNq7sHoIR+sG84vFbaKYGaDA==", + "version": "0.3.14", + "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.14.tgz", + "integrity": "sha512-Ic9EN3kWJCK6iOxEDtwED9nrM146zCDrQaUxbeGOF+q/VLZ/HNHPw+aLqrqmTl0ZT66Sf75Qk6OG+rySjTorvQ==", "dev": true, "requires": { "resolve": "~1.17.0", @@ -8013,9 +7994,9 @@ } }, "@rushstack/ts-command-line": { - "version": "4.12.1", - "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.1.tgz", - "integrity": "sha512-S1Nev6h/kNnamhHeGdp30WgxZTA+B76SJ/P721ctP7DrnC+rrjAc6h/R80I4V0cA2QuEEcMdVOQCtK2BTjsOiQ==", + "version": "4.12.2", + "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.2.tgz", + "integrity": "sha512-poBtnumLuWmwmhCEkVAgynWgtnF9Kygekxyp4qtQUSbBrkuyPQTL85c8Cva1YfoUpOdOXxezMAkUt0n5SNKGqw==", "dev": true, "requires": { "@types/argparse": "1.0.38", @@ -8181,9 +8162,9 @@ "dev": true }, "@types/lodash": { - "version": "4.14.182", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz", - "integrity": "sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==", + "version": "4.14.184", + "resolved": "https://registry.npmmirror.com/@types/lodash/-/lodash-4.14.184.tgz", + "integrity": "sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q==", "dev": true }, "@types/long": { @@ -8276,9 +8257,9 @@ "dev": true }, "@types/semver": { - "version": "7.3.10", - "resolved": "https://registry.npmmirror.com/@types/semver/-/semver-7.3.10.tgz", - "integrity": "sha512-zsv3fsC7S84NN6nPK06u79oWgrPVd0NvOyqgghV1haPaFcVxIrP4DLomRwGAXk0ui4HZA7mOcSFL98sMVW9viw==", + "version": "7.3.12", + "resolved": "https://registry.npmmirror.com/@types/semver/-/semver-7.3.12.tgz", + "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==", "dev": true }, "@types/serve-static": { diff --git a/package.json b/package.json index fb193a45..26e61e43 100644 --- a/package.json +++ b/package.json @@ -53,18 +53,18 @@ "author": "OpenFunction", "license": "Apache-2.0", "devDependencies": { - "@microsoft/api-extractor": "^7.28.4", + "@microsoft/api-extractor": "^7.29.3", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", "@types/express": "4.17.13", "@types/google-protobuf": "^3.15.6", - "@types/lodash": "^4.14.182", + "@types/lodash": "^4.14.184", "@types/minimist": "1.2.2", "@types/mocha": "9.1.1", "@types/node": "14.18.11", "@types/node-fetch": "^2.6.2", "@types/on-finished": "2.3.1", - "@types/semver": "^7.3.10", + "@types/semver": "^7.3.12", "@types/shelljs": "^0.8.11", "@types/sinon": "10.0.11", "@types/supertest": "2.0.12", diff --git a/src/function_wrappers.ts b/src/function_wrappers.ts index 33e05c08..b2772d34 100644 --- a/src/function_wrappers.ts +++ b/src/function_wrappers.ts @@ -16,6 +16,10 @@ import * as domain from 'domain'; import {Request, Response, RequestHandler} from 'express'; + +import {OpenFunctionContext} from './openfunction/context'; +import {OpenFunctionRuntime} from './openfunction/runtime'; + import {sendCrashResponse} from './logger'; import {sendResponse} from './invoker'; import {isBinaryCloudEvent, getBinaryCloudEventContext} from './cloud_events'; @@ -31,9 +35,6 @@ import { import {CloudEvent, OpenFunction} from './functions'; import {SignatureType} from './types'; -import {OpenFunctionContext} from './openfunction/function_context'; -import {OpenFunctionRuntime} from './openfunction/function_runtime'; - /** * The handler function used to signal completion of event functions. */ @@ -126,18 +127,25 @@ const wrapHttpFunction = (execute: HttpFunction): RequestHandler => { }; }; +/** + * It takes a user-defined function and a context object, and returns a function that can be used as an HTTP handler. + * @param userFunction - The function that you wrote in your index.js file. + * @param context - OpenFunctionContext object which hold all context data. + * @returns A function that takes a request and a response and returns a promise. + */ const wrapOpenFunction = ( userFunction: OpenFunction, context: OpenFunctionContext ): RequestHandler => { const ctx = OpenFunctionRuntime.ProxyContext(context); + const wrapper = OpenFunctionRuntime.WrapUserFunction(userFunction, ctx); const httpHandler = (req: Request, res: Response) => { const callback = getOnDoneCallback(res); ctx.setTrigger(req, res); - Promise.resolve() - .then(() => userFunction(ctx, req.body)) + Promise.resolve(req.body) + .then(wrapper) .then(result => callback(null, result)) .catch(err => callback(err, undefined)); }; diff --git a/src/functions.ts b/src/functions.ts index cc3cba1f..eb1cb049 100644 --- a/src/functions.ts +++ b/src/functions.ts @@ -19,7 +19,7 @@ import {Request as ExpressRequest, Response} from 'express'; import {CloudEventV1 as CloudEvent} from 'cloudevents'; -import {OpenFunctionRuntime} from './openfunction/function_runtime'; +import {OpenFunctionRuntime} from './openfunction/runtime'; /** * @public @@ -82,7 +82,7 @@ export interface CloudEventFunctionWithCallback { * @public */ export interface OpenFunction { - (ctx: OpenFunctionRuntime, data: {}): any; + (ctx: OpenFunctionRuntime, data: object): any; } /** diff --git a/src/index.ts b/src/index.ts index 673a5d5e..88198b8e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,4 +25,9 @@ export {http, cloudEvent, openfunction} from './function_registry'; /** * @public */ -export * from './openfunction/function_context'; +export * from './openfunction/context'; + +/** + * @public + */ +export {Plugin} from './openfunction/plugin'; diff --git a/src/loader.ts b/src/loader.ts index 5e943c5f..c77f687d 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -18,18 +18,20 @@ * @packageDocumentation */ +import * as fs from 'fs'; import * as path from 'path'; +import {pathToFileURL} from 'url'; + import * as semver from 'semver'; import * as readPkgUp from 'read-pkg-up'; -import * as fs from 'fs'; -import {pathToFileURL} from 'url'; -import {HandlerFunction, OpenFunctionRuntime} from './functions'; -import {SignatureType} from './types'; -import {getRegisteredFunction} from './function_registry'; -import {Plugin} from './openfunction/function_context'; -import {FrameworkOptions} from './options'; import {forEach} from 'lodash'; +import {Plugin, PluginStore, PluginMap} from './openfunction/plugin'; + +import {HandlerFunction} from './functions'; +import {getRegisteredFunction} from './function_registry'; +import {SignatureType} from './types'; + // Dynamic import function required to load user code packaged as an // ES module is only available on Node.js v13.2.0 and up. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#browser_compatibility @@ -81,6 +83,28 @@ const dynamicImport = new Function( // eslint-disable-next-line @typescript-eslint/no-explicit-any ) as (modulePath: string) => Promise; +async function loadModule(modulePath: string) { + let module; + + const esModule = await isEsModule(modulePath); + if (esModule) { + if (semver.lt(process.version, MIN_NODE_VERSION_ESMODULES)) { + console.error( + `Cannot load ES Module on Node.js ${process.version}. ` + + `Please upgrade to Node.js v${MIN_NODE_VERSION_ESMODULES} and up.` + ); + return null; + } + // Resolve module path to file:// URL. Required for windows support. + const fpath = pathToFileURL(modulePath); + module = await dynamicImport(fpath.href); + } else { + module = require(modulePath); + } + + return module; +} + /** * Returns user's function from function file. * Returns null if function can't be retrieved. @@ -102,25 +126,10 @@ export async function getUserFunction( return null; } - let functionModule; - const esModule = await isEsModule(functionModulePath); - if (esModule) { - if (semver.lt(process.version, MIN_NODE_VERSION_ESMODULES)) { - console.error( - `Cannot load ES Module on Node.js ${process.version}. ` + - `Please upgrade to Node.js v${MIN_NODE_VERSION_ESMODULES} and up.` - ); - return null; - } - // Resolve module path to file:// URL. Required for windows support. - const fpath = pathToFileURL(functionModulePath); - functionModule = await dynamicImport(fpath.href); - } else { - functionModule = require(functionModulePath); - } + // Firstly, we try to load function + const functionModule = await loadModule(functionModulePath); - // If the customer declaratively registered a function matching the target - // return that. + // If the customer declaratively registered a function matching the target return that const registeredFunction = getRegisteredFunction(functionTarget); if (registeredFunction) { return registeredFunction; @@ -199,170 +208,67 @@ function getFunctionModulePath(codeLocation: string): string | null { return path; } -type PluginClass = Record; /** - * Returns user's plugin from function file. - * Returns null if plugin can't be retrieved. - * @return User's plugins or null. + * It loads all the plugins from the provided code location. + * @param codeLocation - The path to the plugin source codes. + * @return A named plugin map object or null. */ -export async function getUserPlugins( - options: FrameworkOptions -): Promise { - // Get plugin set - const pluginSet: Set = new Set(); - if (options.context) { - if (options.context.prePlugins) { - forEach(options.context.prePlugins, plugin => { - typeof plugin === 'string' && pluginSet.add(plugin); - }); - } - if (options.context.postPlugins) { - forEach(options.context.postPlugins, plugin => { - typeof plugin === 'string' && pluginSet.add(plugin); - }); - } - - try { - type Instance = Record; - // Load plugin js files - const instances: Instance = {}; +export async function getFunctionPlugins( + codeLocation: string +): Promise { + const files = getPluginsModulePath(codeLocation); + if (!files) return null; - const pluginFiles = getPluginFiles(options.sourceLocation); - if (pluginFiles === null) { - console.warn('[warn-!!!] user plugins files load failed '); - options.context.prePlugins = []; - options.context.postPlugins = []; - return options; - } + // Try to load all plugin module files - // Find plugins class - const tempMap: PluginClass = {}; - for (const pluginFile of pluginFiles) { - const jsMoulde = require(pluginFile); - processJsModule(jsMoulde, tempMap); - } + const store = PluginStore.Instance(); + const plugins: PluginMap = {}; - // Instance plugin dynamic set ofn_plugin_name - const pluginNames = Array.from(pluginSet.values()); - for (const name of pluginNames) { - const module = tempMap[name]; - if (module) { - const instance = new module(); - instance[Plugin.OFN_PLUGIN_NAME] = module.Name; - instance[Plugin.OFN_PLUGIN_VERSION] = module.Version || 'v1'; + for (const file of files) { + try { + const modules = await loadModule(file); - //Set default method of pre post get - if (!instance.execPreHook) { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - instance.execPreHook = (ctx: OpenFunctionRuntime) => { - console.log( - `This plugin ${name} method execPreHook is not implemented.` - ); - }; - } - if (!instance.execPostHook) { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - instance.execPostHook = (ctx: OpenFunctionRuntime) => { - console.log( - `This plugin ${name} method execPostHook is not implemented.` - ); - }; - } - if (!instance.get) { - instance.get = (filedName: string) => { - for (const key in instance) { - if (key === filedName) { - return instance[key]; - } - } - }; - } - instances[name] = instance as Plugin; + forEach(modules, module => { + // All plugin modules should extend from Plugin abstract class + if (module.prototype instanceof Plugin) { + // Try to create plugin instance + const plugin = new module(); + // Register plugin instance to plugin store + store.register(plugin); + // Also save to return records + plugins[plugin.name] = plugin; } - } - - const prePlugins: Array = []; - const postPlugins: Array = []; - if (options.context.prePlugins) { - forEach(options.context.prePlugins, plugin => { - if (typeof plugin === 'string') { - const instance = instances[plugin]; - typeof instance === 'object' && prePlugins.push(instance); - } - }); - } - if (options.context.postPlugins) { - forEach(options.context.postPlugins, plugin => { - if (typeof plugin === 'string') { - const instance = instances[plugin]; - typeof instance === 'object' && postPlugins.push(instance); - } - }); - } - - options.context.prePlugins = prePlugins; - options.context.postPlugins = postPlugins; - } catch (error) { - console.error('load plugins error reason: \n'); - console.error(error); + }); + } catch (ex) { + const err = ex; + console.error( + "Provided module can't be loaded. Plesae make sure your module extend Plugin class properly." + + `\nDetailed stack trace: ${err.stack}` + ); } } - return options; + + return plugins; } /** - * Returns resolved path to the dir containing the user plugins. - * Returns null if the path is not exits + * Returns resolved path of the folder containing the user plugins. + * Returns null if the plugin folder does not exist. * @param codeLocation Directory with user's code. - * @return Resolved path or null. + * @return Resolved path of plugins or null. */ -function getPluginFiles(codeLocation: string): Array | null { - const pluginFiles: Array = []; +function getPluginsModulePath(codeLocation: string): string[] | null { try { const param = path.resolve(codeLocation + '/plugins'); const files = fs.readdirSync(param); + const pluginFiles: string[] = []; for (const file of files) { pluginFiles.push(require.resolve(path.join(param, file))); } + return pluginFiles; } catch (ex) { - const err: Error = ex; - console.error(err.message); + console.error('Fail to load plugins: %s', ex); return null; } - return pluginFiles; -} -/** - * Returns rdetermine whether it is a class. - * Returns boolean is can be class - * @param obj jsmodule. - * @return boolean of it is a class. - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function couldBeClass(obj: any): boolean { - return ( - typeof obj === 'function' && - obj.prototype !== undefined && - obj.prototype.constructor === obj && - obj.toString().slice(0, 5) === 'class' - ); -} - -/** - * Process jsMoulde if it can be a plugin class put it into tempMap. - * @param obj jsmodule. - * @param tempMap PluginClass. - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function processJsModule(obj: any, tempMap: PluginClass) { - if (typeof obj === 'object') { - for (const o in obj) { - if (couldBeClass(obj[o]) && obj[o].Name) { - tempMap[obj[o].Name] = obj[o]; - } - } - } - if (couldBeClass(obj) && obj.Name) { - tempMap[obj.Name] = obj; - } } diff --git a/src/main.ts b/src/main.ts index 3cc5f864..0833bdf9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -21,12 +21,9 @@ import * as process from 'process'; import {createHttpTerminator} from 'http-terminator'; import getAysncServer from './openfunction/async_server'; -import { - OpenFunctionContext, - ContextUtils, -} from './openfunction/function_context'; +import {OpenFunctionContext, ContextUtils} from './openfunction/context'; -import {getUserFunction, getUserPlugins} from './loader'; +import {getUserFunction, getFunctionPlugins} from './loader'; import {ErrorHandler} from './invoker'; import {getServer} from './server'; import {parseOptions, helpText, OptionsError} from './options'; @@ -44,6 +41,7 @@ export const main = async () => { console.error(helpText); return; } + const loadedFunction = await getUserFunction( options.sourceLocation, options.target, @@ -56,6 +54,9 @@ export const main = async () => { } const {userFunction, signatureType} = loadedFunction; + // Load function plugins before starting server + await getFunctionPlugins(options.sourceLocation); + // Try to determine the server runtime // Considering the async runtime in the first place if (ContextUtils.IsAsyncRuntime(options.context as OpenFunctionContext)) { @@ -69,9 +70,6 @@ export const main = async () => { // DaprServer uses httpTerminator in server.stop() handleShutdown(async () => await server.stop()); - - // Load Plugins - await getUserPlugins(options); } // Then taking sync runtime as the fallback else { diff --git a/src/openfunction/async_server.ts b/src/openfunction/async_server.ts index 6107f24e..2241010e 100644 --- a/src/openfunction/async_server.ts +++ b/src/openfunction/async_server.ts @@ -1,10 +1,10 @@ -import {forEach, invoke} from 'lodash'; +import {forEach} from 'lodash'; import {DaprServer} from '@dapr/dapr'; import {OpenFunction} from '../functions'; -import {OpenFunctionContext, ContextUtils} from './function_context'; -import {OpenFunctionRuntime} from './function_runtime'; +import {OpenFunctionContext, ContextUtils} from './context'; +import {OpenFunctionRuntime} from './runtime'; export type AsyncFunctionServer = DaprServer; @@ -12,36 +12,18 @@ export type AsyncFunctionServer = DaprServer; * Creates and configures an Dapr server and returns an HTTP server * which will run it. * @param userFunction User's function. - * @param functionSignatureType Type of user's function signature. + * @param context Context of user's function. * @return HTTP server. */ export default function ( userFunction: OpenFunction, context: OpenFunctionContext ): AsyncFunctionServer { + // Initailize Dapr server const app = new DaprServer('localhost', context.port); - const ctx = OpenFunctionRuntime.ProxyContext(context); - - const wrapper = async (data: object) => { - // Exec pre hooks - console.log(context.prePlugins); - if (context.prePlugins) { - await context.prePlugins.reduce(async (_, current) => { - await invoke(current, 'execPreHook', ctx); - return []; - }, Promise.resolve([])); - } - - await userFunction(ctx, data); - // Exec post hooks - if (context.postPlugins) { - await context.postPlugins.reduce(async (_, current) => { - await invoke(current, 'execPostHook', ctx); - return []; - }, Promise.resolve([])); - } - }; + // Create wrapper for user function + const wrapper = OpenFunctionRuntime.WrapUserFunction(userFunction, context); // Initialize the server with the user's function. // For server interfaces, refer to https://github.com/dapr/js-sdk/blob/master/src/interfaces/Server/ diff --git a/src/openfunction/function_context.ts b/src/openfunction/context.ts similarity index 69% rename from src/openfunction/function_context.ts rename to src/openfunction/context.ts index fbf4dd23..f2ac10ba 100644 --- a/src/openfunction/function_context.ts +++ b/src/openfunction/context.ts @@ -1,5 +1,3 @@ -import {OpenFunctionRuntime} from './function_runtime'; - /** * The OpenFunction's serving context. * @public @@ -33,13 +31,13 @@ export interface OpenFunctionContext { */ outputs?: OpenFunctionBinding; /** - * Optional pre function exec plugins. + * Optional plugins to be executed before user function. */ - prePlugins?: Array; + prePlugins?: string[]; /** - * Optional post function exec plugins. + * Optional plugins to be executed after user function. */ - postPlugins?: Array; + postPlugins?: string[]; } /** @@ -149,44 +147,3 @@ export class ContextUtils { return component?.componentType.split('.')[0] === ComponentType.PubSub; } } - -/** - * The OpenFunction's plugin template. - * @public - */ -export class Plugin { - static OFN_PLUGIN_NAME = 'ofn_plugin_name'; - static OFN_PLUGIN_VERSION = 'ofn_plugin_version'; - /** - * pre main function exec. - * @param ctx - The openfunction runtime . - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public async execPreHook(ctx?: OpenFunctionRuntime) { - console.log( - `This plugin ${this.get( - Plugin.OFN_PLUGIN_NAME - )} method execPreHook is not implemented.` - ); - } - /** - * post main function exec. - * @param ctx - The openfunction runtime . - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public async execPostHook(ctx?: OpenFunctionRuntime) { - console.log( - `This plugin ${this.get( - Plugin.OFN_PLUGIN_NAME - )} method execPostHook is not implemented.` - ); - } - /** - * get instance filed value. - * @param filedName - the instace filedName - * @returns filed value. - */ - public get(filedName: string) { - return filedName; - } -} diff --git a/src/openfunction/dapr_output_middleware.ts b/src/openfunction/dapr_output_middleware.ts deleted file mode 100644 index 478d6392..00000000 --- a/src/openfunction/dapr_output_middleware.ts +++ /dev/null @@ -1,38 +0,0 @@ -import {Request, Response} from 'express'; -import * as interceptor from 'express-interceptor'; - -import * as Debug from 'debug'; -import {isEmpty} from 'lodash'; - -import {OpenFunctionContext, ContextUtils} from './function_context'; -import {OpenFunctionRuntime} from './function_runtime'; - -const debug = Debug('ofn:middleware:dapr:binding'); - -/** - * The handler to invoke Dapr output binding before sending the response. - * @param req express request object - * @param res express response object - */ -const daprOutputHandler = (req: Request, res: Response) => { - return { - isInterceptable: () => { - return ( - !isEmpty(res.locals.context?.outputs) && - ContextUtils.IsKnativeRuntime(res.locals.context as OpenFunctionContext) - ); - }, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - intercept: (body: any, send: Function) => { - const context = res.locals.context; - const runtime = OpenFunctionRuntime.Parse(context); - - runtime.send(body).then(data => { - debug('🎩 Dapr results: %j', data); - send(body); - }); - }, - }; -}; - -export default interceptor(daprOutputHandler); diff --git a/src/openfunction/decs.d.ts b/src/openfunction/decs.d.ts deleted file mode 100644 index 2b551564..00000000 --- a/src/openfunction/decs.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'express-interceptor'; diff --git a/src/openfunction/plugin.ts b/src/openfunction/plugin.ts new file mode 100644 index 00000000..946796f4 --- /dev/null +++ b/src/openfunction/plugin.ts @@ -0,0 +1,196 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import {get, invoke, omit, transform, trim} from 'lodash'; + +import {OpenFunctionRuntime} from './runtime'; + +/** + * Defining an abstract class to represent Plugin. + * @public + **/ +export class Plugin { + /** + * Name of the plugin. + */ + readonly name: string; + + /** + * Version of the plugin. + */ + readonly version: string; + + /** + * Constructor of the OpenFunction plugin. + */ + constructor(name: string, version = 'unknown') { + if (!trim(name)) { + throw new Error('Plugin name must be specified.'); + } + + this.name = name; + this.version = version; + } + + /** + * Get the value of a property on the plugin. + * @param prop - The property to get. + * @returns The value of the property. + */ + get(prop: string) { + return get(this, prop); + } + + /** + * This function is called before the user function is executed. + * @param ctx - Object that contains information about the function that is being executed. + * @param plugins - The collection of loaded pre and post hook plugins. + */ + async execPreHook( + ctx: OpenFunctionRuntime | null, + plugins: Record + ) { + console.warn( + `Plugin "${this.name}" has not implemented pre hook function.` + ); + } + + /** + * This function is called after the user function is executed. + * @param ctx - Object that contains information about the function that is being executed. + * @param plugins - The collection of loaded pre and post hook plugins. + */ + async execPostHook( + ctx: OpenFunctionRuntime | null, + plugins: Record + ) { + console.warn( + `Plugin "${this.name}" has not implemented post hook function.` + ); + } +} + +/** + * PluginMap type definition. + */ +export type PluginMap = Record & {_seq?: string[]}; + +enum PluginStoreType { + BUILTIN = 1, + CUSTOM, +} + +/** + * Initializes a store object for PluginStore singleton class + * with the keys of the PluginStoreType enum and the values of an empty object. + **/ +const stores = transform( + PluginStoreType, + (r, k, v) => { + r[v] = {_seq: []} as {} as PluginMap; + }, + >{} +); + +/** + * PluginStore is a class that manages a collection of plugins. + **/ +export class PluginStore { + /** + * Type of the plugin store. + */ + static Type = PluginStoreType; + + /** + * Singleton helper method to create PluginStore instance. + * @param type - PluginStoreType - The type of plugin store you want to create. + * @returns A new instance of the PluginStore class. + */ + static Instance(type = PluginStore.Type.CUSTOM): PluginStore { + return new PluginStore(type); + } + + /** + * Internal store object. + */ + #store: PluginMap | null = null; + + /** + * Private constructor of PluginStore. + * @param type - PluginStoreType - The type of store you want to use. + */ + private constructor(type: PluginStoreType) { + if (!this.#store) this.#store = stores[type]; + } + + /** + * Adds a plugin to the store. + * @param plugin - Plugin - The plugin to register. + */ + register(plugin: Plugin) { + this.#store![plugin.name] = plugin; + this.#store!._seq?.push(plugin.name); + } + + /** + * Removes a plugin from the store. + * @param plugin - Plugin - The plugin to register. + */ + unregister(plugin: Plugin) { + delete this.#store![plugin.name]; + omit(this.#store!._seq, plugin.name); + } + + /** + * Return the plugin with the given name from the store. + * @param name - The name of the plugin. + * @returns The plugin object. + */ + get(name: string): Plugin { + return this.#store![name]; + } + + /** + * It invokes the `execPreHook` function of each plugin in the order specified by the `seq` array + * @param ctx - The context object that is passed to the plugin. + * @param [seq] - The sequence of plugins to be executed. If not specified, all plugins will be executed. + */ + async execPreHooks(ctx: OpenFunctionRuntime | null, seq?: string[]) { + await this.#invokePluginBySeq( + ctx, + 'execPreHook', + seq || get(ctx, 'prePlugins', null) + ); + } + + /** + * It invokes the `execPostHook` function of each plugin in the order specified by the `seq` array + * @param ctx - The context object that is passed to the plugin. + * @param [seq] - The sequence of plugins to be executed. If not specified, all plugins will be executed. + */ + async execPostHooks(ctx: OpenFunctionRuntime | null, seq?: string[]) { + await this.#invokePluginBySeq( + ctx, + 'execPostHook', + seq || get(ctx, 'postPlugins', null) + ); + } + + /** + * It invokes a method on each plugin in the sequence. + * @param ctx - OpenFunctionRuntime context object. + * @param method - The method to invoke on the plugin. + * @param [seq] - The sequence of plugins to invoke. If not provided, the default sequence will be used. + */ + async #invokePluginBySeq( + ctx: OpenFunctionRuntime | null, + method: keyof Plugin, + seq: string[] + ) { + const pluginNames = seq ?? this.#store!._seq; + const plugins = this.#store!; + + for (const pluginName of pluginNames) { + const plugin = plugins[pluginName]; + await invoke(plugin, method, ctx, plugins); + } + } +} diff --git a/src/openfunction/function_runtime.ts b/src/openfunction/runtime.ts similarity index 67% rename from src/openfunction/function_runtime.ts rename to src/openfunction/runtime.ts index ea28a44c..ab758e4d 100644 --- a/src/openfunction/function_runtime.ts +++ b/src/openfunction/runtime.ts @@ -1,14 +1,18 @@ import {env} from 'process'; -import {chain, get, has, extend} from 'lodash'; +import {chain, get, has, extend, isPlainObject} from 'lodash'; import {Request, Response} from 'express'; import {DaprClient, CommunicationProtocolEnum} from '@dapr/dapr'; +import {OpenFunction} from '../functions'; + import { OpenFunctionComponent, OpenFunctionContext, ContextUtils, -} from './function_context'; +} from './context'; + +import {Plugin, PluginStore} from './plugin'; /** * Defining the interface of the HttpTarget. @@ -40,11 +44,19 @@ export abstract class OpenFunctionRuntime { */ protected trigger?: OpenFunctionTrigger; + /** + * An object to hold local data. + * TODO: Clarify the usage of this property + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + readonly locals: Record; + /** * Constructor of the OpenFunctionRuntime. */ constructor(context: OpenFunctionContext) { this.context = context; + this.locals = {}; } /** @@ -74,6 +86,40 @@ export abstract class OpenFunctionRuntime { }); } + /** + * It takes a user function and a context object, and returns a function that executes the user + * function with the context object, and executes all the pre and post hooks before and after the user function. + * @param userFunction - The function that you want to wrap. + * @param context - This is the context object that is passed to the user function. + * @returns A function that takes in data and returns a promise. + */ + static WrapUserFunction( + userFunction: OpenFunction, + context: OpenFunctionContext | OpenFunctionRuntime + // eslint-disable-next-line @typescript-eslint/no-explicit-any + ): (data: any) => Promise { + const ctx: OpenFunctionRuntime = !isPlainObject(context) + ? (context as OpenFunctionRuntime) + : OpenFunctionRuntime.ProxyContext(context as OpenFunctionContext); + + // Load plugin stores + const userPlugins = PluginStore.Instance(); + const sysPlugins = PluginStore.Instance(PluginStore.Type.BUILTIN); + + return async data => { + // Execute pre hooks, system plugins go first + await sysPlugins.execPreHooks(ctx); + await userPlugins.execPreHooks(ctx); + + // Execute user function + await userFunction(ctx, data); + + // Execute pre hooks, system plugins go last + await userPlugins.execPostHooks(ctx); + await sysPlugins.execPostHooks(ctx); + }; + } + /** * Getter for the port of Dapr sidecar */ @@ -109,6 +155,19 @@ export abstract class OpenFunctionRuntime { this.trigger = extend(this.trigger, {req, res}); } + /** + * Get a plugin from the plugin store, or if it doesn't exist, get it from the built-in plugin store. + * + * @param name - The name of the plugin to get. + * @returns A plugin object + */ + getPlugin(name: string): Plugin { + return ( + PluginStore.Instance().get(name) || + PluginStore.Instance(PluginStore.Type.BUILTIN).get(name) + ); + } + /** * The promise that send data to certain ouput. */ diff --git a/src/options.ts b/src/options.ts index c3611304..cb78aea8 100644 --- a/src/options.ts +++ b/src/options.ts @@ -17,8 +17,9 @@ import {resolve} from 'path'; import * as Debug from 'debug'; import * as minimist from 'minimist'; +import {OpenFunctionContext} from './openfunction/context'; + import {SignatureType, isValidSignatureType} from './types'; -import {OpenFunctionContext} from './openfunction/function_context'; const debug = Debug('common:options'); diff --git a/test/data/mock/context.ts b/test/data/mock/context.ts new file mode 100644 index 00000000..d1f43650 --- /dev/null +++ b/test/data/mock/context.ts @@ -0,0 +1,69 @@ +import {OpenFunctionContext} from '../../../src'; + +export const KnativeBase: OpenFunctionContext = { + name: 'test-context', + version: '1.0.0', + runtime: 'Knative', + outputs: { + file1: { + componentName: 'local', + componentType: 'bindings.localstorage', + metadata: { + fileName: 'my-file1.txt', + }, + }, + file2: { + componentName: 'local', + componentType: 'bindings.localstorage', + metadata: { + fileName: 'my-file2.txt', + }, + }, + }, +}; + +export const AsyncBase: OpenFunctionContext = { + name: 'test-context', + version: '1.0.0', + runtime: 'Async', + port: '8080', + inputs: { + cron: { + uri: 'cron_input', + componentName: 'binding-cron', + componentType: 'bindings.cron', + }, + mqtt_binding: { + uri: 'default', + componentName: 'binding-mqtt', + componentType: 'bindings.mqtt', + }, + mqtt_sub: { + uri: 'webup', + componentName: 'pubsub-mqtt', + componentType: 'pubsub.mqtt', + }, + }, + outputs: { + cron: { + uri: 'cron_output', + operation: 'delete', + componentName: 'binding-cron', + componentType: 'bindings.cron', + }, + localfs: { + uri: 'localstorage', + operation: 'create', + componentName: 'binding-localfs', + componentType: 'bindings.localstorage', + metadata: { + fileName: 'output-file.txt', + }, + }, + mqtt_pub: { + uri: 'webup_pub', + componentName: 'pubsub-mqtt', + componentType: 'pubsub.mqtt', + }, + }, +}; diff --git a/test/data/mock/index.ts b/test/data/mock/index.ts new file mode 100644 index 00000000..eba4e29c --- /dev/null +++ b/test/data/mock/index.ts @@ -0,0 +1,2 @@ +export * as Context from './context'; +export * as Payload from './payload'; diff --git a/test/data/mock/payload.ts b/test/data/mock/payload.ts new file mode 100644 index 00000000..57bca547 --- /dev/null +++ b/test/data/mock/payload.ts @@ -0,0 +1,19 @@ +import {CloudEvent} from '../../../src'; + +export interface IPayload { + RAW: object; + CE?: CloudEvent; +} + +export const Plain: IPayload = {RAW: {some: 'payload'}}; + +Plain.CE = { + specversion: '1.0', + id: 'test-1234-1234', + type: 'ce.openfunction', + time: '2020-05-13T01:23:45Z', + subject: 'test-subject', + source: 'https://github.com/OpenFunction/functions-framework-nodejs', + datacontenttype: 'application/json', + data: Plain.RAW, +}; diff --git a/test/data/plugins/constants.mjs b/test/data/plugins/constants.mjs new file mode 100644 index 00000000..179502bc --- /dev/null +++ b/test/data/plugins/constants.mjs @@ -0,0 +1,11 @@ +import {Plugin} from '../../../build/src/index.js'; + +export class Numbers extends Plugin { + bin = 2; + oct = 8; + hex = 16; + + constructor() { + super('numbers', 'v1'); + } +} diff --git a/test/data/plugins/counters.mjs b/test/data/plugins/counters.mjs new file mode 100644 index 00000000..5ba83214 --- /dev/null +++ b/test/data/plugins/counters.mjs @@ -0,0 +1,65 @@ +import {Plugin} from '../../../build/src/index.js'; + +const sleep = ms => new Promise(r => setTimeout(r, ms)); + +export class TickTock extends Plugin { + value = 0; + + constructor() { + super('ticktock', 'v1'); + } + + async execPreHook(ctx, plugins) { + this.value++; + } + + async execPostHook(ctx, plugins) { + this.value--; + } +} + +export class Countdown extends Plugin { + // start: number; + // end: number; + // step: number; + // current: number; + + constructor() { + super('countdown', 'v1'); + } + + async execPreHook(ctx, plugins) { + // Initialize step value from another plugin + this.step = plugins['numbers'].bin; + } + + async execPostHook(ctx, plugins) { + // Load start value from context local data + if (!this.start) { + this.start = ctx.locals.start ?? 0; + this.end = ctx.locals.end ?? 0; + this.current = this.start; + } + if (this.current === this.end) return; + + // Sleep "10 milliseconds" x "current value" + await sleep(10 * this.current); + + // Execute main countdown logic + this.countdown(ctx, plugins); + + // Try to end the test if necessary + if (this.current === this.end) ctx.locals.done?.(); + } + + countdown(ctx, plugins) { + // Load self plugin instance + const self = plugins[this.name]; + + // Count down by step value, and save current stop + self.current -= self.step; + + // Calibrate current value if it goes below the end value + if (self.current < self.end) self.current = self.end; + } +} diff --git a/test/data/plugins/errorMissAll.js b/test/data/plugins/errorMissAll.js deleted file mode 100644 index 413b0248..00000000 --- a/test/data/plugins/errorMissAll.js +++ /dev/null @@ -1,6 +0,0 @@ -class ErrorPlugin{ - static Version = "v1"; - static Name = "error-miss-all-plugin"; -} - -module.exports = ErrorPlugin; diff --git a/test/data/plugins/errorMissName.js b/test/data/plugins/errorMissName.js deleted file mode 100644 index c1266036..00000000 --- a/test/data/plugins/errorMissName.js +++ /dev/null @@ -1,22 +0,0 @@ -class ErrorPlugin{ - static Version = "v1"; - // static Name = "error-plugin" - constructor(){ - console.log(`init error plugins`); - } - async execPreHook(ctx){ - console.log(`-----------error plugin pre hook-----------`); - } - execPostHook(ctx){ - console.log(`-----------error plugin post hook-----------`); - } - get(filedName){ - for(let key in this){ - if(key === filedName){ - return this[key]; - } - } - } -} - -module.exports = {ErrorPlugin}; diff --git a/test/data/plugins/errorMissVersion.js b/test/data/plugins/errorMissVersion.js deleted file mode 100644 index aaf3087c..00000000 --- a/test/data/plugins/errorMissVersion.js +++ /dev/null @@ -1,22 +0,0 @@ -class ErrorPlugin{ - // static Version = "v1" - static Name = "error-miss-version-plugin" - constructor(){ - console.log(`init error plugins`); - } - async execPreHook(ctx){ - console.log(`-----------error plugin pre hook-----------`); - } - execPostHook(ctx){ - console.log(`-----------error plugin post hook-----------`); - } - get(filedName){ - for(let key in this){ - if(key === filedName){ - return this[key]; - } - } - } -} - -module.exports = {ErrorPlugin}; diff --git a/test/data/plugins/noname.mjs b/test/data/plugins/noname.mjs new file mode 100644 index 00000000..be122097 --- /dev/null +++ b/test/data/plugins/noname.mjs @@ -0,0 +1,7 @@ +import {Plugin} from '../../../build/src/index.js'; + +export class Noname extends Plugin { + constructor() { + super(' ', 'v0'); + } +} diff --git a/test/data/plugins/plugindemo.js b/test/data/plugins/plugindemo.js deleted file mode 100644 index 6fd4ea12..00000000 --- a/test/data/plugins/plugindemo.js +++ /dev/null @@ -1,32 +0,0 @@ -function sleep(){ - return new Promise(resolve => setTimeout(resolve,3000)); -} -class DemoPlugin{ - static Version = "v1"; - static Name = "demo-plugin"; - id = '666'; - constructor(){ - console.log(`init demo plugins`); - } - async execPreHook(ctx){ - console.log(`-----------demo plugin pre hook-----------`); - ctx['pre'] = 'pre-exec'; - await sleep(); - console.log(`-----------pre sleep 3----------`) - } - async execPostHook(ctx){ - console.log(`-----------demo plugin post hook-----------`); - ctx['post'] = 'post-exec'; - console.log(`-----------send post-----------`); - } - get(filedName){ - for(let key in this){ - if(key === filedName){ - return this[key]; - } - } - } -} - -// module.exports = {DemoPlugin}; -exports.DemoPlugin = DemoPlugin; diff --git a/test/data/test_data/async_plugin.ts b/test/data/test_data/async_plugin.ts deleted file mode 100644 index c281a314..00000000 --- a/test/data/test_data/async_plugin.ts +++ /dev/null @@ -1,111 +0,0 @@ -import {OpenFunctionContext} from '../../../src/openfunction/function_context'; -import {FrameworkOptions} from '../../../src/options'; - -export const TEST_CONTEXT: OpenFunctionContext = { - name: 'test-context', - version: '1.0.0', - runtime: 'Async', - port: '8080', - inputs: { - cron: { - uri: 'cron_input', - componentName: 'binding-cron', - componentType: 'bindings.cron', - }, - mqtt_binding: { - uri: 'default', - componentName: 'binding-mqtt', - componentType: 'bindings.mqtt', - }, - mqtt_sub: { - uri: 'webup', - componentName: 'pubsub-mqtt', - componentType: 'pubsub.mqtt', - }, - }, - outputs: { - cron: { - uri: 'cron_output', - operation: 'delete', - componentName: 'binding-cron', - componentType: 'bindings.cron', - }, - localfs: { - uri: 'localstorage', - operation: 'create', - componentName: 'binding-localfs', - componentType: 'bindings.localstorage', - metadata: { - fileName: 'output-file.txt', - }, - }, - mqtt_pub: { - uri: 'webup_pub', - componentName: 'pubsub-mqtt', - componentType: 'pubsub.mqtt', - }, - }, -}; -export const TEST_PLUGIN_OPTIONS: FrameworkOptions = { - port: '', - target: '', - sourceLocation: process.cwd() + '/test/data', - signatureType: 'event', - printHelp: false, - context: { - name: 'test-context-plugin', - version: '1.0.0', - runtime: 'Async', - port: '8080', - inputs: { - cron: { - uri: 'cron_input', - componentName: 'binding-cron', - componentType: 'bindings.cron', - }, - mqtt_binding: { - uri: 'default', - componentName: 'binding-mqtt', - componentType: 'bindings.mqtt', - }, - mqtt_sub: { - uri: 'webup', - componentName: 'pubsub-mqtt', - componentType: 'pubsub.mqtt', - }, - }, - outputs: { - cron: { - uri: 'cron_output', - operation: 'delete', - componentName: 'binding-cron', - componentType: 'bindings.cron', - }, - localfs: { - uri: 'localstorage', - operation: 'create', - componentName: 'binding-localfs', - componentType: 'bindings.localstorage', - metadata: { - fileName: 'output-file.txt', - }, - }, - mqtt_pub: { - uri: 'webup_pub', - componentName: 'pubsub-mqtt', - componentType: 'pubsub.mqtt', - }, - }, - prePlugins: ['demo-plugin'], - postPlugins: ['demo-plugin'], - }, -}; -export const TEST_PAYLOAD = {data: 'hello world'}; -export const TEST_CLOUD_EVENT = { - specversion: '1.0', - id: 'test-1234-1234', - type: 'ce.openfunction', - source: 'https://github.com/OpenFunction/functions-framework-nodejs', - traceparent: '00-65088630f09e0a5359677a7429456db7-97f23477fb2bf5ec-01', - data: TEST_PAYLOAD, -}; diff --git a/test/function_wrappers.ts b/test/function_wrappers.ts index 67e3591a..48ef82f2 100644 --- a/test/function_wrappers.ts +++ b/test/function_wrappers.ts @@ -2,7 +2,7 @@ import * as assert from 'assert'; import * as sinon from 'sinon'; import {Request, Response} from 'express'; -import {OpenFunctionContext} from '../src/openfunction/function_context'; +import {OpenFunctionContext} from '../src/openfunction/context'; import {Context, CloudEvent, OpenFunctionRuntime} from '../src/functions'; import {wrapUserFunction} from '../src/function_wrappers'; diff --git a/test/integration/async_server.ts b/test/integration/async_server.ts index e9cddd53..8009a44e 100644 --- a/test/integration/async_server.ts +++ b/test/integration/async_server.ts @@ -1,20 +1,20 @@ -/* eslint-disable no-restricted-properties */ import {deepStrictEqual, ifError, ok} from 'assert'; import {createServer} from 'net'; -import {get, isEmpty} from 'lodash'; +import {fill, get, isEmpty} from 'lodash'; import * as shell from 'shelljs'; import * as MQTT from 'aedes'; import getAysncServer from '../../src/openfunction/async_server'; +import {getFunctionPlugins} from '../../src/loader'; -import { - TEST_CLOUD_EVENT, - TEST_CONTEXT, - TEST_PAYLOAD, -} from '../data/test_data/async_plugin'; +import {Context, Payload} from '../data/mock'; -describe('OpenFunction - Async - Binding', () => { +const TEST_CONTEXT = Context.AsyncBase; +const TEST_PAYLOAD = Payload.Plain.RAW; +const TEST_PAYLOAD_CE = Payload.Plain.CE; + +describe('OpenFunction - Async', () => { const APPID = 'async.dapr'; const broker = MQTT.Server(); const server = createServer(broker.handle); @@ -43,20 +43,24 @@ describe('OpenFunction - Async - Binding', () => { }); it('stop cron after first trigger recived', done => { - const app = getAysncServer((ctx, data) => { - // Assert that user function receives data from input binding - ok(data); - - // Assert that context data was passed through - deepStrictEqual(get(ctx, 'runtime'), TEST_CONTEXT.runtime); - deepStrictEqual( - get(ctx, 'inputs.cron.uri'), - TEST_CONTEXT.inputs!.cron.uri - ); + const app = getAysncServer( + (ctx, data) => { + // Assert that user function receives data from input binding + ok(data); - // Then stop the cron scheduler - ctx.send({}, 'cron').then(() => app.stop().finally(done)); - }, TEST_CONTEXT); + // Assert that context data was passed through + deepStrictEqual(get(ctx, 'runtime'), TEST_CONTEXT.runtime); + deepStrictEqual( + get(ctx, 'inputs.cron.uri'), + TEST_CONTEXT.inputs!.cron.uri + ); + + // Then stop the cron scheduler + ctx.send({}, 'cron').then(() => app.stop().finally(done)); + }, + + TEST_CONTEXT + ); app.start(); }); @@ -95,27 +99,31 @@ describe('OpenFunction - Async - Binding', () => { }); it('mqtt sub w/ pub output', done => { - const app = getAysncServer((ctx, data) => { - if (isEmpty(data)) return; - - // Assert that user function receives correct data from input binding - deepStrictEqual(data, TEST_PAYLOAD); - - // Then forward received data to output channel - const output = 'mqtt_pub'; - broker.subscribe( - get(TEST_CONTEXT, `outputs.${output}.uri`), - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (packet, _) => { - const payload = JSON.parse(Buffer.from(packet.payload).toString()); - deepStrictEqual(payload.data, TEST_PAYLOAD); - app.stop().finally(done); - }, - () => { - ctx.send(TEST_PAYLOAD, output); - } - ); - }, TEST_CONTEXT); + const app = getAysncServer( + (ctx, data) => { + if (isEmpty(data)) return; + + // Assert that user function receives correct data from input binding + deepStrictEqual(data, TEST_PAYLOAD); + + // Then forward received data to output channel + const output = 'mqtt_pub'; + broker.subscribe( + get(TEST_CONTEXT, `outputs.${output}.uri`), + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (packet, _) => { + const payload = JSON.parse(Buffer.from(packet.payload).toString()); + deepStrictEqual(payload.data, TEST_PAYLOAD); + app.stop().finally(done); + }, + () => { + ctx.send(TEST_PAYLOAD, output); + } + ); + }, + + TEST_CONTEXT + ); // First, we start the async server app.start().then(() => { @@ -124,7 +132,7 @@ describe('OpenFunction - Async - Binding', () => { { cmd: 'publish', topic: TEST_CONTEXT.inputs!.mqtt_sub.uri!, - payload: JSON.stringify(TEST_CLOUD_EVENT), + payload: JSON.stringify(TEST_PAYLOAD_CE), qos: 0, retain: false, dup: false, @@ -133,4 +141,45 @@ describe('OpenFunction - Async - Binding', () => { ); }); }); + + it('mqtt binding w/ custom plugins', done => { + getFunctionPlugins(process.cwd() + '/test/data').then(plugins => { + const start = get(plugins!.numbers, 'oct'); + + const app = getAysncServer( + (ctx, data) => { + // Assert that user function receives correct data from input binding + deepStrictEqual(get(data, 'start'), start); + + // Set local data for post hook plugin + ctx.locals.start = start; + ctx.locals.end = -start; + + // Passthrough test done handler + ctx.locals.done = done; + }, + { + ...TEST_CONTEXT, + prePlugins: ['countdown'], + postPlugins: fill(Array(start), 'countdown'), + } + ); + + // First, we start the async server + app.start().then(() => { + // Then, we send a number as start value to user function + broker.publish( + { + cmd: 'publish', + topic: 'default', + payload: JSON.stringify({start}), + qos: 0, + retain: false, + dup: false, + }, + err => ifError(err) + ); + }); + }); + }); }); diff --git a/test/integration/async_server_plugin.ts b/test/integration/async_server_plugin.ts deleted file mode 100644 index c7e228ea..00000000 --- a/test/integration/async_server_plugin.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* eslint-disable no-restricted-properties */ -import {deepStrictEqual, ifError} from 'assert'; -import {createServer} from 'net'; - -import {get, isEmpty} from 'lodash'; -import * as shell from 'shelljs'; -import * as MQTT from 'aedes'; - -import getAysncServer from '../../src/openfunction/async_server'; -import {getUserPlugins} from '../../src/loader'; -import assert = require('assert'); -import { - TEST_CLOUD_EVENT, - TEST_CONTEXT, - TEST_PAYLOAD, - TEST_PLUGIN_OPTIONS, -} from '../data/test_data/async_plugin'; - -describe('OpenFunction - Async - Binding with plugin', () => { - const APPID = 'async.dapr'; - const broker = MQTT.Server(); - const server = createServer(broker.handle); - - before(done => { - // Start simple plain MQTT server via aedes - server.listen(1883, () => { - // Try to run Dapr sidecar and listen for the async server - shell.exec( - `dapr run -H 3500 -G 50001 -p ${TEST_CONTEXT.port} -d ./test/data/components/async -a ${APPID} --log-level debug`, - { - silent: true, - async: true, - } - ); - done(); - }); - }); - - after(done => { - // Stop dapr sidecar process - shell.exec(`dapr stop ${APPID}`, { - silent: true, - }); - server.close(); - broker.close(done); - }); - - it('mqtt sub w/ pub output with demo plugin', done => { - const app = getAysncServer((ctx, data) => { - if (isEmpty(data)) return; - - const context: any = ctx as any; - assert(context['pre'] === 'pre-exec'); - context['pre'] = 'main-exec'; - - // Assert that user function receives correct data from input binding - deepStrictEqual(data, TEST_PAYLOAD); - console.log(data); - // Then forward received data to output channel - const output = 'mqtt_pub'; - broker.subscribe( - get(TEST_PLUGIN_OPTIONS.context!, `outputs.${output}.uri`), - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (packet, _) => { - const payload = JSON.parse(Buffer.from(packet.payload).toString()); - deepStrictEqual(payload.data, TEST_PAYLOAD); - app - .stop() - .then(() => { - assert(context['pre'] === 'main-exec'); - assert(context['post'] === 'post-exec'); - }) - .finally(done); - }, - () => { - ctx.send(TEST_PAYLOAD, output); - } - ); - }, TEST_PLUGIN_OPTIONS.context!); - - // First, we start the async server - app.start().then(async () => { - await getUserPlugins(TEST_PLUGIN_OPTIONS); - console.log(TEST_PLUGIN_OPTIONS); - // Then, we send a cloudevent format message to server - broker.publish( - { - cmd: 'publish', - topic: TEST_PLUGIN_OPTIONS.context!.inputs!.mqtt_sub.uri!, - payload: JSON.stringify(TEST_CLOUD_EVENT), - qos: 0, - retain: false, - dup: false, - }, - err => ifError(err) - ); - }); - }); -}); diff --git a/test/integration/cloud_event.ts b/test/integration/cloud_event.ts index ce21b81d..223af5e8 100644 --- a/test/integration/cloud_event.ts +++ b/test/integration/cloud_event.ts @@ -21,19 +21,10 @@ import * as functions from '../../src/index'; import {getTestServer} from '../../src/testing'; import {FUNCTION_STATUS_HEADER_FIELD} from '../../src/types'; +import {Plain} from '../data/mock/payload'; + // A structured CloudEvent -const TEST_CLOUD_EVENT = { - specversion: '1.0', - type: 'com.google.cloud.storage', - source: 'https://github.com/OpenFunction/functions-framework-nodejs', - subject: 'test-subject', - id: 'test-1234-1234', - time: '2020-05-13T01:23:45Z', - datacontenttype: 'application/json', - data: { - some: 'payload', - }, -}; +const TEST_CLOUD_EVENT = Plain.CE!; const TEST_EXTENSIONS = { traceparent: '00-65088630f09e0a5359677a7429456db7-97f23477fb2bf5ec-01', diff --git a/test/integration/http_binding.ts b/test/integration/http_binding.ts index 7c91aa2c..9517cb88 100644 --- a/test/integration/http_binding.ts +++ b/test/integration/http_binding.ts @@ -3,36 +3,18 @@ import {deepStrictEqual} from 'assert'; import * as sinon from 'sinon'; import * as supertest from 'supertest'; import * as shell from 'shelljs'; -import {cloneDeep, forEach, set} from 'lodash'; - -import {OpenFunctionContext} from '../../src/openfunction/function_context'; +import {cloneDeep, forEach, get, set} from 'lodash'; +import {PluginStore} from '../../src/openfunction/plugin'; import {OpenFunctionRuntime} from '../../src/functions'; import {getServer} from '../../src/server'; +import {getFunctionPlugins} from '../../src/loader'; import {FUNCTION_STATUS_HEADER_FIELD} from '../../src/types'; -const TEST_CONTEXT: OpenFunctionContext = { - name: 'test-context', - version: '1.0.0', - runtime: 'Knative', - outputs: { - file1: { - componentName: 'local', - componentType: 'bindings.localstorage', - metadata: { - fileName: 'my-file1.txt', - }, - }, - file2: { - componentName: 'local', - componentType: 'bindings.localstorage', - metadata: { - fileName: 'my-file2.txt', - }, - }, - }, -}; -const TEST_PAYLOAD = {echo: 'hello world'}; +import {Context, Payload} from '../data/mock'; + +const TEST_CONTEXT = Context.KnativeBase; +const TEST_PAYLOAD = Payload.Plain.RAW; describe('OpenFunction - HTTP Binding', () => { const APPID = 'http.dapr'; @@ -50,8 +32,10 @@ describe('OpenFunction - HTTP Binding', () => { } ); - // Wait 5 seconds for dapr sidecar to start - setTimeout(done, 5000); + getFunctionPlugins(process.cwd() + '/test/data').then(() => { + // Wait 5 seconds for dapr sidecar to start + setTimeout(done, 5000); + }); }); after(() => { @@ -79,6 +63,7 @@ describe('OpenFunction - HTTP Binding', () => { testData.forEach(test => { it(test.name, async () => { const context = cloneDeep(TEST_CONTEXT); + context.prePlugins = context.postPlugins = ['ticktock']; forEach(context.outputs, output => set(output, 'operation', test.operation) ); @@ -99,12 +84,17 @@ describe('OpenFunction - HTTP Binding', () => { .send(TEST_PAYLOAD) .expect(test.operation ? 200 : 500) .expect(res => { - !test.operation - ? deepStrictEqual( - res.headers[FUNCTION_STATUS_HEADER_FIELD.toLowerCase()], - 'error' - ) - : deepStrictEqual(res.body, TEST_PAYLOAD); + const tick = get(PluginStore.Instance().get('ticktock'), 'value'); + if (!test.operation) { + deepStrictEqual( + res.headers[FUNCTION_STATUS_HEADER_FIELD.toLowerCase()], + 'error' + ); + deepStrictEqual(tick, 1); + } else { + deepStrictEqual(res.body, TEST_PAYLOAD); + deepStrictEqual(tick, 0); + } }); forEach(context.outputs, output => { diff --git a/test/loader.ts b/test/loader.ts index 35bc528c..52a7589c 100644 --- a/test/loader.ts +++ b/test/loader.ts @@ -13,15 +13,14 @@ // limitations under the License. import * as assert from 'assert'; + import * as express from 'express'; import * as semver from 'semver'; -import * as functions from '../src/functions'; + +import {http, cloudEvent, HttpFunction} from '../src'; import * as loader from '../src/loader'; -import * as FunctionRegistry from '../src/function_registry'; -import {FrameworkOptions} from '../src/options'; -import {Plugin} from '../src'; -describe('loading function', () => { +describe('Load function and plugins', () => { interface TestData { name: string; codeLocation: string; @@ -48,8 +47,7 @@ describe('loading function', () => { test.target, 'http' ); - const userFunction = - loadedFunction?.userFunction as functions.HttpFunction; + const userFunction = loadedFunction?.userFunction as HttpFunction; const returned = userFunction(express.request, express.response); assert.strictEqual(returned, 'PASS'); }); @@ -74,13 +72,13 @@ describe('loading function', () => { ]; for (const test of esmTestData) { - const loadFn: () => Promise = async () => { + const loadFn: () => Promise = async () => { const loadedFunction = await loader.getUserFunction( process.cwd() + test.codeLocation, test.target, 'http' ); - return loadedFunction?.userFunction as functions.HttpFunction; + return loadedFunction?.userFunction as HttpFunction; }; if (semver.lt(process.version, loader.MIN_NODE_VERSION_ESMODULES)) { it(`should fail to load function in an ES module ${test.name}`, async () => { @@ -96,7 +94,7 @@ describe('loading function', () => { } it('loads a declaratively registered function', async () => { - FunctionRegistry.http('registeredFunction', () => { + http('registeredFunction', () => { return 'PASS'; }); const loadedFunction = await loader.getUserFunction( @@ -104,13 +102,13 @@ describe('loading function', () => { 'registeredFunction', 'http' ); - const userFunction = loadedFunction?.userFunction as functions.HttpFunction; + const userFunction = loadedFunction?.userFunction as HttpFunction; const returned = userFunction(express.request, express.response); assert.strictEqual(returned, 'PASS'); }); it('allows a mix of registered and non registered functions', async () => { - FunctionRegistry.http('registeredFunction', () => { + http('registeredFunction', () => { return 'FAIL'; }); const loadedFunction = await loader.getUserFunction( @@ -118,13 +116,13 @@ describe('loading function', () => { 'testFunction', 'http' ); - const userFunction = loadedFunction?.userFunction as functions.HttpFunction; + const userFunction = loadedFunction?.userFunction as HttpFunction; const returned = userFunction(express.request, express.response); assert.strictEqual(returned, 'PASS'); }); it('respects the registered signature type', async () => { - FunctionRegistry.cloudEvent('registeredFunction', () => {}); + cloudEvent('registeredFunction', () => {}); const loadedFunction = await loader.getUserFunction( process.cwd() + '/test/data/with_main', 'registeredFunction', @@ -132,202 +130,16 @@ describe('loading function', () => { ); assert.strictEqual(loadedFunction?.signatureType, 'cloudevent'); }); -}); - -describe('loading plugins', () => { - interface ExceptData { - prePlugins: Array; - postPlugins: Array; - } - interface TestData { - options: FrameworkOptions; - except: ExceptData; - } - const testData: TestData[] = [ - { - options: { - port: '8080', - target: 'helloWorld', - sourceLocation: process.cwd() + '/test/data', - signatureType: 'event', - printHelp: false, - context: { - name: 'demo', - version: '', - runtime: 'ASYNC', - prePlugins: ['demo-plugin'], - postPlugins: ['demo-plugin'], - }, - }, - except: { - prePlugins: ['demo-plugin'], - postPlugins: ['demo-plugin'], - }, - }, - { - options: { - port: '8080', - target: 'helloWorld', - sourceLocation: process.cwd() + '/test/data', - signatureType: 'event', - printHelp: false, - context: { - name: 'demo', - version: '', - runtime: 'ASYNC', - prePlugins: ['demo-plugin'], - postPlugins: [], - }, - }, - except: { - prePlugins: ['demo-plugin'], - postPlugins: [], - }, - }, - { - options: { - port: '8080', - target: 'helloWorld', - sourceLocation: process.cwd() + '/test/data', - signatureType: 'event', - printHelp: false, - context: { - name: 'demo', - version: '', - runtime: 'ASYNC', - prePlugins: [], - postPlugins: [], - }, - }, - except: { - prePlugins: [], - postPlugins: [], - }, - }, - { - options: { - port: '8080', - target: 'helloWorld', - sourceLocation: process.cwd() + '/test/data', - signatureType: 'event', - printHelp: false, - context: { - name: 'error', - version: '', - runtime: 'ASYNC', - prePlugins: ['error-plugin'], - postPlugins: ['error-plugin'], - }, - }, - except: { - prePlugins: [], - postPlugins: [], - }, - }, - { - options: { - port: '8080', - target: 'helloWorld', - sourceLocation: process.cwd() + '/test/data', - signatureType: 'event', - printHelp: false, - context: { - name: 'error', - version: '', - runtime: 'ASYNC', - prePlugins: ['error-miss-version-plugin', 'demo-plugin'], - postPlugins: ['error-miss-version-plugin'], - }, - }, - except: { - prePlugins: ['error-miss-version-plugin', 'demo-plugin'], - postPlugins: ['error-miss-version-plugin'], - }, - }, - ]; - - it('load exits plugins', async () => { - for (const test of testData) { - const options = await loader.getUserPlugins(test.options); - const current: ExceptData = { - prePlugins: [], - postPlugins: [], - }; - - options.context!.prePlugins!.forEach(item => { - assert(typeof item === 'object'); - assert(item.get(Plugin.OFN_PLUGIN_VERSION) === 'v1'); - current.prePlugins.push(item.get(Plugin.OFN_PLUGIN_NAME)); - }); - options.context!.postPlugins!.forEach(item => { - assert(typeof item === 'object'); - assert(item.get(Plugin.OFN_PLUGIN_VERSION) === 'v1'); - current.postPlugins.push(item.get(Plugin.OFN_PLUGIN_NAME)); - }); - - assert.deepStrictEqual(current, test.except); - } - }); - - const test: TestData = { - options: { - port: '8080', - target: 'helloWorld', - sourceLocation: process.cwd() + '/test/data', - signatureType: 'event', - printHelp: false, - context: { - name: 'error', - version: '', - runtime: 'ASYNC', - prePlugins: [''], - postPlugins: [''], - }, - }, - except: { - prePlugins: [''], - postPlugins: [''], - }, - }; - - function copyAndSet(name: string): TestData { - const data: TestData = JSON.parse(JSON.stringify(test)); - data.options.context!.prePlugins![0] = name; - data.options.context!.postPlugins![0] = name; - data.except.postPlugins[0] = name; - data.except.prePlugins[0] = name; - return data; - } - - it('user plugin miss all', async () => { - const data = copyAndSet('error-miss-all-plugin'); - const options = await loader.getUserPlugins(data.options); - assert(typeof options.context!.prePlugins![0] === 'object'); - assert( - options.context!.prePlugins![0].get(Plugin.OFN_PLUGIN_NAME) === - 'error-miss-all-plugin' + it('should only load valid plugin class and ignore other', async () => { + const loadedPlugins = await loader.getFunctionPlugins( + process.cwd() + '/test/data' ); - assert(options.context!.prePlugins![0].execPreHook); - assert(options.context!.prePlugins![0].execPostHook); - }); + assert.ok(loadedPlugins); - it('load multi plugins ', async () => { - const data: FrameworkOptions = { - port: '8080', - target: 'helloWorld', - sourceLocation: process.cwd() + '/test/data', - signatureType: 'event', - printHelp: false, - context: { - name: 'demo', - version: '', - runtime: 'ASYNC', - prePlugins: ['demo-plugin', 'error-miss-all-plugin'], - postPlugins: ['demo-plugin', 'error-miss-all-plugin'], - }, - }; - assert.ok(await loader.getUserPlugins(data)); - console.log(data); + ['noname'].forEach(v => assert.ok(!loadedPlugins[v])); + ['numbers', 'ticktock', 'countdown'].forEach(v => + assert.strictEqual(loadedPlugins[v]?.name, v) + ); }); }); diff --git a/test/plugin.ts b/test/plugin.ts new file mode 100644 index 00000000..000bd46c --- /dev/null +++ b/test/plugin.ts @@ -0,0 +1,57 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import * as assert from 'assert'; + +import {fill, get, random, range} from 'lodash'; + +import {PluginStore, Plugin} from '../src/openfunction/plugin'; +import {getFunctionPlugins} from '../src/loader'; + +class Concater extends Plugin { + index = 0; + value = ''; + + constructor() { + super('concater', 'v1'); + } + + async execPreHook(): Promise { + await new Promise(r => setTimeout(r, random(0, 10) * 10)); + this.value += this.index++; + } +} + +describe('Store for custom and builtin plugins', () => { + before(async () => await getFunctionPlugins(process.cwd() + '/test/data')); + + const customs = PluginStore.Instance(); + + it('can retrieve plugin by name', () => { + ['numbers', 'ticktock', 'countdown'].forEach(v => + assert.strictEqual(customs.get(v)?.name, v) + ); + }); + + it('can execute custom plugins by sequence', async () => { + const size = random(3, 5); + const ticktock = customs.get('ticktock'); + const seq = fill(Array(size), ticktock.name); + + await customs.execPreHooks(null, seq); + assert.strictEqual(get(ticktock, 'value'), size); + + await customs.execPostHooks(null, seq); + assert.strictEqual(get(ticktock, 'value'), 0); + }); + + it('ensures the sequence of long running async plugins', async () => { + customs.register(new Concater()); + + const size = random(0, 9); + const concater = customs.get('concater'); + const seq = fill(Array(size), concater.name); + + await customs.execPreHooks(null, seq); + assert.strictEqual(get(concater, 'index'), size); + assert.strictEqual(get(concater, 'value'), range(size).join('')); + }); +}); From d21201dc6e8fd8bb39e2568771a0e79bf6ac760b Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Thu, 25 Aug 2022 12:41:25 +0800 Subject: [PATCH 32/42] =?UTF-8?q?=F0=9F=93=9D=20docs(CONTRIBUTING):=20intr?= =?UTF-8?q?oduce=20how=20to=20debug=20in=20vscode=20[no=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- CONTRIBUTING.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 026aaa70..a8ad568d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,6 +20,16 @@ All submissions, including submissions by project members, require review. We us ## Testing +### Debugging in VS Code + +VS Code provides awesome Node.js debugging features, including the ability to automatically attach debugging to certain Node.js processes that have been launched from VS Code's Integrated Terminal. + +Please refer this [guide](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_auto-attach) to toggle "Auto Attach" feature, and the default `smart` mode is already good enough for debugging our framework. + +Once set up Auto Attach, you can create some breakpoints in your codes and run `npm t` in VS Code's Integrated Terminal to check whether the breakpoints work as expected. + +> After enabling Auto Attach, you'll need to restart your terminal. This can be done by clicking the ⚠ icon in the top right of the terminal, or just creating a new one. + ### Unit Tests All pull requests should have an associated test to ensure foward compatibility. From 92d5533358d1bd70319ce6ba5c9ebc885a83c3e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Aug 2022 03:36:45 +0000 Subject: [PATCH 33/42] chore(deps-dev): bump typescript from 4.7.4 to 4.8.2 Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.7.4 to 4.8.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.7.4...v4.8.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 81916e75..e2bc777b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -261,6 +261,19 @@ "path-parse": "^1.0.6" } }, + "node_modules/@microsoft/api-extractor/node_modules/typescript": { + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/@microsoft/tsdoc": { "version": "0.14.1", "resolved": "https://registry.npmmirror.com/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz", @@ -7073,9 +7086,9 @@ } }, "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", + "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -7814,6 +7827,12 @@ "requires": { "path-parse": "^1.0.6" } + }, + "typescript": { + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "dev": true } } }, @@ -13035,9 +13054,9 @@ } }, "typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", + "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "dev": true }, "unbox-primitive": { From 7e7c91d91df91904cb1a0f12253fa20bcf244ecb Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 3 Sep 2022 22:21:36 +0800 Subject: [PATCH 34/42] =?UTF-8?q?=F0=9F=91=B7=20ci:=20add=20prepack=20lint?= =?UTF-8?q?=20[no=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- package-lock.json | 18 +++++++++++++++++- package.json | 6 ++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e2bc777b..189f73a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,6 +43,7 @@ "@types/sinon": "10.0.11", "@types/supertest": "2.0.12", "aedes": "^0.47.0", + "clean-pkg-json": "^1.2.0", "concurrently": "^7.3.0", "cross-env": "^7.0.3", "env-cmd": "^10.1.0", @@ -53,7 +54,7 @@ "shelljs": "^0.8.5", "sinon": "^14.0.0", "supertest": "6.2.3", - "typescript": "^4.7.4", + "typescript": "^4.8.2", "wait-on": "^6.0.1" }, "engines": { @@ -1635,6 +1636,15 @@ "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "dev": true }, + "node_modules/clean-pkg-json": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/clean-pkg-json/-/clean-pkg-json-1.2.0.tgz", + "integrity": "sha512-QHBWWOtpSCv5nfMFKwyxn4WMvkYE0msxj5xiqejYGqYepWVrK7O/om1Vn6nSl/WPtYn8ge9YmSCbTi1Hp8k+Hg==", + "dev": true, + "bin": { + "clean-pkg-json": "dist/index.js" + } + }, "node_modules/cli-boxes": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", @@ -8959,6 +8969,12 @@ "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "dev": true }, + "clean-pkg-json": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/clean-pkg-json/-/clean-pkg-json-1.2.0.tgz", + "integrity": "sha512-QHBWWOtpSCv5nfMFKwyxn4WMvkYE0msxj5xiqejYGqYepWVrK7O/om1Vn6nSl/WPtYn8ge9YmSCbTi1Hp8k+Hg==", + "dev": true + }, "cli-boxes": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", diff --git a/package.json b/package.json index 26e61e43..92dd34a0 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "docs": "npm run compile && api-extractor run --local --verbose", "watch": "npm run compile -- --watch", "prepare": "npm run build", - "pretest": "npm run compile" + "pretest": "npm run compile", + "prepack": "clean-pkg-json" }, "prepush": [ "build", @@ -69,6 +70,7 @@ "@types/sinon": "10.0.11", "@types/supertest": "2.0.12", "aedes": "^0.47.0", + "clean-pkg-json": "^1.2.0", "concurrently": "^7.3.0", "cross-env": "^7.0.3", "env-cmd": "^10.1.0", @@ -79,7 +81,7 @@ "shelljs": "^0.8.5", "sinon": "^14.0.0", "supertest": "6.2.3", - "typescript": "^4.7.4", + "typescript": "^4.8.2", "wait-on": "^6.0.1" } } From 32672faa79971260bd2384d30382e3daa40afda1 Mon Sep 17 00:00:00 2001 From: MachaYAD <43526965+YADROOKIE@users.noreply.github.com> Date: Sun, 4 Sep 2022 15:21:57 +0800 Subject: [PATCH 35/42] feat: enable skywalking plugin for tracing (#86) --- .github/workflows/unit.yml | 10 + docs/generated/api.json | 235 +++++++++ docs/generated/api.md | 15 + output-file.txt | 1 + package-lock.json | 475 ++++++++++++++++-- package.json | 4 +- src/loader.ts | 50 ++ src/main.ts | 4 +- src/openfunction/context.ts | 44 ++ .../plugin/skywalking/skywalking.ts | 114 +++++ src/openfunction/runtime.ts | 2 +- test/data/plugins/counters.mjs | 5 +- test/data/plugins/skywalking_assist.mjs | 35 ++ test/integration/async_server.ts | 1 + test/integration/build_in_plugin.ts | 232 +++++++++ 15 files changed, 1176 insertions(+), 51 deletions(-) create mode 100644 output-file.txt create mode 100644 src/openfunction/plugin/skywalking/skywalking.ts create mode 100644 test/data/plugins/skywalking_assist.mjs create mode 100644 test/integration/build_in_plugin.ts diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index c5cfe874..e54221f2 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -26,6 +26,16 @@ jobs: - name: Install Docker for macOS uses: docker-practice/actions-setup-docker@master if: ${{ matrix.platform == 'macos-latest' }} + - name: Install Docker for ubuntu + uses: docker-practice/actions-setup-docker@master + if: ${{ matrix.platform == 'ubuntu-latest' }} + - name: Install skywalking and wait for it start + run: | + docker version + docker pull apache/skywalking-oap-server:8.4.0-es6 + docker run -d --name oap -p 12800:12800 -p 11800:11800 apache/skywalking-oap-server:8.4.0-es6 + docker ps + sleep 20s - name: Initialize Dapr run: dapr init -s --runtime-version ${{ matrix.dapr-version }} - name: Install dependencies diff --git a/docs/generated/api.json b/docs/generated/api.json index d1902656..b83f66fd 100644 --- a/docs/generated/api.json +++ b/docs/generated/api.json @@ -2039,6 +2039,34 @@ "endIndex": 12 } }, + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#tracing:member", + "docComment": "/**\n * Optional trace config\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "tracing?: " + }, + { + "kind": "Reference", + "text": "TraceConfig", + "canonicalReference": "@openfunction/functions-framework!TraceConfig:interface" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "tracing", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#version:member", @@ -3168,6 +3196,213 @@ "name": "Knative" } ] + }, + { + "kind": "Interface", + "canonicalReference": "@openfunction/functions-framework!TraceConfig:interface", + "docComment": "/**\n * The config of the trace.\n *\n * @public\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "export interface TraceConfig " + } + ], + "releaseTag": "Public", + "name": "TraceConfig", + "preserveMemberOrder": false, + "members": [ + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!TraceConfig#baggage:member", + "docComment": "/**\n * Trace baggage\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "baggage?: " + }, + { + "kind": "Reference", + "text": "Record", + "canonicalReference": "!Record:type" + }, + { + "kind": "Content", + "text": "" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "baggage", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 3 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!TraceConfig#enabled:member", + "docComment": "/**\n * This is trace switch\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "enabled: " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "enabled", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!TraceConfig#provider:member", + "docComment": "/**\n * Trace Provider\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "provider?: " + }, + { + "kind": "Reference", + "text": "TraceProvider", + "canonicalReference": "@openfunction/functions-framework!TraceProvider:interface" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "provider", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!TraceConfig#tags:member", + "docComment": "/**\n * Trace tags\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "tags?: " + }, + { + "kind": "Reference", + "text": "Record", + "canonicalReference": "!Record:type" + }, + { + "kind": "Content", + "text": "" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "tags", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 3 + } + } + ], + "extendsTokenRanges": [] + }, + { + "kind": "Interface", + "canonicalReference": "@openfunction/functions-framework!TraceProvider:interface", + "docComment": "/**\n * The trace provider info.\n *\n * @public\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "export interface TraceProvider " + } + ], + "releaseTag": "Public", + "name": "TraceProvider", + "preserveMemberOrder": false, + "members": [ + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!TraceProvider#name:member", + "docComment": "/**\n * Provider name Now is just support skywalking\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "name: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "name", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!TraceProvider#oapServer:member", + "docComment": "/**\n * OapServer address example [skywalking-oap:11800]\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "oapServer: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "oapServer", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "extendsTokenRanges": [] } ] } diff --git a/docs/generated/api.md b/docs/generated/api.md index 864c4d34..388c83ef 100644 --- a/docs/generated/api.md +++ b/docs/generated/api.md @@ -139,6 +139,7 @@ export interface OpenFunctionContext { postPlugins?: string[]; prePlugins?: string[]; runtime: `${RuntimeType}` | `${Capitalize}` | `${Uppercase}`; + tracing?: TraceConfig; version: string; } @@ -188,6 +189,20 @@ export enum RuntimeType { Knative = "knative" } +// @public +export interface TraceConfig { + baggage?: Record; + enabled: boolean; + provider?: TraceProvider; + tags?: Record; +} + +// @public +export interface TraceProvider { + name: string; + oapServer: string; +} + // (No @packageDocumentation comment for this package) ``` diff --git a/output-file.txt b/output-file.txt new file mode 100644 index 00000000..cda8cde4 --- /dev/null +++ b/output-file.txt @@ -0,0 +1 @@ +{"some":"payload"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 189f73a2..dfecfbba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,9 +18,11 @@ "http-terminator": "^3.2.0", "lodash": "^4.17.21", "minimist": "^1.2.6", + "node-fetch": "2.6.5", "on-finished": "^2.4.1", "read-pkg-up": "^7.0.1", - "semver": "^7.3.7" + "semver": "^7.3.7", + "skywalking-backend-js": "^0.5.1" }, "bin": { "functions-framework": "build/src/main.js", @@ -93,6 +95,24 @@ "node": ">=6.9.0" } }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmmirror.com/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@dabh/diagnostics": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", + "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==", + "dependencies": { + "colorspace": "1.1.x", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, "node_modules/@dapr/dapr": { "version": "2.3.1", "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.1.tgz", @@ -108,6 +128,25 @@ "uuid": "^8.3.2" } }, + "node_modules/@dapr/dapr/node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -1214,6 +1253,11 @@ "node": ">=8" } }, + "node_modules/async": { + "version": "3.2.4", + "resolved": "https://registry.npmmirror.com/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1231,15 +1275,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/axios": { - "version": "0.25.0", - "resolved": "https://registry.npmmirror.com/axios/-/axios-0.25.0.tgz", - "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", - "dev": true, - "dependencies": { - "follow-redirects": "^1.14.7" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1728,6 +1763,15 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, + "node_modules/color": { + "version": "3.2.1", + "resolved": "https://registry.npmmirror.com/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "dependencies": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -1741,6 +1785,15 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmmirror.com/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, "node_modules/colors": { "version": "1.2.5", "resolved": "https://registry.npmmirror.com/colors/-/colors-1.2.5.tgz", @@ -1750,6 +1803,15 @@ "node": ">=0.1.90" } }, + "node_modules/colorspace": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/colorspace/-/colorspace-1.1.4.tgz", + "integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==", + "dependencies": { + "color": "^3.1.3", + "text-hex": "1.0.x" + } + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -2301,6 +2363,11 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, + "node_modules/enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==" + }, "node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -3132,6 +3199,11 @@ "integrity": "sha512-XBU9RXeoYc2/VnvMhplAxEmZLfIk7cvTBu+xwoBuTI8pL19E03cmca17QQycKIdxgwCeFA/a4u27gv1h3ya5LQ==", "dev": true }, + "node_modules/fecha": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/fecha/-/fecha-4.2.3.tgz", + "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==" + }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -3241,6 +3313,11 @@ "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", "dev": true }, + "node_modules/fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" + }, "node_modules/follow-redirects": { "version": "1.14.9", "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.14.9.tgz", @@ -3820,6 +3897,17 @@ "node": ">=10.17.0" } }, + "node_modules/husky": { + "version": "7.0.4", + "resolved": "https://registry.npmmirror.com/husky/-/husky-7.0.4.tgz", + "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/hyperid": { "version": "3.0.1", "resolved": "https://registry.npmmirror.com/hyperid/-/hyperid-3.0.1.tgz", @@ -4321,7 +4409,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, "engines": { "node": ">=8" }, @@ -4529,6 +4616,11 @@ "node": ">=0.10.0" } }, + "node_modules/kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" + }, "node_modules/latest-version": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", @@ -4690,6 +4782,18 @@ "node": ">=8" } }, + "node_modules/logform": { + "version": "2.4.2", + "resolved": "https://registry.npmmirror.com/logform/-/logform-2.4.2.tgz", + "integrity": "sha512-W4c9himeAwXEdZ05dQNerhFz2XG80P9Oj0loPUMV23VC2it0orMHQhJm4hdnnor3rd1HsGf6a2lPwBM1zeXHGw==", + "dependencies": { + "@colors/colors": "1.5.0", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "safe-stable-stringify": "^2.3.1", + "triple-beam": "^1.3.0" + } + }, "node_modules/long": { "version": "4.0.0", "resolved": "https://registry.npmmirror.com/long/-/long-4.0.0.tgz", @@ -5275,22 +5379,14 @@ } }, "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "version": "2.6.5", + "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "dependencies": { "whatwg-url": "^5.0.0" }, "engines": { "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } } }, "node_modules/normalize-package-data": { @@ -5428,6 +5524,14 @@ "wrappy": "1" } }, + "node_modules/one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "dependencies": { + "fn.name": "1.x.x" + } + }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -6066,7 +6170,6 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -6329,6 +6432,14 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/safe-stable-stringify": { + "version": "2.3.1", + "resolved": "https://registry.npmmirror.com/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz", + "integrity": "sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg==", + "engines": { + "node": ">=10" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -6506,6 +6617,19 @@ "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==", "dev": true }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmmirror.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/simple-swizzle/node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmmirror.com/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + }, "node_modules/sinon": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.0.tgz", @@ -6554,6 +6678,26 @@ "node": ">=8" } }, + "node_modules/skywalking-backend-js": { + "version": "0.5.1", + "resolved": "https://registry.npmmirror.com/skywalking-backend-js/-/skywalking-backend-js-0.5.1.tgz", + "integrity": "sha512-gu56s9n+581pt1Aw/N3zf6pe/ulLq6FVXfRzqSRiAc6W8w0kaKZBl72S/Epz6cgD1/LmMS151Za09sfVzBBjsA==", + "hasInstallScript": true, + "dependencies": { + "@grpc/grpc-js": "^1.6.7", + "google-protobuf": "^3.14.0", + "husky": "^7.0.4", + "semver": "^7.3.2", + "tslib": "^2.0.3", + "uuid": "^8.1.0", + "winston": "^3.2.1" + } + }, + "node_modules/skywalking-backend-js/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -6672,6 +6816,14 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "node_modules/stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmmirror.com/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==", + "engines": { + "node": "*" + } + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -6684,7 +6836,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, "dependencies": { "safe-buffer": "~5.2.0" } @@ -6693,7 +6844,6 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, "funding": [ { "type": "github", @@ -6917,6 +7067,11 @@ "node": ">= 8" } }, + "node_modules/text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -6999,6 +7154,11 @@ "node": ">=8" } }, + "node_modules/triple-beam": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/triple-beam/-/triple-beam-1.3.0.tgz", + "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" + }, "node_modules/trouter": { "version": "3.2.0", "resolved": "https://registry.npmmirror.com/trouter/-/trouter-3.2.0.tgz", @@ -7294,8 +7454,7 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "node_modules/utils-merge": { "version": "1.0.1", @@ -7370,6 +7529,15 @@ "node": ">=10.0.0" } }, + "node_modules/wait-on/node_modules/axios": { + "version": "0.25.0", + "resolved": "https://registry.npmmirror.com/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.14.7" + } + }, "node_modules/wait-on/node_modules/rxjs": { "version": "7.5.5", "resolved": "https://registry.npmmirror.com/rxjs/-/rxjs-7.5.5.tgz", @@ -7460,6 +7628,39 @@ "node": ">=8" } }, + "node_modules/winston": { + "version": "3.8.1", + "resolved": "https://registry.npmmirror.com/winston/-/winston-3.8.1.tgz", + "integrity": "sha512-r+6YAiCR4uI3N8eQNOg8k3P3PqwAm20cLKlzVD9E66Ch39+LZC+VH1UKf9JemQj2B3QoUHfKD7Poewn0Pr3Y1w==", + "dependencies": { + "@dabh/diagnostics": "^2.0.2", + "async": "^3.2.3", + "is-stream": "^2.0.0", + "logform": "^2.4.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "safe-stable-stringify": "^2.3.1", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.5.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/winston-transport": { + "version": "4.5.0", + "resolved": "https://registry.npmmirror.com/winston-transport/-/winston-transport-4.5.0.tgz", + "integrity": "sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==", + "dependencies": { + "logform": "^2.3.2", + "readable-stream": "^3.6.0", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 6.4.0" + } + }, "node_modules/word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -7700,6 +7901,21 @@ "js-tokens": "^4.0.0" } }, + "@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmmirror.com/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==" + }, + "@dabh/diagnostics": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", + "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==", + "requires": { + "colorspace": "1.1.x", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, "@dapr/dapr": { "version": "2.3.1", "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.1.tgz", @@ -7713,6 +7929,16 @@ "node-fetch": "^2.6.1", "restana": "^4.9.1", "uuid": "^8.3.2" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + } + } } }, "@eslint/eslintrc": { @@ -8643,6 +8869,11 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, + "async": { + "version": "3.2.4", + "resolved": "https://registry.npmmirror.com/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -8654,15 +8885,6 @@ "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" }, - "axios": { - "version": "0.25.0", - "resolved": "https://registry.npmmirror.com/axios/-/axios-0.25.0.tgz", - "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", - "dev": true, - "requires": { - "follow-redirects": "^1.14.7" - } - }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -9044,6 +9266,15 @@ } } }, + "color": { + "version": "3.2.1", + "resolved": "https://registry.npmmirror.com/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "requires": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -9057,12 +9288,30 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, + "color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmmirror.com/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, "colors": { "version": "1.2.5", "resolved": "https://registry.npmmirror.com/colors/-/colors-1.2.5.tgz", "integrity": "sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==", "dev": true }, + "colorspace": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/colorspace/-/colorspace-1.1.4.tgz", + "integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==", + "requires": { + "color": "^3.1.3", + "text-hex": "1.0.x" + } + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -9490,6 +9739,11 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, + "enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==" + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -10117,6 +10371,11 @@ "integrity": "sha512-XBU9RXeoYc2/VnvMhplAxEmZLfIk7cvTBu+xwoBuTI8pL19E03cmca17QQycKIdxgwCeFA/a4u27gv1h3ya5LQ==", "dev": true }, + "fecha": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/fecha/-/fecha-4.2.3.tgz", + "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==" + }, "figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -10204,6 +10463,11 @@ "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", "dev": true }, + "fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" + }, "follow-redirects": { "version": "1.14.9", "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.14.9.tgz", @@ -10619,6 +10883,11 @@ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true }, + "husky": { + "version": "7.0.4", + "resolved": "https://registry.npmmirror.com/husky/-/husky-7.0.4.tgz", + "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==" + }, "hyperid": { "version": "3.0.1", "resolved": "https://registry.npmmirror.com/hyperid/-/hyperid-3.0.1.tgz", @@ -10968,8 +11237,7 @@ "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" }, "is-string": { "version": "1.0.7", @@ -11132,6 +11400,11 @@ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, + "kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" + }, "latest-version": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", @@ -11259,6 +11532,18 @@ } } }, + "logform": { + "version": "2.4.2", + "resolved": "https://registry.npmmirror.com/logform/-/logform-2.4.2.tgz", + "integrity": "sha512-W4c9himeAwXEdZ05dQNerhFz2XG80P9Oj0loPUMV23VC2it0orMHQhJm4hdnnor3rd1HsGf6a2lPwBM1zeXHGw==", + "requires": { + "@colors/colors": "1.5.0", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "safe-stable-stringify": "^2.3.1", + "triple-beam": "^1.3.0" + } + }, "long": { "version": "4.0.0", "resolved": "https://registry.npmmirror.com/long/-/long-4.0.0.tgz", @@ -11691,9 +11976,9 @@ } }, "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "version": "2.6.5", + "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "requires": { "whatwg-url": "^5.0.0" } @@ -11802,6 +12087,14 @@ "wrappy": "1" } }, + "one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "requires": { + "fn.name": "1.x.x" + } + }, "onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -12276,7 +12569,6 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -12460,6 +12752,11 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "safe-stable-stringify": { + "version": "2.3.1", + "resolved": "https://registry.npmmirror.com/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz", + "integrity": "sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg==" + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -12610,6 +12907,21 @@ "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==", "dev": true }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmmirror.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "requires": { + "is-arrayish": "^0.3.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmmirror.com/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + } + } + }, "sinon": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.0.tgz", @@ -12650,6 +12962,27 @@ } } }, + "skywalking-backend-js": { + "version": "0.5.1", + "resolved": "https://registry.npmmirror.com/skywalking-backend-js/-/skywalking-backend-js-0.5.1.tgz", + "integrity": "sha512-gu56s9n+581pt1Aw/N3zf6pe/ulLq6FVXfRzqSRiAc6W8w0kaKZBl72S/Epz6cgD1/LmMS151Za09sfVzBBjsA==", + "requires": { + "@grpc/grpc-js": "^1.6.7", + "google-protobuf": "^3.14.0", + "husky": "^7.0.4", + "semver": "^7.3.2", + "tslib": "^2.0.3", + "uuid": "^8.1.0", + "winston": "^3.2.1" + }, + "dependencies": { + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + } + } + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -12749,6 +13082,11 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmmirror.com/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==" + }, "statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -12758,7 +13096,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, "requires": { "safe-buffer": "~5.2.0" }, @@ -12766,8 +13103,7 @@ "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" } } }, @@ -12931,6 +13267,11 @@ "yallist": "^4.0.0" } }, + "text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -12995,6 +13336,11 @@ "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true }, + "triple-beam": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/triple-beam/-/triple-beam-1.3.0.tgz", + "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" + }, "trouter": { "version": "3.2.0", "resolved": "https://registry.npmmirror.com/trouter/-/trouter-3.2.0.tgz", @@ -13218,8 +13564,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "utils-merge": { "version": "1.0.1", @@ -13276,6 +13621,15 @@ "rxjs": "^7.5.4" }, "dependencies": { + "axios": { + "version": "0.25.0", + "resolved": "https://registry.npmmirror.com/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", + "dev": true, + "requires": { + "follow-redirects": "^1.14.7" + } + }, "rxjs": { "version": "7.5.5", "resolved": "https://registry.npmmirror.com/rxjs/-/rxjs-7.5.5.tgz", @@ -13350,6 +13704,33 @@ "string-width": "^4.0.0" } }, + "winston": { + "version": "3.8.1", + "resolved": "https://registry.npmmirror.com/winston/-/winston-3.8.1.tgz", + "integrity": "sha512-r+6YAiCR4uI3N8eQNOg8k3P3PqwAm20cLKlzVD9E66Ch39+LZC+VH1UKf9JemQj2B3QoUHfKD7Poewn0Pr3Y1w==", + "requires": { + "@dabh/diagnostics": "^2.0.2", + "async": "^3.2.3", + "is-stream": "^2.0.0", + "logform": "^2.4.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "safe-stable-stringify": "^2.3.1", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.5.0" + } + }, + "winston-transport": { + "version": "4.5.0", + "resolved": "https://registry.npmmirror.com/winston-transport/-/winston-transport-4.5.0.tgz", + "integrity": "sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==", + "requires": { + "logform": "^2.3.2", + "readable-stream": "^3.6.0", + "triple-beam": "^1.3.0" + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", diff --git a/package.json b/package.json index 92dd34a0..aac9c8c7 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,11 @@ "http-terminator": "^3.2.0", "lodash": "^4.17.21", "minimist": "^1.2.6", + "node-fetch": "2.6.5", "on-finished": "^2.4.1", "read-pkg-up": "^7.0.1", - "semver": "^7.3.7" + "semver": "^7.3.7", + "skywalking-backend-js": "^0.5.1" }, "scripts": { "test": "cross-env DEBUG=common:*,ofn:* mocha build/test -t 60000 --recursive --exit", diff --git a/src/loader.ts b/src/loader.ts index c77f687d..56a74766 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -31,6 +31,12 @@ import {Plugin, PluginStore, PluginMap} from './openfunction/plugin'; import {HandlerFunction} from './functions'; import {getRegisteredFunction} from './function_registry'; import {SignatureType} from './types'; +import {FrameworkOptions} from './options'; +import {OpenFunctionContext} from './openfunction/context'; +import { + SKYWALKINGNAME, + SkyWalkingPlugin, +} from './openfunction/plugin/skywalking/skywalking'; // Dynamic import function required to load user code packaged as an // ES module is only available on Node.js v13.2.0 and up. @@ -272,3 +278,47 @@ function getPluginsModulePath(codeLocation: string): string[] | null { return null; } } + +/** + * It loads BUIDIN type plugins from the /openfunction/plugin. + * @param context - The context of OpenFunction. + */ +export async function loadBuidInPlugins(options: FrameworkOptions) { + if (!options.context) { + console.warn("The context is undefined can't load BUIDIN type plugins"); + return; + } + const store = PluginStore.Instance(PluginStore.Type.BUILTIN); + //Provide system info for BUILDIN type plugins + + if (checkTraceConfig(options.context)) { + const skywalking = new SkyWalkingPlugin(options); + store.register(skywalking); + options.context.prePlugins?.push(SKYWALKINGNAME); + options.context.postPlugins?.push(SKYWALKINGNAME); + } +} + +/** + * It check trace config ,it will set default value if it is enbaled. + * @param tracing - The config of TraceConfig. + */ +function checkTraceConfig(context: OpenFunctionContext): boolean { + if (!context.tracing) { + console.warn('TraceConfig is invalid'); + return false; + } + if (!context.tracing.enabled) { + return false; + } + if (!context.tracing.tags) { + context.tracing.tags = {}; + } + //Set default trace provider config + context.tracing.provider = { + name: context.tracing.provider?.name || SKYWALKINGNAME, + oapServer: context.tracing.provider?.oapServer || '127.0.0.1:11800', + }; + + return true; +} diff --git a/src/main.ts b/src/main.ts index 0833bdf9..391848da 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,7 +23,7 @@ import {createHttpTerminator} from 'http-terminator'; import getAysncServer from './openfunction/async_server'; import {OpenFunctionContext, ContextUtils} from './openfunction/context'; -import {getUserFunction, getFunctionPlugins} from './loader'; +import {getUserFunction, getFunctionPlugins, loadBuidInPlugins} from './loader'; import {ErrorHandler} from './invoker'; import {getServer} from './server'; import {parseOptions, helpText, OptionsError} from './options'; @@ -54,6 +54,8 @@ export const main = async () => { } const {userFunction, signatureType} = loadedFunction; + // First load BUIDIN type plugin + await loadBuidInPlugins(options); // Load function plugins before starting server await getFunctionPlugins(options.sourceLocation); diff --git a/src/openfunction/context.ts b/src/openfunction/context.ts index f2ac10ba..a0689c40 100644 --- a/src/openfunction/context.ts +++ b/src/openfunction/context.ts @@ -38,6 +38,10 @@ export interface OpenFunctionContext { * Optional plugins to be executed after user function. */ postPlugins?: string[]; + /** + * Optional trace config + */ + tracing?: TraceConfig; } /** @@ -147,3 +151,43 @@ export class ContextUtils { return component?.componentType.split('.')[0] === ComponentType.PubSub; } } + +/** + * The config of the trace. + * @public + */ +export interface TraceConfig { + /** + * This is trace switch + */ + enabled: boolean; + /** + * Trace Provider + */ + provider?: TraceProvider; + /** + * Trace tags + */ + tags?: Record; + /** + * Trace baggage + */ + baggage?: Record; +} + +/** + * The trace provider info. + * @public + */ +export interface TraceProvider { + /** + * Provider name + * Now is just support skywalking + */ + name: string; + /** + * OapServer address + * example [skywalking-oap:11800] + */ + oapServer: string; +} diff --git a/src/openfunction/plugin/skywalking/skywalking.ts b/src/openfunction/plugin/skywalking/skywalking.ts new file mode 100644 index 00000000..33bed7ce --- /dev/null +++ b/src/openfunction/plugin/skywalking/skywalking.ts @@ -0,0 +1,114 @@ +import {forEach} from 'lodash'; +import agent, {ContextManager} from 'skywalking-backend-js'; +import SpanContext from 'skywalking-backend-js/lib/trace/context/SpanContext'; +import {SpanLayer} from 'skywalking-backend-js/lib/proto/language-agent/Tracing_pb'; +import {Component} from 'skywalking-backend-js/lib/trace/Component'; +import {Tag} from 'skywalking-backend-js/lib/Tag'; +import Span from 'skywalking-backend-js/lib/trace/span/Span'; +import Context from 'skywalking-backend-js/lib/trace/context/Context'; + +import {Plugin} from '../../plugin'; +import {OpenFunctionRuntime} from '../../runtime'; +import {TraceConfig} from '../../context'; +import {FrameworkOptions} from '../../../options'; + +// https://github.com/apache/skywalking/blob/master/oap-server/server-starter/src/main/resources/component-libraries.yml#L515 +const componentIDOpenFunction = new Component(5013); + +export const SKYWALKINGNAME = 'skywalking'; + +class Trace { + private span: Span; + private spanContext: Context; + + constructor(functionName: string) { + this.spanContext = ContextManager.hasContext + ? ContextManager.current + : new SpanContext(); + + this.span = this.spanContext.newEntrySpan(`/${functionName}`, undefined); + } + + async start(tags: Array): Promise { + forEach(tags, tag => { + this.span.tag(tag); + }); + this.span.layer = SpanLayer.FAAS; + this.span.component = componentIDOpenFunction; + this.span.start(); + this.span.async(); + return this.spanContext.traceId(); + } + + async stop() { + this.span.stop(); + this.spanContext.stop(this.span); + await agent.flush(); + } +} + +/** + * Defining an class to provide trace ability alugin by skywalking . + * @public + **/ +export class SkyWalkingPlugin extends Plugin { + private trace: Trace | undefined; + private tags: Array = []; + private functionName = 'function'; + + constructor(options: FrameworkOptions) { + super(SKYWALKINGNAME, 'v1'); + + this.functionName = options.target; + + // Start skywalking agent + agent.start({ + serviceName: this.functionName, + serviceInstance: 'openfunctionInstance', + collectorAddress: options.context!.tracing!.provider!.oapServer, + }); + + if (!options.context!.tracing!.tags) { + options.context!.tracing!.tags = {}; + } + options.context!.tracing!.tags!['RuntimeType'] = + options.context?.runtime || 'Knative'; + this.iniAttribute(options.context!.tracing!); + } + + iniAttribute(traceConfig: TraceConfig) { + for (const key in traceConfig.tags) { + this.tags.push({ + key, + val: traceConfig.tags[key], + overridable: false, + }); + } + } + + async execPreHook( + ctx: OpenFunctionRuntime | null, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + plugins: Record + ) { + if (ctx === null) { + console.warn('OpenFunctionRuntime [ctx] is null'); + return; + } + this.trace = new Trace(this.functionName); + const traceId = await this.trace.start(this.tags); + ctx.locals.traceId = traceId; + } + + async execPostHook( + ctx: OpenFunctionRuntime | null, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + plugins: Record + ) { + if (ctx === null) { + console.warn('OpenFunctionRuntime [ctx] is null'); + return; + } + await this.trace?.stop(); + } +} diff --git a/src/openfunction/runtime.ts b/src/openfunction/runtime.ts index ab758e4d..85b3f887 100644 --- a/src/openfunction/runtime.ts +++ b/src/openfunction/runtime.ts @@ -115,8 +115,8 @@ export abstract class OpenFunctionRuntime { await userFunction(ctx, data); // Execute pre hooks, system plugins go last - await userPlugins.execPostHooks(ctx); await sysPlugins.execPostHooks(ctx); + await userPlugins.execPostHooks(ctx); }; } diff --git a/test/data/plugins/counters.mjs b/test/data/plugins/counters.mjs index 5ba83214..1bb8b445 100644 --- a/test/data/plugins/counters.mjs +++ b/test/data/plugins/counters.mjs @@ -49,7 +49,10 @@ export class Countdown extends Plugin { this.countdown(ctx, plugins); // Try to end the test if necessary - if (this.current === this.end) ctx.locals.done?.(); + if (this.current === this.end) { + ctx.locals.app.stop(); + ctx.locals.done?.(); + } } countdown(ctx, plugins) { diff --git a/test/data/plugins/skywalking_assist.mjs b/test/data/plugins/skywalking_assist.mjs new file mode 100644 index 00000000..15924f9e --- /dev/null +++ b/test/data/plugins/skywalking_assist.mjs @@ -0,0 +1,35 @@ +import assert from 'assert'; +import {Plugin} from '../../../build/src/index.js'; +import {query,OapServer,sleep} from '../../../build/test/integration/build_in_plugin.js' +//Help to verify skywalking plugin +export class Assist extends Plugin { + constructor() { + super('assist', 'v1'); + } + + async execPreHook(ctx, plugins) { + } + + async execPostHook(ctx, plugins) { + const traceId = ctx.locals.traceId; + const options = ctx.locals.options; + sleep(3000).then(()=>{ + query(traceId,OapServer).then(res=>{ + res.json().then(res=>{ + if(res.data.trace.spans.length >=0){ + let target = null; + for (const item of res.data.trace.spans) { + if (item.endpointName === `/${options.target}`) { + target = item; + } + } + assert(target !== null); + assert(target.endpointName === `/${options.target}`); + + ctx.locals.done?.(); + } + }) + }) + }) + } + } \ No newline at end of file diff --git a/test/integration/async_server.ts b/test/integration/async_server.ts index 8009a44e..c70491d7 100644 --- a/test/integration/async_server.ts +++ b/test/integration/async_server.ts @@ -157,6 +157,7 @@ describe('OpenFunction - Async', () => { // Passthrough test done handler ctx.locals.done = done; + ctx.locals.app = app; }, { ...TEST_CONTEXT, diff --git a/test/integration/build_in_plugin.ts b/test/integration/build_in_plugin.ts new file mode 100644 index 00000000..42a1dfb7 --- /dev/null +++ b/test/integration/build_in_plugin.ts @@ -0,0 +1,232 @@ +import {ifError, notStrictEqual, deepStrictEqual, ok} from 'assert'; +import {createServer} from 'net'; +import {execSync} from 'child_process'; + +import {get} from 'lodash'; +import * as shell from 'shelljs'; +import * as MQTT from 'aedes'; +import fetch from 'node-fetch'; + +import {FrameworkOptions} from '../../src/options'; +import {SKYWALKINGNAME} from '../../src/openfunction/plugin/skywalking/skywalking'; +import {PluginStore} from '../../src/openfunction/plugin'; +import {OpenFunctionRuntime} from '../../src/openfunction/runtime'; +import {OpenFunctionContext} from '../../src/openfunction/context'; +import getAysncServer from '../../src/openfunction/async_server'; +import {getFunctionPlugins, loadBuidInPlugins} from '../../src/loader'; + +import {Context} from '../data/mock'; + +const TEST_CONTEXT = Context.AsyncBase; + +export const OapServer = '127.0.0.1:12800'; + +export const sleep = (val: number) => { + return new Promise(resolve => setTimeout(resolve, val)); +}; + +export const query = async (traceId: string, url: string) => { + const body = { + query: `query queryTrace($traceId: ID!) { + trace: queryTrace(traceId: $traceId) { + spans { + traceId + segmentId + spanId + parentSpanId + refs { + traceId + parentSegmentId + parentSpanId + type + } + serviceCode + startTime + endTime + endpointName + type + peer + component + isError + layer + tags { + key + value + } + logs { + time + data { + key + value + } + } + } + } + }`, + variables: { + traceId, + }, + }; + return await fetch(`http://${url}/graphql`, { + method: 'POST', + body: JSON.stringify(body), + }); +}; + +//Verify skywalking proccess , start it if not exist +export const checkSkyWalkingProcess = async ( + reCheck: boolean +): Promise => { + try { + const buffer = execSync('docker ps -a').toString(); + + let flag = false; + for (const line of buffer.split('\n')) { + if (line.indexOf('apache/skywalking-oap-server:8.4.0-es6') !== -1) { + if (line.indexOf('Up') !== -1) { + console.log('skywalking oap server is start'); + flag = true; + } else if (line.indexOf('Exited') !== -1) { + console.log('skywalking oap server is stop , now start it '); + console.log( + execSync('docker start ' + line.substring(0, 13)).toString() + ); + flag = true; + } + break; + } + } + if (!flag) { + const startCmd = + 'docker run -d --name oap -p 12800:12800 -p 11800:11800 apache/skywalking-oap-server:8.4.0-es6'; + execSync(startCmd); + console.log(startCmd); + return reCheck ? false : checkSkyWalkingProcess(true); + } + } catch (error) { + console.log('start fail'); + return false; + } + return true; +}; +describe('Build in plugin', () => { + const APPID = 'async.dapr'; + const broker = MQTT.Server(); + const server = createServer(broker.handle); + before(done => { + // Start simple plain MQTT server via aedes + server.listen(1883, () => { + // Try to run Dapr sidecar and listen for the async server + shell.exec( + `dapr run -H 3500 -G 50001 -p ${TEST_CONTEXT.port} -d ./test/data/components/async -a ${APPID} --log-level debug`, + { + silent: true, + async: true, + } + ); + done(); + }); + }); + + after(done => { + // Stop dapr sidecar process + shell.exec(`dapr stop ${APPID}`, { + silent: true, + }); + server.close(); + broker.close(done); + }); + + it('mqtt binding w/ skywalking plugin', done => { + const options: FrameworkOptions = { + target: 'test', + port: '', + sourceLocation: '', + signatureType: 'http', + printHelp: false, + context: { + ...TEST_CONTEXT, + tracing: { + enabled: true, + }, + prePlugins: ['assist'], + postPlugins: ['assist'], + }, + }; + getFunctionPlugins(process.cwd() + '/test/data').then(plugins => { + loadBuidInPlugins(options).then(() => { + const start = get(plugins!.numbers, 'oct'); + + const app = getAysncServer((ctx, data) => { + notStrictEqual(ctx.locals.traceId, null || undefined); + // Passthrough test done handler + ctx.locals.done = done; + ctx.locals.app = app; + ctx.locals.options = options; + ctx.send({some: 'payload'}); + }, options.context!); + + // First, we start the async server + app.start().then(() => { + // Then, we send a number as start value to user function + broker.publish( + { + cmd: 'publish', + topic: 'default', + payload: JSON.stringify({start}), + qos: 0, + retain: false, + dup: false, + }, + err => ifError(err) + ); + }); + }); + }); + }); + + it('skywalking plugin', async () => { + const options = { + target: 'test', + context: { + ...TEST_CONTEXT, + tracing: { + enabled: true, + }, + }, + }; + ok((await checkSkyWalkingProcess(false)) === true); + await loadBuidInPlugins(options as FrameworkOptions); + const skywalking = PluginStore.Instance(1).get(SKYWALKINGNAME); + ok(skywalking.name === SKYWALKINGNAME); + + const runtime = OpenFunctionRuntime.ProxyContext( + options.context as OpenFunctionContext + ); + await skywalking.execPreHook(runtime, {}); + const traceId = runtime.locals.traceId; + await sleep(2000); + await skywalking.execPostHook(runtime, {}); + console.log(traceId); + const response = query(traceId, OapServer); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const data = (await (await response).json()) as any; + console.log(data); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let target: unknown | any = null; + for (const item of data.data.trace.spans) { + console.log(item.serviceCode); + if (item.endpointName === `/${options.target}`) { + target = item; + } + } + notStrictEqual(target, null); + deepStrictEqual(target.endpointName, `/${options.target}`); + + for (const tag in target.tags) { + if (tag === 'RuntimeType') { + ok(target.tags[tag] === options.context.runtime); + } + } + }); +}); From f43cfa3a0952fb38b381417cf56afa5718665098 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Sep 2022 03:33:55 +0000 Subject: [PATCH 36/42] chore(deps): bump actions/stale from 5.1.1 to 5.2.0 Bumps [actions/stale](https://github.com/actions/stale) from 5.1.1 to 5.2.0. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v5.1.1...v5.2.0) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 837b2df1..f9004967 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Prune Stale - uses: actions/stale@v5.1.1 + uses: actions/stale@v5.2.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-issue-stale: 60 From 875236743d24394445fce77e31fc735a5769e0ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Sep 2022 04:02:26 +0000 Subject: [PATCH 37/42] chore(deps): bump actions/stale from 5.2.0 to 6.0.0 Bumps [actions/stale](https://github.com/actions/stale) from 5.2.0 to 6.0.0. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v5.2.0...v6.0.0) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index f9004967..71665d55 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Prune Stale - uses: actions/stale@v5.2.0 + uses: actions/stale@v6.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-issue-stale: 60 From d525d2f09729ade2c079f4909fa348b5f66a0800 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 8 Oct 2022 17:11:54 +0800 Subject: [PATCH 38/42] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(plugin/trac?= =?UTF-8?q?ing):=20reconstruct=20skywalking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- docs/generated/api.json | 339 ++- docs/generated/api.md | 26 +- output-file.txt | 1 - package-lock.json | 2221 ++++------------- package.json | 28 +- src/loader.ts | 76 +- src/main.ts | 11 +- src/openfunction/context.ts | 61 +- src/openfunction/plugin.ts | 44 +- .../plugin/skywalking/skywalking.ts | 114 - src/openfunction/plugins/index.ts | 3 + src/openfunction/plugins/tracing/index.ts | 77 + .../plugins/tracing/skywalking.ts | 114 + src/openfunction/runtime.ts | 22 +- test/data/mock/context.ts | 21 +- test/data/plugins/skywalking.mjs | 56 + test/data/plugins/skywalking_assist.mjs | 35 - test/integration/build_in_plugin.ts | 232 -- test/integration/http_binding.ts | 69 +- 19 files changed, 1157 insertions(+), 2393 deletions(-) delete mode 100644 output-file.txt delete mode 100644 src/openfunction/plugin/skywalking/skywalking.ts create mode 100644 src/openfunction/plugins/index.ts create mode 100644 src/openfunction/plugins/tracing/index.ts create mode 100644 src/openfunction/plugins/tracing/skywalking.ts create mode 100644 test/data/plugins/skywalking.mjs delete mode 100644 test/data/plugins/skywalking_assist.mjs delete mode 100644 test/integration/build_in_plugin.ts diff --git a/docs/generated/api.json b/docs/generated/api.json index b83f66fd..9b12d3f4 100644 --- a/docs/generated/api.json +++ b/docs/generated/api.json @@ -1,7 +1,7 @@ { "metadata": { "toolPackage": "@microsoft/api-extractor", - "toolVersion": "7.29.3", + "toolVersion": "7.32.0", "schemaVersion": 1009, "oldestForwardsCompatibleVersion": 1001, "tsdocConfig": { @@ -1191,7 +1191,7 @@ { "kind": "Reference", "text": "Request", - "canonicalReference": "@openfunction/functions-framework!Request:interface" + "canonicalReference": "@openfunction/functions-framework!Request_2:interface" }, { "kind": "Content", @@ -1200,7 +1200,7 @@ { "kind": "Reference", "text": "Response", - "canonicalReference": "@types/express!~e.Response:interface" + "canonicalReference": "@types/express!e.Response:interface" }, { "kind": "Content", @@ -1561,68 +1561,6 @@ "endIndex": 4 } }, - { - "kind": "Interface", - "canonicalReference": "@openfunction/functions-framework!OpenFunctionBinding:interface", - "docComment": "/**\n * The binding interface of the context.\n *\n * @public\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "export interface OpenFunctionBinding " - } - ], - "releaseTag": "Public", - "name": "OpenFunctionBinding", - "preserveMemberOrder": false, - "members": [ - { - "kind": "IndexSignature", - "canonicalReference": "@openfunction/functions-framework!OpenFunctionBinding:index(1)", - "docComment": "/**\n * The hash map of the binding.\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "[key: " - }, - { - "kind": "Content", - "text": "string" - }, - { - "kind": "Content", - "text": "]: " - }, - { - "kind": "Reference", - "text": "OpenFunctionComponent", - "canonicalReference": "@openfunction/functions-framework!OpenFunctionComponent:interface" - }, - { - "kind": "Content", - "text": ";" - } - ], - "isReadonly": false, - "returnTypeTokenRange": { - "startIndex": 3, - "endIndex": 4 - }, - "releaseTag": "Public", - "overloadIndex": 1, - "parameters": [ - { - "parameterName": "key", - "parameterTypeTokenRange": { - "startIndex": 1, - "endIndex": 2 - }, - "isOptional": false - } - ] - } - ], - "extendsTokenRanges": [] - }, { "kind": "Interface", "canonicalReference": "@openfunction/functions-framework!OpenFunctionComponent:interface", @@ -1814,8 +1752,21 @@ }, { "kind": "Reference", - "text": "OpenFunctionBinding", - "canonicalReference": "@openfunction/functions-framework!OpenFunctionBinding:interface" + "text": "Record", + "canonicalReference": "!Record:type" + }, + { + "kind": "Content", + "text": "" }, { "kind": "Content", @@ -1828,7 +1779,7 @@ "name": "inputs", "propertyTypeTokenRange": { "startIndex": 1, - "endIndex": 2 + "endIndex": 5 } }, { @@ -1869,8 +1820,21 @@ }, { "kind": "Reference", - "text": "OpenFunctionBinding", - "canonicalReference": "@openfunction/functions-framework!OpenFunctionBinding:interface" + "text": "Record", + "canonicalReference": "!Record:type" + }, + { + "kind": "Content", + "text": "" }, { "kind": "Content", @@ -1881,6 +1845,34 @@ "isOptional": true, "releaseTag": "Public", "name": "outputs", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 5 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#pluginsTracing:member", + "docComment": "/**\n * Optional trace plugin config.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "pluginsTracing?: " + }, + { + "kind": "Reference", + "text": "TraceConfig", + "canonicalReference": "@openfunction/functions-framework!TraceConfig:interface" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "pluginsTracing", "propertyTypeTokenRange": { "startIndex": 1, "endIndex": 2 @@ -2039,34 +2031,6 @@ "endIndex": 12 } }, - { - "kind": "PropertySignature", - "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#tracing:member", - "docComment": "/**\n * Optional trace config\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "tracing?: " - }, - { - "kind": "Reference", - "text": "TraceConfig", - "canonicalReference": "@openfunction/functions-framework!TraceConfig:interface" - }, - { - "kind": "Content", - "text": ";" - } - ], - "isReadonly": false, - "isOptional": true, - "releaseTag": "Public", - "name": "tracing", - "propertyTypeTokenRange": { - "startIndex": 1, - "endIndex": 2 - } - }, { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!OpenFunctionContext#version:member", @@ -2174,6 +2138,36 @@ "isStatic": false, "isProtected": true }, + { + "kind": "Property", + "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime#error:member", + "docComment": "/**\n * The optional error object to hold exception data.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "error?: " + }, + { + "kind": "Reference", + "text": "Error", + "canonicalReference": "!Error:interface" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "error", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "isStatic": false, + "isProtected": false + }, { "kind": "Method", "canonicalReference": "@openfunction/functions-framework!OpenFunctionRuntime#getPlugin:member(1)", @@ -2194,7 +2188,7 @@ { "kind": "Reference", "text": "Plugin", - "canonicalReference": "@openfunction/functions-framework!Plugin:class" + "canonicalReference": "@openfunction/functions-framework!Plugin_2:class" }, { "kind": "Content", @@ -2366,7 +2360,7 @@ { "kind": "Reference", "text": "Request", - "canonicalReference": "@types/express!~e.Request:interface" + "canonicalReference": "@types/express!e.Request:interface" }, { "kind": "Content", @@ -2384,7 +2378,7 @@ { "kind": "Reference", "text": "ParsedQs", - "canonicalReference": "@types/qs!~QueryString.ParsedQs:interface" + "canonicalReference": "@types/qs!QueryString.ParsedQs:interface" }, { "kind": "Content", @@ -2427,7 +2421,7 @@ { "kind": "Reference", "text": "Response", - "canonicalReference": "@types/express!~e.Response:interface" + "canonicalReference": "@types/express!e.Response:interface" }, { "kind": "Content", @@ -2538,7 +2532,7 @@ { "kind": "Reference", "text": "Request", - "canonicalReference": "@types/express!~e.Request:interface" + "canonicalReference": "@types/express!e.Request:interface" }, { "kind": "Content", @@ -2547,7 +2541,7 @@ { "kind": "Reference", "text": "Response", - "canonicalReference": "@types/express!~e.Response:interface" + "canonicalReference": "@types/express!e.Response:interface" }, { "kind": "Content", @@ -2632,7 +2626,7 @@ { "kind": "Reference", "text": "OpenFunctionTrigger", - "canonicalReference": "@openfunction/functions-framework!OpenFunctionTrigger:type" + "canonicalReference": "@openfunction/functions-framework!~OpenFunctionTrigger:type" }, { "kind": "Content", @@ -2832,7 +2826,7 @@ { "kind": "Reference", "text": "Plugin", - "canonicalReference": "@openfunction/functions-framework!Plugin:class" + "canonicalReference": "@openfunction/functions-framework!Plugin_2:class" }, { "kind": "Content", @@ -2919,7 +2913,7 @@ { "kind": "Reference", "text": "Plugin", - "canonicalReference": "@openfunction/functions-framework!Plugin:class" + "canonicalReference": "@openfunction/functions-framework!Plugin_2:class" }, { "kind": "Content", @@ -3092,7 +3086,7 @@ { "kind": "Reference", "text": "ExpressRequest", - "canonicalReference": "@types/express!~e.Request:interface" + "canonicalReference": "@types/express!e.Request:interface" }, { "kind": "Content", @@ -3200,7 +3194,7 @@ { "kind": "Interface", "canonicalReference": "@openfunction/functions-framework!TraceConfig:interface", - "docComment": "/**\n * The config of the trace.\n *\n * @public\n */\n", + "docComment": "/**\n * The config of the trace plugin.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3214,7 +3208,7 @@ { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!TraceConfig#baggage:member", - "docComment": "/**\n * Trace baggage\n */\n", + "docComment": "/**\n * Optional baggage of the tracer\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3246,7 +3240,7 @@ { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!TraceConfig#enabled:member", - "docComment": "/**\n * This is trace switch\n */\n", + "docComment": "/**\n * Switch of the tracer\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3273,11 +3267,11 @@ { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!TraceConfig#provider:member", - "docComment": "/**\n * Trace Provider\n */\n", + "docComment": "/**\n * Provider of the tracer\n */\n", "excerptTokens": [ { "kind": "Content", - "text": "provider?: " + "text": "provider: " }, { "kind": "Reference", @@ -3290,7 +3284,7 @@ } ], "isReadonly": false, - "isOptional": true, + "isOptional": false, "releaseTag": "Public", "name": "provider", "propertyTypeTokenRange": { @@ -3301,7 +3295,7 @@ { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!TraceConfig#tags:member", - "docComment": "/**\n * Trace tags\n */\n", + "docComment": "/**\n * Optional tags of the tracer\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3314,7 +3308,7 @@ }, { "kind": "Content", - "text": "" + "text": " & {\n func?: string;\n }" }, { "kind": "Content", @@ -3336,7 +3330,7 @@ { "kind": "Interface", "canonicalReference": "@openfunction/functions-framework!TraceProvider:interface", - "docComment": "/**\n * The trace provider info.\n *\n * @public\n */\n", + "docComment": "/**\n * The trace provider object.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3350,7 +3344,7 @@ { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!TraceProvider#name:member", - "docComment": "/**\n * Provider name Now is just support skywalking\n */\n", + "docComment": "/**\n * The name of the provider.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3358,7 +3352,52 @@ }, { "kind": "Content", - "text": "string" + "text": "`${" + }, + { + "kind": "Reference", + "text": "TraceProviderType", + "canonicalReference": "@openfunction/functions-framework!TraceProviderType:enum" + }, + { + "kind": "Content", + "text": "}` | `${" + }, + { + "kind": "Reference", + "text": "Capitalize", + "canonicalReference": "!Capitalize:type" + }, + { + "kind": "Content", + "text": "<" + }, + { + "kind": "Reference", + "text": "TraceProviderType", + "canonicalReference": "@openfunction/functions-framework!TraceProviderType:enum" + }, + { + "kind": "Content", + "text": ">}` | `${" + }, + { + "kind": "Reference", + "text": "Uppercase", + "canonicalReference": "!Uppercase:type" + }, + { + "kind": "Content", + "text": "<" + }, + { + "kind": "Reference", + "text": "TraceProviderType", + "canonicalReference": "@openfunction/functions-framework!TraceProviderType:enum" + }, + { + "kind": "Content", + "text": ">}`" }, { "kind": "Content", @@ -3371,13 +3410,13 @@ "name": "name", "propertyTypeTokenRange": { "startIndex": 1, - "endIndex": 2 + "endIndex": 12 } }, { "kind": "PropertySignature", "canonicalReference": "@openfunction/functions-framework!TraceProvider#oapServer:member", - "docComment": "/**\n * OapServer address example [skywalking-oap:11800]\n */\n", + "docComment": "/**\n * The address of the OAP server.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3403,6 +3442,64 @@ } ], "extendsTokenRanges": [] + }, + { + "kind": "Enum", + "canonicalReference": "@openfunction/functions-framework!TraceProviderType:enum", + "docComment": "/**\n * Defining trace provider type enumeration.\n *\n * @public\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "export declare enum TraceProviderType " + } + ], + "releaseTag": "Public", + "name": "TraceProviderType", + "preserveMemberOrder": false, + "members": [ + { + "kind": "EnumMember", + "canonicalReference": "@openfunction/functions-framework!TraceProviderType.OpenTelemetry:member", + "docComment": "/**\n * The OpenTelemetry type.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "OpenTelemetry = " + }, + { + "kind": "Content", + "text": "\"opentelemetry\"" + } + ], + "initializerTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "releaseTag": "Public", + "name": "OpenTelemetry" + }, + { + "kind": "EnumMember", + "canonicalReference": "@openfunction/functions-framework!TraceProviderType.SkyWalking:member", + "docComment": "/**\n * The SkyWalking type.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "SkyWalking = " + }, + { + "kind": "Content", + "text": "\"skywalking\"" + } + ], + "initializerTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "releaseTag": "Public", + "name": "SkyWalking" + } + ] } ] } diff --git a/docs/generated/api.md b/docs/generated/api.md index 388c83ef..e99f057e 100644 --- a/docs/generated/api.md +++ b/docs/generated/api.md @@ -116,11 +116,6 @@ export interface OpenFunction { // @public export const openfunction: (functionName: string, handler: OpenFunction) => void; -// @public -export interface OpenFunctionBinding { - [key: string]: OpenFunctionComponent; -} - // @public export interface OpenFunctionComponent { componentName: string; @@ -132,14 +127,14 @@ export interface OpenFunctionComponent { // @public export interface OpenFunctionContext { - inputs?: OpenFunctionBinding; + inputs?: Record; name: string; - outputs?: OpenFunctionBinding; + outputs?: Record; + pluginsTracing?: TraceConfig; port?: string; postPlugins?: string[]; prePlugins?: string[]; runtime: `${RuntimeType}` | `${Capitalize}` | `${Uppercase}`; - tracing?: TraceConfig; version: string; } @@ -147,6 +142,7 @@ export interface OpenFunctionContext { export abstract class OpenFunctionRuntime { constructor(context: OpenFunctionContext); protected readonly context: OpenFunctionContext; + error?: Error; getPlugin(name: string): Plugin_2; readonly locals: Record; static Parse(context: OpenFunctionContext): OpenFunctionRuntime; @@ -193,16 +189,24 @@ export enum RuntimeType { export interface TraceConfig { baggage?: Record; enabled: boolean; - provider?: TraceProvider; - tags?: Record; + provider: TraceProvider; + tags?: Record & { + func?: string; + }; } // @public export interface TraceProvider { - name: string; + name: `${TraceProviderType}` | `${Capitalize}` | `${Uppercase}`; oapServer: string; } +// @public +export enum TraceProviderType { + OpenTelemetry = "opentelemetry", + SkyWalking = "skywalking" +} + // (No @packageDocumentation comment for this package) ``` diff --git a/output-file.txt b/output-file.txt deleted file mode 100644 index cda8cde4..00000000 --- a/output-file.txt +++ /dev/null @@ -1 +0,0 @@ -{"some":"payload"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index dfecfbba..a90e9dc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@dapr/dapr": "2.3.1", - "body-parser": "^1.20.0", + "body-parser": "^1.20.1", "cloudevents": "^6.0.2", "debug": "^4.3.4", "express": "^4.18.1", @@ -18,10 +18,9 @@ "http-terminator": "^3.2.0", "lodash": "^4.17.21", "minimist": "^1.2.6", - "node-fetch": "2.6.5", "on-finished": "^2.4.1", "read-pkg-up": "^7.0.1", - "semver": "^7.3.7", + "semver": "^7.3.8", "skywalking-backend-js": "^0.5.1" }, "bin": { @@ -29,14 +28,14 @@ "functions-framework-nodejs": "build/src/main.js" }, "devDependencies": { - "@microsoft/api-extractor": "^7.29.3", + "@microsoft/api-extractor": "^7.32.0", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", - "@types/express": "4.17.13", + "@types/express": "4.17.14", "@types/google-protobuf": "^3.15.6", - "@types/lodash": "^4.14.184", + "@types/lodash": "^4.14.186", "@types/minimist": "1.2.2", - "@types/mocha": "9.1.1", + "@types/mocha": "10.0.0", "@types/node": "14.18.11", "@types/node-fetch": "^2.6.2", "@types/on-finished": "2.3.1", @@ -44,19 +43,20 @@ "@types/shelljs": "^0.8.11", "@types/sinon": "10.0.11", "@types/supertest": "2.0.12", - "aedes": "^0.47.0", + "aedes": "0.47.0", "clean-pkg-json": "^1.2.0", - "concurrently": "^7.3.0", + "concurrently": "^7.4.0", "cross-env": "^7.0.3", "env-cmd": "^10.1.0", - "gts": "^3.1.0", + "graphql-request": "^5.0.0", + "gts": "^3.1.1", "mocha": "10.0.0", "pack-n-play": "^1.0.0-2", - "pre-push": "^0.1.3", + "pre-push": "^0.1.4", "shelljs": "^0.8.5", - "sinon": "^14.0.0", - "supertest": "6.2.3", - "typescript": "^4.8.2", + "sinon": "^14.0.1", + "supertest": "6.3.0", + "typescript": "^4.8.4", "wait-on": "^6.0.1" }, "engines": { @@ -128,25 +128,6 @@ "uuid": "^8.3.2" } }, - "node_modules/@dapr/dapr/node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -176,6 +157,15 @@ "node": ">= 4" } }, + "node_modules/@graphql-typed-document-node/core": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz", + "integrity": "sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg==", + "dev": true, + "peerDependencies": { + "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" + } + }, "node_modules/@grpc/grpc-js": { "version": "1.6.7", "resolved": "https://registry.npmmirror.com/@grpc/grpc-js/-/grpc-js-1.6.7.tgz", @@ -259,37 +249,37 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@microsoft/api-extractor": { - "version": "7.29.3", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.29.3.tgz", - "integrity": "sha512-PHq+Oo8yiXhwi11VQ1Nz36s+aZwgFqjtkd41udWHtSpyMv2slJ74m1cHdpWbs2ovGUCfldayzdpGwnexZLd2bA==", + "version": "7.32.0", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.32.0.tgz", + "integrity": "sha512-BfvPpeVzWLFTdairVItzWQGsZr82fR4RH+8Q4I7t0f9xq66v4Qz9K+u25jbL5R42X01b/vvJMuRhX5KhU8J1Ug==", "dev": true, "dependencies": { - "@microsoft/api-extractor-model": "7.23.1", + "@microsoft/api-extractor-model": "7.24.3", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.50.2", - "@rushstack/rig-package": "0.3.14", - "@rushstack/ts-command-line": "4.12.2", + "@rushstack/node-core-library": "3.53.0", + "@rushstack/rig-package": "0.3.16", + "@rushstack/ts-command-line": "4.12.4", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", "semver": "~7.3.0", "source-map": "~0.6.1", - "typescript": "~4.7.4" + "typescript": "~4.8.4" }, "bin": { "api-extractor": "bin/api-extractor" } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.23.1", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.23.1.tgz", - "integrity": "sha512-axlZ33H2LfYX7goAaWpzABWZl3JtX/EUkfVBsI4SuMn3AZYBJsP5MVpMCq7jt0PCefWGwwO+Rv+lCmmJIjFhlQ==", + "version": "7.24.3", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.24.3.tgz", + "integrity": "sha512-JElpLULqYDXQb0YIKKQhOJaNWBXsYeYu5J51Z4O6RGbOq7Tby9ViVfpDuXVXa87AMOSR5WKuaxG/5SnQVVNxiw==", "dev": true, "dependencies": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.50.2" + "@rushstack/node-core-library": "3.53.0" } }, "node_modules/@microsoft/api-extractor/node_modules/resolve": { @@ -301,19 +291,6 @@ "path-parse": "^1.0.6" } }, - "node_modules/@microsoft/api-extractor/node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/@microsoft/tsdoc": { "version": "0.14.1", "resolved": "https://registry.npmmirror.com/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz", @@ -321,17 +298,23 @@ "dev": true }, "node_modules/@microsoft/tsdoc-config": { - "version": "0.16.1", - "resolved": "https://registry.npmmirror.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz", - "integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==", + "version": "0.16.2", + "resolved": "https://registry.npmmirror.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz", + "integrity": "sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==", "dev": true, "dependencies": { - "@microsoft/tsdoc": "0.14.1", + "@microsoft/tsdoc": "0.14.2", "ajv": "~6.12.6", "jju": "~1.4.0", "resolve": "~1.19.0" } }, + "node_modules/@microsoft/tsdoc-config/node_modules/@microsoft/tsdoc": { + "version": "0.14.2", + "resolved": "https://registry.npmmirror.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", + "integrity": "sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==", + "dev": true + }, "node_modules/@microsoft/tsdoc-config/node_modules/resolve": { "version": "1.19.0", "resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.19.0.tgz", @@ -432,9 +415,9 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "node_modules/@rushstack/node-core-library": { - "version": "3.50.2", - "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.50.2.tgz", - "integrity": "sha512-+zpZBcaX5s+wA0avF0Lk3sd5jbGRo5SmsEJpElJbqQd3KGFvc/hcyeNSMqV5+esJ1JuTfnE1QyRt8nvxFNTaQg==", + "version": "3.53.0", + "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.53.0.tgz", + "integrity": "sha512-FXk3eDtTHKnaUq+fLyNY867ioRhMa6CJDJO5hZ3wuGlxm184nckAFiU+hx027AodjpnqjX6pYF0zZGq7k7P/vg==", "dev": true, "dependencies": { "@types/node": "12.20.24", @@ -444,7 +427,6 @@ "jju": "~1.4.0", "resolve": "~1.17.0", "semver": "~7.3.0", - "timsort": "~0.3.0", "z-schema": "~5.0.2" } }, @@ -464,9 +446,9 @@ } }, "node_modules/@rushstack/rig-package": { - "version": "0.3.14", - "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.14.tgz", - "integrity": "sha512-Ic9EN3kWJCK6iOxEDtwED9nrM146zCDrQaUxbeGOF+q/VLZ/HNHPw+aLqrqmTl0ZT66Sf75Qk6OG+rySjTorvQ==", + "version": "0.3.16", + "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.16.tgz", + "integrity": "sha512-FoSQng2RtapEUe+CBPKxbpZUhUht5s2+mMiztRH95qqp81dsUpfEWojtV6XrUVyWIRk2/cY1CDZUKJWxMrT26Q==", "dev": true, "dependencies": { "resolve": "~1.17.0", @@ -483,9 +465,9 @@ } }, "node_modules/@rushstack/ts-command-line": { - "version": "4.12.2", - "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.2.tgz", - "integrity": "sha512-poBtnumLuWmwmhCEkVAgynWgtnF9Kygekxyp4qtQUSbBrkuyPQTL85c8Cva1YfoUpOdOXxezMAkUt0n5SNKGqw==", + "version": "4.12.4", + "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.4.tgz", + "integrity": "sha512-ckZHEfPiJCmBdWd/syve5zu2TNsPIqbFie3jWzM/izZa6ZOkDwex/K1ww+kJ12hFBnN44lMD7voJvKXajUCEDA==", "dev": true, "dependencies": { "@types/argparse": "1.0.38", @@ -515,15 +497,6 @@ "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", "dev": true }, - "node_modules/@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -559,18 +532,6 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, - "node_modules/@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "dependencies": { - "defer-to-connect": "^1.0.1" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/@types/argparse": { "version": "1.0.38", "resolved": "https://registry.npmmirror.com/@types/argparse/-/argparse-1.0.38.tgz", @@ -612,9 +573,9 @@ } }, "node_modules/@types/express": { - "version": "4.17.13", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", - "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "version": "4.17.14", + "resolved": "https://registry.npmmirror.com/@types/express/-/express-4.17.14.tgz", + "integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==", "dev": true, "dependencies": { "@types/body-parser": "*", @@ -657,9 +618,9 @@ "dev": true }, "node_modules/@types/lodash": { - "version": "4.14.184", - "resolved": "https://registry.npmmirror.com/@types/lodash/-/lodash-4.14.184.tgz", - "integrity": "sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q==", + "version": "4.14.186", + "resolved": "https://registry.npmmirror.com/@types/lodash/-/lodash-4.14.186.tgz", + "integrity": "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==", "dev": true }, "node_modules/@types/long": { @@ -686,9 +647,9 @@ "dev": true }, "node_modules/@types/mocha": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", - "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", + "version": "10.0.0", + "resolved": "https://registry.npmmirror.com/@types/mocha/-/mocha-10.0.0.tgz", + "integrity": "sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==", "dev": true }, "node_modules/@types/ms": { @@ -1023,7 +984,7 @@ }, "node_modules/aedes": { "version": "0.47.0", - "resolved": "https://registry.npmjs.org/aedes/-/aedes-0.47.0.tgz", + "resolved": "https://registry.npmmirror.com/aedes/-/aedes-0.47.0.tgz", "integrity": "sha512-ERe7jMI87KlZVj+RWDEEQMTGJ10Nr68Jx5QA+/glBPmLpIoyB1sPv5xgY8FJ/zrnyj4RN04Sv9N6HsS8EmNpNg==", "dev": true, "dependencies": { @@ -1069,15 +1030,6 @@ "node": ">=14" } }, - "node_modules/aedes-persistence/node_modules/qlobber": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/qlobber/-/qlobber-7.0.0.tgz", - "integrity": "sha512-hQbAIJbrCMLWpjr8ozRmYDdMmU2tMu1bumL3LNxdFaF2Duq5EqcLD59+/F6hyO4ykJMccKhd65wkMRgr7UhgHw==", - "dev": true, - "engines": { - "node": ">= 14" - } - }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1129,15 +1081,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "dev": true, - "dependencies": { - "string-width": "^4.1.0" - } - }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -1240,7 +1183,7 @@ }, "node_modules/asap": { "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "resolved": "https://registry.npmmirror.com/asap/-/asap-2.0.6.tgz", "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", "dev": true }, @@ -1316,9 +1259,9 @@ } }, "node_modules/body-parser": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "version": "1.20.1", + "resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.4", @@ -1328,7 +1271,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.10.3", + "qs": "6.11.0", "raw-body": "2.5.1", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -1351,126 +1294,21 @@ "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, - "node_modules/boolean": { - "version": "3.2.0", - "resolved": "https://registry.npmmirror.com/boolean/-/boolean-3.2.0.tgz", - "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==" - }, - "node_modules/boxen": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", - "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", - "dev": true, - "dependencies": { - "ansi-align": "^3.0.0", - "camelcase": "^6.2.0", - "chalk": "^4.1.0", - "cli-boxes": "^2.2.1", - "string-width": "^4.2.2", - "type-fest": "^0.20.2", - "widest-line": "^3.1.0", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/boxen/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==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/boxen/node_modules/camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/boxen/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "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/boxen/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==", - "dev": true, + "node_modules/body-parser/node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmmirror.com/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/boxen/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==", - "dev": true - }, - "node_modules/boxen/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==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/boxen/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==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" + "side-channel": "^1.0.4" }, "engines": { - "node": ">=8" + "node": ">=0.6" } }, - "node_modules/boxen/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "node_modules/boolean": { + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/boolean/-/boolean-3.2.0.tgz", + "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==" }, "node_modules/brace-expansion": { "version": "1.1.11", @@ -1524,48 +1362,6 @@ "node": ">= 0.8" } }, - "node_modules/cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cacheable-request/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cacheable-request/node_modules/lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -1665,12 +1461,6 @@ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, - "node_modules/ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, "node_modules/clean-pkg-json": { "version": "1.2.0", "resolved": "https://registry.npmmirror.com/clean-pkg-json/-/clean-pkg-json-1.2.0.tgz", @@ -1680,18 +1470,6 @@ "clean-pkg-json": "dist/index.js" } }, - "node_modules/cli-boxes": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", - "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -1723,15 +1501,6 @@ "wrap-ansi": "^7.0.0" } }, - "node_modules/clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "dev": true, - "dependencies": { - "mimic-response": "^1.0.0" - } - }, "node_modules/cloudevents": { "version": "6.0.2", "resolved": "https://registry.npmmirror.com/cloudevents/-/cloudevents-6.0.2.tgz", @@ -1833,7 +1602,7 @@ }, "node_modules/component-emitter": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "resolved": "https://registry.npmmirror.com/component-emitter/-/component-emitter-1.3.0.tgz", "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", "dev": true }, @@ -1889,13 +1658,13 @@ } }, "node_modules/concurrently": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.3.0.tgz", - "integrity": "sha512-IiDwm+8DOcFEInca494A8V402tNTQlJaYq78RF2rijOrKEk/AOHTxhN4U1cp7GYKYX5Q6Ymh1dLTBlzIMN0ikA==", + "version": "7.4.0", + "resolved": "https://registry.npmmirror.com/concurrently/-/concurrently-7.4.0.tgz", + "integrity": "sha512-M6AfrueDt/GEna/Vg9BqQ+93yuvzkSKmoTixnwEJkH0LlcGrRC2eCmjeG1tLLHIYfpYJABokqSGyMcXjm96AFA==", "dev": true, "dependencies": { "chalk": "^4.1.0", - "date-fns": "^2.16.1", + "date-fns": "^2.29.1", "lodash": "^4.17.21", "rxjs": "^7.0.0", "shell-quote": "^1.7.3", @@ -1905,6 +1674,7 @@ "yargs": "^17.3.1" }, "bin": { + "conc": "dist/bin/concurrently.js", "concurrently": "dist/bin/concurrently.js" }, "engines": { @@ -2029,23 +1799,6 @@ "node": ">=12" } }, - "node_modules/configstore": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", - "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dev": true, - "dependencies": { - "dot-prop": "^5.2.0", - "graceful-fs": "^4.1.2", - "make-dir": "^3.0.0", - "unique-string": "^2.0.0", - "write-file-atomic": "^3.0.0", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -2099,7 +1852,7 @@ }, "node_modules/cookiejar": { "version": "2.1.3", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.3.tgz", + "resolved": "https://registry.npmmirror.com/cookiejar/-/cookiejar-2.1.3.tgz", "integrity": "sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==", "dev": true }, @@ -2127,6 +1880,15 @@ "yarn": ">=1" } }, + "node_modules/cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmmirror.com/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "dev": true, + "dependencies": { + "node-fetch": "2.6.7" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2141,19 +1903,10 @@ "node": ">= 8" } }, - "node_modules/crypto-random-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", - "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/date-fns": { - "version": "2.28.0", - "resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-2.28.0.tgz", - "integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==", + "version": "2.29.2", + "resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-2.29.2.tgz", + "integrity": "sha512-0VNbwmWJDS/G3ySwFSJA3ayhbURMTJLtwM2DTxf9CWondCnh6DTNlO9JgRSq6ibf4eD0lfMJNBxUdEAHHix+bA==", "dev": true, "engines": { "node": ">=0.11" @@ -2206,27 +1959,6 @@ "node": ">=0.10.0" } }, - "node_modules/decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "dependencies": { - "mimic-response": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true, - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -2241,12 +1973,6 @@ "node": ">=0.10.0" } }, - "node_modules/defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, "node_modules/define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -2294,8 +2020,8 @@ }, "node_modules/dezalgo": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", - "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", + "resolved": "https://registry.npmmirror.com/dezalgo/-/dezalgo-1.0.3.tgz", + "integrity": "sha512-K7i4zNfT2kgQz3GylDw40ot9GAE47sFZ9EXHFSPP6zONLgH6kWXE0KWJchkbQJLBkRazq4APwZ4OwiFFlT95OQ==", "dev": true, "dependencies": { "asap": "^2.0.0", @@ -2335,24 +2061,6 @@ "node": ">=6.0.0" } }, - "node_modules/dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "dependencies": { - "is-obj": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true - }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -2487,15 +2195,6 @@ "node": ">=6" } }, - "node_modules/escape-goat": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -3048,6 +2747,29 @@ "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/express/node_modules/body-parser": { + "version": "1.20.0", + "resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-1.20.0.tgz", + "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.10.3", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, "node_modules/express/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", @@ -3094,6 +2816,15 @@ "node": ">=4" } }, + "node_modules/extract-files": { + "version": "9.0.0", + "resolved": "https://registry.npmmirror.com/extract-files/-/extract-files-9.0.0.tgz", + "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==", + "dev": true, + "engines": { + "node": "^10.17.0 || ^12.0.0 || >= 13.7.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -3339,7 +3070,7 @@ }, "node_modules/form-data": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dev": true, "dependencies": { @@ -3353,7 +3084,7 @@ }, "node_modules/formidable": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.0.1.tgz", + "resolved": "https://registry.npmmirror.com/formidable/-/formidable-2.0.1.tgz", "integrity": "sha512-rjTMNbp2BpfQShhFbR3Ruk3qk2y9jKpvMW78nJgx8QKtxjDVrwbZG+wvDOmVbifHyOUOQJXxqEy6r0faRrPzTQ==", "dev": true, "dependencies": { @@ -3361,21 +3092,15 @@ "hexoid": "1.0.0", "once": "1.4.0", "qs": "6.9.3" - }, - "funding": { - "url": "https://ko-fi.com/tunnckoCore/commissions" } }, "node_modules/formidable/node_modules/qs": { "version": "6.9.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.3.tgz", + "resolved": "https://registry.npmmirror.com/qs/-/qs-6.9.3.tgz", "integrity": "sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw==", "dev": true, "engines": { "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } }, "node_modules/forwarded": { @@ -3531,21 +3256,6 @@ "node": ">= 6" } }, - "node_modules/global-dirs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", - "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", - "dev": true, - "dependencies": { - "ini": "2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/globals": { "version": "13.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", @@ -3609,50 +3319,55 @@ "resolved": "https://registry.npmmirror.com/google-protobuf/-/google-protobuf-3.20.1.tgz", "integrity": "sha512-XMf1+O32FjYIV3CYu6Tuh5PNbfNEU5Xu22X+Xkdb/DUexFlCzhvv7d5Iirm4AOwn8lv4al1YvIhzGrg2j9Zfzw==" }, - "node_modules/got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "node_modules/graphql": { + "version": "16.6.0", + "resolved": "https://registry.npmmirror.com/graphql/-/graphql-16.6.0.tgz", + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", + "dev": true, + "peer": true, + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/graphql-request": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/graphql-request/-/graphql-request-5.0.0.tgz", + "integrity": "sha512-SpVEnIo2J5k2+Zf76cUkdvIRaq5FMZvGQYnA4lUWYbc99m+fHh4CZYRRO/Ff4tCLQ613fzCm3SiDT64ubW5Gyw==", "dev": true, "dependencies": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" + "@graphql-typed-document-node/core": "^3.1.1", + "cross-fetch": "^3.1.5", + "extract-files": "^9.0.0", + "form-data": "^3.0.0" }, - "engines": { - "node": ">=8.6" + "peerDependencies": { + "graphql": "14 - 16" } }, - "node_modules/got/node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "node_modules/graphql-request/node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", "dev": true, "dependencies": { - "pump": "^3.0.0" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" }, "engines": { - "node": ">=6" + "node": ">= 6" } }, - "node_modules/graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", - "dev": true - }, "node_modules/gts": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/gts/-/gts-3.1.0.tgz", - "integrity": "sha512-Pbj3ob1VR1IRlEVEBNtKoQ1wHOa8cZz62KEojK8Fn/qeS2ClWI4gLNfhek3lD68aZSmUEg8TFb6AHXIwUMgyqQ==", + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/gts/-/gts-3.1.1.tgz", + "integrity": "sha512-Jw44aBbzMnd1vtZs7tZt3LMstKQukCBg7N4CKVGzviIQ45Cz5b9lxDJGXVKj/9ySuGv6TYEeijZJGbiiVcM27w==", "dev": true, "dependencies": { "@typescript-eslint/eslint-plugin": "^4.2.0", @@ -3669,7 +3384,6 @@ "ncp": "^2.0.0", "prettier": "^2.1.2", "rimraf": "^3.0.2", - "update-notifier": "^5.0.0", "write-file-atomic": "^3.0.3" }, "bin": { @@ -3813,15 +3527,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-yarn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -3833,7 +3538,7 @@ }, "node_modules/hexoid": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", + "resolved": "https://registry.npmmirror.com/hexoid/-/hexoid-1.0.0.tgz", "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==", "dev": true, "engines": { @@ -3845,12 +3550,6 @@ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" }, - "node_modules/http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true - }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -4011,15 +3710,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "node_modules/ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/inquirer": { "version": "7.3.3", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", @@ -4213,18 +3903,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "dependencies": { - "ci-info": "^2.0.0" - }, - "bin": { - "is-ci": "bin.js" - } - }, "node_modules/is-core-module": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", @@ -4293,22 +3971,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-installed-globally": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", - "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dev": true, - "dependencies": { - "global-dirs": "^3.0.0", - "is-path-inside": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", @@ -4320,18 +3982,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-npm": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", - "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -4355,24 +4005,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -4464,8 +4096,8 @@ }, "node_modules/is-typedarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "resolved": "https://registry.npmmirror.com/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", "dev": true }, "node_modules/is-unicode-supported": { @@ -4491,12 +4123,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-yarn-global": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true - }, "node_modules/isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", @@ -4546,12 +4172,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -4598,15 +4218,6 @@ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", "dev": true }, - "node_modules/keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "dependencies": { - "json-buffer": "3.0.0" - } - }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -4621,18 +4232,6 @@ "resolved": "https://registry.npmmirror.com/kuler/-/kuler-2.0.0.tgz", "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" }, - "node_modules/latest-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", - "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, - "dependencies": { - "package-json": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -4799,48 +4398,15 @@ "resolved": "https://registry.npmmirror.com/long/-/long-4.0.0.tgz", "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, - "node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" } }, "node_modules/map-obj": { @@ -5008,15 +4574,6 @@ "node": ">=6" } }, - "node_modules/mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -5299,6 +4856,15 @@ "node": ">=10" } }, + "node_modules/mqemitter/node_modules/qlobber": { + "version": "5.0.3", + "resolved": "https://registry.npmmirror.com/qlobber/-/qlobber-5.0.3.tgz", + "integrity": "sha512-wW4GTZPePyh0RgOsM18oDyOUlXfurVRgoNyJfS+y7VWPyd0GYhQp5T2tycZFZjonH+hngxIfklGJhTP/ghidgQ==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/mqtt-packet": { "version": "7.1.2", "resolved": "https://registry.npmmirror.com/mqtt-packet/-/mqtt-packet-7.1.2.tgz", @@ -5379,14 +4945,22 @@ } }, "node_modules/node-fetch": { - "version": "2.6.5", - "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.5.tgz", - "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", + "version": "2.6.7", + "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "dependencies": { "whatwg-url": "^5.0.0" }, "engines": { "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, "node_modules/normalize-package-data": { @@ -5417,15 +4991,6 @@ "node": ">=0.10.0" } }, - "node_modules/normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/npm-bundled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", @@ -5582,15 +5147,6 @@ "node": ">=0.10.0" } }, - "node_modules/p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/p-finally": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/p-finally/-/p-finally-1.0.0.tgz", @@ -5695,30 +5251,6 @@ "rimraf": "bin.js" } }, - "node_modules/package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, - "dependencies": { - "got": "^9.6.0", - "registry-auth-token": "^4.0.0", - "registry-url": "^5.0.0", - "semver": "^6.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5814,9 +5346,9 @@ } }, "node_modules/pre-push": { - "version": "0.1.3", - "resolved": "https://registry.npmmirror.com/pre-push/-/pre-push-0.1.3.tgz", - "integrity": "sha512-PXc3tT7jq/H2VrEooQ8F9QCVfQawmd52CzWMemUrPlFnL8avaXY22NTuej3ClISy8EwStaB5myiigPBP4zqSbw==", + "version": "0.1.4", + "resolved": "https://registry.npmmirror.com/pre-push/-/pre-push-0.1.4.tgz", + "integrity": "sha512-bIdVuDQR3r5AWV7bM6OMHD3mCXA53Ql0LXmW5UfcSmJZq+J+TytqZ5YJcTmMLcojJysN65vcFIeCqRn6YidA+Q==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -5894,15 +5426,6 @@ "node": ">= 0.8.0" } }, - "node_modules/prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/prettier": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", @@ -5985,16 +5508,6 @@ "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", "dev": true }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -6003,25 +5516,13 @@ "node": ">=6" } }, - "node_modules/pupa": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", - "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dev": true, - "dependencies": { - "escape-goat": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/qlobber": { - "version": "5.0.3", - "resolved": "https://registry.npmmirror.com/qlobber/-/qlobber-5.0.3.tgz", - "integrity": "sha512-wW4GTZPePyh0RgOsM18oDyOUlXfurVRgoNyJfS+y7VWPyd0GYhQp5T2tycZFZjonH+hngxIfklGJhTP/ghidgQ==", + "version": "7.0.1", + "resolved": "https://registry.npmmirror.com/qlobber/-/qlobber-7.0.1.tgz", + "integrity": "sha512-FsFg9lMuMEFNKmTO9nV7tlyPhx8BmskPPjH2akWycuYVTtWaVwhW5yCHLJQ6Q+3mvw5cFX2vMfW2l9z2SiYAbg==", "dev": true, "engines": { - "node": ">= 8" + "node": ">= 14" } }, "node_modules/qs": { @@ -6098,36 +5599,6 @@ "node": ">= 0.8" } }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/rc/node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true - }, - "node_modules/rc/node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", @@ -6236,30 +5707,6 @@ "url": "https://github.com/sponsors/mysticatea" } }, - "node_modules/registry-auth-token": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", - "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", - "dev": true, - "dependencies": { - "rc": "^1.2.8" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/registry-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", - "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, - "dependencies": { - "rc": "^1.2.8" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -6297,15 +5744,6 @@ "node": ">=4" } }, - "node_modules/responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "dependencies": { - "lowercase-keys": "^1.0.0" - } - }, "node_modules/restana": { "version": "4.9.5", "resolved": "https://registry.npmmirror.com/restana/-/restana-4.9.5.tgz", @@ -6446,9 +5884,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.3.8", + "resolved": "https://registry.npmmirror.com/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -6464,27 +5902,6 @@ "resolved": "https://registry.npmmirror.com/semver-compare/-/semver-compare-1.0.0.tgz", "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==" }, - "node_modules/semver-diff": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", - "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dev": true, - "dependencies": { - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/semver-diff/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -6631,9 +6048,9 @@ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" }, "node_modules/sinon": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.0.tgz", - "integrity": "sha512-ugA6BFmE+WrJdh0owRZHToLd32Uw3Lxq6E6LtNRU+xTVBefx632h03Q7apXWRsRdZAJ41LB8aUfn2+O4jsDNMw==", + "version": "14.0.1", + "resolved": "https://registry.npmmirror.com/sinon/-/sinon-14.0.1.tgz", + "integrity": "sha512-JhJ0jCiyBWVAHDS+YSjgEbDn7Wgz9iIjA1/RK+eseJN0vAAWIWiXBdrnb92ELPyjsfreCYntD1ORtLSfIrlvSQ==", "dev": true, "dependencies": { "@sinonjs/commons": "^1.8.3", @@ -6642,10 +6059,6 @@ "diff": "^5.0.0", "nise": "^5.1.1", "supports-color": "^7.2.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/sinon" } }, "node_modules/sinon/node_modules/@sinonjs/fake-timers": { @@ -6955,9 +6368,10 @@ } }, "node_modules/superagent": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-7.1.3.tgz", - "integrity": "sha512-WA6et4nAvgBCS73lJvv1D0ssI5uk5Gh+TGN/kNe+B608EtcVs/yzfl+OLXTzDs7tOBDIpvgh/WUs1K2OK1zTeQ==", + "version": "8.0.2", + "resolved": "https://registry.npmmirror.com/superagent/-/superagent-8.0.2.tgz", + "integrity": "sha512-QtYZ9uaNAMexI7XWl2vAXAh0j4q9H7T0WVEI/y5qaUB3QLwxo+voUgCQ217AokJzUTIVOp0RTo7fhZrwhD7A2Q==", + "deprecated": "Please use v8.0.0 until https://github.com/visionmedia/superagent/issues/1743 is resolved", "dev": true, "dependencies": { "component-emitter": "^1.3.0", @@ -6967,9 +6381,8 @@ "form-data": "^4.0.0", "formidable": "^2.0.1", "methods": "^1.1.2", - "mime": "^2.5.0", - "qs": "^6.10.3", - "readable-stream": "^3.6.0", + "mime": "2.6.0", + "qs": "^6.11.0", "semver": "^7.3.7" }, "engines": { @@ -6978,7 +6391,7 @@ }, "node_modules/superagent/node_modules/mime": { "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "resolved": "https://registry.npmmirror.com/mime/-/mime-2.6.0.tgz", "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", "dev": true, "bin": { @@ -6988,17 +6401,29 @@ "node": ">=4.0.0" } }, + "node_modules/superagent/node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmmirror.com/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + } + }, "node_modules/supertest": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/supertest/-/supertest-6.2.3.tgz", - "integrity": "sha512-3GSdMYTMItzsSYjnIcljxMVZKPW1J9kYHZY+7yLfD0wpPwww97GeImZC1oOk0S5+wYl2niJwuFusBJqwLqYM3g==", + "version": "6.3.0", + "resolved": "https://registry.npmmirror.com/supertest/-/supertest-6.3.0.tgz", + "integrity": "sha512-QgWju1cNoacP81Rv88NKkQ4oXTzGg0eNZtOoxp1ROpbS4OHY/eK5b8meShuFtdni161o5X0VQvgo7ErVyKK+Ow==", "dev": true, "dependencies": { "methods": "^1.1.2", - "superagent": "^7.1.3" + "superagent": "^8.0.0" }, "engines": { - "node": ">=6.0.0" + "node": ">=6.4.0" } }, "node_modules/supports-color": { @@ -7084,12 +6509,6 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, - "node_modules/timsort": { - "version": "0.3.0", - "resolved": "https://registry.npmmirror.com/timsort/-/timsort-0.3.0.tgz", - "integrity": "sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==", - "dev": true - }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -7102,15 +6521,6 @@ "node": ">=0.6.0" } }, - "node_modules/to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -7248,7 +6658,7 @@ }, "node_modules/typedarray-to-buffer": { "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "resolved": "https://registry.npmmirror.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", "dev": true, "dependencies": { @@ -7256,166 +6666,47 @@ } }, "node_modules/typescript": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", - "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", - "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/unique-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", - "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dev": true, - "dependencies": { - "crypto-random-string": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmmirror.com/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/update-notifier": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", - "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", - "dev": true, - "dependencies": { - "boxen": "^5.0.0", - "chalk": "^4.1.0", - "configstore": "^5.0.1", - "has-yarn": "^2.1.0", - "import-lazy": "^2.1.0", - "is-ci": "^2.0.0", - "is-installed-globally": "^0.4.0", - "is-npm": "^5.0.0", - "is-yarn-global": "^0.3.0", - "latest-version": "^5.1.0", - "pupa": "^2.1.1", - "semver": "^7.3.4", - "semver-diff": "^3.1.1", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/yeoman/update-notifier?sponsor=1" - } - }, - "node_modules/update-notifier/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==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/update-notifier/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "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/update-notifier/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==", + "version": "4.8.4", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.8.4.tgz", + "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, "engines": { - "node": ">=7.0.0" + "node": ">=4.2.0" } }, - "node_modules/update-notifier/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==", - "dev": true - }, - "node_modules/update-notifier/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==", - "dev": true, - "engines": { - "node": ">=8" + "node_modules/unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "dependencies": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/update-notifier/node_modules/import-lazy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", - "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmmirror.com/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true, "engines": { - "node": ">=4" + "node": ">= 4.0.0" } }, - "node_modules/update-notifier/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==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", "engines": { - "node": ">=8" + "node": ">= 0.8" } }, "node_modules/uri-js": { @@ -7426,18 +6717,6 @@ "punycode": "^2.1.0" } }, - "node_modules/url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "dependencies": { - "prepend-http": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/util": { "version": "0.12.4", "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", @@ -7616,18 +6895,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/widest-line": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", - "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dev": true, - "dependencies": { - "string-width": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/winston": { "version": "3.8.1", "resolved": "https://registry.npmmirror.com/winston/-/winston-3.8.1.tgz", @@ -7730,7 +6997,7 @@ }, "node_modules/write-file-atomic": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "resolved": "https://registry.npmmirror.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz", "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", "dev": true, "dependencies": { @@ -7740,15 +7007,6 @@ "typedarray-to-buffer": "^3.1.5" } }, - "node_modules/xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmmirror.com/xtend/-/xtend-4.0.2.tgz", @@ -7857,9 +7115,9 @@ } }, "node_modules/z-schema": { - "version": "5.0.3", - "resolved": "https://registry.npmmirror.com/z-schema/-/z-schema-5.0.3.tgz", - "integrity": "sha512-sGvEcBOTNum68x9jCpCVGPFJ6mWnkD0YxOcddDlJHRx3tKdB2q8pCHExMVZo/AV/6geuVJXG7hljDaWG8+5GDw==", + "version": "5.0.4", + "resolved": "https://registry.npmmirror.com/z-schema/-/z-schema-5.0.4.tgz", + "integrity": "sha512-gm/lx3hDzJNcLwseIeQVm1UcwhWIKpSB4NqH89pTBtFns4k/HDHudsICtvG05Bvw/Mv3jMyk700y5dadueLHdA==", "dev": true, "dependencies": { "lodash.get": "^4.4.2", @@ -7929,16 +7187,6 @@ "node-fetch": "^2.6.1", "restana": "^4.9.1", "uuid": "^8.3.2" - }, - "dependencies": { - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "requires": { - "whatwg-url": "^5.0.0" - } - } } }, "@eslint/eslintrc": { @@ -7966,6 +7214,13 @@ } } }, + "@graphql-typed-document-node/core": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz", + "integrity": "sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg==", + "dev": true, + "requires": {} + }, "@grpc/grpc-js": { "version": "1.6.7", "resolved": "https://registry.npmmirror.com/@grpc/grpc-js/-/grpc-js-1.6.7.tgz", @@ -8036,23 +7291,23 @@ } }, "@microsoft/api-extractor": { - "version": "7.29.3", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.29.3.tgz", - "integrity": "sha512-PHq+Oo8yiXhwi11VQ1Nz36s+aZwgFqjtkd41udWHtSpyMv2slJ74m1cHdpWbs2ovGUCfldayzdpGwnexZLd2bA==", + "version": "7.32.0", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor/-/api-extractor-7.32.0.tgz", + "integrity": "sha512-BfvPpeVzWLFTdairVItzWQGsZr82fR4RH+8Q4I7t0f9xq66v4Qz9K+u25jbL5R42X01b/vvJMuRhX5KhU8J1Ug==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.23.1", + "@microsoft/api-extractor-model": "7.24.3", "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.50.2", - "@rushstack/rig-package": "0.3.14", - "@rushstack/ts-command-line": "4.12.2", + "@rushstack/node-core-library": "3.53.0", + "@rushstack/rig-package": "0.3.16", + "@rushstack/ts-command-line": "4.12.4", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", "semver": "~7.3.0", "source-map": "~0.6.1", - "typescript": "~4.7.4" + "typescript": "~4.8.4" }, "dependencies": { "resolve": { @@ -8063,24 +7318,18 @@ "requires": { "path-parse": "^1.0.6" } - }, - "typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", - "dev": true } } }, "@microsoft/api-extractor-model": { - "version": "7.23.1", - "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.23.1.tgz", - "integrity": "sha512-axlZ33H2LfYX7goAaWpzABWZl3JtX/EUkfVBsI4SuMn3AZYBJsP5MVpMCq7jt0PCefWGwwO+Rv+lCmmJIjFhlQ==", + "version": "7.24.3", + "resolved": "https://registry.npmmirror.com/@microsoft/api-extractor-model/-/api-extractor-model-7.24.3.tgz", + "integrity": "sha512-JElpLULqYDXQb0YIKKQhOJaNWBXsYeYu5J51Z4O6RGbOq7Tby9ViVfpDuXVXa87AMOSR5WKuaxG/5SnQVVNxiw==", "dev": true, "requires": { "@microsoft/tsdoc": "0.14.1", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.50.2" + "@rushstack/node-core-library": "3.53.0" } }, "@microsoft/tsdoc": { @@ -8090,17 +7339,23 @@ "dev": true }, "@microsoft/tsdoc-config": { - "version": "0.16.1", - "resolved": "https://registry.npmmirror.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz", - "integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==", + "version": "0.16.2", + "resolved": "https://registry.npmmirror.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz", + "integrity": "sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==", "dev": true, "requires": { - "@microsoft/tsdoc": "0.14.1", + "@microsoft/tsdoc": "0.14.2", "ajv": "~6.12.6", "jju": "~1.4.0", "resolve": "~1.19.0" }, "dependencies": { + "@microsoft/tsdoc": { + "version": "0.14.2", + "resolved": "https://registry.npmmirror.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", + "integrity": "sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==", + "dev": true + }, "resolve": { "version": "1.19.0", "resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.19.0.tgz", @@ -8194,9 +7449,9 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "@rushstack/node-core-library": { - "version": "3.50.2", - "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.50.2.tgz", - "integrity": "sha512-+zpZBcaX5s+wA0avF0Lk3sd5jbGRo5SmsEJpElJbqQd3KGFvc/hcyeNSMqV5+esJ1JuTfnE1QyRt8nvxFNTaQg==", + "version": "3.53.0", + "resolved": "https://registry.npmmirror.com/@rushstack/node-core-library/-/node-core-library-3.53.0.tgz", + "integrity": "sha512-FXk3eDtTHKnaUq+fLyNY867ioRhMa6CJDJO5hZ3wuGlxm184nckAFiU+hx027AodjpnqjX6pYF0zZGq7k7P/vg==", "dev": true, "requires": { "@types/node": "12.20.24", @@ -8206,7 +7461,6 @@ "jju": "~1.4.0", "resolve": "~1.17.0", "semver": "~7.3.0", - "timsort": "~0.3.0", "z-schema": "~5.0.2" }, "dependencies": { @@ -8228,9 +7482,9 @@ } }, "@rushstack/rig-package": { - "version": "0.3.14", - "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.14.tgz", - "integrity": "sha512-Ic9EN3kWJCK6iOxEDtwED9nrM146zCDrQaUxbeGOF+q/VLZ/HNHPw+aLqrqmTl0ZT66Sf75Qk6OG+rySjTorvQ==", + "version": "0.3.16", + "resolved": "https://registry.npmmirror.com/@rushstack/rig-package/-/rig-package-0.3.16.tgz", + "integrity": "sha512-FoSQng2RtapEUe+CBPKxbpZUhUht5s2+mMiztRH95qqp81dsUpfEWojtV6XrUVyWIRk2/cY1CDZUKJWxMrT26Q==", "dev": true, "requires": { "resolve": "~1.17.0", @@ -8249,9 +7503,9 @@ } }, "@rushstack/ts-command-line": { - "version": "4.12.2", - "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.2.tgz", - "integrity": "sha512-poBtnumLuWmwmhCEkVAgynWgtnF9Kygekxyp4qtQUSbBrkuyPQTL85c8Cva1YfoUpOdOXxezMAkUt0n5SNKGqw==", + "version": "4.12.4", + "resolved": "https://registry.npmmirror.com/@rushstack/ts-command-line/-/ts-command-line-4.12.4.tgz", + "integrity": "sha512-ckZHEfPiJCmBdWd/syve5zu2TNsPIqbFie3jWzM/izZa6ZOkDwex/K1ww+kJ12hFBnN44lMD7voJvKXajUCEDA==", "dev": true, "requires": { "@types/argparse": "1.0.38", @@ -8281,12 +7535,6 @@ "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", "dev": true }, - "@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true - }, "@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -8322,15 +7570,6 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, - "@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "requires": { - "defer-to-connect": "^1.0.1" - } - }, "@types/argparse": { "version": "1.0.38", "resolved": "https://registry.npmmirror.com/@types/argparse/-/argparse-1.0.38.tgz", @@ -8372,9 +7611,9 @@ } }, "@types/express": { - "version": "4.17.13", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", - "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "version": "4.17.14", + "resolved": "https://registry.npmmirror.com/@types/express/-/express-4.17.14.tgz", + "integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==", "dev": true, "requires": { "@types/body-parser": "*", @@ -8417,9 +7656,9 @@ "dev": true }, "@types/lodash": { - "version": "4.14.184", - "resolved": "https://registry.npmmirror.com/@types/lodash/-/lodash-4.14.184.tgz", - "integrity": "sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q==", + "version": "4.14.186", + "resolved": "https://registry.npmmirror.com/@types/lodash/-/lodash-4.14.186.tgz", + "integrity": "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==", "dev": true }, "@types/long": { @@ -8446,9 +7685,9 @@ "dev": true }, "@types/mocha": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", - "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", + "version": "10.0.0", + "resolved": "https://registry.npmmirror.com/@types/mocha/-/mocha-10.0.0.tgz", + "integrity": "sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==", "dev": true }, "@types/ms": { @@ -8694,7 +7933,7 @@ }, "aedes": { "version": "0.47.0", - "resolved": "https://registry.npmjs.org/aedes/-/aedes-0.47.0.tgz", + "resolved": "https://registry.npmmirror.com/aedes/-/aedes-0.47.0.tgz", "integrity": "sha512-ERe7jMI87KlZVj+RWDEEQMTGJ10Nr68Jx5QA+/glBPmLpIoyB1sPv5xgY8FJ/zrnyj4RN04Sv9N6HsS8EmNpNg==", "dev": true, "requires": { @@ -8729,14 +7968,6 @@ "requires": { "aedes-packet": "^3.0.0", "qlobber": "^7.0.0" - }, - "dependencies": { - "qlobber": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/qlobber/-/qlobber-7.0.0.tgz", - "integrity": "sha512-hQbAIJbrCMLWpjr8ozRmYDdMmU2tMu1bumL3LNxdFaF2Duq5EqcLD59+/F6hyO4ykJMccKhd65wkMRgr7UhgHw==", - "dev": true - } } }, "ajv": { @@ -8776,15 +8007,6 @@ } } }, - "ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "dev": true, - "requires": { - "string-width": "^4.1.0" - } - }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -8859,7 +8081,7 @@ }, "asap": { "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "resolved": "https://registry.npmmirror.com/asap/-/asap-2.0.6.tgz", "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", "dev": true }, @@ -8920,9 +8142,9 @@ } }, "body-parser": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "version": "1.20.1", + "resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", "requires": { "bytes": "3.1.2", "content-type": "~1.0.4", @@ -8932,7 +8154,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.10.3", + "qs": "6.11.0", "raw-body": "2.5.1", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -8950,6 +8172,14 @@ "version": "2.0.0", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "qs": { + "version": "6.11.0", + "resolved": "https://registry.npmmirror.com/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "requires": { + "side-channel": "^1.0.4" + } } } }, @@ -8958,85 +8188,6 @@ "resolved": "https://registry.npmmirror.com/boolean/-/boolean-3.2.0.tgz", "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==" }, - "boxen": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", - "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", - "dev": true, - "requires": { - "ansi-align": "^3.0.0", - "camelcase": "^6.2.0", - "chalk": "^4.1.0", - "cli-boxes": "^2.2.1", - "string-width": "^4.2.2", - "type-fest": "^0.20.2", - "widest-line": "^3.1.0", - "wrap-ansi": "^7.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "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==", - "dev": true, - "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==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "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==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - } - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -9083,38 +8234,6 @@ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" }, - "cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "dependencies": { - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true - } - } - }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -9185,24 +8304,12 @@ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, - "ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, "clean-pkg-json": { "version": "1.2.0", "resolved": "https://registry.npmmirror.com/clean-pkg-json/-/clean-pkg-json-1.2.0.tgz", "integrity": "sha512-QHBWWOtpSCv5nfMFKwyxn4WMvkYE0msxj5xiqejYGqYepWVrK7O/om1Vn6nSl/WPtYn8ge9YmSCbTi1Hp8k+Hg==", "dev": true }, - "cli-boxes": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", - "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "dev": true - }, "cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -9228,15 +8335,6 @@ "wrap-ansi": "^7.0.0" } }, - "clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - }, "cloudevents": { "version": "6.0.2", "resolved": "https://registry.npmmirror.com/cloudevents/-/cloudevents-6.0.2.tgz", @@ -9330,7 +8428,7 @@ }, "component-emitter": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "resolved": "https://registry.npmmirror.com/component-emitter/-/component-emitter-1.3.0.tgz", "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", "dev": true }, @@ -9385,13 +8483,13 @@ } }, "concurrently": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.3.0.tgz", - "integrity": "sha512-IiDwm+8DOcFEInca494A8V402tNTQlJaYq78RF2rijOrKEk/AOHTxhN4U1cp7GYKYX5Q6Ymh1dLTBlzIMN0ikA==", + "version": "7.4.0", + "resolved": "https://registry.npmmirror.com/concurrently/-/concurrently-7.4.0.tgz", + "integrity": "sha512-M6AfrueDt/GEna/Vg9BqQ+93yuvzkSKmoTixnwEJkH0LlcGrRC2eCmjeG1tLLHIYfpYJABokqSGyMcXjm96AFA==", "dev": true, "requires": { "chalk": "^4.1.0", - "date-fns": "^2.16.1", + "date-fns": "^2.29.1", "lodash": "^4.17.21", "rxjs": "^7.0.0", "shell-quote": "^1.7.3", @@ -9499,20 +8597,6 @@ } } }, - "configstore": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", - "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dev": true, - "requires": { - "dot-prop": "^5.2.0", - "graceful-fs": "^4.1.2", - "make-dir": "^3.0.0", - "unique-string": "^2.0.0", - "write-file-atomic": "^3.0.0", - "xdg-basedir": "^4.0.0" - } - }, "content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -9545,7 +8629,7 @@ }, "cookiejar": { "version": "2.1.3", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.3.tgz", + "resolved": "https://registry.npmmirror.com/cookiejar/-/cookiejar-2.1.3.tgz", "integrity": "sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==", "dev": true }, @@ -9564,6 +8648,15 @@ "cross-spawn": "^7.0.1" } }, + "cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmmirror.com/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "dev": true, + "requires": { + "node-fetch": "2.6.7" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -9575,16 +8668,10 @@ "which": "^2.0.1" } }, - "crypto-random-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", - "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "dev": true - }, "date-fns": { - "version": "2.28.0", - "resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-2.28.0.tgz", - "integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==", + "version": "2.29.2", + "resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-2.29.2.tgz", + "integrity": "sha512-0VNbwmWJDS/G3ySwFSJA3ayhbURMTJLtwM2DTxf9CWondCnh6DTNlO9JgRSq6ibf4eD0lfMJNBxUdEAHHix+bA==", "dev": true }, "debug": { @@ -9619,21 +8706,6 @@ } } }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true - }, "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -9645,12 +8717,6 @@ "resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-4.2.2.tgz", "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==" }, - "defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -9682,8 +8748,8 @@ }, "dezalgo": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", - "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", + "resolved": "https://registry.npmmirror.com/dezalgo/-/dezalgo-1.0.3.tgz", + "integrity": "sha512-K7i4zNfT2kgQz3GylDw40ot9GAE47sFZ9EXHFSPP6zONLgH6kWXE0KWJchkbQJLBkRazq4APwZ4OwiFFlT95OQ==", "dev": true, "requires": { "asap": "^2.0.0", @@ -9714,21 +8780,6 @@ "esutils": "^2.0.2" } }, - "dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "requires": { - "is-obj": "^2.0.0" - } - }, - "duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true - }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -9835,12 +8886,6 @@ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" }, - "escape-goat": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "dev": true - }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -10224,6 +9269,25 @@ "vary": "~1.1.2" }, "dependencies": { + "body-parser": { + "version": "1.20.0", + "resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-1.20.0.tgz", + "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.10.3", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", @@ -10278,6 +9342,12 @@ "tmp": "^0.0.33" } }, + "extract-files": { + "version": "9.0.0", + "resolved": "https://registry.npmmirror.com/extract-files/-/extract-files-9.0.0.tgz", + "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==", + "dev": true + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -10481,7 +9551,7 @@ }, "form-data": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dev": true, "requires": { @@ -10492,7 +9562,7 @@ }, "formidable": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.0.1.tgz", + "resolved": "https://registry.npmmirror.com/formidable/-/formidable-2.0.1.tgz", "integrity": "sha512-rjTMNbp2BpfQShhFbR3Ruk3qk2y9jKpvMW78nJgx8QKtxjDVrwbZG+wvDOmVbifHyOUOQJXxqEy6r0faRrPzTQ==", "dev": true, "requires": { @@ -10504,7 +9574,7 @@ "dependencies": { "qs": { "version": "6.9.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.3.tgz", + "resolved": "https://registry.npmmirror.com/qs/-/qs-6.9.3.tgz", "integrity": "sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw==", "dev": true } @@ -10617,15 +9687,6 @@ "is-glob": "^4.0.1" } }, - "global-dirs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", - "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", - "dev": true, - "requires": { - "ini": "2.0.0" - } - }, "globals": { "version": "13.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", @@ -10670,46 +9731,48 @@ "resolved": "https://registry.npmmirror.com/google-protobuf/-/google-protobuf-3.20.1.tgz", "integrity": "sha512-XMf1+O32FjYIV3CYu6Tuh5PNbfNEU5Xu22X+Xkdb/DUexFlCzhvv7d5Iirm4AOwn8lv4al1YvIhzGrg2j9Zfzw==" }, - "got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "graphql": { + "version": "16.6.0", + "resolved": "https://registry.npmmirror.com/graphql/-/graphql-16.6.0.tgz", + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", + "dev": true, + "peer": true + }, + "graphql-request": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/graphql-request/-/graphql-request-5.0.0.tgz", + "integrity": "sha512-SpVEnIo2J5k2+Zf76cUkdvIRaq5FMZvGQYnA4lUWYbc99m+fHh4CZYRRO/Ff4tCLQ613fzCm3SiDT64ubW5Gyw==", "dev": true, "requires": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" + "@graphql-typed-document-node/core": "^3.1.1", + "cross-fetch": "^3.1.5", + "extract-files": "^9.0.0", + "form-data": "^3.0.0" }, "dependencies": { - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", "dev": true, "requires": { - "pump": "^3.0.0" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" } } } }, - "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", - "dev": true - }, "gts": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/gts/-/gts-3.1.0.tgz", - "integrity": "sha512-Pbj3ob1VR1IRlEVEBNtKoQ1wHOa8cZz62KEojK8Fn/qeS2ClWI4gLNfhek3lD68aZSmUEg8TFb6AHXIwUMgyqQ==", + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/gts/-/gts-3.1.1.tgz", + "integrity": "sha512-Jw44aBbzMnd1vtZs7tZt3LMstKQukCBg7N4CKVGzviIQ45Cz5b9lxDJGXVKj/9ySuGv6TYEeijZJGbiiVcM27w==", "dev": true, "requires": { "@typescript-eslint/eslint-plugin": "^4.2.0", @@ -10726,7 +9789,6 @@ "ncp": "^2.0.0", "prettier": "^2.1.2", "rimraf": "^3.0.2", - "update-notifier": "^5.0.0", "write-file-atomic": "^3.0.3" }, "dependencies": { @@ -10818,12 +9880,6 @@ "has-symbols": "^1.0.2" } }, - "has-yarn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true - }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -10832,7 +9888,7 @@ }, "hexoid": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", + "resolved": "https://registry.npmmirror.com/hexoid/-/hexoid-1.0.0.tgz", "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==", "dev": true }, @@ -10841,12 +9897,6 @@ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" }, - "http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true - }, "http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -10970,12 +10020,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true - }, "inquirer": { "version": "7.3.3", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", @@ -11114,15 +10158,6 @@ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==" }, - "is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, "is-core-module": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", @@ -11167,27 +10202,11 @@ "is-extglob": "^2.1.1" } }, - "is-installed-globally": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", - "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dev": true, - "requires": { - "global-dirs": "^3.0.0", - "is-path-inside": "^3.0.2" - } - }, "is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==" }, - "is-npm": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", - "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", - "dev": true - }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -11202,18 +10221,6 @@ "has-tostringtag": "^1.0.0" } }, - "is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true - }, - "is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true - }, "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -11269,8 +10276,8 @@ }, "is-typedarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "resolved": "https://registry.npmmirror.com/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", "dev": true }, "is-unicode-supported": { @@ -11287,12 +10294,6 @@ "call-bind": "^1.0.2" } }, - "is-yarn-global": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true - }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", @@ -11339,12 +10340,6 @@ "esprima": "^4.0.0" } }, - "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, "json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -11385,15 +10380,6 @@ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", "dev": true }, - "keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "requires": { - "json-buffer": "3.0.0" - } - }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -11405,15 +10391,6 @@ "resolved": "https://registry.npmmirror.com/kuler/-/kuler-2.0.0.tgz", "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" }, - "latest-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", - "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, - "requires": { - "package-json": "^6.3.0" - } - }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -11549,12 +10526,6 @@ "resolved": "https://registry.npmmirror.com/long/-/long-4.0.0.tgz", "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -11563,23 +10534,6 @@ "yallist": "^4.0.0" } }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "requires": { - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, "map-obj": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", @@ -11696,12 +10650,6 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true - }, "min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -11904,6 +10852,14 @@ "requires": { "fastparallel": "^2.3.0", "qlobber": "^5.0.0" + }, + "dependencies": { + "qlobber": { + "version": "5.0.3", + "resolved": "https://registry.npmmirror.com/qlobber/-/qlobber-5.0.3.tgz", + "integrity": "sha512-wW4GTZPePyh0RgOsM18oDyOUlXfurVRgoNyJfS+y7VWPyd0GYhQp5T2tycZFZjonH+hngxIfklGJhTP/ghidgQ==", + "dev": true + } } }, "mqtt-packet": { @@ -11976,9 +10932,9 @@ } }, "node-fetch": { - "version": "2.6.5", - "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.5.tgz", - "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", + "version": "2.6.7", + "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "requires": { "whatwg-url": "^5.0.0" } @@ -12007,12 +10963,6 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, - "normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true - }, "npm-bundled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", @@ -12130,12 +11080,6 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, - "p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true - }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/p-finally/-/p-finally-1.0.0.tgz", @@ -12214,26 +11158,6 @@ } } }, - "package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, - "requires": { - "got": "^9.6.0", - "registry-auth-token": "^4.0.0", - "registry-url": "^5.0.0", - "semver": "^6.2.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -12299,9 +11223,9 @@ "dev": true }, "pre-push": { - "version": "0.1.3", - "resolved": "https://registry.npmmirror.com/pre-push/-/pre-push-0.1.3.tgz", - "integrity": "sha512-PXc3tT7jq/H2VrEooQ8F9QCVfQawmd52CzWMemUrPlFnL8avaXY22NTuej3ClISy8EwStaB5myiigPBP4zqSbw==", + "version": "0.1.4", + "resolved": "https://registry.npmmirror.com/pre-push/-/pre-push-0.1.4.tgz", + "integrity": "sha512-bIdVuDQR3r5AWV7bM6OMHD3mCXA53Ql0LXmW5UfcSmJZq+J+TytqZ5YJcTmMLcojJysN65vcFIeCqRn6YidA+Q==", "dev": true, "requires": { "cross-spawn": "^5.0.1", @@ -12368,12 +11292,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true - }, "prettier": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", @@ -12436,34 +11354,15 @@ "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", "dev": true }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, - "pupa": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", - "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dev": true, - "requires": { - "escape-goat": "^2.0.0" - } - }, "qlobber": { - "version": "5.0.3", - "resolved": "https://registry.npmmirror.com/qlobber/-/qlobber-5.0.3.tgz", - "integrity": "sha512-wW4GTZPePyh0RgOsM18oDyOUlXfurVRgoNyJfS+y7VWPyd0GYhQp5T2tycZFZjonH+hngxIfklGJhTP/ghidgQ==", + "version": "7.0.1", + "resolved": "https://registry.npmmirror.com/qlobber/-/qlobber-7.0.1.tgz", + "integrity": "sha512-FsFg9lMuMEFNKmTO9nV7tlyPhx8BmskPPjH2akWycuYVTtWaVwhW5yCHLJQ6Q+3mvw5cFX2vMfW2l9z2SiYAbg==", "dev": true }, "qs": { @@ -12511,32 +11410,6 @@ "unpipe": "1.0.0" } }, - "rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - } - } - }, "read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", @@ -12614,24 +11487,6 @@ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, - "registry-auth-token": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", - "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", - "dev": true, - "requires": { - "rc": "^1.2.8" - } - }, - "registry-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", - "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, - "requires": { - "rc": "^1.2.8" - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -12657,15 +11512,6 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, - "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "requires": { - "lowercase-keys": "^1.0.0" - } - }, "restana": { "version": "4.9.5", "resolved": "https://registry.npmmirror.com/restana/-/restana-4.9.5.tgz", @@ -12763,9 +11609,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.3.8", + "resolved": "https://registry.npmmirror.com/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "requires": { "lru-cache": "^6.0.0" } @@ -12775,23 +11621,6 @@ "resolved": "https://registry.npmmirror.com/semver-compare/-/semver-compare-1.0.0.tgz", "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==" }, - "semver-diff": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", - "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dev": true, - "requires": { - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, "send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -12923,9 +11752,9 @@ } }, "sinon": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.0.tgz", - "integrity": "sha512-ugA6BFmE+WrJdh0owRZHToLd32Uw3Lxq6E6LtNRU+xTVBefx632h03Q7apXWRsRdZAJ41LB8aUfn2+O4jsDNMw==", + "version": "14.0.1", + "resolved": "https://registry.npmmirror.com/sinon/-/sinon-14.0.1.tgz", + "integrity": "sha512-JhJ0jCiyBWVAHDS+YSjgEbDn7Wgz9iIjA1/RK+eseJN0vAAWIWiXBdrnb92ELPyjsfreCYntD1ORtLSfIrlvSQ==", "dev": true, "requires": { "@sinonjs/commons": "^1.8.3", @@ -13176,9 +12005,9 @@ "dev": true }, "superagent": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-7.1.3.tgz", - "integrity": "sha512-WA6et4nAvgBCS73lJvv1D0ssI5uk5Gh+TGN/kNe+B608EtcVs/yzfl+OLXTzDs7tOBDIpvgh/WUs1K2OK1zTeQ==", + "version": "8.0.2", + "resolved": "https://registry.npmmirror.com/superagent/-/superagent-8.0.2.tgz", + "integrity": "sha512-QtYZ9uaNAMexI7XWl2vAXAh0j4q9H7T0WVEI/y5qaUB3QLwxo+voUgCQ217AokJzUTIVOp0RTo7fhZrwhD7A2Q==", "dev": true, "requires": { "component-emitter": "^1.3.0", @@ -13188,28 +12017,36 @@ "form-data": "^4.0.0", "formidable": "^2.0.1", "methods": "^1.1.2", - "mime": "^2.5.0", - "qs": "^6.10.3", - "readable-stream": "^3.6.0", + "mime": "2.6.0", + "qs": "^6.11.0", "semver": "^7.3.7" }, "dependencies": { "mime": { "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "resolved": "https://registry.npmmirror.com/mime/-/mime-2.6.0.tgz", "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", "dev": true + }, + "qs": { + "version": "6.11.0", + "resolved": "https://registry.npmmirror.com/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dev": true, + "requires": { + "side-channel": "^1.0.4" + } } } }, "supertest": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/supertest/-/supertest-6.2.3.tgz", - "integrity": "sha512-3GSdMYTMItzsSYjnIcljxMVZKPW1J9kYHZY+7yLfD0wpPwww97GeImZC1oOk0S5+wYl2niJwuFusBJqwLqYM3g==", + "version": "6.3.0", + "resolved": "https://registry.npmmirror.com/supertest/-/supertest-6.3.0.tgz", + "integrity": "sha512-QgWju1cNoacP81Rv88NKkQ4oXTzGg0eNZtOoxp1ROpbS4OHY/eK5b8meShuFtdni161o5X0VQvgo7ErVyKK+Ow==", "dev": true, "requires": { "methods": "^1.1.2", - "superagent": "^7.1.3" + "superagent": "^8.0.0" } }, "supports-color": { @@ -13284,12 +12121,6 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, - "timsort": { - "version": "0.3.0", - "resolved": "https://registry.npmmirror.com/timsort/-/timsort-0.3.0.tgz", - "integrity": "sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==", - "dev": true - }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -13299,12 +12130,6 @@ "os-tmpdir": "~1.0.2" } }, - "to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true - }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -13408,7 +12233,7 @@ }, "typedarray-to-buffer": { "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "resolved": "https://registry.npmmirror.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", "dev": true, "requires": { @@ -13416,9 +12241,9 @@ } }, "typescript": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", - "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", + "version": "4.8.4", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.8.4.tgz", + "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", "dev": true }, "unbox-primitive": { @@ -13432,15 +12257,6 @@ "which-boxed-primitive": "^1.0.2" } }, - "unique-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", - "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dev": true, - "requires": { - "crypto-random-string": "^2.0.0" - } - }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmmirror.com/universalify/-/universalify-0.1.2.tgz", @@ -13452,85 +12268,6 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, - "update-notifier": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", - "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", - "dev": true, - "requires": { - "boxen": "^5.0.0", - "chalk": "^4.1.0", - "configstore": "^5.0.1", - "has-yarn": "^2.1.0", - "import-lazy": "^2.1.0", - "is-ci": "^2.0.0", - "is-installed-globally": "^0.4.0", - "is-npm": "^5.0.0", - "is-yarn-global": "^0.3.0", - "latest-version": "^5.1.0", - "pupa": "^2.1.1", - "semver": "^7.3.4", - "semver-diff": "^3.1.1", - "xdg-basedir": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "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==", - "dev": true, - "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==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "import-lazy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", - "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", - "dev": true - }, - "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==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -13539,15 +12276,6 @@ "punycode": "^2.1.0" } }, - "url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "requires": { - "prepend-http": "^2.0.0" - } - }, "util": { "version": "0.12.4", "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", @@ -13695,15 +12423,6 @@ "is-typed-array": "^1.1.7" } }, - "widest-line": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", - "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dev": true, - "requires": { - "string-width": "^4.0.0" - } - }, "winston": { "version": "3.8.1", "resolved": "https://registry.npmmirror.com/winston/-/winston-3.8.1.tgz", @@ -13784,7 +12503,7 @@ }, "write-file-atomic": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "resolved": "https://registry.npmmirror.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz", "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", "dev": true, "requires": { @@ -13794,12 +12513,6 @@ "typedarray-to-buffer": "^3.1.5" } }, - "xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true - }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmmirror.com/xtend/-/xtend-4.0.2.tgz", @@ -13874,9 +12587,9 @@ "dev": true }, "z-schema": { - "version": "5.0.3", - "resolved": "https://registry.npmmirror.com/z-schema/-/z-schema-5.0.3.tgz", - "integrity": "sha512-sGvEcBOTNum68x9jCpCVGPFJ6mWnkD0YxOcddDlJHRx3tKdB2q8pCHExMVZo/AV/6geuVJXG7hljDaWG8+5GDw==", + "version": "5.0.4", + "resolved": "https://registry.npmmirror.com/z-schema/-/z-schema-5.0.4.tgz", + "integrity": "sha512-gm/lx3hDzJNcLwseIeQVm1UcwhWIKpSB4NqH89pTBtFns4k/HDHudsICtvG05Bvw/Mv3jMyk700y5dadueLHdA==", "dev": true, "requires": { "commander": "^2.20.3", diff --git a/package.json b/package.json index aac9c8c7..ac42fefa 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "@dapr/dapr": "2.3.1", - "body-parser": "^1.20.0", + "body-parser": "^1.20.1", "cloudevents": "^6.0.2", "debug": "^4.3.4", "express": "^4.18.1", @@ -22,10 +22,9 @@ "http-terminator": "^3.2.0", "lodash": "^4.17.21", "minimist": "^1.2.6", - "node-fetch": "2.6.5", "on-finished": "^2.4.1", "read-pkg-up": "^7.0.1", - "semver": "^7.3.7", + "semver": "^7.3.8", "skywalking-backend-js": "^0.5.1" }, "scripts": { @@ -56,14 +55,14 @@ "author": "OpenFunction", "license": "Apache-2.0", "devDependencies": { - "@microsoft/api-extractor": "^7.29.3", + "@microsoft/api-extractor": "^7.32.0", "@types/body-parser": "1.19.2", "@types/debug": "^4.1.7", - "@types/express": "4.17.13", + "@types/express": "4.17.14", "@types/google-protobuf": "^3.15.6", - "@types/lodash": "^4.14.184", + "@types/lodash": "^4.14.186", "@types/minimist": "1.2.2", - "@types/mocha": "9.1.1", + "@types/mocha": "10.0.0", "@types/node": "14.18.11", "@types/node-fetch": "^2.6.2", "@types/on-finished": "2.3.1", @@ -71,19 +70,20 @@ "@types/shelljs": "^0.8.11", "@types/sinon": "10.0.11", "@types/supertest": "2.0.12", - "aedes": "^0.47.0", + "aedes": "0.47.0", "clean-pkg-json": "^1.2.0", - "concurrently": "^7.3.0", + "concurrently": "^7.4.0", "cross-env": "^7.0.3", "env-cmd": "^10.1.0", - "gts": "^3.1.0", + "graphql-request": "^5.0.0", + "gts": "^3.1.1", "mocha": "10.0.0", "pack-n-play": "^1.0.0-2", - "pre-push": "^0.1.3", + "pre-push": "^0.1.4", "shelljs": "^0.8.5", - "sinon": "^14.0.0", - "supertest": "6.2.3", - "typescript": "^4.8.2", + "sinon": "^14.0.1", + "supertest": "6.3.0", + "typescript": "^4.8.4", "wait-on": "^6.0.1" } } diff --git a/src/loader.ts b/src/loader.ts index 56a74766..cf1098bf 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -22,21 +22,20 @@ import * as fs from 'fs'; import * as path from 'path'; import {pathToFileURL} from 'url'; +import Debug from 'debug'; import * as semver from 'semver'; import * as readPkgUp from 'read-pkg-up'; -import {forEach} from 'lodash'; +import {forEach, set} from 'lodash'; +import {TracingPlugin} from './openfunction/plugins'; import {Plugin, PluginStore, PluginMap} from './openfunction/plugin'; +import {OpenFunctionContext} from './openfunction/context'; import {HandlerFunction} from './functions'; import {getRegisteredFunction} from './function_registry'; import {SignatureType} from './types'; -import {FrameworkOptions} from './options'; -import {OpenFunctionContext} from './openfunction/context'; -import { - SKYWALKINGNAME, - SkyWalkingPlugin, -} from './openfunction/plugin/skywalking/skywalking'; + +const debug = Debug('common:loader'); // Dynamic import function required to load user code packaged as an // ES module is only available on Node.js v13.2.0 and up. @@ -248,12 +247,13 @@ export async function getFunctionPlugins( } catch (ex) { const err = ex; console.error( - "Provided module can't be loaded. Plesae make sure your module extend Plugin class properly." + + 'Provided module cannot be loaded. Plesae make sure your module extend Plugin class properly.' + `\nDetailed stack trace: ${err.stack}` ); } } + debug('Custom plugins loaded: %o', Object.keys(plugins)); return plugins; } @@ -279,46 +279,32 @@ function getPluginsModulePath(codeLocation: string): string[] | null { } } -/** - * It loads BUIDIN type plugins from the /openfunction/plugin. - * @param context - The context of OpenFunction. - */ -export async function loadBuidInPlugins(options: FrameworkOptions) { - if (!options.context) { - console.warn("The context is undefined can't load BUIDIN type plugins"); - return; - } +export async function getBuiltinPlugins( + context: OpenFunctionContext +): Promise { + if (!context) return null; + + // Setup store for builtin plugins const store = PluginStore.Instance(PluginStore.Type.BUILTIN); - //Provide system info for BUILDIN type plugins + const plugins: PluginMap = {}; - if (checkTraceConfig(options.context)) { - const skywalking = new SkyWalkingPlugin(options); - store.register(skywalking); - options.context.prePlugins?.push(SKYWALKINGNAME); - options.context.postPlugins?.push(SKYWALKINGNAME); - } -} + // Try to create and add tracing plugin + try { + // Save function name into configuration and create the plugin + set(context, 'pluginsTracing.tags.func', context.name); + const tracing = TracingPlugin.Create(context.pluginsTracing); -/** - * It check trace config ,it will set default value if it is enbaled. - * @param tracing - The config of TraceConfig. - */ -function checkTraceConfig(context: OpenFunctionContext): boolean { - if (!context.tracing) { - console.warn('TraceConfig is invalid'); - return false; - } - if (!context.tracing.enabled) { - return false; - } - if (!context.tracing.tags) { - context.tracing.tags = {}; + if (tracing) { + store.register(tracing); + plugins[tracing.name] = tracing; + } + } catch (ex) { + const err = ex; + console.error( + `Tracing plugin cannot be initialized.\nDetailed stack trace: ${err.stack}` + ); } - //Set default trace provider config - context.tracing.provider = { - name: context.tracing.provider?.name || SKYWALKINGNAME, - oapServer: context.tracing.provider?.oapServer || '127.0.0.1:11800', - }; - return true; + debug('Builtin plugins loaded: %o', Object.keys(plugins)); + return plugins; } diff --git a/src/main.ts b/src/main.ts index 391848da..1bf9c641 100644 --- a/src/main.ts +++ b/src/main.ts @@ -21,9 +21,9 @@ import * as process from 'process'; import {createHttpTerminator} from 'http-terminator'; import getAysncServer from './openfunction/async_server'; -import {OpenFunctionContext, ContextUtils} from './openfunction/context'; +import {ContextUtils} from './openfunction/context'; -import {getUserFunction, getFunctionPlugins, loadBuidInPlugins} from './loader'; +import {getUserFunction, getFunctionPlugins, getBuiltinPlugins} from './loader'; import {ErrorHandler} from './invoker'; import {getServer} from './server'; import {parseOptions, helpText, OptionsError} from './options'; @@ -54,14 +54,15 @@ export const main = async () => { } const {userFunction, signatureType} = loadedFunction; - // First load BUIDIN type plugin - await loadBuidInPlugins(options); // Load function plugins before starting server + // First, we load system built-in function plugins + await getBuiltinPlugins(options.context!); + // Then, we load user-defined function plugins await getFunctionPlugins(options.sourceLocation); // Try to determine the server runtime // Considering the async runtime in the first place - if (ContextUtils.IsAsyncRuntime(options.context as OpenFunctionContext)) { + if (ContextUtils.IsAsyncRuntime(options.context!)) { options.context!.port = options.port; const server = getAysncServer( diff --git a/src/openfunction/context.ts b/src/openfunction/context.ts index a0689c40..15c66549 100644 --- a/src/openfunction/context.ts +++ b/src/openfunction/context.ts @@ -25,11 +25,11 @@ export interface OpenFunctionContext { /** * Optional input binding object. */ - inputs?: OpenFunctionBinding; + inputs?: Record; /** * Optional output binding object. */ - outputs?: OpenFunctionBinding; + outputs?: Record; /** * Optional plugins to be executed before user function. */ @@ -39,20 +39,9 @@ export interface OpenFunctionContext { */ postPlugins?: string[]; /** - * Optional trace config + * Optional trace plugin config. */ - tracing?: TraceConfig; -} - -/** - * The binding interface of the context. - * @public - */ -export interface OpenFunctionBinding { - /** - * The hash map of the binding. - */ - [key: string]: OpenFunctionComponent; + pluginsTracing?: TraceConfig; } /** @@ -153,41 +142,57 @@ export class ContextUtils { } /** - * The config of the trace. + * The config of the trace plugin. * @public */ export interface TraceConfig { /** - * This is trace switch + * Switch of the tracer */ enabled: boolean; /** - * Trace Provider + * Provider of the tracer */ - provider?: TraceProvider; + provider: TraceProvider; /** - * Trace tags + * Optional tags of the tracer */ - tags?: Record; + tags?: Record & {func?: string}; /** - * Trace baggage + * Optional baggage of the tracer */ baggage?: Record; } /** - * The trace provider info. + * The trace provider object. * @public */ export interface TraceProvider { /** - * Provider name - * Now is just support skywalking + * The name of the provider. */ - name: string; + name: + | `${TraceProviderType}` + | `${Capitalize}` + | `${Uppercase}`; /** - * OapServer address - * example [skywalking-oap:11800] + * The address of the OAP server. */ oapServer: string; } + +/** + * Defining trace provider type enumeration. + * @public + */ +export enum TraceProviderType { + /** + * The SkyWalking type. + */ + SkyWalking = 'skywalking', + /** + * The OpenTelemetry type. + */ + OpenTelemetry = 'opentelemetry', +} diff --git a/src/openfunction/plugin.ts b/src/openfunction/plugin.ts index 946796f4..7637b875 100644 --- a/src/openfunction/plugin.ts +++ b/src/openfunction/plugin.ts @@ -1,8 +1,11 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import {get, invoke, omit, transform, trim} from 'lodash'; +import * as Debug from 'debug'; +import {get, invoke, isEmpty, omit, transform, trim} from 'lodash'; import {OpenFunctionRuntime} from './runtime'; +const debug = Debug('ofn:plugin'); + /** * Defining an abstract class to represent Plugin. * @public @@ -108,17 +111,25 @@ export class PluginStore { return new PluginStore(type); } + /** + * Internal store type. + */ + #type = PluginStoreType.CUSTOM; + /** * Internal store object. */ - #store: PluginMap | null = null; + readonly #store: PluginMap | null = null; /** * Private constructor of PluginStore. * @param type - PluginStoreType - The type of store you want to use. */ private constructor(type: PluginStoreType) { - if (!this.#store) this.#store = stores[type]; + if (!this.#store) { + this.#type = type; + this.#store = stores[type]; + } } /** @@ -148,6 +159,14 @@ export class PluginStore { return this.#store![name]; } + /** + * Getter that tells whether the store is custom type. + * @returns `true` if the `#type` is `PluginStoreType.CUSTOM`. + */ + get #isCustomStore(): boolean { + return this.#type === PluginStoreType.CUSTOM; + } + /** * It invokes the `execPreHook` function of each plugin in the order specified by the `seq` array * @param ctx - The context object that is passed to the plugin. @@ -157,7 +176,7 @@ export class PluginStore { await this.#invokePluginBySeq( ctx, 'execPreHook', - seq || get(ctx, 'prePlugins', null) + seq || (this.#isCustomStore && get(ctx, 'prePlugins')) ); } @@ -170,7 +189,7 @@ export class PluginStore { await this.#invokePluginBySeq( ctx, 'execPostHook', - seq || get(ctx, 'postPlugins', null) + seq || (this.#isCustomStore && get(ctx, 'postPlugins')) ); } @@ -185,12 +204,23 @@ export class PluginStore { method: keyof Plugin, seq: string[] ) { - const pluginNames = seq ?? this.#store!._seq; + const pluginNames = !isEmpty(seq) ? seq : this.#store!._seq ?? []; const plugins = this.#store!; for (const pluginName of pluginNames) { const plugin = plugins[pluginName]; - await invoke(plugin, method, ctx, plugins); + debug('Executing "%s" of plugin "%s"', method, pluginName); + + // Try to invoke the plugin method and catch exceptions + try { + await invoke(plugin, method, ctx, plugins); + } catch (ex) { + const err = ex; + console.error( + `Failed to invoke "${method}" of plugin "${pluginName}"` + + `\nDetailed stack trace: ${err.stack}` + ); + } } } } diff --git a/src/openfunction/plugin/skywalking/skywalking.ts b/src/openfunction/plugin/skywalking/skywalking.ts deleted file mode 100644 index 33bed7ce..00000000 --- a/src/openfunction/plugin/skywalking/skywalking.ts +++ /dev/null @@ -1,114 +0,0 @@ -import {forEach} from 'lodash'; -import agent, {ContextManager} from 'skywalking-backend-js'; -import SpanContext from 'skywalking-backend-js/lib/trace/context/SpanContext'; -import {SpanLayer} from 'skywalking-backend-js/lib/proto/language-agent/Tracing_pb'; -import {Component} from 'skywalking-backend-js/lib/trace/Component'; -import {Tag} from 'skywalking-backend-js/lib/Tag'; -import Span from 'skywalking-backend-js/lib/trace/span/Span'; -import Context from 'skywalking-backend-js/lib/trace/context/Context'; - -import {Plugin} from '../../plugin'; -import {OpenFunctionRuntime} from '../../runtime'; -import {TraceConfig} from '../../context'; -import {FrameworkOptions} from '../../../options'; - -// https://github.com/apache/skywalking/blob/master/oap-server/server-starter/src/main/resources/component-libraries.yml#L515 -const componentIDOpenFunction = new Component(5013); - -export const SKYWALKINGNAME = 'skywalking'; - -class Trace { - private span: Span; - private spanContext: Context; - - constructor(functionName: string) { - this.spanContext = ContextManager.hasContext - ? ContextManager.current - : new SpanContext(); - - this.span = this.spanContext.newEntrySpan(`/${functionName}`, undefined); - } - - async start(tags: Array): Promise { - forEach(tags, tag => { - this.span.tag(tag); - }); - this.span.layer = SpanLayer.FAAS; - this.span.component = componentIDOpenFunction; - this.span.start(); - this.span.async(); - return this.spanContext.traceId(); - } - - async stop() { - this.span.stop(); - this.spanContext.stop(this.span); - await agent.flush(); - } -} - -/** - * Defining an class to provide trace ability alugin by skywalking . - * @public - **/ -export class SkyWalkingPlugin extends Plugin { - private trace: Trace | undefined; - private tags: Array = []; - private functionName = 'function'; - - constructor(options: FrameworkOptions) { - super(SKYWALKINGNAME, 'v1'); - - this.functionName = options.target; - - // Start skywalking agent - agent.start({ - serviceName: this.functionName, - serviceInstance: 'openfunctionInstance', - collectorAddress: options.context!.tracing!.provider!.oapServer, - }); - - if (!options.context!.tracing!.tags) { - options.context!.tracing!.tags = {}; - } - options.context!.tracing!.tags!['RuntimeType'] = - options.context?.runtime || 'Knative'; - this.iniAttribute(options.context!.tracing!); - } - - iniAttribute(traceConfig: TraceConfig) { - for (const key in traceConfig.tags) { - this.tags.push({ - key, - val: traceConfig.tags[key], - overridable: false, - }); - } - } - - async execPreHook( - ctx: OpenFunctionRuntime | null, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - plugins: Record - ) { - if (ctx === null) { - console.warn('OpenFunctionRuntime [ctx] is null'); - return; - } - this.trace = new Trace(this.functionName); - const traceId = await this.trace.start(this.tags); - ctx.locals.traceId = traceId; - } - - async execPostHook( - ctx: OpenFunctionRuntime | null, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - plugins: Record - ) { - if (ctx === null) { - console.warn('OpenFunctionRuntime [ctx] is null'); - return; - } - await this.trace?.stop(); - } -} diff --git a/src/openfunction/plugins/index.ts b/src/openfunction/plugins/index.ts new file mode 100644 index 00000000..3271dfd3 --- /dev/null +++ b/src/openfunction/plugins/index.ts @@ -0,0 +1,3 @@ +import TracingPlugin from './tracing'; + +export {TracingPlugin}; diff --git a/src/openfunction/plugins/tracing/index.ts b/src/openfunction/plugins/tracing/index.ts new file mode 100644 index 00000000..98db672a --- /dev/null +++ b/src/openfunction/plugins/tracing/index.ts @@ -0,0 +1,77 @@ +import {TraceConfig, TraceProviderType} from '../../context'; +import {Plugin} from '../../plugin'; + +export default abstract class Tracing extends Plugin { + /** + * Property to hold the trace configurations. + */ + protected readonly config: TraceConfig; + + /** + * The constructor function is called when a new instance of the class is created + * @param config - TraceConfig - Configuration object that you can use to configure the agent. + */ + constructor(config: TraceConfig) { + super('tracing', 'v1'); + + this.config = config; + this.startAgent(); + } + + /** + * If the config is enabled, return a new instance of the supported tracing plugin. + * @param [config] - TraceConfig - The configuration of the plugin. + * @returns A Plugin object or null. + */ + static Create(config?: TraceConfig): Plugin | null { + if (!config?.enabled) return null; + + // So far, we only support SkyWalking + if (config?.provider?.name === TraceProviderType.SkyWalking) + return new SkyWalking(config); + + return null; + } + + /** + * Getter returns whether thie plugin is enabled. + * @returns A boolean value of the enabled property of the config object. + */ + get enabled(): boolean { + return !!this.config.enabled; + } + + /** + * Pre hook starts a tracing span. + * @param ctx - The context object that is passed to the hook. + */ + async execPreHook(ctx: unknown) { + await this.startSpan(ctx); + } + + /** + * Post hook ends a tracing span. + * @param ctx - The context object that is passed to the hook. + */ + async execPostHook(ctx: unknown) { + await this.stopSpan(ctx); + } + + /** + * Abstract method to start the tracer agent. + */ + protected abstract startAgent(): void; + /** + * Abstract method to start the context span. + * @param ctx OpenFunction runtime context. + */ + protected abstract startSpan(ctx: unknown): Promise; + /** + * Abstract method to stop the context span. + * @param ctx OpenFunction runtime context. + */ + protected abstract stopSpan(ctx: unknown): Promise; +} + +// HACK: Break circular reference +import SkyWalking from './skywalking'; diff --git a/src/openfunction/plugins/tracing/skywalking.ts b/src/openfunction/plugins/tracing/skywalking.ts new file mode 100644 index 00000000..32a1baaa --- /dev/null +++ b/src/openfunction/plugins/tracing/skywalking.ts @@ -0,0 +1,114 @@ +import * as Debug from 'debug'; +import {forEach, get} from 'lodash'; + +import agent, {ContextManager} from 'skywalking-backend-js'; +import Tag from 'skywalking-backend-js/lib/Tag'; +import {Component} from 'skywalking-backend-js/lib/trace/Component'; +import {ContextCarrier} from 'skywalking-backend-js/lib/trace/context/ContextCarrier'; +import {SpanLayer} from 'skywalking-backend-js/lib/proto/language-agent/Tracing_pb'; + +import {OpenFunctionRuntime} from '../../runtime'; + +import Tracing from '.'; + +const debug = Debug('ofn:plugin:tracing'); + +/** + * SkyWalking specific implementation of tracer plugin. + * See also: https://github.com/apache/skywalking-data-collect-protocol/blob/master/language-agent/Tracing.proto + */ +export default class SkyWalking extends Tracing { + /** + * It starts the SkyWalking tracer agent. + */ + protected async startAgent() { + // AgentConfig: https://github.com/apache/skywalking-nodejs/blob/master/src/config/AgentConfig.ts + agent.start({ + serviceName: this.config.tags?.func, + collectorAddress: this.config.provider?.oapServer || '127.0.0.1:11800', + // FIXME: NO span could be recorded with "http" plugin enabled + // FIXME: "express" plugin will block error span record + disablePlugins: 'http,express', + }); + } + + /** + * It creates a new entry span, sets the span layer to FAAS, and sets the span tags. + * @param ctx - OpenFunctionRuntime - The context object that is passed to the function. + */ + protected async startSpan(ctx: OpenFunctionRuntime) { + const context = ContextManager.current; + const span = + ContextManager.currentSpan ?? + context.newEntrySpan('/', this.#getCarrier(ctx)); + + span.operation = get(ctx, 'name'); + span.component = this.#component; + span.layer = SpanLayer.FAAS; + + // Pass through some typical tags per the context + span.tag({ + key: 'runtime', + val: get(ctx, 'runtime'), + overridable: false, + }); + + if (ctx.req) { + span.tag(Tag.httpMethod(ctx.req?.method)); + span.tag(Tag.httpURL(ctx.req?.originalUrl)); + } + + // Pass through user defined "tags" data + forEach(this.config.tags, (val, key) => { + span.tag({ + key, + val, + overridable: false, + }); + }); + + // Start the span once all set + // span.async(); + span.start(); + + // FIXME: SkyWalking Node.js SDK has not implemented "sw-correlation" injection, + // so we cannot deal with "baggage" data passed through tracer plugin options + + // Save back trace id for potential future use + ctx.locals.traceId = context.traceId(); + debug('Span trace id: %s', ctx.locals.traceId); + } + + /** + * It stops the current span, and if there was an error, it marks the span as an error. + * @param ctx - OpenFunctionRuntime - The context object that is passed to the function. + */ + protected async stopSpan(ctx: OpenFunctionRuntime) { + const span = ContextManager.currentSpan; + + ctx.error && span.error(ctx.error); + span.stop(); + + // NOTE: `flush` may take some time + await agent.flush(); + } + + /** + * Private getter for OpenFunction tracer component. + * See also: https://github.com/apache/skywalking/blob/master/oap-server/server-starter/src/main/resources/component-libraries.yml#L548 + */ + get #component(): Component { + return new Component(5013); + } + + /** + * If the request has headers, return a ContextCarrier from those headers. + * See also: https://skyapm.github.io/document-cn-translation-of-skywalking/zh/8.0.0/protocols/Skywalking-Cross-Process-Propagation-Headers-Protocol-v3.html + * + * @param ctx - OpenFunctionRuntime - The context object that is passed to the function. + * @returns The ContextCarrier is being returned. + */ + #getCarrier(ctx: OpenFunctionRuntime): ContextCarrier | undefined { + return ContextCarrier.from(ctx.req?.headers as Record); + } +} diff --git a/src/openfunction/runtime.ts b/src/openfunction/runtime.ts index 85b3f887..22a8ab4d 100644 --- a/src/openfunction/runtime.ts +++ b/src/openfunction/runtime.ts @@ -51,6 +51,11 @@ export abstract class OpenFunctionRuntime { // eslint-disable-next-line @typescript-eslint/no-explicit-any readonly locals: Record; + /** + * The optional error object to hold exception data. + */ + error?: Error; + /** * Constructor of the OpenFunctionRuntime. */ @@ -107,16 +112,23 @@ export abstract class OpenFunctionRuntime { const sysPlugins = PluginStore.Instance(PluginStore.Type.BUILTIN); return async data => { - // Execute pre hooks, system plugins go first - await sysPlugins.execPreHooks(ctx); + // Execute pre hooks, user plugins go first await userPlugins.execPreHooks(ctx); + await sysPlugins.execPreHooks(ctx); - // Execute user function - await userFunction(ctx, data); + // Execute user function and save error for lazy reporting + try { + await userFunction(ctx, data); + } catch (ex) { + ctx.error = ex; + } - // Execute pre hooks, system plugins go last + // Execute pre hooks, user plugins go last await sysPlugins.execPostHooks(ctx); await userPlugins.execPostHooks(ctx); + + // Report error if exists at the very last + if (ctx.error) throw ctx.error; }; } diff --git a/test/data/mock/context.ts b/test/data/mock/context.ts index d1f43650..1f934a57 100644 --- a/test/data/mock/context.ts +++ b/test/data/mock/context.ts @@ -1,4 +1,7 @@ -import {OpenFunctionContext} from '../../../src'; +import { + OpenFunctionContext, + TraceConfig, +} from '../../../src/openfunction/context'; export const KnativeBase: OpenFunctionContext = { name: 'test-context', @@ -67,3 +70,19 @@ export const AsyncBase: OpenFunctionContext = { }, }, }; + +export const TracerPluginBase: TraceConfig = { + enabled: true, + provider: { + name: 'skywalking', + oapServer: 'localhost:11800', + }, + tags: { + tag1: 'value1', + tag2: 'value2', + }, + baggage: { + key: 'key1', + value: 'value1', + }, +}; diff --git a/test/data/plugins/skywalking.mjs b/test/data/plugins/skywalking.mjs new file mode 100644 index 00000000..8c55a2f1 --- /dev/null +++ b/test/data/plugins/skywalking.mjs @@ -0,0 +1,56 @@ +import * as assert from 'assert'; + +import {GraphQLClient, gql} from 'graphql-request'; + +import {Plugin} from '../../../build/src/index.js'; + +export class SkyPathfinder extends Plugin { + span = {}; + + constructor() { + super('sky-pathfinder', 'v1'); + } + + async execPostHook(ctx) { + // Wait a while for trace logging + await new Promise(r => setTimeout(r, 1000)); + + const traceId = ctx.locals.traceId; + const {trace} = await this.queryGraph(traceId); + + this.span = trace.spans[0]; + console.log('[ span ] >', ctx.locals.traceId, span); + } + + async queryGraph(traceId, endpoint = 'http://localhost:12800/graphql') { + const client = new GraphQLClient(endpoint, { + headers: { + // Why need this header? https://github.com/prisma-labs/graphql-request/issues/140 + accept: 'application/json', + }, + }); + + // Spec: https://github.com/apache/skywalking-query-protocol/blob/master/trace.graphqls + const query = gql` + query ($traceId: ID!) { + trace: queryTrace(traceId: $traceId) { + spans { + traceId + endpointName + type + component + layer + isError + tags { + key + value + } + } + } + } + `; + + const data = await client.request(query, {traceId}); + return data; + } +} diff --git a/test/data/plugins/skywalking_assist.mjs b/test/data/plugins/skywalking_assist.mjs deleted file mode 100644 index 15924f9e..00000000 --- a/test/data/plugins/skywalking_assist.mjs +++ /dev/null @@ -1,35 +0,0 @@ -import assert from 'assert'; -import {Plugin} from '../../../build/src/index.js'; -import {query,OapServer,sleep} from '../../../build/test/integration/build_in_plugin.js' -//Help to verify skywalking plugin -export class Assist extends Plugin { - constructor() { - super('assist', 'v1'); - } - - async execPreHook(ctx, plugins) { - } - - async execPostHook(ctx, plugins) { - const traceId = ctx.locals.traceId; - const options = ctx.locals.options; - sleep(3000).then(()=>{ - query(traceId,OapServer).then(res=>{ - res.json().then(res=>{ - if(res.data.trace.spans.length >=0){ - let target = null; - for (const item of res.data.trace.spans) { - if (item.endpointName === `/${options.target}`) { - target = item; - } - } - assert(target !== null); - assert(target.endpointName === `/${options.target}`); - - ctx.locals.done?.(); - } - }) - }) - }) - } - } \ No newline at end of file diff --git a/test/integration/build_in_plugin.ts b/test/integration/build_in_plugin.ts deleted file mode 100644 index 42a1dfb7..00000000 --- a/test/integration/build_in_plugin.ts +++ /dev/null @@ -1,232 +0,0 @@ -import {ifError, notStrictEqual, deepStrictEqual, ok} from 'assert'; -import {createServer} from 'net'; -import {execSync} from 'child_process'; - -import {get} from 'lodash'; -import * as shell from 'shelljs'; -import * as MQTT from 'aedes'; -import fetch from 'node-fetch'; - -import {FrameworkOptions} from '../../src/options'; -import {SKYWALKINGNAME} from '../../src/openfunction/plugin/skywalking/skywalking'; -import {PluginStore} from '../../src/openfunction/plugin'; -import {OpenFunctionRuntime} from '../../src/openfunction/runtime'; -import {OpenFunctionContext} from '../../src/openfunction/context'; -import getAysncServer from '../../src/openfunction/async_server'; -import {getFunctionPlugins, loadBuidInPlugins} from '../../src/loader'; - -import {Context} from '../data/mock'; - -const TEST_CONTEXT = Context.AsyncBase; - -export const OapServer = '127.0.0.1:12800'; - -export const sleep = (val: number) => { - return new Promise(resolve => setTimeout(resolve, val)); -}; - -export const query = async (traceId: string, url: string) => { - const body = { - query: `query queryTrace($traceId: ID!) { - trace: queryTrace(traceId: $traceId) { - spans { - traceId - segmentId - spanId - parentSpanId - refs { - traceId - parentSegmentId - parentSpanId - type - } - serviceCode - startTime - endTime - endpointName - type - peer - component - isError - layer - tags { - key - value - } - logs { - time - data { - key - value - } - } - } - } - }`, - variables: { - traceId, - }, - }; - return await fetch(`http://${url}/graphql`, { - method: 'POST', - body: JSON.stringify(body), - }); -}; - -//Verify skywalking proccess , start it if not exist -export const checkSkyWalkingProcess = async ( - reCheck: boolean -): Promise => { - try { - const buffer = execSync('docker ps -a').toString(); - - let flag = false; - for (const line of buffer.split('\n')) { - if (line.indexOf('apache/skywalking-oap-server:8.4.0-es6') !== -1) { - if (line.indexOf('Up') !== -1) { - console.log('skywalking oap server is start'); - flag = true; - } else if (line.indexOf('Exited') !== -1) { - console.log('skywalking oap server is stop , now start it '); - console.log( - execSync('docker start ' + line.substring(0, 13)).toString() - ); - flag = true; - } - break; - } - } - if (!flag) { - const startCmd = - 'docker run -d --name oap -p 12800:12800 -p 11800:11800 apache/skywalking-oap-server:8.4.0-es6'; - execSync(startCmd); - console.log(startCmd); - return reCheck ? false : checkSkyWalkingProcess(true); - } - } catch (error) { - console.log('start fail'); - return false; - } - return true; -}; -describe('Build in plugin', () => { - const APPID = 'async.dapr'; - const broker = MQTT.Server(); - const server = createServer(broker.handle); - before(done => { - // Start simple plain MQTT server via aedes - server.listen(1883, () => { - // Try to run Dapr sidecar and listen for the async server - shell.exec( - `dapr run -H 3500 -G 50001 -p ${TEST_CONTEXT.port} -d ./test/data/components/async -a ${APPID} --log-level debug`, - { - silent: true, - async: true, - } - ); - done(); - }); - }); - - after(done => { - // Stop dapr sidecar process - shell.exec(`dapr stop ${APPID}`, { - silent: true, - }); - server.close(); - broker.close(done); - }); - - it('mqtt binding w/ skywalking plugin', done => { - const options: FrameworkOptions = { - target: 'test', - port: '', - sourceLocation: '', - signatureType: 'http', - printHelp: false, - context: { - ...TEST_CONTEXT, - tracing: { - enabled: true, - }, - prePlugins: ['assist'], - postPlugins: ['assist'], - }, - }; - getFunctionPlugins(process.cwd() + '/test/data').then(plugins => { - loadBuidInPlugins(options).then(() => { - const start = get(plugins!.numbers, 'oct'); - - const app = getAysncServer((ctx, data) => { - notStrictEqual(ctx.locals.traceId, null || undefined); - // Passthrough test done handler - ctx.locals.done = done; - ctx.locals.app = app; - ctx.locals.options = options; - ctx.send({some: 'payload'}); - }, options.context!); - - // First, we start the async server - app.start().then(() => { - // Then, we send a number as start value to user function - broker.publish( - { - cmd: 'publish', - topic: 'default', - payload: JSON.stringify({start}), - qos: 0, - retain: false, - dup: false, - }, - err => ifError(err) - ); - }); - }); - }); - }); - - it('skywalking plugin', async () => { - const options = { - target: 'test', - context: { - ...TEST_CONTEXT, - tracing: { - enabled: true, - }, - }, - }; - ok((await checkSkyWalkingProcess(false)) === true); - await loadBuidInPlugins(options as FrameworkOptions); - const skywalking = PluginStore.Instance(1).get(SKYWALKINGNAME); - ok(skywalking.name === SKYWALKINGNAME); - - const runtime = OpenFunctionRuntime.ProxyContext( - options.context as OpenFunctionContext - ); - await skywalking.execPreHook(runtime, {}); - const traceId = runtime.locals.traceId; - await sleep(2000); - await skywalking.execPostHook(runtime, {}); - console.log(traceId); - const response = query(traceId, OapServer); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const data = (await (await response).json()) as any; - console.log(data); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let target: unknown | any = null; - for (const item of data.data.trace.spans) { - console.log(item.serviceCode); - if (item.endpointName === `/${options.target}`) { - target = item; - } - } - notStrictEqual(target, null); - deepStrictEqual(target.endpointName, `/${options.target}`); - - for (const tag in target.tags) { - if (tag === 'RuntimeType') { - ok(target.tags[tag] === options.context.runtime); - } - } - }); -}); diff --git a/test/integration/http_binding.ts b/test/integration/http_binding.ts index 9517cb88..bb7b864e 100644 --- a/test/integration/http_binding.ts +++ b/test/integration/http_binding.ts @@ -8,12 +8,15 @@ import {cloneDeep, forEach, get, set} from 'lodash'; import {PluginStore} from '../../src/openfunction/plugin'; import {OpenFunctionRuntime} from '../../src/functions'; import {getServer} from '../../src/server'; -import {getFunctionPlugins} from '../../src/loader'; +import {getFunctionPlugins, getBuiltinPlugins} from '../../src/loader'; import {FUNCTION_STATUS_HEADER_FIELD} from '../../src/types'; import {Context, Payload} from '../data/mock'; -const TEST_CONTEXT = Context.KnativeBase; +const TEST_CONTEXT = { + ...Context.KnativeBase, + pluginsTracing: Context.TracerPluginBase, +}; const TEST_PAYLOAD = Payload.Plain.RAW; describe('OpenFunction - HTTP Binding', () => { @@ -23,26 +26,35 @@ describe('OpenFunction - HTTP Binding', () => { if (shell.exec('dapr', {silent: true}).code !== 0) throw new Error('Please ensure "dapr" is installed'); + if (shell.exec('docker', {silent: true}).code !== 0) + throw new Error('Please ensure "docker" is installed'); + + // Try to start up skywalking oap server docker container + shell.exec( + 'docker run --name oap --rm -d -p 11800:11800 -p 12800:12800 apache/skywalking-oap-server:9.2.0', + {silent: true} + ); + // Try to run Dapr sidecar on port 3500 with components for testing shell.exec( `dapr run -H 3500 -G 50001 -d ./test/data/components/http -a ${APPID}`, - { - silent: true, - async: true, - } + {silent: true, async: true} ); - getFunctionPlugins(process.cwd() + '/test/data').then(() => { - // Wait 5 seconds for dapr sidecar to start - setTimeout(done, 5000); - }); + getFunctionPlugins(process.cwd() + '/test/data') + .then(() => getBuiltinPlugins(TEST_CONTEXT)) + .then(() => { + // FIXME: NEED wait quite a lot of time for oap server and dapr sidecar to bootup + setTimeout(done, 30 * 1000); + }); }); after(() => { + // Stop skywalking oap server container + shell.exec('docker stop oap', {silent: true}); + // Stop dapr sidecar process - shell.exec(`dapr stop ${APPID}`, { - silent: true, - }); + shell.exec(`dapr stop ${APPID}`, {silent: true}); }); beforeEach(() => { @@ -54,16 +66,18 @@ describe('OpenFunction - HTTP Binding', () => { }); const testData = [ + {name: 'Error data', operation: '', listable: false}, {name: 'Save data', operation: 'create', listable: true}, {name: 'Get data', operation: 'get', listable: true}, {name: 'Delete data', operation: 'delete', listable: false}, - {name: 'Error data', operation: '', listable: false}, ]; - testData.forEach(test => { + for (const test of testData) { it(test.name, async () => { const context = cloneDeep(TEST_CONTEXT); context.prePlugins = context.postPlugins = ['ticktock']; + context.postPlugins.push('sky-pathfinder'); + forEach(context.outputs, output => set(output, 'operation', test.operation) ); @@ -73,6 +87,8 @@ describe('OpenFunction - HTTP Binding', () => { if (!test.operation) throw new Error('I crashed'); await ctx.send(data); + + // FIXME: This makes server respond right away, even before post hooks ctx.res?.send(data); }, 'openfunction', @@ -83,18 +99,31 @@ describe('OpenFunction - HTTP Binding', () => { .post('/') .send(TEST_PAYLOAD) .expect(test.operation ? 200 : 500) - .expect(res => { - const tick = get(PluginStore.Instance().get('ticktock'), 'value'); + // Assert HTTP response first + .then(res => { if (!test.operation) { deepStrictEqual( res.headers[FUNCTION_STATUS_HEADER_FIELD.toLowerCase()], 'error' ); - deepStrictEqual(tick, 1); } else { deepStrictEqual(res.body, TEST_PAYLOAD); - deepStrictEqual(tick, 0); } + }) + // Wait a few seconds for post hooks execution to complete + .then(() => new Promise(r => setTimeout(r, 2000))) + // Then assert user defined hooks are executed + .then(() => { + const tick = get(PluginStore.Instance().get('ticktock'), 'value'); + deepStrictEqual(tick, 0); + }) + .then(() => { + const sky = PluginStore.Instance().get('sky-pathfinder'); + const span = get(sky, 'span'); + + deepStrictEqual(get(span, 'component'), 'OpenFunction'); + deepStrictEqual(get(span, 'layer'), 'FAAS'); + deepStrictEqual(get(span, 'isError'), !test.operation); }); forEach(context.outputs, output => { @@ -102,5 +131,5 @@ describe('OpenFunction - HTTP Binding', () => { deepStrictEqual(listable, test.listable); }); }); - }); + } }); From f612cbe2439267c7cf9f8b3e9c96ab0e7650255c Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 8 Oct 2022 17:35:11 +0800 Subject: [PATCH 39/42] =?UTF-8?q?=F0=9F=91=B7=20ci(unit):=20refactor=20sky?= =?UTF-8?q?walking=20related=20steps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- .github/workflows/unit.yml | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index e54221f2..8169a5d9 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -12,35 +12,35 @@ jobs: dapr-version: [1.6.3, 1.7.4, 1.8.3] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} + steps: - name: Checkout uses: actions/checkout@v3 + + - name: Install Docker + uses: docker-practice/actions-setup-docker@master + + - name: Install SkyWalking + run: docker pull apache/skywalking-oap-server:9.2.0 + + - name: Install Dapr CLI + uses: dapr/setup-dapr@v1 + with: + version: '1.8.1' + + - name: Initialize Dapr Runtime + run: dapr init -s --runtime-version ${{ matrix.dapr-version }} + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Install Dapr - uses: dapr/setup-dapr@v1 - with: - version: '1.8.0' - - name: Install Docker for macOS - uses: docker-practice/actions-setup-docker@master - if: ${{ matrix.platform == 'macos-latest' }} - - name: Install Docker for ubuntu - uses: docker-practice/actions-setup-docker@master - if: ${{ matrix.platform == 'ubuntu-latest' }} - - name: Install skywalking and wait for it start - run: | - docker version - docker pull apache/skywalking-oap-server:8.4.0-es6 - docker run -d --name oap -p 12800:12800 -p 11800:11800 apache/skywalking-oap-server:8.4.0-es6 - docker ps - sleep 20s - - name: Initialize Dapr - run: dapr init -s --runtime-version ${{ matrix.dapr-version }} - - name: Install dependencies + + - name: Install Project Dependencies run: npm install - - name: Build TypeScript project + + - name: Build TypeScript Project run: npm run build --if-present - - name: Test + + - name: Run Tests run: npm test From b12d72baf42e15e4e3f2d757adf18672c10ea910 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 8 Oct 2022 18:02:59 +0800 Subject: [PATCH 40/42] =?UTF-8?q?=E2=AC=87=EF=B8=8F=20chore(deps):=20bump?= =?UTF-8?q?=20dapr-js=202.4.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- package-lock.json | 40 ++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index a90e9dc4..882d8e20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.5.0", "license": "Apache-2.0", "dependencies": { - "@dapr/dapr": "2.3.1", + "@dapr/dapr": "2.4.2", "body-parser": "^1.20.1", "cloudevents": "^6.0.2", "debug": "^4.3.4", @@ -114,12 +114,14 @@ } }, "node_modules/@dapr/dapr": { - "version": "2.3.1", - "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.1.tgz", - "integrity": "sha512-qg0GmXNVmzFPEcoMRrGQQT3s8W/HPKBPv97woSCQNX+uPqzJYIxxIctbAXdzUXHUkeFG97kRJ6ghCzC2q48hRQ==", + "version": "2.4.2", + "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.4.2.tgz", + "integrity": "sha512-endzTSAOHkiPTPj3sb7l9QeZp6Wd6pZGb1qzJMDgD2o9r8zzUX1LqCsKTo+97bM6+Gda90ZXzcUZEWLWvH8QVw==", "dependencies": { "@grpc/grpc-js": "^1.3.7", "@js-temporal/polyfill": "^0.3.0", + "@types/google-protobuf": "^3.15.5", + "@types/node-fetch": "^2.5.8", "body-parser": "^1.19.0", "google-protobuf": "^3.18.0", "http-terminator": "^3.0.4", @@ -608,8 +610,7 @@ "node_modules/@types/google-protobuf": { "version": "3.15.6", "resolved": "https://registry.npmmirror.com/@types/google-protobuf/-/google-protobuf-3.15.6.tgz", - "integrity": "sha512-pYVNNJ+winC4aek+lZp93sIKxnXt5qMkuKmaqS3WGuTq0Bw1ZDYNBgzG5kkdtwcv+GmYJGo3yEg6z2cKKAiEdw==", - "dev": true + "integrity": "sha512-pYVNNJ+winC4aek+lZp93sIKxnXt5qMkuKmaqS3WGuTq0Bw1ZDYNBgzG5kkdtwcv+GmYJGo3yEg6z2cKKAiEdw==" }, "node_modules/@types/json-schema": { "version": "7.0.9", @@ -667,7 +668,6 @@ "version": "2.6.2", "resolved": "https://registry.npmmirror.com/@types/node-fetch/-/node-fetch-2.6.2.tgz", "integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", - "dev": true, "dependencies": { "@types/node": "*", "form-data": "^3.0.0" @@ -677,7 +677,6 @@ "version": "3.0.1", "resolved": "https://registry.npmmirror.com/form-data/-/form-data-3.0.1.tgz", "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "dev": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -1204,8 +1203,7 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/available-typed-arrays": { "version": "1.0.5", @@ -1585,7 +1583,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -1996,7 +1993,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true, "engines": { "node": ">=0.4.0" } @@ -7175,12 +7171,14 @@ } }, "@dapr/dapr": { - "version": "2.3.1", - "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.3.1.tgz", - "integrity": "sha512-qg0GmXNVmzFPEcoMRrGQQT3s8W/HPKBPv97woSCQNX+uPqzJYIxxIctbAXdzUXHUkeFG97kRJ6ghCzC2q48hRQ==", + "version": "2.4.2", + "resolved": "https://registry.npmmirror.com/@dapr/dapr/-/dapr-2.4.2.tgz", + "integrity": "sha512-endzTSAOHkiPTPj3sb7l9QeZp6Wd6pZGb1qzJMDgD2o9r8zzUX1LqCsKTo+97bM6+Gda90ZXzcUZEWLWvH8QVw==", "requires": { "@grpc/grpc-js": "^1.3.7", "@js-temporal/polyfill": "^0.3.0", + "@types/google-protobuf": "^3.15.5", + "@types/node-fetch": "^2.5.8", "body-parser": "^1.19.0", "google-protobuf": "^3.18.0", "http-terminator": "^3.0.4", @@ -7646,8 +7644,7 @@ "@types/google-protobuf": { "version": "3.15.6", "resolved": "https://registry.npmmirror.com/@types/google-protobuf/-/google-protobuf-3.15.6.tgz", - "integrity": "sha512-pYVNNJ+winC4aek+lZp93sIKxnXt5qMkuKmaqS3WGuTq0Bw1ZDYNBgzG5kkdtwcv+GmYJGo3yEg6z2cKKAiEdw==", - "dev": true + "integrity": "sha512-pYVNNJ+winC4aek+lZp93sIKxnXt5qMkuKmaqS3WGuTq0Bw1ZDYNBgzG5kkdtwcv+GmYJGo3yEg6z2cKKAiEdw==" }, "@types/json-schema": { "version": "7.0.9", @@ -7705,7 +7702,6 @@ "version": "2.6.2", "resolved": "https://registry.npmmirror.com/@types/node-fetch/-/node-fetch-2.6.2.tgz", "integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", - "dev": true, "requires": { "@types/node": "*", "form-data": "^3.0.0" @@ -7715,7 +7711,6 @@ "version": "3.0.1", "resolved": "https://registry.npmmirror.com/form-data/-/form-data-3.0.1.tgz", "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -8099,8 +8094,7 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "available-typed-arrays": { "version": "1.0.5", @@ -8414,7 +8408,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -8733,8 +8726,7 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "depd": { "version": "2.0.0", diff --git a/package.json b/package.json index ac42fefa..4209c1a0 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "./testing": "./build/src/testing.js" }, "dependencies": { - "@dapr/dapr": "2.3.1", + "@dapr/dapr": "2.4.2", "body-parser": "^1.20.1", "cloudevents": "^6.0.2", "debug": "^4.3.4", From 9665460ac7f8adba118b9df260f4cad5c07918a1 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 8 Oct 2022 21:24:02 +0800 Subject: [PATCH 41/42] =?UTF-8?q?=F0=9F=93=9D=20docs(CHANGELOG):=20log=200?= =?UTF-8?q?.6.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- CHANGELOG.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0914ad38..cb1efcdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,22 +4,39 @@ [1]: https://www.npmjs.com/package/@openfunction/functions-framework?activeTab=versions +## 0.6.0 / 2022-10-08 + +We are pleased to bring up two amazing features in this release: a plugin system and a built-in SkyWalking tracing plugin. + +The plugin system was introduced along with OpenFunction Framework 0.6.0 (see this [proposal](https://github.com/OpenFunction/OpenFunction/blob/main/docs/proposals/202112-functions-framework-refactoring.md) for reference) and supported by Go Functions Framework starting from 0.3.0. Node.js Functions Framework similarly supports the plugin mechanism and provides an easier way to bootstrap the plugin. + +- Node.js Plugin Sample: To be drafted + - Plugins for testing: +- Go Plugin Sample: + +OpenFunction Framework 0.6.0 also [proposed](https://github.com/OpenFunction/OpenFunction/blob/main/docs/proposals/202112-support-function-tracing.md) tracing capacity to make function calls observable. By leveraging the plugin system, we implemented the SkyWalking plugin within the functions framework to provide samples for both tracing and plugin systems. + +- Tutorial: [How to enable the SkyWalking plugin in OpenFunction](https://openfunction.dev/docs/best-practices/skywalking-solution-for-openfunction/) +- SkyWalking Plugin: + +Lastly, we also enabled gracefully shutdown of function on `SIGINT` & `SIGTERM` signals, which helps to avoid losing the request or event when the function rolls out or scales down. + ## 0.5.0 / 2022-05-27 We are having a standalone `openfunction` signature type starting from this release! Now you can use `function (ctx, data)` as the function signature along with `openfunction` signature type, this allows you to use sync functions in a far more flexible way - whenever there are functions output requirements, sync functions can also send output to Dapr output binding or pubsub components. -Check the demo of HTTP request triggering async function: +Check the demo of the HTTP request triggering the async function: - Quickstart: - Sample: ## 0.4.1 / 2022-04-17 -This feature release offically introduces the support of OpenFunction async function runtime, now your Node.js functions can enjoy the power of Dapr runtime starting from bindings and pubsub. Functions Framework will call [Dapr Node.js SDK](https://github.com/dapr/js-sdk) to bridge the communication with various Dapr input/output bindings or pubsub brokers components. +This feature release officially introduces the support of OpenFunction async function runtime, now your Node.js functions can enjoy the power of Dapr runtime starting from bindings and pubsub. Functions Framework will call [Dapr Node.js SDK](https://github.com/dapr/js-sdk) to bridge the communication with various Dapr input/output bindings or pubsub brokers components. -- Aysnc Function Quickstart: +- Async Function Quickstart: - Async Function Samples: ## 0.3.6 / 2022-03-07 From 5bdf64a027613786b2110cffdf9e1b93e31fd2d8 Mon Sep 17 00:00:00 2001 From: Haili Zhang Date: Sat, 8 Oct 2022 21:29:30 +0800 Subject: [PATCH 42/42] =?UTF-8?q?=F0=9F=94=96=20chore:=20bump=200.6.0=20[n?= =?UTF-8?q?o=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haili Zhang --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 882d8e20..4b224bde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@openfunction/functions-framework", - "version": "0.5.0", + "version": "0.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@openfunction/functions-framework", - "version": "0.5.0", + "version": "0.6.0", "license": "Apache-2.0", "dependencies": { "@dapr/dapr": "2.4.2", diff --git a/package.json b/package.json index 4209c1a0..ce5bff57 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openfunction/functions-framework", - "version": "0.5.0", + "version": "0.6.0", "description": "FaaS (Function as a service) framework for writing portable Node.js functions", "engines": { "node": ">=13.0.0"