diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b275071cd..e8e1b5e52f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -343,7 +343,7 @@ jobs: - run: name: "Running self-test (Test Group 3)" command: | - if [ -f ./tmp/test-groups/3.txt ]; then TEST_GROUP=$(<./tmp/test-groups/3.txt); elif [ -f ./tmp/test-groups/0.txt ]; then TEST_GROUP=XXXXX; else TEST_GROUP='^c[p-z]|^[d-g]|^h[a-e]'; fi + if [ -f ./tmp/test-groups/3.txt ]; then TEST_GROUP=$(<./tmp/test-groups/3.txt); elif [ -f ./tmp/test-groups/0.txt ]; then TEST_GROUP=XXXXX; else TEST_GROUP='^c[p-z]|^h[a-e]'; fi echo $TEST_GROUP; eval $PRE_TEST_COMMANDS; ./meteor self-test \ @@ -353,7 +353,7 @@ jobs: --headless \ --junit ./tmp/results/junit/3.xml \ --without-tag "custom-warehouse" - no_output_timeout: 20m + no_output_timeout: 30m - run: <<: *run_save_node_bin - store_test_results: @@ -648,6 +648,46 @@ jobs: - store_artifacts: path: /tmp/memuse.txt + Test Group 11: + <<: *build_machine_environment + steps: + - run: + <<: *run_log_mem_use + - run: + <<: *run_env_change + - attach_workspace: + at: . + - run: + name: "Print environment" + command: printenv + - run: + name: "Running self-test (Test Group 11)" + command: | + if [ -f ./tmp/test-groups/11.txt ]; then TEST_GROUP=$(<./tmp/test-groups/11.txt); elif [ -f ./tmp/test-groups/0.txt ]; then TEST_GROUP=XXXXX; else TEST_GROUP='^[d-g]'; fi + echo $TEST_GROUP; + eval $PRE_TEST_COMMANDS; + ./meteor self-test \ + "$TEST_GROUP" \ + --retries ${METEOR_SELF_TEST_RETRIES} \ + --exclude "${SELF_TEST_EXCLUDE}" \ + --headless \ + --junit ./tmp/results/junit/11.xml \ + --without-tag "custom-warehouse" + no_output_timeout: 30m + - run: + <<: *run_save_node_bin + - store_test_results: + path: ./tmp/results + - persist_to_workspace: + root: . + paths: ./tmp/results/junit + - store_artifacts: + path: ./tmp/results + - store_artifacts: + path: /tmp/core_dumps + - store_artifacts: + path: /tmp/memuse.txt + # Test the JSDoc declarations which live within this codebase against the # Meteor Docs (https://github.com/meteor/docs) repository, where they'll # eventually be consumed. This test aims to provide an early warning of @@ -804,6 +844,9 @@ workflows: - Test Group 10: requires: - Get Ready + - Test Group 11: + requires: + - Get Ready - Clean Up: requires: - Isolated Tests @@ -818,3 +861,4 @@ workflows: - Test Group 8 - Test Group 9 - Test Group 10 + - Test Group 11 diff --git a/.eslintignore b/.eslintignore index 5228e27ede..3653ab7c32 100644 --- a/.eslintignore +++ b/.eslintignore @@ -67,7 +67,6 @@ tools/runners/run-app.js tools/runners/run-mongo.js tools/runners/run-proxy.js tools/runners/run-selenium.js -tools/runners/run-updater.js tools/packaging/package-client.js tools/packaging/package-map.js diff --git a/docs/_config.yml b/docs/_config.yml index 78db90b0a2..7a70499147 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -86,6 +86,7 @@ sidebar_categories: Command Line: - commandline - environment-variables + - using-core-types Troubleshooting: - expired-certificate - windows diff --git a/docs/history.md b/docs/history.md index 596c237095..724ece077c 100644 --- a/docs/history.md +++ b/docs/history.md @@ -1,3 +1,119 @@ +## 2.8.1, 2022-11-14 + +#### Highlights + +- modernize tools/run-updater.js by [afrokick](https://github.com/afrokick) +- feat(error message): Especifing error message when cross-boundary by [Grubba27](https://github.com/Grubba27) +- Type definitions for core packages by [piotrpospiech](https://github.com/piotrpospiech) +- Add https proxy support to meteor-installer by [heschong](https://github.com/heschong) +- Fix case insensitive lookup resource overuse by [ToyboxZach](https://github.com/ToyboxZach) +- Update default Facebook API to v15 and fix local changelog by [StorytellerCZ](https://github.com/StorytellerCZ) +- Bump to Node v14.21.1 by [StorytellerCZ](https://github.com/StorytellerCZ) +- Use true mongo binary types by [znewsham](https://github.com/znewsham) +- Add docs for Accounts.registerLoginHandler by [shivam1646](https://github.com/shivam1646) +- Updated MongoDB driver to 4.11 by [radekmie](https://github.com/radekmie) +- Show port in restart message by [harryadel](https://github.com/harryadel) +- In the client, don't wait if the stub doesn't return a promise by [denihs](https://github.com/denihs) +- The rest of type definitions for core packages by [piotrpospiech](https://github.com/piotrpospiech) +- Removing underscore in packages by [harryadel](https://github.com/harryadel): + - [twitter-oauth] Remove underscore + - [test-in-browser] Remove underscore + - [webapp-hashing] Remove underscore + - [browser-policy] Remove underscore + - [ecmascript] Remove underscore + - [browser-policy-framing] Remove underscore + - [diff-sequence] Remove underscore + - [facts-ui] Remove underscore + - [geojson-utils] Remove underscore + +#### Breaking Changes + +N/A + +#### Migration Steps + +_In case you want types in your app using the core packages types/zodern:types (now you do have the option)_ + +1. Remove `@types/meteor` package +2. Install [`zodern:types`](https://github.com/zodern/meteor-types) package +3. Follow [installation guide for the Meteor Apps](https://github.com/zodern/meteor-types#meteor-apps) to update + +#### Meteor Version Release + +* `accounts-base@2.2.5` + - added types for package. +* `browser-policy@1.1.1` + - adjusted package tests. +* `browser-policy-common@1.0.12` + - added types for package. +* `browser-policy-framing@1.1.1` + - removed underscore. +* `check@1.3.2` + - added types for package. +* `ddp@1.4.0` + - added types for package. +* `ddp-client@2.6.1` + - In the client, don't wait if the stub doesn't return a promise. +* `ddp-rate-limiter@1.1.1` + - added types for package. +* `diff-sequence@1.1.2` + - removed underscore. +* `ecmascript@0.16.3` + - removed underscore. +* `ejson@1.1.3` + - added types for package. +* `ejson@2.2.2` + - added types for package. +* `facebook-oauth@1.12.0` + - Updated default version of Facebook GraphAPI to v15 +* `facts-ui@1.0.1` + - removed underscore. +* `fetch@0.1.2` + - added types for package. +* `geojson-utils@1.0.11` + - removed underscore. +* `hot-module-replacement@0.5.2` + - added types for package. +* `meteor@1.10.2` + - added types for package. +* `modern-browsers@0.1.9` + - added types for package. +* `modules-runtime@0.13.2` + - added accurate error messages. +* `modules-runtime-hot@0.14.1` + - added accurate error messages. +* `mongo@1.16.1` + - added types for package. + - added true mongo binary +* `npm-mongo@4.11.0` + - updated npm mongo version to match npm one. +* `promise@0.13.0` + - added types for package. +* `random@1.2.1` + - added types for package. +* `reactive-dict@1.3.1` + - added types for package. +* `reactive-dict@1.0.12` + - added types for package. +* `server-render@0.4.1` + - added types for package. +* `service-configuration@1.3.1` + - added types for package. +* `session@1.2.1` + - added types for package. +* `test-in-browser@1.3.1` + - removed underscore. +* `tracker@1.2.1` + - added types for package. +* `twitter-oauth@1.3.1` + - removed underscore. +* `underscore@1.0.11` + - added types for package. +* `webapp@1.13.2` + - added types for package. +* `webapp-hashing@1.1.1` + - added types for package. + ## v2.8, 2022-10-19 #### Highlights @@ -77,7 +193,7 @@ Read our [Migration Guide](https://guide.meteor.com/2.8-migration.html) for this For making this great framework even better! -## v2.7.3, 2022-05-31 +## v2.7.3, 2022-05-3 #### Highlights * `accounts-passwordless@2.1.2`: @@ -3910,9 +4026,9 @@ N/A > Note: With this version of Reify, `import` declarations are compiled to `module.watch(require(id), ...)` instead of `module.importSync(id, ...)` -or the older `module.import(id, ...)`. The behavior of the compiled code -should be the same as before, but the details seemed different enough to -warrant a note. +> or the older `module.import(id, ...)`. The behavior of the compiled code +> should be the same as before, but the details seemed different enough to +> warrant a note. * The `install` npm package has been upgraded to version 0.10.1. @@ -4256,15 +4372,15 @@ https://github.com/meteor/meteor/commit/0cbd25111d1249a61ca7adce23fad5215408c821 are once again constrained by the current Meteor release. > Before Meteor 1.4, the current release dictated the exact version of -every installed core package, which meant newer core packages could not -be installed without publishing a new Meteor release. In order to -support incremental development of core packages, Meteor 1.4 removed all -release-based constraints on core package versions +> every installed core package, which meant newer core packages could not +> be installed without publishing a new Meteor release. In order to +> support incremental development of core packages, Meteor 1.4 removed all +> release-based constraints on core package versions ([#7084](https://github.com/meteor/meteor/pull/7084)). Now, in Meteor -1.4.3, core package versions must remain patch-compatible with the -versions they had when the Meteor release was published. This middle -ground restores meaning to Meteor releases, yet still permits patch -updates to core packages. +> 1.4.3, core package versions must remain patch-compatible with the +> versions they had when the Meteor release was published. This middle +> ground restores meaning to Meteor releases, yet still permits patch +> updates to core packages. * The `cordova-lib` npm package has been updated to 6.4.0, along with cordova-android (6.1.1) and cordova-ios (4.3.0), and various plugins. @@ -4354,11 +4470,11 @@ updates to core packages. change was deemed too significant for this release. > Note: The decision to revert the above change was made late in the -Meteor 1.4.2.4 release process, before it was ever recommended but too -late in the process to avoid the additional increment of the version number. -See [#8311](https://github.com/meteor/meteor/pull/8311) for additional -information. This change will still be released in an upcoming version -of Meteor with a more seamless upgrade. +> Meteor 1.4.2.4 release process, before it was ever recommended but too +> late in the process to avoid the additional increment of the version number. +> See [#8311](https://github.com/meteor/meteor/pull/8311) for additional +> information. This change will still be released in an upcoming version +> of Meteor with a more seamless upgrade. ## v1.4.2.4, 2017-02-02 @@ -4367,7 +4483,7 @@ of Meteor with a more seamless upgrade. * The `npm` npm package has been upgraded from version 3.10.9 to 4.1.2. > Note: This change was later deemed too substantial for a point release -and was reverted in Meteor 1.4.2.7. +> and was reverted in Meteor 1.4.2.7. * Fix for [Issue #8136](https://github.com/meteor/meteor/issues/8136). @@ -4394,9 +4510,9 @@ and was reverted in Meteor 1.4.2.7. > Note: Meteor 1.4.2.2 was finalized before [#8045](https://github.com/meteor/meteor/pull/8045) was merged, but -those changes were [deemed important +> those changes were [deemed important enough](https://github.com/meteor/meteor/pull/8044#issuecomment-260913739) -to skip recommending 1.4.2.2 and instead immediately release 1.4.2.3. +> to skip recommending 1.4.2.2 and instead immediately release 1.4.2.3. ## v1.4.2.2, 2016-11-15 @@ -4483,10 +4599,10 @@ to skip recommending 1.4.2.2 and instead immediately release 1.4.2.3. See https://github.com/meteor/meteor/pull/7668 for more details. > Note: the `METEOR_PROFILE` environment variable now provides data for -server startup time as well as build time, which should make it easier -to tell which of your packages are responsible for slow startup times. -Please include the output of `METEOR_PROFILE=10 meteor run` with any -GitHub issue about rebuild performance. +> server startup time as well as build time, which should make it easier +> to tell which of your packages are responsible for slow startup times. +> Please include the output of `METEOR_PROFILE=10 meteor run` with any +> GitHub issue about rebuild performance. * `npm` has been upgraded to version 3.10.9. @@ -5063,8 +5179,8 @@ GitHub issue about rebuild performance. ## v1.3.2.4, 2016-04-20 > Meteor 1.3.2.4 was published because publishing 1.3.2.3 failed in an -unrecoverable way. Meteor 1.3.2.4 contains no additional changes beyond -the changes in 1.3.2.3. +> unrecoverable way. Meteor 1.3.2.4 contains no additional changes beyond +> the changes in 1.3.2.3. ## v1.3.2.3, 2016-04-20 diff --git a/docs/source/api/accounts-multi.md b/docs/source/api/accounts-multi.md index 644a28970f..8689b15859 100644 --- a/docs/source/api/accounts-multi.md +++ b/docs/source/api/accounts-multi.md @@ -315,6 +315,15 @@ Accounts.setAdditionalFindUserOnExternalLogin(({serviceName, serviceData}) => { } }) ``` +{% apibox "AccountsServer#registerLoginHandler" %} + +Use this to register your own custom authentication method. This is also used by all of the other inbuilt accounts packages to integrate with the accounts system. + +There can be multiple login handlers that are registered. When a login request is made, it will go through all these handlers to find its own handler. + +The registered handler callback is called with a single argument, the `options` object which comes from the login method. For example, if you want to login with a plaintext password, `options` could be `{ user: { username: }, password: }`,or `{ user: { email: }, password: }`. + +The login handler should return `undefined` if it's not going to handle the login request or else the login result object.

Rate Limiting

