diff --git a/.eslintrc.json b/.eslintrc.json index c6085ac..db3da07 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -39,5 +39,14 @@ "node_modules", "tests" ], - "settings": {} + "settings": { + "import/resolver": { + "meteor": { + "extensions": [ + ".js", + ".jsx" + ] + } + } + } } diff --git a/lib/client.js b/lib/client.ts similarity index 86% rename from lib/client.js rename to lib/client.ts index 95c65ef..fd1e9be 100644 --- a/lib/client.js +++ b/lib/client.ts @@ -4,10 +4,7 @@ import { InjectData } from './namespace'; // Automatically parse the inject-data payload on Meteor startup // Load it into memory so it can be fetched by InjectData.getData Meteor.startup(function () { - const dom = document.querySelectorAll( - 'script[type="text/inject-data"]', - document, - ); + const dom = document.querySelectorAll('script[type="text/inject-data"]'); const injectedDataString = dom && dom.length > 0 ? dom[0].innerHTML : ''; InjectData._data = InjectData._decode(injectedDataString) || {}; }); diff --git a/lib/namespace.js b/lib/namespace.ts similarity index 68% rename from lib/namespace.js rename to lib/namespace.ts index 79a629c..e0e195b 100644 --- a/lib/namespace.js +++ b/lib/namespace.ts @@ -1,8 +1,12 @@ -/* global Package */ -export const InjectData = {}; +export let InjectData: { + getData: (key: string, callback: (data: any) => any) => void; +}; +InjectData = {}; // Replace meteorhacks:inject-data with our new API, this is for compatibility // with third party packages that still depend upon the meteorhacks version. if (Package['meteorhacks:inject-data']) { Package['meteorhacks:inject-data'].InjectData = InjectData; } + +Meteor.User; diff --git a/lib/server.js b/lib/server.js index ffac12d..6c89713 100644 --- a/lib/server.js +++ b/lib/server.js @@ -7,7 +7,7 @@ import { WebAppInternals } from 'meteor/webapp'; InjectData.injectToHead = true; Meteor.startup(() => { WebAppInternals.registerBoilerplateDataCallback( - 'communitypackages:fast-render', + 'communitypackages:inject-data', (req, data) => { if ( req && diff --git a/package-lock.json b/package-lock.json index 17f630d..b02f99a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,14 +5,17 @@ "packages": { "": { "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.18.0", - "@typescript-eslint/parser": "^5.18.0", - "eslint": "^8.12.0", - "eslint-config-standard": "^16.0.3", + "@types/meteor": "2.7.1", + "@types/node": "^18.6.5", + "@typescript-eslint/eslint-plugin": "^5.33.0", + "@typescript-eslint/parser": "^5.33.0", + "eslint": "^8.21.0", + "eslint-config-standard": "^17.0.0", + "eslint-import-resolver-meteor": "^0.4.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.0.0", - "eslint-plugin-react": "^7.29.4", + "eslint-plugin-react": "^7.30.1", "typescript": "^4.7.4" } }, @@ -101,6 +104,24 @@ "node": ">= 8" } }, + "node_modules/@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/jquery": { + "version": "3.5.14", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.14.tgz", + "integrity": "sha512-X1gtMRMbziVQkErhTQmSe2jFwwENA/Zr+PprCkF63vFq+Yt5PZ4AlKqgmeNlwgn7dhsXEK888eIW2520EpC+xg==", + "dev": true, + "dependencies": { + "@types/sizzle": "*" + } + }, "node_modules/@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", @@ -113,6 +134,76 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/meteor": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/@types/meteor/-/meteor-2.7.1.tgz", + "integrity": "sha512-bLoDKKKVRbLIUCA1Fy41+vLjRi6M1iMr3bGvq0Hz/66SraYuiQ0Mit1ql2Y4Z/7Oo+9YXYUikTlmgwSTNPE6PA==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/jquery": "*", + "@types/react": "*", + "@types/underscore": "*", + "mongodb": "^4.3.1" + } + }, + "node_modules/@types/node": { + "version": "18.7.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.4.tgz", + "integrity": "sha512-RzRcw8c0B8LzryWOR4Wj7YOTFXvdYKwvrb6xQQyuDfnlTxwYXGCV5RZ/TEbq5L5kn+w3rliHAUyRcG1RtbmTFg==", + "dev": true + }, + "node_modules/@types/prop-types": { + "version": "15.7.5", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", + "dev": true + }, + "node_modules/@types/react": { + "version": "18.0.17", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.17.tgz", + "integrity": "sha512-38ETy4tL+rn4uQQi7mB81G7V1g0u2ryquNmsVIOKUAEIDK+3CUjZ6rSRpdvS99dNBnkLFL83qfmtLacGOTIhwQ==", + "dev": true, + "dependencies": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/scheduler": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", + "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", + "dev": true + }, + "node_modules/@types/sizzle": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz", + "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==", + "dev": true + }, + "node_modules/@types/underscore": { + "version": "1.11.4", + "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.4.tgz", + "integrity": "sha512-uO4CD2ELOjw8tasUrAhvnn2W4A0ZECOvMjCivJr4gA9pGgjv+qxKWY9GLTMVEK8ej85BxQOocUyE7hImmSQYcg==", + "dev": true + }, + "node_modules/@types/webidl-conversions": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", + "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==", + "dev": true + }, + "node_modules/@types/whatwg-url": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", + "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/webidl-conversions": "*" + } + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "5.33.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.33.0.tgz", @@ -425,6 +516,26 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -447,6 +558,52 @@ "node": ">=8" } }, + "node_modules/bson": { + "version": "4.6.5", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.5.tgz", + "integrity": "sha512-uqrgcjyOaZsHfz7ea8zLRCLe1u+QGUSzMZmvXqO24CDW7DWoW1qiN9folSwa7hSneTSgM2ykDIzF5kcQQ8cwNw==", + "dev": true, + "dependencies": { + "buffer": "^5.6.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "peer": true, + "dependencies": { + "semver": "^7.0.0" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -523,6 +680,12 @@ "node": ">= 8" } }, + "node_modules/csstype": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.0.tgz", + "integrity": "sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==", + "dev": true + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -568,6 +731,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -712,9 +884,9 @@ } }, "node_modules/eslint-config-standard": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.3.tgz", - "integrity": "sha512-x4fmJL5hGqNJKGHSjnLdgA6U6h1YW/G2dW9fA+cyVur4SK6lyue8+UgNKWlZtUDTXvgKDD/Oa3GQjmB5kjtVvg==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", + "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", "dev": true, "funding": [ { @@ -731,10 +903,23 @@ } ], "peerDependencies": { - "eslint": "^7.12.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1 || ^5.0.0" + "eslint": "^8.0.1", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0", + "eslint-plugin-promise": "^6.0.0" + } + }, + "node_modules/eslint-import-resolver-meteor": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-meteor/-/eslint-import-resolver-meteor-0.4.0.tgz", + "integrity": "sha512-BSqvgt6QZvk9EGhDGnM4azgbxyBD8b0y6FYA52WFzpWpHcZV9ys8PxM33bx8dlCy3HyopRLLsMUnlhTpZzsZmQ==", + "dev": true, + "dependencies": { + "object-assign": "^4.0.1", + "resolve": "^1.1.6" + }, + "peerDependencies": { + "eslint-plugin-import": ">=1.4.0" } }, "node_modules/eslint-import-resolver-node": { @@ -939,6 +1124,78 @@ "node": ">=0.10.0" } }, + "node_modules/eslint-plugin-n": { + "version": "15.2.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz", + "integrity": "sha512-tjnVMv2fiXYMnuiIFI8QMtyUFI42SckEEWvi8h68SWGWshfqO6SSCASy24dGMGAiy7NUk6DZt90DM0iNUsmQ5w==", + "dev": true, + "peer": true, + "dependencies": { + "builtins": "^5.0.1", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.9.0", + "minimatch": "^3.1.2", + "resolve": "^1.10.1", + "semver": "^7.3.7" + }, + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-n/node_modules/eslint-plugin-es": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", + "dev": true, + "peer": true, + "dependencies": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=4.19.1" + } + }, + "node_modules/eslint-plugin-n/node_modules/eslint-plugin-es/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "peer": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-n/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, "node_modules/eslint-plugin-node": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", @@ -1579,6 +1836,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", @@ -1643,6 +1920,12 @@ "node": ">= 0.4" } }, + "node_modules/ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "dev": true + }, "node_modules/is-bigint": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", @@ -1944,6 +2227,13 @@ "node": ">=10" } }, + "node_modules/memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "dev": true, + "optional": true + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -1978,6 +2268,34 @@ "node": "*" } }, + "node_modules/mongodb": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", + "integrity": "sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==", + "dev": true, + "dependencies": { + "bson": "^4.6.5", + "denque": "^2.0.1", + "mongodb-connection-string-url": "^2.5.2", + "socks": "^2.6.2" + }, + "engines": { + "node": ">=12.9.0" + }, + "optionalDependencies": { + "saslprep": "^1.0.3" + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.3.tgz", + "integrity": "sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==", + "dev": true, + "dependencies": { + "@types/whatwg-url": "^8.2.1", + "whatwg-url": "^11.0.0" + } + }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -2385,6 +2703,19 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/saslprep": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", + "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", + "dev": true, + "optional": true, + "dependencies": { + "sparse-bitfield": "^3.0.3" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", @@ -2435,6 +2766,40 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", + "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", + "dev": true, + "dependencies": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.13.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "dev": true, + "optional": true, + "dependencies": { + "memory-pager": "^1.0.2" + } + }, "node_modules/string.prototype.matchall": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz", @@ -2566,6 +2931,18 @@ "node": ">=8.0" } }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/tsconfig-paths": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", @@ -2684,6 +3061,28 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -2816,6 +3215,24 @@ "fastq": "^1.6.0" } }, + "@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/jquery": { + "version": "3.5.14", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.14.tgz", + "integrity": "sha512-X1gtMRMbziVQkErhTQmSe2jFwwENA/Zr+PprCkF63vFq+Yt5PZ4AlKqgmeNlwgn7dhsXEK888eIW2520EpC+xg==", + "dev": true, + "requires": { + "@types/sizzle": "*" + } + }, "@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", @@ -2828,6 +3245,76 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "@types/meteor": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/@types/meteor/-/meteor-2.7.1.tgz", + "integrity": "sha512-bLoDKKKVRbLIUCA1Fy41+vLjRi6M1iMr3bGvq0Hz/66SraYuiQ0Mit1ql2Y4Z/7Oo+9YXYUikTlmgwSTNPE6PA==", + "dev": true, + "requires": { + "@types/connect": "*", + "@types/jquery": "*", + "@types/react": "*", + "@types/underscore": "*", + "mongodb": "^4.3.1" + } + }, + "@types/node": { + "version": "18.7.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.4.tgz", + "integrity": "sha512-RzRcw8c0B8LzryWOR4Wj7YOTFXvdYKwvrb6xQQyuDfnlTxwYXGCV5RZ/TEbq5L5kn+w3rliHAUyRcG1RtbmTFg==", + "dev": true + }, + "@types/prop-types": { + "version": "15.7.5", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", + "dev": true + }, + "@types/react": { + "version": "18.0.17", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.17.tgz", + "integrity": "sha512-38ETy4tL+rn4uQQi7mB81G7V1g0u2ryquNmsVIOKUAEIDK+3CUjZ6rSRpdvS99dNBnkLFL83qfmtLacGOTIhwQ==", + "dev": true, + "requires": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "@types/scheduler": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", + "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", + "dev": true + }, + "@types/sizzle": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz", + "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==", + "dev": true + }, + "@types/underscore": { + "version": "1.11.4", + "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.4.tgz", + "integrity": "sha512-uO4CD2ELOjw8tasUrAhvnn2W4A0ZECOvMjCivJr4gA9pGgjv+qxKWY9GLTMVEK8ej85BxQOocUyE7hImmSQYcg==", + "dev": true + }, + "@types/webidl-conversions": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", + "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==", + "dev": true + }, + "@types/whatwg-url": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", + "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/webidl-conversions": "*" + } + }, "@typescript-eslint/eslint-plugin": { "version": "5.33.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.33.0.tgz", @@ -3012,6 +3499,12 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -3031,6 +3524,35 @@ "fill-range": "^7.0.1" } }, + "bson": { + "version": "4.6.5", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.5.tgz", + "integrity": "sha512-uqrgcjyOaZsHfz7ea8zLRCLe1u+QGUSzMZmvXqO24CDW7DWoW1qiN9folSwa7hSneTSgM2ykDIzF5kcQQ8cwNw==", + "dev": true, + "requires": { + "buffer": "^5.6.0" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "peer": true, + "requires": { + "semver": "^7.0.0" + } + }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -3089,6 +3611,12 @@ "which": "^2.0.1" } }, + "csstype": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.0.tgz", + "integrity": "sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==", + "dev": true + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -3122,6 +3650,12 @@ "object-keys": "^1.1.1" } }, + "denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "dev": true + }, "dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -3263,12 +3797,22 @@ } }, "eslint-config-standard": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.3.tgz", - "integrity": "sha512-x4fmJL5hGqNJKGHSjnLdgA6U6h1YW/G2dW9fA+cyVur4SK6lyue8+UgNKWlZtUDTXvgKDD/Oa3GQjmB5kjtVvg==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", + "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", "dev": true, "requires": {} }, + "eslint-import-resolver-meteor": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-meteor/-/eslint-import-resolver-meteor-0.4.0.tgz", + "integrity": "sha512-BSqvgt6QZvk9EGhDGnM4azgbxyBD8b0y6FYA52WFzpWpHcZV9ys8PxM33bx8dlCy3HyopRLLsMUnlhTpZzsZmQ==", + "dev": true, + "requires": { + "object-assign": "^4.0.1", + "resolve": "^1.1.6" + } + }, "eslint-import-resolver-node": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", @@ -3434,6 +3978,55 @@ } } }, + "eslint-plugin-n": { + "version": "15.2.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz", + "integrity": "sha512-tjnVMv2fiXYMnuiIFI8QMtyUFI42SckEEWvi8h68SWGWshfqO6SSCASy24dGMGAiy7NUk6DZt90DM0iNUsmQ5w==", + "dev": true, + "peer": true, + "requires": { + "builtins": "^5.0.1", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.9.0", + "minimatch": "^3.1.2", + "resolve": "^1.10.1", + "semver": "^7.3.7" + }, + "dependencies": { + "eslint-plugin-es": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", + "dev": true, + "peer": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "peer": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + } + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "peer": true + } + } + }, "eslint-plugin-node": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", @@ -3887,32 +4480,11 @@ "has-symbols": "^1.0.2" } }, - "has-tostringtag": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "dev": true, - "requires": { - "has-symbols": "^1.0.3" - } - }, - "hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, - "requires": { - "function-bind": "^1.1.2" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true }, "ignore": { "version": "5.2.0", @@ -3963,6 +4535,12 @@ "side-channel": "^1.0.4" } }, + "ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "dev": true + }, "is-bigint": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", @@ -4184,6 +4762,13 @@ "yallist": "^4.0.0" } }, + "memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "dev": true, + "optional": true + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -4209,6 +4794,29 @@ "brace-expansion": "^1.1.7" } }, + "mongodb": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", + "integrity": "sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==", + "dev": true, + "requires": { + "bson": "^4.6.5", + "denque": "^2.0.1", + "mongodb-connection-string-url": "^2.5.2", + "saslprep": "^1.0.3", + "socks": "^2.6.2" + } + }, + "mongodb-connection-string-url": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.3.tgz", + "integrity": "sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ==", + "dev": true, + "requires": { + "@types/whatwg-url": "^8.2.1", + "whatwg-url": "^11.0.0" + } + }, "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -4479,6 +5087,16 @@ "queue-microtask": "^1.2.2" } }, + "saslprep": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", + "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", + "dev": true, + "optional": true, + "requires": { + "sparse-bitfield": "^3.0.3" + } + }, "semver": { "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", @@ -4514,6 +5132,32 @@ "object-inspect": "^1.9.0" } }, + "smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true + }, + "socks": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", + "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==", + "dev": true, + "requires": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + } + }, + "sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "dev": true, + "optional": true, + "requires": { + "memory-pager": "^1.0.2" + } + }, "string.prototype.matchall": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz", @@ -4611,6 +5255,15 @@ "is-number": "^7.0.0" } }, + "tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "requires": { + "punycode": "^2.1.1" + } + }, "tsconfig-paths": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", @@ -4703,6 +5356,22 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true + }, + "whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "requires": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.js b/package.js index 156ed9d..4b211e8 100644 --- a/package.js +++ b/package.js @@ -1,32 +1,31 @@ /* global Package */ Package.describe({ summary: 'A way to inject data to the client with initial HTML', - version: '2.3.2', + version: '3.0.0-beta.0', git: 'https://github.com/Meteor-Community-Packages/meteor-inject-data', name: 'communitypackages:inject-data', }); Package.onUse(function (api) { - api.versionsFrom('METEOR@1.6.1'); + api.versionsFrom('METEOR@3.0.1'); api.use('webapp', 'server'); - api.use(['ejson', 'ecmascript'], ['server', 'client']); - api.use('zodern:types@1.0.8'); - api.mainModule('lib/namespace.js', ['server', 'client']); + api.use(['ejson', 'ecmascript', 'typescript'], ['server', 'client']); + api.use('zodern:types@1.0.13'); + api.mainModule('lib/namespace.ts', ['server', 'client']); api.addFiles('lib/utils.js', ['server', 'client']); api.addFiles('lib/server.js', 'server'); - api.addFiles('lib/client.js', 'client'); + api.addFiles('lib/client.ts', 'client'); api.export('InjectData', ['client', 'server']); }); Package.onTest(function (api) { api.use('communitypackages:inject-data'); api.use('webapp', 'server'); - api.use(['underscore', 'tinytest'], ['client', 'server']); - api.use('http', 'server'); - api.use('random', 'server'); - api.use('communitypackages:picker@1.0.1', 'server'); - api.addFiles(['tests/init.js'], 'server'); - api.addFiles(['tests/utils.js'], ['client', 'server']); - api.addFiles(['tests/client.js'], 'client'); - api.addFiles(['tests/integration.js'], 'server'); + api.use(['meteortesting:browser-tests@1.7.0', 'meteortesting:mocha@3.2.0']); + api.use(['ecmascript', 'typescript', 'underscore'], ['client', 'server']); + api.use('zodern:types@1.0.13'); + api.use(['http', 'random'], 'server'); + api.use('communitypackages:picker@2.0.0-beta.0', 'server'); + api.mainModule('tests/server/index.js', 'server'); + api.mainModule('tests/client/index.js', 'client'); }); diff --git a/package.json b/package.json index 2d9959f..eac053c 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,13 @@ "publish-release": "rimraf ./node_modules && meteor publish && meteor npm i --only=dev" }, "devDependencies": { - "@types/node": "^18.6.5", "@types/meteor": "2.7.1", + "@types/node": "^18.6.5", "@typescript-eslint/eslint-plugin": "^5.33.0", "@typescript-eslint/parser": "^5.33.0", "eslint": "^8.21.0", "eslint-config-standard": "^17.0.0", + "eslint-import-resolver-meteor": "^0.4.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.0.0", diff --git a/tests/client.js b/tests/client.js deleted file mode 100644 index 227c89a..0000000 --- a/tests/client.js +++ /dev/null @@ -1,7 +0,0 @@ -Tinytest.addAsync('Clinet - get data', function (test, done) { - InjectData.getData('hello', function (data) { - console.warn(data); - test.equal(data, { meteorhacks: 'rocks' }); - done(); - }); -}); diff --git a/tests/client/index.js b/tests/client/index.js new file mode 100644 index 0000000..563baf8 --- /dev/null +++ b/tests/client/index.js @@ -0,0 +1,13 @@ +import { InjectData } from 'meteor/communitypackages:inject-data'; +import { should, assert } from 'chai'; +import '../utils'; + +should(); +describe('inject-data - integration', function () { + it('should get data', async function () { + InjectData.getData('hello', function (data) { + data.should.deep.equal({ meteorhacks: 'rocks' }); + }); + }); +}); + diff --git a/tests/integration.js b/tests/integration.js deleted file mode 100644 index 17a6fd6..0000000 --- a/tests/integration.js +++ /dev/null @@ -1,104 +0,0 @@ -Tinytest.add('integration - sending some data', function (test) { - const path = '/' + Random.id(); - Picker.route(path, function (params, req, res, next) { - InjectData.pushData(req, 'aa', { bb: 10 }); - next(); - }); - - const data = getInjectedData(path); - const expected = { aa: { bb: 10 } }; - test.equal(data, expected); -}); - -Tinytest.add('integration - get data on the client', function (test) { - const expected = { bb: 10 }; - const path = '/' + Random.id(); - Picker.route(path, function (params, req, res, next) { - InjectData.pushData(req, 'aa', { bb: 10 }); - test.equal(InjectData.getData(req, 'aa'), expected); - next(); - }); - - getInjectedData(path); -}); - -Tinytest.add('integration - different types of data', function (test) { - const path = '/' + Random.id(); - const sendingData = { - kk: { bb: 10 }, - c: true, - d: 'string', - }; - - Picker.route(path, function (params, req, res, next) { - _.each(sendingData, function (val, key) { - InjectData.pushData(req, key, val); - }); - next(); - }); - - const data = getInjectedData(path); - test.equal(data, sendingData); -}); - -Tinytest.add( - 'integration - sending some bad chars where HTML does not like well', - function (test) { - const path = '/' + Random.id(); - const text = " sdsd //\\ alert('hello');"; - Picker.route(path, function (params, req, res, next) { - InjectData.pushData(req, 'aa', text); - next(); - }); - - const data = getInjectedData(path); - const expected = { aa: text }; - test.equal(data, expected); - }, -); - -Tinytest.add('integration - no data sending', function (test, done) { - const path = '/' + Random.id(); - const data = getInjectedData(path); - test.equal(data, null); -}); - -Tinytest.add('integration - send with CORS', function (test, done) { - const path = '/' + Random.id(); - Picker.route(path, function (params, req, res, next) { - InjectData.pushData(req, 'aa', { bb: 10 }); - res.writeHead(200, { - 'access-control-allow-origin': '*', - }); - res.write(''); - res.end(); - }); - - const data = getInjectedData(path); - test.equal(data, null); -}); - -Tinytest.add('integration - send with other than HTML', function (test, done) { - const path = '/' + Random.id(); - Picker.route(path, function (params, req, res, next) { - InjectData.pushData(res, 'aa', { bb: 10 }); - res.write('some other data'); - res.end(); - }); - - const data = getInjectedData(path); - test.equal(data, null); -}); - -const urlResolve = Npm.require('url').resolve; -function getInjectedData (path) { - const url = urlResolve(process.env.ROOT_URL, path); - const res = HTTP.get(url); - const matched = res.content.match(/inject-data">(.*)<\/script/); - if (matched) { - const encodedData = matched[1]; - return InjectData._decode(encodedData); - } else { - return null; - } -} diff --git a/tests/server/index.js b/tests/server/index.js new file mode 100644 index 0000000..d5dbbda --- /dev/null +++ b/tests/server/index.js @@ -0,0 +1,3 @@ +import './init'; +import '../utils'; +import './integration'; diff --git a/tests/init.js b/tests/server/init.js similarity index 68% rename from tests/init.js rename to tests/server/init.js index cec5bbd..612dd0d 100644 --- a/tests/init.js +++ b/tests/server/init.js @@ -1,3 +1,5 @@ +import { Picker } from 'meteor/communitypackages:picker'; + Picker.route('/', function (params, req, res, next) { InjectData.pushData(req, 'hello', { meteorhacks: 'rocks' }); next(); diff --git a/tests/server/integration.js b/tests/server/integration.js new file mode 100644 index 0000000..b78b9dc --- /dev/null +++ b/tests/server/integration.js @@ -0,0 +1,124 @@ +import { Picker } from 'meteor/communitypackages:picker'; +import { fetch } from 'meteor/fetch'; +import { check } from 'meteor/check'; +import { should, assert } from 'chai'; + +should(); + +describe('inject-data - integration', function () { + it('should send data', async function () { + const path = '/' + Random.id(); + Picker.route(path, function (params, req, res, next) { + InjectData.pushData(req, 'aa', { bb: 10 }); + next(); + }); + + const data = await getInjectedData(path); + const expected = { aa: { bb: 10 } }; + data.should.deep.equal(expected); + }); + + it('should get data on the client', async function () { + const expected = { bb: 10 }; + const path = '/' + Random.id(); + Picker.route(path, function (params, req, res, next) { + InjectData.pushData(req, 'aa', { bb: 10 }); + const data = InjectData.getData(req, 'aa'); + data.should.deep.equal(expected); + next(); + }); + + await getInjectedData(path); + }); + + it('should handle different types of data', async function () { + const path = '/' + Random.id(); + const sendingData = { + kk: { bb: 10 }, + c: true, + d: 'string', + }; + + Picker.route(path, function (params, req, res, next) { + _.each(sendingData, function (val, key) { + InjectData.pushData(req, key, val); + }); + next(); + }); + + const data = await getInjectedData(path); + data.should.deep.equal(sendingData); + }); + + it('should handle bad HTML chars', async function () { + const path = '/' + Random.id(); + const text = " sdsd //\\ alert('hello');"; + Picker.route(path, function (params, req, res, next) { + InjectData.pushData(req, 'aa', text); + next(); + }); + + const data = await getInjectedData(path); + const expected = { aa: text }; + data.should.deep.equal(expected); + }); + + it('should have empty data when none is sent', async function () { + const path = '/' + Random.id(); + const data = await getInjectedData(path); + assert.isNull(data); + }); + + it('should send with CORS', async function () { + const path = '/' + Random.id(); + Picker.route(path, function (params, req, res, next) { + InjectData.pushData(req, 'aa', { bb: 10 }); + res.writeHead(200, { + 'access-control-allow-origin': '*', + }); + res.write(''); + res.end(); + }); + + const data = await getInjectedData(path); + assert.isNull(data); + }); + + it('should not send with other than HTML', async function () { + const path = '/' + Random.id(); + Picker.route(path, function (params, req, res, next) { + InjectData.pushData(req, 'aa', { bb: 10 }); + res.write('some other data'); + res.end(); + }); + + const data = await getInjectedData(path); + assert.isNull(data); + }); +}); + +// Tinytest.add('integration - send with other than HTML', async function (test) { +// const path = '/' + Random.id(); +// Picker.route(path, function (params, req, res, next) { +// InjectData.pushData(res, 'aa', { bb: 10 }); +// res.write('some other data'); +// res.end(); +// }); +// +// const data = await getInjectedData(path); +// test.equal(data, null); +// }); + +const urlResolve = Npm.require('url').resolve; +async function getInjectedData (path) { + const url = urlResolve(process.env.ROOT_URL, path); + const res = await fetch(url); + const content = await res.text(); + const matched = content.match(/data">(.*)<\/script/); + if (matched) { + const encodedData = matched[1]; + return InjectData._decode(encodedData); + } else { + return null; + } +} diff --git a/tests/utils.js b/tests/utils.js index e8dd6c4..d627c07 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -1,21 +1,26 @@ -Tinytest.add('Utils - encode decode', function (test) { - const data = { aa: 10, date: new Date() }; - const str = InjectData._encode(data); - const decoded = InjectData._decode(str); +import { assert } from 'chai'; - test.equal(decoded.aa, data.aa); - test.equal(decoded.date.getTime(), data.date.getTime()); -}); +describe('inject-data - utils', function () { + it('should encode and decode injected data', function () { + const data = { aa: 10, date: new Date() }; + const str = InjectData._encode(data); + const decoded = InjectData._decode(str); -Tinytest.add('Utils - decode empty', function (test) { - const str = ''; - const decoded = InjectData._decode(str); - test.equal(decoded, null); -}); + assert.equal(decoded.aa, data.aa); + assert.equal(decoded.date.getTime(), data.date.getTime()); + }); -Tinytest.add('Utils - encode decode special chars', function (test) { - const data = { special: '#://' }; - const str = InjectData._encode(data); + it('should decode empty data', function () { + const str = ''; + const decoded = InjectData._decode(str); + assert.equal(decoded, null); + }); - test.isFalse(/#/.test(str)); + it('should encode special chars', function () { + const data = { special: '#://' }; + const str = InjectData._encode(data); + + assert.isFalse(/#/.test(str)); + }); }); + diff --git a/tsconfig.json b/tsconfig.json index af4de94..38438ac 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,7 @@ "incremental": true }, "include": [ + "./global.d.ts", "**/*.ts", "**/*.tsx", "**/*.js",