diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8270dd19c1..7dedfef861 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,6 +9,7 @@ This closes # ??? * [ ] 📝 Changelog entry * [ ] 📝 `Compatibility` label is updated or copied from previous entry * [ ] 🚦 Tests +* [ ] 📱 Check the React Native/other sample apps work if necessary * [ ] 📝 Public documentation PR created or is not necessary * [ ] 💥 `Breaking` label has been applied or is not necessary diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 848211ecee..559fb31c7b 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -33,11 +33,12 @@ jobs: fail-fast: false matrix: os: - [ - { name: Linux, runner: ubuntu-latest }, - { name: Window, runner: windows-latest }, - { name: macOS, runner: macos-latest }, - ] + - name: Linux + runner: ubuntu-latest + - name: Window + runner: windows-latest + - name: macOS + runner: macos-latest node: [14, 16] type: [release, debug] steps: @@ -155,10 +156,13 @@ jobs: #type: [Release, Debug] type: [Release] platform: - [ - { name: ios, build-configuration: simulator }, - { name: catalyst, build-configuration: catalyst }, - ] + - name: ios + build-configuration: simulator + - name: catalyst + build-configuration: catalyst + env: + # Pin the Xcode version + DEVELOPER_DIR: /Applications/Xcode_12.5.1.app steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/package-unit-tests.yml b/.github/workflows/package-unit-tests.yml new file mode 100644 index 0000000000..ca2e7d3eaa --- /dev/null +++ b/.github/workflows/package-unit-tests.yml @@ -0,0 +1,34 @@ +name: Package Unit Tests + +env: + REALM_DISABLE_ANALYTICS: 1 + MOCHA_REMOTE_TIMEOUT: 10000 + +on: + pull_request: + paths: + # Source code + - "packages/realm-network-transport/**" + - "packages/realm-common/**" + # No need to run when updating documentation + - "!**.md" + # Run this on updates to the workflow + - ".github/workflows/package-unit-tests.yml" + +jobs: + unit-tests-linux: + name: Unit tests on Linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: "recursive" + - uses: actions/setup-node@v1 + with: + node-version: 14 + registry-url: https://registry.npmjs.org/ + - name: Install npm v7 + run: npm install -g npm@7 + - run: npx lerna bootstrap --scope '{realm-network-transport,@realm.io/common}' --include-dependencies + - run: npm test --prefix packages/realm-network-transport + - run: npm test --prefix packages/realm-common diff --git a/.vscode/launch.json b/.vscode/launch.json index 31dd104a24..2c4175b577 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -85,7 +85,7 @@ "--expose_gc", "${workspaceFolder}/tests/node_modules/jasmine/bin/jasmine.js", "spec/unit_tests.js", - "--filter=." + "--filter=${input:testFilter}" ], "cwd": "${workspaceFolder}/tests" }, @@ -105,5 +105,13 @@ "Attach to Port" ] } + ], + "inputs": [ + { + "id": "testFilter", + "type": "promptString", + "default": ".", + "description": "Filtering used to limit what tests are run" + } ] } diff --git a/.watchmanconfig b/.watchmanconfig index 4e20b9a376..9f8062d492 100644 --- a/.watchmanconfig +++ b/.watchmanconfig @@ -1,8 +1,9 @@ { "ignore_dirs": [ - "node_modules", "react-native/node_modules", - "packages", + "packages/realm-app-importer", + "packages/realm-web-importer", + "packages/realm-web-integration-tests", "tests" ] } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bc3c20ef9..16470ee1ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ x.x.x Release notes (yyyy-MM-dd) ============================================================= + +### Deprecations +* `EmailPasswordAuth` method calls using positional arguments are being deprecated in favour of using a single object dictionary argument. See "Examples of how to update to the new API" in the description of https://github.com/realm/realm-js/pull/4041 for examples of how to update each method call. + * The existing methods will be removed in the next major version. + * The existing methods will continue to work but will output a deprecation warning to the console in development mode when used, of the form: `Deprecation warning from Realm: resetPassword(password, token, token_id) is deprecated and will be removed in a future major release. Consider switching to resetPassword({ password, token, token_id })`. + ### Enhancements -* None. +* New consistent API for `EmailPasswordAuth` methods, using a single object dictionary rather than positional arguments, to fix inconsistencies and make usage clearer. The existing API is being deprecated (see above). ([#3943](https://github.com/realm/realm-js/issues/3943)) ### Fixed * Using `sort`, `distinct`, or `limit` as property name in query expression would cause an `Invalid predicate` error. ([realm/realm-java#7545](https://github.com/realm/realm-java/issues/7545), since v10.0.2) @@ -18,11 +24,14 @@ x.x.x Release notes (yyyy-MM-dd) * File format: generates Realms with format v22 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms). ### Internal -* Adding use of [ccache](https://ccache.dev/) in build scripts, XCode projects and the integration tests GHA workflow. * Upgraded Realm Core from v11.4.1 to v10.6.0. +* Adding use of [ccache](https://ccache.dev/) in build scripts, XCode projects and the integration tests GHA workflow. * Change Apple/Linux temporary directory to default to the environment's `TMPDIR` if available. This is primarily used by tests. ([realm/realm-core#4921](https://github.com/realm/realm-core/issues/4921)) * Minor speed improvement in property setters. ([#4058](https://github.com/realm/realm-js/pull/4058) and [realm/realm-core#5011](https://github.com/realm/realm-core/pull/5011)) * Adding use of [ccache](https://ccache.dev/) in build scripts, XCode projects and the integration tests GHA workflow. +* Dropped using `install-local` in the integration tests, in favour of a more involved Metro configuration. +* Adding combined type definition for `Realm.objects()` and `Realm.objectForPrimaryKey()` so they can be cleanly wrapped. +* Adding colorized compiler diagnostics if using Ninja. 10.9.1 Release notes (2021-10-20) ============================================================= diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f631eeabc..4d53b28b1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,5 @@ +include(CheckCXXCompilerFlag) + # compiling for Node.js, need to set up toolchains before project() call if(DEFINED CMAKE_JS_VERSION) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") @@ -35,6 +37,21 @@ if(CCACHE_PROGRAM) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") endif() +# Copied from Realm Core's CMakeList.txt +function(add_cxx_flag_if_supported flag) + if(flag MATCHES "^-Wno-") + # Compilers ignore unknown -Wno-foo flags, so look for -Wfoo instead. + string(REPLACE "-Wno-" "-W" check_flag ${flag}) + else() + set(check_flag ${flag}) + endif() + + check_cxx_compiler_flag(${check_flag} HAVE${check_flag}) + if(HAVE${check_flag}) + add_compile_options($<$:${flag}>) + endif() +endfunction() + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -49,6 +66,13 @@ if(DEFINED CMAKE_JS_VERSION) include(NodeJSTargets) endif() +if (NOT MSVC) + # Ninja buffers output so we need to tell the compiler to use colors even though stdout isn't a tty. + if(CMAKE_GENERATOR STREQUAL "Ninja") + add_cxx_flag_if_supported(-fdiagnostics-color) + endif() +endif() + option(REALM_JS_BUILD_CORE_FROM_SOURCE "Build Realm Core from source, as opposed to downloading prebuilt binaries" ON) if(REALM_JS_BUILD_CORE_FROM_SOURCE) set(REALM_BUILD_LIB_ONLY ON) diff --git a/contrib/assets/debug-enter-test-filter.png b/contrib/assets/debug-enter-test-filter.png new file mode 100644 index 0000000000..6fb123c4c0 Binary files /dev/null and b/contrib/assets/debug-enter-test-filter.png differ diff --git a/contrib/building.md b/contrib/building.md index ecc76255a0..8dfc46fec8 100644 --- a/contrib/building.md +++ b/contrib/building.md @@ -29,9 +29,10 @@ * [Debugging the tests](#debugging-the-tests) * [Debugging React Native tests](#debugging-react-native-tests) * [Debugging Node.js tests using Visual Studio Code](#debugging-nodejs-tests-using-visual-studio-code) + * [Debugging failing Github Actions CI tests](#debugging-failing-github-actions-ci-tests) * [Testing against real apps](#testing-against-real-apps) - + @@ -39,16 +40,16 @@ The following dependencies are required. All except Xcode can be installed by following the [setup instructions for MacOS section](#setup-instructions-for-macos). -* [Xcode](https://developer.apple.com/xcode/) 12+ with Xcode command line tools installed +- [Xcode](https://developer.apple.com/xcode/) 12+ with Xcode command line tools installed - Newer versions may work but 12.2 is the current recommended version, which can be downloaded from [Apple](https://developer.apple.com/download/all/?q=xcode%2012.2) -* [Node.js](https://nodejs.org/en/) version 10.19 or later +- [Node.js](https://nodejs.org/en/) version 10.19 or later - Consider [using NVM](https://github.com/nvm-sh/nvm#installing-and-updating) to enable fast switching between Node.js & NPM versions -* [CMake](https://cmake.org/) -* [OpenJDK 8](https://openjdk.java.net/install/) -* [Android SDK 23+](https://developer.android.com/studio/index.html#command-tools) - - Optionally, you can install [Android Studio](https://developer.android.com/studio) -* [Android NDK 21.0](https://developer.android.com/ndk/downloads/index.html) -* [Android CMake](https://developer.android.com/ndk/guides/cmake) +- [CMake](https://cmake.org/) +- [OpenJDK 8](https://openjdk.java.net/install/) +- [Android SDK 23+](https://developer.android.com/studio/index.html#command-tools) + - Optionally, you can install [Android Studio](https://developer.android.com/studio) +- [Android NDK 21.0](https://developer.android.com/ndk/downloads/index.html) +- [Android CMake](https://developer.android.com/ndk/guides/cmake) ### Setup instructions for MacOS @@ -171,12 +172,12 @@ Note: If you have cloned the repo previously make sure you remove your `node_mod ### Building for iOS -* Run `./scripts/build-ios.sh` from the `realm-js` root directory +- Run `./scripts/build-ios.sh` from the `realm-js` root directory ### Building for Android -* Run `node scripts/build-android.js` from the `realm-js` root directory - - The compiled version of the Android module is output to `/android` +- Run `node scripts/build-android.js` from the `realm-js` root directory + - The compiled version of the Android module is output to `/android` ### Building for Node.js @@ -190,26 +191,26 @@ If you want to build for Apple Silicon on an Intel based Mac, you can use the fo ```sh npm run build-m1 - ``` +``` #### Additional steps for Windows On Windows you will need to setup the environment for node-gyp: -* Option 1: Install windows-build-tools Node.js package +- Option 1: Install windows-build-tools Node.js package - ```cmd - # run in elevated command prompt (as Administrator) - npm install -g --production windows-build-tools - ``` + ```cmd + # run in elevated command prompt (as Administrator) + npm install -g --production windows-build-tools + ``` -* Option 2: Manually install and configure as described in the [node-gyp](https://github.com/nodejs/node-gyp) manual. +- Option 2: Manually install and configure as described in the [node-gyp](https://github.com/nodejs/node-gyp) manual. - Note you may need to configure the build tools path using npm + Note you may need to configure the build tools path using npm - ```cmd - npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" - ``` + ```cmd + npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" + ``` You also need to install openssl libraries with vcpkg: @@ -227,7 +228,7 @@ copy .\packages\openssl-windows_x64-windows-static\lib\ssleay32.lib C:\src\vcpkg API documentation is written using [JSDoc](http://usejsdoc.org/). To generate the documentation, run: -```npm run jsdoc``` +`npm run jsdoc` The generated docs can be found in `docs/output/realm//index.html`. @@ -255,10 +256,10 @@ See [the instructions in the `integration-tests`](../integration-tests/README.md To run the the tests, run the `scripts/test.sh` script, passing an argument for which tests you would like to execute. The following options are available: -* `react-tests` - runs all React Native tests on iOS Simulator -* `react-tests-android` - runs all React Native Android tests on Android emulator -* `node` - runs all tests for Node.js -* `test-runners` - checks supported tests runners are working correctly +- `react-tests` - runs all React Native tests on iOS Simulator +- `react-tests-android` - runs all React Native Android tests on Android emulator +- `node` - runs all tests for Node.js +- `test-runners` - checks supported tests runners are working correctly For example: @@ -273,6 +274,7 @@ Run `npm run lint` to lint the source code using `eslint`. #### Testing on Windows On Windows some of these targets are available as npm commands. + ``` npm run eslint npm run node-tests @@ -304,22 +306,37 @@ You can use [Visual Studio Code](https://code.visualstudio.com/) to develop and VSCode has good support for debugging JavaScript, but to work with C++ code, you are required to install two additional VSCode extensions: -* Microsoft C/C++ -* CodeLLDB +- Microsoft C/C++ +- CodeLLDB To begin, you will need to build the Node addon and prepare the test environment: + ```sh npm install --build-from-source --debug (cd tests && npm install) ``` -Prior to begin debugging, you must start Realm Object Server. In VSCode, under menu *Tasks*/*Run Task*, find *Download and Start Server*. +Prior to begin debugging, you must start Realm Object Server. In VSCode, under menu _Tasks_/_Run Task_, find _Download and Start Server_. + +In the debugging pane, you can find `Debug LLDB + Node.js` in the dropdown. First select _Start Debugging_ in the _Debug_ menu. + +### Debugging failing Github Actions CI tests -In the debugging pane, you can find `Debug LLDB + Node.js` in the dropdown. First select *Start Debugging* in the *Debug* menu. +To debug failing Github Actions CI tests, it can be helpful to `ssh` into the runner and test out the CI commands manually. This Github Action can be used to add a step into the workflow which pauses it and outputs details to `ssh` into it: https://github.com/marketplace/actions/debugging-with-tmate + +The relevant snippet is: + +``` +- name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + timeout-minutes: 30 +``` ## Testing against real apps There are a couple of suggested workflows for testing your changes to Realm JS against real apps: -* [Guide: Setting up watchman to copy changes from this package to an app](guide-watchman.md) -* [Guide: Testing your changes against sample apps using a script](guide-testing-with-sample-apps.md) +- [Guide: Setting up watchman to copy changes from this package to an app](guide-watchman.md) +- [Guide: Testing your changes against sample apps using a script](guide-testing-with-sample-apps.md) diff --git a/contrib/vscode-debugging.md b/contrib/vscode-debugging.md index 5c49fa217e..0ec93a2ec9 100644 --- a/contrib/vscode-debugging.md +++ b/contrib/vscode-debugging.md @@ -32,31 +32,15 @@ First lets take a look at `.vscode/launch.json`. This contains various ways to "--expose_gc", "${workspaceFolder}/tests/node_modules/jasmine/bin/jasmine.js", "spec/unit_tests.js", - "--filter=." + "--filter=${input:testFilter}" ], "cwd": "${workspaceFolder}/tests" } ``` -A quick read through this code shows that the launch type is `lldb` provided by the CodeLLDB extension, and it is using the `node` command to invoke the `jasmine` test framework with our `spec/unit_tests.js`. The filter option is currently running all tests. To make things easier, let's modify that parameter to take a single test (`testListPush` from `tests/list-tests.js`). +A quick read through this code shows that the launch type is `lldb` provided by the CodeLLDB extension, and it is using the `node` command to invoke the `jasmine` test framework with our `spec/unit_tests.js`. The `${input:testFilter}` will prompt us for a string to use as filter to avoid running all tests every time. -```json -{ - "type": "lldb", - "request": "launch", - "name": "LLDB Launch Unit Tests", - "program": "node", - "args": [ - "--expose_gc", - "${workspaceFolder}/tests/node_modules/jasmine/bin/jasmine.js", - "spec/unit_tests.js", - "--filter=testListPush" - ], - "cwd": "${workspaceFolder}/tests" -} -``` - -As we are fairly certain this will perform a `push` command on a realm list, we can place a breakpoint in the push function in `src/js_list.hpp` by locating the push function and clicking next to the desired line number (see example below) +When prompted for a filter, try using "testListPush" as the input. As we are fairly certain this will perform a `push` command on a realm list, we can place a breakpoint in the push function in `src/js_list.hpp` by locating the push function and clicking next to the desired line number (see example below) ![Breakpoint in Code](./assets/pushBreakpoint.png) @@ -68,7 +52,12 @@ Select the `LLDB Launch Unit Tests` from the run tab: ![Debug Run Tab](./assets/debugRunTab.png) -Now press play and we should arrive at our new breakpoint. +Now press play, type "testListPush" as filter and hit Enter +![Enter test filter](./assets/debug-enter-test-filter.png) + +We should now arrive at our new breakpoint. ![Met Breakpoint](./assets/metBreakpoint.png) + +To run all tests, simply leave the filter at the default (`.`). diff --git a/docs/sync.js b/docs/sync.js index 6337b2084c..5676f7bf27 100644 --- a/docs/sync.js +++ b/docs/sync.js @@ -147,7 +147,7 @@ class App { * { * // Creating a new user, by registering via email & password * const app = new Realm.App(config); - * await app.emailPasswordAuth.registerUser('john@example.com', 'some-secure-password'); + * await app.emailPasswordAuth.registerUser({ email: 'john@example.com', password: 'some-secure-password' }); * } * * @type {Realm.Auth.EmailPasswordAuth} @@ -461,6 +461,18 @@ class Auth {} * @memberof Realm.Auth */ class EmailPasswordAuth { + /** + * Registers a new email identity with the email/password provider, + * and sends a confirmation email to the provided address. + * + * @param {object} userDetails The new user's email and password details + * @param {string} userDetails.email - The email address of the user to register. + * @param {string} userDetails.password - The password that the user created for the new username/password identity. + * @returns {Promise} + * @since v10.10.0 + */ + registerUser(userDetails) {} + /** * Registers a new email identity with the email/password provider, * and sends a confirmation email to the provided address. @@ -468,52 +480,126 @@ class EmailPasswordAuth { * @param {string} email - The email address of the user to register. * @param {string} password - The password that the user created for the new username/password identity. * @returns {Promise} + * @deprecated Use `registerUser(userDetails)` instead */ registerUser(email, password) {} + /** + * Confirms an email identity with the email/password provider. + * + * @param {object} tokenDetails The received token and ID details + * @param {string} tokenDetails.token - The confirmation token that was emailed to the user. + * @param {string} tokenDetails.tokenId - The confirmation token id that was emailed to the user. + * @returns {Promise} + * @since v10.10.0 + */ + confirmUser(tokenDetails) {} + /** * Confirms an email identity with the email/password provider. * * @param {string} token - The confirmation token that was emailed to the user. * @param {string} id - The confirmation token id that was emailed to the user. * @returns {Promise} + * @deprecated Use `confirmUser(tokenDetails)` instead */ confirmUser(token, id) {} + /** + * Re-sends a confirmation email to a user that has registered but + * not yet confirmed their email address. + * + * @param {object} emailDetails The associated email details + * @param {string} emailDetails.email - The email address of the user to re-send a confirmation for. + * @returns {Promise} + * @since v10.10.0 + */ + resendConfirmationEmail(emailDetails) {} + /** * Re-sends a confirmation email to a user that has registered but * not yet confirmed their email address. * * @param {string} email - The email address of the user to re-send a confirmation for. * @returns {Promise} + * @deprecated Use `resendConfirmationEmail(emailDetails)` instead */ resendConfirmationEmail(email) {} + /** + * Re-run the custom confirmation function for user that has registered but + * not yet confirmed their email address. + * + * @param {object} emailDetails The associated email details + * @param {string} emailDetails.email - The email address of the user to re-run the confirmation for. + * @returns {Promise} + * @since v10.10.0 + */ + retryCustomConfirmation(emailDetails) {} + /** * Re-run the custom confirmation function for user that has registered but * not yet confirmed their email address. * * @param {string} email - The email address of the user to re-run the confirmation for. * @returns {Promise} + * @deprecated Use `retryCustomConfirmation(emailDetails)` instead */ retryCustomConfirmation(email) {} + /** + * Sends an email to the user for resetting the password. + * + * @param {object} emailDetails The email details to send the reset to + * @param {string} emailDetails.email - The email address of the user to re-send a confirmation for. + * @returns {Promise} + * @since v10.10.0 + */ + sendResetPasswordEmail(emailDetails) {} + /** * Sends an email to the user for resetting the password. * @param {string} email - The email address of the user to re-send a confirmation for. * @returns {Promise} + * @deprecated Use `sendResetPasswordEmail(emailDetails)` instead */ sendResetPasswordEmail(email) {} + /** + * Resets the password of an email identity using the password reset token emailed to a user. + * + * @param {object} resetDetails The token and password details for the reset + * @param {string} resetDetails.password - The desired new password. + * @param {string} resetDetails.token - The password reset token that was emailed to the user. + * @param {string} resetDetails.tokenId - The password reset token id that was emailed to the user. + * @returns {Promise} + * @since v10.10.0 + */ + resetPassword(resetDetails) {} + /** * Resets the password of an email identity using the password reset token emailed to a user. * @param {string} password - The desired new password. * @param {string} token - The password reset token that was emailed to the user. * @param {string} id - The password reset token id that was emailed to the user. * @returns {Promise} + * @deprecated Use `resetPassword(resetDetails)` instead */ resetPassword(password, token, id) {} + /** + * Resets the password of an email identity using the + * password reset function set up in the application. + * + * @param resetDetails The email and password details to reset + * @param {string} resetDetails.email - The email address of the user. + * @param {string} resetDetails.password - The desired new password. + * @param {Array} args - Arguments passed onto the function. + * @return {Promise} + * @since v10.10.0 + */ + callResetPasswordFunction(resetDetails, ...args) {} + /** * Resets the password of an email identity using the * password reset function set up in the application. @@ -522,6 +608,7 @@ class EmailPasswordAuth { * @param {string} password - The desired new password. * @param {Array} args - Arguments passed onto the function. * @return {Promise} + * @deprecated Use `callResetPasswordFunction(resetDetails, ...args)` instead */ callResetPasswordFunction(email, password, ...args) {} } diff --git a/integration-tests/environments/react-native/README.md b/integration-tests/environments/react-native/README.md index 5ddf1a9813..064bd3da81 100644 --- a/integration-tests/environments/react-native/README.md +++ b/integration-tests/environments/react-native/README.md @@ -10,6 +10,7 @@ Currently this directory consists of: - `react-native-cli.js` wraps the `react-native` CLI. - `xcode-cli.js` wraps the `react-native` CLI. - `puppeteer-log.js` implements a handler for logs used when running Chrome debugging headlessly. +- A `metro.config.js` which can resolve the symbolic links produced by Lerna. To install this environment, run the following command from the root directory of repository: @@ -17,7 +18,7 @@ To install this environment, run the following command from the root directory o npx lerna bootstrap --scope realm-react-native-tests --include-dependencies ``` -This will run `install-local` and `pod install` (in `./ios`) for you. +This will run `pod install` (in `./ios`) for you. ## Running the tests @@ -74,7 +75,6 @@ This gives us an opportunity to manually link to the root project, removing the - Watch the Realm library and the integration test suite packages. - Block any loading of packages from `node_modules` in the two packages. -- Use `install-local` install the dependencies of our two packages into the app. ### Android configuration diff --git a/integration-tests/environments/react-native/android/app/src/main/java/com/realmreactnativetests/MainApplication.java b/integration-tests/environments/react-native/android/app/src/main/java/com/realmreactnativetests/MainApplication.java index d58ce8de8a..2553492263 100644 --- a/integration-tests/environments/react-native/android/app/src/main/java/com/realmreactnativetests/MainApplication.java +++ b/integration-tests/environments/react-native/android/app/src/main/java/com/realmreactnativetests/MainApplication.java @@ -26,8 +26,6 @@ public boolean getUseDeveloperSupport() { protected List getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List packages = new PackageList(this).getPackages(); - // Manually linking the Realm package - packages.add(new RealmReactPackage()); return packages; } diff --git a/integration-tests/environments/react-native/ios/Podfile b/integration-tests/environments/react-native/ios/Podfile index f819ba9629..ac3325c199 100644 --- a/integration-tests/environments/react-native/ios/Podfile +++ b/integration-tests/environments/react-native/ios/Podfile @@ -15,11 +15,6 @@ target 'RealmReactNativeTests' do :hermes_enabled => false ) - # Since we're installing Realm using install-local, - # auto-linking won't find a key for it in our package.json's dependencies, - # hence, we need to add this manually - pod 'RealmJS', :path => '../../../..', :inhibit_warnings => false - target 'RealmReactNativeTestsTests' do inherit! :complete # Pods for testing diff --git a/integration-tests/environments/react-native/metro.config.js b/integration-tests/environments/react-native/metro.config.js index 64e6b5614b..77865127b7 100644 --- a/integration-tests/environments/react-native/metro.config.js +++ b/integration-tests/environments/react-native/metro.config.js @@ -16,40 +16,95 @@ // //////////////////////////////////////////////////////////////////////////// +// Metro bundler does not support symlinks (see https://github.com/facebook/metro/issues/1). +// In order to link to our local version of Realm JS in a way which Metro can follow, +// we need to instead add the module to `resolver.blockList`, and then in `resolver.extraNodeModules`, +// override the locations for any symlinked modules by specifying a mapping from their name +// to their actual location on disk. + +// In order to achieve this, we recursively check if each file/directory in `node_modules` +// is a symlink or not. If it is, and if it is specified in our main `package.json` (i.e. +// it is a direct dependency of our app), we add it to the `blockList` and +// add a mapping for it. We also add it to the list of watched folders, so +// that any changes to it are picked up by hot reloading. + const path = require("path"); const fs = require("fs"); const exclusionList = require("metro-config/src/defaults/exclusionList"); -// Read the localDependencies property of package.json and resolve the relative path values -const appPackageJson = readJson(__dirname, "package.json"); -const localDependencies = Object.fromEntries( - Object.entries(appPackageJson.localDependencies || {}).map(([localName, relativePath]) => [ - localName, - path.resolve(__dirname, relativePath), - ]), -); - function readJson(...pathSegemnts) { const filePath = path.join(...pathSegemnts); return JSON.parse(fs.readFileSync(filePath, "utf8")); } -const watchFolders = Object.values(localDependencies); +function getLinkedDependencies(packagePath, exclude = new Set()) { + const packageJson = readJson(packagePath, "package.json"); + const nodeModulesPath = path.join(packagePath, "node_modules"); + const files = fs.readdirSync(nodeModulesPath, { encoding: "utf8", withFileTypes: true }); + const links = files + .filter((f) => f.isSymbolicLink()) + .map(({ name }) => { + const linkPath = fs.realpathSync(path.join(nodeModulesPath, name)); + const linkPackageJson = readJson(linkPath, "package.json"); + const peerDependencies = Object.keys(linkPackageJson.peerDependencies || {}); + return { name, path: linkPath, peerDependencies }; + }); + // We're only interested in actual dependencies + const dependencyLinks = links.filter(({ name }) => name in packageJson.dependencies && !exclude.has(name)); + // Recurse + // Ensure we don't visit this package again + exclude.add(packageJson.name); + // Traverse all dependencies + for (const link of dependencyLinks) { + const additionalLinks = getLinkedDependencies(link.path, exclude); + dependencyLinks.push(...additionalLinks); + } + // Return only new links + return dependencyLinks; +} + +const linkedDependencies = getLinkedDependencies(__dirname); +console.log(`Linked dependencies: ${linkedDependencies.map(({ name }) => name).join(", ")}`); + +const watchFolders = linkedDependencies.map((pkg) => pkg.path); -// Block any node_module loaded from the local dependency, outside of the app's node_modules -const blockList = Object.values(localDependencies).map( - (localPath) => new RegExp(`^${escape(path.join(localPath, "node_modules"))}\\/.*$`), -); +const blockedPaths = []; +for (const pkg of linkedDependencies) { + // Block the links + blockedPaths.push(path.join(__dirname, "node_modules", pkg.name)); + // Block any peer dependencies of the links + blockedPaths.push(...pkg.peerDependencies.map((peer) => path.join(pkg.path, "node_modules", peer))); +} +// Turn paths into regular expressions +const blockList = blockedPaths.map((pkgPath) => new RegExp(`^${escape(pkgPath)}\\/.*$`)); -// Serves any module from the app's node_modules -const extraNodeModules = new Proxy( - {}, - { - get(target, name, receiver) { - return path.resolve(__dirname, "node_modules", name); - }, +const peerNodeModules = {}; +const allPeerDependencies = linkedDependencies.flatMap((pkg) => pkg.peerDependencies); +const unresolvedPeerDependencies = new Set(allPeerDependencies.filter((name) => !(name in linkedDependencies))); +// Locate the package providing every unresolved peer dependency +for (const peer of unresolvedPeerDependencies) { + for (const pkg of linkedDependencies) { + const potentialPath = path.join(pkg.path, "node_modules", peer); + if (fs.existsSync(potentialPath)) { + peerNodeModules[peer] = potentialPath; + break; + } + } +} +// Create a proxy around the resolved peer dependencies +// This will resolve all modules exposed by the react-native app and fall back to resolved peer dependencies +const extraNodeModules = new Proxy(peerNodeModules, { + get(target, name, receiver) { + const potentialPath = path.join(__dirname, "node_modules", name); + if (fs.existsSync(potentialPath)) { + return potentialPath; + } else if (name in target) { + return target[name]; + } else { + return undefined; + } }, -); +}); module.exports = { projectRoot: __dirname, diff --git a/integration-tests/environments/react-native/package-lock.json b/integration-tests/environments/react-native/package-lock.json index 9804ae33da..620538ff97 100644 --- a/integration-tests/environments/react-native/package-lock.json +++ b/integration-tests/environments/react-native/package-lock.json @@ -26,7 +26,6 @@ "chalk": "^4.1.1", "concurrently": "^6.0.2", "fs-extra": "^9.1.0", - "install-local": "^3.0.1", "metro-react-native-babel-preset": "^0.64.0", "mocha-remote-cli": "^1.4.3", "pod-install": "^0.1.23", @@ -4155,14 +4154,6 @@ "node": ">= 6" } }, - "node_modules/human-signals": { - "version": "1.1.1", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", - "dev": true, - "engines": { - "node": ">=8.12.0" - } - }, "node_modules/ieee754": { "version": "1.2.1", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", @@ -4222,154 +4213,6 @@ "version": "2.0.4", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "node_modules/install-local": { - "version": "3.0.1", - "integrity": "sha512-f5Njj3ZeD/HxaDkjDBZCLYks5XSd4Ps4I/nA2UFyYhM7fWRsdkVnfIoncxWqtUrbOZOZhvjOrtbrPunw2fWoAg==", - "dev": true, - "dependencies": { - "execa": "^4.0.3", - "lodash.flatmap": "^4.5.0", - "rimraf": "^3.0.2", - "uniqid": "^5.2.0" - }, - "bin": { - "install-local": "bin/install-local" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/install-local/node_modules/cross-spawn": { - "version": "7.0.3", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/install-local/node_modules/execa": { - "version": "4.1.0", - "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/install-local/node_modules/get-stream": { - "version": "5.2.0", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/install-local/node_modules/is-stream": { - "version": "2.0.0", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/install-local/node_modules/mimic-fn": { - "version": "2.1.0", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/install-local/node_modules/npm-run-path": { - "version": "4.0.1", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/install-local/node_modules/onetime": { - "version": "5.1.2", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/install-local/node_modules/path-key": { - "version": "3.1.1", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/install-local/node_modules/rimraf": { - "version": "3.0.2", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/install-local/node_modules/shebang-command": { - "version": "2.0.0", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/install-local/node_modules/shebang-regex": { - "version": "3.0.0", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/interpret": { "version": "1.4.0", "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", @@ -4986,11 +4829,6 @@ "version": "4.0.8", "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" }, - "node_modules/lodash.flatmap": { - "version": "4.5.0", - "integrity": "sha1-74y/QI9uSCaGYzRTBcaswLd4cC4=", - "dev": true - }, "node_modules/lodash.throttle": { "version": "4.1.1", "integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=" @@ -8150,14 +7988,6 @@ "node": ">=0.10.0" } }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/strip-json-comments": { "version": "3.1.1", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", @@ -8444,11 +8274,6 @@ "node": ">=0.10.0" } }, - "node_modules/uniqid": { - "version": "5.3.0", - "integrity": "sha512-Jq8EzvAT8/CcLu8tzoSiylnzPkNhJJKpnMT964Dj1jI4pG4sKYP9aFVByNTp8KzMvYlW1Um63PCDqtOoujNzrA==", - "dev": true - }, "node_modules/universalify": { "version": "0.1.2", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", @@ -11980,11 +11805,6 @@ "debug": "4" } }, - "human-signals": { - "version": "1.1.1", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", - "dev": true - }, "ieee754": { "version": "1.2.1", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", @@ -12018,105 +11838,6 @@ "version": "2.0.4", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "install-local": { - "version": "3.0.1", - "integrity": "sha512-f5Njj3ZeD/HxaDkjDBZCLYks5XSd4Ps4I/nA2UFyYhM7fWRsdkVnfIoncxWqtUrbOZOZhvjOrtbrPunw2fWoAg==", - "dev": true, - "requires": { - "execa": "^4.0.3", - "lodash.flatmap": "^4.5.0", - "rimraf": "^3.0.2", - "uniqid": "^5.2.0" - }, - "dependencies": { - "cross-spawn": { - "version": "7.0.3", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "execa": { - "version": "4.1.0", - "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - } - }, - "get-stream": { - "version": "5.2.0", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "2.0.0", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true - }, - "mimic-fn": { - "version": "2.1.0", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "onetime": { - "version": "5.1.2", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "path-key": { - "version": "3.1.1", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "shebang-command": { - "version": "2.0.0", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - } - } - }, "interpret": { "version": "1.4.0", "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" @@ -12583,11 +12304,6 @@ "version": "4.0.8", "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" }, - "lodash.flatmap": { - "version": "4.5.0", - "integrity": "sha1-74y/QI9uSCaGYzRTBcaswLd4cC4=", - "dev": true - }, "lodash.throttle": { "version": "4.1.1", "integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=" @@ -15066,11 +14782,6 @@ "version": "1.0.0", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" }, - "strip-final-newline": { - "version": "2.0.0", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true - }, "strip-json-comments": { "version": "3.1.1", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" @@ -15289,11 +15000,6 @@ "set-value": "^2.0.1" } }, - "uniqid": { - "version": "5.3.0", - "integrity": "sha512-Jq8EzvAT8/CcLu8tzoSiylnzPkNhJJKpnMT964Dj1jI4pG4sKYP9aFVByNTp8KzMvYlW1Um63PCDqtOoujNzrA==", - "dev": true - }, "universalify": { "version": "0.1.2", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" diff --git a/integration-tests/environments/react-native/package.json b/integration-tests/environments/react-native/package.json index 1efbd76a23..10e7fce9ca 100644 --- a/integration-tests/environments/react-native/package.json +++ b/integration-tests/environments/react-native/package.json @@ -22,8 +22,7 @@ "app-importer": "realm-app-importer serve ../../realm-apps", "metro": "react-native start --reset-cache", "runner": "node harness/runner.js", - "prepare": "npm run install-local && pod-install", - "install-local": "npm_config_legacy_peer_deps=true npm_config_ignore_scripts=true install-local" + "prepare": "pod-install" }, "dependencies": { "@react-native-community/art": "^1.2.0", @@ -35,7 +34,9 @@ "react": "17.0.1", "react-native": "0.64.2", "react-native-fs": "^2.16.6", - "react-native-progress": "^4.1.2" + "react-native-progress": "^4.1.2", + "realm": "*", + "realm-integration-tests": "*" }, "devDependencies": { "@babel/core": "^7.12.9", @@ -44,16 +45,11 @@ "chalk": "^4.1.1", "concurrently": "^6.0.2", "fs-extra": "^9.1.0", - "install-local": "^3.0.1", "metro-react-native-babel-preset": "^0.64.0", "mocha-remote-cli": "^1.4.3", "pod-install": "^0.1.23", "puppeteer": "^9.0.0", "react-test-renderer": "17.0.1", "realm-app-importer": "*" - }, - "localDependencies": { - "realm": "../../..", - "realm-integration-tests": "../../tests" } } \ No newline at end of file diff --git a/integration-tests/tests/package.json b/integration-tests/tests/package.json index d3fc86e4c6..93af3c9dba 100644 --- a/integration-tests/tests/package.json +++ b/integration-tests/tests/package.json @@ -28,7 +28,6 @@ "node-fetch": "^2.6.1", "realm": "*", "realm-app-importer": "*", - "realm-network-transport": "*", "ts-mocha": "^6.0.0", "typescript": "^4.2.4" }, diff --git a/lib/browser/email-password-auth.js b/lib/browser/email-password-auth.js index 1feb13311d..fb9073f4c0 100644 --- a/lib/browser/email-password-auth.js +++ b/lib/browser/email-password-auth.js @@ -19,34 +19,60 @@ import { keys, objectTypes } from "./constants"; import { createMethods } from "./util"; import { promisify } from "../utils"; +import { handleDeprecatedPositionalArgs } from "@realm.io/common"; +// TODO for v11: change all signatures to methodName(argsObject) and remove handleDeprecatedPositionalArgs call +// +// Example post-v11: +// registerUser(argsObject) { +// return promisify((cb) => this._registerUser(argsObject, cb)); +// }, export class EmailPasswordAuth { - registerUser(email, password) { - return promisify((cb) => this._registerUser(email, password, cb)); + registerUser(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "registerUser", ["email", "password"]); + + return promisify((cb) => this._registerUser(argsObject, cb)); } - confirmUser(token, token_id) { - return promisify((cb) => this._confirmUser(token, token_id, cb)); + confirmUser(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "confirmUser", ["token", "tokenId"]); + + return promisify((cb) => this._confirmUser(argsObject, cb)); } - resendConfirmationEmail(email) { - return promisify((cb) => this._resendConfirmationEmail(email, cb)); + resendConfirmationEmail(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "resendConfirmationEmail", ["email"]); + + return promisify((cb) => this._resendConfirmationEmail(argsObject, cb)); } - retryCustomConfirmation(email) { - return promisify((cb) => this._retryCustomConfirmation(email, cb)); + retryCustomConfirmation(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "retryCustomConfirmation", ["email"]); + + return promisify((cb) => this._retryCustomConfirmation(argsObject, cb)); } - sendResetPasswordEmail(email) { - return promisify((cb) => this._sendResetPasswordEmail(email, cb)); + sendResetPasswordEmail(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "sendResetPasswordEmail", ["email"]); + + return promisify((cb) => this._sendResetPasswordEmail(argsObject, cb)); } - resetPassword(password, token, token_id) { - return promisify((cb) => this._resetPassword(password, token, token_id, cb)); + resetPassword(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "resetPassword", ["password", "token", "tokenId"]); + + return promisify((cb) => this._resetPassword(argsObject, cb)); } - callResetPasswordFunction(email, password, ...bsonArgs) { - return promisify((cb) => this._callResetPasswordFunction(email, password, bsonArgs, cb)); + callResetPasswordFunction(...args) { + const { argsObject, restArgs } = handleDeprecatedPositionalArgs( + args, + "callResetPasswordFunction", + ["email", "password"], + true, + ); + + return promisify((cb) => this._callResetPasswordFunction(argsObject, restArgs, cb)); } } diff --git a/lib/email-password-auth-methods.js b/lib/email-password-auth-methods.js index ab491d677d..bdcd26b1d8 100644 --- a/lib/email-password-auth-methods.js +++ b/lib/email-password-auth-methods.js @@ -19,35 +19,61 @@ const { EJSON } = require("bson"); const { promisify } = require("./utils.js"); +const { handleDeprecatedPositionalArgs } = require("@realm.io/common"); +// TODO for v11: change all signatures to methodName(argsObject) and remove handleDeprecatedPositionalArgs call +// +// Example post-v11: +// registerUser(argsObject) { +// return promisify((cb) => this._registerUser(argsObject, cb)); +// }, const instanceMethods = { - registerUser(email, password) { - return promisify((cb) => this._registerUser(email, password, cb)); + registerUser(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "registerUser", ["email", "password"]); + + return promisify((cb) => this._registerUser(argsObject, cb)); }, - confirmUser(token, token_id) { - return promisify((cb) => this._confirmUser(token, token_id, cb)); + confirmUser(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "confirmUser", ["token", "tokenId"]); + + return promisify((cb) => this._confirmUser(argsObject, cb)); }, - resendConfirmationEmail(email) { - return promisify((cb) => this._resendConfirmationEmail(email, cb)); + resendConfirmationEmail(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "resendConfirmationEmail", ["email"]); + + return promisify((cb) => this._resendConfirmationEmail(argsObject, cb)); }, - retryCustomConfirmation(email) { - return promisify((cb) => this._retryCustomConfirmation(email, cb)); + retryCustomConfirmation(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "retryCustomConfirmation", ["email"]); + + return promisify((cb) => this._retryCustomConfirmation(argsObject, cb)); }, - sendResetPasswordEmail(email) { - return promisify((cb) => this._sendResetPasswordEmail(email, cb)); + sendResetPasswordEmail(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "sendResetPasswordEmail", ["email"]); + + return promisify((cb) => this._sendResetPasswordEmail(argsObject, cb)); }, - resetPassword(password, token, token_id) { - return promisify((cb) => this._resetPassword(password, token, token_id, cb)); + resetPassword(...args) { + const { argsObject } = handleDeprecatedPositionalArgs(args, "resetPassword", ["password", "token", "tokenId"]); + + return promisify((cb) => this._resetPassword(argsObject, cb)); }, - callResetPasswordFunction(email, password, ...args) { - const stringifiedArgs = EJSON.stringify(args, { relaxed: false }); - return promisify((cb) => this._callResetPasswordFunction(email, password, stringifiedArgs, cb)); + callResetPasswordFunction(...args) { + const { argsObject, restArgs } = handleDeprecatedPositionalArgs( + args, + "callResetPasswordFunction", + ["email", "password"], + true, + ); + + const stringifiedArgs = EJSON.stringify(restArgs, { relaxed: false }); + return promisify((cb) => this._callResetPasswordFunction(argsObject.email, stringifiedArgs, cb)); }, }; diff --git a/package-lock.json b/package-lock.json index 9b80d1bd94..a60a2d1f86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "hasInstallScript": true, "license": "See the actual license in the file LICENSE", "dependencies": { + "@realm.io/common": "^0.1.1", "bindings": "^1.5.0", "bson": "4.4.1", "command-line-args": "^5.1.1", @@ -3075,6 +3076,11 @@ "integrity": "sha512-W/J0fNYVO01tioHjvYWQ9m6RgndVtbElzYozBq1ZPrHO/iCzlqoySHl4gO/fpCl9QEFjvJfjPgtPMTMlsoq5DQ==", "dev": true }, + "node_modules/@realm.io/common": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@realm.io/common/-/common-0.1.1.tgz", + "integrity": "sha512-sXc7Ndhh39O9bm7/e0eeAx8keDBO83yoG7WfH04o6PqwVaIwm4T1uT0bhTO6OizP6ojhugZlVSu9HzgUVRE1Ag==" + }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -13289,9 +13295,9 @@ "dev": true }, "node_modules/url-parse": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz", - "integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==", + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.2.tgz", + "integrity": "sha512-6bTUPERy1muxxYClbzoRo5qtQuyoGEbzbQvi0SW4/8U8UyVkAQhWFBlnigqJkRm4su4x1zDQfNbEzWkt+vchcg==", "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" @@ -16075,6 +16081,11 @@ "integrity": "sha512-W/J0fNYVO01tioHjvYWQ9m6RgndVtbElzYozBq1ZPrHO/iCzlqoySHl4gO/fpCl9QEFjvJfjPgtPMTMlsoq5DQ==", "dev": true }, + "@realm.io/common": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@realm.io/common/-/common-0.1.1.tgz", + "integrity": "sha512-sXc7Ndhh39O9bm7/e0eeAx8keDBO83yoG7WfH04o6PqwVaIwm4T1uT0bhTO6OizP6ojhugZlVSu9HzgUVRE1Ag==" + }, "@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -24065,9 +24076,9 @@ "dev": true }, "url-parse": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz", - "integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==", + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.2.tgz", + "integrity": "sha512-6bTUPERy1muxxYClbzoRo5qtQuyoGEbzbQvi0SW4/8U8UyVkAQhWFBlnigqJkRm4su4x1zDQfNbEzWkt+vchcg==", "requires": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" diff --git a/package.json b/package.json index f8c350a825..784f3db300 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "check-environment": "node scripts/check-environment.js" }, "dependencies": { + "@realm.io/common": "^0.1.1", "bindings": "^1.5.0", "bson": "4.4.1", "command-line-args": "^5.1.1", diff --git a/packages/react-native-template-realm-js/package.json b/packages/react-native-template-realm-js/package.json index 2f872b37df..113292b488 100644 --- a/packages/react-native-template-realm-js/package.json +++ b/packages/react-native-template-realm-js/package.json @@ -1,6 +1,6 @@ { "name": "react-native-template-realm-js", - "version": "0.0.3", + "version": "0.0.5", "description": "React Native Template Realm JS", "scripts": { "lint": "cd template && npm run lint" diff --git a/packages/react-native-template-realm-js/template/_flowconfig b/packages/react-native-template-realm-js/template/_flowconfig index 7c3a4c6ae2..4320b7070e 100644 --- a/packages/react-native-template-realm-js/template/_flowconfig +++ b/packages/react-native-template-realm-js/template/_flowconfig @@ -25,6 +25,8 @@ emoji=true exact_by_default=true +format.bracket_spacing=false + module.file_ext=.js module.file_ext=.json module.file_ext=.ios.js @@ -60,4 +62,4 @@ untyped-import untyped-type-import [version] -^0.149.0 +^0.158.0 diff --git a/packages/react-native-template-realm-js/template/_gitignore b/packages/react-native-template-realm-js/template/_gitignore index ad572e632b..cc53454ef4 100644 --- a/packages/react-native-template-realm-js/template/_gitignore +++ b/packages/react-native-template-realm-js/template/_gitignore @@ -28,6 +28,7 @@ build/ .gradle local.properties *.iml +*.hprof # node.js # diff --git a/packages/react-native-template-realm-js/template/android/app/build.gradle b/packages/react-native-template-realm-js/template/android/app/build.gradle index 65de083a68..06f0d54151 100644 --- a/packages/react-native-template-realm-js/template/android/app/build.gradle +++ b/packages/react-native-template-realm-js/template/android/app/build.gradle @@ -120,6 +120,11 @@ def jscFlavor = 'org.webkit:android-jsc:+' */ def enableHermes = project.ext.react.get("enableHermes", false); +/** + * Architectures to build native code for in debug. + */ +def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures") + android { ndkVersion rootProject.ext.ndkVersion @@ -151,6 +156,11 @@ android { buildTypes { debug { signingConfig signingConfigs.debug + if (nativeArchitectures) { + ndk { + abiFilters nativeArchitectures.split(',') + } + } } release { // Caution! In production, you need to generate your own keystore file. @@ -186,7 +196,7 @@ dependencies { implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { - exclude group:'com.facebook.fbjni' + exclude group:'com.facebook.fbjni' } debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { diff --git a/packages/react-native-template-realm-js/template/android/app/src/main/res/values/styles.xml b/packages/react-native-template-realm-js/template/android/app/src/main/res/values/styles.xml index 9fab0be743..24bc061368 100644 --- a/packages/react-native-template-realm-js/template/android/app/src/main/res/values/styles.xml +++ b/packages/react-native-template-realm-js/template/android/app/src/main/res/values/styles.xml @@ -3,7 +3,6 @@ diff --git a/packages/react-native-template-realm-js/template/android/build.gradle b/packages/react-native-template-realm-js/template/android/build.gradle index e64d31e5fb..650989507d 100644 --- a/packages/react-native-template-realm-js/template/android/build.gradle +++ b/packages/react-native-template-realm-js/template/android/build.gradle @@ -6,14 +6,14 @@ buildscript { minSdkVersion = 21 compileSdkVersion = 30 targetSdkVersion = 30 - ndkVersion = "20.1.5948944" + ndkVersion = "21.4.7075529" } repositories { google() mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:4.2.1") + classpath("com.android.tools.build:gradle:4.2.2") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/packages/react-native-template-realm-js/template/android/gradle.properties b/packages/react-native-template-realm-js/template/android/gradle.properties index dbcbe6f208..cdb4c21108 100644 --- a/packages/react-native-template-realm-js/template/android/gradle.properties +++ b/packages/react-native-template-realm-js/template/android/gradle.properties @@ -25,4 +25,4 @@ android.useAndroidX=true android.enableJetifier=true # Version of flipper SDK to use with React Native -FLIPPER_VERSION=0.93.0 +FLIPPER_VERSION=0.99.0 diff --git a/packages/react-native-template-realm-js/template/ios/Podfile b/packages/react-native-template-realm-js/template/ios/Podfile index fb6dfbe3cd..e01f909d4f 100644 --- a/packages/react-native-template-realm-js/template/ios/Podfile +++ b/packages/react-native-template-realm-js/template/ios/Podfile @@ -25,5 +25,6 @@ target 'RealmJsTemplate' do post_install do |installer| react_native_post_install(installer) + __apply_Xcode_12_5_M1_post_install_workaround(installer) end end diff --git a/packages/react-native-template-realm-js/template/ios/RealmJsTemplate.xcodeproj/project.pbxproj b/packages/react-native-template-realm-js/template/ios/RealmJsTemplate.xcodeproj/project.pbxproj index 27dae57e0a..1ab474ef20 100644 --- a/packages/react-native-template-realm-js/template/ios/RealmJsTemplate.xcodeproj/project.pbxproj +++ b/packages/react-native-template-realm-js/template/ios/RealmJsTemplate.xcodeproj/project.pbxproj @@ -583,6 +583,7 @@ "$(inherited)", ); LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(inherited)\"", @@ -641,6 +642,7 @@ "$(inherited)", ); LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(inherited)\"", diff --git a/packages/react-native-template-realm-js/template/ios/RealmJsTemplate.xcworkspace/contents.xcworkspacedata b/packages/react-native-template-realm-js/template/ios/RealmJsTemplate.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index ed8dcc5ebb..0000000000 --- a/packages/react-native-template-realm-js/template/ios/RealmJsTemplate.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/packages/react-native-template-realm-js/template/package.json b/packages/react-native-template-realm-js/template/package.json index d1c5152e4a..b4dc7c7788 100644 --- a/packages/react-native-template-realm-js/template/package.json +++ b/packages/react-native-template-realm-js/template/package.json @@ -11,9 +11,9 @@ }, "dependencies": { "react": "17.0.2", - "react-native": "0.65.1", + "react-native": "0.66.1", "react-native-get-random-values": "^1.7.0", - "realm": "^10.7.0" + "realm": "^10.9.1" }, "devDependencies": { "@babel/core": "^7.12.9", @@ -22,11 +22,10 @@ "babel-jest": "^26.6.3", "eslint": "7.14.0", "jest": "^26.6.3", - "metro-react-native-babel-preset": "^0.66.0", - "react-native-codegen": "^0.0.7", + "metro-react-native-babel-preset": "^0.66.2", "react-test-renderer": "17.0.2" }, "jest": { "preset": "react-native" } -} +} \ No newline at end of file diff --git a/packages/react-native-template-realm-ts/package.json b/packages/react-native-template-realm-ts/package.json index fb45a13b21..79c3e207a0 100644 --- a/packages/react-native-template-realm-ts/package.json +++ b/packages/react-native-template-realm-ts/package.json @@ -1,6 +1,6 @@ { "name": "react-native-template-realm-ts", - "version": "0.0.3", + "version": "0.0.5", "description": "React Native Template Realm TS", "scripts": { "lint": "cd template && npm run lint" diff --git a/packages/react-native-template-realm-ts/template/_gitignore b/packages/react-native-template-realm-ts/template/_gitignore index ad572e632b..cc53454ef4 100644 --- a/packages/react-native-template-realm-ts/template/_gitignore +++ b/packages/react-native-template-realm-ts/template/_gitignore @@ -28,6 +28,7 @@ build/ .gradle local.properties *.iml +*.hprof # node.js # diff --git a/packages/react-native-template-realm-ts/template/android/app/build.gradle b/packages/react-native-template-realm-ts/template/android/app/build.gradle index 2d9e6b0a84..d77d370997 100644 --- a/packages/react-native-template-realm-ts/template/android/app/build.gradle +++ b/packages/react-native-template-realm-ts/template/android/app/build.gradle @@ -120,6 +120,11 @@ def jscFlavor = 'org.webkit:android-jsc:+' */ def enableHermes = project.ext.react.get("enableHermes", false); +/** + * Architectures to build native code for in debug. + */ +def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures") + android { ndkVersion rootProject.ext.ndkVersion @@ -151,6 +156,11 @@ android { buildTypes { debug { signingConfig signingConfigs.debug + if (nativeArchitectures) { + ndk { + abiFilters nativeArchitectures.split(',') + } + } } release { // Caution! In production, you need to generate your own keystore file. @@ -186,7 +196,7 @@ dependencies { implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { - exclude group:'com.facebook.fbjni' + exclude group:'com.facebook.fbjni' } debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { diff --git a/packages/react-native-template-realm-ts/template/android/app/src/main/res/values/styles.xml b/packages/react-native-template-realm-ts/template/android/app/src/main/res/values/styles.xml index 9fab0be743..24bc061368 100644 --- a/packages/react-native-template-realm-ts/template/android/app/src/main/res/values/styles.xml +++ b/packages/react-native-template-realm-ts/template/android/app/src/main/res/values/styles.xml @@ -3,7 +3,6 @@ diff --git a/packages/react-native-template-realm-ts/template/android/build.gradle b/packages/react-native-template-realm-ts/template/android/build.gradle index e64d31e5fb..650989507d 100644 --- a/packages/react-native-template-realm-ts/template/android/build.gradle +++ b/packages/react-native-template-realm-ts/template/android/build.gradle @@ -6,14 +6,14 @@ buildscript { minSdkVersion = 21 compileSdkVersion = 30 targetSdkVersion = 30 - ndkVersion = "20.1.5948944" + ndkVersion = "21.4.7075529" } repositories { google() mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:4.2.1") + classpath("com.android.tools.build:gradle:4.2.2") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/packages/react-native-template-realm-ts/template/android/gradle.properties b/packages/react-native-template-realm-ts/template/android/gradle.properties index dbcbe6f208..cdb4c21108 100644 --- a/packages/react-native-template-realm-ts/template/android/gradle.properties +++ b/packages/react-native-template-realm-ts/template/android/gradle.properties @@ -25,4 +25,4 @@ android.useAndroidX=true android.enableJetifier=true # Version of flipper SDK to use with React Native -FLIPPER_VERSION=0.93.0 +FLIPPER_VERSION=0.99.0 diff --git a/packages/react-native-template-realm-ts/template/ios/Podfile b/packages/react-native-template-realm-ts/template/ios/Podfile index 4000d47cc0..4ab4438994 100644 --- a/packages/react-native-template-realm-ts/template/ios/Podfile +++ b/packages/react-native-template-realm-ts/template/ios/Podfile @@ -25,5 +25,6 @@ target 'RealmTsTemplate' do post_install do |installer| react_native_post_install(installer) + __apply_Xcode_12_5_M1_post_install_workaround(installer) end end \ No newline at end of file diff --git a/packages/react-native-template-realm-ts/template/ios/Podfile.lock b/packages/react-native-template-realm-ts/template/ios/Podfile.lock deleted file mode 100644 index 7e4ffc7461..0000000000 --- a/packages/react-native-template-realm-ts/template/ios/Podfile.lock +++ /dev/null @@ -1,516 +0,0 @@ -PODS: - - boost-for-react-native (1.63.0) - - CocoaAsyncSocket (7.6.5) - - DoubleConversion (1.1.6) - - FBLazyVector (0.65.1) - - FBReactNativeSpec (0.65.1): - - RCT-Folly (= 2021.04.26.00) - - RCTRequired (= 0.65.1) - - RCTTypeSafety (= 0.65.1) - - React-Core (= 0.65.1) - - React-jsi (= 0.65.1) - - ReactCommon/turbomodule/core (= 0.65.1) - - Flipper (0.93.0): - - Flipper-Folly (~> 2.6) - - Flipper-RSocket (~> 1.4) - - Flipper-Boost-iOSX (1.76.0.1.11) - - Flipper-DoubleConversion (3.1.7) - - Flipper-Fmt (7.1.7) - - Flipper-Folly (2.6.7): - - Flipper-Boost-iOSX - - Flipper-DoubleConversion - - Flipper-Fmt (= 7.1.7) - - Flipper-Glog - - libevent (~> 2.1.12) - - OpenSSL-Universal (= 1.1.180) - - Flipper-Glog (0.3.6) - - Flipper-PeerTalk (0.0.4) - - Flipper-RSocket (1.4.3): - - Flipper-Folly (~> 2.6) - - FlipperKit (0.93.0): - - FlipperKit/Core (= 0.93.0) - - FlipperKit/Core (0.93.0): - - Flipper (~> 0.93.0) - - FlipperKit/CppBridge - - FlipperKit/FBCxxFollyDynamicConvert - - FlipperKit/FBDefines - - FlipperKit/FKPortForwarding - - FlipperKit/CppBridge (0.93.0): - - Flipper (~> 0.93.0) - - FlipperKit/FBCxxFollyDynamicConvert (0.93.0): - - Flipper-Folly (~> 2.6) - - FlipperKit/FBDefines (0.93.0) - - FlipperKit/FKPortForwarding (0.93.0): - - CocoaAsyncSocket (~> 7.6) - - Flipper-PeerTalk (~> 0.0.4) - - FlipperKit/FlipperKitHighlightOverlay (0.93.0) - - FlipperKit/FlipperKitLayoutHelpers (0.93.0): - - FlipperKit/Core - - FlipperKit/FlipperKitHighlightOverlay - - FlipperKit/FlipperKitLayoutTextSearchable - - FlipperKit/FlipperKitLayoutIOSDescriptors (0.93.0): - - FlipperKit/Core - - FlipperKit/FlipperKitHighlightOverlay - - FlipperKit/FlipperKitLayoutHelpers - - YogaKit (~> 1.18) - - FlipperKit/FlipperKitLayoutPlugin (0.93.0): - - FlipperKit/Core - - FlipperKit/FlipperKitHighlightOverlay - - FlipperKit/FlipperKitLayoutHelpers - - FlipperKit/FlipperKitLayoutIOSDescriptors - - FlipperKit/FlipperKitLayoutTextSearchable - - YogaKit (~> 1.18) - - FlipperKit/FlipperKitLayoutTextSearchable (0.93.0) - - FlipperKit/FlipperKitNetworkPlugin (0.93.0): - - FlipperKit/Core - - FlipperKit/FlipperKitReactPlugin (0.93.0): - - FlipperKit/Core - - FlipperKit/FlipperKitUserDefaultsPlugin (0.93.0): - - FlipperKit/Core - - FlipperKit/SKIOSNetworkPlugin (0.93.0): - - FlipperKit/Core - - FlipperKit/FlipperKitNetworkPlugin - - fmt (6.2.1) - - glog (0.3.5) - - libevent (2.1.12) - - OpenSSL-Universal (1.1.180) - - RCT-Folly (2021.04.26.00): - - boost-for-react-native - - DoubleConversion - - fmt (~> 6.2.1) - - glog - - RCT-Folly/Default (= 2021.04.26.00) - - RCT-Folly/Default (2021.04.26.00): - - boost-for-react-native - - DoubleConversion - - fmt (~> 6.2.1) - - glog - - RCTRequired (0.65.1) - - RCTTypeSafety (0.65.1): - - FBLazyVector (= 0.65.1) - - RCT-Folly (= 2021.04.26.00) - - RCTRequired (= 0.65.1) - - React-Core (= 0.65.1) - - React (0.65.1): - - React-Core (= 0.65.1) - - React-Core/DevSupport (= 0.65.1) - - React-Core/RCTWebSocket (= 0.65.1) - - React-RCTActionSheet (= 0.65.1) - - React-RCTAnimation (= 0.65.1) - - React-RCTBlob (= 0.65.1) - - React-RCTImage (= 0.65.1) - - React-RCTLinking (= 0.65.1) - - React-RCTNetwork (= 0.65.1) - - React-RCTSettings (= 0.65.1) - - React-RCTText (= 0.65.1) - - React-RCTVibration (= 0.65.1) - - React-callinvoker (0.65.1) - - React-Core (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default (= 0.65.1) - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/CoreModulesHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/Default (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/DevSupport (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default (= 0.65.1) - - React-Core/RCTWebSocket (= 0.65.1) - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-jsinspector (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTActionSheetHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTAnimationHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTBlobHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTImageHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTLinkingHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTNetworkHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTSettingsHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTTextHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTVibrationHeaders (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-Core/RCTWebSocket (0.65.1): - - glog - - RCT-Folly (= 2021.04.26.00) - - React-Core/Default (= 0.65.1) - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsiexecutor (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga - - React-CoreModules (0.65.1): - - FBReactNativeSpec (= 0.65.1) - - RCT-Folly (= 2021.04.26.00) - - RCTTypeSafety (= 0.65.1) - - React-Core/CoreModulesHeaders (= 0.65.1) - - React-jsi (= 0.65.1) - - React-RCTImage (= 0.65.1) - - ReactCommon/turbomodule/core (= 0.65.1) - - React-cxxreact (0.65.1): - - boost-for-react-native (= 1.63.0) - - DoubleConversion - - glog - - RCT-Folly (= 2021.04.26.00) - - React-callinvoker (= 0.65.1) - - React-jsi (= 0.65.1) - - React-jsinspector (= 0.65.1) - - React-perflogger (= 0.65.1) - - React-runtimeexecutor (= 0.65.1) - - React-jsi (0.65.1): - - boost-for-react-native (= 1.63.0) - - DoubleConversion - - glog - - RCT-Folly (= 2021.04.26.00) - - React-jsi/Default (= 0.65.1) - - React-jsi/Default (0.65.1): - - boost-for-react-native (= 1.63.0) - - DoubleConversion - - glog - - RCT-Folly (= 2021.04.26.00) - - React-jsiexecutor (0.65.1): - - DoubleConversion - - glog - - RCT-Folly (= 2021.04.26.00) - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-perflogger (= 0.65.1) - - React-jsinspector (0.65.1) - - React-perflogger (0.65.1) - - React-RCTActionSheet (0.65.1): - - React-Core/RCTActionSheetHeaders (= 0.65.1) - - React-RCTAnimation (0.65.1): - - FBReactNativeSpec (= 0.65.1) - - RCT-Folly (= 2021.04.26.00) - - RCTTypeSafety (= 0.65.1) - - React-Core/RCTAnimationHeaders (= 0.65.1) - - React-jsi (= 0.65.1) - - ReactCommon/turbomodule/core (= 0.65.1) - - React-RCTBlob (0.65.1): - - FBReactNativeSpec (= 0.65.1) - - RCT-Folly (= 2021.04.26.00) - - React-Core/RCTBlobHeaders (= 0.65.1) - - React-Core/RCTWebSocket (= 0.65.1) - - React-jsi (= 0.65.1) - - React-RCTNetwork (= 0.65.1) - - ReactCommon/turbomodule/core (= 0.65.1) - - React-RCTImage (0.65.1): - - FBReactNativeSpec (= 0.65.1) - - RCT-Folly (= 2021.04.26.00) - - RCTTypeSafety (= 0.65.1) - - React-Core/RCTImageHeaders (= 0.65.1) - - React-jsi (= 0.65.1) - - React-RCTNetwork (= 0.65.1) - - ReactCommon/turbomodule/core (= 0.65.1) - - React-RCTLinking (0.65.1): - - FBReactNativeSpec (= 0.65.1) - - React-Core/RCTLinkingHeaders (= 0.65.1) - - React-jsi (= 0.65.1) - - ReactCommon/turbomodule/core (= 0.65.1) - - React-RCTNetwork (0.65.1): - - FBReactNativeSpec (= 0.65.1) - - RCT-Folly (= 2021.04.26.00) - - RCTTypeSafety (= 0.65.1) - - React-Core/RCTNetworkHeaders (= 0.65.1) - - React-jsi (= 0.65.1) - - ReactCommon/turbomodule/core (= 0.65.1) - - React-RCTSettings (0.65.1): - - FBReactNativeSpec (= 0.65.1) - - RCT-Folly (= 2021.04.26.00) - - RCTTypeSafety (= 0.65.1) - - React-Core/RCTSettingsHeaders (= 0.65.1) - - React-jsi (= 0.65.1) - - ReactCommon/turbomodule/core (= 0.65.1) - - React-RCTText (0.65.1): - - React-Core/RCTTextHeaders (= 0.65.1) - - React-RCTVibration (0.65.1): - - FBReactNativeSpec (= 0.65.1) - - RCT-Folly (= 2021.04.26.00) - - React-Core/RCTVibrationHeaders (= 0.65.1) - - React-jsi (= 0.65.1) - - ReactCommon/turbomodule/core (= 0.65.1) - - React-runtimeexecutor (0.65.1): - - React-jsi (= 0.65.1) - - ReactCommon/turbomodule/core (0.65.1): - - DoubleConversion - - glog - - RCT-Folly (= 2021.04.26.00) - - React-callinvoker (= 0.65.1) - - React-Core (= 0.65.1) - - React-cxxreact (= 0.65.1) - - React-jsi (= 0.65.1) - - React-perflogger (= 0.65.1) - - Yoga (1.14.0) - - YogaKit (1.18.1): - - Yoga (~> 1.14) - -DEPENDENCIES: - - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) - - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) - - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) - - Flipper (= 0.93.0) - - Flipper-Boost-iOSX (= 1.76.0.1.11) - - Flipper-DoubleConversion (= 3.1.7) - - Flipper-Fmt (= 7.1.7) - - Flipper-Folly (= 2.6.7) - - Flipper-Glog (= 0.3.6) - - Flipper-PeerTalk (= 0.0.4) - - Flipper-RSocket (= 1.4.3) - - FlipperKit (= 0.93.0) - - FlipperKit/Core (= 0.93.0) - - FlipperKit/CppBridge (= 0.93.0) - - FlipperKit/FBCxxFollyDynamicConvert (= 0.93.0) - - FlipperKit/FBDefines (= 0.93.0) - - FlipperKit/FKPortForwarding (= 0.93.0) - - FlipperKit/FlipperKitHighlightOverlay (= 0.93.0) - - FlipperKit/FlipperKitLayoutPlugin (= 0.93.0) - - FlipperKit/FlipperKitLayoutTextSearchable (= 0.93.0) - - FlipperKit/FlipperKitNetworkPlugin (= 0.93.0) - - FlipperKit/FlipperKitReactPlugin (= 0.93.0) - - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.93.0) - - FlipperKit/SKIOSNetworkPlugin (= 0.93.0) - - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) - - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) - - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) - - React (from `../node_modules/react-native/`) - - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) - - React-Core (from `../node_modules/react-native/`) - - React-Core/DevSupport (from `../node_modules/react-native/`) - - React-Core/RCTWebSocket (from `../node_modules/react-native/`) - - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) - - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) - - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) - - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) - - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) - - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) - - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) - - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) - - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) - - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) - - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) - - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) - - React-RCTText (from `../node_modules/react-native/Libraries/Text`) - - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) - - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) - - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) - - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) - -SPEC REPOS: - trunk: - - boost-for-react-native - - CocoaAsyncSocket - - Flipper - - Flipper-Boost-iOSX - - Flipper-DoubleConversion - - Flipper-Fmt - - Flipper-Folly - - Flipper-Glog - - Flipper-PeerTalk - - Flipper-RSocket - - FlipperKit - - fmt - - libevent - - OpenSSL-Universal - - YogaKit - -EXTERNAL SOURCES: - DoubleConversion: - :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" - FBLazyVector: - :path: "../node_modules/react-native/Libraries/FBLazyVector" - FBReactNativeSpec: - :path: "../node_modules/react-native/React/FBReactNativeSpec" - glog: - :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" - RCT-Folly: - :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" - RCTRequired: - :path: "../node_modules/react-native/Libraries/RCTRequired" - RCTTypeSafety: - :path: "../node_modules/react-native/Libraries/TypeSafety" - React: - :path: "../node_modules/react-native/" - React-callinvoker: - :path: "../node_modules/react-native/ReactCommon/callinvoker" - React-Core: - :path: "../node_modules/react-native/" - React-CoreModules: - :path: "../node_modules/react-native/React/CoreModules" - React-cxxreact: - :path: "../node_modules/react-native/ReactCommon/cxxreact" - React-jsi: - :path: "../node_modules/react-native/ReactCommon/jsi" - React-jsiexecutor: - :path: "../node_modules/react-native/ReactCommon/jsiexecutor" - React-jsinspector: - :path: "../node_modules/react-native/ReactCommon/jsinspector" - React-perflogger: - :path: "../node_modules/react-native/ReactCommon/reactperflogger" - React-RCTActionSheet: - :path: "../node_modules/react-native/Libraries/ActionSheetIOS" - React-RCTAnimation: - :path: "../node_modules/react-native/Libraries/NativeAnimation" - React-RCTBlob: - :path: "../node_modules/react-native/Libraries/Blob" - React-RCTImage: - :path: "../node_modules/react-native/Libraries/Image" - React-RCTLinking: - :path: "../node_modules/react-native/Libraries/LinkingIOS" - React-RCTNetwork: - :path: "../node_modules/react-native/Libraries/Network" - React-RCTSettings: - :path: "../node_modules/react-native/Libraries/Settings" - React-RCTText: - :path: "../node_modules/react-native/Libraries/Text" - React-RCTVibration: - :path: "../node_modules/react-native/Libraries/Vibration" - React-runtimeexecutor: - :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" - ReactCommon: - :path: "../node_modules/react-native/ReactCommon" - Yoga: - :path: "../node_modules/react-native/ReactCommon/yoga" - -SPEC CHECKSUMS: - boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c - CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 - DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 - FBLazyVector: 33c82491102f20ecddb6c6a2c273696ace3191e0 - FBReactNativeSpec: df8f81d2a7541ee6755a047b398a5cb5a72acd0e - Flipper: b1fddf9a17c32097b2b4c806ad158b2f36bb2692 - Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c - Flipper-DoubleConversion: 57ffbe81ef95306cc9e69c4aa3aeeeeb58a6a28c - Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b - Flipper-Folly: 83af37379faa69497529e414bd43fbfc7cae259a - Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6 - Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 - Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541 - FlipperKit: aec2d931adeee48a07bab1ea8bcc8a6bb87dfce4 - fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 5337263514dd6f09803962437687240c5dc39aa4 - libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 - OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b - RCT-Folly: 0dd9e1eb86348ecab5ba76f910b56f4b5fef3c46 - RCTRequired: 6cf071ab2adfd769014b3d94373744ee6e789530 - RCTTypeSafety: b829c59453478bb5b02487b8de3336386ab93ab1 - React: 29d8a785041b96a2754c25cc16ddea57b7a618ce - React-callinvoker: 2857b61132bd7878b736e282581f4b42fd93002b - React-Core: 001e21bad5ca41e59e9d90df5c0b53da04c3ce8e - React-CoreModules: 0a0410ab296a62ab38e2f8d321e822d1fcc2fe49 - React-cxxreact: 8d904967134ae8ff0119c5357c42eaae976806f8 - React-jsi: 12913c841713a15f64eabf5c9ad98592c0ec5940 - React-jsiexecutor: 43f2542aed3c26e42175b339f8d37fe3dd683765 - React-jsinspector: 41e58e5b8e3e0bf061fdf725b03f2144014a8fb0 - React-perflogger: fd28ee1f2b5b150b00043f0301d96bd417fdc339 - React-RCTActionSheet: 7f3fa0855c346aa5d7c60f9ced16e067db6d29fa - React-RCTAnimation: 2119a18ee26159004b001bc56404ca5dbaae6077 - React-RCTBlob: a493cc306deeaba0c0efa8ecec2da154afd3a798 - React-RCTImage: 54999ddc896b7db6650af5760607aaebdf30425c - React-RCTLinking: 7fb3fa6397d3700c69c3d361870a299f04f1a2e6 - React-RCTNetwork: 329ee4f75bd2deb8cf6c4b14231b5bb272cbd9af - React-RCTSettings: 1a659d58e45719bc77c280dbebce6a5a5a2733f5 - React-RCTText: e12d7aae2a038be9ae72815436677a7c6549dd26 - React-RCTVibration: 92d41c2442e5328cc4d342cd7f78e5876b68bae5 - React-runtimeexecutor: 85187f19dd9c47a7c102f9994f9d14e4dc2110de - ReactCommon: eafed38eec7b591c31751bfa7494801618460459 - Yoga: aa0cb45287ebe1004c02a13f279c55a95f1572f4 - YogaKit: f782866e155069a2cca2517aafea43200b01fd5a - -PODFILE CHECKSUM: baf8a6784632308a52ca4aedf415d20c62656f06 - -COCOAPODS: 1.10.2 diff --git a/packages/react-native-template-realm-ts/template/ios/RealmTsTemplate.xcodeproj/project.pbxproj b/packages/react-native-template-realm-ts/template/ios/RealmTsTemplate.xcodeproj/project.pbxproj index 57c5c78785..0a1fd76dc8 100644 --- a/packages/react-native-template-realm-ts/template/ios/RealmTsTemplate.xcodeproj/project.pbxproj +++ b/packages/react-native-template-realm-ts/template/ios/RealmTsTemplate.xcodeproj/project.pbxproj @@ -583,6 +583,7 @@ "$(inherited)", ); LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(inherited)\"", @@ -641,6 +642,7 @@ "$(inherited)", ); LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(inherited)\"", diff --git a/packages/react-native-template-realm-ts/template/ios/RealmTsTemplate.xcworkspace/contents.xcworkspacedata b/packages/react-native-template-realm-ts/template/ios/RealmTsTemplate.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index ea529d68b2..0000000000 --- a/packages/react-native-template-realm-ts/template/ios/RealmTsTemplate.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/packages/react-native-template-realm-ts/template/package.json b/packages/react-native-template-realm-ts/template/package.json index 5dcc957f80..b265ddc531 100644 --- a/packages/react-native-template-realm-ts/template/package.json +++ b/packages/react-native-template-realm-ts/template/package.json @@ -11,9 +11,9 @@ }, "dependencies": { "react": "17.0.2", - "react-native": "0.65.1", + "react-native": "0.66.1", "react-native-get-random-values": "^1.7.0", - "realm": "^10.7.0" + "realm": "^10.9.1" }, "devDependencies": { "@babel/core": "^7.12.9", @@ -25,8 +25,7 @@ "babel-jest": "^26.6.3", "eslint": "^7.14.0", "jest": "^26.6.3", - "metro-react-native-babel-preset": "^0.66.0", - "react-native-codegen": "^0.0.7", + "metro-react-native-babel-preset": "^0.66.2", "react-test-renderer": "17.0.2", "typescript": "^3.8.3" }, @@ -44,4 +43,4 @@ "node" ] } -} +} \ No newline at end of file diff --git a/packages/realm-common/.eslintignore b/packages/realm-common/.eslintignore new file mode 100644 index 0000000000..72760ebe4d --- /dev/null +++ b/packages/realm-common/.eslintignore @@ -0,0 +1,2 @@ +/dist/ +/types/ diff --git a/packages/realm-common/.eslintrc.json b/packages/realm-common/.eslintrc.json new file mode 100644 index 0000000000..88610f5248 --- /dev/null +++ b/packages/realm-common/.eslintrc.json @@ -0,0 +1,9 @@ +{ + "parser": "@typescript-eslint/parser", + "extends": [ + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "@typescript-eslint/explicit-function-return-type": "off" + } +} \ No newline at end of file diff --git a/packages/realm-common/.gitignore b/packages/realm-common/.gitignore new file mode 100644 index 0000000000..ab8e4cb9c3 --- /dev/null +++ b/packages/realm-common/.gitignore @@ -0,0 +1,2 @@ +dist/ +types/generated/ diff --git a/packages/realm-common/LICENSE b/packages/realm-common/LICENSE new file mode 120000 index 0000000000..30cff7403d --- /dev/null +++ b/packages/realm-common/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/packages/realm-common/README.md b/packages/realm-common/README.md new file mode 100644 index 0000000000..3886db3c23 --- /dev/null +++ b/packages/realm-common/README.md @@ -0,0 +1,5 @@ +# realm-common + +A place for common code to be shared between Realm JS and Realm Web. + +This is an internal package of Realm JS, not intended for public consumption. diff --git a/packages/realm-common/package-lock.json b/packages/realm-common/package-lock.json new file mode 100644 index 0000000000..cf4a25613d --- /dev/null +++ b/packages/realm-common/package-lock.json @@ -0,0 +1,1427 @@ +{ + "name": "@realm.io/common", + "version": "0.1.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@realm.io/common", + "version": "0.1.0", + "license": "SEE LICENSE IN LICENSE", + "devDependencies": { + "@rollup/plugin-commonjs": "^14.0.0", + "@rollup/plugin-node-resolve": "^7.1.3", + "@rollup/plugin-typescript": "^4.1.1", + "@types/chai": "^4.2.10", + "@types/mocha": "^5", + "chai": "^4.2.0", + "mocha": "^5.2.0", + "rollup": "^2.6.1", + "rollup-plugin-dts": "^1.4.0", + "ts-node": "^8.8.2", + "typescript": "^4.2.4" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "dev": true, + "optional": true, + "dependencies": { + "@babel/highlight": "^7.12.13" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true, + "optional": true + }, + "node_modules/@babel/highlight": { + "version": "7.13.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "dev": true, + "optional": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-14.0.0.tgz", + "integrity": "sha512-+PSmD9ePwTAeU106i9FRdc+Zb3XUWyW26mo5Atr2mk82hor8+nPwkztEjFo8/B1fJKfaQDg9aM2bzQkjhi7zOw==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.0.8", + "commondir": "^1.0.1", + "estree-walker": "^1.0.1", + "glob": "^7.1.2", + "is-reference": "^1.1.2", + "magic-string": "^0.25.2", + "resolve": "^1.11.0" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^2.3.4" + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", + "integrity": "sha512-RxtSL3XmdTAE2byxekYLnx+98kEUOrPHF/KRVjLH+DEIHy6kjIw7YINQzn+NXiH/NTrQLAwYs0GWB+csWygA9Q==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.0.8", + "@types/resolve": "0.0.8", + "builtin-modules": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.14.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@rollup/plugin-typescript": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-4.1.2.tgz", + "integrity": "sha512-+7UlGat/99e2JbmGNnIauxwEhYLwrL7adO/tSJxUN57xrrS3Ps+ZzYpLCDGPZJ57j+ZJTZLLN89KXW9JMEB+jg==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.0.1", + "resolve": "^1.14.1" + }, + "engines": { + "node": ">=8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0", + "tslib": "*", + "typescript": ">=2.1.0" + } + }, + "node_modules/@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "dependencies": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@types/chai": { + "version": "4.2.16", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.16.tgz", + "integrity": "sha512-vI5iOAsez9+roLS3M3+Xx7w+WRuDtSmF8bQkrbcIJ2sC1PcDgVoA0WGpa+bIrJ+y8zqY2oi//fUctkxtIcXJCw==", + "dev": true + }, + "node_modules/@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "node_modules/@types/mocha": { + "version": "5.2.7", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", + "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "14.14.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.41.tgz", + "integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==", + "dev": true + }, + "node_modules/@types/resolve": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", + "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "optional": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "node_modules/builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "optional": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "optional": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true, + "optional": true + }, + "node_modules/commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "optional": true + }, + "node_modules/magic-string": { + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "dev": true, + "dependencies": { + "sourcemap-codec": "^1.4.4" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dev": true, + "dependencies": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/mocha/node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "node_modules/mocha/node_modules/mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "dev": true, + "dependencies": { + "minimist": "0.0.8" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/picomatch": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", + "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rollup": { + "version": "2.45.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.45.2.tgz", + "integrity": "sha512-kRRU7wXzFHUzBIv0GfoFFIN3m9oteY4uAsKllIpQDId5cfnkWF2J130l+27dzDju0E6MScKiV0ZM5Bw8m4blYQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.1" + } + }, + "node_modules/rollup-plugin-dts": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/rollup-plugin-dts/-/rollup-plugin-dts-1.4.14.tgz", + "integrity": "sha512-H33aGCUbp/Lm+tbkG5gZePnuWvvaafkwh7Uh4RYJs0/ChOfWlENCby1wOn+xBVsCzpV/g/+OVYqgzVjT80dNJg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/Swatinem" + }, + "optionalDependencies": { + "@babel/code-frame": "^7.10.4" + }, + "peerDependencies": { + "rollup": "^2.33.1", + "typescript": "^4.0.5" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "optional": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ts-node": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "dev": true, + "dependencies": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "engines": { + "node": ">=6.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "peer": true + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/typescript": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "dev": true, + "optional": true, + "requires": { + "@babel/highlight": "^7.12.13" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true, + "optional": true + }, + "@babel/highlight": { + "version": "7.13.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "dev": true, + "optional": true, + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@rollup/plugin-commonjs": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-14.0.0.tgz", + "integrity": "sha512-+PSmD9ePwTAeU106i9FRdc+Zb3XUWyW26mo5Atr2mk82hor8+nPwkztEjFo8/B1fJKfaQDg9aM2bzQkjhi7zOw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8", + "commondir": "^1.0.1", + "estree-walker": "^1.0.1", + "glob": "^7.1.2", + "is-reference": "^1.1.2", + "magic-string": "^0.25.2", + "resolve": "^1.11.0" + } + }, + "@rollup/plugin-node-resolve": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", + "integrity": "sha512-RxtSL3XmdTAE2byxekYLnx+98kEUOrPHF/KRVjLH+DEIHy6kjIw7YINQzn+NXiH/NTrQLAwYs0GWB+csWygA9Q==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8", + "@types/resolve": "0.0.8", + "builtin-modules": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.14.2" + } + }, + "@rollup/plugin-typescript": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-4.1.2.tgz", + "integrity": "sha512-+7UlGat/99e2JbmGNnIauxwEhYLwrL7adO/tSJxUN57xrrS3Ps+ZzYpLCDGPZJ57j+ZJTZLLN89KXW9JMEB+jg==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.1", + "resolve": "^1.14.1" + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, + "@types/chai": { + "version": "4.2.16", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.16.tgz", + "integrity": "sha512-vI5iOAsez9+roLS3M3+Xx7w+WRuDtSmF8bQkrbcIJ2sC1PcDgVoA0WGpa+bIrJ+y8zqY2oi//fUctkxtIcXJCw==", + "dev": true + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "@types/mocha": { + "version": "5.2.7", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", + "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", + "dev": true + }, + "@types/node": { + "version": "14.14.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.41.tgz", + "integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==", + "dev": true + }, + "@types/resolve": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", + "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "dev": true + }, + "chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "optional": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "optional": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true, + "optional": true + }, + "commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "requires": { + "@types/estree": "*" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "optional": true + }, + "magic-string": { + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dev": true, + "requires": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, + "picomatch": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", + "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", + "dev": true + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "rollup": { + "version": "2.45.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.45.2.tgz", + "integrity": "sha512-kRRU7wXzFHUzBIv0GfoFFIN3m9oteY4uAsKllIpQDId5cfnkWF2J130l+27dzDju0E6MScKiV0ZM5Bw8m4blYQ==", + "dev": true, + "requires": { + "fsevents": "~2.3.1" + } + }, + "rollup-plugin-dts": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/rollup-plugin-dts/-/rollup-plugin-dts-1.4.14.tgz", + "integrity": "sha512-H33aGCUbp/Lm+tbkG5gZePnuWvvaafkwh7Uh4RYJs0/ChOfWlENCby1wOn+xBVsCzpV/g/+OVYqgzVjT80dNJg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "optional": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "ts-node": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "peer": true + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "typescript": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + } + } +} diff --git a/packages/realm-common/package.json b/packages/realm-common/package.json new file mode 100644 index 0000000000..f1e5ac6f33 --- /dev/null +++ b/packages/realm-common/package.json @@ -0,0 +1,50 @@ +{ + "name": "@realm.io/common", + "version": "0.1.1", + "description": "Cross-product common code used by Realm", + "main": "./dist/bundle.cjs.js", + "module": "./dist/bundle.es.js", + "types": "./dist/bundle.d.ts", + "browser": { + "./dist/bundle.cjs.js": "./dist/bundle.dom.cjs.js", + "./dist/bundle.es.js": "./dist/bundle.dom.es.js", + "./dist/bundle.d.ts": "./dist/bundle.dom.d.ts" + }, + "scripts": { + "generate-types": "tsc --project tsconfig.types.json --declaration --emitDeclarationOnly --declarationDir types/generated", + "build": "npm run generate-types && rollup --config", + "lint": "eslint --ext .js,.ts .", + "test": "mocha 'src/**/*.test.ts'", + "prepare": "rm -rf dist && npm run build" + }, + "files": [ + "dist" + ], + "author": { + "name": "Realm", + "email": "help@realm.io", + "url": "https://realm.io" + }, + "repository": { + "type": "git", + "url": "https://github.com/realm/realm-js.git" + }, + "bugs": { + "url": "https://github.com/realm/realm-js/issues" + }, + "license": "SEE LICENSE IN LICENSE", + "dependencies": {}, + "devDependencies": { + "@rollup/plugin-commonjs": "^14.0.0", + "@rollup/plugin-node-resolve": "^7.1.3", + "@rollup/plugin-typescript": "^4.1.1", + "@types/chai": "^4.2.10", + "@types/mocha": "^5", + "chai": "^4.2.0", + "mocha": "^5.2.0", + "rollup": "^2.6.1", + "rollup-plugin-dts": "^1.4.0", + "ts-node": "^8.8.2", + "typescript": "^4.2.4" + } +} diff --git a/packages/realm-common/rollup.config.js b/packages/realm-common/rollup.config.js new file mode 100644 index 0000000000..6b37d90f1d --- /dev/null +++ b/packages/realm-common/rollup.config.js @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////////////////////// +// +// Copyright 2021 Realm Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////// + +import typescript from "@rollup/plugin-typescript"; +import nodeResolve from "@rollup/plugin-node-resolve"; +import commonjs from "@rollup/plugin-commonjs"; +import dts from "rollup-plugin-dts"; + +import pkg from "./package.json"; + +export default [ + { + input: "src/node/index.ts", + output: [ + { + file: pkg.main, + format: "cjs", + }, + { + file: pkg.module, + format: "es", + }, + ], + plugins: [ + commonjs(), + typescript({ + tsconfig: "src/node/tsconfig.json", + }), + ], + external: [], + }, + { + input: "src/dom/index.ts", + output: [ + { + file: pkg.browser[pkg.main], + format: "cjs", + }, + { + file: pkg.browser[pkg.module], + format: "es", + }, + ], + plugins: [ + typescript({ + tsconfig: "src/dom/tsconfig.json", + }), + nodeResolve(), + ], + }, + { + input: "types/generated/index.d.ts", + output: { + file: "dist/bundle.d.ts", + format: "es", + }, + plugins: [dts(), nodeResolve()], + }, +]; diff --git a/packages/realm-common/src/deprecation.ts b/packages/realm-common/src/deprecation.ts new file mode 100644 index 0000000000..55d5ba3139 --- /dev/null +++ b/packages/realm-common/src/deprecation.ts @@ -0,0 +1,86 @@ +//////////////////////////////////////////////////////////////////////////// +// +// Copyright 2021 Realm Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////// + +import { isDevelopmentMode } from "./environment"; + +/** + * Display a deprecation warning for features being removed in the next major version + * to users in development mode (as best as we can detect this, see `isDevelopmentMode`) + * + * @param deprecatedItem The method signature or name of the deprecated item + * @param suggestedReplacement The method signature or name of the suggested replacement + */ +export const deprecationWarning = (deprecatedItem: string, suggestedReplacement: string): void => { + if (!isDevelopmentMode) return; + + console.warn( + `Deprecation warning from Realm: ${deprecatedItem} is deprecated and will be removed in a future major release. Consider switching to ${suggestedReplacement}.`, + ); +}; + +/** + * Helper function for migrating from positional arguments to a single dictionary argument. + * Check the arguments passed to a function, if the first argument is not an object (i.e. it + * is presumed to be a deprecated positional-style call), shows a deprecation warning and + * converts the positional arguments into an object matching the expected "new" shape. + * + * @param args Array of arguments passed to the function (captured with `...args`). + * @param methodName The name of the method, used to show the deprecation warning. + * @param argNames The list of positional argument names, used to covert them into + * an object if a deprecated call is made and to show the deprecation warning. + * @param hasRestArgs Optional flag indicating that the function's final argument is + * `...args` (to capture any extra arguments), in which case we capture them and return + * as the second element of the return array. + * + * @returns An object containing: + * + * argsObject: a dictionary of function arguments, either passed through from args[0] if + * args[0] is an object, or created from `args` and `argNames` if the args are a + * deprecated positional argument call. + * + * restArgs: an array of the "...args" passed to the function if `hasRestArgs` is true; + * otherwise it is `undefined`. + */ +// Allow use of `object` type +// eslint-disable-next-line @typescript-eslint/ban-types +export const handleDeprecatedPositionalArgs = ( + args: [T, ...unknown[]] | unknown[], + methodName: string, + argNames: (keyof T)[], + hasRestArgs?: boolean, +): { argsObject: T; restArgs: unknown[] | undefined } => { + if (typeof args[0] !== "object") { + const restArgsText = hasRestArgs ? ", ...args" : ""; + + deprecationWarning( + `${methodName}(${argNames.join(", ")}${restArgsText})`, + `${methodName}({ ${argNames.join(", ")} }${restArgsText})`, + ); + + // Convert the array of arguments into a dictionary keyed by the relevant argName + const argsObject = argNames.reduce((prev, argName, index) => { + return { ...prev, [argName]: args[index] }; + }, {} as T); + + const restArgs = hasRestArgs ? args.slice(argNames.length) : undefined; + + return { argsObject, restArgs }; + } + + return { argsObject: args[0] as T, restArgs: hasRestArgs ? args.slice(1) : undefined }; +}; diff --git a/packages/realm-common/src/dom/index.ts b/packages/realm-common/src/dom/index.ts new file mode 100644 index 0000000000..97a9cf7f05 --- /dev/null +++ b/packages/realm-common/src/dom/index.ts @@ -0,0 +1,24 @@ +//////////////////////////////////////////////////////////////////////////// +// +// Copyright 2021 Realm Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////// + +import { setIsDevelopmentMode } from "../environment"; + +// React/React Native set a global __DEV__ variable when running in dev mode +setIsDevelopmentMode(typeof __DEV__ !== "undefined" && __DEV__); + +export * from "../index"; diff --git a/packages/realm-common/src/dom/tsconfig.json b/packages/realm-common/src/dom/tsconfig.json new file mode 100644 index 0000000000..6b08909e38 --- /dev/null +++ b/packages/realm-common/src/dom/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "lib": [ + "ES2015", + "DOM" + ] + }, + "exclude": [ + "../node/*", + "../**/*.test.ts" + ] +} \ No newline at end of file diff --git a/packages/realm-common/src/environment.ts b/packages/realm-common/src/environment.ts new file mode 100644 index 0000000000..4391466d97 --- /dev/null +++ b/packages/realm-common/src/environment.ts @@ -0,0 +1,38 @@ +//////////////////////////////////////////////////////////////////////////// +// +// Copyright 2021 Realm Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////// + +/** + * Check whether the user's app is running in "development mode" (e.g. `npm run dev` + * for a React app, or `NODE_ENV=development` for a Node app). Each platform's entry + * point should define the value of this using `setIsDevelopmentMode`. + * The default behaviour is to always return `false`. + * + * @returns true if the user's app is running in development mode, false otherwise + */ +export let isDevelopmentMode = false; + +/** + * Set the value of `isDevelopmentMode`. This allows each entry point (node vs DOM) + * to use its own method for determining whether we are in development mode. + * + * @param state A boolean indicating whether the user's app is running in + * development mode or not. + */ +export const setIsDevelopmentMode = (state: boolean): void => { + isDevelopmentMode = state; +}; diff --git a/packages/realm-common/src/index.ts b/packages/realm-common/src/index.ts new file mode 100644 index 0000000000..201d3b2476 --- /dev/null +++ b/packages/realm-common/src/index.ts @@ -0,0 +1,19 @@ +//////////////////////////////////////////////////////////////////////////// +// +// Copyright 2021 Realm Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////// + +export { deprecationWarning, handleDeprecatedPositionalArgs } from "./deprecation"; diff --git a/packages/realm-common/src/node/index.ts b/packages/realm-common/src/node/index.ts new file mode 100644 index 0000000000..6eef1c10ac --- /dev/null +++ b/packages/realm-common/src/node/index.ts @@ -0,0 +1,39 @@ +//////////////////////////////////////////////////////////////////////////// +// +// Copyright 2021 Realm Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////// + +import { setIsDevelopmentMode } from "../environment"; + +// Exported for unit testing +export const isDevelopmentModeImpl = () => { + try { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { app } = require("electron"); + // We are in an electron app, check if the app is packaged (release mode) + return app !== undefined && !app.isPackaged; + } catch (_) { + // ignore error + } + + // Node.js has no default for NODE_ENV, so check if it is anything other than + // "production" to catch cases where it is just started with `node index.js` + return process.env?.NODE_ENV !== "production"; +}; + +setIsDevelopmentMode(isDevelopmentModeImpl()); + +export * from "../index"; diff --git a/packages/realm-common/src/node/tsconfig.json b/packages/realm-common/src/node/tsconfig.json new file mode 100644 index 0000000000..ed1fe1c273 --- /dev/null +++ b/packages/realm-common/src/node/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "types": [ + ], + "lib": [ + "ES2015" + ] + }, + "exclude": [ + "../dom/*", + "../**/*.test.ts" + ] +} \ No newline at end of file diff --git a/packages/realm-common/src/tests/deprecation.test.ts b/packages/realm-common/src/tests/deprecation.test.ts new file mode 100644 index 0000000000..1cf43fa606 --- /dev/null +++ b/packages/realm-common/src/tests/deprecation.test.ts @@ -0,0 +1,124 @@ +//////////////////////////////////////////////////////////////////////////// +// +// Copyright 2021 Realm Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////// + +import { expect } from "chai"; + +import { handleDeprecatedPositionalArgs } from "../deprecation"; + +describe("Deprecation handling", () => { + describe("handleDeprecatedPositionalArgs", () => { + let consoleOutput: unknown[] = []; + const originalConsoleWarn = console.warn; + + // Capture console.warn output to an array for the duration of the test so we can assert warnings were(n't) logged + beforeEach(() => { + console.warn = (x) => consoleOutput.push(x); + consoleOutput = []; + }); + + afterEach(() => { + console.warn = originalConsoleWarn; + }); + + describe("without restArgs", () => { + it("does nothing if the first argument is an object", () => { + const arg = { testArg: 1 }; + const result = handleDeprecatedPositionalArgs<{ testArg: number }>([arg], "test", ["testArg"]); + + expect(result.argsObject).equals(arg); + expect(result.restArgs).to.be.undefined; + + expect(consoleOutput).to.have.length(0); + }); + + it("converts a single positional argument into an object and shows a deprecation warning", () => { + const result = handleDeprecatedPositionalArgs<{ testArg: number }>([1], "test", ["testArg"]); + + expect(result.argsObject).deep.equals({ testArg: 1 }); + expect(result.restArgs).to.be.undefined; + + expect(consoleOutput).to.have.length(1); + expect(consoleOutput[0]).to.equal( + "Deprecation warning from Realm: test(testArg) is deprecated and will be removed in a future major release. Consider switching to test({ testArg }).", + ); + }); + + it("converts multiple positional arguments into an object and shows a deprecation warning", () => { + const result = handleDeprecatedPositionalArgs<{ testArg1: number; testArg2: string; testArg3: boolean }>( + [1, "a", false], + "test", + ["testArg1", "testArg2", "testArg3"], + ); + + expect(result.argsObject).deep.equals({ testArg1: 1, testArg2: "a", testArg3: false }); + expect(result.restArgs).to.be.undefined; + + expect(consoleOutput).to.have.length(1); + expect(consoleOutput[0]).to.equal( + "Deprecation warning from Realm: test(testArg1, testArg2, testArg3) is deprecated and will be removed in a future major release. Consider switching to test({ testArg1, testArg2, testArg3 }).", + ); + }); + }); + + describe("with restArgs", () => { + it("does nothing and passes through restArgs if the first argument is an object", () => { + const arg = { testArg: 1 }; + const result = handleDeprecatedPositionalArgs<{ testArg: number }>( + [arg, "a", false], + "test", + ["testArg"], + true, + ); + + expect(result.argsObject).equals(arg); + expect(result.restArgs).deep.equals(["a", false]); + + expect(consoleOutput).to.have.length(0); + }); + + it("converts a single positional argument into an object, passes through restArgs, and shows a deprecation warning", () => { + const result = handleDeprecatedPositionalArgs<{ testArg: number }>([1, "a", false], "test", ["testArg"], true); + + expect(result.argsObject).deep.equals({ testArg: 1 }); + expect(result.restArgs).deep.equals(["a", false]); + + expect(consoleOutput).to.have.length(1); + expect(consoleOutput[0]).to.equal( + "Deprecation warning from Realm: test(testArg, ...args) is deprecated and will be removed in a future major release. Consider switching to test({ testArg }, ...args).", + ); + }); + + it("converts multiple positional arguments into an object passes through restArgs, and shows a deprecation warning", () => { + const result = handleDeprecatedPositionalArgs<{ testArg1: number; testArg2: string; testArg3: boolean }>( + [1, "a", false, "b", true], + "test", + ["testArg1", "testArg2", "testArg3"], + true, + ); + + expect(result.argsObject).deep.equals({ testArg1: 1, testArg2: "a", testArg3: false }); + expect(result.restArgs).deep.equals(["b", true]); + + expect(consoleOutput).to.have.length(1); + expect(consoleOutput[0]).to.equal( + "Deprecation warning from Realm: test(testArg1, testArg2, testArg3, ...args) is deprecated and will be removed in a future major release. Consider switching to test({ testArg1, testArg2, testArg3 }, ...args).", + ); + }); + }); + }); +}); diff --git a/packages/realm-common/src/tests/environment.test.ts b/packages/realm-common/src/tests/environment.test.ts new file mode 100644 index 0000000000..f6c4640087 --- /dev/null +++ b/packages/realm-common/src/tests/environment.test.ts @@ -0,0 +1,49 @@ +//////////////////////////////////////////////////////////////////////////// +// +// Copyright 2021 Realm Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////// + +import { expect } from "chai"; + +import { isDevelopmentModeImpl } from "../node"; + +describe("Environment utilities", () => { + describe("isDevelopmentMode (node implementation)", () => { + let originalEnv: string | undefined; + beforeEach(() => { + originalEnv = process.env.NODE_ENV; + }); + + afterEach(() => { + process.env.NODE_ENV = originalEnv; + }); + + it("returns true if NODE_ENV is undefined", () => { + process.env.NODE_ENV = undefined; + expect(isDevelopmentModeImpl()).to.equal(true); + }); + + it("returns true if NODE_ENV is development", () => { + process.env.NODE_ENV = "development"; + expect(isDevelopmentModeImpl()).to.equal(true); + }); + + it("returns false if NODE_ENV is production", () => { + process.env.NODE_ENV = "production"; + expect(isDevelopmentModeImpl()).to.equal(false); + }); + }); +}); diff --git a/packages/realm-common/src/tests/tsconfig.json b/packages/realm-common/src/tests/tsconfig.json new file mode 100644 index 0000000000..fdcf92daec --- /dev/null +++ b/packages/realm-common/src/tests/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "noResolve": false, + "types": [ + "mocha", + "chai", + "node" + ] + } +} \ No newline at end of file diff --git a/packages/realm-common/test/mocha.opts b/packages/realm-common/test/mocha.opts new file mode 100644 index 0000000000..422b5e4e57 --- /dev/null +++ b/packages/realm-common/test/mocha.opts @@ -0,0 +1,3 @@ +--watch-extensions ts +--require ts-node/register/transpile-only +--file src/node/index.ts diff --git a/packages/realm-common/test/tsconfig.json b/packages/realm-common/test/tsconfig.json new file mode 100644 index 0000000000..fdcf92daec --- /dev/null +++ b/packages/realm-common/test/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "noResolve": false, + "types": [ + "mocha", + "chai", + "node" + ] + } +} \ No newline at end of file diff --git a/packages/realm-common/tsconfig.json b/packages/realm-common/tsconfig.json new file mode 100644 index 0000000000..6222babfad --- /dev/null +++ b/packages/realm-common/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "target": "es2018", + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true, + "noResolve": true, + "typeRoots": [ + "./types", + "./node_modules/@types" + ], + "types": [], + "lib": [ + "ES2018", + "ES2018.AsyncIterable" + ] + }, + "include": [ + "src/**/*.ts", + "types/index.d.ts", + "types/generated/app.d.ts" + ], + "exclude": [] +} \ No newline at end of file diff --git a/packages/realm-common/tsconfig.types.json b/packages/realm-common/tsconfig.types.json new file mode 100644 index 0000000000..cbf4f92cd2 --- /dev/null +++ b/packages/realm-common/tsconfig.types.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "types": [], + "emitDeclarationOnly": true + }, + "exclude": [ + "src/node/index.ts", + "src/dom/index.ts", + "src/**/*.test.ts" + ] +} \ No newline at end of file diff --git a/packages/realm-common/types/index.d.ts b/packages/realm-common/types/index.d.ts new file mode 100644 index 0000000000..3434c2c5ca --- /dev/null +++ b/packages/realm-common/types/index.d.ts @@ -0,0 +1,23 @@ +interface Console { + error(message?: unknown, ...optionalParams: unknown[]): void; + log(message?: unknown, ...optionalParams: unknown[]): void; + warn(message?: unknown, ...optionalParams: unknown[]): void; +} + +declare const console: Console; + +interface Process { + env: { NODE_ENV: string | undefined }; +} + +declare const process: Process; + +interface Window {} + +declare const window: Window | undefined; + +declare const __DEV__: boolean | undefined; + +type Require = (id: string) => { app?: { isPackaged: boolean } }; + +declare const require: Require; diff --git a/packages/realm-network-transport/.watchmanconfig b/packages/realm-network-transport/.watchmanconfig new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/realm-network-transport/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/realm-network-transport/package-lock.json b/packages/realm-network-transport/package-lock.json index 0f223375a7..dd3c1d868f 100644 --- a/packages/realm-network-transport/package-lock.json +++ b/packages/realm-network-transport/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "realm-network-transport", "version": "0.7.0", "license": "SEE LICENSE IN LICENSE", "dependencies": { diff --git a/packages/realm-network-transport/package.json b/packages/realm-network-transport/package.json index 947ec4d429..e479f299b1 100644 --- a/packages/realm-network-transport/package.json +++ b/packages/realm-network-transport/package.json @@ -15,7 +15,7 @@ "build": "npm run generate-types && rollup --config", "lint": "eslint --ext .js,.ts .", "test": "mocha 'src/**/*.test.ts'", - "prepare": "rm -rf dist && npm run build" + "prepare": "npm run build" }, "files": [ "dist" diff --git a/packages/realm-network-transport/rollup.config.js b/packages/realm-network-transport/rollup.config.js index 6cbc2b9d63..06a1bf2ba1 100644 --- a/packages/realm-network-transport/rollup.config.js +++ b/packages/realm-network-transport/rollup.config.js @@ -66,7 +66,7 @@ export default [ { input: "types/generated/index.d.ts", output: { - file: "dist/bundle.d.ts", + file: pkg.types, format: "es", }, plugins: [dts(), nodeResolve()], diff --git a/packages/realm-web-integration-tests/package-lock.json b/packages/realm-web-integration-tests/package-lock.json index c9871a40b0..1107402467 100644 --- a/packages/realm-web-integration-tests/package-lock.json +++ b/packages/realm-web-integration-tests/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "realm-web-integration-tests", "version": "0.1.0", "dependencies": { "chai": "^4.2.0", diff --git a/packages/realm-web-integration-tests/src/credentials.test.ts b/packages/realm-web-integration-tests/src/credentials.test.ts index a81b5aa0d3..2626e6a78a 100644 --- a/packages/realm-web-integration-tests/src/credentials.test.ts +++ b/packages/realm-web-integration-tests/src/credentials.test.ts @@ -45,7 +45,7 @@ describe("Credentials", () => { const email = `gilfoil-${nonce}@testing.mongodb.com`; const password = "v3ry-s3cret"; // Register the user - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); // Log in const credentials = Credentials.emailPassword(email, password); expect(credentials.payload.username).equals(email); diff --git a/packages/realm-web-integration-tests/src/email-password-auth.test.ts b/packages/realm-web-integration-tests/src/email-password-auth.test.ts index e079c7177b..5114de877d 100644 --- a/packages/realm-web-integration-tests/src/email-password-auth.test.ts +++ b/packages/realm-web-integration-tests/src/email-password-auth.test.ts @@ -29,7 +29,7 @@ describe("EmailPasswordAuth", () => { const email = `gilfoil-${nonce}@testing.mongodb.com`; const password = "my-super-secret-password"; // Register a user - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); // Authenticate const newCredentials = Credentials.emailPassword(email, password); await app.logIn(newCredentials); @@ -43,10 +43,10 @@ describe("EmailPasswordAuth", () => { const email = `gilfoil-${nonce}@testing.mongodb.com`; const password = "my-super-secret-password"; // Register a user - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); // Ask for a new confirmation email try { - await app.emailPasswordAuth.confirmUser("e30=", "some-token-id"); + await app.emailPasswordAuth.confirmUser({ token: "e30=", tokenId: "some-token-id" }); } catch (err) { // We expect this to throw, since we're feading in an invalid token expect(err).instanceOf(MongoDBRealmError); @@ -62,10 +62,10 @@ describe("EmailPasswordAuth", () => { const email = `gilfoil-${nonce}@testing.mongodb.com`; const password = "my-super-secret-password"; // Register a user - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); // Ask for a new confirmation email try { - await app.emailPasswordAuth.resendConfirmationEmail(email); + await app.emailPasswordAuth.resendConfirmationEmail({ email }); } catch (err) { // We expect this to throw, since users are automatically confirmed with this app configuration expect(err).instanceOf(MongoDBRealmError); @@ -81,10 +81,10 @@ describe("EmailPasswordAuth", () => { const email = `gilfoil-${nonce}@testing.mongodb.com`; const password = "my-super-secret-password"; // Register a user - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); // Ask for a new confirmation email try { - await app.emailPasswordAuth.retryCustomConfirmation(email); + await app.emailPasswordAuth.retryCustomConfirmation({ email }); } catch (err) { // We expect this to throw, since the app does not currently have custom confirmation enabled // TODO: import an app with custom confirmation enabled @@ -101,10 +101,10 @@ describe("EmailPasswordAuth", () => { const email = `gilfoil-${nonce}@testing.mongodb.com`; const password = "my-super-secret-password"; // Register a user - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); // Ask for a password reset try { - await app.emailPasswordAuth.sendResetPasswordEmail(email); + await app.emailPasswordAuth.sendResetPasswordEmail({ email }); } catch (err) { // We expect this to throw, since password resets via email is disabled with this app configuration expect(err).instanceOf(MongoDBRealmError); @@ -120,10 +120,10 @@ describe("EmailPasswordAuth", () => { const email = `gilfoil-${nonce}@testing.mongodb.com`; const password = "my-super-secret-password"; // Register a user - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); // Ask for a password reset try { - await app.emailPasswordAuth.callResetPasswordFunction(email, "my-new-password", "some-argument"); + await app.emailPasswordAuth.callResetPasswordFunction({ email, password: "my-new-password" }, "some-argument"); } catch (err) { // We expect this to throw, since password resets via functions fail with this app configuration expect(err).instanceOf(MongoDBRealmError); diff --git a/packages/realm-web-integration-tests/src/user.test.ts b/packages/realm-web-integration-tests/src/user.test.ts index 0216eee54a..11e5aac469 100644 --- a/packages/realm-web-integration-tests/src/user.test.ts +++ b/packages/realm-web-integration-tests/src/user.test.ts @@ -105,7 +105,7 @@ describe("User", () => { { const email = `dinesh-${nonce}@testing.mongodb.com`; const password = "v3ry-s3cret"; - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); const credentials = Credentials.emailPassword(email, password); // Log in const user1 = await app.logIn(credentials); @@ -127,7 +127,7 @@ describe("User", () => { { const email = `gilfoyle-${nonce}@testing.mongodb.com`; const password = "v3ry-s3cret"; - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); const credentials = Credentials.emailPassword(email, password); // Read out the device id generated by the previous user const storedDeviceId = app.storage.get("deviceId"); @@ -158,7 +158,7 @@ describe("User", () => { const nonce = now.getTime(); const email = `dinesh-${nonce}@testing.mongodb.com`; const password = "v3ry-s3cret"; - await app.emailPasswordAuth.registerUser(email, password); + await app.emailPasswordAuth.registerUser({ email, password }); const emailCredentials = Credentials.emailPassword(email, password); await user.linkCredentials(emailCredentials); expect(user.identities.length).equals(2); diff --git a/packages/realm-web/CHANGELOG.md b/packages/realm-web/CHANGELOG.md index 56e0013bbb..164af81928 100644 --- a/packages/realm-web/CHANGELOG.md +++ b/packages/realm-web/CHANGELOG.md @@ -1,3 +1,23 @@ +x.x.x Release notes (yyyy-MM-dd) +============================================================= + +### Breaking Changes +* None + +### Deprecations +* `EmailPasswordAuth` method calls using positional arguments are being deprecated in favour of using a single object dictionary argument. See "Examples of how to update to the new API" in the description of https://github.com/realm/realm-js/pull/4041 for examples of how to update each method call. + * The existing methods will be removed in the next major version. + * The existing methods will continue to work but will output a deprecation warning to the console in development mode when used, of the form: `Deprecation warning from Realm: resetPassword(password, token, token_id) is deprecated and will be removed in a future major release. Consider switching to resetPassword({ password, token, token_id })`. + +### Enhancements +* New consistent API for `EmailPasswordAuth` methods, using a single object dictionary rather than positional arguments, to fix inconsistencies and make usage clearer. The existing API is being deprecated (see above). ([#3943](https://github.com/realm/realm-js/issues/3943)) + +### Fixed +* New `EmailPasswordAuth` API (see Enhancements above) fixes `resetPassword` inconsistency between realm-web and realm. (fixes [#3723](https://github.com/realm/realm-js/issues/3723), since v.1.0.0) + +### Internal +* None + 1.4.0 Release notes (2021-10-18) ============================================================= @@ -64,16 +84,16 @@ * None 1.1.0 Release notes (2020-12-08) -============================================================= +============================================================= -### Breaking Changes -* None +### Breaking Changes +* None -### Enhancements -* Added support of OpenID Connect credential for the Google authentication provider. ([#3383](https://github.com/realm/realm-js/issues/3383)) +### Enhancements +* Added support of OpenID Connect credential for the Google authentication provider. ([#3383](https://github.com/realm/realm-js/issues/3383)) -### Fixed -* Fixed the type returned by `getApp` and `App.getApp`, such that an `app.currentUser` will match the `User` exported by the package. ([#3420](https://github.com/realm/realm-js/pull/3420), since v1.0.0-rc.1) +### Fixed +* Fixed the type returned by `getApp` and `App.getApp`, such that an `app.currentUser` will match the `User` exported by the package. ([#3420](https://github.com/realm/realm-js/pull/3420), since v1.0.0-rc.1) ### Internal * None diff --git a/packages/realm-web/package-lock.json b/packages/realm-web/package-lock.json index aca440298f..8d4ec82dc1 100644 --- a/packages/realm-web/package-lock.json +++ b/packages/realm-web/package-lock.json @@ -5,11 +5,13 @@ "requires": true, "packages": { "": { + "name": "realm-web", "version": "1.4.0", "license": "SEE LICENSE IN LICENSE", "dependencies": { "bson": "^4.2.0", "detect-browser": "^5.1.1", + "fs-extra": "^10.0.0", "js-base64": "^2.6.3" }, "devDependencies": { @@ -838,6 +840,19 @@ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, + "node_modules/fs-extra": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -921,6 +936,11 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/graceful-fs": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" + }, "node_modules/growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -1118,6 +1138,17 @@ "dev": true, "optional": true }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/level-blobs": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/level-blobs/-/level-blobs-0.1.7.tgz", @@ -1871,6 +1902,14 @@ "node": ">=4.2.0" } }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -2613,6 +2652,16 @@ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, + "fs-extra": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2681,6 +2730,11 @@ "path-is-absolute": "^1.0.0" } }, + "graceful-fs": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" + }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -2834,6 +2888,15 @@ "dev": true, "optional": true }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, "level-blobs": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/level-blobs/-/level-blobs-0.1.7.tgz", @@ -3499,6 +3562,11 @@ "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", "dev": true }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/packages/realm-web/package.json b/packages/realm-web/package.json index e5198a381b..cb20b1f76c 100644 --- a/packages/realm-web/package.json +++ b/packages/realm-web/package.json @@ -45,6 +45,7 @@ }, "license": "SEE LICENSE IN LICENSE", "dependencies": { + "@realm.io/common": "^0.1.1", "bson": "^4.2.0", "detect-browser": "^5.1.1", "js-base64": "^2.6.3" @@ -65,6 +66,7 @@ "@types/node": "^13.7.6", "abort-controller": "^3.0.0", "chai": "^4.2.0", + "fs-extra": "^10.0.0", "mocha": "^5.2.0", "node-fetch": "^2.6.0", "realm-network-transport": "^0.7.0", diff --git a/packages/realm-web/src/auth-providers/EmailPasswordAuth.ts b/packages/realm-web/src/auth-providers/EmailPasswordAuth.ts index 5b6c102048..41603f4801 100644 --- a/packages/realm-web/src/auth-providers/EmailPasswordAuth.ts +++ b/packages/realm-web/src/auth-providers/EmailPasswordAuth.ts @@ -17,6 +17,7 @@ //////////////////////////////////////////////////////////////////////////// import { Fetcher } from "../Fetcher"; +import { handleDeprecatedPositionalArgs } from "@realm.io/common"; /** @inheritdoc */ export class EmailPasswordAuth implements Realm.Auth.EmailPasswordAuth { @@ -35,72 +36,137 @@ export class EmailPasswordAuth implements Realm.Auth.EmailPasswordAuth { } /** @inheritdoc */ - async registerUser(email: string, password: string): Promise { + async registerUser(email: string, password: string): Promise; + async registerUser(userDetails: Realm.Auth.RegisterUserDetails): Promise; + async registerUser(...args: [string, string] | [Realm.Auth.RegisterUserDetails]): Promise { + const { argsObject: userDetails } = handleDeprecatedPositionalArgs( + args, + "registerUser", + ["email", "password"], + ); + const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).register().path, - body: { email, password }, + body: userDetails, }); } /** @inheritdoc */ - async confirmUser(token: string, tokenId: string): Promise { + async confirmUser(token: string, tokenId: string): Promise; + async confirmUser(tokenDetails: Realm.Auth.ConfirmUserDetails): Promise; + async confirmUser(...args: [string, string] | [Realm.Auth.ConfirmUserDetails]): Promise { + const { argsObject: tokenDetails } = handleDeprecatedPositionalArgs( + args, + "confirmUser", + ["token", "tokenId"], + ); + const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).confirm().path, - body: { token, tokenId }, + body: tokenDetails, }); } /** @inheritdoc */ - async resendConfirmationEmail(email: string): Promise { + async resendConfirmationEmail(email: string): Promise; + async resendConfirmationEmail(emailDetails: Realm.Auth.ResendConfirmationDetails): Promise; + async resendConfirmationEmail(...args: [string] | [Realm.Auth.ResendConfirmationDetails]): Promise { + const { argsObject: emailDetails } = handleDeprecatedPositionalArgs( + args, + "resendConfirmationEmail", + ["email"], + ); + const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).confirmSend().path, - body: { email }, + body: emailDetails, }); } /** @inheritdoc */ - async retryCustomConfirmation(email: string): Promise { + async retryCustomConfirmation(email: string): Promise; + async retryCustomConfirmation(emailDetails: Realm.Auth.RetryCustomConfirmationDetails): Promise; + async retryCustomConfirmation(...args: [string] | [Realm.Auth.RetryCustomConfirmationDetails]): Promise { + const { argsObject: emailDetails } = handleDeprecatedPositionalArgs( + args, + "retryCustomConfirmation", + ["email"], + ); + const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).confirmCall().path, - body: { email }, + body: emailDetails, }); } /** @inheritdoc */ - async resetPassword(token: string, tokenId: string, password: string): Promise { + async resetPassword(token: string, tokenId: string, password: string): Promise; + async resetPassword(resetDetails: Realm.Auth.ResetPasswordDetails): Promise; + async resetPassword(...args: [string, string, string] | [Realm.Auth.ResetPasswordDetails]): Promise { + const { argsObject: resetDetails } = handleDeprecatedPositionalArgs( + args, + "resetPassword", + ["token", "tokenId", "password"], + ); + const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).reset().path, - body: { token, tokenId, password }, + body: resetDetails, }); } /** @inheritdoc */ - async sendResetPasswordEmail(email: string): Promise { + async sendResetPasswordEmail(email: string): Promise; + async sendResetPasswordEmail(emailDetails: Realm.Auth.SendResetPasswordDetails): Promise; + async sendResetPasswordEmail(...args: [string] | [Realm.Auth.SendResetPasswordDetails]): Promise { + const { argsObject: emailDetails } = handleDeprecatedPositionalArgs( + args, + "sendResetPasswordEmail", + ["email"], + ); + const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).resetSend().path, - body: { email }, + body: emailDetails, }); } /** @inheritdoc */ - async callResetPasswordFunction(email: string, password: string, ...args: unknown[]): Promise { + async callResetPasswordFunction(email: string, password: string, ...args: unknown[]): Promise; + async callResetPasswordFunction( + resetDetails: Realm.Auth.CallResetPasswordFunctionDetails, + ...args: unknown[] + ): Promise; + async callResetPasswordFunction( + ...args: [string, string, ...unknown[]] | [Realm.Auth.CallResetPasswordFunctionDetails, ...unknown[]] + ): Promise { + const { + argsObject: resetDetails, + restArgs, + } = handleDeprecatedPositionalArgs( + args, + "callResetPasswordFunction", + ["email", "password"], + true, + ); + const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).resetCall().path, - body: { email, password, arguments: args }, + body: { ...resetDetails, arguments: restArgs }, }); } } diff --git a/packages/realm-web/src/dom/tsconfig.json b/packages/realm-web/src/dom/tsconfig.json index ecc8fbbea1..c81ea16f51 100644 --- a/packages/realm-web/src/dom/tsconfig.json +++ b/packages/realm-web/src/dom/tsconfig.json @@ -4,6 +4,7 @@ "noResolve": true, "types": [ "realm-network-transport", + "@realm.io/common", "js-base64", "bson", "buffer", diff --git a/packages/realm-web/src/node/tsconfig.json b/packages/realm-web/src/node/tsconfig.json index e41b865b51..a48e2f0fe0 100644 --- a/packages/realm-web/src/node/tsconfig.json +++ b/packages/realm-web/src/node/tsconfig.json @@ -4,6 +4,7 @@ "noResolve": false, "types": [ "realm-network-transport", + "@realm.io/common", "js-base64", "bson", "buffer", diff --git a/packages/realm-web/src/tests/EmailPasswordAuth.test.ts b/packages/realm-web/src/tests/EmailPasswordAuth.test.ts index be55641d37..74fe4fd3d0 100644 --- a/packages/realm-web/src/tests/EmailPasswordAuth.test.ts +++ b/packages/realm-web/src/tests/EmailPasswordAuth.test.ts @@ -43,7 +43,7 @@ describe("EmailPasswordAuth", () => { it("can register a user", async () => { // Make a request - await client.registerUser("gilfoyle@testing.mongodb.com", "s3cr3t"); + await client.registerUser({ email: "gilfoyle@testing.mongodb.com", password: "s3cr3t" }); // Expect something of the request expect(fetcher.requests).deep.equals([ { @@ -60,7 +60,7 @@ describe("EmailPasswordAuth", () => { it("can confirm a user", async () => { // Make a request - await client.confirmUser("token-value", "token-id-value"); + await client.confirmUser({ token: "token-value", tokenId: "token-id-value" }); // Expect something of the request expect(fetcher.requests).deep.equals([ { @@ -77,7 +77,7 @@ describe("EmailPasswordAuth", () => { it("can request a resend of confirmation", async () => { // Make a request - await client.resendConfirmationEmail("gilfoyle@testing.mongodb.com"); + await client.resendConfirmationEmail({ email: "gilfoyle@testing.mongodb.com" }); // Expect something of the request expect(fetcher.requests).deep.equals([ { @@ -93,7 +93,7 @@ describe("EmailPasswordAuth", () => { it("can request a retry of custom confirmation", async () => { // Make a request - await client.retryCustomConfirmation("gilfoyle@testing.mongodb.com"); + await client.retryCustomConfirmation({ email: "gilfoyle@testing.mongodb.com" }); // Expect something of the request expect(fetcher.requests).deep.equals([ { @@ -109,7 +109,7 @@ describe("EmailPasswordAuth", () => { it("can reset a password", async () => { // Make a request - await client.resetPassword("token-value", "token-id-value", "my-new-password"); + await client.resetPassword({ token: "token-value", tokenId: "token-id-value", password: "my-new-password" }); // Expect something of the request expect(fetcher.requests).deep.equals([ { @@ -127,7 +127,7 @@ describe("EmailPasswordAuth", () => { it("can request a password reset", async () => { // Make a request - await client.sendResetPasswordEmail("gilfoyle@testing.mongodb.com"); + await client.sendResetPasswordEmail({ email: "gilfoyle@testing.mongodb.com" }); // Expect something of the request expect(fetcher.requests).deep.equals([ { @@ -143,9 +143,12 @@ describe("EmailPasswordAuth", () => { it("can reset a password via a function", async () => { // Make a request - await client.callResetPasswordFunction("gilfoyle@testing.mongodb.com", "my-new-password", { - someObjectId: ObjectId.createFromHexString("5f84057629c14b540462cd1d"), - }); + await client.callResetPasswordFunction( + { email: "gilfoyle@testing.mongodb.com", password: "my-new-password" }, + { + someObjectId: ObjectId.createFromHexString("5f84057629c14b540462cd1d"), + }, + ); // Expect something of the request expect(fetcher.requests).deep.equals([ { diff --git a/packages/realm-web/tsconfig.json b/packages/realm-web/tsconfig.json index b0d2c98b7c..9d3aaf01bf 100644 --- a/packages/realm-web/tsconfig.json +++ b/packages/realm-web/tsconfig.json @@ -12,6 +12,7 @@ ], "types": [ "realm-network-transport", + "@realm.io/common", "realm", "js-base64", "bson", diff --git a/src/js_email_password_auth.hpp b/src/js_email_password_auth.hpp index 7518ee8188..1f3a791792 100644 --- a/src/js_email_password_auth.hpp +++ b/src/js_email_password_auth.hpp @@ -82,26 +82,28 @@ typename T::Object EmailPasswordAuthClass::create_instance(ContextType ctx, S template void EmailPasswordAuthClass::register_user(ContextType ctx, ObjectType this_object, Arguments& args, ReturnValue& return_value) { - args.validate_count(3); + args.validate_count(2); auto& client = *get_internal>(ctx, this_object); - auto email = Value::validated_to_string(ctx, args[0], "email"); - auto password = Value::validated_to_string(ctx, args[1], "password"); - auto callback = Value::validated_to_function(ctx, args[2], "callback"); + auto details = Value::validated_to_object(ctx, args[0], "userDetails"); + auto email = Object::validated_get_string(ctx, details, "email", "email"); + auto password = Object::validated_get_string(ctx, details, "password", "password"); + auto callback = Value::validated_to_function(ctx, args[1], "callback"); client.register_email(email, password, Function::wrap_void_callback(ctx, this_object, callback)); } template void EmailPasswordAuthClass::confirm_user(ContextType ctx, ObjectType this_object, Arguments& args, ReturnValue& return_value) { - args.validate_count(3); + args.validate_count(2); auto& client = *get_internal>(ctx, this_object); - auto token = Value::validated_to_string(ctx, args[0], "token"); - auto token_id = Value::validated_to_string(ctx, args[1], "token_id"); - auto callback = Value::validated_to_function(ctx, args[2], "callback"); + auto details = Value::validated_to_object(ctx, args[0], "tokenDetails"); + auto token = Object::validated_get_string(ctx, details, "token", "token"); + auto token_id = Object::validated_get_string(ctx, details, "tokenId", "tokenId"); + auto callback = Value::validated_to_function(ctx, args[1], "callback"); client.confirm_user(token, token_id, Function::wrap_void_callback(ctx, this_object, callback)); } @@ -112,7 +114,8 @@ void EmailPasswordAuthClass::resend_confirmation_email(ContextType ctx, Objec auto& client = *get_internal>(ctx, this_object); - auto email = Value::validated_to_string(ctx, args[0], "email"); + auto details = Value::validated_to_object(ctx, args[0], "emailDetails"); + auto email = Object::validated_get_string(ctx, details, "email", "email"); auto callback = Value::validated_to_function(ctx, args[1], "callback"); client.resend_confirmation_email(email, Function::wrap_void_callback(ctx, this_object, callback)); @@ -120,7 +123,7 @@ void EmailPasswordAuthClass::resend_confirmation_email(ContextType ctx, Objec /** * @brief Retry registering a user with custom confirmation logic - * + * * @param args Two arguments; [0]: email address of the user; [1]: callback to invoke upon completion * @param return_value void */ @@ -129,7 +132,9 @@ void EmailPasswordAuthClass::retry_custom_confirmation(ContextType ctx, Objec args.validate_count(2); auto &client = *get_internal>(ctx, this_object); - std::string const email = Value::validated_to_string(ctx, args[0], "email"); + + auto details = Value::validated_to_object(ctx, args[0], "emailDetails"); + auto email = Object::validated_get_string(ctx, details, "email", "email"); auto callback = Value::validated_to_function(ctx, args[1], "callback"); client.retry_custom_confirmation(email, Function::wrap_void_callback(ctx, this_object, callback)); @@ -141,7 +146,8 @@ void EmailPasswordAuthClass::send_reset_password_email(ContextType ctx, Objec auto& client = *get_internal>(ctx, this_object); - auto email = Value::validated_to_string(ctx, args[0], "email"); + auto details = Value::validated_to_object(ctx, args[0], "emailDetails"); + auto email = Object::validated_get_string(ctx, details, "email", "email"); auto callback = Value::validated_to_function(ctx, args[1], "callback"); client.send_reset_password_email(email, Function::wrap_void_callback(ctx, this_object, callback)); @@ -149,29 +155,31 @@ void EmailPasswordAuthClass::send_reset_password_email(ContextType ctx, Objec template void EmailPasswordAuthClass::reset_password(ContextType ctx, ObjectType this_object, Arguments& args, ReturnValue& return_value) { - args.validate_count(4); + args.validate_count(2); auto& client = *get_internal>(ctx, this_object); - auto password = Value::validated_to_string(ctx, args[0], "password"); - auto token = Value::validated_to_string(ctx, args[1], "token"); - auto token_id = Value::validated_to_string(ctx, args[2], "token_id"); - auto callback = Value::validated_to_function(ctx, args[3], "callback"); + auto details = Value::validated_to_object(ctx, args[0], "resetDetails"); + auto password = Object::validated_get_string(ctx, details, "password", "password"); + auto token = Object::validated_get_string(ctx, details, "token", "token"); + auto token_id = Object::validated_get_string(ctx, details, "tokenId", "tokenId"); + auto callback = Value::validated_to_function(ctx, args[1], "callback"); client.reset_password(password, token, token_id, Function::wrap_void_callback(ctx, this_object, callback)); } template void EmailPasswordAuthClass::call_reset_password_function(ContextType ctx, ObjectType this_object, Arguments& args, ReturnValue& return_value) { - args.validate_count(4); + args.validate_count(3); auto& client = *get_internal>(ctx, this_object); - auto email = Value::validated_to_string(ctx, args[0], "email"); - auto password = Value::validated_to_string(ctx, args[1], "password"); + auto details = Value::validated_to_object(ctx, args[0], "resetDetails"); + auto email = Object::validated_get_string(ctx, details, "email", "email"); + auto password = Object::validated_get_string(ctx, details, "password", "password"); auto stringified_ejson_args = Value::validated_to_string(ctx, args[2], "args"); auto callback = Value::validated_to_function(ctx, args[3], "callback"); - + auto bson_args = String::to_bson(stringified_ejson_args); client.call_reset_password_function(email, password, bson_args.operator const bson::BsonArray &(), Function::wrap_void_callback(ctx, this_object, callback)); diff --git a/tests/js/test-utils.js b/tests/js/test-utils.js index 3b9df28136..01369ea28f 100644 --- a/tests/js/test-utils.js +++ b/tests/js/test-utils.js @@ -46,11 +46,11 @@ async function getRegisteredEmailPassCredentials(app) { } const email = randomVerifiableEmail(); - const pass = "test1234567890"; + const password = "test1234567890"; // Create the user (see note in 'randomVerifiableEmail') - await app.emailPasswordAuth.registerUser(email, pass); + await app.emailPasswordAuth.registerUser({ email, password }); - return Realm.Credentials.emailPassword(email, pass); + return Realm.Credentials.emailPassword(email, password); } module.exports = { diff --git a/tests/js/user-tests.js b/tests/js/user-tests.js index d10f0d0a26..e5a03468dc 100644 --- a/tests/js/user-tests.js +++ b/tests/js/user-tests.js @@ -96,7 +96,7 @@ function randomPendingVerificationEmail() { async function registerAndLogInEmailUser(app) { const validEmail = randomVerifiableEmail(); const validPassword = "test1234567890"; - await app.emailPasswordAuth.registerUser(validEmail, validPassword); + await app.emailPasswordAuth.registerUser({ email: validEmail, password: validPassword }); let user = await app.logIn(Realm.Credentials.emailPassword(validEmail, validPassword)); assertIsUser(user); assertIsSameUser(user, app.currentUser); @@ -178,7 +178,7 @@ module.exports = { let err = await TestCase.assertThrowsAsync(async () => app.logIn(credentials)); TestCase.assertEqual(err.message, "invalid username/password"); // this user does not exist yet err = await TestCase.assertThrowsAsync(async () => - app.emailPasswordAuth.registerUser(invalidEmail, invalidPassword), + app.emailPasswordAuth.registerUser({ email: invalidEmail, password: invalidPassword }), ); TestCase.assertEqual(err.message, "password must be between 6 and 128 characters"); err = await TestCase.assertThrowsAsync(async () => app.logIn(credentials)); @@ -190,7 +190,7 @@ module.exports = { let err = await TestCase.assertThrowsAsync(async () => app.logIn(credentials)); TestCase.assertEqual(err.message, "invalid username/password"); // this user does not exist yet err = await TestCase.assertThrowsAsync(async () => - app.emailPasswordAuth.registerUser(invalidEmail, validPassword), + app.emailPasswordAuth.registerUser({ email: invalidEmail, password: validPassword }), ); TestCase.assertEqual(err.message, `failed to confirm user ${invalidEmail}`); err = await TestCase.assertThrowsAsync(async () => app.logIn(credentials)); @@ -202,7 +202,7 @@ module.exports = { let err = await TestCase.assertThrowsAsync(async () => app.logIn(credentials)); TestCase.assertEqual(err.message, "invalid username/password"); // this user does not exist yet err = await TestCase.assertThrowsAsync(async () => - app.emailPasswordAuth.registerUser(validEmail, invalidPassword), + app.emailPasswordAuth.registerUser({ email: validEmail, password: invalidPassword }), ); TestCase.assertEqual(err.message, "password must be between 6 and 128 characters"); err = await TestCase.assertThrowsAsync(async () => app.logIn(credentials)); @@ -213,7 +213,7 @@ module.exports = { let credentials = Realm.Credentials.emailPassword(validEmail, validPassword); let err = await TestCase.assertThrowsAsync(async () => app.logIn(credentials)); TestCase.assertEqual(err.message, "invalid username/password"); // this user does not exist yet - await app.emailPasswordAuth.registerUser(validEmail, validPassword); + await app.emailPasswordAuth.registerUser({ email: validEmail, password: validPassword }); let user = await app.logIn(credentials); assertIsUser(user); assertIsSameUser(user, app.currentUser); @@ -246,10 +246,10 @@ module.exports = { const validPassword = "password123456"; // we should be able to register our user as pending confirmation - await app.emailPasswordAuth.registerUser(pendingEmail, validPassword); + await app.emailPasswordAuth.registerUser({ email: pendingEmail, password: validPassword }); // we should be able to call the registration function again - await app.emailPasswordAuth.retryCustomConfirmation(pendingEmail); + await app.emailPasswordAuth.retryCustomConfirmation({ email: pendingEmail }); }, async testCustomUserConfirmationAlreadyConfirmed() { @@ -258,13 +258,17 @@ module.exports = { const validPassword = "password123456"; // make sure we can't call a confirmation function on a user that doesn't exist - let err = await TestCase.assertThrowsAsync(async () => app.emailPasswordAuth.retryCustomConfirmation(validEmail)); + let err = await TestCase.assertThrowsAsync(async () => + app.emailPasswordAuth.retryCustomConfirmation({ email: validEmail }), + ); TestCase.assertEqual(err.message, "user not found", "User should not exist yet."); - await app.emailPasswordAuth.registerUser(validEmail, validPassword); + await app.emailPasswordAuth.registerUser({ email: validEmail, password: validPassword }); // make sure we can't call a confirmation function on a user that is already verified - err = await TestCase.assertThrowsAsync(async () => app.emailPasswordAuth.retryCustomConfirmation(validEmail)); + err = await TestCase.assertThrowsAsync(async () => + app.emailPasswordAuth.retryCustomConfirmation({ email: validEmail }), + ); TestCase.assertEqual(err.message, "already confirmed", "User should already be confirmed."); }, diff --git a/tests/package-lock.json b/tests/package-lock.json index f0a433adb5..ab24ee39e8 100644 --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -32,10 +32,11 @@ }, "..": { "name": "realm", - "version": "10.6.2-beta.1", + "version": "10.9.1", "hasInstallScript": true, "license": "See the actual license in the file LICENSE", "dependencies": { + "@realm.io/common": "^0.1.0", "bindings": "^1.5.0", "bson": "4.4.1", "command-line-args": "^5.1.1", @@ -15601,6 +15602,7 @@ "version": "file:..", "requires": { "@react-native-community/eslint-config": "^3.0.0", + "@realm.io/common": "^0.1.0", "@types/node": "^4.9.1", "@typescript-eslint/eslint-plugin": "^4.28.3", "@typescript-eslint/parser": "^4.28.3", @@ -17925,7 +17927,8 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz", "integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==", - "dev": true + "dev": true, + "requires": {} }, "@octokit/plugin-rest-endpoint-methods": { "version": "5.3.1", @@ -18228,7 +18231,8 @@ } }, "@typescript-eslint/parser": { - "version": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", "integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==", "dev": true, "requires": { @@ -18372,7 +18376,8 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", - "dev": true + "dev": true, + "requires": {} }, "add-stream": { "version": "1.0.0", @@ -19985,7 +19990,8 @@ "dev": true }, "eslint": { - "version": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz", "integrity": "sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==", "dev": true, "requires": { @@ -20202,7 +20208,8 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz", "integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==", - "dev": true + "dev": true, + "requires": {} }, "eslint-plugin-jasmine": { "version": "4.1.2", @@ -20214,7 +20221,8 @@ "version": "22.4.1", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-22.4.1.tgz", "integrity": "sha512-gcLfn6P2PrFAVx3AobaOzlIEevpAEf9chTpFZz7bYfc7pz8XRv7vuKTIE4hxPKZSha6XWKKplDQ0x9Pq8xX2mg==", - "dev": true + "dev": true, + "requires": {} }, "eslint-plugin-jsdoc": { "version": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-23.1.0.tgz", @@ -20298,7 +20306,8 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz", "integrity": "sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ==", - "dev": true + "dev": true, + "requires": {} }, "eslint-plugin-react-native": { "version": "3.11.0", @@ -22713,7 +22722,8 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.3.0.tgz", "integrity": "sha512-/V1MnLL/rgJ3jkMWo84UR+K+jF1cxNG1a+KwqeXqTIJ+jtA8aWSHuigx8lTzauiIjBDbwF3NcWQMotd0Dm39jA==", - "dev": true + "dev": true, + "requires": {} }, "marked": { "version": "0.7.0", diff --git a/types/auth-providers.d.ts b/types/auth-providers.d.ts index b64f5ce40b..19a48ac101 100644 --- a/types/auth-providers.d.ts +++ b/types/auth-providers.d.ts @@ -28,6 +28,72 @@ declare namespace Realm { } namespace Auth { + /** + * Details for registering a user + */ + interface RegisterUserDetails { + /** The new user's email */ + email: string; + /** The new user's passsword */ + password: string; + } + + /** + * Details for confirming a user + */ + interface ConfirmUserDetails { + /** The token received */ + token: string; + /** The ID of the token received */ + tokenId: string; + } + + /** + * Details for resending a confirmation + */ + interface ResendConfirmationDetails { + /** The email associated to resend the confirmation to */ + email: string; + } + + /** + * Details for retrying a custom confirmation + */ + interface RetryCustomConfirmationDetails { + /** The email associated to resend the confirmation to */ + email: string; + } + + /** + * Details for resetting a password + */ + interface ResetPasswordDetails { + /** The token received */ + token: string; + /** The id of the token received */ + tokenId: string; + /** The new password */ + password: string; + } + + /** + * Details for sending a reset password email + */ + interface SendResetPasswordDetails { + /** The email to send the tokens to */ + email: string; + } + + /** + * Details for calling a custom reset password function + */ + interface CallResetPasswordFunctionDetails { + /** The email associated with the user */ + email: string; + /** The new password */ + password: string; + } + /** * Authentication provider where users identify using email and password. */ @@ -35,57 +101,121 @@ declare namespace Realm { /** * Register a new user. * - * @param email The new users email. - * @param password the new users passsword. + * @param userDetails The new user's email and password details + * @since v10.10.0 + */ + registerUser(userDetails: RegisterUserDetails): Promise; + + /** + * Register a new user. + * + * @param email the new user's email. + * @param password the new user's passsword. + * @deprecated Use `registerUser(userDetails)` instead */ registerUser(email: string, password: string): Promise; + /** + * Confirm a user by the token received. + * + * @param tokenDetails The received token and ID details + * @since v10.10.0 + */ + confirmUser(tokenDetails: ConfirmUserDetails): Promise; + /** * Confirm a user by the token received. * * @param token the token received. * @param tokenId the id of the token received. + * @deprecated Use `confirmUser(tokenDetails)` instead */ confirmUser(token: string, tokenId: string): Promise; + /** + * Resend the confirmation email. + * + * @param emailDetails The associated email details + * @since v10.10.0 + */ + resendConfirmationEmail(emailDetails: ResendConfirmationDetails): Promise; + /** * Resend the confirmation email. * * @param email the email associated to resend the confirmation to. + * @deprecated Use `resendConfirmationEmail(emailDetails)` instead */ resendConfirmationEmail(email: string): Promise; + /** + * Rerun the custom confirmation function. + * + * @param emailDetails The associated email details + * @since v10.10.0 + */ + retryCustomConfirmation(emailDetails: RetryCustomConfirmationDetails): Promise; + /** * Rerun the custom confirmation function. * * @param email the email associated to resend the confirmation to. + * @deprecated Use `retryCustomConfirmation(emailDetails)` instead */ retryCustomConfirmation(email: string): Promise; + /** + * Complete resetting the password + * + * @param resetDetails The token and password details for the reset + * @since v10.10.0 + */ + resetPassword(resetDetails: ResetPasswordDetails): Promise; + /** * Complete resetting the password * * @param token the token received. * @param tokenId the id of the token received. * @param password the new password. + * @deprecated Use `resetPassword(resetDetails)` instead */ resetPassword(token: string, tokenId: string, password: string): Promise; + /** + * Send an email with tokens to reset the password. + * + * @param emailDetails The email details to send the reset to + * @since v10.10.0 + */ + sendResetPasswordEmail(emailDetails: SendResetPasswordDetails): Promise; + /** * Send an email with tokens to reset the password. * * @param email the email to send the tokens to. + * @deprecated Use `sendResetPasswordEmail(emailDetails)` instead */ sendResetPasswordEmail(email: string): Promise; + /** + * Call the custom function to reset the password. + * + * @param resetDetails The email and password details to reset + * @param args One or more arguments to pass to the function. + * @since v10.10.0 + */ + callResetPasswordFunction(resetDetails: CallResetPasswordFunctionDetails, ...args: unknown[]): Promise; + /** * Call the custom function to reset the password. * * @param email the email associated with the user. * @param password the new password. * @param args one or more arguments to pass to the function. + * @deprecated Use `callResetPasswordFunction(resetDetails, ...args)` instead */ - callResetPasswordFunction(email: string, password: string, ...args: any[]): Promise; + callResetPasswordFunction(email: string, password: string, ...args: unknown[]): Promise; } /** diff --git a/types/index.d.ts b/types/index.d.ts index 974f33b457..eb5ef6d6d6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -748,6 +748,9 @@ declare class Realm { * @returns {T | undefined} */ objectForPrimaryKey(type: {new(...arg: any[]): T; }, key: Realm.PrimaryKey): T | undefined; + + // Combined definitions + objectForPrimaryKey(type: string | {new(...arg: any[]): T; }, key: Realm.PrimaryKey): (T & Realm.Object) | undefined; /** * @param {string} type @@ -761,6 +764,9 @@ declare class Realm { */ objects(type: {new(...arg: any[]): T; }): Realm.Results; + // Combined definitions + objects(type: string | {new(...arg: any[]): T; }): Realm.Results; + /** * @param {string} name * @param {()=>void} callback