diff --git a/docs/source/using-core-types.md b/docs/source/using-core-types.md new file mode 100644 index 0000000000..89ac1636af --- /dev/null +++ b/docs/source/using-core-types.md @@ -0,0 +1,39 @@ +--- +title: Using Core Types +description: Using core types with zodern:types +--- + +For MeteorJS in its version 2.8.1 we have introduced to our core packages an integration with the [zodern:types](https://github.com/zodern/meteor-types) package. +This package allows you to use the TypeScript types for the Meteor core packages in your TypeScript code or JavaScript code. +in order to use the types you need to install the package by running the command: + +```bash +meteor add zodern:types +``` + +And add the following line to your `tsconfig.json` file (if you do not have one, create one and add the code bellow): + +```json +{ + "compilerOptions": { + "preserveSymlinks": true, + "paths": { + "meteor/*": [ + "node_modules/@types/meteor/*", + ".meteor/local/types/packages.d.ts" + ] + } + } +} +``` + +then run the command: + +```bash +meteor lint +``` + +this will create a file within your .meteor folder that will have your types for the core packages. +You can continue to use your code as you did before, but now you can use the types for the core packages even if you are in JavaScript. + +for more information about the package please visit the [zodern:types](https://github.com/zodern/meteor-types). diff --git a/meteor b/meteor index dff5d789b0..0779da7ba2 100755 --- a/meteor +++ b/meteor @@ -1,6 +1,6 @@ #!/usr/bin/env bash -BUNDLE_VERSION=14.20.1.0 +BUNDLE_VERSION=14.21.1.0 # OS Check. Put here because here is where we download the precompiled # bundles that are arch specific. diff --git a/npm-packages/eslint-plugin-meteor/.eslintignore b/npm-packages/eslint-plugin-meteor/.eslintignore index 5228e27ede..3653ab7c32 100644 --- a/npm-packages/eslint-plugin-meteor/.eslintignore +++ b/npm-packages/eslint-plugin-meteor/.eslintignore @@ -67,7 +67,6 @@ tools/runners/run-app.js tools/runners/run-mongo.js tools/runners/run-proxy.js tools/runners/run-selenium.js -tools/runners/run-updater.js tools/packaging/package-client.js tools/packaging/package-map.js diff --git a/npm-packages/meteor-installer/README.md b/npm-packages/meteor-installer/README.md index 4d164e7194..0fb3ca6f33 100644 --- a/npm-packages/meteor-installer/README.md +++ b/npm-packages/meteor-installer/README.md @@ -14,6 +14,7 @@ npm install -g meteor | NPM Package | Meteor Official Release | |-------------|-------------------------| +| 2.8.1 | 2.8.1 | | 2.8.0 | 2.8.0 | | 2.7.5 | 2.7.3 | | 2.7.4 | 2.7.3 | @@ -57,3 +58,8 @@ npm install -g meteor --ignore-meteor-setup-exec-path ``` (or by setting the environment variable `npm_config_ignore_meteor_setup_exec_path=true`) + +### Proxy configuration + +Setting the `https_proxy` or `HTTPS_PROXY` environment variable to a valid proxy URL will cause the +downloader to use the configured proxy to retrieve the Meteor files. \ No newline at end of file diff --git a/npm-packages/meteor-installer/config.js b/npm-packages/meteor-installer/config.js index 9b13c21c20..676cf07665 100644 --- a/npm-packages/meteor-installer/config.js +++ b/npm-packages/meteor-installer/config.js @@ -1,7 +1,7 @@ const path = require('path'); const os = require('os'); -const METEOR_LATEST_VERSION = '2.8.0'; +const METEOR_LATEST_VERSION = '2.8.1'; const sudoUser = process.env.SUDO_USER || ''; function isRoot() { return process.getuid && process.getuid() === 0; diff --git a/npm-packages/meteor-installer/install.js b/npm-packages/meteor-installer/install.js index c495d31999..6f52bfb93b 100644 --- a/npm-packages/meteor-installer/install.js +++ b/npm-packages/meteor-installer/install.js @@ -1,4 +1,5 @@ const { DownloaderHelper } = require('node-downloader-helper'); +const HttpsProxyAgent = require('https-proxy-agent'); const cliProgress = require('cli-progress'); const Seven = require('node-7z'); const path = require('path'); @@ -143,6 +144,15 @@ try { download(); +function generateProxyAgent() { + const proxyUrl = process.env.https_proxy || process.env.HTTPS_PROXY; + if (!proxyUrl) { + return undefined; + } + + return new HttpsProxyAgent(proxyUrl); +} + function download() { const start = Date.now(); const downloadProgress = new cliProgress.SingleBar( @@ -158,6 +168,9 @@ function download() { retry: { maxRetries: 5, delay: 5000 }, override: true, fileName: tarGzName, + httpsRequestOptions: { + agent: generateProxyAgent() + } }); dl.on('progress', ({ progress }) => { diff --git a/npm-packages/meteor-installer/package.json b/npm-packages/meteor-installer/package.json index d7a6b90863..34f8eb8224 100644 --- a/npm-packages/meteor-installer/package.json +++ b/npm-packages/meteor-installer/package.json @@ -1,6 +1,6 @@ { "name": "meteor", - "version": "2.8.0", + "version": "2.8.1", "description": "Install Meteor", "main": "install.js", "scripts": { diff --git a/packages/accounts-base/accounts-base.d.ts b/packages/accounts-base/accounts-base.d.ts new file mode 100644 index 0000000000..923625be79 --- /dev/null +++ b/packages/accounts-base/accounts-base.d.ts @@ -0,0 +1,326 @@ +import { Mongo } from 'meteor/mongo'; +import { Meteor } from 'meteor/meteor'; + +export interface URLS { + resetPassword: (token: string) => string; + verifyEmail: (token: string) => string; + enrollAccount: (token: string) => string; +} + +export interface EmailFields { + from?: ((user: Meteor.User) => string) | undefined; + subject?: ((user: Meteor.User) => string) | undefined; + text?: ((user: Meteor.User, url: string) => string) | undefined; + html?: ((user: Meteor.User, url: string) => string) | undefined; +} + +export namespace Accounts { + var urls: URLS; + + function user(options?: { + fields?: Mongo.FieldSpecifier | undefined; + }): Meteor.User | null; + + function userId(): string | null; + + function createUser( + options: { + username?: string | undefined; + email?: string | undefined; + password?: string | undefined; + profile?: Object | undefined; + }, + callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void + ): string; + + function config(options: { + sendVerificationEmail?: boolean | undefined; + forbidClientAccountCreation?: boolean | undefined; + restrictCreationByEmailDomain?: string | Function | undefined; + loginExpirationInDays?: number | undefined; + oauthSecretKey?: string | undefined; + passwordResetTokenExpirationInDays?: number | undefined; + passwordEnrollTokenExpirationInDays?: number | undefined; + ambiguousErrorMessages?: boolean | undefined; + defaultFieldSelector?: { [key: string]: 0 | 1 } | undefined; + }): void; + + function onLogin( + func: Function + ): { + stop: () => void; + }; + + function onLoginFailure( + func: Function + ): { + stop: () => void; + }; + + function loginServicesConfigured(): boolean; + + function onPageLoadLogin(func: Function): void; +} + +export namespace Accounts { + function changePassword( + oldPassword: string, + newPassword: string, + callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function forgotPassword( + options: { email?: string | undefined }, + callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function resetPassword( + token: string, + newPassword: string, + callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function verifyEmail( + token: string, + callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function onEmailVerificationLink(callback: Function): void; + + function onEnrollmentLink(callback: Function): void; + + function onResetPasswordLink(callback: Function): void; + + function loggingIn(): boolean; + + function loggingOut(): boolean; + + function logout( + callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function logoutOtherClients( + callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + var ui: { + config(options: { + requestPermissions?: Object | undefined; + requestOfflineToken?: Object | undefined; + forceApprovalPrompt?: Object | undefined; + passwordSignupFields?: string | undefined; + }): void; + }; +} + +export interface Header { + [id: string]: string; +} + +export interface EmailTemplates { + from: string; + siteName: string; + headers?: Header | undefined; + resetPassword: EmailFields; + enrollAccount: EmailFields; + verifyEmail: EmailFields; +} + +export namespace Accounts { + var emailTemplates: EmailTemplates; + + function addEmail(userId: string, newEmail: string, verified?: boolean): void; + + function removeEmail(userId: string, email: string): void; + + function onCreateUser( + func: (options: { profile?: {} | undefined }, user: Meteor.User) => void + ): void; + + function findUserByEmail( + email: string, + options?: { fields?: Mongo.FieldSpecifier | undefined } + ): Meteor.User | null | undefined; + + function findUserByUsername( + username: string, + options?: { fields?: Mongo.FieldSpecifier | undefined } + ): Meteor.User | null | undefined; + + function sendEnrollmentEmail( + userId: string, + email?: string, + extraTokenData?: Record, + extraParams?: Record + ): void; + + function sendResetPasswordEmail( + userId: string, + email?: string, + extraTokenData?: Record, + extraParams?: Record + ): void; + + function sendVerificationEmail( + userId: string, + email?: string, + extraTokenData?: Record, + extraParams?: Record + ): void; + + function setUsername(userId: string, newUsername: string): void; + + function setPassword( + userId: string, + newPassword: string, + options?: { logout?: Object | undefined } + ): void; + + function validateNewUser(func: Function): boolean; + + function validateLoginAttempt( + func: Function + ): { + stop: () => void; + }; + + function _hashPassword( + password: string + ): { digest: string; algorithm: string }; + + interface IValidateLoginAttemptCbOpts { + type: string; + allowed: boolean; + error: Meteor.Error; + user: Meteor.User; + connection: Meteor.Connection; + methodName: string; + methodArguments: any[]; + } +} + +export namespace Accounts { + function onLogout(func: Function): void; +} + +export namespace Accounts { + function onLogout( + func: (options: { + user: Meteor.User; + connection: Meteor.Connection; + }) => void + ): void; +} + +export namespace Accounts { + interface LoginMethodOptions { + /** + * The method to call (default 'login') + */ + methodName?: string | undefined; + /** + * The arguments for the method + */ + methodArguments?: any[] | undefined; + /** + * If provided, will be called with the result of the + * method. If it throws, the client will not be logged in (and + * its error will be passed to the callback). + */ + validateResult?: Function | undefined; + /** + * Will be called with no arguments once the user is fully + * logged in, or with the error on error. + */ + userCallback?: ((err?: any) => void) | undefined; + } + + /** + * + * Call a login method on the server. + * + * A login method is a method which on success calls `this.setUserId(id)` and + * `Accounts._setLoginToken` on the server and returns an object with fields + * 'id' (containing the user id), 'token' (containing a resume token), and + * optionally `tokenExpires`. + * + * This function takes care of: + * - Updating the Meteor.loggingIn() reactive data source + * - Calling the method in 'wait' mode + * - On success, saving the resume token to localStorage + * - On success, calling Accounts.connection.setUserId() + * - Setting up an onReconnect handler which logs in with + * the resume token + * + * Options: + * - methodName: The method to call (default 'login') + * - methodArguments: The arguments for the method + * - validateResult: If provided, will be called with the result of the + * method. If it throws, the client will not be logged in (and + * its error will be passed to the callback). + * - userCallback: Will be called with no arguments once the user is fully + * logged in, or with the error on error. + * + * */ + function callLoginMethod(options: LoginMethodOptions): void; + + /** + * + * The main entry point for auth packages to hook in to login. + * + * A login handler is a login method which can return `undefined` to + * indicate that the login request is not handled by this handler. + * + * @param name {String} Optional. The service name, used by default + * if a specific service name isn't returned in the result. + * + * @param handler {Function} A function that receives an options object + * (as passed as an argument to the `login` method) and returns one of: + * - `undefined`, meaning don't handle; + * - a login method result object + **/ + function registerLoginHandler( + name: string, + handler: (options: any) => undefined | Object + ): void; + + type Password = + | string + | { + digest: string; + algorithm: 'sha-256'; + }; + + /** + * + * Check whether the provided password matches the bcrypt'ed password in + * the database user record. `password` can be a string (in which case + * it will be run through SHA256 before bcrypt) or an object with + * properties `digest` and `algorithm` (in which case we bcrypt + * `password.digest`). + */ + function _checkPassword( + user: Meteor.User, + password: Password + ): { userId: string; error?: any }; +} + +export namespace Accounts { + type StampedLoginToken = { + token: string; + when: Date; + }; + type HashedStampedLoginToken = { + hashedToken: string; + when: Date; + }; + + function _generateStampedLoginToken(): StampedLoginToken; + function _hashStampedToken(token: StampedLoginToken): HashedStampedLoginToken; + function _insertHashedLoginToken( + userId: string, + token: HashedStampedLoginToken, + query?: Mongo.Selector | Mongo.ObjectID | string + ): void; + function _hashLoginToken(token: string): string; +} diff --git a/packages/accounts-base/accounts_server.js b/packages/accounts-base/accounts_server.js index 9088bbbea9..f677baa34c 100644 --- a/packages/accounts-base/accounts_server.js +++ b/packages/accounts-base/accounts_server.js @@ -318,7 +318,7 @@ export class AccountsServer extends AccountsCommon { // If user is not found, try a case insensitive lookup if (!user) { selector = this._selectorForFastCaseInsensitiveLookup(fieldName, fieldValue); - const candidateUsers = Meteor.users.find(selector, options).fetch(); + const candidateUsers = Meteor.users.find(selector, { ...options, limit: 2 }).fetch(); // No match if multiple candidates are found if (candidateUsers.length === 1) { user = candidateUsers[0]; @@ -547,19 +547,14 @@ export class AccountsServer extends AccountsCommon { /// LOGIN HANDLERS /// - // The main entry point for auth packages to hook in to login. - // - // A login handler is a login method which can return `undefined` to - // indicate that the login request is not handled by this handler. - // - // @param name {String} Optional. The service name, used by default - // if a specific service name isn't returned in the result. - // - // @param handler {Function} A function that receives an options object - // (as passed as an argument to the `login` method) and returns one of: - // - `undefined`, meaning don't handle; - // - a login method result object - + /** + * @summary Registers a new login handler. + * @locus Server + * @param {String} [name] The type of login method like oauth, password, etc. + * @param {Function} handler A function that receives an options object + * (as passed as an argument to the `login` method) and returns one of + * `undefined`, meaning don't handle or a login method result object. + */ registerLoginHandler(name, handler) { if (! handler) { handler = name; diff --git a/packages/accounts-base/package-types.json b/packages/accounts-base/package-types.json new file mode 100644 index 0000000000..033f6cab29 --- /dev/null +++ b/packages/accounts-base/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "accounts-base.d.ts" +} diff --git a/packages/accounts-base/package.js b/packages/accounts-base/package.js index 32a6df946c..90f03e6b50 100644 --- a/packages/accounts-base/package.js +++ b/packages/accounts-base/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: 'A user account system', - version: '2.2.4', + version: '2.2.5', }); Package.onUse(api => { @@ -48,6 +48,8 @@ Package.onUse(api => { // modules that import the accounts-base package. api.mainModule('server_main.js', 'server'); api.mainModule('client_main.js', 'client'); + + api.addAssets('accounts-base.d.ts', 'server'); }); Package.onTest(api => { diff --git a/packages/browser-policy-common/browser-policy-common.d.ts b/packages/browser-policy-common/browser-policy-common.d.ts new file mode 100644 index 0000000000..0cfa8678a3 --- /dev/null +++ b/packages/browser-policy-common/browser-policy-common.d.ts @@ -0,0 +1,38 @@ +export namespace BrowserPolicy { + var framing: { + disallow(): void; + restrictToOrigin(origin: string): void; + allowAll(): void; + }; + + var content: { + allowEval(): void; + allowInlineStyles(): void; + allowInlineScripts(): void; + allowSameOriginForAll(): void; + allowDataUrlForAll(): void; + allowOriginForAll(origin: string): void; + allowImageOrigin(origin: string): void; + allowMediaOrigin(origin: string): void; + allowFontOrigin(origin: string): void; + allowStyleOrigin(origin: string): void; + allowScriptOrigin(origin: string): void; + allowFrameOrigin(origin: string): void; + allowFrameAncestorsOrigin(origin: string): void; + allowContentTypeSniffing(): void; + allowAllContentOrigin(): void; + allowAllContentDataUrl(): void; + allowAllContentSameOrigin(): void; + allowConnectOrigin(origin: string): void; + allowObjectOrigin(origin: string): void; + + disallowAll(): void; + disallowInlineStyles(): void; + disallowEval(): void; + disallowInlineScripts(): void; + disallowFont(): void; + disallowObject(): void; + disallowAllContent(): void; + disallowConnect(): void; + }; +} diff --git a/packages/browser-policy-common/package-types.json b/packages/browser-policy-common/package-types.json new file mode 100644 index 0000000000..1b2482b244 --- /dev/null +++ b/packages/browser-policy-common/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "browser-policy-common.d.ts" +} diff --git a/packages/browser-policy-common/package.js b/packages/browser-policy-common/package.js index 85c2554c3e..d3a1888984 100644 --- a/packages/browser-policy-common/package.js +++ b/packages/browser-policy-common/package.js @@ -1,10 +1,11 @@ Package.describe({ summary: "Common code for browser-policy packages", - version: "1.0.11" + version: "1.0.12" }); Package.onUse(function (api) { api.use('webapp', 'server'); api.addFiles('browser-policy-common.js', 'server'); api.export('BrowserPolicy', 'server'); + api.addAssets('browser-policy-common.d.ts', 'server'); }); diff --git a/packages/browser-policy-framing/browser-policy-framing.js b/packages/browser-policy-framing/browser-policy-framing.js index eb90a3778b..1027492c57 100644 --- a/packages/browser-policy-framing/browser-policy-framing.js +++ b/packages/browser-policy-framing/browser-policy-framing.js @@ -12,7 +12,7 @@ var xFrameOptions = defaultXFrameOptions; const BrowserPolicy = require("meteor/browser-policy-common").BrowserPolicy; BrowserPolicy.framing = {}; -_.extend(BrowserPolicy.framing, { +Object.assign(BrowserPolicy.framing, { // Exported for tests and browser-policy-common. _constructXFrameOptions: function () { return xFrameOptions; diff --git a/packages/browser-policy-framing/package.js b/packages/browser-policy-framing/package.js index 4b982f0967..1135346dd5 100644 --- a/packages/browser-policy-framing/package.js +++ b/packages/browser-policy-framing/package.js @@ -1,11 +1,11 @@ Package.describe({ summary: "Restrict which websites can frame your app", - version: "1.1.0" + version: '1.1.1' }); Package.onUse(function (api) { api.use("modules"); - api.use(["underscore", "browser-policy-common"], "server"); + api.use(["browser-policy-common"], "server"); api.imply(["browser-policy-common"], "server"); api.mainModule("browser-policy-framing.js", "server"); }); diff --git a/packages/browser-policy/browser-policy-test.js b/packages/browser-policy/browser-policy-test.js index cd2e453a74..4ba437f761 100644 --- a/packages/browser-policy/browser-policy-test.js +++ b/packages/browser-policy/browser-policy-test.js @@ -1,17 +1,34 @@ BrowserPolicy._setRunningTest(); +var toObject = function(list, values) { + if (list == null) return {}; + var result = {}; + for (var i = 0, length = list.length; i < length; i++) { + if (values) { + result[list[i]] = values[i]; + } else { + result[list[i][0]] = list[i][1]; + } + } + return result; +}; + var cspsEqual = function (csp1, csp2) { var cspToObj = function (csp) { csp = csp.substring(0, csp.length - 1); - var parts = _.map(csp.split("; "), function (part) { + var parts = csp.split("; ").map(function (part) { return part.split(" "); }); - var keys = _.map(parts, _.first); - var values = _.map(parts, _.rest); - _.each(values, function (value) { + var keys = parts.map(part => part[0]); + var values = parts.map((part) => { + const [head, ...tail] = part; + return tail; + }); + values.forEach(function (value) { value.sort(); }); - return _.object(keys, values); + + return toObject(keys, values); }; return EJSON.equals(cspToObj(csp1), cspToObj(csp2)); @@ -137,11 +154,11 @@ Tinytest.add("browser-policy - csp", function (test) { "default-src 'none'; frame-src https://foo.com; " + "object-src http://foo.com https://foo.com;")); - // Check that frame-ancestors property is set correctly.
 - BrowserPolicy.content.allowFrameAncestorsOrigin("https://foo.com/");
 - test.isTrue(cspsEqual(BrowserPolicy.content._constructCsp(),
 - "default-src 'none'; frame-src https://foo.com; " +
 - "object-src http://foo.com https://foo.com; " +
 + // Check that frame-ancestors property is set correctly. + BrowserPolicy.content.allowFrameAncestorsOrigin("https://foo.com/"); + test.isTrue(cspsEqual(BrowserPolicy.content._constructCsp(), + "default-src 'none'; frame-src https://foo.com; " + + "object-src http://foo.com https://foo.com; " + "frame-ancestors https://foo.com;")); // CSP2 options: nonce @@ -188,4 +205,4 @@ Tinytest.add("browser-policy - X-Content-Type-Options", function (test) { test.equal(BrowserPolicy.content._xContentTypeOptions(), "nosniff"); BrowserPolicy.content.allowContentTypeSniffing(); test.equal(BrowserPolicy.content._xContentTypeOptions(), undefined); -}); +}); \ No newline at end of file diff --git a/packages/browser-policy/package.js b/packages/browser-policy/package.js index 8d370afc66..bbab788e76 100644 --- a/packages/browser-policy/package.js +++ b/packages/browser-policy/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Configure security policies enforced by the browser", - version: "1.1.0" + version: '1.1.1' }); Package.onUse(function (api) { @@ -11,6 +11,6 @@ Package.onUse(function (api) { }); Package.onTest(function (api) { - api.use(["tinytest", "browser-policy", "ejson", "underscore"], "server"); + api.use(["tinytest", "browser-policy", "ejson"], "server"); api.addFiles("browser-policy-test.js", "server"); }); diff --git a/packages/check/check.d.ts b/packages/check/check.d.ts new file mode 100644 index 0000000000..0322aab9e9 --- /dev/null +++ b/packages/check/check.d.ts @@ -0,0 +1,92 @@ +/** + * The namespace for all Match types and methods. + */ +export namespace Match { + interface Matcher { + _meteorCheckMatcherBrand: void; + } + // prettier-ignore + export type Pattern = + typeof String | + typeof Number | + typeof Boolean | + typeof Object | + typeof Function | + (new (...args: any[]) => any) | + undefined | null | string | number | boolean | + [Pattern] | + {[key: string]: Pattern} | + Matcher; + // prettier-ignore + export type PatternMatch = + T extends Matcher ? U : + T extends typeof String ? string : + T extends typeof Number ? number : + T extends typeof Boolean ? boolean : + T extends typeof Object ? object : + T extends typeof Function ? Function : + T extends undefined | null | string | number | boolean ? T : + T extends new (...args: any[]) => infer U ? U : + T extends [Pattern] ? PatternMatch[] : + T extends {[key: string]: Pattern} ? {[K in keyof T]: PatternMatch} : + unknown; + + /** Matches any value. */ + var Any: Matcher; + /** Matches a signed 32-bit integer. Doesn’t match `Infinity`, `-Infinity`, or `NaN`. */ + var Integer: Matcher; + + /** + * Matches either `undefined`, `null`, or pattern. If used in an object, matches only if the key is not set as opposed to the value being set to `undefined` or `null`. This set of conditions + * was chosen because `undefined` arguments to Meteor Methods are converted to `null` when sent over the wire. + */ + function Maybe( + pattern: T + ): Matcher | undefined | null>; + + /** Behaves like `Match.Maybe` except it doesn’t accept `null`. If used in an object, the behavior is identical to `Match.Maybe`. */ + function Optional( + pattern: T + ): Matcher | undefined>; + + /** Matches an Object with the given keys; the value may also have other keys with arbitrary values. */ + function ObjectIncluding( + dico: T + ): Matcher>; + + /** Matches any value that matches at least one of the provided patterns. */ + function OneOf( + ...patterns: T + ): Matcher>; + + /** + * Calls the function condition with the value as the argument. If condition returns true, this matches. If condition throws a `Match.Error` or returns false, this fails. If condition throws + * any other error, that error is thrown from the call to `check` or `Match.test`. + */ + function Where(condition: (val: any) => val is T): Matcher; + function Where(condition: (val: any) => boolean): Matcher; + + /** + * Returns true if the value matches the pattern. + * @param value The value to check + * @param pattern The pattern to match `value` against + */ + function test( + value: any, + pattern: T + ): value is PatternMatch; +} + +/** + * Check that a value matches a pattern. + * If the value does not match the pattern, throw a `Match.Error`. + * + * Particularly useful to assert that arguments to a function have the right + * types and structure. + * @param value The value to check + * @param pattern The pattern to match `value` against + */ +export declare function check( + value: any, + pattern: T +): asserts value is Match.PatternMatch; diff --git a/packages/check/package-types.json b/packages/check/package-types.json new file mode 100644 index 0000000000..19e3d36ba9 --- /dev/null +++ b/packages/check/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "check.d.ts" +} diff --git a/packages/check/package.js b/packages/check/package.js index ee260f6f24..7505e58b51 100644 --- a/packages/check/package.js +++ b/packages/check/package.js @@ -1,12 +1,14 @@ Package.describe({ summary: 'Check whether a value matches a pattern', - version: '1.3.1', + version: '1.3.2', }); Package.onUse(api => { api.use('ecmascript'); api.use('ejson'); + api.addAssets('check.d.ts', 'server'); + api.mainModule('match.js'); api.export('check'); diff --git a/packages/ddp-client/common/livedata_connection.js b/packages/ddp-client/common/livedata_connection.js index c30ff6f48d..868201c43d 100644 --- a/packages/ddp-client/common/livedata_connection.js +++ b/packages/ddp-client/common/livedata_connection.js @@ -695,7 +695,14 @@ export class Connection { invocation ); try { - stubOptions.stubReturnValue = await stubInvocation(); + const resultOrThenable = stubInvocation(); + const isThenable = + resultOrThenable && typeof resultOrThenable.then === 'function'; + if (isThenable) { + stubOptions.stubReturnValue = await resultOrThenable; + } else { + stubOptions.stubReturnValue = resultOrThenable; + } } finally { DDP._CurrentMethodInvocation._set(currentContext); } diff --git a/packages/ddp-client/package.js b/packages/ddp-client/package.js index 0cdc77a953..5a0b31737f 100644 --- a/packages/ddp-client/package.js +++ b/packages/ddp-client/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Meteor's latency-compensated distributed data client", - version: '2.6.0', + version: '2.6.1', documentation: null }); diff --git a/packages/ddp-rate-limiter/ddp-rate-limiter.d.ts b/packages/ddp-rate-limiter/ddp-rate-limiter.d.ts new file mode 100644 index 0000000000..fbce221f5a --- /dev/null +++ b/packages/ddp-rate-limiter/ddp-rate-limiter.d.ts @@ -0,0 +1,17 @@ +export namespace DDPRateLimiter { + interface Matcher { + type?: string | ((type: string) => boolean) | undefined; + name?: string | ((name: string) => boolean) | undefined; + userId?: string | ((userId: string) => boolean) | undefined; + connectionId?: string | ((connectionId: string) => boolean) | undefined; + clientAddress?: string | ((clientAddress: string) => boolean) | undefined; + } + + function addRule( + matcher: Matcher, + numRequests: number, + timeInterval: number + ): string; + + function removeRule(ruleId: string): boolean; +} diff --git a/packages/ddp-rate-limiter/package-types.json b/packages/ddp-rate-limiter/package-types.json new file mode 100644 index 0000000000..34869b7735 --- /dev/null +++ b/packages/ddp-rate-limiter/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "ddp-rate-limiter.d.ts" +} diff --git a/packages/ddp-rate-limiter/package.js b/packages/ddp-rate-limiter/package.js index a38d55936e..c39e26c462 100644 --- a/packages/ddp-rate-limiter/package.js +++ b/packages/ddp-rate-limiter/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'ddp-rate-limiter', - version: '1.1.0', + version: '1.1.1', // Brief, one-line summary of the package. summary: 'The DDPRateLimiter allows users to add rate limits to DDP' + ' methods and subscriptions.', @@ -14,6 +14,7 @@ Package.describe({ Package.onUse(function(api) { api.use('rate-limit', 'server'); api.use('ecmascript'); + api.addAssets('ddp-rate-limiter.d.ts', 'server'); api.export('DDPRateLimiter', 'server'); api.mainModule('ddp-rate-limiter.js', 'server'); }); diff --git a/packages/ddp/ddp.d.ts b/packages/ddp/ddp.d.ts new file mode 100644 index 0000000000..199adb3d55 --- /dev/null +++ b/packages/ddp/ddp.d.ts @@ -0,0 +1,65 @@ +import { Meteor } from 'meteor/meteor'; + +export namespace DDP { + interface DDPStatic { + subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle; + call(method: string, ...parameters: any[]): any; + apply(method: string, ...parameters: any[]): any; + methods(IMeteorMethodsDictionary: any): any; + status(): DDPStatus; + reconnect(): void; + disconnect(): void; + onReconnect(): void; + } + + function _allSubscriptionsReady(): boolean; + + type Status = 'connected' | 'connecting' | 'failed' | 'waiting' | 'offline'; + + interface DDPStatus { + connected: boolean; + status: Status; + retryCount: number; + retryTime?: number | undefined; + reason?: string | undefined; + } + + function connect(url: string): DDPStatic; +} + +export namespace DDPCommon { + interface MethodInvocationOptions { + userId: string | null; + setUserId?: ((newUserId: string) => void) | undefined; + isSimulation: boolean; + connection: Meteor.Connection; + randomSeed: string; + } + + /** The state for a single invocation of a method, referenced by this inside a method definition. */ + interface MethodInvocation { + new (options: MethodInvocationOptions): MethodInvocation; + /** + * Call inside a method invocation. Allow subsequent method from this client to begin running in a new fiber. + */ + unblock(): void; + /** + * Set the logged in user. + * @param userId The value that should be returned by `userId` on this connection. + */ + setUserId(userId: string | null): void; + /** + * The id of the user that made this method call, or `null` if no user was logged in. + */ + userId: string | null; + /** + * Access inside a method invocation. Boolean value, true if this invocation is a stub. + */ + isSimulation: boolean; + /** + * Access inside a method invocation. The [connection](#meteor_onconnection) that this method was received on. `null` if the method is not associated with a connection, eg. a server + * initiated method call. Calls to methods made from a server method which was in turn initiated from the client share the same `connection`. + */ + connection: Meteor.Connection; + } +} diff --git a/packages/ddp/package-types.json b/packages/ddp/package-types.json new file mode 100644 index 0000000000..31646e57c4 --- /dev/null +++ b/packages/ddp/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "ddp.d.ts" +} diff --git a/packages/ddp/package.js b/packages/ddp/package.js index 49cace9e05..bf92eed179 100644 --- a/packages/ddp/package.js +++ b/packages/ddp/package.js @@ -1,12 +1,14 @@ Package.describe({ summary: "Meteor's latency-compensated distributed data framework", - version: '1.4.0' + version: '1.4.1' }); Package.onUse(function (api) { api.use(['ddp-client'], ['client', 'server']); api.use(['ddp-server'], 'server'); + api.addAssets('ddp.d.ts', 'server'); + api.export('DDP'); api.export('DDPServer', 'server'); diff --git a/packages/deprecated/jshint/.versions b/packages/deprecated/jshint/.versions index c5612a10eb..2560991c2d 100644 --- a/packages/deprecated/jshint/.versions +++ b/packages/deprecated/jshint/.versions @@ -5,7 +5,7 @@ base64@1.0.12 binary-heap@1.0.11 boilerplate-generator@1.7.1 callback-hook@1.3.0 -check@1.3.1 +check@1.3.2 ddp@1.4.0 ddp-client@2.4.1 ddp-common@1.4.0 @@ -36,14 +36,14 @@ mongo-id@1.0.8 npm-mongo@3.9.0 ordered-dict@1.1.0 promise@0.11.2 -random@1.2.0 +random@1.2.1 react-fast-refresh@0.1.1 reload@1.3.1 retry@1.1.0 routepolicy@1.1.0 socket-stream-client@0.3.3 tinytest@1.1.0 -tracker@1.2.0 -underscore@1.0.10 +tracker@1.2.1 +underscore@1.0.11 webapp@1.10.1 webapp-hashing@1.1.0 diff --git a/packages/diff-sequence/package.js b/packages/diff-sequence/package.js index 18c673049b..8c63436265 100644 --- a/packages/diff-sequence/package.js +++ b/packages/diff-sequence/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "An implementation of a diff algorithm on arrays and objects.", - version: '1.1.1', + version: '1.1.2', documentation: null }); @@ -14,7 +14,6 @@ Package.onUse(function (api) { Package.onTest(function (api) { api.use([ 'tinytest', - 'underscore', 'ejson' ]); diff --git a/packages/diff-sequence/tests.js b/packages/diff-sequence/tests.js index a8cc9c3c58..8c593baee0 100644 --- a/packages/diff-sequence/tests.js +++ b/packages/diff-sequence/tests.js @@ -1,6 +1,6 @@ Tinytest.add("diff-sequence - diff changes ordering", function (test) { var makeDocs = function (ids) { - return _.map(ids, function (id) { return {_id: id};}); + return ids.map(function (id) { return {_id: id};}); }; var testMutation = function (a, b) { var aa = makeDocs(a); @@ -10,12 +10,12 @@ Tinytest.add("diff-sequence - diff changes ordering", function (test) { addedBefore: function (id, doc, before) { if (before === null) { - aaCopy.push( _.extend({_id: id}, doc)); + aaCopy.push( Object.assign({_id: id}, doc)); return; } for (var i = 0; i < aaCopy.length; i++) { if (aaCopy[i]._id === before) { - aaCopy.splice(i, 0, _.extend({_id: id}, doc)); + aaCopy.splice(i, 0, Object.assign({_id: id}, doc)); return; } } @@ -29,12 +29,12 @@ Tinytest.add("diff-sequence - diff changes ordering", function (test) { } } if (before === null) { - aaCopy.push( _.extend({_id: id}, found)); + aaCopy.push( Object.assign({_id: id}, found)); return; } for (i = 0; i < aaCopy.length; i++) { if (aaCopy[i]._id === before) { - aaCopy.splice(i, 0, _.extend({_id: id}, found)); + aaCopy.splice(i, 0, Object.assign({_id: id}, found)); return; } } @@ -75,7 +75,7 @@ Tinytest.add("diff-sequence - diff", function (test) { for (var i = 1; i <= origLen; i++) oldResults[i-1] = {_id: i}; - var newResults = _.map(newOldIdx, function(n) { + var newResults = newOldIdx.map(function(n) { var doc = {_id: Math.abs(n)}; if (n < 0) doc.changed = true; @@ -89,7 +89,7 @@ Tinytest.add("diff-sequence - diff", function (test) { return -1; }; - var results = _.clone(oldResults); + var results = [...oldResults]; var observer = { addedBefore: function(id, fields, before) { var before_idx; @@ -97,7 +97,7 @@ Tinytest.add("diff-sequence - diff", function (test) { before_idx = results.length; else before_idx = find (results, before); - var doc = _.extend({_id: id}, fields); + var doc = Object.assign({_id: id}, fields); test.isFalse(before_idx < 0 || before_idx > results.length); results.splice(before_idx, 0, doc); }, @@ -157,4 +157,3 @@ Tinytest.add("diff-sequence - diff", function (test) { diffTest(3, [-3, -2, -1]); diffTest(10, [-2, 7, 4, 6, 11, -3, -8, 9]); }); - diff --git a/packages/ecmascript/package.js b/packages/ecmascript/package.js index eed53fefd0..adb2b73436 100644 --- a/packages/ecmascript/package.js +++ b/packages/ecmascript/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'ecmascript', - version: '0.16.2', + version: '0.16.3', summary: 'Compiler plugin that supports ES2015+ in all .js files', documentation: 'README.md', }); @@ -31,7 +31,7 @@ Package.onUse(function(api) { }); Package.onTest(function(api) { - api.use(['tinytest', 'underscore']); + api.use(['tinytest']); api.use(['es5-shim', 'ecmascript', 'babel-compiler']); api.addFiles('runtime-tests.js'); api.addFiles('transpilation-tests.js', 'server'); diff --git a/packages/ecmascript/runtime-tests.js b/packages/ecmascript/runtime-tests.js index f0cb308a97..c4ddfe227d 100644 --- a/packages/ecmascript/runtime-tests.js +++ b/packages/ecmascript/runtime-tests.js @@ -216,7 +216,7 @@ Tinytest.add('ecmascript - runtime - block scope', test => { }); } - _.each(thunks, f => f()); + thunks.forEach(f => f()); test.equal(buf, [0, 1, 2]); } }); diff --git a/packages/ejson/ejson.d.ts b/packages/ejson/ejson.d.ts new file mode 100644 index 0000000000..61c3a7674c --- /dev/null +++ b/packages/ejson/ejson.d.ts @@ -0,0 +1,71 @@ +export interface EJSONableCustomType { + clone?(): EJSONableCustomType; + equals?(other: Object): boolean; + toJSONValue(): JSONable; + typeName(): string; +} + +export type EJSONableProperty = + | number + | string + | boolean + | Object + | number[] + | string[] + | Object[] + | Date + | Uint8Array + | EJSONableCustomType + | undefined + | null; + +export interface EJSONable { + [key: string]: EJSONableProperty; +} + +export interface JSONable { + [key: string]: + | number + | string + | boolean + | Object + | number[] + | string[] + | Object[] + | undefined + | null; +} + +export interface EJSON extends EJSONable {} + +export namespace EJSON { + function addType( + name: string, + factory: (val: JSONable) => EJSONableCustomType + ): void; + + function clone(val: T): T; + + function equals( + a: EJSON, + b: EJSON, + options?: { keyOrderSensitive?: boolean | undefined } + ): boolean; + + function fromJSONValue(val: JSONable): any; + + function isBinary(x: Object): x is Uint8Array; + function newBinary(size: number): Uint8Array; + + function parse(str: string): EJSON; + + function stringify( + val: EJSON, + options?: { + indent?: boolean | number | string | undefined; + canonical?: boolean | undefined; + } + ): string; + + function toJSONValue(val: EJSON): JSONable; +} diff --git a/packages/ejson/package-types.json b/packages/ejson/package-types.json new file mode 100644 index 0000000000..3f2149b4c0 --- /dev/null +++ b/packages/ejson/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "ejson.d.ts" +} diff --git a/packages/ejson/package.js b/packages/ejson/package.js index 2a10d49443..8003d75acf 100644 --- a/packages/ejson/package.js +++ b/packages/ejson/package.js @@ -1,10 +1,11 @@ Package.describe({ summary: 'Extended and Extensible JSON library', - version: '1.1.2' + version: '1.1.3' }); Package.onUse(function onUse(api) { api.use(['ecmascript', 'base64']); + api.addAssets('ejson.d.ts', 'server'); api.mainModule('ejson.js'); api.export('EJSON'); }); diff --git a/packages/email/email.d.ts b/packages/email/email.d.ts new file mode 100644 index 0000000000..71380d328e --- /dev/null +++ b/packages/email/email.d.ts @@ -0,0 +1,44 @@ +export namespace Email { + interface EmailOptions { + from?: string | undefined; + to?: string | string[] | undefined; + cc?: string | string[] | undefined; + bcc?: string | string[] | undefined; + replyTo?: string | string[] | undefined; + subject?: string | undefined; + text?: string | undefined; + html?: string | undefined; + headers?: Object | undefined; + attachments?: Object[] | undefined; + mailComposer?: MailComposer | undefined; + } + + interface CustomEmailOptions extends EmailOptions { + packageSettings?: unknown; + } + + function send(options: EmailOptions): void; + function hookSend(fn: (options: EmailOptions) => boolean): void; + function customTransport(fn: (options: CustomEmailOptions) => void): void; +} + +export interface MailComposerOptions { + escapeSMTP: boolean; + encoding: string; + charset: string; + keepBcc: boolean; + forceEmbeddedImages: boolean; +} + +export declare var MailComposer: MailComposerStatic; + +export interface MailComposerStatic { + new (options: MailComposerOptions): MailComposer; +} + +export interface MailComposer { + addHeader(name: string, value: string): void; + setMessageOption(from: string, to: string, body: string, html: string): void; + streamMessage(): void; + pipe(stream: any /** fs.WriteStream **/): void; +} diff --git a/packages/email/package-types.json b/packages/email/package-types.json new file mode 100644 index 0000000000..de228d2fc5 --- /dev/null +++ b/packages/email/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "email.d.ts" +} diff --git a/packages/email/package.js b/packages/email/package.js index 3fb07dae92..326bad392a 100644 --- a/packages/email/package.js +++ b/packages/email/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: 'Send email messages', - version: '2.2.1', + version: '2.2.2', }); Npm.depends({ @@ -10,6 +10,7 @@ Npm.depends({ Package.onUse(function(api) { api.use(['ecmascript', 'logging', 'callback-hook'], 'server'); + api.addAssets('email.d.ts', 'server'); api.mainModule('email.js', 'server'); api.export(['Email', 'EmailInternals'], 'server'); api.export('EmailTest', 'server', { testOnly: true }); diff --git a/packages/facebook-oauth/CHANGELOG.md b/packages/facebook-oauth/CHANGELOG.md index a772af6e78..b492fe1f09 100644 --- a/packages/facebook-oauth/CHANGELOG.md +++ b/packages/facebook-oauth/CHANGELOG.md @@ -1,10 +1,26 @@ # Changelog -## 1.8.0 - unreleased -### Breaking changes -- N/A - +## 1.12.0 - UNRELEASED +### Changes +- Updated default version of Facebook GraphAPI to v15 + +## 1.11.0 - 2022-03-24 +### Changes +- Updated default version of Facebook GraphAPI to v12 + +## 1.10.0 - 2021-09-14 +### Changes +- Added login handler hook, like in the Google package for easier management in React Native and similar apps. [PR](https://github.com/meteor/meteor/pull/11603) + +## 1.9.1 - 2021-08-12 +### Changes +- Allow usage of `http` package both v1 and v2 for backward compatibility + +## 1.9.0 - 2021-06-24 +### Changes +- Upgrade default Facebook API to v10 [#11362](https://github.com/meteor/meteor/pull/11362) + +## 1.8.0 - 2021-04-15 ### Changes -- Updated to use Facebook GraphAPI v10 - You can now override the default API version by setting `Meteor.settings.public.packages.facebook-oauth.apiVersion` to for example `8.0` ## 1.7.3 - 2020-10-05 diff --git a/packages/facebook-oauth/facebook_client.js b/packages/facebook-oauth/facebook_client.js index 771e1d6828..582d63bf04 100644 --- a/packages/facebook-oauth/facebook_client.js +++ b/packages/facebook-oauth/facebook_client.js @@ -30,7 +30,7 @@ Facebook.requestCredential = (options, credentialRequestCompleteCallback) => { const loginStyle = OAuth._loginStyle('facebook', config, options); - const API_VERSION = Meteor.settings?.public?.packages?.['facebook-oauth']?.apiVersion || '13.0'; + const API_VERSION = Meteor.settings?.public?.packages?.['facebook-oauth']?.apiVersion || '15.0'; let loginUrl = `https://www.facebook.com/v${API_VERSION}/dialog/oauth?client_id=${config.appId}` + diff --git a/packages/facebook-oauth/package.js b/packages/facebook-oauth/package.js index 67536065cb..5df363643a 100644 --- a/packages/facebook-oauth/package.js +++ b/packages/facebook-oauth/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Facebook OAuth flow", - version: "1.11.0" + version: '1.11.1' }); Package.onUse(api => { diff --git a/packages/facts-ui/facts_ui_client.js b/packages/facts-ui/facts_ui_client.js index 9542c5f5f9..6731cfe466 100644 --- a/packages/facts-ui/facts_ui_client.js +++ b/packages/facts-ui/facts_ui_client.js @@ -6,7 +6,7 @@ Template.serverFacts.helpers({ factsByPackage: () => Facts.server.find(), facts: function () { const factArray = []; - _.each(this, function (value, name) { + Object.entries(this).forEach(function ([name, value]) { if (name !== '_id') factArray.push({name: name, value: value}); }); diff --git a/packages/facts-ui/package.js b/packages/facts-ui/package.js index 20d72c3b10..4a40b24089 100644 --- a/packages/facts-ui/package.js +++ b/packages/facts-ui/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Display internal app statistics", - version: '1.0.0' + version: '1.0.1' }); Package.onUse(function (api) { @@ -8,8 +8,7 @@ Package.onUse(function (api) { 'ecmascript', 'facts-base', 'mongo', - 'templating@1.2.13', - 'underscore', + 'templating@1.2.13' ], 'client'); api.imply('facts-base'); diff --git a/packages/fetch/fetch.d.ts b/packages/fetch/fetch.d.ts new file mode 100644 index 0000000000..8d6eb289ad --- /dev/null +++ b/packages/fetch/fetch.d.ts @@ -0,0 +1,4 @@ +export declare function fetch(): typeof globalThis.fetch; +export declare var Headers: typeof globalThis.Headers; +export declare var Request: typeof globalThis.Request; +export declare var Response: typeof globalThis.Response; diff --git a/packages/fetch/package-types.json b/packages/fetch/package-types.json new file mode 100644 index 0000000000..3fcb42c31a --- /dev/null +++ b/packages/fetch/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "fetch.d.ts" +} diff --git a/packages/fetch/package.js b/packages/fetch/package.js index 9c3969ff7b..5648235dac 100644 --- a/packages/fetch/package.js +++ b/packages/fetch/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "fetch", - version: "0.1.1", + version: '0.1.2', summary: "Isomorphic modern/legacy/Node polyfill for WHATWG fetch()", documentation: "README.md" }); @@ -19,6 +19,7 @@ Package.onUse(function(api) { api.mainModule("legacy.js", "legacy"); api.mainModule("server.js", "server"); + api.addAssets("fetch.d.ts", "server"); // The other exports (Headers, Request, Response) can be imported // explicitly from the "meteor/fetch" package. api.export("fetch"); diff --git a/packages/geojson-utils/geojson-utils.tests.js b/packages/geojson-utils/geojson-utils.tests.js index ea7ab39462..2d97d7a472 100644 --- a/packages/geojson-utils/geojson-utils.tests.js +++ b/packages/geojson-utils/geojson-utils.tests.js @@ -85,8 +85,8 @@ Tinytest.add("geojson-utils - points distance generated tests", function (test) 6846704.0253010122, 1368055.9401701286, 14041503.0409814864, 18560499.7346975356, 3793112.6186894816]; - _.each(tests, function (pair, testN) { - var distance = GeoJSON.pointDistance.apply(this, _.map(pair, toGeoJSONPoint)); + tests.forEach(function (pair, testN) { + var distance = GeoJSON.pointDistance.apply(this, pair.map(toGeoJSONPoint)); test.isTrue(Math.abs(distance - answers[testN]) < 0.000001, "Wrong distance between points " + JSON.stringify(pair) + ": " + distance + ", " + Math.abs(distance - answers[testN]) + " differenc"); }); diff --git a/packages/geojson-utils/package.js b/packages/geojson-utils/package.js index 5ae045b046..4dc3e82de0 100644 --- a/packages/geojson-utils/package.js +++ b/packages/geojson-utils/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: 'GeoJSON utility functions (from https://github.com/maxogden/geojson-js-utils)', - version: '1.0.10' + version: '1.0.11' }); Package.onUse(function (api) { @@ -11,7 +11,6 @@ Package.onUse(function (api) { Package.onTest(function (api) { api.use('tinytest'); - api.use('underscore'); api.use('geojson-utils'); api.addFiles(['geojson-utils.tests.js'], 'client'); }); diff --git a/packages/hot-module-replacement/hot-module-replacement.d.ts b/packages/hot-module-replacement/hot-module-replacement.d.ts new file mode 100644 index 0000000000..767262f3ac --- /dev/null +++ b/packages/hot-module-replacement/hot-module-replacement.d.ts @@ -0,0 +1,14 @@ +export interface Module { + readonly hot?: { + accept(): void; + decline(): void; + dispose(callback: (data: object) => void): void; + data: object | null; + onRequire(callbacks: { + before?(requiredModule: Module, parentId: string): T; + after?(requiredModule: Module, data: T): void; + }): void; + }; +} + +export declare var module: NodeJS.Module; diff --git a/packages/hot-module-replacement/package-types.json b/packages/hot-module-replacement/package-types.json new file mode 100644 index 0000000000..b11c5dadfe --- /dev/null +++ b/packages/hot-module-replacement/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "hot-module-replacement.d.ts" +} diff --git a/packages/hot-module-replacement/package.js b/packages/hot-module-replacement/package.js index 2d92f97b09..c3f3e3c3af 100644 --- a/packages/hot-module-replacement/package.js +++ b/packages/hot-module-replacement/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'hot-module-replacement', - version: '0.5.1', + version: '0.5.2', summary: 'Update code in development without reloading the page', documentation: 'README.md', debugOnly: true, @@ -11,6 +11,8 @@ Package.onUse(function(api) { api.use('meteor'); api.use('hot-code-push', { unordered: true }); + api.addAssets('hot-module-replacement.d.ts', 'server'); + // Provides polyfills needed by Meteor.absoluteUrl in legacy browsers api.use('ecmascript-runtime-client', { weak: true }); diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index 374140976c..b28bbf6643 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: 'The Meteor command-line tool', - version: '2.8.0', + version: '2.8.1', }); Package.includeTool(); diff --git a/packages/meteor/meteor.d.ts b/packages/meteor/meteor.d.ts new file mode 100644 index 0000000000..0a482c0aa9 --- /dev/null +++ b/packages/meteor/meteor.d.ts @@ -0,0 +1,504 @@ +import { Mongo } from 'meteor/mongo'; +import { EJSONable, EJSONableProperty } from 'meteor/ejson'; +import { Blaze } from 'meteor/blaze'; +import { DDP } from 'meteor/ddp'; + +export type global_Error = Error; + +export namespace Meteor { + /** Global props **/ + /** True if running in client environment. */ + var isClient: boolean; + /** True if running in a Cordova mobile environment. */ + var isCordova: boolean; + /** True if running in server environment. */ + var isServer: boolean; + /** True if running in production environment. */ + var isProduction: boolean; + /** + * `Meteor.release` is a string containing the name of the release with which the project was built (for example, `"1.2.3"`). It is `undefined` if the project was built using a git checkout + * of Meteor. + */ + var release: string; + /** Global props **/ + + /** Settings **/ + interface Settings { + public: { [id: string]: any }; + [id: string]: any; + } + /** + * `Meteor.settings` contains deployment-specific configuration options. You can initialize settings by passing the `--settings` option (which takes the name of a file containing JSON data) + * to `meteor run` or `meteor deploy`. When running your server directly (e.g. from a bundle), you instead specify settings by putting the JSON directly into the `METEOR_SETTINGS` environment + * variable. If the settings object contains a key named `public`, then `Meteor.settings.public` will be available on the client as well as the server. All other properties of + * `Meteor.settings` are only defined on the server. You can rely on `Meteor.settings` and `Meteor.settings.public` being defined objects (not undefined) on both client and server even if + * there are no settings specified. Changes to `Meteor.settings.public` at runtime will be picked up by new client connections. + */ + var settings: Settings; + /** Settings **/ + + /** User **/ + interface UserEmail { + address: string; + verified: boolean; + } + /** + * UserProfile is left intentionally underspecified here, to allow you + * to override it in your application (but keep in mind that the default + * Meteor configuration allows users to write directly to their user + * record's profile field) + */ + interface UserProfile {} + interface User { + _id: string; + username?: string | undefined; + emails?: UserEmail[] | undefined; + createdAt?: Date | undefined; + profile?: UserProfile; + services?: any; + } + + function user(options?: { + fields?: Mongo.FieldSpecifier | undefined; + }): User | null; + + function userId(): string | null; + var users: Mongo.Collection; + /** User **/ + + /** Error **/ + /** + * This class represents a symbolic error thrown by a method. + */ + var Error: ErrorStatic; + interface ErrorStatic { + /** + * @param error A string code uniquely identifying this kind of error. + * This string should be used by callers of the method to determine the + * appropriate action to take, instead of attempting to parse the reason + * or details fields. For example: + * + * ``` + * // on the server, pick a code unique to this error + * // the reason field should be a useful debug message + * throw new Meteor.Error("logged-out", + * "The user must be logged in to post a comment."); + * + * // on the client + * Meteor.call("methodName", function (error) { + * // identify the error + * if (error && error.error === "logged-out") { + * // show a nice error message + * Session.set("errorMessage", "Please log in to post a comment."); + * } + * }); + * ``` + * + * For legacy reasons, some built-in Meteor functions such as `check` throw + * errors with a number in this field. + * + * @param reason Optional. A short human-readable summary of the + * error, like 'Not Found'. + * @param details Optional. Additional information about the error, + * like a textual stack trace. + */ + new (error: string | number, reason?: string, details?: string): Error; + } + interface Error extends global_Error { + error: string | number; + reason?: string | undefined; + details?: string | undefined; + } + var TypedError: TypedErrorStatic; + interface TypedErrorStatic { + new (message: string, errorType: string): TypedError; + } + interface TypedError extends global_Error { + message: string; + errorType: string; + } + /** Error **/ + + /** Method **/ + interface MethodThisType { + /** Access inside a method invocation. Boolean value, true if this invocation is a stub. */ + isSimulation: boolean; + /** The id of the user that made this method call, or `null` if no user was logged in. */ + userId: string | null; + /** + * Access inside a method invocation. The connection that this method was received on. `null` if the method is not associated with a connection, eg. a server initiated method call. Calls + * to methods made from a server method which was in turn initiated from the client share the same `connection`. */ + connection: Connection | null; + /** + * Set the logged in user. + * @param userId The value that should be returned by `userId` on this connection. + */ + setUserId(userId: string | null): void; + /** Call inside a method invocation. Allow subsequent method from this client to begin running in a new fiber. */ + unblock(): void; + } + + /** + * Defines functions that can be invoked over the network by clients. + * @param methods Dictionary whose keys are method names and values are functions. + */ + function methods(methods: { + [key: string]: (this: MethodThisType, ...args: any[]) => any; + }): void; + + /** + * Invokes a method passing any number of arguments. + * @param name Name of method to invoke + * @param args Optional method arguments + */ + function call(name: string, ...args: any[]): any; + + function apply< + Result extends + | EJSONable + | EJSONable[] + | EJSONableProperty + | EJSONableProperty[] + >( + name: string, + args: ReadonlyArray, + options?: { + wait?: boolean | undefined; + onResultReceived?: + | (( + error: global_Error | Meteor.Error | undefined, + result?: Result + ) => void) + | undefined; + /** + * (Client only) if true, don't send this method again on reload, simply call the callback an error with the error code 'invocation-failed'. + */ + noRetry?: boolean | undefined; + returnStubValue?: boolean | undefined; + throwStubExceptions?: boolean | undefined; + }, + asyncCallback?: ( + error: global_Error | Meteor.Error | undefined, + result?: Result + ) => void + ): any; + /** Method **/ + + /** Url **/ + /** + * Generate an absolute URL pointing to the application. The server reads from the `ROOT_URL` environment variable to determine where it is running. This is taken care of automatically for + * apps deployed to Galaxy, but must be provided when using `meteor build`. + */ + var absoluteUrl: { + /** + * @param path A path to append to the root URL. Do not include a leading "`/`". + */ + (path?: string, options?: absoluteUrlOptions): string; + defaultOptions: absoluteUrlOptions; + }; + + interface absoluteUrlOptions { + /** Create an HTTPS URL. */ + secure?: boolean | undefined; + /** Replace localhost with 127.0.0.1. Useful for services that don't recognize localhost as a domain name. */ + replaceLocalhost?: boolean | undefined; + /** Override the default ROOT_URL from the server environment. For example: "`http://foo.example.com`" */ + rootUrl?: string | undefined; + } + /** Url **/ + + /** Timeout **/ + /** + * Call a function repeatedly, with a time delay between calls. + * @param func The function to run + * @param delay Number of milliseconds to wait between each function call. + */ + function setInterval(func: Function, delay: number): number; + + /** + * Call a function in the future after waiting for a specified delay. + * @param func The function to run + * @param delay Number of milliseconds to wait before calling function + */ + function setTimeout(func: Function, delay: number): number; + /** + * Cancel a repeating function call scheduled by `Meteor.setInterval`. + * @param id The handle returned by `Meteor.setInterval` + */ + function clearInterval(id: number): void; + + /** + * Cancel a function call scheduled by `Meteor.setTimeout`. + * @param id The handle returned by `Meteor.setTimeout` + */ + function clearTimeout(id: number): void; + /** + * Defer execution of a function to run asynchronously in the background (similar to `Meteor.setTimeout(func, 0)`. + * @param func The function to run + */ + function defer(func: Function): void; + /** Timeout **/ + + /** utils **/ + /** + * Run code when a client or a server starts. + * @param func A function to run on startup. + */ + function startup(func: Function): void; + + /** + * Wrap a function that takes a callback function as its final parameter. + * The signature of the callback of the wrapped function should be `function(error, result){}`. + * On the server, the wrapped function can be used either synchronously (without passing a callback) or asynchronously + * (when a callback is passed). On the client, a callback is always required; errors will be logged if there is no callback. + * If a callback is provided, the environment captured when the original function was called will be restored in the callback. + * The parameters of the wrapped function must not contain any optional parameters or be undefined, as the callback function is expected to be the final, non-undefined parameter. + * @param func A function that takes a callback as its final parameter + * @param context Optional `this` object against which the original function will be invoked + */ + function wrapAsync(func: Function, context?: Object): any; + + function bindEnvironment(func: TFunc): TFunc; + + class EnvironmentVariable { + readonly slot: number; + constructor(); + get(): T; + getOrNullIfOutsideFiber(): T | null; + withValue(value: T, fn: () => U): U; + } + /** utils **/ + + /** Pub/Sub **/ + interface SubscriptionHandle { + /** Cancel the subscription. This will typically result in the server directing the client to remove the subscription’s data from the client’s cache. */ + stop(): void; + /** True if the server has marked the subscription as ready. A reactive data source. */ + ready(): boolean; + } + interface LiveQueryHandle { + stop(): void; + } + /** Pub/Sub **/ +} + +export namespace Meteor { + /** Login **/ + interface LoginWithExternalServiceOptions { + requestPermissions?: ReadonlyArray | undefined; + requestOfflineToken?: Boolean | undefined; + forceApprovalPrompt?: Boolean | undefined; + loginUrlParameters?: Object | undefined; + redirectUrl?: string | undefined; + loginHint?: string | undefined; + loginStyle?: string | undefined; + } + + function loginWithMeteorDeveloperAccount( + options?: Meteor.LoginWithExternalServiceOptions, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loginWithFacebook( + options?: Meteor.LoginWithExternalServiceOptions, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loginWithGithub( + options?: Meteor.LoginWithExternalServiceOptions, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loginWithGoogle( + options?: Meteor.LoginWithExternalServiceOptions, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loginWithMeetup( + options?: Meteor.LoginWithExternalServiceOptions, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loginWithTwitter( + options?: Meteor.LoginWithExternalServiceOptions, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loginWithWeibo( + options?: Meteor.LoginWithExternalServiceOptions, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loginWith( + options?: { + requestPermissions?: ReadonlyArray | undefined; + requestOfflineToken?: boolean | undefined; + loginUrlParameters?: Object | undefined; + userEmail?: string | undefined; + loginStyle?: string | undefined; + redirectUrl?: string | undefined; + }, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loginWithPassword( + user: Object | string, + password: string, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loginWithToken( + token: string, + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function loggingIn(): boolean; + + function loggingOut(): boolean; + + function logout( + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + + function logoutOtherClients( + callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void + ): void; + /** Login **/ + + /** Event **/ + interface Event { + type: string; + target: HTMLElement; + currentTarget: HTMLElement; + which: number; + stopPropagation(): void; + stopImmediatePropagation(): void; + preventDefault(): void; + isPropagationStopped(): boolean; + isImmediatePropagationStopped(): boolean; + isDefaultPrevented(): boolean; + } + interface EventHandlerFunction extends Function { + (event?: Meteor.Event, templateInstance?: Blaze.TemplateInstance): void; + } + interface EventMap { + [id: string]: Meteor.EventHandlerFunction; + } + /** Event **/ + + /** Connection **/ + function reconnect(): void; + + function disconnect(): void; + /** Connection **/ + + /** Status **/ + function status(): DDP.DDPStatus; + /** Status **/ + + /** Pub/Sub **/ + /** + * Subscribe to a record set. Returns a handle that provides + * `stop()` and `ready()` methods. + * @param name Name of the subscription. Matches the name of the + * server's `publish()` call. + * @param args Optional arguments passed to publisher + * function on server. + * @param callbacks Optional. May include `onStop` + * and `onReady` callbacks. If there is an error, it is passed as an + * argument to `onStop`. If a function is passed instead of an object, it + * is interpreted as an `onReady` callback. + */ + function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle; + /** Pub/Sub **/ +} + +export namespace Meteor { + /** Connection **/ + interface Connection { + id: string; + close: () => void; + onClose: (callback: () => void) => void; + clientAddress: string; + httpHeaders: Object; + } + + function onConnection(callback: (connection: Connection) => void): void; + /** Connection **/ + /** + * Publish a record set. + * @param name If String, name of the record set. If Object, publications Dictionary of publish functions by name. If `null`, the set has no name, and the record set is automatically sent to + * all connected clients. + * @param func Function called on the server each time a client subscribes. Inside the function, `this` is the publish handler object, described below. If the client passed arguments to + * `subscribe`, the function is called with the same arguments. + */ + function publish( + name: string | null, + func: (this: Subscription, ...args: any[]) => void, + options?: { is_auto: boolean } + ): void; + + function _debug(...args: any[]): void; +} + +export interface Subscription { + /** + * Call inside the publish function. Informs the subscriber that a document has been added to the record set. + * @param collection The name of the collection that contains the new document. + * @param id The new document's ID. + * @param fields The fields in the new document. If `_id` is present it is ignored. + */ + added(collection: string, id: string, fields: Object): void; + /** + * Call inside the publish function. Informs the subscriber that a document in the record set has been modified. + * @param collection The name of the collection that contains the changed document. + * @param id The changed document's ID. + * @param fields The fields in the document that have changed, together with their new values. If a field is not present in `fields` it was left unchanged; if it is present in `fields` and + * has a value of `undefined` it was removed from the document. If `_id` is present it is ignored. + */ + changed(collection: string, id: string, fields: Object): void; + /** Access inside the publish function. The incoming connection for this subscription. */ + connection: Meteor.Connection; + /** + * Call inside the publish function. Stops this client's subscription, triggering a call on the client to the `onStop` callback passed to `Meteor.subscribe`, if any. If `error` is not a + * `Meteor.Error`, it will be sanitized. + * @param error The error to pass to the client. + */ + error(error: Error): void; + /** + * Call inside the publish function. Registers a callback function to run when the subscription is stopped. + * @param func The callback function + */ + onStop(func: Function): void; + /** + * Call inside the publish function. Informs the subscriber that an initial, complete snapshot of the record set has been sent. This will trigger a call on the client to the `onReady` + * callback passed to `Meteor.subscribe`, if any. + */ + ready(): void; + /** + * Call inside the publish function. Informs the subscriber that a document has been removed from the record set. + * @param collection The name of the collection that the document has been removed from. + * @param id The ID of the document that has been removed. + */ + removed(collection: string, id: string): void; + /** + * Access inside the publish function. The incoming connection for this subscription. + */ + stop(): void; + /** + * Call inside the publish function. Allows subsequent methods or subscriptions for the client of this subscription + * to begin running without waiting for the publishing to become ready. + */ + unblock(): void; + /** Access inside the publish function. The id of the logged-in user, or `null` if no user is logged in. */ + userId: string | null; +} + +export namespace Meteor { + /** Global props **/ + /** True if running in development environment. */ + var isDevelopment: boolean; + var isTest: boolean; + var isAppTest: boolean; + /** Global props **/ +} diff --git a/packages/meteor/package-types.json b/packages/meteor/package-types.json new file mode 100644 index 0000000000..bc20149ad0 --- /dev/null +++ b/packages/meteor/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "meteor.d.ts" +} diff --git a/packages/meteor/package.js b/packages/meteor/package.js index 98e5453a3c..930478dc07 100644 --- a/packages/meteor/package.js +++ b/packages/meteor/package.js @@ -2,7 +2,7 @@ Package.describe({ summary: "Core Meteor environment", - version: '1.10.1' + version: '1.10.2' }); Package.registerBuildPlugin({ @@ -54,6 +54,8 @@ Package.onUse(function (api) { // People expect process.exit() to not swallow console output. // On Windows, it sometimes does, so we fix it for all apps and packages api.addFiles('flush-buffers-on-exit-in-windows.js', 'server'); + + api.addAssets('meteor.d.ts', 'server'); }); Package.onTest(function (api) { diff --git a/packages/modern-browsers/modern.d.ts b/packages/modern-browsers/modern.d.ts new file mode 100644 index 0000000000..69f1268f74 --- /dev/null +++ b/packages/modern-browsers/modern.d.ts @@ -0,0 +1,4 @@ +export declare function setMinimumBrowserVersions( + versions: Record, + source: string +): void; diff --git a/packages/modern-browsers/package-types.json b/packages/modern-browsers/package-types.json new file mode 100644 index 0000000000..ee517974a2 --- /dev/null +++ b/packages/modern-browsers/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "modern.d.ts" +} diff --git a/packages/modern-browsers/package.js b/packages/modern-browsers/package.js index 40e95833a3..7ca4b6d41c 100644 --- a/packages/modern-browsers/package.js +++ b/packages/modern-browsers/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'modern-browsers', - version: '0.1.8', + version: '0.1.9', summary: 'API for defining the boundary between modern and legacy ' + 'JavaScript clients', @@ -10,6 +10,7 @@ Package.describe({ Package.onUse(function(api) { api.use('modules'); api.mainModule('modern.js', 'server'); + api.addAssets('modern.d.ts', 'server'); }); Package.onTest(function(api) { diff --git a/packages/modules-runtime-hot/installer.js b/packages/modules-runtime-hot/installer.js index 3c7c7df494..6ad56981a4 100644 --- a/packages/modules-runtime-hot/installer.js +++ b/packages/modules-runtime-hot/installer.js @@ -220,8 +220,8 @@ makeInstaller = function (options) { var file = fileResolve(filesByModuleId[this.id], id); if (file) return file.module.id; var error = makeMissingError(id); - if (fallback && isFunction(fallback.resolve)) { - return fallback.resolve(id, this.id, error); + if (fallback && isFunction(fallback)) { + return fallback(id, this.id, error); } throw error; }; diff --git a/packages/modules-runtime-hot/legacy.js b/packages/modules-runtime-hot/legacy.js index 77ef37d5c6..c4b1263ec4 100644 --- a/packages/modules-runtime-hot/legacy.js +++ b/packages/modules-runtime-hot/legacy.js @@ -1,3 +1,5 @@ +let verifyErrors = Package['modules-runtime'].verifyErrors; + meteorInstall = makeInstaller({ // On the client, make package resolution prefer the "browser" field of // package.json over the "module" field over the "main" field. @@ -8,15 +10,7 @@ meteorInstall = makeInstaller({ mainFields: ["browser", "main", "module"], fallback: function (id, parentId, error) { - if (id && id.startsWith('meteor/')) { - var packageName = id.split('/', 2)[1]; - throw new Error( - 'Cannot find package "' + packageName + '". ' + - 'Try "meteor add ' + packageName + '".' - ); - } - - throw error; + verifyErrors(id, parentId, error); } }); diff --git a/packages/modules-runtime-hot/modern.js b/packages/modules-runtime-hot/modern.js index 2445856d2d..48282a28f3 100644 --- a/packages/modules-runtime-hot/modern.js +++ b/packages/modules-runtime-hot/modern.js @@ -1,3 +1,5 @@ +let verifyErrors = Package['modules-runtime'].verifyErrors; + meteorInstall = makeInstaller({ // On the client, make package resolution prefer the "browser" field of // package.json over the "module" field over the "main" field. @@ -5,15 +7,7 @@ meteorInstall = makeInstaller({ mainFields: ["browser", "module", "main"], fallback: function (id, parentId, error) { - if (id && id.startsWith('meteor/')) { - var packageName = id.split('/', 2)[1]; - throw new Error( - 'Cannot find package "' + packageName + '". ' + - 'Try "meteor add ' + packageName + '".' - ); - } - - throw error; + verifyErrors(id, parentId, error); } }); diff --git a/packages/modules-runtime-hot/package.js b/packages/modules-runtime-hot/package.js index 6a932eb21b..2ba683b96d 100644 --- a/packages/modules-runtime-hot/package.js +++ b/packages/modules-runtime-hot/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'modules-runtime-hot', - version: '0.14.0', + version: '0.14.1', summary: 'Patches modules-runtime to support Hot Module Replacement', git: 'https://github.com/benjamn/install', documentation: 'README.md', diff --git a/packages/modules-runtime/errors/cannotFindMeteorPackage.js b/packages/modules-runtime/errors/cannotFindMeteorPackage.js new file mode 100644 index 0000000000..fd94ab813a --- /dev/null +++ b/packages/modules-runtime/errors/cannotFindMeteorPackage.js @@ -0,0 +1,12 @@ +/** + * @description Default error message for when a package is not found + * @param id{string} + * @return {Error} + */ +cannotFindMeteorPackage = function(id) { + var packageName = id.split('/', 2)[1]; + return new Error( + 'Cannot find package "' + packageName + '". ' + + 'Try "meteor add ' + packageName + '".' + ); +}; diff --git a/packages/modules-runtime/errors/importsErrors.js b/packages/modules-runtime/errors/importsErrors.js new file mode 100644 index 0000000000..d82f62cb1f --- /dev/null +++ b/packages/modules-runtime/errors/importsErrors.js @@ -0,0 +1,46 @@ +/** + * + * @param id{string} + * @return {{fromServer: (function(): Error), from: (function(location: string): boolean), fromClient: (function(): Error)}} + */ +imports = function (id) { + /** + * + * @param location{string} + * @return {boolean} + */ + var from = + function (location) { + if (!id) { + return false; + } + + // XXX: removed last part of path so that it does not trigger false positives + var path = String(id).split('/').slice(0, -1); + + return path.some(function (subPath) { + return subPath === location; + }); + }; + + var fromClientError = + function () { + return new Error( + 'Unable to import on the server a module from a client directory: "' + id + '" \n (cross-boundary import) see: https://guide.meteor.com/structure.html#special-directories' + ); + }; + + + var fromServerError = + function () { + return new Error( + 'Unable to import on the client a module from a server directory: "' + id + '" \n (cross-boundary import) see: https://guide.meteor.com/structure.html#special-directories' + ); + }; + + return { + from: from, + fromClientError: fromClientError, + fromServerError: fromServerError + }; +}; diff --git a/packages/modules-runtime/legacy.js b/packages/modules-runtime/legacy.js index b76f1d36b3..b75822a116 100644 --- a/packages/modules-runtime/legacy.js +++ b/packages/modules-runtime/legacy.js @@ -5,17 +5,9 @@ meteorInstall = makeInstaller({ // The difference between legacy.js and modern.js is that this module // prefers "main" over "module" (see issue #10658). - mainFields: ["browser", "main", "module"], + mainFields: ['browser', 'main', 'module'], - fallback: function(id, parentId, error) { - if (id && id.startsWith('meteor/')) { - var packageName = id.split('/', 2)[1]; - throw new Error( - 'Cannot find package "' + packageName + '". ' + - 'Try "meteor add ' + packageName + '".' - ); - } - - throw error; + fallback: function (id, parentId, error) { + verifyErrors(id, parentId, error); } }); diff --git a/packages/modules-runtime/modern.js b/packages/modules-runtime/modern.js index c26a129da0..06b6390a6f 100644 --- a/packages/modules-runtime/modern.js +++ b/packages/modules-runtime/modern.js @@ -2,17 +2,9 @@ meteorInstall = makeInstaller({ // On the client, make package resolution prefer the "browser" field of // package.json over the "module" field over the "main" field. browser: true, - mainFields: ["browser", "module", "main"], + mainFields: ['browser', 'module', 'main'], - fallback: function(id, parentId, error) { - if (id && id.startsWith('meteor/')) { - var packageName = id.split('/', 2)[1]; - throw new Error( - 'Cannot find package "' + packageName + '". ' + - 'Try "meteor add ' + packageName + '".' - ); - } - - throw error; + fallback: function (id, parentId, error) { + verifyErrors(id, parentId, error); } }); diff --git a/packages/modules-runtime/modules-runtime-tests.js b/packages/modules-runtime/modules-runtime-tests.js index cebc27a5c7..78abd74037 100644 --- a/packages/modules-runtime/modules-runtime-tests.js +++ b/packages/modules-runtime/modules-runtime-tests.js @@ -1,5 +1,76 @@ Tinytest.add('modules', function (test) { - test.equal(typeof meteorInstall, "function"); + test.equal(typeof meteorInstall, 'function'); var require = meteorInstall(); - test.equal(typeof require, "function"); + test.equal(typeof require, 'function'); }); + +Tinytest.add('errors - standard', function (test) { + var require = meteorInstall(); + test.throws(() => { + require('meteor/foo'); + }, 'Cannot find package "foo". Try "meteor add foo".'); +}); + +Tinytest.add('errors - node_modules', function (test) { + var require = meteorInstall(); + test.throws(() => { + require('./node_modules/foo'); + }, "Cannot find module './node_modules/foo'"); +}); + +if (Meteor.isServer) { + Tinytest.add('server - throwClientError', function (test) { + var require = meteorInstall(); + test.throws(() => { + require('./../server/main.js'); + }, "Cannot find module './../server/main.js'" + ); + }); + Tinytest.add('server - client and server in path', function (test) { + var require = meteorInstall(); + test.throws(() => { + require('/client/graphql/client'); + }, + 'Unable to import on the server a module from a client directory: "/client/graphql/client" \n' + + ' (cross-boundary import) see: https://guide.meteor.com/structure.html#special-directories' + ); + }); + Tinytest.add('server - throwServerError', function (test) { + var require = meteorInstall(); + test.throws(() => { + require('./../client/main.js'); + }, + 'Unable to import on the server a module from a client directory: "./../client/main.js" \n' + + ' (cross-boundary import) see: https://guide.meteor.com/structure.html#special-directories' + ); + }); +} + +if (Meteor.isClient) { + Tinytest.add('client - throwClientError', function (test) { + var require = meteorInstall(); + test.throws(() => { + require('./../server/main.js'); + }, + 'Unable to import on the client a module from a server directory: "./../server/main.js" \n' + + ' (cross-boundary import) see: https://guide.meteor.com/structure.html#special-directories' + ); + }); + Tinytest.add('client - client and server in path', function (test) { + var require = meteorInstall(); + test.throws(() => { + require('/server/graphql/client'); + }, + 'Unable to import on the client a module from a server directory: "/server/graphql/client" \n' + + ' (cross-boundary import) see: https://guide.meteor.com/structure.html#special-directories' + ); + }); + Tinytest.add('client - throwServerError', function (test) { + var require = meteorInstall(); + test.throws(() => { + require('./../client/main.js'); + }, "Cannot find module './../client/main.js'"); + }); +} + + diff --git a/packages/modules-runtime/package.js b/packages/modules-runtime/package.js index 7afb76434b..4e124aaacb 100644 --- a/packages/modules-runtime/package.js +++ b/packages/modules-runtime/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "modules-runtime", - version: "0.13.0", + version: '0.13.1', summary: "CommonJS module system", git: "https://github.com/benjamn/install", documentation: "README.md" @@ -18,12 +18,16 @@ Package.onUse(function(api) { bare: true }); - api.addFiles("modern.js", "modern"); - api.addFiles("legacy.js", "legacy"); - api.addFiles("server.js", "server"); - api.addFiles("profile.js"); + api.addFiles(['./errors/importsErrors.js', + './errors/cannotFindMeteorPackage.js']); + api.addFiles('modern.js', 'modern'); + api.addFiles('legacy.js', 'legacy'); + api.addFiles('server.js', 'server'); + api.addFiles('profile.js'); + api.addFiles('verifyErrors.js'); - api.export("meteorInstall"); + api.export('meteorInstall'); + api.export('verifyErrors'); }); Package.onTest(function(api) { diff --git a/packages/modules-runtime/server.js b/packages/modules-runtime/server.js index 018a61e49b..b2d66af281 100644 --- a/packages/modules-runtime/server.js +++ b/packages/modules-runtime/server.js @@ -28,7 +28,7 @@ makeInstallerOptions.fallback = function (id, parentId, error) { return Npm.require(id, error); } } - + verifyErrors(id, parentId, error); throw error; }; diff --git a/packages/modules-runtime/verifyErrors.js b/packages/modules-runtime/verifyErrors.js new file mode 100644 index 0000000000..d0fe827e8d --- /dev/null +++ b/packages/modules-runtime/verifyErrors.js @@ -0,0 +1,34 @@ + +/** + * + * @param id{string} + * @param parentId{string} + * @param err {Error} + */ +verifyErrors = function (id, parentId,err) { + + if (id && id.startsWith('meteor/')) { + throw cannotFindMeteorPackage(id); + } + + if(!(id.startsWith('.') || id.startsWith('/'))) { + throw err; + } + + if (imports(id).from('node_modules')) { + // Problem with node modules + throw err; + } + + // custom errors + if (Meteor.isServer && imports(id).from('client')) { + throw imports(id).fromClientError(); + } + if (Meteor.isClient && imports(id).from('server')) { + throw imports(id).fromServerError(); + } + + if (err) { + throw err; + } +}; diff --git a/packages/modules/module-system.png b/packages/modules/module-system.png new file mode 100644 index 0000000000..e8b82ac455 Binary files /dev/null and b/packages/modules/module-system.png differ diff --git a/packages/mongo-id/id.js b/packages/mongo-id/id.js index b0bf43dd37..142a761a0d 100644 --- a/packages/mongo-id/id.js +++ b/packages/mongo-id/id.js @@ -3,7 +3,7 @@ import { Random } from 'meteor/random'; const MongoID = {}; -MongoID._looksLikeObjectID = str => str.length === 24 && str.match(/^[0-9a-f]*$/); +MongoID._looksLikeObjectID = str => str.length === 24 && /^[0-9a-f]*$/.test(str); MongoID.ObjectID = class ObjectID { constructor (hexString) { diff --git a/packages/mongo/collection_tests.js b/packages/mongo/collection_tests.js index 96b953617e..78da9a1f18 100644 --- a/packages/mongo/collection_tests.js +++ b/packages/mongo/collection_tests.js @@ -1,3 +1,6 @@ + +var MongoDB = NpmModuleMongodb; + Tinytest.add( 'collection - call Mongo.Collection without new', function (test) { @@ -203,3 +206,181 @@ Tinytest.add('collection - calling find with an invalid readPreference', } } ); + +Tinytest.add('collection - inserting a document with a binary should return a document with a binary', + function(test) { + if (Meteor.isServer) { + const collection = new Mongo.Collection('testBinary1'); + const _id = Random.id(); + collection.insert({ + _id, + binary: new MongoDB.Binary(Buffer.from('hello world'), 6) + }); + + const doc = collection.findOne({ _id }); + test.ok( + doc.binary instanceof MongoDB.Binary + ); + test.equal( + doc.binary.buffer, + Buffer.from('hello world') + ); + } + } +); + +Tinytest.add('collection - inserting a document with a binary (sub type 0) should return a document with a uint8array', + function(test) { + if (Meteor.isServer) { + const collection = new Mongo.Collection('testBinary8'); + const _id = Random.id(); + collection.insert({ + _id, + binary: new MongoDB.Binary(Buffer.from('hello world'), 0) + }); + + const doc = collection.findOne({ _id }); + test.ok( + doc.binary instanceof Uint8Array + ); + test.equal( + doc.binary, + new Uint8Array(Buffer.from('hello world')) + ); + } + } +); + +Tinytest.add('collection - updating a document with a binary should return a document with a binary', + function(test) { + if (Meteor.isServer) { + const collection = new Mongo.Collection('testBinary2'); + const _id = Random.id(); + collection.insert({ + _id + }); + + collection.update({ _id }, { $set: { binary: new MongoDB.Binary(Buffer.from('hello world'), 6) } }); + + const doc = collection.findOne({ _id }); + test.ok( + doc.binary instanceof MongoDB.Binary + ); + test.equal( + doc.binary.buffer, + Buffer.from('hello world') + ); + } + } +); + +Tinytest.add('collection - updating a document with a binary (sub type 0) should return a document with a uint8array', + function(test) { + if (Meteor.isServer) { + const collection = new Mongo.Collection('testBinary7'); + const _id = Random.id(); + collection.insert({ + _id + }); + + collection.update({ _id }, { $set: { binary: new MongoDB.Binary(Buffer.from('hello world'), 0) } }); + + const doc = collection.findOne({ _id }); + test.ok( + doc.binary instanceof Uint8Array + ); + test.equal( + doc.binary, + new Uint8Array(Buffer.from('hello world')) + ); + } + } +); + +Tinytest.add('collection - inserting a document with a uint8array should return a document with a uint8array', + function(test) { + if (Meteor.isServer) { + const collection = new Mongo.Collection('testBinary3'); + const _id = Random.id(); + collection.insert({ + _id, + binary: new Uint8Array(Buffer.from('hello world')) + }); + + const doc = collection.findOne({ _id }); + test.ok( + doc.binary instanceof Uint8Array + ); + test.equal( + doc.binary, + new Uint8Array(Buffer.from('hello world')) + ); + } + } +); + +Tinytest.add('collection - updating a document with a uint8array should return a document with a uint8array', + function(test) { + if (Meteor.isServer) { + const collection = new Mongo.Collection('testBinary4'); + const _id = Random.id(); + collection.insert({ + _id + }); + + collection.update( + { _id }, + { $set: { binary: new Uint8Array(Buffer.from('hello world')) } } + ) + + const doc = collection.findOne({ _id }); + test.ok( + doc.binary instanceof Uint8Array + ); + test.equal( + doc.binary, + new Uint8Array(Buffer.from('hello world')) + ); + } + } +); + +Tinytest.add('collection - finding with a query with a uint8array field should return the correct document', + function(test) { + if (Meteor.isServer) { + const collection = new Mongo.Collection('testBinary5'); + const _id = Random.id(); + collection.insert({ + _id, + binary: new Uint8Array(Buffer.from('hello world')) + }); + + const doc = collection.findOne({ binary: new Uint8Array(Buffer.from('hello world')) }); + test.equal( + doc._id, + _id + ); + collection.remove({}); + } + } +); + +Tinytest.add('collection - finding with a query with a binary field should return the correct document', + function(test) { + if (Meteor.isServer) { + const collection = new Mongo.Collection('testBinary6'); + const _id = Random.id(); + collection.insert({ + _id, + binary: new MongoDB.Binary(Buffer.from('hello world'), 6) + }); + + const doc = collection.findOne({ binary: new MongoDB.Binary(Buffer.from('hello world'), 6) }); + test.equal( + doc._id, + _id + ); + collection.remove({}); + } + } +); diff --git a/packages/mongo/mongo.d.ts b/packages/mongo/mongo.d.ts new file mode 100644 index 0000000000..43e8e9c3e7 --- /dev/null +++ b/packages/mongo/mongo.d.ts @@ -0,0 +1,598 @@ +import * as MongoNpmModule from 'mongodb'; +import { + Collection as MongoCollection, + CreateIndexesOptions, + Db as MongoDb, + Hint, + IndexSpecification, + MongoClient, +} from 'mongodb'; +import { Meteor } from 'meteor/meteor'; + +// Based on https://github.com/microsoft/TypeScript/issues/28791#issuecomment-443520161 +export type UnionOmit = T extends T + ? Pick> + : never; + +export namespace Mongo { + // prettier-ignore + type BsonType = 1 | "double" | + 2 | "string" | + 3 | "object" | + 4 | "array" | + 5 | "binData" | + 6 | "undefined" | + 7 | "objectId" | + 8 | "bool" | + 9 | "date" | + 10 | "null" | + 11 | "regex" | + 12 | "dbPointer" | + 13 | "javascript" | + 14 | "symbol" | + 15 | "javascriptWithScope" | + 16 | "int" | + 17 | "timestamp" | + 18 | "long" | + 19 | "decimal" | + -1 | "minKey" | + 127 | "maxKey" | "number"; + + type FieldExpression = { + $eq?: T | undefined; + $gt?: T | undefined; + $gte?: T | undefined; + $lt?: T | undefined; + $lte?: T | undefined; + $in?: T[] | undefined; + $nin?: T[] | undefined; + $ne?: T | undefined; + $exists?: boolean | undefined; + $type?: BsonType[] | BsonType | undefined; + $not?: FieldExpression | undefined; + $expr?: FieldExpression | undefined; + $jsonSchema?: any; + $mod?: number[] | undefined; + $regex?: RegExp | string | undefined; + $options?: string | undefined; + $text?: + | { + $search: string; + $language?: string | undefined; + $caseSensitive?: boolean | undefined; + $diacriticSensitive?: boolean | undefined; + } + | undefined; + $where?: string | Function | undefined; + $geoIntersects?: any; + $geoWithin?: any; + $near?: any; + $nearSphere?: any; + $all?: T[] | undefined; + $elemMatch?: T extends {} ? Query : FieldExpression | undefined; + $size?: number | undefined; + $bitsAllClear?: any; + $bitsAllSet?: any; + $bitsAnyClear?: any; + $bitsAnySet?: any; + $comment?: string | undefined; + }; + + type Flatten = T extends any[] ? T[0] : T; + + type Query = { + [P in keyof T]?: Flatten | RegExp | FieldExpression>; + } & { + $or?: Query[] | undefined; + $and?: Query[] | undefined; + $nor?: Query[] | undefined; + } & Dictionary; + + type QueryWithModifiers = { + $query: Query; + $comment?: string | undefined; + $explain?: any; + $hint?: Hint; + $maxScan?: any; + $max?: any; + $maxTimeMS?: any; + $min?: any; + $orderby?: any; + $returnKey?: any; + $showDiskLoc?: any; + $natural?: any; + }; + + type Selector = Query | QueryWithModifiers; + + type Dictionary = { [key: string]: T }; + type PartialMapTo = Partial>; + type OnlyArrays = T extends any[] ? T : never; + type OnlyElementsOfArrays = T extends any[] ? Partial : never; + type ElementsOf = { + [P in keyof T]?: OnlyElementsOfArrays; + }; + type PushModifier = { + [P in keyof T]?: + | OnlyElementsOfArrays + | { + $each?: T[P] | undefined; + $position?: number | undefined; + $slice?: number | undefined; + $sort?: 1 | -1 | Dictionary | undefined; + }; + }; + type ArraysOrEach = { + [P in keyof T]?: OnlyElementsOfArrays | { $each: T[P] }; + }; + type CurrentDateModifier = { $type: 'timestamp' | 'date' } | true; + type Modifier = + | T + | { + $currentDate?: + | (Partial> & + Dictionary) + | undefined; + $inc?: (PartialMapTo & Dictionary) | undefined; + $min?: + | (PartialMapTo & Dictionary) + | undefined; + $max?: + | (PartialMapTo & Dictionary) + | undefined; + $mul?: (PartialMapTo & Dictionary) | undefined; + $rename?: (PartialMapTo & Dictionary) | undefined; + $set?: (Partial & Dictionary) | undefined; + $setOnInsert?: (Partial & Dictionary) | undefined; + $unset?: + | (PartialMapTo & Dictionary) + | undefined; + $addToSet?: (ArraysOrEach & Dictionary) | undefined; + $push?: (PushModifier & Dictionary) | undefined; + $pull?: (ElementsOf & Dictionary) | undefined; + $pullAll?: (Partial & Dictionary) | undefined; + $pop?: (PartialMapTo & Dictionary<1 | -1>) | undefined; + }; + + type OptionalId = UnionOmit & { _id?: any }; + + interface SortSpecifier {} + interface FieldSpecifier { + [id: string]: Number; + } + + type Transform = ((doc: T) => any) | null | undefined; + + type Options = { + /** Sort order (default: natural order) */ + sort?: SortSpecifier | undefined; + /** Number of results to skip at the beginning */ + skip?: number | undefined; + /** Maximum number of results to return */ + limit?: number | undefined; + /** Dictionary of fields to return or exclude. */ + fields?: FieldSpecifier | undefined; + /** (Server only) Overrides MongoDB's default index selection and query optimization process. Specify an index to force its use, either by its name or index specification. */ + hint?: Hint | undefined; + /** (Client only) Default `true`; pass `false` to disable reactivity */ + reactive?: boolean | undefined; + /** Overrides `transform` on the [`Collection`](#collections) for this cursor. Pass `null` to disable transformation. */ + transform?: Transform | undefined; + }; + + type DispatchTransform = Transform extends ( + ...args: any + ) => any + ? ReturnType + : Transform extends null + ? T + : U; + + var Collection: CollectionStatic; + interface CollectionStatic { + /** + * Constructor for a Collection + * @param name The name of the collection. If null, creates an unmanaged (unsynchronized) local collection. + */ + new ( + name: string | null, + options?: { + /** + * The server connection that will manage this collection. Uses the default connection if not specified. Pass the return value of calling `DDP.connect` to specify a different + * server. Pass `null` to specify no connection. Unmanaged (`name` is null) collections cannot specify a connection. + */ + connection?: Object | null | undefined; + /** The method of generating the `_id` fields of new documents in this collection. Possible values: + * - **`'STRING'`**: random strings + * - **`'MONGO'`**: random [`Mongo.ObjectID`](#mongo_object_id) values + * + * The default id generation technique is `'STRING'`. + */ + idGeneration?: string | undefined; + /** + * An optional transformation function. Documents will be passed through this function before being returned from `fetch` or `findOne`, and before being passed to callbacks of + * `observe`, `map`, `forEach`, `allow`, and `deny`. Transforms are *not* applied for the callbacks of `observeChanges` or to cursors returned from publish functions. + */ + transform?: (doc: T) => U; + /** Set to `false` to skip setting up the mutation methods that enable insert/update/remove from client code. Default `true`. */ + defineMutationMethods?: boolean | undefined; + } + ): Collection; + } + interface Collection { + allow = undefined>(options: { + insert?: + | ((userId: string, doc: DispatchTransform) => boolean) + | undefined; + update?: + | (( + userId: string, + doc: DispatchTransform, + fieldNames: string[], + modifier: any + ) => boolean) + | undefined; + remove?: + | ((userId: string, doc: DispatchTransform) => boolean) + | undefined; + fetch?: string[] | undefined; + transform?: Fn | undefined; + }): boolean; + createCappedCollectionAsync( + byteSize?: number, + maxDocuments?: number + ): Promise; + createIndex( + indexSpec: IndexSpecification, + options?: CreateIndexesOptions + ): void; + createIndexAsync( + indexSpec: IndexSpecification, + options?: CreateIndexesOptions + ): Promise; + deny = undefined>(options: { + insert?: + | ((userId: string, doc: DispatchTransform) => boolean) + | undefined; + update?: + | (( + userId: string, + doc: DispatchTransform, + fieldNames: string[], + modifier: any + ) => boolean) + | undefined; + remove?: + | ((userId: string, doc: DispatchTransform) => boolean) + | undefined; + fetch?: string[] | undefined; + transform?: Fn | undefined; + }): boolean; + dropCollectionAsync(): Promise; + dropIndexAsync(indexName: string): void; + /** + * Find the documents in a collection that match the selector. + * @param selector A query describing the documents to find + */ + find(selector?: Selector | ObjectID | string): Cursor; + /** + * Find the documents in a collection that match the selector. + * @param selector A query describing the documents to find + */ + find>( + selector?: Selector | ObjectID | string, + options?: O + ): Cursor>; + /** + * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. + * @param selector A query describing the documents to find + */ + findOne(selector?: Selector | ObjectID | string): U | undefined; + /** + * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. + * @param selector A query describing the documents to find + */ + findOne, 'limit'>>( + selector?: Selector | ObjectID | string, + options?: O + ): DispatchTransform | undefined; + /** + * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. + * @param selector A query describing the documents to find + */ + findOneAsync( + selector?: Selector | ObjectID | string + ): Promise; + /** + * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. + * @param selector A query describing the documents to find + */ + findOneAsync, 'limit'>>( + selector?: Selector | ObjectID | string, + options?: O + ): Promise | undefined>; + /** + * Insert a document in the collection. Returns its unique _id. + * @param doc The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you. + * @param callback If present, called with an error object as the first argument and, if no error, the _id as the second. + */ + insert(doc: OptionalId, callback?: Function): string; + /** + * Insert a document in the collection. Returns its unique _id. + * @param doc The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you. + * @param callback If present, called with an error object as the first argument and, if no error, the _id as the second. + */ + insertAsync(doc: OptionalId, callback?: Function): Promise; + /** + * Returns the [`Collection`](http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html) object corresponding to this collection from the + * [npm `mongodb` driver module](https://www.npmjs.com/package/mongodb) which is wrapped by `Mongo.Collection`. + */ + rawCollection(): MongoCollection; + /** + * Returns the [`Db`](http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html) object corresponding to this collection's database connection from the + * [npm `mongodb` driver module](https://www.npmjs.com/package/mongodb) which is wrapped by `Mongo.Collection`. + */ + rawDatabase(): MongoDb; + /** + * Remove documents from the collection + * @param selector Specifies which documents to remove + * @param callback If present, called with an error object as its argument. + */ + remove( + selector: Selector | ObjectID | string, + callback?: Function + ): number; + /** + * Remove documents from the collection + * @param selector Specifies which documents to remove + * @param callback If present, called with an error object as its argument. + */ + removeAsync( + selector: Selector | ObjectID | string, + callback?: Function + ): Promise; + /** + * Modify one or more documents in the collection. Returns the number of matched documents. + * @param selector Specifies which documents to modify + * @param modifier Specifies how to modify the documents + * @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second. + */ + update( + selector: Selector | ObjectID | string, + modifier: Modifier, + options?: { + /** True to modify all matching documents; false to only modify one of the matching documents (the default). */ + multi?: boolean | undefined; + /** True to insert a document if no matching documents are found. */ + upsert?: boolean | undefined; + /** + * Used in combination with MongoDB [filtered positional operator](https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/) to specify which elements to + * modify in an array field. + */ + arrayFilters?: { [identifier: string]: any }[] | undefined; + }, + callback?: Function + ): number; + /** + * Modify one or more documents in the collection. Returns the number of matched documents. + * @param selector Specifies which documents to modify + * @param modifier Specifies how to modify the documents + * @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second. + */ + updateAsync( + selector: Selector | ObjectID | string, + modifier: Modifier, + options?: { + /** True to modify all matching documents; false to only modify one of the matching documents (the default). */ + multi?: boolean | undefined; + /** True to insert a document if no matching documents are found. */ + upsert?: boolean | undefined; + /** + * Used in combination with MongoDB [filtered positional operator](https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/) to specify which elements to + * modify in an array field. + */ + arrayFilters?: { [identifier: string]: any }[] | undefined; + }, + callback?: Function + ): Promise; + /** + * Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys `numberAffected` (the number of documents modified) and + * `insertedId` (the unique _id of the document that was inserted, if any). + * @param selector Specifies which documents to modify + * @param modifier Specifies how to modify the documents + * @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second. + */ + upsert( + selector: Selector | ObjectID | string, + modifier: Modifier, + options?: { + /** True to modify all matching documents; false to only modify one of the matching documents (the default). */ + multi?: boolean | undefined; + }, + callback?: Function + ): { + numberAffected?: number | undefined; + insertedId?: string | undefined; + }; + /** + * Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys `numberAffected` (the number of documents modified) and + * `insertedId` (the unique _id of the document that was inserted, if any). + * @param selector Specifies which documents to modify + * @param modifier Specifies how to modify the documents + * @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second. + */ + upsertAsync( + selector: Selector | ObjectID | string, + modifier: Modifier, + options?: { + /** True to modify all matching documents; false to only modify one of the matching documents (the default). */ + multi?: boolean | undefined; + }, + callback?: Function + ): Promise<{ + numberAffected?: number | undefined; + insertedId?: string | undefined; + }>; + _createCappedCollection(byteSize?: number, maxDocuments?: number): void; + /** @deprecated */ + _ensureIndex( + indexSpec: IndexSpecification, + options?: CreateIndexesOptions + ): void; + _dropCollection(): Promise; + _dropIndex(indexName: string): void; + } + + var Cursor: CursorStatic; + interface CursorStatic { + /** + * To create a cursor, use find. To access the documents in a cursor, use forEach, map, or fetch. + */ + new (): Cursor; + } + interface ObserveCallbacks { + added?(document: T): void; + addedAt?(document: T, atIndex: number, before: T | null): void; + changed?(newDocument: T, oldDocument: T): void; + changedAt?(newDocument: T, oldDocument: T, indexAt: number): void; + removed?(oldDocument: T): void; + removedAt?(oldDocument: T, atIndex: number): void; + movedTo?( + document: T, + fromIndex: number, + toIndex: number, + before: T | null + ): void; + } + interface ObserveChangesCallbacks { + added?(id: string, fields: Partial): void; + addedBefore?(id: string, fields: Partial, before: T | null): void; + changed?(id: string, fields: Partial): void; + movedBefore?(id: string, before: T | null): void; + removed?(id: string): void; + } + interface Cursor { + /** + * Returns the number of documents that match a query. + * @param applySkipLimit If set to `false`, the value returned will reflect the total number of matching documents, ignoring any value supplied for limit. (Default: true) + */ + count(applySkipLimit?: boolean): number; + /** + * Returns the number of documents that match a query. + * @param applySkipLimit If set to `false`, the value returned will reflect the total number of matching documents, ignoring any value supplied for limit. (Default: true) + */ + countAsync(applySkipLimit?: boolean): Promise; + /** + * Return all matching documents as an Array. + */ + fetch(): Array; + /** + * Return all matching documents as an Array. + */ + fetchAsync(): Promise>; + /** + * Call `callback` once for each matching document, sequentially and + * synchronously. + * @param callback Function to call. It will be called with three arguments: the document, a 0-based index, and cursor itself. + * @param thisArg An object which will be the value of `this` inside `callback`. + */ + forEach( + callback: (doc: U, index: number, cursor: Cursor) => void, + thisArg?: any + ): void; + /** + * Call `callback` once for each matching document, sequentially and + * synchronously. + * @param callback Function to call. It will be called with three arguments: the document, a 0-based index, and cursor itself. + * @param thisArg An object which will be the value of `this` inside `callback`. + */ + forEachAsync( + callback: (doc: U, index: number, cursor: Cursor) => void, + thisArg?: any + ): Promise; + /** + * Map callback over all matching documents. Returns an Array. + * @param callback Function to call. It will be called with three arguments: the document, a 0-based index, and cursor itself. + * @param thisArg An object which will be the value of `this` inside `callback`. + */ + map( + callback: (doc: U, index: number, cursor: Cursor) => M, + thisArg?: any + ): Array; + /** + * Map callback over all matching documents. Returns an Array. + * @param callback Function to call. It will be called with three arguments: the document, a 0-based index, and cursor itself. + * @param thisArg An object which will be the value of `this` inside `callback`. + */ + mapAsync( + callback: (doc: U, index: number, cursor: Cursor) => M, + thisArg?: any + ): Promise>; + /** + * Watch a query. Receive callbacks as the result set changes. + * @param callbacks Functions to call to deliver the result set as it changes + */ + observe(callbacks: ObserveCallbacks): Meteor.LiveQueryHandle; + /** + * Watch a query. Receive callbacks as the result set changes. Only the differences between the old and new documents are passed to the callbacks. + * @param callbacks Functions to call to deliver the result set as it changes + */ + observeChanges( + callbacks: ObserveChangesCallbacks, + options?: { nonMutatingCallbacks?: boolean | undefined } + ): Meteor.LiveQueryHandle; + [Symbol.iterator](): Iterator; + [Symbol.asyncIterator](): AsyncIterator; + } + + var ObjectID: ObjectIDStatic; + interface ObjectIDStatic { + /** + * Create a Mongo-style `ObjectID`. If you don't specify a `hexString`, the `ObjectID` will generated randomly (not using MongoDB's ID construction rules). + + * @param hexString The 24-character hexadecimal contents of the ObjectID to create + */ + new (hexString?: string): ObjectID; + } + interface ObjectID { + toHexString(): string; + equals(otherID: ObjectID): boolean; + } + + function setConnectionOptions(options: any): void; +} + +export namespace Mongo { + interface AllowDenyOptions { + insert?: ((userId: string, doc: any) => boolean) | undefined; + update?: + | (( + userId: string, + doc: any, + fieldNames: string[], + modifier: any + ) => boolean) + | undefined; + remove?: ((userId: string, doc: any) => boolean) | undefined; + fetch?: string[] | undefined; + transform?: Function | null | undefined; + } +} + +export declare module MongoInternals { + interface MongoConnection { + db: MongoDb; + client: MongoClient; + } + + function defaultRemoteCollectionDriver(): { + mongo: MongoConnection; + }; + + var NpmModules: { + mongodb: { + version: string; + module: typeof MongoNpmModule; + }; + }; +} diff --git a/packages/mongo/mongo_driver.js b/packages/mongo/mongo_driver.js index b8fa60d531..5d653636a8 100644 --- a/packages/mongo/mongo_driver.js +++ b/packages/mongo/mongo_driver.js @@ -69,6 +69,10 @@ var unmakeMongoLegal = function (name) { return name.substr(5); }; var replaceMongoAtomWithMeteor = function (document) { if (document instanceof MongoDB.Binary) { + // for backwards compatibility + if (document.sub_type !== 0) { + return document; + } var buffer = document.value(true); return new Uint8Array(buffer); } @@ -98,6 +102,9 @@ var replaceMeteorAtomWithMongo = function (document) { // serialize it correctly). return new MongoDB.Binary(Buffer.from(document)); } + if (document instanceof MongoDB.Binary) { + return document; + } if (document instanceof Mongo.ObjectID) { return new MongoDB.ObjectID(document.toHexString()); } diff --git a/packages/mongo/package.js b/packages/mongo/package.js index 628baf804b..31ef5d4b77 100644 --- a/packages/mongo/package.js +++ b/packages/mongo/package.js @@ -9,7 +9,7 @@ Package.describe({ summary: "Adaptor for using MongoDB and Minimongo over DDP", - version: '1.16.0' + version: '1.16.1' }); Npm.depends({ @@ -82,12 +82,14 @@ Package.onUse(function (api) { api.addFiles('remote_collection_driver.js', 'server'); api.addFiles('collection.js', ['client', 'server']); api.addFiles('connection_options.js', 'server'); + api.addAssets('mongo.d.ts', 'server'); }); Package.onTest(function (api) { api.use('mongo'); api.use('check'); api.use('ecmascript'); + api.use('npm-mongo', 'server'); api.use(['tinytest', 'underscore', 'test-helpers', 'ejson', 'random', 'ddp', 'base64']); // XXX test order dependency: the allow_tests "partial allow" test diff --git a/packages/mongo/package.types.json b/packages/mongo/package.types.json new file mode 100644 index 0000000000..97c9c11e61 --- /dev/null +++ b/packages/mongo/package.types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "mongo.d.ts" +} diff --git a/packages/non-core/less/.versions b/packages/non-core/less/.versions index b8dac39441..703024e52f 100644 --- a/packages/non-core/less/.versions +++ b/packages/non-core/less/.versions @@ -7,7 +7,7 @@ blaze@2.3.4 boilerplate-generator@1.7.1 caching-compiler@1.2.2 callback-hook@1.3.1 -check@1.3.1 +check@1.3.2 ddp@1.4.0 ddp-client@2.5.0 ddp-common@1.4.0 @@ -40,16 +40,16 @@ npm-mongo@3.9.0 observe-sequence@1.0.19 ordered-dict@1.1.0 promise@0.12.0 -random@1.2.0 +random@1.2.1 react-fast-refresh@0.1.1 -reactive-var@1.0.11 +reactive-var@1.0.12 reload@1.3.1 retry@1.1.0 routepolicy@1.1.1 socket-stream-client@0.4.0 test-helpers@1.2.0 tinytest@1.1.1 -tracker@1.2.0 -underscore@1.0.10 +tracker@1.2.1 +underscore@1.0.11 webapp@1.11.1 webapp-hashing@1.1.0 diff --git a/packages/npm-mongo/.npm/package/npm-shrinkwrap.json b/packages/npm-mongo/.npm/package/npm-shrinkwrap.json index bdf03af949..11662ebe99 100644 --- a/packages/npm-mongo/.npm/package/npm-shrinkwrap.json +++ b/packages/npm-mongo/.npm/package/npm-shrinkwrap.json @@ -1,15 +1,355 @@ { "lockfileVersion": 1, "dependencies": { + "@aws-crypto/ie11-detection": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@aws-crypto/ie11-detection/-/ie11-detection-2.0.2.tgz", + "integrity": "sha512-5XDMQY98gMAf/WRTic5G++jfmS/VLM0rwpiOpaainKi4L0nqWMSB1SzsrEG5rjFZGYN6ZAefO+/Yta2dFM0kMw==", + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/sha256-browser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-2.0.0.tgz", + "integrity": "sha512-rYXOQ8BFOaqMEHJrLHul/25ckWH6GTJtdLSajhlqGMx0PmSueAuvboCuZCTqEKlxR8CQOwRarxYMZZSYlhRA1A==", + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/sha256-js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-2.0.0.tgz", + "integrity": "sha512-VZY+mCY4Nmrs5WGfitmNqXzaE873fcIZDu54cbaDaaamsaTOP1DBImV9F4pICc3EHjQXujyE8jig+PFCaew9ig==", + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/supports-web-crypto": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-2.0.2.tgz", + "integrity": "sha512-6mbSsLHwZ99CTOOswvCRP3C+VCWnzBf+1SnbWxzzJ9lR0mA0JnY2JEAhp8rqmTE0GPFy88rrM27ffgp62oErMQ==", + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/util": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-2.0.2.tgz", + "integrity": "sha512-Lgu5v/0e/BcrZ5m/IWqzPUf3UYFTy/PpeED+uc9SWUR1iZQL8XXbGQg10UfllwwBryO3hFF5dizK+78aoXC1eA==", + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-sdk/abort-controller": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/abort-controller/-/abort-controller-3.190.0.tgz", + "integrity": "sha512-M6qo2exTzEfHT5RuW7K090OgesUojhb2JyWiV4ulu7ngY4DWBUBMKUqac696sHRUZvGE5CDzSi0606DMboM+kA==" + }, + "@aws-sdk/client-cognito-identity": { + "version": "3.192.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.192.0.tgz", + "integrity": "sha512-nIRmiv5JY8wWGUadhG7yLx8o8aVETj5CAgO8e8UJIwwqfue/Yv9bHi2mvkUphO1pj0TeBatAtvu79neJQtsR5g==" + }, + "@aws-sdk/client-sso": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.190.0.tgz", + "integrity": "sha512-joEKRjJEzgvXnEih/x2UDDCPlvXWCO3MAHmqi44yJ36Ph4YsFS299mOjPdVLuzUtpQ+cST1nRO7hXNFrulW2jQ==" + }, + "@aws-sdk/client-sts": { + "version": "3.192.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.192.0.tgz", + "integrity": "sha512-iv72dmRxbZ1cN5jGn4KIVzzu11eduS2fXHbNgd7JsFd5hLBV5TvJaugQzUdXNmy2gN4HiRJr+qa9WkD5b39lsA==" + }, + "@aws-sdk/config-resolver": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/config-resolver/-/config-resolver-3.190.0.tgz", + "integrity": "sha512-K+VnDtjTgjpf7yHEdDB0qgGbHToF0pIL0pQMSnmk2yc8BoB3LGG/gg1T0Ki+wRlrFnDCJ6L+8zUdawY2qDsbyw==" + }, + "@aws-sdk/credential-provider-cognito-identity": { + "version": "3.192.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.192.0.tgz", + "integrity": "sha512-CWo+KyHCGyYtvjlmDIGtnwBEkdiondergZADiStbFFvie8pPI7IsdTXNVssQQ1VxKIBGGHVebgZGSklHBqthwA==" + }, + "@aws-sdk/credential-provider-env": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.190.0.tgz", + "integrity": "sha512-GTY7l3SJhTmRGFpWddbdJOihSqoMN8JMo3CsCtIjk4/h3xirBi02T4GSvbrMyP7FP3Fdl4NAdT+mHJ4q2Bvzxw==" + }, + "@aws-sdk/credential-provider-imds": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-imds/-/credential-provider-imds-3.190.0.tgz", + "integrity": "sha512-gI5pfBqGYCKdmx8igPvq+jLzyE2kuNn9Q5u73pdM/JZxiq7GeWYpE/MqqCubHxPtPcTFgAwxCxCFoXlUTBh/2g==" + }, + "@aws-sdk/credential-provider-ini": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.190.0.tgz", + "integrity": "sha512-Z7NN/evXJk59hBQlfOSWDfHntwmxwryu6uclgv7ECI6SEVtKt1EKIlPuCLUYgQ4lxb9bomyO5lQAl/1WutNT5w==" + }, + "@aws-sdk/credential-provider-node": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.190.0.tgz", + "integrity": "sha512-ctCG5+TsIK2gVgvvFiFjinPjc5nGpSypU3nQKCaihtPh83wDN6gCx4D0p9M8+fUrlPa5y+o/Y7yHo94ATepM8w==" + }, + "@aws-sdk/credential-provider-process": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.190.0.tgz", + "integrity": "sha512-sIJhICR80n5XY1kW/EFHTh5ZzBHb5X+744QCH3StcbKYI44mOZvNKfFdeRL2fQ7yLgV7npte2HJRZzQPWpZUrw==" + }, + "@aws-sdk/credential-provider-sso": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.190.0.tgz", + "integrity": "sha512-uarU9vk471MHHT+GJj3KWFSmaaqLNL5n1KcMer2CCAZfjs+mStAi8+IjZuuKXB4vqVs5DxdH8cy5aLaJcBlXwQ==" + }, + "@aws-sdk/credential-provider-web-identity": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.190.0.tgz", + "integrity": "sha512-nlIBeK9hGHKWC874h+ITAfPZ9Eaok+x/ydZQVKsLHiQ9PH3tuQ8AaGqhuCwBSH0hEAHZ/BiKeEx5VyWAE8/x+Q==" + }, + "@aws-sdk/credential-providers": { + "version": "3.192.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.192.0.tgz", + "integrity": "sha512-iBTrEPkfOHlfgQyk7EeUCmZnhUKXsGcc/hhxBbc6Z/Xc7Y8LqRVLbEmHq9lruXraFuvs26xV9oZi1s1UMXneQA==" + }, + "@aws-sdk/fetch-http-handler": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/fetch-http-handler/-/fetch-http-handler-3.190.0.tgz", + "integrity": "sha512-5riRpKydARXAPLesTZm6eP6QKJ4HJGQ3k0Tepi3nvxHVx3UddkRNoX0pLS3rvbajkykWPNC2qdfRGApWlwOYsA==" + }, + "@aws-sdk/hash-node": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/hash-node/-/hash-node-3.190.0.tgz", + "integrity": "sha512-DNwVT3O8zc9Jk/bXiXcN0WsD98r+JJWryw9F1/ZZbuzbf6rx2qhI8ZK+nh5X6WMtYPU84luQMcF702fJt/1bzg==" + }, + "@aws-sdk/invalid-dependency": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/invalid-dependency/-/invalid-dependency-3.190.0.tgz", + "integrity": "sha512-crCh63e8d/Uw9y3dQlVTPja7+IZiXpNXyH6oSuAadTDQwMq6KK87Av1/SDzVf6bAo2KgAOo41MyO2joaCEk0dQ==" + }, + "@aws-sdk/is-array-buffer": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/is-array-buffer/-/is-array-buffer-3.188.0.tgz", + "integrity": "sha512-n69N4zJZCNd87Rf4NzufPzhactUeM877Y0Tp/F3KiHqGeTnVjYUa4Lv1vLBjqtfjYb2HWT3NKlYn5yzrhaEwiQ==" + }, + "@aws-sdk/middleware-content-length": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-content-length/-/middleware-content-length-3.190.0.tgz", + "integrity": "sha512-sSU347SuC6I8kWum1jlJlpAqeV23KP7enG+ToWcEcgFrJhm3AvuqB//NJxDbkKb2DNroRvJjBckBvrwNAjQnBQ==" + }, + "@aws-sdk/middleware-host-header": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.190.0.tgz", + "integrity": "sha512-cL7Vo/QSpGx/DDmFxjeV0Qlyi1atvHQDPn3MLBBmi1icu+3GKZkCMAJwzsrV3U4+WoVoDYT9FJ9yMQf2HaIjeQ==" + }, + "@aws-sdk/middleware-logger": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.190.0.tgz", + "integrity": "sha512-rrfLGYSZCBtiXNrIa8pJ2uwUoUMyj6Q82E8zmduTvqKWviCr6ZKes0lttGIkWhjvhql2m4CbjG5MPBnY7RXL4A==" + }, + "@aws-sdk/middleware-recursion-detection": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.190.0.tgz", + "integrity": "sha512-5tc1AIIZe5jDNdyuJW+7vIFmQOxz3q031ZVrEtUEIF7cz2ySho2lkOWziz+v+UGSLhjHGKMz3V26+aN1FLZNxQ==" + }, + "@aws-sdk/middleware-retry": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-retry/-/middleware-retry-3.190.0.tgz", + "integrity": "sha512-h1bPopkncf2ue/erJdhqvgR2AEh0bIvkNsIHhx93DckWKotZd/GAVDq0gpKj7/f/7B+teHH8Fg5GDOwOOGyKcg==" + }, + "@aws-sdk/middleware-sdk-sts": { + "version": "3.192.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-sts/-/middleware-sdk-sts-3.192.0.tgz", + "integrity": "sha512-xzTV7MyG5ipWYTvekWX1tQc5ExsUvCYsDTBCD3LR5hBrP8assUDPo52zGSe+QMcjgnQv7BcYIzeikTkLEG0dUw==" + }, + "@aws-sdk/middleware-serde": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-serde/-/middleware-serde-3.190.0.tgz", + "integrity": "sha512-S132hEOK4jwbtZ1bGAgSuQ0DMFG4TiD4ulAwbQRBYooC7tiWZbRiR0Pkt2hV8d7WhOHgUpg7rvqlA7/HXXBAsA==" + }, + "@aws-sdk/middleware-signing": { + "version": "3.192.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-signing/-/middleware-signing-3.192.0.tgz", + "integrity": "sha512-qTRIU/TL/dvtTrNj+AkZkgYeTIFslib3Y3XnQNNM6RCm4cMxIgs2K/lnhaUmLdbzHrpOQb4cISkY8yiHo+pNsw==" + }, + "@aws-sdk/middleware-stack": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-stack/-/middleware-stack-3.190.0.tgz", + "integrity": "sha512-h1mqiWNJdi1OTSEY8QovpiHgDQEeRG818v8yShpqSYXJKEqdn54MA3Z1D2fg/Wv/8ZJsFrBCiI7waT1JUYOmCg==" + }, + "@aws-sdk/middleware-user-agent": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.190.0.tgz", + "integrity": "sha512-y/2cTE1iYHKR0nkb3DvR3G8vt12lcTP95r/iHp8ZO+Uzpc25jM/AyMHWr2ZjqQiHKNlzh8uRw1CmQtgg4sBxXQ==" + }, + "@aws-sdk/node-config-provider": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/node-config-provider/-/node-config-provider-3.190.0.tgz", + "integrity": "sha512-TJPUchyeK5KeEXWrwb6oW5/OkY3STCSGR1QIlbPcaTGkbo4kXAVyQmmZsY4KtRPuDM6/HlfUQV17bD716K65rQ==" + }, + "@aws-sdk/node-http-handler": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/node-http-handler/-/node-http-handler-3.190.0.tgz", + "integrity": "sha512-3Klkr73TpZkCzcnSP+gmFF0Baluzk3r7BaWclJHqt2LcFUWfIJzYlnbBQNZ4t3EEq7ZlBJX85rIDHBRlS+rUyA==" + }, + "@aws-sdk/property-provider": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/property-provider/-/property-provider-3.190.0.tgz", + "integrity": "sha512-uzdKjHE2blbuceTC5zeBgZ0+Uo/hf9pH20CHpJeVNtrrtF3GALtu4Y1Gu5QQVIQBz8gjHnqANx0XhfYzorv69Q==" + }, + "@aws-sdk/protocol-http": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/protocol-http/-/protocol-http-3.190.0.tgz", + "integrity": "sha512-s5MVfeONpfZYRzCSbqQ+wJ3GxKED+aSS7+CQoeaYoD6HDTDxaMGNv9aiPxVCzW02sgG7py7f29Q6Vw+5taZXZA==" + }, + "@aws-sdk/querystring-builder": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/querystring-builder/-/querystring-builder-3.190.0.tgz", + "integrity": "sha512-w9mTKkCsaLIBC8EA4RAHrqethNGbf60CbpPzN/QM7yCV3ZZJAXkppFfjTVVOMbPaI8GUEOptJtzgqV68CRB7ow==" + }, + "@aws-sdk/querystring-parser": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/querystring-parser/-/querystring-parser-3.190.0.tgz", + "integrity": "sha512-vCKP0s33VtS47LSYzEWRRr2aTbi3qNkUuQyIrc5LMqBfS5hsy79P1HL4Q7lCVqZB5fe61N8fKzOxDxWRCF0sXg==" + }, + "@aws-sdk/service-error-classification": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/service-error-classification/-/service-error-classification-3.190.0.tgz", + "integrity": "sha512-g+s6xtaMa5fCMA2zJQC4BiFGMP7FN5/L1V/UwxCnKy8skCwaN0K5A1tFffBjjbYiPI7Gu7LVorWD2A0Y4xl01Q==" + }, + "@aws-sdk/shared-ini-file-loader": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.190.0.tgz", + "integrity": "sha512-CZC/xsGReUEl5w+JgfancrxfkaCbEisyIFy6HALUYrioWQe80WMqLAdUMZSXHWjIaNK9mH0J/qvcSV2MuIoMzQ==" + }, + "@aws-sdk/signature-v4": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4/-/signature-v4-3.190.0.tgz", + "integrity": "sha512-L/R/1X2T+/Kg2k/sjoYyDFulVUGrVcRfyEKKVFIUNg0NwUtw5UKa1/gS7geTKcg4q8M2pd/v+OCBrge2X7phUw==" + }, + "@aws-sdk/smithy-client": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/smithy-client/-/smithy-client-3.190.0.tgz", + "integrity": "sha512-f5EoCwjBLXMyuN491u1NmEutbolL0cJegaJbtgK9OJw2BLuRHiBknjDF4OEVuK/WqK0kz2JLMGi9xwVPl4BKCA==" + }, + "@aws-sdk/types": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.190.0.tgz", + "integrity": "sha512-mkeZ+vJZzElP6OdRXvuLKWHSlDQxZP9u8BjQB9N0Rw0pCXTzYS0vzIhN1pL0uddWp5fMrIE68snto9xNR6BQuA==" + }, + "@aws-sdk/url-parser": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/url-parser/-/url-parser-3.190.0.tgz", + "integrity": "sha512-FKFDtxA9pvHmpfWmNVK5BAVRpDgkWMz3u4Sg9UzB+WAFN6UexRypXXUZCFAo8S04FbPKfYOR3O0uVlw7kzmj9g==" + }, + "@aws-sdk/util-base64-browser": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-base64-browser/-/util-base64-browser-3.188.0.tgz", + "integrity": "sha512-qlH+5NZBLiyKziL335BEPedYxX6j+p7KFRWXvDQox9S+s+gLCayednpK+fteOhBenCcR9fUZOVuAPScy1I8qCg==" + }, + "@aws-sdk/util-base64-node": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-base64-node/-/util-base64-node-3.188.0.tgz", + "integrity": "sha512-r1dccRsRjKq+OhVRUfqFiW3sGgZBjHbMeHLbrAs9jrOjU2PTQ8PSzAXLvX/9lmp7YjmX17Qvlsg0NCr1tbB9OA==" + }, + "@aws-sdk/util-body-length-browser": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-body-length-browser/-/util-body-length-browser-3.188.0.tgz", + "integrity": "sha512-8VpnwFWXhnZ/iRSl9mTf+VKOX9wDE8QtN4bj9pBfxwf90H1X7E8T6NkiZD3k+HubYf2J94e7DbeHs7fuCPW5Qg==" + }, + "@aws-sdk/util-body-length-node": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-body-length-node/-/util-body-length-node-3.188.0.tgz", + "integrity": "sha512-XwqP3vxk60MKp4YDdvDeCD6BPOiG2e+/Ou4AofZOy5/toB6NKz2pFNibQIUg2+jc7mPMnGnvOW3MQEgSJ+gu/Q==" + }, + "@aws-sdk/util-buffer-from": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-buffer-from/-/util-buffer-from-3.188.0.tgz", + "integrity": "sha512-NX1WXZ8TH20IZb4jPFT2CnLKSqZWddGxtfiWxD9M47YOtq/SSQeR82fhqqVjJn4P8w2F5E28f+Du4ntg/sGcxA==" + }, + "@aws-sdk/util-config-provider": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-config-provider/-/util-config-provider-3.188.0.tgz", + "integrity": "sha512-LBA7tLbi7v4uvbOJhSnjJrxbcRifKK/1ZVK94JTV2MNSCCyNkFotyEI5UWDl10YKriTIUyf7o5cakpiDZ3O4xg==" + }, + "@aws-sdk/util-defaults-mode-browser": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-defaults-mode-browser/-/util-defaults-mode-browser-3.190.0.tgz", + "integrity": "sha512-FKxTU4tIbFk2pdUbBNneStF++j+/pB4NYJ1HRSEAb/g4D2+kxikR/WKIv3p0JTVvAkwcuX/ausILYEPUyDZ4HQ==" + }, + "@aws-sdk/util-defaults-mode-node": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-defaults-mode-node/-/util-defaults-mode-node-3.190.0.tgz", + "integrity": "sha512-qBiIMjNynqAP7p6urG1+ZattYkFaylhyinofVcLEiDvM9a6zGt6GZsxru2Loq0kRAXXGew9E9BWGt45HcDc20g==" + }, + "@aws-sdk/util-hex-encoding": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-hex-encoding/-/util-hex-encoding-3.188.0.tgz", + "integrity": "sha512-QyWovTtjQ2RYxqVM+STPh65owSqzuXURnfoof778spyX4iQ4z46wOge1YV2ZtwS8w5LWd9eeVvDrLu5POPYOnA==" + }, + "@aws-sdk/util-locate-window": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.188.0.tgz", + "integrity": "sha512-SxobBVLZkkLSawTCfeQnhVX3Azm9O+C2dngZVe1+BqtF8+retUbVTs7OfYeWBlawVkULKF2e781lTzEHBBjCzw==" + }, + "@aws-sdk/util-middleware": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-middleware/-/util-middleware-3.190.0.tgz", + "integrity": "sha512-qzTJ/qhFDzHZS+iXdHydQ/0sWAuNIB5feeLm55Io/I8Utv3l3TKYOhbgGwTsXY+jDk7oD+YnAi7hLN5oEBCwpg==" + }, + "@aws-sdk/util-uri-escape": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-uri-escape/-/util-uri-escape-3.188.0.tgz", + "integrity": "sha512-4Y6AYZMT483Tiuq8dxz5WHIiPNdSFPGrl6tRTo2Oi2FcwypwmFhqgEGcqxeXDUJktvaCBxeA08DLr/AemVhPCg==" + }, + "@aws-sdk/util-user-agent-browser": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.190.0.tgz", + "integrity": "sha512-c074wjsD+/u9vT7DVrBLkwVhn28I+OEHuHaqpTVCvAIjpueZ3oms0e99YJLfpdpEgdLavOroAsNFtAuRrrTZZw==" + }, + "@aws-sdk/util-user-agent-node": { + "version": "3.190.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.190.0.tgz", + "integrity": "sha512-R36BMvvPX8frqFhU4lAsrOJ/2PJEHH/Jz1WZzO3GWmVSEAQQdHmo8tVPE3KOM7mZWe5Hj1dZudFAIxWHHFYKJA==" + }, + "@aws-sdk/util-utf8-browser": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.188.0.tgz", + "integrity": "sha512-jt627x0+jE+Ydr9NwkFstg3cUvgWh56qdaqAMDsqgRlKD21md/6G226z/Qxl7lb1VEW2LlmCx43ai/37Qwcj2Q==" + }, + "@aws-sdk/util-utf8-node": { + "version": "3.188.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-node/-/util-utf8-node-3.188.0.tgz", + "integrity": "sha512-hCgP4+C0Lekjpjt2zFJ2R/iHes5sBGljXa5bScOFAEkRUc0Qw0VNgTv7LpEbIOAwGmqyxBoCwBW0YHPW1DfmYQ==" + }, "@types/node": { - "version": "18.7.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.13.tgz", - "integrity": "sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==" + "version": "18.11.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.2.tgz", + "integrity": "sha512-BWN3M23gLO2jVG8g/XHIRFWiiV4/GckeFIqbU/C4V3xpoBBWSMk4OZomouN0wCkfQFPqgZikyLr7DOYDysIkkw==" }, "@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==" + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-xTE1E+YF4aWPJJeUzaZI5DRntlkY3+BCVJi0axFptnjGmAoWxkyREIh/XMrfxVLejwQxMCfDXdICo0VLxThrog==" }, "@types/whatwg-url": { "version": "8.2.2", @@ -21,6 +361,11 @@ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, + "bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==" + }, "bson": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/bson/-/bson-4.7.0.tgz", @@ -36,6 +381,11 @@ "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==" }, + "fast-xml-parser": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.0.11.tgz", + "integrity": "sha512-4aUg3aNRR/WjQAcpceODG1C3x3lFANXRo8+1biqfieHmg9pyMt7qB4lQV/Ta6sJCTbA5vfD8fnA8S54JATiFUA==" + }, "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -52,14 +402,14 @@ "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==" }, "mongodb": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.9.0.tgz", - "integrity": "sha512-tJJEFJz7OQTQPZeVHZJIeSOjMRqc5eSyXTt86vSQENEErpkiG7279tM/GT5AVZ7TgXNh9HQxoa2ZkbrANz5GQw==" + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.11.0.tgz", + "integrity": "sha512-9l9n4Nk2BYZzljW3vHah3Z0rfS5npKw6ktnkmFgTcnzaXH1DRm3pDl6VMHu84EVb1lzmSaJC4OzWZqTkB5i2wg==" }, "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==" + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.4.tgz", + "integrity": "sha512-SeAxuWs0ez3iI3vvmLk/j2y+zHwigTDKQhtdxTgt5ZCOQQS5+HW4g45/Xw5vzzbn7oQXCNQ24Z40AkJsizEy7w==" }, "punycode": { "version": "2.1.1", @@ -77,20 +427,35 @@ "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" }, "socks": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz", - "integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==" + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", + "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==" }, "sparse-bitfield": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==" }, + "strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, "tr46": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==" }, + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + }, "webidl-conversions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", diff --git a/packages/npm-mongo/package.js b/packages/npm-mongo/package.js index b8519fa86a..63696bf272 100644 --- a/packages/npm-mongo/package.js +++ b/packages/npm-mongo/package.js @@ -3,12 +3,12 @@ Package.describe({ summary: "Wrapper around the mongo npm package", - version: "4.9.0", + version: '4.11.0', documentation: null }); Npm.depends({ - mongodb: "4.9.0" + mongodb: "4.11.0" }); Package.onUse(function (api) { diff --git a/packages/promise/package.js b/packages/promise/package.js index fad988b619..181ef21b3b 100644 --- a/packages/promise/package.js +++ b/packages/promise/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "promise", - version: "0.12.0", + version: "0.12.1", summary: "ECMAScript 2015 Promise polyfill with Fiber support", git: "https://github.com/meteor/promise", documentation: "README.md" @@ -20,6 +20,7 @@ Package.onUse(function(api) { api.mainModule("client.js", "client"); api.mainModule("server.js", "server"); api.export("Promise"); + api.addAssets("promise.d.ts", ["client", "server"]); }); Package.onTest(function(api) { diff --git a/packages/promise/package.types.json b/packages/promise/package.types.json new file mode 100644 index 0000000000..b939961149 --- /dev/null +++ b/packages/promise/package.types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "promise.d.ts" +} diff --git a/packages/promise/promise.d.ts b/packages/promise/promise.d.ts new file mode 100644 index 0000000000..38698fc7cb --- /dev/null +++ b/packages/promise/promise.d.ts @@ -0,0 +1,23 @@ +export declare class Promise extends globalThis.Promise { + static async< + Fn extends (this: This, ...args: Args) => any, + This, + Args extends any[] + >( + fn: Fn, + allowReuseOfCurrentFiber?: boolean + ): (this: This, ...args: Args) => Promise>; + static asyncApply< + Fn extends (this: This, ...args: Args) => any, + This, + Args extends any[] + >( + fn: Fn, + context: This, + args: Args, + allowReuseOfCurrentFiber?: boolean + ): Promise>; + static await(value: PromiseLike): T; + static awaitAll(values: Iterable>): T[]; + await(): T; +} diff --git a/packages/random/package-types.json b/packages/random/package-types.json new file mode 100644 index 0000000000..71bd4af0cd --- /dev/null +++ b/packages/random/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "random.d.ts" +} diff --git a/packages/random/package.js b/packages/random/package.js index 370077010c..f6d9b6aae9 100644 --- a/packages/random/package.js +++ b/packages/random/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: 'Random number generator and utilities', - version: '1.2.0', + version: '1.2.1', }); Package.onUse(function (api) { @@ -8,6 +8,7 @@ Package.onUse(function (api) { api.export('Random'); api.mainModule('main_client.js', 'client'); api.mainModule('main_server.js', 'server'); + api.addAssets('random.d.ts', 'server'); }); Package.onTest(function (api) { diff --git a/packages/random/random.d.ts b/packages/random/random.d.ts new file mode 100644 index 0000000000..fd529f9a4d --- /dev/null +++ b/packages/random/random.d.ts @@ -0,0 +1,13 @@ +export namespace Random { + function id(numberOfChars?: number): string; + + function secret(numberOfChars?: number): string; + + function fraction(): number; + // @param numberOfDigits, @returns a random hex string of the given length + function hexString(numberOfDigits: number): string; + // @param array, @return a random element in array + function choice(array: T[]): T | undefined; + // @param str, @return a random char in str + function choice(str: string): string; +} diff --git a/packages/reactive-dict/package-types.json b/packages/reactive-dict/package-types.json new file mode 100644 index 0000000000..089231243f --- /dev/null +++ b/packages/reactive-dict/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "reactive-dict.d.ts" +} diff --git a/packages/reactive-dict/package.js b/packages/reactive-dict/package.js index ee7d4e4e9f..9fe4681c54 100644 --- a/packages/reactive-dict/package.js +++ b/packages/reactive-dict/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Reactive dictionary", - version: '1.3.0' + version: '1.3.1' }); Package.onUse(function (api) { @@ -9,6 +9,7 @@ Package.onUse(function (api) { api.use(['mongo', 'reload'], { weak: true }); api.mainModule('migration.js'); api.export('ReactiveDict'); + api.addAssets('reactive-dict.d.ts', 'server'); }); Package.onTest(function (api) { diff --git a/packages/reactive-dict/reactive-dict.d.ts b/packages/reactive-dict/reactive-dict.d.ts new file mode 100644 index 0000000000..b9a32ec4d8 --- /dev/null +++ b/packages/reactive-dict/reactive-dict.d.ts @@ -0,0 +1,94 @@ +import { EJSONable } from 'meteor/ejson'; + +export declare class ReactiveDict { + /** + * Constructor for a ReactiveDict, which represents a reactive dictionary of key/value pairs. + * @param name When a name is passed, preserves contents across Hot Code Pushes + * @param initialValue The default values for the dictionary + */ + constructor(name?: string, initialValue?: Partial); + /** + * Set a value for a key if it hasn't been set before. + * Otherwise works exactly the same as `ReactiveDict.set`. + * @param key The key to set, eg, `selectedItem` + * @param value The new value for `key` + */ + setDefault

(key: P, value?: O[P]): void; + /** + * Set a value for a key if it hasn't been set before. + * Otherwise works exactly the same as `ReactiveDict.set`. + */ + setDefault(object: Partial): void; + /** + * Set a value for a key in the ReactiveDict. Notify any listeners + * that the value has changed (eg: redraw templates, and rerun any + * `Tracker.autorun` computations, that called + * `ReactiveDict.get` on this `key`.) + * @param key The key to set, eg, `selectedItem` + * @param value The new value for `key` + */ + set

(key: P, value?: O[P]): void; + /** + * Set a value for a key in the ReactiveDict. Notify any listeners + * that the value has changed (eg: redraw templates, and rerun any + * `Tracker.autorun` computations, that called + * `ReactiveDict.get` on this `key`.) + */ + set(object: Partial): void; + /** + * Get the value assiciated with a key. If inside a reactive + * computation, invalidate the computation the next time the + * value associated with this key is changed by `ReactiveDict.set`. + * This returns a clone of the value, so if it's an object or an array, + * mutating the returned value has no effect on the value stored in the + * ReactiveDict. + * @param key The key of the element to return + */ + get

(key: P): O[P] | undefined; + /** + * Test if the stored entry for a key is equal to a value. If inside a + * reactive computation, invalidate the computation the next + * time the variable changes to or from the value. + * @param key The name of the session variable to test + * @param value The value to + * test against + */ + equals

( + key: P, + value: string | number | boolean | undefined | null + ): boolean; + /** + * Get all key-value pairs as a plain object. If inside a reactive + * computation, invalidate the computation the next time the + * value associated with any key is changed by `ReactiveDict.set`. + * This returns a clone of each value, so if it's an object or an array, + * mutating the returned value has no effect on the value stored in the + * ReactiveDict. + */ + all(): Partial; + /** + * remove all key-value pairs from the ReactiveDict. Notify any + * listeners that the value has changed (eg: redraw templates, and rerun any + * `Tracker.autorun` computations, that called + * `ReactiveDict.get` on this `key`.) + */ + clear(): void; + + /** + * remove a key-value pair from the ReactiveDict. Notify any listeners + * that the value has changed (eg: redraw templates, and rerun any + * `Tracker.autorun` computations, that called + * `ReactiveDict.get` on this `key`.) + * @param key The key to delete, eg, `selectedItem` + * @return did remove + */ + delete

(key: P): boolean; + /** + * Clear all values from the reactiveDict and prevent it from being + * migrated on a Hot Code Pushes. Notify any listeners + * that the value has changed (eg: redraw templates, and rerun any + * `Tracker.autorun` computations, that called + * `ReactiveDict.get` on this `key`.) + */ + destroy(): void; +} diff --git a/packages/reactive-var/package-types.json b/packages/reactive-var/package-types.json new file mode 100644 index 0000000000..24149d998a --- /dev/null +++ b/packages/reactive-var/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "reactive-var.d.ts" +} diff --git a/packages/reactive-var/package.js b/packages/reactive-var/package.js index 029608a876..05d1b1a194 100644 --- a/packages/reactive-var/package.js +++ b/packages/reactive-var/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Reactive variable", - version: '1.0.11' + version: '1.0.12' }); Package.onUse(function (api) { @@ -9,4 +9,5 @@ Package.onUse(function (api) { api.use('tracker'); api.addFiles('reactive-var.js'); + api.addAssets('reactive-var.d.ts', 'server'); }); diff --git a/packages/reactive-var/reactive-var.d.ts b/packages/reactive-var/reactive-var.d.ts new file mode 100644 index 0000000000..f7d22c7559 --- /dev/null +++ b/packages/reactive-var/reactive-var.d.ts @@ -0,0 +1,25 @@ +export declare var ReactiveVar: ReactiveVarStatic; + +export interface ReactiveVarStatic { + /** + * Constructor for a ReactiveVar, which represents a single reactive variable. + * @param initialValue The initial value to set. `equalsFunc` is ignored when setting the initial value. + * @param equalsFunc A function of two arguments, called on the old value and the new value whenever the ReactiveVar is set. If it returns true, no set is performed. If omitted, the default + * `equalsFunc` returns true if its arguments are `===` and are of type number, boolean, string, undefined, or null. + */ + new ( + initialValue: T, + equalsFunc?: (oldValue: T, newValue: T) => boolean + ): ReactiveVar; +} + +export interface ReactiveVar { + /** + * Returns the current value of the ReactiveVar, establishing a reactive dependency. + */ + get(): T; + /** + * Sets the current value of the ReactiveVar, invalidating the Computations that called `get` if `newValue` is different from the old value. + */ + set(newValue: T): void; +} diff --git a/packages/server-render/package-types.json b/packages/server-render/package-types.json new file mode 100644 index 0000000000..11840961ec --- /dev/null +++ b/packages/server-render/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "server-render.d.ts" +} diff --git a/packages/server-render/package.js b/packages/server-render/package.js index 47d3cadc5c..01be2f4b65 100644 --- a/packages/server-render/package.js +++ b/packages/server-render/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "server-render", - version: "0.4.0", + version: "0.4.1", summary: "Generic support for server-side rendering in Meteor apps", documentation: "README.md" }); @@ -17,6 +17,7 @@ Package.onUse(function(api) { api.use("webapp"); api.mainModule("client.js", "client", { lazy: true }); api.mainModule("server.js", "server"); + api.addAssets('server-render.d.ts', 'server'); }); Package.onTest(function(api) { diff --git a/packages/server-render/server-render.d.ts b/packages/server-render/server-render.d.ts new file mode 100644 index 0000000000..8f55c0fe07 --- /dev/null +++ b/packages/server-render/server-render.d.ts @@ -0,0 +1,36 @@ +import * as http from 'http'; + +// NodeJS.ReadableStream only works on server. +// HTMLElement only works on client. +export type Content = string | Content[] | NodeJS.ReadableStream | HTMLElement; + +export interface ClientSink { + // Client and server. Only client + appendToHead(html: Content): void; + appendToBody(html: Content): void; + appendToElementById(id: string, html: Content): void; + renderIntoElementById(id: string, html: Content): void; + redirect(location: string, code?: number): void; + + // Server-only, but error-raising stubs provided to client: + setStatusCode(code: number): void; + setHeader(key: string, value: number | string | string[]): void; + getHeaders(): http.IncomingHttpHeaders; + getCookies(): { [key: string]: string }; +} + +export interface ServerSink extends ClientSink { + // Server-only: + request: http.IncomingMessage; + arch: string; + head: string; + body: string; + htmlById: { [key: string]: string }; + maybeMadeChanges: boolean; +} + +export type Sink = ClientSink | ServerSink; + +export type Callback = (sink: Sink) => Promise | any; + +export function onPageLoad(callback: T): T; diff --git a/packages/service-configuration/package-types.json b/packages/service-configuration/package-types.json new file mode 100644 index 0000000000..16883a4dac --- /dev/null +++ b/packages/service-configuration/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "service-configuration.d.ts" +} diff --git a/packages/service-configuration/package.js b/packages/service-configuration/package.js index ec496a1fff..a3042eb333 100644 --- a/packages/service-configuration/package.js +++ b/packages/service-configuration/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: 'Manage the configuration for third-party services', - version: '1.3.0', + version: '1.3.1', }); Package.onUse(function(api) { @@ -10,4 +10,5 @@ Package.onUse(function(api) { api.export('ServiceConfiguration'); api.addFiles('service_configuration_common.js', ['client', 'server']); api.addFiles('service_configuration_server.js', 'server'); + api.addAssets('service-configuration.d.ts', 'server'); }); diff --git a/packages/service-configuration/service-configuration.d.ts b/packages/service-configuration/service-configuration.d.ts new file mode 100644 index 0000000000..3c18cfaac3 --- /dev/null +++ b/packages/service-configuration/service-configuration.d.ts @@ -0,0 +1,10 @@ +import { Mongo } from 'meteor/mongo'; + +export interface Configuration { + appId: string; + secret: string; +} + +export declare var ServiceConfiguration: { + configurations: Mongo.Collection; +}; diff --git a/packages/session/package-types.json b/packages/session/package-types.json new file mode 100644 index 0000000000..ee5a93cac4 --- /dev/null +++ b/packages/session/package-types.json @@ -0,0 +1,3 @@ +{ + "typesEntry": "session.d.ts" +} diff --git a/packages/session/package.js b/packages/session/package.js index 5515510f25..30f5529638 100644 --- a/packages/session/package.js +++ b/packages/session/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Session variable", - version: '1.2.0' + version: '1.2.1' }); Package.onUse(function (api) { @@ -13,6 +13,7 @@ Package.onUse(function (api) { api.export('Session', 'client'); api.mainModule('session.js', 'client'); + api.addAssets('session.d.ts', 'server'); }); Package.onTest(function (api) { diff --git a/packages/session/session.d.ts b/packages/session/session.d.ts new file mode 100644 index 0000000000..6e5afd4420 --- /dev/null +++ b/packages/session/session.d.ts @@ -0,0 +1,41 @@ +import { EJSONable } from 'meteor/ejson'; + +export namespace Session { + /** + * Test if a session variable is equal to a value. If inside a + * reactive computation, invalidate the computation the next + * time the variable changes to or from the value. + * @param key The name of the session variable to test + * @param value The value to test against + */ + function equals(key: string, value: string | number | boolean | any): boolean; + + /** + * Get the value of a session variable. If inside a reactive + * computation, invalidate the computation the next time the + * value of the variable is changed by `Session.set`. This + * returns a clone of the session value, so if it's an object or an array, + * mutating the returned value has no effect on the value stored in the + * session. + * @param key The name of the session variable to return + */ + function get(key: string): any; + + /** + * Set a variable in the session. Notify any listeners that the value + * has changed (eg: redraw templates, and rerun any + * `Tracker.autorun` computations, that called + * `Session.get` on this `key`.) + * @param key The key to set, eg, `selectedItem` + * @param value The new value for `key` + */ + function set(key: string, value: EJSONable | any): void; + + /** + * Set a variable in the session if it hasn't been set before. + * Otherwise works exactly the same as `Session.set`. + * @param key The key to set, eg, `selectedItem` + * @param value The new value for `key` + */ + function setDefault(key: string, value: EJSONable | any): void; +} diff --git a/packages/test-in-browser/driver.js b/packages/test-in-browser/driver.js index 5e6120d04a..d0d5fa4423 100644 --- a/packages/test-in-browser/driver.js +++ b/packages/test-in-browser/driver.js @@ -88,7 +88,7 @@ var reportResults = function(results) { } // Now process the current report - if (_.isArray(results.events)) { + if (Array.isArray(results.events)) { // append events, if present Array.prototype.push.apply((test.events || (test.events = [])), results.events); @@ -97,7 +97,7 @@ var reportResults = function(results) { return a.sequence - b.sequence; }); var out = []; - _.each(test.events, function (e) { + test.events.forEach(function (e) { if (out.length === 0 || out[out.length - 1].sequence !== e.sequence) out.push(e); }); @@ -110,7 +110,7 @@ var reportResults = function(results) { // test name yet). if (test.expanded === undefined) test.expanded = true; - if (!_.contains(failedTests, test.fullName)) + if (!failedTests.includes(test.fullName)) failedTests.push(test.fullName); countDep.changed(); @@ -147,16 +147,16 @@ var forgetEvents = function (results) { // possibly 'events'. var _findTestForResults = function (results) { var groupPath = results.groupPath; // array - if ((! _.isArray(groupPath)) || (groupPath.length < 1)) { + if ((! Array.isArray(groupPath)) || (groupPath.length < 1)) { throw new Error("Test must be part of a group"); } var group; var i = 0; - _.each(groupPath, function(gname) { + groupPath.forEach(function(gname) { var array = (group ? (group.groups || (group.groups = [])) : resultTree); - var newGroup = _.find(array, function(g) { return g.name === gname; }); + var newGroup = array.find(function(g) { return g.name === gname; }); if (! newGroup) { newGroup = { name: gname, @@ -177,12 +177,12 @@ var _findTestForResults = function (results) { var testName = results.test; var server = !!results.server; - var test = _.find(group.tests || (group.tests = []), + var test = (group.tests || (group.tests = [])).find( function(t) { return t.name === testName && t.server === server; }); if (! test) { // create test - var nameParts = _.clone(groupPath); + var nameParts = [...groupPath]; nameParts.push(testName); var fullName = nameParts.join(' - '); test = { @@ -209,7 +209,7 @@ var _findTestForResults = function (results) { var _testTime = function(t) { if (t.events && t.events.length > 0) { - var lastEvent = _.last(t.events); + var lastEvent = t.events[t.events.length - 1]; if (lastEvent.type === "finish") { if ((typeof lastEvent.timeMs) === "number") { return lastEvent.timeMs; @@ -221,15 +221,15 @@ var _testTime = function(t) { var _testStatus = function(t) { var events = t.events || []; - if (_.find(events, function(x) { return x.type === "exception"; })) { + if (events.find(function(x) { return x.type === "exception"; })) { // "exception" should be last event, except race conditions on the // server can make this not the case. Technically we can't tell // if the test is still running at this point, but it can only // result in FAIL. return "failed"; - } else if (events.length == 0 || (_.last(events).type != "finish")) { + } else if (events.length == 0 || (events[events.length - 1].type != "finish")) { return "running"; - } else if (_.any(events, function(e) { + } else if (events.some(function(e) { return e.type == "fail" || e.type == "exception"; })) { return "failed"; } else { @@ -261,8 +261,8 @@ Template.navBar.helpers({ var walk = function (groups) { var total = 0; - _.each(groups || [], function (group) { - _.each(group.tests || [], function (t) { + (groups || []).forEach(function (group) { + (group.tests || []).forEach(function (t) { total += _testTime(t); }); @@ -450,14 +450,14 @@ Template.test.helpers({ }, eventsArray: function() { - var events = _.filter(this.events, function(e) { - return e.type != "finish"; + var events = this.events.filter(function(e) { + return e[type] != "finish"; }); var partitionBy = function(seq, func) { var result = []; var lastValue = {}; - _.each(seq, function(x) { + seq.forEach(function(x) { var newValue = func(x); if (newValue === lastValue) { result[result.length-1].push(x); @@ -470,17 +470,17 @@ Template.test.helpers({ }; var dupLists = partitionBy( - _.map(events, function(e) { + events.map(function(e) { // XXX XXX We need something better than stringify! // stringify([undefined]) === "[null]" - e = _.clone(e); + e = Object.assign({}, e); delete e.sequence; return {obj: e, str: JSON.stringify(e)}; }), function(x) { return x.str; }); - return _.map(dupLists, function(L) { + return dupLists.map(function(L) { var obj = L[0].obj; - return (L.length > 1) ? _.extend({times: L.length}, obj) : obj; + return (L.length > 1) ? Object.assign({times: L.length}, obj) : obj; }); } }); @@ -525,7 +525,7 @@ Template.event.helpers({ var type = details.type; var stack = details.stack; - details = _.clone(details); + details = Array.isArray(details) && [...details] || Object.assign({}, details); delete details.type; delete details.stack; @@ -535,14 +535,14 @@ Template.event.helpers({ details.expected); } - return _.compact(_.map(details, function(val, key) { + return Object.entries(details).map(function([key, val]) { // make test._stringEqual results print nicely, // in particular for multiline strings if (type === 'string_equal' && (key === 'actual' || key === 'expected')) { var html = '

';
-            _.each(diff, function (piece) {
+            diff.forEach(function (piece) {
               var which = piece[0];
               var text = piece[1];
               if (which === 0 ||
@@ -561,7 +561,7 @@ Template.event.helpers({
           // You can end up with a an undefined value, e.g. using
           // isNull without providing a message attribute: isNull(1).
           // No need to display those.
-          if (!_.isUndefined(val)) {
+          if (typeof val !== 'undefined') {
             return {
               key: key,
               val: val
@@ -569,7 +569,7 @@ Template.event.helpers({
           } else {
             return undefined;
           }
-        }));
+        }).filter(Boolean);
       };
 
       return {
@@ -583,4 +583,4 @@ Template.event.helpers({
   is_debuggable: function() {
     return !!this.cookie;
   }
-});
+});
\ No newline at end of file
diff --git a/packages/test-in-browser/package.js b/packages/test-in-browser/package.js
index a92fb4206a..a090172f76 100644
--- a/packages/test-in-browser/package.js
+++ b/packages/test-in-browser/package.js
@@ -1,6 +1,6 @@
 Package.describe({
   summary: "Run tests interactively in the browser",
-  version: '1.3.0',
+  version: '1.3.1',
   documentation: null
 });
 
@@ -13,7 +13,6 @@ Package.onUse(function (api) {
   // XXX this should go away, and there should be a clean interface
   // that tinytest and the driver both implement?
   api.use('tinytest');
-  api.use('underscore');
 
   api.use('session');
   api.use('reload');
diff --git a/packages/tracker/package-types.json b/packages/tracker/package-types.json
new file mode 100644
index 0000000000..7e03462336
--- /dev/null
+++ b/packages/tracker/package-types.json
@@ -0,0 +1,3 @@
+{
+  "typesEntry": "tracker.d.ts"
+}
diff --git a/packages/tracker/package.js b/packages/tracker/package.js
index 9475828977..4448d88383 100644
--- a/packages/tracker/package.js
+++ b/packages/tracker/package.js
@@ -1,6 +1,6 @@
 Package.describe({
   summary: "Dependency tracker to allow reactive callbacks",
-  version: "1.2.0"
+  version: "1.2.1"
 });
 
 Package.onUse(function (api) {
@@ -8,6 +8,7 @@ Package.onUse(function (api) {
   api.addFiles("tracker.js");
   api.export("Tracker");
   api.export("Deps");
+  api.addAssets("tracker.d.ts", ["client", "server"]);
 });
 
 Package.onTest(function (api) {
diff --git a/packages/tracker/tracker.d.ts b/packages/tracker/tracker.d.ts
new file mode 100644
index 0000000000..9ab6e0bdc5
--- /dev/null
+++ b/packages/tracker/tracker.d.ts
@@ -0,0 +1,128 @@
+/**
+ * The namespace for Tracker-related methods.
+ */
+export namespace Tracker {
+  function Computation(): void;
+  /**
+   * A Computation object represents code that is repeatedly rerun
+   * in response to
+   * reactive data changes. Computations don't have return values; they just
+   * perform actions, such as rerendering a template on the screen. Computations
+   * are created using Tracker.autorun. Use stop to prevent further rerunning of a
+   * computation.
+   */
+  interface Computation {
+    /**
+     * True during the initial run of the computation at the time `Tracker.autorun` is called, and false on subsequent reruns and at other times.
+     */
+    firstRun: boolean;
+    /**
+     * Invalidates this computation so that it will be rerun.
+     */
+    invalidate(): void;
+    /**
+     * True if this computation has been invalidated (and not yet rerun), or if it has been stopped.
+     */
+    invalidated: boolean;
+    /**
+     * Registers `callback` to run when this computation is next invalidated, or runs it immediately if the computation is already invalidated.  The callback is run exactly once and not upon
+     * future invalidations unless `onInvalidate` is called again after the computation becomes valid again.
+     * @param callback Function to be called on invalidation. Receives one argument, the computation that was invalidated.
+     */
+    onInvalidate(callback: Function): void;
+    /**
+     * Registers `callback` to run when this computation is stopped, or runs it immediately if the computation is already stopped.  The callback is run after any `onInvalidate` callbacks.
+     * @param callback Function to be called on stop. Receives one argument, the computation that was stopped.
+     */
+    onStop(callback: Function): void;
+    /**
+     * Prevents this computation from rerunning.
+     */
+    stop(): void;
+    /**
+     * True if this computation has been stopped.
+     */
+    stopped: boolean;
+  }
+  /**
+   * The current computation, or `null` if there isn't one.  The current computation is the `Tracker.Computation` object created by the innermost active call to
+   * `Tracker.autorun`, and it's the computation that gains dependencies when reactive data sources are accessed.
+   */
+  var currentComputation: Computation;
+
+  var Dependency: DependencyStatic;
+  /**
+   * A Dependency represents an atomic unit of reactive data that a
+   * computation might depend on. Reactive data sources such as Session or
+   * Minimongo internally create different Dependency objects for different
+   * pieces of data, each of which may be depended on by multiple computations.
+   * When the data changes, the computations are invalidated.
+   */
+  interface DependencyStatic {
+    new (): Dependency;
+  }
+  interface Dependency {
+    /**
+     * Invalidate all dependent computations immediately and remove them as dependents.
+     */
+    changed(): void;
+    /**
+     * Declares that the current computation (or `fromComputation` if given) depends on `dependency`.  The computation will be invalidated the next time `dependency` changes.
+     * If there is no current computation and `depend()` is called with no arguments, it does nothing and returns false.
+     * Returns true if the computation is a new dependent of `dependency` rather than an existing one.
+     * @param fromComputation An optional computation declared to depend on `dependency` instead of the current computation.
+     */
+    depend(fromComputation?: Computation): boolean;
+    /**
+     * True if this Dependency has one or more dependent Computations, which would be invalidated if this Dependency were to change.
+     */
+    hasDependents(): boolean;
+  }
+
+  /**
+   * True if there is a current computation, meaning that dependencies on reactive data sources will be tracked and potentially cause the current computation to be rerun.
+   */
+  var active: boolean;
+
+  /**
+   * Schedules a function to be called during the next flush, or later in the current flush if one is in progress, after all invalidated computations have been rerun.  The function will be run
+   * once and not on subsequent flushes unless `afterFlush` is called again.
+   * @param callback A function to call at flush time.
+   */
+  function afterFlush(callback: Function): void;
+
+  /**
+   * Run a function now and rerun it later whenever its dependencies
+   * change. Returns a Computation object that can be used to stop or observe the
+   * rerunning.
+   * @param runFunc The function to run. It receives one argument: the Computation object that will be returned.
+   */
+  function autorun(
+    runFunc: (computation: Computation) => void,
+    options?: {
+      /**
+       * The function to run when an error
+       * happens in the Computation. The only argument it receives is the Error
+       * thrown. Defaults to the error being logged to the console.
+       */
+      onError?: Function | undefined;
+    }
+  ): Computation;
+
+  /**
+   * Process all reactive updates immediately and ensure that all invalidated computations are rerun.
+   */
+  function flush(): void;
+
+  /**
+   * Run a function without tracking dependencies.
+   * @param func A function to call immediately.
+   */
+  function nonreactive(func: () => T): T;
+
+  /**
+   * Registers a new `onInvalidate` callback on the current computation (which must exist), to be called immediately when the current computation is invalidated or stopped.
+   * @param callback A callback function that will be invoked as `func(c)`, where `c` is the computation on which the callback is registered.
+   */
+  function onInvalidate(callback: Function): void;
+}
diff --git a/packages/twitter-oauth/package.js b/packages/twitter-oauth/package.js
index 3f5cde5730..6a8bd6793b 100644
--- a/packages/twitter-oauth/package.js
+++ b/packages/twitter-oauth/package.js
@@ -1,13 +1,12 @@
 Package.describe({
   summary: "Twitter OAuth flow",
-  version: "1.3.0"
+  version: '1.3.1'
 });
 
 Package.onUse(function(api) {
   api.use('oauth1', ['client', 'server']);
   api.use('oauth', ['client', 'server']);
   api.use('random', 'client');
-  api.use('underscore', 'server');
   api.use('service-configuration', ['client', 'server']);
 
   api.addFiles('twitter_common.js', ['server', 'client']);
diff --git a/packages/twitter-oauth/twitter_server.js b/packages/twitter-oauth/twitter_server.js
index d597f0db1e..6a973ac57d 100644
--- a/packages/twitter-oauth/twitter_server.js
+++ b/packages/twitter-oauth/twitter_server.js
@@ -26,8 +26,8 @@ OAuth.registerService('twitter', 1, urls, function(oauthBinding) {
   };
 
   // include helpful fields from twitter
-  var fields = _.pick(identity, Twitter.whitelistedFields);
-  _.extend(serviceData, fields);
+  const { identity: fields } = Twitter.whitelistedFields;
+  Object.assign(serviceData, fields);
 
   return {
     serviceData: serviceData,
diff --git a/packages/underscore/package-types.json b/packages/underscore/package-types.json
new file mode 100644
index 0000000000..347b86d05e
--- /dev/null
+++ b/packages/underscore/package-types.json
@@ -0,0 +1,3 @@
+{
+  "typesEntry": "underscore.d.ts"
+}
diff --git a/packages/underscore/package.js b/packages/underscore/package.js
index 483509a727..58525754ed 100644
--- a/packages/underscore/package.js
+++ b/packages/underscore/package.js
@@ -1,6 +1,6 @@
 Package.describe({
   summary: "Collection of small helpers: _.map, _.each, ...",
-  version: '1.0.10'
+  version: '1.0.11'
 });
 
 Package.onUse(function (api) {
@@ -27,6 +27,8 @@ Package.onUse(function (api) {
   // numeric length field whose constructor === Object are still treated as
   // objects, not as arrays.  Search for looksLikeArray.
   api.addFiles(['pre.js', 'underscore.js', 'post.js']);
+
+  api.addAssets('underscore.d.ts', 'server');
 });
 
 
diff --git a/packages/underscore/underscore.d.ts b/packages/underscore/underscore.d.ts
new file mode 100644
index 0000000000..ffbb281e51
--- /dev/null
+++ b/packages/underscore/underscore.d.ts
@@ -0,0 +1,2 @@
+import * as _ from 'underscore';
+export { _ };
diff --git a/packages/webapp-hashing/package.js b/packages/webapp-hashing/package.js
index af8f7e762d..12e2eac59c 100644
--- a/packages/webapp-hashing/package.js
+++ b/packages/webapp-hashing/package.js
@@ -1,11 +1,10 @@
 Package.describe({
   summary: "Used internally by WebApp. Knows how to hash programs from manifests.",
-  version: "1.1.0"
+  version: '1.1.1'
 });
 
 Package.onUse(function(api) {
   api.use('ecmascript');
-  api.use('underscore', 'server');
   api.addFiles('webapp-hashing.js', 'server');
   api.export('WebAppHashing');
 });
diff --git a/packages/webapp-hashing/webapp-hashing.js b/packages/webapp-hashing/webapp-hashing.js
index f2fc190449..0968b45323 100644
--- a/packages/webapp-hashing/webapp-hashing.js
+++ b/packages/webapp-hashing/webapp-hashing.js
@@ -1,4 +1,4 @@
-var crypto = Npm.require("crypto");
+import { createHash } from "crypto";
 
 WebAppHashing = {};
 
@@ -13,13 +13,11 @@ WebAppHashing = {};
 
 WebAppHashing.calculateClientHash =
   function (manifest, includeFilter, runtimeConfigOverride) {
-  var hash = crypto.createHash('sha1');
+  var hash = createHash('sha1');
 
   // Omit the old hashed client values in the new hash. These may be
   // modified in the new boilerplate.
-  var runtimeCfg = _.omit(__meteor_runtime_config__,
-    ['autoupdateVersion', 'autoupdateVersionRefreshable',
-     'autoupdateVersionCordova']);
+  var { autoupdateVersion, autoupdateVersionRefreshable, autoupdateVersionCordova, ...runtimeCfg } = __meteor_runtime_config__;
 
   if (runtimeConfigOverride) {
     runtimeCfg = runtimeConfigOverride;
@@ -27,7 +25,7 @@ WebAppHashing.calculateClientHash =
 
   hash.update(JSON.stringify(runtimeCfg, 'utf8'));
 
-  _.each(manifest, function (resource) {
+  manifest.forEach(function (resource) {
       if ((! includeFilter || includeFilter(resource.type, resource.replaceable)) &&
           (resource.where === 'client' || resource.where === 'internal')) {
       hash.update(resource.path);
@@ -39,7 +37,7 @@ WebAppHashing.calculateClientHash =
 
 WebAppHashing.calculateCordovaCompatibilityHash =
   function(platformVersion, pluginVersions) {
-  const hash = crypto.createHash('sha1');
+  const hash = createHash('sha1');
 
   hash.update(platformVersion);
 
diff --git a/packages/webapp/package-types.json b/packages/webapp/package-types.json
new file mode 100644
index 0000000000..ba477f3ba8
--- /dev/null
+++ b/packages/webapp/package-types.json
@@ -0,0 +1,3 @@
+{
+  "typesEntry": "webapp.d.ts"
+}
diff --git a/packages/webapp/package.js b/packages/webapp/package.js
index 5464ea7dc8..56e920fea2 100644
--- a/packages/webapp/package.js
+++ b/packages/webapp/package.js
@@ -1,6 +1,6 @@
 Package.describe({
   summary: 'Serves a Meteor app over HTTP',
-  version: '1.13.1',
+  version: '1.13.2',
 });
 
 Npm.depends({
@@ -57,6 +57,7 @@ Package.onUse(function(api) {
   api.export('WebApp', 'client');
 
   api.mainModule('webapp_cordova.js', 'web.cordova');
+  api.addAssets('webapp.d.ts', 'server');
 });
 
 Package.onTest(function(api) {
diff --git a/packages/webapp/webapp.d.ts b/packages/webapp/webapp.d.ts
new file mode 100644
index 0000000000..e13bb9ccf0
--- /dev/null
+++ b/packages/webapp/webapp.d.ts
@@ -0,0 +1,87 @@
+import * as http from 'http';
+import * as connect from 'connect';
+
+export interface StaticFiles {
+  [key: string]: {
+    content?: string | undefined;
+    absolutePath: string;
+    cacheable: boolean;
+    hash: string;
+    sourceMapUrl?: string | undefined;
+    type: string;
+  };
+}
+
+export declare module WebApp {
+  var defaultArch: string;
+  var clientPrograms: {
+    [key: string]: {
+      format: string;
+      manifest: any;
+      version: string;
+      cordovaCompatibilityVersions?: any;
+      PUBLIC_SETTINGS: any;
+    };
+  };
+  var connectHandlers: connect.Server;
+  var rawConnectHandlers: connect.Server;
+  var httpServer: http.Server;
+  var connectApp: connect.Server;
+  function suppressConnectErrors(): void;
+  function onListening(callback: Function): void;
+
+  type RuntimeConfigHookCallback = (options: {
+    arch: 'web.browser' | 'web.browser.legacy' | 'web.cordova';
+    request: http.IncomingMessage;
+    encodedCurrentConfig: string;
+    updated: boolean;
+  }) => string | undefined | null | false;
+  function addRuntimeConfigHook(callback: RuntimeConfigHookCallback): void;
+  function decodeRuntimeConfig(rtimeConfigString: string): unknown;
+  function encodeRuntimeConfig(rtimeConfig: unknown): string;
+}
+
+export declare module WebAppInternals {
+  var NpmModules: {
+    [key: string]: {
+      version: string;
+      module: any;
+    };
+  };
+  function identifyBrowser(
+    userAgentString: string
+  ): {
+    name: string;
+    major: string;
+    minor: string;
+    patch: string;
+  };
+  function registerBoilerplateDataCallback(
+    key: string,
+    callback: Function
+  ): Function;
+  function generateBoilerplateInstance(
+    arch: string,
+    manifest: any,
+    additionalOptions: any
+  ): any;
+
+  function staticFilesMiddleware(
+    staticFiles: StaticFiles,
+    req: http.IncomingMessage,
+    res: http.ServerResponse,
+    next: Function
+  ): void;
+  function parsePort(port: string): number;
+  function reloadClientPrograms(): void;
+  function generateBoilerplate(): void;
+  var staticFiles: StaticFiles;
+  function inlineScriptsAllowed(): boolean;
+  function setInlineScriptsAllowed(inlineScriptsAllowed: boolean): void;
+
+  function setBundledJsCssUrlRewriteHook(hookFn: (url: string) => string): void;
+  function setBundledJsCssPrefix(bundledJsCssPrefix: string): void;
+  function addStaticJs(): void;
+  function getBoilerplate(request: http.IncomingMessage, arch: string): string;
+  var additionalStaticJs: any;
+}
diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json
index 73b31948b6..e475269aa6 100644
--- a/scripts/admin/meteor-release-experimental.json
+++ b/scripts/admin/meteor-release-experimental.json
@@ -1,6 +1,6 @@
 {
   "track": "METEOR",
-  "version": "2.8-rc.0",
+  "version": "2.8.1-rc.0",
   "recommended": false,
   "official": false,
   "description": "Meteor experimental release"
diff --git a/scripts/admin/meteor-release-official.json b/scripts/admin/meteor-release-official.json
index 41230791aa..b49fccf05e 100644
--- a/scripts/admin/meteor-release-official.json
+++ b/scripts/admin/meteor-release-official.json
@@ -1,6 +1,6 @@
 {
   "track": "METEOR",
-  "version": "2.8.0",
+  "version": "2.8.1",
   "recommended": false,
   "official": true,
   "description": "The Official Meteor Distribution"
diff --git a/scripts/admin/update-semver/index.js b/scripts/admin/update-semver/index.js
index bc903a43f1..73c4a0fce8 100644
--- a/scripts/admin/update-semver/index.js
+++ b/scripts/admin/update-semver/index.js
@@ -7,6 +7,7 @@
 const semver = require('semver');
 const fs = require('fs');
 const { exec } = require("child_process");
+const { readdir } = require("fs/promises");
 
 const runCommand = async (command) => {
   return new Promise((resolve, reject) => {
@@ -26,24 +27,64 @@ const runCommand = async (command) => {
   })
 }
 
+/**
+ *
+ * @returns {Promise}
+ */
 async function getPackages() {
   return await runCommand("./get-diff.sh");
 }
 
+async function getFile(path) {
+  try {
+    const data = await fs.promises.readFile(path, 'utf8');
+    return [data, null]
+  } catch (e) {
+    console.error(e);
+    return ['', e];
+  }
+
+}
+
+const getDirectories = async source =>
+  (await readdir(source, { withFileTypes: true }))
+    .filter(dirent => dirent.isDirectory())
+    .map(dirent => dirent.name);
+
 async function main() {
+  /**
+   * @type {string[]}
+   */
   let args = process.argv.slice(2);
 
-  if (args[0] === '@auto') {
-    const packages = await getPackages();
+  if (args[0].startsWith('@all')) {
+    const [_, type] = args[0].split('.');
+    const allPackages = await getDirectories('../../../packages');
+    args = allPackages.map((packageName) => `${ packageName }.${ type }`);
+  }
+
+  if (args[0].startsWith('@auto')) {
+    const [_, type] = args[0].split('.');
+    // List of packages that for some reason are not in the diff.
+    // If there is a change in one of them please do not forget
+    // to add it to the list.
+    // List:
+    // ddp-common
+
+    const p = await getPackages();
+    console.log('****************')
+    console.log('Will be updating the following packages:');
+    console.dir(p)
+    console.log('****************')
+    const packages = p.concat(`packages/meteor-tool.${ type }`);
     args = packages
       .split('/')
-      .filter((packageName) => packageName !== 'packages' && packageName !== "\npackages" && packageName !== "\n");
+      .filter((packageName) => packageName !== 'packages' && packageName !== "\npackages" && packageName !== "\n")
+      .map((packageName) => `${ packageName }.${ type }`);
   }
+
   /**
-   * @type {{
-   *   name: string,
-   *   version: string,
-   * }[]}
+   * @type {{release, name: string|null}[]}
    */
   const packages = args.map(arg => {
     const [name, release] = arg.split('.');
@@ -51,8 +92,9 @@ async function main() {
   });
   for (const { name, release } of packages) {
     const filePath = `../../../packages/${ name }/package.js`;
-    const code = await fs.promises.readFile(filePath, 'utf8');
-
+    const [code, err] = await getFile(filePath);
+    // if there is an error reading the file, we will skip it.
+    if (err) continue;
     for (const line of code.split(/\n/)) {
       // should only run on lines that have a version
       if (!line.includes('version')) continue;
@@ -62,8 +104,13 @@ async function main() {
       //   version: '1.2.3' <--- this is the line we want, we assure that it has a version in the previous if
       //});
       const [_, versionValue] = line.split(':');
-      const currentVersion = versionValue.trim().replace(',', '');
-      const semverVersion = semver.coerce(currentVersion);
+      if (!versionValue) continue;
+      const currentVersion = versionValue
+        .trim()
+        .replace(',', '')
+        .replace(/'/g, '')
+        .replace(/"/g, '');
+
 
       /**
        *
@@ -72,17 +119,19 @@ async function main() {
        */
       function incrementNewVersion(release) {
         if (release.includes('beta') || release.includes('rc')) {
-          return semver.inc(semverVersion, 'prerelease', release);
+          return semver.inc(currentVersion, 'prerelease', release);
         }
-        return semver.inc(semverVersion, release);
+        return semver.inc(currentVersion, release);
       }
 
       const newVersion = incrementNewVersion(release);
       console.log(`Updating ${ name } from ${ currentVersion } to ${ newVersion }`);
-      const newCode = code.replace(currentVersion, "'" + newVersion + "'");
+      const newCode = code.replace(currentVersion, `${ newVersion }`);
       await fs.promises.writeFile(filePath, newCode);
     }
   }
+  console.log('Done!');
+  if (!args[0].startsWith('@auto')) console.log('Do not forget to update meteor-tool');
 }
 
 main();
diff --git a/scripts/build-dev-bundle-common.sh b/scripts/build-dev-bundle-common.sh
index d7b4cfaa10..ef6013c4e5 100644
--- a/scripts/build-dev-bundle-common.sh
+++ b/scripts/build-dev-bundle-common.sh
@@ -5,7 +5,7 @@ set -u
 
 UNAME=$(uname)
 ARCH=$(uname -m)
-NODE_VERSION=14.20.1
+NODE_VERSION=14.21.1
 MONGO_VERSION_64BIT=5.0.5
 MONGO_VERSION_32BIT=3.2.22
 NPM_VERSION=6.14.17
diff --git a/scripts/make-release-tarballs.sh b/scripts/make-release-tarballs.sh
index 6b52e9c5e7..562b67823c 100755
--- a/scripts/make-release-tarballs.sh
+++ b/scripts/make-release-tarballs.sh
@@ -12,16 +12,16 @@ done
 echo "BRANCH_NAME = $BRANCH_NAME"
 echo "VERSION = $VERSION"
 
-git fetch origin && git checkout release/METEOR@$VERSION &&
-  git reset --hard origin/$BRANCH_NAME &&
+git fetch origin && git checkout release/METEOR@"$VERSION" &&
+  git reset --hard origin/"$BRANCH_NAME" &&
   git clean -df &&
-  ./meteor admin make-bootstrap-tarballs --target-arch os.windows.x86_64 $VERSION win64 &&
-  ./meteor admin make-bootstrap-tarballs --target-arch os.linux.x86_64 $VERSION linux64 &&
-  ./meteor admin make-bootstrap-tarballs --target-arch os.osx.x86_64 $VERSION osx &&
-  ./meteor admin make-bootstrap-tarballs --target-arch os.osx.arm64 $VERSION osx &&
-  aws s3 mb s3://com.meteor.static/packages-bootstrap/$VERSION/ &&
-  aws s3 cp --acl public-read win64/meteor-bootstrap-os.windows.x86_64.tar.gz s3://com.meteor.static/packages-bootstrap/$VERSION/ &&
-  aws s3 cp --acl public-read linux64/meteor-bootstrap-os.linux.x86_64.tar.gz s3://com.meteor.static/packages-bootstrap/$VERSION/ &&
-  aws s3 cp --acl public-read osx/meteor-bootstrap-os.osx.x86_64.tar.gz s3://com.meteor.static/packages-bootstrap/$VERSION/ &&
-  aws s3 cp --acl public-read osx/meteor-bootstrap-os.osx.arm64.tar.gz s3://com.meteor.static/packages-bootstrap/$VERSION/ &&
-  aws s3 ls s3://com.meteor.static/packages-bootstrap/$VERSION
+  ./meteor admin make-bootstrap-tarballs --target-arch os.windows.x86_64 "$VERSION" win64 &&
+  aws s3 cp --acl public-read win64/meteor-bootstrap-os.windows.x86_64.tar.gz s3://com.meteor.static/packages-bootstrap/"$VERSION"/ &&
+  ./meteor admin make-bootstrap-tarballs --target-arch os.linux.x86_64 "$VERSION" linux64 &&
+  aws s3 cp --acl public-read linux64/meteor-bootstrap-os.linux.x86_64.tar.gz s3://com.meteor.static/packages-bootstrap/"$VERSION"/ &&
+  ./meteor admin make-bootstrap-tarballs --target-arch os.osx.x86_64 "$VERSION" osx &&
+  aws s3 cp --acl public-read osx/meteor-bootstrap-os.osx.x86_64.tar.gz s3://com.meteor.static/packages-bootstrap/"$VERSION"/ &&
+  ./meteor admin make-bootstrap-tarballs --target-arch os.osx.arm64 "$VERSION" osx &&
+  aws s3 cp --acl public-read osx/meteor-bootstrap-os.osx.arm64.tar.gz s3://com.meteor.static/packages-bootstrap/"$VERSION"/ &&
+  aws s3 mb s3://com.meteor.static/packages-bootstrap/"$VERSION"/ &&
+  aws s3 ls s3://com.meteor.static/packages-bootstrap/"$VERSION"
diff --git a/tools/runners/run-all.js b/tools/runners/run-all.js
index 805b81365c..04fa462eff 100644
--- a/tools/runners/run-all.js
+++ b/tools/runners/run-all.js
@@ -14,7 +14,7 @@ const Selenium = require('./run-selenium.js').Selenium;
 const AppRunner = require('./run-app.js').AppRunner;
 const MongoRunner = require('./run-mongo.js').MongoRunner;
 const HMRServer = require('./run-hmr').HMRServer;
-const Updater = require('./run-updater.js').Updater;
+const Updater = require('./run-updater').Updater;
 
 class Runner {
   constructor({
@@ -123,7 +123,7 @@ class Runner {
         hmrPath: HMRPath,
         secret: hmrSecret,
         projectContext: self.projectContext,
-        cordovaServerPort 
+        cordovaServerPort
       });
     }
 
diff --git a/tools/runners/run-app.js b/tools/runners/run-app.js
index d02d044dc5..fbc3b03af5 100644
--- a/tools/runners/run-app.js
+++ b/tools/runners/run-app.js
@@ -947,7 +947,7 @@ Object.assign(AppRunner.prototype, {
       var runResult = self._runOnce({
         onListen: function () {
           if (! self.noRestartBanner && ! firstRun) {
-            runLog.logRestart();
+            runLog.logRestart(self);
             Console.enableProgressDisplay(false);
           }
         },
diff --git a/tools/runners/run-log.js b/tools/runners/run-log.js
index a661f69963..d7a2f812f6 100644
--- a/tools/runners/run-log.js
+++ b/tools/runners/run-log.js
@@ -145,7 +145,7 @@ Object.assign(RunLog.prototype, {
     self.temporaryMessageLength = msg.length;
   },
 
-  logRestart: function () {
+  logRestart: function (options) {
     var self = this;
 
     if (self.consecutiveRestartMessages) {
@@ -159,7 +159,7 @@ Object.assign(RunLog.prototype, {
       self.consecutiveRestartMessages = 1;
     }
 
-    var message = "=> Meteor server restarted";
+    var message = "=> Meteor server restarted at: " + options.rootUrl;
     if (self.consecutiveRestartMessages > 1) {
       message += " (x" + self.consecutiveRestartMessages + ")";
     }
diff --git a/tools/runners/run-updater.js b/tools/runners/run-updater.js
index dac475e9d0..c4a51be525 100644
--- a/tools/runners/run-updater.js
+++ b/tools/runners/run-updater.js
@@ -1,60 +1,52 @@
-var Console = require('../console/console.js').Console;
+import { Console } from '../console/console';
 
-var Updater = function () {
-  var self = this;
-  self.timer = null;
-};
+const CHECK_UPDATE_INTERVAL = 3 * 60 * 60 * 1000; // every 3 hours
 
 // XXX make it take a runLog?
 // XXX need to deal with updater writing messages (bypassing old
 // stdout interception.. maybe it should be global after all..)
-Object.assign(Updater.prototype, {
-  start: function () {
-    var self = this;
+export class Updater {
+  constructor() {
+    this.timer = null;
+  }
 
-    if (self.timer) {
-      throw new Error("already running?");
+  start() {
+    if (this.timer) {
+      throw new Error('already running?');
     }
 
+    const self = this;
     // Check every 3 hours. (Should not share buildmessage state with
     // the main fiber.)
     async function check() {
       self._check();
     }
 
-    self.timer = setInterval(check, 3 * 60 * 60 * 1000);
+    this.timer = setInterval(check, CHECK_UPDATE_INTERVAL);
 
     // Also start a check now, but don't block on it. (This should
     // not share buildmessage state with the main fiber.)
     check();
-  },
+  }
 
-  _check: function () {
-    var self = this;
-    var updater = require('../packaging/updater.js');
+  _check() {
+    const updater = require('../packaging/updater');
     try {
-      updater.tryToDownloadUpdate({showBanner: true});
+      updater.tryToDownloadUpdate({ showBanner: true });
     } catch (e) {
       // oh well, this was the background. Only show errors if we are in debug
       // mode.
-      Console.debug("Error inside updater.");
+      Console.debug('Error inside updater.');
       Console.debug(e.stack);
-      return;
     }
-  },
-
-  // Returns immediately. However if an update check is currently
-  // running it will complete in the background. Idempotent.
-  stop: function () {
-    var self = this;
-
-    if (self.timer) {
-      return;
-    }
-    clearInterval(self.timer);
-    self.timer = null;
   }
-});
 
+  // Returns immediately. However, if an update check is currently
+  // running it will complete in the background. Idempotent.
+  stop() {
+    if (!this.timer) return;
 
-exports.Updater = Updater;
+    clearInterval(this.timer);
+    this.timer = null;
+  }
+}
diff --git a/tools/tests/apps/app-config/.meteor/versions b/tools/tests/apps/app-config/.meteor/versions
index 23b1d17616..e53282cd8f 100644
--- a/tools/tests/apps/app-config/.meteor/versions
+++ b/tools/tests/apps/app-config/.meteor/versions
@@ -57,8 +57,8 @@ standard-minifier-css@1.4.1
 standard-minifier-js@2.3.2
 static-html@1.2.2
 templating-tools@1.1.2
-tracker@1.2.0
-underscore@1.0.10
+tracker@1.2.1
+underscore@1.0.11
 url@1.2.0
 webapp@1.5.0
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/client-refresh/.meteor/versions b/tools/tests/apps/client-refresh/.meteor/versions
index 087c94fa51..eef8816483 100644
--- a/tools/tests/apps/client-refresh/.meteor/versions
+++ b/tools/tests/apps/client-refresh/.meteor/versions
@@ -7,7 +7,7 @@ boilerplate-generator@1.6.0
 caching-compiler@1.2.1
 caching-html-compiler@1.1.3
 callback-hook@1.1.0
-check@1.3.1
+check@1.3.2
 ddp@1.4.0
 ddp-client@2.3.3
 ddp-common@1.4.0
@@ -47,8 +47,8 @@ standard-minifier-js@2.4.1
 static-html@1.2.2
 templating-tools@1.1.2
 test-package@0.0.1
-tracker@1.2.0
+tracker@1.2.1-beta.1
 typescript@3.5.2-beta182.17
-underscore@1.0.10
+underscore@1.0.11-beta.1
 webapp@1.7.4
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/compiler-plugin-static-html-error/.meteor/versions b/tools/tests/apps/compiler-plugin-static-html-error/.meteor/versions
index 2112029aa3..ea9c18baf2 100644
--- a/tools/tests/apps/compiler-plugin-static-html-error/.meteor/versions
+++ b/tools/tests/apps/compiler-plugin-static-html-error/.meteor/versions
@@ -7,7 +7,7 @@ boilerplate-generator@1.6.0
 caching-compiler@1.2.1
 caching-html-compiler@1.1.3
 callback-hook@1.1.0
-check@1.3.1
+check@1.3.2
 ddp@1.4.0
 ddp-client@2.3.3
 ddp-common@1.4.0
@@ -49,7 +49,7 @@ standard-minifier-css@1.5.3
 standard-minifier-js@2.4.1
 static-html@1.2.2
 templating-tools@1.1.2
-tracker@1.2.0
-underscore@1.0.10
+tracker@1.2.1
+underscore@1.0.11
 webapp@1.7.4
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/compiler-plugin-static-html/.meteor/versions b/tools/tests/apps/compiler-plugin-static-html/.meteor/versions
index 2112029aa3..ea9c18baf2 100644
--- a/tools/tests/apps/compiler-plugin-static-html/.meteor/versions
+++ b/tools/tests/apps/compiler-plugin-static-html/.meteor/versions
@@ -7,7 +7,7 @@ boilerplate-generator@1.6.0
 caching-compiler@1.2.1
 caching-html-compiler@1.1.3
 callback-hook@1.1.0
-check@1.3.1
+check@1.3.2
 ddp@1.4.0
 ddp-client@2.3.3
 ddp-common@1.4.0
@@ -49,7 +49,7 @@ standard-minifier-css@1.5.3
 standard-minifier-js@2.4.1
 static-html@1.2.2
 templating-tools@1.1.2
-tracker@1.2.0
-underscore@1.0.10
+tracker@1.2.1
+underscore@1.0.11
 webapp@1.7.4
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/custom-minifier/.meteor/versions b/tools/tests/apps/custom-minifier/.meteor/versions
index 0aacfc62db..99e0fc7d2b 100644
--- a/tools/tests/apps/custom-minifier/.meteor/versions
+++ b/tools/tests/apps/custom-minifier/.meteor/versions
@@ -7,7 +7,7 @@ boilerplate-generator@1.6.0
 caching-compiler@1.2.1
 caching-html-compiler@1.1.3
 callback-hook@1.2.0
-check@1.3.1
+check@1.3.2
 custom-minifier@0.0.1
 ddp@1.4.0
 ddp-client@2.3.3
@@ -45,7 +45,7 @@ socket-stream-client@0.2.2
 spacebars-compiler@1.1.3
 static-html@1.2.2
 templating-tools@1.1.2
-tracker@1.2.0
-underscore@1.0.10
+tracker@1.2.1
+underscore@1.0.11
 webapp@1.7.5
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/dynamic-import/.meteor/packages b/tools/tests/apps/dynamic-import/.meteor/packages
index b74a849e52..1570f6c394 100644
--- a/tools/tests/apps/dynamic-import/.meteor/packages
+++ b/tools/tests/apps/dynamic-import/.meteor/packages
@@ -8,8 +8,8 @@ meteor-base@1.4.0             # Packages every Meteor app needs to have
 mobile-experience@1.1.0       # Packages for a great mobile UX
 mongo@1.9.0                   # The database Meteor supports right now
 blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
-reactive-var@1.0.11            # Reactive variable for tracker
-tracker@1.2.0                 # Meteor's client-side reactive programming library
+reactive-var@1.0.12          # Reactive variable for tracker
+tracker@1.2.1               # Meteor's client-side reactive programming library
 
 standard-minifier-css@1.6.0   # CSS minifier run for production mode
 standard-minifier-js@2.6.0    # JS minifier run for production mode
@@ -23,6 +23,6 @@ dynamic-import@0.5.1
 lazy-test-package
 helper-package
 user:colon-name
-underscore@1.0.10
+underscore@1.0.11
 fetch@0.1.1
 jquery
diff --git a/tools/tests/apps/dynamic-import/.meteor/versions b/tools/tests/apps/dynamic-import/.meteor/versions
index a99df3012b..3872664234 100644
--- a/tools/tests/apps/dynamic-import/.meteor/versions
+++ b/tools/tests/apps/dynamic-import/.meteor/versions
@@ -12,7 +12,7 @@ boilerplate-generator@1.7.0
 caching-compiler@1.2.1
 caching-html-compiler@1.1.3
 callback-hook@1.3.0
-check@1.3.1
+check@1.3.2-beta.1
 coffeescript@2.4.1
 coffeescript-compiler@2.4.1
 ddp@1.4.0
@@ -60,8 +60,8 @@ npm-mongo@3.7.0
 observe-sequence@1.0.16
 ordered-dict@1.1.0
 promise@0.11.2
-random@1.2.0
-reactive-var@1.0.11
+random@1.2.1-beta.1
+reactive-var@1.0.12-beta.1
 reload@1.3.0
 retry@1.1.0
 routepolicy@1.1.0
@@ -75,9 +75,9 @@ templating@1.3.2
 templating-compiler@1.3.3
 templating-runtime@1.3.2
 templating-tools@1.1.2
-tracker@1.2.0
+tracker@1.2.1-beta.1
 ui@1.0.13
-underscore@1.0.10
+underscore@1.0.11-beta.1
 user:colon-name@0.0.1
 webapp@1.9.0
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/ecmascript-regression/.meteor/packages b/tools/tests/apps/ecmascript-regression/.meteor/packages
index ab27ff6225..59cfdb5807 100644
--- a/tools/tests/apps/ecmascript-regression/.meteor/packages
+++ b/tools/tests/apps/ecmascript-regression/.meteor/packages
@@ -7,7 +7,7 @@
 meteor-base@1.5.1             # Packages every Meteor app needs to have
 mobile-experience@1.1.0       # Packages for a great mobile UX
 mongo@1.13.0                   # The database Meteor supports right now
-reactive-var@1.0.11            # Reactive variable for tracker
+reactive-var@1.0.12          # Reactive variable for tracker
 
 standard-minifier-css@1.7.4   # CSS minifier run for production mode
 standard-minifier-js@2.7.0    # JS minifier run for production mode
diff --git a/tools/tests/apps/ecmascript-regression/.meteor/versions b/tools/tests/apps/ecmascript-regression/.meteor/versions
index de86973195..d5985967e1 100644
--- a/tools/tests/apps/ecmascript-regression/.meteor/versions
+++ b/tools/tests/apps/ecmascript-regression/.meteor/versions
@@ -10,7 +10,7 @@ boilerplate-generator@1.7.1
 caching-compiler@1.2.2
 caching-html-compiler@1.2.1
 callback-hook@1.4.0
-check@1.3.1
+check@1.3.2
 ddp@1.4.0
 ddp-client@2.5.0
 ddp-common@1.4.0
@@ -56,10 +56,10 @@ mongo-id@1.0.8
 npm-mongo@3.9.1
 ordered-dict@1.1.0
 promise@0.12.0
-random@1.2.0
+random@1.2.1
 react-fast-refresh@0.1.1
 react-meteor-data@2.3.3
-reactive-var@1.0.11
+reactive-var@1.0.12
 reload@1.3.1
 retry@1.1.0
 routepolicy@1.1.1
@@ -70,9 +70,9 @@ standard-minifier-css@1.7.4
 standard-minifier-js@2.7.1
 static-html@1.3.2
 templating-tools@1.2.1
-tracker@1.2.0
+tracker@1.2.1
 typescript@4.3.5
-underscore@1.0.10
+underscore@1.0.11
 url@1.3.2
 webapp@1.12.0
 webapp-hashing@1.1.0
diff --git a/tools/tests/apps/git-commit-hash/.meteor/versions b/tools/tests/apps/git-commit-hash/.meteor/versions
index a10ed1d9c8..91b9af05b0 100644
--- a/tools/tests/apps/git-commit-hash/.meteor/versions
+++ b/tools/tests/apps/git-commit-hash/.meteor/versions
@@ -33,7 +33,7 @@ standard-minifier-css@1.5.2
 standard-minifier-js@2.4.0
 static-html@1.2.2
 templating-tools@1.1.2
-tracker@1.2.0
-underscore@1.0.10
+tracker@1.2.1
+underscore@1.0.11
 webapp@1.7.3-beta181.16
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/link-config-npm-package/.meteor/versions b/tools/tests/apps/link-config-npm-package/.meteor/versions
index 91816ff622..38888c802f 100644
--- a/tools/tests/apps/link-config-npm-package/.meteor/versions
+++ b/tools/tests/apps/link-config-npm-package/.meteor/versions
@@ -33,7 +33,7 @@ standard-minifier-css@1.4.1
 standard-minifier-js@2.4.0-rc171.6
 static-html@1.2.2
 templating-tools@1.1.2
-tracker@1.2.0
-underscore@1.0.10
+tracker@1.2.1
+underscore@1.0.11
 webapp@1.7.0-rc171.6
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/linked-external-npm-package/.meteor/versions b/tools/tests/apps/linked-external-npm-package/.meteor/versions
index 91816ff622..38888c802f 100644
--- a/tools/tests/apps/linked-external-npm-package/.meteor/versions
+++ b/tools/tests/apps/linked-external-npm-package/.meteor/versions
@@ -33,7 +33,7 @@ standard-minifier-css@1.4.1
 standard-minifier-js@2.4.0-rc171.6
 static-html@1.2.2
 templating-tools@1.1.2
-tracker@1.2.0
-underscore@1.0.10
+tracker@1.2.1
+underscore@1.0.11
 webapp@1.7.0-rc171.6
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/meteor-ignore/.meteor/versions b/tools/tests/apps/meteor-ignore/.meteor/versions
index 2a0c9c4a0e..22056f661d 100644
--- a/tools/tests/apps/meteor-ignore/.meteor/versions
+++ b/tools/tests/apps/meteor-ignore/.meteor/versions
@@ -47,7 +47,7 @@ npm-mongo@2.2.30
 ordered-dict@1.0.9
 promise@0.9.0
 random@1.0.10
-reactive-var@1.0.11
+reactive-var@1.0.12
 reload@1.1.11
 retry@1.0.9
 routepolicy@1.0.12
@@ -58,7 +58,7 @@ standard-minifier-js@2.1.1
 static-html@1.2.2
 templating-tools@1.1.2
 tracker@1.1.3
-underscore@1.0.10
+underscore@1.0.11
 url@1.1.0
 webapp@1.3.19
 webapp-hashing@1.0.9
diff --git a/tools/tests/apps/modules/.meteor/packages b/tools/tests/apps/modules/.meteor/packages
index 2f92a7e262..f139c0b7a7 100644
--- a/tools/tests/apps/modules/.meteor/packages
+++ b/tools/tests/apps/modules/.meteor/packages
@@ -8,9 +8,9 @@ meteor-base@1.4.0             # Packages every Meteor app needs to have
 mobile-experience@1.1.0       # Packages for a great mobile UX
 mongo@1.9.0                   # The database Meteor supports right now
 blaze-html-templates    # Compile .html files into Meteor Blaze views
-session@1.2.0                 # Client-side reactive dictionary for your app
+session@1.2.1               # Client-side reactive dictionary for your app
 jquery                        # Helpful client-side library
-tracker@1.2.0                 # Meteor's client-side reactive programming library
+tracker@1.2.1             # Meteor's client-side reactive programming library
 
 es5-shim@4.8.0                # ECMAScript 5 compatibility for older browsers.
 ecmascript@0.14.2              # Enable ECMAScript2015+ syntax in app code
@@ -23,7 +23,7 @@ client-only-ecmascript
 modules-test-plugin
 shell-server@0.5.0
 dynamic-import@0.5.1
-underscore@1.0.10
+underscore@1.0.11
 import-local-json-module
 akryum:vue-component
 dummy-compiler
diff --git a/tools/tests/apps/standard-app/.meteor/versions b/tools/tests/apps/standard-app/.meteor/versions
index a574733bd2..521ac34984 100644
--- a/tools/tests/apps/standard-app/.meteor/versions
+++ b/tools/tests/apps/standard-app/.meteor/versions
@@ -6,7 +6,7 @@ base64@1.0.11
 binary-heap@1.0.11
 boilerplate-generator@1.6.0
 callback-hook@1.1.0
-check@1.3.1
+check@1.3.2
 ddp@1.4.0
 ddp-client@2.3.3
 ddp-common@1.4.0
@@ -49,7 +49,7 @@ shell-server@0.4.0
 socket-stream-client@0.2.2
 standard-minifier-css@1.5.2
 standard-minifier-js@2.4.0
-tracker@1.2.0
-underscore@1.0.10
+tracker@1.2.1
+underscore@1.0.11
 webapp@1.7.2
 webapp-hashing@1.0.9
diff --git a/tools/tests/old/app-with-private/.meteor/versions b/tools/tests/old/app-with-private/.meteor/versions
index 4a33deb24f..d3261ace0f 100644
--- a/tools/tests/old/app-with-private/.meteor/versions
+++ b/tools/tests/old/app-with-private/.meteor/versions
@@ -47,7 +47,7 @@ npm-mongo@2.2.33
 ordered-dict@1.0.9
 promise@0.10.0
 random@1.0.10
-reactive-var@1.0.11
+reactive-var@1.0.12-beta.1
 reload@1.1.11
 retry@1.0.9
 routepolicy@1.0.12
@@ -58,7 +58,7 @@ standard-minifier-js@2.2.1
 static-html@1.2.2
 templating-tools@1.1.2
 tracker@1.1.3
-underscore@1.0.10
+underscore@1.0.11-beta.1
 url@1.1.0
 webapp@1.4.0
 webapp-hashing@1.0.9
diff --git a/tools/tests/server-restart-port.js b/tools/tests/server-restart-port.js
new file mode 100644
index 0000000000..ef6a985541
--- /dev/null
+++ b/tools/tests/server-restart-port.js
@@ -0,0 +1,25 @@
+import * as selftest from '../tool-testing/selftest';
+
+selftest.define("server outputs port number on restarting", () => testHelper({
+    path: "server/main.js",
+    id: "server/main.js"
+}));
+
+function testHelper(server) {
+  const s = new selftest.Sandbox();
+  s.createApp("myapp", "client-refresh");
+  s.cd("myapp");
+
+  let run = s.run("--port", "21000");
+  run.match("Started proxy");
+  run.waitSecs(15);
+
+  run.match(server.id + " 0");
+
+  s.write(server.path, s.read(server.path).replace(
+    /module.id, (\d+)/,
+    (match, n) => `module.id, ${ ++n }`,
+  ));
+
+  run.match("Meteor server restarted at: http://localhost:21000/");
+}