mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
4
.github/workflows/labeler.yml
vendored
4
.github/workflows/labeler.yml
vendored
@@ -9,6 +9,10 @@ name: Labeler
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
permissions:
|
||||
contents: read # to determine modified files (actions/labeler)
|
||||
pull-requests: write # to add labels to PRs (actions/labeler)
|
||||
|
||||
jobs:
|
||||
label:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -6,6 +6,10 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "npm-packages/eslint-plugin-meteor/**"
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
4
.github/workflows/npm-meteor-babel.yml
vendored
4
.github/workflows/npm-meteor-babel.yml
vendored
@@ -6,6 +6,10 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "npm-packages/meteor-babel/**"
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
4
.github/workflows/npm-meteor-promise.yml
vendored
4
.github/workflows/npm-meteor-promise.yml
vendored
@@ -6,6 +6,10 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "npm-packages/meteor-promise/**"
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -86,6 +86,7 @@ sidebar_categories:
|
||||
Command Line:
|
||||
- commandline
|
||||
- environment-variables
|
||||
- using-core-types
|
||||
Troubleshooting:
|
||||
- expired-certificate
|
||||
- windows
|
||||
|
||||
204
docs/history.md
204
docs/history.md
@@ -1,4 +1,148 @@
|
||||
## v2.8, 2022-08-XX
|
||||
## v2.8.2, 2022-11-29
|
||||
|
||||
#### Highlights
|
||||
* `mongo@1.16.2`:
|
||||
- Make count NOT create a cursor. [PR](https://github.com/meteor/meteor/pull/12326).
|
||||
* `meteorjs/babel@7.16.1-beta.0`
|
||||
- Adjusted config to Auto import React on jsx,tsx files [PR](https://github.com/meteor/meteor/pull/12327).
|
||||
- needs to use directly from npm the meteorjs/babel@7.16.1-beta.0
|
||||
|
||||
#### Breaking Changes
|
||||
N/A
|
||||
|
||||
#### Migration Steps
|
||||
|
||||
#### Meteor Version Release
|
||||
* `mongo@1.16.2`:
|
||||
- Make count NOT create a cursor. [PR](https://github.com/meteor/meteor/pull/12326).
|
||||
* `meteorjs/babel@7.16.1-beta.0`
|
||||
- Adjusted config to Auto import React on jsx,tsx files [PR](https://github.com/meteor/meteor/pull/12327)
|
||||
- needs to use directly from npm the meteorjs/babel@7.16.1-beta.0
|
||||
|
||||
#### Special thanks to
|
||||
- [@henriquealbert](https://github.com/henriquealbert)
|
||||
- [@znewsham](https://github.com/znewsham)
|
||||
|
||||
For making this great framework even better!
|
||||
|
||||
|
||||
## 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
|
||||
* New MongoDB Package Async API. [PR](https://github.com/meteor/meteor/pull/12028)
|
||||
@@ -77,7 +221,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`:
|
||||
@@ -670,7 +814,7 @@ This version should be ignored. Proceed to 2.5.5 above.
|
||||
* Typescript updated to [v4.3.5](https://github.com/Microsoft/TypeScript/releases/tag/v4.3.5)
|
||||
* Email package now allows setting `Email.customTransport` to override sending method.
|
||||
* Use `createIndex` instead of `_ensureIndex` to align with new MongoDB naming.
|
||||
* Apollo skeleton has been upgraded for [Apollo server v3](https://github.com/apollographql/apollo-server/blob/main/CHANGELOG.md#v300)
|
||||
* Apollo skeleton has been upgraded for [Apollo server v3](https://github.com/apollographql/apollo-server/blob/main/CHANGELOG_historical.md#v300)
|
||||
* `reify` has been updated to v0.22.2 which reduces the overhead of `import` statements and some uses of `export ... from`, especially when a module is imported a large number of times or re-exports a large number of exports from other modules. PRs [1](https://github.com/benjamn/reify/pull/246), [2](https://github.com/benjamn/reify/pull/291)
|
||||
* Meteor NPM installer is [now available for all platforms](https://github.com/meteor/meteor/pull/11590).
|
||||
* DDP server now allows you to set publication strategies for your publications to control mergebox behavior
|
||||
@@ -1040,7 +1184,7 @@ This version should be ignored. Proceed to 2.5.5 above.
|
||||
- The undocumented environment variable `DDP_DEFAULT_CONNECTION_URL` behavior has changed. Setting `DDP_DEFAULT_CONNECTION_URL` when running the server (development: `meteor run` or production: `node main.js`) sets the default DDP server value for meteor. But this did not work for `cordova` apps. Now you can define the `cordova` app default DDP server value by setting `DDP_DEFAULT_CONNECTION_URL` when building (`meteor build`).
|
||||
- Skeletons dependencies updated to latest version
|
||||
- Svelte skeleton now has HMR
|
||||
- New deploy option: `--build-only`. Helpful if you want to build first and after some validations proceeding with the upload and deploy. [Read more](https://cloud-guide.meteor.com/deploy-guide.html#cache-only)
|
||||
- New deploy option: `--build-only`. Helpful if you want to build first and after some validations proceeding with the upload and deploy. [Read more](https://galaxy-guide.meteor.com/deploy-command-line.html#cache-only)
|
||||
- Improved watched system to properly rebuild `client` even when a file is outside of `client` or `imports` folders. See [PR](https://github.com/meteor/meteor/pull/11474) for details.
|
||||
- Fix an issue when `App.appendToConfig` crashed Cordova build.
|
||||
- Reify compiler now uses cache in runtime. [Read more](https://github.com/meteor/meteor/pull/11400)
|
||||
@@ -1528,7 +1672,7 @@ N/A
|
||||
|
||||
* `meteor create --vue` is now available thanks to [@chris-visser](https://github.com/chris-visser). PR [#11086](https://github.com/meteor/meteor/pull/11086)
|
||||
|
||||
* `--cache-build` option is now available on `meteor deploy` command and you can use it safely all the time if you are using a Git repository to run your deploy. This is helpful if your upload is failing then you can retry just the upload and also if you deploy the same bundle to multiple environments. [Read more](https://cloud-guide.meteor.com/deploy-guide.html#cache-build).
|
||||
* `--cache-build` option is now available on `meteor deploy` command and you can use it safely all the time if you are using a Git repository to run your deploy. This is helpful if your upload is failing then you can retry just the upload and also if you deploy the same bundle to multiple environments. [Read more](https://galaxy-guide.meteor.com/deploy-command-line.html#cache-build)
|
||||
|
||||
* Multiple optimizations in build performance, many of them for Windows thanks to [@zodern](https://github.com/zodern). PRs [#10838](https://github.com/meteor/meteor/pull/10838), [#11114](https://github.com/meteor/meteor/pull/11114), [#11115](https://github.com/meteor/meteor/pull/11115), [#11102](https://github.com/meteor/meteor/pull/11102), [#10839](https://github.com/meteor/meteor/pull/10839)
|
||||
|
||||
@@ -3910,9 +4054,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 +4400,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 +4498,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 +4511,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 +4538,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 +4627,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 +5207,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
|
||||
|
||||
|
||||
@@ -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: <username> }, password: <password> }`,or `{ user: { email: <email> }, password: <password> }`.
|
||||
|
||||
The login handler should return `undefined` if it's not going to handle the login request or else the login result object.
|
||||
|
||||
<h2 id="accounts_rate_limit">Rate Limiting</h2>
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ prior to being upgraded to TLS/SSL (using `STARTTLS`) typically use port 587
|
||||
(and _sometimes_ 25) and should use `smtp://`. For more information see the
|
||||
[Nodemailer docs](https://nodemailer.com/smtp/)
|
||||
|
||||
Second, if you are using a one of the [supported services](https://nodemailer.com/smtp/well-known/#supported-services)
|
||||
you can setup the sending options in your app settings like this:
|
||||
Second, if you are using a one of the [supported services](https://community.nodemailer.com/smtp/well-known/#supported-services) you can setup the sending options in your app settings like this:
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
39
docs/source/using-core-types.md
Normal file
39
docs/source/using-core-types.md
Normal file
@@ -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).
|
||||
@@ -157,7 +157,7 @@ As `callAsync` returns a promise, it'll be solved in the future. So you need to
|
||||
|
||||
It's also important to understand what will happen if you call an async method with `Meteor.call`, and vice versa.
|
||||
|
||||
If you can an async method with `Meteor.call` in the client, and you don't have the package `insecure` on your project, an error like this will be thrown:
|
||||
If you call an async method with `Meteor.call` in the client, and you don't have the package `insecure` on your project, an error like this will be thrown:
|
||||
|
||||
<img src="images/live-data-error.png">
|
||||
|
||||
|
||||
2
meteor
2
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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# eslint-config-meteor
|
||||
# @meteorjs/eslint-config-meteor
|
||||
|
||||
This is an [ESLint](https://eslint.org) configuration for [Meteor](https://www.meteor.com) apps which implements the recommendations from the [Meteor Guide](https://guide.meteor.com/)'s section on [Code style](https://guide.meteor.com/code-style.html#eslint).
|
||||
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
module.exports = {
|
||||
parser: 'babel-eslint',
|
||||
parserOptions: {
|
||||
allowImportExportEverywhere: true
|
||||
allowImportExportEverywhere: true,
|
||||
},
|
||||
env: {
|
||||
node: true,
|
||||
browser: true
|
||||
browser: true,
|
||||
},
|
||||
plugins: [
|
||||
'meteor'
|
||||
],
|
||||
extends: [
|
||||
'airbnb',
|
||||
'plugin:meteor/recommended'
|
||||
],
|
||||
plugins: ['meteor'],
|
||||
extends: ['airbnb', 'plugin:meteor/recommended'],
|
||||
settings: {
|
||||
'import/resolver': 'meteor'
|
||||
'import/resolver': 'meteor',
|
||||
},
|
||||
rules: {
|
||||
'react/jsx-filename-extension': 0,
|
||||
@@ -30,24 +25,21 @@ module.exports = {
|
||||
'no-underscore-dangle': [
|
||||
'error',
|
||||
{
|
||||
allow: [
|
||||
'_id',
|
||||
'_ensureIndex'
|
||||
]
|
||||
}
|
||||
allow: ['_id', '_ensureIndex'],
|
||||
},
|
||||
],
|
||||
'object-shorthand': [
|
||||
'error',
|
||||
'always',
|
||||
{
|
||||
avoidQuotes: false
|
||||
}
|
||||
avoidQuotes: false,
|
||||
},
|
||||
],
|
||||
|
||||
'space-before-function-paren': 0,
|
||||
|
||||
|
||||
// for Meteor API's that rely on `this` context, e.g. Template.onCreated and publications
|
||||
'func-names': 0,
|
||||
'prefer-arrow-callback': 0
|
||||
}
|
||||
'prefer-arrow-callback': 0,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/meteor/eslint-config-meteor.git"
|
||||
"url": "git+https://github.com/meteor/meteor.git"
|
||||
},
|
||||
"author": "David Burles",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/meteor/eslint-config-meteor/issues"
|
||||
"url": "https://github.com/meteor/meteor/issues"
|
||||
},
|
||||
"homepage": "https://github.com/meteor/eslint-config-meteor#readme",
|
||||
"homepage": "https://github.com/meteor/meteor/tree/devel/npm-packages/eslint-config-meteor#readme",
|
||||
"peerDependencies": {
|
||||
"babel-eslint": ">= 7",
|
||||
"eslint": ">= 3",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,7 +15,7 @@ var packageJson = {
|
||||
"node-gyp": "8.0.0",
|
||||
"node-pre-gyp": "0.15.0",
|
||||
typescript: "4.5.4",
|
||||
"@meteorjs/babel": "7.16.0-beta.1",
|
||||
"@meteorjs/babel": "7.16.1-beta.0",
|
||||
// Keep the versions of these packages consistent with the versions
|
||||
// found in dev-bundle-server-package.js.
|
||||
"meteor-promise": "0.9.0",
|
||||
|
||||
@@ -80,7 +80,11 @@ exports.getDefaults = function getDefaults(features) {
|
||||
|
||||
function maybeAddReactPlugins(features, options) {
|
||||
if (features && features.react) {
|
||||
options.presets.push(require("@babel/preset-react"));
|
||||
options.presets.push(
|
||||
[require("@babel/preset-react"), {
|
||||
runtime: "automatic"
|
||||
}]
|
||||
);
|
||||
options.plugins.push(
|
||||
[require("@babel/plugin-proposal-class-properties"), {
|
||||
loose: true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@meteorjs/babel",
|
||||
"author": "Meteor <dev@meteor.com>",
|
||||
"version": "7.16.0-beta.1",
|
||||
"version": "7.16.1-beta.0",
|
||||
"license": "MIT",
|
||||
"description": "Babel wrapper package for use with Meteor",
|
||||
"keywords": [
|
||||
|
||||
@@ -14,6 +14,8 @@ npm install -g meteor
|
||||
|
||||
| NPM Package | Meteor Official Release |
|
||||
|-------------|-------------------------|
|
||||
| 2.8.2 | 2.8.1 |
|
||||
| 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 +59,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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -143,6 +143,17 @@ try {
|
||||
|
||||
download();
|
||||
|
||||
function generateProxyAgent() {
|
||||
const proxyUrl = process.env.https_proxy || process.env.HTTPS_PROXY;
|
||||
if (!proxyUrl) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const HttpsProxyAgent = require('https-proxy-agent');
|
||||
|
||||
return new HttpsProxyAgent(proxyUrl);
|
||||
}
|
||||
|
||||
function download() {
|
||||
const start = Date.now();
|
||||
const downloadProgress = new cliProgress.SingleBar(
|
||||
@@ -158,6 +169,9 @@ function download() {
|
||||
retry: { maxRetries: 5, delay: 5000 },
|
||||
override: true,
|
||||
fileName: tarGzName,
|
||||
httpsRequestOptions: {
|
||||
agent: generateProxyAgent()
|
||||
}
|
||||
});
|
||||
|
||||
dl.on('progress', ({ progress }) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meteor",
|
||||
"version": "2.8.0",
|
||||
"version": "2.8.2",
|
||||
"description": "Install Meteor",
|
||||
"main": "install.js",
|
||||
"scripts": {
|
||||
@@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"7zip-bin": "^5.2.0",
|
||||
"cli-progress": "^3.11.1",
|
||||
"https-proxy-agent": "^5.0.1",
|
||||
"node-7z": "^2.1.2",
|
||||
"node-downloader-helper": "^1.0.19",
|
||||
"rimraf": "^3.0.2",
|
||||
|
||||
326
packages/accounts-base/accounts-base.d.ts
vendored
Normal file
326
packages/accounts-base/accounts-base.d.ts
vendored
Normal file
@@ -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<string, unknown>,
|
||||
extraParams?: Record<string, unknown>
|
||||
): void;
|
||||
|
||||
function sendResetPasswordEmail(
|
||||
userId: string,
|
||||
email?: string,
|
||||
extraTokenData?: Record<string, unknown>,
|
||||
extraParams?: Record<string, unknown>
|
||||
): void;
|
||||
|
||||
function sendVerificationEmail(
|
||||
userId: string,
|
||||
email?: string,
|
||||
extraTokenData?: Record<string, unknown>,
|
||||
extraParams?: Record<string, unknown>
|
||||
): 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<T>(
|
||||
userId: string,
|
||||
token: HashedStampedLoginToken,
|
||||
query?: Mongo.Selector<T> | Mongo.ObjectID | string
|
||||
): void;
|
||||
function _hashLoginToken(token: string): string;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
3
packages/accounts-base/package-types.json
Normal file
3
packages/accounts-base/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "accounts-base.d.ts"
|
||||
}
|
||||
@@ -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 => {
|
||||
|
||||
@@ -5,7 +5,7 @@ Package.describe({
|
||||
});
|
||||
|
||||
Npm.depends({
|
||||
'@meteorjs/babel': '7.16.0-beta.1',
|
||||
'@meteorjs/babel': '7.16.1-beta.0',
|
||||
'json5': '2.1.1'
|
||||
});
|
||||
|
||||
|
||||
38
packages/browser-policy-common/browser-policy-common.d.ts
vendored
Normal file
38
packages/browser-policy-common/browser-policy-common.d.ts
vendored
Normal file
@@ -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;
|
||||
};
|
||||
}
|
||||
3
packages/browser-policy-common/package-types.json
Normal file
3
packages/browser-policy-common/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "browser-policy-common.d.ts"
|
||||
}
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
92
packages/check/check.d.ts
vendored
Normal file
92
packages/check/check.d.ts
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* The namespace for all Match types and methods.
|
||||
*/
|
||||
export namespace Match {
|
||||
interface Matcher<T> {
|
||||
_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<any>;
|
||||
// prettier-ignore
|
||||
export type PatternMatch<T extends Pattern> =
|
||||
T extends Matcher<infer U> ? 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[0]>[] :
|
||||
T extends {[key: string]: Pattern} ? {[K in keyof T]: PatternMatch<T[K]>} :
|
||||
unknown;
|
||||
|
||||
/** Matches any value. */
|
||||
var Any: Matcher<any>;
|
||||
/** Matches a signed 32-bit integer. Doesn’t match `Infinity`, `-Infinity`, or `NaN`. */
|
||||
var Integer: Matcher<number>;
|
||||
|
||||
/**
|
||||
* 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<T extends Pattern>(
|
||||
pattern: T
|
||||
): Matcher<PatternMatch<T> | 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<T extends Pattern>(
|
||||
pattern: T
|
||||
): Matcher<PatternMatch<T> | undefined>;
|
||||
|
||||
/** Matches an Object with the given keys; the value may also have other keys with arbitrary values. */
|
||||
function ObjectIncluding<T extends { [key: string]: Pattern }>(
|
||||
dico: T
|
||||
): Matcher<PatternMatch<T>>;
|
||||
|
||||
/** Matches any value that matches at least one of the provided patterns. */
|
||||
function OneOf<T extends Pattern[]>(
|
||||
...patterns: T
|
||||
): Matcher<PatternMatch<T[number]>>;
|
||||
|
||||
/**
|
||||
* 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<T>(condition: (val: any) => val is T): Matcher<T>;
|
||||
function Where(condition: (val: any) => boolean): Matcher<any>;
|
||||
|
||||
/**
|
||||
* Returns true if the value matches the pattern.
|
||||
* @param value The value to check
|
||||
* @param pattern The pattern to match `value` against
|
||||
*/
|
||||
function test<T extends Pattern>(
|
||||
value: any,
|
||||
pattern: T
|
||||
): value is PatternMatch<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<T extends Match.Pattern>(
|
||||
value: any,
|
||||
pattern: T
|
||||
): asserts value is Match.PatternMatch<T>;
|
||||
3
packages/check/package-types.json
Normal file
3
packages/check/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "check.d.ts"
|
||||
}
|
||||
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Package.describe({
|
||||
summary: "Meteor's latency-compensated distributed data client",
|
||||
version: '2.6.0',
|
||||
version: '2.6.1',
|
||||
documentation: null
|
||||
});
|
||||
|
||||
|
||||
17
packages/ddp-rate-limiter/ddp-rate-limiter.d.ts
vendored
Normal file
17
packages/ddp-rate-limiter/ddp-rate-limiter.d.ts
vendored
Normal file
@@ -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;
|
||||
}
|
||||
3
packages/ddp-rate-limiter/package-types.json
Normal file
3
packages/ddp-rate-limiter/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "ddp-rate-limiter.d.ts"
|
||||
}
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
65
packages/ddp/ddp.d.ts
vendored
Normal file
65
packages/ddp/ddp.d.ts
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
3
packages/ddp/package-types.json
Normal file
3
packages/ddp/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "ddp.d.ts"
|
||||
}
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
]);
|
||||
|
||||
|
||||
@@ -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]);
|
||||
});
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
});
|
||||
|
||||
71
packages/ejson/ejson.d.ts
vendored
Normal file
71
packages/ejson/ejson.d.ts
vendored
Normal file
@@ -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<T>(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;
|
||||
}
|
||||
3
packages/ejson/package-types.json
Normal file
3
packages/ejson/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "ejson.d.ts"
|
||||
}
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
44
packages/email/email.d.ts
vendored
Normal file
44
packages/email/email.d.ts
vendored
Normal file
@@ -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;
|
||||
}
|
||||
3
packages/email/package-types.json
Normal file
3
packages/email/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "email.d.ts"
|
||||
}
|
||||
@@ -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 });
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}` +
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Package.describe({
|
||||
summary: "Facebook OAuth flow",
|
||||
version: "1.11.0"
|
||||
version: '1.11.1'
|
||||
});
|
||||
|
||||
Package.onUse(api => {
|
||||
|
||||
@@ -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});
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
|
||||
4
packages/fetch/fetch.d.ts
vendored
Normal file
4
packages/fetch/fetch.d.ts
vendored
Normal file
@@ -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;
|
||||
3
packages/fetch/package-types.json
Normal file
3
packages/fetch/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "fetch.d.ts"
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
14
packages/hot-module-replacement/hot-module-replacement.d.ts
vendored
Normal file
14
packages/hot-module-replacement/hot-module-replacement.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export interface Module {
|
||||
readonly hot?: {
|
||||
accept(): void;
|
||||
decline(): void;
|
||||
dispose(callback: (data: object) => void): void;
|
||||
data: object | null;
|
||||
onRequire<T>(callbacks: {
|
||||
before?(requiredModule: Module, parentId: string): T;
|
||||
after?(requiredModule: Module, data: T): void;
|
||||
}): void;
|
||||
};
|
||||
}
|
||||
|
||||
export declare var module: NodeJS.Module;
|
||||
3
packages/hot-module-replacement/package-types.json
Normal file
3
packages/hot-module-replacement/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "hot-module-replacement.d.ts"
|
||||
}
|
||||
@@ -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 });
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Package.describe({
|
||||
summary: 'The Meteor command-line tool',
|
||||
version: '2.8.0',
|
||||
version: '2.8.2',
|
||||
});
|
||||
|
||||
Package.includeTool();
|
||||
|
||||
504
packages/meteor/meteor.d.ts
vendored
Normal file
504
packages/meteor/meteor.d.ts
vendored
Normal file
@@ -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>;
|
||||
/** 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<EJSONable | EJSONableProperty>,
|
||||
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<TFunc extends Function>(func: TFunc): TFunc;
|
||||
|
||||
class EnvironmentVariable<T> {
|
||||
readonly slot: number;
|
||||
constructor();
|
||||
get(): T;
|
||||
getOrNullIfOutsideFiber(): T | null;
|
||||
withValue<U>(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<string> | 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<ExternalService>(
|
||||
options?: {
|
||||
requestPermissions?: ReadonlyArray<string> | 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 **/
|
||||
}
|
||||
3
packages/meteor/package-types.json
Normal file
3
packages/meteor/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "meteor.d.ts"
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
4
packages/modern-browsers/modern.d.ts
vendored
Normal file
4
packages/modern-browsers/modern.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare function setMinimumBrowserVersions(
|
||||
versions: Record<string, number | number[]>,
|
||||
source: string
|
||||
): void;
|
||||
3
packages/modern-browsers/package-types.json
Normal file
3
packages/modern-browsers/package-types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "modern.d.ts"
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
12
packages/modules-runtime/errors/cannotFindMeteorPackage.js
Normal file
12
packages/modules-runtime/errors/cannotFindMeteorPackage.js
Normal file
@@ -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 + '".'
|
||||
);
|
||||
};
|
||||
46
packages/modules-runtime/errors/importsErrors.js
Normal file
46
packages/modules-runtime/errors/importsErrors.js
Normal file
@@ -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
|
||||
};
|
||||
};
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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'");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -28,7 +28,7 @@ makeInstallerOptions.fallback = function (id, parentId, error) {
|
||||
return Npm.require(id, error);
|
||||
}
|
||||
}
|
||||
|
||||
verifyErrors(id, parentId, error);
|
||||
throw error;
|
||||
};
|
||||
|
||||
|
||||
34
packages/modules-runtime/verifyErrors.js
Normal file
34
packages/modules-runtime/verifyErrors.js
Normal file
@@ -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;
|
||||
}
|
||||
};
|
||||
BIN
packages/modules/module-system.png
Normal file
BIN
packages/modules/module-system.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
@@ -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) {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
|
||||
var MongoDB = NpmModuleMongodb;
|
||||
|
||||
Tinytest.add(
|
||||
'collection - call Mongo.Collection without new',
|
||||
function (test) {
|
||||
@@ -167,8 +170,8 @@ Tinytest.add('collection - calling find with a valid readPreference',
|
||||
);
|
||||
|
||||
// Trigger the creation of _synchronousCursor
|
||||
defaultCursor.count();
|
||||
customCursor.count();
|
||||
defaultCursor.fetch();
|
||||
customCursor.fetch();
|
||||
|
||||
// defaultCursor._synchronousCursor._dbCursor.operation is not an option anymore
|
||||
// as the cursor options are now private
|
||||
@@ -203,3 +206,211 @@ 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({});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Tinytest.add('collection - count should release the session',
|
||||
function(test) {
|
||||
const client = MongoInternals.defaultRemoteCollectionDriver().mongo.client;
|
||||
var collectionName = 'count' + test.id;
|
||||
var collection = new Mongo.Collection(collectionName);
|
||||
collection.insert({ _id: '1' });
|
||||
collection.insert({ _id: '2' });
|
||||
collection.insert({ _id: '3' });
|
||||
const preCount = client.s.activeSessions.size;
|
||||
|
||||
test.equal(collection.find().count(), 3);
|
||||
|
||||
// options and selector still work
|
||||
test.equal(collection.find({ _id: { $ne: '1' } }, { skip: 1 }).count(), 1);
|
||||
|
||||
// cursor reuse
|
||||
const cursor1 = collection.find({ _id: { $ne: '1' } }, { skip: 1 });
|
||||
test.equal(cursor1.count(), 1);
|
||||
test.equal(cursor1.fetch().length, 1);
|
||||
|
||||
const cursor2 = collection.find({ _id: { $ne: '1' } }, { skip: 1 });
|
||||
test.equal(cursor2.fetch().length, 1);
|
||||
test.equal(cursor2.count(), 1);
|
||||
|
||||
const postCount = client.s.activeSessions.size;
|
||||
test.equal(preCount, postCount);
|
||||
}
|
||||
);
|
||||
|
||||
598
packages/mongo/mongo.d.ts
vendored
Normal file
598
packages/mongo/mongo.d.ts
vendored
Normal file
@@ -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, K extends keyof any> = T extends T
|
||||
? Pick<T, Exclude<keyof T, K>>
|
||||
: 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<T> = {
|
||||
$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<T> | undefined;
|
||||
$expr?: FieldExpression<T> | 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<T> : FieldExpression<T> | undefined;
|
||||
$size?: number | undefined;
|
||||
$bitsAllClear?: any;
|
||||
$bitsAllSet?: any;
|
||||
$bitsAnyClear?: any;
|
||||
$bitsAnySet?: any;
|
||||
$comment?: string | undefined;
|
||||
};
|
||||
|
||||
type Flatten<T> = T extends any[] ? T[0] : T;
|
||||
|
||||
type Query<T> = {
|
||||
[P in keyof T]?: Flatten<T[P]> | RegExp | FieldExpression<Flatten<T[P]>>;
|
||||
} & {
|
||||
$or?: Query<T>[] | undefined;
|
||||
$and?: Query<T>[] | undefined;
|
||||
$nor?: Query<T>[] | undefined;
|
||||
} & Dictionary<any>;
|
||||
|
||||
type QueryWithModifiers<T> = {
|
||||
$query: Query<T>;
|
||||
$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<T> = Query<T> | QueryWithModifiers<T>;
|
||||
|
||||
type Dictionary<T> = { [key: string]: T };
|
||||
type PartialMapTo<T, M> = Partial<Record<keyof T, M>>;
|
||||
type OnlyArrays<T> = T extends any[] ? T : never;
|
||||
type OnlyElementsOfArrays<T> = T extends any[] ? Partial<T[0]> : never;
|
||||
type ElementsOf<T> = {
|
||||
[P in keyof T]?: OnlyElementsOfArrays<T[P]>;
|
||||
};
|
||||
type PushModifier<T> = {
|
||||
[P in keyof T]?:
|
||||
| OnlyElementsOfArrays<T[P]>
|
||||
| {
|
||||
$each?: T[P] | undefined;
|
||||
$position?: number | undefined;
|
||||
$slice?: number | undefined;
|
||||
$sort?: 1 | -1 | Dictionary<number> | undefined;
|
||||
};
|
||||
};
|
||||
type ArraysOrEach<T> = {
|
||||
[P in keyof T]?: OnlyElementsOfArrays<T[P]> | { $each: T[P] };
|
||||
};
|
||||
type CurrentDateModifier = { $type: 'timestamp' | 'date' } | true;
|
||||
type Modifier<T> =
|
||||
| T
|
||||
| {
|
||||
$currentDate?:
|
||||
| (Partial<Record<keyof T, CurrentDateModifier>> &
|
||||
Dictionary<CurrentDateModifier>)
|
||||
| undefined;
|
||||
$inc?: (PartialMapTo<T, number> & Dictionary<number>) | undefined;
|
||||
$min?:
|
||||
| (PartialMapTo<T, Date | number> & Dictionary<Date | number>)
|
||||
| undefined;
|
||||
$max?:
|
||||
| (PartialMapTo<T, Date | number> & Dictionary<Date | number>)
|
||||
| undefined;
|
||||
$mul?: (PartialMapTo<T, number> & Dictionary<number>) | undefined;
|
||||
$rename?: (PartialMapTo<T, string> & Dictionary<string>) | undefined;
|
||||
$set?: (Partial<T> & Dictionary<any>) | undefined;
|
||||
$setOnInsert?: (Partial<T> & Dictionary<any>) | undefined;
|
||||
$unset?:
|
||||
| (PartialMapTo<T, string | boolean | 1 | 0> & Dictionary<any>)
|
||||
| undefined;
|
||||
$addToSet?: (ArraysOrEach<T> & Dictionary<any>) | undefined;
|
||||
$push?: (PushModifier<T> & Dictionary<any>) | undefined;
|
||||
$pull?: (ElementsOf<T> & Dictionary<any>) | undefined;
|
||||
$pullAll?: (Partial<T> & Dictionary<any>) | undefined;
|
||||
$pop?: (PartialMapTo<T, 1 | -1> & Dictionary<1 | -1>) | undefined;
|
||||
};
|
||||
|
||||
type OptionalId<TSchema> = UnionOmit<TSchema, '_id'> & { _id?: any };
|
||||
|
||||
interface SortSpecifier {}
|
||||
interface FieldSpecifier {
|
||||
[id: string]: Number;
|
||||
}
|
||||
|
||||
type Transform<T> = ((doc: T) => any) | null | undefined;
|
||||
|
||||
type Options<T> = {
|
||||
/** 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<T> | undefined;
|
||||
};
|
||||
|
||||
type DispatchTransform<Transform, T, U> = Transform extends (
|
||||
...args: any
|
||||
) => any
|
||||
? ReturnType<Transform>
|
||||
: 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 <T extends MongoNpmModule.Document, U = T>(
|
||||
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<T, U>;
|
||||
}
|
||||
interface Collection<T extends MongoNpmModule.Document, U = T> {
|
||||
allow<Fn extends Transform<T> = undefined>(options: {
|
||||
insert?:
|
||||
| ((userId: string, doc: DispatchTransform<Fn, T, U>) => boolean)
|
||||
| undefined;
|
||||
update?:
|
||||
| ((
|
||||
userId: string,
|
||||
doc: DispatchTransform<Fn, T, U>,
|
||||
fieldNames: string[],
|
||||
modifier: any
|
||||
) => boolean)
|
||||
| undefined;
|
||||
remove?:
|
||||
| ((userId: string, doc: DispatchTransform<Fn, T, U>) => boolean)
|
||||
| undefined;
|
||||
fetch?: string[] | undefined;
|
||||
transform?: Fn | undefined;
|
||||
}): boolean;
|
||||
createCappedCollectionAsync(
|
||||
byteSize?: number,
|
||||
maxDocuments?: number
|
||||
): Promise<void>;
|
||||
createIndex(
|
||||
indexSpec: IndexSpecification,
|
||||
options?: CreateIndexesOptions
|
||||
): void;
|
||||
createIndexAsync(
|
||||
indexSpec: IndexSpecification,
|
||||
options?: CreateIndexesOptions
|
||||
): Promise<void>;
|
||||
deny<Fn extends Transform<T> = undefined>(options: {
|
||||
insert?:
|
||||
| ((userId: string, doc: DispatchTransform<Fn, T, U>) => boolean)
|
||||
| undefined;
|
||||
update?:
|
||||
| ((
|
||||
userId: string,
|
||||
doc: DispatchTransform<Fn, T, U>,
|
||||
fieldNames: string[],
|
||||
modifier: any
|
||||
) => boolean)
|
||||
| undefined;
|
||||
remove?:
|
||||
| ((userId: string, doc: DispatchTransform<Fn, T, U>) => boolean)
|
||||
| undefined;
|
||||
fetch?: string[] | undefined;
|
||||
transform?: Fn | undefined;
|
||||
}): boolean;
|
||||
dropCollectionAsync(): Promise<void>;
|
||||
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<T> | ObjectID | string): Cursor<T, U>;
|
||||
/**
|
||||
* Find the documents in a collection that match the selector.
|
||||
* @param selector A query describing the documents to find
|
||||
*/
|
||||
find<O extends Options<T>>(
|
||||
selector?: Selector<T> | ObjectID | string,
|
||||
options?: O
|
||||
): Cursor<T, DispatchTransform<O['transform'], T, U>>;
|
||||
/**
|
||||
* 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<T> | 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<O extends Omit<Options<T>, 'limit'>>(
|
||||
selector?: Selector<T> | ObjectID | string,
|
||||
options?: O
|
||||
): DispatchTransform<O['transform'], T, 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
|
||||
*/
|
||||
findOneAsync(
|
||||
selector?: Selector<T> | ObjectID | string
|
||||
): Promise<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
|
||||
*/
|
||||
findOneAsync<O extends Omit<Options<T>, 'limit'>>(
|
||||
selector?: Selector<T> | ObjectID | string,
|
||||
options?: O
|
||||
): Promise<DispatchTransform<O['transform'], T, U> | 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<T>, 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<T>, callback?: Function): Promise<string>;
|
||||
/**
|
||||
* 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<T>;
|
||||
/**
|
||||
* 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<T> | 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<T> | ObjectID | string,
|
||||
callback?: Function
|
||||
): Promise<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.
|
||||
*/
|
||||
update(
|
||||
selector: Selector<T> | ObjectID | string,
|
||||
modifier: Modifier<T>,
|
||||
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<T> | ObjectID | string,
|
||||
modifier: Modifier<T>,
|
||||
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<number>;
|
||||
/**
|
||||
* 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<T> | ObjectID | string,
|
||||
modifier: Modifier<T>,
|
||||
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<T> | ObjectID | string,
|
||||
modifier: Modifier<T>,
|
||||
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<void>;
|
||||
_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 <T, U = T>(): Cursor<T, U>;
|
||||
}
|
||||
interface ObserveCallbacks<T> {
|
||||
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<T> {
|
||||
added?(id: string, fields: Partial<T>): void;
|
||||
addedBefore?(id: string, fields: Partial<T>, before: T | null): void;
|
||||
changed?(id: string, fields: Partial<T>): void;
|
||||
movedBefore?(id: string, before: T | null): void;
|
||||
removed?(id: string): void;
|
||||
}
|
||||
interface Cursor<T, U = T> {
|
||||
/**
|
||||
* 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<number>;
|
||||
/**
|
||||
* Return all matching documents as an Array.
|
||||
*/
|
||||
fetch(): Array<U>;
|
||||
/**
|
||||
* Return all matching documents as an Array.
|
||||
*/
|
||||
fetchAsync(): Promise<Array<U>>;
|
||||
/**
|
||||
* 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 <em>cursor</em> itself.
|
||||
* @param thisArg An object which will be the value of `this` inside `callback`.
|
||||
*/
|
||||
forEach(
|
||||
callback: (doc: U, index: number, cursor: Cursor<T, U>) => 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 <em>cursor</em> itself.
|
||||
* @param thisArg An object which will be the value of `this` inside `callback`.
|
||||
*/
|
||||
forEachAsync(
|
||||
callback: (doc: U, index: number, cursor: Cursor<T, U>) => void,
|
||||
thisArg?: any
|
||||
): Promise<void>;
|
||||
/**
|
||||
* 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 <em>cursor</em> itself.
|
||||
* @param thisArg An object which will be the value of `this` inside `callback`.
|
||||
*/
|
||||
map<M>(
|
||||
callback: (doc: U, index: number, cursor: Cursor<T, U>) => M,
|
||||
thisArg?: any
|
||||
): Array<M>;
|
||||
/**
|
||||
* 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 <em>cursor</em> itself.
|
||||
* @param thisArg An object which will be the value of `this` inside `callback`.
|
||||
*/
|
||||
mapAsync<M>(
|
||||
callback: (doc: U, index: number, cursor: Cursor<T, U>) => M,
|
||||
thisArg?: any
|
||||
): Promise<Array<M>>;
|
||||
/**
|
||||
* 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<U>): 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<T>,
|
||||
options?: { nonMutatingCallbacks?: boolean | undefined }
|
||||
): Meteor.LiveQueryHandle;
|
||||
[Symbol.iterator](): Iterator<T, never, never>;
|
||||
[Symbol.asyncIterator](): AsyncIterator<T, never, never>;
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
@@ -900,11 +907,24 @@ function setupSynchronousCursor(cursor, method) {
|
||||
return cursor._synchronousCursor;
|
||||
}
|
||||
|
||||
|
||||
Cursor.prototype.count = function () {
|
||||
const collection = this._mongo.rawCollection(this._cursorDescription.collectionName);
|
||||
return Promise.await(collection.countDocuments(
|
||||
replaceTypes(this._cursorDescription.selector, replaceMeteorAtomWithMongo),
|
||||
replaceTypes(this._cursorDescription.options, replaceMeteorAtomWithMongo),
|
||||
));
|
||||
};
|
||||
|
||||
[...ASYNC_CURSOR_METHODS, Symbol.iterator, Symbol.asyncIterator].forEach(methodName => {
|
||||
Cursor.prototype[methodName] = function (...args) {
|
||||
const cursor = setupSynchronousCursor(this, methodName);
|
||||
return cursor[methodName](...args);
|
||||
};
|
||||
// count is handled specially since we don't want to create a cursor.
|
||||
// it is still included in ASYNC_CURSOR_METHODS because we still want an async version of it to exist.
|
||||
if (methodName !== 'count') {
|
||||
Cursor.prototype[methodName] = function (...args) {
|
||||
const cursor = setupSynchronousCursor(this, methodName);
|
||||
return cursor[methodName](...args);
|
||||
};
|
||||
}
|
||||
|
||||
// These methods are handled separately.
|
||||
if (methodName === Symbol.iterator || methodName === Symbol.asyncIterator) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
Package.describe({
|
||||
summary: "Adaptor for using MongoDB and Minimongo over DDP",
|
||||
version: '1.16.0'
|
||||
version: '1.16.2'
|
||||
});
|
||||
|
||||
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
|
||||
|
||||
3
packages/mongo/package.types.json
Normal file
3
packages/mongo/package.types.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typesEntry": "mongo.d.ts"
|
||||
}
|
||||
@@ -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
|
||||
|
||||
20
packages/non-core/less/tests/top-cdn-file.import.less
vendored
Normal file
20
packages/non-core/less/tests/top-cdn-file.import.less
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
FILE ARCHIVED ON 22:48:06 Jan 31, 2021 AND RETRIEVED FROM THE
|
||||
INTERNET ARCHIVE ON 14:01:15 Oct 20, 2022.
|
||||
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
|
||||
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
|
||||
SECTION 108(a)(3)).
|
||||
*/
|
||||
/*
|
||||
playback timings (ms):
|
||||
captures_list: 273.718
|
||||
exclusion.robots: 0.088
|
||||
exclusion.robots.policy: 0.08
|
||||
cdx.remote: 0.063
|
||||
esindex: 0.009
|
||||
LoadShardBlock: 52.202 (3)
|
||||
PetaboxLoader3.datanode: 93.37 (5)
|
||||
CDXLines.iter: 13.615 (3)
|
||||
load_resource: 130.222 (2)
|
||||
PetaboxLoader3.resolve: 65.34 (2)
|
||||
*/
|
||||
9
packages/non-core/less/tests/top.import.less
vendored
9
packages/non-core/less/tests/top.import.less
vendored
@@ -6,4 +6,11 @@
|
||||
|
||||
// Make sure regular CSS import doesn't make the compiler explode - this was
|
||||
// a regression from 1.1.0.3 caught in QA
|
||||
@import url("http://hello.myfonts.net/count/2c4b9d");
|
||||
|
||||
// 20 Oct 2022
|
||||
// GH link: https://github.com/meteor/meteor/pull/12236#discussion_r1000838738
|
||||
// older link broke and we putted in another CDN. if this breaks
|
||||
// again, the contents of the file are in top-cdn-file.import.less
|
||||
// feel free to use any other CDN
|
||||
|
||||
@import url("https://css-cdn2.vercel.app/font");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user